1@c Copyright (C) 1988-2019 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-2019 Free Software Foundation, Inc.
12
13Permission is granted to copy, distribute and/or modify this document
14under the terms of the GNU Free Documentation License, Version 1.3 or
15any later version published by the Free Software Foundation; with the
16Invariant Sections being ``GNU General Public License'' and ``Funding
17Free Software'', the Front-Cover texts being (a) (see below), and with
18the Back-Cover Texts being (b) (see below).  A copy of the license is
19included in the gfdl(7) man page.
20
21(a) The FSF's Front-Cover Text is:
22
23     A GNU Manual
24
25(b) The FSF's Back-Cover Text is:
26
27     You have freedom to copy and modify this GNU Manual, like GNU
28     software.  Copies published by the Free Software Foundation raise
29     funds for GNU development.
30@c man end
31@c Set file name and title for the man page.
32@setfilename gcc
33@settitle GNU project C and C++ compiler
34@c man begin SYNOPSIS
35gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36    [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37    [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38    [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39    [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40    [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41    [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
42
43Only the most useful options are listed here; see below for the
44remainder.  @command{g++} accepts mostly the same options as @command{gcc}.
45@c man end
46@c man begin SEEALSO
47gpl(7), gfdl(7), fsf-funding(7),
48cpp(1), gcov(1), as(1), ld(1), gdb(1), dbx(1)
49and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50@file{ld}, @file{binutils} and @file{gdb}.
51@c man end
52@c man begin BUGS
53For instructions on reporting bugs, see
54@w{@value{BUGURL}}.
55@c man end
56@c man begin AUTHOR
57See the Info entry for @command{gcc}, or
58@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59for contributors to GCC@.
60@c man end
61@end ignore
62
63@node Invoking GCC
64@chapter GCC Command Options
65@cindex GCC command options
66@cindex command options
67@cindex options, GCC command
68
69@c man begin DESCRIPTION
70When you invoke GCC, it normally does preprocessing, compilation,
71assembly and linking.  The ``overall options'' allow you to stop this
72process at an intermediate stage.  For example, the @option{-c} option
73says not to run the linker.  Then the output consists of object files
74output by the assembler.
75@xref{Overall Options,,Options Controlling the Kind of Output}.
76
77Other options are passed on to one or more stages of processing.  Some options
78control the preprocessor and others the compiler itself.  Yet other
79options control the assembler and linker; most of these are not
80documented here, since you rarely need to use any of them.
81
82@cindex C compilation options
83Most of the command-line options that you can use with GCC are useful
84for C programs; when an option is only useful with another language
85(usually C++), the explanation says so explicitly.  If the description
86for a particular option does not mention a source language, you can use
87that option with all supported languages.
88
89@cindex cross compiling
90@cindex specifying machine version
91@cindex specifying compiler version and target machine
92@cindex compiler version, specifying
93@cindex target machine, specifying
94The usual way to run GCC is to run the executable called @command{gcc}, or
95@command{@var{machine}-gcc} when cross-compiling, or
96@command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97When you compile C++ programs, you should invoke GCC as @command{g++}
98instead.  @xref{Invoking G++,,Compiling C++ Programs},
99for information about the differences in behavior between @command{gcc}
100and @code{g++} when compiling C++ programs.
101
102@cindex grouping options
103@cindex options, grouping
104The @command{gcc} program accepts options and file names as operands.  Many
105options have multi-letter names; therefore multiple single-letter options
106may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107-v}}.
108
109@cindex order of options
110@cindex options, order
111You can mix options and other arguments.  For the most part, the order
112you use doesn't matter.  Order does matter when you use several
113options of the same kind; for example, if you specify @option{-L} more
114than once, the directories are searched in the order specified.  Also,
115the placement of the @option{-l} option is significant.
116
117Many options have long names starting with @samp{-f} or with
118@samp{-W}---for example,
119@option{-fmove-loop-invariants}, @option{-Wformat} and so on.  Most of
120these have both positive and negative forms; the negative form of
121@option{-ffoo} is @option{-fno-foo}.  This manual documents
122only one of these two forms, whichever one is not the default.
123
124Some options take one or more arguments typically separated either
125by a space or by the equals sign (@samp{=}) from the option name.
126Unless documented otherwise, an argument can be either numeric or
127a string.  Numeric arguments must typically be small unsigned decimal
128or hexadecimal integers.  Hexadecimal arguments must begin with
129the @samp{0x} prefix.  Arguments to options that specify a size
130threshold of some sort may be arbitrarily large decimal or hexadecimal
131integers followed by a byte size suffix designating a multiple of bytes
132such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
133@code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and
134@code{GiB} for gigabyte and gigibyte, and so on.  Such arguments are
135designated by @var{byte-size} in the following text.  Refer to the NIST,
136IEC, and other relevant national and international standards for the full
137listing and explanation of the binary and decimal byte size prefixes.
138
139@c man end
140
141@xref{Option Index}, for an index to GCC's options.
142
143@menu
144* Option Summary::      Brief list of all options, without explanations.
145* Overall Options::     Controlling the kind of output:
146                        an executable, object files, assembler files,
147                        or preprocessed source.
148* Invoking G++::        Compiling C++ programs.
149* C Dialect Options::   Controlling the variant of C language compiled.
150* C++ Dialect Options:: Variations on C++.
151* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152                        and Objective-C++.
153* Diagnostic Message Formatting Options:: Controlling how diagnostics should
154                        be formatted.
155* Warning Options::     How picky should the compiler be?
156* Debugging Options::   Producing debuggable code.
157* Optimize Options::    How much optimization?
158* Instrumentation Options:: Enabling profiling and extra run-time error checking.
159* Preprocessor Options:: Controlling header files and macro definitions.
160                         Also, getting dependency information for Make.
161* Assembler Options::   Passing options to the assembler.
162* Link Options::        Specifying libraries and so on.
163* Directory Options::   Where to find header files and libraries.
164                        Where to find the compiler executable files.
165* Code Gen Options::    Specifying conventions for function calls, data layout
166                        and register usage.
167* Developer Options::   Printing GCC configuration info, statistics, and
168                        debugging dumps.
169* Submodel Options::    Target-specific options, such as compiling for a
170                        specific processor variant.
171* Spec Files::          How to pass switches to sub-processes.
172* Environment Variables:: Env vars that affect GCC.
173* Precompiled Headers:: Compiling a header once, and using it many times.
174@end menu
175
176@c man begin OPTIONS
177
178@node Option Summary
179@section Option Summary
180
181Here is a summary of all the options, grouped by type.  Explanations are
182in the following sections.
183
184@table @emph
185@item Overall Options
186@xref{Overall Options,,Options Controlling the Kind of Output}.
187@gccoptlist{-c  -S  -E  -o @var{file}  -x @var{language}  @gol
188-v  -###  --help@r{[}=@var{class}@r{[},@dots{}@r{]]}  --target-help  --version @gol
189-pass-exit-codes  -pipe  -specs=@var{file}  -wrapper  @gol
190@@@var{file}  -ffile-prefix-map=@var{old}=@var{new}  @gol
191-fplugin=@var{file}  -fplugin-arg-@var{name}=@var{arg}  @gol
192-fdump-ada-spec@r{[}-slim@r{]}  -fada-spec-parent=@var{unit}  -fdump-go-spec=@var{file}}
193
194@item C Language Options
195@xref{C Dialect Options,,Options Controlling C Dialect}.
196@gccoptlist{-ansi  -std=@var{standard}  -fgnu89-inline @gol
197-fpermitted-flt-eval-methods=@var{standard} @gol
198-aux-info @var{filename}  -fallow-parameterless-variadic-functions @gol
199-fno-asm  -fno-builtin  -fno-builtin-@var{function}  -fgimple@gol
200-fhosted  -ffreestanding @gol
201-fopenacc  -fopenacc-dim=@var{geom} @gol
202-fopenmp  -fopenmp-simd @gol
203-fms-extensions  -fplan9-extensions  -fsso-struct=@var{endianness} @gol
204-fallow-single-precision  -fcond-mismatch  -flax-vector-conversions @gol
205-fsigned-bitfields  -fsigned-char @gol
206-funsigned-bitfields  -funsigned-char}
207
208@item C++ Language Options
209@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
210@gccoptlist{-fabi-version=@var{n}  -fno-access-control @gol
211-faligned-new=@var{n}  -fargs-in-order=@var{n}  -fchar8_t  -fcheck-new @gol
212-fconstexpr-depth=@var{n}  -fconstexpr-loop-limit=@var{n} @gol
213-fconstexpr-ops-limit=@var{n} -fno-elide-constructors @gol
214-fno-enforce-eh-specs @gol
215-fno-gnu-keywords @gol
216-fno-implicit-templates @gol
217-fno-implicit-inline-templates @gol
218-fno-implement-inlines  -fms-extensions @gol
219-fnew-inheriting-ctors @gol
220-fnew-ttp-matching @gol
221-fno-nonansi-builtins  -fnothrow-opt  -fno-operator-names @gol
222-fno-optional-diags  -fpermissive @gol
223-fno-pretty-templates @gol
224-frepo  -fno-rtti  -fsized-deallocation @gol
225-ftemplate-backtrace-limit=@var{n} @gol
226-ftemplate-depth=@var{n} @gol
227-fno-threadsafe-statics  -fuse-cxa-atexit @gol
228-fno-weak  -nostdinc++ @gol
229-fvisibility-inlines-hidden @gol
230-fvisibility-ms-compat @gol
231-fext-numeric-literals @gol
232-Wabi=@var{n}  -Wabi-tag  -Wconversion-null  -Wctor-dtor-privacy @gol
233-Wdelete-non-virtual-dtor  -Wdeprecated-copy  -Wdeprecated-copy-dtor @gol
234-Wliteral-suffix @gol
235-Wmultiple-inheritance  -Wno-init-list-lifetime @gol
236-Wnamespaces  -Wnarrowing @gol
237-Wpessimizing-move  -Wredundant-move @gol
238-Wnoexcept  -Wnoexcept-type  -Wclass-memaccess @gol
239-Wnon-virtual-dtor  -Wreorder  -Wregister @gol
240-Weffc++  -Wstrict-null-sentinel  -Wtemplates @gol
241-Wno-non-template-friend  -Wold-style-cast @gol
242-Woverloaded-virtual  -Wno-pmf-conversions @gol
243-Wno-class-conversion  -Wno-terminate @gol
244-Wsign-promo  -Wvirtual-inheritance}
245
246@item Objective-C and Objective-C++ Language Options
247@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
248Objective-C and Objective-C++ Dialects}.
249@gccoptlist{-fconstant-string-class=@var{class-name} @gol
250-fgnu-runtime  -fnext-runtime @gol
251-fno-nil-receivers @gol
252-fobjc-abi-version=@var{n} @gol
253-fobjc-call-cxx-cdtors @gol
254-fobjc-direct-dispatch @gol
255-fobjc-exceptions @gol
256-fobjc-gc @gol
257-fobjc-nilcheck @gol
258-fobjc-std=objc1 @gol
259-fno-local-ivars @gol
260-fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
261-freplace-objc-classes @gol
262-fzero-link @gol
263-gen-decls @gol
264-Wassign-intercept @gol
265-Wno-protocol  -Wselector @gol
266-Wstrict-selector-match @gol
267-Wundeclared-selector}
268
269@item Diagnostic Message Formatting Options
270@xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
271@gccoptlist{-fmessage-length=@var{n}  @gol
272-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}  @gol
273-fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]}  @gol
274-fdiagnostics-format=@r{[}text@r{|}json@r{]}  @gol
275-fno-diagnostics-show-option  -fno-diagnostics-show-caret @gol
276-fno-diagnostics-show-labels  -fno-diagnostics-show-line-numbers @gol
277-fdiagnostics-minimum-margin-width=@var{width} @gol
278-fdiagnostics-parseable-fixits  -fdiagnostics-generate-patch @gol
279-fdiagnostics-show-template-tree  -fno-elide-type @gol
280-fno-show-column}
281
282@item Warning Options
283@xref{Warning Options,,Options to Request or Suppress Warnings}.
284@gccoptlist{-fsyntax-only  -fmax-errors=@var{n}  -Wpedantic @gol
285-pedantic-errors @gol
286-w  -Wextra  -Wall  -Waddress  -Waddress-of-packed-member @gol
287-Waggregate-return  -Waligned-new @gol
288-Walloc-zero  -Walloc-size-larger-than=@var{byte-size} @gol
289-Walloca  -Walloca-larger-than=@var{byte-size} @gol
290-Wno-aggressive-loop-optimizations  -Warray-bounds  -Warray-bounds=@var{n} @gol
291-Wno-attributes  -Wattribute-alias=@var{n}  @gol
292-Wbool-compare  -Wbool-operation @gol
293-Wno-builtin-declaration-mismatch @gol
294-Wno-builtin-macro-redefined  -Wc90-c99-compat  -Wc99-c11-compat @gol
295-Wc11-c2x-compat @gol
296-Wc++-compat  -Wc++11-compat  -Wc++14-compat  -Wc++17-compat  @gol
297-Wcast-align  -Wcast-align=strict  -Wcast-function-type  -Wcast-qual  @gol
298-Wchar-subscripts  -Wcatch-value  -Wcatch-value=@var{n} @gol
299-Wclobbered  -Wcomment  -Wconditionally-supported @gol
300-Wconversion  -Wcoverage-mismatch  -Wno-cpp  -Wdangling-else  -Wdate-time @gol
301-Wdelete-incomplete @gol
302-Wno-attribute-warning @gol
303-Wno-deprecated  -Wno-deprecated-declarations  -Wno-designated-init @gol
304-Wdisabled-optimization @gol
305-Wno-discarded-qualifiers  -Wno-discarded-array-qualifiers @gol
306-Wno-div-by-zero  -Wdouble-promotion @gol
307-Wduplicated-branches  -Wduplicated-cond @gol
308-Wempty-body  -Wenum-compare  -Wno-endif-labels  -Wexpansion-to-defined @gol
309-Werror  -Werror=*  -Wextra-semi  -Wfatal-errors @gol
310-Wfloat-equal  -Wformat  -Wformat=2 @gol
311-Wno-format-contains-nul  -Wno-format-extra-args  @gol
312-Wformat-nonliteral  -Wformat-overflow=@var{n} @gol
313-Wformat-security  -Wformat-signedness  -Wformat-truncation=@var{n} @gol
314-Wformat-y2k  -Wframe-address @gol
315-Wframe-larger-than=@var{byte-size}  -Wno-free-nonheap-object @gol
316-Wjump-misses-init @gol
317-Whsa  -Wif-not-aligned @gol
318-Wignored-qualifiers  -Wignored-attributes  -Wincompatible-pointer-types @gol
319-Wimplicit  -Wimplicit-fallthrough  -Wimplicit-fallthrough=@var{n} @gol
320-Wimplicit-function-declaration  -Wimplicit-int @gol
321-Winit-self  -Winline  -Wno-int-conversion  -Wint-in-bool-context @gol
322-Wno-int-to-pointer-cast  -Winvalid-memory-model  -Wno-invalid-offsetof @gol
323-Winvalid-pch  -Wlarger-than=@var{byte-size} @gol
324-Wlogical-op  -Wlogical-not-parentheses  -Wlong-long @gol
325-Wmain  -Wmaybe-uninitialized  -Wmemset-elt-size  -Wmemset-transposed-args @gol
326-Wmisleading-indentation  -Wmissing-attributes  -Wmissing-braces @gol
327-Wmissing-field-initializers  -Wmissing-format-attribute @gol
328-Wmissing-include-dirs  -Wmissing-noreturn  -Wmissing-profile @gol
329-Wno-multichar  -Wmultistatement-macros  -Wnonnull  -Wnonnull-compare @gol
330-Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
331-Wnull-dereference  -Wodr  -Wno-overflow  -Wopenmp-simd  @gol
332-Woverride-init-side-effects  -Woverlength-strings @gol
333-Wpacked  -Wpacked-bitfield-compat -Wpacked-not-aligned  -Wpadded @gol
334-Wparentheses  -Wno-pedantic-ms-format @gol
335-Wplacement-new  -Wplacement-new=@var{n} @gol
336-Wpointer-arith  -Wpointer-compare  -Wno-pointer-to-int-cast @gol
337-Wno-pragmas  -Wno-prio-ctor-dtor  -Wredundant-decls @gol
338-Wrestrict  -Wno-return-local-addr @gol
339-Wreturn-type  -Wsequence-point  -Wshadow  -Wno-shadow-ivar @gol
340-Wshadow=global,  -Wshadow=local,  -Wshadow=compatible-local @gol
341-Wshift-overflow  -Wshift-overflow=@var{n} @gol
342-Wshift-count-negative  -Wshift-count-overflow  -Wshift-negative-value @gol
343-Wsign-compare  -Wsign-conversion  -Wfloat-conversion @gol
344-Wno-scalar-storage-order  -Wsizeof-pointer-div @gol
345-Wsizeof-pointer-memaccess  -Wsizeof-array-argument @gol
346-Wstack-protector  -Wstack-usage=@var{byte-size}  -Wstrict-aliasing @gol
347-Wstrict-aliasing=n  -Wstrict-overflow  -Wstrict-overflow=@var{n} @gol
348-Wstringop-overflow=@var{n}  -Wstringop-truncation  -Wsubobject-linkage @gol
349-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
350-Wsuggest-final-types @gol  -Wsuggest-final-methods  -Wsuggest-override @gol
351-Wswitch  -Wswitch-bool  -Wswitch-default  -Wswitch-enum @gol
352-Wswitch-unreachable  -Wsync-nand @gol
353-Wsystem-headers  -Wtautological-compare  -Wtrampolines  -Wtrigraphs @gol
354-Wtype-limits  -Wundef @gol
355-Wuninitialized  -Wunknown-pragmas @gol
356-Wunsuffixed-float-constants  -Wunused  -Wunused-function @gol
357-Wunused-label  -Wunused-local-typedefs  -Wunused-macros @gol
358-Wunused-parameter  -Wno-unused-result @gol
359-Wunused-value  -Wunused-variable @gol
360-Wunused-const-variable  -Wunused-const-variable=@var{n} @gol
361-Wunused-but-set-parameter  -Wunused-but-set-variable @gol
362-Wuseless-cast  -Wvariadic-macros  -Wvector-operation-performance @gol
363-Wvla  -Wvla-larger-than=@var{byte-size}  -Wvolatile-register-var @gol
364-Wwrite-strings @gol
365-Wzero-as-null-pointer-constant}
366
367@item C and Objective-C-only Warning Options
368@gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
369-Wmissing-parameter-type  -Wmissing-prototypes  -Wnested-externs @gol
370-Wold-style-declaration  -Wold-style-definition @gol
371-Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion @gol
372-Wdeclaration-after-statement  -Wpointer-sign}
373
374@item Debugging Options
375@xref{Debugging Options,,Options for Debugging Your Program}.
376@gccoptlist{-g  -g@var{level}  -gdwarf  -gdwarf-@var{version} @gol
377-ggdb  -grecord-gcc-switches  -gno-record-gcc-switches @gol
378-gstabs  -gstabs+  -gstrict-dwarf  -gno-strict-dwarf @gol
379-gas-loc-support  -gno-as-loc-support @gol
380-gas-locview-support  -gno-as-locview-support @gol
381-gcolumn-info  -gno-column-info @gol
382-gstatement-frontiers  -gno-statement-frontiers @gol
383-gvariable-location-views  -gno-variable-location-views @gol
384-ginternal-reset-location-views  -gno-internal-reset-location-views @gol
385-ginline-points  -gno-inline-points @gol
386-gvms  -gxcoff  -gxcoff+  -gz@r{[}=@var{type}@r{]} @gol
387-gsplit-dwarf  -gdescribe-dies  -gno-describe-dies @gol
388-fdebug-prefix-map=@var{old}=@var{new}  -fdebug-types-section @gol
389-fno-eliminate-unused-debug-types @gol
390-femit-struct-debug-baseonly  -femit-struct-debug-reduced @gol
391-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
392-feliminate-unused-debug-symbols  -femit-class-debug-always @gol
393-fno-merge-debug-strings  -fno-dwarf2-cfi-asm @gol
394-fvar-tracking  -fvar-tracking-assignments}
395
396@item Optimization Options
397@xref{Optimize Options,,Options that Control Optimization}.
398@gccoptlist{-faggressive-loop-optimizations @gol
399-falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
400-falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
401-falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
402-falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
403-fassociative-math  -fauto-profile  -fauto-profile[=@var{path}] @gol
404-fauto-inc-dec  -fbranch-probabilities @gol
405-fbranch-target-load-optimize  -fbranch-target-load-optimize2 @gol
406-fbtr-bb-exclusive  -fcaller-saves @gol
407-fcombine-stack-adjustments  -fconserve-stack @gol
408-fcompare-elim  -fcprop-registers  -fcrossjumping @gol
409-fcse-follow-jumps  -fcse-skip-blocks  -fcx-fortran-rules @gol
410-fcx-limited-range @gol
411-fdata-sections  -fdce  -fdelayed-branch @gol
412-fdelete-null-pointer-checks  -fdevirtualize  -fdevirtualize-speculatively @gol
413-fdevirtualize-at-ltrans  -fdse @gol
414-fearly-inlining  -fipa-sra  -fexpensive-optimizations  -ffat-lto-objects @gol
415-ffast-math  -ffinite-math-only  -ffloat-store  -fexcess-precision=@var{style} @gol
416-fforward-propagate  -ffp-contract=@var{style}  -ffunction-sections @gol
417-fgcse  -fgcse-after-reload  -fgcse-las  -fgcse-lm  -fgraphite-identity @gol
418-fgcse-sm  -fhoist-adjacent-loads  -fif-conversion @gol
419-fif-conversion2  -findirect-inlining @gol
420-finline-functions  -finline-functions-called-once  -finline-limit=@var{n} @gol
421-finline-small-functions  -fipa-cp  -fipa-cp-clone @gol
422-fipa-bit-cp  -fipa-vrp  -fipa-pta  -fipa-profile  -fipa-pure-const @gol
423-fipa-reference  -fipa-reference-addressable @gol
424-fipa-stack-alignment  -fipa-icf  -fira-algorithm=@var{algorithm} @gol
425-flive-patching=@var{level} @gol
426-fira-region=@var{region}  -fira-hoist-pressure @gol
427-fira-loop-pressure  -fno-ira-share-save-slots @gol
428-fno-ira-share-spill-slots @gol
429-fisolate-erroneous-paths-dereference  -fisolate-erroneous-paths-attribute @gol
430-fivopts  -fkeep-inline-functions  -fkeep-static-functions @gol
431-fkeep-static-consts  -flimit-function-alignment  -flive-range-shrinkage @gol
432-floop-block  -floop-interchange  -floop-strip-mine @gol
433-floop-unroll-and-jam  -floop-nest-optimize @gol
434-floop-parallelize-all  -flra-remat  -flto  -flto-compression-level @gol
435-flto-partition=@var{alg}  -fmerge-all-constants @gol
436-fmerge-constants  -fmodulo-sched  -fmodulo-sched-allow-regmoves @gol
437-fmove-loop-invariants  -fno-branch-count-reg @gol
438-fno-defer-pop  -fno-fp-int-builtin-inexact  -fno-function-cse @gol
439-fno-guess-branch-probability  -fno-inline  -fno-math-errno  -fno-peephole @gol
440-fno-peephole2  -fno-printf-return-value  -fno-sched-interblock @gol
441-fno-sched-spec  -fno-signed-zeros @gol
442-fno-toplevel-reorder  -fno-trapping-math  -fno-zero-initialized-in-bss @gol
443-fomit-frame-pointer  -foptimize-sibling-calls @gol
444-fpartial-inlining  -fpeel-loops  -fpredictive-commoning @gol
445-fprefetch-loop-arrays @gol
446-fprofile-correction @gol
447-fprofile-use  -fprofile-use=@var{path}  -fprofile-values @gol
448-fprofile-reorder-functions @gol
449-freciprocal-math  -free  -frename-registers  -freorder-blocks @gol
450-freorder-blocks-algorithm=@var{algorithm} @gol
451-freorder-blocks-and-partition  -freorder-functions @gol
452-frerun-cse-after-loop  -freschedule-modulo-scheduled-loops @gol
453-frounding-math  -fsave-optimization-record @gol
454-fsched2-use-superblocks  -fsched-pressure @gol
455-fsched-spec-load  -fsched-spec-load-dangerous @gol
456-fsched-stalled-insns-dep[=@var{n}]  -fsched-stalled-insns[=@var{n}] @gol
457-fsched-group-heuristic  -fsched-critical-path-heuristic @gol
458-fsched-spec-insn-heuristic  -fsched-rank-heuristic @gol
459-fsched-last-insn-heuristic  -fsched-dep-count-heuristic @gol
460-fschedule-fusion @gol
461-fschedule-insns  -fschedule-insns2  -fsection-anchors @gol
462-fselective-scheduling  -fselective-scheduling2 @gol
463-fsel-sched-pipelining  -fsel-sched-pipelining-outer-loops @gol
464-fsemantic-interposition  -fshrink-wrap  -fshrink-wrap-separate @gol
465-fsignaling-nans @gol
466-fsingle-precision-constant  -fsplit-ivs-in-unroller  -fsplit-loops@gol
467-fsplit-paths @gol
468-fsplit-wide-types  -fssa-backprop  -fssa-phiopt @gol
469-fstdarg-opt  -fstore-merging  -fstrict-aliasing @gol
470-fthread-jumps  -ftracer  -ftree-bit-ccp @gol
471-ftree-builtin-call-dce  -ftree-ccp  -ftree-ch @gol
472-ftree-coalesce-vars  -ftree-copy-prop  -ftree-dce  -ftree-dominator-opts @gol
473-ftree-dse  -ftree-forwprop  -ftree-fre  -fcode-hoisting @gol
474-ftree-loop-if-convert  -ftree-loop-im @gol
475-ftree-phiprop  -ftree-loop-distribution  -ftree-loop-distribute-patterns @gol
476-ftree-loop-ivcanon  -ftree-loop-linear  -ftree-loop-optimize @gol
477-ftree-loop-vectorize @gol
478-ftree-parallelize-loops=@var{n}  -ftree-pre  -ftree-partial-pre  -ftree-pta @gol
479-ftree-reassoc  -ftree-scev-cprop  -ftree-sink  -ftree-slsr  -ftree-sra @gol
480-ftree-switch-conversion  -ftree-tail-merge @gol
481-ftree-ter  -ftree-vectorize  -ftree-vrp  -funconstrained-commons @gol
482-funit-at-a-time  -funroll-all-loops  -funroll-loops @gol
483-funsafe-math-optimizations  -funswitch-loops @gol
484-fipa-ra  -fvariable-expansion-in-unroller  -fvect-cost-model  -fvpt @gol
485-fweb  -fwhole-program  -fwpa  -fuse-linker-plugin @gol
486--param @var{name}=@var{value}
487-O  -O0  -O1  -O2  -O3  -Os  -Ofast  -Og}
488
489@item Program Instrumentation Options
490@xref{Instrumentation Options,,Program Instrumentation Options}.
491@gccoptlist{-p  -pg  -fprofile-arcs  --coverage  -ftest-coverage @gol
492-fprofile-abs-path @gol
493-fprofile-dir=@var{path}  -fprofile-generate  -fprofile-generate=@var{path} @gol
494-fprofile-update=@var{method}  -fprofile-filter-files=@var{regex} @gol
495-fprofile-exclude-files=@var{regex} @gol
496-fsanitize=@var{style}  -fsanitize-recover  -fsanitize-recover=@var{style} @gol
497-fasan-shadow-offset=@var{number}  -fsanitize-sections=@var{s1},@var{s2},... @gol
498-fsanitize-undefined-trap-on-error  -fbounds-check @gol
499-fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
500-fstack-protector  -fstack-protector-all  -fstack-protector-strong @gol
501-fstack-protector-explicit  -fstack-check @gol
502-fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
503-fno-stack-limit  -fsplit-stack @gol
504-fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
505-fvtv-counts  -fvtv-debug @gol
506-finstrument-functions @gol
507-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
508-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
509
510@item Preprocessor Options
511@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
512@gccoptlist{-A@var{question}=@var{answer} @gol
513-A-@var{question}@r{[}=@var{answer}@r{]} @gol
514-C  -CC  -D@var{macro}@r{[}=@var{defn}@r{]} @gol
515-dD  -dI  -dM  -dN  -dU @gol
516-fdebug-cpp  -fdirectives-only  -fdollars-in-identifiers  @gol
517-fexec-charset=@var{charset}  -fextended-identifiers  @gol
518-finput-charset=@var{charset}  -fmacro-prefix-map=@var{old}=@var{new}  @gol
519-fno-canonical-system-headers  -fpch-deps  -fpch-preprocess  @gol
520-fpreprocessed  -ftabstop=@var{width}  -ftrack-macro-expansion  @gol
521-fwide-exec-charset=@var{charset}  -fworking-directory @gol
522-H  -imacros @var{file}  -include @var{file} @gol
523-M  -MD  -MF  -MG  -MM  -MMD  -MP  -MQ  -MT @gol
524-no-integrated-cpp  -P  -pthread  -remap @gol
525-traditional  -traditional-cpp  -trigraphs @gol
526-U@var{macro}  -undef  @gol
527-Wp,@var{option}  -Xpreprocessor @var{option}}
528
529@item Assembler Options
530@xref{Assembler Options,,Passing Options to the Assembler}.
531@gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
532
533@item Linker Options
534@xref{Link Options,,Options for Linking}.
535@gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library} @gol
536-nostartfiles  -nodefaultlibs  -nolibc  -nostdlib @gol
537-e @var{entry}  --entry=@var{entry} @gol
538-pie  -pthread  -r  -rdynamic @gol
539-s  -static  -static-pie  -static-libgcc  -static-libstdc++ @gol
540-static-libasan  -static-libtsan  -static-liblsan  -static-libubsan @gol
541-shared  -shared-libgcc  -symbolic @gol
542-T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
543-u @var{symbol}  -z @var{keyword}}
544
545@item Directory Options
546@xref{Directory Options,,Options for Directory Search}.
547@gccoptlist{-B@var{prefix}  -I@var{dir}  -I- @gol
548-idirafter @var{dir} @gol
549-imacros @var{file}  -imultilib @var{dir} @gol
550-iplugindir=@var{dir}  -iprefix @var{file} @gol
551-iquote @var{dir}  -isysroot @var{dir}  -isystem @var{dir} @gol
552-iwithprefix @var{dir}  -iwithprefixbefore @var{dir}  @gol
553-L@var{dir}  -no-canonical-prefixes  --no-sysroot-suffix @gol
554-nostdinc  -nostdinc++  --sysroot=@var{dir}}
555
556@item Code Generation Options
557@xref{Code Gen Options,,Options for Code Generation Conventions}.
558@gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
559-ffixed-@var{reg}  -fexceptions @gol
560-fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables @gol
561-fasynchronous-unwind-tables @gol
562-fno-gnu-unique @gol
563-finhibit-size-directive  -fno-common  -fno-ident @gol
564-fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt @gol
565-fno-jump-tables @gol
566-frecord-gcc-switches @gol
567-freg-struct-return  -fshort-enums  -fshort-wchar @gol
568-fverbose-asm  -fpack-struct[=@var{n}]  @gol
569-fleading-underscore  -ftls-model=@var{model} @gol
570-fstack-reuse=@var{reuse_level} @gol
571-ftrampolines  -ftrapv  -fwrapv @gol
572-fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
573-fstrict-volatile-bitfields  -fsync-libcalls}
574
575@item Developer Options
576@xref{Developer Options,,GCC Developer Options}.
577@gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
578-dumpfullversion  -fchecking  -fchecking=@var{n}  -fdbg-cnt-list @gol
579-fdbg-cnt=@var{counter-value-list} @gol
580-fdisable-ipa-@var{pass_name} @gol
581-fdisable-rtl-@var{pass_name} @gol
582-fdisable-rtl-@var{pass-name}=@var{range-list} @gol
583-fdisable-tree-@var{pass_name} @gol
584-fdisable-tree-@var{pass-name}=@var{range-list} @gol
585-fdump-debug  -fdump-earlydebug @gol
586-fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links @gol
587-fdump-final-insns@r{[}=@var{file}@r{]} @gol
588-fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline @gol
589-fdump-lang-all @gol
590-fdump-lang-@var{switch} @gol
591-fdump-lang-@var{switch}-@var{options} @gol
592-fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
593-fdump-passes @gol
594-fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename} @gol
595-fdump-statistics @gol
596-fdump-tree-all @gol
597-fdump-tree-@var{switch} @gol
598-fdump-tree-@var{switch}-@var{options} @gol
599-fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
600-fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second @gol
601-fenable-@var{kind}-@var{pass} @gol
602-fenable-@var{kind}-@var{pass}=@var{range-list} @gol
603-fira-verbose=@var{n} @gol
604-flto-report  -flto-report-wpa  -fmem-report-wpa @gol
605-fmem-report  -fpre-ipa-mem-report  -fpost-ipa-mem-report @gol
606-fopt-info  -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
607-fprofile-report @gol
608-frandom-seed=@var{string}  -fsched-verbose=@var{n} @gol
609-fsel-sched-verbose  -fsel-sched-dump-cfg  -fsel-sched-pipelining-verbose @gol
610-fstats  -fstack-usage  -ftime-report  -ftime-report-details @gol
611-fvar-tracking-assignments-toggle  -gtoggle @gol
612-print-file-name=@var{library}  -print-libgcc-file-name @gol
613-print-multi-directory  -print-multi-lib  -print-multi-os-directory @gol
614-print-prog-name=@var{program}  -print-search-dirs  -Q @gol
615-print-sysroot  -print-sysroot-headers-suffix @gol
616-save-temps  -save-temps=cwd  -save-temps=obj  -time@r{[}=@var{file}@r{]}}
617
618@item Machine-Dependent Options
619@xref{Submodel Options,,Machine-Dependent Options}.
620@c This list is ordered alphanumerically by subsection name.
621@c Try and put the significant identifier (CPU or system) first,
622@c so users have a clue at guessing where the ones they want will be.
623
624@emph{AArch64 Options}
625@gccoptlist{-mabi=@var{name}  -mbig-endian  -mlittle-endian @gol
626-mgeneral-regs-only @gol
627-mcmodel=tiny  -mcmodel=small  -mcmodel=large @gol
628-mstrict-align  -mno-strict-align @gol
629-momit-leaf-frame-pointer @gol
630-mtls-dialect=desc  -mtls-dialect=traditional @gol
631-mtls-size=@var{size} @gol
632-mfix-cortex-a53-835769  -mfix-cortex-a53-843419 @gol
633-mlow-precision-recip-sqrt  -mlow-precision-sqrt  -mlow-precision-div @gol
634-mpc-relative-literal-loads @gol
635-msign-return-address=@var{scope} @gol
636-mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]|@var{bti} @gol
637-mharden-sls=@var{opts} @gol
638-march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}  @gol
639-moverride=@var{string}  -mverbose-cost-dump @gol
640-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
641-mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
642-moutline-atomics }
643
644@emph{Adapteva Epiphany Options}
645@gccoptlist{-mhalf-reg-file  -mprefer-short-insn-regs @gol
646-mbranch-cost=@var{num}  -mcmove  -mnops=@var{num}  -msoft-cmpsf @gol
647-msplit-lohi  -mpost-inc  -mpost-modify  -mstack-offset=@var{num} @gol
648-mround-nearest  -mlong-calls  -mshort-calls  -msmall16 @gol
649-mfp-mode=@var{mode}  -mvect-double  -max-vect-align=@var{num} @gol
650-msplit-vecmove-early  -m1reg-@var{reg}}
651
652@emph{AMD GCN Options}
653@gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
654
655@emph{ARC Options}
656@gccoptlist{-mbarrel-shifter  -mjli-always @gol
657-mcpu=@var{cpu}  -mA6  -mARC600  -mA7  -mARC700 @gol
658-mdpfp  -mdpfp-compact  -mdpfp-fast  -mno-dpfp-lrsr @gol
659-mea  -mno-mpy  -mmul32x16  -mmul64  -matomic @gol
660-mnorm  -mspfp  -mspfp-compact  -mspfp-fast  -msimd  -msoft-float  -mswap @gol
661-mcrc  -mdsp-packa  -mdvbf  -mlock  -mmac-d16  -mmac-24  -mrtsc  -mswape @gol
662-mtelephony  -mxy  -misize  -mannotate-align  -marclinux  -marclinux_prof @gol
663-mlong-calls  -mmedium-calls  -msdata  -mirq-ctrl-saved @gol
664-mrgf-banked-regs  -mlpc-width=@var{width}  -G @var{num} @gol
665-mvolatile-cache  -mtp-regno=@var{regno} @gol
666-malign-call  -mauto-modify-reg  -mbbit-peephole  -mno-brcc @gol
667-mcase-vector-pcrel  -mcompact-casesi  -mno-cond-exec  -mearly-cbranchsi @gol
668-mexpand-adddi  -mindexed-loads  -mlra  -mlra-priority-none @gol
669-mlra-priority-compact mlra-priority-noncompact  -mmillicode @gol
670-mmixed-code  -mq-class  -mRcq  -mRcw  -msize-level=@var{level} @gol
671-mtune=@var{cpu}  -mmultcost=@var{num}  -mcode-density-frame @gol
672-munalign-prob-threshold=@var{probability}  -mmpy-option=@var{multo} @gol
673-mdiv-rem  -mcode-density  -mll64  -mfpu=@var{fpu}  -mrf16  -mbranch-index}
674
675@emph{ARM Options}
676@gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
677-mabi=@var{name} @gol
678-mapcs-stack-check  -mno-apcs-stack-check @gol
679-mapcs-reentrant  -mno-apcs-reentrant @gol
680-mgeneral-regs-only @gol
681-msched-prolog  -mno-sched-prolog @gol
682-mlittle-endian  -mbig-endian @gol
683-mbe8  -mbe32 @gol
684-mfloat-abi=@var{name} @gol
685-mfp16-format=@var{name}
686-mthumb-interwork  -mno-thumb-interwork @gol
687-mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
688-mtune=@var{name}  -mprint-tune-info @gol
689-mstructure-size-boundary=@var{n} @gol
690-mabort-on-noreturn @gol
691-mlong-calls  -mno-long-calls @gol
692-msingle-pic-base  -mno-single-pic-base @gol
693-mpic-register=@var{reg} @gol
694-mnop-fun-dllimport @gol
695-mpoke-function-name @gol
696-mthumb  -marm  -mflip-thumb @gol
697-mtpcs-frame  -mtpcs-leaf-frame @gol
698-mcaller-super-interworking  -mcallee-super-interworking @gol
699-mtp=@var{name}  -mtls-dialect=@var{dialect} @gol
700-mword-relocations @gol
701-mfix-cortex-m3-ldrd @gol
702-munaligned-access @gol
703-mneon-for-64bits @gol
704-mslow-flash-data @gol
705-masm-syntax-unified @gol
706-mrestrict-it @gol
707-mverbose-cost-dump @gol
708-mpure-code @gol
709-mcmse}
710
711@emph{AVR Options}
712@gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args @gol
713-mbranch-cost=@var{cost} @gol
714-mcall-prologues  -mgas-isr-prologues  -mint8 @gol
715-mn_flash=@var{size}  -mno-interrupts @gol
716-mmain-is-OS_task  -mrelax  -mrmw  -mstrict-X  -mtiny-stack @gol
717-mfract-convert-truncate @gol
718-mshort-calls -nodevicelib  -nodevicespecs @gol
719-Waddr-space-convert  -Wmisspelled-isr}
720
721@emph{Blackfin Options}
722@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
723-msim  -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer @gol
724-mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly @gol
725-mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library @gol
726-mno-id-shared-library  -mshared-library-id=@var{n} @gol
727-mleaf-id-shared-library  -mno-leaf-id-shared-library @gol
728-msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls @gol
729-mfast-fp  -minline-plt  -mmulticore  -mcorea  -mcoreb  -msdram @gol
730-micplb}
731
732@emph{C6X Options}
733@gccoptlist{-mbig-endian  -mlittle-endian  -march=@var{cpu} @gol
734-msim  -msdata=@var{sdata-type}}
735
736@emph{CRIS Options}
737@gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
738-mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
739-metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
740-mstack-align  -mdata-align  -mconst-align @gol
741-m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
742-melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
743-mmul-bug-workaround  -mno-mul-bug-workaround}
744
745@emph{CR16 Options}
746@gccoptlist{-mmac @gol
747-mcr16cplus  -mcr16c @gol
748-msim  -mint32  -mbit-ops
749-mdata-model=@var{model}}
750
751@emph{C-SKY Options}
752@gccoptlist{-march=@var{arch}  -mcpu=@var{cpu} @gol
753-mbig-endian  -EB  -mlittle-endian  -EL @gol
754-mhard-float  -msoft-float  -mfpu=@var{fpu}  -mdouble-float  -mfdivdu @gol
755-melrw  -mistack  -mmp  -mcp  -mcache  -msecurity  -mtrust @gol
756-mdsp  -medsp  -mvdsp @gol
757-mdiv  -msmart  -mhigh-registers  -manchor @gol
758-mpushpop  -mmultiple-stld  -mconstpool  -mstack-size  -mccrt @gol
759-mbranch-cost=@var{n}  -mcse-cc  -msched-prolog}
760
761@emph{Darwin Options}
762@gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
763-arch_only  -bind_at_load  -bundle  -bundle_loader @gol
764-client_name  -compatibility_version  -current_version @gol
765-dead_strip @gol
766-dependency-file  -dylib_file  -dylinker_install_name @gol
767-dynamic  -dynamiclib  -exported_symbols_list @gol
768-filelist  -flat_namespace  -force_cpusubtype_ALL @gol
769-force_flat_namespace  -headerpad_max_install_names @gol
770-iframework @gol
771-image_base  -init  -install_name  -keep_private_externs @gol
772-multi_module  -multiply_defined  -multiply_defined_unused @gol
773-noall_load   -no_dead_strip_inits_and_terms @gol
774-nofixprebinding  -nomultidefs  -noprebind  -noseglinkedit @gol
775-pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
776-private_bundle  -read_only_relocs  -sectalign @gol
777-sectobjectsymbols  -whyload  -seg1addr @gol
778-sectcreate  -sectobjectsymbols  -sectorder @gol
779-segaddr  -segs_read_only_addr  -segs_read_write_addr @gol
780-seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
781-segprot  -segs_read_only_addr  -segs_read_write_addr @gol
782-single_module  -static  -sub_library  -sub_umbrella @gol
783-twolevel_namespace  -umbrella  -undefined @gol
784-unexported_symbols_list  -weak_reference_mismatches @gol
785-whatsloaded  -F  -gused  -gfull  -mmacosx-version-min=@var{version} @gol
786-mkernel  -mone-byte-bool}
787
788@emph{DEC Alpha Options}
789@gccoptlist{-mno-fp-regs  -msoft-float @gol
790-mieee  -mieee-with-inexact  -mieee-conformant @gol
791-mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
792-mtrap-precision=@var{mode}  -mbuild-constants @gol
793-mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
794-mbwx  -mmax  -mfix  -mcix @gol
795-mfloat-vax  -mfloat-ieee @gol
796-mexplicit-relocs  -msmall-data  -mlarge-data @gol
797-msmall-text  -mlarge-text @gol
798-mmemory-latency=@var{time}}
799
800@emph{FR30 Options}
801@gccoptlist{-msmall-model  -mno-lsim}
802
803@emph{FT32 Options}
804@gccoptlist{-msim  -mlra  -mnodiv  -mft32b  -mcompress  -mnopm}
805
806@emph{FRV Options}
807@gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
808-mhard-float  -msoft-float @gol
809-malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
810-mdouble  -mno-double @gol
811-mmedia  -mno-media  -mmuladd  -mno-muladd @gol
812-mfdpic  -minline-plt  -mgprel-ro  -multilib-library-pic @gol
813-mlinked-fp  -mlong-calls  -malign-labels @gol
814-mlibrary-pic  -macc-4  -macc-8 @gol
815-mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
816-moptimize-membar  -mno-optimize-membar @gol
817-mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
818-mvliw-branch  -mno-vliw-branch @gol
819-mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
820-mno-nested-cond-exec  -mtomcat-stats @gol
821-mTLS  -mtls @gol
822-mcpu=@var{cpu}}
823
824@emph{GNU/Linux Options}
825@gccoptlist{-mglibc  -muclibc  -mmusl  -mbionic  -mandroid @gol
826-tno-android-cc  -tno-android-ld}
827
828@emph{H8/300 Options}
829@gccoptlist{-mrelax  -mh  -ms  -mn  -mexr  -mno-exr  -mint32  -malign-300}
830
831@emph{HPPA Options}
832@gccoptlist{-march=@var{architecture-type} @gol
833-mcaller-copies  -mdisable-fpregs  -mdisable-indexing @gol
834-mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
835-mfixed-range=@var{register-range} @gol
836-mjump-in-delay  -mlinker-opt  -mlong-calls @gol
837-mlong-load-store  -mno-disable-fpregs @gol
838-mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
839-mno-jump-in-delay  -mno-long-load-store @gol
840-mno-portable-runtime  -mno-soft-float @gol
841-mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
842-mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
843-mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
844-munix=@var{unix-std}  -nolibdld  -static  -threads}
845
846@emph{IA-64 Options}
847@gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
848-mvolatile-asm-stop  -mregister-names  -msdata  -mno-sdata @gol
849-mconstant-gp  -mauto-pic  -mfused-madd @gol
850-minline-float-divide-min-latency @gol
851-minline-float-divide-max-throughput @gol
852-mno-inline-float-divide @gol
853-minline-int-divide-min-latency @gol
854-minline-int-divide-max-throughput  @gol
855-mno-inline-int-divide @gol
856-minline-sqrt-min-latency  -minline-sqrt-max-throughput @gol
857-mno-inline-sqrt @gol
858-mdwarf2-asm  -mearly-stop-bits @gol
859-mfixed-range=@var{register-range}  -mtls-size=@var{tls-size} @gol
860-mtune=@var{cpu-type}  -milp32  -mlp64 @gol
861-msched-br-data-spec  -msched-ar-data-spec  -msched-control-spec @gol
862-msched-br-in-data-spec  -msched-ar-in-data-spec  -msched-in-control-spec @gol
863-msched-spec-ldc  -msched-spec-control-ldc @gol
864-msched-prefer-non-data-spec-insns  -msched-prefer-non-control-spec-insns @gol
865-msched-stop-bits-after-every-cycle  -msched-count-spec-in-critical-path @gol
866-msel-sched-dont-check-control-spec  -msched-fp-mem-deps-zero-cost @gol
867-msched-max-memory-insns-hard-limit  -msched-max-memory-insns=@var{max-insns}}
868
869@emph{LM32 Options}
870@gccoptlist{-mbarrel-shift-enabled  -mdivide-enabled  -mmultiply-enabled @gol
871-msign-extend-enabled  -muser-enabled}
872
873@emph{M32R/D Options}
874@gccoptlist{-m32r2  -m32rx  -m32r @gol
875-mdebug @gol
876-malign-loops  -mno-align-loops @gol
877-missue-rate=@var{number} @gol
878-mbranch-cost=@var{number} @gol
879-mmodel=@var{code-size-model-type} @gol
880-msdata=@var{sdata-type} @gol
881-mno-flush-func  -mflush-func=@var{name} @gol
882-mno-flush-trap  -mflush-trap=@var{number} @gol
883-G @var{num}}
884
885@emph{M32C Options}
886@gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
887
888@emph{M680x0 Options}
889@gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune} @gol
890-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
891-m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407 @gol
892-mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020 @gol
893-mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort @gol
894-mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel @gol
895-malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
896-mshared-library-id=n  -mid-shared-library  -mno-id-shared-library @gol
897-mxgot  -mno-xgot  -mlong-jump-table-offsets}
898
899@emph{MCore Options}
900@gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
901-mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
902-m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
903-mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
904-mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
905
906@emph{MeP Options}
907@gccoptlist{-mabsdiff  -mall-opts  -maverage  -mbased=@var{n}  -mbitops @gol
908-mc=@var{n}  -mclip  -mconfig=@var{name}  -mcop  -mcop32  -mcop64  -mivc2 @gol
909-mdc  -mdiv  -meb  -mel  -mio-volatile  -ml  -mleadz  -mm  -mminmax @gol
910-mmult  -mno-opts  -mrepeat  -ms  -msatur  -msdram  -msim  -msimnovec  -mtf @gol
911-mtiny=@var{n}}
912
913@emph{MicroBlaze Options}
914@gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu} @gol
915-mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift @gol
916-mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss @gol
917-mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt @gol
918-mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model} @gol
919-mpic-data-is-text-relative}
920
921@emph{MIPS Options}
922@gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
923-mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5 @gol
924-mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6 @gol
925-mips16  -mno-mips16  -mflip-mips16 @gol
926-minterlink-compressed  -mno-interlink-compressed @gol
927-minterlink-mips16  -mno-interlink-mips16 @gol
928-mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
929-mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
930-mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float @gol
931-mno-float  -msingle-float  -mdouble-float @gol
932-modd-spreg  -mno-odd-spreg @gol
933-mabs=@var{mode}  -mnan=@var{encoding} @gol
934-mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
935-mmcu  -mmno-mcu @gol
936-meva  -mno-eva @gol
937-mvirt  -mno-virt @gol
938-mxpa  -mno-xpa @gol
939-mcrc  -mno-crc @gol
940-mginv  -mno-ginv @gol
941-mmicromips  -mno-micromips @gol
942-mmsa  -mno-msa @gol
943-mloongson-mmi  -mno-loongson-mmi @gol
944-mloongson-ext  -mno-loongson-ext @gol
945-mloongson-ext2  -mno-loongson-ext2 @gol
946-mfpu=@var{fpu-type} @gol
947-msmartmips  -mno-smartmips @gol
948-mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx @gol
949-mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc @gol
950-mlong64  -mlong32  -msym32  -mno-sym32 @gol
951-G@var{num}  -mlocal-sdata  -mno-local-sdata @gol
952-mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt @gol
953-membedded-data  -mno-embedded-data @gol
954-muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
955-mcode-readable=@var{setting} @gol
956-msplit-addresses  -mno-split-addresses @gol
957-mexplicit-relocs  -mno-explicit-relocs @gol
958-mcheck-zero-division  -mno-check-zero-division @gol
959-mdivide-traps  -mdivide-breaks @gol
960-mload-store-pairs  -mno-load-store-pairs @gol
961-mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
962-mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp @gol
963-mfix-24k  -mno-fix-24k @gol
964-mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
965-mfix-r5900  -mno-fix-r5900 @gol
966-mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000 @gol
967-mfix-vr4120  -mno-fix-vr4120 @gol
968-mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1 @gol
969-mflush-func=@var{func}  -mno-flush-func @gol
970-mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely @gol
971-mcompact-branches=@var{policy} @gol
972-mfp-exceptions  -mno-fp-exceptions @gol
973-mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci @gol
974-mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4 @gol
975-mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address @gol
976-mframe-header-opt  -mno-frame-header-opt}
977
978@emph{MMIX Options}
979@gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
980-mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
981-melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
982-mno-base-addresses  -msingle-exit  -mno-single-exit}
983
984@emph{MN10300 Options}
985@gccoptlist{-mmult-bug  -mno-mult-bug @gol
986-mno-am33  -mam33  -mam33-2  -mam34 @gol
987-mtune=@var{cpu-type} @gol
988-mreturn-pointer-on-d0 @gol
989-mno-crt0  -mrelax  -mliw  -msetlb}
990
991@emph{Moxie Options}
992@gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
993
994@emph{MSP430 Options}
995@gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax @gol
996-mwarn-mcu @gol
997-mcode-region=  -mdata-region= @gol
998-msilicon-errata=  -msilicon-errata-warn= @gol
999-mhwmult=  -minrt}
1000
1001@emph{NDS32 Options}
1002@gccoptlist{-mbig-endian  -mlittle-endian @gol
1003-mreduced-regs  -mfull-regs @gol
1004-mcmov  -mno-cmov @gol
1005-mext-perf  -mno-ext-perf @gol
1006-mext-perf2  -mno-ext-perf2 @gol
1007-mext-string  -mno-ext-string @gol
1008-mv3push  -mno-v3push @gol
1009-m16bit  -mno-16bit @gol
1010-misr-vector-size=@var{num} @gol
1011-mcache-block-size=@var{num} @gol
1012-march=@var{arch} @gol
1013-mcmodel=@var{code-model} @gol
1014-mctor-dtor  -mrelax}
1015
1016@emph{Nios II Options}
1017@gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt @gol
1018-mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp} @gol
1019-mel  -meb @gol
1020-mno-bypass-cache  -mbypass-cache @gol
1021-mno-cache-volatile  -mcache-volatile @gol
1022-mno-fast-sw-div  -mfast-sw-div @gol
1023-mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div @gol
1024-mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn} @gol
1025-mcustom-fpu-cfg=@var{name} @gol
1026-mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name} @gol
1027-march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1028
1029@emph{Nvidia PTX Options}
1030@gccoptlist{-m32  -m64  -mmainkernel  -moptimize}
1031
1032@emph{OpenRISC Options}
1033@gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div @gol
1034-msoft-mul  -msoft-div @gol
1035-mcmov  -mror  -msext  -msfimm  -mshftimm}
1036
1037@emph{PDP-11 Options}
1038@gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
1039-mint32  -mno-int16  -mint16  -mno-int32 @gol
1040-msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1041
1042@emph{picoChip Options}
1043@gccoptlist{-mae=@var{ae_type}  -mvliw-lookahead=@var{N} @gol
1044-msymbol-as-address  -mno-inefficient-warnings}
1045
1046@emph{PowerPC Options}
1047See RS/6000 and PowerPC Options.
1048
1049@emph{RISC-V Options}
1050@gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1051-mplt  -mno-plt @gol
1052-mabi=@var{ABI-string} @gol
1053-mfdiv  -mno-fdiv @gol
1054-mdiv  -mno-div @gol
1055-march=@var{ISA-string} @gol
1056-mtune=@var{processor-string} @gol
1057-mpreferred-stack-boundary=@var{num} @gol
1058-msmall-data-limit=@var{N-bytes} @gol
1059-msave-restore  -mno-save-restore @gol
1060-mstrict-align  -mno-strict-align @gol
1061-mcmodel=medlow  -mcmodel=medany @gol
1062-mexplicit-relocs  -mno-explicit-relocs @gol
1063-mrelax  -mno-relax @gol
1064-mriscv-attribute  -mmo-riscv-attribute}
1065
1066@emph{RL78 Options}
1067@gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs @gol
1068-mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14 @gol
1069-m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1070
1071@emph{RS/6000 and PowerPC Options}
1072@gccoptlist{-mcpu=@var{cpu-type} @gol
1073-mtune=@var{cpu-type} @gol
1074-mcmodel=@var{code-model} @gol
1075-mpowerpc64 @gol
1076-maltivec  -mno-altivec @gol
1077-mpowerpc-gpopt  -mno-powerpc-gpopt @gol
1078-mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
1079-mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd @gol
1080-mfprnd  -mno-fprnd @gol
1081-mcmpb  -mno-cmpb  -mmfpgpr  -mno-mfpgpr  -mhard-dfp  -mno-hard-dfp @gol
1082-mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
1083-m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
1084-malign-power  -malign-natural @gol
1085-msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
1086-mupdate  -mno-update @gol
1087-mavoid-indexed-addresses  -mno-avoid-indexed-addresses @gol
1088-mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
1089-mstrict-align  -mno-strict-align  -mrelocatable @gol
1090-mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
1091-mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
1092-mdynamic-no-pic  -mswdiv  -msingle-pic-base @gol
1093-mprioritize-restricted-insns=@var{priority} @gol
1094-msched-costly-dep=@var{dependence_type} @gol
1095-minsert-sched-nops=@var{scheme} @gol
1096-mcall-aixdesc  -mcall-eabi  -mcall-freebsd  @gol
1097-mcall-linux  -mcall-netbsd  -mcall-openbsd  @gol
1098-mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi @gol
1099-mtraceback=@var{traceback_type} @gol
1100-maix-struct-return  -msvr4-struct-return @gol
1101-mabi=@var{abi-type}  -msecure-plt  -mbss-plt @gol
1102-mlongcall  -mno-longcall  -mpltseq  -mno-pltseq  @gol
1103-mblock-move-inline-limit=@var{num} @gol
1104-mblock-compare-inline-limit=@var{num} @gol
1105-mblock-compare-inline-loop-limit=@var{num} @gol
1106-mstring-compare-inline-limit=@var{num} @gol
1107-misel  -mno-isel @gol
1108-mvrsave  -mno-vrsave @gol
1109-mmulhw  -mno-mulhw @gol
1110-mdlmzb  -mno-dlmzb @gol
1111-mprototype  -mno-prototype @gol
1112-msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
1113-msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num} @gol
1114-mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision @gol
1115-mno-recip-precision @gol
1116-mveclibabi=@var{type}  -mfriz  -mno-friz @gol
1117-mpointers-to-nested-functions  -mno-pointers-to-nested-functions @gol
1118-msave-toc-indirect  -mno-save-toc-indirect @gol
1119-mpower8-fusion  -mno-mpower8-fusion  -mpower8-vector  -mno-power8-vector @gol
1120-mcrypto  -mno-crypto  -mhtm  -mno-htm @gol
1121-mquad-memory  -mno-quad-memory @gol
1122-mquad-memory-atomic  -mno-quad-memory-atomic @gol
1123-mcompat-align-parm  -mno-compat-align-parm @gol
1124-mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware @gol
1125-mgnu-attribute  -mno-gnu-attribute @gol
1126-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1127-mstack-protector-guard-offset=@var{offset}}
1128
1129@emph{RX Options}
1130@gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu@gol
1131-mcpu=@gol
1132-mbig-endian-data  -mlittle-endian-data @gol
1133-msmall-data @gol
1134-msim  -mno-sim@gol
1135-mas100-syntax  -mno-as100-syntax@gol
1136-mrelax@gol
1137-mmax-constant-size=@gol
1138-mint-register=@gol
1139-mpid@gol
1140-mallow-string-insns  -mno-allow-string-insns@gol
1141-mjsr@gol
1142-mno-warn-multiple-fast-interrupts@gol
1143-msave-acc-in-interrupts}
1144
1145@emph{S/390 and zSeries Options}
1146@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1147-mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp @gol
1148-mlong-double-64  -mlong-double-128 @gol
1149-mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack @gol
1150-msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle @gol
1151-m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
1152-mhtm  -mvx  -mzvector @gol
1153-mtpf-trace  -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
1154-mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard @gol
1155-mhotpatch=@var{halfwords},@var{halfwords}}
1156
1157@emph{Score Options}
1158@gccoptlist{-meb  -mel @gol
1159-mnhwloop @gol
1160-muls @gol
1161-mmac @gol
1162-mscore5  -mscore5u  -mscore7  -mscore7d}
1163
1164@emph{SH Options}
1165@gccoptlist{-m1  -m2  -m2e @gol
1166-m2a-nofpu  -m2a-single-only  -m2a-single  -m2a @gol
1167-m3  -m3e @gol
1168-m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
1169-m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al @gol
1170-mb  -ml  -mdalign  -mrelax @gol
1171-mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave @gol
1172-mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct @gol
1173-mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy} @gol
1174-mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range} @gol
1175-maccumulate-outgoing-args @gol
1176-matomic-model=@var{atomic-model} @gol
1177-mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch @gol
1178-mcbranch-force-delay-slot @gol
1179-mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra @gol
1180-mpretend-cmove  -mtas}
1181
1182@emph{Solaris 2 Options}
1183@gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text @gol
1184-pthreads}
1185
1186@emph{SPARC Options}
1187@gccoptlist{-mcpu=@var{cpu-type} @gol
1188-mtune=@var{cpu-type} @gol
1189-mcmodel=@var{code-model} @gol
1190-mmemory-model=@var{mem-model} @gol
1191-m32  -m64  -mapp-regs  -mno-app-regs @gol
1192-mfaster-structs  -mno-faster-structs  -mflat  -mno-flat @gol
1193-mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1194-mhard-quad-float  -msoft-quad-float @gol
1195-mstack-bias  -mno-stack-bias @gol
1196-mstd-struct-return  -mno-std-struct-return @gol
1197-munaligned-doubles  -mno-unaligned-doubles @gol
1198-muser-mode  -mno-user-mode @gol
1199-mv8plus  -mno-v8plus  -mvis  -mno-vis @gol
1200-mvis2  -mno-vis2  -mvis3  -mno-vis3 @gol
1201-mvis4  -mno-vis4  -mvis4b  -mno-vis4b @gol
1202-mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld  @gol
1203-mpopc  -mno-popc  -msubxc  -mno-subxc @gol
1204-mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc @gol
1205-mlra  -mno-lra}
1206
1207@emph{SPU Options}
1208@gccoptlist{-mwarn-reloc  -merror-reloc @gol
1209-msafe-dma  -munsafe-dma @gol
1210-mbranch-hints @gol
1211-msmall-mem  -mlarge-mem  -mstdmain @gol
1212-mfixed-range=@var{register-range} @gol
1213-mea32  -mea64 @gol
1214-maddress-space-conversion  -mno-address-space-conversion @gol
1215-mcache-size=@var{cache-size} @gol
1216-matomic-updates  -mno-atomic-updates}
1217
1218@emph{System V Options}
1219@gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1220
1221@emph{TILE-Gx Options}
1222@gccoptlist{-mcpu=CPU  -m32  -m64  -mbig-endian  -mlittle-endian @gol
1223-mcmodel=@var{code-model}}
1224
1225@emph{TILEPro Options}
1226@gccoptlist{-mcpu=@var{cpu}  -m32}
1227
1228@emph{V850 Options}
1229@gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
1230-mprolog-function  -mno-prolog-function  -mspace @gol
1231-mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
1232-mapp-regs  -mno-app-regs @gol
1233-mdisable-callt  -mno-disable-callt @gol
1234-mv850e2v3  -mv850e2  -mv850e1  -mv850es @gol
1235-mv850e  -mv850  -mv850e3v5 @gol
1236-mloop @gol
1237-mrelax @gol
1238-mlong-jumps @gol
1239-msoft-float @gol
1240-mhard-float @gol
1241-mgcc-abi @gol
1242-mrh850-abi @gol
1243-mbig-switch}
1244
1245@emph{VAX Options}
1246@gccoptlist{-mg  -mgnu  -munix}
1247
1248@emph{Visium Options}
1249@gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1250-mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1251
1252@emph{VMS Options}
1253@gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64 @gol
1254-mpointer-size=@var{size}}
1255
1256@emph{VxWorks Options}
1257@gccoptlist{-mrtp  -non-static  -Bstatic  -Bdynamic @gol
1258-Xbind-lazy  -Xbind-now}
1259
1260@emph{x86 Options}
1261@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1262-mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default @gol
1263-mfpmath=@var{unit} @gol
1264-masm=@var{dialect}  -mno-fancy-math-387 @gol
1265-mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float @gol
1266-mno-wide-multiply  -mrtd  -malign-double @gol
1267-mpreferred-stack-boundary=@var{num} @gol
1268-mincoming-stack-boundary=@var{num} @gol
1269-mcld  -mcx16  -msahf  -mmovbe  -mcrc32 @gol
1270-mrecip  -mrecip=@var{opt} @gol
1271-mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt} @gol
1272-mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx @gol
1273-mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl @gol
1274-mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes @gol
1275-mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd  @gol
1276-mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves @gol
1277-msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop @gol
1278-madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp @gol
1279-mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg @gol
1280-mshstk -mmanual-endbr -mforce-indirect-call  -mavx512vbmi2 @gol
1281-mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq @gol
1282-mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid @gol
1283-mrdseed  -msgx @gol
1284-mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops @gol
1285-minline-stringops-dynamically  -mstringop-strategy=@var{alg} @gol
1286-mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy} @gol
1287-mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
1288-m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128 @gol
1289-mregparm=@var{num}  -msseregparm @gol
1290-mveclibabi=@var{type}  -mvect8-ret-in-mem @gol
1291-mpc32  -mpc64  -mpc80  -mstackrealign @gol
1292-momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs @gol
1293-mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode} @gol
1294-m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num} @gol
1295-msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv @gol
1296-minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1297-mavx256-split-unaligned-load  -mavx256-split-unaligned-store @gol
1298-malign-data=@var{type}  -mstack-protector-guard=@var{guard} @gol
1299-mstack-protector-guard-reg=@var{reg} @gol
1300-mstack-protector-guard-offset=@var{offset} @gol
1301-mstack-protector-guard-symbol=@var{symbol} @gol
1302-mgeneral-regs-only  -mcall-ms2sysv-xlogues @gol
1303-mindirect-branch=@var{choice}  -mfunction-return=@var{choice} @gol
1304-mindirect-branch-register}
1305
1306@emph{x86 Windows Options}
1307@gccoptlist{-mconsole  -mcygwin  -mno-cygwin  -mdll @gol
1308-mnop-fun-dllimport  -mthread @gol
1309-municode  -mwin32  -mwindows  -fno-set-stack-executable}
1310
1311@emph{Xstormy16 Options}
1312@gccoptlist{-msim}
1313
1314@emph{Xtensa Options}
1315@gccoptlist{-mconst16  -mno-const16 @gol
1316-mfused-madd  -mno-fused-madd @gol
1317-mforce-no-pic @gol
1318-mserialize-volatile  -mno-serialize-volatile @gol
1319-mtext-section-literals  -mno-text-section-literals @gol
1320-mauto-litpools  -mno-auto-litpools @gol
1321-mtarget-align  -mno-target-align @gol
1322-mlongcalls  -mno-longcalls}
1323
1324@emph{zSeries Options}
1325See S/390 and zSeries Options.
1326@end table
1327
1328
1329@node Overall Options
1330@section Options Controlling the Kind of Output
1331
1332Compilation can involve up to four stages: preprocessing, compilation
1333proper, assembly and linking, always in that order.  GCC is capable of
1334preprocessing and compiling several files either into several
1335assembler input files, or into one assembler input file; then each
1336assembler input file produces an object file, and linking combines all
1337the object files (those newly compiled, and those specified as input)
1338into an executable file.
1339
1340@cindex file name suffix
1341For any given input file, the file name suffix determines what kind of
1342compilation is done:
1343
1344@table @gcctabopt
1345@item @var{file}.c
1346C source code that must be preprocessed.
1347
1348@item @var{file}.i
1349C source code that should not be preprocessed.
1350
1351@item @var{file}.ii
1352C++ source code that should not be preprocessed.
1353
1354@item @var{file}.m
1355Objective-C source code.  Note that you must link with the @file{libobjc}
1356library to make an Objective-C program work.
1357
1358@item @var{file}.mi
1359Objective-C source code that should not be preprocessed.
1360
1361@item @var{file}.mm
1362@itemx @var{file}.M
1363Objective-C++ source code.  Note that you must link with the @file{libobjc}
1364library to make an Objective-C++ program work.  Note that @samp{.M} refers
1365to a literal capital M@.
1366
1367@item @var{file}.mii
1368Objective-C++ source code that should not be preprocessed.
1369
1370@item @var{file}.h
1371C, C++, Objective-C or Objective-C++ header file to be turned into a
1372precompiled header (default), or C, C++ header file to be turned into an
1373Ada spec (via the @option{-fdump-ada-spec} switch).
1374
1375@item @var{file}.cc
1376@itemx @var{file}.cp
1377@itemx @var{file}.cxx
1378@itemx @var{file}.cpp
1379@itemx @var{file}.CPP
1380@itemx @var{file}.c++
1381@itemx @var{file}.C
1382C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1383the last two letters must both be literally @samp{x}.  Likewise,
1384@samp{.C} refers to a literal capital C@.
1385
1386@item @var{file}.mm
1387@itemx @var{file}.M
1388Objective-C++ source code that must be preprocessed.
1389
1390@item @var{file}.mii
1391Objective-C++ source code that should not be preprocessed.
1392
1393@item @var{file}.hh
1394@itemx @var{file}.H
1395@itemx @var{file}.hp
1396@itemx @var{file}.hxx
1397@itemx @var{file}.hpp
1398@itemx @var{file}.HPP
1399@itemx @var{file}.h++
1400@itemx @var{file}.tcc
1401C++ header file to be turned into a precompiled header or Ada spec.
1402
1403@item @var{file}.f
1404@itemx @var{file}.for
1405@itemx @var{file}.ftn
1406Fixed form Fortran source code that should not be preprocessed.
1407
1408@item @var{file}.F
1409@itemx @var{file}.FOR
1410@itemx @var{file}.fpp
1411@itemx @var{file}.FPP
1412@itemx @var{file}.FTN
1413Fixed form Fortran source code that must be preprocessed (with the traditional
1414preprocessor).
1415
1416@item @var{file}.f90
1417@itemx @var{file}.f95
1418@itemx @var{file}.f03
1419@itemx @var{file}.f08
1420Free form Fortran source code that should not be preprocessed.
1421
1422@item @var{file}.F90
1423@itemx @var{file}.F95
1424@itemx @var{file}.F03
1425@itemx @var{file}.F08
1426Free form Fortran source code that must be preprocessed (with the
1427traditional preprocessor).
1428
1429@item @var{file}.go
1430Go source code.
1431
1432@item @var{file}.brig
1433BRIG files (binary representation of HSAIL).
1434
1435@item @var{file}.d
1436D source code.
1437
1438@item @var{file}.di
1439D interface file.
1440
1441@item @var{file}.dd
1442D documentation code (Ddoc).
1443
1444@item @var{file}.ads
1445Ada source code file that contains a library unit declaration (a
1446declaration of a package, subprogram, or generic, or a generic
1447instantiation), or a library unit renaming declaration (a package,
1448generic, or subprogram renaming declaration).  Such files are also
1449called @dfn{specs}.
1450
1451@item @var{file}.adb
1452Ada source code file containing a library unit body (a subprogram or
1453package body).  Such files are also called @dfn{bodies}.
1454
1455@c GCC also knows about some suffixes for languages not yet included:
1456@c Ratfor:
1457@c @var{file}.r
1458
1459@item @var{file}.s
1460Assembler code.
1461
1462@item @var{file}.S
1463@itemx @var{file}.sx
1464Assembler code that must be preprocessed.
1465
1466@item @var{other}
1467An object file to be fed straight into linking.
1468Any file name with no recognized suffix is treated this way.
1469@end table
1470
1471@opindex x
1472You can specify the input language explicitly with the @option{-x} option:
1473
1474@table @gcctabopt
1475@item -x @var{language}
1476Specify explicitly the @var{language} for the following input files
1477(rather than letting the compiler choose a default based on the file
1478name suffix).  This option applies to all following input files until
1479the next @option{-x} option.  Possible values for @var{language} are:
1480@smallexample
1481c  c-header  cpp-output
1482c++  c++-header  c++-cpp-output
1483objective-c  objective-c-header  objective-c-cpp-output
1484objective-c++ objective-c++-header objective-c++-cpp-output
1485assembler  assembler-with-cpp
1486ada
1487d
1488f77  f77-cpp-input f95  f95-cpp-input
1489go
1490brig
1491@end smallexample
1492
1493@item -x none
1494Turn off any specification of a language, so that subsequent files are
1495handled according to their file name suffixes (as they are if @option{-x}
1496has not been used at all).
1497@end table
1498
1499If you only want some of the stages of compilation, you can use
1500@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1501one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1502@command{gcc} is to stop.  Note that some combinations (for example,
1503@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1504
1505@table @gcctabopt
1506@item -c
1507@opindex c
1508Compile or assemble the source files, but do not link.  The linking
1509stage simply is not done.  The ultimate output is in the form of an
1510object file for each source file.
1511
1512By default, the object file name for a source file is made by replacing
1513the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1514
1515Unrecognized input files, not requiring compilation or assembly, are
1516ignored.
1517
1518@item -S
1519@opindex S
1520Stop after the stage of compilation proper; do not assemble.  The output
1521is in the form of an assembler code file for each non-assembler input
1522file specified.
1523
1524By default, the assembler file name for a source file is made by
1525replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1526
1527Input files that don't require compilation are ignored.
1528
1529@item -E
1530@opindex E
1531Stop after the preprocessing stage; do not run the compiler proper.  The
1532output is in the form of preprocessed source code, which is sent to the
1533standard output.
1534
1535Input files that don't require preprocessing are ignored.
1536
1537@cindex output file option
1538@item -o @var{file}
1539@opindex o
1540Place output in file @var{file}.  This applies to whatever
1541sort of output is being produced, whether it be an executable file,
1542an object file, an assembler file or preprocessed C code.
1543
1544If @option{-o} is not specified, the default is to put an executable
1545file in @file{a.out}, the object file for
1546@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1547assembler file in @file{@var{source}.s}, a precompiled header file in
1548@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1549standard output.
1550
1551@item -v
1552@opindex v
1553Print (on standard error output) the commands executed to run the stages
1554of compilation.  Also print the version number of the compiler driver
1555program and of the preprocessor and the compiler proper.
1556
1557@item -###
1558@opindex ###
1559Like @option{-v} except the commands are not executed and arguments
1560are quoted unless they contain only alphanumeric characters or @code{./-_}.
1561This is useful for shell scripts to capture the driver-generated command lines.
1562
1563@item --help
1564@opindex help
1565Print (on the standard output) a description of the command-line options
1566understood by @command{gcc}.  If the @option{-v} option is also specified
1567then @option{--help} is also passed on to the various processes
1568invoked by @command{gcc}, so that they can display the command-line options
1569they accept.  If the @option{-Wextra} option has also been specified
1570(prior to the @option{--help} option), then command-line options that
1571have no documentation associated with them are also displayed.
1572
1573@item --target-help
1574@opindex target-help
1575Print (on the standard output) a description of target-specific command-line
1576options for each tool.  For some targets extra target-specific
1577information may also be printed.
1578
1579@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1580Print (on the standard output) a description of the command-line
1581options understood by the compiler that fit into all specified classes
1582and qualifiers.  These are the supported classes:
1583
1584@table @asis
1585@item @samp{optimizers}
1586Display all of the optimization options supported by the
1587compiler.
1588
1589@item @samp{warnings}
1590Display all of the options controlling warning messages
1591produced by the compiler.
1592
1593@item @samp{target}
1594Display target-specific options.  Unlike the
1595@option{--target-help} option however, target-specific options of the
1596linker and assembler are not displayed.  This is because those
1597tools do not currently support the extended @option{--help=} syntax.
1598
1599@item @samp{params}
1600Display the values recognized by the @option{--param}
1601option.
1602
1603@item @var{language}
1604Display the options supported for @var{language}, where
1605@var{language} is the name of one of the languages supported in this
1606version of GCC@.
1607
1608@item @samp{common}
1609Display the options that are common to all languages.
1610@end table
1611
1612These are the supported qualifiers:
1613
1614@table @asis
1615@item @samp{undocumented}
1616Display only those options that are undocumented.
1617
1618@item @samp{joined}
1619Display options taking an argument that appears after an equal
1620sign in the same continuous piece of text, such as:
1621@samp{--help=target}.
1622
1623@item @samp{separate}
1624Display options taking an argument that appears as a separate word
1625following the original option, such as: @samp{-o output-file}.
1626@end table
1627
1628Thus for example to display all the undocumented target-specific
1629switches supported by the compiler, use:
1630
1631@smallexample
1632--help=target,undocumented
1633@end smallexample
1634
1635The sense of a qualifier can be inverted by prefixing it with the
1636@samp{^} character, so for example to display all binary warning
1637options (i.e., ones that are either on or off and that do not take an
1638argument) that have a description, use:
1639
1640@smallexample
1641--help=warnings,^joined,^undocumented
1642@end smallexample
1643
1644The argument to @option{--help=} should not consist solely of inverted
1645qualifiers.
1646
1647Combining several classes is possible, although this usually
1648restricts the output so much that there is nothing to display.  One
1649case where it does work, however, is when one of the classes is
1650@var{target}.  For example, to display all the target-specific
1651optimization options, use:
1652
1653@smallexample
1654--help=target,optimizers
1655@end smallexample
1656
1657The @option{--help=} option can be repeated on the command line.  Each
1658successive use displays its requested class of options, skipping
1659those that have already been displayed.  If @option{--help} is also
1660specified anywhere on the command line then this takes precedence
1661over any @option{--help=} option.
1662
1663If the @option{-Q} option appears on the command line before the
1664@option{--help=} option, then the descriptive text displayed by
1665@option{--help=} is changed.  Instead of describing the displayed
1666options, an indication is given as to whether the option is enabled,
1667disabled or set to a specific value (assuming that the compiler
1668knows this at the point where the @option{--help=} option is used).
1669
1670Here is a truncated example from the ARM port of @command{gcc}:
1671
1672@smallexample
1673  % gcc -Q -mabi=2 --help=target -c
1674  The following options are target specific:
1675  -mabi=                                2
1676  -mabort-on-noreturn                   [disabled]
1677  -mapcs                                [disabled]
1678@end smallexample
1679
1680The output is sensitive to the effects of previous command-line
1681options, so for example it is possible to find out which optimizations
1682are enabled at @option{-O2} by using:
1683
1684@smallexample
1685-Q -O2 --help=optimizers
1686@end smallexample
1687
1688Alternatively you can discover which binary optimizations are enabled
1689by @option{-O3} by using:
1690
1691@smallexample
1692gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1693gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1694diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1695@end smallexample
1696
1697@item --version
1698@opindex version
1699Display the version number and copyrights of the invoked GCC@.
1700
1701@item -pass-exit-codes
1702@opindex pass-exit-codes
1703Normally the @command{gcc} program exits with the code of 1 if any
1704phase of the compiler returns a non-success return code.  If you specify
1705@option{-pass-exit-codes}, the @command{gcc} program instead returns with
1706the numerically highest error produced by any phase returning an error
1707indication.  The C, C++, and Fortran front ends return 4 if an internal
1708compiler error is encountered.
1709
1710@item -pipe
1711@opindex pipe
1712Use pipes rather than temporary files for communication between the
1713various stages of compilation.  This fails to work on some systems where
1714the assembler is unable to read from a pipe; but the GNU assembler has
1715no trouble.
1716
1717@item -specs=@var{file}
1718@opindex specs
1719Process @var{file} after the compiler reads in the standard @file{specs}
1720file, in order to override the defaults which the @command{gcc} driver
1721program uses when determining what switches to pass to @command{cc1},
1722@command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
1723@option{-specs=@var{file}} can be specified on the command line, and they
1724are processed in order, from left to right.  @xref{Spec Files}, for
1725information about the format of the @var{file}.
1726
1727@item -wrapper
1728@opindex wrapper
1729Invoke all subcommands under a wrapper program.  The name of the
1730wrapper program and its parameters are passed as a comma separated
1731list.
1732
1733@smallexample
1734gcc -c t.c -wrapper gdb,--args
1735@end smallexample
1736
1737@noindent
1738This invokes all subprograms of @command{gcc} under
1739@samp{gdb --args}, thus the invocation of @command{cc1} is
1740@samp{gdb --args cc1 @dots{}}.
1741
1742@item -ffile-prefix-map=@var{old}=@var{new}
1743@opindex ffile-prefix-map
1744When compiling files residing in directory @file{@var{old}}, record
1745any references to them in the result of the compilation as if the
1746files resided in directory @file{@var{new}} instead.  Specifying this
1747option is equivalent to specifying all the individual
1748@option{-f*-prefix-map} options.  This can be used to make reproducible
1749builds that are location independent.  See also
1750@option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1751
1752@item -fplugin=@var{name}.so
1753@opindex fplugin
1754Load the plugin code in file @var{name}.so, assumed to be a
1755shared object to be dlopen'd by the compiler.  The base name of
1756the shared object file is used to identify the plugin for the
1757purposes of argument parsing (See
1758@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1759Each plugin should define the callback functions specified in the
1760Plugins API.
1761
1762@item -fplugin-arg-@var{name}-@var{key}=@var{value}
1763@opindex fplugin-arg
1764Define an argument called @var{key} with a value of @var{value}
1765for the plugin called @var{name}.
1766
1767@item -fdump-ada-spec@r{[}-slim@r{]}
1768@opindex fdump-ada-spec
1769For C and C++ source and include files, generate corresponding Ada specs.
1770@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1771GNAT User's Guide}, which provides detailed documentation on this feature.
1772
1773@item -fada-spec-parent=@var{unit}
1774@opindex fada-spec-parent
1775In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1776Ada specs as child units of parent @var{unit}.
1777
1778@item -fdump-go-spec=@var{file}
1779@opindex fdump-go-spec
1780For input files in any language, generate corresponding Go
1781declarations in @var{file}.  This generates Go @code{const},
1782@code{type}, @code{var}, and @code{func} declarations which may be a
1783useful way to start writing a Go interface to code written in some
1784other language.
1785
1786@include @value{srcdir}/../libiberty/at-file.texi
1787@end table
1788
1789@node Invoking G++
1790@section Compiling C++ Programs
1791
1792@cindex suffixes for C++ source
1793@cindex C++ source file suffixes
1794C++ source files conventionally use one of the suffixes @samp{.C},
1795@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1796@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1797@samp{.H}, or (for shared template code) @samp{.tcc}; and
1798preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
1799files with these names and compiles them as C++ programs even if you
1800call the compiler the same way as for compiling C programs (usually
1801with the name @command{gcc}).
1802
1803@findex g++
1804@findex c++
1805However, the use of @command{gcc} does not add the C++ library.
1806@command{g++} is a program that calls GCC and automatically specifies linking
1807against the C++ library.  It treats @samp{.c},
1808@samp{.h} and @samp{.i} files as C++ source files instead of C source
1809files unless @option{-x} is used.  This program is also useful when
1810precompiling a C header file with a @samp{.h} extension for use in C++
1811compilations.  On many systems, @command{g++} is also installed with
1812the name @command{c++}.
1813
1814@cindex invoking @command{g++}
1815When you compile C++ programs, you may specify many of the same
1816command-line options that you use for compiling programs in any
1817language; or command-line options meaningful for C and related
1818languages; or options that are meaningful only for C++ programs.
1819@xref{C Dialect Options,,Options Controlling C Dialect}, for
1820explanations of options for languages related to C@.
1821@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1822explanations of options that are meaningful only for C++ programs.
1823
1824@node C Dialect Options
1825@section Options Controlling C Dialect
1826@cindex dialect options
1827@cindex language dialect options
1828@cindex options, dialect
1829
1830The following options control the dialect of C (or languages derived
1831from C, such as C++, Objective-C and Objective-C++) that the compiler
1832accepts:
1833
1834@table @gcctabopt
1835@cindex ANSI support
1836@cindex ISO support
1837@item -ansi
1838@opindex ansi
1839In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1840equivalent to @option{-std=c++98}.
1841
1842This turns off certain features of GCC that are incompatible with ISO
1843C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1844such as the @code{asm} and @code{typeof} keywords, and
1845predefined macros such as @code{unix} and @code{vax} that identify the
1846type of system you are using.  It also enables the undesirable and
1847rarely used ISO trigraph feature.  For the C compiler,
1848it disables recognition of C++ style @samp{//} comments as well as
1849the @code{inline} keyword.
1850
1851The alternate keywords @code{__asm__}, @code{__extension__},
1852@code{__inline__} and @code{__typeof__} continue to work despite
1853@option{-ansi}.  You would not want to use them in an ISO C program, of
1854course, but it is useful to put them in header files that might be included
1855in compilations done with @option{-ansi}.  Alternate predefined macros
1856such as @code{__unix__} and @code{__vax__} are also available, with or
1857without @option{-ansi}.
1858
1859The @option{-ansi} option does not cause non-ISO programs to be
1860rejected gratuitously.  For that, @option{-Wpedantic} is required in
1861addition to @option{-ansi}.  @xref{Warning Options}.
1862
1863The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1864option is used.  Some header files may notice this macro and refrain
1865from declaring certain functions or defining certain macros that the
1866ISO standard doesn't call for; this is to avoid interfering with any
1867programs that might use these names for other things.
1868
1869Functions that are normally built in but do not have semantics
1870defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1871functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
1872built-in functions provided by GCC}, for details of the functions
1873affected.
1874
1875@item -std=
1876@opindex std
1877Determine the language standard. @xref{Standards,,Language Standards
1878Supported by GCC}, for details of these standard versions.  This option
1879is currently only supported when compiling C or C++.
1880
1881The compiler can accept several base standards, such as @samp{c90} or
1882@samp{c++98}, and GNU dialects of those standards, such as
1883@samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
1884compiler accepts all programs following that standard plus those
1885using GNU extensions that do not contradict it.  For example,
1886@option{-std=c90} turns off certain features of GCC that are
1887incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1888keywords, but not other GNU extensions that do not have a meaning in
1889ISO C90, such as omitting the middle term of a @code{?:}
1890expression. On the other hand, when a GNU dialect of a standard is
1891specified, all features supported by the compiler are enabled, even when
1892those features change the meaning of the base standard.  As a result, some
1893strict-conforming programs may be rejected.  The particular standard
1894is used by @option{-Wpedantic} to identify which features are GNU
1895extensions given that version of the standard. For example
1896@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1897comments, while @option{-std=gnu99 -Wpedantic} does not.
1898
1899A value for this option must be provided; possible values are
1900
1901@table @samp
1902@item c90
1903@itemx c89
1904@itemx iso9899:1990
1905Support all ISO C90 programs (certain GNU extensions that conflict
1906with ISO C90 are disabled). Same as @option{-ansi} for C code.
1907
1908@item iso9899:199409
1909ISO C90 as modified in amendment 1.
1910
1911@item c99
1912@itemx c9x
1913@itemx iso9899:1999
1914@itemx iso9899:199x
1915ISO C99.  This standard is substantially completely supported, modulo
1916bugs and floating-point issues
1917(mainly but not entirely relating to optional C99 features from
1918Annexes F and G).  See
1919@w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1920names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1921
1922@item c11
1923@itemx c1x
1924@itemx iso9899:2011
1925ISO C11, the 2011 revision of the ISO C standard.  This standard is
1926substantially completely supported, modulo bugs, floating-point issues
1927(mainly but not entirely relating to optional C11 features from
1928Annexes F and G) and the optional Annexes K (Bounds-checking
1929interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
1930
1931@item c17
1932@itemx c18
1933@itemx iso9899:2017
1934@itemx iso9899:2018
1935ISO C17, the 2017 revision of the ISO C standard
1936(published in 2018).  This standard is
1937same as C11 except for corrections of defects (all of which are also
1938applied with @option{-std=c11}) and a new value of
1939@code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1940
1941@item c2x
1942The next version of the ISO C standard, still under development.  The
1943support for this version is experimental and incomplete.
1944
1945@item gnu90
1946@itemx gnu89
1947GNU dialect of ISO C90 (including some C99 features).
1948
1949@item gnu99
1950@itemx gnu9x
1951GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
1952
1953@item gnu11
1954@itemx gnu1x
1955GNU dialect of ISO C11.
1956The name @samp{gnu1x} is deprecated.
1957
1958@item gnu17
1959@itemx gnu18
1960GNU dialect of ISO C17.  This is the default for C code.
1961
1962@item gnu2x
1963The next version of the ISO C standard, still under development, plus
1964GNU extensions.  The support for this version is experimental and
1965incomplete.
1966
1967@item c++98
1968@itemx c++03
1969The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1970additional defect reports. Same as @option{-ansi} for C++ code.
1971
1972@item gnu++98
1973@itemx gnu++03
1974GNU dialect of @option{-std=c++98}.
1975
1976@item c++11
1977@itemx c++0x
1978The 2011 ISO C++ standard plus amendments.
1979The name @samp{c++0x} is deprecated.
1980
1981@item gnu++11
1982@itemx gnu++0x
1983GNU dialect of @option{-std=c++11}.
1984The name @samp{gnu++0x} is deprecated.
1985
1986@item c++14
1987@itemx c++1y
1988The 2014 ISO C++ standard plus amendments.
1989The name @samp{c++1y} is deprecated.
1990
1991@item gnu++14
1992@itemx gnu++1y
1993GNU dialect of @option{-std=c++14}.
1994This is the default for C++ code.
1995The name @samp{gnu++1y} is deprecated.
1996
1997@item c++17
1998@itemx c++1z
1999The 2017 ISO C++ standard plus amendments.
2000The name @samp{c++1z} is deprecated.
2001
2002@item gnu++17
2003@itemx gnu++1z
2004GNU dialect of @option{-std=c++17}.
2005The name @samp{gnu++1z} is deprecated.
2006
2007@item c++2a
2008The next revision of the ISO C++ standard, tentatively planned for
20092020.  Support is highly experimental, and will almost certainly
2010change in incompatible ways in future releases.
2011
2012@item gnu++2a
2013GNU dialect of @option{-std=c++2a}.  Support is highly experimental,
2014and will almost certainly change in incompatible ways in future
2015releases.
2016@end table
2017
2018@item -fgnu89-inline
2019@opindex fgnu89-inline
2020The option @option{-fgnu89-inline} tells GCC to use the traditional
2021GNU semantics for @code{inline} functions when in C99 mode.
2022@xref{Inline,,An Inline Function is As Fast As a Macro}.
2023Using this option is roughly equivalent to adding the
2024@code{gnu_inline} function attribute to all inline functions
2025(@pxref{Function Attributes}).
2026
2027The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2028C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2029specifies the default behavior).
2030This option is not supported in @option{-std=c90} or
2031@option{-std=gnu90} mode.
2032
2033The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2034@code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2035in effect for @code{inline} functions.  @xref{Common Predefined
2036Macros,,,cpp,The C Preprocessor}.
2037
2038@item -fpermitted-flt-eval-methods=@var{style}
2039@opindex fpermitted-flt-eval-methods
2040@opindex fpermitted-flt-eval-methods=c11
2041@opindex fpermitted-flt-eval-methods=ts-18661-3
2042ISO/IEC TS 18661-3 defines new permissible values for
2043@code{FLT_EVAL_METHOD} that indicate that operations and constants with
2044a semantic type that is an interchange or extended format should be
2045evaluated to the precision and range of that type.  These new values are
2046a superset of those permitted under C99/C11, which does not specify the
2047meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2048conforming to C11 may not have been written expecting the possibility of
2049the new values.
2050
2051@option{-fpermitted-flt-eval-methods} specifies whether the compiler
2052should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2053or the extended set of values specified in ISO/IEC TS 18661-3.
2054
2055@var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2056
2057The default when in a standards compliant mode (@option{-std=c11} or similar)
2058is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2059dialect (@option{-std=gnu11} or similar) is
2060@option{-fpermitted-flt-eval-methods=ts-18661-3}.
2061
2062@item -aux-info @var{filename}
2063@opindex aux-info
2064Output to the given filename prototyped declarations for all functions
2065declared and/or defined in a translation unit, including those in header
2066files.  This option is silently ignored in any language other than C@.
2067
2068Besides declarations, the file indicates, in comments, the origin of
2069each declaration (source file and line), whether the declaration was
2070implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2071@samp{O} for old, respectively, in the first character after the line
2072number and the colon), and whether it came from a declaration or a
2073definition (@samp{C} or @samp{F}, respectively, in the following
2074character).  In the case of function definitions, a K&R-style list of
2075arguments followed by their declarations is also provided, inside
2076comments, after the declaration.
2077
2078@item -fallow-parameterless-variadic-functions
2079@opindex fallow-parameterless-variadic-functions
2080Accept variadic functions without named parameters.
2081
2082Although it is possible to define such a function, this is not very
2083useful as it is not possible to read the arguments.  This is only
2084supported for C as this construct is allowed by C++.
2085
2086@item -fno-asm
2087@opindex fno-asm
2088@opindex fasm
2089Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2090keyword, so that code can use these words as identifiers.  You can use
2091the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2092instead.  @option{-ansi} implies @option{-fno-asm}.
2093
2094In C++, this switch only affects the @code{typeof} keyword, since
2095@code{asm} and @code{inline} are standard keywords.  You may want to
2096use the @option{-fno-gnu-keywords} flag instead, which has the same
2097effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2098switch only affects the @code{asm} and @code{typeof} keywords, since
2099@code{inline} is a standard keyword in ISO C99.
2100
2101@item -fno-builtin
2102@itemx -fno-builtin-@var{function}
2103@opindex fno-builtin
2104@opindex fbuiltin
2105@cindex built-in functions
2106Don't recognize built-in functions that do not begin with
2107@samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2108functions provided by GCC}, for details of the functions affected,
2109including those which are not built-in functions when @option{-ansi} or
2110@option{-std} options for strict ISO C conformance are used because they
2111do not have an ISO standard meaning.
2112
2113GCC normally generates special code to handle certain built-in functions
2114more efficiently; for instance, calls to @code{alloca} may become single
2115instructions which adjust the stack directly, and calls to @code{memcpy}
2116may become inline copy loops.  The resulting code is often both smaller
2117and faster, but since the function calls no longer appear as such, you
2118cannot set a breakpoint on those calls, nor can you change the behavior
2119of the functions by linking with a different library.  In addition,
2120when a function is recognized as a built-in function, GCC may use
2121information about that function to warn about problems with calls to
2122that function, or to generate more efficient code, even if the
2123resulting code still contains calls to that function.  For example,
2124warnings are given with @option{-Wformat} for bad calls to
2125@code{printf} when @code{printf} is built in and @code{strlen} is
2126known not to modify global memory.
2127
2128With the @option{-fno-builtin-@var{function}} option
2129only the built-in function @var{function} is
2130disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2131function is named that is not built-in in this version of GCC, this
2132option is ignored.  There is no corresponding
2133@option{-fbuiltin-@var{function}} option; if you wish to enable
2134built-in functions selectively when using @option{-fno-builtin} or
2135@option{-ffreestanding}, you may define macros such as:
2136
2137@smallexample
2138#define abs(n)          __builtin_abs ((n))
2139#define strcpy(d, s)    __builtin_strcpy ((d), (s))
2140@end smallexample
2141
2142@item -fgimple
2143@opindex fgimple
2144
2145Enable parsing of function definitions marked with @code{__GIMPLE}.
2146This is an experimental feature that allows unit testing of GIMPLE
2147passes.
2148
2149@item -fhosted
2150@opindex fhosted
2151@cindex hosted environment
2152
2153Assert that compilation targets a hosted environment.  This implies
2154@option{-fbuiltin}.  A hosted environment is one in which the
2155entire standard library is available, and in which @code{main} has a return
2156type of @code{int}.  Examples are nearly everything except a kernel.
2157This is equivalent to @option{-fno-freestanding}.
2158
2159@item -ffreestanding
2160@opindex ffreestanding
2161@cindex hosted environment
2162
2163Assert that compilation targets a freestanding environment.  This
2164implies @option{-fno-builtin}.  A freestanding environment
2165is one in which the standard library may not exist, and program startup may
2166not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2167This is equivalent to @option{-fno-hosted}.
2168
2169@xref{Standards,,Language Standards Supported by GCC}, for details of
2170freestanding and hosted environments.
2171
2172@item -fopenacc
2173@opindex fopenacc
2174@cindex OpenACC accelerator programming
2175Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2176@code{!$acc} in Fortran.  When @option{-fopenacc} is specified, the
2177compiler generates accelerated code according to the OpenACC Application
2178Programming Interface v2.0 @w{@uref{https://www.openacc.org}}.  This option
2179implies @option{-pthread}, and thus is only supported on targets that
2180have support for @option{-pthread}.
2181
2182@item -fopenacc-dim=@var{geom}
2183@opindex fopenacc-dim
2184@cindex OpenACC accelerator programming
2185Specify default compute dimensions for parallel offload regions that do
2186not explicitly specify.  The @var{geom} value is a triple of
2187':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2188can be omitted, to use a target-specific default value.
2189
2190@item -fopenmp
2191@opindex fopenmp
2192@cindex OpenMP parallel
2193Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2194@code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
2195compiler generates parallel code according to the OpenMP Application
2196Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2197implies @option{-pthread}, and thus is only supported on targets that
2198have support for @option{-pthread}. @option{-fopenmp} implies
2199@option{-fopenmp-simd}.
2200
2201@item -fopenmp-simd
2202@opindex fopenmp-simd
2203@cindex OpenMP SIMD
2204@cindex SIMD
2205Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2206in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2207are ignored.
2208
2209@item -fgnu-tm
2210@opindex fgnu-tm
2211When the option @option{-fgnu-tm} is specified, the compiler
2212generates code for the Linux variant of Intel's current Transactional
2213Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2214an experimental feature whose interface may change in future versions
2215of GCC, as the official specification changes.  Please note that not
2216all architectures are supported for this feature.
2217
2218For more information on GCC's support for transactional memory,
2219@xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2220Transactional Memory Library}.
2221
2222Note that the transactional memory feature is not supported with
2223non-call exceptions (@option{-fnon-call-exceptions}).
2224
2225@item -fms-extensions
2226@opindex fms-extensions
2227Accept some non-standard constructs used in Microsoft header files.
2228
2229In C++ code, this allows member names in structures to be similar
2230to previous types declarations.
2231
2232@smallexample
2233typedef int UOW;
2234struct ABC @{
2235  UOW UOW;
2236@};
2237@end smallexample
2238
2239Some cases of unnamed fields in structures and unions are only
2240accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2241fields within structs/unions}, for details.
2242
2243Note that this option is off for all targets but x86
2244targets using ms-abi.
2245
2246@item -fplan9-extensions
2247@opindex fplan9-extensions
2248Accept some non-standard constructs used in Plan 9 code.
2249
2250This enables @option{-fms-extensions}, permits passing pointers to
2251structures with anonymous fields to functions that expect pointers to
2252elements of the type of the field, and permits referring to anonymous
2253fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2254struct/union fields within structs/unions}, for details.  This is only
2255supported for C, not C++.
2256
2257@item -fcond-mismatch
2258@opindex fcond-mismatch
2259Allow conditional expressions with mismatched types in the second and
2260third arguments.  The value of such an expression is void.  This option
2261is not supported for C++.
2262
2263@item -flax-vector-conversions
2264@opindex flax-vector-conversions
2265Allow implicit conversions between vectors with differing numbers of
2266elements and/or incompatible element types.  This option should not be
2267used for new code.
2268
2269@item -funsigned-char
2270@opindex funsigned-char
2271Let the type @code{char} be unsigned, like @code{unsigned char}.
2272
2273Each kind of machine has a default for what @code{char} should
2274be.  It is either like @code{unsigned char} by default or like
2275@code{signed char} by default.
2276
2277Ideally, a portable program should always use @code{signed char} or
2278@code{unsigned char} when it depends on the signedness of an object.
2279But many programs have been written to use plain @code{char} and
2280expect it to be signed, or expect it to be unsigned, depending on the
2281machines they were written for.  This option, and its inverse, let you
2282make such a program work with the opposite default.
2283
2284The type @code{char} is always a distinct type from each of
2285@code{signed char} or @code{unsigned char}, even though its behavior
2286is always just like one of those two.
2287
2288@item -fsigned-char
2289@opindex fsigned-char
2290Let the type @code{char} be signed, like @code{signed char}.
2291
2292Note that this is equivalent to @option{-fno-unsigned-char}, which is
2293the negative form of @option{-funsigned-char}.  Likewise, the option
2294@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2295
2296@item -fsigned-bitfields
2297@itemx -funsigned-bitfields
2298@itemx -fno-signed-bitfields
2299@itemx -fno-unsigned-bitfields
2300@opindex fsigned-bitfields
2301@opindex funsigned-bitfields
2302@opindex fno-signed-bitfields
2303@opindex fno-unsigned-bitfields
2304These options control whether a bit-field is signed or unsigned, when the
2305declaration does not use either @code{signed} or @code{unsigned}.  By
2306default, such a bit-field is signed, because this is consistent: the
2307basic integer types such as @code{int} are signed types.
2308
2309@item -fsso-struct=@var{endianness}
2310@opindex fsso-struct
2311Set the default scalar storage order of structures and unions to the
2312specified endianness.  The accepted values are @samp{big-endian},
2313@samp{little-endian} and @samp{native} for the native endianness of
2314the target (the default).  This option is not supported for C++.
2315
2316@strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2317code that is not binary compatible with code generated without it if the
2318specified endianness is not the native endianness of the target.
2319@end table
2320
2321@node C++ Dialect Options
2322@section Options Controlling C++ Dialect
2323
2324@cindex compiler options, C++
2325@cindex C++ options, command-line
2326@cindex options, C++
2327This section describes the command-line options that are only meaningful
2328for C++ programs.  You can also use most of the GNU compiler options
2329regardless of what language your program is in.  For example, you
2330might compile a file @file{firstClass.C} like this:
2331
2332@smallexample
2333g++ -g -fstrict-enums -O -c firstClass.C
2334@end smallexample
2335
2336@noindent
2337In this example, only @option{-fstrict-enums} is an option meant
2338only for C++ programs; you can use the other options with any
2339language supported by GCC@.
2340
2341Some options for compiling C programs, such as @option{-std}, are also
2342relevant for C++ programs.
2343@xref{C Dialect Options,,Options Controlling C Dialect}.
2344
2345Here is a list of options that are @emph{only} for compiling C++ programs:
2346
2347@table @gcctabopt
2348
2349@item -fabi-version=@var{n}
2350@opindex fabi-version
2351Use version @var{n} of the C++ ABI@.  The default is version 0.
2352
2353Version 0 refers to the version conforming most closely to
2354the C++ ABI specification.  Therefore, the ABI obtained using version 0
2355will change in different versions of G++ as ABI bugs are fixed.
2356
2357Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2358
2359Version 2 is the version of the C++ ABI that first appeared in G++
23603.4, and was the default through G++ 4.9.
2361
2362Version 3 corrects an error in mangling a constant address as a
2363template argument.
2364
2365Version 4, which first appeared in G++ 4.5, implements a standard
2366mangling for vector types.
2367
2368Version 5, which first appeared in G++ 4.6, corrects the mangling of
2369attribute const/volatile on function pointer types, decltype of a
2370plain decl, and use of a function parameter in the declaration of
2371another parameter.
2372
2373Version 6, which first appeared in G++ 4.7, corrects the promotion
2374behavior of C++11 scoped enums and the mangling of template argument
2375packs, const/static_cast, prefix ++ and --, and a class scope function
2376used as a template argument.
2377
2378Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2379builtin type and corrects the mangling of lambdas in default argument
2380scope.
2381
2382Version 8, which first appeared in G++ 4.9, corrects the substitution
2383behavior of function types with function-cv-qualifiers.
2384
2385Version 9, which first appeared in G++ 5.2, corrects the alignment of
2386@code{nullptr_t}.
2387
2388Version 10, which first appeared in G++ 6.1, adds mangling of
2389attributes that affect type identity, such as ia32 calling convention
2390attributes (e.g.@: @samp{stdcall}).
2391
2392Version 11, which first appeared in G++ 7, corrects the mangling of
2393sizeof... expressions and operator names.  For multiple entities with
2394the same name within a function, that are declared in different scopes,
2395the mangling now changes starting with the twelfth occurrence.  It also
2396implies @option{-fnew-inheriting-ctors}.
2397
2398Version 12, which first appeared in G++ 8, corrects the calling
2399conventions for empty classes on the x86_64 target and for classes
2400with only deleted copy/move constructors.  It accidentally changes the
2401calling convention for classes with a deleted copy constructor and a
2402trivial move constructor.
2403
2404Version 13, which first appeared in G++ 8.2, fixes the accidental
2405change in version 12.
2406
2407See also @option{-Wabi}.
2408
2409@item -fabi-compat-version=@var{n}
2410@opindex fabi-compat-version
2411On targets that support strong aliases, G++
2412works around mangling changes by creating an alias with the correct
2413mangled name when defining a symbol with an incorrect mangled name.
2414This switch specifies which ABI version to use for the alias.
2415
2416With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2417compatibility).  If another ABI version is explicitly selected, this
2418defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
2419use @option{-fabi-compat-version=2}.
2420
2421If this option is not provided but @option{-Wabi=@var{n}} is, that
2422version is used for compatibility aliases.  If this option is provided
2423along with @option{-Wabi} (without the version), the version from this
2424option is used for the warning.
2425
2426@item -fno-access-control
2427@opindex fno-access-control
2428@opindex faccess-control
2429Turn off all access checking.  This switch is mainly useful for working
2430around bugs in the access control code.
2431
2432@item -faligned-new
2433@opindex faligned-new
2434Enable support for C++17 @code{new} of types that require more
2435alignment than @code{void* ::operator new(std::size_t)} provides.  A
2436numeric argument such as @code{-faligned-new=32} can be used to
2437specify how much alignment (in bytes) is provided by that function,
2438but few users will need to override the default of
2439@code{alignof(std::max_align_t)}.
2440
2441This flag is enabled by default for @option{-std=c++17}.
2442
2443@item -fchar8_t
2444@itemx -fno-char8_t
2445@opindex fchar8_t
2446@opindex fno-char8_t
2447Enable support for @code{char8_t} as adopted for C++2a.  This includes
2448the addition of a new @code{char8_t} fundamental type, changes to the
2449types of UTF-8 string and character literals, new signatures for
2450user-defined literals, associated standard library updates, and new
2451@code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2452
2453This option enables functions to be overloaded for ordinary and UTF-8
2454strings:
2455
2456@smallexample
2457int f(const char *);    // #1
2458int f(const char8_t *); // #2
2459int v1 = f("text");     // Calls #1
2460int v2 = f(u8"text");   // Calls #2
2461@end smallexample
2462
2463@noindent
2464and introduces new signatures for user-defined literals:
2465
2466@smallexample
2467int operator""_udl1(char8_t);
2468int v3 = u8'x'_udl1;
2469int operator""_udl2(const char8_t*, std::size_t);
2470int v4 = u8"text"_udl2;
2471template<typename T, T...> int operator""_udl3();
2472int v5 = u8"text"_udl3;
2473@end smallexample
2474
2475@noindent
2476The change to the types of UTF-8 string and character literals introduces
2477incompatibilities with ISO C++11 and later standards.  For example, the
2478following code is well-formed under ISO C++11, but is ill-formed when
2479@option{-fchar8_t} is specified.
2480
2481@smallexample
2482char ca[] = u8"xx";     // error: char-array initialized from wide
2483                        //        string
2484const char *cp = u8"xx";// error: invalid conversion from
2485                        //        `const char8_t*' to `const char*'
2486int f(const char*);
2487auto v = f(u8"xx");     // error: invalid conversion from
2488                        //        `const char8_t*' to `const char*'
2489std::string s@{u8"xx"@};  // error: no matching function for call to
2490                        //        `std::basic_string<char>::basic_string()'
2491using namespace std::literals;
2492s = u8"xx"s;            // error: conversion from
2493                        //        `basic_string<char8_t>' to non-scalar
2494                        //        type `basic_string<char>' requested
2495@end smallexample
2496
2497@item -fcheck-new
2498@opindex fcheck-new
2499Check that the pointer returned by @code{operator new} is non-null
2500before attempting to modify the storage allocated.  This check is
2501normally unnecessary because the C++ standard specifies that
2502@code{operator new} only returns @code{0} if it is declared
2503@code{throw()}, in which case the compiler always checks the
2504return value even without this option.  In all other cases, when
2505@code{operator new} has a non-empty exception specification, memory
2506exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
2507@samp{new (nothrow)}.
2508
2509@item -fconcepts
2510@opindex fconcepts
2511Enable support for the C++ Extensions for Concepts Technical
2512Specification, ISO 19217 (2015), which allows code like
2513
2514@smallexample
2515template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2516template <Addable T> T add (T a, T b) @{ return a + b; @}
2517@end smallexample
2518
2519@item -fconstexpr-depth=@var{n}
2520@opindex fconstexpr-depth
2521Set the maximum nested evaluation depth for C++11 constexpr functions
2522to @var{n}.  A limit is needed to detect endless recursion during
2523constant expression evaluation.  The minimum specified by the standard
2524is 512.
2525
2526@item -fconstexpr-loop-limit=@var{n}
2527@opindex fconstexpr-loop-limit
2528Set the maximum number of iterations for a loop in C++14 constexpr functions
2529to @var{n}.  A limit is needed to detect infinite loops during
2530constant expression evaluation.  The default is 262144 (1<<18).
2531
2532@item -fconstexpr-ops-limit=@var{n}
2533@opindex fconstexpr-ops-limit
2534Set the maximum number of operations during a single constexpr evaluation.
2535Even when number of iterations of a single loop is limited with the above limit,
2536if there are several nested loops and each of them has many iterations but still
2537smaller than the above limit, or if in a body of some loop or even outside
2538of a loop too many expressions need to be evaluated, the resulting constexpr
2539evaluation might take too long.
2540The default is 33554432 (1<<25).
2541
2542@item -fdeduce-init-list
2543@opindex fdeduce-init-list
2544Enable deduction of a template type parameter as
2545@code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2546
2547@smallexample
2548template <class T> auto forward(T t) -> decltype (realfn (t))
2549@{
2550  return realfn (t);
2551@}
2552
2553void f()
2554@{
2555  forward(@{1,2@}); // call forward<std::initializer_list<int>>
2556@}
2557@end smallexample
2558
2559This deduction was implemented as a possible extension to the
2560originally proposed semantics for the C++11 standard, but was not part
2561of the final standard, so it is disabled by default.  This option is
2562deprecated, and may be removed in a future version of G++.
2563
2564@item -fno-elide-constructors
2565@opindex fno-elide-constructors
2566@opindex felide-constructors
2567The C++ standard allows an implementation to omit creating a temporary
2568that is only used to initialize another object of the same type.
2569Specifying this option disables that optimization, and forces G++ to
2570call the copy constructor in all cases.  This option also causes G++
2571to call trivial member functions which otherwise would be expanded inline.
2572
2573In C++17, the compiler is required to omit these temporaries, but this
2574option still affects trivial member functions.
2575
2576@item -fno-enforce-eh-specs
2577@opindex fno-enforce-eh-specs
2578@opindex fenforce-eh-specs
2579Don't generate code to check for violation of exception specifications
2580at run time.  This option violates the C++ standard, but may be useful
2581for reducing code size in production builds, much like defining
2582@code{NDEBUG}.  This does not give user code permission to throw
2583exceptions in violation of the exception specifications; the compiler
2584still optimizes based on the specifications, so throwing an
2585unexpected exception results in undefined behavior at run time.
2586
2587@item -fextern-tls-init
2588@itemx -fno-extern-tls-init
2589@opindex fextern-tls-init
2590@opindex fno-extern-tls-init
2591The C++11 and OpenMP standards allow @code{thread_local} and
2592@code{threadprivate} variables to have dynamic (runtime)
2593initialization.  To support this, any use of such a variable goes
2594through a wrapper function that performs any necessary initialization.
2595When the use and definition of the variable are in the same
2596translation unit, this overhead can be optimized away, but when the
2597use is in a different translation unit there is significant overhead
2598even if the variable doesn't actually need dynamic initialization.  If
2599the programmer can be sure that no use of the variable in a
2600non-defining TU needs to trigger dynamic initialization (either
2601because the variable is statically initialized, or a use of the
2602variable in the defining TU will be executed before any uses in
2603another TU), they can avoid this overhead with the
2604@option{-fno-extern-tls-init} option.
2605
2606On targets that support symbol aliases, the default is
2607@option{-fextern-tls-init}.  On targets that do not support symbol
2608aliases, the default is @option{-fno-extern-tls-init}.
2609
2610@item -fno-gnu-keywords
2611@opindex fno-gnu-keywords
2612@opindex fgnu-keywords
2613Do not recognize @code{typeof} as a keyword, so that code can use this
2614word as an identifier.  You can use the keyword @code{__typeof__} instead.
2615This option is implied by the strict ISO C++ dialects: @option{-ansi},
2616@option{-std=c++98}, @option{-std=c++11}, etc.
2617
2618@item -fno-implicit-templates
2619@opindex fno-implicit-templates
2620@opindex fimplicit-templates
2621Never emit code for non-inline templates that are instantiated
2622implicitly (i.e.@: by use); only emit code for explicit instantiations.
2623If you use this option, you must take care to structure your code to
2624include all the necessary explicit instantiations to avoid getting
2625undefined symbols at link time.
2626@xref{Template Instantiation}, for more information.
2627
2628@item -fno-implicit-inline-templates
2629@opindex fno-implicit-inline-templates
2630@opindex fimplicit-inline-templates
2631Don't emit code for implicit instantiations of inline templates, either.
2632The default is to handle inlines differently so that compiles with and
2633without optimization need the same set of explicit instantiations.
2634
2635@item -fno-implement-inlines
2636@opindex fno-implement-inlines
2637@opindex fimplement-inlines
2638To save space, do not emit out-of-line copies of inline functions
2639controlled by @code{#pragma implementation}.  This causes linker
2640errors if these functions are not inlined everywhere they are called.
2641
2642@item -fms-extensions
2643@opindex fms-extensions
2644Disable Wpedantic warnings about constructs used in MFC, such as implicit
2645int and getting a pointer to member function via non-standard syntax.
2646
2647@item -fnew-inheriting-ctors
2648@opindex fnew-inheriting-ctors
2649Enable the P0136 adjustment to the semantics of C++11 constructor
2650inheritance.  This is part of C++17 but also considered to be a Defect
2651Report against C++11 and C++14.  This flag is enabled by default
2652unless @option{-fabi-version=10} or lower is specified.
2653
2654@item -fnew-ttp-matching
2655@opindex fnew-ttp-matching
2656Enable the P0522 resolution to Core issue 150, template template
2657parameters and default arguments: this allows a template with default
2658template arguments as an argument for a template template parameter
2659with fewer template parameters.  This flag is enabled by default for
2660@option{-std=c++17}.
2661
2662@item -fno-nonansi-builtins
2663@opindex fno-nonansi-builtins
2664@opindex fnonansi-builtins
2665Disable built-in declarations of functions that are not mandated by
2666ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
2667@code{index}, @code{bzero}, @code{conjf}, and other related functions.
2668
2669@item -fnothrow-opt
2670@opindex fnothrow-opt
2671Treat a @code{throw()} exception specification as if it were a
2672@code{noexcept} specification to reduce or eliminate the text size
2673overhead relative to a function with no exception specification.  If
2674the function has local variables of types with non-trivial
2675destructors, the exception specification actually makes the
2676function smaller because the EH cleanups for those variables can be
2677optimized away.  The semantic effect is that an exception thrown out of
2678a function with such an exception specification results in a call
2679to @code{terminate} rather than @code{unexpected}.
2680
2681@item -fno-operator-names
2682@opindex fno-operator-names
2683@opindex foperator-names
2684Do not treat the operator name keywords @code{and}, @code{bitand},
2685@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2686synonyms as keywords.
2687
2688@item -fno-optional-diags
2689@opindex fno-optional-diags
2690@opindex foptional-diags
2691Disable diagnostics that the standard says a compiler does not need to
2692issue.  Currently, the only such diagnostic issued by G++ is the one for
2693a name having multiple meanings within a class.
2694
2695@item -fpermissive
2696@opindex fpermissive
2697Downgrade some diagnostics about nonconformant code from errors to
2698warnings.  Thus, using @option{-fpermissive} allows some
2699nonconforming code to compile.
2700
2701@item -fno-pretty-templates
2702@opindex fno-pretty-templates
2703@opindex fpretty-templates
2704When an error message refers to a specialization of a function
2705template, the compiler normally prints the signature of the
2706template followed by the template arguments and any typedefs or
2707typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2708rather than @code{void f(int)}) so that it's clear which template is
2709involved.  When an error message refers to a specialization of a class
2710template, the compiler omits any template arguments that match
2711the default template arguments for that template.  If either of these
2712behaviors make it harder to understand the error message rather than
2713easier, you can use @option{-fno-pretty-templates} to disable them.
2714
2715@item -frepo
2716@opindex frepo
2717Enable automatic template instantiation at link time.  This option also
2718implies @option{-fno-implicit-templates}.  @xref{Template
2719Instantiation}, for more information.
2720
2721@item -fno-rtti
2722@opindex fno-rtti
2723@opindex frtti
2724Disable generation of information about every class with virtual
2725functions for use by the C++ run-time type identification features
2726(@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
2727of the language, you can save some space by using this flag.  Note that
2728exception handling uses the same information, but G++ generates it as
2729needed. The @code{dynamic_cast} operator can still be used for casts that
2730do not require run-time type information, i.e.@: casts to @code{void *} or to
2731unambiguous base classes.
2732
2733Mixing code compiled with @option{-frtti} with that compiled with
2734@option{-fno-rtti} may not work.  For example, programs may
2735fail to link if a class compiled with @option{-fno-rtti} is used as a base
2736for a class compiled with @option{-frtti}.
2737
2738@item -fsized-deallocation
2739@opindex fsized-deallocation
2740Enable the built-in global declarations
2741@smallexample
2742void operator delete (void *, std::size_t) noexcept;
2743void operator delete[] (void *, std::size_t) noexcept;
2744@end smallexample
2745as introduced in C++14.  This is useful for user-defined replacement
2746deallocation functions that, for example, use the size of the object
2747to make deallocation faster.  Enabled by default under
2748@option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
2749warns about places that might want to add a definition.
2750
2751@item -fstrict-enums
2752@opindex fstrict-enums
2753Allow the compiler to optimize using the assumption that a value of
2754enumerated type can only be one of the values of the enumeration (as
2755defined in the C++ standard; basically, a value that can be
2756represented in the minimum number of bits needed to represent all the
2757enumerators).  This assumption may not be valid if the program uses a
2758cast to convert an arbitrary integer value to the enumerated type.
2759
2760@item -fstrong-eval-order
2761@opindex fstrong-eval-order
2762Evaluate member access, array subscripting, and shift expressions in
2763left-to-right order, and evaluate assignment in right-to-left order,
2764as adopted for C++17.  Enabled by default with @option{-std=c++17}.
2765@option{-fstrong-eval-order=some} enables just the ordering of member
2766access and shift expressions, and is the default without
2767@option{-std=c++17}.
2768
2769@item -ftemplate-backtrace-limit=@var{n}
2770@opindex ftemplate-backtrace-limit
2771Set the maximum number of template instantiation notes for a single
2772warning or error to @var{n}.  The default value is 10.
2773
2774@item -ftemplate-depth=@var{n}
2775@opindex ftemplate-depth
2776Set the maximum instantiation depth for template classes to @var{n}.
2777A limit on the template instantiation depth is needed to detect
2778endless recursions during template class instantiation.  ANSI/ISO C++
2779conforming programs must not rely on a maximum depth greater than 17
2780(changed to 1024 in C++11).  The default value is 900, as the compiler
2781can run out of stack space before hitting 1024 in some situations.
2782
2783@item -fno-threadsafe-statics
2784@opindex fno-threadsafe-statics
2785@opindex fthreadsafe-statics
2786Do not emit the extra code to use the routines specified in the C++
2787ABI for thread-safe initialization of local statics.  You can use this
2788option to reduce code size slightly in code that doesn't need to be
2789thread-safe.
2790
2791@item -fuse-cxa-atexit
2792@opindex fuse-cxa-atexit
2793Register destructors for objects with static storage duration with the
2794@code{__cxa_atexit} function rather than the @code{atexit} function.
2795This option is required for fully standards-compliant handling of static
2796destructors, but only works if your C library supports
2797@code{__cxa_atexit}.
2798
2799@item -fno-use-cxa-get-exception-ptr
2800@opindex fno-use-cxa-get-exception-ptr
2801@opindex fuse-cxa-get-exception-ptr
2802Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
2803causes @code{std::uncaught_exception} to be incorrect, but is necessary
2804if the runtime routine is not available.
2805
2806@item -fvisibility-inlines-hidden
2807@opindex fvisibility-inlines-hidden
2808This switch declares that the user does not attempt to compare
2809pointers to inline functions or methods where the addresses of the two functions
2810are taken in different shared objects.
2811
2812The effect of this is that GCC may, effectively, mark inline methods with
2813@code{__attribute__ ((visibility ("hidden")))} so that they do not
2814appear in the export table of a DSO and do not require a PLT indirection
2815when used within the DSO@.  Enabling this option can have a dramatic effect
2816on load and link times of a DSO as it massively reduces the size of the
2817dynamic export table when the library makes heavy use of templates.
2818
2819The behavior of this switch is not quite the same as marking the
2820methods as hidden directly, because it does not affect static variables
2821local to the function or cause the compiler to deduce that
2822the function is defined in only one shared object.
2823
2824You may mark a method as having a visibility explicitly to negate the
2825effect of the switch for that method.  For example, if you do want to
2826compare pointers to a particular inline method, you might mark it as
2827having default visibility.  Marking the enclosing class with explicit
2828visibility has no effect.
2829
2830Explicitly instantiated inline methods are unaffected by this option
2831as their linkage might otherwise cross a shared library boundary.
2832@xref{Template Instantiation}.
2833
2834@item -fvisibility-ms-compat
2835@opindex fvisibility-ms-compat
2836This flag attempts to use visibility settings to make GCC's C++
2837linkage model compatible with that of Microsoft Visual Studio.
2838
2839The flag makes these changes to GCC's linkage model:
2840
2841@enumerate
2842@item
2843It sets the default visibility to @code{hidden}, like
2844@option{-fvisibility=hidden}.
2845
2846@item
2847Types, but not their members, are not hidden by default.
2848
2849@item
2850The One Definition Rule is relaxed for types without explicit
2851visibility specifications that are defined in more than one
2852shared object: those declarations are permitted if they are
2853permitted when this option is not used.
2854@end enumerate
2855
2856In new code it is better to use @option{-fvisibility=hidden} and
2857export those classes that are intended to be externally visible.
2858Unfortunately it is possible for code to rely, perhaps accidentally,
2859on the Visual Studio behavior.
2860
2861Among the consequences of these changes are that static data members
2862of the same type with the same name but defined in different shared
2863objects are different, so changing one does not change the other;
2864and that pointers to function members defined in different shared
2865objects may not compare equal.  When this flag is given, it is a
2866violation of the ODR to define types with the same name differently.
2867
2868@item -fno-weak
2869@opindex fno-weak
2870@opindex fweak
2871Do not use weak symbol support, even if it is provided by the linker.
2872By default, G++ uses weak symbols if they are available.  This
2873option exists only for testing, and should not be used by end-users;
2874it results in inferior code and has no benefits.  This option may
2875be removed in a future release of G++.
2876
2877@item -nostdinc++
2878@opindex nostdinc++
2879Do not search for header files in the standard directories specific to
2880C++, but do still search the other standard directories.  (This option
2881is used when building the C++ library.)
2882@end table
2883
2884In addition, these optimization, warning, and code generation options
2885have meanings only for C++ programs:
2886
2887@table @gcctabopt
2888@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2889@opindex Wabi
2890@opindex Wno-abi
2891Warn when G++ it generates code that is probably not compatible with
2892the vendor-neutral C++ ABI@.  Since G++ now defaults to updating the
2893ABI with each major release, normally @option{-Wabi} will warn only if
2894there is a check added later in a release series for an ABI issue
2895discovered since the initial release.  @option{-Wabi} will warn about
2896more things if an older ABI version is selected (with
2897@option{-fabi-version=@var{n}}).
2898
2899@option{-Wabi} can also be used with an explicit version number to
2900warn about compatibility with a particular @option{-fabi-version}
2901level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2902@option{-fabi-version=2}.
2903
2904If an explicit version number is provided and
2905@option{-fabi-compat-version} is not specified, the version number
2906from this option is used for compatibility aliases.  If no explicit
2907version number is provided with this option, but
2908@option{-fabi-compat-version} is specified, that version number is
2909used for ABI warnings.
2910
2911Although an effort has been made to warn about
2912all such cases, there are probably some cases that are not warned about,
2913even though G++ is generating incompatible code.  There may also be
2914cases where warnings are emitted even though the code that is generated
2915is compatible.
2916
2917You should rewrite your code to avoid these warnings if you are
2918concerned about the fact that code generated by G++ may not be binary
2919compatible with code generated by other compilers.
2920
2921Known incompatibilities in @option{-fabi-version=2} (which was the
2922default from GCC 3.4 to 4.9) include:
2923
2924@itemize @bullet
2925
2926@item
2927A template with a non-type template parameter of reference type was
2928mangled incorrectly:
2929@smallexample
2930extern int N;
2931template <int &> struct S @{@};
2932void n (S<N>) @{2@}
2933@end smallexample
2934
2935This was fixed in @option{-fabi-version=3}.
2936
2937@item
2938SIMD vector types declared using @code{__attribute ((vector_size))} were
2939mangled in a non-standard way that does not allow for overloading of
2940functions taking vectors of different sizes.
2941
2942The mangling was changed in @option{-fabi-version=4}.
2943
2944@item
2945@code{__attribute ((const))} and @code{noreturn} were mangled as type
2946qualifiers, and @code{decltype} of a plain declaration was folded away.
2947
2948These mangling issues were fixed in @option{-fabi-version=5}.
2949
2950@item
2951Scoped enumerators passed as arguments to a variadic function are
2952promoted like unscoped enumerators, causing @code{va_arg} to complain.
2953On most targets this does not actually affect the parameter passing
2954ABI, as there is no way to pass an argument smaller than @code{int}.
2955
2956Also, the ABI changed the mangling of template argument packs,
2957@code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2958a class scope function used as a template argument.
2959
2960These issues were corrected in @option{-fabi-version=6}.
2961
2962@item
2963Lambdas in default argument scope were mangled incorrectly, and the
2964ABI changed the mangling of @code{nullptr_t}.
2965
2966These issues were corrected in @option{-fabi-version=7}.
2967
2968@item
2969When mangling a function type with function-cv-qualifiers, the
2970un-qualified function type was incorrectly treated as a substitution
2971candidate.
2972
2973This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2974
2975@item
2976@code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2977unaligned accesses.  Note that this did not affect the ABI of a
2978function with a @code{nullptr_t} parameter, as parameters have a
2979minimum alignment.
2980
2981This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2982
2983@item
2984Target-specific attributes that affect the identity of a type, such as
2985ia32 calling conventions on a function type (stdcall, regparm, etc.),
2986did not affect the mangled name, leading to name collisions when
2987function pointers were used as template arguments.
2988
2989This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2990
2991@end itemize
2992
2993It also warns about psABI-related changes.  The known psABI changes at this
2994point include:
2995
2996@itemize @bullet
2997
2998@item
2999For SysV/x86-64, unions with @code{long double} members are
3000passed in memory as specified in psABI.  For example:
3001
3002@smallexample
3003union U @{
3004  long double ld;
3005  int i;
3006@};
3007@end smallexample
3008
3009@noindent
3010@code{union U} is always passed in memory.
3011
3012@end itemize
3013
3014@item -Wabi-tag @r{(C++ and Objective-C++ only)}
3015@opindex Wabi-tag
3016@opindex Wabi-tag
3017Warn when a type with an ABI tag is used in a context that does not
3018have that ABI tag.  See @ref{C++ Attributes} for more information
3019about ABI tags.
3020
3021@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3022@opindex Wctor-dtor-privacy
3023@opindex Wno-ctor-dtor-privacy
3024Warn when a class seems unusable because all the constructors or
3025destructors in that class are private, and it has neither friends nor
3026public static member functions.  Also warn if there are no non-private
3027methods, and there's at least one private member function that isn't
3028a constructor or destructor.
3029
3030@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3031@opindex Wdelete-non-virtual-dtor
3032@opindex Wno-delete-non-virtual-dtor
3033Warn when @code{delete} is used to destroy an instance of a class that
3034has virtual functions and non-virtual destructor. It is unsafe to delete
3035an instance of a derived class through a pointer to a base class if the
3036base class does not have a virtual destructor.  This warning is enabled
3037by @option{-Wall}.
3038
3039@item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3040@opindex Wdeprecated-copy
3041@opindex Wno-deprecated-copy
3042Warn that the implicit declaration of a copy constructor or copy
3043assignment operator is deprecated if the class has a user-provided
3044copy constructor or copy assignment operator, in C++11 and up.  This
3045warning is enabled by @option{-Wextra}.  With
3046@option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3047user-provided destructor.
3048
3049@item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3050@opindex Winit-list-lifetime
3051@opindex Wno-init-list-lifetime
3052Do not warn about uses of @code{std::initializer_list} that are likely
3053to result in dangling pointers.  Since the underlying array for an
3054@code{initializer_list} is handled like a normal C++ temporary object,
3055it is easy to inadvertently keep a pointer to the array past the end
3056of the array's lifetime.  For example:
3057
3058@itemize @bullet
3059@item
3060If a function returns a temporary @code{initializer_list}, or a local
3061@code{initializer_list} variable, the array's lifetime ends at the end
3062of the return statement, so the value returned has a dangling pointer.
3063
3064@item
3065If a new-expression creates an @code{initializer_list}, the array only
3066lives until the end of the enclosing full-expression, so the
3067@code{initializer_list} in the heap has a dangling pointer.
3068
3069@item
3070When an @code{initializer_list} variable is assigned from a
3071brace-enclosed initializer list, the temporary array created for the
3072right side of the assignment only lives until the end of the
3073full-expression, so at the next statement the @code{initializer_list}
3074variable has a dangling pointer.
3075
3076@smallexample
3077// li's initial underlying array lives as long as li
3078std::initializer_list<int> li = @{ 1,2,3 @};
3079// assignment changes li to point to a temporary array
3080li = @{ 4, 5 @};
3081// now the temporary is gone and li has a dangling pointer
3082int i = li.begin()[0] // undefined behavior
3083@end smallexample
3084
3085@item
3086When a list constructor stores the @code{begin} pointer from the
3087@code{initializer_list} argument, this doesn't extend the lifetime of
3088the array, so if a class variable is constructed from a temporary
3089@code{initializer_list}, the pointer is left dangling by the end of
3090the variable declaration statement.
3091
3092@end itemize
3093
3094@item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3095@opindex Wliteral-suffix
3096@opindex Wno-literal-suffix
3097Warn when a string or character literal is followed by a ud-suffix which does
3098not begin with an underscore.  As a conforming extension, GCC treats such
3099suffixes as separate preprocessing tokens in order to maintain backwards
3100compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3101For example:
3102
3103@smallexample
3104#define __STDC_FORMAT_MACROS
3105#include <inttypes.h>
3106#include <stdio.h>
3107
3108int main() @{
3109  int64_t i64 = 123;
3110  printf("My int64: %" PRId64"\n", i64);
3111@}
3112@end smallexample
3113
3114In this case, @code{PRId64} is treated as a separate preprocessing token.
3115
3116Additionally, warn when a user-defined literal operator is declared with
3117a literal suffix identifier that doesn't begin with an underscore. Literal
3118suffix identifiers that don't begin with an underscore are reserved for
3119future standardization.
3120
3121This warning is enabled by default.
3122
3123@item -Wlto-type-mismatch
3124@opindex Wlto-type-mismatch
3125@opindex Wno-lto-type-mismatch
3126
3127During the link-time optimization warn about type mismatches in
3128global declarations from different compilation units.
3129Requires @option{-flto} to be enabled.  Enabled by default.
3130
3131@item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3132@opindex Wnarrowing
3133@opindex Wno-narrowing
3134For C++11 and later standards, narrowing conversions are diagnosed by default,
3135as required by the standard.  A narrowing conversion from a constant produces
3136an error, and a narrowing conversion from a non-constant produces a warning,
3137but @option{-Wno-narrowing} suppresses the diagnostic.
3138Note that this does not affect the meaning of well-formed code;
3139narrowing conversions are still considered ill-formed in SFINAE contexts.
3140
3141With @option{-Wnarrowing} in C++98, warn when a narrowing
3142conversion prohibited by C++11 occurs within
3143@samp{@{ @}}, e.g.
3144
3145@smallexample
3146int i = @{ 2.2 @}; // error: narrowing from double to int
3147@end smallexample
3148
3149This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3150
3151@item -Wnoexcept @r{(C++ and Objective-C++ only)}
3152@opindex Wnoexcept
3153@opindex Wno-noexcept
3154Warn when a noexcept-expression evaluates to false because of a call
3155to a function that does not have a non-throwing exception
3156specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3157the compiler to never throw an exception.
3158
3159@item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3160@opindex Wnoexcept-type
3161@opindex Wno-noexcept-type
3162Warn if the C++17 feature making @code{noexcept} part of a function
3163type changes the mangled name of a symbol relative to C++14.  Enabled
3164by @option{-Wabi} and @option{-Wc++17-compat}.
3165
3166As an example:
3167
3168@smallexample
3169template <class T> void f(T t) @{ t(); @};
3170void g() noexcept;
3171void h() @{ f(g); @}
3172@end smallexample
3173
3174@noindent
3175In C++14, @code{f} calls @code{f<void(*)()>}, but in
3176C++17 it calls @code{f<void(*)()noexcept>}.
3177
3178@item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3179@opindex Wclass-memaccess
3180@opindex Wno-class-memaccess
3181Warn when the destination of a call to a raw memory function such as
3182@code{memset} or @code{memcpy} is an object of class type, and when writing
3183into such an object might bypass the class non-trivial or deleted constructor
3184or copy assignment, violate const-correctness or encapsulation, or corrupt
3185virtual table pointers.  Modifying the representation of such objects may
3186violate invariants maintained by member functions of the class.  For example,
3187the call to @code{memset} below is undefined because it modifies a non-trivial
3188class object and is, therefore, diagnosed.  The safe way to either initialize
3189or clear the storage of objects of such types is by using the appropriate
3190constructor or assignment operator, if one is available.
3191@smallexample
3192std::string str = "abc";
3193memset (&str, 0, sizeof str);
3194@end smallexample
3195The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3196Explicitly casting the pointer to the class object to @code{void *} or
3197to a type that can be safely accessed by the raw memory function suppresses
3198the warning.
3199
3200@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3201@opindex Wnon-virtual-dtor
3202@opindex Wno-non-virtual-dtor
3203Warn when a class has virtual functions and an accessible non-virtual
3204destructor itself or in an accessible polymorphic base class, in which
3205case it is possible but unsafe to delete an instance of a derived
3206class through a pointer to the class itself or base class.  This
3207warning is automatically enabled if @option{-Weffc++} is specified.
3208
3209@item -Wregister @r{(C++ and Objective-C++ only)}
3210@opindex Wregister
3211@opindex Wno-register
3212Warn on uses of the @code{register} storage class specifier, except
3213when it is part of the GNU @ref{Explicit Register Variables} extension.
3214The use of the @code{register} keyword as storage class specifier has
3215been deprecated in C++11 and removed in C++17.
3216Enabled by default with @option{-std=c++17}.
3217
3218@item -Wreorder @r{(C++ and Objective-C++ only)}
3219@opindex Wreorder
3220@opindex Wno-reorder
3221@cindex reordering, warning
3222@cindex warning for reordering of member initializers
3223Warn when the order of member initializers given in the code does not
3224match the order in which they must be executed.  For instance:
3225
3226@smallexample
3227struct A @{
3228  int i;
3229  int j;
3230  A(): j (0), i (1) @{ @}
3231@};
3232@end smallexample
3233
3234@noindent
3235The compiler rearranges the member initializers for @code{i}
3236and @code{j} to match the declaration order of the members, emitting
3237a warning to that effect.  This warning is enabled by @option{-Wall}.
3238
3239@item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3240@opindex Wpessimizing-move
3241@opindex Wno-pessimizing-move
3242This warning warns when a call to @code{std::move} prevents copy
3243elision.  A typical scenario when copy elision can occur is when returning in
3244a function with a class return type, when the expression being returned is the
3245name of a non-volatile automatic object, and is not a function parameter, and
3246has the same type as the function return type.
3247
3248@smallexample
3249struct T @{
3250@dots{}
3251@};
3252T fn()
3253@{
3254  T t;
3255  @dots{}
3256  return std::move (t);
3257@}
3258@end smallexample
3259
3260But in this example, the @code{std::move} call prevents copy elision.
3261
3262This warning is enabled by @option{-Wall}.
3263
3264@item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3265@opindex Wredundant-move
3266@opindex Wno-redundant-move
3267This warning warns about redundant calls to @code{std::move}; that is, when
3268a move operation would have been performed even without the @code{std::move}
3269call.  This happens because the compiler is forced to treat the object as if
3270it were an rvalue in certain situations such as returning a local variable,
3271where copy elision isn't applicable.  Consider:
3272
3273@smallexample
3274struct T @{
3275@dots{}
3276@};
3277T fn(T t)
3278@{
3279  @dots{}
3280  return std::move (t);
3281@}
3282@end smallexample
3283
3284Here, the @code{std::move} call is redundant.  Because G++ implements Core
3285Issue 1579, another example is:
3286
3287@smallexample
3288struct T @{ // convertible to U
3289@dots{}
3290@};
3291struct U @{
3292@dots{}
3293@};
3294U fn()
3295@{
3296  T t;
3297  @dots{}
3298  return std::move (t);
3299@}
3300@end smallexample
3301In this example, copy elision isn't applicable because the type of the
3302expression being returned and the function return type differ, yet G++
3303treats the return value as if it were designated by an rvalue.
3304
3305This warning is enabled by @option{-Wextra}.
3306
3307@item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3308@opindex fext-numeric-literals
3309@opindex fno-ext-numeric-literals
3310Accept imaginary, fixed-point, or machine-defined
3311literal number suffixes as GNU extensions.
3312When this option is turned off these suffixes are treated
3313as C++11 user-defined literal numeric suffixes.
3314This is on by default for all pre-C++11 dialects and all GNU dialects:
3315@option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3316@option{-std=gnu++14}.
3317This option is off by default
3318for ISO C++11 onwards (@option{-std=c++11}, ...).
3319@end table
3320
3321The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3322
3323@table @gcctabopt
3324@item -Weffc++ @r{(C++ and Objective-C++ only)}
3325@opindex Weffc++
3326@opindex Wno-effc++
3327Warn about violations of the following style guidelines from Scott Meyers'
3328@cite{Effective C++} series of books:
3329
3330@itemize @bullet
3331@item
3332Define a copy constructor and an assignment operator for classes
3333with dynamically-allocated memory.
3334
3335@item
3336Prefer initialization to assignment in constructors.
3337
3338@item
3339Have @code{operator=} return a reference to @code{*this}.
3340
3341@item
3342Don't try to return a reference when you must return an object.
3343
3344@item
3345Distinguish between prefix and postfix forms of increment and
3346decrement operators.
3347
3348@item
3349Never overload @code{&&}, @code{||}, or @code{,}.
3350
3351@end itemize
3352
3353This option also enables @option{-Wnon-virtual-dtor}, which is also
3354one of the effective C++ recommendations.  However, the check is
3355extended to warn about the lack of virtual destructor in accessible
3356non-polymorphic bases classes too.
3357
3358When selecting this option, be aware that the standard library
3359headers do not obey all of these guidelines; use @samp{grep -v}
3360to filter out those warnings.
3361
3362@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3363@opindex Wstrict-null-sentinel
3364@opindex Wno-strict-null-sentinel
3365Warn about the use of an uncasted @code{NULL} as sentinel.  When
3366compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3367to @code{__null}.  Although it is a null pointer constant rather than a
3368null pointer, it is guaranteed to be of the same size as a pointer.
3369But this use is not portable across different compilers.
3370
3371@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3372@opindex Wno-non-template-friend
3373@opindex Wnon-template-friend
3374Disable warnings when non-template friend functions are declared
3375within a template.  In very old versions of GCC that predate implementation
3376of the ISO standard, declarations such as
3377@samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3378could be interpreted as a particular specialization of a template
3379function; the warning exists to diagnose compatibility problems,
3380and is enabled by default.
3381
3382@item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3383@opindex Wold-style-cast
3384@opindex Wno-old-style-cast
3385Warn if an old-style (C-style) cast to a non-void type is used within
3386a C++ program.  The new-style casts (@code{dynamic_cast},
3387@code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3388less vulnerable to unintended effects and much easier to search for.
3389
3390@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3391@opindex Woverloaded-virtual
3392@opindex Wno-overloaded-virtual
3393@cindex overloaded virtual function, warning
3394@cindex warning for overloaded virtual function
3395Warn when a function declaration hides virtual functions from a
3396base class.  For example, in:
3397
3398@smallexample
3399struct A @{
3400  virtual void f();
3401@};
3402
3403struct B: public A @{
3404  void f(int);
3405@};
3406@end smallexample
3407
3408the @code{A} class version of @code{f} is hidden in @code{B}, and code
3409like:
3410
3411@smallexample
3412B* b;
3413b->f();
3414@end smallexample
3415
3416@noindent
3417fails to compile.
3418
3419@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3420@opindex Wno-pmf-conversions
3421@opindex Wpmf-conversions
3422Disable the diagnostic for converting a bound pointer to member function
3423to a plain pointer.
3424
3425@item -Wsign-promo @r{(C++ and Objective-C++ only)}
3426@opindex Wsign-promo
3427@opindex Wno-sign-promo
3428Warn when overload resolution chooses a promotion from unsigned or
3429enumerated type to a signed type, over a conversion to an unsigned type of
3430the same size.  Previous versions of G++ tried to preserve
3431unsignedness, but the standard mandates the current behavior.
3432
3433@item -Wtemplates @r{(C++ and Objective-C++ only)}
3434@opindex Wtemplates
3435@opindex Wno-templates
3436Warn when a primary template declaration is encountered.  Some coding
3437rules disallow templates, and this may be used to enforce that rule.
3438The warning is inactive inside a system header file, such as the STL, so
3439one can still use the STL.  One may also instantiate or specialize
3440templates.
3441
3442@item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3443@opindex Wmultiple-inheritance
3444@opindex Wno-multiple-inheritance
3445Warn when a class is defined with multiple direct base classes.  Some
3446coding rules disallow multiple inheritance, and this may be used to
3447enforce that rule.  The warning is inactive inside a system header file,
3448such as the STL, so one can still use the STL.  One may also define
3449classes that indirectly use multiple inheritance.
3450
3451@item -Wvirtual-inheritance
3452@opindex Wvirtual-inheritance
3453@opindex Wno-virtual-inheritance
3454Warn when a class is defined with a virtual direct base class.  Some
3455coding rules disallow multiple inheritance, and this may be used to
3456enforce that rule.  The warning is inactive inside a system header file,
3457such as the STL, so one can still use the STL.  One may also define
3458classes that indirectly use virtual inheritance.
3459
3460@item -Wnamespaces
3461@opindex Wnamespaces
3462@opindex Wno-namespaces
3463Warn when a namespace definition is opened.  Some coding rules disallow
3464namespaces, and this may be used to enforce that rule.  The warning is
3465inactive inside a system header file, such as the STL, so one can still
3466use the STL.  One may also use using directives and qualified names.
3467
3468@item -Wno-terminate @r{(C++ and Objective-C++ only)}
3469@opindex Wterminate
3470@opindex Wno-terminate
3471Disable the warning about a throw-expression that will immediately
3472result in a call to @code{terminate}.
3473
3474@item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3475@opindex Wno-class-conversion
3476@opindex Wclass-conversion
3477Disable the warning about the case when a conversion function converts an
3478object to the same type, to a base class of that type, or to void; such
3479a conversion function will never be called.
3480@end table
3481
3482@node Objective-C and Objective-C++ Dialect Options
3483@section Options Controlling Objective-C and Objective-C++ Dialects
3484
3485@cindex compiler options, Objective-C and Objective-C++
3486@cindex Objective-C and Objective-C++ options, command-line
3487@cindex options, Objective-C and Objective-C++
3488(NOTE: This manual does not describe the Objective-C and Objective-C++
3489languages themselves.  @xref{Standards,,Language Standards
3490Supported by GCC}, for references.)
3491
3492This section describes the command-line options that are only meaningful
3493for Objective-C and Objective-C++ programs.  You can also use most of
3494the language-independent GNU compiler options.
3495For example, you might compile a file @file{some_class.m} like this:
3496
3497@smallexample
3498gcc -g -fgnu-runtime -O -c some_class.m
3499@end smallexample
3500
3501@noindent
3502In this example, @option{-fgnu-runtime} is an option meant only for
3503Objective-C and Objective-C++ programs; you can use the other options with
3504any language supported by GCC@.
3505
3506Note that since Objective-C is an extension of the C language, Objective-C
3507compilations may also use options specific to the C front-end (e.g.,
3508@option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
3509C++-specific options (e.g., @option{-Wabi}).
3510
3511Here is a list of options that are @emph{only} for compiling Objective-C
3512and Objective-C++ programs:
3513
3514@table @gcctabopt
3515@item -fconstant-string-class=@var{class-name}
3516@opindex fconstant-string-class
3517Use @var{class-name} as the name of the class to instantiate for each
3518literal string specified with the syntax @code{@@"@dots{}"}.  The default
3519class name is @code{NXConstantString} if the GNU runtime is being used, and
3520@code{NSConstantString} if the NeXT runtime is being used (see below).  The
3521@option{-fconstant-cfstrings} option, if also present, overrides the
3522@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3523to be laid out as constant CoreFoundation strings.
3524
3525@item -fgnu-runtime
3526@opindex fgnu-runtime
3527Generate object code compatible with the standard GNU Objective-C
3528runtime.  This is the default for most types of systems.
3529
3530@item -fnext-runtime
3531@opindex fnext-runtime
3532Generate output compatible with the NeXT runtime.  This is the default
3533for NeXT-based systems, including Darwin and Mac OS X@.  The macro
3534@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3535used.
3536
3537@item -fno-nil-receivers
3538@opindex fno-nil-receivers
3539@opindex fnil-receivers
3540Assume that all Objective-C message dispatches (@code{[receiver
3541message:arg]}) in this translation unit ensure that the receiver is
3542not @code{nil}.  This allows for more efficient entry points in the
3543runtime to be used.  This option is only available in conjunction with
3544the NeXT runtime and ABI version 0 or 1.
3545
3546@item -fobjc-abi-version=@var{n}
3547@opindex fobjc-abi-version
3548Use version @var{n} of the Objective-C ABI for the selected runtime.
3549This option is currently supported only for the NeXT runtime.  In that
3550case, Version 0 is the traditional (32-bit) ABI without support for
3551properties and other Objective-C 2.0 additions.  Version 1 is the
3552traditional (32-bit) ABI with support for properties and other
3553Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
3554nothing is specified, the default is Version 0 on 32-bit target
3555machines, and Version 2 on 64-bit target machines.
3556
3557@item -fobjc-call-cxx-cdtors
3558@opindex fobjc-call-cxx-cdtors
3559For each Objective-C class, check if any of its instance variables is a
3560C++ object with a non-trivial default constructor.  If so, synthesize a
3561special @code{- (id) .cxx_construct} instance method which runs
3562non-trivial default constructors on any such instance variables, in order,
3563and then return @code{self}.  Similarly, check if any instance variable
3564is a C++ object with a non-trivial destructor, and if so, synthesize a
3565special @code{- (void) .cxx_destruct} method which runs
3566all such default destructors, in reverse order.
3567
3568The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3569methods thusly generated only operate on instance variables
3570declared in the current Objective-C class, and not those inherited
3571from superclasses.  It is the responsibility of the Objective-C
3572runtime to invoke all such methods in an object's inheritance
3573hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
3574by the runtime immediately after a new object instance is allocated;
3575the @code{- (void) .cxx_destruct} methods are invoked immediately
3576before the runtime deallocates an object instance.
3577
3578As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3579support for invoking the @code{- (id) .cxx_construct} and
3580@code{- (void) .cxx_destruct} methods.
3581
3582@item -fobjc-direct-dispatch
3583@opindex fobjc-direct-dispatch
3584Allow fast jumps to the message dispatcher.  On Darwin this is
3585accomplished via the comm page.
3586
3587@item -fobjc-exceptions
3588@opindex fobjc-exceptions
3589Enable syntactic support for structured exception handling in
3590Objective-C, similar to what is offered by C++.  This option
3591is required to use the Objective-C keywords @code{@@try},
3592@code{@@throw}, @code{@@catch}, @code{@@finally} and
3593@code{@@synchronized}.  This option is available with both the GNU
3594runtime and the NeXT runtime (but not available in conjunction with
3595the NeXT runtime on Mac OS X 10.2 and earlier).
3596
3597@item -fobjc-gc
3598@opindex fobjc-gc
3599Enable garbage collection (GC) in Objective-C and Objective-C++
3600programs.  This option is only available with the NeXT runtime; the
3601GNU runtime has a different garbage collection implementation that
3602does not require special compiler flags.
3603
3604@item -fobjc-nilcheck
3605@opindex fobjc-nilcheck
3606For the NeXT runtime with version 2 of the ABI, check for a nil
3607receiver in method invocations before doing the actual method call.
3608This is the default and can be disabled using
3609@option{-fno-objc-nilcheck}.  Class methods and super calls are never
3610checked for nil in this way no matter what this flag is set to.
3611Currently this flag does nothing when the GNU runtime, or an older
3612version of the NeXT runtime ABI, is used.
3613
3614@item -fobjc-std=objc1
3615@opindex fobjc-std
3616Conform to the language syntax of Objective-C 1.0, the language
3617recognized by GCC 4.0.  This only affects the Objective-C additions to
3618the C/C++ language; it does not affect conformance to C/C++ standards,
3619which is controlled by the separate C/C++ dialect option flags.  When
3620this option is used with the Objective-C or Objective-C++ compiler,
3621any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3622This is useful if you need to make sure that your Objective-C code can
3623be compiled with older versions of GCC@.
3624
3625@item -freplace-objc-classes
3626@opindex freplace-objc-classes
3627Emit a special marker instructing @command{ld(1)} not to statically link in
3628the resulting object file, and allow @command{dyld(1)} to load it in at
3629run time instead.  This is used in conjunction with the Fix-and-Continue
3630debugging mode, where the object file in question may be recompiled and
3631dynamically reloaded in the course of program execution, without the need
3632to restart the program itself.  Currently, Fix-and-Continue functionality
3633is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3634and later.
3635
3636@item -fzero-link
3637@opindex fzero-link
3638When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3639to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3640compile time) with static class references that get initialized at load time,
3641which improves run-time performance.  Specifying the @option{-fzero-link} flag
3642suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3643to be retained.  This is useful in Zero-Link debugging mode, since it allows
3644for individual class implementations to be modified during program execution.
3645The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3646regardless of command-line options.
3647
3648@item -fno-local-ivars
3649@opindex fno-local-ivars
3650@opindex flocal-ivars
3651By default instance variables in Objective-C can be accessed as if
3652they were local variables from within the methods of the class they're
3653declared in.  This can lead to shadowing between instance variables
3654and other variables declared either locally inside a class method or
3655globally with the same name.  Specifying the @option{-fno-local-ivars}
3656flag disables this behavior thus avoiding variable shadowing issues.
3657
3658@item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3659@opindex fivar-visibility
3660Set the default instance variable visibility to the specified option
3661so that instance variables declared outside the scope of any access
3662modifier directives default to the specified visibility.
3663
3664@item -gen-decls
3665@opindex gen-decls
3666Dump interface declarations for all classes seen in the source file to a
3667file named @file{@var{sourcename}.decl}.
3668
3669@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3670@opindex Wassign-intercept
3671@opindex Wno-assign-intercept
3672Warn whenever an Objective-C assignment is being intercepted by the
3673garbage collector.
3674
3675@item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3676@opindex Wno-protocol
3677@opindex Wprotocol
3678If a class is declared to implement a protocol, a warning is issued for
3679every method in the protocol that is not implemented by the class.  The
3680default behavior is to issue a warning for every method not explicitly
3681implemented in the class, even if a method implementation is inherited
3682from the superclass.  If you use the @option{-Wno-protocol} option, then
3683methods inherited from the superclass are considered to be implemented,
3684and no warning is issued for them.
3685
3686@item -Wselector @r{(Objective-C and Objective-C++ only)}
3687@opindex Wselector
3688@opindex Wno-selector
3689Warn if multiple methods of different types for the same selector are
3690found during compilation.  The check is performed on the list of methods
3691in the final stage of compilation.  Additionally, a check is performed
3692for each selector appearing in a @code{@@selector(@dots{})}
3693expression, and a corresponding method for that selector has been found
3694during compilation.  Because these checks scan the method table only at
3695the end of compilation, these warnings are not produced if the final
3696stage of compilation is not reached, for example because an error is
3697found during compilation, or because the @option{-fsyntax-only} option is
3698being used.
3699
3700@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3701@opindex Wstrict-selector-match
3702@opindex Wno-strict-selector-match
3703Warn if multiple methods with differing argument and/or return types are
3704found for a given selector when attempting to send a message using this
3705selector to a receiver of type @code{id} or @code{Class}.  When this flag
3706is off (which is the default behavior), the compiler omits such warnings
3707if any differences found are confined to types that share the same size
3708and alignment.
3709
3710@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3711@opindex Wundeclared-selector
3712@opindex Wno-undeclared-selector
3713Warn if a @code{@@selector(@dots{})} expression referring to an
3714undeclared selector is found.  A selector is considered undeclared if no
3715method with that name has been declared before the
3716@code{@@selector(@dots{})} expression, either explicitly in an
3717@code{@@interface} or @code{@@protocol} declaration, or implicitly in
3718an @code{@@implementation} section.  This option always performs its
3719checks as soon as a @code{@@selector(@dots{})} expression is found,
3720while @option{-Wselector} only performs its checks in the final stage of
3721compilation.  This also enforces the coding style convention
3722that methods and selectors must be declared before being used.
3723
3724@item -print-objc-runtime-info
3725@opindex print-objc-runtime-info
3726Generate C header describing the largest structure that is passed by
3727value, if any.
3728
3729@end table
3730
3731@node Diagnostic Message Formatting Options
3732@section Options to Control Diagnostic Messages Formatting
3733@cindex options to control diagnostics formatting
3734@cindex diagnostic messages
3735@cindex message formatting
3736
3737Traditionally, diagnostic messages have been formatted irrespective of
3738the output device's aspect (e.g.@: its width, @dots{}).  You can use the
3739options described below
3740to control the formatting algorithm for diagnostic messages,
3741e.g.@: how many characters per line, how often source location
3742information should be reported.  Note that some language front ends may not
3743honor these options.
3744
3745@table @gcctabopt
3746@item -fmessage-length=@var{n}
3747@opindex fmessage-length
3748Try to format error messages so that they fit on lines of about
3749@var{n} characters.  If @var{n} is zero, then no line-wrapping is
3750done; each error message appears on a single line.  This is the
3751default for all front ends.
3752
3753Note - this option also affects the display of the @samp{#error} and
3754@samp{#warning} pre-processor directives, and the @samp{deprecated}
3755function/type/variable attribute.  It does not however affect the
3756@samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3757
3758@item -fdiagnostics-show-location=once
3759@opindex fdiagnostics-show-location
3760Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
3761reporter to emit source location information @emph{once}; that is, in
3762case the message is too long to fit on a single physical line and has to
3763be wrapped, the source location won't be emitted (as prefix) again,
3764over and over, in subsequent continuation lines.  This is the default
3765behavior.
3766
3767@item -fdiagnostics-show-location=every-line
3768Only meaningful in line-wrapping mode.  Instructs the diagnostic
3769messages reporter to emit the same source location information (as
3770prefix) for physical lines that result from the process of breaking
3771a message which is too long to fit on a single line.
3772
3773@item -fdiagnostics-color[=@var{WHEN}]
3774@itemx -fno-diagnostics-color
3775@opindex fdiagnostics-color
3776@cindex highlight, color
3777@vindex GCC_COLORS @r{environment variable}
3778Use color in diagnostics.  @var{WHEN} is @samp{never}, @samp{always},
3779or @samp{auto}.  The default depends on how the compiler has been configured,
3780it can be any of the above @var{WHEN} options or also @samp{never}
3781if @env{GCC_COLORS} environment variable isn't present in the environment,
3782and @samp{auto} otherwise.
3783@samp{auto} means to use color only when the standard error is a terminal.
3784The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3785aliases for @option{-fdiagnostics-color=always} and
3786@option{-fdiagnostics-color=never}, respectively.
3787
3788The colors are defined by the environment variable @env{GCC_COLORS}.
3789Its value is a colon-separated list of capabilities and Select Graphic
3790Rendition (SGR) substrings. SGR commands are interpreted by the
3791terminal or terminal emulator.  (See the section in the documentation
3792of your text terminal for permitted values and their meanings as
3793character attributes.)  These substring values are integers in decimal
3794representation and can be concatenated with semicolons.
3795Common values to concatenate include
3796@samp{1} for bold,
3797@samp{4} for underline,
3798@samp{5} for blink,
3799@samp{7} for inverse,
3800@samp{39} for default foreground color,
3801@samp{30} to @samp{37} for foreground colors,
3802@samp{90} to @samp{97} for 16-color mode foreground colors,
3803@samp{38;5;0} to @samp{38;5;255}
3804for 88-color and 256-color modes foreground colors,
3805@samp{49} for default background color,
3806@samp{40} to @samp{47} for background colors,
3807@samp{100} to @samp{107} for 16-color mode background colors,
3808and @samp{48;5;0} to @samp{48;5;255}
3809for 88-color and 256-color modes background colors.
3810
3811The default @env{GCC_COLORS} is
3812@smallexample
3813error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3814quote=01:fixit-insert=32:fixit-delete=31:\
3815diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3816type-diff=01;32
3817@end smallexample
3818@noindent
3819where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3820@samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3821@samp{01} is bold, and @samp{31} is red.
3822Setting @env{GCC_COLORS} to the empty string disables colors.
3823Supported capabilities are as follows.
3824
3825@table @code
3826@item error=
3827@vindex error GCC_COLORS @r{capability}
3828SGR substring for error: markers.
3829
3830@item warning=
3831@vindex warning GCC_COLORS @r{capability}
3832SGR substring for warning: markers.
3833
3834@item note=
3835@vindex note GCC_COLORS @r{capability}
3836SGR substring for note: markers.
3837
3838@item range1=
3839@vindex range1 GCC_COLORS @r{capability}
3840SGR substring for first additional range.
3841
3842@item range2=
3843@vindex range2 GCC_COLORS @r{capability}
3844SGR substring for second additional range.
3845
3846@item locus=
3847@vindex locus GCC_COLORS @r{capability}
3848SGR substring for location information, @samp{file:line} or
3849@samp{file:line:column} etc.
3850
3851@item quote=
3852@vindex quote GCC_COLORS @r{capability}
3853SGR substring for information printed within quotes.
3854
3855@item fixit-insert=
3856@vindex fixit-insert GCC_COLORS @r{capability}
3857SGR substring for fix-it hints suggesting text to
3858be inserted or replaced.
3859
3860@item fixit-delete=
3861@vindex fixit-delete GCC_COLORS @r{capability}
3862SGR substring for fix-it hints suggesting text to
3863be deleted.
3864
3865@item diff-filename=
3866@vindex diff-filename GCC_COLORS @r{capability}
3867SGR substring for filename headers within generated patches.
3868
3869@item diff-hunk=
3870@vindex diff-hunk GCC_COLORS @r{capability}
3871SGR substring for the starts of hunks within generated patches.
3872
3873@item diff-delete=
3874@vindex diff-delete GCC_COLORS @r{capability}
3875SGR substring for deleted lines within generated patches.
3876
3877@item diff-insert=
3878@vindex diff-insert GCC_COLORS @r{capability}
3879SGR substring for inserted lines within generated patches.
3880
3881@item type-diff=
3882@vindex type-diff GCC_COLORS @r{capability}
3883SGR substring for highlighting mismatching types within template
3884arguments in the C++ frontend.
3885@end table
3886
3887@item -fno-diagnostics-show-option
3888@opindex fno-diagnostics-show-option
3889@opindex fdiagnostics-show-option
3890By default, each diagnostic emitted includes text indicating the
3891command-line option that directly controls the diagnostic (if such an
3892option is known to the diagnostic machinery).  Specifying the
3893@option{-fno-diagnostics-show-option} flag suppresses that behavior.
3894
3895@item -fno-diagnostics-show-caret
3896@opindex fno-diagnostics-show-caret
3897@opindex fdiagnostics-show-caret
3898By default, each diagnostic emitted includes the original source line
3899and a caret @samp{^} indicating the column.  This option suppresses this
3900information.  The source line is truncated to @var{n} characters, if
3901the @option{-fmessage-length=n} option is given.  When the output is done
3902to the terminal, the width is limited to the width given by the
3903@env{COLUMNS} environment variable or, if not set, to the terminal width.
3904
3905@item -fno-diagnostics-show-labels
3906@opindex fno-diagnostics-show-labels
3907@opindex fdiagnostics-show-labels
3908By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3909diagnostics can label ranges of source code with pertinent information, such
3910as the types of expressions:
3911
3912@smallexample
3913    printf ("foo %s bar", long_i + long_j);
3914                 ~^       ~~~~~~~~~~~~~~~
3915                  |              |
3916                  char *         long int
3917@end smallexample
3918
3919This option suppresses the printing of these labels (in the example above,
3920the vertical bars and the ``char *'' and ``long int'' text).
3921
3922@item -fno-diagnostics-show-line-numbers
3923@opindex fno-diagnostics-show-line-numbers
3924@opindex fdiagnostics-show-line-numbers
3925By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3926a left margin is printed, showing line numbers.  This option suppresses this
3927left margin.
3928
3929@item -fdiagnostics-minimum-margin-width=@var{width}
3930@opindex fdiagnostics-minimum-margin-width
3931This option controls the minimum width of the left margin printed by
3932@option{-fdiagnostics-show-line-numbers}.  It defaults to 6.
3933
3934@item -fdiagnostics-parseable-fixits
3935@opindex fdiagnostics-parseable-fixits
3936Emit fix-it hints in a machine-parseable format, suitable for consumption
3937by IDEs.  For each fix-it, a line will be printed after the relevant
3938diagnostic, starting with the string ``fix-it:''.  For example:
3939
3940@smallexample
3941fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3942@end smallexample
3943
3944The location is expressed as a half-open range, expressed as a count of
3945bytes, starting at byte 1 for the initial column.  In the above example,
3946bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3947given string:
3948
3949@smallexample
395000000000011111111112222222222
395112345678901234567890123456789
3952  gtk_widget_showall (dlg);
3953  ^^^^^^^^^^^^^^^^^^
3954  gtk_widget_show_all
3955@end smallexample
3956
3957The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3958newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3959(e.g. vertical tab as ``\013'').
3960
3961An empty replacement string indicates that the given range is to be removed.
3962An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3963be inserted at the given position.
3964
3965@item -fdiagnostics-generate-patch
3966@opindex fdiagnostics-generate-patch
3967Print fix-it hints to stderr in unified diff format, after any diagnostics
3968are printed.  For example:
3969
3970@smallexample
3971--- test.c
3972+++ test.c
3973@@ -42,5 +42,5 @@
3974
3975 void show_cb(GtkDialog *dlg)
3976 @{
3977-  gtk_widget_showall(dlg);
3978+  gtk_widget_show_all(dlg);
3979 @}
3980
3981@end smallexample
3982
3983The diff may or may not be colorized, following the same rules
3984as for diagnostics (see @option{-fdiagnostics-color}).
3985
3986@item -fdiagnostics-show-template-tree
3987@opindex fdiagnostics-show-template-tree
3988
3989In the C++ frontend, when printing diagnostics showing mismatching
3990template types, such as:
3991
3992@smallexample
3993  could not convert 'std::map<int, std::vector<double> >()'
3994    from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3995@end smallexample
3996
3997the @option{-fdiagnostics-show-template-tree} flag enables printing a
3998tree-like structure showing the common and differing parts of the types,
3999such as:
4000
4001@smallexample
4002  map<
4003    [...],
4004    vector<
4005      [double != float]>>
4006@end smallexample
4007
4008The parts that differ are highlighted with color (``double'' and
4009``float'' in this case).
4010
4011@item -fno-elide-type
4012@opindex fno-elide-type
4013@opindex felide-type
4014By default when the C++ frontend prints diagnostics showing mismatching
4015template types, common parts of the types are printed as ``[...]'' to
4016simplify the error message.  For example:
4017
4018@smallexample
4019  could not convert 'std::map<int, std::vector<double> >()'
4020    from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4021@end smallexample
4022
4023Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4024This flag also affects the output of the
4025@option{-fdiagnostics-show-template-tree} flag.
4026
4027@item -fno-show-column
4028@opindex fno-show-column
4029@opindex fshow-column
4030Do not print column numbers in diagnostics.  This may be necessary if
4031diagnostics are being scanned by a program that does not understand the
4032column numbers, such as @command{dejagnu}.
4033
4034@item -fdiagnostics-format=@var{FORMAT}
4035@opindex fdiagnostics-format
4036Select a different format for printing diagnostics.
4037@var{FORMAT} is @samp{text} or @samp{json}.
4038The default is @samp{text}.
4039
4040The @samp{json} format consists of a top-level JSON array containing JSON
4041objects representing the diagnostics.
4042
4043The JSON is emitted as one line, without formatting; the examples below
4044have been formatted for clarity.
4045
4046Diagnostics can have child diagnostics.  For example, this error and note:
4047
4048@smallexample
4049misleading-indentation.c:15:3: warning: this 'if' clause does not
4050  guard... [-Wmisleading-indentation]
4051   15 |   if (flag)
4052      |   ^~
4053misleading-indentation.c:17:5: note: ...this statement, but the latter
4054  is misleadingly indented as if it were guarded by the 'if'
4055   17 |     y = 2;
4056      |     ^
4057@end smallexample
4058
4059@noindent
4060might be printed in JSON form (after formatting) like this:
4061
4062@smallexample
4063[
4064    @{
4065        "kind": "warning",
4066        "locations": [
4067            @{
4068                "caret": @{
4069                    "column": 3,
4070                    "file": "misleading-indentation.c",
4071                    "line": 15
4072                @},
4073                "finish": @{
4074                    "column": 4,
4075                    "file": "misleading-indentation.c",
4076                    "line": 15
4077                @}
4078            @}
4079        ],
4080        "message": "this \u2018if\u2019 clause does not guard...",
4081        "option": "-Wmisleading-indentation",
4082        "children": [
4083            @{
4084                "kind": "note",
4085                "locations": [
4086                    @{
4087                        "caret": @{
4088                            "column": 5,
4089                            "file": "misleading-indentation.c",
4090                            "line": 17
4091                        @}
4092                    @}
4093                ],
4094                "message": "...this statement, but the latter is @dots{}"
4095            @}
4096        ]
4097    @},
4098    @dots{}
4099]
4100@end smallexample
4101
4102@noindent
4103where the @code{note} is a child of the @code{warning}.
4104
4105A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
4106an @code{option} key describing the command-line option controlling the
4107warning.
4108
4109A diagnostic can contain zero or more locations.  Each location has up
4110to three positions within it: a @code{caret} position and optional
4111@code{start} and @code{finish} positions.  A location can also have
4112an optional @code{label} string.  For example, this error:
4113
4114@smallexample
4115bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4116   'struct s'@} and 'T' @{aka 'struct t'@})
4117   64 |   return callee_4a () + callee_4b ();
4118      |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4119      |          |              |
4120      |          |              T @{aka struct t@}
4121      |          S @{aka struct s@}
4122@end smallexample
4123
4124@noindent
4125has three locations.  Its primary location is at the ``+'' token at column
412623.  It has two secondary locations, describing the left and right-hand sides
4127of the expression, which have labels.  It might be printed in JSON form as:
4128
4129@smallexample
4130    @{
4131        "children": [],
4132        "kind": "error",
4133        "locations": [
4134            @{
4135                "caret": @{
4136                    "column": 23, "file": "bad-binary-ops.c", "line": 64
4137                @}
4138            @},
4139            @{
4140                "caret": @{
4141                    "column": 10, "file": "bad-binary-ops.c", "line": 64
4142                @},
4143                "finish": @{
4144                    "column": 21, "file": "bad-binary-ops.c", "line": 64
4145                @},
4146                "label": "S @{aka struct s@}"
4147            @},
4148            @{
4149                "caret": @{
4150                    "column": 25, "file": "bad-binary-ops.c", "line": 64
4151                @},
4152                "finish": @{
4153                    "column": 36, "file": "bad-binary-ops.c", "line": 64
4154                @},
4155                "label": "T @{aka struct t@}"
4156            @}
4157        ],
4158        "message": "invalid operands to binary + @dots{}"
4159    @}
4160@end smallexample
4161
4162If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4163consisting of half-open intervals, similar to the output of
4164@option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
4165with a replacement fix-it hint:
4166
4167@smallexample
4168demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4169  mean 'color'?
4170    8 |   return ptr->colour;
4171      |               ^~~~~~
4172      |               color
4173@end smallexample
4174
4175@noindent
4176might be printed in JSON form as:
4177
4178@smallexample
4179    @{
4180        "children": [],
4181        "fixits": [
4182            @{
4183                "next": @{
4184                    "column": 21,
4185                    "file": "demo.c",
4186                    "line": 8
4187                @},
4188                "start": @{
4189                    "column": 15,
4190                    "file": "demo.c",
4191                    "line": 8
4192                @},
4193                "string": "color"
4194            @}
4195        ],
4196        "kind": "error",
4197        "locations": [
4198            @{
4199                "caret": @{
4200                    "column": 15,
4201                    "file": "demo.c",
4202                    "line": 8
4203                @},
4204                "finish": @{
4205                    "column": 20,
4206                    "file": "demo.c",
4207                    "line": 8
4208                @}
4209            @}
4210        ],
4211        "message": "\u2018struct s\u2019 has no member named @dots{}"
4212    @}
4213@end smallexample
4214
4215@noindent
4216where the fix-it hint suggests replacing the text from @code{start} up
4217to but not including @code{next} with @code{string}'s value.  Deletions
4218are expressed via an empty value for @code{string}, insertions by
4219having @code{start} equal @code{next}.
4220
4221@end table
4222
4223@node Warning Options
4224@section Options to Request or Suppress Warnings
4225@cindex options to control warnings
4226@cindex warning messages
4227@cindex messages, warning
4228@cindex suppressing warnings
4229
4230Warnings are diagnostic messages that report constructions that
4231are not inherently erroneous but that are risky or suggest there
4232may have been an error.
4233
4234The following language-independent options do not enable specific
4235warnings but control the kinds of diagnostics produced by GCC@.
4236
4237@table @gcctabopt
4238@cindex syntax checking
4239@item -fsyntax-only
4240@opindex fsyntax-only
4241Check the code for syntax errors, but don't do anything beyond that.
4242
4243@item -fmax-errors=@var{n}
4244@opindex fmax-errors
4245Limits the maximum number of error messages to @var{n}, at which point
4246GCC bails out rather than attempting to continue processing the source
4247code.  If @var{n} is 0 (the default), there is no limit on the number
4248of error messages produced.  If @option{-Wfatal-errors} is also
4249specified, then @option{-Wfatal-errors} takes precedence over this
4250option.
4251
4252@item -w
4253@opindex w
4254Inhibit all warning messages.
4255
4256@item -Werror
4257@opindex Werror
4258@opindex Wno-error
4259Make all warnings into errors.
4260
4261@item -Werror=
4262@opindex Werror=
4263@opindex Wno-error=
4264Make the specified warning into an error.  The specifier for a warning
4265is appended; for example @option{-Werror=switch} turns the warnings
4266controlled by @option{-Wswitch} into errors.  This switch takes a
4267negative form, to be used to negate @option{-Werror} for specific
4268warnings; for example @option{-Wno-error=switch} makes
4269@option{-Wswitch} warnings not be errors, even when @option{-Werror}
4270is in effect.
4271
4272The warning message for each controllable warning includes the
4273option that controls the warning.  That option can then be used with
4274@option{-Werror=} and @option{-Wno-error=} as described above.
4275(Printing of the option in the warning message can be disabled using the
4276@option{-fno-diagnostics-show-option} flag.)
4277
4278Note that specifying @option{-Werror=}@var{foo} automatically implies
4279@option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
4280imply anything.
4281
4282@item -Wfatal-errors
4283@opindex Wfatal-errors
4284@opindex Wno-fatal-errors
4285This option causes the compiler to abort compilation on the first error
4286occurred rather than trying to keep going and printing further error
4287messages.
4288
4289@end table
4290
4291You can request many specific warnings with options beginning with
4292@samp{-W}, for example @option{-Wimplicit} to request warnings on
4293implicit declarations.  Each of these specific warning options also
4294has a negative form beginning @samp{-Wno-} to turn off warnings; for
4295example, @option{-Wno-implicit}.  This manual lists only one of the
4296two forms, whichever is not the default.  For further
4297language-specific options also refer to @ref{C++ Dialect Options} and
4298@ref{Objective-C and Objective-C++ Dialect Options}.
4299
4300Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4301options, such as @option{-Wunused}, which may turn on further options,
4302such as @option{-Wunused-value}. The combined effect of positive and
4303negative forms is that more specific options have priority over less
4304specific ones, independently of their position in the command-line. For
4305options of the same specificity, the last one takes effect. Options
4306enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4307as if they appeared at the end of the command-line.
4308
4309When an unrecognized warning option is requested (e.g.,
4310@option{-Wunknown-warning}), GCC emits a diagnostic stating
4311that the option is not recognized.  However, if the @option{-Wno-} form
4312is used, the behavior is slightly different: no diagnostic is
4313produced for @option{-Wno-unknown-warning} unless other diagnostics
4314are being produced.  This allows the use of new @option{-Wno-} options
4315with old compilers, but if something goes wrong, the compiler
4316warns that an unrecognized option is present.
4317
4318The effectiveness of some warnings depends on optimizations also being
4319enabled. For example @option{-Wsuggest-final-types} is more effective
4320with link-time optimization and @option{-Wmaybe-uninitialized} will not
4321warn at all unless optimization is enabled.
4322
4323@table @gcctabopt
4324@item -Wpedantic
4325@itemx -pedantic
4326@opindex pedantic
4327@opindex Wpedantic
4328@opindex Wno-pedantic
4329Issue all the warnings demanded by strict ISO C and ISO C++;
4330reject all programs that use forbidden extensions, and some other
4331programs that do not follow ISO C and ISO C++.  For ISO C, follows the
4332version of the ISO C standard specified by any @option{-std} option used.
4333
4334Valid ISO C and ISO C++ programs should compile properly with or without
4335this option (though a rare few require @option{-ansi} or a
4336@option{-std} option specifying the required version of ISO C)@.  However,
4337without this option, certain GNU extensions and traditional C and C++
4338features are supported as well.  With this option, they are rejected.
4339
4340@option{-Wpedantic} does not cause warning messages for use of the
4341alternate keywords whose names begin and end with @samp{__}.  Pedantic
4342warnings are also disabled in the expression that follows
4343@code{__extension__}.  However, only system header files should use
4344these escape routes; application programs should avoid them.
4345@xref{Alternate Keywords}.
4346
4347Some users try to use @option{-Wpedantic} to check programs for strict ISO
4348C conformance.  They soon find that it does not do quite what they want:
4349it finds some non-ISO practices, but not all---only those for which
4350ISO C @emph{requires} a diagnostic, and some others for which
4351diagnostics have been added.
4352
4353A feature to report any failure to conform to ISO C might be useful in
4354some instances, but would require considerable additional work and would
4355be quite different from @option{-Wpedantic}.  We don't have plans to
4356support such a feature in the near future.
4357
4358Where the standard specified with @option{-std} represents a GNU
4359extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4360corresponding @dfn{base standard}, the version of ISO C on which the GNU
4361extended dialect is based.  Warnings from @option{-Wpedantic} are given
4362where they are required by the base standard.  (It does not make sense
4363for such warnings to be given only for features not in the specified GNU
4364C dialect, since by definition the GNU dialects of C include all
4365features the compiler supports with the given option, and there would be
4366nothing to warn about.)
4367
4368@item -pedantic-errors
4369@opindex pedantic-errors
4370Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4371requires a diagnostic, in some cases where there is undefined behavior
4372at compile-time and in some other cases that do not prevent compilation
4373of programs that are valid according to the standard. This is not
4374equivalent to @option{-Werror=pedantic}, since there are errors enabled
4375by this option and not enabled by the latter and vice versa.
4376
4377@item -Wall
4378@opindex Wall
4379@opindex Wno-all
4380This enables all the warnings about constructions that some users
4381consider questionable, and that are easy to avoid (or modify to
4382prevent the warning), even in conjunction with macros.  This also
4383enables some language-specific warnings described in @ref{C++ Dialect
4384Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4385
4386@option{-Wall} turns on the following warning flags:
4387
4388@gccoptlist{-Waddress   @gol
4389-Warray-bounds=1 @r{(only with} @option{-O2}@r{)}  @gol
4390-Wbool-compare  @gol
4391-Wbool-operation  @gol
4392-Wc++11-compat  -Wc++14-compat  @gol
4393-Wcatch-value @r{(C++ and Objective-C++ only)}  @gol
4394-Wchar-subscripts  @gol
4395-Wcomment  @gol
4396-Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4397-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4398-Wformat   @gol
4399-Wint-in-bool-context  @gol
4400-Wimplicit @r{(C and Objective-C only)} @gol
4401-Wimplicit-int @r{(C and Objective-C only)} @gol
4402-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4403-Winit-self @r{(only for C++)} @gol
4404-Wlogical-not-parentheses @gol
4405-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}  @gol
4406-Wmaybe-uninitialized @gol
4407-Wmemset-elt-size @gol
4408-Wmemset-transposed-args @gol
4409-Wmisleading-indentation @r{(only for C/C++)} @gol
4410-Wmissing-attributes @gol
4411-Wmissing-braces @r{(only for C/ObjC)} @gol
4412-Wmultistatement-macros  @gol
4413-Wnarrowing @r{(only for C++)}  @gol
4414-Wnonnull  @gol
4415-Wnonnull-compare  @gol
4416-Wopenmp-simd @gol
4417-Wparentheses  @gol
4418-Wpessimizing-move @r{(only for C++)}  @gol
4419-Wpointer-sign  @gol
4420-Wreorder   @gol
4421-Wrestrict   @gol
4422-Wreturn-type  @gol
4423-Wsequence-point  @gol
4424-Wsign-compare @r{(only in C++)}  @gol
4425-Wsizeof-pointer-div @gol
4426-Wsizeof-pointer-memaccess @gol
4427-Wstrict-aliasing  @gol
4428-Wstrict-overflow=1  @gol
4429-Wswitch  @gol
4430-Wtautological-compare  @gol
4431-Wtrigraphs  @gol
4432-Wuninitialized  @gol
4433-Wunknown-pragmas  @gol
4434-Wunused-function  @gol
4435-Wunused-label     @gol
4436-Wunused-value     @gol
4437-Wunused-variable  @gol
4438-Wvolatile-register-var}
4439
4440Note that some warning flags are not implied by @option{-Wall}.  Some of
4441them warn about constructions that users generally do not consider
4442questionable, but which occasionally you might wish to check for;
4443others warn about constructions that are necessary or hard to avoid in
4444some cases, and there is no simple way to modify the code to suppress
4445the warning. Some of them are enabled by @option{-Wextra} but many of
4446them must be enabled individually.
4447
4448@item -Wextra
4449@opindex W
4450@opindex Wextra
4451@opindex Wno-extra
4452This enables some extra warning flags that are not enabled by
4453@option{-Wall}. (This option used to be called @option{-W}.  The older
4454name is still supported, but the newer name is more descriptive.)
4455
4456@gccoptlist{-Wclobbered  @gol
4457-Wcast-function-type  @gol
4458-Wdeprecated-copy @r{(C++ only)} @gol
4459-Wempty-body  @gol
4460-Wignored-qualifiers @gol
4461-Wimplicit-fallthrough=3 @gol
4462-Wmissing-field-initializers  @gol
4463-Wmissing-parameter-type @r{(C only)}  @gol
4464-Wold-style-declaration @r{(C only)}  @gol
4465-Woverride-init  @gol
4466-Wsign-compare @r{(C only)} @gol
4467-Wredundant-move @r{(only for C++)}  @gol
4468-Wtype-limits  @gol
4469-Wuninitialized  @gol
4470-Wshift-negative-value @r{(in C++03 and in C99 and newer)}  @gol
4471-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4472-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4473
4474
4475The option @option{-Wextra} also prints warning messages for the
4476following cases:
4477
4478@itemize @bullet
4479
4480@item
4481A pointer is compared against integer zero with @code{<}, @code{<=},
4482@code{>}, or @code{>=}.
4483
4484@item
4485(C++ only) An enumerator and a non-enumerator both appear in a
4486conditional expression.
4487
4488@item
4489(C++ only) Ambiguous virtual bases.
4490
4491@item
4492(C++ only) Subscripting an array that has been declared @code{register}.
4493
4494@item
4495(C++ only) Taking the address of a variable that has been declared
4496@code{register}.
4497
4498@item
4499(C++ only) A base class is not initialized in the copy constructor
4500of a derived class.
4501
4502@end itemize
4503
4504@item -Wchar-subscripts
4505@opindex Wchar-subscripts
4506@opindex Wno-char-subscripts
4507Warn if an array subscript has type @code{char}.  This is a common cause
4508of error, as programmers often forget that this type is signed on some
4509machines.
4510This warning is enabled by @option{-Wall}.
4511
4512@item -Wno-coverage-mismatch
4513@opindex Wno-coverage-mismatch
4514@opindex Wcoverage-mismatch
4515Warn if feedback profiles do not match when using the
4516@option{-fprofile-use} option.
4517If a source file is changed between compiling with @option{-fprofile-generate}
4518and with @option{-fprofile-use}, the files with the profile feedback can fail
4519to match the source file and GCC cannot use the profile feedback
4520information.  By default, this warning is enabled and is treated as an
4521error.  @option{-Wno-coverage-mismatch} can be used to disable the
4522warning or @option{-Wno-error=coverage-mismatch} can be used to
4523disable the error.  Disabling the error for this warning can result in
4524poorly optimized code and is useful only in the
4525case of very minor changes such as bug fixes to an existing code-base.
4526Completely disabling the warning is not recommended.
4527
4528@item -Wno-cpp
4529@r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4530
4531Suppress warning messages emitted by @code{#warning} directives.
4532
4533@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4534@opindex Wdouble-promotion
4535@opindex Wno-double-promotion
4536Give a warning when a value of type @code{float} is implicitly
4537promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
4538floating-point unit implement @code{float} in hardware, but emulate
4539@code{double} in software.  On such a machine, doing computations
4540using @code{double} values is much more expensive because of the
4541overhead required for software emulation.
4542
4543It is easy to accidentally do computations with @code{double} because
4544floating-point literals are implicitly of type @code{double}.  For
4545example, in:
4546@smallexample
4547@group
4548float area(float radius)
4549@{
4550   return 3.14159 * radius * radius;
4551@}
4552@end group
4553@end smallexample
4554the compiler performs the entire computation with @code{double}
4555because the floating-point literal is a @code{double}.
4556
4557@item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4558@opindex Wduplicate-decl-specifier
4559@opindex Wno-duplicate-decl-specifier
4560Warn if a declaration has duplicate @code{const}, @code{volatile},
4561@code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
4562@option{-Wall}.
4563
4564@item -Wformat
4565@itemx -Wformat=@var{n}
4566@opindex Wformat
4567@opindex Wno-format
4568@opindex ffreestanding
4569@opindex fno-builtin
4570@opindex Wformat=
4571Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4572the arguments supplied have types appropriate to the format string
4573specified, and that the conversions specified in the format string make
4574sense.  This includes standard functions, and others specified by format
4575attributes (@pxref{Function Attributes}), in the @code{printf},
4576@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4577not in the C standard) families (or other target-specific families).
4578Which functions are checked without format attributes having been
4579specified depends on the standard version selected, and such checks of
4580functions without the attribute specified are disabled by
4581@option{-ffreestanding} or @option{-fno-builtin}.
4582
4583The formats are checked against the format features supported by GNU
4584libc version 2.2.  These include all ISO C90 and C99 features, as well
4585as features from the Single Unix Specification and some BSD and GNU
4586extensions.  Other library implementations may not support all these
4587features; GCC does not support warning about features that go beyond a
4588particular library's limitations.  However, if @option{-Wpedantic} is used
4589with @option{-Wformat}, warnings are given about format features not
4590in the selected standard version (but not for @code{strfmon} formats,
4591since those are not in any version of the C standard).  @xref{C Dialect
4592Options,,Options Controlling C Dialect}.
4593
4594@table @gcctabopt
4595@item -Wformat=1
4596@itemx -Wformat
4597@opindex Wformat
4598@opindex Wformat=1
4599Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4600@option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
4601@option{-Wformat} also checks for null format arguments for several
4602functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
4603aspects of this level of format checking can be disabled by the
4604options: @option{-Wno-format-contains-nul},
4605@option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4606@option{-Wformat} is enabled by @option{-Wall}.
4607
4608@item -Wno-format-contains-nul
4609@opindex Wno-format-contains-nul
4610@opindex Wformat-contains-nul
4611If @option{-Wformat} is specified, do not warn about format strings that
4612contain NUL bytes.
4613
4614@item -Wno-format-extra-args
4615@opindex Wno-format-extra-args
4616@opindex Wformat-extra-args
4617If @option{-Wformat} is specified, do not warn about excess arguments to a
4618@code{printf} or @code{scanf} format function.  The C standard specifies
4619that such arguments are ignored.
4620
4621Where the unused arguments lie between used arguments that are
4622specified with @samp{$} operand number specifications, normally
4623warnings are still given, since the implementation could not know what
4624type to pass to @code{va_arg} to skip the unused arguments.  However,
4625in the case of @code{scanf} formats, this option suppresses the
4626warning if the unused arguments are all pointers, since the Single
4627Unix Specification says that such unused arguments are allowed.
4628
4629@item -Wformat-overflow
4630@itemx -Wformat-overflow=@var{level}
4631@opindex Wformat-overflow
4632@opindex Wno-format-overflow
4633Warn about calls to formatted input/output functions such as @code{sprintf}
4634and @code{vsprintf} that might overflow the destination buffer.  When the
4635exact number of bytes written by a format directive cannot be determined
4636at compile-time it is estimated based on heuristics that depend on the
4637@var{level} argument and on optimization.  While enabling optimization
4638will in most cases improve the accuracy of the warning, it may also
4639result in false positives.
4640
4641@table @gcctabopt
4642@item -Wformat-overflow
4643@itemx -Wformat-overflow=1
4644@opindex Wformat-overflow
4645@opindex Wno-format-overflow
4646Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4647employs a conservative approach that warns only about calls that most
4648likely overflow the buffer.  At this level, numeric arguments to format
4649directives with unknown values are assumed to have the value of one, and
4650strings of unknown length to be empty.  Numeric arguments that are known
4651to be bounded to a subrange of their type, or string arguments whose output
4652is bounded either by their directive's precision or by a finite set of
4653string literals, are assumed to take on the value within the range that
4654results in the most bytes on output.  For example, the call to @code{sprintf}
4655below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4656the terminating NUL character (@code{'\0'}) appended by the function
4657to the destination buffer will be written past its end.  Increasing
4658the size of the buffer by a single byte is sufficient to avoid the
4659warning, though it may not be sufficient to avoid the overflow.
4660
4661@smallexample
4662void f (int a, int b)
4663@{
4664  char buf [13];
4665  sprintf (buf, "a = %i, b = %i\n", a, b);
4666@}
4667@end smallexample
4668
4669@item -Wformat-overflow=2
4670Level @var{2} warns also about calls that might overflow the destination
4671buffer given an argument of sufficient length or magnitude.  At level
4672@var{2}, unknown numeric arguments are assumed to have the minimum
4673representable value for signed types with a precision greater than 1, and
4674the maximum representable value otherwise.  Unknown string arguments whose
4675length cannot be assumed to be bounded either by the directive's precision,
4676or by a finite set of string literals they may evaluate to, or the character
4677array they may point to, are assumed to be 1 character long.
4678
4679At level @var{2}, the call in the example above is again diagnosed, but
4680this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4681@code{%i} directive will write some of its digits beyond the end of
4682the destination buffer.  To make the call safe regardless of the values
4683of the two variables, the size of the destination buffer must be increased
4684to at least 34 bytes.  GCC includes the minimum size of the buffer in
4685an informational note following the warning.
4686
4687An alternative to increasing the size of the destination buffer is to
4688constrain the range of formatted values.  The maximum length of string
4689arguments can be bounded by specifying the precision in the format
4690directive.  When numeric arguments of format directives can be assumed
4691to be bounded by less than the precision of their type, choosing
4692an appropriate length modifier to the format specifier will reduce
4693the required buffer size.  For example, if @var{a} and @var{b} in the
4694example above can be assumed to be within the precision of
4695the @code{short int} type then using either the @code{%hi} format
4696directive or casting the argument to @code{short} reduces the maximum
4697required size of the buffer to 24 bytes.
4698
4699@smallexample
4700void f (int a, int b)
4701@{
4702  char buf [23];
4703  sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4704@}
4705@end smallexample
4706@end table
4707
4708@item -Wno-format-zero-length
4709@opindex Wno-format-zero-length
4710@opindex Wformat-zero-length
4711If @option{-Wformat} is specified, do not warn about zero-length formats.
4712The C standard specifies that zero-length formats are allowed.
4713
4714
4715@item -Wformat=2
4716@opindex Wformat=2
4717Enable @option{-Wformat} plus additional format checks.  Currently
4718equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4719-Wformat-y2k}.
4720
4721@item -Wformat-nonliteral
4722@opindex Wformat-nonliteral
4723@opindex Wno-format-nonliteral
4724If @option{-Wformat} is specified, also warn if the format string is not a
4725string literal and so cannot be checked, unless the format function
4726takes its format arguments as a @code{va_list}.
4727
4728@item -Wformat-security
4729@opindex Wformat-security
4730@opindex Wno-format-security
4731If @option{-Wformat} is specified, also warn about uses of format
4732functions that represent possible security problems.  At present, this
4733warns about calls to @code{printf} and @code{scanf} functions where the
4734format string is not a string literal and there are no format arguments,
4735as in @code{printf (foo);}.  This may be a security hole if the format
4736string came from untrusted input and contains @samp{%n}.  (This is
4737currently a subset of what @option{-Wformat-nonliteral} warns about, but
4738in future warnings may be added to @option{-Wformat-security} that are not
4739included in @option{-Wformat-nonliteral}.)
4740
4741@item -Wformat-signedness
4742@opindex Wformat-signedness
4743@opindex Wno-format-signedness
4744If @option{-Wformat} is specified, also warn if the format string
4745requires an unsigned argument and the argument is signed and vice versa.
4746
4747@item -Wformat-truncation
4748@itemx -Wformat-truncation=@var{level}
4749@opindex Wformat-truncation
4750@opindex Wno-format-truncation
4751Warn about calls to formatted input/output functions such as @code{snprintf}
4752and @code{vsnprintf} that might result in output truncation.  When the exact
4753number of bytes written by a format directive cannot be determined at
4754compile-time it is estimated based on heuristics that depend on
4755the @var{level} argument and on optimization.  While enabling optimization
4756will in most cases improve the accuracy of the warning, it may also result
4757in false positives.  Except as noted otherwise, the option uses the same
4758logic @option{-Wformat-overflow}.
4759
4760@table @gcctabopt
4761@item -Wformat-truncation
4762@itemx -Wformat-truncation=1
4763@opindex Wformat-truncation
4764@opindex Wno-format-truncation
4765Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4766employs a conservative approach that warns only about calls to bounded
4767functions whose return value is unused and that will most likely result
4768in output truncation.
4769
4770@item -Wformat-truncation=2
4771Level @var{2} warns also about calls to bounded functions whose return
4772value is used and that might result in truncation given an argument of
4773sufficient length or magnitude.
4774@end table
4775
4776@item -Wformat-y2k
4777@opindex Wformat-y2k
4778@opindex Wno-format-y2k
4779If @option{-Wformat} is specified, also warn about @code{strftime}
4780formats that may yield only a two-digit year.
4781@end table
4782
4783@item -Wnonnull
4784@opindex Wnonnull
4785@opindex Wno-nonnull
4786Warn about passing a null pointer for arguments marked as
4787requiring a non-null value by the @code{nonnull} function attribute.
4788
4789@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
4790can be disabled with the @option{-Wno-nonnull} option.
4791
4792@item -Wnonnull-compare
4793@opindex Wnonnull-compare
4794@opindex Wno-nonnull-compare
4795Warn when comparing an argument marked with the @code{nonnull}
4796function attribute against null inside the function.
4797
4798@option{-Wnonnull-compare} is included in @option{-Wall}.  It
4799can be disabled with the @option{-Wno-nonnull-compare} option.
4800
4801@item -Wnull-dereference
4802@opindex Wnull-dereference
4803@opindex Wno-null-dereference
4804Warn if the compiler detects paths that trigger erroneous or
4805undefined behavior due to dereferencing a null pointer.  This option
4806is only active when @option{-fdelete-null-pointer-checks} is active,
4807which is enabled by optimizations in most targets.  The precision of
4808the warnings depends on the optimization options used.
4809
4810@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4811@opindex Winit-self
4812@opindex Wno-init-self
4813Warn about uninitialized variables that are initialized with themselves.
4814Note this option can only be used with the @option{-Wuninitialized} option.
4815
4816For example, GCC warns about @code{i} being uninitialized in the
4817following snippet only when @option{-Winit-self} has been specified:
4818@smallexample
4819@group
4820int f()
4821@{
4822  int i = i;
4823  return i;
4824@}
4825@end group
4826@end smallexample
4827
4828This warning is enabled by @option{-Wall} in C++.
4829
4830@item -Wimplicit-int @r{(C and Objective-C only)}
4831@opindex Wimplicit-int
4832@opindex Wno-implicit-int
4833Warn when a declaration does not specify a type.
4834This warning is enabled by @option{-Wall}.
4835
4836@item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4837@opindex Wimplicit-function-declaration
4838@opindex Wno-implicit-function-declaration
4839Give a warning whenever a function is used before being declared. In
4840C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4841enabled by default and it is made into an error by
4842@option{-pedantic-errors}. This warning is also enabled by
4843@option{-Wall}.
4844
4845@item -Wimplicit @r{(C and Objective-C only)}
4846@opindex Wimplicit
4847@opindex Wno-implicit
4848Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4849This warning is enabled by @option{-Wall}.
4850
4851@item -Wimplicit-fallthrough
4852@opindex Wimplicit-fallthrough
4853@opindex Wno-implicit-fallthrough
4854@option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4855and @option{-Wno-implicit-fallthrough} is the same as
4856@option{-Wimplicit-fallthrough=0}.
4857
4858@item -Wimplicit-fallthrough=@var{n}
4859@opindex Wimplicit-fallthrough=
4860Warn when a switch case falls through.  For example:
4861
4862@smallexample
4863@group
4864switch (cond)
4865  @{
4866  case 1:
4867    a = 1;
4868    break;
4869  case 2:
4870    a = 2;
4871  case 3:
4872    a = 3;
4873    break;
4874  @}
4875@end group
4876@end smallexample
4877
4878This warning does not warn when the last statement of a case cannot
4879fall through, e.g. when there is a return statement or a call to function
4880declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
4881also takes into account control flow statements, such as ifs, and only
4882warns when appropriate.  E.g.@:
4883
4884@smallexample
4885@group
4886switch (cond)
4887  @{
4888  case 1:
4889    if (i > 3) @{
4890      bar (5);
4891      break;
4892    @} else if (i < 1) @{
4893      bar (0);
4894    @} else
4895      return;
4896  default:
4897    @dots{}
4898  @}
4899@end group
4900@end smallexample
4901
4902Since there are occasions where a switch case fall through is desirable,
4903GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4904to be used along with a null statement to suppress this warning that
4905would normally occur:
4906
4907@smallexample
4908@group
4909switch (cond)
4910  @{
4911  case 1:
4912    bar (0);
4913    __attribute__ ((fallthrough));
4914  default:
4915    @dots{}
4916  @}
4917@end group
4918@end smallexample
4919
4920C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4921warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
4922or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4923Instead of these attributes, it is also possible to add a fallthrough comment
4924to silence the warning.  The whole body of the C or C++ style comment should
4925match the given regular expressions listed below.  The option argument @var{n}
4926specifies what kind of comments are accepted:
4927
4928@itemize @bullet
4929
4930@item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4931
4932@item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4933expression, any comment is used as fallthrough comment.
4934
4935@item @option{-Wimplicit-fallthrough=2} case insensitively matches
4936@code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4937
4938@item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4939following regular expressions:
4940
4941@itemize @bullet
4942
4943@item @code{-fallthrough}
4944
4945@item @code{@@fallthrough@@}
4946
4947@item @code{lint -fallthrough[ \t]*}
4948
4949@item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4950
4951@item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4952
4953@item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4954
4955@end itemize
4956
4957@item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4958following regular expressions:
4959
4960@itemize @bullet
4961
4962@item @code{-fallthrough}
4963
4964@item @code{@@fallthrough@@}
4965
4966@item @code{lint -fallthrough[ \t]*}
4967
4968@item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4969
4970@end itemize
4971
4972@item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4973fallthrough comments, only attributes disable the warning.
4974
4975@end itemize
4976
4977The comment needs to be followed after optional whitespace and other comments
4978by @code{case} or @code{default} keywords or by a user label that precedes some
4979@code{case} or @code{default} label.
4980
4981@smallexample
4982@group
4983switch (cond)
4984  @{
4985  case 1:
4986    bar (0);
4987    /* FALLTHRU */
4988  default:
4989    @dots{}
4990  @}
4991@end group
4992@end smallexample
4993
4994The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4995
4996@item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4997@opindex Wif-not-aligned
4998@opindex Wno-if-not-aligned
4999Control if warning triggered by the @code{warn_if_not_aligned} attribute
5000should be issued.  This is enabled by default.
5001Use @option{-Wno-if-not-aligned} to disable it.
5002
5003@item -Wignored-qualifiers @r{(C and C++ only)}
5004@opindex Wignored-qualifiers
5005@opindex Wno-ignored-qualifiers
5006Warn if the return type of a function has a type qualifier
5007such as @code{const}.  For ISO C such a type qualifier has no effect,
5008since the value returned by a function is not an lvalue.
5009For C++, the warning is only emitted for scalar types or @code{void}.
5010ISO C prohibits qualified @code{void} return types on function
5011definitions, so such return types always receive a warning
5012even without this option.
5013
5014This warning is also enabled by @option{-Wextra}.
5015
5016@item -Wignored-attributes @r{(C and C++ only)}
5017@opindex Wignored-attributes
5018@opindex Wno-ignored-attributes
5019Warn when an attribute is ignored.  This is different from the
5020@option{-Wattributes} option in that it warns whenever the compiler decides
5021to drop an attribute, not that the attribute is either unknown, used in a
5022wrong place, etc.  This warning is enabled by default.
5023
5024@item -Wmain
5025@opindex Wmain
5026@opindex Wno-main
5027Warn if the type of @code{main} is suspicious.  @code{main} should be
5028a function with external linkage, returning int, taking either zero
5029arguments, two, or three arguments of appropriate types.  This warning
5030is enabled by default in C++ and is enabled by either @option{-Wall}
5031or @option{-Wpedantic}.
5032
5033@item -Wmisleading-indentation @r{(C and C++ only)}
5034@opindex Wmisleading-indentation
5035@opindex Wno-misleading-indentation
5036Warn when the indentation of the code does not reflect the block structure.
5037Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5038@code{for} clauses with a guarded statement that does not use braces,
5039followed by an unguarded statement with the same indentation.
5040
5041In the following example, the call to ``bar'' is misleadingly indented as
5042if it were guarded by the ``if'' conditional.
5043
5044@smallexample
5045  if (some_condition ())
5046    foo ();
5047    bar ();  /* Gotcha: this is not guarded by the "if".  */
5048@end smallexample
5049
5050In the case of mixed tabs and spaces, the warning uses the
5051@option{-ftabstop=} option to determine if the statements line up
5052(defaulting to 8).
5053
5054The warning is not issued for code involving multiline preprocessor logic
5055such as the following example.
5056
5057@smallexample
5058  if (flagA)
5059    foo (0);
5060#if SOME_CONDITION_THAT_DOES_NOT_HOLD
5061  if (flagB)
5062#endif
5063    foo (1);
5064@end smallexample
5065
5066The warning is not issued after a @code{#line} directive, since this
5067typically indicates autogenerated code, and no assumptions can be made
5068about the layout of the file that the directive references.
5069
5070This warning is enabled by @option{-Wall} in C and C++.
5071
5072@item -Wmissing-attributes
5073@opindex Wmissing-attributes
5074@opindex Wno-missing-attributes
5075Warn when a declaration of a function is missing one or more attributes
5076that a related function is declared with and whose absence may adversely
5077affect the correctness or efficiency of generated code.  For example,
5078the warning is issued for declarations of aliases that use attributes
5079to specify less restrictive requirements than those of their targets.
5080This typically represents a potential optimization opportunity.
5081By contrast, the @option{-Wattribute-alias=2} option controls warnings
5082issued when the alias is more restrictive than the target, which could
5083lead to incorrect code generation.
5084Attributes considered include @code{alloc_align}, @code{alloc_size},
5085@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5086@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5087@code{returns_nonnull}, and @code{returns_twice}.
5088
5089In C++, the warning is issued when an explicit specialization of a primary
5090template declared with attribute @code{alloc_align}, @code{alloc_size},
5091@code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5092or @code{nonnull} is declared without it.  Attributes @code{deprecated},
5093@code{error}, and @code{warning} suppress the warning.
5094(@pxref{Function Attributes}).
5095
5096You can use the @code{copy} attribute to apply the same
5097set of attributes to a declaration as that on another declaration without
5098explicitly enumerating the attributes. This attribute can be applied
5099to declarations of functions (@pxref{Common Function Attributes}),
5100variables (@pxref{Common Variable Attributes}), or types
5101(@pxref{Common Type Attributes}).
5102
5103@option{-Wmissing-attributes} is enabled by @option{-Wall}.
5104
5105For example, since the declaration of the primary function template
5106below makes use of both attribute @code{malloc} and @code{alloc_size}
5107the declaration of the explicit specialization of the template is
5108diagnosed because it is missing one of the attributes.
5109
5110@smallexample
5111template <class T>
5112T* __attribute__ ((malloc, alloc_size (1)))
5113allocate (size_t);
5114
5115template <>
5116void* __attribute__ ((malloc))   // missing alloc_size
5117allocate<void> (size_t);
5118@end smallexample
5119
5120@item -Wmissing-braces
5121@opindex Wmissing-braces
5122@opindex Wno-missing-braces
5123Warn if an aggregate or union initializer is not fully bracketed.  In
5124the following example, the initializer for @code{a} is not fully
5125bracketed, but that for @code{b} is fully bracketed.  This warning is
5126enabled by @option{-Wall} in C.
5127
5128@smallexample
5129int a[2][2] = @{ 0, 1, 2, 3 @};
5130int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5131@end smallexample
5132
5133This warning is enabled by @option{-Wall}.
5134
5135@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5136@opindex Wmissing-include-dirs
5137@opindex Wno-missing-include-dirs
5138Warn if a user-supplied include directory does not exist.
5139
5140@item -Wmissing-profile
5141@opindex Wmissing-profile
5142@opindex Wno-missing-profile
5143Warn if feedback profiles are missing when using the
5144@option{-fprofile-use} option.
5145This option diagnoses those cases where a new function or a new file is added
5146to the user code between compiling with @option{-fprofile-generate} and with
5147@option{-fprofile-use}, without regenerating the profiles.  In these cases, the
5148profile feedback data files do not contain any profile feedback information for
5149the newly added function or file respectively.  Also, in the case when profile
5150count data (.gcda) files are removed, GCC cannot use any profile feedback
5151information.  In all these cases, warnings are issued to inform the user that a
5152profile generation step is due.  @option{-Wno-missing-profile} can be used to
5153disable the warning.  Ignoring the warning can result in poorly optimized code.
5154Completely disabling the warning is not recommended and should be done only
5155when non-existent profile data is justified.
5156
5157@item -Wmultistatement-macros
5158@opindex Wmultistatement-macros
5159@opindex Wno-multistatement-macros
5160Warn about unsafe multiple statement macros that appear to be guarded
5161by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5162@code{while}, in which only the first statement is actually guarded after
5163the macro is expanded.
5164
5165For example:
5166
5167@smallexample
5168#define DOIT x++; y++
5169if (c)
5170  DOIT;
5171@end smallexample
5172
5173will increment @code{y} unconditionally, not just when @code{c} holds.
5174The can usually be fixed by wrapping the macro in a do-while loop:
5175@smallexample
5176#define DOIT do @{ x++; y++; @} while (0)
5177if (c)
5178  DOIT;
5179@end smallexample
5180
5181This warning is enabled by @option{-Wall} in C and C++.
5182
5183@item -Wparentheses
5184@opindex Wparentheses
5185@opindex Wno-parentheses
5186Warn if parentheses are omitted in certain contexts, such
5187as when there is an assignment in a context where a truth value
5188is expected, or when operators are nested whose precedence people
5189often get confused about.
5190
5191Also warn if a comparison like @code{x<=y<=z} appears; this is
5192equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5193interpretation from that of ordinary mathematical notation.
5194
5195Also warn for dangerous uses of the GNU extension to
5196@code{?:} with omitted middle operand. When the condition
5197in the @code{?}: operator is a boolean expression, the omitted value is
5198always 1.  Often programmers expect it to be a value computed
5199inside the conditional expression instead.
5200
5201For C++ this also warns for some cases of unnecessary parentheses in
5202declarations, which can indicate an attempt at a function call instead
5203of a declaration:
5204@smallexample
5205@{
5206  // Declares a local variable called mymutex.
5207  std::unique_lock<std::mutex> (mymutex);
5208  // User meant std::unique_lock<std::mutex> lock (mymutex);
5209@}
5210@end smallexample
5211
5212This warning is enabled by @option{-Wall}.
5213
5214@item -Wsequence-point
5215@opindex Wsequence-point
5216@opindex Wno-sequence-point
5217Warn about code that may have undefined semantics because of violations
5218of sequence point rules in the C and C++ standards.
5219
5220The C and C++ standards define the order in which expressions in a C/C++
5221program are evaluated in terms of @dfn{sequence points}, which represent
5222a partial ordering between the execution of parts of the program: those
5223executed before the sequence point, and those executed after it.  These
5224occur after the evaluation of a full expression (one which is not part
5225of a larger expression), after the evaluation of the first operand of a
5226@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5227function is called (but after the evaluation of its arguments and the
5228expression denoting the called function), and in certain other places.
5229Other than as expressed by the sequence point rules, the order of
5230evaluation of subexpressions of an expression is not specified.  All
5231these rules describe only a partial order rather than a total order,
5232since, for example, if two functions are called within one expression
5233with no sequence point between them, the order in which the functions
5234are called is not specified.  However, the standards committee have
5235ruled that function calls do not overlap.
5236
5237It is not specified when between sequence points modifications to the
5238values of objects take effect.  Programs whose behavior depends on this
5239have undefined behavior; the C and C++ standards specify that ``Between
5240the previous and next sequence point an object shall have its stored
5241value modified at most once by the evaluation of an expression.
5242Furthermore, the prior value shall be read only to determine the value
5243to be stored.''.  If a program breaks these rules, the results on any
5244particular implementation are entirely unpredictable.
5245
5246Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5247= b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
5248diagnosed by this option, and it may give an occasional false positive
5249result, but in general it has been found fairly effective at detecting
5250this sort of problem in programs.
5251
5252The C++17 standard will define the order of evaluation of operands in
5253more cases: in particular it requires that the right-hand side of an
5254assignment be evaluated before the left-hand side, so the above
5255examples are no longer undefined.  But this warning will still warn
5256about them, to help people avoid writing code that is undefined in C
5257and earlier revisions of C++.
5258
5259The standard is worded confusingly, therefore there is some debate
5260over the precise meaning of the sequence point rules in subtle cases.
5261Links to discussions of the problem, including proposed formal
5262definitions, may be found on the GCC readings page, at
5263@uref{http://gcc.gnu.org/@/readings.html}.
5264
5265This warning is enabled by @option{-Wall} for C and C++.
5266
5267@item -Wno-return-local-addr
5268@opindex Wno-return-local-addr
5269@opindex Wreturn-local-addr
5270Do not warn about returning a pointer (or in C++, a reference) to a
5271variable that goes out of scope after the function returns.
5272
5273@item -Wreturn-type
5274@opindex Wreturn-type
5275@opindex Wno-return-type
5276Warn whenever a function is defined with a return type that defaults
5277to @code{int}.  Also warn about any @code{return} statement with no
5278return value in a function whose return type is not @code{void}
5279(falling off the end of the function body is considered returning
5280without a value).
5281
5282For C only, warn about a @code{return} statement with an expression in a
5283function whose return type is @code{void}, unless the expression type is
5284also @code{void}.  As a GNU extension, the latter case is accepted
5285without a warning unless @option{-Wpedantic} is used.  Attempting
5286to use the return value of a non-@code{void} function other than @code{main}
5287that flows off the end by reaching the closing curly brace that terminates
5288the function is undefined.
5289
5290Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5291than @code{main} results in undefined behavior even when the value of
5292the function is not used.
5293
5294This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5295
5296@item -Wshift-count-negative
5297@opindex Wshift-count-negative
5298@opindex Wno-shift-count-negative
5299Warn if shift count is negative. This warning is enabled by default.
5300
5301@item -Wshift-count-overflow
5302@opindex Wshift-count-overflow
5303@opindex Wno-shift-count-overflow
5304Warn if shift count >= width of type. This warning is enabled by default.
5305
5306@item -Wshift-negative-value
5307@opindex Wshift-negative-value
5308@opindex Wno-shift-negative-value
5309Warn if left shifting a negative value.  This warning is enabled by
5310@option{-Wextra} in C99 and C++11 modes (and newer).
5311
5312@item -Wshift-overflow
5313@itemx -Wshift-overflow=@var{n}
5314@opindex Wshift-overflow
5315@opindex Wno-shift-overflow
5316Warn about left shift overflows.  This warning is enabled by
5317default in C99 and C++11 modes (and newer).
5318
5319@table @gcctabopt
5320@item -Wshift-overflow=1
5321This is the warning level of @option{-Wshift-overflow} and is enabled
5322by default in C99 and C++11 modes (and newer).  This warning level does
5323not warn about left-shifting 1 into the sign bit.  (However, in C, such
5324an overflow is still rejected in contexts where an integer constant expression
5325is required.)  No warning is emitted in C++2A mode (and newer), as signed left
5326shifts always wrap.
5327
5328@item -Wshift-overflow=2
5329This warning level also warns about left-shifting 1 into the sign bit,
5330unless C++14 mode (or newer) is active.
5331@end table
5332
5333@item -Wswitch
5334@opindex Wswitch
5335@opindex Wno-switch
5336Warn whenever a @code{switch} statement has an index of enumerated type
5337and lacks a @code{case} for one or more of the named codes of that
5338enumeration.  (The presence of a @code{default} label prevents this
5339warning.)  @code{case} labels outside the enumeration range also
5340provoke warnings when this option is used (even if there is a
5341@code{default} label).
5342This warning is enabled by @option{-Wall}.
5343
5344@item -Wswitch-default
5345@opindex Wswitch-default
5346@opindex Wno-switch-default
5347Warn whenever a @code{switch} statement does not have a @code{default}
5348case.
5349
5350@item -Wswitch-enum
5351@opindex Wswitch-enum
5352@opindex Wno-switch-enum
5353Warn whenever a @code{switch} statement has an index of enumerated type
5354and lacks a @code{case} for one or more of the named codes of that
5355enumeration.  @code{case} labels outside the enumeration range also
5356provoke warnings when this option is used.  The only difference
5357between @option{-Wswitch} and this option is that this option gives a
5358warning about an omitted enumeration code even if there is a
5359@code{default} label.
5360
5361@item -Wswitch-bool
5362@opindex Wswitch-bool
5363@opindex Wno-switch-bool
5364Warn whenever a @code{switch} statement has an index of boolean type
5365and the case values are outside the range of a boolean type.
5366It is possible to suppress this warning by casting the controlling
5367expression to a type other than @code{bool}.  For example:
5368@smallexample
5369@group
5370switch ((int) (a == 4))
5371  @{
5372  @dots{}
5373  @}
5374@end group
5375@end smallexample
5376This warning is enabled by default for C and C++ programs.
5377
5378@item -Wswitch-unreachable
5379@opindex Wswitch-unreachable
5380@opindex Wno-switch-unreachable
5381Warn whenever a @code{switch} statement contains statements between the
5382controlling expression and the first case label, which will never be
5383executed.  For example:
5384@smallexample
5385@group
5386switch (cond)
5387  @{
5388   i = 15;
5389  @dots{}
5390   case 5:
5391  @dots{}
5392  @}
5393@end group
5394@end smallexample
5395@option{-Wswitch-unreachable} does not warn if the statement between the
5396controlling expression and the first case label is just a declaration:
5397@smallexample
5398@group
5399switch (cond)
5400  @{
5401   int i;
5402  @dots{}
5403   case 5:
5404   i = 5;
5405  @dots{}
5406  @}
5407@end group
5408@end smallexample
5409This warning is enabled by default for C and C++ programs.
5410
5411@item -Wsync-nand @r{(C and C++ only)}
5412@opindex Wsync-nand
5413@opindex Wno-sync-nand
5414Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5415built-in functions are used.  These functions changed semantics in GCC 4.4.
5416
5417@item -Wunused-but-set-parameter
5418@opindex Wunused-but-set-parameter
5419@opindex Wno-unused-but-set-parameter
5420Warn whenever a function parameter is assigned to, but otherwise unused
5421(aside from its declaration).
5422
5423To suppress this warning use the @code{unused} attribute
5424(@pxref{Variable Attributes}).
5425
5426This warning is also enabled by @option{-Wunused} together with
5427@option{-Wextra}.
5428
5429@item -Wunused-but-set-variable
5430@opindex Wunused-but-set-variable
5431@opindex Wno-unused-but-set-variable
5432Warn whenever a local variable is assigned to, but otherwise unused
5433(aside from its declaration).
5434This warning is enabled by @option{-Wall}.
5435
5436To suppress this warning use the @code{unused} attribute
5437(@pxref{Variable Attributes}).
5438
5439This warning is also enabled by @option{-Wunused}, which is enabled
5440by @option{-Wall}.
5441
5442@item -Wunused-function
5443@opindex Wunused-function
5444@opindex Wno-unused-function
5445Warn whenever a static function is declared but not defined or a
5446non-inline static function is unused.
5447This warning is enabled by @option{-Wall}.
5448
5449@item -Wunused-label
5450@opindex Wunused-label
5451@opindex Wno-unused-label
5452Warn whenever a label is declared but not used.
5453This warning is enabled by @option{-Wall}.
5454
5455To suppress this warning use the @code{unused} attribute
5456(@pxref{Variable Attributes}).
5457
5458@item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5459@opindex Wunused-local-typedefs
5460@opindex Wno-unused-local-typedefs
5461Warn when a typedef locally defined in a function is not used.
5462This warning is enabled by @option{-Wall}.
5463
5464@item -Wunused-parameter
5465@opindex Wunused-parameter
5466@opindex Wno-unused-parameter
5467Warn whenever a function parameter is unused aside from its declaration.
5468
5469To suppress this warning use the @code{unused} attribute
5470(@pxref{Variable Attributes}).
5471
5472@item -Wno-unused-result
5473@opindex Wunused-result
5474@opindex Wno-unused-result
5475Do not warn if a caller of a function marked with attribute
5476@code{warn_unused_result} (@pxref{Function Attributes}) does not use
5477its return value. The default is @option{-Wunused-result}.
5478
5479@item -Wunused-variable
5480@opindex Wunused-variable
5481@opindex Wno-unused-variable
5482Warn whenever a local or static variable is unused aside from its
5483declaration. This option implies @option{-Wunused-const-variable=1} for C,
5484but not for C++. This warning is enabled by @option{-Wall}.
5485
5486To suppress this warning use the @code{unused} attribute
5487(@pxref{Variable Attributes}).
5488
5489@item -Wunused-const-variable
5490@itemx -Wunused-const-variable=@var{n}
5491@opindex Wunused-const-variable
5492@opindex Wno-unused-const-variable
5493Warn whenever a constant static variable is unused aside from its declaration.
5494@option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5495for C, but not for C++. In C this declares variable storage, but in C++ this
5496is not an error since const variables take the place of @code{#define}s.
5497
5498To suppress this warning use the @code{unused} attribute
5499(@pxref{Variable Attributes}).
5500
5501@table @gcctabopt
5502@item -Wunused-const-variable=1
5503This is the warning level that is enabled by @option{-Wunused-variable} for
5504C.  It warns only about unused static const variables defined in the main
5505compilation unit, but not about static const variables declared in any
5506header included.
5507
5508@item -Wunused-const-variable=2
5509This warning level also warns for unused constant static variables in
5510headers (excluding system headers).  This is the warning level of
5511@option{-Wunused-const-variable} and must be explicitly requested since
5512in C++ this isn't an error and in C it might be harder to clean up all
5513headers included.
5514@end table
5515
5516@item -Wunused-value
5517@opindex Wunused-value
5518@opindex Wno-unused-value
5519Warn whenever a statement computes a result that is explicitly not
5520used. To suppress this warning cast the unused expression to
5521@code{void}. This includes an expression-statement or the left-hand
5522side of a comma expression that contains no side effects. For example,
5523an expression such as @code{x[i,j]} causes a warning, while
5524@code{x[(void)i,j]} does not.
5525
5526This warning is enabled by @option{-Wall}.
5527
5528@item -Wunused
5529@opindex Wunused
5530@opindex Wno-unused
5531All the above @option{-Wunused} options combined.
5532
5533In order to get a warning about an unused function parameter, you must
5534either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5535@option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5536
5537@item -Wuninitialized
5538@opindex Wuninitialized
5539@opindex Wno-uninitialized
5540Warn if an automatic variable is used without first being initialized
5541or if a variable may be clobbered by a @code{setjmp} call. In C++,
5542warn if a non-static reference or non-static @code{const} member
5543appears in a class without constructors.
5544
5545If you want to warn about code that uses the uninitialized value of the
5546variable in its own initializer, use the @option{-Winit-self} option.
5547
5548These warnings occur for individual uninitialized or clobbered
5549elements of structure, union or array variables as well as for
5550variables that are uninitialized or clobbered as a whole.  They do
5551not occur for variables or elements declared @code{volatile}.  Because
5552these warnings depend on optimization, the exact variables or elements
5553for which there are warnings depends on the precise optimization
5554options and version of GCC used.
5555
5556Note that there may be no warning about a variable that is used only
5557to compute a value that itself is never used, because such
5558computations may be deleted by data flow analysis before the warnings
5559are printed.
5560
5561@item -Winvalid-memory-model
5562@opindex Winvalid-memory-model
5563@opindex Wno-invalid-memory-model
5564Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5565and the C11 atomic generic functions with a memory consistency argument
5566that is either invalid for the operation or outside the range of values
5567of the @code{memory_order} enumeration.  For example, since the
5568@code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5569defined for the relaxed, release, and sequentially consistent memory
5570orders the following code is diagnosed:
5571
5572@smallexample
5573void store (int *i)
5574@{
5575  __atomic_store_n (i, 0, memory_order_consume);
5576@}
5577@end smallexample
5578
5579@option{-Winvalid-memory-model} is enabled by default.
5580
5581@item -Wmaybe-uninitialized
5582@opindex Wmaybe-uninitialized
5583@opindex Wno-maybe-uninitialized
5584For an automatic (i.e.@: local) variable, if there exists a path from the
5585function entry to a use of the variable that is initialized, but there exist
5586some other paths for which the variable is not initialized, the compiler
5587emits a warning if it cannot prove the uninitialized paths are not
5588executed at run time.
5589
5590These warnings are only possible in optimizing compilation, because otherwise
5591GCC does not keep track of the state of variables.
5592
5593These warnings are made optional because GCC may not be able to determine when
5594the code is correct in spite of appearing to have an error.  Here is one
5595example of how this can happen:
5596
5597@smallexample
5598@group
5599@{
5600  int x;
5601  switch (y)
5602    @{
5603    case 1: x = 1;
5604      break;
5605    case 2: x = 4;
5606      break;
5607    case 3: x = 5;
5608    @}
5609  foo (x);
5610@}
5611@end group
5612@end smallexample
5613
5614@noindent
5615If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5616always initialized, but GCC doesn't know this. To suppress the
5617warning, you need to provide a default case with assert(0) or
5618similar code.
5619
5620@cindex @code{longjmp} warnings
5621This option also warns when a non-volatile automatic variable might be
5622changed by a call to @code{longjmp}.
5623The compiler sees only the calls to @code{setjmp}.  It cannot know
5624where @code{longjmp} will be called; in fact, a signal handler could
5625call it at any point in the code.  As a result, you may get a warning
5626even when there is in fact no problem because @code{longjmp} cannot
5627in fact be called at the place that would cause a problem.
5628
5629Some spurious warnings can be avoided if you declare all the functions
5630you use that never return as @code{noreturn}.  @xref{Function
5631Attributes}.
5632
5633This warning is enabled by @option{-Wall} or @option{-Wextra}.
5634
5635@item -Wunknown-pragmas
5636@opindex Wunknown-pragmas
5637@opindex Wno-unknown-pragmas
5638@cindex warning for unknown pragmas
5639@cindex unknown pragmas, warning
5640@cindex pragmas, warning of unknown
5641Warn when a @code{#pragma} directive is encountered that is not understood by
5642GCC@.  If this command-line option is used, warnings are even issued
5643for unknown pragmas in system header files.  This is not the case if
5644the warnings are only enabled by the @option{-Wall} command-line option.
5645
5646@item -Wno-pragmas
5647@opindex Wno-pragmas
5648@opindex Wpragmas
5649Do not warn about misuses of pragmas, such as incorrect parameters,
5650invalid syntax, or conflicts between pragmas.  See also
5651@option{-Wunknown-pragmas}.
5652
5653@item -Wno-prio-ctor-dtor
5654@opindex Wno-prio-ctor-dtor
5655@opindex Wprio-ctor-dtor
5656Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5657The use of constructor and destructor attributes allow you to assign a
5658priority to the constructor/destructor to control its order of execution
5659before @code{main} is called or after it returns.  The priority values must be
5660greater than 100 as the compiler reserves priority values between 0--100 for
5661the implementation.
5662
5663@item -Wstrict-aliasing
5664@opindex Wstrict-aliasing
5665@opindex Wno-strict-aliasing
5666This option is only active when @option{-fstrict-aliasing} is active.
5667It warns about code that might break the strict aliasing rules that the
5668compiler is using for optimization.  The warning does not catch all
5669cases, but does attempt to catch the more common pitfalls.  It is
5670included in @option{-Wall}.
5671It is equivalent to @option{-Wstrict-aliasing=3}
5672
5673@item -Wstrict-aliasing=n
5674@opindex Wstrict-aliasing=n
5675This option is only active when @option{-fstrict-aliasing} is active.
5676It warns about code that might break the strict aliasing rules that the
5677compiler is using for optimization.
5678Higher levels correspond to higher accuracy (fewer false positives).
5679Higher levels also correspond to more effort, similar to the way @option{-O}
5680works.
5681@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5682
5683Level 1: Most aggressive, quick, least accurate.
5684Possibly useful when higher levels
5685do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5686false negatives.  However, it has many false positives.
5687Warns for all pointer conversions between possibly incompatible types,
5688even if never dereferenced.  Runs in the front end only.
5689
5690Level 2: Aggressive, quick, not too precise.
5691May still have many false positives (not as many as level 1 though),
5692and few false negatives (but possibly more than level 1).
5693Unlike level 1, it only warns when an address is taken.  Warns about
5694incomplete types.  Runs in the front end only.
5695
5696Level 3 (default for @option{-Wstrict-aliasing}):
5697Should have very few false positives and few false
5698negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
5699Takes care of the common pun+dereference pattern in the front end:
5700@code{*(int*)&some_float}.
5701If optimization is enabled, it also runs in the back end, where it deals
5702with multiple statement cases using flow-sensitive points-to information.
5703Only warns when the converted pointer is dereferenced.
5704Does not warn about incomplete types.
5705
5706@item -Wstrict-overflow
5707@itemx -Wstrict-overflow=@var{n}
5708@opindex Wstrict-overflow
5709@opindex Wno-strict-overflow
5710This option is only active when signed overflow is undefined.
5711It warns about cases where the compiler optimizes based on the
5712assumption that signed overflow does not occur.  Note that it does not
5713warn about all cases where the code might overflow: it only warns
5714about cases where the compiler implements some optimization.  Thus
5715this warning depends on the optimization level.
5716
5717An optimization that assumes that signed overflow does not occur is
5718perfectly safe if the values of the variables involved are such that
5719overflow never does, in fact, occur.  Therefore this warning can
5720easily give a false positive: a warning about code that is not
5721actually a problem.  To help focus on important issues, several
5722warning levels are defined.  No warnings are issued for the use of
5723undefined signed overflow when estimating how many iterations a loop
5724requires, in particular when determining whether a loop will be
5725executed at all.
5726
5727@table @gcctabopt
5728@item -Wstrict-overflow=1
5729Warn about cases that are both questionable and easy to avoid.  For
5730example the compiler simplifies
5731@code{x + 1 > x} to @code{1}.  This level of
5732@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5733are not, and must be explicitly requested.
5734
5735@item -Wstrict-overflow=2
5736Also warn about other cases where a comparison is simplified to a
5737constant.  For example: @code{abs (x) >= 0}.  This can only be
5738simplified when signed integer overflow is undefined, because
5739@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5740zero.  @option{-Wstrict-overflow} (with no level) is the same as
5741@option{-Wstrict-overflow=2}.
5742
5743@item -Wstrict-overflow=3
5744Also warn about other cases where a comparison is simplified.  For
5745example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5746
5747@item -Wstrict-overflow=4
5748Also warn about other simplifications not covered by the above cases.
5749For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5750
5751@item -Wstrict-overflow=5
5752Also warn about cases where the compiler reduces the magnitude of a
5753constant involved in a comparison.  For example: @code{x + 2 > y} is
5754simplified to @code{x + 1 >= y}.  This is reported only at the
5755highest warning level because this simplification applies to many
5756comparisons, so this warning level gives a very large number of
5757false positives.
5758@end table
5759
5760@item -Wstringop-overflow
5761@itemx -Wstringop-overflow=@var{type}
5762@opindex Wstringop-overflow
5763@opindex Wno-stringop-overflow
5764Warn for calls to string manipulation functions such as @code{memcpy} and
5765@code{strcpy} that are determined to overflow the destination buffer.  The
5766optional argument is one greater than the type of Object Size Checking to
5767perform to determine the size of the destination.  @xref{Object Size Checking}.
5768The argument is meaningful only for functions that operate on character arrays
5769but not for raw memory functions like @code{memcpy} which always make use
5770of Object Size type-0.  The option also warns for calls that specify a size
5771in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5772The option produces the best results with optimization enabled but can detect
5773a small subset of simple buffer overflows even without optimization in
5774calls to the GCC built-in functions like @code{__builtin_memcpy} that
5775correspond to the standard functions.  In any case, the option warns about
5776just a subset of buffer overflows detected by the corresponding overflow
5777checking built-ins.  For example, the option will issue a warning for
5778the @code{strcpy} call below because it copies at least 5 characters
5779(the string @code{"blue"} including the terminating NUL) into the buffer
5780of size 4.
5781
5782@smallexample
5783enum Color @{ blue, purple, yellow @};
5784const char* f (enum Color clr)
5785@{
5786  static char buf [4];
5787  const char *str;
5788  switch (clr)
5789    @{
5790      case blue: str = "blue"; break;
5791      case purple: str = "purple"; break;
5792      case yellow: str = "yellow"; break;
5793    @}
5794
5795  return strcpy (buf, str);   // warning here
5796@}
5797@end smallexample
5798
5799Option @option{-Wstringop-overflow=2} is enabled by default.
5800
5801@table @gcctabopt
5802@item -Wstringop-overflow
5803@itemx -Wstringop-overflow=1
5804@opindex Wstringop-overflow
5805@opindex Wno-stringop-overflow
5806The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5807to determine the sizes of destination objects.  This is the default setting
5808of the option.  At this setting the option will not warn for writes past
5809the end of subobjects of larger objects accessed by pointers unless the
5810size of the largest surrounding object is known.  When the destination may
5811be one of several objects it is assumed to be the largest one of them.  On
5812Linux systems, when optimization is enabled at this setting the option warns
5813for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5814a non-zero value.
5815
5816@item -Wstringop-overflow=2
5817The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5818to determine the sizes of destination objects.  At this setting the option
5819will warn about overflows when writing to members of the largest complete
5820objects whose exact size is known.  It will, however, not warn for excessive
5821writes to the same members of unknown objects referenced by pointers since
5822they may point to arrays containing unknown numbers of elements.
5823
5824@item -Wstringop-overflow=3
5825The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5826to determine the sizes of destination objects.  At this setting the option
5827warns about overflowing the smallest object or data member.  This is the
5828most restrictive setting of the option that may result in warnings for safe
5829code.
5830
5831@item -Wstringop-overflow=4
5832The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5833to determine the sizes of destination objects.  At this setting the option
5834will warn about overflowing any data members, and when the destination is
5835one of several objects it uses the size of the largest of them to decide
5836whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
5837setting of the option may result in warnings for benign code.
5838@end table
5839
5840@item -Wstringop-truncation
5841@opindex Wstringop-truncation
5842@opindex Wno-stringop-truncation
5843Warn for calls to bounded string manipulation functions such as @code{strncat},
5844@code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5845or leave the destination unchanged.
5846
5847In the following example, the call to @code{strncat} specifies a bound that
5848is less than the length of the source string.  As a result, the copy of
5849the source will be truncated and so the call is diagnosed.  To avoid the
5850warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5851
5852@smallexample
5853void append (char *buf, size_t bufsize)
5854@{
5855  strncat (buf, ".txt", 3);
5856@}
5857@end smallexample
5858
5859As another example, the following call to @code{strncpy} results in copying
5860to @code{d} just the characters preceding the terminating NUL, without
5861appending the NUL to the end.  Assuming the result of @code{strncpy} is
5862necessarily a NUL-terminated string is a common mistake, and so the call
5863is diagnosed.  To avoid the warning when the result is not expected to be
5864NUL-terminated, call @code{memcpy} instead.
5865
5866@smallexample
5867void copy (char *d, const char *s)
5868@{
5869  strncpy (d, s, strlen (s));
5870@}
5871@end smallexample
5872
5873In the following example, the call to @code{strncpy} specifies the size
5874of the destination buffer as the bound.  If the length of the source
5875string is equal to or greater than this size the result of the copy will
5876not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
5877the warning, specify @code{sizeof buf - 1} as the bound and set the last
5878element of the buffer to @code{NUL}.
5879
5880@smallexample
5881void copy (const char *s)
5882@{
5883  char buf[80];
5884  strncpy (buf, s, sizeof buf);
5885  @dots{}
5886@}
5887@end smallexample
5888
5889In situations where a character array is intended to store a sequence
5890of bytes with no terminating @code{NUL} such an array may be annotated
5891with attribute @code{nonstring} to avoid this warning.  Such arrays,
5892however, are not suitable arguments to functions that expect
5893@code{NUL}-terminated strings.  To help detect accidental misuses of
5894such arrays GCC issues warnings unless it can prove that the use is
5895safe.  @xref{Common Variable Attributes}.
5896
5897@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5898@opindex Wsuggest-attribute=
5899@opindex Wno-suggest-attribute=
5900Warn for cases where adding an attribute may be beneficial. The
5901attributes currently supported are listed below.
5902
5903@table @gcctabopt
5904@item -Wsuggest-attribute=pure
5905@itemx -Wsuggest-attribute=const
5906@itemx -Wsuggest-attribute=noreturn
5907@itemx -Wmissing-noreturn
5908@itemx -Wsuggest-attribute=malloc
5909@opindex Wsuggest-attribute=pure
5910@opindex Wno-suggest-attribute=pure
5911@opindex Wsuggest-attribute=const
5912@opindex Wno-suggest-attribute=const
5913@opindex Wsuggest-attribute=noreturn
5914@opindex Wno-suggest-attribute=noreturn
5915@opindex Wmissing-noreturn
5916@opindex Wno-missing-noreturn
5917@opindex Wsuggest-attribute=malloc
5918@opindex Wno-suggest-attribute=malloc
5919
5920Warn about functions that might be candidates for attributes
5921@code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5922only warns for functions visible in other compilation units or (in the case of
5923@code{pure} and @code{const}) if it cannot prove that the function returns
5924normally. A function returns normally if it doesn't contain an infinite loop or
5925return abnormally by throwing, calling @code{abort} or trapping.  This analysis
5926requires option @option{-fipa-pure-const}, which is enabled by default at
5927@option{-O} and higher.  Higher optimization levels improve the accuracy
5928of the analysis.
5929
5930@item -Wsuggest-attribute=format
5931@itemx -Wmissing-format-attribute
5932@opindex Wsuggest-attribute=format
5933@opindex Wmissing-format-attribute
5934@opindex Wno-suggest-attribute=format
5935@opindex Wno-missing-format-attribute
5936@opindex Wformat
5937@opindex Wno-format
5938
5939Warn about function pointers that might be candidates for @code{format}
5940attributes.  Note these are only possible candidates, not absolute ones.
5941GCC guesses that function pointers with @code{format} attributes that
5942are used in assignment, initialization, parameter passing or return
5943statements should have a corresponding @code{format} attribute in the
5944resulting type.  I.e.@: the left-hand side of the assignment or
5945initialization, the type of the parameter variable, or the return type
5946of the containing function respectively should also have a @code{format}
5947attribute to avoid the warning.
5948
5949GCC also warns about function definitions that might be
5950candidates for @code{format} attributes.  Again, these are only
5951possible candidates.  GCC guesses that @code{format} attributes
5952might be appropriate for any function that calls a function like
5953@code{vprintf} or @code{vscanf}, but this might not always be the
5954case, and some functions for which @code{format} attributes are
5955appropriate may not be detected.
5956
5957@item -Wsuggest-attribute=cold
5958@opindex Wsuggest-attribute=cold
5959@opindex Wno-suggest-attribute=cold
5960
5961Warn about functions that might be candidates for @code{cold} attribute.  This
5962is based on static detection and generally will only warn about functions which
5963always leads to a call to another @code{cold} function such as wrappers of
5964C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5965@end table
5966
5967@item -Wsuggest-final-types
5968@opindex Wno-suggest-final-types
5969@opindex Wsuggest-final-types
5970Warn about types with virtual methods where code quality would be improved
5971if the type were declared with the C++11 @code{final} specifier,
5972or, if possible,
5973declared in an anonymous namespace. This allows GCC to more aggressively
5974devirtualize the polymorphic calls. This warning is more effective with link
5975time optimization, where the information about the class hierarchy graph is
5976more complete.
5977
5978@item -Wsuggest-final-methods
5979@opindex Wno-suggest-final-methods
5980@opindex Wsuggest-final-methods
5981Warn about virtual methods where code quality would be improved if the method
5982were declared with the C++11 @code{final} specifier,
5983or, if possible, its type were
5984declared in an anonymous namespace or with the @code{final} specifier.
5985This warning is
5986more effective with link-time optimization, where the information about the
5987class hierarchy graph is more complete. It is recommended to first consider
5988suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5989annotations.
5990
5991@item -Wsuggest-override
5992Warn about overriding virtual functions that are not marked with the override
5993keyword.
5994
5995@item -Walloc-zero
5996@opindex Wno-alloc-zero
5997@opindex Walloc-zero
5998Warn about calls to allocation functions decorated with attribute
5999@code{alloc_size} that specify zero bytes, including those to the built-in
6000forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6001@code{malloc}, and @code{realloc}.  Because the behavior of these functions
6002when called with a zero size differs among implementations (and in the case
6003of @code{realloc} has been deprecated) relying on it may result in subtle
6004portability bugs and should be avoided.
6005
6006@item -Walloc-size-larger-than=@var{byte-size}
6007@opindex Walloc-size-larger-than=
6008@opindex Wno-alloc-size-larger-than
6009Warn about calls to functions decorated with attribute @code{alloc_size}
6010that attempt to allocate objects larger than the specified number of bytes,
6011or where the result of the size computation in an integer type with infinite
6012precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6013@option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6014Warnings controlled by the option can be disabled either by specifying
6015@var{byte-size} of @samp{SIZE_MAX} or more or by
6016@option{-Wno-alloc-size-larger-than}.
6017@xref{Function Attributes}.
6018
6019@item -Wno-alloc-size-larger-than
6020@opindex Wno-alloc-size-larger-than
6021Disable @option{-Walloc-size-larger-than=} warnings.  The option is
6022equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6023larger.
6024
6025@item -Walloca
6026@opindex Wno-alloca
6027@opindex Walloca
6028This option warns on all uses of @code{alloca} in the source.
6029
6030@item -Walloca-larger-than=@var{byte-size}
6031@opindex Walloca-larger-than=
6032@opindex Wno-alloca-larger-than
6033This option warns on calls to @code{alloca} with an integer argument whose
6034value is either zero, or that is not bounded by a controlling predicate
6035that limits its value to at most @var{byte-size}.  It also warns for calls
6036to @code{alloca} where the bound value is unknown.  Arguments of non-integer
6037types are considered unbounded even if they appear to be constrained to
6038the expected range.
6039
6040For example, a bounded case of @code{alloca} could be:
6041
6042@smallexample
6043void func (size_t n)
6044@{
6045  void *p;
6046  if (n <= 1000)
6047    p = alloca (n);
6048  else
6049    p = malloc (n);
6050  f (p);
6051@}
6052@end smallexample
6053
6054In the above example, passing @code{-Walloca-larger-than=1000} would not
6055issue a warning because the call to @code{alloca} is known to be at most
60561000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
6057the compiler would emit a warning.
6058
6059Unbounded uses, on the other hand, are uses of @code{alloca} with no
6060controlling predicate constraining its integer argument.  For example:
6061
6062@smallexample
6063void func ()
6064@{
6065  void *p = alloca (n);
6066  f (p);
6067@}
6068@end smallexample
6069
6070If @code{-Walloca-larger-than=500} were passed, the above would trigger
6071a warning, but this time because of the lack of bounds checking.
6072
6073Note, that even seemingly correct code involving signed integers could
6074cause a warning:
6075
6076@smallexample
6077void func (signed int n)
6078@{
6079  if (n < 500)
6080    @{
6081      p = alloca (n);
6082      f (p);
6083    @}
6084@}
6085@end smallexample
6086
6087In the above example, @var{n} could be negative, causing a larger than
6088expected argument to be implicitly cast into the @code{alloca} call.
6089
6090This option also warns when @code{alloca} is used in a loop.
6091
6092@option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6093but is usually only effective  when @option{-ftree-vrp} is active (default
6094for @option{-O2} and above).
6095
6096See also @option{-Wvla-larger-than=}@samp{byte-size}.
6097
6098@item -Wno-alloca-larger-than
6099@opindex Wno-alloca-larger-than
6100Disable @option{-Walloca-larger-than=} warnings.  The option is
6101equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6102
6103@item -Warray-bounds
6104@itemx -Warray-bounds=@var{n}
6105@opindex Wno-array-bounds
6106@opindex Warray-bounds
6107This option is only active when @option{-ftree-vrp} is active
6108(default for @option{-O2} and above). It warns about subscripts to arrays
6109that are always out of bounds. This warning is enabled by @option{-Wall}.
6110
6111@table @gcctabopt
6112@item -Warray-bounds=1
6113This is the warning level of @option{-Warray-bounds} and is enabled
6114by @option{-Wall}; higher levels are not, and must be explicitly requested.
6115
6116@item -Warray-bounds=2
6117This warning level also warns about out of bounds access for
6118arrays at the end of a struct and for arrays accessed through
6119pointers. This warning level may give a larger number of
6120false positives and is deactivated by default.
6121@end table
6122
6123@item -Wattribute-alias=@var{n}
6124@itemx -Wno-attribute-alias
6125@opindex -Wattribute-alias
6126@opindex -Wno-attribute-alias
6127Warn about declarations using the @code{alias} and similar attributes whose
6128target is incompatible with the type of the alias.
6129@xref{Function Attributes,,Declaring Attributes of Functions}.
6130
6131@table @gcctabopt
6132@item -Wattribute-alias=1
6133The default warning level of the @option{-Wattribute-alias} option diagnoses
6134incompatibilities between the type of the alias declaration and that of its
6135target.  Such incompatibilities are typically indicative of bugs.
6136
6137@item -Wattribute-alias=2
6138
6139At this level @option{-Wattribute-alias} also diagnoses cases where
6140the attributes of the alias declaration are more restrictive than the
6141attributes applied to its target.  These mismatches can potentially
6142result in incorrect code generation.  In other cases they may be
6143benign and could be resolved simply by adding the missing attribute to
6144the target.  For comparison, see the @option{-Wmissing-attributes}
6145option, which controls diagnostics when the alias declaration is less
6146restrictive than the target, rather than more restrictive.
6147
6148Attributes considered include @code{alloc_align}, @code{alloc_size},
6149@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6150@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6151@code{returns_nonnull}, and @code{returns_twice}.
6152@end table
6153
6154@option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6155This is the default.  You can disable these warnings with either
6156@option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6157
6158@item -Wbool-compare
6159@opindex Wno-bool-compare
6160@opindex Wbool-compare
6161Warn about boolean expression compared with an integer value different from
6162@code{true}/@code{false}.  For instance, the following comparison is
6163always false:
6164@smallexample
6165int n = 5;
6166@dots{}
6167if ((n > 1) == 2) @{ @dots{} @}
6168@end smallexample
6169This warning is enabled by @option{-Wall}.
6170
6171@item -Wbool-operation
6172@opindex Wno-bool-operation
6173@opindex Wbool-operation
6174Warn about suspicious operations on expressions of a boolean type.  For
6175instance, bitwise negation of a boolean is very likely a bug in the program.
6176For C, this warning also warns about incrementing or decrementing a boolean,
6177which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
6178Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6179
6180This warning is enabled by @option{-Wall}.
6181
6182@item -Wduplicated-branches
6183@opindex Wno-duplicated-branches
6184@opindex Wduplicated-branches
6185Warn when an if-else has identical branches.  This warning detects cases like
6186@smallexample
6187if (p != NULL)
6188  return 0;
6189else
6190  return 0;
6191@end smallexample
6192It doesn't warn when both branches contain just a null statement.  This warning
6193also warn for conditional operators:
6194@smallexample
6195  int i = x ? *p : *p;
6196@end smallexample
6197
6198@item -Wduplicated-cond
6199@opindex Wno-duplicated-cond
6200@opindex Wduplicated-cond
6201Warn about duplicated conditions in an if-else-if chain.  For instance,
6202warn for the following code:
6203@smallexample
6204if (p->q != NULL) @{ @dots{} @}
6205else if (p->q != NULL) @{ @dots{} @}
6206@end smallexample
6207
6208@item -Wframe-address
6209@opindex Wno-frame-address
6210@opindex Wframe-address
6211Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6212is called with an argument greater than 0.  Such calls may return indeterminate
6213values or crash the program.  The warning is included in @option{-Wall}.
6214
6215@item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6216@opindex Wno-discarded-qualifiers
6217@opindex Wdiscarded-qualifiers
6218Do not warn if type qualifiers on pointers are being discarded.
6219Typically, the compiler warns if a @code{const char *} variable is
6220passed to a function that takes a @code{char *} parameter.  This option
6221can be used to suppress such a warning.
6222
6223@item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6224@opindex Wno-discarded-array-qualifiers
6225@opindex Wdiscarded-array-qualifiers
6226Do not warn if type qualifiers on arrays which are pointer targets
6227are being discarded. Typically, the compiler warns if a
6228@code{const int (*)[]} variable is passed to a function that
6229takes a @code{int (*)[]} parameter.  This option can be used to
6230suppress such a warning.
6231
6232@item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6233@opindex Wno-incompatible-pointer-types
6234@opindex Wincompatible-pointer-types
6235Do not warn when there is a conversion between pointers that have incompatible
6236types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
6237which warns for pointer argument passing or assignment with different
6238signedness.
6239
6240@item -Wno-int-conversion @r{(C and Objective-C only)}
6241@opindex Wno-int-conversion
6242@opindex Wint-conversion
6243Do not warn about incompatible integer to pointer and pointer to integer
6244conversions.  This warning is about implicit conversions; for explicit
6245conversions the warnings @option{-Wno-int-to-pointer-cast} and
6246@option{-Wno-pointer-to-int-cast} may be used.
6247
6248@item -Wno-div-by-zero
6249@opindex Wno-div-by-zero
6250@opindex Wdiv-by-zero
6251Do not warn about compile-time integer division by zero.  Floating-point
6252division by zero is not warned about, as it can be a legitimate way of
6253obtaining infinities and NaNs.
6254
6255@item -Wsystem-headers
6256@opindex Wsystem-headers
6257@opindex Wno-system-headers
6258@cindex warnings from system headers
6259@cindex system headers, warnings from
6260Print warning messages for constructs found in system header files.
6261Warnings from system headers are normally suppressed, on the assumption
6262that they usually do not indicate real problems and would only make the
6263compiler output harder to read.  Using this command-line option tells
6264GCC to emit warnings from system headers as if they occurred in user
6265code.  However, note that using @option{-Wall} in conjunction with this
6266option does @emph{not} warn about unknown pragmas in system
6267headers---for that, @option{-Wunknown-pragmas} must also be used.
6268
6269@item -Wtautological-compare
6270@opindex Wtautological-compare
6271@opindex Wno-tautological-compare
6272Warn if a self-comparison always evaluates to true or false.  This
6273warning detects various mistakes such as:
6274@smallexample
6275int i = 1;
6276@dots{}
6277if (i > i) @{ @dots{} @}
6278@end smallexample
6279
6280This warning also warns about bitwise comparisons that always evaluate
6281to true or false, for instance:
6282@smallexample
6283if ((a & 16) == 10) @{ @dots{} @}
6284@end smallexample
6285will always be false.
6286
6287This warning is enabled by @option{-Wall}.
6288
6289@item -Wtrampolines
6290@opindex Wtrampolines
6291@opindex Wno-trampolines
6292Warn about trampolines generated for pointers to nested functions.
6293A trampoline is a small piece of data or code that is created at run
6294time on the stack when the address of a nested function is taken, and is
6295used to call the nested function indirectly.  For some targets, it is
6296made up of data only and thus requires no special treatment.  But, for
6297most targets, it is made up of code and thus requires the stack to be
6298made executable in order for the program to work properly.
6299
6300@item -Wfloat-equal
6301@opindex Wfloat-equal
6302@opindex Wno-float-equal
6303Warn if floating-point values are used in equality comparisons.
6304
6305The idea behind this is that sometimes it is convenient (for the
6306programmer) to consider floating-point values as approximations to
6307infinitely precise real numbers.  If you are doing this, then you need
6308to compute (by analyzing the code, or in some other way) the maximum or
6309likely maximum error that the computation introduces, and allow for it
6310when performing comparisons (and when producing output, but that's a
6311different problem).  In particular, instead of testing for equality, you
6312should check to see whether the two values have ranges that overlap; and
6313this is done with the relational operators, so equality comparisons are
6314probably mistaken.
6315
6316@item -Wtraditional @r{(C and Objective-C only)}
6317@opindex Wtraditional
6318@opindex Wno-traditional
6319Warn about certain constructs that behave differently in traditional and
6320ISO C@.  Also warn about ISO C constructs that have no traditional C
6321equivalent, and/or problematic constructs that should be avoided.
6322
6323@itemize @bullet
6324@item
6325Macro parameters that appear within string literals in the macro body.
6326In traditional C macro replacement takes place within string literals,
6327but in ISO C it does not.
6328
6329@item
6330In traditional C, some preprocessor directives did not exist.
6331Traditional preprocessors only considered a line to be a directive
6332if the @samp{#} appeared in column 1 on the line.  Therefore
6333@option{-Wtraditional} warns about directives that traditional C
6334understands but ignores because the @samp{#} does not appear as the
6335first character on the line.  It also suggests you hide directives like
6336@code{#pragma} not understood by traditional C by indenting them.  Some
6337traditional implementations do not recognize @code{#elif}, so this option
6338suggests avoiding it altogether.
6339
6340@item
6341A function-like macro that appears without arguments.
6342
6343@item
6344The unary plus operator.
6345
6346@item
6347The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6348constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
6349constants.)  Note, these suffixes appear in macros defined in the system
6350headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6351Use of these macros in user code might normally lead to spurious
6352warnings, however GCC's integrated preprocessor has enough context to
6353avoid warning in these cases.
6354
6355@item
6356A function declared external in one block and then used after the end of
6357the block.
6358
6359@item
6360A @code{switch} statement has an operand of type @code{long}.
6361
6362@item
6363A non-@code{static} function declaration follows a @code{static} one.
6364This construct is not accepted by some traditional C compilers.
6365
6366@item
6367The ISO type of an integer constant has a different width or
6368signedness from its traditional type.  This warning is only issued if
6369the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
6370typically represent bit patterns, are not warned about.
6371
6372@item
6373Usage of ISO string concatenation is detected.
6374
6375@item
6376Initialization of automatic aggregates.
6377
6378@item
6379Identifier conflicts with labels.  Traditional C lacks a separate
6380namespace for labels.
6381
6382@item
6383Initialization of unions.  If the initializer is zero, the warning is
6384omitted.  This is done under the assumption that the zero initializer in
6385user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6386initializer warnings and relies on default initialization to zero in the
6387traditional C case.
6388
6389@item
6390Conversions by prototypes between fixed/floating-point values and vice
6391versa.  The absence of these prototypes when compiling with traditional
6392C causes serious problems.  This is a subset of the possible
6393conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6394
6395@item
6396Use of ISO C style function definitions.  This warning intentionally is
6397@emph{not} issued for prototype declarations or variadic functions
6398because these ISO C features appear in your code when using
6399libiberty's traditional C compatibility macros, @code{PARAMS} and
6400@code{VPARAMS}.  This warning is also bypassed for nested functions
6401because that feature is already a GCC extension and thus not relevant to
6402traditional C compatibility.
6403@end itemize
6404
6405@item -Wtraditional-conversion @r{(C and Objective-C only)}
6406@opindex Wtraditional-conversion
6407@opindex Wno-traditional-conversion
6408Warn if a prototype causes a type conversion that is different from what
6409would happen to the same argument in the absence of a prototype.  This
6410includes conversions of fixed point to floating and vice versa, and
6411conversions changing the width or signedness of a fixed-point argument
6412except when the same as the default promotion.
6413
6414@item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6415@opindex Wdeclaration-after-statement
6416@opindex Wno-declaration-after-statement
6417Warn when a declaration is found after a statement in a block.  This
6418construct, known from C++, was introduced with ISO C99 and is by default
6419allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Declarations}.
6420
6421@item -Wshadow
6422@opindex Wshadow
6423@opindex Wno-shadow
6424Warn whenever a local variable or type declaration shadows another
6425variable, parameter, type, class member (in C++), or instance variable
6426(in Objective-C) or whenever a built-in function is shadowed. Note
6427that in C++, the compiler warns if a local variable shadows an
6428explicit typedef, but not if it shadows a struct/class/enum.
6429Same as @option{-Wshadow=global}.
6430
6431@item -Wno-shadow-ivar @r{(Objective-C only)}
6432@opindex Wno-shadow-ivar
6433@opindex Wshadow-ivar
6434Do not warn whenever a local variable shadows an instance variable in an
6435Objective-C method.
6436
6437@item -Wshadow=global
6438@opindex Wshadow=local
6439The default for @option{-Wshadow}. Warns for any (global) shadowing.
6440
6441@item -Wshadow=local
6442@opindex Wshadow=local
6443Warn when a local variable shadows another local variable or parameter.
6444This warning is enabled by @option{-Wshadow=global}.
6445
6446@item -Wshadow=compatible-local
6447@opindex Wshadow=compatible-local
6448Warn when a local variable shadows another local variable or parameter
6449whose type is compatible with that of the shadowing variable. In C++,
6450type compatibility here means the type of the shadowing variable can be
6451converted to that of the shadowed variable. The creation of this flag
6452(in addition to @option{-Wshadow=local}) is based on the idea that when
6453a local variable shadows another one of incompatible type, it is most
6454likely intentional, not a bug or typo, as shown in the following example:
6455
6456@smallexample
6457@group
6458for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6459@{
6460  for (int i = 0; i < N; ++i)
6461  @{
6462    ...
6463  @}
6464  ...
6465@}
6466@end group
6467@end smallexample
6468
6469Since the two variable @code{i} in the example above have incompatible types,
6470enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6471Because their types are incompatible, if a programmer accidentally uses one
6472in place of the other, type checking will catch that and emit an error or
6473warning. So not warning (about shadowing) in this case will not lead to
6474undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6475possibly reduce the number of warnings triggered by intentional shadowing.
6476
6477This warning is enabled by @option{-Wshadow=local}.
6478
6479@item -Wlarger-than=@var{byte-size}
6480@opindex Wlarger-than=
6481@opindex Wlarger-than-@var{byte-size}
6482Warn whenever an object is defined whose size exceeds @var{byte-size}.
6483@option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6484Warnings controlled by the option can be disabled either by specifying
6485@var{byte-size} of @samp{SIZE_MAX} or more or by
6486@option{-Wno-larger-than}.
6487
6488@item -Wno-larger-than
6489@opindex Wno-larger-than
6490Disable @option{-Wlarger-than=} warnings.  The option is equivalent
6491to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6492
6493@item -Wframe-larger-than=@var{byte-size}
6494@opindex Wframe-larger-than=
6495@opindex Wno-frame-larger-than
6496Warn if the size of a function frame exceeds @var{byte-size}.
6497The computation done to determine the stack frame size is approximate
6498and not conservative.
6499The actual requirements may be somewhat greater than @var{byte-size}
6500even if you do not get a warning.  In addition, any space allocated
6501via @code{alloca}, variable-length arrays, or related constructs
6502is not included by the compiler when determining
6503whether or not to issue a warning.
6504@option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6505Warnings controlled by the option can be disabled either by specifying
6506@var{byte-size} of @samp{SIZE_MAX} or more or by
6507@option{-Wno-frame-larger-than}.
6508
6509@item -Wno-frame-larger-than
6510@opindex Wno-frame-larger-than
6511Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
6512to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6513
6514@item -Wno-free-nonheap-object
6515@opindex Wno-free-nonheap-object
6516@opindex Wfree-nonheap-object
6517Do not warn when attempting to free an object that was not allocated
6518on the heap.
6519
6520@item -Wstack-usage=@var{byte-size}
6521@opindex Wstack-usage
6522@opindex Wno-stack-usage
6523Warn if the stack usage of a function might exceed @var{byte-size}.
6524The computation done to determine the stack usage is conservative.
6525Any space allocated via @code{alloca}, variable-length arrays, or related
6526constructs is included by the compiler when determining whether or not to
6527issue a warning.
6528
6529The message is in keeping with the output of @option{-fstack-usage}.
6530
6531@itemize
6532@item
6533If the stack usage is fully static but exceeds the specified amount, it's:
6534
6535@smallexample
6536  warning: stack usage is 1120 bytes
6537@end smallexample
6538@item
6539If the stack usage is (partly) dynamic but bounded, it's:
6540
6541@smallexample
6542  warning: stack usage might be 1648 bytes
6543@end smallexample
6544@item
6545If the stack usage is (partly) dynamic and not bounded, it's:
6546
6547@smallexample
6548  warning: stack usage might be unbounded
6549@end smallexample
6550@end itemize
6551
6552@option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6553Warnings controlled by the option can be disabled either by specifying
6554@var{byte-size} of @samp{SIZE_MAX} or more or by
6555@option{-Wno-stack-usage}.
6556
6557@item -Wno-stack-usage
6558@opindex Wno-stack-usage
6559Disable @option{-Wstack-usage=} warnings.  The option is equivalent
6560to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6561
6562@item -Wunsafe-loop-optimizations
6563@opindex Wunsafe-loop-optimizations
6564@opindex Wno-unsafe-loop-optimizations
6565Warn if the loop cannot be optimized because the compiler cannot
6566assume anything on the bounds of the loop indices.  With
6567@option{-funsafe-loop-optimizations} warn if the compiler makes
6568such assumptions.
6569
6570@item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6571@opindex Wno-pedantic-ms-format
6572@opindex Wpedantic-ms-format
6573When used in combination with @option{-Wformat}
6574and @option{-pedantic} without GNU extensions, this option
6575disables the warnings about non-ISO @code{printf} / @code{scanf} format
6576width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6577which depend on the MS runtime.
6578
6579@item -Waligned-new
6580@opindex Waligned-new
6581@opindex Wno-aligned-new
6582Warn about a new-expression of a type that requires greater alignment
6583than the @code{alignof(std::max_align_t)} but uses an allocation
6584function without an explicit alignment parameter. This option is
6585enabled by @option{-Wall}.
6586
6587Normally this only warns about global allocation functions, but
6588@option{-Waligned-new=all} also warns about class member allocation
6589functions.
6590
6591@item -Wplacement-new
6592@itemx -Wplacement-new=@var{n}
6593@opindex Wplacement-new
6594@opindex Wno-placement-new
6595Warn about placement new expressions with undefined behavior, such as
6596constructing an object in a buffer that is smaller than the type of
6597the object.  For example, the placement new expression below is diagnosed
6598because it attempts to construct an array of 64 integers in a buffer only
659964 bytes large.
6600@smallexample
6601char buf [64];
6602new (buf) int[64];
6603@end smallexample
6604This warning is enabled by default.
6605
6606@table @gcctabopt
6607@item -Wplacement-new=1
6608This is the default warning level of @option{-Wplacement-new}.  At this
6609level the warning is not issued for some strictly undefined constructs that
6610GCC allows as extensions for compatibility with legacy code.  For example,
6611the following @code{new} expression is not diagnosed at this level even
6612though it has undefined behavior according to the C++ standard because
6613it writes past the end of the one-element array.
6614@smallexample
6615struct S @{ int n, a[1]; @};
6616S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6617new (s->a)int [32]();
6618@end smallexample
6619
6620@item -Wplacement-new=2
6621At this level, in addition to diagnosing all the same constructs as at level
66221, a diagnostic is also issued for placement new expressions that construct
6623an object in the last member of structure whose type is an array of a single
6624element and whose size is less than the size of the object being constructed.
6625While the previous example would be diagnosed, the following construct makes
6626use of the flexible member array extension to avoid the warning at level 2.
6627@smallexample
6628struct S @{ int n, a[]; @};
6629S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6630new (s->a)int [32]();
6631@end smallexample
6632
6633@end table
6634
6635@item -Wpointer-arith
6636@opindex Wpointer-arith
6637@opindex Wno-pointer-arith
6638Warn about anything that depends on the ``size of'' a function type or
6639of @code{void}.  GNU C assigns these types a size of 1, for
6640convenience in calculations with @code{void *} pointers and pointers
6641to functions.  In C++, warn also when an arithmetic operation involves
6642@code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
6643
6644@item -Wpointer-compare
6645@opindex Wpointer-compare
6646@opindex Wno-pointer-compare
6647Warn if a pointer is compared with a zero character constant.  This usually
6648means that the pointer was meant to be dereferenced.  For example:
6649
6650@smallexample
6651const char *p = foo ();
6652if (p == '\0')
6653  return 42;
6654@end smallexample
6655
6656Note that the code above is invalid in C++11.
6657
6658This warning is enabled by default.
6659
6660@item -Wtype-limits
6661@opindex Wtype-limits
6662@opindex Wno-type-limits
6663Warn if a comparison is always true or always false due to the limited
6664range of the data type, but do not warn for constant expressions.  For
6665example, warn if an unsigned variable is compared against zero with
6666@code{<} or @code{>=}.  This warning is also enabled by
6667@option{-Wextra}.
6668
6669@item -Wabsolute-value @r{(C and Objective-C only)}
6670@opindex Wabsolute-value
6671@opindex Wno-absolute-value
6672Warn for calls to standard functions that compute the absolute value
6673of an argument when a more appropriate standard function is available.
6674For example, calling @code{abs(3.14)} triggers the warning because the
6675appropriate function to call to compute the absolute value of a double
6676argument is @code{fabs}.  The option also triggers warnings when the
6677argument in a call to such a function has an unsigned type.  This
6678warning can be suppressed with an explicit type cast and it is also
6679enabled by @option{-Wextra}.
6680
6681@include cppwarnopts.texi
6682
6683@item -Wbad-function-cast @r{(C and Objective-C only)}
6684@opindex Wbad-function-cast
6685@opindex Wno-bad-function-cast
6686Warn when a function call is cast to a non-matching type.
6687For example, warn if a call to a function returning an integer type
6688is cast to a pointer type.
6689
6690@item -Wc90-c99-compat @r{(C and Objective-C only)}
6691@opindex Wc90-c99-compat
6692@opindex Wno-c90-c99-compat
6693Warn about features not present in ISO C90, but present in ISO C99.
6694For instance, warn about use of variable length arrays, @code{long long}
6695type, @code{bool} type, compound literals, designated initializers, and so
6696on.  This option is independent of the standards mode.  Warnings are disabled
6697in the expression that follows @code{__extension__}.
6698
6699@item -Wc99-c11-compat @r{(C and Objective-C only)}
6700@opindex Wc99-c11-compat
6701@opindex Wno-c99-c11-compat
6702Warn about features not present in ISO C99, but present in ISO C11.
6703For instance, warn about use of anonymous structures and unions,
6704@code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6705@code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6706and so on.  This option is independent of the standards mode.  Warnings are
6707disabled in the expression that follows @code{__extension__}.
6708
6709@item -Wc11-c2x-compat @r{(C and Objective-C only)}
6710@opindex Wc11-c2x-compat
6711@opindex Wno-c11-c2x-compat
6712Warn about features not present in ISO C11, but present in ISO C2X.
6713For instance, warn about omitting the string in @code{_Static_assert}.
6714This option is independent of the standards mode.  Warnings are
6715disabled in the expression that follows @code{__extension__}.
6716
6717@item -Wc++-compat @r{(C and Objective-C only)}
6718@opindex Wc++-compat
6719@opindex Wno-c++-compat
6720Warn about ISO C constructs that are outside of the common subset of
6721ISO C and ISO C++, e.g.@: request for implicit conversion from
6722@code{void *} to a pointer to non-@code{void} type.
6723
6724@item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6725@opindex Wc++11-compat
6726@opindex Wno-c++11-compat
6727Warn about C++ constructs whose meaning differs between ISO C++ 1998
6728and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6729in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
6730enabled by @option{-Wall}.
6731
6732@item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6733@opindex Wc++14-compat
6734@opindex Wno-c++14-compat
6735Warn about C++ constructs whose meaning differs between ISO C++ 2011
6736and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
6737
6738@item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6739@opindex Wc++17-compat
6740@opindex Wno-c++17-compat
6741Warn about C++ constructs whose meaning differs between ISO C++ 2014
6742and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
6743
6744@item -Wcast-qual
6745@opindex Wcast-qual
6746@opindex Wno-cast-qual
6747Warn whenever a pointer is cast so as to remove a type qualifier from
6748the target type.  For example, warn if a @code{const char *} is cast
6749to an ordinary @code{char *}.
6750
6751Also warn when making a cast that introduces a type qualifier in an
6752unsafe way.  For example, casting @code{char **} to @code{const char **}
6753is unsafe, as in this example:
6754
6755@smallexample
6756  /* p is char ** value.  */
6757  const char **q = (const char **) p;
6758  /* Assignment of readonly string to const char * is OK.  */
6759  *q = "string";
6760  /* Now char** pointer points to read-only memory.  */
6761  **p = 'b';
6762@end smallexample
6763
6764@item -Wcast-align
6765@opindex Wcast-align
6766@opindex Wno-cast-align
6767Warn whenever a pointer is cast such that the required alignment of the
6768target is increased.  For example, warn if a @code{char *} is cast to
6769an @code{int *} on machines where integers can only be accessed at
6770two- or four-byte boundaries.
6771
6772@item -Wcast-align=strict
6773@opindex Wcast-align=strict
6774Warn whenever a pointer is cast such that the required alignment of the
6775target is increased.  For example, warn if a @code{char *} is cast to
6776an @code{int *} regardless of the target machine.
6777
6778@item -Wcast-function-type
6779@opindex Wcast-function-type
6780@opindex Wno-cast-function-type
6781Warn when a function pointer is cast to an incompatible function pointer.
6782In a cast involving function types with a variable argument list only
6783the types of initial arguments that are provided are considered.
6784Any parameter of pointer-type matches any other pointer-type.  Any benign
6785differences in integral types are ignored, like @code{int} vs.@: @code{long}
6786on ILP32 targets.  Likewise type qualifiers are ignored.  The function
6787type @code{void (*) (void)} is special and matches everything, which can
6788be used to suppress this warning.
6789In a cast involving pointer to member types this warning warns whenever
6790the type cast is changing the pointer to member type.
6791This warning is enabled by @option{-Wextra}.
6792
6793@item -Wwrite-strings
6794@opindex Wwrite-strings
6795@opindex Wno-write-strings
6796When compiling C, give string constants the type @code{const
6797char[@var{length}]} so that copying the address of one into a
6798non-@code{const} @code{char *} pointer produces a warning.  These
6799warnings help you find at compile time code that can try to write
6800into a string constant, but only if you have been very careful about
6801using @code{const} in declarations and prototypes.  Otherwise, it is
6802just a nuisance. This is why we did not make @option{-Wall} request
6803these warnings.
6804
6805When compiling C++, warn about the deprecated conversion from string
6806literals to @code{char *}.  This warning is enabled by default for C++
6807programs.
6808
6809@item -Wcatch-value
6810@itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6811@opindex Wcatch-value
6812@opindex Wno-catch-value
6813Warn about catch handlers that do not catch via reference.
6814With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6815warn about polymorphic class types that are caught by value.
6816With @option{-Wcatch-value=2} warn about all class types that are caught
6817by value. With @option{-Wcatch-value=3} warn about all types that are
6818not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6819
6820@item -Wclobbered
6821@opindex Wclobbered
6822@opindex Wno-clobbered
6823Warn for variables that might be changed by @code{longjmp} or
6824@code{vfork}.  This warning is also enabled by @option{-Wextra}.
6825
6826@item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6827@opindex Wconditionally-supported
6828@opindex Wno-conditionally-supported
6829Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6830
6831@item -Wconversion
6832@opindex Wconversion
6833@opindex Wno-conversion
6834Warn for implicit conversions that may alter a value. This includes
6835conversions between real and integer, like @code{abs (x)} when
6836@code{x} is @code{double}; conversions between signed and unsigned,
6837like @code{unsigned ui = -1}; and conversions to smaller types, like
6838@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6839((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6840changed by the conversion like in @code{abs (2.0)}.  Warnings about
6841conversions between signed and unsigned integers can be disabled by
6842using @option{-Wno-sign-conversion}.
6843
6844For C++, also warn for confusing overload resolution for user-defined
6845conversions; and conversions that never use a type conversion
6846operator: conversions to @code{void}, the same type, a base class or a
6847reference to them. Warnings about conversions between signed and
6848unsigned integers are disabled by default in C++ unless
6849@option{-Wsign-conversion} is explicitly enabled.
6850
6851@item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6852@opindex Wconversion-null
6853@opindex Wno-conversion-null
6854Do not warn for conversions between @code{NULL} and non-pointer
6855types. @option{-Wconversion-null} is enabled by default.
6856
6857@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6858@opindex Wzero-as-null-pointer-constant
6859@opindex Wno-zero-as-null-pointer-constant
6860Warn when a literal @samp{0} is used as null pointer constant.  This can
6861be useful to facilitate the conversion to @code{nullptr} in C++11.
6862
6863@item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6864@opindex Wsubobject-linkage
6865@opindex Wno-subobject-linkage
6866Warn if a class type has a base or a field whose type uses the anonymous
6867namespace or depends on a type with no linkage.  If a type A depends on
6868a type B with no or internal linkage, defining it in multiple
6869translation units would be an ODR violation because the meaning of B
6870is different in each translation unit.  If A only appears in a single
6871translation unit, the best way to silence the warning is to give it
6872internal linkage by putting it in an anonymous namespace as well.  The
6873compiler doesn't give this warning for types defined in the main .C
6874file, as those are unlikely to have multiple definitions.
6875@option{-Wsubobject-linkage} is enabled by default.
6876
6877@item -Wdangling-else
6878@opindex Wdangling-else
6879@opindex Wno-dangling-else
6880Warn about constructions where there may be confusion to which
6881@code{if} statement an @code{else} branch belongs.  Here is an example of
6882such a case:
6883
6884@smallexample
6885@group
6886@{
6887  if (a)
6888    if (b)
6889      foo ();
6890  else
6891    bar ();
6892@}
6893@end group
6894@end smallexample
6895
6896In C/C++, every @code{else} branch belongs to the innermost possible
6897@code{if} statement, which in this example is @code{if (b)}.  This is
6898often not what the programmer expected, as illustrated in the above
6899example by indentation the programmer chose.  When there is the
6900potential for this confusion, GCC issues a warning when this flag
6901is specified.  To eliminate the warning, add explicit braces around
6902the innermost @code{if} statement so there is no way the @code{else}
6903can belong to the enclosing @code{if}.  The resulting code
6904looks like this:
6905
6906@smallexample
6907@group
6908@{
6909  if (a)
6910    @{
6911      if (b)
6912        foo ();
6913      else
6914        bar ();
6915    @}
6916@}
6917@end group
6918@end smallexample
6919
6920This warning is enabled by @option{-Wparentheses}.
6921
6922@item -Wdate-time
6923@opindex Wdate-time
6924@opindex Wno-date-time
6925Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6926are encountered as they might prevent bit-wise-identical reproducible
6927compilations.
6928
6929@item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6930@opindex Wdelete-incomplete
6931@opindex Wno-delete-incomplete
6932Warn when deleting a pointer to incomplete type, which may cause
6933undefined behavior at runtime.  This warning is enabled by default.
6934
6935@item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6936@opindex Wuseless-cast
6937@opindex Wno-useless-cast
6938Warn when an expression is casted to its own type.
6939
6940@item -Wempty-body
6941@opindex Wempty-body
6942@opindex Wno-empty-body
6943Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6944while} statement.  This warning is also enabled by @option{-Wextra}.
6945
6946@item -Wenum-compare
6947@opindex Wenum-compare
6948@opindex Wno-enum-compare
6949Warn about a comparison between values of different enumerated types.
6950In C++ enumerated type mismatches in conditional expressions are also
6951diagnosed and the warning is enabled by default.  In C this warning is
6952enabled by @option{-Wall}.
6953
6954@item -Wextra-semi @r{(C++, Objective-C++ only)}
6955@opindex Wextra-semi
6956@opindex Wno-extra-semi
6957Warn about redundant semicolon after in-class function definition.
6958
6959@item -Wjump-misses-init @r{(C, Objective-C only)}
6960@opindex Wjump-misses-init
6961@opindex Wno-jump-misses-init
6962Warn if a @code{goto} statement or a @code{switch} statement jumps
6963forward across the initialization of a variable, or jumps backward to a
6964label after the variable has been initialized.  This only warns about
6965variables that are initialized when they are declared.  This warning is
6966only supported for C and Objective-C; in C++ this sort of branch is an
6967error in any case.
6968
6969@option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
6970can be disabled with the @option{-Wno-jump-misses-init} option.
6971
6972@item -Wsign-compare
6973@opindex Wsign-compare
6974@opindex Wno-sign-compare
6975@cindex warning for comparison of signed and unsigned values
6976@cindex comparison of signed and unsigned values, warning
6977@cindex signed and unsigned values, comparison warning
6978Warn when a comparison between signed and unsigned values could produce
6979an incorrect result when the signed value is converted to unsigned.
6980In C++, this warning is also enabled by @option{-Wall}.  In C, it is
6981also enabled by @option{-Wextra}.
6982
6983@item -Wsign-conversion
6984@opindex Wsign-conversion
6985@opindex Wno-sign-conversion
6986Warn for implicit conversions that may change the sign of an integer
6987value, like assigning a signed integer expression to an unsigned
6988integer variable. An explicit cast silences the warning. In C, this
6989option is enabled also by @option{-Wconversion}.
6990
6991@item -Wfloat-conversion
6992@opindex Wfloat-conversion
6993@opindex Wno-float-conversion
6994Warn for implicit conversions that reduce the precision of a real value.
6995This includes conversions from real to integer, and from higher precision
6996real to lower precision real values.  This option is also enabled by
6997@option{-Wconversion}.
6998
6999@item -Wno-scalar-storage-order
7000@opindex Wno-scalar-storage-order
7001@opindex Wscalar-storage-order
7002Do not warn on suspicious constructs involving reverse scalar storage order.
7003
7004@item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7005@opindex Wsized-deallocation
7006@opindex Wno-sized-deallocation
7007Warn about a definition of an unsized deallocation function
7008@smallexample
7009void operator delete (void *) noexcept;
7010void operator delete[] (void *) noexcept;
7011@end smallexample
7012without a definition of the corresponding sized deallocation function
7013@smallexample
7014void operator delete (void *, std::size_t) noexcept;
7015void operator delete[] (void *, std::size_t) noexcept;
7016@end smallexample
7017or vice versa.  Enabled by @option{-Wextra} along with
7018@option{-fsized-deallocation}.
7019
7020@item -Wsizeof-pointer-div
7021@opindex Wsizeof-pointer-div
7022@opindex Wno-sizeof-pointer-div
7023Warn for suspicious divisions of two sizeof expressions that divide
7024the pointer size by the element size, which is the usual way to compute
7025the array size but won't work out correctly with pointers.  This warning
7026warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7027not an array, but a pointer.  This warning is enabled by @option{-Wall}.
7028
7029@item -Wsizeof-pointer-memaccess
7030@opindex Wsizeof-pointer-memaccess
7031@opindex Wno-sizeof-pointer-memaccess
7032Warn for suspicious length parameters to certain string and memory built-in
7033functions if the argument uses @code{sizeof}.  This warning triggers for
7034example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7035an array, but a pointer, and suggests a possible fix, or about
7036@code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
7037also warns about calls to bounded string copy functions like @code{strncat}
7038or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7039the source array.  For example, in the following function the call to
7040@code{strncat} specifies the size of the source string as the bound.  That
7041is almost certainly a mistake and so the call is diagnosed.
7042@smallexample
7043void make_file (const char *name)
7044@{
7045  char path[PATH_MAX];
7046  strncpy (path, name, sizeof path - 1);
7047  strncat (path, ".text", sizeof ".text");
7048  @dots{}
7049@}
7050@end smallexample
7051
7052The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7053
7054@item -Wsizeof-array-argument
7055@opindex Wsizeof-array-argument
7056@opindex Wno-sizeof-array-argument
7057Warn when the @code{sizeof} operator is applied to a parameter that is
7058declared as an array in a function definition.  This warning is enabled by
7059default for C and C++ programs.
7060
7061@item -Wmemset-elt-size
7062@opindex Wmemset-elt-size
7063@opindex Wno-memset-elt-size
7064Warn for suspicious calls to the @code{memset} built-in function, if the
7065first argument references an array, and the third argument is a number
7066equal to the number of elements, but not equal to the size of the array
7067in memory.  This indicates that the user has omitted a multiplication by
7068the element size.  This warning is enabled by @option{-Wall}.
7069
7070@item -Wmemset-transposed-args
7071@opindex Wmemset-transposed-args
7072@opindex Wno-memset-transposed-args
7073Warn for suspicious calls to the @code{memset} built-in function where
7074the second argument is not zero and the third argument is zero.  For
7075example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7076@code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
7077is only emitted if the third argument is a literal zero.  Otherwise, if
7078it is an expression that is folded to zero, or a cast of zero to some
7079type, it is far less likely that the arguments have been mistakenly
7080transposed and no warning is emitted.  This warning is enabled
7081by @option{-Wall}.
7082
7083@item -Waddress
7084@opindex Waddress
7085@opindex Wno-address
7086Warn about suspicious uses of memory addresses. These include using
7087the address of a function in a conditional expression, such as
7088@code{void func(void); if (func)}, and comparisons against the memory
7089address of a string literal, such as @code{if (x == "abc")}.  Such
7090uses typically indicate a programmer error: the address of a function
7091always evaluates to true, so their use in a conditional usually
7092indicate that the programmer forgot the parentheses in a function
7093call; and comparisons against string literals result in unspecified
7094behavior and are not portable in C, so they usually indicate that the
7095programmer intended to use @code{strcmp}.  This warning is enabled by
7096@option{-Wall}.
7097
7098@item -Waddress-of-packed-member
7099@opindex Waddress-of-packed-member
7100@opindex Wno-address-of-packed-member
7101Warn when the address of packed member of struct or union is taken,
7102which usually results in an unaligned pointer value.  This is
7103enabled by default.
7104
7105@item -Wlogical-op
7106@opindex Wlogical-op
7107@opindex Wno-logical-op
7108Warn about suspicious uses of logical operators in expressions.
7109This includes using logical operators in contexts where a
7110bit-wise operator is likely to be expected.  Also warns when
7111the operands of a logical operator are the same:
7112@smallexample
7113extern int a;
7114if (a < 0 && a < 0) @{ @dots{} @}
7115@end smallexample
7116
7117@item -Wlogical-not-parentheses
7118@opindex Wlogical-not-parentheses
7119@opindex Wno-logical-not-parentheses
7120Warn about logical not used on the left hand side operand of a comparison.
7121This option does not warn if the right operand is considered to be a boolean
7122expression.  Its purpose is to detect suspicious code like the following:
7123@smallexample
7124int a;
7125@dots{}
7126if (!a > 1) @{ @dots{} @}
7127@end smallexample
7128
7129It is possible to suppress the warning by wrapping the LHS into
7130parentheses:
7131@smallexample
7132if ((!a) > 1) @{ @dots{} @}
7133@end smallexample
7134
7135This warning is enabled by @option{-Wall}.
7136
7137@item -Waggregate-return
7138@opindex Waggregate-return
7139@opindex Wno-aggregate-return
7140Warn if any functions that return structures or unions are defined or
7141called.  (In languages where you can return an array, this also elicits
7142a warning.)
7143
7144@item -Wno-aggressive-loop-optimizations
7145@opindex Wno-aggressive-loop-optimizations
7146@opindex Waggressive-loop-optimizations
7147Warn if in a loop with constant number of iterations the compiler detects
7148undefined behavior in some statement during one or more of the iterations.
7149
7150@item -Wno-attributes
7151@opindex Wno-attributes
7152@opindex Wattributes
7153Do not warn if an unexpected @code{__attribute__} is used, such as
7154unrecognized attributes, function attributes applied to variables,
7155etc.  This does not stop errors for incorrect use of supported
7156attributes.
7157
7158@item -Wno-builtin-declaration-mismatch
7159@opindex Wno-builtin-declaration-mismatch
7160@opindex Wbuiltin-declaration-mismatch
7161Warn if a built-in function is declared with an incompatible signature
7162or as a non-function, or when a built-in function declared with a type
7163that does not include a prototype is called with arguments whose promoted
7164types do not match those expected by the function.  When @option{-Wextra}
7165is specified, also warn when a built-in function that takes arguments is
7166declared without a prototype.  The @option{-Wno-builtin-declaration-mismatch}
7167warning is enabled by default.  To avoid the warning include the appropriate
7168header to bring the prototypes of built-in functions into scope.
7169
7170For example, the call to @code{memset} below is diagnosed by the warning
7171because the function expects a value of type @code{size_t} as its argument
7172but the type of @code{32} is @code{int}.  With @option{-Wextra},
7173the declaration of the function is diagnosed as well.
7174@smallexample
7175extern void* memset ();
7176void f (void *d)
7177@{
7178  memset (d, '\0', 32);
7179@}
7180@end smallexample
7181
7182@item -Wno-builtin-macro-redefined
7183@opindex Wno-builtin-macro-redefined
7184@opindex Wbuiltin-macro-redefined
7185Do not warn if certain built-in macros are redefined.  This suppresses
7186warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7187@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7188
7189@item -Wstrict-prototypes @r{(C and Objective-C only)}
7190@opindex Wstrict-prototypes
7191@opindex Wno-strict-prototypes
7192Warn if a function is declared or defined without specifying the
7193argument types.  (An old-style function definition is permitted without
7194a warning if preceded by a declaration that specifies the argument
7195types.)
7196
7197@item -Wold-style-declaration @r{(C and Objective-C only)}
7198@opindex Wold-style-declaration
7199@opindex Wno-old-style-declaration
7200Warn for obsolescent usages, according to the C Standard, in a
7201declaration. For example, warn if storage-class specifiers like
7202@code{static} are not the first things in a declaration.  This warning
7203is also enabled by @option{-Wextra}.
7204
7205@item -Wold-style-definition @r{(C and Objective-C only)}
7206@opindex Wold-style-definition
7207@opindex Wno-old-style-definition
7208Warn if an old-style function definition is used.  A warning is given
7209even if there is a previous prototype.
7210
7211@item -Wmissing-parameter-type @r{(C and Objective-C only)}
7212@opindex Wmissing-parameter-type
7213@opindex Wno-missing-parameter-type
7214A function parameter is declared without a type specifier in K&R-style
7215functions:
7216
7217@smallexample
7218void foo(bar) @{ @}
7219@end smallexample
7220
7221This warning is also enabled by @option{-Wextra}.
7222
7223@item -Wmissing-prototypes @r{(C and Objective-C only)}
7224@opindex Wmissing-prototypes
7225@opindex Wno-missing-prototypes
7226Warn if a global function is defined without a previous prototype
7227declaration.  This warning is issued even if the definition itself
7228provides a prototype.  Use this option to detect global functions
7229that do not have a matching prototype declaration in a header file.
7230This option is not valid for C++ because all function declarations
7231provide prototypes and a non-matching declaration declares an
7232overload rather than conflict with an earlier declaration.
7233Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7234
7235@item -Wmissing-declarations
7236@opindex Wmissing-declarations
7237@opindex Wno-missing-declarations
7238Warn if a global function is defined without a previous declaration.
7239Do so even if the definition itself provides a prototype.
7240Use this option to detect global functions that are not declared in
7241header files.  In C, no warnings are issued for functions with previous
7242non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7243missing prototypes.  In C++, no warnings are issued for function templates,
7244or for inline functions, or for functions in anonymous namespaces.
7245
7246@item -Wmissing-field-initializers
7247@opindex Wmissing-field-initializers
7248@opindex Wno-missing-field-initializers
7249@opindex W
7250@opindex Wextra
7251@opindex Wno-extra
7252Warn if a structure's initializer has some fields missing.  For
7253example, the following code causes such a warning, because
7254@code{x.h} is implicitly zero:
7255
7256@smallexample
7257struct s @{ int f, g, h; @};
7258struct s x = @{ 3, 4 @};
7259@end smallexample
7260
7261This option does not warn about designated initializers, so the following
7262modification does not trigger a warning:
7263
7264@smallexample
7265struct s @{ int f, g, h; @};
7266struct s x = @{ .f = 3, .g = 4 @};
7267@end smallexample
7268
7269In C this option does not warn about the universal zero initializer
7270@samp{@{ 0 @}}:
7271
7272@smallexample
7273struct s @{ int f, g, h; @};
7274struct s x = @{ 0 @};
7275@end smallexample
7276
7277Likewise, in C++ this option does not warn about the empty @{ @}
7278initializer, for example:
7279
7280@smallexample
7281struct s @{ int f, g, h; @};
7282s x = @{ @};
7283@end smallexample
7284
7285This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
7286warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7287
7288@item -Wno-multichar
7289@opindex Wno-multichar
7290@opindex Wmultichar
7291Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7292Usually they indicate a typo in the user's code, as they have
7293implementation-defined values, and should not be used in portable code.
7294
7295@item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7296@opindex Wnormalized=
7297@opindex Wnormalized
7298@opindex Wno-normalized
7299@cindex NFC
7300@cindex NFKC
7301@cindex character set, input normalization
7302In ISO C and ISO C++, two identifiers are different if they are
7303different sequences of characters.  However, sometimes when characters
7304outside the basic ASCII character set are used, you can have two
7305different character sequences that look the same.  To avoid confusion,
7306the ISO 10646 standard sets out some @dfn{normalization rules} which
7307when applied ensure that two sequences that look the same are turned into
7308the same sequence.  GCC can warn you if you are using identifiers that
7309have not been normalized; this option controls that warning.
7310
7311There are four levels of warning supported by GCC@.  The default is
7312@option{-Wnormalized=nfc}, which warns about any identifier that is
7313not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
7314recommended form for most uses.  It is equivalent to
7315@option{-Wnormalized}.
7316
7317Unfortunately, there are some characters allowed in identifiers by
7318ISO C and ISO C++ that, when turned into NFC, are not allowed in
7319identifiers.  That is, there's no way to use these symbols in portable
7320ISO C or C++ and have all your identifiers in NFC@.
7321@option{-Wnormalized=id} suppresses the warning for these characters.
7322It is hoped that future versions of the standards involved will correct
7323this, which is why this option is not the default.
7324
7325You can switch the warning off for all characters by writing
7326@option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
7327only do this if you are using some other normalization scheme (like
7328``D''), because otherwise you can easily create bugs that are
7329literally impossible to see.
7330
7331Some characters in ISO 10646 have distinct meanings but look identical
7332in some fonts or display methodologies, especially once formatting has
7333been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7334LETTER N'', displays just like a regular @code{n} that has been
7335placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
7336normalization scheme to convert all these into a standard form as
7337well, and GCC warns if your code is not in NFKC if you use
7338@option{-Wnormalized=nfkc}.  This warning is comparable to warning
7339about every identifier that contains the letter O because it might be
7340confused with the digit 0, and so is not the default, but may be
7341useful as a local coding convention if the programming environment
7342cannot be fixed to display these characters distinctly.
7343
7344@item -Wno-attribute-warning
7345@opindex Wno-attribute-warning
7346@opindex Wattribute-warning
7347Do not warn about usage of functions (@pxref{Function Attributes})
7348declared with @code{warning} attribute.  By default, this warning is
7349enabled.  @option{-Wno-attribute-warning} can be used to disable the
7350warning or @option{-Wno-error=attribute-warning} can be used to
7351disable the error when compiled with @option{-Werror} flag.
7352
7353@item -Wno-deprecated
7354@opindex Wno-deprecated
7355@opindex Wdeprecated
7356Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
7357
7358@item -Wno-deprecated-declarations
7359@opindex Wno-deprecated-declarations
7360@opindex Wdeprecated-declarations
7361Do not warn about uses of functions (@pxref{Function Attributes}),
7362variables (@pxref{Variable Attributes}), and types (@pxref{Type
7363Attributes}) marked as deprecated by using the @code{deprecated}
7364attribute.
7365
7366@item -Wno-overflow
7367@opindex Wno-overflow
7368@opindex Woverflow
7369Do not warn about compile-time overflow in constant expressions.
7370
7371@item -Wno-odr
7372@opindex Wno-odr
7373@opindex Wodr
7374Warn about One Definition Rule violations during link-time optimization.
7375Requires @option{-flto-odr-type-merging} to be enabled.  Enabled by default.
7376
7377@item -Wopenmp-simd
7378@opindex Wopenmp-simd
7379@opindex Wno-openmp-simd
7380Warn if the vectorizer cost model overrides the OpenMP
7381simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
7382option can be used to relax the cost model.
7383
7384@item -Woverride-init @r{(C and Objective-C only)}
7385@opindex Woverride-init
7386@opindex Wno-override-init
7387@opindex W
7388@opindex Wextra
7389@opindex Wno-extra
7390Warn if an initialized field without side effects is overridden when
7391using designated initializers (@pxref{Designated Inits, , Designated
7392Initializers}).
7393
7394This warning is included in @option{-Wextra}.  To get other
7395@option{-Wextra} warnings without this one, use @option{-Wextra
7396-Wno-override-init}.
7397
7398@item -Woverride-init-side-effects @r{(C and Objective-C only)}
7399@opindex Woverride-init-side-effects
7400@opindex Wno-override-init-side-effects
7401Warn if an initialized field with side effects is overridden when
7402using designated initializers (@pxref{Designated Inits, , Designated
7403Initializers}).  This warning is enabled by default.
7404
7405@item -Wpacked
7406@opindex Wpacked
7407@opindex Wno-packed
7408Warn if a structure is given the packed attribute, but the packed
7409attribute has no effect on the layout or size of the structure.
7410Such structures may be mis-aligned for little benefit.  For
7411instance, in this code, the variable @code{f.x} in @code{struct bar}
7412is misaligned even though @code{struct bar} does not itself
7413have the packed attribute:
7414
7415@smallexample
7416@group
7417struct foo @{
7418  int x;
7419  char a, b, c, d;
7420@} __attribute__((packed));
7421struct bar @{
7422  char z;
7423  struct foo f;
7424@};
7425@end group
7426@end smallexample
7427
7428@item -Wpacked-bitfield-compat
7429@opindex Wpacked-bitfield-compat
7430@opindex Wno-packed-bitfield-compat
7431The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7432on bit-fields of type @code{char}.  This has been fixed in GCC 4.4 but
7433the change can lead to differences in the structure layout.  GCC
7434informs you when the offset of such a field has changed in GCC 4.4.
7435For example there is no longer a 4-bit padding between field @code{a}
7436and @code{b} in this structure:
7437
7438@smallexample
7439struct foo
7440@{
7441  char a:4;
7442  char b:8;
7443@} __attribute__ ((packed));
7444@end smallexample
7445
7446This warning is enabled by default.  Use
7447@option{-Wno-packed-bitfield-compat} to disable this warning.
7448
7449@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7450@opindex Wpacked-not-aligned
7451@opindex Wno-packed-not-aligned
7452Warn if a structure field with explicitly specified alignment in a
7453packed struct or union is misaligned.  For example, a warning will
7454be issued on @code{struct S}, like, @code{warning: alignment 1 of
7455'struct S' is less than 8}, in this code:
7456
7457@smallexample
7458@group
7459struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7460struct __attribute__ ((packed)) S @{
7461  struct S8 s8;
7462@};
7463@end group
7464@end smallexample
7465
7466This warning is enabled by @option{-Wall}.
7467
7468@item -Wpadded
7469@opindex Wpadded
7470@opindex Wno-padded
7471Warn if padding is included in a structure, either to align an element
7472of the structure or to align the whole structure.  Sometimes when this
7473happens it is possible to rearrange the fields of the structure to
7474reduce the padding and so make the structure smaller.
7475
7476@item -Wredundant-decls
7477@opindex Wredundant-decls
7478@opindex Wno-redundant-decls
7479Warn if anything is declared more than once in the same scope, even in
7480cases where multiple declaration is valid and changes nothing.
7481
7482@item -Wno-restrict
7483@opindex Wrestrict
7484@opindex Wno-restrict
7485Warn when an object referenced by a @code{restrict}-qualified parameter
7486(or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7487argument, or when copies between such objects overlap.  For example,
7488the call to the @code{strcpy} function below attempts to truncate the string
7489by replacing its initial characters with the last four.  However, because
7490the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7491the call is diagnosed.
7492
7493@smallexample
7494void foo (void)
7495@{
7496  char a[] = "abcd1234";
7497  strcpy (a, a + 4);
7498  @dots{}
7499@}
7500@end smallexample
7501The @option{-Wrestrict} option detects some instances of simple overlap
7502even without optimization but works best at @option{-O2} and above.  It
7503is included in @option{-Wall}.
7504
7505@item -Wnested-externs @r{(C and Objective-C only)}
7506@opindex Wnested-externs
7507@opindex Wno-nested-externs
7508Warn if an @code{extern} declaration is encountered within a function.
7509
7510@item -Wno-inherited-variadic-ctor
7511@opindex Winherited-variadic-ctor
7512@opindex Wno-inherited-variadic-ctor
7513Suppress warnings about use of C++11 inheriting constructors when the
7514base class inherited from has a C variadic constructor; the warning is
7515on by default because the ellipsis is not inherited.
7516
7517@item -Winline
7518@opindex Winline
7519@opindex Wno-inline
7520Warn if a function that is declared as inline cannot be inlined.
7521Even with this option, the compiler does not warn about failures to
7522inline functions declared in system headers.
7523
7524The compiler uses a variety of heuristics to determine whether or not
7525to inline a function.  For example, the compiler takes into account
7526the size of the function being inlined and the amount of inlining
7527that has already been done in the current function.  Therefore,
7528seemingly insignificant changes in the source program can cause the
7529warnings produced by @option{-Winline} to appear or disappear.
7530
7531@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7532@opindex Wno-invalid-offsetof
7533@opindex Winvalid-offsetof
7534Suppress warnings from applying the @code{offsetof} macro to a non-POD
7535type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
7536to a non-standard-layout type is undefined.  In existing C++ implementations,
7537however, @code{offsetof} typically gives meaningful results.
7538This flag is for users who are aware that they are
7539writing nonportable code and who have deliberately chosen to ignore the
7540warning about it.
7541
7542The restrictions on @code{offsetof} may be relaxed in a future version
7543of the C++ standard.
7544
7545@item -Wint-in-bool-context
7546@opindex Wint-in-bool-context
7547@opindex Wno-int-in-bool-context
7548Warn for suspicious use of integer values where boolean values are expected,
7549such as conditional expressions (?:) using non-boolean integer constants in
7550boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
7551integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
7552for all kinds of multiplications regardless of the data type.
7553This warning is enabled by @option{-Wall}.
7554
7555@item -Wno-int-to-pointer-cast
7556@opindex Wno-int-to-pointer-cast
7557@opindex Wint-to-pointer-cast
7558Suppress warnings from casts to pointer type of an integer of a
7559different size. In C++, casting to a pointer type of smaller size is
7560an error. @option{Wint-to-pointer-cast} is enabled by default.
7561
7562
7563@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7564@opindex Wno-pointer-to-int-cast
7565@opindex Wpointer-to-int-cast
7566Suppress warnings from casts from a pointer to an integer type of a
7567different size.
7568
7569@item -Winvalid-pch
7570@opindex Winvalid-pch
7571@opindex Wno-invalid-pch
7572Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7573the search path but cannot be used.
7574
7575@item -Wlong-long
7576@opindex Wlong-long
7577@opindex Wno-long-long
7578Warn if @code{long long} type is used.  This is enabled by either
7579@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7580modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
7581
7582@item -Wvariadic-macros
7583@opindex Wvariadic-macros
7584@opindex Wno-variadic-macros
7585Warn if variadic macros are used in ISO C90 mode, or if the GNU
7586alternate syntax is used in ISO C99 mode.  This is enabled by either
7587@option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
7588messages, use @option{-Wno-variadic-macros}.
7589
7590@item -Wvarargs
7591@opindex Wvarargs
7592@opindex Wno-varargs
7593Warn upon questionable usage of the macros used to handle variable
7594arguments like @code{va_start}.  This is default.  To inhibit the
7595warning messages, use @option{-Wno-varargs}.
7596
7597@item -Wvector-operation-performance
7598@opindex Wvector-operation-performance
7599@opindex Wno-vector-operation-performance
7600Warn if vector operation is not implemented via SIMD capabilities of the
7601architecture.  Mainly useful for the performance tuning.
7602Vector operation can be implemented @code{piecewise}, which means that the
7603scalar operation is performed on every vector element;
7604@code{in parallel}, which means that the vector operation is implemented
7605using scalars of wider type, which normally is more performance efficient;
7606and @code{as a single scalar}, which means that vector fits into a
7607scalar type.
7608
7609@item -Wno-virtual-move-assign
7610@opindex Wvirtual-move-assign
7611@opindex Wno-virtual-move-assign
7612Suppress warnings about inheriting from a virtual base with a
7613non-trivial C++11 move assignment operator.  This is dangerous because
7614if the virtual base is reachable along more than one path, it is
7615moved multiple times, which can mean both objects end up in the
7616moved-from state.  If the move assignment operator is written to avoid
7617moving from a moved-from object, this warning can be disabled.
7618
7619@item -Wvla
7620@opindex Wvla
7621@opindex Wno-vla
7622Warn if a variable-length array is used in the code.
7623@option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7624the variable-length array.
7625
7626@item -Wvla-larger-than=@var{byte-size}
7627@opindex Wvla-larger-than=
7628@opindex Wno-vla-larger-than
7629If this option is used, the compiler will warn for declarations of
7630variable-length arrays whose size is either unbounded, or bounded
7631by an argument that allows the array size to exceed @var{byte-size}
7632bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7633works, but with variable-length arrays.
7634
7635Note that GCC may optimize small variable-length arrays of a known
7636value into plain arrays, so this warning may not get triggered for
7637such arrays.
7638
7639@option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7640is typically only effective when @option{-ftree-vrp} is active (default
7641for @option{-O2} and above).
7642
7643See also @option{-Walloca-larger-than=@var{byte-size}}.
7644
7645@item -Wno-vla-larger-than
7646@opindex Wno-vla-larger-than
7647Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
7648to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7649
7650@item -Wvolatile-register-var
7651@opindex Wvolatile-register-var
7652@opindex Wno-volatile-register-var
7653Warn if a register variable is declared volatile.  The volatile
7654modifier does not inhibit all optimizations that may eliminate reads
7655and/or writes to register variables.  This warning is enabled by
7656@option{-Wall}.
7657
7658@item -Wdisabled-optimization
7659@opindex Wdisabled-optimization
7660@opindex Wno-disabled-optimization
7661Warn if a requested optimization pass is disabled.  This warning does
7662not generally indicate that there is anything wrong with your code; it
7663merely indicates that GCC's optimizers are unable to handle the code
7664effectively.  Often, the problem is that your code is too big or too
7665complex; GCC refuses to optimize programs when the optimization
7666itself is likely to take inordinate amounts of time.
7667
7668@item -Wpointer-sign @r{(C and Objective-C only)}
7669@opindex Wpointer-sign
7670@opindex Wno-pointer-sign
7671Warn for pointer argument passing or assignment with different signedness.
7672This option is only supported for C and Objective-C@.  It is implied by
7673@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7674@option{-Wno-pointer-sign}.
7675
7676@item -Wstack-protector
7677@opindex Wstack-protector
7678@opindex Wno-stack-protector
7679This option is only active when @option{-fstack-protector} is active.  It
7680warns about functions that are not protected against stack smashing.
7681
7682@item -Woverlength-strings
7683@opindex Woverlength-strings
7684@opindex Wno-overlength-strings
7685Warn about string constants that are longer than the ``minimum
7686maximum'' length specified in the C standard.  Modern compilers
7687generally allow string constants that are much longer than the
7688standard's minimum limit, but very portable programs should avoid
7689using longer strings.
7690
7691The limit applies @emph{after} string constant concatenation, and does
7692not count the trailing NUL@.  In C90, the limit was 509 characters; in
7693C99, it was raised to 4095.  C++98 does not specify a normative
7694minimum maximum, so we do not diagnose overlength strings in C++@.
7695
7696This option is implied by @option{-Wpedantic}, and can be disabled with
7697@option{-Wno-overlength-strings}.
7698
7699@item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7700@opindex Wunsuffixed-float-constants
7701@opindex Wno-unsuffixed-float-constants
7702
7703Issue a warning for any floating constant that does not have
7704a suffix.  When used together with @option{-Wsystem-headers} it
7705warns about such constants in system header files.  This can be useful
7706when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7707from the decimal floating-point extension to C99.
7708
7709@item -Wno-designated-init @r{(C and Objective-C only)}
7710Suppress warnings when a positional initializer is used to initialize
7711a structure that has been marked with the @code{designated_init}
7712attribute.
7713
7714@item -Whsa
7715Issue a warning when HSAIL cannot be emitted for the compiled function or
7716OpenMP construct.
7717
7718@end table
7719
7720@node Debugging Options
7721@section Options for Debugging Your Program
7722@cindex options, debugging
7723@cindex debugging information options
7724
7725To tell GCC to emit extra information for use by a debugger, in almost
7726all cases you need only to add @option{-g} to your other options.
7727
7728GCC allows you to use @option{-g} with
7729@option{-O}.  The shortcuts taken by optimized code may occasionally
7730be surprising: some variables you declared may not exist
7731at all; flow of control may briefly move where you did not expect it;
7732some statements may not be executed because they compute constant
7733results or their values are already at hand; some statements may
7734execute in different places because they have been moved out of loops.
7735Nevertheless it is possible to debug optimized output.  This makes
7736it reasonable to use the optimizer for programs that might have bugs.
7737
7738If you are not using some other optimization option, consider
7739using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7740With no @option{-O} option at all, some compiler passes that collect
7741information useful for debugging do not run at all, so that
7742@option{-Og} may result in a better debugging experience.
7743
7744@table @gcctabopt
7745@item -g
7746@opindex g
7747Produce debugging information in the operating system's native format
7748(stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
7749information.
7750
7751On most systems that use stabs format, @option{-g} enables use of extra
7752debugging information that only GDB can use; this extra information
7753makes debugging work better in GDB but probably makes other debuggers
7754crash or
7755refuse to read the program.  If you want to control for certain whether
7756to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7757@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7758
7759@item -ggdb
7760@opindex ggdb
7761Produce debugging information for use by GDB@.  This means to use the
7762most expressive format available (DWARF, stabs, or the native format
7763if neither of those are supported), including GDB extensions if at all
7764possible.
7765
7766@item -gdwarf
7767@itemx -gdwarf-@var{version}
7768@opindex gdwarf
7769Produce debugging information in DWARF format (if that is supported).
7770The value of @var{version} may be either 2, 3, 4 or 5; the default version
7771for most targets is 4.  DWARF Version 5 is only experimental.
7772
7773Note that with DWARF Version 2, some ports require and always
7774use some non-conflicting DWARF 3 extensions in the unwind tables.
7775
7776Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7777for maximum benefit.
7778
7779GCC no longer supports DWARF Version 1, which is substantially
7780different than Version 2 and later.  For historical reasons, some
7781other DWARF-related options such as
7782@option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7783in their names, but apply to all currently-supported versions of DWARF.
7784
7785@item -gstabs
7786@opindex gstabs
7787Produce debugging information in stabs format (if that is supported),
7788without GDB extensions.  This is the format used by DBX on most BSD
7789systems.  On MIPS, Alpha and System V Release 4 systems this option
7790produces stabs debugging output that is not understood by DBX@.
7791On System V Release 4 systems this option requires the GNU assembler.
7792
7793@item -gstabs+
7794@opindex gstabs+
7795Produce debugging information in stabs format (if that is supported),
7796using GNU extensions understood only by the GNU debugger (GDB)@.  The
7797use of these extensions is likely to make other debuggers crash or
7798refuse to read the program.
7799
7800@item -gxcoff
7801@opindex gxcoff
7802Produce debugging information in XCOFF format (if that is supported).
7803This is the format used by the DBX debugger on IBM RS/6000 systems.
7804
7805@item -gxcoff+
7806@opindex gxcoff+
7807Produce debugging information in XCOFF format (if that is supported),
7808using GNU extensions understood only by the GNU debugger (GDB)@.  The
7809use of these extensions is likely to make other debuggers crash or
7810refuse to read the program, and may cause assemblers other than the GNU
7811assembler (GAS) to fail with an error.
7812
7813@item -gvms
7814@opindex gvms
7815Produce debugging information in Alpha/VMS debug format (if that is
7816supported).  This is the format used by DEBUG on Alpha/VMS systems.
7817
7818@item -g@var{level}
7819@itemx -ggdb@var{level}
7820@itemx -gstabs@var{level}
7821@itemx -gxcoff@var{level}
7822@itemx -gvms@var{level}
7823Request debugging information and also use @var{level} to specify how
7824much information.  The default level is 2.
7825
7826Level 0 produces no debug information at all.  Thus, @option{-g0} negates
7827@option{-g}.
7828
7829Level 1 produces minimal information, enough for making backtraces in
7830parts of the program that you don't plan to debug.  This includes
7831descriptions of functions and external variables, and line number
7832tables, but no information about local variables.
7833
7834Level 3 includes extra information, such as all the macro definitions
7835present in the program.  Some debuggers support macro expansion when
7836you use @option{-g3}.
7837
7838If you use multiple @option{-g} options, with or without level numbers,
7839the last such option is the one that is effective.
7840
7841@option{-gdwarf} does not accept a concatenated debug level, to avoid
7842confusion with @option{-gdwarf-@var{level}}.
7843Instead use an additional @option{-g@var{level}} option to change the
7844debug level for DWARF.
7845
7846@item -feliminate-unused-debug-symbols
7847@opindex feliminate-unused-debug-symbols
7848Produce debugging information in stabs format (if that is supported),
7849for only symbols that are actually used.
7850
7851@item -femit-class-debug-always
7852@opindex femit-class-debug-always
7853Instead of emitting debugging information for a C++ class in only one
7854object file, emit it in all object files using the class.  This option
7855should be used only with debuggers that are unable to handle the way GCC
7856normally emits debugging information for classes because using this
7857option increases the size of debugging information by as much as a
7858factor of two.
7859
7860@item -fno-merge-debug-strings
7861@opindex fmerge-debug-strings
7862@opindex fno-merge-debug-strings
7863Direct the linker to not merge together strings in the debugging
7864information that are identical in different object files.  Merging is
7865not supported by all assemblers or linkers.  Merging decreases the size
7866of the debug information in the output file at the cost of increasing
7867link processing time.  Merging is enabled by default.
7868
7869@item -fdebug-prefix-map=@var{old}=@var{new}
7870@opindex fdebug-prefix-map
7871When compiling files residing in directory @file{@var{old}}, record
7872debugging information describing them as if the files resided in
7873directory @file{@var{new}} instead.  This can be used to replace a
7874build-time path with an install-time path in the debug info.  It can
7875also be used to change an absolute path to a relative path by using
7876@file{.} for @var{new}.  This can give more reproducible builds, which
7877are location independent, but may require an extra command to tell GDB
7878where to find the source files. See also @option{-ffile-prefix-map}.
7879
7880@item -fvar-tracking
7881@opindex fvar-tracking
7882Run variable tracking pass.  It computes where variables are stored at each
7883position in code.  Better debugging information is then generated
7884(if the debugging information format supports this information).
7885
7886It is enabled by default when compiling with optimization (@option{-Os},
7887@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7888the debug info format supports it.
7889
7890@item -fvar-tracking-assignments
7891@opindex fvar-tracking-assignments
7892@opindex fno-var-tracking-assignments
7893Annotate assignments to user variables early in the compilation and
7894attempt to carry the annotations over throughout the compilation all the
7895way to the end, in an attempt to improve debug information while
7896optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
7897
7898It can be enabled even if var-tracking is disabled, in which case
7899annotations are created and maintained, but discarded at the end.
7900By default, this flag is enabled together with @option{-fvar-tracking},
7901except when selective scheduling is enabled.
7902
7903@item -gsplit-dwarf
7904@opindex gsplit-dwarf
7905Separate as much DWARF debugging information as possible into a
7906separate output file with the extension @file{.dwo}.  This option allows
7907the build system to avoid linking files with debug information.  To
7908be useful, this option requires a debugger capable of reading @file{.dwo}
7909files.
7910
7911@item -gdescribe-dies
7912@opindex gdescribe-dies
7913Add description attributes to some DWARF DIEs that have no name attribute,
7914such as artificial variables, external references and call site
7915parameter DIEs.
7916
7917@item -gpubnames
7918@opindex gpubnames
7919Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7920
7921@item -ggnu-pubnames
7922@opindex ggnu-pubnames
7923Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7924suitable for conversion into a GDB@ index.  This option is only useful
7925with a linker that can produce GDB@ index version 7.
7926
7927@item -fdebug-types-section
7928@opindex fdebug-types-section
7929@opindex fno-debug-types-section
7930When using DWARF Version 4 or higher, type DIEs can be put into
7931their own @code{.debug_types} section instead of making them part of the
7932@code{.debug_info} section.  It is more efficient to put them in a separate
7933comdat section since the linker can then remove duplicates.
7934But not all DWARF consumers support @code{.debug_types} sections yet
7935and on some objects @code{.debug_types} produces larger instead of smaller
7936debugging information.
7937
7938@item -grecord-gcc-switches
7939@itemx -gno-record-gcc-switches
7940@opindex grecord-gcc-switches
7941@opindex gno-record-gcc-switches
7942This switch causes the command-line options used to invoke the
7943compiler that may affect code generation to be appended to the
7944DW_AT_producer attribute in DWARF debugging information.  The options
7945are concatenated with spaces separating them from each other and from
7946the compiler version.
7947It is enabled by default.
7948See also @option{-frecord-gcc-switches} for another
7949way of storing compiler options into the object file.
7950
7951@item -gstrict-dwarf
7952@opindex gstrict-dwarf
7953Disallow using extensions of later DWARF standard version than selected
7954with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
7955DWARF extensions from later standard versions is allowed.
7956
7957@item -gno-strict-dwarf
7958@opindex gno-strict-dwarf
7959Allow using extensions of later DWARF standard version than selected with
7960@option{-gdwarf-@var{version}}.
7961
7962@item -gas-loc-support
7963@opindex gas-loc-support
7964Inform the compiler that the assembler supports @code{.loc} directives.
7965It may then use them for the assembler to generate DWARF2+ line number
7966tables.
7967
7968This is generally desirable, because assembler-generated line-number
7969tables are a lot more compact than those the compiler can generate
7970itself.
7971
7972This option will be enabled by default if, at GCC configure time, the
7973assembler was found to support such directives.
7974
7975@item -gno-as-loc-support
7976@opindex gno-as-loc-support
7977Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7978line number tables are to be generated.
7979
7980@item gas-locview-support
7981@opindex gas-locview-support
7982Inform the compiler that the assembler supports @code{view} assignment
7983and reset assertion checking in @code{.loc} directives.
7984
7985This option will be enabled by default if, at GCC configure time, the
7986assembler was found to support them.
7987
7988@item gno-as-locview-support
7989Force GCC to assign view numbers internally, if
7990@option{-gvariable-location-views} are explicitly requested.
7991
7992@item -gcolumn-info
7993@itemx -gno-column-info
7994@opindex gcolumn-info
7995@opindex gno-column-info
7996Emit location column information into DWARF debugging information, rather
7997than just file and line.
7998This option is enabled by default.
7999
8000@item -gstatement-frontiers
8001@itemx -gno-statement-frontiers
8002@opindex gstatement-frontiers
8003@opindex gno-statement-frontiers
8004This option causes GCC to create markers in the internal representation
8005at the beginning of statements, and to keep them roughly in place
8006throughout compilation, using them to guide the output of @code{is_stmt}
8007markers in the line number table.  This is enabled by default when
8008compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8009@dots{}), and outputting DWARF 2 debug information at the normal level.
8010
8011@item -gvariable-location-views
8012@itemx -gvariable-location-views=incompat5
8013@itemx -gno-variable-location-views
8014@opindex gvariable-location-views
8015@opindex gvariable-location-views=incompat5
8016@opindex gno-variable-location-views
8017Augment variable location lists with progressive view numbers implied
8018from the line number table.  This enables debug information consumers to
8019inspect state at certain points of the program, even if no instructions
8020associated with the corresponding source locations are present at that
8021point.  If the assembler lacks support for view numbers in line number
8022tables, this will cause the compiler to emit the line number table,
8023which generally makes them somewhat less compact.  The augmented line
8024number tables and location lists are fully backward-compatible, so they
8025can be consumed by debug information consumers that are not aware of
8026these augmentations, but they won't derive any benefit from them either.
8027
8028This is enabled by default when outputting DWARF 2 debug information at
8029the normal level, as long as there is assembler support,
8030@option{-fvar-tracking-assignments} is enabled and
8031@option{-gstrict-dwarf} is not.  When assembler support is not
8032available, this may still be enabled, but it will force GCC to output
8033internal line number tables, and if
8034@option{-ginternal-reset-location-views} is not enabled, that will most
8035certainly lead to silently mismatching location views.
8036
8037There is a proposed representation for view numbers that is not backward
8038compatible with the location list format introduced in DWARF 5, that can
8039be enabled with @option{-gvariable-location-views=incompat5}.  This
8040option may be removed in the future, is only provided as a reference
8041implementation of the proposed representation.  Debug information
8042consumers are not expected to support this extended format, and they
8043would be rendered unable to decode location lists using it.
8044
8045@item -ginternal-reset-location-views
8046@itemx -gno-internal-reset-location-views
8047@opindex ginternal-reset-location-views
8048@opindex gno-internal-reset-location-views
8049Attempt to determine location views that can be omitted from location
8050view lists.  This requires the compiler to have very accurate insn
8051length estimates, which isn't always the case, and it may cause
8052incorrect view lists to be generated silently when using an assembler
8053that does not support location view lists.  The GNU assembler will flag
8054any such error as a @code{view number mismatch}.  This is only enabled
8055on ports that define a reliable estimation function.
8056
8057@item -ginline-points
8058@itemx -gno-inline-points
8059@opindex ginline-points
8060@opindex gno-inline-points
8061Generate extended debug information for inlined functions.  Location
8062view tracking markers are inserted at inlined entry points, so that
8063address and view numbers can be computed and output in debug
8064information.  This can be enabled independently of location views, in
8065which case the view numbers won't be output, but it can only be enabled
8066along with statement frontiers, and it is only enabled by default if
8067location views are enabled.
8068
8069@item -gz@r{[}=@var{type}@r{]}
8070@opindex gz
8071Produce compressed debug sections in DWARF format, if that is supported.
8072If @var{type} is not given, the default type depends on the capabilities
8073of the assembler and linker used.  @var{type} may be one of
8074@samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8075compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8076compression in traditional GNU format).  If the linker doesn't support
8077writing compressed debug sections, the option is rejected.  Otherwise,
8078if the assembler does not support them, @option{-gz} is silently ignored
8079when producing object files.
8080
8081@item -femit-struct-debug-baseonly
8082@opindex femit-struct-debug-baseonly
8083Emit debug information for struct-like types
8084only when the base name of the compilation source file
8085matches the base name of file in which the struct is defined.
8086
8087This option substantially reduces the size of debugging information,
8088but at significant potential loss in type information to the debugger.
8089See @option{-femit-struct-debug-reduced} for a less aggressive option.
8090See @option{-femit-struct-debug-detailed} for more detailed control.
8091
8092This option works only with DWARF debug output.
8093
8094@item -femit-struct-debug-reduced
8095@opindex femit-struct-debug-reduced
8096Emit debug information for struct-like types
8097only when the base name of the compilation source file
8098matches the base name of file in which the type is defined,
8099unless the struct is a template or defined in a system header.
8100
8101This option significantly reduces the size of debugging information,
8102with some potential loss in type information to the debugger.
8103See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8104See @option{-femit-struct-debug-detailed} for more detailed control.
8105
8106This option works only with DWARF debug output.
8107
8108@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8109@opindex femit-struct-debug-detailed
8110Specify the struct-like types
8111for which the compiler generates debug information.
8112The intent is to reduce duplicate struct debug information
8113between different object files within the same program.
8114
8115This option is a detailed version of
8116@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8117which serves for most needs.
8118
8119A specification has the syntax@*
8120[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8121
8122The optional first word limits the specification to
8123structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8124A struct type is used directly when it is the type of a variable, member.
8125Indirect uses arise through pointers to structs.
8126That is, when use of an incomplete struct is valid, the use is indirect.
8127An example is
8128@samp{struct one direct; struct two * indirect;}.
8129
8130The optional second word limits the specification to
8131ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8132Generic structs are a bit complicated to explain.
8133For C++, these are non-explicit specializations of template classes,
8134or non-template classes within the above.
8135Other programming languages have generics,
8136but @option{-femit-struct-debug-detailed} does not yet implement them.
8137
8138The third word specifies the source files for those
8139structs for which the compiler should emit debug information.
8140The values @samp{none} and @samp{any} have the normal meaning.
8141The value @samp{base} means that
8142the base of name of the file in which the type declaration appears
8143must match the base of the name of the main compilation file.
8144In practice, this means that when compiling @file{foo.c}, debug information
8145is generated for types declared in that file and @file{foo.h},
8146but not other header files.
8147The value @samp{sys} means those types satisfying @samp{base}
8148or declared in system or compiler headers.
8149
8150You may need to experiment to determine the best settings for your application.
8151
8152The default is @option{-femit-struct-debug-detailed=all}.
8153
8154This option works only with DWARF debug output.
8155
8156@item -fno-dwarf2-cfi-asm
8157@opindex fdwarf2-cfi-asm
8158@opindex fno-dwarf2-cfi-asm
8159Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8160instead of using GAS @code{.cfi_*} directives.
8161
8162@item -fno-eliminate-unused-debug-types
8163@opindex feliminate-unused-debug-types
8164@opindex fno-eliminate-unused-debug-types
8165Normally, when producing DWARF output, GCC avoids producing debug symbol
8166output for types that are nowhere used in the source file being compiled.
8167Sometimes it is useful to have GCC emit debugging
8168information for all types declared in a compilation
8169unit, regardless of whether or not they are actually used
8170in that compilation unit, for example
8171if, in the debugger, you want to cast a value to a type that is
8172not actually used in your program (but is declared).  More often,
8173however, this results in a significant amount of wasted space.
8174@end table
8175
8176@node Optimize Options
8177@section Options That Control Optimization
8178@cindex optimize options
8179@cindex options, optimization
8180
8181These options control various sorts of optimizations.
8182
8183Without any optimization option, the compiler's goal is to reduce the
8184cost of compilation and to make debugging produce the expected
8185results.  Statements are independent: if you stop the program with a
8186breakpoint between statements, you can then assign a new value to any
8187variable or change the program counter to any other statement in the
8188function and get exactly the results you expect from the source
8189code.
8190
8191Turning on optimization flags makes the compiler attempt to improve
8192the performance and/or code size at the expense of compilation time
8193and possibly the ability to debug the program.
8194
8195The compiler performs optimization based on the knowledge it has of the
8196program.  Compiling multiple files at once to a single output file mode allows
8197the compiler to use information gained from all of the files when compiling
8198each of them.
8199
8200Not all optimizations are controlled directly by a flag.  Only
8201optimizations that have a flag are listed in this section.
8202
8203Most optimizations are completely disabled at @option{-O0} or if an
8204@option{-O} level is not set on the command line, even if individual
8205optimization flags are specified.  Similarly, @option{-Og} suppresses
8206many optimization passes.
8207
8208Depending on the target and how GCC was configured, a slightly different
8209set of optimizations may be enabled at each @option{-O} level than
8210those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
8211to find out the exact set of optimizations that are enabled at each level.
8212@xref{Overall Options}, for examples.
8213
8214@table @gcctabopt
8215@item -O
8216@itemx -O1
8217@opindex O
8218@opindex O1
8219Optimize.  Optimizing compilation takes somewhat more time, and a lot
8220more memory for a large function.
8221
8222With @option{-O}, the compiler tries to reduce code size and execution
8223time, without performing any optimizations that take a great deal of
8224compilation time.
8225
8226@c Note that in addition to the default_options_table list in opts.c,
8227@c several optimization flags default to true but control optimization
8228@c passes that are explicitly disabled at -O0.
8229
8230@option{-O} turns on the following optimization flags:
8231
8232@c Please keep the following list alphabetized.
8233@gccoptlist{-fauto-inc-dec @gol
8234-fbranch-count-reg @gol
8235-fcombine-stack-adjustments @gol
8236-fcompare-elim @gol
8237-fcprop-registers @gol
8238-fdce @gol
8239-fdefer-pop @gol
8240-fdelayed-branch @gol
8241-fdse @gol
8242-fforward-propagate @gol
8243-fguess-branch-probability @gol
8244-fif-conversion @gol
8245-fif-conversion2 @gol
8246-finline-functions-called-once @gol
8247-fipa-profile @gol
8248-fipa-pure-const @gol
8249-fipa-reference @gol
8250-fipa-reference-addressable @gol
8251-fmerge-constants @gol
8252-fmove-loop-invariants @gol
8253-fomit-frame-pointer @gol
8254-freorder-blocks @gol
8255-fshrink-wrap @gol
8256-fshrink-wrap-separate @gol
8257-fsplit-wide-types @gol
8258-fssa-backprop @gol
8259-fssa-phiopt @gol
8260-ftree-bit-ccp @gol
8261-ftree-ccp @gol
8262-ftree-ch @gol
8263-ftree-coalesce-vars @gol
8264-ftree-copy-prop @gol
8265-ftree-dce @gol
8266-ftree-dominator-opts @gol
8267-ftree-dse @gol
8268-ftree-forwprop @gol
8269-ftree-fre @gol
8270-ftree-phiprop @gol
8271-ftree-pta @gol
8272-ftree-scev-cprop @gol
8273-ftree-sink @gol
8274-ftree-slsr @gol
8275-ftree-sra @gol
8276-ftree-ter @gol
8277-funit-at-a-time}
8278
8279@item -O2
8280@opindex O2
8281Optimize even more.  GCC performs nearly all supported optimizations
8282that do not involve a space-speed tradeoff.
8283As compared to @option{-O}, this option increases both compilation time
8284and the performance of the generated code.
8285
8286@option{-O2} turns on all optimization flags specified by @option{-O}.  It
8287also turns on the following optimization flags:
8288
8289@c Please keep the following list alphabetized!
8290@gccoptlist{-falign-functions  -falign-jumps @gol
8291-falign-labels  -falign-loops @gol
8292-fcaller-saves @gol
8293-fcode-hoisting @gol
8294-fcrossjumping @gol
8295-fcse-follow-jumps  -fcse-skip-blocks @gol
8296-fdelete-null-pointer-checks @gol
8297-fdevirtualize  -fdevirtualize-speculatively @gol
8298-fexpensive-optimizations @gol
8299-fgcse  -fgcse-lm  @gol
8300-fhoist-adjacent-loads @gol
8301-finline-small-functions @gol
8302-findirect-inlining @gol
8303-fipa-bit-cp  -fipa-cp  -fipa-icf @gol
8304-fipa-ra  -fipa-sra  -fipa-vrp @gol
8305-fisolate-erroneous-paths-dereference @gol
8306-flra-remat @gol
8307-foptimize-sibling-calls @gol
8308-foptimize-strlen @gol
8309-fpartial-inlining @gol
8310-fpeephole2 @gol
8311-freorder-blocks-algorithm=stc @gol
8312-freorder-blocks-and-partition  -freorder-functions @gol
8313-frerun-cse-after-loop  @gol
8314-fschedule-insns  -fschedule-insns2 @gol
8315-fsched-interblock  -fsched-spec @gol
8316-fstore-merging @gol
8317-fstrict-aliasing @gol
8318-fthread-jumps @gol
8319-ftree-builtin-call-dce @gol
8320-ftree-pre @gol
8321-ftree-switch-conversion  -ftree-tail-merge @gol
8322-ftree-vrp}
8323
8324Please note the warning under @option{-fgcse} about
8325invoking @option{-O2} on programs that use computed gotos.
8326
8327@item -O3
8328@opindex O3
8329Optimize yet more.  @option{-O3} turns on all optimizations specified
8330by @option{-O2} and also turns on the following optimization flags:
8331
8332@c Please keep the following list alphabetized!
8333@gccoptlist{-fgcse-after-reload @gol
8334-finline-functions @gol
8335-fipa-cp-clone
8336-floop-interchange @gol
8337-floop-unroll-and-jam @gol
8338-fpeel-loops @gol
8339-fpredictive-commoning @gol
8340-fsplit-paths @gol
8341-ftree-loop-distribute-patterns @gol
8342-ftree-loop-distribution @gol
8343-ftree-loop-vectorize @gol
8344-ftree-partial-pre @gol
8345-ftree-slp-vectorize @gol
8346-funswitch-loops @gol
8347-fvect-cost-model @gol
8348-fversion-loops-for-strides}
8349
8350@item -O0
8351@opindex O0
8352Reduce compilation time and make debugging produce the expected
8353results.  This is the default.
8354
8355@item -Os
8356@opindex Os
8357Optimize for size.  @option{-Os} enables all @option{-O2} optimizations
8358except those that often increase code size:
8359
8360@gccoptlist{-falign-functions  -falign-jumps @gol
8361-falign-labels  -falign-loops @gol
8362-fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
8363
8364It also enables @option{-finline-functions}, causes the compiler to tune for
8365code size rather than execution speed, and performs further optimizations
8366designed to reduce code size.
8367
8368@item -Ofast
8369@opindex Ofast
8370Disregard strict standards compliance.  @option{-Ofast} enables all
8371@option{-O3} optimizations.  It also enables optimizations that are not
8372valid for all standard-compliant programs.
8373It turns on @option{-ffast-math} and the Fortran-specific
8374@option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8375specified, and @option{-fno-protect-parens}.
8376
8377@item -Og
8378@opindex Og
8379Optimize debugging experience.  @option{-Og} should be the optimization
8380level of choice for the standard edit-compile-debug cycle, offering
8381a reasonable level of optimization while maintaining fast compilation
8382and a good debugging experience.  It is a better choice than @option{-O0}
8383for producing debuggable code because some compiler passes
8384that collect debug information are disabled at @option{-O0}.
8385
8386Like @option{-O0}, @option{-Og} completely disables a number of
8387optimization passes so that individual options controlling them have
8388no effect.  Otherwise @option{-Og} enables all @option{-O1}
8389optimization flags except for those that may interfere with debugging:
8390
8391@gccoptlist{-fbranch-count-reg  -fdelayed-branch @gol
8392-fif-conversion  -fif-conversion2  @gol
8393-finline-functions-called-once @gol
8394-fmove-loop-invariants  -fssa-phiopt @gol
8395-ftree-bit-ccp  -ftree-pta  -ftree-sra}
8396
8397@end table
8398
8399If you use multiple @option{-O} options, with or without level numbers,
8400the last such option is the one that is effective.
8401
8402Options of the form @option{-f@var{flag}} specify machine-independent
8403flags.  Most flags have both positive and negative forms; the negative
8404form of @option{-ffoo} is @option{-fno-foo}.  In the table
8405below, only one of the forms is listed---the one you typically
8406use.  You can figure out the other form by either removing @samp{no-}
8407or adding it.
8408
8409The following options control specific optimizations.  They are either
8410activated by @option{-O} options or are related to ones that are.  You
8411can use the following flags in the rare cases when ``fine-tuning'' of
8412optimizations to be performed is desired.
8413
8414@table @gcctabopt
8415@item -fno-defer-pop
8416@opindex fno-defer-pop
8417@opindex fdefer-pop
8418For machines that must pop arguments after a function call, always pop
8419the arguments as soon as each function returns.
8420At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8421this allows the compiler to let arguments accumulate on the stack for several
8422function calls and pop them all at once.
8423
8424@item -fforward-propagate
8425@opindex fforward-propagate
8426Perform a forward propagation pass on RTL@.  The pass tries to combine two
8427instructions and checks if the result can be simplified.  If loop unrolling
8428is active, two passes are performed and the second is scheduled after
8429loop unrolling.
8430
8431This option is enabled by default at optimization levels @option{-O},
8432@option{-O2}, @option{-O3}, @option{-Os}.
8433
8434@item -ffp-contract=@var{style}
8435@opindex ffp-contract
8436@option{-ffp-contract=off} disables floating-point expression contraction.
8437@option{-ffp-contract=fast} enables floating-point expression contraction
8438such as forming of fused multiply-add operations if the target has
8439native support for them.
8440@option{-ffp-contract=on} enables floating-point expression contraction
8441if allowed by the language standard.  This is currently not implemented
8442and treated equal to @option{-ffp-contract=off}.
8443
8444The default is @option{-ffp-contract=fast}.
8445
8446@item -fomit-frame-pointer
8447@opindex fomit-frame-pointer
8448Omit the frame pointer in functions that don't need one.  This avoids the
8449instructions to save, set up and restore the frame pointer; on many targets
8450it also makes an extra register available.
8451
8452On some targets this flag has no effect because the standard calling sequence
8453always uses a frame pointer, so it cannot be omitted.
8454
8455Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8456is used in all functions.  Several targets always omit the frame pointer in
8457leaf functions.
8458
8459Enabled by default at @option{-O} and higher.
8460
8461@item -foptimize-sibling-calls
8462@opindex foptimize-sibling-calls
8463Optimize sibling and tail recursive calls.
8464
8465Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8466
8467@item -foptimize-strlen
8468@opindex foptimize-strlen
8469Optimize various standard C string functions (e.g.@: @code{strlen},
8470@code{strchr} or @code{strcpy}) and
8471their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8472
8473Enabled at levels @option{-O2}, @option{-O3}.
8474
8475@item -fno-inline
8476@opindex fno-inline
8477@opindex finline
8478Do not expand any functions inline apart from those marked with
8479the @code{always_inline} attribute.  This is the default when not
8480optimizing.
8481
8482Single functions can be exempted from inlining by marking them
8483with the @code{noinline} attribute.
8484
8485@item -finline-small-functions
8486@opindex finline-small-functions
8487Integrate functions into their callers when their body is smaller than expected
8488function call code (so overall size of program gets smaller).  The compiler
8489heuristically decides which functions are simple enough to be worth integrating
8490in this way.  This inlining applies to all functions, even those not declared
8491inline.
8492
8493Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8494
8495@item -findirect-inlining
8496@opindex findirect-inlining
8497Inline also indirect calls that are discovered to be known at compile
8498time thanks to previous inlining.  This option has any effect only
8499when inlining itself is turned on by the @option{-finline-functions}
8500or @option{-finline-small-functions} options.
8501
8502Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8503
8504@item -finline-functions
8505@opindex finline-functions
8506Consider all functions for inlining, even if they are not declared inline.
8507The compiler heuristically decides which functions are worth integrating
8508in this way.
8509
8510If all calls to a given function are integrated, and the function is
8511declared @code{static}, then the function is normally not output as
8512assembler code in its own right.
8513
8514Enabled at levels @option{-O3}, @option{-Os}.  Also enabled
8515by @option{-fprofile-use} and @option{-fauto-profile}.
8516
8517@item -finline-functions-called-once
8518@opindex finline-functions-called-once
8519Consider all @code{static} functions called once for inlining into their
8520caller even if they are not marked @code{inline}.  If a call to a given
8521function is integrated, then the function is not output as assembler code
8522in its own right.
8523
8524Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8525but not @option{-Og}.
8526
8527@item -fearly-inlining
8528@opindex fearly-inlining
8529Inline functions marked by @code{always_inline} and functions whose body seems
8530smaller than the function call overhead early before doing
8531@option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
8532makes profiling significantly cheaper and usually inlining faster on programs
8533having large chains of nested wrapper functions.
8534
8535Enabled by default.
8536
8537@item -fipa-sra
8538@opindex fipa-sra
8539Perform interprocedural scalar replacement of aggregates, removal of
8540unused parameters and replacement of parameters passed by reference
8541by parameters passed by value.
8542
8543Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8544
8545@item -finline-limit=@var{n}
8546@opindex finline-limit
8547By default, GCC limits the size of functions that can be inlined.  This flag
8548allows coarse control of this limit.  @var{n} is the size of functions that
8549can be inlined in number of pseudo instructions.
8550
8551Inlining is actually controlled by a number of parameters, which may be
8552specified individually by using @option{--param @var{name}=@var{value}}.
8553The @option{-finline-limit=@var{n}} option sets some of these parameters
8554as follows:
8555
8556@table @gcctabopt
8557@item max-inline-insns-single
8558is set to @var{n}/2.
8559@item max-inline-insns-auto
8560is set to @var{n}/2.
8561@end table
8562
8563See below for a documentation of the individual
8564parameters controlling inlining and for the defaults of these parameters.
8565
8566@emph{Note:} there may be no value to @option{-finline-limit} that results
8567in default behavior.
8568
8569@emph{Note:} pseudo instruction represents, in this particular context, an
8570abstract measurement of function's size.  In no way does it represent a count
8571of assembly instructions and as such its exact meaning might change from one
8572release to an another.
8573
8574@item -fno-keep-inline-dllexport
8575@opindex fno-keep-inline-dllexport
8576@opindex fkeep-inline-dllexport
8577This is a more fine-grained version of @option{-fkeep-inline-functions},
8578which applies only to functions that are declared using the @code{dllexport}
8579attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
8580Functions}.
8581
8582@item -fkeep-inline-functions
8583@opindex fkeep-inline-functions
8584In C, emit @code{static} functions that are declared @code{inline}
8585into the object file, even if the function has been inlined into all
8586of its callers.  This switch does not affect functions using the
8587@code{extern inline} extension in GNU C90@.  In C++, emit any and all
8588inline functions into the object file.
8589
8590@item -fkeep-static-functions
8591@opindex fkeep-static-functions
8592Emit @code{static} functions into the object file, even if the function
8593is never used.
8594
8595@item -fkeep-static-consts
8596@opindex fkeep-static-consts
8597Emit variables declared @code{static const} when optimization isn't turned
8598on, even if the variables aren't referenced.
8599
8600GCC enables this option by default.  If you want to force the compiler to
8601check if a variable is referenced, regardless of whether or not
8602optimization is turned on, use the @option{-fno-keep-static-consts} option.
8603
8604@item -fmerge-constants
8605@opindex fmerge-constants
8606Attempt to merge identical constants (string constants and floating-point
8607constants) across compilation units.
8608
8609This option is the default for optimized compilation if the assembler and
8610linker support it.  Use @option{-fno-merge-constants} to inhibit this
8611behavior.
8612
8613Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8614
8615@item -fmerge-all-constants
8616@opindex fmerge-all-constants
8617Attempt to merge identical constants and identical variables.
8618
8619This option implies @option{-fmerge-constants}.  In addition to
8620@option{-fmerge-constants} this considers e.g.@: even constant initialized
8621arrays or initialized constant variables with integral or floating-point
8622types.  Languages like C or C++ require each variable, including multiple
8623instances of the same variable in recursive calls, to have distinct locations,
8624so using this option results in non-conforming
8625behavior.
8626
8627@item -fmodulo-sched
8628@opindex fmodulo-sched
8629Perform swing modulo scheduling immediately before the first scheduling
8630pass.  This pass looks at innermost loops and reorders their
8631instructions by overlapping different iterations.
8632
8633@item -fmodulo-sched-allow-regmoves
8634@opindex fmodulo-sched-allow-regmoves
8635Perform more aggressive SMS-based modulo scheduling with register moves
8636allowed.  By setting this flag certain anti-dependences edges are
8637deleted, which triggers the generation of reg-moves based on the
8638life-range analysis.  This option is effective only with
8639@option{-fmodulo-sched} enabled.
8640
8641@item -fno-branch-count-reg
8642@opindex fno-branch-count-reg
8643@opindex fbranch-count-reg
8644Disable the optimization pass that scans for opportunities to use
8645``decrement and branch'' instructions on a count register instead of
8646instruction sequences that decrement a register, compare it against zero, and
8647then branch based upon the result.  This option is only meaningful on
8648architectures that support such instructions, which include x86, PowerPC,
8649IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
8650doesn't remove the decrement and branch instructions from the generated
8651instruction stream introduced by other optimization passes.
8652
8653The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8654except for @option{-Og}.
8655
8656@item -fno-function-cse
8657@opindex fno-function-cse
8658@opindex ffunction-cse
8659Do not put function addresses in registers; make each instruction that
8660calls a constant function contain the function's address explicitly.
8661
8662This option results in less efficient code, but some strange hacks
8663that alter the assembler output may be confused by the optimizations
8664performed when this option is not used.
8665
8666The default is @option{-ffunction-cse}
8667
8668@item -fno-zero-initialized-in-bss
8669@opindex fno-zero-initialized-in-bss
8670@opindex fzero-initialized-in-bss
8671If the target supports a BSS section, GCC by default puts variables that
8672are initialized to zero into BSS@.  This can save space in the resulting
8673code.
8674
8675This option turns off this behavior because some programs explicitly
8676rely on variables going to the data section---e.g., so that the
8677resulting executable can find the beginning of that section and/or make
8678assumptions based on that.
8679
8680The default is @option{-fzero-initialized-in-bss}.
8681
8682@item -fthread-jumps
8683@opindex fthread-jumps
8684Perform optimizations that check to see if a jump branches to a
8685location where another comparison subsumed by the first is found.  If
8686so, the first branch is redirected to either the destination of the
8687second branch or a point immediately following it, depending on whether
8688the condition is known to be true or false.
8689
8690Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8691
8692@item -fsplit-wide-types
8693@opindex fsplit-wide-types
8694When using a type that occupies multiple registers, such as @code{long
8695long} on a 32-bit system, split the registers apart and allocate them
8696independently.  This normally generates better code for those types,
8697but may make debugging more difficult.
8698
8699Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8700@option{-Os}.
8701
8702@item -fcse-follow-jumps
8703@opindex fcse-follow-jumps
8704In common subexpression elimination (CSE), scan through jump instructions
8705when the target of the jump is not reached by any other path.  For
8706example, when CSE encounters an @code{if} statement with an
8707@code{else} clause, CSE follows the jump when the condition
8708tested is false.
8709
8710Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8711
8712@item -fcse-skip-blocks
8713@opindex fcse-skip-blocks
8714This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8715follow jumps that conditionally skip over blocks.  When CSE
8716encounters a simple @code{if} statement with no else clause,
8717@option{-fcse-skip-blocks} causes CSE to follow the jump around the
8718body of the @code{if}.
8719
8720Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8721
8722@item -frerun-cse-after-loop
8723@opindex frerun-cse-after-loop
8724Re-run common subexpression elimination after loop optimizations are
8725performed.
8726
8727Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8728
8729@item -fgcse
8730@opindex fgcse
8731Perform a global common subexpression elimination pass.
8732This pass also performs global constant and copy propagation.
8733
8734@emph{Note:} When compiling a program using computed gotos, a GCC
8735extension, you may get better run-time performance if you disable
8736the global common subexpression elimination pass by adding
8737@option{-fno-gcse} to the command line.
8738
8739Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8740
8741@item -fgcse-lm
8742@opindex fgcse-lm
8743When @option{-fgcse-lm} is enabled, global common subexpression elimination
8744attempts to move loads that are only killed by stores into themselves.  This
8745allows a loop containing a load/store sequence to be changed to a load outside
8746the loop, and a copy/store within the loop.
8747
8748Enabled by default when @option{-fgcse} is enabled.
8749
8750@item -fgcse-sm
8751@opindex fgcse-sm
8752When @option{-fgcse-sm} is enabled, a store motion pass is run after
8753global common subexpression elimination.  This pass attempts to move
8754stores out of loops.  When used in conjunction with @option{-fgcse-lm},
8755loops containing a load/store sequence can be changed to a load before
8756the loop and a store after the loop.
8757
8758Not enabled at any optimization level.
8759
8760@item -fgcse-las
8761@opindex fgcse-las
8762When @option{-fgcse-las} is enabled, the global common subexpression
8763elimination pass eliminates redundant loads that come after stores to the
8764same memory location (both partial and full redundancies).
8765
8766Not enabled at any optimization level.
8767
8768@item -fgcse-after-reload
8769@opindex fgcse-after-reload
8770When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8771pass is performed after reload.  The purpose of this pass is to clean up
8772redundant spilling.
8773
8774Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8775
8776@item -faggressive-loop-optimizations
8777@opindex faggressive-loop-optimizations
8778This option tells the loop optimizer to use language constraints to
8779derive bounds for the number of iterations of a loop.  This assumes that
8780loop code does not invoke undefined behavior by for example causing signed
8781integer overflows or out-of-bound array accesses.  The bounds for the
8782number of iterations of a loop are used to guide loop unrolling and peeling
8783and loop exit test optimizations.
8784This option is enabled by default.
8785
8786@item -funconstrained-commons
8787@opindex funconstrained-commons
8788This option tells the compiler that variables declared in common blocks
8789(e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8790prevents certain optimizations that depend on knowing the array bounds.
8791
8792@item -fcrossjumping
8793@opindex fcrossjumping
8794Perform cross-jumping transformation.
8795This transformation unifies equivalent code and saves code size.  The
8796resulting code may or may not perform better than without cross-jumping.
8797
8798Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8799
8800@item -fauto-inc-dec
8801@opindex fauto-inc-dec
8802Combine increments or decrements of addresses with memory accesses.
8803This pass is always skipped on architectures that do not have
8804instructions to support this.  Enabled by default at @option{-O} and
8805higher on architectures that support this.
8806
8807@item -fdce
8808@opindex fdce
8809Perform dead code elimination (DCE) on RTL@.
8810Enabled by default at @option{-O} and higher.
8811
8812@item -fdse
8813@opindex fdse
8814Perform dead store elimination (DSE) on RTL@.
8815Enabled by default at @option{-O} and higher.
8816
8817@item -fif-conversion
8818@opindex fif-conversion
8819Attempt to transform conditional jumps into branch-less equivalents.  This
8820includes use of conditional moves, min, max, set flags and abs instructions, and
8821some tricks doable by standard arithmetics.  The use of conditional execution
8822on chips where it is available is controlled by @option{-fif-conversion2}.
8823
8824Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8825not with @option{-Og}.
8826
8827@item -fif-conversion2
8828@opindex fif-conversion2
8829Use conditional execution (where available) to transform conditional jumps into
8830branch-less equivalents.
8831
8832Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8833not with @option{-Og}.
8834
8835@item -fdeclone-ctor-dtor
8836@opindex fdeclone-ctor-dtor
8837The C++ ABI requires multiple entry points for constructors and
8838destructors: one for a base subobject, one for a complete object, and
8839one for a virtual destructor that calls operator delete afterwards.
8840For a hierarchy with virtual bases, the base and complete variants are
8841clones, which means two copies of the function.  With this option, the
8842base and complete variants are changed to be thunks that call a common
8843implementation.
8844
8845Enabled by @option{-Os}.
8846
8847@item -fdelete-null-pointer-checks
8848@opindex fdelete-null-pointer-checks
8849Assume that programs cannot safely dereference null pointers, and that
8850no code or data element resides at address zero.
8851This option enables simple constant
8852folding optimizations at all optimization levels.  In addition, other
8853optimization passes in GCC use this flag to control global dataflow
8854analyses that eliminate useless checks for null pointers; these assume
8855that a memory access to address zero always results in a trap, so
8856that if a pointer is checked after it has already been dereferenced,
8857it cannot be null.
8858
8859Note however that in some environments this assumption is not true.
8860Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8861for programs that depend on that behavior.
8862
8863This option is enabled by default on most targets.  On Nios II ELF, it
8864defaults to off.  On AVR, CR16, and MSP430, this option is completely disabled.
8865
8866Passes that use the dataflow information
8867are enabled independently at different optimization levels.
8868
8869@item -fdevirtualize
8870@opindex fdevirtualize
8871Attempt to convert calls to virtual functions to direct calls.  This
8872is done both within a procedure and interprocedurally as part of
8873indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8874propagation (@option{-fipa-cp}).
8875Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8876
8877@item -fdevirtualize-speculatively
8878@opindex fdevirtualize-speculatively
8879Attempt to convert calls to virtual functions to speculative direct calls.
8880Based on the analysis of the type inheritance graph, determine for a given call
8881the set of likely targets. If the set is small, preferably of size 1, change
8882the call into a conditional deciding between direct and indirect calls.  The
8883speculative calls enable more optimizations, such as inlining.  When they seem
8884useless after further optimization, they are converted back into original form.
8885
8886@item -fdevirtualize-at-ltrans
8887@opindex fdevirtualize-at-ltrans
8888Stream extra information needed for aggressive devirtualization when running
8889the link-time optimizer in local transformation mode.
8890This option enables more devirtualization but
8891significantly increases the size of streamed data. For this reason it is
8892disabled by default.
8893
8894@item -fexpensive-optimizations
8895@opindex fexpensive-optimizations
8896Perform a number of minor optimizations that are relatively expensive.
8897
8898Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8899
8900@item -free
8901@opindex free
8902Attempt to remove redundant extension instructions.  This is especially
8903helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8904registers after writing to their lower 32-bit half.
8905
8906Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8907@option{-O3}, @option{-Os}.
8908
8909@item -fno-lifetime-dse
8910@opindex fno-lifetime-dse
8911@opindex flifetime-dse
8912In C++ the value of an object is only affected by changes within its
8913lifetime: when the constructor begins, the object has an indeterminate
8914value, and any changes during the lifetime of the object are dead when
8915the object is destroyed.  Normally dead store elimination will take
8916advantage of this; if your code relies on the value of the object
8917storage persisting beyond the lifetime of the object, you can use this
8918flag to disable this optimization.  To preserve stores before the
8919constructor starts (e.g.@: because your operator new clears the object
8920storage) but still treat the object as dead after the destructor you,
8921can use @option{-flifetime-dse=1}.  The default behavior can be
8922explicitly selected with @option{-flifetime-dse=2}.
8923@option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8924
8925@item -flive-range-shrinkage
8926@opindex flive-range-shrinkage
8927Attempt to decrease register pressure through register live range
8928shrinkage.  This is helpful for fast processors with small or moderate
8929size register sets.
8930
8931@item -fira-algorithm=@var{algorithm}
8932@opindex fira-algorithm
8933Use the specified coloring algorithm for the integrated register
8934allocator.  The @var{algorithm} argument can be @samp{priority}, which
8935specifies Chow's priority coloring, or @samp{CB}, which specifies
8936Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
8937for all architectures, but for those targets that do support it, it is
8938the default because it generates better code.
8939
8940@item -fira-region=@var{region}
8941@opindex fira-region
8942Use specified regions for the integrated register allocator.  The
8943@var{region} argument should be one of the following:
8944
8945@table @samp
8946
8947@item all
8948Use all loops as register allocation regions.
8949This can give the best results for machines with a small and/or
8950irregular register set.
8951
8952@item mixed
8953Use all loops except for loops with small register pressure
8954as the regions.  This value usually gives
8955the best results in most cases and for most architectures,
8956and is enabled by default when compiling with optimization for speed
8957(@option{-O}, @option{-O2}, @dots{}).
8958
8959@item one
8960Use all functions as a single region.
8961This typically results in the smallest code size, and is enabled by default for
8962@option{-Os} or @option{-O0}.
8963
8964@end table
8965
8966@item -fira-hoist-pressure
8967@opindex fira-hoist-pressure
8968Use IRA to evaluate register pressure in the code hoisting pass for
8969decisions to hoist expressions.  This option usually results in smaller
8970code, but it can slow the compiler down.
8971
8972This option is enabled at level @option{-Os} for all targets.
8973
8974@item -fira-loop-pressure
8975@opindex fira-loop-pressure
8976Use IRA to evaluate register pressure in loops for decisions to move
8977loop invariants.  This option usually results in generation
8978of faster and smaller code on machines with large register files (>= 32
8979registers), but it can slow the compiler down.
8980
8981This option is enabled at level @option{-O3} for some targets.
8982
8983@item -fno-ira-share-save-slots
8984@opindex fno-ira-share-save-slots
8985@opindex fira-share-save-slots
8986Disable sharing of stack slots used for saving call-used hard
8987registers living through a call.  Each hard register gets a
8988separate stack slot, and as a result function stack frames are
8989larger.
8990
8991@item -fno-ira-share-spill-slots
8992@opindex fno-ira-share-spill-slots
8993@opindex fira-share-spill-slots
8994Disable sharing of stack slots allocated for pseudo-registers.  Each
8995pseudo-register that does not get a hard register gets a separate
8996stack slot, and as a result function stack frames are larger.
8997
8998@item -flra-remat
8999@opindex flra-remat
9000Enable CFG-sensitive rematerialization in LRA.  Instead of loading
9001values of spilled pseudos, LRA tries to rematerialize (recalculate)
9002values if it is profitable.
9003
9004Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9005
9006@item -fdelayed-branch
9007@opindex fdelayed-branch
9008If supported for the target machine, attempt to reorder instructions
9009to exploit instruction slots available after delayed branch
9010instructions.
9011
9012Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9013but not at @option{-Og}.
9014
9015@item -fschedule-insns
9016@opindex fschedule-insns
9017If supported for the target machine, attempt to reorder instructions to
9018eliminate execution stalls due to required data being unavailable.  This
9019helps machines that have slow floating point or memory load instructions
9020by allowing other instructions to be issued until the result of the load
9021or floating-point instruction is required.
9022
9023Enabled at levels @option{-O2}, @option{-O3}.
9024
9025@item -fschedule-insns2
9026@opindex fschedule-insns2
9027Similar to @option{-fschedule-insns}, but requests an additional pass of
9028instruction scheduling after register allocation has been done.  This is
9029especially useful on machines with a relatively small number of
9030registers and where memory load instructions take more than one cycle.
9031
9032Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9033
9034@item -fno-sched-interblock
9035@opindex fno-sched-interblock
9036@opindex fsched-interblock
9037Disable instruction scheduling across basic blocks, which
9038is normally enabled when scheduling before register allocation, i.e.@:
9039with @option{-fschedule-insns} or at @option{-O2} or higher.
9040
9041@item -fno-sched-spec
9042@opindex fno-sched-spec
9043@opindex fsched-spec
9044Disable speculative motion of non-load instructions, which
9045is normally enabled when scheduling before register allocation, i.e.@:
9046with @option{-fschedule-insns} or at @option{-O2} or higher.
9047
9048@item -fsched-pressure
9049@opindex fsched-pressure
9050Enable register pressure sensitive insn scheduling before register
9051allocation.  This only makes sense when scheduling before register
9052allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9053@option{-O2} or higher.  Usage of this option can improve the
9054generated code and decrease its size by preventing register pressure
9055increase above the number of available hard registers and subsequent
9056spills in register allocation.
9057
9058@item -fsched-spec-load
9059@opindex fsched-spec-load
9060Allow speculative motion of some load instructions.  This only makes
9061sense when scheduling before register allocation, i.e.@: with
9062@option{-fschedule-insns} or at @option{-O2} or higher.
9063
9064@item -fsched-spec-load-dangerous
9065@opindex fsched-spec-load-dangerous
9066Allow speculative motion of more load instructions.  This only makes
9067sense when scheduling before register allocation, i.e.@: with
9068@option{-fschedule-insns} or at @option{-O2} or higher.
9069
9070@item -fsched-stalled-insns
9071@itemx -fsched-stalled-insns=@var{n}
9072@opindex fsched-stalled-insns
9073Define how many insns (if any) can be moved prematurely from the queue
9074of stalled insns into the ready list during the second scheduling pass.
9075@option{-fno-sched-stalled-insns} means that no insns are moved
9076prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9077on how many queued insns can be moved prematurely.
9078@option{-fsched-stalled-insns} without a value is equivalent to
9079@option{-fsched-stalled-insns=1}.
9080
9081@item -fsched-stalled-insns-dep
9082@itemx -fsched-stalled-insns-dep=@var{n}
9083@opindex fsched-stalled-insns-dep
9084Define how many insn groups (cycles) are examined for a dependency
9085on a stalled insn that is a candidate for premature removal from the queue
9086of stalled insns.  This has an effect only during the second scheduling pass,
9087and only if @option{-fsched-stalled-insns} is used.
9088@option{-fno-sched-stalled-insns-dep} is equivalent to
9089@option{-fsched-stalled-insns-dep=0}.
9090@option{-fsched-stalled-insns-dep} without a value is equivalent to
9091@option{-fsched-stalled-insns-dep=1}.
9092
9093@item -fsched2-use-superblocks
9094@opindex fsched2-use-superblocks
9095When scheduling after register allocation, use superblock scheduling.
9096This allows motion across basic block boundaries,
9097resulting in faster schedules.  This option is experimental, as not all machine
9098descriptions used by GCC model the CPU closely enough to avoid unreliable
9099results from the algorithm.
9100
9101This only makes sense when scheduling after register allocation, i.e.@: with
9102@option{-fschedule-insns2} or at @option{-O2} or higher.
9103
9104@item -fsched-group-heuristic
9105@opindex fsched-group-heuristic
9106Enable the group heuristic in the scheduler.  This heuristic favors
9107the instruction that belongs to a schedule group.  This is enabled
9108by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9109or @option{-fschedule-insns2} or at @option{-O2} or higher.
9110
9111@item -fsched-critical-path-heuristic
9112@opindex fsched-critical-path-heuristic
9113Enable the critical-path heuristic in the scheduler.  This heuristic favors
9114instructions on the critical path.  This is enabled by default when
9115scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9116or @option{-fschedule-insns2} or at @option{-O2} or higher.
9117
9118@item -fsched-spec-insn-heuristic
9119@opindex fsched-spec-insn-heuristic
9120Enable the speculative instruction heuristic in the scheduler.  This
9121heuristic favors speculative instructions with greater dependency weakness.
9122This is enabled by default when scheduling is enabled, i.e.@:
9123with @option{-fschedule-insns} or @option{-fschedule-insns2}
9124or at @option{-O2} or higher.
9125
9126@item -fsched-rank-heuristic
9127@opindex fsched-rank-heuristic
9128Enable the rank heuristic in the scheduler.  This heuristic favors
9129the instruction belonging to a basic block with greater size or frequency.
9130This is enabled by default when scheduling is enabled, i.e.@:
9131with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9132at @option{-O2} or higher.
9133
9134@item -fsched-last-insn-heuristic
9135@opindex fsched-last-insn-heuristic
9136Enable the last-instruction heuristic in the scheduler.  This heuristic
9137favors the instruction that is less dependent on the last instruction
9138scheduled.  This is enabled by default when scheduling is enabled,
9139i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9140at @option{-O2} or higher.
9141
9142@item -fsched-dep-count-heuristic
9143@opindex fsched-dep-count-heuristic
9144Enable the dependent-count heuristic in the scheduler.  This heuristic
9145favors the instruction that has more instructions depending on it.
9146This is enabled by default when scheduling is enabled, i.e.@:
9147with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9148at @option{-O2} or higher.
9149
9150@item -freschedule-modulo-scheduled-loops
9151@opindex freschedule-modulo-scheduled-loops
9152Modulo scheduling is performed before traditional scheduling.  If a loop
9153is modulo scheduled, later scheduling passes may change its schedule.
9154Use this option to control that behavior.
9155
9156@item -fselective-scheduling
9157@opindex fselective-scheduling
9158Schedule instructions using selective scheduling algorithm.  Selective
9159scheduling runs instead of the first scheduler pass.
9160
9161@item -fselective-scheduling2
9162@opindex fselective-scheduling2
9163Schedule instructions using selective scheduling algorithm.  Selective
9164scheduling runs instead of the second scheduler pass.
9165
9166@item -fsel-sched-pipelining
9167@opindex fsel-sched-pipelining
9168Enable software pipelining of innermost loops during selective scheduling.
9169This option has no effect unless one of @option{-fselective-scheduling} or
9170@option{-fselective-scheduling2} is turned on.
9171
9172@item -fsel-sched-pipelining-outer-loops
9173@opindex fsel-sched-pipelining-outer-loops
9174When pipelining loops during selective scheduling, also pipeline outer loops.
9175This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9176
9177@item -fsemantic-interposition
9178@opindex fsemantic-interposition
9179Some object formats, like ELF, allow interposing of symbols by the
9180dynamic linker.
9181This means that for symbols exported from the DSO, the compiler cannot perform
9182interprocedural propagation, inlining and other optimizations in anticipation
9183that the function or variable in question may change. While this feature is
9184useful, for example, to rewrite memory allocation functions by a debugging
9185implementation, it is expensive in the terms of code quality.
9186With @option{-fno-semantic-interposition} the compiler assumes that
9187if interposition happens for functions the overwriting function will have
9188precisely the same semantics (and side effects).
9189Similarly if interposition happens
9190for variables, the constructor of the variable will be the same. The flag
9191has no effect for functions explicitly declared inline
9192(where it is never allowed for interposition to change semantics)
9193and for symbols explicitly declared weak.
9194
9195@item -fshrink-wrap
9196@opindex fshrink-wrap
9197Emit function prologues only before parts of the function that need it,
9198rather than at the top of the function.  This flag is enabled by default at
9199@option{-O} and higher.
9200
9201@item -fshrink-wrap-separate
9202@opindex fshrink-wrap-separate
9203Shrink-wrap separate parts of the prologue and epilogue separately, so that
9204those parts are only executed when needed.
9205This option is on by default, but has no effect unless @option{-fshrink-wrap}
9206is also turned on and the target supports this.
9207
9208@item -fcaller-saves
9209@opindex fcaller-saves
9210Enable allocation of values to registers that are clobbered by
9211function calls, by emitting extra instructions to save and restore the
9212registers around such calls.  Such allocation is done only when it
9213seems to result in better code.
9214
9215This option is always enabled by default on certain machines, usually
9216those which have no call-preserved registers to use instead.
9217
9218Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9219
9220@item -fcombine-stack-adjustments
9221@opindex fcombine-stack-adjustments
9222Tracks stack adjustments (pushes and pops) and stack memory references
9223and then tries to find ways to combine them.
9224
9225Enabled by default at @option{-O1} and higher.
9226
9227@item -fipa-ra
9228@opindex fipa-ra
9229Use caller save registers for allocation if those registers are not used by
9230any called function.  In that case it is not necessary to save and restore
9231them around calls.  This is only possible if called functions are part of
9232same compilation unit as current function and they are compiled before it.
9233
9234Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9235is disabled if generated code will be instrumented for profiling
9236(@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9237exactly (this happens on targets that do not expose prologues
9238and epilogues in RTL).
9239
9240@item -fconserve-stack
9241@opindex fconserve-stack
9242Attempt to minimize stack usage.  The compiler attempts to use less
9243stack space, even if that makes the program slower.  This option
9244implies setting the @option{large-stack-frame} parameter to 100
9245and the @option{large-stack-frame-growth} parameter to 400.
9246
9247@item -ftree-reassoc
9248@opindex ftree-reassoc
9249Perform reassociation on trees.  This flag is enabled by default
9250at @option{-O} and higher.
9251
9252@item -fcode-hoisting
9253@opindex fcode-hoisting
9254Perform code hoisting.  Code hoisting tries to move the
9255evaluation of expressions executed on all paths to the function exit
9256as early as possible.  This is especially useful as a code size
9257optimization, but it often helps for code speed as well.
9258This flag is enabled by default at @option{-O2} and higher.
9259
9260@item -ftree-pre
9261@opindex ftree-pre
9262Perform partial redundancy elimination (PRE) on trees.  This flag is
9263enabled by default at @option{-O2} and @option{-O3}.
9264
9265@item -ftree-partial-pre
9266@opindex ftree-partial-pre
9267Make partial redundancy elimination (PRE) more aggressive.  This flag is
9268enabled by default at @option{-O3}.
9269
9270@item -ftree-forwprop
9271@opindex ftree-forwprop
9272Perform forward propagation on trees.  This flag is enabled by default
9273at @option{-O} and higher.
9274
9275@item -ftree-fre
9276@opindex ftree-fre
9277Perform full redundancy elimination (FRE) on trees.  The difference
9278between FRE and PRE is that FRE only considers expressions
9279that are computed on all paths leading to the redundant computation.
9280This analysis is faster than PRE, though it exposes fewer redundancies.
9281This flag is enabled by default at @option{-O} and higher.
9282
9283@item -ftree-phiprop
9284@opindex ftree-phiprop
9285Perform hoisting of loads from conditional pointers on trees.  This
9286pass is enabled by default at @option{-O} and higher.
9287
9288@item -fhoist-adjacent-loads
9289@opindex fhoist-adjacent-loads
9290Speculatively hoist loads from both branches of an if-then-else if the
9291loads are from adjacent locations in the same structure and the target
9292architecture has a conditional move instruction.  This flag is enabled
9293by default at @option{-O2} and higher.
9294
9295@item -ftree-copy-prop
9296@opindex ftree-copy-prop
9297Perform copy propagation on trees.  This pass eliminates unnecessary
9298copy operations.  This flag is enabled by default at @option{-O} and
9299higher.
9300
9301@item -fipa-pure-const
9302@opindex fipa-pure-const
9303Discover which functions are pure or constant.
9304Enabled by default at @option{-O} and higher.
9305
9306@item -fipa-reference
9307@opindex fipa-reference
9308Discover which static variables do not escape the
9309compilation unit.
9310Enabled by default at @option{-O} and higher.
9311
9312@item -fipa-reference-addressable
9313@opindex fipa-reference-addressable
9314Discover read-only, write-only and non-addressable static variables.
9315Enabled by default at @option{-O} and higher.
9316
9317@item -fipa-stack-alignment
9318@opindex fipa-stack-alignment
9319Reduce stack alignment on call sites if possible.
9320Enabled by default.
9321
9322@item -fipa-pta
9323@opindex fipa-pta
9324Perform interprocedural pointer analysis and interprocedural modification
9325and reference analysis.  This option can cause excessive memory and
9326compile-time usage on large compilation units.  It is not enabled by
9327default at any optimization level.
9328
9329@item -fipa-profile
9330@opindex fipa-profile
9331Perform interprocedural profile propagation.  The functions called only from
9332cold functions are marked as cold. Also functions executed once (such as
9333@code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9334functions and loop less parts of functions executed once are then optimized for
9335size.
9336Enabled by default at @option{-O} and higher.
9337
9338@item -fipa-cp
9339@opindex fipa-cp
9340Perform interprocedural constant propagation.
9341This optimization analyzes the program to determine when values passed
9342to functions are constants and then optimizes accordingly.
9343This optimization can substantially increase performance
9344if the application has constants passed to functions.
9345This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9346It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9347
9348@item -fipa-cp-clone
9349@opindex fipa-cp-clone
9350Perform function cloning to make interprocedural constant propagation stronger.
9351When enabled, interprocedural constant propagation performs function cloning
9352when externally visible function can be called with constant arguments.
9353Because this optimization can create multiple copies of functions,
9354it may significantly increase code size
9355(see @option{--param ipcp-unit-growth=@var{value}}).
9356This flag is enabled by default at @option{-O3}.
9357It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9358
9359@item -fipa-bit-cp
9360@opindex fipa-bit-cp
9361When enabled, perform interprocedural bitwise constant
9362propagation. This flag is enabled by default at @option{-O2} and
9363by @option{-fprofile-use} and @option{-fauto-profile}.
9364It requires that @option{-fipa-cp} is enabled.
9365
9366@item -fipa-vrp
9367@opindex fipa-vrp
9368When enabled, perform interprocedural propagation of value
9369ranges. This flag is enabled by default at @option{-O2}. It requires
9370that @option{-fipa-cp} is enabled.
9371
9372@item -fipa-icf
9373@opindex fipa-icf
9374Perform Identical Code Folding for functions and read-only variables.
9375The optimization reduces code size and may disturb unwind stacks by replacing
9376a function by equivalent one with a different name. The optimization works
9377more effectively with link-time optimization enabled.
9378
9379Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9380works on different levels and thus the optimizations are not same - there are
9381equivalences that are found only by GCC and equivalences found only by Gold.
9382
9383This flag is enabled by default at @option{-O2} and @option{-Os}.
9384
9385@item -flive-patching=@var{level}
9386@opindex flive-patching
9387Control GCC's optimizations to produce output suitable for live-patching.
9388
9389If the compiler's optimization uses a function's body or information extracted
9390from its body to optimize/change another function, the latter is called an
9391impacted function of the former.  If a function is patched, its impacted
9392functions should be patched too.
9393
9394The impacted functions are determined by the compiler's interprocedural
9395optimizations.  For example, a caller is impacted when inlining a function
9396into its caller,
9397cloning a function and changing its caller to call this new clone,
9398or extracting a function's pureness/constness information to optimize
9399its direct or indirect callers, etc.
9400
9401Usually, the more IPA optimizations enabled, the larger the number of
9402impacted functions for each function.  In order to control the number of
9403impacted functions and more easily compute the list of impacted function,
9404IPA optimizations can be partially enabled at two different levels.
9405
9406The @var{level} argument should be one of the following:
9407
9408@table @samp
9409
9410@item inline-clone
9411
9412Only enable inlining and cloning optimizations, which includes inlining,
9413cloning, interprocedural scalar replacement of aggregates and partial inlining.
9414As a result, when patching a function, all its callers and its clones'
9415callers are impacted, therefore need to be patched as well.
9416
9417@option{-flive-patching=inline-clone} disables the following optimization flags:
9418@gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra @gol
9419-fipa-icf  -fipa-icf-functions  -fipa-icf-variables @gol
9420-fipa-bit-cp  -fipa-vrp  -fipa-pure-const  -fipa-reference-addressable @gol
9421-fipa-stack-alignment}
9422
9423@item inline-only-static
9424
9425Only enable inlining of static functions.
9426As a result, when patching a static function, all its callers are impacted
9427and so need to be patched as well.
9428
9429In addition to all the flags that @option{-flive-patching=inline-clone}
9430disables,
9431@option{-flive-patching=inline-only-static} disables the following additional
9432optimization flags:
9433@gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
9434
9435@end table
9436
9437When @option{-flive-patching} is specified without any value, the default value
9438is @var{inline-clone}.
9439
9440This flag is disabled by default.
9441
9442Note that @option{-flive-patching} is not supported with link-time optimization
9443(@option{-flto}).
9444
9445@item -fisolate-erroneous-paths-dereference
9446@opindex fisolate-erroneous-paths-dereference
9447Detect paths that trigger erroneous or undefined behavior due to
9448dereferencing a null pointer.  Isolate those paths from the main control
9449flow and turn the statement with erroneous or undefined behavior into a trap.
9450This flag is enabled by default at @option{-O2} and higher and depends on
9451@option{-fdelete-null-pointer-checks} also being enabled.
9452
9453@item -fisolate-erroneous-paths-attribute
9454@opindex fisolate-erroneous-paths-attribute
9455Detect paths that trigger erroneous or undefined behavior due to a null value
9456being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9457attribute.  Isolate those paths from the main control flow and turn the
9458statement with erroneous or undefined behavior into a trap.  This is not
9459currently enabled, but may be enabled by @option{-O2} in the future.
9460
9461@item -ftree-sink
9462@opindex ftree-sink
9463Perform forward store motion on trees.  This flag is
9464enabled by default at @option{-O} and higher.
9465
9466@item -ftree-bit-ccp
9467@opindex ftree-bit-ccp
9468Perform sparse conditional bit constant propagation on trees and propagate
9469pointer alignment information.
9470This pass only operates on local scalar variables and is enabled by default
9471at @option{-O1} and higher, except for @option{-Og}.
9472It requires that @option{-ftree-ccp} is enabled.
9473
9474@item -ftree-ccp
9475@opindex ftree-ccp
9476Perform sparse conditional constant propagation (CCP) on trees.  This
9477pass only operates on local scalar variables and is enabled by default
9478at @option{-O} and higher.
9479
9480@item -fssa-backprop
9481@opindex fssa-backprop
9482Propagate information about uses of a value up the definition chain
9483in order to simplify the definitions.  For example, this pass strips
9484sign operations if the sign of a value never matters.  The flag is
9485enabled by default at @option{-O} and higher.
9486
9487@item -fssa-phiopt
9488@opindex fssa-phiopt
9489Perform pattern matching on SSA PHI nodes to optimize conditional
9490code.  This pass is enabled by default at @option{-O1} and higher,
9491except for @option{-Og}.
9492
9493@item -ftree-switch-conversion
9494@opindex ftree-switch-conversion
9495Perform conversion of simple initializations in a switch to
9496initializations from a scalar array.  This flag is enabled by default
9497at @option{-O2} and higher.
9498
9499@item -ftree-tail-merge
9500@opindex ftree-tail-merge
9501Look for identical code sequences.  When found, replace one with a jump to the
9502other.  This optimization is known as tail merging or cross jumping.  This flag
9503is enabled by default at @option{-O2} and higher.  The compilation time
9504in this pass can
9505be limited using @option{max-tail-merge-comparisons} parameter and
9506@option{max-tail-merge-iterations} parameter.
9507
9508@item -ftree-dce
9509@opindex ftree-dce
9510Perform dead code elimination (DCE) on trees.  This flag is enabled by
9511default at @option{-O} and higher.
9512
9513@item -ftree-builtin-call-dce
9514@opindex ftree-builtin-call-dce
9515Perform conditional dead code elimination (DCE) for calls to built-in functions
9516that may set @code{errno} but are otherwise free of side effects.  This flag is
9517enabled by default at @option{-O2} and higher if @option{-Os} is not also
9518specified.
9519
9520@item -ftree-dominator-opts
9521@opindex ftree-dominator-opts
9522Perform a variety of simple scalar cleanups (constant/copy
9523propagation, redundancy elimination, range propagation and expression
9524simplification) based on a dominator tree traversal.  This also
9525performs jump threading (to reduce jumps to jumps). This flag is
9526enabled by default at @option{-O} and higher.
9527
9528@item -ftree-dse
9529@opindex ftree-dse
9530Perform dead store elimination (DSE) on trees.  A dead store is a store into
9531a memory location that is later overwritten by another store without
9532any intervening loads.  In this case the earlier store can be deleted.  This
9533flag is enabled by default at @option{-O} and higher.
9534
9535@item -ftree-ch
9536@opindex ftree-ch
9537Perform loop header copying on trees.  This is beneficial since it increases
9538effectiveness of code motion optimizations.  It also saves one jump.  This flag
9539is enabled by default at @option{-O} and higher.  It is not enabled
9540for @option{-Os}, since it usually increases code size.
9541
9542@item -ftree-loop-optimize
9543@opindex ftree-loop-optimize
9544Perform loop optimizations on trees.  This flag is enabled by default
9545at @option{-O} and higher.
9546
9547@item -ftree-loop-linear
9548@itemx -floop-strip-mine
9549@itemx -floop-block
9550@opindex ftree-loop-linear
9551@opindex floop-strip-mine
9552@opindex floop-block
9553Perform loop nest optimizations.  Same as
9554@option{-floop-nest-optimize}.  To use this code transformation, GCC has
9555to be configured with @option{--with-isl} to enable the Graphite loop
9556transformation infrastructure.
9557
9558@item -fgraphite-identity
9559@opindex fgraphite-identity
9560Enable the identity transformation for graphite.  For every SCoP we generate
9561the polyhedral representation and transform it back to gimple.  Using
9562@option{-fgraphite-identity} we can check the costs or benefits of the
9563GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
9564are also performed by the code generator isl, like index splitting and
9565dead code elimination in loops.
9566
9567@item -floop-nest-optimize
9568@opindex floop-nest-optimize
9569Enable the isl based loop nest optimizer.  This is a generic loop nest
9570optimizer based on the Pluto optimization algorithms.  It calculates a loop
9571structure optimized for data-locality and parallelism.  This option
9572is experimental.
9573
9574@item -floop-parallelize-all
9575@opindex floop-parallelize-all
9576Use the Graphite data dependence analysis to identify loops that can
9577be parallelized.  Parallelize all the loops that can be analyzed to
9578not contain loop carried dependences without checking that it is
9579profitable to parallelize the loops.
9580
9581@item -ftree-coalesce-vars
9582@opindex ftree-coalesce-vars
9583While transforming the program out of the SSA representation, attempt to
9584reduce copying by coalescing versions of different user-defined
9585variables, instead of just compiler temporaries.  This may severely
9586limit the ability to debug an optimized program compiled with
9587@option{-fno-var-tracking-assignments}.  In the negated form, this flag
9588prevents SSA coalescing of user variables.  This option is enabled by
9589default if optimization is enabled, and it does very little otherwise.
9590
9591@item -ftree-loop-if-convert
9592@opindex ftree-loop-if-convert
9593Attempt to transform conditional jumps in the innermost loops to
9594branch-less equivalents.  The intent is to remove control-flow from
9595the innermost loops in order to improve the ability of the
9596vectorization pass to handle these loops.  This is enabled by default
9597if vectorization is enabled.
9598
9599@item -ftree-loop-distribution
9600@opindex ftree-loop-distribution
9601Perform loop distribution.  This flag can improve cache performance on
9602big loop bodies and allow further loop optimizations, like
9603parallelization or vectorization, to take place.  For example, the loop
9604@smallexample
9605DO I = 1, N
9606  A(I) = B(I) + C
9607  D(I) = E(I) * F
9608ENDDO
9609@end smallexample
9610is transformed to
9611@smallexample
9612DO I = 1, N
9613   A(I) = B(I) + C
9614ENDDO
9615DO I = 1, N
9616   D(I) = E(I) * F
9617ENDDO
9618@end smallexample
9619This flag is enabled by default at @option{-O3}.
9620It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9621
9622@item -ftree-loop-distribute-patterns
9623@opindex ftree-loop-distribute-patterns
9624Perform loop distribution of patterns that can be code generated with
9625calls to a library.  This flag is enabled by default at @option{-O3}, and
9626by @option{-fprofile-use} and @option{-fauto-profile}.
9627
9628This pass distributes the initialization loops and generates a call to
9629memset zero.  For example, the loop
9630@smallexample
9631DO I = 1, N
9632  A(I) = 0
9633  B(I) = A(I) + I
9634ENDDO
9635@end smallexample
9636is transformed to
9637@smallexample
9638DO I = 1, N
9639   A(I) = 0
9640ENDDO
9641DO I = 1, N
9642   B(I) = A(I) + I
9643ENDDO
9644@end smallexample
9645and the initialization loop is transformed into a call to memset zero.
9646This flag is enabled by default at @option{-O3}.
9647It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9648
9649@item -floop-interchange
9650@opindex floop-interchange
9651Perform loop interchange outside of graphite.  This flag can improve cache
9652performance on loop nest and allow further loop optimizations, like
9653vectorization, to take place.  For example, the loop
9654@smallexample
9655for (int i = 0; i < N; i++)
9656  for (int j = 0; j < N; j++)
9657    for (int k = 0; k < N; k++)
9658      c[i][j] = c[i][j] + a[i][k]*b[k][j];
9659@end smallexample
9660is transformed to
9661@smallexample
9662for (int i = 0; i < N; i++)
9663  for (int k = 0; k < N; k++)
9664    for (int j = 0; j < N; j++)
9665      c[i][j] = c[i][j] + a[i][k]*b[k][j];
9666@end smallexample
9667This flag is enabled by default at @option{-O3}.
9668It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9669
9670@item -floop-unroll-and-jam
9671@opindex floop-unroll-and-jam
9672Apply unroll and jam transformations on feasible loops.  In a loop
9673nest this unrolls the outer loop by some factor and fuses the resulting
9674multiple inner loops.  This flag is enabled by default at @option{-O3}.
9675It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9676
9677@item -ftree-loop-im
9678@opindex ftree-loop-im
9679Perform loop invariant motion on trees.  This pass moves only invariants that
9680are hard to handle at RTL level (function calls, operations that expand to
9681nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
9682operands of conditions that are invariant out of the loop, so that we can use
9683just trivial invariantness analysis in loop unswitching.  The pass also includes
9684store motion.
9685
9686@item -ftree-loop-ivcanon
9687@opindex ftree-loop-ivcanon
9688Create a canonical counter for number of iterations in loops for which
9689determining number of iterations requires complicated analysis.  Later
9690optimizations then may determine the number easily.  Useful especially
9691in connection with unrolling.
9692
9693@item -ftree-scev-cprop
9694@opindex ftree-scev-cprop
9695Perform final value replacement.  If a variable is modified in a loop
9696in such a way that its value when exiting the loop can be determined using
9697only its initial value and the number of loop iterations, replace uses of
9698the final value by such a computation, provided it is sufficiently cheap.
9699This reduces data dependencies and may allow further simplifications.
9700Enabled by default at @option{-O} and higher.
9701
9702@item -fivopts
9703@opindex fivopts
9704Perform induction variable optimizations (strength reduction, induction
9705variable merging and induction variable elimination) on trees.
9706
9707@item -ftree-parallelize-loops=n
9708@opindex ftree-parallelize-loops
9709Parallelize loops, i.e., split their iteration space to run in n threads.
9710This is only possible for loops whose iterations are independent
9711and can be arbitrarily reordered.  The optimization is only
9712profitable on multiprocessor machines, for loops that are CPU-intensive,
9713rather than constrained e.g.@: by memory bandwidth.  This option
9714implies @option{-pthread}, and thus is only supported on targets
9715that have support for @option{-pthread}.
9716
9717@item -ftree-pta
9718@opindex ftree-pta
9719Perform function-local points-to analysis on trees.  This flag is
9720enabled by default at @option{-O1} and higher, except for @option{-Og}.
9721
9722@item -ftree-sra
9723@opindex ftree-sra
9724Perform scalar replacement of aggregates.  This pass replaces structure
9725references with scalars to prevent committing structures to memory too
9726early.  This flag is enabled by default at @option{-O1} and higher,
9727except for @option{-Og}.
9728
9729@item -fstore-merging
9730@opindex fstore-merging
9731Perform merging of narrow stores to consecutive memory addresses.  This pass
9732merges contiguous stores of immediate values narrower than a word into fewer
9733wider stores to reduce the number of instructions.  This is enabled by default
9734at @option{-O2} and higher as well as @option{-Os}.
9735
9736@item -ftree-ter
9737@opindex ftree-ter
9738Perform temporary expression replacement during the SSA->normal phase.  Single
9739use/single def temporaries are replaced at their use location with their
9740defining expression.  This results in non-GIMPLE code, but gives the expanders
9741much more complex trees to work on resulting in better RTL generation.  This is
9742enabled by default at @option{-O} and higher.
9743
9744@item -ftree-slsr
9745@opindex ftree-slsr
9746Perform straight-line strength reduction on trees.  This recognizes related
9747expressions involving multiplications and replaces them by less expensive
9748calculations when possible.  This is enabled by default at @option{-O} and
9749higher.
9750
9751@item -ftree-vectorize
9752@opindex ftree-vectorize
9753Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9754and @option{-ftree-slp-vectorize} if not explicitly specified.
9755
9756@item -ftree-loop-vectorize
9757@opindex ftree-loop-vectorize
9758Perform loop vectorization on trees. This flag is enabled by default at
9759@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9760and @option{-fauto-profile}.
9761
9762@item -ftree-slp-vectorize
9763@opindex ftree-slp-vectorize
9764Perform basic block vectorization on trees. This flag is enabled by default at
9765@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9766and @option{-fauto-profile}.
9767
9768@item -fvect-cost-model=@var{model}
9769@opindex fvect-cost-model
9770Alter the cost model used for vectorization.  The @var{model} argument
9771should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9772With the @samp{unlimited} model the vectorized code-path is assumed
9773to be profitable while with the @samp{dynamic} model a runtime check
9774guards the vectorized code-path to enable it only for iteration
9775counts that will likely execute faster than when executing the original
9776scalar loop.  The @samp{cheap} model disables vectorization of
9777loops where doing so would be cost prohibitive for example due to
9778required runtime checks for data dependence or alignment but otherwise
9779is equal to the @samp{dynamic} model.
9780The default cost model depends on other optimization flags and is
9781either @samp{dynamic} or @samp{cheap}.
9782
9783@item -fsimd-cost-model=@var{model}
9784@opindex fsimd-cost-model
9785Alter the cost model used for vectorization of loops marked with the OpenMP
9786simd directive.  The @var{model} argument should be one of
9787@samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
9788have the same meaning as described in @option{-fvect-cost-model} and by
9789default a cost model defined with @option{-fvect-cost-model} is used.
9790
9791@item -ftree-vrp
9792@opindex ftree-vrp
9793Perform Value Range Propagation on trees.  This is similar to the
9794constant propagation pass, but instead of values, ranges of values are
9795propagated.  This allows the optimizers to remove unnecessary range
9796checks like array bound checks and null pointer checks.  This is
9797enabled by default at @option{-O2} and higher.  Null pointer check
9798elimination is only done if @option{-fdelete-null-pointer-checks} is
9799enabled.
9800
9801@item -fsplit-paths
9802@opindex fsplit-paths
9803Split paths leading to loop backedges.  This can improve dead code
9804elimination and common subexpression elimination.  This is enabled by
9805default at @option{-O3} and above.
9806
9807@item -fsplit-ivs-in-unroller
9808@opindex fsplit-ivs-in-unroller
9809Enables expression of values of induction variables in later iterations
9810of the unrolled loop using the value in the first iteration.  This breaks
9811long dependency chains, thus improving efficiency of the scheduling passes.
9812
9813A combination of @option{-fweb} and CSE is often sufficient to obtain the
9814same effect.  However, that is not reliable in cases where the loop body
9815is more complicated than a single basic block.  It also does not work at all
9816on some architectures due to restrictions in the CSE pass.
9817
9818This optimization is enabled by default.
9819
9820@item -fvariable-expansion-in-unroller
9821@opindex fvariable-expansion-in-unroller
9822With this option, the compiler creates multiple copies of some
9823local variables when unrolling a loop, which can result in superior code.
9824
9825@item -fpartial-inlining
9826@opindex fpartial-inlining
9827Inline parts of functions.  This option has any effect only
9828when inlining itself is turned on by the @option{-finline-functions}
9829or @option{-finline-small-functions} options.
9830
9831Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9832
9833@item -fpredictive-commoning
9834@opindex fpredictive-commoning
9835Perform predictive commoning optimization, i.e., reusing computations
9836(especially memory loads and stores) performed in previous
9837iterations of loops.
9838
9839This option is enabled at level @option{-O3}.
9840It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9841
9842@item -fprefetch-loop-arrays
9843@opindex fprefetch-loop-arrays
9844If supported by the target machine, generate instructions to prefetch
9845memory to improve the performance of loops that access large arrays.
9846
9847This option may generate better or worse code; results are highly
9848dependent on the structure of loops within the source code.
9849
9850Disabled at level @option{-Os}.
9851
9852@item -fno-printf-return-value
9853@opindex fno-printf-return-value
9854@opindex fprintf-return-value
9855Do not substitute constants for known return value of formatted output
9856functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9857@code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
9858transformation allows GCC to optimize or even eliminate branches based
9859on the known return value of these functions called with arguments that
9860are either constant, or whose values are known to be in a range that
9861makes determining the exact return value possible.  For example, when
9862@option{-fprintf-return-value} is in effect, both the branch and the
9863body of the @code{if} statement (but not the call to @code{snprint})
9864can be optimized away when @code{i} is a 32-bit or smaller integer
9865because the return value is guaranteed to be at most 8.
9866
9867@smallexample
9868char buf[9];
9869if (snprintf (buf, "%08x", i) >= sizeof buf)
9870  @dots{}
9871@end smallexample
9872
9873The @option{-fprintf-return-value} option relies on other optimizations
9874and yields best results with @option{-O2} and above.  It works in tandem
9875with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9876options.  The @option{-fprintf-return-value} option is enabled by default.
9877
9878@item -fno-peephole
9879@itemx -fno-peephole2
9880@opindex fno-peephole
9881@opindex fpeephole
9882@opindex fno-peephole2
9883@opindex fpeephole2
9884Disable any machine-specific peephole optimizations.  The difference
9885between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9886are implemented in the compiler; some targets use one, some use the
9887other, a few use both.
9888
9889@option{-fpeephole} is enabled by default.
9890@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9891
9892@item -fno-guess-branch-probability
9893@opindex fno-guess-branch-probability
9894@opindex fguess-branch-probability
9895Do not guess branch probabilities using heuristics.
9896
9897GCC uses heuristics to guess branch probabilities if they are
9898not provided by profiling feedback (@option{-fprofile-arcs}).  These
9899heuristics are based on the control flow graph.  If some branch probabilities
9900are specified by @code{__builtin_expect}, then the heuristics are
9901used to guess branch probabilities for the rest of the control flow graph,
9902taking the @code{__builtin_expect} info into account.  The interactions
9903between the heuristics and @code{__builtin_expect} can be complex, and in
9904some cases, it may be useful to disable the heuristics so that the effects
9905of @code{__builtin_expect} are easier to understand.
9906
9907It is also possible to specify expected probability of the expression
9908with @code{__builtin_expect_with_probability} built-in function.
9909
9910The default is @option{-fguess-branch-probability} at levels
9911@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9912
9913@item -freorder-blocks
9914@opindex freorder-blocks
9915Reorder basic blocks in the compiled function in order to reduce number of
9916taken branches and improve code locality.
9917
9918Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9919
9920@item -freorder-blocks-algorithm=@var{algorithm}
9921@opindex freorder-blocks-algorithm
9922Use the specified algorithm for basic block reordering.  The
9923@var{algorithm} argument can be @samp{simple}, which does not increase
9924code size (except sometimes due to secondary effects like alignment),
9925or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9926put all often executed code together, minimizing the number of branches
9927executed by making extra copies of code.
9928
9929The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9930@samp{stc} at levels @option{-O2}, @option{-O3}.
9931
9932@item -freorder-blocks-and-partition
9933@opindex freorder-blocks-and-partition
9934In addition to reordering basic blocks in the compiled function, in order
9935to reduce number of taken branches, partitions hot and cold basic blocks
9936into separate sections of the assembly and @file{.o} files, to improve
9937paging and cache locality performance.
9938
9939This optimization is automatically turned off in the presence of
9940exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9941section attribute and on any architecture that does not support named
9942sections.  When @option{-fsplit-stack} is used this option is not
9943enabled by default (to avoid linker errors), but may be enabled
9944explicitly (if using a working linker).
9945
9946Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9947
9948@item -freorder-functions
9949@opindex freorder-functions
9950Reorder functions in the object file in order to
9951improve code locality.  This is implemented by using special
9952subsections @code{.text.hot} for most frequently executed functions and
9953@code{.text.unlikely} for unlikely executed functions.  Reordering is done by
9954the linker so object file format must support named sections and linker must
9955place them in a reasonable way.
9956
9957This option isn't effective unless you either provide profile feedback
9958(see @option{-fprofile-arcs} for details) or manually annotate functions with
9959@code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
9960
9961Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9962
9963@item -fstrict-aliasing
9964@opindex fstrict-aliasing
9965Allow the compiler to assume the strictest aliasing rules applicable to
9966the language being compiled.  For C (and C++), this activates
9967optimizations based on the type of expressions.  In particular, an
9968object of one type is assumed never to reside at the same address as an
9969object of a different type, unless the types are almost the same.  For
9970example, an @code{unsigned int} can alias an @code{int}, but not a
9971@code{void*} or a @code{double}.  A character type may alias any other
9972type.
9973
9974@anchor{Type-punning}Pay special attention to code like this:
9975@smallexample
9976union a_union @{
9977  int i;
9978  double d;
9979@};
9980
9981int f() @{
9982  union a_union t;
9983  t.d = 3.0;
9984  return t.i;
9985@}
9986@end smallexample
9987The practice of reading from a different union member than the one most
9988recently written to (called ``type-punning'') is common.  Even with
9989@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9990is accessed through the union type.  So, the code above works as
9991expected.  @xref{Structures unions enumerations and bit-fields
9992implementation}.  However, this code might not:
9993@smallexample
9994int f() @{
9995  union a_union t;
9996  int* ip;
9997  t.d = 3.0;
9998  ip = &t.i;
9999  return *ip;
10000@}
10001@end smallexample
10002
10003Similarly, access by taking the address, casting the resulting pointer
10004and dereferencing the result has undefined behavior, even if the cast
10005uses a union type, e.g.:
10006@smallexample
10007int f() @{
10008  double d = 3.0;
10009  return ((union a_union *) &d)->i;
10010@}
10011@end smallexample
10012
10013The @option{-fstrict-aliasing} option is enabled at levels
10014@option{-O2}, @option{-O3}, @option{-Os}.
10015
10016@item -falign-functions
10017@itemx -falign-functions=@var{n}
10018@itemx -falign-functions=@var{n}:@var{m}
10019@itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10020@itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10021@opindex falign-functions
10022Align the start of functions to the next power-of-two greater than
10023@var{n}, skipping up to @var{m}-1 bytes.  This ensures that at least
10024the first @var{m} bytes of the function can be fetched by the CPU
10025without crossing an @var{n}-byte alignment boundary.
10026
10027If @var{m} is not specified, it defaults to @var{n}.
10028
10029Examples: @option{-falign-functions=32} aligns functions to the next
1003032-byte boundary, @option{-falign-functions=24} aligns to the next
1003132-byte boundary only if this can be done by skipping 23 bytes or less,
10032@option{-falign-functions=32:7} aligns to the next
1003332-byte boundary only if this can be done by skipping 6 bytes or less.
10034
10035The second pair of @var{n2}:@var{m2} values allows you to specify
10036a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10037the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10038otherwise aligns to the next 32-byte boundary if this can be done
10039by skipping 2 bytes or less.
10040If @var{m2} is not specified, it defaults to @var{n2}.
10041
10042Some assemblers only support this flag when @var{n} is a power of two;
10043in that case, it is rounded up.
10044
10045@option{-fno-align-functions} and @option{-falign-functions=1} are
10046equivalent and mean that functions are not aligned.
10047
10048If @var{n} is not specified or is zero, use a machine-dependent default.
10049The maximum allowed @var{n} option value is 65536.
10050
10051Enabled at levels @option{-O2}, @option{-O3}.
10052
10053@item -flimit-function-alignment
10054If this option is enabled, the compiler tries to avoid unnecessarily
10055overaligning functions. It attempts to instruct the assembler to align
10056by the amount specified by @option{-falign-functions}, but not to
10057skip more bytes than the size of the function.
10058
10059@item -falign-labels
10060@itemx -falign-labels=@var{n}
10061@itemx -falign-labels=@var{n}:@var{m}
10062@itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10063@itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10064@opindex falign-labels
10065Align all branch targets to a power-of-two boundary.
10066
10067Parameters of this option are analogous to the @option{-falign-functions} option.
10068@option{-fno-align-labels} and @option{-falign-labels=1} are
10069equivalent and mean that labels are not aligned.
10070
10071If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10072are greater than this value, then their values are used instead.
10073
10074If @var{n} is not specified or is zero, use a machine-dependent default
10075which is very likely to be @samp{1}, meaning no alignment.
10076The maximum allowed @var{n} option value is 65536.
10077
10078Enabled at levels @option{-O2}, @option{-O3}.
10079
10080@item -falign-loops
10081@itemx -falign-loops=@var{n}
10082@itemx -falign-loops=@var{n}:@var{m}
10083@itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10084@itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10085@opindex falign-loops
10086Align loops to a power-of-two boundary.  If the loops are executed
10087many times, this makes up for any execution of the dummy padding
10088instructions.
10089
10090Parameters of this option are analogous to the @option{-falign-functions} option.
10091@option{-fno-align-loops} and @option{-falign-loops=1} are
10092equivalent and mean that loops are not aligned.
10093The maximum allowed @var{n} option value is 65536.
10094
10095If @var{n} is not specified or is zero, use a machine-dependent default.
10096
10097Enabled at levels @option{-O2}, @option{-O3}.
10098
10099@item -falign-jumps
10100@itemx -falign-jumps=@var{n}
10101@itemx -falign-jumps=@var{n}:@var{m}
10102@itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10103@itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10104@opindex falign-jumps
10105Align branch targets to a power-of-two boundary, for branch targets
10106where the targets can only be reached by jumping.  In this case,
10107no dummy operations need be executed.
10108
10109Parameters of this option are analogous to the @option{-falign-functions} option.
10110@option{-fno-align-jumps} and @option{-falign-jumps=1} are
10111equivalent and mean that loops are not aligned.
10112
10113If @var{n} is not specified or is zero, use a machine-dependent default.
10114The maximum allowed @var{n} option value is 65536.
10115
10116Enabled at levels @option{-O2}, @option{-O3}.
10117
10118@item -funit-at-a-time
10119@opindex funit-at-a-time
10120This option is left for compatibility reasons. @option{-funit-at-a-time}
10121has no effect, while @option{-fno-unit-at-a-time} implies
10122@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10123
10124Enabled by default.
10125
10126@item -fno-toplevel-reorder
10127@opindex fno-toplevel-reorder
10128@opindex ftoplevel-reorder
10129Do not reorder top-level functions, variables, and @code{asm}
10130statements.  Output them in the same order that they appear in the
10131input file.  When this option is used, unreferenced static variables
10132are not removed.  This option is intended to support existing code
10133that relies on a particular ordering.  For new code, it is better to
10134use attributes when possible.
10135
10136@option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10137also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10138Additionally @option{-fno-toplevel-reorder} implies
10139@option{-fno-section-anchors}.
10140
10141@item -fweb
10142@opindex fweb
10143Constructs webs as commonly used for register allocation purposes and assign
10144each web individual pseudo register.  This allows the register allocation pass
10145to operate on pseudos directly, but also strengthens several other optimization
10146passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
10147however, make debugging impossible, since variables no longer stay in a
10148``home register''.
10149
10150Enabled by default with @option{-funroll-loops}.
10151
10152@item -fwhole-program
10153@opindex fwhole-program
10154Assume that the current compilation unit represents the whole program being
10155compiled.  All public functions and variables with the exception of @code{main}
10156and those merged by attribute @code{externally_visible} become static functions
10157and in effect are optimized more aggressively by interprocedural optimizers.
10158
10159This option should not be used in combination with @option{-flto}.
10160Instead relying on a linker plugin should provide safer and more precise
10161information.
10162
10163@item -flto[=@var{n}]
10164@opindex flto
10165This option runs the standard link-time optimizer.  When invoked
10166with source code, it generates GIMPLE (one of GCC's internal
10167representations) and writes it to special ELF sections in the object
10168file.  When the object files are linked together, all the function
10169bodies are read from these ELF sections and instantiated as if they
10170had been part of the same translation unit.
10171
10172To use the link-time optimizer, @option{-flto} and optimization
10173options should be specified at compile time and during the final link.
10174It is recommended that you compile all the files participating in the
10175same link with the same options and also specify those options at
10176link time.
10177For example:
10178
10179@smallexample
10180gcc -c -O2 -flto foo.c
10181gcc -c -O2 -flto bar.c
10182gcc -o myprog -flto -O2 foo.o bar.o
10183@end smallexample
10184
10185The first two invocations to GCC save a bytecode representation
10186of GIMPLE into special ELF sections inside @file{foo.o} and
10187@file{bar.o}.  The final invocation reads the GIMPLE bytecode from
10188@file{foo.o} and @file{bar.o}, merges the two files into a single
10189internal image, and compiles the result as usual.  Since both
10190@file{foo.o} and @file{bar.o} are merged into a single image, this
10191causes all the interprocedural analyses and optimizations in GCC to
10192work across the two files as if they were a single one.  This means,
10193for example, that the inliner is able to inline functions in
10194@file{bar.o} into functions in @file{foo.o} and vice-versa.
10195
10196Another (simpler) way to enable link-time optimization is:
10197
10198@smallexample
10199gcc -o myprog -flto -O2 foo.c bar.c
10200@end smallexample
10201
10202The above generates bytecode for @file{foo.c} and @file{bar.c},
10203merges them together into a single GIMPLE representation and optimizes
10204them as usual to produce @file{myprog}.
10205
10206The important thing to keep in mind is that to enable link-time
10207optimizations you need to use the GCC driver to perform the link step.
10208GCC automatically performs link-time optimization if any of the
10209objects involved were compiled with the @option{-flto} command-line option.
10210You can always override
10211the automatic decision to do link-time optimization
10212by passing @option{-fno-lto} to the link command.
10213
10214To make whole program optimization effective, it is necessary to make
10215certain whole program assumptions.  The compiler needs to know
10216what functions and variables can be accessed by libraries and runtime
10217outside of the link-time optimized unit.  When supported by the linker,
10218the linker plugin (see @option{-fuse-linker-plugin}) passes information
10219to the compiler about used and externally visible symbols.  When
10220the linker plugin is not available, @option{-fwhole-program} should be
10221used to allow the compiler to make these assumptions, which leads
10222to more aggressive optimization decisions.
10223
10224When a file is compiled with @option{-flto} without
10225@option{-fuse-linker-plugin}, the generated object file is larger than
10226a regular object file because it contains GIMPLE bytecodes and the usual
10227final code (see @option{-ffat-lto-objects}.  This means that
10228object files with LTO information can be linked as normal object
10229files; if @option{-fno-lto} is passed to the linker, no
10230interprocedural optimizations are applied.  Note that when
10231@option{-fno-fat-lto-objects} is enabled the compile stage is faster
10232but you cannot perform a regular, non-LTO link on them.
10233
10234When producing the final binary, GCC only
10235applies link-time optimizations to those files that contain bytecode.
10236Therefore, you can mix and match object files and libraries with
10237GIMPLE bytecodes and final object code.  GCC automatically selects
10238which files to optimize in LTO mode and which files to link without
10239further processing.
10240
10241Generally, options specified at link time override those
10242specified at compile time, although in some cases GCC attempts to infer
10243link-time options from the settings used to compile the input files.
10244
10245If you do not specify an optimization level option @option{-O} at
10246link time, then GCC uses the highest optimization level
10247used when compiling the object files.  Note that it is generally
10248ineffective to specify an optimization level option only at link time and
10249not at compile time, for two reasons.  First, compiling without
10250optimization suppresses compiler passes that gather information
10251needed for effective optimization at link time.  Second, some early
10252optimization passes can be performed only at compile time and
10253not at link time.
10254
10255There are some code generation flags preserved by GCC when
10256generating bytecodes, as they need to be used during the final link.
10257Currently, the following options and their settings are taken from
10258the first object file that explicitly specifies them:
10259@option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10260@option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10261and all the @option{-m} target flags.
10262
10263Certain ABI-changing flags are required to match in all compilation units,
10264and trying to override this at link time with a conflicting value
10265is ignored.  This includes options such as @option{-freg-struct-return}
10266and @option{-fpcc-struct-return}.
10267
10268Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10269@option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10270are passed through to the link stage and merged conservatively for
10271conflicting translation units.  Specifically
10272@option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10273precedence; and for example @option{-ffp-contract=off} takes precedence
10274over @option{-ffp-contract=fast}.  You can override them at link time.
10275
10276When you need to pass options to the assembler via @option{-Wa} or
10277@option{-Xassembler} make sure to either compile such translation
10278units with @option{-fno-lto} or consistently use the same assembler
10279options on all translation units.  You can alternatively also
10280specify assembler options at LTO link time.
10281
10282If LTO encounters objects with C linkage declared with incompatible
10283types in separate translation units to be linked together (undefined
10284behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10285issued.  The behavior is still undefined at run time.  Similar
10286diagnostics may be raised for other languages.
10287
10288Another feature of LTO is that it is possible to apply interprocedural
10289optimizations on files written in different languages:
10290
10291@smallexample
10292gcc -c -flto foo.c
10293g++ -c -flto bar.cc
10294gfortran -c -flto baz.f90
10295g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10296@end smallexample
10297
10298Notice that the final link is done with @command{g++} to get the C++
10299runtime libraries and @option{-lgfortran} is added to get the Fortran
10300runtime libraries.  In general, when mixing languages in LTO mode, you
10301should use the same link command options as when mixing languages in a
10302regular (non-LTO) compilation.
10303
10304If object files containing GIMPLE bytecode are stored in a library archive, say
10305@file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10306are using a linker with plugin support.  To create static libraries suitable
10307for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10308and @command{ranlib};
10309to show the symbols of object files with GIMPLE bytecode, use
10310@command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
10311and @command{nm} have been compiled with plugin support.  At link time, use the
10312flag @option{-fuse-linker-plugin} to ensure that the library participates in
10313the LTO optimization process:
10314
10315@smallexample
10316gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10317@end smallexample
10318
10319With the linker plugin enabled, the linker extracts the needed
10320GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10321to make them part of the aggregated GIMPLE image to be optimized.
10322
10323If you are not using a linker with plugin support and/or do not
10324enable the linker plugin, then the objects inside @file{libfoo.a}
10325are extracted and linked as usual, but they do not participate
10326in the LTO optimization process.  In order to make a static library suitable
10327for both LTO optimization and usual linkage, compile its object files with
10328@option{-flto} @option{-ffat-lto-objects}.
10329
10330Link-time optimizations do not require the presence of the whole program to
10331operate.  If the program does not require any symbols to be exported, it is
10332possible to combine @option{-flto} and @option{-fwhole-program} to allow
10333the interprocedural optimizers to use more aggressive assumptions which may
10334lead to improved optimization opportunities.
10335Use of @option{-fwhole-program} is not needed when linker plugin is
10336active (see @option{-fuse-linker-plugin}).
10337
10338The current implementation of LTO makes no
10339attempt to generate bytecode that is portable between different
10340types of hosts.  The bytecode files are versioned and there is a
10341strict version check, so bytecode files generated in one version of
10342GCC do not work with an older or newer version of GCC.
10343
10344Link-time optimization does not work well with generation of debugging
10345information on systems other than those using a combination of ELF and
10346DWARF.
10347
10348If you specify the optional @var{n}, the optimization and code
10349generation done at link time is executed in parallel using @var{n}
10350parallel jobs by utilizing an installed @command{make} program.  The
10351environment variable @env{MAKE} may be used to override the program
10352used.  The default value for @var{n} is 1.
10353
10354You can also specify @option{-flto=jobserver} to use GNU make's
10355job server mode to determine the number of parallel jobs. This
10356is useful when the Makefile calling GCC is already executing in parallel.
10357You must prepend a @samp{+} to the command recipe in the parent Makefile
10358for this to work.  This option likely only works if @env{MAKE} is
10359GNU make.
10360
10361@item -flto-partition=@var{alg}
10362@opindex flto-partition
10363Specify the partitioning algorithm used by the link-time optimizer.
10364The value is either @samp{1to1} to specify a partitioning mirroring
10365the original source files or @samp{balanced} to specify partitioning
10366into equally sized chunks (whenever possible) or @samp{max} to create
10367new partition for every symbol where possible.  Specifying @samp{none}
10368as an algorithm disables partitioning and streaming completely.
10369The default value is @samp{balanced}. While @samp{1to1} can be used
10370as an workaround for various code ordering issues, the @samp{max}
10371partitioning is intended for internal testing only.
10372The value @samp{one} specifies that exactly one partition should be
10373used while the value @samp{none} bypasses partitioning and executes
10374the link-time optimization step directly from the WPA phase.
10375
10376@item -flto-odr-type-merging
10377@opindex flto-odr-type-merging
10378Enable streaming of mangled types names of C++ types and their unification
10379at link time.  This increases size of LTO object files, but enables
10380diagnostics about One Definition Rule violations.
10381
10382@item -flto-compression-level=@var{n}
10383@opindex flto-compression-level
10384This option specifies the level of compression used for intermediate
10385language written to LTO object files, and is only meaningful in
10386conjunction with LTO mode (@option{-flto}).  Valid
10387values are 0 (no compression) to 9 (maximum compression).  Values
10388outside this range are clamped to either 0 or 9.  If the option is not
10389given, a default balanced compression setting is used.
10390
10391@item -fuse-linker-plugin
10392@opindex fuse-linker-plugin
10393Enables the use of a linker plugin during link-time optimization.  This
10394option relies on plugin support in the linker, which is available in gold
10395or in GNU ld 2.21 or newer.
10396
10397This option enables the extraction of object files with GIMPLE bytecode out
10398of library archives. This improves the quality of optimization by exposing
10399more code to the link-time optimizer.  This information specifies what
10400symbols can be accessed externally (by non-LTO object or during dynamic
10401linking).  Resulting code quality improvements on binaries (and shared
10402libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10403See @option{-flto} for a description of the effect of this flag and how to
10404use it.
10405
10406This option is enabled by default when LTO support in GCC is enabled
10407and GCC was configured for use with
10408a linker supporting plugins (GNU ld 2.21 or newer or gold).
10409
10410@item -ffat-lto-objects
10411@opindex ffat-lto-objects
10412Fat LTO objects are object files that contain both the intermediate language
10413and the object code. This makes them usable for both LTO linking and normal
10414linking. This option is effective only when compiling with @option{-flto}
10415and is ignored at link time.
10416
10417@option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10418requires the complete toolchain to be aware of LTO. It requires a linker with
10419linker plugin support for basic functionality.  Additionally,
10420@command{nm}, @command{ar} and @command{ranlib}
10421need to support linker plugins to allow a full-featured build environment
10422(capable of building static libraries etc).  GCC provides the @command{gcc-ar},
10423@command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10424to these tools. With non fat LTO makefiles need to be modified to use them.
10425
10426Note that modern binutils provide plugin auto-load mechanism.
10427Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10428effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10429@command{gcc-ranlib}).
10430
10431The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10432support.
10433
10434@item -fcompare-elim
10435@opindex fcompare-elim
10436After register allocation and post-register allocation instruction splitting,
10437identify arithmetic instructions that compute processor flags similar to a
10438comparison operation based on that arithmetic.  If possible, eliminate the
10439explicit comparison operation.
10440
10441This pass only applies to certain targets that cannot explicitly represent
10442the comparison operation before register allocation is complete.
10443
10444Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10445
10446@item -fcprop-registers
10447@opindex fcprop-registers
10448After register allocation and post-register allocation instruction splitting,
10449perform a copy-propagation pass to try to reduce scheduling dependencies
10450and occasionally eliminate the copy.
10451
10452Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10453
10454@item -fprofile-correction
10455@opindex fprofile-correction
10456Profiles collected using an instrumented binary for multi-threaded programs may
10457be inconsistent due to missed counter updates. When this option is specified,
10458GCC uses heuristics to correct or smooth out such inconsistencies. By
10459default, GCC emits an error message when an inconsistent profile is detected.
10460
10461This option is enabled by @option{-fauto-profile}.
10462
10463@item -fprofile-use
10464@itemx -fprofile-use=@var{path}
10465@opindex fprofile-use
10466Enable profile feedback-directed optimizations,
10467and the following optimizations, many of which
10468are generally profitable only with profile feedback available:
10469
10470@gccoptlist{-fbranch-probabilities  -fprofile-values @gol
10471-funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
10472-finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
10473-fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
10474-fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
10475-fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
10476-fprofile-reorder-functions}
10477
10478Before you can use this option, you must first generate profiling information.
10479@xref{Instrumentation Options}, for information about the
10480@option{-fprofile-generate} option.
10481
10482By default, GCC emits an error message if the feedback profiles do not
10483match the source code.  This error can be turned into a warning by using
10484@option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
10485optimized code.  Additionally, by default, GCC also emits a warning message if
10486the feedback profiles do not exist (see @option{-Wmissing-profile}).
10487
10488If @var{path} is specified, GCC looks at the @var{path} to find
10489the profile feedback data files. See @option{-fprofile-dir}.
10490
10491@item -fauto-profile
10492@itemx -fauto-profile=@var{path}
10493@opindex fauto-profile
10494Enable sampling-based feedback-directed optimizations,
10495and the following optimizations,
10496many of which are generally profitable only with profile feedback available:
10497
10498@gccoptlist{-fbranch-probabilities  -fprofile-values @gol
10499-funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
10500-finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
10501-fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
10502-fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
10503-fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
10504-fprofile-correction}
10505
10506@var{path} is the name of a file containing AutoFDO profile information.
10507If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10508
10509Producing an AutoFDO profile data file requires running your program
10510with the @command{perf} utility on a supported GNU/Linux target system.
10511For more information, see @uref{https://perf.wiki.kernel.org/}.
10512
10513E.g.
10514@smallexample
10515perf record -e br_inst_retired:near_taken -b -o perf.data \
10516    -- your_program
10517@end smallexample
10518
10519Then use the @command{create_gcov} tool to convert the raw profile data
10520to a format that can be used by GCC.@  You must also supply the
10521unstripped binary for your program to this tool.
10522See @uref{https://github.com/google/autofdo}.
10523
10524E.g.
10525@smallexample
10526create_gcov --binary=your_program.unstripped --profile=perf.data \
10527    --gcov=profile.afdo
10528@end smallexample
10529@end table
10530
10531The following options control compiler behavior regarding floating-point
10532arithmetic.  These options trade off between speed and
10533correctness.  All must be specifically enabled.
10534
10535@table @gcctabopt
10536@item -ffloat-store
10537@opindex ffloat-store
10538Do not store floating-point variables in registers, and inhibit other
10539options that might change whether a floating-point value is taken from a
10540register or memory.
10541
10542@cindex floating-point precision
10543This option prevents undesirable excess precision on machines such as
10544the 68000 where the floating registers (of the 68881) keep more
10545precision than a @code{double} is supposed to have.  Similarly for the
10546x86 architecture.  For most programs, the excess precision does only
10547good, but a few programs rely on the precise definition of IEEE floating
10548point.  Use @option{-ffloat-store} for such programs, after modifying
10549them to store all pertinent intermediate computations into variables.
10550
10551@item -fexcess-precision=@var{style}
10552@opindex fexcess-precision
10553This option allows further control over excess precision on machines
10554where floating-point operations occur in a format with more precision or
10555range than the IEEE standard and interchange floating-point types.  By
10556default, @option{-fexcess-precision=fast} is in effect; this means that
10557operations may be carried out in a wider precision than the types specified
10558in the source if that would result in faster code, and it is unpredictable
10559when rounding to the types specified in the source code takes place.
10560When compiling C, if @option{-fexcess-precision=standard} is specified then
10561excess precision follows the rules specified in ISO C99; in particular,
10562both casts and assignments cause values to be rounded to their
10563semantic types (whereas @option{-ffloat-store} only affects
10564assignments).  This option is enabled by default for C if a strict
10565conformance option such as @option{-std=c99} is used.
10566@option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10567regardless of whether a strict conformance option is used.
10568
10569@opindex mfpmath
10570@option{-fexcess-precision=standard} is not implemented for languages
10571other than C.  On the x86, it has no effect if @option{-mfpmath=sse}
10572or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10573semantics apply without excess precision, and in the latter, rounding
10574is unpredictable.
10575
10576@item -ffast-math
10577@opindex ffast-math
10578Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10579@option{-ffinite-math-only}, @option{-fno-rounding-math},
10580@option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10581@option{-fexcess-precision=fast}.
10582
10583This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10584
10585This option is not turned on by any @option{-O} option besides
10586@option{-Ofast} since it can result in incorrect output for programs
10587that depend on an exact implementation of IEEE or ISO rules/specifications
10588for math functions. It may, however, yield faster code for programs
10589that do not require the guarantees of these specifications.
10590
10591@item -fno-math-errno
10592@opindex fno-math-errno
10593@opindex fmath-errno
10594Do not set @code{errno} after calling math functions that are executed
10595with a single instruction, e.g., @code{sqrt}.  A program that relies on
10596IEEE exceptions for math error handling may want to use this flag
10597for speed while maintaining IEEE arithmetic compatibility.
10598
10599This option is not turned on by any @option{-O} option since
10600it can result in incorrect output for programs that depend on
10601an exact implementation of IEEE or ISO rules/specifications for
10602math functions. It may, however, yield faster code for programs
10603that do not require the guarantees of these specifications.
10604
10605The default is @option{-fmath-errno}.
10606
10607On Darwin systems, the math library never sets @code{errno}.  There is
10608therefore no reason for the compiler to consider the possibility that
10609it might, and @option{-fno-math-errno} is the default.
10610
10611@item -funsafe-math-optimizations
10612@opindex funsafe-math-optimizations
10613
10614Allow optimizations for floating-point arithmetic that (a) assume
10615that arguments and results are valid and (b) may violate IEEE or
10616ANSI standards.  When used at link time, it may include libraries
10617or startup files that change the default FPU control word or other
10618similar optimizations.
10619
10620This option is not turned on by any @option{-O} option since
10621it can result in incorrect output for programs that depend on
10622an exact implementation of IEEE or ISO rules/specifications for
10623math functions. It may, however, yield faster code for programs
10624that do not require the guarantees of these specifications.
10625Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10626@option{-fassociative-math} and @option{-freciprocal-math}.
10627
10628The default is @option{-fno-unsafe-math-optimizations}.
10629
10630@item -fassociative-math
10631@opindex fassociative-math
10632
10633Allow re-association of operands in series of floating-point operations.
10634This violates the ISO C and C++ language standard by possibly changing
10635computation result.  NOTE: re-ordering may change the sign of zero as
10636well as ignore NaNs and inhibit or create underflow or overflow (and
10637thus cannot be used on code that relies on rounding behavior like
10638@code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
10639and thus may not be used when ordered comparisons are required.
10640This option requires that both @option{-fno-signed-zeros} and
10641@option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
10642much sense with @option{-frounding-math}. For Fortran the option
10643is automatically enabled when both @option{-fno-signed-zeros} and
10644@option{-fno-trapping-math} are in effect.
10645
10646The default is @option{-fno-associative-math}.
10647
10648@item -freciprocal-math
10649@opindex freciprocal-math
10650
10651Allow the reciprocal of a value to be used instead of dividing by
10652the value if this enables optimizations.  For example @code{x / y}
10653can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10654is subject to common subexpression elimination.  Note that this loses
10655precision and increases the number of flops operating on the value.
10656
10657The default is @option{-fno-reciprocal-math}.
10658
10659@item -ffinite-math-only
10660@opindex ffinite-math-only
10661Allow optimizations for floating-point arithmetic that assume
10662that arguments and results are not NaNs or +-Infs.
10663
10664This option is not turned on by any @option{-O} option since
10665it can result in incorrect output for programs that depend on
10666an exact implementation of IEEE or ISO rules/specifications for
10667math functions. It may, however, yield faster code for programs
10668that do not require the guarantees of these specifications.
10669
10670The default is @option{-fno-finite-math-only}.
10671
10672@item -fno-signed-zeros
10673@opindex fno-signed-zeros
10674@opindex fsigned-zeros
10675Allow optimizations for floating-point arithmetic that ignore the
10676signedness of zero.  IEEE arithmetic specifies the behavior of
10677distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10678of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10679This option implies that the sign of a zero result isn't significant.
10680
10681The default is @option{-fsigned-zeros}.
10682
10683@item -fno-trapping-math
10684@opindex fno-trapping-math
10685@opindex ftrapping-math
10686Compile code assuming that floating-point operations cannot generate
10687user-visible traps.  These traps include division by zero, overflow,
10688underflow, inexact result and invalid operation.  This option requires
10689that @option{-fno-signaling-nans} be in effect.  Setting this option may
10690allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10691
10692This option should never be turned on by any @option{-O} option since
10693it can result in incorrect output for programs that depend on
10694an exact implementation of IEEE or ISO rules/specifications for
10695math functions.
10696
10697The default is @option{-ftrapping-math}.
10698
10699@item -frounding-math
10700@opindex frounding-math
10701Disable transformations and optimizations that assume default floating-point
10702rounding behavior.  This is round-to-zero for all floating point
10703to integer conversions, and round-to-nearest for all other arithmetic
10704truncations.  This option should be specified for programs that change
10705the FP rounding mode dynamically, or that may be executed with a
10706non-default rounding mode.  This option disables constant folding of
10707floating-point expressions at compile time (which may be affected by
10708rounding mode) and arithmetic transformations that are unsafe in the
10709presence of sign-dependent rounding modes.
10710
10711The default is @option{-fno-rounding-math}.
10712
10713This option is experimental and does not currently guarantee to
10714disable all GCC optimizations that are affected by rounding mode.
10715Future versions of GCC may provide finer control of this setting
10716using C99's @code{FENV_ACCESS} pragma.  This command-line option
10717will be used to specify the default state for @code{FENV_ACCESS}.
10718
10719@item -fsignaling-nans
10720@opindex fsignaling-nans
10721Compile code assuming that IEEE signaling NaNs may generate user-visible
10722traps during floating-point operations.  Setting this option disables
10723optimizations that may change the number of exceptions visible with
10724signaling NaNs.  This option implies @option{-ftrapping-math}.
10725
10726This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10727be defined.
10728
10729The default is @option{-fno-signaling-nans}.
10730
10731This option is experimental and does not currently guarantee to
10732disable all GCC optimizations that affect signaling NaN behavior.
10733
10734@item -fno-fp-int-builtin-inexact
10735@opindex fno-fp-int-builtin-inexact
10736@opindex ffp-int-builtin-inexact
10737Do not allow the built-in functions @code{ceil}, @code{floor},
10738@code{round} and @code{trunc}, and their @code{float} and @code{long
10739double} variants, to generate code that raises the ``inexact''
10740floating-point exception for noninteger arguments.  ISO C99 and C11
10741allow these functions to raise the ``inexact'' exception, but ISO/IEC
10742TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10743functions to do so.
10744
10745The default is @option{-ffp-int-builtin-inexact}, allowing the
10746exception to be raised.  This option does nothing unless
10747@option{-ftrapping-math} is in effect.
10748
10749Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10750generate a call to a library function then the ``inexact'' exception
10751may be raised if the library implementation does not follow TS 18661.
10752
10753@item -fsingle-precision-constant
10754@opindex fsingle-precision-constant
10755Treat floating-point constants as single precision instead of
10756implicitly converting them to double-precision constants.
10757
10758@item -fcx-limited-range
10759@opindex fcx-limited-range
10760When enabled, this option states that a range reduction step is not
10761needed when performing complex division.  Also, there is no checking
10762whether the result of a complex multiplication or division is @code{NaN
10763+ I*NaN}, with an attempt to rescue the situation in that case.  The
10764default is @option{-fno-cx-limited-range}, but is enabled by
10765@option{-ffast-math}.
10766
10767This option controls the default setting of the ISO C99
10768@code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
10769all languages.
10770
10771@item -fcx-fortran-rules
10772@opindex fcx-fortran-rules
10773Complex multiplication and division follow Fortran rules.  Range
10774reduction is done as part of complex division, but there is no checking
10775whether the result of a complex multiplication or division is @code{NaN
10776+ I*NaN}, with an attempt to rescue the situation in that case.
10777
10778The default is @option{-fno-cx-fortran-rules}.
10779
10780@end table
10781
10782The following options control optimizations that may improve
10783performance, but are not enabled by any @option{-O} options.  This
10784section includes experimental options that may produce broken code.
10785
10786@table @gcctabopt
10787@item -fbranch-probabilities
10788@opindex fbranch-probabilities
10789After running a program compiled with @option{-fprofile-arcs}
10790(@pxref{Instrumentation Options}),
10791you can compile it a second time using
10792@option{-fbranch-probabilities}, to improve optimizations based on
10793the number of times each branch was taken.  When a program
10794compiled with @option{-fprofile-arcs} exits, it saves arc execution
10795counts to a file called @file{@var{sourcename}.gcda} for each source
10796file.  The information in this data file is very dependent on the
10797structure of the generated code, so you must use the same source code
10798and the same optimization options for both compilations.
10799
10800With @option{-fbranch-probabilities}, GCC puts a
10801@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10802These can be used to improve optimization.  Currently, they are only
10803used in one place: in @file{reorg.c}, instead of guessing which path a
10804branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10805exactly determine which path is taken more often.
10806
10807Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10808
10809@item -fprofile-values
10810@opindex fprofile-values
10811If combined with @option{-fprofile-arcs}, it adds code so that some
10812data about values of expressions in the program is gathered.
10813
10814With @option{-fbranch-probabilities}, it reads back the data gathered
10815from profiling values of expressions for usage in optimizations.
10816
10817Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10818@option{-fauto-profile}.
10819
10820@item -fprofile-reorder-functions
10821@opindex fprofile-reorder-functions
10822Function reordering based on profile instrumentation collects
10823first time of execution of a function and orders these functions
10824in ascending order.
10825
10826Enabled with @option{-fprofile-use}.
10827
10828@item -fvpt
10829@opindex fvpt
10830If combined with @option{-fprofile-arcs}, this option instructs the compiler
10831to add code to gather information about values of expressions.
10832
10833With @option{-fbranch-probabilities}, it reads back the data gathered
10834and actually performs the optimizations based on them.
10835Currently the optimizations include specialization of division operations
10836using the knowledge about the value of the denominator.
10837
10838Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10839
10840@item -frename-registers
10841@opindex frename-registers
10842Attempt to avoid false dependencies in scheduled code by making use
10843of registers left over after register allocation.  This optimization
10844most benefits processors with lots of registers.  Depending on the
10845debug information format adopted by the target, however, it can
10846make debugging impossible, since variables no longer stay in
10847a ``home register''.
10848
10849Enabled by default with @option{-funroll-loops}.
10850
10851@item -fschedule-fusion
10852@opindex fschedule-fusion
10853Performs a target dependent pass over the instruction stream to schedule
10854instructions of same type together because target machine can execute them
10855more efficiently if they are adjacent to each other in the instruction flow.
10856
10857Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10858
10859@item -ftracer
10860@opindex ftracer
10861Perform tail duplication to enlarge superblock size.  This transformation
10862simplifies the control flow of the function allowing other optimizations to do
10863a better job.
10864
10865Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10866
10867@item -funroll-loops
10868@opindex funroll-loops
10869Unroll loops whose number of iterations can be determined at compile time or
10870upon entry to the loop.  @option{-funroll-loops} implies
10871@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10872It also turns on complete loop peeling (i.e.@: complete removal of loops with
10873a small constant number of iterations).  This option makes code larger, and may
10874or may not make it run faster.
10875
10876Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10877
10878@item -funroll-all-loops
10879@opindex funroll-all-loops
10880Unroll all loops, even if their number of iterations is uncertain when
10881the loop is entered.  This usually makes programs run more slowly.
10882@option{-funroll-all-loops} implies the same options as
10883@option{-funroll-loops}.
10884
10885@item -fpeel-loops
10886@opindex fpeel-loops
10887Peels loops for which there is enough information that they do not
10888roll much (from profile feedback or static analysis).  It also turns on
10889complete loop peeling (i.e.@: complete removal of loops with small constant
10890number of iterations).
10891
10892Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10893
10894@item -fmove-loop-invariants
10895@opindex fmove-loop-invariants
10896Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
10897at level @option{-O1} and higher, except for @option{-Og}.
10898
10899@item -fsplit-loops
10900@opindex fsplit-loops
10901Split a loop into two if it contains a condition that's always true
10902for one side of the iteration space and false for the other.
10903
10904Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10905
10906@item -funswitch-loops
10907@opindex funswitch-loops
10908Move branches with loop invariant conditions out of the loop, with duplicates
10909of the loop on both branches (modified according to result of the condition).
10910
10911Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10912
10913@item -fversion-loops-for-strides
10914@opindex fversion-loops-for-strides
10915If a loop iterates over an array with a variable stride, create another
10916version of the loop that assumes the stride is always one.  For example:
10917
10918@smallexample
10919for (int i = 0; i < n; ++i)
10920  x[i * stride] = @dots{};
10921@end smallexample
10922
10923becomes:
10924
10925@smallexample
10926if (stride == 1)
10927  for (int i = 0; i < n; ++i)
10928    x[i] = @dots{};
10929else
10930  for (int i = 0; i < n; ++i)
10931    x[i * stride] = @dots{};
10932@end smallexample
10933
10934This is particularly useful for assumed-shape arrays in Fortran where
10935(for example) it allows better vectorization assuming contiguous accesses.
10936This flag is enabled by default at @option{-O3}.
10937It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10938
10939@item -ffunction-sections
10940@itemx -fdata-sections
10941@opindex ffunction-sections
10942@opindex fdata-sections
10943Place each function or data item into its own section in the output
10944file if the target supports arbitrary sections.  The name of the
10945function or the name of the data item determines the section's name
10946in the output file.
10947
10948Use these options on systems where the linker can perform optimizations to
10949improve locality of reference in the instruction space.  Most systems using the
10950ELF object format have linkers with such optimizations.  On AIX, the linker
10951rearranges sections (CSECTs) based on the call graph.  The performance impact
10952varies.
10953
10954Together with a linker garbage collection (linker @option{--gc-sections}
10955option) these options may lead to smaller statically-linked executables (after
10956stripping).
10957
10958On ELF/DWARF systems these options do not degenerate the quality of the debug
10959information.  There could be issues with other object files/debug info formats.
10960
10961Only use these options when there are significant benefits from doing so.  When
10962you specify these options, the assembler and linker create larger object and
10963executable files and are also slower.  These options affect code generation.
10964They prevent optimizations by the compiler and assembler using relative
10965locations inside a translation unit since the locations are unknown until
10966link time.  An example of such an optimization is relaxing calls to short call
10967instructions.
10968
10969@item -fbranch-target-load-optimize
10970@opindex fbranch-target-load-optimize
10971Perform branch target register load optimization before prologue / epilogue
10972threading.
10973The use of target registers can typically be exposed only during reload,
10974thus hoisting loads out of loops and doing inter-block scheduling needs
10975a separate optimization pass.
10976
10977@item -fbranch-target-load-optimize2
10978@opindex fbranch-target-load-optimize2
10979Perform branch target register load optimization after prologue / epilogue
10980threading.
10981
10982@item -fbtr-bb-exclusive
10983@opindex fbtr-bb-exclusive
10984When performing branch target register load optimization, don't reuse
10985branch target registers within any basic block.
10986
10987@item -fstdarg-opt
10988@opindex fstdarg-opt
10989Optimize the prologue of variadic argument functions with respect to usage of
10990those arguments.
10991
10992@item -fsection-anchors
10993@opindex fsection-anchors
10994Try to reduce the number of symbolic address calculations by using
10995shared ``anchor'' symbols to address nearby objects.  This transformation
10996can help to reduce the number of GOT entries and GOT accesses on some
10997targets.
10998
10999For example, the implementation of the following function @code{foo}:
11000
11001@smallexample
11002static int a, b, c;
11003int foo (void) @{ return a + b + c; @}
11004@end smallexample
11005
11006@noindent
11007usually calculates the addresses of all three variables, but if you
11008compile it with @option{-fsection-anchors}, it accesses the variables
11009from a common anchor point instead.  The effect is similar to the
11010following pseudocode (which isn't valid C):
11011
11012@smallexample
11013int foo (void)
11014@{
11015  register int *xr = &x;
11016  return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11017@}
11018@end smallexample
11019
11020Not all targets support this option.
11021
11022@item --param @var{name}=@var{value}
11023@opindex param
11024In some places, GCC uses various constants to control the amount of
11025optimization that is done.  For example, GCC does not inline functions
11026that contain more than a certain number of instructions.  You can
11027control some of these constants on the command line using the
11028@option{--param} option.
11029
11030The names of specific parameters, and the meaning of the values, are
11031tied to the internals of the compiler, and are subject to change
11032without notice in future releases.
11033
11034In order to get minimal, maximal and default value of a parameter,
11035one can use @option{--help=param -Q} options.
11036
11037In each case, the @var{value} is an integer.  The allowable choices for
11038@var{name} are:
11039
11040@table @gcctabopt
11041@item predictable-branch-outcome
11042When branch is predicted to be taken with probability lower than this threshold
11043(in percent), then it is considered well predictable.
11044
11045@item max-rtl-if-conversion-insns
11046RTL if-conversion tries to remove conditional branches around a block and
11047replace them with conditionally executed instructions.  This parameter
11048gives the maximum number of instructions in a block which should be
11049considered for if-conversion.  The compiler will
11050also use other heuristics to decide whether if-conversion is likely to be
11051profitable.
11052
11053@item max-rtl-if-conversion-predictable-cost
11054@itemx max-rtl-if-conversion-unpredictable-cost
11055RTL if-conversion will try to remove conditional branches around a block
11056and replace them with conditionally executed instructions.  These parameters
11057give the maximum permissible cost for the sequence that would be generated
11058by if-conversion depending on whether the branch is statically determined
11059to be predictable or not.  The units for this parameter are the same as
11060those for the GCC internal seq_cost metric.  The compiler will try to
11061provide a reasonable default for this parameter using the BRANCH_COST
11062target macro.
11063
11064@item max-crossjump-edges
11065The maximum number of incoming edges to consider for cross-jumping.
11066The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11067the number of edges incoming to each block.  Increasing values mean
11068more aggressive optimization, making the compilation time increase with
11069probably small improvement in executable size.
11070
11071@item min-crossjump-insns
11072The minimum number of instructions that must be matched at the end
11073of two blocks before cross-jumping is performed on them.  This
11074value is ignored in the case where all instructions in the block being
11075cross-jumped from are matched.
11076
11077@item max-grow-copy-bb-insns
11078The maximum code size expansion factor when copying basic blocks
11079instead of jumping.  The expansion is relative to a jump instruction.
11080
11081@item max-goto-duplication-insns
11082The maximum number of instructions to duplicate to a block that jumps
11083to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
11084passes, GCC factors computed gotos early in the compilation process,
11085and unfactors them as late as possible.  Only computed jumps at the
11086end of a basic blocks with no more than max-goto-duplication-insns are
11087unfactored.
11088
11089@item max-delay-slot-insn-search
11090The maximum number of instructions to consider when looking for an
11091instruction to fill a delay slot.  If more than this arbitrary number of
11092instructions are searched, the time savings from filling the delay slot
11093are minimal, so stop searching.  Increasing values mean more
11094aggressive optimization, making the compilation time increase with probably
11095small improvement in execution time.
11096
11097@item max-delay-slot-live-search
11098When trying to fill delay slots, the maximum number of instructions to
11099consider when searching for a block with valid live register
11100information.  Increasing this arbitrarily chosen value means more
11101aggressive optimization, increasing the compilation time.  This parameter
11102should be removed when the delay slot code is rewritten to maintain the
11103control-flow graph.
11104
11105@item max-gcse-memory
11106The approximate maximum amount of memory that can be allocated in
11107order to perform the global common subexpression elimination
11108optimization.  If more memory than specified is required, the
11109optimization is not done.
11110
11111@item max-gcse-insertion-ratio
11112If the ratio of expression insertions to deletions is larger than this value
11113for any expression, then RTL PRE inserts or removes the expression and thus
11114leaves partially redundant computations in the instruction stream.
11115
11116@item max-pending-list-length
11117The maximum number of pending dependencies scheduling allows
11118before flushing the current state and starting over.  Large functions
11119with few branches or calls can create excessively large lists which
11120needlessly consume memory and resources.
11121
11122@item max-modulo-backtrack-attempts
11123The maximum number of backtrack attempts the scheduler should make
11124when modulo scheduling a loop.  Larger values can exponentially increase
11125compilation time.
11126
11127@item max-inline-insns-single
11128Several parameters control the tree inliner used in GCC@.
11129This number sets the maximum number of instructions (counted in GCC's
11130internal representation) in a single function that the tree inliner
11131considers for inlining.  This only affects functions declared
11132inline and methods implemented in a class declaration (C++).
11133
11134@item max-inline-insns-auto
11135When you use @option{-finline-functions} (included in @option{-O3}),
11136a lot of functions that would otherwise not be considered for inlining
11137by the compiler are investigated.  To those functions, a different
11138(more restrictive) limit compared to functions declared inline can
11139be applied.
11140
11141@item max-inline-insns-small
11142This is bound applied to calls which are considered relevant with
11143@option{-finline-small-functions}.
11144
11145@item max-inline-insns-size
11146This is bound applied to calls which are optimized for size. Small growth
11147may be desirable to anticipate optimization oppurtunities exposed by inlining.
11148
11149@item uninlined-function-insns
11150Number of instructions accounted by inliner for function overhead such as
11151function prologue and epilogue.
11152
11153@item uninlined-function-time
11154Extra time accounted by inliner for function overhead such as time needed to
11155execute function prologue and epilogue
11156
11157@item uninlined-thunk-insns
11158@item uninlined-thunk-time
11159Same as @option{--param uninlined-function-insns} and
11160@option{--param uninlined-function-time} but applied to function thunks
11161
11162@item inline-min-speedup
11163When estimated performance improvement of caller + callee runtime exceeds this
11164threshold (in percent), the function can be inlined regardless of the limit on
11165@option{--param max-inline-insns-single} and @option{--param
11166max-inline-insns-auto}.
11167
11168@item large-function-insns
11169The limit specifying really large functions.  For functions larger than this
11170limit after inlining, inlining is constrained by
11171@option{--param large-function-growth}.  This parameter is useful primarily
11172to avoid extreme compilation time caused by non-linear algorithms used by the
11173back end.
11174
11175@item large-function-growth
11176Specifies maximal growth of large function caused by inlining in percents.
11177For example, parameter value 100 limits large function growth to 2.0 times
11178the original size.
11179
11180@item large-unit-insns
11181The limit specifying large translation unit.  Growth caused by inlining of
11182units larger than this limit is limited by @option{--param inline-unit-growth}.
11183For small units this might be too tight.
11184For example, consider a unit consisting of function A
11185that is inline and B that just calls A three times.  If B is small relative to
11186A, the growth of unit is 300\% and yet such inlining is very sane.  For very
11187large units consisting of small inlineable functions, however, the overall unit
11188growth limit is needed to avoid exponential explosion of code size.  Thus for
11189smaller units, the size is increased to @option{--param large-unit-insns}
11190before applying @option{--param inline-unit-growth}.
11191
11192@item inline-unit-growth
11193Specifies maximal overall growth of the compilation unit caused by inlining.
11194For example, parameter value 20 limits unit growth to 1.2 times the original
11195size. Cold functions (either marked cold via an attribute or by profile
11196feedback) are not accounted into the unit size.
11197
11198@item ipcp-unit-growth
11199Specifies maximal overall growth of the compilation unit caused by
11200interprocedural constant propagation.  For example, parameter value 10 limits
11201unit growth to 1.1 times the original size.
11202
11203@item large-stack-frame
11204The limit specifying large stack frames.  While inlining the algorithm is trying
11205to not grow past this limit too much.
11206
11207@item large-stack-frame-growth
11208Specifies maximal growth of large stack frames caused by inlining in percents.
11209For example, parameter value 1000 limits large stack frame growth to 11 times
11210the original size.
11211
11212@item max-inline-insns-recursive
11213@itemx max-inline-insns-recursive-auto
11214Specifies the maximum number of instructions an out-of-line copy of a
11215self-recursive inline
11216function can grow into by performing recursive inlining.
11217
11218@option{--param max-inline-insns-recursive} applies to functions
11219declared inline.
11220For functions not declared inline, recursive inlining
11221happens only when @option{-finline-functions} (included in @option{-O3}) is
11222enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11223
11224@item max-inline-recursive-depth
11225@itemx max-inline-recursive-depth-auto
11226Specifies the maximum recursion depth used for recursive inlining.
11227
11228@option{--param max-inline-recursive-depth} applies to functions
11229declared inline.  For functions not declared inline, recursive inlining
11230happens only when @option{-finline-functions} (included in @option{-O3}) is
11231enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11232
11233@item min-inline-recursive-probability
11234Recursive inlining is profitable only for function having deep recursion
11235in average and can hurt for function having little recursion depth by
11236increasing the prologue size or complexity of function body to other
11237optimizers.
11238
11239When profile feedback is available (see @option{-fprofile-generate}) the actual
11240recursion depth can be guessed from the probability that function recurses
11241via a given call expression.  This parameter limits inlining only to call
11242expressions whose probability exceeds the given threshold (in percents).
11243
11244@item early-inlining-insns
11245Specify growth that the early inliner can make.  In effect it increases
11246the amount of inlining for code having a large abstraction penalty.
11247
11248@item max-early-inliner-iterations
11249Limit of iterations of the early inliner.  This basically bounds
11250the number of nested indirect calls the early inliner can resolve.
11251Deeper chains are still handled by late inlining.
11252
11253@item comdat-sharing-probability
11254Probability (in percent) that C++ inline function with comdat visibility
11255are shared across multiple compilation units.
11256
11257@item profile-func-internal-id
11258A parameter to control whether to use function internal id in profile
11259database lookup. If the value is 0, the compiler uses an id that
11260is based on function assembler name and filename, which makes old profile
11261data more tolerant to source changes such as function reordering etc.
11262
11263@item min-vect-loop-bound
11264The minimum number of iterations under which loops are not vectorized
11265when @option{-ftree-vectorize} is used.  The number of iterations after
11266vectorization needs to be greater than the value specified by this option
11267to allow vectorization.
11268
11269@item gcse-cost-distance-ratio
11270Scaling factor in calculation of maximum distance an expression
11271can be moved by GCSE optimizations.  This is currently supported only in the
11272code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
11273is with simple expressions, i.e., the expressions that have cost
11274less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
11275hoisting of simple expressions.
11276
11277@item gcse-unrestricted-cost
11278Cost, roughly measured as the cost of a single typical machine
11279instruction, at which GCSE optimizations do not constrain
11280the distance an expression can travel.  This is currently
11281supported only in the code hoisting pass.  The lesser the cost,
11282the more aggressive code hoisting is.  Specifying 0
11283allows all expressions to travel unrestricted distances.
11284
11285@item max-hoist-depth
11286The depth of search in the dominator tree for expressions to hoist.
11287This is used to avoid quadratic behavior in hoisting algorithm.
11288The value of 0 does not limit on the search, but may slow down compilation
11289of huge functions.
11290
11291@item max-tail-merge-comparisons
11292The maximum amount of similar bbs to compare a bb with.  This is used to
11293avoid quadratic behavior in tree tail merging.
11294
11295@item max-tail-merge-iterations
11296The maximum amount of iterations of the pass over the function.  This is used to
11297limit compilation time in tree tail merging.
11298
11299@item store-merging-allow-unaligned
11300Allow the store merging pass to introduce unaligned stores if it is legal to
11301do so.
11302
11303@item max-stores-to-merge
11304The maximum number of stores to attempt to merge into wider stores in the store
11305merging pass.
11306
11307@item max-unrolled-insns
11308The maximum number of instructions that a loop may have to be unrolled.
11309If a loop is unrolled, this parameter also determines how many times
11310the loop code is unrolled.
11311
11312@item max-average-unrolled-insns
11313The maximum number of instructions biased by probabilities of their execution
11314that a loop may have to be unrolled.  If a loop is unrolled,
11315this parameter also determines how many times the loop code is unrolled.
11316
11317@item max-unroll-times
11318The maximum number of unrollings of a single loop.
11319
11320@item max-peeled-insns
11321The maximum number of instructions that a loop may have to be peeled.
11322If a loop is peeled, this parameter also determines how many times
11323the loop code is peeled.
11324
11325@item max-peel-times
11326The maximum number of peelings of a single loop.
11327
11328@item max-peel-branches
11329The maximum number of branches on the hot path through the peeled sequence.
11330
11331@item max-completely-peeled-insns
11332The maximum number of insns of a completely peeled loop.
11333
11334@item max-completely-peel-times
11335The maximum number of iterations of a loop to be suitable for complete peeling.
11336
11337@item max-completely-peel-loop-nest-depth
11338The maximum depth of a loop nest suitable for complete peeling.
11339
11340@item max-unswitch-insns
11341The maximum number of insns of an unswitched loop.
11342
11343@item max-unswitch-level
11344The maximum number of branches unswitched in a single loop.
11345
11346@item lim-expensive
11347The minimum cost of an expensive expression in the loop invariant motion.
11348
11349@item iv-consider-all-candidates-bound
11350Bound on number of candidates for induction variables, below which
11351all candidates are considered for each use in induction variable
11352optimizations.  If there are more candidates than this,
11353only the most relevant ones are considered to avoid quadratic time complexity.
11354
11355@item iv-max-considered-uses
11356The induction variable optimizations give up on loops that contain more
11357induction variable uses.
11358
11359@item iv-always-prune-cand-set-bound
11360If the number of candidates in the set is smaller than this value,
11361always try to remove unnecessary ivs from the set
11362when adding a new one.
11363
11364@item avg-loop-niter
11365Average number of iterations of a loop.
11366
11367@item dse-max-object-size
11368Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11369Larger values may result in larger compilation times.
11370
11371@item dse-max-alias-queries-per-store
11372Maximum number of queries into the alias oracle per store.
11373Larger values result in larger compilation times and may result in more
11374removed dead stores.
11375
11376@item scev-max-expr-size
11377Bound on size of expressions used in the scalar evolutions analyzer.
11378Large expressions slow the analyzer.
11379
11380@item scev-max-expr-complexity
11381Bound on the complexity of the expressions in the scalar evolutions analyzer.
11382Complex expressions slow the analyzer.
11383
11384@item max-tree-if-conversion-phi-args
11385Maximum number of arguments in a PHI supported by TREE if conversion
11386unless the loop is marked with simd pragma.
11387
11388@item vect-max-version-for-alignment-checks
11389The maximum number of run-time checks that can be performed when
11390doing loop versioning for alignment in the vectorizer.
11391
11392@item vect-max-version-for-alias-checks
11393The maximum number of run-time checks that can be performed when
11394doing loop versioning for alias in the vectorizer.
11395
11396@item vect-max-peeling-for-alignment
11397The maximum number of loop peels to enhance access alignment
11398for vectorizer. Value -1 means no limit.
11399
11400@item max-iterations-to-track
11401The maximum number of iterations of a loop the brute-force algorithm
11402for analysis of the number of iterations of the loop tries to evaluate.
11403
11404@item hot-bb-count-ws-permille
11405A basic block profile count is considered hot if it contributes to
11406the given permillage (i.e.@: 0...1000) of the entire profiled execution.
11407
11408@item hot-bb-frequency-fraction
11409Select fraction of the entry block frequency of executions of basic block in
11410function given basic block needs to have to be considered hot.
11411
11412@item max-predicted-iterations
11413The maximum number of loop iterations we predict statically.  This is useful
11414in cases where a function contains a single loop with known bound and
11415another loop with unknown bound.
11416The known number of iterations is predicted correctly, while
11417the unknown number of iterations average to roughly 10.  This means that the
11418loop without bounds appears artificially cold relative to the other one.
11419
11420@item builtin-expect-probability
11421Control the probability of the expression having the specified value. This
11422parameter takes a percentage (i.e.@: 0 ... 100) as input.
11423
11424@item builtin-string-cmp-inline-length
11425The maximum length of a constant string for a builtin string cmp call
11426eligible for inlining.
11427
11428@item align-threshold
11429
11430Select fraction of the maximal frequency of executions of a basic block in
11431a function to align the basic block.
11432
11433@item align-loop-iterations
11434
11435A loop expected to iterate at least the selected number of iterations is
11436aligned.
11437
11438@item tracer-dynamic-coverage
11439@itemx tracer-dynamic-coverage-feedback
11440
11441This value is used to limit superblock formation once the given percentage of
11442executed instructions is covered.  This limits unnecessary code size
11443expansion.
11444
11445The @option{tracer-dynamic-coverage-feedback} parameter
11446is used only when profile
11447feedback is available.  The real profiles (as opposed to statically estimated
11448ones) are much less balanced allowing the threshold to be larger value.
11449
11450@item tracer-max-code-growth
11451Stop tail duplication once code growth has reached given percentage.  This is
11452a rather artificial limit, as most of the duplicates are eliminated later in
11453cross jumping, so it may be set to much higher values than is the desired code
11454growth.
11455
11456@item tracer-min-branch-ratio
11457
11458Stop reverse growth when the reverse probability of best edge is less than this
11459threshold (in percent).
11460
11461@item tracer-min-branch-probability
11462@itemx tracer-min-branch-probability-feedback
11463
11464Stop forward growth if the best edge has probability lower than this
11465threshold.
11466
11467Similarly to @option{tracer-dynamic-coverage} two parameters are
11468provided.  @option{tracer-min-branch-probability-feedback} is used for
11469compilation with profile feedback and @option{tracer-min-branch-probability}
11470compilation without.  The value for compilation with profile feedback
11471needs to be more conservative (higher) in order to make tracer
11472effective.
11473
11474@item stack-clash-protection-guard-size
11475Specify the size of the operating system provided stack guard as
114762 raised to @var{num} bytes.  Higher values may reduce the
11477number of explicit probes, but a value larger than the operating system
11478provided guard will leave code vulnerable to stack clash style attacks.
11479
11480@item stack-clash-protection-probe-interval
11481Stack clash protection involves probing stack space as it is allocated.  This
11482param controls the maximum distance between probes into the stack as 2 raised
11483to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
11484larger than the operating system provided guard will leave code vulnerable to
11485stack clash style attacks.
11486
11487@item max-cse-path-length
11488
11489The maximum number of basic blocks on path that CSE considers.
11490
11491@item max-cse-insns
11492The maximum number of instructions CSE processes before flushing.
11493
11494@item ggc-min-expand
11495
11496GCC uses a garbage collector to manage its own memory allocation.  This
11497parameter specifies the minimum percentage by which the garbage
11498collector's heap should be allowed to expand between collections.
11499Tuning this may improve compilation speed; it has no effect on code
11500generation.
11501
11502The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11503RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
11504the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
11505GCC is not able to calculate RAM on a particular platform, the lower
11506bound of 30% is used.  Setting this parameter and
11507@option{ggc-min-heapsize} to zero causes a full collection to occur at
11508every opportunity.  This is extremely slow, but can be useful for
11509debugging.
11510
11511@item ggc-min-heapsize
11512
11513Minimum size of the garbage collector's heap before it begins bothering
11514to collect garbage.  The first collection occurs after the heap expands
11515by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
11516tuning this may improve compilation speed, and has no effect on code
11517generation.
11518
11519The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11520tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11521with a lower bound of 4096 (four megabytes) and an upper bound of
11522131072 (128 megabytes).  If GCC is not able to calculate RAM on a
11523particular platform, the lower bound is used.  Setting this parameter
11524very large effectively disables garbage collection.  Setting this
11525parameter and @option{ggc-min-expand} to zero causes a full collection
11526to occur at every opportunity.
11527
11528@item max-reload-search-insns
11529The maximum number of instruction reload should look backward for equivalent
11530register.  Increasing values mean more aggressive optimization, making the
11531compilation time increase with probably slightly better performance.
11532
11533@item max-cselib-memory-locations
11534The maximum number of memory locations cselib should take into account.
11535Increasing values mean more aggressive optimization, making the compilation time
11536increase with probably slightly better performance.
11537
11538@item max-sched-ready-insns
11539The maximum number of instructions ready to be issued the scheduler should
11540consider at any given time during the first scheduling pass.  Increasing
11541values mean more thorough searches, making the compilation time increase
11542with probably little benefit.
11543
11544@item max-sched-region-blocks
11545The maximum number of blocks in a region to be considered for
11546interblock scheduling.
11547
11548@item max-pipeline-region-blocks
11549The maximum number of blocks in a region to be considered for
11550pipelining in the selective scheduler.
11551
11552@item max-sched-region-insns
11553The maximum number of insns in a region to be considered for
11554interblock scheduling.
11555
11556@item max-pipeline-region-insns
11557The maximum number of insns in a region to be considered for
11558pipelining in the selective scheduler.
11559
11560@item min-spec-prob
11561The minimum probability (in percents) of reaching a source block
11562for interblock speculative scheduling.
11563
11564@item max-sched-extend-regions-iters
11565The maximum number of iterations through CFG to extend regions.
11566A value of 0 disables region extensions.
11567
11568@item max-sched-insn-conflict-delay
11569The maximum conflict delay for an insn to be considered for speculative motion.
11570
11571@item sched-spec-prob-cutoff
11572The minimal probability of speculation success (in percents), so that
11573speculative insns are scheduled.
11574
11575@item sched-state-edge-prob-cutoff
11576The minimum probability an edge must have for the scheduler to save its
11577state across it.
11578
11579@item sched-mem-true-dep-cost
11580Minimal distance (in CPU cycles) between store and load targeting same
11581memory locations.
11582
11583@item selsched-max-lookahead
11584The maximum size of the lookahead window of selective scheduling.  It is a
11585depth of search for available instructions.
11586
11587@item selsched-max-sched-times
11588The maximum number of times that an instruction is scheduled during
11589selective scheduling.  This is the limit on the number of iterations
11590through which the instruction may be pipelined.
11591
11592@item selsched-insns-to-rename
11593The maximum number of best instructions in the ready list that are considered
11594for renaming in the selective scheduler.
11595
11596@item sms-min-sc
11597The minimum value of stage count that swing modulo scheduler
11598generates.
11599
11600@item max-last-value-rtl
11601The maximum size measured as number of RTLs that can be recorded in an expression
11602in combiner for a pseudo register as last known value of that register.
11603
11604@item max-combine-insns
11605The maximum number of instructions the RTL combiner tries to combine.
11606
11607@item integer-share-limit
11608Small integer constants can use a shared data structure, reducing the
11609compiler's memory usage and increasing its speed.  This sets the maximum
11610value of a shared integer constant.
11611
11612@item ssp-buffer-size
11613The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11614protection when @option{-fstack-protection} is used.
11615
11616@item min-size-for-stack-sharing
11617The minimum size of variables taking part in stack slot sharing when not
11618optimizing.
11619
11620@item max-jump-thread-duplication-stmts
11621Maximum number of statements allowed in a block that needs to be
11622duplicated when threading jumps.
11623
11624@item max-fields-for-field-sensitive
11625Maximum number of fields in a structure treated in
11626a field sensitive manner during pointer analysis.
11627
11628@item prefetch-latency
11629Estimate on average number of instructions that are executed before
11630prefetch finishes.  The distance prefetched ahead is proportional
11631to this constant.  Increasing this number may also lead to less
11632streams being prefetched (see @option{simultaneous-prefetches}).
11633
11634@item simultaneous-prefetches
11635Maximum number of prefetches that can run at the same time.
11636
11637@item l1-cache-line-size
11638The size of cache line in L1 data cache, in bytes.
11639
11640@item l1-cache-size
11641The size of L1 data cache, in kilobytes.
11642
11643@item l2-cache-size
11644The size of L2 data cache, in kilobytes.
11645
11646@item prefetch-dynamic-strides
11647Whether the loop array prefetch pass should issue software prefetch hints
11648for strides that are non-constant.  In some cases this may be
11649beneficial, though the fact the stride is non-constant may make it
11650hard to predict when there is clear benefit to issuing these hints.
11651
11652Set to 1 if the prefetch hints should be issued for non-constant
11653strides.  Set to 0 if prefetch hints should be issued only for strides that
11654are known to be constant and below @option{prefetch-minimum-stride}.
11655
11656@item prefetch-minimum-stride
11657Minimum constant stride, in bytes, to start using prefetch hints for.  If
11658the stride is less than this threshold, prefetch hints will not be issued.
11659
11660This setting is useful for processors that have hardware prefetchers, in
11661which case there may be conflicts between the hardware prefetchers and
11662the software prefetchers.  If the hardware prefetchers have a maximum
11663stride they can handle, it should be used here to improve the use of
11664software prefetchers.
11665
11666A value of -1 means we don't have a threshold and therefore
11667prefetch hints can be issued for any constant stride.
11668
11669This setting is only useful for strides that are known and constant.
11670
11671@item loop-interchange-max-num-stmts
11672The maximum number of stmts in a loop to be interchanged.
11673
11674@item loop-interchange-stride-ratio
11675The minimum ratio between stride of two loops for interchange to be profitable.
11676
11677@item min-insn-to-prefetch-ratio
11678The minimum ratio between the number of instructions and the
11679number of prefetches to enable prefetching in a loop.
11680
11681@item prefetch-min-insn-to-mem-ratio
11682The minimum ratio between the number of instructions and the
11683number of memory references to enable prefetching in a loop.
11684
11685@item use-canonical-types
11686Whether the compiler should use the ``canonical'' type system.
11687Should always be 1, which uses a more efficient internal
11688mechanism for comparing types in C++ and Objective-C++.  However, if
11689bugs in the canonical type system are causing compilation failures,
11690set this value to 0 to disable canonical types.
11691
11692@item switch-conversion-max-branch-ratio
11693Switch initialization conversion refuses to create arrays that are
11694bigger than @option{switch-conversion-max-branch-ratio} times the number of
11695branches in the switch.
11696
11697@item max-partial-antic-length
11698Maximum length of the partial antic set computed during the tree
11699partial redundancy elimination optimization (@option{-ftree-pre}) when
11700optimizing at @option{-O3} and above.  For some sorts of source code
11701the enhanced partial redundancy elimination optimization can run away,
11702consuming all of the memory available on the host machine.  This
11703parameter sets a limit on the length of the sets that are computed,
11704which prevents the runaway behavior.  Setting a value of 0 for
11705this parameter allows an unlimited set length.
11706
11707@item rpo-vn-max-loop-depth
11708Maximum loop depth that is value-numbered optimistically.
11709When the limit hits the innermost
11710@var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11711loop nest are value-numbered optimistically and the remaining ones not.
11712
11713@item sccvn-max-alias-queries-per-access
11714Maximum number of alias-oracle queries we perform when looking for
11715redundancies for loads and stores.  If this limit is hit the search
11716is aborted and the load or store is not considered redundant.  The
11717number of queries is algorithmically limited to the number of
11718stores on all paths from the load to the function entry.
11719
11720@item ira-max-loops-num
11721IRA uses regional register allocation by default.  If a function
11722contains more loops than the number given by this parameter, only at most
11723the given number of the most frequently-executed loops form regions
11724for regional register allocation.
11725
11726@item ira-max-conflict-table-size
11727Although IRA uses a sophisticated algorithm to compress the conflict
11728table, the table can still require excessive amounts of memory for
11729huge functions.  If the conflict table for a function could be more
11730than the size in MB given by this parameter, the register allocator
11731instead uses a faster, simpler, and lower-quality
11732algorithm that does not require building a pseudo-register conflict table.
11733
11734@item ira-loop-reserved-regs
11735IRA can be used to evaluate more accurate register pressure in loops
11736for decisions to move loop invariants (see @option{-O3}).  The number
11737of available registers reserved for some other purposes is given
11738by this parameter.  Default of the parameter
11739is the best found from numerous experiments.
11740
11741@item lra-inheritance-ebb-probability-cutoff
11742LRA tries to reuse values reloaded in registers in subsequent insns.
11743This optimization is called inheritance.  EBB is used as a region to
11744do this optimization.  The parameter defines a minimal fall-through
11745edge probability in percentage used to add BB to inheritance EBB in
11746LRA.  The default value was chosen
11747from numerous runs of SPEC2000 on x86-64.
11748
11749@item loop-invariant-max-bbs-in-loop
11750Loop invariant motion can be very expensive, both in compilation time and
11751in amount of needed compile-time memory, with very large loops.  Loops
11752with more basic blocks than this parameter won't have loop invariant
11753motion optimization performed on them.
11754
11755@item loop-max-datarefs-for-datadeps
11756Building data dependencies is expensive for very large loops.  This
11757parameter limits the number of data references in loops that are
11758considered for data dependence analysis.  These large loops are no
11759handled by the optimizations using loop data dependencies.
11760
11761@item max-vartrack-size
11762Sets a maximum number of hash table slots to use during variable
11763tracking dataflow analysis of any function.  If this limit is exceeded
11764with variable tracking at assignments enabled, analysis for that
11765function is retried without it, after removing all debug insns from
11766the function.  If the limit is exceeded even without debug insns, var
11767tracking analysis is completely disabled for the function.  Setting
11768the parameter to zero makes it unlimited.
11769
11770@item max-vartrack-expr-depth
11771Sets a maximum number of recursion levels when attempting to map
11772variable names or debug temporaries to value expressions.  This trades
11773compilation time for more complete debug information.  If this is set too
11774low, value expressions that are available and could be represented in
11775debug information may end up not being used; setting this higher may
11776enable the compiler to find more complex debug expressions, but compile
11777time and memory use may grow.
11778
11779@item max-debug-marker-count
11780Sets a threshold on the number of debug markers (e.g.@: begin stmt
11781markers) to avoid complexity explosion at inlining or expanding to RTL.
11782If a function has more such gimple stmts than the set limit, such stmts
11783will be dropped from the inlined copy of a function, and from its RTL
11784expansion.
11785
11786@item min-nondebug-insn-uid
11787Use uids starting at this parameter for nondebug insns.  The range below
11788the parameter is reserved exclusively for debug insns created by
11789@option{-fvar-tracking-assignments}, but debug insns may get
11790(non-overlapping) uids above it if the reserved range is exhausted.
11791
11792@item ipa-sra-ptr-growth-factor
11793IPA-SRA replaces a pointer to an aggregate with one or more new
11794parameters only when their cumulative size is less or equal to
11795@option{ipa-sra-ptr-growth-factor} times the size of the original
11796pointer parameter.
11797
11798@item sra-max-scalarization-size-Ospeed
11799@itemx sra-max-scalarization-size-Osize
11800The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11801replace scalar parts of aggregates with uses of independent scalar
11802variables.  These parameters control the maximum size, in storage units,
11803of aggregate which is considered for replacement when compiling for
11804speed
11805(@option{sra-max-scalarization-size-Ospeed}) or size
11806(@option{sra-max-scalarization-size-Osize}) respectively.
11807
11808@item sra-max-propagations
11809The maximum number of artificial accesses that Scalar Replacement of
11810Aggregates (SRA) will track, per one local variable, in order to
11811facilitate copy propagation.
11812
11813@item tm-max-aggregate-size
11814When making copies of thread-local variables in a transaction, this
11815parameter specifies the size in bytes after which variables are
11816saved with the logging functions as opposed to save/restore code
11817sequence pairs.  This option only applies when using
11818@option{-fgnu-tm}.
11819
11820@item graphite-max-nb-scop-params
11821To avoid exponential effects in the Graphite loop transforms, the
11822number of parameters in a Static Control Part (SCoP) is bounded.
11823A value of zero can be used to lift
11824the bound.  A variable whose value is unknown at compilation time and
11825defined outside a SCoP is a parameter of the SCoP.
11826
11827@item loop-block-tile-size
11828Loop blocking or strip mining transforms, enabled with
11829@option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11830loop in the loop nest by a given number of iterations.  The strip
11831length can be changed using the @option{loop-block-tile-size}
11832parameter.
11833
11834@item ipa-cp-value-list-size
11835IPA-CP attempts to track all possible values and types passed to a function's
11836parameter in order to propagate them and perform devirtualization.
11837@option{ipa-cp-value-list-size} is the maximum number of values and types it
11838stores per one formal parameter of a function.
11839
11840@item ipa-cp-eval-threshold
11841IPA-CP calculates its own score of cloning profitability heuristics
11842and performs those cloning opportunities with scores that exceed
11843@option{ipa-cp-eval-threshold}.
11844
11845@item ipa-cp-recursion-penalty
11846Percentage penalty the recursive functions will receive when they
11847are evaluated for cloning.
11848
11849@item ipa-cp-single-call-penalty
11850Percentage penalty functions containing a single call to another
11851function will receive when they are evaluated for cloning.
11852
11853@item ipa-max-agg-items
11854IPA-CP is also capable to propagate a number of scalar values passed
11855in an aggregate. @option{ipa-max-agg-items} controls the maximum
11856number of such values per one parameter.
11857
11858@item ipa-cp-loop-hint-bonus
11859When IPA-CP determines that a cloning candidate would make the number
11860of iterations of a loop known, it adds a bonus of
11861@option{ipa-cp-loop-hint-bonus} to the profitability score of
11862the candidate.
11863
11864@item ipa-cp-array-index-hint-bonus
11865When IPA-CP determines that a cloning candidate would make the index of
11866an array access known, it adds a bonus of
11867@option{ipa-cp-array-index-hint-bonus} to the profitability
11868score of the candidate.
11869
11870@item ipa-max-aa-steps
11871During its analysis of function bodies, IPA-CP employs alias analysis
11872in order to track values pointed to by function parameters.  In order
11873not spend too much time analyzing huge functions, it gives up and
11874consider all memory clobbered after examining
11875@option{ipa-max-aa-steps} statements modifying memory.
11876
11877@item lto-partitions
11878Specify desired number of partitions produced during WHOPR compilation.
11879The number of partitions should exceed the number of CPUs used for compilation.
11880
11881@item lto-min-partition
11882Size of minimal partition for WHOPR (in estimated instructions).
11883This prevents expenses of splitting very small programs into too many
11884partitions.
11885
11886@item lto-max-partition
11887Size of max partition for WHOPR (in estimated instructions).
11888to provide an upper bound for individual size of partition.
11889Meant to be used only with balanced partitioning.
11890
11891@item lto-max-streaming-parallelism
11892Maximal number of parallel processes used for LTO streaming.
11893
11894@item cxx-max-namespaces-for-diagnostic-help
11895The maximum number of namespaces to consult for suggestions when C++
11896name lookup fails for an identifier.
11897
11898@item sink-frequency-threshold
11899The maximum relative execution frequency (in percents) of the target block
11900relative to a statement's original block to allow statement sinking of a
11901statement.  Larger numbers result in more aggressive statement sinking.
11902A small positive adjustment is applied for
11903statements with memory operands as those are even more profitable so sink.
11904
11905@item max-stores-to-sink
11906The maximum number of conditional store pairs that can be sunk.  Set to 0
11907if either vectorization (@option{-ftree-vectorize}) or if-conversion
11908(@option{-ftree-loop-if-convert}) is disabled.
11909
11910@item allow-store-data-races
11911Allow optimizers to introduce new data races on stores.
11912Set to 1 to allow, otherwise to 0.
11913
11914@item case-values-threshold
11915The smallest number of different values for which it is best to use a
11916jump-table instead of a tree of conditional branches.  If the value is
119170, use the default for the machine.
11918
11919@item tree-reassoc-width
11920Set the maximum number of instructions executed in parallel in
11921reassociated tree. This parameter overrides target dependent
11922heuristics used by default if has non zero value.
11923
11924@item sched-pressure-algorithm
11925Choose between the two available implementations of
11926@option{-fsched-pressure}.  Algorithm 1 is the original implementation
11927and is the more likely to prevent instructions from being reordered.
11928Algorithm 2 was designed to be a compromise between the relatively
11929conservative approach taken by algorithm 1 and the rather aggressive
11930approach taken by the default scheduler.  It relies more heavily on
11931having a regular register file and accurate register pressure classes.
11932See @file{haifa-sched.c} in the GCC sources for more details.
11933
11934The default choice depends on the target.
11935
11936@item max-slsr-cand-scan
11937Set the maximum number of existing candidates that are considered when
11938seeking a basis for a new straight-line strength reduction candidate.
11939
11940@item asan-globals
11941Enable buffer overflow detection for global objects.  This kind
11942of protection is enabled by default if you are using
11943@option{-fsanitize=address} option.
11944To disable global objects protection use @option{--param asan-globals=0}.
11945
11946@item asan-stack
11947Enable buffer overflow detection for stack objects.  This kind of
11948protection is enabled by default when using @option{-fsanitize=address}.
11949To disable stack protection use @option{--param asan-stack=0} option.
11950
11951@item asan-instrument-reads
11952Enable buffer overflow detection for memory reads.  This kind of
11953protection is enabled by default when using @option{-fsanitize=address}.
11954To disable memory reads protection use
11955@option{--param asan-instrument-reads=0}.
11956
11957@item asan-instrument-writes
11958Enable buffer overflow detection for memory writes.  This kind of
11959protection is enabled by default when using @option{-fsanitize=address}.
11960To disable memory writes protection use
11961@option{--param asan-instrument-writes=0} option.
11962
11963@item asan-memintrin
11964Enable detection for built-in functions.  This kind of protection
11965is enabled by default when using @option{-fsanitize=address}.
11966To disable built-in functions protection use
11967@option{--param asan-memintrin=0}.
11968
11969@item asan-use-after-return
11970Enable detection of use-after-return.  This kind of protection
11971is enabled by default when using the @option{-fsanitize=address} option.
11972To disable it use @option{--param asan-use-after-return=0}.
11973
11974Note: By default the check is disabled at run time.  To enable it,
11975add @code{detect_stack_use_after_return=1} to the environment variable
11976@env{ASAN_OPTIONS}.
11977
11978@item asan-instrumentation-with-call-threshold
11979If number of memory accesses in function being instrumented
11980is greater or equal to this number, use callbacks instead of inline checks.
11981E.g. to disable inline code use
11982@option{--param asan-instrumentation-with-call-threshold=0}.
11983
11984@item use-after-scope-direct-emission-threshold
11985If the size of a local variable in bytes is smaller or equal to this
11986number, directly poison (or unpoison) shadow memory instead of using
11987run-time callbacks.
11988
11989@item max-fsm-thread-path-insns
11990Maximum number of instructions to copy when duplicating blocks on a
11991finite state automaton jump thread path.
11992
11993@item max-fsm-thread-length
11994Maximum number of basic blocks on a finite state automaton jump thread
11995path.
11996
11997@item max-fsm-thread-paths
11998Maximum number of new jump thread paths to create for a finite state
11999automaton.
12000
12001@item parloops-chunk-size
12002Chunk size of omp schedule for loops parallelized by parloops.
12003
12004@item parloops-schedule
12005Schedule type of omp schedule for loops parallelized by parloops (static,
12006dynamic, guided, auto, runtime).
12007
12008@item parloops-min-per-thread
12009The minimum number of iterations per thread of an innermost parallelized
12010loop for which the parallelized variant is preferred over the single threaded
12011one.  Note that for a parallelized loop nest the
12012minimum number of iterations of the outermost loop per thread is two.
12013
12014@item max-ssa-name-query-depth
12015Maximum depth of recursion when querying properties of SSA names in things
12016like fold routines.  One level of recursion corresponds to following a
12017use-def chain.
12018
12019@item hsa-gen-debug-stores
12020Enable emission of special debug stores within HSA kernels which are
12021then read and reported by libgomp plugin.  Generation of these stores
12022is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12023enable it.
12024
12025@item max-speculative-devirt-maydefs
12026The maximum number of may-defs we analyze when looking for a must-def
12027specifying the dynamic type of an object that invokes a virtual call
12028we may be able to devirtualize speculatively.
12029
12030@item max-vrp-switch-assertions
12031The maximum number of assertions to add along the default edge of a switch
12032statement during VRP.
12033
12034@item unroll-jam-min-percent
12035The minimum percentage of memory references that must be optimized
12036away for the unroll-and-jam transformation to be considered profitable.
12037
12038@item unroll-jam-max-unroll
12039The maximum number of times the outer loop should be unrolled by
12040the unroll-and-jam transformation.
12041
12042@item max-rtl-if-conversion-unpredictable-cost
12043Maximum permissible cost for the sequence that would be generated
12044by the RTL if-conversion pass for a branch that is considered unpredictable.
12045
12046@item max-variable-expansions-in-unroller
12047If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12048of times that an individual variable will be expanded during loop unrolling.
12049
12050@item tracer-min-branch-probability-feedback
12051Stop forward growth if the probability of best edge is less than
12052this threshold (in percent). Used when profile feedback is available.
12053
12054@item partial-inlining-entry-probability
12055Maximum probability of the entry BB of split region
12056(in percent relative to entry BB of the function)
12057to make partial inlining happen.
12058
12059@item max-tracked-strlens
12060Maximum number of strings for which strlen optimization pass will
12061track string lengths.
12062
12063@item gcse-after-reload-partial-fraction
12064The threshold ratio for performing partial redundancy
12065elimination after reload.
12066
12067@item gcse-after-reload-critical-fraction
12068The threshold ratio of critical edges execution count that
12069permit performing redundancy elimination after reload.
12070
12071@item max-loop-header-insns
12072The maximum number of insns in loop header duplicated
12073by the copy loop headers pass.
12074
12075@item vect-epilogues-nomask
12076Enable loop epilogue vectorization using smaller vector size.
12077
12078@item slp-max-insns-in-bb
12079Maximum number of instructions in basic block to be
12080considered for SLP vectorization.
12081
12082@item avoid-fma-max-bits
12083Maximum number of bits for which we avoid creating FMAs.
12084
12085@item sms-loop-average-count-threshold
12086A threshold on the average loop count considered by the swing modulo scheduler.
12087
12088@item sms-dfa-history
12089The number of cycles the swing modulo scheduler considers when checking
12090conflicts using DFA.
12091
12092@item hot-bb-count-fraction
12093Select fraction of the maximal count of repetitions of basic block
12094in program given basic block needs
12095to have to be considered hot (used in non-LTO mode)
12096
12097@item max-inline-insns-recursive-auto
12098The maximum number of instructions non-inline function
12099can grow to via recursive inlining.
12100
12101@item graphite-allow-codegen-errors
12102Whether codegen errors should be ICEs when @option{-fchecking}.
12103
12104@item sms-max-ii-factor
12105A factor for tuning the upper bound that swing modulo scheduler
12106uses for scheduling a loop.
12107
12108@item lra-max-considered-reload-pseudos
12109The max number of reload pseudos which are considered during
12110spilling a non-reload pseudo.
12111
12112@item max-pow-sqrt-depth
12113Maximum depth of sqrt chains to use when synthesizing exponentiation
12114by a real constant.
12115
12116@item max-dse-active-local-stores
12117Maximum number of active local stores in RTL dead store elimination.
12118
12119@item asan-instrument-allocas
12120Enable asan allocas/VLAs protection.
12121
12122@item max-iterations-computation-cost
12123Bound on the cost of an expression to compute the number of iterations.
12124
12125@item max-isl-operations
12126Maximum number of isl operations, 0 means unlimited.
12127
12128@item graphite-max-arrays-per-scop
12129Maximum number of arrays per scop.
12130
12131@item max-vartrack-reverse-op-size
12132Max. size of loc list for which reverse ops should be added.
12133
12134@item unlikely-bb-count-fraction
12135The minimum fraction of profile runs a given basic block execution count
12136must be not to be considered unlikely.
12137
12138@item tracer-dynamic-coverage-feedback
12139The percentage of function, weighted by execution frequency,
12140that must be covered by trace formation.
12141Used when profile feedback is available.
12142
12143@item max-inline-recursive-depth-auto
12144The maximum depth of recursive inlining for non-inline functions.
12145
12146@item fsm-scale-path-stmts
12147Scale factor to apply to the number of statements in a threading path
12148when comparing to the number of (scaled) blocks.
12149
12150@item fsm-maximum-phi-arguments
12151Maximum number of arguments a PHI may have before the FSM threader
12152will not try to thread through its block.
12153
12154@item uninit-control-dep-attempts
12155Maximum number of nested calls to search for control dependencies
12156during uninitialized variable analysis.
12157
12158@item indir-call-topn-profile
12159Track top N target addresses in indirect-call profile.
12160
12161@item max-once-peeled-insns
12162The maximum number of insns of a peeled loop that rolls only once.
12163
12164@item sra-max-scalarization-size-Osize
12165Maximum size, in storage units, of an aggregate
12166which should be considered for scalarization when compiling for size.
12167
12168@item fsm-scale-path-blocks
12169Scale factor to apply to the number of blocks in a threading path
12170when comparing to the number of (scaled) statements.
12171
12172@item sched-autopref-queue-depth
12173Hardware autoprefetcher scheduler model control flag.
12174Number of lookahead cycles the model looks into; at '
12175' only enable instruction sorting heuristic.
12176
12177@item loop-versioning-max-inner-insns
12178The maximum number of instructions that an inner loop can have
12179before the loop versioning pass considers it too big to copy.
12180
12181@item loop-versioning-max-outer-insns
12182The maximum number of instructions that an outer loop can have
12183before the loop versioning pass considers it too big to copy,
12184discounting any instructions in inner loops that directly benefit
12185from versioning.
12186
12187@item ssa-name-def-chain-limit
12188The maximum number of SSA_NAME assignments to follow in determining
12189a property of a variable such as its value.  This limits the number
12190of iterations or recursive calls GCC performs when optimizing certain
12191statements or when determining their validity prior to issuing
12192diagnostics.
12193
12194@end table
12195@end table
12196
12197@node Instrumentation Options
12198@section Program Instrumentation Options
12199@cindex instrumentation options
12200@cindex program instrumentation options
12201@cindex run-time error checking options
12202@cindex profiling options
12203@cindex options, program instrumentation
12204@cindex options, run-time error checking
12205@cindex options, profiling
12206
12207GCC supports a number of command-line options that control adding
12208run-time instrumentation to the code it normally generates.
12209For example, one purpose of instrumentation is collect profiling
12210statistics for use in finding program hot spots, code coverage
12211analysis, or profile-guided optimizations.
12212Another class of program instrumentation is adding run-time checking
12213to detect programming errors like invalid pointer
12214dereferences or out-of-bounds array accesses, as well as deliberately
12215hostile attacks such as stack smashing or C++ vtable hijacking.
12216There is also a general hook which can be used to implement other
12217forms of tracing or function-level instrumentation for debug or
12218program analysis purposes.
12219
12220@table @gcctabopt
12221@cindex @command{prof}
12222@cindex @command{gprof}
12223@item -p
12224@itemx -pg
12225@opindex p
12226@opindex pg
12227Generate extra code to write profile information suitable for the
12228analysis program @command{prof} (for @option{-p}) or @command{gprof}
12229(for @option{-pg}).  You must use this option when compiling
12230the source files you want data about, and you must also use it when
12231linking.
12232
12233You can use the function attribute @code{no_instrument_function} to
12234suppress profiling of individual functions when compiling with these options.
12235@xref{Common Function Attributes}.
12236
12237@item -fprofile-arcs
12238@opindex fprofile-arcs
12239Add code so that program flow @dfn{arcs} are instrumented.  During
12240execution the program records how many times each branch and call is
12241executed and how many times it is taken or returns.  On targets that support
12242constructors with priority support, profiling properly handles constructors,
12243destructors and C++ constructors (and destructors) of classes which are used
12244as a type of a global variable.
12245
12246When the compiled
12247program exits it saves this data to a file called
12248@file{@var{auxname}.gcda} for each source file.  The data may be used for
12249profile-directed optimizations (@option{-fbranch-probabilities}), or for
12250test coverage analysis (@option{-ftest-coverage}).  Each object file's
12251@var{auxname} is generated from the name of the output file, if
12252explicitly specified and it is not the final executable, otherwise it is
12253the basename of the source file.  In both cases any suffix is removed
12254(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12255@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12256@xref{Cross-profiling}.
12257
12258@cindex @command{gcov}
12259@item --coverage
12260@opindex coverage
12261
12262This option is used to compile and link code instrumented for coverage
12263analysis.  The option is a synonym for @option{-fprofile-arcs}
12264@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12265linking).  See the documentation for those options for more details.
12266
12267@itemize
12268
12269@item
12270Compile the source files with @option{-fprofile-arcs} plus optimization
12271and code generation options.  For test coverage analysis, use the
12272additional @option{-ftest-coverage} option.  You do not need to profile
12273every source file in a program.
12274
12275@item
12276Compile the source files additionally with @option{-fprofile-abs-path}
12277to create absolute path names in the @file{.gcno} files.  This allows
12278@command{gcov} to find the correct sources in projects where compilations
12279occur with different working directories.
12280
12281@item
12282Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12283(the latter implies the former).
12284
12285@item
12286Run the program on a representative workload to generate the arc profile
12287information.  This may be repeated any number of times.  You can run
12288concurrent instances of your program, and provided that the file system
12289supports locking, the data files will be correctly updated.  Unless
12290a strict ISO C dialect option is in effect, @code{fork} calls are
12291detected and correctly handled without double counting.
12292
12293@item
12294For profile-directed optimizations, compile the source files again with
12295the same optimization and code generation options plus
12296@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12297Control Optimization}).
12298
12299@item
12300For test coverage analysis, use @command{gcov} to produce human readable
12301information from the @file{.gcno} and @file{.gcda} files.  Refer to the
12302@command{gcov} documentation for further information.
12303
12304@end itemize
12305
12306With @option{-fprofile-arcs}, for each function of your program GCC
12307creates a program flow graph, then finds a spanning tree for the graph.
12308Only arcs that are not on the spanning tree have to be instrumented: the
12309compiler adds code to count the number of times that these arcs are
12310executed.  When an arc is the only exit or only entrance to a block, the
12311instrumentation code can be added to the block; otherwise, a new basic
12312block must be created to hold the instrumentation code.
12313
12314@need 2000
12315@item -ftest-coverage
12316@opindex ftest-coverage
12317Produce a notes file that the @command{gcov} code-coverage utility
12318(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12319show program coverage.  Each source file's note file is called
12320@file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
12321above for a description of @var{auxname} and instructions on how to
12322generate test coverage data.  Coverage data matches the source files
12323more closely if you do not optimize.
12324
12325@item -fprofile-abs-path
12326@opindex fprofile-abs-path
12327Automatically convert relative source file names to absolute path names
12328in the @file{.gcno} files.  This allows @command{gcov} to find the correct
12329sources in projects where compilations occur with different working
12330directories.
12331
12332@item -fprofile-dir=@var{path}
12333@opindex fprofile-dir
12334
12335Set the directory to search for the profile data files in to @var{path}.
12336This option affects only the profile data generated by
12337@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12338and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12339and its related options.  Both absolute and relative paths can be used.
12340By default, GCC uses the current directory as @var{path}, thus the
12341profile data file appears in the same directory as the object file.
12342In order to prevent the file name clashing, if the object file name is
12343not an absolute path, we mangle the absolute path of the
12344@file{@var{sourcename}.gcda} file and use it as the file name of a
12345@file{.gcda} file.
12346
12347When an executable is run in a massive parallel environment, it is recommended
12348to save profile to different folders.  That can be done with variables
12349in @var{path} that are exported during run-time:
12350
12351@table @gcctabopt
12352
12353@item %p
12354process ID.
12355
12356@item %q@{VAR@}
12357value of environment variable @var{VAR}
12358
12359@end table
12360
12361@item -fprofile-generate
12362@itemx -fprofile-generate=@var{path}
12363@opindex fprofile-generate
12364
12365Enable options usually used for instrumenting application to produce
12366profile useful for later recompilation with profile feedback based
12367optimization.  You must use @option{-fprofile-generate} both when
12368compiling and when linking your program.
12369
12370The following options are enabled:
12371@option{-fprofile-arcs}, @option{-fprofile-values},
12372@option{-finline-functions}, and @option{-fipa-bit-cp}.
12373
12374If @var{path} is specified, GCC looks at the @var{path} to find
12375the profile feedback data files. See @option{-fprofile-dir}.
12376
12377To optimize the program based on the collected profile information, use
12378@option{-fprofile-use}.  @xref{Optimize Options}, for more information.
12379
12380@item -fprofile-update=@var{method}
12381@opindex fprofile-update
12382
12383Alter the update method for an application instrumented for profile
12384feedback based optimization.  The @var{method} argument should be one of
12385@samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12386The first one is useful for single-threaded applications,
12387while the second one prevents profile corruption by emitting thread-safe code.
12388
12389@strong{Warning:} When an application does not properly join all threads
12390(or creates an detached thread), a profile file can be still corrupted.
12391
12392Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12393when supported by a target, or to @samp{single} otherwise.  The GCC driver
12394automatically selects @samp{prefer-atomic} when @option{-pthread}
12395is present in the command line.
12396
12397@item -fprofile-filter-files=@var{regex}
12398@opindex fprofile-filter-files
12399
12400Instrument only functions from files where names match
12401any regular expression (separated by a semi-colon).
12402
12403For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12404only @file{main.c} and all C files starting with 'module'.
12405
12406@item -fprofile-exclude-files=@var{regex}
12407@opindex fprofile-exclude-files
12408
12409Instrument only functions from files where names do not match
12410all the regular expressions (separated by a semi-colon).
12411
12412For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12413of all files that are located in @file{/usr/} folder.
12414
12415@item -fsanitize=address
12416@opindex fsanitize=address
12417Enable AddressSanitizer, a fast memory error detector.
12418Memory access instructions are instrumented to detect
12419out-of-bounds and use-after-free bugs.
12420The option enables @option{-fsanitize-address-use-after-scope}.
12421See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12422more details.  The run-time behavior can be influenced using the
12423@env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
12424the available options are shown at startup of the instrumented program.  See
12425@url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12426for a list of supported options.
12427The option cannot be combined with @option{-fsanitize=thread}.
12428
12429@item -fsanitize=kernel-address
12430@opindex fsanitize=kernel-address
12431Enable AddressSanitizer for Linux kernel.
12432See @uref{https://github.com/google/kasan/wiki} for more details.
12433
12434@item -fsanitize=pointer-compare
12435@opindex fsanitize=pointer-compare
12436Instrument comparison operation (<, <=, >, >=) with pointer operands.
12437The option must be combined with either @option{-fsanitize=kernel-address} or
12438@option{-fsanitize=address}
12439The option cannot be combined with @option{-fsanitize=thread}.
12440Note: By default the check is disabled at run time.  To enable it,
12441add @code{detect_invalid_pointer_pairs=2} to the environment variable
12442@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12443invalid operation only when both pointers are non-null.
12444
12445@item -fsanitize=pointer-subtract
12446@opindex fsanitize=pointer-subtract
12447Instrument subtraction with pointer operands.
12448The option must be combined with either @option{-fsanitize=kernel-address} or
12449@option{-fsanitize=address}
12450The option cannot be combined with @option{-fsanitize=thread}.
12451Note: By default the check is disabled at run time.  To enable it,
12452add @code{detect_invalid_pointer_pairs=2} to the environment variable
12453@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12454invalid operation only when both pointers are non-null.
12455
12456@item -fsanitize=thread
12457@opindex fsanitize=thread
12458Enable ThreadSanitizer, a fast data race detector.
12459Memory access instructions are instrumented to detect
12460data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12461details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12462environment variable; see
12463@url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12464supported options.
12465The option cannot be combined with @option{-fsanitize=address},
12466@option{-fsanitize=leak}.
12467
12468Note that sanitized atomic builtins cannot throw exceptions when
12469operating on invalid memory addresses with non-call exceptions
12470(@option{-fnon-call-exceptions}).
12471
12472@item -fsanitize=leak
12473@opindex fsanitize=leak
12474Enable LeakSanitizer, a memory leak detector.
12475This option only matters for linking of executables and
12476the executable is linked against a library that overrides @code{malloc}
12477and other allocator functions.  See
12478@uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12479details.  The run-time behavior can be influenced using the
12480@env{LSAN_OPTIONS} environment variable.
12481The option cannot be combined with @option{-fsanitize=thread}.
12482
12483@item -fsanitize=undefined
12484@opindex fsanitize=undefined
12485Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12486Various computations are instrumented to detect undefined behavior
12487at runtime.  Current suboptions are:
12488
12489@table @gcctabopt
12490
12491@item -fsanitize=shift
12492@opindex fsanitize=shift
12493This option enables checking that the result of a shift operation is
12494not undefined.  Note that what exactly is considered undefined differs
12495slightly between C and C++, as well as between ISO C90 and C99, etc.
12496This option has two suboptions, @option{-fsanitize=shift-base} and
12497@option{-fsanitize=shift-exponent}.
12498
12499@item -fsanitize=shift-exponent
12500@opindex fsanitize=shift-exponent
12501This option enables checking that the second argument of a shift operation
12502is not negative and is smaller than the precision of the promoted first
12503argument.
12504
12505@item -fsanitize=shift-base
12506@opindex fsanitize=shift-base
12507If the second argument of a shift operation is within range, check that the
12508result of a shift operation is not undefined.  Note that what exactly is
12509considered undefined differs slightly between C and C++, as well as between
12510ISO C90 and C99, etc.
12511
12512@item -fsanitize=integer-divide-by-zero
12513@opindex fsanitize=integer-divide-by-zero
12514Detect integer division by zero as well as @code{INT_MIN / -1} division.
12515
12516@item -fsanitize=unreachable
12517@opindex fsanitize=unreachable
12518With this option, the compiler turns the @code{__builtin_unreachable}
12519call into a diagnostics message call instead.  When reaching the
12520@code{__builtin_unreachable} call, the behavior is undefined.
12521
12522@item -fsanitize=vla-bound
12523@opindex fsanitize=vla-bound
12524This option instructs the compiler to check that the size of a variable
12525length array is positive.
12526
12527@item -fsanitize=null
12528@opindex fsanitize=null
12529This option enables pointer checking.  Particularly, the application
12530built with this option turned on will issue an error message when it
12531tries to dereference a NULL pointer, or if a reference (possibly an
12532rvalue reference) is bound to a NULL pointer, or if a method is invoked
12533on an object pointed by a NULL pointer.
12534
12535@item -fsanitize=return
12536@opindex fsanitize=return
12537This option enables return statement checking.  Programs
12538built with this option turned on will issue an error message
12539when the end of a non-void function is reached without actually
12540returning a value.  This option works in C++ only.
12541
12542@item -fsanitize=signed-integer-overflow
12543@opindex fsanitize=signed-integer-overflow
12544This option enables signed integer overflow checking.  We check that
12545the result of @code{+}, @code{*}, and both unary and binary @code{-}
12546does not overflow in the signed arithmetics.  Note, integer promotion
12547rules must be taken into account.  That is, the following is not an
12548overflow:
12549@smallexample
12550signed char a = SCHAR_MAX;
12551a++;
12552@end smallexample
12553
12554@item -fsanitize=bounds
12555@opindex fsanitize=bounds
12556This option enables instrumentation of array bounds.  Various out of bounds
12557accesses are detected.  Flexible array members, flexible array member-like
12558arrays, and initializers of variables with static storage are not instrumented.
12559
12560@item -fsanitize=bounds-strict
12561@opindex fsanitize=bounds-strict
12562This option enables strict instrumentation of array bounds.  Most out of bounds
12563accesses are detected, including flexible array members and flexible array
12564member-like arrays.  Initializers of variables with static storage are not
12565instrumented.
12566
12567@item -fsanitize=alignment
12568@opindex fsanitize=alignment
12569
12570This option enables checking of alignment of pointers when they are
12571dereferenced, or when a reference is bound to insufficiently aligned target,
12572or when a method or constructor is invoked on insufficiently aligned object.
12573
12574@item -fsanitize=object-size
12575@opindex fsanitize=object-size
12576This option enables instrumentation of memory references using the
12577@code{__builtin_object_size} function.  Various out of bounds pointer
12578accesses are detected.
12579
12580@item -fsanitize=float-divide-by-zero
12581@opindex fsanitize=float-divide-by-zero
12582Detect floating-point division by zero.  Unlike other similar options,
12583@option{-fsanitize=float-divide-by-zero} is not enabled by
12584@option{-fsanitize=undefined}, since floating-point division by zero can
12585be a legitimate way of obtaining infinities and NaNs.
12586
12587@item -fsanitize=float-cast-overflow
12588@opindex fsanitize=float-cast-overflow
12589This option enables floating-point type to integer conversion checking.
12590We check that the result of the conversion does not overflow.
12591Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12592not enabled by @option{-fsanitize=undefined}.
12593This option does not work well with @code{FE_INVALID} exceptions enabled.
12594
12595@item -fsanitize=nonnull-attribute
12596@opindex fsanitize=nonnull-attribute
12597
12598This option enables instrumentation of calls, checking whether null values
12599are not passed to arguments marked as requiring a non-null value by the
12600@code{nonnull} function attribute.
12601
12602@item -fsanitize=returns-nonnull-attribute
12603@opindex fsanitize=returns-nonnull-attribute
12604
12605This option enables instrumentation of return statements in functions
12606marked with @code{returns_nonnull} function attribute, to detect returning
12607of null values from such functions.
12608
12609@item -fsanitize=bool
12610@opindex fsanitize=bool
12611
12612This option enables instrumentation of loads from bool.  If a value other
12613than 0/1 is loaded, a run-time error is issued.
12614
12615@item -fsanitize=enum
12616@opindex fsanitize=enum
12617
12618This option enables instrumentation of loads from an enum type.  If
12619a value outside the range of values for the enum type is loaded,
12620a run-time error is issued.
12621
12622@item -fsanitize=vptr
12623@opindex fsanitize=vptr
12624
12625This option enables instrumentation of C++ member function calls, member
12626accesses and some conversions between pointers to base and derived classes,
12627to verify the referenced object has the correct dynamic type.
12628
12629@item -fsanitize=pointer-overflow
12630@opindex fsanitize=pointer-overflow
12631
12632This option enables instrumentation of pointer arithmetics.  If the pointer
12633arithmetics overflows, a run-time error is issued.
12634
12635@item -fsanitize=builtin
12636@opindex fsanitize=builtin
12637
12638This option enables instrumentation of arguments to selected builtin
12639functions.  If an invalid value is passed to such arguments, a run-time
12640error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12641or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12642by this option.
12643
12644@end table
12645
12646While @option{-ftrapv} causes traps for signed overflows to be emitted,
12647@option{-fsanitize=undefined} gives a diagnostic message.
12648This currently works only for the C family of languages.
12649
12650@item -fno-sanitize=all
12651@opindex fno-sanitize=all
12652
12653This option disables all previously enabled sanitizers.
12654@option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12655together.
12656
12657@item -fasan-shadow-offset=@var{number}
12658@opindex fasan-shadow-offset
12659This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12660It is useful for experimenting with different shadow memory layouts in
12661Kernel AddressSanitizer.
12662
12663@item -fsanitize-sections=@var{s1},@var{s2},...
12664@opindex fsanitize-sections
12665Sanitize global variables in selected user-defined sections.  @var{si} may
12666contain wildcards.
12667
12668@item -fsanitize-recover@r{[}=@var{opts}@r{]}
12669@opindex fsanitize-recover
12670@opindex fno-sanitize-recover
12671@option{-fsanitize-recover=} controls error recovery mode for sanitizers
12672mentioned in comma-separated list of @var{opts}.  Enabling this option
12673for a sanitizer component causes it to attempt to continue
12674running the program as if no error happened.  This means multiple
12675runtime errors can be reported in a single program run, and the exit
12676code of the program may indicate success even when errors
12677have been reported.  The @option{-fno-sanitize-recover=} option
12678can be used to alter
12679this behavior: only the first detected error is reported
12680and program then exits with a non-zero exit code.
12681
12682Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12683except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12684@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12685@option{-fsanitize=bounds-strict},
12686@option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12687For these sanitizers error recovery is turned on by default,
12688except @option{-fsanitize=address}, for which this feature is experimental.
12689@option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12690accepted, the former enables recovery for all sanitizers that support it,
12691the latter disables recovery for all sanitizers that support it.
12692
12693Even if a recovery mode is turned on the compiler side, it needs to be also
12694enabled on the runtime library side, otherwise the failures are still fatal.
12695The runtime library defaults to @code{halt_on_error=0} for
12696ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12697AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12698setting the @code{halt_on_error} flag in the corresponding environment variable.
12699
12700Syntax without an explicit @var{opts} parameter is deprecated.  It is
12701equivalent to specifying an @var{opts} list of:
12702
12703@smallexample
12704undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12705@end smallexample
12706
12707@item -fsanitize-address-use-after-scope
12708@opindex fsanitize-address-use-after-scope
12709Enable sanitization of local variables to detect use-after-scope bugs.
12710The option sets @option{-fstack-reuse} to @samp{none}.
12711
12712@item -fsanitize-undefined-trap-on-error
12713@opindex fsanitize-undefined-trap-on-error
12714The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12715report undefined behavior using @code{__builtin_trap} rather than
12716a @code{libubsan} library routine.  The advantage of this is that the
12717@code{libubsan} library is not needed and is not linked in, so this
12718is usable even in freestanding environments.
12719
12720@item -fsanitize-coverage=trace-pc
12721@opindex fsanitize-coverage=trace-pc
12722Enable coverage-guided fuzzing code instrumentation.
12723Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12724
12725@item -fsanitize-coverage=trace-cmp
12726@opindex fsanitize-coverage=trace-cmp
12727Enable dataflow guided fuzzing code instrumentation.
12728Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12729@code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12730@code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12731variable or @code{__sanitizer_cov_trace_const_cmp1},
12732@code{__sanitizer_cov_trace_const_cmp2},
12733@code{__sanitizer_cov_trace_const_cmp4} or
12734@code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12735operand constant, @code{__sanitizer_cov_trace_cmpf} or
12736@code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12737@code{__sanitizer_cov_trace_switch} for switch statements.
12738
12739@item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12740@opindex fcf-protection
12741Enable code instrumentation of control-flow transfers to increase
12742program security by checking that target addresses of control-flow
12743transfer instructions (such as indirect function call, function return,
12744indirect jump) are valid.  This prevents diverting the flow of control
12745to an unexpected target.  This is intended to protect against such
12746threats as Return-oriented Programming (ROP), and similarly
12747call/jmp-oriented programming (COP/JOP).
12748
12749The value @code{branch} tells the compiler to implement checking of
12750validity of control-flow transfer at the point of indirect branch
12751instructions, i.e.@: call/jmp instructions.  The value @code{return}
12752implements checking of validity at the point of returning from a
12753function.  The value @code{full} is an alias for specifying both
12754@code{branch} and @code{return}. The value @code{none} turns off
12755instrumentation.
12756
12757The macro @code{__CET__} is defined when @option{-fcf-protection} is
12758used.  The first bit of @code{__CET__} is set to 1 for the value
12759@code{branch} and the second bit of @code{__CET__} is set to 1 for
12760the @code{return}.
12761
12762You can also use the @code{nocf_check} attribute to identify
12763which functions and calls should be skipped from instrumentation
12764(@pxref{Function Attributes}).
12765
12766Currently the x86 GNU/Linux target provides an implementation based
12767on Intel Control-flow Enforcement Technology (CET).
12768
12769@item -fstack-protector
12770@opindex fstack-protector
12771Emit extra code to check for buffer overflows, such as stack smashing
12772attacks.  This is done by adding a guard variable to functions with
12773vulnerable objects.  This includes functions that call @code{alloca}, and
12774functions with buffers larger than 8 bytes.  The guards are initialized
12775when a function is entered and then checked when the function exits.
12776If a guard check fails, an error message is printed and the program exits.
12777
12778@item -fstack-protector-all
12779@opindex fstack-protector-all
12780Like @option{-fstack-protector} except that all functions are protected.
12781
12782@item -fstack-protector-strong
12783@opindex fstack-protector-strong
12784Like @option{-fstack-protector} but includes additional functions to
12785be protected --- those that have local array definitions, or have
12786references to local frame addresses.
12787
12788@item -fstack-protector-explicit
12789@opindex fstack-protector-explicit
12790Like @option{-fstack-protector} but only protects those functions which
12791have the @code{stack_protect} attribute.
12792
12793@item -fstack-check
12794@opindex fstack-check
12795Generate code to verify that you do not go beyond the boundary of the
12796stack.  You should specify this flag if you are running in an
12797environment with multiple threads, but you only rarely need to specify it in
12798a single-threaded environment since stack overflow is automatically
12799detected on nearly all systems if there is only one stack.
12800
12801Note that this switch does not actually cause checking to be done; the
12802operating system or the language runtime must do that.  The switch causes
12803generation of code to ensure that they see the stack being extended.
12804
12805You can additionally specify a string parameter: @samp{no} means no
12806checking, @samp{generic} means force the use of old-style checking,
12807@samp{specific} means use the best checking method and is equivalent
12808to bare @option{-fstack-check}.
12809
12810Old-style checking is a generic mechanism that requires no specific
12811target support in the compiler but comes with the following drawbacks:
12812
12813@enumerate
12814@item
12815Modified allocation strategy for large objects: they are always
12816allocated dynamically if their size exceeds a fixed threshold.  Note this
12817may change the semantics of some code.
12818
12819@item
12820Fixed limit on the size of the static frame of functions: when it is
12821topped by a particular function, stack checking is not reliable and
12822a warning is issued by the compiler.
12823
12824@item
12825Inefficiency: because of both the modified allocation strategy and the
12826generic implementation, code performance is hampered.
12827@end enumerate
12828
12829Note that old-style stack checking is also the fallback method for
12830@samp{specific} if no target support has been added in the compiler.
12831
12832@samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12833and stack overflows.  @samp{specific} is an excellent choice when compiling
12834Ada code.  It is not generally sufficient to protect against stack-clash
12835attacks.  To protect against those you want @samp{-fstack-clash-protection}.
12836
12837@item -fstack-clash-protection
12838@opindex fstack-clash-protection
12839Generate code to prevent stack clash style attacks.  When this option is
12840enabled, the compiler will only allocate one page of stack space at a time
12841and each page is accessed immediately after allocation.  Thus, it prevents
12842allocations from jumping over any stack guard page provided by the
12843operating system.
12844
12845Most targets do not fully support stack clash protection.  However, on
12846those targets @option{-fstack-clash-protection} will protect dynamic stack
12847allocations.  @option{-fstack-clash-protection} may also provide limited
12848protection for static stack allocations if the target supports
12849@option{-fstack-check=specific}.
12850
12851@item -fstack-limit-register=@var{reg}
12852@itemx -fstack-limit-symbol=@var{sym}
12853@itemx -fno-stack-limit
12854@opindex fstack-limit-register
12855@opindex fstack-limit-symbol
12856@opindex fno-stack-limit
12857Generate code to ensure that the stack does not grow beyond a certain value,
12858either the value of a register or the address of a symbol.  If a larger
12859stack is required, a signal is raised at run time.  For most targets,
12860the signal is raised before the stack overruns the boundary, so
12861it is possible to catch the signal without taking special precautions.
12862
12863For instance, if the stack starts at absolute address @samp{0x80000000}
12864and grows downwards, you can use the flags
12865@option{-fstack-limit-symbol=__stack_limit} and
12866@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12867of 128KB@.  Note that this may only work with the GNU linker.
12868
12869You can locally override stack limit checking by using the
12870@code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12871
12872@item -fsplit-stack
12873@opindex fsplit-stack
12874Generate code to automatically split the stack before it overflows.
12875The resulting program has a discontiguous stack which can only
12876overflow if the program is unable to allocate any more memory.  This
12877is most useful when running threaded programs, as it is no longer
12878necessary to calculate a good stack size to use for each thread.  This
12879is currently only implemented for the x86 targets running
12880GNU/Linux.
12881
12882When code compiled with @option{-fsplit-stack} calls code compiled
12883without @option{-fsplit-stack}, there may not be much stack space
12884available for the latter code to run.  If compiling all code,
12885including library code, with @option{-fsplit-stack} is not an option,
12886then the linker can fix up these calls so that the code compiled
12887without @option{-fsplit-stack} always has a large stack.  Support for
12888this is implemented in the gold linker in GNU binutils release 2.21
12889and later.
12890
12891@item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12892@opindex fvtable-verify
12893This option is only available when compiling C++ code.
12894It turns on (or off, if using @option{-fvtable-verify=none}) the security
12895feature that verifies at run time, for every virtual call, that
12896the vtable pointer through which the call is made is valid for the type of
12897the object, and has not been corrupted or overwritten.  If an invalid vtable
12898pointer is detected at run time, an error is reported and execution of the
12899program is immediately halted.
12900
12901This option causes run-time data structures to be built at program startup,
12902which are used for verifying the vtable pointers.
12903The options @samp{std} and @samp{preinit}
12904control the timing of when these data structures are built.  In both cases the
12905data structures are built before execution reaches @code{main}.  Using
12906@option{-fvtable-verify=std} causes the data structures to be built after
12907shared libraries have been loaded and initialized.
12908@option{-fvtable-verify=preinit} causes them to be built before shared
12909libraries have been loaded and initialized.
12910
12911If this option appears multiple times in the command line with different
12912values specified, @samp{none} takes highest priority over both @samp{std} and
12913@samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12914
12915@item -fvtv-debug
12916@opindex fvtv-debug
12917When used in conjunction with @option{-fvtable-verify=std} or
12918@option{-fvtable-verify=preinit}, causes debug versions of the
12919runtime functions for the vtable verification feature to be called.
12920This flag also causes the compiler to log information about which
12921vtable pointers it finds for each class.
12922This information is written to a file named @file{vtv_set_ptr_data.log}
12923in the directory named by the environment variable @env{VTV_LOGS_DIR}
12924if that is defined or the current working directory otherwise.
12925
12926Note:  This feature @emph{appends} data to the log file. If you want a fresh log
12927file, be sure to delete any existing one.
12928
12929@item -fvtv-counts
12930@opindex fvtv-counts
12931This is a debugging flag.  When used in conjunction with
12932@option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12933causes the compiler to keep track of the total number of virtual calls
12934it encounters and the number of verifications it inserts.  It also
12935counts the number of calls to certain run-time library functions
12936that it inserts and logs this information for each compilation unit.
12937The compiler writes this information to a file named
12938@file{vtv_count_data.log} in the directory named by the environment
12939variable @env{VTV_LOGS_DIR} if that is defined or the current working
12940directory otherwise.  It also counts the size of the vtable pointer sets
12941for each class, and writes this information to @file{vtv_class_set_sizes.log}
12942in the same directory.
12943
12944Note:  This feature @emph{appends} data to the log files.  To get fresh log
12945files, be sure to delete any existing ones.
12946
12947@item -finstrument-functions
12948@opindex finstrument-functions
12949Generate instrumentation calls for entry and exit to functions.  Just
12950after function entry and just before function exit, the following
12951profiling functions are called with the address of the current
12952function and its call site.  (On some platforms,
12953@code{__builtin_return_address} does not work beyond the current
12954function, so the call site information may not be available to the
12955profiling functions otherwise.)
12956
12957@smallexample
12958void __cyg_profile_func_enter (void *this_fn,
12959                               void *call_site);
12960void __cyg_profile_func_exit  (void *this_fn,
12961                               void *call_site);
12962@end smallexample
12963
12964The first argument is the address of the start of the current function,
12965which may be looked up exactly in the symbol table.
12966
12967This instrumentation is also done for functions expanded inline in other
12968functions.  The profiling calls indicate where, conceptually, the
12969inline function is entered and exited.  This means that addressable
12970versions of such functions must be available.  If all your uses of a
12971function are expanded inline, this may mean an additional expansion of
12972code size.  If you use @code{extern inline} in your C code, an
12973addressable version of such functions must be provided.  (This is
12974normally the case anyway, but if you get lucky and the optimizer always
12975expands the functions inline, you might have gotten away without
12976providing static copies.)
12977
12978A function may be given the attribute @code{no_instrument_function}, in
12979which case this instrumentation is not done.  This can be used, for
12980example, for the profiling functions listed above, high-priority
12981interrupt routines, and any functions from which the profiling functions
12982cannot safely be called (perhaps signal handlers, if the profiling
12983routines generate output or allocate memory).
12984@xref{Common Function Attributes}.
12985
12986@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12987@opindex finstrument-functions-exclude-file-list
12988
12989Set the list of functions that are excluded from instrumentation (see
12990the description of @option{-finstrument-functions}).  If the file that
12991contains a function definition matches with one of @var{file}, then
12992that function is not instrumented.  The match is done on substrings:
12993if the @var{file} parameter is a substring of the file name, it is
12994considered to be a match.
12995
12996For example:
12997
12998@smallexample
12999-finstrument-functions-exclude-file-list=/bits/stl,include/sys
13000@end smallexample
13001
13002@noindent
13003excludes any inline function defined in files whose pathnames
13004contain @file{/bits/stl} or @file{include/sys}.
13005
13006If, for some reason, you want to include letter @samp{,} in one of
13007@var{sym}, write @samp{\,}. For example,
13008@option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13009(note the single quote surrounding the option).
13010
13011@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13012@opindex finstrument-functions-exclude-function-list
13013
13014This is similar to @option{-finstrument-functions-exclude-file-list},
13015but this option sets the list of function names to be excluded from
13016instrumentation.  The function name to be matched is its user-visible
13017name, such as @code{vector<int> blah(const vector<int> &)}, not the
13018internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
13019match is done on substrings: if the @var{sym} parameter is a substring
13020of the function name, it is considered to be a match.  For C99 and C++
13021extended identifiers, the function name must be given in UTF-8, not
13022using universal character names.
13023
13024@item -fpatchable-function-entry=@var{N}[,@var{M}]
13025@opindex fpatchable-function-entry
13026Generate @var{N} NOPs right at the beginning
13027of each function, with the function entry point before the @var{M}th NOP.
13028If @var{M} is omitted, it defaults to @code{0} so the
13029function entry points to the address just at the first NOP.
13030The NOP instructions reserve extra space which can be used to patch in
13031any desired instrumentation at run time, provided that the code segment
13032is writable.  The amount of space is controllable indirectly via
13033the number of NOPs; the NOP instruction used corresponds to the instruction
13034emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
13035is target-specific and may also depend on the architecture variant and/or
13036other compilation options.
13037
13038For run-time identification, the starting addresses of these areas,
13039which correspond to their respective function entries minus @var{M},
13040are additionally collected in the @code{__patchable_function_entries}
13041section of the resulting binary.
13042
13043Note that the value of @code{__attribute__ ((patchable_function_entry
13044(N,M)))} takes precedence over command-line option
13045@option{-fpatchable-function-entry=N,M}.  This can be used to increase
13046the area size or to remove it completely on a single function.
13047If @code{N=0}, no pad location is recorded.
13048
13049The NOP instructions are inserted at---and maybe before, depending on
13050@var{M}---the function entry address, even before the prologue.
13051
13052@end table
13053
13054
13055@node Preprocessor Options
13056@section Options Controlling the Preprocessor
13057@cindex preprocessor options
13058@cindex options, preprocessor
13059
13060These options control the C preprocessor, which is run on each C source
13061file before actual compilation.
13062
13063If you use the @option{-E} option, nothing is done except preprocessing.
13064Some of these options make sense only together with @option{-E} because
13065they cause the preprocessor output to be unsuitable for actual
13066compilation.
13067
13068In addition to the options listed here, there are a number of options
13069to control search paths for include files documented in
13070@ref{Directory Options}.
13071Options to control preprocessor diagnostics are listed in
13072@ref{Warning Options}.
13073
13074@table @gcctabopt
13075@include cppopts.texi
13076
13077@item -Wp,@var{option}
13078@opindex Wp
13079You can use @option{-Wp,@var{option}} to bypass the compiler driver
13080and pass @var{option} directly through to the preprocessor.  If
13081@var{option} contains commas, it is split into multiple options at the
13082commas.  However, many options are modified, translated or interpreted
13083by the compiler driver before being passed to the preprocessor, and
13084@option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
13085interface is undocumented and subject to change, so whenever possible
13086you should avoid using @option{-Wp} and let the driver handle the
13087options instead.
13088
13089@item -Xpreprocessor @var{option}
13090@opindex Xpreprocessor
13091Pass @var{option} as an option to the preprocessor.  You can use this to
13092supply system-specific preprocessor options that GCC does not
13093recognize.
13094
13095If you want to pass an option that takes an argument, you must use
13096@option{-Xpreprocessor} twice, once for the option and once for the argument.
13097
13098@item -no-integrated-cpp
13099@opindex no-integrated-cpp
13100Perform preprocessing as a separate pass before compilation.
13101By default, GCC performs preprocessing as an integrated part of
13102input tokenization and parsing.
13103If this option is provided, the appropriate language front end
13104(@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13105and Objective-C, respectively) is instead invoked twice,
13106once for preprocessing only and once for actual compilation
13107of the preprocessed input.
13108This option may be useful in conjunction with the @option{-B} or
13109@option{-wrapper} options to specify an alternate preprocessor or
13110perform additional processing of the program source between
13111normal preprocessing and compilation.
13112
13113@end table
13114
13115@node Assembler Options
13116@section Passing Options to the Assembler
13117
13118@c prevent bad page break with this line
13119You can pass options to the assembler.
13120
13121@table @gcctabopt
13122@item -Wa,@var{option}
13123@opindex Wa
13124Pass @var{option} as an option to the assembler.  If @var{option}
13125contains commas, it is split into multiple options at the commas.
13126
13127@item -Xassembler @var{option}
13128@opindex Xassembler
13129Pass @var{option} as an option to the assembler.  You can use this to
13130supply system-specific assembler options that GCC does not
13131recognize.
13132
13133If you want to pass an option that takes an argument, you must use
13134@option{-Xassembler} twice, once for the option and once for the argument.
13135
13136@end table
13137
13138@node Link Options
13139@section Options for Linking
13140@cindex link options
13141@cindex options, linking
13142
13143These options come into play when the compiler links object files into
13144an executable output file.  They are meaningless if the compiler is
13145not doing a link step.
13146
13147@table @gcctabopt
13148@cindex file names
13149@item @var{object-file-name}
13150A file name that does not end in a special recognized suffix is
13151considered to name an object file or library.  (Object files are
13152distinguished from libraries by the linker according to the file
13153contents.)  If linking is done, these object files are used as input
13154to the linker.
13155
13156@item -c
13157@itemx -S
13158@itemx -E
13159@opindex c
13160@opindex S
13161@opindex E
13162If any of these options is used, then the linker is not run, and
13163object file names should not be used as arguments.  @xref{Overall
13164Options}.
13165
13166@item -flinker-output=@var{type}
13167@opindex flinker-output
13168This option controls the code generation of the link time optimizer.  By
13169default the linker output is determined by the linker plugin automatically. For
13170debugging the compiler and in the case of incremental linking to non-lto object
13171file is desired, it may be useful to control the type manually.
13172
13173If @var{type} is @samp{exec} the code generation is configured to produce static
13174binary. In this case @option{-fpic} and @option{-fpie} are both disabled.
13175
13176If @var{type} is @samp{dyn} the code generation is configured to produce shared
13177library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not
13178enabled automatically.  This makes it possible to build shared libraries without
13179position independent code on architectures this is possible, i.e.@: on x86.
13180
13181If @var{type} is @samp{pie} the code generation is configured to produce
13182@option{-fpie} executable. This result in similar optimizations as @samp{exec}
13183except that @option{-fpie} is not disabled if specified at compilation time.
13184
13185If @var{type} is @samp{rel} the compiler assumes that incremental linking is
13186done.  The sections containing intermediate code for link-time optimization are
13187merged, pre-optimized, and output to the resulting object file. In addition, if
13188@option{-ffat-lto-objects} is specified the binary code is produced for future
13189non-lto linking. The object file produced by incremental linking will be smaller
13190than a static library produced from the same object files.  At link-time the
13191result of incremental linking will also load faster to compiler than a static
13192library assuming that majority of objects in the library are used.
13193
13194Finally @samp{nolto-rel} configure compiler to for incremental linking where
13195code generation is forced, final binary is produced and the intermediate code
13196for later link-time optimization is stripped. When multiple object files are
13197linked together the resulting code will be optimized better than with link time
13198optimizations disabled (for example, the cross-module inlining will happen),
13199most of benefits of whole program optimizations are however lost.
13200
13201During the incremental link (by @option{-r}) the linker plugin will default to
13202@option{rel}. With current interfaces to GNU Binutils it is however not
13203possible to link incrementally LTO objects and non-LTO objects into a single
13204mixed object file.  In the case any of object files in incremental link cannot
13205be used for link-time optimization the linker plugin will output warning and
13206use @samp{nolto-rel}. To maintain the whole program optimization it is
13207recommended to link such objects into static library instead. Alternatively it
13208is possible to use H.J. Lu's binutils with support for mixed objects.
13209
13210@item -fuse-ld=bfd
13211@opindex fuse-ld=bfd
13212Use the @command{bfd} linker instead of the default linker.
13213
13214@item -fuse-ld=gold
13215@opindex fuse-ld=gold
13216Use the @command{gold} linker instead of the default linker.
13217
13218@item -fuse-ld=lld
13219@opindex fuse-ld=lld
13220Use the LLVM @command{lld} linker instead of the default linker.
13221
13222@cindex Libraries
13223@item -l@var{library}
13224@itemx -l @var{library}
13225@opindex l
13226Search the library named @var{library} when linking.  (The second
13227alternative with the library as a separate argument is only for
13228POSIX compliance and is not recommended.)
13229
13230The @option{-l} option is passed directly to the linker by GCC.  Refer
13231to your linker documentation for exact details.  The general
13232description below applies to the GNU linker.
13233
13234The linker searches a standard list of directories for the library.
13235The directories searched include several standard system directories
13236plus any that you specify with @option{-L}.
13237
13238Static libraries are archives of object files, and have file names
13239like @file{lib@var{library}.a}.  Some targets also support shared
13240libraries, which typically have names like @file{lib@var{library}.so}.
13241If both static and shared libraries are found, the linker gives
13242preference to linking with the shared library unless the
13243@option{-static} option is used.
13244
13245It makes a difference where in the command you write this option; the
13246linker searches and processes libraries and object files in the order they
13247are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13248after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
13249to functions in @samp{z}, those functions may not be loaded.
13250
13251@item -lobjc
13252@opindex lobjc
13253You need this special case of the @option{-l} option in order to
13254link an Objective-C or Objective-C++ program.
13255
13256@item -nostartfiles
13257@opindex nostartfiles
13258Do not use the standard system startup files when linking.
13259The standard system libraries are used normally, unless @option{-nostdlib},
13260@option{-nolibc}, or @option{-nodefaultlibs} is used.
13261
13262@item -nodefaultlibs
13263@opindex nodefaultlibs
13264Do not use the standard system libraries when linking.
13265Only the libraries you specify are passed to the linker, and options
13266specifying linkage of the system libraries, such as @option{-static-libgcc}
13267or @option{-shared-libgcc}, are ignored.
13268The standard startup files are used normally, unless @option{-nostartfiles}
13269is used.
13270
13271The compiler may generate calls to @code{memcmp},
13272@code{memset}, @code{memcpy} and @code{memmove}.
13273These entries are usually resolved by entries in
13274libc.  These entry points should be supplied through some other
13275mechanism when this option is specified.
13276
13277@item -nolibc
13278@opindex nolibc
13279Do not use the C library or system libraries tightly coupled with it when
13280linking.  Still link with the startup files, @file{libgcc} or toolchain
13281provided language support libraries such as @file{libgnat}, @file{libgfortran}
13282or @file{libstdc++} unless options preventing their inclusion are used as
13283well.  This typically removes @option{-lc} from the link command line, as well
13284as system libraries that normally go with it and become meaningless when
13285absence of a C library is assumed, for example @option{-lpthread} or
13286@option{-lm} in some configurations.  This is intended for bare-board
13287targets when there is indeed no C library available.
13288
13289@item -nostdlib
13290@opindex nostdlib
13291Do not use the standard system startup files or libraries when linking.
13292No startup files and only the libraries you specify are passed to
13293the linker, and options specifying linkage of the system libraries, such as
13294@option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13295
13296The compiler may generate calls to @code{memcmp}, @code{memset},
13297@code{memcpy} and @code{memmove}.
13298These entries are usually resolved by entries in
13299libc.  These entry points should be supplied through some other
13300mechanism when this option is specified.
13301
13302@cindex @option{-lgcc}, use with @option{-nostdlib}
13303@cindex @option{-nostdlib} and unresolved references
13304@cindex unresolved references and @option{-nostdlib}
13305@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13306@cindex @option{-nodefaultlibs} and unresolved references
13307@cindex unresolved references and @option{-nodefaultlibs}
13308One of the standard libraries bypassed by @option{-nostdlib} and
13309@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13310which GCC uses to overcome shortcomings of particular machines, or special
13311needs for some languages.
13312(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13313Collection (GCC) Internals},
13314for more discussion of @file{libgcc.a}.)
13315In most cases, you need @file{libgcc.a} even when you want to avoid
13316other standard libraries.  In other words, when you specify @option{-nostdlib}
13317or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13318This ensures that you have no unresolved references to internal GCC
13319library subroutines.
13320(An example of such an internal subroutine is @code{__main}, used to ensure C++
13321constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13322GNU Compiler Collection (GCC) Internals}.)
13323
13324@item -e @var{entry}
13325@itemx --entry=@var{entry}
13326@opindex e
13327@opindex entry
13328
13329Specify that the program entry point is @var{entry}.  The argument is
13330interpreted by the linker; the GNU linker accepts either a symbol name
13331or an address.
13332
13333@item -pie
13334@opindex pie
13335Produce a dynamically linked position independent executable on targets
13336that support it.  For predictable results, you must also specify the same
13337set of options used for compilation (@option{-fpie}, @option{-fPIE},
13338or model suboptions) when you specify this linker option.
13339
13340@item -no-pie
13341@opindex no-pie
13342Don't produce a dynamically linked position independent executable.
13343
13344@item -static-pie
13345@opindex static-pie
13346Produce a static position independent executable on targets that support
13347it.  A static position independent executable is similar to a static
13348executable, but can be loaded at any address without a dynamic linker.
13349For predictable results, you must also specify the same set of options
13350used for compilation (@option{-fpie}, @option{-fPIE}, or model
13351suboptions) when you specify this linker option.
13352
13353@item -pthread
13354@opindex pthread
13355Link with the POSIX threads library.  This option is supported on
13356GNU/Linux targets, most other Unix derivatives, and also on
13357x86 Cygwin and MinGW targets.  On some targets this option also sets
13358flags for the preprocessor, so it should be used consistently for both
13359compilation and linking.
13360
13361@item -r
13362@opindex r
13363Produce a relocatable object as output.  This is also known as partial
13364linking.
13365
13366@item -rdynamic
13367@opindex rdynamic
13368Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13369that support it. This instructs the linker to add all symbols, not
13370only used ones, to the dynamic symbol table. This option is needed
13371for some uses of @code{dlopen} or to allow obtaining backtraces
13372from within a program.
13373
13374@item -s
13375@opindex s
13376Remove all symbol table and relocation information from the executable.
13377
13378@item -static
13379@opindex static
13380On systems that support dynamic linking, this overrides @option{-pie}
13381and prevents linking with the shared libraries.  On other systems, this
13382option has no effect.
13383
13384@item -shared
13385@opindex shared
13386Produce a shared object which can then be linked with other objects to
13387form an executable.  Not all systems support this option.  For predictable
13388results, you must also specify the same set of options used for compilation
13389(@option{-fpic}, @option{-fPIC}, or model suboptions) when
13390you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13391needs to build supplementary stub code for constructors to work.  On
13392multi-libbed systems, @samp{gcc -shared} must select the correct support
13393libraries to link against.  Failing to supply the correct flags may lead
13394to subtle defects.  Supplying them in cases where they are not necessary
13395is innocuous.}
13396
13397@item -shared-libgcc
13398@itemx -static-libgcc
13399@opindex shared-libgcc
13400@opindex static-libgcc
13401On systems that provide @file{libgcc} as a shared library, these options
13402force the use of either the shared or static version, respectively.
13403If no shared version of @file{libgcc} was built when the compiler was
13404configured, these options have no effect.
13405
13406There are several situations in which an application should use the
13407shared @file{libgcc} instead of the static version.  The most common
13408of these is when the application wishes to throw and catch exceptions
13409across different shared libraries.  In that case, each of the libraries
13410as well as the application itself should use the shared @file{libgcc}.
13411
13412Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13413whenever you build a shared library or a main executable, because C++
13414programs typically use exceptions, so this is the right thing to do.
13415
13416If, instead, you use the GCC driver to create shared libraries, you may
13417find that they are not always linked with the shared @file{libgcc}.
13418If GCC finds, at its configuration time, that you have a non-GNU linker
13419or a GNU linker that does not support option @option{--eh-frame-hdr},
13420it links the shared version of @file{libgcc} into shared libraries
13421by default.  Otherwise, it takes advantage of the linker and optimizes
13422away the linking with the shared version of @file{libgcc}, linking with
13423the static version of libgcc by default.  This allows exceptions to
13424propagate through such shared libraries, without incurring relocation
13425costs at library load time.
13426
13427However, if a library or main executable is supposed to throw or catch
13428exceptions, you must link it using the G++ driver, or using the option
13429@option{-shared-libgcc}, such that it is linked with the shared
13430@file{libgcc}.
13431
13432@item -static-libasan
13433@opindex static-libasan
13434When the @option{-fsanitize=address} option is used to link a program,
13435the GCC driver automatically links against @option{libasan}.  If
13436@file{libasan} is available as a shared library, and the @option{-static}
13437option is not used, then this links against the shared version of
13438@file{libasan}.  The @option{-static-libasan} option directs the GCC
13439driver to link @file{libasan} statically, without necessarily linking
13440other libraries statically.
13441
13442@item -static-libtsan
13443@opindex static-libtsan
13444When the @option{-fsanitize=thread} option is used to link a program,
13445the GCC driver automatically links against @option{libtsan}.  If
13446@file{libtsan} is available as a shared library, and the @option{-static}
13447option is not used, then this links against the shared version of
13448@file{libtsan}.  The @option{-static-libtsan} option directs the GCC
13449driver to link @file{libtsan} statically, without necessarily linking
13450other libraries statically.
13451
13452@item -static-liblsan
13453@opindex static-liblsan
13454When the @option{-fsanitize=leak} option is used to link a program,
13455the GCC driver automatically links against @option{liblsan}.  If
13456@file{liblsan} is available as a shared library, and the @option{-static}
13457option is not used, then this links against the shared version of
13458@file{liblsan}.  The @option{-static-liblsan} option directs the GCC
13459driver to link @file{liblsan} statically, without necessarily linking
13460other libraries statically.
13461
13462@item -static-libubsan
13463@opindex static-libubsan
13464When the @option{-fsanitize=undefined} option is used to link a program,
13465the GCC driver automatically links against @option{libubsan}.  If
13466@file{libubsan} is available as a shared library, and the @option{-static}
13467option is not used, then this links against the shared version of
13468@file{libubsan}.  The @option{-static-libubsan} option directs the GCC
13469driver to link @file{libubsan} statically, without necessarily linking
13470other libraries statically.
13471
13472@item -static-libstdc++
13473@opindex static-libstdc++
13474When the @command{g++} program is used to link a C++ program, it
13475normally automatically links against @option{libstdc++}.  If
13476@file{libstdc++} is available as a shared library, and the
13477@option{-static} option is not used, then this links against the
13478shared version of @file{libstdc++}.  That is normally fine.  However, it
13479is sometimes useful to freeze the version of @file{libstdc++} used by
13480the program without going all the way to a fully static link.  The
13481@option{-static-libstdc++} option directs the @command{g++} driver to
13482link @file{libstdc++} statically, without necessarily linking other
13483libraries statically.
13484
13485@item -symbolic
13486@opindex symbolic
13487Bind references to global symbols when building a shared object.  Warn
13488about any unresolved references (unless overridden by the link editor
13489option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
13490this option.
13491
13492@item -T @var{script}
13493@opindex T
13494@cindex linker script
13495Use @var{script} as the linker script.  This option is supported by most
13496systems using the GNU linker.  On some targets, such as bare-board
13497targets without an operating system, the @option{-T} option may be required
13498when linking to avoid references to undefined symbols.
13499
13500@item -Xlinker @var{option}
13501@opindex Xlinker
13502Pass @var{option} as an option to the linker.  You can use this to
13503supply system-specific linker options that GCC does not recognize.
13504
13505If you want to pass an option that takes a separate argument, you must use
13506@option{-Xlinker} twice, once for the option and once for the argument.
13507For example, to pass @option{-assert definitions}, you must write
13508@option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
13509@option{-Xlinker "-assert definitions"}, because this passes the entire
13510string as a single argument, which is not what the linker expects.
13511
13512When using the GNU linker, it is usually more convenient to pass
13513arguments to linker options using the @option{@var{option}=@var{value}}
13514syntax than as separate arguments.  For example, you can specify
13515@option{-Xlinker -Map=output.map} rather than
13516@option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
13517this syntax for command-line options.
13518
13519@item -Wl,@var{option}
13520@opindex Wl
13521Pass @var{option} as an option to the linker.  If @var{option} contains
13522commas, it is split into multiple options at the commas.  You can use this
13523syntax to pass an argument to the option.
13524For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13525linker.  When using the GNU linker, you can also get the same effect with
13526@option{-Wl,-Map=output.map}.
13527
13528@item -u @var{symbol}
13529@opindex u
13530Pretend the symbol @var{symbol} is undefined, to force linking of
13531library modules to define it.  You can use @option{-u} multiple times with
13532different symbols to force loading of additional library modules.
13533
13534@item -z @var{keyword}
13535@opindex z
13536@option{-z} is passed directly on to the linker along with the keyword
13537@var{keyword}. See the section in the documentation of your linker for
13538permitted values and their meanings.
13539@end table
13540
13541@node Directory Options
13542@section Options for Directory Search
13543@cindex directory options
13544@cindex options, directory search
13545@cindex search path
13546
13547These options specify directories to search for header files, for
13548libraries and for parts of the compiler:
13549
13550@table @gcctabopt
13551@include cppdiropts.texi
13552
13553@item -iplugindir=@var{dir}
13554@opindex iplugindir=
13555Set the directory to search for plugins that are passed
13556by @option{-fplugin=@var{name}} instead of
13557@option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
13558to be used by the user, but only passed by the driver.
13559
13560@item -L@var{dir}
13561@opindex L
13562Add directory @var{dir} to the list of directories to be searched
13563for @option{-l}.
13564
13565@item -B@var{prefix}
13566@opindex B
13567This option specifies where to find the executables, libraries,
13568include files, and data files of the compiler itself.
13569
13570The compiler driver program runs one or more of the subprograms
13571@command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
13572@var{prefix} as a prefix for each program it tries to run, both with and
13573without @samp{@var{machine}/@var{version}/} for the corresponding target
13574machine and compiler version.
13575
13576For each subprogram to be run, the compiler driver first tries the
13577@option{-B} prefix, if any.  If that name is not found, or if @option{-B}
13578is not specified, the driver tries two standard prefixes,
13579@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
13580those results in a file name that is found, the unmodified program
13581name is searched for using the directories specified in your
13582@env{PATH} environment variable.
13583
13584The compiler checks to see if the path provided by @option{-B}
13585refers to a directory, and if necessary it adds a directory
13586separator character at the end of the path.
13587
13588@option{-B} prefixes that effectively specify directory names also apply
13589to libraries in the linker, because the compiler translates these
13590options into @option{-L} options for the linker.  They also apply to
13591include files in the preprocessor, because the compiler translates these
13592options into @option{-isystem} options for the preprocessor.  In this case,
13593the compiler appends @samp{include} to the prefix.
13594
13595The runtime support file @file{libgcc.a} can also be searched for using
13596the @option{-B} prefix, if needed.  If it is not found there, the two
13597standard prefixes above are tried, and that is all.  The file is left
13598out of the link if it is not found by those means.
13599
13600Another way to specify a prefix much like the @option{-B} prefix is to use
13601the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
13602Variables}.
13603
13604As a special kludge, if the path provided by @option{-B} is
13605@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
136069, then it is replaced by @file{[dir/]include}.  This is to help
13607with boot-strapping the compiler.
13608
13609@item -no-canonical-prefixes
13610@opindex no-canonical-prefixes
13611Do not expand any symbolic links, resolve references to @samp{/../}
13612or @samp{/./}, or make the path absolute when generating a relative
13613prefix.
13614
13615@item --sysroot=@var{dir}
13616@opindex sysroot
13617Use @var{dir} as the logical root directory for headers and libraries.
13618For example, if the compiler normally searches for headers in
13619@file{/usr/include} and libraries in @file{/usr/lib}, it instead
13620searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13621
13622If you use both this option and the @option{-isysroot} option, then
13623the @option{--sysroot} option applies to libraries, but the
13624@option{-isysroot} option applies to header files.
13625
13626The GNU linker (beginning with version 2.16) has the necessary support
13627for this option.  If your linker does not support this option, the
13628header file aspect of @option{--sysroot} still works, but the
13629library aspect does not.
13630
13631@item --no-sysroot-suffix
13632@opindex no-sysroot-suffix
13633For some targets, a suffix is added to the root directory specified
13634with @option{--sysroot}, depending on the other options used, so that
13635headers may for example be found in
13636@file{@var{dir}/@var{suffix}/usr/include} instead of
13637@file{@var{dir}/usr/include}.  This option disables the addition of
13638such a suffix.
13639
13640@end table
13641
13642@node Code Gen Options
13643@section Options for Code Generation Conventions
13644@cindex code generation conventions
13645@cindex options, code generation
13646@cindex run-time options
13647
13648These machine-independent options control the interface conventions
13649used in code generation.
13650
13651Most of them have both positive and negative forms; the negative form
13652of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
13653one of the forms is listed---the one that is not the default.  You
13654can figure out the other form by either removing @samp{no-} or adding
13655it.
13656
13657@table @gcctabopt
13658@item -fstack-reuse=@var{reuse-level}
13659@opindex fstack_reuse
13660This option controls stack space reuse for user declared local/auto variables
13661and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
13662@samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13663local variables and temporaries, @samp{named_vars} enables the reuse only for
13664user defined local variables with names, and @samp{none} disables stack reuse
13665completely. The default value is @samp{all}. The option is needed when the
13666program extends the lifetime of a scoped local variable or a compiler generated
13667temporary beyond the end point defined by the language.  When a lifetime of
13668a variable ends, and if the variable lives in memory, the optimizing compiler
13669has the freedom to reuse its stack space with other temporaries or scoped
13670local variables whose live range does not overlap with it. Legacy code extending
13671local lifetime is likely to break with the stack reuse optimization.
13672
13673For example,
13674
13675@smallexample
13676   int *p;
13677   @{
13678     int local1;
13679
13680     p = &local1;
13681     local1 = 10;
13682     ....
13683   @}
13684   @{
13685      int local2;
13686      local2 = 20;
13687      ...
13688   @}
13689
13690   if (*p == 10)  // out of scope use of local1
13691     @{
13692
13693     @}
13694@end smallexample
13695
13696Another example:
13697@smallexample
13698
13699   struct A
13700   @{
13701       A(int k) : i(k), j(k) @{ @}
13702       int i;
13703       int j;
13704   @};
13705
13706   A *ap;
13707
13708   void foo(const A& ar)
13709   @{
13710      ap = &ar;
13711   @}
13712
13713   void bar()
13714   @{
13715      foo(A(10)); // temp object's lifetime ends when foo returns
13716
13717      @{
13718        A a(20);
13719        ....
13720      @}
13721      ap->i+= 10;  // ap references out of scope temp whose space
13722                   // is reused with a. What is the value of ap->i?
13723   @}
13724
13725@end smallexample
13726
13727The lifetime of a compiler generated temporary is well defined by the C++
13728standard. When a lifetime of a temporary ends, and if the temporary lives
13729in memory, the optimizing compiler has the freedom to reuse its stack
13730space with other temporaries or scoped local variables whose live range
13731does not overlap with it. However some of the legacy code relies on
13732the behavior of older compilers in which temporaries' stack space is
13733not reused, the aggressive stack reuse can lead to runtime errors. This
13734option is used to control the temporary stack reuse optimization.
13735
13736@item -ftrapv
13737@opindex ftrapv
13738This option generates traps for signed overflow on addition, subtraction,
13739multiplication operations.
13740The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13741@option{-ftrapv} @option{-fwrapv} on the command-line results in
13742@option{-fwrapv} being effective.  Note that only active options override, so
13743using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13744results in @option{-ftrapv} being effective.
13745
13746@item -fwrapv
13747@opindex fwrapv
13748This option instructs the compiler to assume that signed arithmetic
13749overflow of addition, subtraction and multiplication wraps around
13750using twos-complement representation.  This flag enables some optimizations
13751and disables others.
13752The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13753@option{-ftrapv} @option{-fwrapv} on the command-line results in
13754@option{-fwrapv} being effective.  Note that only active options override, so
13755using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13756results in @option{-ftrapv} being effective.
13757
13758@item -fwrapv-pointer
13759@opindex fwrapv-pointer
13760This option instructs the compiler to assume that pointer arithmetic
13761overflow on addition and subtraction wraps around using twos-complement
13762representation.  This flag disables some optimizations which assume
13763pointer overflow is invalid.
13764
13765@item -fstrict-overflow
13766@opindex fstrict-overflow
13767This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13768negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13769
13770@item -fexceptions
13771@opindex fexceptions
13772Enable exception handling.  Generates extra code needed to propagate
13773exceptions.  For some targets, this implies GCC generates frame
13774unwind information for all functions, which can produce significant data
13775size overhead, although it does not affect execution.  If you do not
13776specify this option, GCC enables it by default for languages like
13777C++ that normally require exception handling, and disables it for
13778languages like C that do not normally require it.  However, you may need
13779to enable this option when compiling C code that needs to interoperate
13780properly with exception handlers written in C++.  You may also wish to
13781disable this option if you are compiling older C++ programs that don't
13782use exception handling.
13783
13784@item -fnon-call-exceptions
13785@opindex fnon-call-exceptions
13786Generate code that allows trapping instructions to throw exceptions.
13787Note that this requires platform-specific runtime support that does
13788not exist everywhere.  Moreover, it only allows @emph{trapping}
13789instructions to throw exceptions, i.e.@: memory references or floating-point
13790instructions.  It does not allow exceptions to be thrown from
13791arbitrary signal handlers such as @code{SIGALRM}.
13792
13793@item -fdelete-dead-exceptions
13794@opindex fdelete-dead-exceptions
13795Consider that instructions that may throw exceptions but don't otherwise
13796contribute to the execution of the program can be optimized away.
13797This option is enabled by default for the Ada front end, as permitted by
13798the Ada language specification.
13799Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13800
13801@item -funwind-tables
13802@opindex funwind-tables
13803Similar to @option{-fexceptions}, except that it just generates any needed
13804static data, but does not affect the generated code in any other way.
13805You normally do not need to enable this option; instead, a language processor
13806that needs this handling enables it on your behalf.
13807
13808@item -fasynchronous-unwind-tables
13809@opindex fasynchronous-unwind-tables
13810Generate unwind table in DWARF format, if supported by target machine.  The
13811table is exact at each instruction boundary, so it can be used for stack
13812unwinding from asynchronous events (such as debugger or garbage collector).
13813
13814@item -fno-gnu-unique
13815@opindex fno-gnu-unique
13816@opindex fgnu-unique
13817On systems with recent GNU assembler and C library, the C++ compiler
13818uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13819of template static data members and static local variables in inline
13820functions are unique even in the presence of @code{RTLD_LOCAL}; this
13821is necessary to avoid problems with a library used by two different
13822@code{RTLD_LOCAL} plugins depending on a definition in one of them and
13823therefore disagreeing with the other one about the binding of the
13824symbol.  But this causes @code{dlclose} to be ignored for affected
13825DSOs; if your program relies on reinitialization of a DSO via
13826@code{dlclose} and @code{dlopen}, you can use
13827@option{-fno-gnu-unique}.
13828
13829@item -fpcc-struct-return
13830@opindex fpcc-struct-return
13831Return ``short'' @code{struct} and @code{union} values in memory like
13832longer ones, rather than in registers.  This convention is less
13833efficient, but it has the advantage of allowing intercallability between
13834GCC-compiled files and files compiled with other compilers, particularly
13835the Portable C Compiler (pcc).
13836
13837The precise convention for returning structures in memory depends
13838on the target configuration macros.
13839
13840Short structures and unions are those whose size and alignment match
13841that of some integer type.
13842
13843@strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13844switch is not binary compatible with code compiled with the
13845@option{-freg-struct-return} switch.
13846Use it to conform to a non-default application binary interface.
13847
13848@item -freg-struct-return
13849@opindex freg-struct-return
13850Return @code{struct} and @code{union} values in registers when possible.
13851This is more efficient for small structures than
13852@option{-fpcc-struct-return}.
13853
13854If you specify neither @option{-fpcc-struct-return} nor
13855@option{-freg-struct-return}, GCC defaults to whichever convention is
13856standard for the target.  If there is no standard convention, GCC
13857defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13858the principal compiler.  In those cases, we can choose the standard, and
13859we chose the more efficient register return alternative.
13860
13861@strong{Warning:} code compiled with the @option{-freg-struct-return}
13862switch is not binary compatible with code compiled with the
13863@option{-fpcc-struct-return} switch.
13864Use it to conform to a non-default application binary interface.
13865
13866@item -fshort-enums
13867@opindex fshort-enums
13868Allocate to an @code{enum} type only as many bytes as it needs for the
13869declared range of possible values.  Specifically, the @code{enum} type
13870is equivalent to the smallest integer type that has enough room.
13871
13872@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13873code that is not binary compatible with code generated without that switch.
13874Use it to conform to a non-default application binary interface.
13875
13876@item -fshort-wchar
13877@opindex fshort-wchar
13878Override the underlying type for @code{wchar_t} to be @code{short
13879unsigned int} instead of the default for the target.  This option is
13880useful for building programs to run under WINE@.
13881
13882@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13883code that is not binary compatible with code generated without that switch.
13884Use it to conform to a non-default application binary interface.
13885
13886@item -fno-common
13887@opindex fno-common
13888@opindex fcommon
13889@cindex tentative definitions
13890In C code, this option controls the placement of global variables
13891defined without an initializer, known as @dfn{tentative definitions}
13892in the C standard.  Tentative definitions are distinct from declarations
13893of a variable with the @code{extern} keyword, which do not allocate storage.
13894
13895Unix C compilers have traditionally allocated storage for
13896uninitialized global variables in a common block.  This allows the
13897linker to resolve all tentative definitions of the same variable
13898in different compilation units to the same object, or to a non-tentative
13899definition.
13900This is the behavior specified by @option{-fcommon}, and is the default for
13901GCC on most targets.
13902On the other hand, this behavior is not required by ISO
13903C, and on some targets may carry a speed or code size penalty on
13904variable references.
13905
13906The @option{-fno-common} option specifies that the compiler should instead
13907place uninitialized global variables in the BSS section of the object file.
13908This inhibits the merging of tentative definitions by the linker so
13909you get a multiple-definition error if the same
13910variable is defined in more than one compilation unit.
13911Compiling with @option{-fno-common} is useful on targets for which
13912it provides better performance, or if you wish to verify that the
13913program will work on other systems that always treat uninitialized
13914variable definitions this way.
13915
13916@item -fno-ident
13917@opindex fno-ident
13918@opindex fident
13919Ignore the @code{#ident} directive.
13920
13921@item -finhibit-size-directive
13922@opindex finhibit-size-directive
13923Don't output a @code{.size} assembler directive, or anything else that
13924would cause trouble if the function is split in the middle, and the
13925two halves are placed at locations far apart in memory.  This option is
13926used when compiling @file{crtstuff.c}; you should not need to use it
13927for anything else.
13928
13929@item -fverbose-asm
13930@opindex fverbose-asm
13931Put extra commentary information in the generated assembly code to
13932make it more readable.  This option is generally only of use to those
13933who actually need to read the generated assembly code (perhaps while
13934debugging the compiler itself).
13935
13936@option{-fno-verbose-asm}, the default, causes the
13937extra information to be omitted and is useful when comparing two assembler
13938files.
13939
13940The added comments include:
13941
13942@itemize @bullet
13943
13944@item
13945information on the compiler version and command-line options,
13946
13947@item
13948the source code lines associated with the assembly instructions,
13949in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13950
13951@item
13952hints on which high-level expressions correspond to
13953the various assembly instruction operands.
13954
13955@end itemize
13956
13957For example, given this C source file:
13958
13959@smallexample
13960int test (int n)
13961@{
13962  int i;
13963  int total = 0;
13964
13965  for (i = 0; i < n; i++)
13966    total += i * i;
13967
13968  return total;
13969@}
13970@end smallexample
13971
13972compiling to (x86_64) assembly via @option{-S} and emitting the result
13973direct to stdout via @option{-o} @option{-}
13974
13975@smallexample
13976gcc -S test.c -fverbose-asm -Os -o -
13977@end smallexample
13978
13979gives output similar to this:
13980
13981@smallexample
13982	.file	"test.c"
13983# GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13984  [...snip...]
13985# options passed:
13986  [...snip...]
13987
13988	.text
13989	.globl	test
13990	.type	test, @@function
13991test:
13992.LFB0:
13993	.cfi_startproc
13994# test.c:4:   int total = 0;
13995	xorl	%eax, %eax	# <retval>
13996# test.c:6:   for (i = 0; i < n; i++)
13997	xorl	%edx, %edx	# i
13998.L2:
13999# test.c:6:   for (i = 0; i < n; i++)
14000	cmpl	%edi, %edx	# n, i
14001	jge	.L5	#,
14002# test.c:7:     total += i * i;
14003	movl	%edx, %ecx	# i, tmp92
14004	imull	%edx, %ecx	# i, tmp92
14005# test.c:6:   for (i = 0; i < n; i++)
14006	incl	%edx	# i
14007# test.c:7:     total += i * i;
14008	addl	%ecx, %eax	# tmp92, <retval>
14009	jmp	.L2	#
14010.L5:
14011# test.c:10: @}
14012	ret
14013	.cfi_endproc
14014.LFE0:
14015	.size	test, .-test
14016	.ident	"GCC: (GNU) 7.0.0 20160809 (experimental)"
14017	.section	.note.GNU-stack,"",@@progbits
14018@end smallexample
14019
14020The comments are intended for humans rather than machines and hence the
14021precise format of the comments is subject to change.
14022
14023@item -frecord-gcc-switches
14024@opindex frecord-gcc-switches
14025This switch causes the command line used to invoke the
14026compiler to be recorded into the object file that is being created.
14027This switch is only implemented on some targets and the exact format
14028of the recording is target and binary file format dependent, but it
14029usually takes the form of a section containing ASCII text.  This
14030switch is related to the @option{-fverbose-asm} switch, but that
14031switch only records information in the assembler output file as
14032comments, so it never reaches the object file.
14033See also @option{-grecord-gcc-switches} for another
14034way of storing compiler options into the object file.
14035
14036@item -fpic
14037@opindex fpic
14038@cindex global offset table
14039@cindex PIC
14040Generate position-independent code (PIC) suitable for use in a shared
14041library, if supported for the target machine.  Such code accesses all
14042constant addresses through a global offset table (GOT)@.  The dynamic
14043loader resolves the GOT entries when the program starts (the dynamic
14044loader is not part of GCC; it is part of the operating system).  If
14045the GOT size for the linked executable exceeds a machine-specific
14046maximum size, you get an error message from the linker indicating that
14047@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14048instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14049on the m68k and RS/6000.  The x86 has no such limit.)
14050
14051Position-independent code requires special support, and therefore works
14052only on certain machines.  For the x86, GCC supports PIC for System V
14053but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
14054position-independent.
14055
14056When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14057are defined to 1.
14058
14059@item -fPIC
14060@opindex fPIC
14061If supported for the target machine, emit position-independent code,
14062suitable for dynamic linking and avoiding any limit on the size of the
14063global offset table.  This option makes a difference on AArch64, m68k,
14064PowerPC and SPARC@.
14065
14066Position-independent code requires special support, and therefore works
14067only on certain machines.
14068
14069When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14070are defined to 2.
14071
14072@item -fpie
14073@itemx -fPIE
14074@opindex fpie
14075@opindex fPIE
14076These options are similar to @option{-fpic} and @option{-fPIC}, but the
14077generated position-independent code can be only linked into executables.
14078Usually these options are used to compile code that will be linked using
14079the @option{-pie} GCC option.
14080
14081@option{-fpie} and @option{-fPIE} both define the macros
14082@code{__pie__} and @code{__PIE__}.  The macros have the value 1
14083for @option{-fpie} and 2 for @option{-fPIE}.
14084
14085@item -fno-plt
14086@opindex fno-plt
14087@opindex fplt
14088Do not use the PLT for external function calls in position-independent code.
14089Instead, load the callee address at call sites from the GOT and branch to it.
14090This leads to more efficient code by eliminating PLT stubs and exposing
14091GOT loads to optimizations.  On architectures such as 32-bit x86 where
14092PLT stubs expect the GOT pointer in a specific register, this gives more
14093register allocation freedom to the compiler.
14094Lazy binding requires use of the PLT;
14095with @option{-fno-plt} all external symbols are resolved at load time.
14096
14097Alternatively, the function attribute @code{noplt} can be used to avoid calls
14098through the PLT for specific external functions.
14099
14100In position-dependent code, a few targets also convert calls to
14101functions that are marked to not use the PLT to use the GOT instead.
14102
14103@item -fno-jump-tables
14104@opindex fno-jump-tables
14105@opindex fjump-tables
14106Do not use jump tables for switch statements even where it would be
14107more efficient than other code generation strategies.  This option is
14108of use in conjunction with @option{-fpic} or @option{-fPIC} for
14109building code that forms part of a dynamic linker and cannot
14110reference the address of a jump table.  On some targets, jump tables
14111do not require a GOT and this option is not needed.
14112
14113@item -ffixed-@var{reg}
14114@opindex ffixed
14115Treat the register named @var{reg} as a fixed register; generated code
14116should never refer to it (except perhaps as a stack pointer, frame
14117pointer or in some other fixed role).
14118
14119@var{reg} must be the name of a register.  The register names accepted
14120are machine-specific and are defined in the @code{REGISTER_NAMES}
14121macro in the machine description macro file.
14122
14123This flag does not have a negative form, because it specifies a
14124three-way choice.
14125
14126@item -fcall-used-@var{reg}
14127@opindex fcall-used
14128Treat the register named @var{reg} as an allocable register that is
14129clobbered by function calls.  It may be allocated for temporaries or
14130variables that do not live across a call.  Functions compiled this way
14131do not save and restore the register @var{reg}.
14132
14133It is an error to use this flag with the frame pointer or stack pointer.
14134Use of this flag for other registers that have fixed pervasive roles in
14135the machine's execution model produces disastrous results.
14136
14137This flag does not have a negative form, because it specifies a
14138three-way choice.
14139
14140@item -fcall-saved-@var{reg}
14141@opindex fcall-saved
14142Treat the register named @var{reg} as an allocable register saved by
14143functions.  It may be allocated even for temporaries or variables that
14144live across a call.  Functions compiled this way save and restore
14145the register @var{reg} if they use it.
14146
14147It is an error to use this flag with the frame pointer or stack pointer.
14148Use of this flag for other registers that have fixed pervasive roles in
14149the machine's execution model produces disastrous results.
14150
14151A different sort of disaster results from the use of this flag for
14152a register in which function values may be returned.
14153
14154This flag does not have a negative form, because it specifies a
14155three-way choice.
14156
14157@item -fpack-struct[=@var{n}]
14158@opindex fpack-struct
14159Without a value specified, pack all structure members together without
14160holes.  When a value is specified (which must be a small power of two), pack
14161structure members according to this value, representing the maximum
14162alignment (that is, objects with default alignment requirements larger than
14163this are output potentially unaligned at the next fitting location.
14164
14165@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14166code that is not binary compatible with code generated without that switch.
14167Additionally, it makes the code suboptimal.
14168Use it to conform to a non-default application binary interface.
14169
14170@item -fleading-underscore
14171@opindex fleading-underscore
14172This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14173change the way C symbols are represented in the object file.  One use
14174is to help link with legacy assembly code.
14175
14176@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14177generate code that is not binary compatible with code generated without that
14178switch.  Use it to conform to a non-default application binary interface.
14179Not all targets provide complete support for this switch.
14180
14181@item -ftls-model=@var{model}
14182@opindex ftls-model
14183Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14184The @var{model} argument should be one of @samp{global-dynamic},
14185@samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14186Note that the choice is subject to optimization: the compiler may use
14187a more efficient model for symbols not visible outside of the translation
14188unit, or if @option{-fpic} is not given on the command line.
14189
14190The default without @option{-fpic} is @samp{initial-exec}; with
14191@option{-fpic} the default is @samp{global-dynamic}.
14192
14193@item -ftrampolines
14194@opindex ftrampolines
14195For targets that normally need trampolines for nested functions, always
14196generate them instead of using descriptors.  Otherwise, for targets that
14197do not need them, like for example HP-PA or IA-64, do nothing.
14198
14199A trampoline is a small piece of code that is created at run time on the
14200stack when the address of a nested function is taken, and is used to call
14201the nested function indirectly.  Therefore, it requires the stack to be
14202made executable in order for the program to work properly.
14203
14204@option{-fno-trampolines} is enabled by default on a language by language
14205basis to let the compiler avoid generating them, if it computes that this
14206is safe, and replace them with descriptors.  Descriptors are made up of data
14207only, but the generated code must be prepared to deal with them.  As of this
14208writing, @option{-fno-trampolines} is enabled by default only for Ada.
14209
14210Moreover, code compiled with @option{-ftrampolines} and code compiled with
14211@option{-fno-trampolines} are not binary compatible if nested functions are
14212present.  This option must therefore be used on a program-wide basis and be
14213manipulated with extreme care.
14214
14215@item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14216@opindex fvisibility
14217Set the default ELF image symbol visibility to the specified option---all
14218symbols are marked with this unless overridden within the code.
14219Using this feature can very substantially improve linking and
14220load times of shared object libraries, produce more optimized
14221code, provide near-perfect API export and prevent symbol clashes.
14222It is @strong{strongly} recommended that you use this in any shared objects
14223you distribute.
14224
14225Despite the nomenclature, @samp{default} always means public; i.e.,
14226available to be linked against from outside the shared object.
14227@samp{protected} and @samp{internal} are pretty useless in real-world
14228usage so the only other commonly used option is @samp{hidden}.
14229The default if @option{-fvisibility} isn't specified is
14230@samp{default}, i.e., make every symbol public.
14231
14232A good explanation of the benefits offered by ensuring ELF
14233symbols have the correct visibility is given by ``How To Write
14234Shared Libraries'' by Ulrich Drepper (which can be found at
14235@w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14236solution made possible by this option to marking things hidden when
14237the default is public is to make the default hidden and mark things
14238public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14239and @code{__attribute__ ((visibility("default")))} instead of
14240@code{__declspec(dllexport)} you get almost identical semantics with
14241identical syntax.  This is a great boon to those working with
14242cross-platform projects.
14243
14244For those adding visibility support to existing code, you may find
14245@code{#pragma GCC visibility} of use.  This works by you enclosing
14246the declarations you wish to set visibility for with (for example)
14247@code{#pragma GCC visibility push(hidden)} and
14248@code{#pragma GCC visibility pop}.
14249Bear in mind that symbol visibility should be viewed @strong{as
14250part of the API interface contract} and thus all new code should
14251always specify visibility when it is not the default; i.e., declarations
14252only for use within the local DSO should @strong{always} be marked explicitly
14253as hidden as so to avoid PLT indirection overheads---making this
14254abundantly clear also aids readability and self-documentation of the code.
14255Note that due to ISO C++ specification requirements, @code{operator new} and
14256@code{operator delete} must always be of default visibility.
14257
14258Be aware that headers from outside your project, in particular system
14259headers and headers from any other library you use, may not be
14260expecting to be compiled with visibility other than the default.  You
14261may need to explicitly say @code{#pragma GCC visibility push(default)}
14262before including any such headers.
14263
14264@code{extern} declarations are not affected by @option{-fvisibility}, so
14265a lot of code can be recompiled with @option{-fvisibility=hidden} with
14266no modifications.  However, this means that calls to @code{extern}
14267functions with no explicit visibility use the PLT, so it is more
14268effective to use @code{__attribute ((visibility))} and/or
14269@code{#pragma GCC visibility} to tell the compiler which @code{extern}
14270declarations should be treated as hidden.
14271
14272Note that @option{-fvisibility} does affect C++ vague linkage
14273entities. This means that, for instance, an exception class that is
14274be thrown between DSOs must be explicitly marked with default
14275visibility so that the @samp{type_info} nodes are unified between
14276the DSOs.
14277
14278An overview of these techniques, their benefits and how to use them
14279is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14280
14281@item -fstrict-volatile-bitfields
14282@opindex fstrict-volatile-bitfields
14283This option should be used if accesses to volatile bit-fields (or other
14284structure fields, although the compiler usually honors those types
14285anyway) should use a single access of the width of the
14286field's type, aligned to a natural alignment if possible.  For
14287example, targets with memory-mapped peripheral registers might require
14288all such accesses to be 16 bits wide; with this flag you can
14289declare all peripheral bit-fields as @code{unsigned short} (assuming short
14290is 16 bits on these targets) to force GCC to use 16-bit accesses
14291instead of, perhaps, a more efficient 32-bit access.
14292
14293If this option is disabled, the compiler uses the most efficient
14294instruction.  In the previous example, that might be a 32-bit load
14295instruction, even though that accesses bytes that do not contain
14296any portion of the bit-field, or memory-mapped registers unrelated to
14297the one being updated.
14298
14299In some cases, such as when the @code{packed} attribute is applied to a
14300structure field, it may not be possible to access the field with a single
14301read or write that is correctly aligned for the target machine.  In this
14302case GCC falls back to generating multiple accesses rather than code that
14303will fault or truncate the result at run time.
14304
14305Note:  Due to restrictions of the C/C++11 memory model, write accesses are
14306not allowed to touch non bit-field members.  It is therefore recommended
14307to define all bits of the field's type as bit-field members.
14308
14309The default value of this option is determined by the application binary
14310interface for the target processor.
14311
14312@item -fsync-libcalls
14313@opindex fsync-libcalls
14314This option controls whether any out-of-line instance of the @code{__sync}
14315family of functions may be used to implement the C++11 @code{__atomic}
14316family of functions.
14317
14318The default value of this option is enabled, thus the only useful form
14319of the option is @option{-fno-sync-libcalls}.  This option is used in
14320the implementation of the @file{libatomic} runtime library.
14321
14322@end table
14323
14324@node Developer Options
14325@section GCC Developer Options
14326@cindex developer options
14327@cindex debugging GCC
14328@cindex debug dump options
14329@cindex dump options
14330@cindex compilation statistics
14331
14332This section describes command-line options that are primarily of
14333interest to GCC developers, including options to support compiler
14334testing and investigation of compiler bugs and compile-time
14335performance problems.  This includes options that produce debug dumps
14336at various points in the compilation; that print statistics such as
14337memory use and execution time; and that print information about GCC's
14338configuration, such as where it searches for libraries.  You should
14339rarely need to use any of these options for ordinary compilation and
14340linking tasks.
14341
14342Many developer options that cause GCC to dump output to a file take an
14343optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14344or @samp{-} to dump to standard output, and @samp{stderr} for standard
14345error.
14346
14347If @samp{=@var{filename}} is omitted, a default dump file name is
14348constructed by concatenating the base dump file name, a pass number,
14349phase letter, and pass name.  The base dump file name is the name of
14350output file produced by the compiler if explicitly specified and not
14351an executable; otherwise it is the source file name.
14352The pass number is determined by the order passes are registered with
14353the compiler's pass manager.
14354This is generally the same as the order of execution, but passes
14355registered by plugins, target-specific passes, or passes that are
14356otherwise registered late are numbered higher than the pass named
14357@samp{final}, even if they are executed earlier.  The phase letter is
14358one of @samp{i} (inter-procedural analysis), @samp{l}
14359(language-specific), @samp{r} (RTL), or @samp{t} (tree).
14360The files are created in the directory of the output file.
14361
14362@table @gcctabopt
14363
14364@item -d@var{letters}
14365@itemx -fdump-rtl-@var{pass}
14366@itemx -fdump-rtl-@var{pass}=@var{filename}
14367@opindex d
14368@opindex fdump-rtl-@var{pass}
14369Says to make debugging dumps during compilation at times specified by
14370@var{letters}.  This is used for debugging the RTL-based passes of the
14371compiler.
14372
14373Some @option{-d@var{letters}} switches have different meaning when
14374@option{-E} is used for preprocessing.  @xref{Preprocessor Options},
14375for information about preprocessor-specific dump options.
14376
14377Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14378@option{-d} option @var{letters}.  Here are the possible
14379letters for use in @var{pass} and @var{letters}, and their meanings:
14380
14381@table @gcctabopt
14382
14383@item -fdump-rtl-alignments
14384@opindex fdump-rtl-alignments
14385Dump after branch alignments have been computed.
14386
14387@item -fdump-rtl-asmcons
14388@opindex fdump-rtl-asmcons
14389Dump after fixing rtl statements that have unsatisfied in/out constraints.
14390
14391@item -fdump-rtl-auto_inc_dec
14392@opindex fdump-rtl-auto_inc_dec
14393Dump after auto-inc-dec discovery.  This pass is only run on
14394architectures that have auto inc or auto dec instructions.
14395
14396@item -fdump-rtl-barriers
14397@opindex fdump-rtl-barriers
14398Dump after cleaning up the barrier instructions.
14399
14400@item -fdump-rtl-bbpart
14401@opindex fdump-rtl-bbpart
14402Dump after partitioning hot and cold basic blocks.
14403
14404@item -fdump-rtl-bbro
14405@opindex fdump-rtl-bbro
14406Dump after block reordering.
14407
14408@item -fdump-rtl-btl1
14409@itemx -fdump-rtl-btl2
14410@opindex fdump-rtl-btl2
14411@opindex fdump-rtl-btl2
14412@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14413after the two branch
14414target load optimization passes.
14415
14416@item -fdump-rtl-bypass
14417@opindex fdump-rtl-bypass
14418Dump after jump bypassing and control flow optimizations.
14419
14420@item -fdump-rtl-combine
14421@opindex fdump-rtl-combine
14422Dump after the RTL instruction combination pass.
14423
14424@item -fdump-rtl-compgotos
14425@opindex fdump-rtl-compgotos
14426Dump after duplicating the computed gotos.
14427
14428@item -fdump-rtl-ce1
14429@itemx -fdump-rtl-ce2
14430@itemx -fdump-rtl-ce3
14431@opindex fdump-rtl-ce1
14432@opindex fdump-rtl-ce2
14433@opindex fdump-rtl-ce3
14434@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14435@option{-fdump-rtl-ce3} enable dumping after the three
14436if conversion passes.
14437
14438@item -fdump-rtl-cprop_hardreg
14439@opindex fdump-rtl-cprop_hardreg
14440Dump after hard register copy propagation.
14441
14442@item -fdump-rtl-csa
14443@opindex fdump-rtl-csa
14444Dump after combining stack adjustments.
14445
14446@item -fdump-rtl-cse1
14447@itemx -fdump-rtl-cse2
14448@opindex fdump-rtl-cse1
14449@opindex fdump-rtl-cse2
14450@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14451the two common subexpression elimination passes.
14452
14453@item -fdump-rtl-dce
14454@opindex fdump-rtl-dce
14455Dump after the standalone dead code elimination passes.
14456
14457@item -fdump-rtl-dbr
14458@opindex fdump-rtl-dbr
14459Dump after delayed branch scheduling.
14460
14461@item -fdump-rtl-dce1
14462@itemx -fdump-rtl-dce2
14463@opindex fdump-rtl-dce1
14464@opindex fdump-rtl-dce2
14465@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14466the two dead store elimination passes.
14467
14468@item -fdump-rtl-eh
14469@opindex fdump-rtl-eh
14470Dump after finalization of EH handling code.
14471
14472@item -fdump-rtl-eh_ranges
14473@opindex fdump-rtl-eh_ranges
14474Dump after conversion of EH handling range regions.
14475
14476@item -fdump-rtl-expand
14477@opindex fdump-rtl-expand
14478Dump after RTL generation.
14479
14480@item -fdump-rtl-fwprop1
14481@itemx -fdump-rtl-fwprop2
14482@opindex fdump-rtl-fwprop1
14483@opindex fdump-rtl-fwprop2
14484@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14485dumping after the two forward propagation passes.
14486
14487@item -fdump-rtl-gcse1
14488@itemx -fdump-rtl-gcse2
14489@opindex fdump-rtl-gcse1
14490@opindex fdump-rtl-gcse2
14491@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14492after global common subexpression elimination.
14493
14494@item -fdump-rtl-init-regs
14495@opindex fdump-rtl-init-regs
14496Dump after the initialization of the registers.
14497
14498@item -fdump-rtl-initvals
14499@opindex fdump-rtl-initvals
14500Dump after the computation of the initial value sets.
14501
14502@item -fdump-rtl-into_cfglayout
14503@opindex fdump-rtl-into_cfglayout
14504Dump after converting to cfglayout mode.
14505
14506@item -fdump-rtl-ira
14507@opindex fdump-rtl-ira
14508Dump after iterated register allocation.
14509
14510@item -fdump-rtl-jump
14511@opindex fdump-rtl-jump
14512Dump after the second jump optimization.
14513
14514@item -fdump-rtl-loop2
14515@opindex fdump-rtl-loop2
14516@option{-fdump-rtl-loop2} enables dumping after the rtl
14517loop optimization passes.
14518
14519@item -fdump-rtl-mach
14520@opindex fdump-rtl-mach
14521Dump after performing the machine dependent reorganization pass, if that
14522pass exists.
14523
14524@item -fdump-rtl-mode_sw
14525@opindex fdump-rtl-mode_sw
14526Dump after removing redundant mode switches.
14527
14528@item -fdump-rtl-rnreg
14529@opindex fdump-rtl-rnreg
14530Dump after register renumbering.
14531
14532@item -fdump-rtl-outof_cfglayout
14533@opindex fdump-rtl-outof_cfglayout
14534Dump after converting from cfglayout mode.
14535
14536@item -fdump-rtl-peephole2
14537@opindex fdump-rtl-peephole2
14538Dump after the peephole pass.
14539
14540@item -fdump-rtl-postreload
14541@opindex fdump-rtl-postreload
14542Dump after post-reload optimizations.
14543
14544@item -fdump-rtl-pro_and_epilogue
14545@opindex fdump-rtl-pro_and_epilogue
14546Dump after generating the function prologues and epilogues.
14547
14548@item -fdump-rtl-sched1
14549@itemx -fdump-rtl-sched2
14550@opindex fdump-rtl-sched1
14551@opindex fdump-rtl-sched2
14552@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14553after the basic block scheduling passes.
14554
14555@item -fdump-rtl-ree
14556@opindex fdump-rtl-ree
14557Dump after sign/zero extension elimination.
14558
14559@item -fdump-rtl-seqabstr
14560@opindex fdump-rtl-seqabstr
14561Dump after common sequence discovery.
14562
14563@item -fdump-rtl-shorten
14564@opindex fdump-rtl-shorten
14565Dump after shortening branches.
14566
14567@item -fdump-rtl-sibling
14568@opindex fdump-rtl-sibling
14569Dump after sibling call optimizations.
14570
14571@item -fdump-rtl-split1
14572@itemx -fdump-rtl-split2
14573@itemx -fdump-rtl-split3
14574@itemx -fdump-rtl-split4
14575@itemx -fdump-rtl-split5
14576@opindex fdump-rtl-split1
14577@opindex fdump-rtl-split2
14578@opindex fdump-rtl-split3
14579@opindex fdump-rtl-split4
14580@opindex fdump-rtl-split5
14581These options enable dumping after five rounds of
14582instruction splitting.
14583
14584@item -fdump-rtl-sms
14585@opindex fdump-rtl-sms
14586Dump after modulo scheduling.  This pass is only run on some
14587architectures.
14588
14589@item -fdump-rtl-stack
14590@opindex fdump-rtl-stack
14591Dump after conversion from GCC's ``flat register file'' registers to the
14592x87's stack-like registers.  This pass is only run on x86 variants.
14593
14594@item -fdump-rtl-subreg1
14595@itemx -fdump-rtl-subreg2
14596@opindex fdump-rtl-subreg1
14597@opindex fdump-rtl-subreg2
14598@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14599the two subreg expansion passes.
14600
14601@item -fdump-rtl-unshare
14602@opindex fdump-rtl-unshare
14603Dump after all rtl has been unshared.
14604
14605@item -fdump-rtl-vartrack
14606@opindex fdump-rtl-vartrack
14607Dump after variable tracking.
14608
14609@item -fdump-rtl-vregs
14610@opindex fdump-rtl-vregs
14611Dump after converting virtual registers to hard registers.
14612
14613@item -fdump-rtl-web
14614@opindex fdump-rtl-web
14615Dump after live range splitting.
14616
14617@item -fdump-rtl-regclass
14618@itemx -fdump-rtl-subregs_of_mode_init
14619@itemx -fdump-rtl-subregs_of_mode_finish
14620@itemx -fdump-rtl-dfinit
14621@itemx -fdump-rtl-dfinish
14622@opindex fdump-rtl-regclass
14623@opindex fdump-rtl-subregs_of_mode_init
14624@opindex fdump-rtl-subregs_of_mode_finish
14625@opindex fdump-rtl-dfinit
14626@opindex fdump-rtl-dfinish
14627These dumps are defined but always produce empty files.
14628
14629@item -da
14630@itemx -fdump-rtl-all
14631@opindex da
14632@opindex fdump-rtl-all
14633Produce all the dumps listed above.
14634
14635@item -dA
14636@opindex dA
14637Annotate the assembler output with miscellaneous debugging information.
14638
14639@item -dD
14640@opindex dD
14641Dump all macro definitions, at the end of preprocessing, in addition to
14642normal output.
14643
14644@item -dH
14645@opindex dH
14646Produce a core dump whenever an error occurs.
14647
14648@item -dp
14649@opindex dp
14650Annotate the assembler output with a comment indicating which
14651pattern and alternative is used.  The length and cost of each instruction are
14652also printed.
14653
14654@item -dP
14655@opindex dP
14656Dump the RTL in the assembler output as a comment before each instruction.
14657Also turns on @option{-dp} annotation.
14658
14659@item -dx
14660@opindex dx
14661Just generate RTL for a function instead of compiling it.  Usually used
14662with @option{-fdump-rtl-expand}.
14663@end table
14664
14665@item -fdump-debug
14666@opindex fdump-debug
14667Dump debugging information generated during the debug
14668generation phase.
14669
14670@item -fdump-earlydebug
14671@opindex fdump-earlydebug
14672Dump debugging information generated during the early debug
14673generation phase.
14674
14675@item -fdump-noaddr
14676@opindex fdump-noaddr
14677When doing debugging dumps, suppress address output.  This makes it more
14678feasible to use diff on debugging dumps for compiler invocations with
14679different compiler binaries and/or different
14680text / bss / data / heap / stack / dso start locations.
14681
14682@item -freport-bug
14683@opindex freport-bug
14684Collect and dump debug information into a temporary file if an
14685internal compiler error (ICE) occurs.
14686
14687@item -fdump-unnumbered
14688@opindex fdump-unnumbered
14689When doing debugging dumps, suppress instruction numbers and address output.
14690This makes it more feasible to use diff on debugging dumps for compiler
14691invocations with different options, in particular with and without
14692@option{-g}.
14693
14694@item -fdump-unnumbered-links
14695@opindex fdump-unnumbered-links
14696When doing debugging dumps (see @option{-d} option above), suppress
14697instruction numbers for the links to the previous and next instructions
14698in a sequence.
14699
14700@item -fdump-ipa-@var{switch}
14701@itemx -fdump-ipa-@var{switch}-@var{options}
14702@opindex fdump-ipa
14703Control the dumping at various stages of inter-procedural analysis
14704language tree to a file.  The file name is generated by appending a
14705switch specific suffix to the source file name, and the file is created
14706in the same directory as the output file.  The following dumps are
14707possible:
14708
14709@table @samp
14710@item all
14711Enables all inter-procedural analysis dumps.
14712
14713@item cgraph
14714Dumps information about call-graph optimization, unused function removal,
14715and inlining decisions.
14716
14717@item inline
14718Dump after function inlining.
14719
14720@end table
14721
14722Additionally, the options @option{-optimized}, @option{-missed},
14723@option{-note}, and @option{-all} can be provided, with the same meaning
14724as for @option{-fopt-info}, defaulting to @option{-optimized}.
14725
14726For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14727information on callsites that were inlined, along with callsites
14728that were not inlined.
14729
14730By default, the dump will contain messages about successful
14731optimizations (equivalent to @option{-optimized}) together with
14732low-level details about the analysis.
14733
14734@item -fdump-lang-all
14735@itemx -fdump-lang-@var{switch}
14736@itemx -fdump-lang-@var{switch}-@var{options}
14737@itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14738@opindex fdump-lang-all
14739@opindex fdump-lang
14740Control the dumping of language-specific information.  The @var{options}
14741and @var{filename} portions behave as described in the
14742@option{-fdump-tree} option.  The following @var{switch} values are
14743accepted:
14744
14745@table @samp
14746@item all
14747
14748Enable all language-specific dumps.
14749
14750@item class
14751Dump class hierarchy information.  Virtual table information is emitted
14752unless '@option{slim}' is specified.  This option is applicable to C++ only.
14753
14754@item raw
14755Dump the raw internal tree data.  This option is applicable to C++ only.
14756
14757@end table
14758
14759@item -fdump-passes
14760@opindex fdump-passes
14761Print on @file{stderr} the list of optimization passes that are turned
14762on and off by the current command-line options.
14763
14764@item -fdump-statistics-@var{option}
14765@opindex fdump-statistics
14766Enable and control dumping of pass statistics in a separate file.  The
14767file name is generated by appending a suffix ending in
14768@samp{.statistics} to the source file name, and the file is created in
14769the same directory as the output file.  If the @samp{-@var{option}}
14770form is used, @samp{-stats} causes counters to be summed over the
14771whole compilation unit while @samp{-details} dumps every event as
14772the passes generate them.  The default with no option is to sum
14773counters for each function compiled.
14774
14775@item -fdump-tree-all
14776@itemx -fdump-tree-@var{switch}
14777@itemx -fdump-tree-@var{switch}-@var{options}
14778@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14779@opindex fdump-tree-all
14780@opindex fdump-tree
14781Control the dumping at various stages of processing the intermediate
14782language tree to a file.  If the @samp{-@var{options}}
14783form is used, @var{options} is a list of @samp{-} separated options
14784which control the details of the dump.  Not all options are applicable
14785to all dumps; those that are not meaningful are ignored.  The
14786following options are available
14787
14788@table @samp
14789@item address
14790Print the address of each node.  Usually this is not meaningful as it
14791changes according to the environment and source file.  Its primary use
14792is for tying up a dump file with a debug environment.
14793@item asmname
14794If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14795in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
14796use working backward from mangled names in the assembly file.
14797@item slim
14798When dumping front-end intermediate representations, inhibit dumping
14799of members of a scope or body of a function merely because that scope
14800has been reached.  Only dump such items when they are directly reachable
14801by some other path.
14802
14803When dumping pretty-printed trees, this option inhibits dumping the
14804bodies of control structures.
14805
14806When dumping RTL, print the RTL in slim (condensed) form instead of
14807the default LISP-like representation.
14808@item raw
14809Print a raw representation of the tree.  By default, trees are
14810pretty-printed into a C-like representation.
14811@item details
14812Enable more detailed dumps (not honored by every dump option). Also
14813include information from the optimization passes.
14814@item stats
14815Enable dumping various statistics about the pass (not honored by every dump
14816option).
14817@item blocks
14818Enable showing basic block boundaries (disabled in raw dumps).
14819@item graph
14820For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14821dump a representation of the control flow graph suitable for viewing with
14822GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
14823the file is pretty-printed as a subgraph, so that GraphViz can render them
14824all in a single plot.
14825
14826This option currently only works for RTL dumps, and the RTL is always
14827dumped in slim form.
14828@item vops
14829Enable showing virtual operands for every statement.
14830@item lineno
14831Enable showing line numbers for statements.
14832@item uid
14833Enable showing the unique ID (@code{DECL_UID}) for each variable.
14834@item verbose
14835Enable showing the tree dump for each statement.
14836@item eh
14837Enable showing the EH region number holding each statement.
14838@item scev
14839Enable showing scalar evolution analysis details.
14840@item optimized
14841Enable showing optimization information (only available in certain
14842passes).
14843@item missed
14844Enable showing missed optimization information (only available in certain
14845passes).
14846@item note
14847Enable other detailed optimization information (only available in
14848certain passes).
14849@item all
14850Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14851and @option{lineno}.
14852@item optall
14853Turn on all optimization options, i.e., @option{optimized},
14854@option{missed}, and @option{note}.
14855@end table
14856
14857To determine what tree dumps are available or find the dump for a pass
14858of interest follow the steps below.
14859
14860@enumerate
14861@item
14862Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14863look for a code that corresponds to the pass you are interested in.
14864For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14865@code{tree-vrp2} correspond to the three Value Range Propagation passes.
14866The number at the end distinguishes distinct invocations of the same pass.
14867@item
14868To enable the creation of the dump file, append the pass code to
14869the @option{-fdump-} option prefix and invoke GCC with it.  For example,
14870to enable the dump from the Early Value Range Propagation pass, invoke
14871GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
14872specify the name of the dump file.  If you don't specify one, GCC
14873creates as described below.
14874@item
14875Find the pass dump in a file whose name is composed of three components
14876separated by a period: the name of the source file GCC was invoked to
14877compile, a numeric suffix indicating the pass number followed by the
14878letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14879and finally the pass code.  For example, the Early VRP pass dump might
14880be in a file named @file{myfile.c.038t.evrp} in the current working
14881directory.  Note that the numeric codes are not stable and may change
14882from one version of GCC to another.
14883@end enumerate
14884
14885@item -fopt-info
14886@itemx -fopt-info-@var{options}
14887@itemx -fopt-info-@var{options}=@var{filename}
14888@opindex fopt-info
14889Controls optimization dumps from various optimization passes. If the
14890@samp{-@var{options}} form is used, @var{options} is a list of
14891@samp{-} separated option keywords to select the dump details and
14892optimizations.
14893
14894The @var{options} can be divided into three groups:
14895@enumerate
14896@item
14897options describing what kinds of messages should be emitted,
14898@item
14899options describing the verbosity of the dump, and
14900@item
14901options describing which optimizations should be included.
14902@end enumerate
14903The options from each group can be freely mixed as they are
14904non-overlapping. However, in case of any conflicts,
14905the later options override the earlier options on the command
14906line.
14907
14908The following options control which kinds of messages should be emitted:
14909
14910@table @samp
14911@item optimized
14912Print information when an optimization is successfully applied. It is
14913up to a pass to decide which information is relevant. For example, the
14914vectorizer passes print the source location of loops which are
14915successfully vectorized.
14916@item missed
14917Print information about missed optimizations. Individual passes
14918control which information to include in the output.
14919@item note
14920Print verbose information about optimizations, such as certain
14921transformations, more detailed messages about decisions etc.
14922@item all
14923Print detailed optimization information. This includes
14924@samp{optimized}, @samp{missed}, and @samp{note}.
14925@end table
14926
14927The following option controls the dump verbosity:
14928
14929@table @samp
14930@item internals
14931By default, only ``high-level'' messages are emitted. This option enables
14932additional, more detailed, messages, which are likely to only be of interest
14933to GCC developers.
14934@end table
14935
14936One or more of the following option keywords can be used to describe a
14937group of optimizations:
14938
14939@table @samp
14940@item ipa
14941Enable dumps from all interprocedural optimizations.
14942@item loop
14943Enable dumps from all loop optimizations.
14944@item inline
14945Enable dumps from all inlining optimizations.
14946@item omp
14947Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14948@item vec
14949Enable dumps from all vectorization optimizations.
14950@item optall
14951Enable dumps from all optimizations. This is a superset of
14952the optimization groups listed above.
14953@end table
14954
14955If @var{options} is
14956omitted, it defaults to @samp{optimized-optall}, which means to dump messages
14957about successful optimizations from all the passes, omitting messages
14958that are treated as ``internals''.
14959
14960If the @var{filename} is provided, then the dumps from all the
14961applicable optimizations are concatenated into the @var{filename}.
14962Otherwise the dump is output onto @file{stderr}. Though multiple
14963@option{-fopt-info} options are accepted, only one of them can include
14964a @var{filename}. If other filenames are provided then all but the
14965first such option are ignored.
14966
14967Note that the output @var{filename} is overwritten
14968in case of multiple translation units. If a combined output from
14969multiple translation units is desired, @file{stderr} should be used
14970instead.
14971
14972In the following example, the optimization info is output to
14973@file{stderr}:
14974
14975@smallexample
14976gcc -O3 -fopt-info
14977@end smallexample
14978
14979This example:
14980@smallexample
14981gcc -O3 -fopt-info-missed=missed.all
14982@end smallexample
14983
14984@noindent
14985outputs missed optimization report from all the passes into
14986@file{missed.all}, and this one:
14987
14988@smallexample
14989gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14990@end smallexample
14991
14992@noindent
14993prints information about missed optimization opportunities from
14994vectorization passes on @file{stderr}.
14995Note that @option{-fopt-info-vec-missed} is equivalent to
14996@option{-fopt-info-missed-vec}.  The order of the optimization group
14997names and message types listed after @option{-fopt-info} does not matter.
14998
14999As another example,
15000@smallexample
15001gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15002@end smallexample
15003
15004@noindent
15005outputs information about missed optimizations as well as
15006optimized locations from all the inlining passes into
15007@file{inline.txt}.
15008
15009Finally, consider:
15010
15011@smallexample
15012gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15013@end smallexample
15014
15015@noindent
15016Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15017in conflict since only one output file is allowed. In this case, only
15018the first option takes effect and the subsequent options are
15019ignored. Thus only @file{vec.miss} is produced which contains
15020dumps from the vectorizer about missed opportunities.
15021
15022@item -fsave-optimization-record
15023@opindex fsave-optimization-record
15024Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15025were performed, for those optimizations that support @option{-fopt-info}.
15026
15027This option is experimental and the format of the data within the
15028compressed JSON file is subject to change.
15029
15030It is roughly equivalent to a machine-readable version of
15031@option{-fopt-info-all}, as a collection of messages with source file,
15032line number and column number, with the following additional data for
15033each message:
15034
15035@itemize @bullet
15036
15037@item
15038the execution count of the code being optimized, along with metadata about
15039whether this was from actual profile data, or just an estimate, allowing
15040consumers to prioritize messages by code hotness,
15041
15042@item
15043the function name of the code being optimized, where applicable,
15044
15045@item
15046the ``inlining chain'' for the code being optimized, so that when
15047a function is inlined into several different places (which might
15048themselves be inlined), the reader can distinguish between the copies,
15049
15050@item
15051objects identifying those parts of the message that refer to expressions,
15052statements or symbol-table nodes, which of these categories they are, and,
15053when available, their source code location,
15054
15055@item
15056the GCC pass that emitted the message, and
15057
15058@item
15059the location in GCC's own code from which the message was emitted
15060
15061@end itemize
15062
15063Additionally, some messages are logically nested within other
15064messages, reflecting implementation details of the optimization
15065passes.
15066
15067@item -fsched-verbose=@var{n}
15068@opindex fsched-verbose
15069On targets that use instruction scheduling, this option controls the
15070amount of debugging output the scheduler prints to the dump files.
15071
15072For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15073same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15074For @var{n} greater than one, it also output basic block probabilities,
15075detailed ready list information and unit/insn info.  For @var{n} greater
15076than two, it includes RTL at abort point, control-flow and regions info.
15077And for @var{n} over four, @option{-fsched-verbose} also includes
15078dependence info.
15079
15080
15081
15082@item -fenable-@var{kind}-@var{pass}
15083@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15084@opindex fdisable-
15085@opindex fenable-
15086
15087This is a set of options that are used to explicitly disable/enable
15088optimization passes.  These options are intended for use for debugging GCC.
15089Compiler users should use regular options for enabling/disabling
15090passes instead.
15091
15092@table @gcctabopt
15093
15094@item -fdisable-ipa-@var{pass}
15095Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
15096statically invoked in the compiler multiple times, the pass name should be
15097appended with a sequential number starting from 1.
15098
15099@item -fdisable-rtl-@var{pass}
15100@itemx -fdisable-rtl-@var{pass}=@var{range-list}
15101Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
15102statically invoked in the compiler multiple times, the pass name should be
15103appended with a sequential number starting from 1.  @var{range-list} is a
15104comma-separated list of function ranges or assembler names.  Each range is a number
15105pair separated by a colon.  The range is inclusive in both ends.  If the range
15106is trivial, the number pair can be simplified as a single number.  If the
15107function's call graph node's @var{uid} falls within one of the specified ranges,
15108the @var{pass} is disabled for that function.  The @var{uid} is shown in the
15109function header of a dump file, and the pass names can be dumped by using
15110option @option{-fdump-passes}.
15111
15112@item -fdisable-tree-@var{pass}
15113@itemx -fdisable-tree-@var{pass}=@var{range-list}
15114Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
15115option arguments.
15116
15117@item -fenable-ipa-@var{pass}
15118Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
15119statically invoked in the compiler multiple times, the pass name should be
15120appended with a sequential number starting from 1.
15121
15122@item -fenable-rtl-@var{pass}
15123@itemx -fenable-rtl-@var{pass}=@var{range-list}
15124Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
15125description and examples.
15126
15127@item -fenable-tree-@var{pass}
15128@itemx -fenable-tree-@var{pass}=@var{range-list}
15129Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
15130of option arguments.
15131
15132@end table
15133
15134Here are some examples showing uses of these options.
15135
15136@smallexample
15137
15138# disable ccp1 for all functions
15139   -fdisable-tree-ccp1
15140# disable complete unroll for function whose cgraph node uid is 1
15141   -fenable-tree-cunroll=1
15142# disable gcse2 for functions at the following ranges [1,1],
15143# [300,400], and [400,1000]
15144# disable gcse2 for functions foo and foo2
15145   -fdisable-rtl-gcse2=foo,foo2
15146# disable early inlining
15147   -fdisable-tree-einline
15148# disable ipa inlining
15149   -fdisable-ipa-inline
15150# enable tree full unroll
15151   -fenable-tree-unroll
15152
15153@end smallexample
15154
15155@item -fchecking
15156@itemx -fchecking=@var{n}
15157@opindex fchecking
15158@opindex fno-checking
15159Enable internal consistency checking.  The default depends on
15160the compiler configuration.  @option{-fchecking=2} enables further
15161internal consistency checking that might affect code generation.
15162
15163@item -frandom-seed=@var{string}
15164@opindex frandom-seed
15165This option provides a seed that GCC uses in place of
15166random numbers in generating certain symbol names
15167that have to be different in every compiled file.  It is also used to
15168place unique stamps in coverage data files and the object files that
15169produce them.  You can use the @option{-frandom-seed} option to produce
15170reproducibly identical object files.
15171
15172The @var{string} can either be a number (decimal, octal or hex) or an
15173arbitrary string (in which case it's converted to a number by
15174computing CRC32).
15175
15176The @var{string} should be different for every file you compile.
15177
15178@item -save-temps
15179@itemx -save-temps=cwd
15180@opindex save-temps
15181Store the usual ``temporary'' intermediate files permanently; place them
15182in the current directory and name them based on the source file.  Thus,
15183compiling @file{foo.c} with @option{-c -save-temps} produces files
15184@file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
15185preprocessed @file{foo.i} output file even though the compiler now
15186normally uses an integrated preprocessor.
15187
15188When used in combination with the @option{-x} command-line option,
15189@option{-save-temps} is sensible enough to avoid over writing an
15190input source file with the same extension as an intermediate file.
15191The corresponding intermediate file may be obtained by renaming the
15192source file before using @option{-save-temps}.
15193
15194If you invoke GCC in parallel, compiling several different source
15195files that share a common base name in different subdirectories or the
15196same source file compiled for multiple output destinations, it is
15197likely that the different parallel compilers will interfere with each
15198other, and overwrite the temporary files.  For instance:
15199
15200@smallexample
15201gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15202gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15203@end smallexample
15204
15205may result in @file{foo.i} and @file{foo.o} being written to
15206simultaneously by both compilers.
15207
15208@item -save-temps=obj
15209@opindex save-temps=obj
15210Store the usual ``temporary'' intermediate files permanently.  If the
15211@option{-o} option is used, the temporary files are based on the
15212object file.  If the @option{-o} option is not used, the
15213@option{-save-temps=obj} switch behaves like @option{-save-temps}.
15214
15215For example:
15216
15217@smallexample
15218gcc -save-temps=obj -c foo.c
15219gcc -save-temps=obj -c bar.c -o dir/xbar.o
15220gcc -save-temps=obj foobar.c -o dir2/yfoobar
15221@end smallexample
15222
15223@noindent
15224creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15225@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15226@file{dir2/yfoobar.o}.
15227
15228@item -time@r{[}=@var{file}@r{]}
15229@opindex time
15230Report the CPU time taken by each subprocess in the compilation
15231sequence.  For C source files, this is the compiler proper and assembler
15232(plus the linker if linking is done).
15233
15234Without the specification of an output file, the output looks like this:
15235
15236@smallexample
15237# cc1 0.12 0.01
15238# as 0.00 0.01
15239@end smallexample
15240
15241The first number on each line is the ``user time'', that is time spent
15242executing the program itself.  The second number is ``system time'',
15243time spent executing operating system routines on behalf of the program.
15244Both numbers are in seconds.
15245
15246With the specification of an output file, the output is appended to the
15247named file, and it looks like this:
15248
15249@smallexample
152500.12 0.01 cc1 @var{options}
152510.00 0.01 as @var{options}
15252@end smallexample
15253
15254The ``user time'' and the ``system time'' are moved before the program
15255name, and the options passed to the program are displayed, so that one
15256can later tell what file was being compiled, and with which options.
15257
15258@item -fdump-final-insns@r{[}=@var{file}@r{]}
15259@opindex fdump-final-insns
15260Dump the final internal representation (RTL) to @var{file}.  If the
15261optional argument is omitted (or if @var{file} is @code{.}), the name
15262of the dump file is determined by appending @code{.gkd} to the
15263compilation output file name.
15264
15265@item -fcompare-debug@r{[}=@var{opts}@r{]}
15266@opindex fcompare-debug
15267@opindex fno-compare-debug
15268If no error occurs during compilation, run the compiler a second time,
15269adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15270passed to the second compilation.  Dump the final internal
15271representation in both compilations, and print an error if they differ.
15272
15273If the equal sign is omitted, the default @option{-gtoggle} is used.
15274
15275The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15276and nonzero, implicitly enables @option{-fcompare-debug}.  If
15277@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15278then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15279is used.
15280
15281@option{-fcompare-debug=}, with the equal sign but without @var{opts},
15282is equivalent to @option{-fno-compare-debug}, which disables the dumping
15283of the final representation and the second compilation, preventing even
15284@env{GCC_COMPARE_DEBUG} from taking effect.
15285
15286To verify full coverage during @option{-fcompare-debug} testing, set
15287@env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15288which GCC rejects as an invalid option in any actual compilation
15289(rather than preprocessing, assembly or linking).  To get just a
15290warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15291not overridden} will do.
15292
15293@item -fcompare-debug-second
15294@opindex fcompare-debug-second
15295This option is implicitly passed to the compiler for the second
15296compilation requested by @option{-fcompare-debug}, along with options to
15297silence warnings, and omitting other options that would cause the compiler
15298to produce output to files or to standard output as a side effect.  Dump
15299files and preserved temporary files are renamed so as to contain the
15300@code{.gk} additional extension during the second compilation, to avoid
15301overwriting those generated by the first.
15302
15303When this option is passed to the compiler driver, it causes the
15304@emph{first} compilation to be skipped, which makes it useful for little
15305other than debugging the compiler proper.
15306
15307@item -gtoggle
15308@opindex gtoggle
15309Turn off generation of debug info, if leaving out this option
15310generates it, or turn it on at level 2 otherwise.  The position of this
15311argument in the command line does not matter; it takes effect after all
15312other options are processed, and it does so only once, no matter how
15313many times it is given.  This is mainly intended to be used with
15314@option{-fcompare-debug}.
15315
15316@item -fvar-tracking-assignments-toggle
15317@opindex fvar-tracking-assignments-toggle
15318@opindex fno-var-tracking-assignments-toggle
15319Toggle @option{-fvar-tracking-assignments}, in the same way that
15320@option{-gtoggle} toggles @option{-g}.
15321
15322@item -Q
15323@opindex Q
15324Makes the compiler print out each function name as it is compiled, and
15325print some statistics about each pass when it finishes.
15326
15327@item -ftime-report
15328@opindex ftime-report
15329Makes the compiler print some statistics about the time consumed by each
15330pass when it finishes.
15331
15332@item -ftime-report-details
15333@opindex ftime-report-details
15334Record the time consumed by infrastructure parts separately for each pass.
15335
15336@item -fira-verbose=@var{n}
15337@opindex fira-verbose
15338Control the verbosity of the dump file for the integrated register allocator.
15339The default value is 5.  If the value @var{n} is greater or equal to 10,
15340the dump output is sent to stderr using the same format as @var{n} minus 10.
15341
15342@item -flto-report
15343@opindex flto-report
15344Prints a report with internal details on the workings of the link-time
15345optimizer.  The contents of this report vary from version to version.
15346It is meant to be useful to GCC developers when processing object
15347files in LTO mode (via @option{-flto}).
15348
15349Disabled by default.
15350
15351@item -flto-report-wpa
15352@opindex flto-report-wpa
15353Like @option{-flto-report}, but only print for the WPA phase of Link
15354Time Optimization.
15355
15356@item -fmem-report
15357@opindex fmem-report
15358Makes the compiler print some statistics about permanent memory
15359allocation when it finishes.
15360
15361@item -fmem-report-wpa
15362@opindex fmem-report-wpa
15363Makes the compiler print some statistics about permanent memory
15364allocation for the WPA phase only.
15365
15366@item -fpre-ipa-mem-report
15367@opindex fpre-ipa-mem-report
15368@item -fpost-ipa-mem-report
15369@opindex fpost-ipa-mem-report
15370Makes the compiler print some statistics about permanent memory
15371allocation before or after interprocedural optimization.
15372
15373@item -fprofile-report
15374@opindex fprofile-report
15375Makes the compiler print some statistics about consistency of the
15376(estimated) profile and effect of individual passes.
15377
15378@item -fstack-usage
15379@opindex fstack-usage
15380Makes the compiler output stack usage information for the program, on a
15381per-function basis.  The filename for the dump is made by appending
15382@file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
15383the output file, if explicitly specified and it is not an executable,
15384otherwise it is the basename of the source file.  An entry is made up
15385of three fields:
15386
15387@itemize
15388@item
15389The name of the function.
15390@item
15391A number of bytes.
15392@item
15393One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15394@end itemize
15395
15396The qualifier @code{static} means that the function manipulates the stack
15397statically: a fixed number of bytes are allocated for the frame on function
15398entry and released on function exit; no stack adjustments are otherwise made
15399in the function.  The second field is this fixed number of bytes.
15400
15401The qualifier @code{dynamic} means that the function manipulates the stack
15402dynamically: in addition to the static allocation described above, stack
15403adjustments are made in the body of the function, for example to push/pop
15404arguments around function calls.  If the qualifier @code{bounded} is also
15405present, the amount of these adjustments is bounded at compile time and
15406the second field is an upper bound of the total amount of stack used by
15407the function.  If it is not present, the amount of these adjustments is
15408not bounded at compile time and the second field only represents the
15409bounded part.
15410
15411@item -fstats
15412@opindex fstats
15413Emit statistics about front-end processing at the end of the compilation.
15414This option is supported only by the C++ front end, and
15415the information is generally only useful to the G++ development team.
15416
15417@item -fdbg-cnt-list
15418@opindex fdbg-cnt-list
15419Print the name and the counter upper bound for all debug counters.
15420
15421
15422@item -fdbg-cnt=@var{counter-value-list}
15423@opindex fdbg-cnt
15424Set the internal debug counter lower and upper bound.  @var{counter-value-list}
15425is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15426tuples which sets the lower and the upper bound of each debug
15427counter @var{name}.  The @var{lower_bound} is optional and is zero
15428initialized if not set.
15429All debug counters have the initial upper bound of @code{UINT_MAX};
15430thus @code{dbg_cnt} returns true always unless the upper bound
15431is set by this option.
15432For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15433@code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15434For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15435
15436@item -print-file-name=@var{library}
15437@opindex print-file-name
15438Print the full absolute name of the library file @var{library} that
15439would be used when linking---and don't do anything else.  With this
15440option, GCC does not compile or link anything; it just prints the
15441file name.
15442
15443@item -print-multi-directory
15444@opindex print-multi-directory
15445Print the directory name corresponding to the multilib selected by any
15446other switches present in the command line.  This directory is supposed
15447to exist in @env{GCC_EXEC_PREFIX}.
15448
15449@item -print-multi-lib
15450@opindex print-multi-lib
15451Print the mapping from multilib directory names to compiler switches
15452that enable them.  The directory name is separated from the switches by
15453@samp{;}, and each switch starts with an @samp{@@} instead of the
15454@samp{-}, without spaces between multiple switches.  This is supposed to
15455ease shell processing.
15456
15457@item -print-multi-os-directory
15458@opindex print-multi-os-directory
15459Print the path to OS libraries for the selected
15460multilib, relative to some @file{lib} subdirectory.  If OS libraries are
15461present in the @file{lib} subdirectory and no multilibs are used, this is
15462usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15463sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15464@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15465subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15466
15467@item -print-multiarch
15468@opindex print-multiarch
15469Print the path to OS libraries for the selected multiarch,
15470relative to some @file{lib} subdirectory.
15471
15472@item -print-prog-name=@var{program}
15473@opindex print-prog-name
15474Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15475
15476@item -print-libgcc-file-name
15477@opindex print-libgcc-file-name
15478Same as @option{-print-file-name=libgcc.a}.
15479
15480This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15481but you do want to link with @file{libgcc.a}.  You can do:
15482
15483@smallexample
15484gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15485@end smallexample
15486
15487@item -print-search-dirs
15488@opindex print-search-dirs
15489Print the name of the configured installation directory and a list of
15490program and library directories @command{gcc} searches---and don't do anything else.
15491
15492This is useful when @command{gcc} prints the error message
15493@samp{installation problem, cannot exec cpp0: No such file or directory}.
15494To resolve this you either need to put @file{cpp0} and the other compiler
15495components where @command{gcc} expects to find them, or you can set the environment
15496variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15497Don't forget the trailing @samp{/}.
15498@xref{Environment Variables}.
15499
15500@item -print-sysroot
15501@opindex print-sysroot
15502Print the target sysroot directory that is used during
15503compilation.  This is the target sysroot specified either at configure
15504time or using the @option{--sysroot} option, possibly with an extra
15505suffix that depends on compilation options.  If no target sysroot is
15506specified, the option prints nothing.
15507
15508@item -print-sysroot-headers-suffix
15509@opindex print-sysroot-headers-suffix
15510Print the suffix added to the target sysroot when searching for
15511headers, or give an error if the compiler is not configured with such
15512a suffix---and don't do anything else.
15513
15514@item -dumpmachine
15515@opindex dumpmachine
15516Print the compiler's target machine (for example,
15517@samp{i686-pc-linux-gnu})---and don't do anything else.
15518
15519@item -dumpversion
15520@opindex dumpversion
15521Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15522anything else.  This is the compiler version used in filesystem paths and
15523specs. Depending on how the compiler has been configured it can be just
15524a single number (major version), two numbers separated by a dot (major and
15525minor version) or three numbers separated by dots (major, minor and patchlevel
15526version).
15527
15528@item -dumpfullversion
15529@opindex dumpfullversion
15530Print the full compiler version---and don't do anything else. The output is
15531always three numbers separated by dots, major, minor and patchlevel version.
15532
15533@item -dumpspecs
15534@opindex dumpspecs
15535Print the compiler's built-in specs---and don't do anything else.  (This
15536is used when GCC itself is being built.)  @xref{Spec Files}.
15537@end table
15538
15539@node Submodel Options
15540@section Machine-Dependent Options
15541@cindex submodel options
15542@cindex specifying hardware config
15543@cindex hardware models and configurations, specifying
15544@cindex target-dependent options
15545@cindex machine-dependent options
15546
15547Each target machine supported by GCC can have its own options---for
15548example, to allow you to compile for a particular processor variant or
15549ABI, or to control optimizations specific to that machine.  By
15550convention, the names of machine-specific options start with
15551@samp{-m}.
15552
15553Some configurations of the compiler also support additional target-specific
15554options, usually for compatibility with other compilers on the same
15555platform.
15556
15557@c This list is ordered alphanumerically by subsection name.
15558@c It should be the same order and spelling as these options are listed
15559@c in Machine Dependent Options
15560
15561@menu
15562* AArch64 Options::
15563* Adapteva Epiphany Options::
15564* AMD GCN Options::
15565* ARC Options::
15566* ARM Options::
15567* AVR Options::
15568* Blackfin Options::
15569* C6X Options::
15570* CRIS Options::
15571* CR16 Options::
15572* C-SKY Options::
15573* Darwin Options::
15574* DEC Alpha Options::
15575* FR30 Options::
15576* FT32 Options::
15577* FRV Options::
15578* GNU/Linux Options::
15579* H8/300 Options::
15580* HPPA Options::
15581* IA-64 Options::
15582* LM32 Options::
15583* M32C Options::
15584* M32R/D Options::
15585* M680x0 Options::
15586* MCore Options::
15587* MeP Options::
15588* MicroBlaze Options::
15589* MIPS Options::
15590* MMIX Options::
15591* MN10300 Options::
15592* Moxie Options::
15593* MSP430 Options::
15594* NDS32 Options::
15595* Nios II Options::
15596* Nvidia PTX Options::
15597* OpenRISC Options::
15598* PDP-11 Options::
15599* picoChip Options::
15600* PowerPC Options::
15601* RISC-V Options::
15602* RL78 Options::
15603* RS/6000 and PowerPC Options::
15604* RX Options::
15605* S/390 and zSeries Options::
15606* Score Options::
15607* SH Options::
15608* Solaris 2 Options::
15609* SPARC Options::
15610* SPU Options::
15611* System V Options::
15612* TILE-Gx Options::
15613* TILEPro Options::
15614* V850 Options::
15615* VAX Options::
15616* Visium Options::
15617* VMS Options::
15618* VxWorks Options::
15619* x86 Options::
15620* x86 Windows Options::
15621* Xstormy16 Options::
15622* Xtensa Options::
15623* zSeries Options::
15624@end menu
15625
15626@node AArch64 Options
15627@subsection AArch64 Options
15628@cindex AArch64 Options
15629
15630These options are defined for AArch64 implementations:
15631
15632@table @gcctabopt
15633
15634@item -mabi=@var{name}
15635@opindex mabi
15636Generate code for the specified data model.  Permissible values
15637are @samp{ilp32} for SysV-like data model where int, long int and pointers
15638are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15639but long int and pointers are 64 bits.
15640
15641The default depends on the specific target configuration.  Note that
15642the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15643entire program with the same ABI, and link with a compatible set of libraries.
15644
15645@item -mbig-endian
15646@opindex mbig-endian
15647Generate big-endian code.  This is the default when GCC is configured for an
15648@samp{aarch64_be-*-*} target.
15649
15650@item -mgeneral-regs-only
15651@opindex mgeneral-regs-only
15652Generate code which uses only the general-purpose registers.  This will prevent
15653the compiler from using floating-point and Advanced SIMD registers but will not
15654impose any restrictions on the assembler.
15655
15656@item -mlittle-endian
15657@opindex mlittle-endian
15658Generate little-endian code.  This is the default when GCC is configured for an
15659@samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15660
15661@item -mcmodel=tiny
15662@opindex mcmodel=tiny
15663Generate code for the tiny code model.  The program and its statically defined
15664symbols must be within 1MB of each other.  Programs can be statically or
15665dynamically linked.
15666
15667@item -mcmodel=small
15668@opindex mcmodel=small
15669Generate code for the small code model.  The program and its statically defined
15670symbols must be within 4GB of each other.  Programs can be statically or
15671dynamically linked.  This is the default code model.
15672
15673@item -mcmodel=large
15674@opindex mcmodel=large
15675Generate code for the large code model.  This makes no assumptions about
15676addresses and sizes of sections.  Programs can be statically linked only.
15677
15678@item -mstrict-align
15679@itemx -mno-strict-align
15680@opindex mstrict-align
15681@opindex mno-strict-align
15682Avoid or allow generating memory accesses that may not be aligned on a natural
15683object boundary as described in the architecture specification.
15684
15685@item -momit-leaf-frame-pointer
15686@itemx -mno-omit-leaf-frame-pointer
15687@opindex momit-leaf-frame-pointer
15688@opindex mno-omit-leaf-frame-pointer
15689Omit or keep the frame pointer in leaf functions.  The former behavior is the
15690default.
15691
15692@item -mstack-protector-guard=@var{guard}
15693@itemx -mstack-protector-guard-reg=@var{reg}
15694@itemx -mstack-protector-guard-offset=@var{offset}
15695@opindex mstack-protector-guard
15696@opindex mstack-protector-guard-reg
15697@opindex mstack-protector-guard-offset
15698Generate stack protection code using canary at @var{guard}.  Supported
15699locations are @samp{global} for a global canary or @samp{sysreg} for a
15700canary in an appropriate system register.
15701
15702With the latter choice the options
15703@option{-mstack-protector-guard-reg=@var{reg}} and
15704@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15705which system register to use as base register for reading the canary,
15706and from what offset from that base register. There is no default
15707register or offset as this is entirely for use within the Linux
15708kernel.
15709
15710@item -mstack-protector-guard=@var{guard}
15711@itemx -mstack-protector-guard-reg=@var{reg}
15712@itemx -mstack-protector-guard-offset=@var{offset}
15713@opindex mstack-protector-guard
15714@opindex mstack-protector-guard-reg
15715@opindex mstack-protector-guard-offset
15716Generate stack protection code using canary at @var{guard}.  Supported
15717locations are @samp{global} for a global canary or @samp{sysreg} for a
15718canary in an appropriate system register.
15719
15720With the latter choice the options
15721@option{-mstack-protector-guard-reg=@var{reg}} and
15722@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15723which system register to use as base register for reading the canary,
15724and from what offset from that base register. There is no default
15725register or offset as this is entirely for use within the Linux
15726kernel.
15727
15728@item -mtls-dialect=desc
15729@opindex mtls-dialect=desc
15730Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15731of TLS variables.  This is the default.
15732
15733@item -mtls-dialect=traditional
15734@opindex mtls-dialect=traditional
15735Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15736of TLS variables.
15737
15738@item -mtls-size=@var{size}
15739@opindex mtls-size
15740Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
15741This option requires binutils 2.26 or newer.
15742
15743@item -mfix-cortex-a53-835769
15744@itemx -mno-fix-cortex-a53-835769
15745@opindex mfix-cortex-a53-835769
15746@opindex mno-fix-cortex-a53-835769
15747Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15748This involves inserting a NOP instruction between memory instructions and
1574964-bit integer multiply-accumulate instructions.
15750
15751@item -mfix-cortex-a53-843419
15752@itemx -mno-fix-cortex-a53-843419
15753@opindex mfix-cortex-a53-843419
15754@opindex mno-fix-cortex-a53-843419
15755Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15756This erratum workaround is made at link time and this will only pass the
15757corresponding flag to the linker.
15758
15759@item -mlow-precision-recip-sqrt
15760@itemx -mno-low-precision-recip-sqrt
15761@opindex mlow-precision-recip-sqrt
15762@opindex mno-low-precision-recip-sqrt
15763Enable or disable the reciprocal square root approximation.
15764This option only has an effect if @option{-ffast-math} or
15765@option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
15766precision of reciprocal square root results to about 16 bits for
15767single precision and to 32 bits for double precision.
15768
15769@item -mlow-precision-sqrt
15770@itemx -mno-low-precision-sqrt
15771@opindex mlow-precision-sqrt
15772@opindex mno-low-precision-sqrt
15773Enable or disable the square root approximation.
15774This option only has an effect if @option{-ffast-math} or
15775@option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
15776precision of square root results to about 16 bits for
15777single precision and to 32 bits for double precision.
15778If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15779
15780@item -mlow-precision-div
15781@itemx -mno-low-precision-div
15782@opindex mlow-precision-div
15783@opindex mno-low-precision-div
15784Enable or disable the division approximation.
15785This option only has an effect if @option{-ffast-math} or
15786@option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
15787precision of division results to about 16 bits for
15788single precision and to 32 bits for double precision.
15789
15790@item -mtrack-speculation
15791@itemx -mno-track-speculation
15792Enable or disable generation of additional code to track speculative
15793execution through conditional branches.  The tracking state can then
15794be used by the compiler when expanding calls to
15795@code{__builtin_speculation_safe_copy} to permit a more efficient code
15796sequence to be generated.
15797
15798@item -moutline-atomics
15799@itemx -mno-outline-atomics
15800Enable or disable calls to out-of-line helpers to implement atomic operations.
15801These helpers will, at runtime, determine if the LSE instructions from
15802ARMv8.1-A can be used; if not, they will use the load/store-exclusive
15803instructions that are present in the base ARMv8.0 ISA.
15804
15805This option is only applicable when compiling for the base ARMv8.0
15806instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
15807or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
15808used directly.  The same applies when using @option{-mcpu=} when the
15809selected cpu supports the @samp{lse} feature.
15810
15811@item -march=@var{name}
15812@opindex march
15813Specify the name of the target architecture and, optionally, one or
15814more feature modifiers.  This option has the form
15815@option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15816
15817The permissible values for @var{arch} are @samp{armv8-a},
15818@samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15819@samp{armv8.5-a} or @var{native}.
15820
15821The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15822support for the ARMv8.5-A architecture extensions.
15823
15824The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15825support for the ARMv8.4-A architecture extensions.
15826
15827The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15828support for the ARMv8.3-A architecture extensions.
15829
15830The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15831support for the ARMv8.2-A architecture extensions.
15832
15833The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15834support for the ARMv8.1-A architecture extension.  In particular, it
15835enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15836
15837The value @samp{native} is available on native AArch64 GNU/Linux and
15838causes the compiler to pick the architecture of the host system.  This
15839option has no effect if the compiler is unable to recognize the
15840architecture of the host system,
15841
15842The permissible values for @var{feature} are listed in the sub-section
15843on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15844Feature Modifiers}.  Where conflicting feature modifiers are
15845specified, the right-most feature is used.
15846
15847GCC uses @var{name} to determine what kind of instructions it can emit
15848when generating assembly code.  If @option{-march} is specified
15849without either of @option{-mtune} or @option{-mcpu} also being
15850specified, the code is tuned to perform well across a range of target
15851processors implementing the target architecture.
15852
15853@item -mtune=@var{name}
15854@opindex mtune
15855Specify the name of the target processor for which GCC should tune the
15856performance of the code.  Permissible values for this option are:
15857@samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15858@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15859@samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15860@samp{neoverse-e1}, @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1},
15861@samp{neoverse-512tvb},
15862@samp{qdf24xx}, @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
15863@samp{octeontx}, @samp{octeontx81},  @samp{octeontx83},
15864@samp{a64fx},
15865@samp{thunderx}, @samp{thunderxt88},
15866@samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
15867@samp{thunderxt83}, @samp{thunderx2t99}, @samp{zeus},
15868@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15869@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15870@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15871@samp{native}.
15872
15873The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15874@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15875@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15876should tune for a big.LITTLE system.
15877
15878The value @samp{neoverse-512tvb} specifies that GCC should tune
15879for Neoverse cores that (a) implement SVE and (b) have a total vector
15880bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
15881tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
15882instructions a cycle and that can execute an equivalent number of SVE
15883arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
15884This is more general than tuning for a specific core like Neoverse V1
15885but is more specific than the default tuning described below.
15886
15887Additionally on native AArch64 GNU/Linux systems the value
15888@samp{native} tunes performance to the host system.  This option has no effect
15889if the compiler is unable to recognize the processor of the host system.
15890
15891Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15892are specified, the code is tuned to perform well across a range
15893of target processors.
15894
15895This option cannot be suffixed by feature modifiers.
15896
15897@item -mcpu=@var{name}
15898@opindex mcpu
15899Specify the name of the target processor, optionally suffixed by one
15900or more feature modifiers.  This option has the form
15901@option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15902the permissible values for @var{cpu} are the same as those available
15903for @option{-mtune}.  The permissible values for @var{feature} are
15904documented in the sub-section on
15905@ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15906Feature Modifiers}.  Where conflicting feature modifiers are
15907specified, the right-most feature is used.
15908
15909GCC uses @var{name} to determine what kind of instructions it can emit when
15910generating assembly code (as if by @option{-march}) and to determine
15911the target processor for which to tune for performance (as if
15912by @option{-mtune}).  Where this option is used in conjunction
15913with @option{-march} or @option{-mtune}, those options take precedence
15914over the appropriate part of this option.
15915
15916@option{-mcpu=neoverse-512tvb} is special in that it does not refer
15917to a specific core, but instead refers to all Neoverse cores that
15918(a) implement SVE and (b) have a total vector bandwidth of 512 bits
15919a cycle.  Unless overridden by @option{-march},
15920@option{-mcpu=neoverse-512tvb} generates code that can run on a
15921Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
15922these properties.  Unless overridden by @option{-mtune},
15923@option{-mcpu=neoverse-512tvb} tunes code in the same way as for
15924@option{-mtune=neoverse-512tvb}.
15925
15926@item -moverride=@var{string}
15927@opindex moverride
15928Override tuning decisions made by the back-end in response to a
15929@option{-mtune=} switch.  The syntax, semantics, and accepted values
15930for @var{string} in this option are not guaranteed to be consistent
15931across releases.
15932
15933This option is only intended to be useful when developing GCC.
15934
15935@item -mverbose-cost-dump
15936@opindex mverbose-cost-dump
15937Enable verbose cost model dumping in the debug dump files.  This option is
15938provided for use in debugging the compiler.
15939
15940@item -mpc-relative-literal-loads
15941@itemx -mno-pc-relative-literal-loads
15942@opindex mpc-relative-literal-loads
15943@opindex mno-pc-relative-literal-loads
15944Enable or disable PC-relative literal loads.  With this option literal pools are
15945accessed using a single instruction and emitted after each function.  This
15946limits the maximum size of functions to 1MB.  This is enabled by default for
15947@option{-mcmodel=tiny}.
15948
15949@item -msign-return-address=@var{scope}
15950@opindex msign-return-address
15951Select the function scope on which return address signing will be applied.
15952Permissible values are @samp{none}, which disables return address signing,
15953@samp{non-leaf}, which enables pointer signing for functions which are not leaf
15954functions, and @samp{all}, which enables pointer signing for all functions.  The
15955default value is @samp{none}. This option has been deprecated by
15956-mbranch-protection.
15957
15958@item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]|@var{bti}
15959@opindex mbranch-protection
15960Select the branch protection features to use.
15961@samp{none} is the default and turns off all types of branch protection.
15962@samp{standard} turns on all types of branch protection features.  If a feature
15963has additional tuning options, then @samp{standard} sets it to its standard
15964level.
15965@samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
15966level: signing functions that save the return address to memory (non-leaf
15967functions will practically always do this) using the a-key.  The optional
15968argument @samp{leaf} can be used to extend the signing to include leaf
15969functions.
15970@samp{bti} turns on branch target identification mechanism.
15971
15972@item -mharden-sls=@var{opts}
15973@opindex mharden-sls
15974Enable compiler hardening against straight line speculation (SLS).
15975@var{opts} is a comma-separated list of the following options:
15976@table @samp
15977@item retbr
15978@item blr
15979@end table
15980In addition, @samp{-mharden-sls=all} enables all SLS hardening while
15981@samp{-mharden-sls=none} disables all SLS hardening.
15982
15983@item -msve-vector-bits=@var{bits}
15984@opindex msve-vector-bits
15985Specify the number of bits in an SVE vector register.  This option only has
15986an effect when SVE is enabled.
15987
15988GCC supports two forms of SVE code generation: ``vector-length
15989agnostic'' output that works with any size of vector register and
15990``vector-length specific'' output that allows GCC to make assumptions
15991about the vector length when it is useful for optimization reasons.
15992The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
15993@samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
15994Specifying @samp{scalable} selects vector-length agnostic
15995output.  At present @samp{-msve-vector-bits=128} also generates vector-length
15996agnostic output.  All other values generate vector-length specific code.
15997The behavior of these values may change in future releases and no value except
15998@samp{scalable} should be relied on for producing code that is portable across
15999different hardware SVE vector lengths.
16000
16001The default is @samp{-msve-vector-bits=scalable}, which produces
16002vector-length agnostic code.
16003@end table
16004
16005@subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16006@anchor{aarch64-feature-modifiers}
16007@cindex @option{-march} feature modifiers
16008@cindex @option{-mcpu} feature modifiers
16009Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16010the following and their inverses @option{no@var{feature}}:
16011
16012@table @samp
16013@item crc
16014Enable CRC extension.  This is on by default for
16015@option{-march=armv8.1-a}.
16016@item crypto
16017Enable Crypto extension.  This also enables Advanced SIMD and floating-point
16018instructions.
16019@item fp
16020Enable floating-point instructions.  This is on by default for all possible
16021values for options @option{-march} and @option{-mcpu}.
16022@item simd
16023Enable Advanced SIMD instructions.  This also enables floating-point
16024instructions.  This is on by default for all possible values for options
16025@option{-march} and @option{-mcpu}.
16026@item sve
16027Enable Scalable Vector Extension instructions.  This also enables Advanced
16028SIMD and floating-point instructions.
16029@item lse
16030Enable Large System Extension instructions.  This is on by default for
16031@option{-march=armv8.1-a}.
16032@item rdma
16033Enable Round Double Multiply Accumulate instructions.  This is on by default
16034for @option{-march=armv8.1-a}.
16035@item fp16
16036Enable FP16 extension.  This also enables floating-point instructions.
16037@item fp16fml
16038Enable FP16 fmla extension.  This also enables FP16 extensions and
16039floating-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.
16040
16041@item rcpc
16042Enable the RcPc extension.  This does not change code generation from GCC,
16043but is passed on to the assembler, enabling inline asm statements to use
16044instructions from the RcPc extension.
16045@item dotprod
16046Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
16047@item aes
16048Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
16049SIMD instructions.
16050@item sha2
16051Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
16052@item sha3
16053Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
16054instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16055@item sm4
16056Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
16057Use of this option with architectures prior to Armv8.2-A is not supported.
16058@item profile
16059Enable the Statistical Profiling extension.  This option is only to enable the
16060extension at the assembler level and does not affect code generation.
16061@item rng
16062Enable the Armv8.5-a Random Number instructions.  This option is only to
16063enable the extension at the assembler level and does not affect code
16064generation.
16065@item memtag
16066Enable the Armv8.5-a Memory Tagging Extensions.  This option is only to
16067enable the extension at the assembler level and does not affect code
16068generation.
16069@item sb
16070Enable the Armv8-a Speculation Barrier instruction.  This option is only to
16071enable the extension at the assembler level and does not affect code
16072generation.  This option is enabled by default for @option{-march=armv8.5-a}.
16073@item ssbs
16074Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
16075is only to enable the extension at the assembler level and does not affect code
16076generation.  This option is enabled by default for @option{-march=armv8.5-a}.
16077@item predres
16078Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16079This option is only to enable the extension at the assembler level and does
16080not affect code generation.  This option is enabled by default for
16081@option{-march=armv8.5-a}.
16082
16083@end table
16084
16085Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16086which implies @option{fp}.
16087Conversely, @option{nofp} implies @option{nosimd}, which implies
16088@option{nocrypto}, @option{noaes} and @option{nosha2}.
16089
16090@node Adapteva Epiphany Options
16091@subsection Adapteva Epiphany Options
16092
16093These @samp{-m} options are defined for Adapteva Epiphany:
16094
16095@table @gcctabopt
16096@item -mhalf-reg-file
16097@opindex mhalf-reg-file
16098Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16099That allows code to run on hardware variants that lack these registers.
16100
16101@item -mprefer-short-insn-regs
16102@opindex mprefer-short-insn-regs
16103Preferentially allocate registers that allow short instruction generation.
16104This can result in increased instruction count, so this may either reduce or
16105increase overall code size.
16106
16107@item -mbranch-cost=@var{num}
16108@opindex mbranch-cost
16109Set the cost of branches to roughly @var{num} ``simple'' instructions.
16110This cost is only a heuristic and is not guaranteed to produce
16111consistent results across releases.
16112
16113@item -mcmove
16114@opindex mcmove
16115Enable the generation of conditional moves.
16116
16117@item -mnops=@var{num}
16118@opindex mnops
16119Emit @var{num} NOPs before every other generated instruction.
16120
16121@item -mno-soft-cmpsf
16122@opindex mno-soft-cmpsf
16123@opindex msoft-cmpsf
16124For single-precision floating-point comparisons, emit an @code{fsub} instruction
16125and test the flags.  This is faster than a software comparison, but can
16126get incorrect results in the presence of NaNs, or when two different small
16127numbers are compared such that their difference is calculated as zero.
16128The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16129software comparisons.
16130
16131@item -mstack-offset=@var{num}
16132@opindex mstack-offset
16133Set the offset between the top of the stack and the stack pointer.
16134E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16135can be used by leaf functions without stack allocation.
16136Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16137Note also that this option changes the ABI; compiling a program with a
16138different stack offset than the libraries have been compiled with
16139generally does not work.
16140This option can be useful if you want to evaluate if a different stack
16141offset would give you better code, but to actually use a different stack
16142offset to build working programs, it is recommended to configure the
16143toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16144
16145@item -mno-round-nearest
16146@opindex mno-round-nearest
16147@opindex mround-nearest
16148Make the scheduler assume that the rounding mode has been set to
16149truncating.  The default is @option{-mround-nearest}.
16150
16151@item -mlong-calls
16152@opindex mlong-calls
16153If not otherwise specified by an attribute, assume all calls might be beyond
16154the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16155function address into a register before performing a (otherwise direct) call.
16156This is the default.
16157
16158@item -mshort-calls
16159@opindex short-calls
16160If not otherwise specified by an attribute, assume all direct calls are
16161in the range of the @code{b} / @code{bl} instructions, so use these instructions
16162for direct calls.  The default is @option{-mlong-calls}.
16163
16164@item -msmall16
16165@opindex msmall16
16166Assume addresses can be loaded as 16-bit unsigned values.  This does not
16167apply to function addresses for which @option{-mlong-calls} semantics
16168are in effect.
16169
16170@item -mfp-mode=@var{mode}
16171@opindex mfp-mode
16172Set the prevailing mode of the floating-point unit.
16173This determines the floating-point mode that is provided and expected
16174at function call and return time.  Making this mode match the mode you
16175predominantly need at function start can make your programs smaller and
16176faster by avoiding unnecessary mode switches.
16177
16178@var{mode} can be set to one the following values:
16179
16180@table @samp
16181@item caller
16182Any mode at function entry is valid, and retained or restored when
16183the function returns, and when it calls other functions.
16184This mode is useful for compiling libraries or other compilation units
16185you might want to incorporate into different programs with different
16186prevailing FPU modes, and the convenience of being able to use a single
16187object file outweighs the size and speed overhead for any extra
16188mode switching that might be needed, compared with what would be needed
16189with a more specific choice of prevailing FPU mode.
16190
16191@item truncate
16192This is the mode used for floating-point calculations with
16193truncating (i.e.@: round towards zero) rounding mode.  That includes
16194conversion from floating point to integer.
16195
16196@item round-nearest
16197This is the mode used for floating-point calculations with
16198round-to-nearest-or-even rounding mode.
16199
16200@item int
16201This is the mode used to perform integer calculations in the FPU, e.g.@:
16202integer multiply, or integer multiply-and-accumulate.
16203@end table
16204
16205The default is @option{-mfp-mode=caller}
16206
16207@item -mno-split-lohi
16208@itemx -mno-postinc
16209@itemx -mno-postmodify
16210@opindex mno-split-lohi
16211@opindex msplit-lohi
16212@opindex mno-postinc
16213@opindex mpostinc
16214@opindex mno-postmodify
16215@opindex mpostmodify
16216Code generation tweaks that disable, respectively, splitting of 32-bit
16217loads, generation of post-increment addresses, and generation of
16218post-modify addresses.  The defaults are @option{msplit-lohi},
16219@option{-mpost-inc}, and @option{-mpost-modify}.
16220
16221@item -mnovect-double
16222@opindex mno-vect-double
16223@opindex mvect-double
16224Change the preferred SIMD mode to SImode.  The default is
16225@option{-mvect-double}, which uses DImode as preferred SIMD mode.
16226
16227@item -max-vect-align=@var{num}
16228@opindex max-vect-align
16229The maximum alignment for SIMD vector mode types.
16230@var{num} may be 4 or 8.  The default is 8.
16231Note that this is an ABI change, even though many library function
16232interfaces are unaffected if they don't use SIMD vector modes
16233in places that affect size and/or alignment of relevant types.
16234
16235@item -msplit-vecmove-early
16236@opindex msplit-vecmove-early
16237Split vector moves into single word moves before reload.  In theory this
16238can give better register allocation, but so far the reverse seems to be
16239generally the case.
16240
16241@item -m1reg-@var{reg}
16242@opindex m1reg-
16243Specify a register to hold the constant @minus{}1, which makes loading small negative
16244constants and certain bitmasks faster.
16245Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16246which specify use of that register as a fixed register,
16247and @samp{none}, which means that no register is used for this
16248purpose.  The default is @option{-m1reg-none}.
16249
16250@end table
16251
16252@node AMD GCN Options
16253@subsection AMD GCN Options
16254@cindex AMD GCN Options
16255
16256These options are defined specifically for the AMD GCN port.
16257
16258@table @gcctabopt
16259
16260@item -march=@var{gpu}
16261@opindex march
16262@itemx -mtune=@var{gpu}
16263@opindex mtune
16264Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16265are
16266
16267@table @samp
16268@opindex fiji
16269@item fiji
16270Compile for GCN3 Fiji devices (gfx803).
16271
16272@item gfx900
16273Compile for GCN5 Vega 10 devices (gfx900).
16274
16275@end table
16276
16277@item -mstack-size=@var{bytes}
16278@opindex mstack-size
16279Specify how many @var{bytes} of stack space will be requested for each GPU
16280thread (wave-front).  Beware that there may be many threads and limited memory
16281available.  The size of the stack allocation may also have an impact on
16282run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
162831MB otherwise.
16284
16285@end table
16286
16287@node ARC Options
16288@subsection ARC Options
16289@cindex ARC options
16290
16291The following options control the architecture variant for which code
16292is being compiled:
16293
16294@c architecture variants
16295@table @gcctabopt
16296
16297@item -mbarrel-shifter
16298@opindex mbarrel-shifter
16299Generate instructions supported by barrel shifter.  This is the default
16300unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16301
16302@item -mjli-always
16303@opindex mjli-alawys
16304Force to call a function using jli_s instruction.  This option is
16305valid only for ARCv2 architecture.
16306
16307@item -mcpu=@var{cpu}
16308@opindex mcpu
16309Set architecture type, register usage, and instruction scheduling
16310parameters for @var{cpu}.  There are also shortcut alias options
16311available for backward compatibility and convenience.  Supported
16312values for @var{cpu} are
16313
16314@table @samp
16315@opindex mA6
16316@opindex mARC600
16317@item arc600
16318Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
16319
16320@item arc601
16321@opindex mARC601
16322Compile for ARC601.  Alias: @option{-mARC601}.
16323
16324@item arc700
16325@opindex mA7
16326@opindex mARC700
16327Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
16328This is the default when configured with @option{--with-cpu=arc700}@.
16329
16330@item arcem
16331Compile for ARC EM.
16332
16333@item archs
16334Compile for ARC HS.
16335
16336@item em
16337Compile for ARC EM CPU with no hardware extensions.
16338
16339@item em4
16340Compile for ARC EM4 CPU.
16341
16342@item em4_dmips
16343Compile for ARC EM4 DMIPS CPU.
16344
16345@item em4_fpus
16346Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16347extension.
16348
16349@item em4_fpuda
16350Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16351double assist instructions.
16352
16353@item hs
16354Compile for ARC HS CPU with no hardware extensions except the atomic
16355instructions.
16356
16357@item hs34
16358Compile for ARC HS34 CPU.
16359
16360@item hs38
16361Compile for ARC HS38 CPU.
16362
16363@item hs38_linux
16364Compile for ARC HS38 CPU with all hardware extensions on.
16365
16366@item arc600_norm
16367Compile for ARC 600 CPU with @code{norm} instructions enabled.
16368
16369@item arc600_mul32x16
16370Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16371instructions enabled.
16372
16373@item arc600_mul64
16374Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16375instructions enabled.
16376
16377@item arc601_norm
16378Compile for ARC 601 CPU with @code{norm} instructions enabled.
16379
16380@item arc601_mul32x16
16381Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16382instructions enabled.
16383
16384@item arc601_mul64
16385Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16386instructions enabled.
16387
16388@item nps400
16389Compile for ARC 700 on NPS400 chip.
16390
16391@item em_mini
16392Compile for ARC EM minimalist configuration featuring reduced register
16393set.
16394
16395@end table
16396
16397@item -mdpfp
16398@opindex mdpfp
16399@itemx -mdpfp-compact
16400@opindex mdpfp-compact
16401Generate double-precision FPX instructions, tuned for the compact
16402implementation.
16403
16404@item -mdpfp-fast
16405@opindex mdpfp-fast
16406Generate double-precision FPX instructions, tuned for the fast
16407implementation.
16408
16409@item -mno-dpfp-lrsr
16410@opindex mno-dpfp-lrsr
16411Disable @code{lr} and @code{sr} instructions from using FPX extension
16412aux registers.
16413
16414@item -mea
16415@opindex mea
16416Generate extended arithmetic instructions.  Currently only
16417@code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16418supported.  This is always enabled for @option{-mcpu=ARC700}.
16419
16420@item -mno-mpy
16421@opindex mno-mpy
16422@opindex mmpy
16423Do not generate @code{mpy}-family instructions for ARC700.  This option is
16424deprecated.
16425
16426@item -mmul32x16
16427@opindex mmul32x16
16428Generate 32x16-bit multiply and multiply-accumulate instructions.
16429
16430@item -mmul64
16431@opindex mmul64
16432Generate @code{mul64} and @code{mulu64} instructions.
16433Only valid for @option{-mcpu=ARC600}.
16434
16435@item -mnorm
16436@opindex mnorm
16437Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
16438is in effect.
16439
16440@item -mspfp
16441@opindex mspfp
16442@itemx -mspfp-compact
16443@opindex mspfp-compact
16444Generate single-precision FPX instructions, tuned for the compact
16445implementation.
16446
16447@item -mspfp-fast
16448@opindex mspfp-fast
16449Generate single-precision FPX instructions, tuned for the fast
16450implementation.
16451
16452@item -msimd
16453@opindex msimd
16454Enable generation of ARC SIMD instructions via target-specific
16455builtins.  Only valid for @option{-mcpu=ARC700}.
16456
16457@item -msoft-float
16458@opindex msoft-float
16459This option ignored; it is provided for compatibility purposes only.
16460Software floating-point code is emitted by default, and this default
16461can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16462@option{-mspfp-fast} for single precision, and @option{-mdpfp},
16463@option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16464
16465@item -mswap
16466@opindex mswap
16467Generate @code{swap} instructions.
16468
16469@item -matomic
16470@opindex matomic
16471This enables use of the locked load/store conditional extension to implement
16472atomic memory built-in functions.  Not available for ARC 6xx or ARC
16473EM cores.
16474
16475@item -mdiv-rem
16476@opindex mdiv-rem
16477Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16478
16479@item -mcode-density
16480@opindex mcode-density
16481Enable code density instructions for ARC EM.
16482This option is on by default for ARC HS.
16483
16484@item -mll64
16485@opindex mll64
16486Enable double load/store operations for ARC HS cores.
16487
16488@item -mtp-regno=@var{regno}
16489@opindex mtp-regno
16490Specify thread pointer register number.
16491
16492@item -mmpy-option=@var{multo}
16493@opindex mmpy-option
16494Compile ARCv2 code with a multiplier design option.  You can specify
16495the option using either a string or numeric value for @var{multo}.
16496@samp{wlh1} is the default value.  The recognized values are:
16497
16498@table @samp
16499@item 0
16500@itemx none
16501No multiplier available.
16502
16503@item 1
16504@itemx w
1650516x16 multiplier, fully pipelined.
16506The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16507
16508@item 2
16509@itemx wlh1
1651032x32 multiplier, fully
16511pipelined (1 stage).  The following instructions are additionally
16512enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16513
16514@item 3
16515@itemx wlh2
1651632x32 multiplier, fully pipelined
16517(2 stages).  The following instructions are additionally enabled: @code{mpy},
16518@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16519
16520@item 4
16521@itemx wlh3
16522Two 16x16 multipliers, blocking,
16523sequential.  The following instructions are additionally enabled: @code{mpy},
16524@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16525
16526@item 5
16527@itemx wlh4
16528One 16x16 multiplier, blocking,
16529sequential.  The following instructions are additionally enabled: @code{mpy},
16530@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16531
16532@item 6
16533@itemx wlh5
16534One 32x4 multiplier, blocking,
16535sequential.  The following instructions are additionally enabled: @code{mpy},
16536@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16537
16538@item 7
16539@itemx plus_dmpy
16540ARC HS SIMD support.
16541
16542@item 8
16543@itemx plus_macd
16544ARC HS SIMD support.
16545
16546@item 9
16547@itemx plus_qmacw
16548ARC HS SIMD support.
16549
16550@end table
16551
16552This option is only available for ARCv2 cores@.
16553
16554@item -mfpu=@var{fpu}
16555@opindex mfpu
16556Enables support for specific floating-point hardware extensions for ARCv2
16557cores.  Supported values for @var{fpu} are:
16558
16559@table @samp
16560
16561@item fpus
16562Enables support for single-precision floating-point hardware
16563extensions@.
16564
16565@item fpud
16566Enables support for double-precision floating-point hardware
16567extensions.  The single-precision floating-point extension is also
16568enabled.  Not available for ARC EM@.
16569
16570@item fpuda
16571Enables support for double-precision floating-point hardware
16572extensions using double-precision assist instructions.  The single-precision
16573floating-point extension is also enabled.  This option is
16574only available for ARC EM@.
16575
16576@item fpuda_div
16577Enables support for double-precision floating-point hardware
16578extensions using double-precision assist instructions.
16579The single-precision floating-point, square-root, and divide
16580extensions are also enabled.  This option is
16581only available for ARC EM@.
16582
16583@item fpuda_fma
16584Enables support for double-precision floating-point hardware
16585extensions using double-precision assist instructions.
16586The single-precision floating-point and fused multiply and add
16587hardware extensions are also enabled.  This option is
16588only available for ARC EM@.
16589
16590@item fpuda_all
16591Enables support for double-precision floating-point hardware
16592extensions using double-precision assist instructions.
16593All single-precision floating-point hardware extensions are also
16594enabled.  This option is only available for ARC EM@.
16595
16596@item fpus_div
16597Enables support for single-precision floating-point, square-root and divide
16598hardware extensions@.
16599
16600@item fpud_div
16601Enables support for double-precision floating-point, square-root and divide
16602hardware extensions.  This option
16603includes option @samp{fpus_div}. Not available for ARC EM@.
16604
16605@item fpus_fma
16606Enables support for single-precision floating-point and
16607fused multiply and add hardware extensions@.
16608
16609@item fpud_fma
16610Enables support for double-precision floating-point and
16611fused multiply and add hardware extensions.  This option
16612includes option @samp{fpus_fma}.  Not available for ARC EM@.
16613
16614@item fpus_all
16615Enables support for all single-precision floating-point hardware
16616extensions@.
16617
16618@item fpud_all
16619Enables support for all single- and double-precision floating-point
16620hardware extensions.  Not available for ARC EM@.
16621
16622@end table
16623
16624@item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16625@opindex mirq-ctrl-saved
16626Specifies general-purposes registers that the processor automatically
16627saves/restores on interrupt entry and exit.  @var{register-range} is
16628specified as two registers separated by a dash.  The register range
16629always starts with @code{r0}, the upper limit is @code{fp} register.
16630@var{blink} and @var{lp_count} are optional.  This option is only
16631valid for ARC EM and ARC HS cores.
16632
16633@item -mrgf-banked-regs=@var{number}
16634@opindex mrgf-banked-regs
16635Specifies the number of registers replicated in second register bank
16636on entry to fast interrupt.  Fast interrupts are interrupts with the
16637highest priority level P0.  These interrupts save only PC and STATUS32
16638registers to avoid memory transactions during interrupt entry and exit
16639sequences.  Use this option when you are using fast interrupts in an
16640ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
16641
16642@item -mlpc-width=@var{width}
16643@opindex mlpc-width
16644Specify the width of the @code{lp_count} register.  Valid values for
16645@var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
16646fixed to 32 bits.  If the width is less than 32, the compiler does not
16647attempt to transform loops in your program to use the zero-delay loop
16648mechanism unless it is known that the @code{lp_count} register can
16649hold the required loop-counter value.  Depending on the width
16650specified, the compiler and run-time library might continue to use the
16651loop mechanism for various needs.  This option defines macro
16652@code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16653
16654@item -mrf16
16655@opindex mrf16
16656This option instructs the compiler to generate code for a 16-entry
16657register file.  This option defines the @code{__ARC_RF16__}
16658preprocessor macro.
16659
16660@item -mbranch-index
16661@opindex mbranch-index
16662Enable use of @code{bi} or @code{bih} instructions to implement jump
16663tables.
16664
16665@end table
16666
16667The following options are passed through to the assembler, and also
16668define preprocessor macro symbols.
16669
16670@c Flags used by the assembler, but for which we define preprocessor
16671@c macro symbols as well.
16672@table @gcctabopt
16673@item -mdsp-packa
16674@opindex mdsp-packa
16675Passed down to the assembler to enable the DSP Pack A extensions.
16676Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
16677deprecated.
16678
16679@item -mdvbf
16680@opindex mdvbf
16681Passed down to the assembler to enable the dual Viterbi butterfly
16682extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
16683option is deprecated.
16684
16685@c ARC700 4.10 extension instruction
16686@item -mlock
16687@opindex mlock
16688Passed down to the assembler to enable the locked load/store
16689conditional extension.  Also sets the preprocessor symbol
16690@code{__Xlock}.
16691
16692@item -mmac-d16
16693@opindex mmac-d16
16694Passed down to the assembler.  Also sets the preprocessor symbol
16695@code{__Xxmac_d16}.  This option is deprecated.
16696
16697@item -mmac-24
16698@opindex mmac-24
16699Passed down to the assembler.  Also sets the preprocessor symbol
16700@code{__Xxmac_24}.  This option is deprecated.
16701
16702@c ARC700 4.10 extension instruction
16703@item -mrtsc
16704@opindex mrtsc
16705Passed down to the assembler to enable the 64-bit time-stamp counter
16706extension instruction.  Also sets the preprocessor symbol
16707@code{__Xrtsc}.  This option is deprecated.
16708
16709@c ARC700 4.10 extension instruction
16710@item -mswape
16711@opindex mswape
16712Passed down to the assembler to enable the swap byte ordering
16713extension instruction.  Also sets the preprocessor symbol
16714@code{__Xswape}.
16715
16716@item -mtelephony
16717@opindex mtelephony
16718Passed down to the assembler to enable dual- and single-operand
16719instructions for telephony.  Also sets the preprocessor symbol
16720@code{__Xtelephony}.  This option is deprecated.
16721
16722@item -mxy
16723@opindex mxy
16724Passed down to the assembler to enable the XY memory extension.  Also
16725sets the preprocessor symbol @code{__Xxy}.
16726
16727@end table
16728
16729The following options control how the assembly code is annotated:
16730
16731@c Assembly annotation options
16732@table @gcctabopt
16733@item -misize
16734@opindex misize
16735Annotate assembler instructions with estimated addresses.
16736
16737@item -mannotate-align
16738@opindex mannotate-align
16739Explain what alignment considerations lead to the decision to make an
16740instruction short or long.
16741
16742@end table
16743
16744The following options are passed through to the linker:
16745
16746@c options passed through to the linker
16747@table @gcctabopt
16748@item -marclinux
16749@opindex marclinux
16750Passed through to the linker, to specify use of the @code{arclinux} emulation.
16751This option is enabled by default in tool chains built for
16752@w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16753when profiling is not requested.
16754
16755@item -marclinux_prof
16756@opindex marclinux_prof
16757Passed through to the linker, to specify use of the
16758@code{arclinux_prof} emulation.  This option is enabled by default in
16759tool chains built for @w{@code{arc-linux-uclibc}} and
16760@w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16761
16762@end table
16763
16764The following options control the semantics of generated code:
16765
16766@c semantically relevant code generation options
16767@table @gcctabopt
16768@item -mlong-calls
16769@opindex mlong-calls
16770Generate calls as register indirect calls, thus providing access
16771to the full 32-bit address range.
16772
16773@item -mmedium-calls
16774@opindex mmedium-calls
16775Don't use less than 25-bit addressing range for calls, which is the
16776offset available for an unconditional branch-and-link
16777instruction.  Conditional execution of function calls is suppressed, to
16778allow use of the 25-bit range, rather than the 21-bit range with
16779conditional branch-and-link.  This is the default for tool chains built
16780for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16781
16782@item -G @var{num}
16783@opindex G
16784Put definitions of externally-visible data in a small data section if
16785that data is no bigger than @var{num} bytes.  The default value of
16786@var{num} is 4 for any ARC configuration, or 8 when we have double
16787load/store operations.
16788
16789@item -mno-sdata
16790@opindex mno-sdata
16791@opindex msdata
16792Do not generate sdata references.  This is the default for tool chains
16793built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16794targets.
16795
16796@item -mvolatile-cache
16797@opindex mvolatile-cache
16798Use ordinarily cached memory accesses for volatile references.  This is the
16799default.
16800
16801@item -mno-volatile-cache
16802@opindex mno-volatile-cache
16803@opindex mvolatile-cache
16804Enable cache bypass for volatile references.
16805
16806@end table
16807
16808The following options fine tune code generation:
16809@c code generation tuning options
16810@table @gcctabopt
16811@item -malign-call
16812@opindex malign-call
16813Do alignment optimizations for call instructions.
16814
16815@item -mauto-modify-reg
16816@opindex mauto-modify-reg
16817Enable the use of pre/post modify with register displacement.
16818
16819@item -mbbit-peephole
16820@opindex mbbit-peephole
16821Enable bbit peephole2.
16822
16823@item -mno-brcc
16824@opindex mno-brcc
16825This option disables a target-specific pass in @file{arc_reorg} to
16826generate compare-and-branch (@code{br@var{cc}}) instructions.
16827It has no effect on
16828generation of these instructions driven by the combiner pass.
16829
16830@item -mcase-vector-pcrel
16831@opindex mcase-vector-pcrel
16832Use PC-relative switch case tables to enable case table shortening.
16833This is the default for @option{-Os}.
16834
16835@item -mcompact-casesi
16836@opindex mcompact-casesi
16837Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
16838and only available for ARCv1 cores.  This option is deprecated.
16839
16840@item -mno-cond-exec
16841@opindex mno-cond-exec
16842Disable the ARCompact-specific pass to generate conditional
16843execution instructions.
16844
16845Due to delay slot scheduling and interactions between operand numbers,
16846literal sizes, instruction lengths, and the support for conditional execution,
16847the target-independent pass to generate conditional execution is often lacking,
16848so the ARC port has kept a special pass around that tries to find more
16849conditional execution generation opportunities after register allocation,
16850branch shortening, and delay slot scheduling have been done.  This pass
16851generally, but not always, improves performance and code size, at the cost of
16852extra compilation time, which is why there is an option to switch it off.
16853If you have a problem with call instructions exceeding their allowable
16854offset range because they are conditionalized, you should consider using
16855@option{-mmedium-calls} instead.
16856
16857@item -mearly-cbranchsi
16858@opindex mearly-cbranchsi
16859Enable pre-reload use of the @code{cbranchsi} pattern.
16860
16861@item -mexpand-adddi
16862@opindex mexpand-adddi
16863Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16864@code{add.f}, @code{adc} etc.  This option is deprecated.
16865
16866@item -mindexed-loads
16867@opindex mindexed-loads
16868Enable the use of indexed loads.  This can be problematic because some
16869optimizers then assume that indexed stores exist, which is not
16870the case.
16871
16872@item -mlra
16873@opindex mlra
16874Enable Local Register Allocation.  This is still experimental for ARC,
16875so by default the compiler uses standard reload
16876(i.e.@: @option{-mno-lra}).
16877
16878@item -mlra-priority-none
16879@opindex mlra-priority-none
16880Don't indicate any priority for target registers.
16881
16882@item -mlra-priority-compact
16883@opindex mlra-priority-compact
16884Indicate target register priority for r0..r3 / r12..r15.
16885
16886@item -mlra-priority-noncompact
16887@opindex mlra-priority-noncompact
16888Reduce target register priority for r0..r3 / r12..r15.
16889
16890@item -mmillicode
16891@opindex mmillicode
16892When optimizing for size (using @option{-Os}), prologues and epilogues
16893that have to save or restore a large number of registers are often
16894shortened by using call to a special function in libgcc; this is
16895referred to as a @emph{millicode} call.  As these calls can pose
16896performance issues, and/or cause linking issues when linking in a
16897nonstandard way, this option is provided to turn on or off millicode
16898call generation.
16899
16900@item -mcode-density-frame
16901@opindex mcode-density-frame
16902This option enable the compiler to emit @code{enter} and @code{leave}
16903instructions.  These instructions are only valid for CPUs with
16904code-density feature.
16905
16906@item -mmixed-code
16907@opindex mmixed-code
16908Tweak register allocation to help 16-bit instruction generation.
16909This generally has the effect of decreasing the average instruction size
16910while increasing the instruction count.
16911
16912@item -mq-class
16913@opindex mq-class
16914Enable @samp{q} instruction alternatives.
16915This is the default for @option{-Os}.
16916
16917@item -mRcq
16918@opindex mRcq
16919Enable @samp{Rcq} constraint handling.
16920Most short code generation depends on this.
16921This is the default.
16922
16923@item -mRcw
16924@opindex mRcw
16925Enable @samp{Rcw} constraint handling.
16926Most ccfsm condexec mostly depends on this.
16927This is the default.
16928
16929@item -msize-level=@var{level}
16930@opindex msize-level
16931Fine-tune size optimization with regards to instruction lengths and alignment.
16932The recognized values for @var{level} are:
16933@table @samp
16934@item 0
16935No size optimization.  This level is deprecated and treated like @samp{1}.
16936
16937@item 1
16938Short instructions are used opportunistically.
16939
16940@item 2
16941In addition, alignment of loops and of code after barriers are dropped.
16942
16943@item 3
16944In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16945
16946@end table
16947
16948This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
16949the behavior when this is not set is equivalent to level @samp{1}.
16950
16951@item -mtune=@var{cpu}
16952@opindex mtune
16953Set instruction scheduling parameters for @var{cpu}, overriding any implied
16954by @option{-mcpu=}.
16955
16956Supported values for @var{cpu} are
16957
16958@table @samp
16959@item ARC600
16960Tune for ARC600 CPU.
16961
16962@item ARC601
16963Tune for ARC601 CPU.
16964
16965@item ARC700
16966Tune for ARC700 CPU with standard multiplier block.
16967
16968@item ARC700-xmac
16969Tune for ARC700 CPU with XMAC block.
16970
16971@item ARC725D
16972Tune for ARC725D CPU.
16973
16974@item ARC750D
16975Tune for ARC750D CPU.
16976
16977@end table
16978
16979@item -mmultcost=@var{num}
16980@opindex mmultcost
16981Cost to assume for a multiply instruction, with @samp{4} being equal to a
16982normal instruction.
16983
16984@item -munalign-prob-threshold=@var{probability}
16985@opindex munalign-prob-threshold
16986Set probability threshold for unaligning branches.
16987When tuning for @samp{ARC700} and optimizing for speed, branches without
16988filled delay slot are preferably emitted unaligned and long, unless
16989profiling indicates that the probability for the branch to be taken
16990is below @var{probability}.  @xref{Cross-profiling}.
16991The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
16992
16993@end table
16994
16995The following options are maintained for backward compatibility, but
16996are now deprecated and will be removed in a future release:
16997
16998@c Deprecated options
16999@table @gcctabopt
17000
17001@item -margonaut
17002@opindex margonaut
17003Obsolete FPX.
17004
17005@item -mbig-endian
17006@opindex mbig-endian
17007@itemx -EB
17008@opindex EB
17009Compile code for big-endian targets.  Use of these options is now
17010deprecated.  Big-endian code is supported by configuring GCC to build
17011@w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17012for which big endian is the default.
17013
17014@item -mlittle-endian
17015@opindex mlittle-endian
17016@itemx -EL
17017@opindex EL
17018Compile code for little-endian targets.  Use of these options is now
17019deprecated.  Little-endian code is supported by configuring GCC to build
17020@w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17021for which little endian is the default.
17022
17023@item -mbarrel_shifter
17024@opindex mbarrel_shifter
17025Replaced by @option{-mbarrel-shifter}.
17026
17027@item -mdpfp_compact
17028@opindex mdpfp_compact
17029Replaced by @option{-mdpfp-compact}.
17030
17031@item -mdpfp_fast
17032@opindex mdpfp_fast
17033Replaced by @option{-mdpfp-fast}.
17034
17035@item -mdsp_packa
17036@opindex mdsp_packa
17037Replaced by @option{-mdsp-packa}.
17038
17039@item -mEA
17040@opindex mEA
17041Replaced by @option{-mea}.
17042
17043@item -mmac_24
17044@opindex mmac_24
17045Replaced by @option{-mmac-24}.
17046
17047@item -mmac_d16
17048@opindex mmac_d16
17049Replaced by @option{-mmac-d16}.
17050
17051@item -mspfp_compact
17052@opindex mspfp_compact
17053Replaced by @option{-mspfp-compact}.
17054
17055@item -mspfp_fast
17056@opindex mspfp_fast
17057Replaced by @option{-mspfp-fast}.
17058
17059@item -mtune=@var{cpu}
17060@opindex mtune
17061Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17062@samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17063@samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17064
17065@item -multcost=@var{num}
17066@opindex multcost
17067Replaced by @option{-mmultcost}.
17068
17069@end table
17070
17071@node ARM Options
17072@subsection ARM Options
17073@cindex ARM options
17074
17075These @samp{-m} options are defined for the ARM port:
17076
17077@table @gcctabopt
17078@item -mabi=@var{name}
17079@opindex mabi
17080Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
17081@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17082
17083@item -mapcs-frame
17084@opindex mapcs-frame
17085Generate a stack frame that is compliant with the ARM Procedure Call
17086Standard for all functions, even if this is not strictly necessary for
17087correct execution of the code.  Specifying @option{-fomit-frame-pointer}
17088with this option causes the stack frames not to be generated for
17089leaf functions.  The default is @option{-mno-apcs-frame}.
17090This option is deprecated.
17091
17092@item -mapcs
17093@opindex mapcs
17094This is a synonym for @option{-mapcs-frame} and is deprecated.
17095
17096@ignore
17097@c not currently implemented
17098@item -mapcs-stack-check
17099@opindex mapcs-stack-check
17100Generate code to check the amount of stack space available upon entry to
17101every function (that actually uses some stack space).  If there is
17102insufficient space available then either the function
17103@code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17104called, depending upon the amount of stack space required.  The runtime
17105system is required to provide these functions.  The default is
17106@option{-mno-apcs-stack-check}, since this produces smaller code.
17107
17108@c not currently implemented
17109@item -mapcs-reentrant
17110@opindex mapcs-reentrant
17111Generate reentrant, position-independent code.  The default is
17112@option{-mno-apcs-reentrant}.
17113@end ignore
17114
17115@item -mthumb-interwork
17116@opindex mthumb-interwork
17117Generate code that supports calling between the ARM and Thumb
17118instruction sets.  Without this option, on pre-v5 architectures, the
17119two instruction sets cannot be reliably used inside one program.  The
17120default is @option{-mno-thumb-interwork}, since slightly larger code
17121is generated when @option{-mthumb-interwork} is specified.  In AAPCS
17122configurations this option is meaningless.
17123
17124@item -mno-sched-prolog
17125@opindex mno-sched-prolog
17126@opindex msched-prolog
17127Prevent the reordering of instructions in the function prologue, or the
17128merging of those instruction with the instructions in the function's
17129body.  This means that all functions start with a recognizable set
17130of instructions (or in fact one of a choice from a small set of
17131different function prologues), and this information can be used to
17132locate the start of functions inside an executable piece of code.  The
17133default is @option{-msched-prolog}.
17134
17135@item -mfloat-abi=@var{name}
17136@opindex mfloat-abi
17137Specifies which floating-point ABI to use.  Permissible values
17138are: @samp{soft}, @samp{softfp} and @samp{hard}.
17139
17140Specifying @samp{soft} causes GCC to generate output containing
17141library calls for floating-point operations.
17142@samp{softfp} allows the generation of code using hardware floating-point
17143instructions, but still uses the soft-float calling conventions.
17144@samp{hard} allows generation of floating-point instructions
17145and uses FPU-specific calling conventions.
17146
17147The default depends on the specific target configuration.  Note that
17148the hard-float and soft-float ABIs are not link-compatible; you must
17149compile your entire program with the same ABI, and link with a
17150compatible set of libraries.
17151
17152@item -mgeneral-regs-only
17153@opindex mgeneral-regs-only
17154Generate code which uses only the general-purpose registers.  This will prevent
17155the compiler from using floating-point and Advanced SIMD registers but will not
17156impose any restrictions on the assembler.
17157
17158@item -mlittle-endian
17159@opindex mlittle-endian
17160Generate code for a processor running in little-endian mode.  This is
17161the default for all standard configurations.
17162
17163@item -mbig-endian
17164@opindex mbig-endian
17165Generate code for a processor running in big-endian mode; the default is
17166to compile code for a little-endian processor.
17167
17168@item -mbe8
17169@itemx -mbe32
17170@opindex mbe8
17171When linking a big-endian image select between BE8 and BE32 formats.
17172The option has no effect for little-endian images and is ignored.  The
17173default is dependent on the selected target architecture.  For ARMv6
17174and later architectures the default is BE8, for older architectures
17175the default is BE32.  BE32 format has been deprecated by ARM.
17176
17177@item -march=@var{name}@r{[}+extension@dots{}@r{]}
17178@opindex march
17179This specifies the name of the target ARM architecture.  GCC uses this
17180name to determine what kind of instructions it can emit when generating
17181assembly code.  This option can be used in conjunction with or instead
17182of the @option{-mcpu=} option.
17183
17184Permissible names are:
17185@samp{armv4t},
17186@samp{armv5t}, @samp{armv5te},
17187@samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17188@samp{armv6z}, @samp{armv6zk},
17189@samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17190@samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17191@samp{armv8.4-a},
17192@samp{armv8.5-a},
17193@samp{armv7-r},
17194@samp{armv8-r},
17195@samp{armv6-m}, @samp{armv6s-m},
17196@samp{armv7-m}, @samp{armv7e-m},
17197@samp{armv8-m.base}, @samp{armv8-m.main},
17198@samp{iwmmxt} and @samp{iwmmxt2}.
17199
17200Additionally, the following architectures, which lack support for the
17201Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17202
17203Many of the architectures support extensions.  These can be added by
17204appending @samp{+@var{extension}} to the architecture name.  Extension
17205options are processed in order and capabilities accumulate.  An extension
17206will also enable any necessary base extensions
17207upon which it depends.  For example, the @samp{+crypto} extension
17208will always enable the @samp{+simd} extension.  The exception to the
17209additive construction is for extensions that are prefixed with
17210@samp{+no@dots{}}: these extensions disable the specified option and
17211any other extensions that may depend on the presence of that
17212extension.
17213
17214For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17215writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17216entirely disabled by the @samp{+nofp} option that follows it.
17217
17218Most extension names are generically named, but have an effect that is
17219dependent upon the architecture to which it is applied.  For example,
17220the @samp{+simd} option can be applied to both @samp{armv7-a} and
17221@samp{armv8-a} architectures, but will enable the original ARMv7-A
17222Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17223variant for @samp{armv8-a}.
17224
17225The table below lists the supported extensions for each architecture.
17226Architectures not mentioned do not support any extensions.
17227
17228@table @samp
17229@item armv5te
17230@itemx armv6
17231@itemx armv6j
17232@itemx armv6k
17233@itemx armv6kz
17234@itemx armv6t2
17235@itemx armv6z
17236@itemx armv6zk
17237@table @samp
17238@item +fp
17239The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
17240used as an alias for this extension.
17241
17242@item +nofp
17243Disable the floating-point instructions.
17244@end table
17245
17246@item armv7
17247The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17248@table @samp
17249@item +fp
17250The VFPv3 floating-point instructions, with 16 double-precision
17251registers.  The extension @samp{+vfpv3-d16} can be used as an alias
17252for this extension.  Note that floating-point is not supported by the
17253base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17254ARMv7-R architectures.
17255
17256@item +nofp
17257Disable the floating-point instructions.
17258@end table
17259
17260@item armv7-a
17261@table @samp
17262@item +mp
17263The multiprocessing extension.
17264
17265@item +sec
17266The security extension.
17267
17268@item +fp
17269The VFPv3 floating-point instructions, with 16 double-precision
17270registers.  The extension @samp{+vfpv3-d16} can be used as an alias
17271for this extension.
17272
17273@item +simd
17274The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17275The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17276for this extension.
17277
17278@item +vfpv3
17279The VFPv3 floating-point instructions, with 32 double-precision
17280registers.
17281
17282@item +vfpv3-d16-fp16
17283The VFPv3 floating-point instructions, with 16 double-precision
17284registers and the half-precision floating-point conversion operations.
17285
17286@item +vfpv3-fp16
17287The VFPv3 floating-point instructions, with 32 double-precision
17288registers and the half-precision floating-point conversion operations.
17289
17290@item +vfpv4-d16
17291The VFPv4 floating-point instructions, with 16 double-precision
17292registers.
17293
17294@item +vfpv4
17295The VFPv4 floating-point instructions, with 32 double-precision
17296registers.
17297
17298@item +neon-fp16
17299The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17300the half-precision floating-point conversion operations.
17301
17302@item +neon-vfpv4
17303The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17304
17305@item +nosimd
17306Disable the Advanced SIMD instructions (does not disable floating point).
17307
17308@item +nofp
17309Disable the floating-point and Advanced SIMD instructions.
17310@end table
17311
17312@item armv7ve
17313The extended version of the ARMv7-A architecture with support for
17314virtualization.
17315@table @samp
17316@item +fp
17317The VFPv4 floating-point instructions, with 16 double-precision registers.
17318The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17319
17320@item +simd
17321The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
17322extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17323
17324@item +vfpv3-d16
17325The VFPv3 floating-point instructions, with 16 double-precision
17326registers.
17327
17328@item +vfpv3
17329The VFPv3 floating-point instructions, with 32 double-precision
17330registers.
17331
17332@item +vfpv3-d16-fp16
17333The VFPv3 floating-point instructions, with 16 double-precision
17334registers and the half-precision floating-point conversion operations.
17335
17336@item +vfpv3-fp16
17337The VFPv3 floating-point instructions, with 32 double-precision
17338registers and the half-precision floating-point conversion operations.
17339
17340@item +vfpv4-d16
17341The VFPv4 floating-point instructions, with 16 double-precision
17342registers.
17343
17344@item +vfpv4
17345The VFPv4 floating-point instructions, with 32 double-precision
17346registers.
17347
17348@item +neon
17349The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17350The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17351
17352@item +neon-fp16
17353The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17354the half-precision floating-point conversion operations.
17355
17356@item +nosimd
17357Disable the Advanced SIMD instructions (does not disable floating point).
17358
17359@item +nofp
17360Disable the floating-point and Advanced SIMD instructions.
17361@end table
17362
17363@item armv8-a
17364@table @samp
17365@item +crc
17366The Cyclic Redundancy Check (CRC) instructions.
17367@item +simd
17368The ARMv8-A Advanced SIMD and floating-point instructions.
17369@item +crypto
17370The cryptographic instructions.
17371@item +nocrypto
17372Disable the cryptographic instructions.
17373@item +nofp
17374Disable the floating-point, Advanced SIMD and cryptographic instructions.
17375@item +sb
17376Speculation Barrier Instruction.
17377@item +predres
17378Execution and Data Prediction Restriction Instructions.
17379@end table
17380
17381@item armv8.1-a
17382@table @samp
17383@item +simd
17384The ARMv8.1-A Advanced SIMD and floating-point instructions.
17385
17386@item +crypto
17387The cryptographic instructions.  This also enables the Advanced SIMD and
17388floating-point instructions.
17389
17390@item +nocrypto
17391Disable the cryptographic instructions.
17392
17393@item +nofp
17394Disable the floating-point, Advanced SIMD and cryptographic instructions.
17395
17396@item +sb
17397Speculation Barrier Instruction.
17398
17399@item +predres
17400Execution and Data Prediction Restriction Instructions.
17401@end table
17402
17403@item armv8.2-a
17404@itemx armv8.3-a
17405@table @samp
17406@item +fp16
17407The half-precision floating-point data processing instructions.
17408This also enables the Advanced SIMD and floating-point instructions.
17409
17410@item +fp16fml
17411The half-precision floating-point fmla extension.  This also enables
17412the half-precision floating-point extension and Advanced SIMD and
17413floating-point instructions.
17414
17415@item +simd
17416The ARMv8.1-A Advanced SIMD and floating-point instructions.
17417
17418@item +crypto
17419The cryptographic instructions.  This also enables the Advanced SIMD and
17420floating-point instructions.
17421
17422@item +dotprod
17423Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
17424
17425@item +nocrypto
17426Disable the cryptographic extension.
17427
17428@item +nofp
17429Disable the floating-point, Advanced SIMD and cryptographic instructions.
17430
17431@item +sb
17432Speculation Barrier Instruction.
17433
17434@item +predres
17435Execution and Data Prediction Restriction Instructions.
17436@end table
17437
17438@item armv8.4-a
17439@table @samp
17440@item +fp16
17441The half-precision floating-point data processing instructions.
17442This also enables the Advanced SIMD and floating-point instructions as well
17443as the Dot Product extension and the half-precision floating-point fmla
17444extension.
17445
17446@item +simd
17447The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17448Dot Product extension.
17449
17450@item +crypto
17451The cryptographic instructions.  This also enables the Advanced SIMD and
17452floating-point instructions as well as the Dot Product extension.
17453
17454@item +nocrypto
17455Disable the cryptographic extension.
17456
17457@item +nofp
17458Disable the floating-point, Advanced SIMD and cryptographic instructions.
17459
17460@item +sb
17461Speculation Barrier Instruction.
17462
17463@item +predres
17464Execution and Data Prediction Restriction Instructions.
17465@end table
17466
17467@item armv8.5-a
17468@table @samp
17469@item +fp16
17470The half-precision floating-point data processing instructions.
17471This also enables the Advanced SIMD and floating-point instructions as well
17472as the Dot Product extension and the half-precision floating-point fmla
17473extension.
17474
17475@item +simd
17476The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17477Dot Product extension.
17478
17479@item +crypto
17480The cryptographic instructions.  This also enables the Advanced SIMD and
17481floating-point instructions as well as the Dot Product extension.
17482
17483@item +nocrypto
17484Disable the cryptographic extension.
17485
17486@item +nofp
17487Disable the floating-point, Advanced SIMD and cryptographic instructions.
17488@end table
17489
17490@item armv7-r
17491@table @samp
17492@item +fp.sp
17493The single-precision VFPv3 floating-point instructions.  The extension
17494@samp{+vfpv3xd} can be used as an alias for this extension.
17495
17496@item +fp
17497The VFPv3 floating-point instructions with 16 double-precision registers.
17498The extension +vfpv3-d16 can be used as an alias for this extension.
17499
17500@item +vfpv3xd-d16-fp16
17501The single-precision VFPv3 floating-point instructions with 16 double-precision
17502registers and the half-precision floating-point conversion operations.
17503
17504@item +vfpv3-d16-fp16
17505The VFPv3 floating-point instructions with 16 double-precision
17506registers and the half-precision floating-point conversion operations.
17507
17508@item +nofp
17509Disable the floating-point extension.
17510
17511@item +idiv
17512The ARM-state integer division instructions.
17513
17514@item +noidiv
17515Disable the ARM-state integer division extension.
17516@end table
17517
17518@item armv7e-m
17519@table @samp
17520@item +fp
17521The single-precision VFPv4 floating-point instructions.
17522
17523@item +fpv5
17524The single-precision FPv5 floating-point instructions.
17525
17526@item +fp.dp
17527The single- and double-precision FPv5 floating-point instructions.
17528
17529@item +nofp
17530Disable the floating-point extensions.
17531@end table
17532
17533@item  armv8-m.main
17534@table @samp
17535@item +dsp
17536The DSP instructions.
17537
17538@item +nodsp
17539Disable the DSP extension.
17540
17541@item +fp
17542The single-precision floating-point instructions.
17543
17544@item +fp.dp
17545The single- and double-precision floating-point instructions.
17546
17547@item +nofp
17548Disable the floating-point extension.
17549@end table
17550
17551@item armv8-r
17552@table @samp
17553@item +crc
17554The Cyclic Redundancy Check (CRC) instructions.
17555@item +fp.sp
17556The single-precision FPv5 floating-point instructions.
17557@item +simd
17558The ARMv8-A Advanced SIMD and floating-point instructions.
17559@item +crypto
17560The cryptographic instructions.
17561@item +nocrypto
17562Disable the cryptographic instructions.
17563@item +nofp
17564Disable the floating-point, Advanced SIMD and cryptographic instructions.
17565@end table
17566
17567@end table
17568
17569@option{-march=native} causes the compiler to auto-detect the architecture
17570of the build computer.  At present, this feature is only supported on
17571GNU/Linux, and not all architectures are recognized.  If the auto-detect
17572is unsuccessful the option has no effect.
17573
17574@item -mtune=@var{name}
17575@opindex mtune
17576This option specifies the name of the target ARM processor for
17577which GCC should tune the performance of the code.
17578For some ARM implementations better performance can be obtained by using
17579this option.
17580Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17581@samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17582@samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17583@samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17584@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17585@samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17586@samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17587@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17588@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17589@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17590@samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17591@samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17592@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17593@samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17594@samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17595@samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17596@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17597@samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17598@samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17599@samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
17600@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
17601@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17602
17603Additionally, this option can specify that GCC should tune the performance
17604of the code for a big.LITTLE system.  Permissible names are:
17605@samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17606@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17607@samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17608@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17609
17610@option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17611performance for a blend of processors within architecture @var{arch}.
17612The aim is to generate code that run well on the current most popular
17613processors, balancing between optimizations that benefit some CPUs in the
17614range, and avoiding performance pitfalls of other CPUs.  The effects of
17615this option may change in future GCC versions as CPU models come and go.
17616
17617@option{-mtune} permits the same extension options as @option{-mcpu}, but
17618the extension options do not affect the tuning of the generated code.
17619
17620@option{-mtune=native} causes the compiler to auto-detect the CPU
17621of the build computer.  At present, this feature is only supported on
17622GNU/Linux, and not all architectures are recognized.  If the auto-detect is
17623unsuccessful the option has no effect.
17624
17625@item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17626@opindex mcpu
17627This specifies the name of the target ARM processor.  GCC uses this name
17628to derive the name of the target ARM architecture (as if specified
17629by @option{-march}) and the ARM processor type for which to tune for
17630performance (as if specified by @option{-mtune}).  Where this option
17631is used in conjunction with @option{-march} or @option{-mtune},
17632those options take precedence over the appropriate part of this option.
17633
17634Many of the supported CPUs implement optional architectural
17635extensions.  Where this is so the architectural extensions are
17636normally enabled by default.  If implementations that lack the
17637extension exist, then the extension syntax can be used to disable
17638those extensions that have been omitted.  For floating-point and
17639Advanced SIMD (Neon) instructions, the settings of the options
17640@option{-mfloat-abi} and @option{-mfpu} must also be considered:
17641floating-point and Advanced SIMD instructions will only be used if
17642@option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17643@option{-mfpu} other than @samp{auto} will override the available
17644floating-point and SIMD extension instructions.
17645
17646For example, @samp{cortex-a9} can be found in three major
17647configurations: integer only, with just a floating-point unit or with
17648floating-point and Advanced SIMD.  The default is to enable all the
17649instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17650be used to disable just the SIMD or both the SIMD and floating-point
17651instructions respectively.
17652
17653Permissible names for this option are the same as those for
17654@option{-mtune}.
17655
17656The following extension options are common to the listed CPUs:
17657
17658@table @samp
17659@item +nodsp
17660Disable the DSP instructions on @samp{cortex-m33}.
17661
17662@item  +nofp
17663Disables the floating-point instructions on @samp{arm9e},
17664@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17665@samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17666@samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17667@samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17668Disables the floating-point and SIMD instructions on
17669@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17670@samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17671@samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17672@samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17673@samp{cortex-a53} and @samp{cortex-a55}.
17674
17675@item +nofp.dp
17676Disables the double-precision component of the floating-point instructions
17677on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17678@samp{cortex-m7}.
17679
17680@item +nosimd
17681Disables the SIMD (but not floating-point) instructions on
17682@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17683and @samp{cortex-a9}.
17684
17685@item +crypto
17686Enables the cryptographic instructions on @samp{cortex-a32},
17687@samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17688@samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17689@samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17690@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17691@samp{cortex-a75.cortex-a55}.
17692@end table
17693
17694Additionally the @samp{generic-armv7-a} pseudo target defaults to
17695VFPv3 with 16 double-precision registers.  It supports the following
17696extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17697@samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17698@samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17699@samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
17700the extensions to @option{-march=armv7-a}.
17701
17702@option{-mcpu=generic-@var{arch}} is also permissible, and is
17703equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17704See @option{-mtune} for more information.
17705
17706@option{-mcpu=native} causes the compiler to auto-detect the CPU
17707of the build computer.  At present, this feature is only supported on
17708GNU/Linux, and not all architectures are recognized.  If the auto-detect
17709is unsuccessful the option has no effect.
17710
17711@item -mfpu=@var{name}
17712@opindex mfpu
17713This specifies what floating-point hardware (or hardware emulation) is
17714available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
17715@samp{vfpv3},
17716@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17717@samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17718@samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17719@samp{fpv5-d16}, @samp{fpv5-sp-d16},
17720@samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17721Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17722is an alias for @samp{vfpv2}.
17723
17724The setting @samp{auto} is the default and is special.  It causes the
17725compiler to select the floating-point and Advanced SIMD instructions
17726based on the settings of @option{-mcpu} and @option{-march}.
17727
17728If the selected floating-point hardware includes the NEON extension
17729(e.g.@: @option{-mfpu=neon}), note that floating-point
17730operations are not generated by GCC's auto-vectorization pass unless
17731@option{-funsafe-math-optimizations} is also specified.  This is
17732because NEON hardware does not fully implement the IEEE 754 standard for
17733floating-point arithmetic (in particular denormal values are treated as
17734zero), so the use of NEON instructions may lead to a loss of precision.
17735
17736You 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}).
17737
17738@item -mfp16-format=@var{name}
17739@opindex mfp16-format
17740Specify the format of the @code{__fp16} half-precision floating-point type.
17741Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17742the default is @samp{none}, in which case the @code{__fp16} type is not
17743defined.  @xref{Half-Precision}, for more information.
17744
17745@item -mstructure-size-boundary=@var{n}
17746@opindex mstructure-size-boundary
17747The sizes of all structures and unions are rounded up to a multiple
17748of the number of bits set by this option.  Permissible values are 8, 32
17749and 64.  The default value varies for different toolchains.  For the COFF
17750targeted toolchain the default value is 8.  A value of 64 is only allowed
17751if the underlying ABI supports it.
17752
17753Specifying a larger number can produce faster, more efficient code, but
17754can also increase the size of the program.  Different values are potentially
17755incompatible.  Code compiled with one value cannot necessarily expect to
17756work with code or libraries compiled with another value, if they exchange
17757information using structures or unions.
17758
17759This option is deprecated.
17760
17761@item -mabort-on-noreturn
17762@opindex mabort-on-noreturn
17763Generate a call to the function @code{abort} at the end of a
17764@code{noreturn} function.  It is executed if the function tries to
17765return.
17766
17767@item -mlong-calls
17768@itemx -mno-long-calls
17769@opindex mlong-calls
17770@opindex mno-long-calls
17771Tells the compiler to perform function calls by first loading the
17772address of the function into a register and then performing a subroutine
17773call on this register.  This switch is needed if the target function
17774lies outside of the 64-megabyte addressing range of the offset-based
17775version of subroutine call instruction.
17776
17777Even if this switch is enabled, not all function calls are turned
17778into long calls.  The heuristic is that static functions, functions
17779that have the @code{short_call} attribute, functions that are inside
17780the scope of a @code{#pragma no_long_calls} directive, and functions whose
17781definitions have already been compiled within the current compilation
17782unit are not turned into long calls.  The exceptions to this rule are
17783that weak function definitions, functions with the @code{long_call}
17784attribute or the @code{section} attribute, and functions that are within
17785the scope of a @code{#pragma long_calls} directive are always
17786turned into long calls.
17787
17788This feature is not enabled by default.  Specifying
17789@option{-mno-long-calls} restores the default behavior, as does
17790placing the function calls within the scope of a @code{#pragma
17791long_calls_off} directive.  Note these switches have no effect on how
17792the compiler generates code to handle function calls via function
17793pointers.
17794
17795@item -msingle-pic-base
17796@opindex msingle-pic-base
17797Treat the register used for PIC addressing as read-only, rather than
17798loading it in the prologue for each function.  The runtime system is
17799responsible for initializing this register with an appropriate value
17800before execution begins.
17801
17802@item -mpic-register=@var{reg}
17803@opindex mpic-register
17804Specify the register to be used for PIC addressing.
17805For standard PIC base case, the default is any suitable register
17806determined by compiler.  For single PIC base case, the default is
17807@samp{R9} if target is EABI based or stack-checking is enabled,
17808otherwise the default is @samp{R10}.
17809
17810@item -mpic-data-is-text-relative
17811@opindex mpic-data-is-text-relative
17812Assume that the displacement between the text and data segments is fixed
17813at static link time.  This permits using PC-relative addressing
17814operations to access data known to be in the data segment.  For
17815non-VxWorks RTP targets, this option is enabled by default.  When
17816disabled on such targets, it will enable @option{-msingle-pic-base} by
17817default.
17818
17819@item -mpoke-function-name
17820@opindex mpoke-function-name
17821Write the name of each function into the text section, directly
17822preceding the function prologue.  The generated code is similar to this:
17823
17824@smallexample
17825     t0
17826         .ascii "arm_poke_function_name", 0
17827         .align
17828     t1
17829         .word 0xff000000 + (t1 - t0)
17830     arm_poke_function_name
17831         mov     ip, sp
17832         stmfd   sp!, @{fp, ip, lr, pc@}
17833         sub     fp, ip, #4
17834@end smallexample
17835
17836When performing a stack backtrace, code can inspect the value of
17837@code{pc} stored at @code{fp + 0}.  If the trace function then looks at
17838location @code{pc - 12} and the top 8 bits are set, then we know that
17839there is a function name embedded immediately preceding this location
17840and has length @code{((pc[-3]) & 0xff000000)}.
17841
17842@item -mthumb
17843@itemx -marm
17844@opindex marm
17845@opindex mthumb
17846
17847Select between generating code that executes in ARM and Thumb
17848states.  The default for most configurations is to generate code
17849that executes in ARM state, but the default can be changed by
17850configuring GCC with the @option{--with-mode=}@var{state}
17851configure option.
17852
17853You can also override the ARM and Thumb mode for each function
17854by using the @code{target("thumb")} and @code{target("arm")} function attributes
17855(@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17856
17857@item -mflip-thumb
17858@opindex mflip-thumb
17859Switch ARM/Thumb modes on alternating functions.
17860This option is provided for regression testing of mixed Thumb/ARM code
17861generation, and is not intended for ordinary use in compiling code.
17862
17863@item -mtpcs-frame
17864@opindex mtpcs-frame
17865Generate a stack frame that is compliant with the Thumb Procedure Call
17866Standard for all non-leaf functions.  (A leaf function is one that does
17867not call any other functions.)  The default is @option{-mno-tpcs-frame}.
17868
17869@item -mtpcs-leaf-frame
17870@opindex mtpcs-leaf-frame
17871Generate a stack frame that is compliant with the Thumb Procedure Call
17872Standard for all leaf functions.  (A leaf function is one that does
17873not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
17874
17875@item -mcallee-super-interworking
17876@opindex mcallee-super-interworking
17877Gives all externally visible functions in the file being compiled an ARM
17878instruction set header which switches to Thumb mode before executing the
17879rest of the function.  This allows these functions to be called from
17880non-interworking code.  This option is not valid in AAPCS configurations
17881because interworking is enabled by default.
17882
17883@item -mcaller-super-interworking
17884@opindex mcaller-super-interworking
17885Allows calls via function pointers (including virtual functions) to
17886execute correctly regardless of whether the target code has been
17887compiled for interworking or not.  There is a small overhead in the cost
17888of executing a function pointer if this option is enabled.  This option
17889is not valid in AAPCS configurations because interworking is enabled
17890by default.
17891
17892@item -mtp=@var{name}
17893@opindex mtp
17894Specify the access model for the thread local storage pointer.  The valid
17895models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17896@samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17897(supported in the arm6k architecture), and @samp{auto}, which uses the
17898best available method for the selected processor.  The default setting is
17899@samp{auto}.
17900
17901@item -mtls-dialect=@var{dialect}
17902@opindex mtls-dialect
17903Specify the dialect to use for accessing thread local storage.  Two
17904@var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
17905@samp{gnu} dialect selects the original GNU scheme for supporting
17906local and global dynamic TLS models.  The @samp{gnu2} dialect
17907selects the GNU descriptor scheme, which provides better performance
17908for shared libraries.  The GNU descriptor scheme is compatible with
17909the original scheme, but does require new assembler, linker and
17910library support.  Initial and local exec TLS models are unaffected by
17911this option and always use the original scheme.
17912
17913@item -mword-relocations
17914@opindex mword-relocations
17915Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17916This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17917loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17918is specified. This option conflicts with @option{-mslow-flash-data}.
17919
17920@item -mfix-cortex-m3-ldrd
17921@opindex mfix-cortex-m3-ldrd
17922Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17923with overlapping destination and base registers are used.  This option avoids
17924generating these instructions.  This option is enabled by default when
17925@option{-mcpu=cortex-m3} is specified.
17926
17927@item -munaligned-access
17928@itemx -mno-unaligned-access
17929@opindex munaligned-access
17930@opindex mno-unaligned-access
17931Enables (or disables) reading and writing of 16- and 32- bit values
17932from addresses that are not 16- or 32- bit aligned.  By default
17933unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17934ARMv8-M Baseline architectures, and enabled for all other
17935architectures.  If unaligned access is not enabled then words in packed
17936data structures are accessed a byte at a time.
17937
17938The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17939generated object file to either true or false, depending upon the
17940setting of this option.  If unaligned access is enabled then the
17941preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17942defined.
17943
17944@item -mneon-for-64bits
17945@opindex mneon-for-64bits
17946Enables using Neon to handle scalar 64-bits operations. This is
17947disabled by default since the cost of moving data from core registers
17948to Neon is high.
17949
17950@item -mslow-flash-data
17951@opindex mslow-flash-data
17952Assume loading data from flash is slower than fetching instruction.
17953Therefore literal load is minimized for better performance.
17954This option is only supported when compiling for ARMv7 M-profile and
17955off by default. It conflicts with @option{-mword-relocations}.
17956
17957@item -masm-syntax-unified
17958@opindex masm-syntax-unified
17959Assume inline assembler is using unified asm syntax.  The default is
17960currently off which implies divided syntax.  This option has no impact
17961on Thumb2. However, this may change in future releases of GCC.
17962Divided syntax should be considered deprecated.
17963
17964@item -mrestrict-it
17965@opindex mrestrict-it
17966Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17967IT blocks can only contain a single 16-bit instruction from a select
17968set of instructions. This option is on by default for ARMv8-A Thumb mode.
17969
17970@item -mprint-tune-info
17971@opindex mprint-tune-info
17972Print CPU tuning information as comment in assembler file.  This is
17973an option used only for regression testing of the compiler and not
17974intended for ordinary use in compiling code.  This option is disabled
17975by default.
17976
17977@item -mverbose-cost-dump
17978@opindex mverbose-cost-dump
17979Enable verbose cost model dumping in the debug dump files.  This option is
17980provided for use in debugging the compiler.
17981
17982@item -mpure-code
17983@opindex mpure-code
17984Do not allow constant data to be placed in code sections.
17985Additionally, when compiling for ELF object format give all text sections the
17986ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
17987is only available when generating non-pic code for M-profile targets.
17988
17989@item -mcmse
17990@opindex mcmse
17991Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
17992Development Tools Engineering Specification", which can be found on
17993@url{https://developer.arm.com/documentation/ecm0359818/latest/}.
17994@end table
17995
17996@node AVR Options
17997@subsection AVR Options
17998@cindex AVR Options
17999
18000These options are defined for AVR implementations:
18001
18002@table @gcctabopt
18003@item -mmcu=@var{mcu}
18004@opindex mmcu
18005Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18006
18007The default for this option is@tie{}@samp{avr2}.
18008
18009GCC supports the following AVR devices and ISAs:
18010
18011@include avr-mmcu.texi
18012
18013@item -mabsdata
18014@opindex mabsdata
18015
18016Assume that all data in static storage can be accessed by LDS / STS
18017instructions.  This option has only an effect on reduced Tiny devices like
18018ATtiny40.  See also the @code{absdata}
18019@ref{AVR Variable Attributes,variable attribute}.
18020
18021@item -maccumulate-args
18022@opindex maccumulate-args
18023Accumulate outgoing function arguments and acquire/release the needed
18024stack space for outgoing function arguments once in function
18025prologue/epilogue.  Without this option, outgoing arguments are pushed
18026before calling a function and popped afterwards.
18027
18028Popping the arguments after the function call can be expensive on
18029AVR so that accumulating the stack space might lead to smaller
18030executables because arguments need not be removed from the
18031stack after such a function call.
18032
18033This option can lead to reduced code size for functions that perform
18034several calls to functions that get their arguments on the stack like
18035calls to printf-like functions.
18036
18037@item -mbranch-cost=@var{cost}
18038@opindex mbranch-cost
18039Set the branch costs for conditional branch instructions to
18040@var{cost}.  Reasonable values for @var{cost} are small, non-negative
18041integers. The default branch cost is 0.
18042
18043@item -mcall-prologues
18044@opindex mcall-prologues
18045Functions prologues/epilogues are expanded as calls to appropriate
18046subroutines.  Code size is smaller.
18047
18048@item -mgas-isr-prologues
18049@opindex mgas-isr-prologues
18050Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18051instruction supported by GNU Binutils.
18052If this option is on, the feature can still be disabled for individual
18053ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18054function attribute.  This feature is activated per default
18055if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18056and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18057
18058@item -mint8
18059@opindex mint8
18060Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
18061@code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18062and @code{long long} is 4 bytes.  Please note that this option does not
18063conform to the C standards, but it results in smaller code
18064size.
18065
18066@item -mmain-is-OS_task
18067@opindex mmain-is-OS_task
18068Do not save registers in @code{main}.  The effect is the same like
18069attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18070to @code{main}. It is activated per default if optimization is on.
18071
18072@item -mn-flash=@var{num}
18073@opindex mn-flash
18074Assume that the flash memory has a size of
18075@var{num} times 64@tie{}KiB.
18076
18077@item -mno-interrupts
18078@opindex mno-interrupts
18079Generated code is not compatible with hardware interrupts.
18080Code size is smaller.
18081
18082@item -mrelax
18083@opindex mrelax
18084Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18085@code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18086Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18087the assembler's command line and the @option{--relax} option to the
18088linker's command line.
18089
18090Jump relaxing is performed by the linker because jump offsets are not
18091known before code is located. Therefore, the assembler code generated by the
18092compiler is the same, but the instructions in the executable may
18093differ from instructions in the assembler code.
18094
18095Relaxing must be turned on if linker stubs are needed, see the
18096section on @code{EIND} and linker stubs below.
18097
18098@item -mrmw
18099@opindex mrmw
18100Assume that the device supports the Read-Modify-Write
18101instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18102
18103@item -mshort-calls
18104@opindex mshort-calls
18105
18106Assume that @code{RJMP} and @code{RCALL} can target the whole
18107program memory.
18108
18109This option is used internally for multilib selection.  It is
18110not an optimization option, and you don't need to set it by hand.
18111
18112@item -msp8
18113@opindex msp8
18114Treat the stack pointer register as an 8-bit register,
18115i.e.@: assume the high byte of the stack pointer is zero.
18116In general, you don't need to set this option by hand.
18117
18118This option is used internally by the compiler to select and
18119build multilibs for architectures @code{avr2} and @code{avr25}.
18120These architectures mix devices with and without @code{SPH}.
18121For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18122the compiler driver adds or removes this option from the compiler
18123proper's command line, because the compiler then knows if the device
18124or architecture has an 8-bit stack pointer and thus no @code{SPH}
18125register or not.
18126
18127@item -mstrict-X
18128@opindex mstrict-X
18129Use address register @code{X} in a way proposed by the hardware.  This means
18130that @code{X} is only used in indirect, post-increment or
18131pre-decrement addressing.
18132
18133Without this option, the @code{X} register may be used in the same way
18134as @code{Y} or @code{Z} which then is emulated by additional
18135instructions.
18136For example, loading a value with @code{X+const} addressing with a
18137small non-negative @code{const < 64} to a register @var{Rn} is
18138performed as
18139
18140@example
18141adiw r26, const   ; X += const
18142ld   @var{Rn}, X        ; @var{Rn} = *X
18143sbiw r26, const   ; X -= const
18144@end example
18145
18146@item -mtiny-stack
18147@opindex mtiny-stack
18148Only change the lower 8@tie{}bits of the stack pointer.
18149
18150@item -mfract-convert-truncate
18151@opindex mfract-convert-truncate
18152Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18153
18154@item -nodevicelib
18155@opindex nodevicelib
18156Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18157
18158@item -nodevicespecs
18159@opindex nodevicespecs
18160Don't add @option{-specs=device-specs/specs-<mcu>} to the compiler driver's
18161command line.  The user takes responsibility for supplying the sub-processes
18162like compiler proper, assembler and linker with appropriate command line
18163options.
18164
18165@item -Waddr-space-convert
18166@opindex Waddr-space-convert
18167@opindex Wno-addr-space-convert
18168Warn about conversions between address spaces in the case where the
18169resulting address space is not contained in the incoming address space.
18170
18171@item -Wmisspelled-isr
18172@opindex Wmisspelled-isr
18173@opindex Wno-misspelled-isr
18174Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18175Enabled by default.
18176@end table
18177
18178@subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18179@cindex @code{EIND}
18180Pointers in the implementation are 16@tie{}bits wide.
18181The address of a function or label is represented as word address so
18182that indirect jumps and calls can target any code address in the
18183range of 64@tie{}Ki words.
18184
18185In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18186bytes of program memory space, there is a special function register called
18187@code{EIND} that serves as most significant part of the target address
18188when @code{EICALL} or @code{EIJMP} instructions are used.
18189
18190Indirect jumps and calls on these devices are handled as follows by
18191the compiler and are subject to some limitations:
18192
18193@itemize @bullet
18194
18195@item
18196The compiler never sets @code{EIND}.
18197
18198@item
18199The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18200instructions or might read @code{EIND} directly in order to emulate an
18201indirect call/jump by means of a @code{RET} instruction.
18202
18203@item
18204The compiler assumes that @code{EIND} never changes during the startup
18205code or during the application. In particular, @code{EIND} is not
18206saved/restored in function or interrupt service routine
18207prologue/epilogue.
18208
18209@item
18210For indirect calls to functions and computed goto, the linker
18211generates @emph{stubs}. Stubs are jump pads sometimes also called
18212@emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18213The stub contains a direct jump to the desired address.
18214
18215@item
18216Linker relaxation must be turned on so that the linker generates
18217the stubs correctly in all situations. See the compiler option
18218@option{-mrelax} and the linker option @option{--relax}.
18219There are corner cases where the linker is supposed to generate stubs
18220but aborts without relaxation and without a helpful error message.
18221
18222@item
18223The default linker script is arranged for code with @code{EIND = 0}.
18224If code is supposed to work for a setup with @code{EIND != 0}, a custom
18225linker script has to be used in order to place the sections whose
18226name start with @code{.trampolines} into the segment where @code{EIND}
18227points to.
18228
18229@item
18230The startup code from libgcc never sets @code{EIND}.
18231Notice that startup code is a blend of code from libgcc and AVR-LibC.
18232For the impact of AVR-LibC on @code{EIND}, see the
18233@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18234
18235@item
18236It is legitimate for user-specific startup code to set up @code{EIND}
18237early, for example by means of initialization code located in
18238section @code{.init3}. Such code runs prior to general startup code
18239that initializes RAM and calls constructors, but after the bit
18240of startup code from AVR-LibC that sets @code{EIND} to the segment
18241where the vector table is located.
18242@example
18243#include <avr/io.h>
18244
18245static void
18246__attribute__((section(".init3"),naked,used,no_instrument_function))
18247init3_set_eind (void)
18248@{
18249  __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18250                  "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18251@}
18252@end example
18253
18254@noindent
18255The @code{__trampolines_start} symbol is defined in the linker script.
18256
18257@item
18258Stubs are generated automatically by the linker if
18259the following two conditions are met:
18260@itemize @minus
18261
18262@item The address of a label is taken by means of the @code{gs} modifier
18263(short for @emph{generate stubs}) like so:
18264@example
18265LDI r24, lo8(gs(@var{func}))
18266LDI r25, hi8(gs(@var{func}))
18267@end example
18268@item The final location of that label is in a code segment
18269@emph{outside} the segment where the stubs are located.
18270@end itemize
18271
18272@item
18273The compiler emits such @code{gs} modifiers for code labels in the
18274following situations:
18275@itemize @minus
18276@item Taking address of a function or code label.
18277@item Computed goto.
18278@item If prologue-save function is used, see @option{-mcall-prologues}
18279command-line option.
18280@item Switch/case dispatch tables. If you do not want such dispatch
18281tables you can specify the @option{-fno-jump-tables} command-line option.
18282@item C and C++ constructors/destructors called during startup/shutdown.
18283@item If the tools hit a @code{gs()} modifier explained above.
18284@end itemize
18285
18286@item
18287Jumping to non-symbolic addresses like so is @emph{not} supported:
18288
18289@example
18290int main (void)
18291@{
18292    /* Call function at word address 0x2 */
18293    return ((int(*)(void)) 0x2)();
18294@}
18295@end example
18296
18297Instead, a stub has to be set up, i.e.@: the function has to be called
18298through a symbol (@code{func_4} in the example):
18299
18300@example
18301int main (void)
18302@{
18303    extern int func_4 (void);
18304
18305    /* Call function at byte address 0x4 */
18306    return func_4();
18307@}
18308@end example
18309
18310and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18311Alternatively, @code{func_4} can be defined in the linker script.
18312@end itemize
18313
18314@subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18315@cindex @code{RAMPD}
18316@cindex @code{RAMPX}
18317@cindex @code{RAMPY}
18318@cindex @code{RAMPZ}
18319Some AVR devices support memories larger than the 64@tie{}KiB range
18320that can be accessed with 16-bit pointers.  To access memory locations
18321outside this 64@tie{}KiB range, the content of a @code{RAMP}
18322register is used as high part of the address:
18323The @code{X}, @code{Y}, @code{Z} address register is concatenated
18324with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18325register, respectively, to get a wide address. Similarly,
18326@code{RAMPD} is used together with direct addressing.
18327
18328@itemize
18329@item
18330The startup code initializes the @code{RAMP} special function
18331registers with zero.
18332
18333@item
18334If a @ref{AVR Named Address Spaces,named address space} other than
18335generic or @code{__flash} is used, then @code{RAMPZ} is set
18336as needed before the operation.
18337
18338@item
18339If the device supports RAM larger than 64@tie{}KiB and the compiler
18340needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18341is reset to zero after the operation.
18342
18343@item
18344If the device comes with a specific @code{RAMP} register, the ISR
18345prologue/epilogue saves/restores that SFR and initializes it with
18346zero in case the ISR code might (implicitly) use it.
18347
18348@item
18349RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18350If you use inline assembler to read from locations outside the
1835116-bit address range and change one of the @code{RAMP} registers,
18352you must reset it to zero after the access.
18353
18354@end itemize
18355
18356@subsubsection AVR Built-in Macros
18357
18358GCC defines several built-in macros so that the user code can test
18359for the presence or absence of features.  Almost any of the following
18360built-in macros are deduced from device capabilities and thus
18361triggered by the @option{-mmcu=} command-line option.
18362
18363For even more AVR-specific built-in macros see
18364@ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18365
18366@table @code
18367
18368@item __AVR_ARCH__
18369Build-in macro that resolves to a decimal number that identifies the
18370architecture and depends on the @option{-mmcu=@var{mcu}} option.
18371Possible values are:
18372
18373@code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18374@code{4}, @code{5}, @code{51}, @code{6}
18375
18376for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18377@code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18378
18379respectively and
18380
18381@code{100},
18382@code{102}, @code{103}, @code{104},
18383@code{105}, @code{106}, @code{107}
18384
18385for @var{mcu}=@code{avrtiny},
18386@code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18387@code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18388If @var{mcu} specifies a device, this built-in macro is set
18389accordingly. For example, with @option{-mmcu=atmega8} the macro is
18390defined to @code{4}.
18391
18392@item __AVR_@var{Device}__
18393Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18394the device's name. For example, @option{-mmcu=atmega8} defines the
18395built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18396@code{__AVR_ATtiny261A__}, etc.
18397
18398The built-in macros' names follow
18399the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18400the device name as from the AVR user manual. The difference between
18401@var{Device} in the built-in macro and @var{device} in
18402@option{-mmcu=@var{device}} is that the latter is always lowercase.
18403
18404If @var{device} is not a device but only a core architecture like
18405@samp{avr51}, this macro is not defined.
18406
18407@item __AVR_DEVICE_NAME__
18408Setting @option{-mmcu=@var{device}} defines this built-in macro to
18409the device's name. For example, with @option{-mmcu=atmega8} the macro
18410is defined to @code{atmega8}.
18411
18412If @var{device} is not a device but only a core architecture like
18413@samp{avr51}, this macro is not defined.
18414
18415@item __AVR_XMEGA__
18416The device / architecture belongs to the XMEGA family of devices.
18417
18418@item __AVR_HAVE_ELPM__
18419The device has the @code{ELPM} instruction.
18420
18421@item __AVR_HAVE_ELPMX__
18422The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18423R@var{n},Z+} instructions.
18424
18425@item __AVR_HAVE_MOVW__
18426The device has the @code{MOVW} instruction to perform 16-bit
18427register-register moves.
18428
18429@item __AVR_HAVE_LPMX__
18430The device has the @code{LPM R@var{n},Z} and
18431@code{LPM R@var{n},Z+} instructions.
18432
18433@item __AVR_HAVE_MUL__
18434The device has a hardware multiplier.
18435
18436@item __AVR_HAVE_JMP_CALL__
18437The device has the @code{JMP} and @code{CALL} instructions.
18438This is the case for devices with more than 8@tie{}KiB of program
18439memory.
18440
18441@item __AVR_HAVE_EIJMP_EICALL__
18442@itemx __AVR_3_BYTE_PC__
18443The device has the @code{EIJMP} and @code{EICALL} instructions.
18444This is the case for devices with more than 128@tie{}KiB of program memory.
18445This also means that the program counter
18446(PC) is 3@tie{}bytes wide.
18447
18448@item __AVR_2_BYTE_PC__
18449The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18450with up to 128@tie{}KiB of program memory.
18451
18452@item __AVR_HAVE_8BIT_SP__
18453@itemx __AVR_HAVE_16BIT_SP__
18454The stack pointer (SP) register is treated as 8-bit respectively
1845516-bit register by the compiler.
18456The definition of these macros is affected by @option{-mtiny-stack}.
18457
18458@item __AVR_HAVE_SPH__
18459@itemx __AVR_SP8__
18460The device has the SPH (high part of stack pointer) special function
18461register or has an 8-bit stack pointer, respectively.
18462The definition of these macros is affected by @option{-mmcu=} and
18463in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18464by @option{-msp8}.
18465
18466@item __AVR_HAVE_RAMPD__
18467@itemx __AVR_HAVE_RAMPX__
18468@itemx __AVR_HAVE_RAMPY__
18469@itemx __AVR_HAVE_RAMPZ__
18470The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18471@code{RAMPZ} special function register, respectively.
18472
18473@item __NO_INTERRUPTS__
18474This macro reflects the @option{-mno-interrupts} command-line option.
18475
18476@item __AVR_ERRATA_SKIP__
18477@itemx __AVR_ERRATA_SKIP_JMP_CALL__
18478Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18479instructions because of a hardware erratum.  Skip instructions are
18480@code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18481The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18482set.
18483
18484@item __AVR_ISA_RMW__
18485The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18486
18487@item __AVR_SFR_OFFSET__=@var{offset}
18488Instructions that can address I/O special function registers directly
18489like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18490address as if addressed by an instruction to access RAM like @code{LD}
18491or @code{STS}. This offset depends on the device architecture and has
18492to be subtracted from the RAM address in order to get the
18493respective I/O@tie{}address.
18494
18495@item __AVR_SHORT_CALLS__
18496The @option{-mshort-calls} command line option is set.
18497
18498@item __AVR_PM_BASE_ADDRESS__=@var{addr}
18499Some devices support reading from flash memory by means of @code{LD*}
18500instructions.  The flash memory is seen in the data address space
18501at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
18502is not defined, this feature is not available.  If defined,
18503the address space is linear and there is no need to put
18504@code{.rodata} into RAM.  This is handled by the default linker
18505description file, and is currently available for
18506@code{avrtiny} and @code{avrxmega3}.  Even more convenient,
18507there is no need to use address spaces like @code{__flash} or
18508features like attribute @code{progmem} and @code{pgm_read_*}.
18509
18510@item __WITH_AVRLIBC__
18511The compiler is configured to be used together with AVR-Libc.
18512See the @option{--with-avrlibc} configure option.
18513
18514@end table
18515
18516@node Blackfin Options
18517@subsection Blackfin Options
18518@cindex Blackfin Options
18519
18520@table @gcctabopt
18521@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18522@opindex mcpu=
18523Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
18524can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18525@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18526@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18527@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18528@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18529@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18530@samp{bf561}, @samp{bf592}.
18531
18532The optional @var{sirevision} specifies the silicon revision of the target
18533Blackfin processor.  Any workarounds available for the targeted silicon revision
18534are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
18535If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18536are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
18537hexadecimal digits representing the major and minor numbers in the silicon
18538revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18539is not defined.  If @var{sirevision} is @samp{any}, the
18540@code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18541If this optional @var{sirevision} is not used, GCC assumes the latest known
18542silicon revision of the targeted Blackfin processor.
18543
18544GCC defines a preprocessor macro for the specified @var{cpu}.
18545For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18546provided by libgloss to be linked in if @option{-msim} is not given.
18547
18548Without this option, @samp{bf532} is used as the processor by default.
18549
18550Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
18551only the preprocessor macro is defined.
18552
18553@item -msim
18554@opindex msim
18555Specifies that the program will be run on the simulator.  This causes
18556the simulator BSP provided by libgloss to be linked in.  This option
18557has effect only for @samp{bfin-elf} toolchain.
18558Certain other options, such as @option{-mid-shared-library} and
18559@option{-mfdpic}, imply @option{-msim}.
18560
18561@item -momit-leaf-frame-pointer
18562@opindex momit-leaf-frame-pointer
18563Don't keep the frame pointer in a register for leaf functions.  This
18564avoids the instructions to save, set up and restore frame pointers and
18565makes an extra register available in leaf functions.
18566
18567@item -mspecld-anomaly
18568@opindex mspecld-anomaly
18569When enabled, the compiler ensures that the generated code does not
18570contain speculative loads after jump instructions. If this option is used,
18571@code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18572
18573@item -mno-specld-anomaly
18574@opindex mno-specld-anomaly
18575@opindex mspecld-anomaly
18576Don't generate extra code to prevent speculative loads from occurring.
18577
18578@item -mcsync-anomaly
18579@opindex mcsync-anomaly
18580When enabled, the compiler ensures that the generated code does not
18581contain CSYNC or SSYNC instructions too soon after conditional branches.
18582If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18583
18584@item -mno-csync-anomaly
18585@opindex mno-csync-anomaly
18586@opindex mcsync-anomaly
18587Don't generate extra code to prevent CSYNC or SSYNC instructions from
18588occurring too soon after a conditional branch.
18589
18590@item -mlow64k
18591@opindex mlow64k
18592When enabled, the compiler is free to take advantage of the knowledge that
18593the entire program fits into the low 64k of memory.
18594
18595@item -mno-low64k
18596@opindex mno-low64k
18597Assume that the program is arbitrarily large.  This is the default.
18598
18599@item -mstack-check-l1
18600@opindex mstack-check-l1
18601Do stack checking using information placed into L1 scratchpad memory by the
18602uClinux kernel.
18603
18604@item -mid-shared-library
18605@opindex mid-shared-library
18606Generate code that supports shared libraries via the library ID method.
18607This allows for execute in place and shared libraries in an environment
18608without virtual memory management.  This option implies @option{-fPIC}.
18609With a @samp{bfin-elf} target, this option implies @option{-msim}.
18610
18611@item -mno-id-shared-library
18612@opindex mno-id-shared-library
18613@opindex mid-shared-library
18614Generate code that doesn't assume ID-based shared libraries are being used.
18615This is the default.
18616
18617@item -mleaf-id-shared-library
18618@opindex mleaf-id-shared-library
18619Generate code that supports shared libraries via the library ID method,
18620but assumes that this library or executable won't link against any other
18621ID shared libraries.  That allows the compiler to use faster code for jumps
18622and calls.
18623
18624@item -mno-leaf-id-shared-library
18625@opindex mno-leaf-id-shared-library
18626@opindex mleaf-id-shared-library
18627Do not assume that the code being compiled won't link against any ID shared
18628libraries.  Slower code is generated for jump and call insns.
18629
18630@item -mshared-library-id=n
18631@opindex mshared-library-id
18632Specifies the identification number of the ID-based shared library being
18633compiled.  Specifying a value of 0 generates more compact code; specifying
18634other values forces the allocation of that number to the current
18635library but is no more space- or time-efficient than omitting this option.
18636
18637@item -msep-data
18638@opindex msep-data
18639Generate code that allows the data segment to be located in a different
18640area of memory from the text segment.  This allows for execute in place in
18641an environment without virtual memory management by eliminating relocations
18642against the text section.
18643
18644@item -mno-sep-data
18645@opindex mno-sep-data
18646@opindex msep-data
18647Generate code that assumes that the data segment follows the text segment.
18648This is the default.
18649
18650@item -mlong-calls
18651@itemx -mno-long-calls
18652@opindex mlong-calls
18653@opindex mno-long-calls
18654Tells the compiler to perform function calls by first loading the
18655address of the function into a register and then performing a subroutine
18656call on this register.  This switch is needed if the target function
18657lies outside of the 24-bit addressing range of the offset-based
18658version of subroutine call instruction.
18659
18660This feature is not enabled by default.  Specifying
18661@option{-mno-long-calls} restores the default behavior.  Note these
18662switches have no effect on how the compiler generates code to handle
18663function calls via function pointers.
18664
18665@item -mfast-fp
18666@opindex mfast-fp
18667Link with the fast floating-point library. This library relaxes some of
18668the IEEE floating-point standard's rules for checking inputs against
18669Not-a-Number (NAN), in the interest of performance.
18670
18671@item -minline-plt
18672@opindex minline-plt
18673Enable inlining of PLT entries in function calls to functions that are
18674not known to bind locally.  It has no effect without @option{-mfdpic}.
18675
18676@item -mmulticore
18677@opindex mmulticore
18678Build a standalone application for multicore Blackfin processors.
18679This option causes proper start files and link scripts supporting
18680multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18681It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18682
18683This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18684selects the one-application-per-core programming model.  Without
18685@option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18686programming model is used. In this model, the main function of Core B
18687should be named as @code{coreb_main}.
18688
18689If this option is not used, the single-core application programming
18690model is used.
18691
18692@item -mcorea
18693@opindex mcorea
18694Build a standalone application for Core A of BF561 when using
18695the one-application-per-core programming model. Proper start files
18696and link scripts are used to support Core A, and the macro
18697@code{__BFIN_COREA} is defined.
18698This option can only be used in conjunction with @option{-mmulticore}.
18699
18700@item -mcoreb
18701@opindex mcoreb
18702Build a standalone application for Core B of BF561 when using
18703the one-application-per-core programming model. Proper start files
18704and link scripts are used to support Core B, and the macro
18705@code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18706should be used instead of @code{main}.
18707This option can only be used in conjunction with @option{-mmulticore}.
18708
18709@item -msdram
18710@opindex msdram
18711Build a standalone application for SDRAM. Proper start files and
18712link scripts are used to put the application into SDRAM, and the macro
18713@code{__BFIN_SDRAM} is defined.
18714The loader should initialize SDRAM before loading the application.
18715
18716@item -micplb
18717@opindex micplb
18718Assume that ICPLBs are enabled at run time.  This has an effect on certain
18719anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
18720are enabled; for standalone applications the default is off.
18721@end table
18722
18723@node C6X Options
18724@subsection C6X Options
18725@cindex C6X Options
18726
18727@table @gcctabopt
18728@item -march=@var{name}
18729@opindex march
18730This specifies the name of the target architecture.  GCC uses this
18731name to determine what kind of instructions it can emit when generating
18732assembly code.  Permissible names are: @samp{c62x},
18733@samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18734
18735@item -mbig-endian
18736@opindex mbig-endian
18737Generate code for a big-endian target.
18738
18739@item -mlittle-endian
18740@opindex mlittle-endian
18741Generate code for a little-endian target.  This is the default.
18742
18743@item -msim
18744@opindex msim
18745Choose startup files and linker script suitable for the simulator.
18746
18747@item -msdata=default
18748@opindex msdata=default
18749Put small global and static data in the @code{.neardata} section,
18750which is pointed to by register @code{B14}.  Put small uninitialized
18751global and static data in the @code{.bss} section, which is adjacent
18752to the @code{.neardata} section.  Put small read-only data into the
18753@code{.rodata} section.  The corresponding sections used for large
18754pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18755
18756@item -msdata=all
18757@opindex msdata=all
18758Put all data, not just small objects, into the sections reserved for
18759small data, and use addressing relative to the @code{B14} register to
18760access them.
18761
18762@item -msdata=none
18763@opindex msdata=none
18764Make no use of the sections reserved for small data, and use absolute
18765addresses to access all data.  Put all initialized global and static
18766data in the @code{.fardata} section, and all uninitialized data in the
18767@code{.far} section.  Put all constant data into the @code{.const}
18768section.
18769@end table
18770
18771@node CRIS Options
18772@subsection CRIS Options
18773@cindex CRIS Options
18774
18775These options are defined specifically for the CRIS ports.
18776
18777@table @gcctabopt
18778@item -march=@var{architecture-type}
18779@itemx -mcpu=@var{architecture-type}
18780@opindex march
18781@opindex mcpu
18782Generate code for the specified architecture.  The choices for
18783@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18784respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18785Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18786@samp{v10}.
18787
18788@item -mtune=@var{architecture-type}
18789@opindex mtune
18790Tune to @var{architecture-type} everything applicable about the generated
18791code, except for the ABI and the set of available instructions.  The
18792choices for @var{architecture-type} are the same as for
18793@option{-march=@var{architecture-type}}.
18794
18795@item -mmax-stack-frame=@var{n}
18796@opindex mmax-stack-frame
18797Warn when the stack frame of a function exceeds @var{n} bytes.
18798
18799@item -metrax4
18800@itemx -metrax100
18801@opindex metrax4
18802@opindex metrax100
18803The options @option{-metrax4} and @option{-metrax100} are synonyms for
18804@option{-march=v3} and @option{-march=v8} respectively.
18805
18806@item -mmul-bug-workaround
18807@itemx -mno-mul-bug-workaround
18808@opindex mmul-bug-workaround
18809@opindex mno-mul-bug-workaround
18810Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18811models where it applies.  This option is active by default.
18812
18813@item -mpdebug
18814@opindex mpdebug
18815Enable CRIS-specific verbose debug-related information in the assembly
18816code.  This option also has the effect of turning off the @samp{#NO_APP}
18817formatted-code indicator to the assembler at the beginning of the
18818assembly file.
18819
18820@item -mcc-init
18821@opindex mcc-init
18822Do not use condition-code results from previous instruction; always emit
18823compare and test instructions before use of condition codes.
18824
18825@item -mno-side-effects
18826@opindex mno-side-effects
18827@opindex mside-effects
18828Do not emit instructions with side effects in addressing modes other than
18829post-increment.
18830
18831@item -mstack-align
18832@itemx -mno-stack-align
18833@itemx -mdata-align
18834@itemx -mno-data-align
18835@itemx -mconst-align
18836@itemx -mno-const-align
18837@opindex mstack-align
18838@opindex mno-stack-align
18839@opindex mdata-align
18840@opindex mno-data-align
18841@opindex mconst-align
18842@opindex mno-const-align
18843These options (@samp{no-} options) arrange (eliminate arrangements) for the
18844stack frame, individual data and constants to be aligned for the maximum
18845single data access size for the chosen CPU model.  The default is to
18846arrange for 32-bit alignment.  ABI details such as structure layout are
18847not affected by these options.
18848
18849@item -m32-bit
18850@itemx -m16-bit
18851@itemx -m8-bit
18852@opindex m32-bit
18853@opindex m16-bit
18854@opindex m8-bit
18855Similar to the stack- data- and const-align options above, these options
18856arrange for stack frame, writable data and constants to all be 32-bit,
1885716-bit or 8-bit aligned.  The default is 32-bit alignment.
18858
18859@item -mno-prologue-epilogue
18860@itemx -mprologue-epilogue
18861@opindex mno-prologue-epilogue
18862@opindex mprologue-epilogue
18863With @option{-mno-prologue-epilogue}, the normal function prologue and
18864epilogue which set up the stack frame are omitted and no return
18865instructions or return sequences are generated in the code.  Use this
18866option only together with visual inspection of the compiled code: no
18867warnings or errors are generated when call-saved registers must be saved,
18868or storage for local variables needs to be allocated.
18869
18870@item -mno-gotplt
18871@itemx -mgotplt
18872@opindex mno-gotplt
18873@opindex mgotplt
18874With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18875instruction sequences that load addresses for functions from the PLT part
18876of the GOT rather than (traditional on other architectures) calls to the
18877PLT@.  The default is @option{-mgotplt}.
18878
18879@item -melf
18880@opindex melf
18881Legacy no-op option only recognized with the cris-axis-elf and
18882cris-axis-linux-gnu targets.
18883
18884@item -mlinux
18885@opindex mlinux
18886Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18887
18888@item -sim
18889@opindex sim
18890This option, recognized for the cris-axis-elf, arranges
18891to link with input-output functions from a simulator library.  Code,
18892initialized data and zero-initialized data are allocated consecutively.
18893
18894@item -sim2
18895@opindex sim2
18896Like @option{-sim}, but pass linker options to locate initialized data at
188970x40000000 and zero-initialized data at 0x80000000.
18898@end table
18899
18900@node CR16 Options
18901@subsection CR16 Options
18902@cindex CR16 Options
18903
18904These options are defined specifically for the CR16 ports.
18905
18906@table @gcctabopt
18907
18908@item -mmac
18909@opindex mmac
18910Enable the use of multiply-accumulate instructions. Disabled by default.
18911
18912@item -mcr16cplus
18913@itemx -mcr16c
18914@opindex mcr16cplus
18915@opindex mcr16c
18916Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18917is default.
18918
18919@item -msim
18920@opindex msim
18921Links the library libsim.a which is in compatible with simulator. Applicable
18922to ELF compiler only.
18923
18924@item -mint32
18925@opindex mint32
18926Choose integer type as 32-bit wide.
18927
18928@item -mbit-ops
18929@opindex mbit-ops
18930Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18931
18932@item -mdata-model=@var{model}
18933@opindex mdata-model
18934Choose a data model. The choices for @var{model} are @samp{near},
18935@samp{far} or @samp{medium}. @samp{medium} is default.
18936However, @samp{far} is not valid with @option{-mcr16c}, as the
18937CR16C architecture does not support the far data model.
18938@end table
18939
18940@node C-SKY Options
18941@subsection C-SKY Options
18942@cindex C-SKY Options
18943
18944GCC supports these options when compiling for C-SKY V2 processors.
18945
18946@table @gcctabopt
18947
18948@item -march=@var{arch}
18949@opindex march=
18950Specify the C-SKY target architecture.  Valid values for @var{arch} are:
18951@samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18952The default is @samp{ck810}.
18953
18954@item -mcpu=@var{cpu}
18955@opindex mcpu=
18956Specify the C-SKY target processor.  Valid values for @var{cpu} are:
18957@samp{ck801}, @samp{ck801t},
18958@samp{ck802}, @samp{ck802t}, @samp{ck802j},
18959@samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18960@samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18961@samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18962@samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18963@samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18964@samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18965@samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18966@samp{ck803eftr1}, @samp{ck803efhtr1},
18967@samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18968@samp{ck803sef}, @samp{ck803seft},
18969@samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18970@samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18971@samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18972@samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18973
18974@item -mbig-endian
18975@opindex mbig-endian
18976@itemx -EB
18977@opindex EB
18978@itemx -mlittle-endian
18979@opindex mlittle-endian
18980@itemx -EL
18981@opindex EL
18982
18983Select big- or little-endian code.  The default is little-endian.
18984
18985@item -mhard-float
18986@opindex mhard-float
18987@itemx -msoft-float
18988@opindex msoft-float
18989
18990Select hardware or software floating-point implementations.
18991The default is soft float.
18992
18993@item -mdouble-float
18994@itemx -mno-double-float
18995@opindex mdouble-float
18996When @option{-mhard-float} is in effect, enable generation of
18997double-precision float instructions.  This is the default except
18998when compiling for CK803.
18999
19000@item -mfdivdu
19001@itemx -mno-fdivdu
19002@opindex mfdivdu
19003When @option{-mhard-float} is in effect, enable generation of
19004@code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
19005This is the default except when compiling for CK803.
19006
19007@item -mfpu=@var{fpu}
19008@opindex mfpu=
19009Select the floating-point processor.  This option can only be used with
19010@option{-mhard-float}.
19011Values for @var{fpu} are
19012@samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19013@samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19014@samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19015
19016@item -melrw
19017@itemx -mno-elrw
19018@opindex melrw
19019Enable the extended @code{lrw} instruction.  This option defaults to on
19020for CK801 and off otherwise.
19021
19022@item -mistack
19023@itemx -mno-istack
19024@opindex mistack
19025Enable interrupt stack instructions; the default is off.
19026
19027The @option{-mistack} option is required to handle the
19028@code{interrupt} and @code{isr} function attributes
19029(@pxref{C-SKY Function Attributes}).
19030
19031@item -mmp
19032@opindex mmp
19033Enable multiprocessor instructions; the default is off.
19034
19035@item -mcp
19036@opindex mcp
19037Enable coprocessor instructions; the default is off.
19038
19039@item -mcache
19040@opindex mcache
19041Enable coprocessor instructions; the default is off.
19042
19043@item -msecurity
19044@opindex msecurity
19045Enable C-SKY security instructions; the default is off.
19046
19047@item -mtrust
19048@opindex mtrust
19049Enable C-SKY trust instructions; the default is off.
19050
19051@item -mdsp
19052@opindex mdsp
19053@itemx -medsp
19054@opindex medsp
19055@itemx -mvdsp
19056@opindex mvdsp
19057Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19058All of these options default to off.
19059
19060@item -mdiv
19061@itemx -mno-div
19062@opindex mdiv
19063Generate divide instructions.  Default is off.
19064
19065@item -msmart
19066@itemx -mno-smart
19067@opindex msmart
19068Generate code for Smart Mode, using only registers numbered 0-7 to allow
19069use of 16-bit instructions.  This option is ignored for CK801 where this
19070is the required behavior, and it defaults to on for CK802.
19071For other targets, the default is off.
19072
19073@item -mhigh-registers
19074@itemx -mno-high-registers
19075@opindex mhigh-registers
19076Generate code using the high registers numbered 16-31.  This option
19077is not supported on CK801, CK802, or CK803, and is enabled by default
19078for other processors.
19079
19080@item -manchor
19081@itemx -mno-anchor
19082@opindex manchor
19083Generate code using global anchor symbol addresses.
19084
19085@item -mpushpop
19086@itemx -mno-pushpop
19087@opindex mpushpop
19088Generate code using @code{push} and @code{pop} instructions.  This option
19089defaults to on.
19090
19091@item -mmultiple-stld
19092@itemx -mstm
19093@itemx -mno-multiple-stld
19094@itemx -mno-stm
19095@opindex mmultiple-stld
19096Generate code using @code{stm} and @code{ldm} instructions.  This option
19097isn't supported on CK801 but is enabled by default on other processors.
19098
19099@item -mconstpool
19100@itemx -mno-constpool
19101@opindex mconstpool
19102Create constant pools in the compiler instead of deferring it to the
19103assembler.  This option is the default and required for correct code
19104generation on CK801 and CK802, and is optional on other processors.
19105
19106@item -mstack-size
19107@item -mno-stack-size
19108@opindex mstack-size
19109Emit @code{.stack_size} directives for each function in the assembly
19110output.  This option defaults to off.
19111
19112@item -mccrt
19113@itemx -mno-ccrt
19114@opindex mccrt
19115Generate code for the C-SKY compiler runtime instead of libgcc.  This
19116option defaults to off.
19117
19118@item -mbranch-cost=@var{n}
19119@opindex mbranch-cost=
19120Set the branch costs to roughly @code{n} instructions.  The default is 1.
19121
19122@item -msched-prolog
19123@itemx -mno-sched-prolog
19124@opindex msched-prolog
19125Permit scheduling of function prologue and epilogue sequences.  Using
19126this option can result in code that is not compliant with the C-SKY V2 ABI
19127prologue requirements and that cannot be debugged or backtraced.
19128It is disabled by default.
19129
19130@end table
19131
19132@node Darwin Options
19133@subsection Darwin Options
19134@cindex Darwin options
19135
19136These options are defined for all architectures running the Darwin operating
19137system.
19138
19139FSF GCC on Darwin does not create ``fat'' object files; it creates
19140an object file for the single architecture that GCC was built to
19141target.  Apple's GCC on Darwin does create ``fat'' files if multiple
19142@option{-arch} options are used; it does so by running the compiler or
19143linker multiple times and joining the results together with
19144@file{lipo}.
19145
19146The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19147@samp{i686}) is determined by the flags that specify the ISA
19148that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
19149@option{-force_cpusubtype_ALL} option can be used to override this.
19150
19151The Darwin tools vary in their behavior when presented with an ISA
19152mismatch.  The assembler, @file{as}, only permits instructions to
19153be used that are valid for the subtype of the file it is generating,
19154so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19155The linker for shared libraries, @file{/usr/bin/libtool}, fails
19156and prints an error if asked to create a shared library with a less
19157restrictive subtype than its input files (for instance, trying to put
19158a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
19159for executables, @command{ld}, quietly gives the executable the most
19160restrictive subtype of any of its input files.
19161
19162@table @gcctabopt
19163@item -F@var{dir}
19164@opindex F
19165Add the framework directory @var{dir} to the head of the list of
19166directories to be searched for header files.  These directories are
19167interleaved with those specified by @option{-I} options and are
19168scanned in a left-to-right order.
19169
19170A framework directory is a directory with frameworks in it.  A
19171framework is a directory with a @file{Headers} and/or
19172@file{PrivateHeaders} directory contained directly in it that ends
19173in @file{.framework}.  The name of a framework is the name of this
19174directory excluding the @file{.framework}.  Headers associated with
19175the framework are found in one of those two directories, with
19176@file{Headers} being searched first.  A subframework is a framework
19177directory that is in a framework's @file{Frameworks} directory.
19178Includes of subframework headers can only appear in a header of a
19179framework that contains the subframework, or in a sibling subframework
19180header.  Two subframeworks are siblings if they occur in the same
19181framework.  A subframework should not have the same name as a
19182framework; a warning is issued if this is violated.  Currently a
19183subframework cannot have subframeworks; in the future, the mechanism
19184may be extended to support this.  The standard frameworks can be found
19185in @file{/System/Library/Frameworks} and
19186@file{/Library/Frameworks}.  An example include looks like
19187@code{#include <Framework/header.h>}, where @file{Framework} denotes
19188the name of the framework and @file{header.h} is found in the
19189@file{PrivateHeaders} or @file{Headers} directory.
19190
19191@item -iframework@var{dir}
19192@opindex iframework
19193Like @option{-F} except the directory is a treated as a system
19194directory.  The main difference between this @option{-iframework} and
19195@option{-F} is that with @option{-iframework} the compiler does not
19196warn about constructs contained within header files found via
19197@var{dir}.  This option is valid only for the C family of languages.
19198
19199@item -gused
19200@opindex gused
19201Emit debugging information for symbols that are used.  For stabs
19202debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19203This is by default ON@.
19204
19205@item -gfull
19206@opindex gfull
19207Emit debugging information for all symbols and types.
19208
19209@item -mmacosx-version-min=@var{version}
19210The earliest version of MacOS X that this executable will run on
19211is @var{version}.  Typical values of @var{version} include @code{10.1},
19212@code{10.2}, and @code{10.3.9}.
19213
19214If the compiler was built to use the system's headers by default,
19215then the default for this option is the system version on which the
19216compiler is running, otherwise the default is to make choices that
19217are compatible with as many systems and code bases as possible.
19218
19219@item -mkernel
19220@opindex mkernel
19221Enable kernel development mode.  The @option{-mkernel} option sets
19222@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19223@option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19224@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19225applicable.  This mode also sets @option{-mno-altivec},
19226@option{-msoft-float}, @option{-fno-builtin} and
19227@option{-mlong-branch} for PowerPC targets.
19228
19229@item -mone-byte-bool
19230@opindex mone-byte-bool
19231Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19232By default @code{sizeof(bool)} is @code{4} when compiling for
19233Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19234option has no effect on x86.
19235
19236@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19237to generate code that is not binary compatible with code generated
19238without that switch.  Using this switch may require recompiling all
19239other modules in a program, including system libraries.  Use this
19240switch to conform to a non-default data model.
19241
19242@item -mfix-and-continue
19243@itemx -ffix-and-continue
19244@itemx -findirect-data
19245@opindex mfix-and-continue
19246@opindex ffix-and-continue
19247@opindex findirect-data
19248Generate code suitable for fast turnaround development, such as to
19249allow GDB to dynamically load @file{.o} files into already-running
19250programs.  @option{-findirect-data} and @option{-ffix-and-continue}
19251are provided for backwards compatibility.
19252
19253@item -all_load
19254@opindex all_load
19255Loads all members of static archive libraries.
19256See man ld(1) for more information.
19257
19258@item -arch_errors_fatal
19259@opindex arch_errors_fatal
19260Cause the errors having to do with files that have the wrong architecture
19261to be fatal.
19262
19263@item -bind_at_load
19264@opindex bind_at_load
19265Causes the output file to be marked such that the dynamic linker will
19266bind all undefined references when the file is loaded or launched.
19267
19268@item -bundle
19269@opindex bundle
19270Produce a Mach-o bundle format file.
19271See man ld(1) for more information.
19272
19273@item -bundle_loader @var{executable}
19274@opindex bundle_loader
19275This option specifies the @var{executable} that will load the build
19276output file being linked.  See man ld(1) for more information.
19277
19278@item -dynamiclib
19279@opindex dynamiclib
19280When passed this option, GCC produces a dynamic library instead of
19281an executable when linking, using the Darwin @file{libtool} command.
19282
19283@item -force_cpusubtype_ALL
19284@opindex force_cpusubtype_ALL
19285This causes GCC's output file to have the @samp{ALL} subtype, instead of
19286one controlled by the @option{-mcpu} or @option{-march} option.
19287
19288@item -allowable_client  @var{client_name}
19289@itemx -client_name
19290@itemx -compatibility_version
19291@itemx -current_version
19292@itemx -dead_strip
19293@itemx -dependency-file
19294@itemx -dylib_file
19295@itemx -dylinker_install_name
19296@itemx -dynamic
19297@itemx -exported_symbols_list
19298@itemx -filelist
19299@need 800
19300@itemx -flat_namespace
19301@itemx -force_flat_namespace
19302@itemx -headerpad_max_install_names
19303@itemx -image_base
19304@itemx -init
19305@itemx -install_name
19306@itemx -keep_private_externs
19307@itemx -multi_module
19308@itemx -multiply_defined
19309@itemx -multiply_defined_unused
19310@need 800
19311@itemx -noall_load
19312@itemx -no_dead_strip_inits_and_terms
19313@itemx -nofixprebinding
19314@itemx -nomultidefs
19315@itemx -noprebind
19316@itemx -noseglinkedit
19317@itemx -pagezero_size
19318@itemx -prebind
19319@itemx -prebind_all_twolevel_modules
19320@itemx -private_bundle
19321@need 800
19322@itemx -read_only_relocs
19323@itemx -sectalign
19324@itemx -sectobjectsymbols
19325@itemx -whyload
19326@itemx -seg1addr
19327@itemx -sectcreate
19328@itemx -sectobjectsymbols
19329@itemx -sectorder
19330@itemx -segaddr
19331@itemx -segs_read_only_addr
19332@need 800
19333@itemx -segs_read_write_addr
19334@itemx -seg_addr_table
19335@itemx -seg_addr_table_filename
19336@itemx -seglinkedit
19337@itemx -segprot
19338@itemx -segs_read_only_addr
19339@itemx -segs_read_write_addr
19340@itemx -single_module
19341@itemx -static
19342@itemx -sub_library
19343@need 800
19344@itemx -sub_umbrella
19345@itemx -twolevel_namespace
19346@itemx -umbrella
19347@itemx -undefined
19348@itemx -unexported_symbols_list
19349@itemx -weak_reference_mismatches
19350@itemx -whatsloaded
19351@opindex allowable_client
19352@opindex client_name
19353@opindex compatibility_version
19354@opindex current_version
19355@opindex dead_strip
19356@opindex dependency-file
19357@opindex dylib_file
19358@opindex dylinker_install_name
19359@opindex dynamic
19360@opindex exported_symbols_list
19361@opindex filelist
19362@opindex flat_namespace
19363@opindex force_flat_namespace
19364@opindex headerpad_max_install_names
19365@opindex image_base
19366@opindex init
19367@opindex install_name
19368@opindex keep_private_externs
19369@opindex multi_module
19370@opindex multiply_defined
19371@opindex multiply_defined_unused
19372@opindex noall_load
19373@opindex no_dead_strip_inits_and_terms
19374@opindex nofixprebinding
19375@opindex nomultidefs
19376@opindex noprebind
19377@opindex noseglinkedit
19378@opindex pagezero_size
19379@opindex prebind
19380@opindex prebind_all_twolevel_modules
19381@opindex private_bundle
19382@opindex read_only_relocs
19383@opindex sectalign
19384@opindex sectobjectsymbols
19385@opindex whyload
19386@opindex seg1addr
19387@opindex sectcreate
19388@opindex sectobjectsymbols
19389@opindex sectorder
19390@opindex segaddr
19391@opindex segs_read_only_addr
19392@opindex segs_read_write_addr
19393@opindex seg_addr_table
19394@opindex seg_addr_table_filename
19395@opindex seglinkedit
19396@opindex segprot
19397@opindex segs_read_only_addr
19398@opindex segs_read_write_addr
19399@opindex single_module
19400@opindex static
19401@opindex sub_library
19402@opindex sub_umbrella
19403@opindex twolevel_namespace
19404@opindex umbrella
19405@opindex undefined
19406@opindex unexported_symbols_list
19407@opindex weak_reference_mismatches
19408@opindex whatsloaded
19409These options are passed to the Darwin linker.  The Darwin linker man page
19410describes them in detail.
19411@end table
19412
19413@node DEC Alpha Options
19414@subsection DEC Alpha Options
19415
19416These @samp{-m} options are defined for the DEC Alpha implementations:
19417
19418@table @gcctabopt
19419@item -mno-soft-float
19420@itemx -msoft-float
19421@opindex mno-soft-float
19422@opindex msoft-float
19423Use (do not use) the hardware floating-point instructions for
19424floating-point operations.  When @option{-msoft-float} is specified,
19425functions in @file{libgcc.a} are used to perform floating-point
19426operations.  Unless they are replaced by routines that emulate the
19427floating-point operations, or compiled in such a way as to call such
19428emulations routines, these routines issue floating-point
19429operations.   If you are compiling for an Alpha without floating-point
19430operations, you must ensure that the library is built so as not to call
19431them.
19432
19433Note that Alpha implementations without floating-point operations are
19434required to have floating-point registers.
19435
19436@item -mfp-reg
19437@itemx -mno-fp-regs
19438@opindex mfp-reg
19439@opindex mno-fp-regs
19440Generate code that uses (does not use) the floating-point register set.
19441@option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
19442register set is not used, floating-point operands are passed in integer
19443registers as if they were integers and floating-point results are passed
19444in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
19445so any function with a floating-point argument or return value called by code
19446compiled with @option{-mno-fp-regs} must also be compiled with that
19447option.
19448
19449A typical use of this option is building a kernel that does not use,
19450and hence need not save and restore, any floating-point registers.
19451
19452@item -mieee
19453@opindex mieee
19454The Alpha architecture implements floating-point hardware optimized for
19455maximum performance.  It is mostly compliant with the IEEE floating-point
19456standard.  However, for full compliance, software assistance is
19457required.  This option generates code fully IEEE-compliant code
19458@emph{except} that the @var{inexact-flag} is not maintained (see below).
19459If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19460defined during compilation.  The resulting code is less efficient but is
19461able to correctly support denormalized numbers and exceptional IEEE
19462values such as not-a-number and plus/minus infinity.  Other Alpha
19463compilers call this option @option{-ieee_with_no_inexact}.
19464
19465@item -mieee-with-inexact
19466@opindex mieee-with-inexact
19467This is like @option{-mieee} except the generated code also maintains
19468the IEEE @var{inexact-flag}.  Turning on this option causes the
19469generated code to implement fully-compliant IEEE math.  In addition to
19470@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19471macro.  On some Alpha implementations the resulting code may execute
19472significantly slower than the code generated by default.  Since there is
19473very little code that depends on the @var{inexact-flag}, you should
19474normally not specify this option.  Other Alpha compilers call this
19475option @option{-ieee_with_inexact}.
19476
19477@item -mfp-trap-mode=@var{trap-mode}
19478@opindex mfp-trap-mode
19479This option controls what floating-point related traps are enabled.
19480Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19481The trap mode can be set to one of four values:
19482
19483@table @samp
19484@item n
19485This is the default (normal) setting.  The only traps that are enabled
19486are the ones that cannot be disabled in software (e.g., division by zero
19487trap).
19488
19489@item u
19490In addition to the traps enabled by @samp{n}, underflow traps are enabled
19491as well.
19492
19493@item su
19494Like @samp{u}, but the instructions are marked to be safe for software
19495completion (see Alpha architecture manual for details).
19496
19497@item sui
19498Like @samp{su}, but inexact traps are enabled as well.
19499@end table
19500
19501@item -mfp-rounding-mode=@var{rounding-mode}
19502@opindex mfp-rounding-mode
19503Selects the IEEE rounding mode.  Other Alpha compilers call this option
19504@option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
19505of:
19506
19507@table @samp
19508@item n
19509Normal IEEE rounding mode.  Floating-point numbers are rounded towards
19510the nearest machine number or towards the even machine number in case
19511of a tie.
19512
19513@item m
19514Round towards minus infinity.
19515
19516@item c
19517Chopped rounding mode.  Floating-point numbers are rounded towards zero.
19518
19519@item d
19520Dynamic rounding mode.  A field in the floating-point control register
19521(@var{fpcr}, see Alpha architecture reference manual) controls the
19522rounding mode in effect.  The C library initializes this register for
19523rounding towards plus infinity.  Thus, unless your program modifies the
19524@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19525@end table
19526
19527@item -mtrap-precision=@var{trap-precision}
19528@opindex mtrap-precision
19529In the Alpha architecture, floating-point traps are imprecise.  This
19530means without software assistance it is impossible to recover from a
19531floating trap and program execution normally needs to be terminated.
19532GCC can generate code that can assist operating system trap handlers
19533in determining the exact location that caused a floating-point trap.
19534Depending on the requirements of an application, different levels of
19535precisions can be selected:
19536
19537@table @samp
19538@item p
19539Program precision.  This option is the default and means a trap handler
19540can only identify which program caused a floating-point exception.
19541
19542@item f
19543Function precision.  The trap handler can determine the function that
19544caused a floating-point exception.
19545
19546@item i
19547Instruction precision.  The trap handler can determine the exact
19548instruction that caused a floating-point exception.
19549@end table
19550
19551Other Alpha compilers provide the equivalent options called
19552@option{-scope_safe} and @option{-resumption_safe}.
19553
19554@item -mieee-conformant
19555@opindex mieee-conformant
19556This option marks the generated code as IEEE conformant.  You must not
19557use this option unless you also specify @option{-mtrap-precision=i} and either
19558@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
19559is to emit the line @samp{.eflag 48} in the function prologue of the
19560generated assembly file.
19561
19562@item -mbuild-constants
19563@opindex mbuild-constants
19564Normally GCC examines a 32- or 64-bit integer constant to
19565see if it can construct it from smaller constants in two or three
19566instructions.  If it cannot, it outputs the constant as a literal and
19567generates code to load it from the data segment at run time.
19568
19569Use this option to require GCC to construct @emph{all} integer constants
19570using code, even if it takes more instructions (the maximum is six).
19571
19572You typically use this option to build a shared library dynamic
19573loader.  Itself a shared library, it must relocate itself in memory
19574before it can find the variables and constants in its own data segment.
19575
19576@item -mbwx
19577@itemx -mno-bwx
19578@itemx -mcix
19579@itemx -mno-cix
19580@itemx -mfix
19581@itemx -mno-fix
19582@itemx -mmax
19583@itemx -mno-max
19584@opindex mbwx
19585@opindex mno-bwx
19586@opindex mcix
19587@opindex mno-cix
19588@opindex mfix
19589@opindex mno-fix
19590@opindex mmax
19591@opindex mno-max
19592Indicate whether GCC should generate code to use the optional BWX,
19593CIX, FIX and MAX instruction sets.  The default is to use the instruction
19594sets supported by the CPU type specified via @option{-mcpu=} option or that
19595of the CPU on which GCC was built if none is specified.
19596
19597@item -mfloat-vax
19598@itemx -mfloat-ieee
19599@opindex mfloat-vax
19600@opindex mfloat-ieee
19601Generate code that uses (does not use) VAX F and G floating-point
19602arithmetic instead of IEEE single and double precision.
19603
19604@item -mexplicit-relocs
19605@itemx -mno-explicit-relocs
19606@opindex mexplicit-relocs
19607@opindex mno-explicit-relocs
19608Older Alpha assemblers provided no way to generate symbol relocations
19609except via assembler macros.  Use of these macros does not allow
19610optimal instruction scheduling.  GNU binutils as of version 2.12
19611supports a new syntax that allows the compiler to explicitly mark
19612which relocations should apply to which instructions.  This option
19613is mostly useful for debugging, as GCC detects the capabilities of
19614the assembler when it is built and sets the default accordingly.
19615
19616@item -msmall-data
19617@itemx -mlarge-data
19618@opindex msmall-data
19619@opindex mlarge-data
19620When @option{-mexplicit-relocs} is in effect, static data is
19621accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
19622is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19623(the @code{.sdata} and @code{.sbss} sections) and are accessed via
1962416-bit relocations off of the @code{$gp} register.  This limits the
19625size of the small data area to 64KB, but allows the variables to be
19626directly accessed via a single instruction.
19627
19628The default is @option{-mlarge-data}.  With this option the data area
19629is limited to just below 2GB@.  Programs that require more than 2GB of
19630data must use @code{malloc} or @code{mmap} to allocate the data in the
19631heap instead of in the program's data segment.
19632
19633When generating code for shared libraries, @option{-fpic} implies
19634@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19635
19636@item -msmall-text
19637@itemx -mlarge-text
19638@opindex msmall-text
19639@opindex mlarge-text
19640When @option{-msmall-text} is used, the compiler assumes that the
19641code of the entire program (or shared library) fits in 4MB, and is
19642thus reachable with a branch instruction.  When @option{-msmall-data}
19643is used, the compiler can assume that all local symbols share the
19644same @code{$gp} value, and thus reduce the number of instructions
19645required for a function call from 4 to 1.
19646
19647The default is @option{-mlarge-text}.
19648
19649@item -mcpu=@var{cpu_type}
19650@opindex mcpu
19651Set the instruction set and instruction scheduling parameters for
19652machine type @var{cpu_type}.  You can specify either the @samp{EV}
19653style name or the corresponding chip number.  GCC supports scheduling
19654parameters for the EV4, EV5 and EV6 family of processors and
19655chooses the default values for the instruction set from the processor
19656you specify.  If you do not specify a processor type, GCC defaults
19657to the processor on which the compiler was built.
19658
19659Supported values for @var{cpu_type} are
19660
19661@table @samp
19662@item ev4
19663@itemx ev45
19664@itemx 21064
19665Schedules as an EV4 and has no instruction set extensions.
19666
19667@item ev5
19668@itemx 21164
19669Schedules as an EV5 and has no instruction set extensions.
19670
19671@item ev56
19672@itemx 21164a
19673Schedules as an EV5 and supports the BWX extension.
19674
19675@item pca56
19676@itemx 21164pc
19677@itemx 21164PC
19678Schedules as an EV5 and supports the BWX and MAX extensions.
19679
19680@item ev6
19681@itemx 21264
19682Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19683
19684@item ev67
19685@itemx 21264a
19686Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19687@end table
19688
19689Native toolchains also support the value @samp{native},
19690which selects the best architecture option for the host processor.
19691@option{-mcpu=native} has no effect if GCC does not recognize
19692the processor.
19693
19694@item -mtune=@var{cpu_type}
19695@opindex mtune
19696Set only the instruction scheduling parameters for machine type
19697@var{cpu_type}.  The instruction set is not changed.
19698
19699Native toolchains also support the value @samp{native},
19700which selects the best architecture option for the host processor.
19701@option{-mtune=native} has no effect if GCC does not recognize
19702the processor.
19703
19704@item -mmemory-latency=@var{time}
19705@opindex mmemory-latency
19706Sets the latency the scheduler should assume for typical memory
19707references as seen by the application.  This number is highly
19708dependent on the memory access patterns used by the application
19709and the size of the external cache on the machine.
19710
19711Valid options for @var{time} are
19712
19713@table @samp
19714@item @var{number}
19715A decimal number representing clock cycles.
19716
19717@item L1
19718@itemx L2
19719@itemx L3
19720@itemx main
19721The compiler contains estimates of the number of clock cycles for
19722``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19723(also called Dcache, Scache, and Bcache), as well as to main memory.
19724Note that L3 is only valid for EV5.
19725
19726@end table
19727@end table
19728
19729@node FR30 Options
19730@subsection FR30 Options
19731@cindex FR30 Options
19732
19733These options are defined specifically for the FR30 port.
19734
19735@table @gcctabopt
19736
19737@item -msmall-model
19738@opindex msmall-model
19739Use the small address space model.  This can produce smaller code, but
19740it does assume that all symbolic values and addresses fit into a
1974120-bit range.
19742
19743@item -mno-lsim
19744@opindex mno-lsim
19745Assume that runtime support has been provided and so there is no need
19746to include the simulator library (@file{libsim.a}) on the linker
19747command line.
19748
19749@end table
19750
19751@node FT32 Options
19752@subsection FT32 Options
19753@cindex FT32 Options
19754
19755These options are defined specifically for the FT32 port.
19756
19757@table @gcctabopt
19758
19759@item -msim
19760@opindex msim
19761Specifies that the program will be run on the simulator.  This causes
19762an alternate runtime startup and library to be linked.
19763You must not use this option when generating programs that will run on
19764real hardware; you must provide your own runtime library for whatever
19765I/O functions are needed.
19766
19767@item -mlra
19768@opindex mlra
19769Enable Local Register Allocation.  This is still experimental for FT32,
19770so by default the compiler uses standard reload.
19771
19772@item -mnodiv
19773@opindex mnodiv
19774Do not use div and mod instructions.
19775
19776@item -mft32b
19777@opindex mft32b
19778Enable use of the extended instructions of the FT32B processor.
19779
19780@item -mcompress
19781@opindex mcompress
19782Compress all code using the Ft32B code compression scheme.
19783
19784@item -mnopm
19785@opindex  mnopm
19786Do not generate code that reads program memory.
19787
19788@end table
19789
19790@node FRV Options
19791@subsection FRV Options
19792@cindex FRV Options
19793
19794@table @gcctabopt
19795@item -mgpr-32
19796@opindex mgpr-32
19797
19798Only use the first 32 general-purpose registers.
19799
19800@item -mgpr-64
19801@opindex mgpr-64
19802
19803Use all 64 general-purpose registers.
19804
19805@item -mfpr-32
19806@opindex mfpr-32
19807
19808Use only the first 32 floating-point registers.
19809
19810@item -mfpr-64
19811@opindex mfpr-64
19812
19813Use all 64 floating-point registers.
19814
19815@item -mhard-float
19816@opindex mhard-float
19817
19818Use hardware instructions for floating-point operations.
19819
19820@item -msoft-float
19821@opindex msoft-float
19822
19823Use library routines for floating-point operations.
19824
19825@item -malloc-cc
19826@opindex malloc-cc
19827
19828Dynamically allocate condition code registers.
19829
19830@item -mfixed-cc
19831@opindex mfixed-cc
19832
19833Do not try to dynamically allocate condition code registers, only
19834use @code{icc0} and @code{fcc0}.
19835
19836@item -mdword
19837@opindex mdword
19838
19839Change ABI to use double word insns.
19840
19841@item -mno-dword
19842@opindex mno-dword
19843@opindex mdword
19844
19845Do not use double word instructions.
19846
19847@item -mdouble
19848@opindex mdouble
19849
19850Use floating-point double instructions.
19851
19852@item -mno-double
19853@opindex mno-double
19854
19855Do not use floating-point double instructions.
19856
19857@item -mmedia
19858@opindex mmedia
19859
19860Use media instructions.
19861
19862@item -mno-media
19863@opindex mno-media
19864
19865Do not use media instructions.
19866
19867@item -mmuladd
19868@opindex mmuladd
19869
19870Use multiply and add/subtract instructions.
19871
19872@item -mno-muladd
19873@opindex mno-muladd
19874
19875Do not use multiply and add/subtract instructions.
19876
19877@item -mfdpic
19878@opindex mfdpic
19879
19880Select the FDPIC ABI, which uses function descriptors to represent
19881pointers to functions.  Without any PIC/PIE-related options, it
19882implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
19883assumes GOT entries and small data are within a 12-bit range from the
19884GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19885are computed with 32 bits.
19886With a @samp{bfin-elf} target, this option implies @option{-msim}.
19887
19888@item -minline-plt
19889@opindex minline-plt
19890
19891Enable inlining of PLT entries in function calls to functions that are
19892not known to bind locally.  It has no effect without @option{-mfdpic}.
19893It's enabled by default if optimizing for speed and compiling for
19894shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19895optimization option such as @option{-O3} or above is present in the
19896command line.
19897
19898@item -mTLS
19899@opindex mTLS
19900
19901Assume a large TLS segment when generating thread-local code.
19902
19903@item -mtls
19904@opindex mtls
19905
19906Do not assume a large TLS segment when generating thread-local code.
19907
19908@item -mgprel-ro
19909@opindex mgprel-ro
19910
19911Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19912that is known to be in read-only sections.  It's enabled by default,
19913except for @option{-fpic} or @option{-fpie}: even though it may help
19914make the global offset table smaller, it trades 1 instruction for 4.
19915With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19916one of which may be shared by multiple symbols, and it avoids the need
19917for a GOT entry for the referenced symbol, so it's more likely to be a
19918win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
19919
19920@item -multilib-library-pic
19921@opindex multilib-library-pic
19922
19923Link with the (library, not FD) pic libraries.  It's implied by
19924@option{-mlibrary-pic}, as well as by @option{-fPIC} and
19925@option{-fpic} without @option{-mfdpic}.  You should never have to use
19926it explicitly.
19927
19928@item -mlinked-fp
19929@opindex mlinked-fp
19930
19931Follow the EABI requirement of always creating a frame pointer whenever
19932a stack frame is allocated.  This option is enabled by default and can
19933be disabled with @option{-mno-linked-fp}.
19934
19935@item -mlong-calls
19936@opindex mlong-calls
19937
19938Use indirect addressing to call functions outside the current
19939compilation unit.  This allows the functions to be placed anywhere
19940within the 32-bit address space.
19941
19942@item -malign-labels
19943@opindex malign-labels
19944
19945Try to align labels to an 8-byte boundary by inserting NOPs into the
19946previous packet.  This option only has an effect when VLIW packing
19947is enabled.  It doesn't create new packets; it merely adds NOPs to
19948existing ones.
19949
19950@item -mlibrary-pic
19951@opindex mlibrary-pic
19952
19953Generate position-independent EABI code.
19954
19955@item -macc-4
19956@opindex macc-4
19957
19958Use only the first four media accumulator registers.
19959
19960@item -macc-8
19961@opindex macc-8
19962
19963Use all eight media accumulator registers.
19964
19965@item -mpack
19966@opindex mpack
19967
19968Pack VLIW instructions.
19969
19970@item -mno-pack
19971@opindex mno-pack
19972
19973Do not pack VLIW instructions.
19974
19975@item -mno-eflags
19976@opindex mno-eflags
19977
19978Do not mark ABI switches in e_flags.
19979
19980@item -mcond-move
19981@opindex mcond-move
19982
19983Enable the use of conditional-move instructions (default).
19984
19985This switch is mainly for debugging the compiler and will likely be removed
19986in a future version.
19987
19988@item -mno-cond-move
19989@opindex mno-cond-move
19990
19991Disable the use of conditional-move instructions.
19992
19993This switch is mainly for debugging the compiler and will likely be removed
19994in a future version.
19995
19996@item -mscc
19997@opindex mscc
19998
19999Enable the use of conditional set instructions (default).
20000
20001This switch is mainly for debugging the compiler and will likely be removed
20002in a future version.
20003
20004@item -mno-scc
20005@opindex mno-scc
20006
20007Disable the use of conditional set instructions.
20008
20009This switch is mainly for debugging the compiler and will likely be removed
20010in a future version.
20011
20012@item -mcond-exec
20013@opindex mcond-exec
20014
20015Enable the use of conditional execution (default).
20016
20017This switch is mainly for debugging the compiler and will likely be removed
20018in a future version.
20019
20020@item -mno-cond-exec
20021@opindex mno-cond-exec
20022
20023Disable the use of conditional execution.
20024
20025This switch is mainly for debugging the compiler and will likely be removed
20026in a future version.
20027
20028@item -mvliw-branch
20029@opindex mvliw-branch
20030
20031Run a pass to pack branches into VLIW instructions (default).
20032
20033This switch is mainly for debugging the compiler and will likely be removed
20034in a future version.
20035
20036@item -mno-vliw-branch
20037@opindex mno-vliw-branch
20038
20039Do not run a pass to pack branches into VLIW instructions.
20040
20041This switch is mainly for debugging the compiler and will likely be removed
20042in a future version.
20043
20044@item -mmulti-cond-exec
20045@opindex mmulti-cond-exec
20046
20047Enable optimization of @code{&&} and @code{||} in conditional execution
20048(default).
20049
20050This switch is mainly for debugging the compiler and will likely be removed
20051in a future version.
20052
20053@item -mno-multi-cond-exec
20054@opindex mno-multi-cond-exec
20055
20056Disable optimization of @code{&&} and @code{||} in conditional execution.
20057
20058This switch is mainly for debugging the compiler and will likely be removed
20059in a future version.
20060
20061@item -mnested-cond-exec
20062@opindex mnested-cond-exec
20063
20064Enable nested conditional execution optimizations (default).
20065
20066This switch is mainly for debugging the compiler and will likely be removed
20067in a future version.
20068
20069@item -mno-nested-cond-exec
20070@opindex mno-nested-cond-exec
20071
20072Disable nested conditional execution optimizations.
20073
20074This switch is mainly for debugging the compiler and will likely be removed
20075in a future version.
20076
20077@item -moptimize-membar
20078@opindex moptimize-membar
20079
20080This switch removes redundant @code{membar} instructions from the
20081compiler-generated code.  It is enabled by default.
20082
20083@item -mno-optimize-membar
20084@opindex mno-optimize-membar
20085@opindex moptimize-membar
20086
20087This switch disables the automatic removal of redundant @code{membar}
20088instructions from the generated code.
20089
20090@item -mtomcat-stats
20091@opindex mtomcat-stats
20092
20093Cause gas to print out tomcat statistics.
20094
20095@item -mcpu=@var{cpu}
20096@opindex mcpu
20097
20098Select the processor type for which to generate code.  Possible values are
20099@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20100@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20101
20102@end table
20103
20104@node GNU/Linux Options
20105@subsection GNU/Linux Options
20106
20107These @samp{-m} options are defined for GNU/Linux targets:
20108
20109@table @gcctabopt
20110@item -mglibc
20111@opindex mglibc
20112Use the GNU C library.  This is the default except
20113on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20114@samp{*-*-linux-*android*} targets.
20115
20116@item -muclibc
20117@opindex muclibc
20118Use uClibc C library.  This is the default on
20119@samp{*-*-linux-*uclibc*} targets.
20120
20121@item -mmusl
20122@opindex mmusl
20123Use the musl C library.  This is the default on
20124@samp{*-*-linux-*musl*} targets.
20125
20126@item -mbionic
20127@opindex mbionic
20128Use Bionic C library.  This is the default on
20129@samp{*-*-linux-*android*} targets.
20130
20131@item -mandroid
20132@opindex mandroid
20133Compile code compatible with Android platform.  This is the default on
20134@samp{*-*-linux-*android*} targets.
20135
20136When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20137@option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
20138this option makes the GCC driver pass Android-specific options to the linker.
20139Finally, this option causes the preprocessor macro @code{__ANDROID__}
20140to be defined.
20141
20142@item -tno-android-cc
20143@opindex tno-android-cc
20144Disable compilation effects of @option{-mandroid}, i.e., do not enable
20145@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20146@option{-fno-rtti} by default.
20147
20148@item -tno-android-ld
20149@opindex tno-android-ld
20150Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20151linking options to the linker.
20152
20153@end table
20154
20155@node H8/300 Options
20156@subsection H8/300 Options
20157
20158These @samp{-m} options are defined for the H8/300 implementations:
20159
20160@table @gcctabopt
20161@item -mrelax
20162@opindex mrelax
20163Shorten some address references at link time, when possible; uses the
20164linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
20165ld, Using ld}, for a fuller description.
20166
20167@item -mh
20168@opindex mh
20169Generate code for the H8/300H@.
20170
20171@item -ms
20172@opindex ms
20173Generate code for the H8S@.
20174
20175@item -mn
20176@opindex mn
20177Generate code for the H8S and H8/300H in the normal mode.  This switch
20178must be used either with @option{-mh} or @option{-ms}.
20179
20180@item -ms2600
20181@opindex ms2600
20182Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
20183
20184@item -mexr
20185@opindex mexr
20186Extended registers are stored on stack before execution of function
20187with monitor attribute. Default option is @option{-mexr}.
20188This option is valid only for H8S targets.
20189
20190@item -mno-exr
20191@opindex mno-exr
20192@opindex mexr
20193Extended registers are not stored on stack before execution of function
20194with monitor attribute. Default option is @option{-mno-exr}.
20195This option is valid only for H8S targets.
20196
20197@item -mint32
20198@opindex mint32
20199Make @code{int} data 32 bits by default.
20200
20201@item -malign-300
20202@opindex malign-300
20203On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20204The default for the H8/300H and H8S is to align longs and floats on
202054-byte boundaries.
20206@option{-malign-300} causes them to be aligned on 2-byte boundaries.
20207This option has no effect on the H8/300.
20208@end table
20209
20210@node HPPA Options
20211@subsection HPPA Options
20212@cindex HPPA Options
20213
20214These @samp{-m} options are defined for the HPPA family of computers:
20215
20216@table @gcctabopt
20217@item -march=@var{architecture-type}
20218@opindex march
20219Generate code for the specified architecture.  The choices for
20220@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
202211.1, and @samp{2.0} for PA 2.0 processors.  Refer to
20222@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20223architecture option for your machine.  Code compiled for lower numbered
20224architectures runs on higher numbered architectures, but not the
20225other way around.
20226
20227@item -mpa-risc-1-0
20228@itemx -mpa-risc-1-1
20229@itemx -mpa-risc-2-0
20230@opindex mpa-risc-1-0
20231@opindex mpa-risc-1-1
20232@opindex mpa-risc-2-0
20233Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20234
20235@item -mcaller-copies
20236@opindex mcaller-copies
20237The caller copies function arguments passed by hidden reference.  This
20238option should be used with care as it is not compatible with the default
2023932-bit runtime.  However, only aggregates larger than eight bytes are
20240passed by hidden reference and the option provides better compatibility
20241with OpenMP.
20242
20243@item -mjump-in-delay
20244@opindex mjump-in-delay
20245This option is ignored and provided for compatibility purposes only.
20246
20247@item -mdisable-fpregs
20248@opindex mdisable-fpregs
20249Prevent floating-point registers from being used in any manner.  This is
20250necessary for compiling kernels that perform lazy context switching of
20251floating-point registers.  If you use this option and attempt to perform
20252floating-point operations, the compiler aborts.
20253
20254@item -mdisable-indexing
20255@opindex mdisable-indexing
20256Prevent the compiler from using indexing address modes.  This avoids some
20257rather obscure problems when compiling MIG generated code under MACH@.
20258
20259@item -mno-space-regs
20260@opindex mno-space-regs
20261@opindex mspace-regs
20262Generate code that assumes the target has no space registers.  This allows
20263GCC to generate faster indirect calls and use unscaled index address modes.
20264
20265Such code is suitable for level 0 PA systems and kernels.
20266
20267@item -mfast-indirect-calls
20268@opindex mfast-indirect-calls
20269Generate code that assumes calls never cross space boundaries.  This
20270allows GCC to emit code that performs faster indirect calls.
20271
20272This option does not work in the presence of shared libraries or nested
20273functions.
20274
20275@item -mfixed-range=@var{register-range}
20276@opindex mfixed-range
20277Generate code treating the given register range as fixed registers.
20278A fixed register is one that the register allocator cannot use.  This is
20279useful when compiling kernel code.  A register range is specified as
20280two registers separated by a dash.  Multiple register ranges can be
20281specified separated by a comma.
20282
20283@item -mlong-load-store
20284@opindex mlong-load-store
20285Generate 3-instruction load and store sequences as sometimes required by
20286the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
20287the HP compilers.
20288
20289@item -mportable-runtime
20290@opindex mportable-runtime
20291Use the portable calling conventions proposed by HP for ELF systems.
20292
20293@item -mgas
20294@opindex mgas
20295Enable the use of assembler directives only GAS understands.
20296
20297@item -mschedule=@var{cpu-type}
20298@opindex mschedule
20299Schedule code according to the constraints for the machine type
20300@var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
20301@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
20302to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20303proper scheduling option for your machine.  The default scheduling is
20304@samp{8000}.
20305
20306@item -mlinker-opt
20307@opindex mlinker-opt
20308Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
20309debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
20310linkers in which they give bogus error messages when linking some programs.
20311
20312@item -msoft-float
20313@opindex msoft-float
20314Generate output containing library calls for floating point.
20315@strong{Warning:} the requisite libraries are not available for all HPPA
20316targets.  Normally the facilities of the machine's usual C compiler are
20317used, but this cannot be done directly in cross-compilation.  You must make
20318your own arrangements to provide suitable library functions for
20319cross-compilation.
20320
20321@option{-msoft-float} changes the calling convention in the output file;
20322therefore, it is only useful if you compile @emph{all} of a program with
20323this option.  In particular, you need to compile @file{libgcc.a}, the
20324library that comes with GCC, with @option{-msoft-float} in order for
20325this to work.
20326
20327@item -msio
20328@opindex msio
20329Generate the predefine, @code{_SIO}, for server IO@.  The default is
20330@option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
20331@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
20332options are available under HP-UX and HI-UX@.
20333
20334@item -mgnu-ld
20335@opindex mgnu-ld
20336Use options specific to GNU @command{ld}.
20337This passes @option{-shared} to @command{ld} when
20338building a shared library.  It is the default when GCC is configured,
20339explicitly or implicitly, with the GNU linker.  This option does not
20340affect which @command{ld} is called; it only changes what parameters
20341are passed to that @command{ld}.
20342The @command{ld} that is called is determined by the
20343@option{--with-ld} configure option, GCC's program search path, and
20344finally by the user's @env{PATH}.  The linker used by GCC can be printed
20345using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
20346on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20347
20348@item -mhp-ld
20349@opindex mhp-ld
20350Use options specific to HP @command{ld}.
20351This passes @option{-b} to @command{ld} when building
20352a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20353links.  It is the default when GCC is configured, explicitly or
20354implicitly, with the HP linker.  This option does not affect
20355which @command{ld} is called; it only changes what parameters are passed to that
20356@command{ld}.
20357The @command{ld} that is called is determined by the @option{--with-ld}
20358configure option, GCC's program search path, and finally by the user's
20359@env{PATH}.  The linker used by GCC can be printed using @samp{which
20360`gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
20361HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20362
20363@item -mlong-calls
20364@opindex mno-long-calls
20365@opindex mlong-calls
20366Generate code that uses long call sequences.  This ensures that a call
20367is always able to reach linker generated stubs.  The default is to generate
20368long calls only when the distance from the call site to the beginning
20369of the function or translation unit, as the case may be, exceeds a
20370predefined limit set by the branch type being used.  The limits for
20371normal calls are 7,600,000 and 240,000 bytes, respectively for the
20372PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
20373240,000 bytes.
20374
20375Distances are measured from the beginning of functions when using the
20376@option{-ffunction-sections} option, or when using the @option{-mgas}
20377and @option{-mno-portable-runtime} options together under HP-UX with
20378the SOM linker.
20379
20380It is normally not desirable to use this option as it degrades
20381performance.  However, it may be useful in large applications,
20382particularly when partial linking is used to build the application.
20383
20384The types of long calls used depends on the capabilities of the
20385assembler and linker, and the type of code being generated.  The
20386impact on systems that support long absolute calls, and long pic
20387symbol-difference or pc-relative calls should be relatively small.
20388However, an indirect call is used on 32-bit ELF systems in pic code
20389and it is quite long.
20390
20391@item -munix=@var{unix-std}
20392@opindex march
20393Generate compiler predefines and select a startfile for the specified
20394UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
20395and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
20396is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
2039711.11 and later.  The default values are @samp{93} for HP-UX 10.00,
20398@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20399and later.
20400
20401@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20402@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20403and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20404@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20405@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20406@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20407
20408It is @emph{important} to note that this option changes the interfaces
20409for various library routines.  It also affects the operational behavior
20410of the C library.  Thus, @emph{extreme} care is needed in using this
20411option.
20412
20413Library code that is intended to operate with more than one UNIX
20414standard must test, set and restore the variable @code{__xpg4_extended_mask}
20415as appropriate.  Most GNU software doesn't provide this capability.
20416
20417@item -nolibdld
20418@opindex nolibdld
20419Suppress the generation of link options to search libdld.sl when the
20420@option{-static} option is specified on HP-UX 10 and later.
20421
20422@item -static
20423@opindex static
20424The HP-UX implementation of setlocale in libc has a dependency on
20425libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
20426when the @option{-static} option is specified, special link options
20427are needed to resolve this dependency.
20428
20429On HP-UX 10 and later, the GCC driver adds the necessary options to
20430link with libdld.sl when the @option{-static} option is specified.
20431This causes the resulting binary to be dynamic.  On the 64-bit port,
20432the linkers generate dynamic binaries by default in any case.  The
20433@option{-nolibdld} option can be used to prevent the GCC driver from
20434adding these link options.
20435
20436@item -threads
20437@opindex threads
20438Add support for multithreading with the @dfn{dce thread} library
20439under HP-UX@.  This option sets flags for both the preprocessor and
20440linker.
20441@end table
20442
20443@node IA-64 Options
20444@subsection IA-64 Options
20445@cindex IA-64 Options
20446
20447These are the @samp{-m} options defined for the Intel IA-64 architecture.
20448
20449@table @gcctabopt
20450@item -mbig-endian
20451@opindex mbig-endian
20452Generate code for a big-endian target.  This is the default for HP-UX@.
20453
20454@item -mlittle-endian
20455@opindex mlittle-endian
20456Generate code for a little-endian target.  This is the default for AIX5
20457and GNU/Linux.
20458
20459@item -mgnu-as
20460@itemx -mno-gnu-as
20461@opindex mgnu-as
20462@opindex mno-gnu-as
20463Generate (or don't) code for the GNU assembler.  This is the default.
20464@c Also, this is the default if the configure option @option{--with-gnu-as}
20465@c is used.
20466
20467@item -mgnu-ld
20468@itemx -mno-gnu-ld
20469@opindex mgnu-ld
20470@opindex mno-gnu-ld
20471Generate (or don't) code for the GNU linker.  This is the default.
20472@c Also, this is the default if the configure option @option{--with-gnu-ld}
20473@c is used.
20474
20475@item -mno-pic
20476@opindex mno-pic
20477Generate code that does not use a global pointer register.  The result
20478is not position independent code, and violates the IA-64 ABI@.
20479
20480@item -mvolatile-asm-stop
20481@itemx -mno-volatile-asm-stop
20482@opindex mvolatile-asm-stop
20483@opindex mno-volatile-asm-stop
20484Generate (or don't) a stop bit immediately before and after volatile asm
20485statements.
20486
20487@item -mregister-names
20488@itemx -mno-register-names
20489@opindex mregister-names
20490@opindex mno-register-names
20491Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20492the stacked registers.  This may make assembler output more readable.
20493
20494@item -mno-sdata
20495@itemx -msdata
20496@opindex mno-sdata
20497@opindex msdata
20498Disable (or enable) optimizations that use the small data section.  This may
20499be useful for working around optimizer bugs.
20500
20501@item -mconstant-gp
20502@opindex mconstant-gp
20503Generate code that uses a single constant global pointer value.  This is
20504useful when compiling kernel code.
20505
20506@item -mauto-pic
20507@opindex mauto-pic
20508Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
20509This is useful when compiling firmware code.
20510
20511@item -minline-float-divide-min-latency
20512@opindex minline-float-divide-min-latency
20513Generate code for inline divides of floating-point values
20514using the minimum latency algorithm.
20515
20516@item -minline-float-divide-max-throughput
20517@opindex minline-float-divide-max-throughput
20518Generate code for inline divides of floating-point values
20519using the maximum throughput algorithm.
20520
20521@item -mno-inline-float-divide
20522@opindex mno-inline-float-divide
20523Do not generate inline code for divides of floating-point values.
20524
20525@item -minline-int-divide-min-latency
20526@opindex minline-int-divide-min-latency
20527Generate code for inline divides of integer values
20528using the minimum latency algorithm.
20529
20530@item -minline-int-divide-max-throughput
20531@opindex minline-int-divide-max-throughput
20532Generate code for inline divides of integer values
20533using the maximum throughput algorithm.
20534
20535@item -mno-inline-int-divide
20536@opindex mno-inline-int-divide
20537@opindex minline-int-divide
20538Do not generate inline code for divides of integer values.
20539
20540@item -minline-sqrt-min-latency
20541@opindex minline-sqrt-min-latency
20542Generate code for inline square roots
20543using the minimum latency algorithm.
20544
20545@item -minline-sqrt-max-throughput
20546@opindex minline-sqrt-max-throughput
20547Generate code for inline square roots
20548using the maximum throughput algorithm.
20549
20550@item -mno-inline-sqrt
20551@opindex mno-inline-sqrt
20552Do not generate inline code for @code{sqrt}.
20553
20554@item -mfused-madd
20555@itemx -mno-fused-madd
20556@opindex mfused-madd
20557@opindex mno-fused-madd
20558Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20559instructions.  The default is to use these instructions.
20560
20561@item -mno-dwarf2-asm
20562@itemx -mdwarf2-asm
20563@opindex mno-dwarf2-asm
20564@opindex mdwarf2-asm
20565Don't (or do) generate assembler code for the DWARF line number debugging
20566info.  This may be useful when not using the GNU assembler.
20567
20568@item -mearly-stop-bits
20569@itemx -mno-early-stop-bits
20570@opindex mearly-stop-bits
20571@opindex mno-early-stop-bits
20572Allow stop bits to be placed earlier than immediately preceding the
20573instruction that triggered the stop bit.  This can improve instruction
20574scheduling, but does not always do so.
20575
20576@item -mfixed-range=@var{register-range}
20577@opindex mfixed-range
20578Generate code treating the given register range as fixed registers.
20579A fixed register is one that the register allocator cannot use.  This is
20580useful when compiling kernel code.  A register range is specified as
20581two registers separated by a dash.  Multiple register ranges can be
20582specified separated by a comma.
20583
20584@item -mtls-size=@var{tls-size}
20585@opindex mtls-size
20586Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
2058764.
20588
20589@item -mtune=@var{cpu-type}
20590@opindex mtune
20591Tune the instruction scheduling for a particular CPU, Valid values are
20592@samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20593and @samp{mckinley}.
20594
20595@item -milp32
20596@itemx -mlp64
20597@opindex milp32
20598@opindex mlp64
20599Generate code for a 32-bit or 64-bit environment.
20600The 32-bit environment sets int, long and pointer to 32 bits.
20601The 64-bit environment sets int to 32 bits and long and pointer
20602to 64 bits.  These are HP-UX specific flags.
20603
20604@item -mno-sched-br-data-spec
20605@itemx -msched-br-data-spec
20606@opindex mno-sched-br-data-spec
20607@opindex msched-br-data-spec
20608(Dis/En)able data speculative scheduling before reload.
20609This results in generation of @code{ld.a} instructions and
20610the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20611The default setting is disabled.
20612
20613@item -msched-ar-data-spec
20614@itemx -mno-sched-ar-data-spec
20615@opindex msched-ar-data-spec
20616@opindex mno-sched-ar-data-spec
20617(En/Dis)able data speculative scheduling after reload.
20618This results in generation of @code{ld.a} instructions and
20619the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20620The default setting is enabled.
20621
20622@item -mno-sched-control-spec
20623@itemx -msched-control-spec
20624@opindex mno-sched-control-spec
20625@opindex msched-control-spec
20626(Dis/En)able control speculative scheduling.  This feature is
20627available only during region scheduling (i.e.@: before reload).
20628This results in generation of the @code{ld.s} instructions and
20629the corresponding check instructions @code{chk.s}.
20630The default setting is disabled.
20631
20632@item -msched-br-in-data-spec
20633@itemx -mno-sched-br-in-data-spec
20634@opindex msched-br-in-data-spec
20635@opindex mno-sched-br-in-data-spec
20636(En/Dis)able speculative scheduling of the instructions that
20637are dependent on the data speculative loads before reload.
20638This is effective only with @option{-msched-br-data-spec} enabled.
20639The default setting is enabled.
20640
20641@item -msched-ar-in-data-spec
20642@itemx -mno-sched-ar-in-data-spec
20643@opindex msched-ar-in-data-spec
20644@opindex mno-sched-ar-in-data-spec
20645(En/Dis)able speculative scheduling of the instructions that
20646are dependent on the data speculative loads after reload.
20647This is effective only with @option{-msched-ar-data-spec} enabled.
20648The default setting is enabled.
20649
20650@item -msched-in-control-spec
20651@itemx -mno-sched-in-control-spec
20652@opindex msched-in-control-spec
20653@opindex mno-sched-in-control-spec
20654(En/Dis)able speculative scheduling of the instructions that
20655are dependent on the control speculative loads.
20656This is effective only with @option{-msched-control-spec} enabled.
20657The default setting is enabled.
20658
20659@item -mno-sched-prefer-non-data-spec-insns
20660@itemx -msched-prefer-non-data-spec-insns
20661@opindex mno-sched-prefer-non-data-spec-insns
20662@opindex msched-prefer-non-data-spec-insns
20663If enabled, data-speculative instructions are chosen for schedule
20664only if there are no other choices at the moment.  This makes
20665the use of the data speculation much more conservative.
20666The default setting is disabled.
20667
20668@item -mno-sched-prefer-non-control-spec-insns
20669@itemx -msched-prefer-non-control-spec-insns
20670@opindex mno-sched-prefer-non-control-spec-insns
20671@opindex msched-prefer-non-control-spec-insns
20672If enabled, control-speculative instructions are chosen for schedule
20673only if there are no other choices at the moment.  This makes
20674the use of the control speculation much more conservative.
20675The default setting is disabled.
20676
20677@item -mno-sched-count-spec-in-critical-path
20678@itemx -msched-count-spec-in-critical-path
20679@opindex mno-sched-count-spec-in-critical-path
20680@opindex msched-count-spec-in-critical-path
20681If enabled, speculative dependencies are considered during
20682computation of the instructions priorities.  This makes the use of the
20683speculation a bit more conservative.
20684The default setting is disabled.
20685
20686@item -msched-spec-ldc
20687@opindex msched-spec-ldc
20688Use a simple data speculation check.  This option is on by default.
20689
20690@item -msched-control-spec-ldc
20691@opindex msched-spec-ldc
20692Use a simple check for control speculation.  This option is on by default.
20693
20694@item -msched-stop-bits-after-every-cycle
20695@opindex msched-stop-bits-after-every-cycle
20696Place a stop bit after every cycle when scheduling.  This option is on
20697by default.
20698
20699@item -msched-fp-mem-deps-zero-cost
20700@opindex msched-fp-mem-deps-zero-cost
20701Assume that floating-point stores and loads are not likely to cause a conflict
20702when placed into the same instruction group.  This option is disabled by
20703default.
20704
20705@item -msel-sched-dont-check-control-spec
20706@opindex msel-sched-dont-check-control-spec
20707Generate checks for control speculation in selective scheduling.
20708This flag is disabled by default.
20709
20710@item -msched-max-memory-insns=@var{max-insns}
20711@opindex msched-max-memory-insns
20712Limit on the number of memory insns per instruction group, giving lower
20713priority to subsequent memory insns attempting to schedule in the same
20714instruction group. Frequently useful to prevent cache bank conflicts.
20715The default value is 1.
20716
20717@item -msched-max-memory-insns-hard-limit
20718@opindex msched-max-memory-insns-hard-limit
20719Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20720disallowing more than that number in an instruction group.
20721Otherwise, the limit is ``soft'', meaning that non-memory operations
20722are preferred when the limit is reached, but memory operations may still
20723be scheduled.
20724
20725@end table
20726
20727@node LM32 Options
20728@subsection LM32 Options
20729@cindex LM32 options
20730
20731These @option{-m} options are defined for the LatticeMico32 architecture:
20732
20733@table @gcctabopt
20734@item -mbarrel-shift-enabled
20735@opindex mbarrel-shift-enabled
20736Enable barrel-shift instructions.
20737
20738@item -mdivide-enabled
20739@opindex mdivide-enabled
20740Enable divide and modulus instructions.
20741
20742@item -mmultiply-enabled
20743@opindex multiply-enabled
20744Enable multiply instructions.
20745
20746@item -msign-extend-enabled
20747@opindex msign-extend-enabled
20748Enable sign extend instructions.
20749
20750@item -muser-enabled
20751@opindex muser-enabled
20752Enable user-defined instructions.
20753
20754@end table
20755
20756@node M32C Options
20757@subsection M32C Options
20758@cindex M32C options
20759
20760@table @gcctabopt
20761@item -mcpu=@var{name}
20762@opindex mcpu=
20763Select the CPU for which code is generated.  @var{name} may be one of
20764@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20765/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20766the M32C/80 series.
20767
20768@item -msim
20769@opindex msim
20770Specifies that the program will be run on the simulator.  This causes
20771an alternate runtime library to be linked in which supports, for
20772example, file I/O@.  You must not use this option when generating
20773programs that will run on real hardware; you must provide your own
20774runtime library for whatever I/O functions are needed.
20775
20776@item -memregs=@var{number}
20777@opindex memregs=
20778Specifies the number of memory-based pseudo-registers GCC uses
20779during code generation.  These pseudo-registers are used like real
20780registers, so there is a tradeoff between GCC's ability to fit the
20781code into available registers, and the performance penalty of using
20782memory instead of registers.  Note that all modules in a program must
20783be compiled with the same value for this option.  Because of that, you
20784must not use this option with GCC's default runtime libraries.
20785
20786@end table
20787
20788@node M32R/D Options
20789@subsection M32R/D Options
20790@cindex M32R/D options
20791
20792These @option{-m} options are defined for Renesas M32R/D architectures:
20793
20794@table @gcctabopt
20795@item -m32r2
20796@opindex m32r2
20797Generate code for the M32R/2@.
20798
20799@item -m32rx
20800@opindex m32rx
20801Generate code for the M32R/X@.
20802
20803@item -m32r
20804@opindex m32r
20805Generate code for the M32R@.  This is the default.
20806
20807@item -mmodel=small
20808@opindex mmodel=small
20809Assume all objects live in the lower 16MB of memory (so that their addresses
20810can be loaded with the @code{ld24} instruction), and assume all subroutines
20811are reachable with the @code{bl} instruction.
20812This is the default.
20813
20814The addressability of a particular object can be set with the
20815@code{model} attribute.
20816
20817@item -mmodel=medium
20818@opindex mmodel=medium
20819Assume objects may be anywhere in the 32-bit address space (the compiler
20820generates @code{seth/add3} instructions to load their addresses), and
20821assume all subroutines are reachable with the @code{bl} instruction.
20822
20823@item -mmodel=large
20824@opindex mmodel=large
20825Assume objects may be anywhere in the 32-bit address space (the compiler
20826generates @code{seth/add3} instructions to load their addresses), and
20827assume subroutines may not be reachable with the @code{bl} instruction
20828(the compiler generates the much slower @code{seth/add3/jl}
20829instruction sequence).
20830
20831@item -msdata=none
20832@opindex msdata=none
20833Disable use of the small data area.  Variables are put into
20834one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20835@code{section} attribute has been specified).
20836This is the default.
20837
20838The small data area consists of sections @code{.sdata} and @code{.sbss}.
20839Objects may be explicitly put in the small data area with the
20840@code{section} attribute using one of these sections.
20841
20842@item -msdata=sdata
20843@opindex msdata=sdata
20844Put small global and static data in the small data area, but do not
20845generate special code to reference them.
20846
20847@item -msdata=use
20848@opindex msdata=use
20849Put small global and static data in the small data area, and generate
20850special instructions to reference them.
20851
20852@item -G @var{num}
20853@opindex G
20854@cindex smaller data references
20855Put global and static objects less than or equal to @var{num} bytes
20856into the small data or BSS sections instead of the normal data or BSS
20857sections.  The default value of @var{num} is 8.
20858The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20859for this option to have any effect.
20860
20861All modules should be compiled with the same @option{-G @var{num}} value.
20862Compiling with different values of @var{num} may or may not work; if it
20863doesn't the linker gives an error message---incorrect code is not
20864generated.
20865
20866@item -mdebug
20867@opindex mdebug
20868Makes the M32R-specific code in the compiler display some statistics
20869that might help in debugging programs.
20870
20871@item -malign-loops
20872@opindex malign-loops
20873Align all loops to a 32-byte boundary.
20874
20875@item -mno-align-loops
20876@opindex mno-align-loops
20877Do not enforce a 32-byte alignment for loops.  This is the default.
20878
20879@item -missue-rate=@var{number}
20880@opindex missue-rate=@var{number}
20881Issue @var{number} instructions per cycle.  @var{number} can only be 1
20882or 2.
20883
20884@item -mbranch-cost=@var{number}
20885@opindex mbranch-cost=@var{number}
20886@var{number} can only be 1 or 2.  If it is 1 then branches are
20887preferred over conditional code, if it is 2, then the opposite applies.
20888
20889@item -mflush-trap=@var{number}
20890@opindex mflush-trap=@var{number}
20891Specifies the trap number to use to flush the cache.  The default is
2089212.  Valid numbers are between 0 and 15 inclusive.
20893
20894@item -mno-flush-trap
20895@opindex mno-flush-trap
20896Specifies that the cache cannot be flushed by using a trap.
20897
20898@item -mflush-func=@var{name}
20899@opindex mflush-func=@var{name}
20900Specifies the name of the operating system function to call to flush
20901the cache.  The default is @samp{_flush_cache}, but a function call
20902is only used if a trap is not available.
20903
20904@item -mno-flush-func
20905@opindex mno-flush-func
20906Indicates that there is no OS function for flushing the cache.
20907
20908@end table
20909
20910@node M680x0 Options
20911@subsection M680x0 Options
20912@cindex M680x0 options
20913
20914These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20915The default settings depend on which architecture was selected when
20916the compiler was configured; the defaults for the most common choices
20917are given below.
20918
20919@table @gcctabopt
20920@item -march=@var{arch}
20921@opindex march
20922Generate code for a specific M680x0 or ColdFire instruction set
20923architecture.  Permissible values of @var{arch} for M680x0
20924architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20925@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
20926architectures are selected according to Freescale's ISA classification
20927and the permissible values are: @samp{isaa}, @samp{isaaplus},
20928@samp{isab} and @samp{isac}.
20929
20930GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20931code for a ColdFire target.  The @var{arch} in this macro is one of the
20932@option{-march} arguments given above.
20933
20934When used together, @option{-march} and @option{-mtune} select code
20935that runs on a family of similar processors but that is optimized
20936for a particular microarchitecture.
20937
20938@item -mcpu=@var{cpu}
20939@opindex mcpu
20940Generate code for a specific M680x0 or ColdFire processor.
20941The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20942@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20943and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
20944below, which also classifies the CPUs into families:
20945
20946@multitable @columnfractions 0.20 0.80
20947@item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20948@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}
20949@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20950@item @samp{5206e} @tab @samp{5206e}
20951@item @samp{5208} @tab @samp{5207} @samp{5208}
20952@item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20953@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20954@item @samp{5216} @tab @samp{5214} @samp{5216}
20955@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20956@item @samp{5225} @tab @samp{5224} @samp{5225}
20957@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20958@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20959@item @samp{5249} @tab @samp{5249}
20960@item @samp{5250} @tab @samp{5250}
20961@item @samp{5271} @tab @samp{5270} @samp{5271}
20962@item @samp{5272} @tab @samp{5272}
20963@item @samp{5275} @tab @samp{5274} @samp{5275}
20964@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20965@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20966@item @samp{5307} @tab @samp{5307}
20967@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20968@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20969@item @samp{5407} @tab @samp{5407}
20970@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}
20971@end multitable
20972
20973@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20974@var{arch} is compatible with @var{cpu}.  Other combinations of
20975@option{-mcpu} and @option{-march} are rejected.
20976
20977GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20978@var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
20979where the value of @var{family} is given by the table above.
20980
20981@item -mtune=@var{tune}
20982@opindex mtune
20983Tune the code for a particular microarchitecture within the
20984constraints set by @option{-march} and @option{-mcpu}.
20985The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20986@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20987and @samp{cpu32}.  The ColdFire microarchitectures
20988are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
20989
20990You can also use @option{-mtune=68020-40} for code that needs
20991to run relatively well on 68020, 68030 and 68040 targets.
20992@option{-mtune=68020-60} is similar but includes 68060 targets
20993as well.  These two options select the same tuning decisions as
20994@option{-m68020-40} and @option{-m68020-60} respectively.
20995
20996GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
20997when tuning for 680x0 architecture @var{arch}.  It also defines
20998@code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
20999option is used.  If GCC is tuning for a range of architectures,
21000as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
21001it defines the macros for every architecture in the range.
21002
21003GCC also defines the macro @code{__m@var{uarch}__} when tuning for
21004ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
21005of the arguments given above.
21006
21007@item -m68000
21008@itemx -mc68000
21009@opindex m68000
21010@opindex mc68000
21011Generate output for a 68000.  This is the default
21012when the compiler is configured for 68000-based systems.
21013It is equivalent to @option{-march=68000}.
21014
21015Use this option for microcontrollers with a 68000 or EC000 core,
21016including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21017
21018@item -m68010
21019@opindex m68010
21020Generate output for a 68010.  This is the default
21021when the compiler is configured for 68010-based systems.
21022It is equivalent to @option{-march=68010}.
21023
21024@item -m68020
21025@itemx -mc68020
21026@opindex m68020
21027@opindex mc68020
21028Generate output for a 68020.  This is the default
21029when the compiler is configured for 68020-based systems.
21030It is equivalent to @option{-march=68020}.
21031
21032@item -m68030
21033@opindex m68030
21034Generate output for a 68030.  This is the default when the compiler is
21035configured for 68030-based systems.  It is equivalent to
21036@option{-march=68030}.
21037
21038@item -m68040
21039@opindex m68040
21040Generate output for a 68040.  This is the default when the compiler is
21041configured for 68040-based systems.  It is equivalent to
21042@option{-march=68040}.
21043
21044This option inhibits the use of 68881/68882 instructions that have to be
21045emulated by software on the 68040.  Use this option if your 68040 does not
21046have code to emulate those instructions.
21047
21048@item -m68060
21049@opindex m68060
21050Generate output for a 68060.  This is the default when the compiler is
21051configured for 68060-based systems.  It is equivalent to
21052@option{-march=68060}.
21053
21054This option inhibits the use of 68020 and 68881/68882 instructions that
21055have to be emulated by software on the 68060.  Use this option if your 68060
21056does not have code to emulate those instructions.
21057
21058@item -mcpu32
21059@opindex mcpu32
21060Generate output for a CPU32.  This is the default
21061when the compiler is configured for CPU32-based systems.
21062It is equivalent to @option{-march=cpu32}.
21063
21064Use this option for microcontrollers with a
21065CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
2106668336, 68340, 68341, 68349 and 68360.
21067
21068@item -m5200
21069@opindex m5200
21070Generate output for a 520X ColdFire CPU@.  This is the default
21071when the compiler is configured for 520X-based systems.
21072It is equivalent to @option{-mcpu=5206}, and is now deprecated
21073in favor of that option.
21074
21075Use this option for microcontroller with a 5200 core, including
21076the MCF5202, MCF5203, MCF5204 and MCF5206.
21077
21078@item -m5206e
21079@opindex m5206e
21080Generate output for a 5206e ColdFire CPU@.  The option is now
21081deprecated in favor of the equivalent @option{-mcpu=5206e}.
21082
21083@item -m528x
21084@opindex m528x
21085Generate output for a member of the ColdFire 528X family.
21086The option is now deprecated in favor of the equivalent
21087@option{-mcpu=528x}.
21088
21089@item -m5307
21090@opindex m5307
21091Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
21092in favor of the equivalent @option{-mcpu=5307}.
21093
21094@item -m5407
21095@opindex m5407
21096Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
21097in favor of the equivalent @option{-mcpu=5407}.
21098
21099@item -mcfv4e
21100@opindex mcfv4e
21101Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21102This includes use of hardware floating-point instructions.
21103The option is equivalent to @option{-mcpu=547x}, and is now
21104deprecated in favor of that option.
21105
21106@item -m68020-40
21107@opindex m68020-40
21108Generate output for a 68040, without using any of the new instructions.
21109This results in code that can run relatively efficiently on either a
2111068020/68881 or a 68030 or a 68040.  The generated code does use the
2111168881 instructions that are emulated on the 68040.
21112
21113The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21114
21115@item -m68020-60
21116@opindex m68020-60
21117Generate output for a 68060, without using any of the new instructions.
21118This results in code that can run relatively efficiently on either a
2111968020/68881 or a 68030 or a 68040.  The generated code does use the
2112068881 instructions that are emulated on the 68060.
21121
21122The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21123
21124@item -mhard-float
21125@itemx -m68881
21126@opindex mhard-float
21127@opindex m68881
21128Generate floating-point instructions.  This is the default for 68020
21129and above, and for ColdFire devices that have an FPU@.  It defines the
21130macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21131on ColdFire targets.
21132
21133@item -msoft-float
21134@opindex msoft-float
21135Do not generate floating-point instructions; use library calls instead.
21136This is the default for 68000, 68010, and 68832 targets.  It is also
21137the default for ColdFire devices that have no FPU.
21138
21139@item -mdiv
21140@itemx -mno-div
21141@opindex mdiv
21142@opindex mno-div
21143Generate (do not generate) ColdFire hardware divide and remainder
21144instructions.  If @option{-march} is used without @option{-mcpu},
21145the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21146architectures.  Otherwise, the default is taken from the target CPU
21147(either the default CPU, or the one specified by @option{-mcpu}).  For
21148example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21149@option{-mcpu=5206e}.
21150
21151GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21152
21153@item -mshort
21154@opindex mshort
21155Consider type @code{int} to be 16 bits wide, like @code{short int}.
21156Additionally, parameters passed on the stack are also aligned to a
2115716-bit boundary even on targets whose API mandates promotion to 32-bit.
21158
21159@item -mno-short
21160@opindex mno-short
21161Do not consider type @code{int} to be 16 bits wide.  This is the default.
21162
21163@item -mnobitfield
21164@itemx -mno-bitfield
21165@opindex mnobitfield
21166@opindex mno-bitfield
21167Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
21168and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21169
21170@item -mbitfield
21171@opindex mbitfield
21172Do use the bit-field instructions.  The @option{-m68020} option implies
21173@option{-mbitfield}.  This is the default if you use a configuration
21174designed for a 68020.
21175
21176@item -mrtd
21177@opindex mrtd
21178Use a different function-calling convention, in which functions
21179that take a fixed number of arguments return with the @code{rtd}
21180instruction, which pops their arguments while returning.  This
21181saves one instruction in the caller since there is no need to pop
21182the arguments there.
21183
21184This calling convention is incompatible with the one normally
21185used on Unix, so you cannot use it if you need to call libraries
21186compiled with the Unix compiler.
21187
21188Also, you must provide function prototypes for all functions that
21189take variable numbers of arguments (including @code{printf});
21190otherwise incorrect code is generated for calls to those
21191functions.
21192
21193In addition, seriously incorrect code results if you call a
21194function with too many arguments.  (Normally, extra arguments are
21195harmlessly ignored.)
21196
21197The @code{rtd} instruction is supported by the 68010, 68020, 68030,
2119868040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21199
21200The default is @option{-mno-rtd}.
21201
21202@item -malign-int
21203@itemx -mno-align-int
21204@opindex malign-int
21205@opindex mno-align-int
21206Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21207@code{float}, @code{double}, and @code{long double} variables on a 32-bit
21208boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21209Aligning variables on 32-bit boundaries produces code that runs somewhat
21210faster on processors with 32-bit busses at the expense of more memory.
21211
21212@strong{Warning:} if you use the @option{-malign-int} switch, GCC
21213aligns structures containing the above types differently than
21214most published application binary interface specifications for the m68k.
21215
21216@item -mpcrel
21217@opindex mpcrel
21218Use the pc-relative addressing mode of the 68000 directly, instead of
21219using a global offset table.  At present, this option implies @option{-fpic},
21220allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
21221not presently supported with @option{-mpcrel}, though this could be supported for
2122268020 and higher processors.
21223
21224@item -mno-strict-align
21225@itemx -mstrict-align
21226@opindex mno-strict-align
21227@opindex mstrict-align
21228Do not (do) assume that unaligned memory references are handled by
21229the system.
21230
21231@item -msep-data
21232Generate code that allows the data segment to be located in a different
21233area of memory from the text segment.  This allows for execute-in-place in
21234an environment without virtual memory management.  This option implies
21235@option{-fPIC}.
21236
21237@item -mno-sep-data
21238Generate code that assumes that the data segment follows the text segment.
21239This is the default.
21240
21241@item -mid-shared-library
21242Generate code that supports shared libraries via the library ID method.
21243This allows for execute-in-place and shared libraries in an environment
21244without virtual memory management.  This option implies @option{-fPIC}.
21245
21246@item -mno-id-shared-library
21247Generate code that doesn't assume ID-based shared libraries are being used.
21248This is the default.
21249
21250@item -mshared-library-id=n
21251Specifies the identification number of the ID-based shared library being
21252compiled.  Specifying a value of 0 generates more compact code; specifying
21253other values forces the allocation of that number to the current
21254library, but is no more space- or time-efficient than omitting this option.
21255
21256@item -mxgot
21257@itemx -mno-xgot
21258@opindex mxgot
21259@opindex mno-xgot
21260When generating position-independent code for ColdFire, generate code
21261that works if the GOT has more than 8192 entries.  This code is
21262larger and slower than code generated without this option.  On M680x0
21263processors, this option is not needed; @option{-fPIC} suffices.
21264
21265GCC normally uses a single instruction to load values from the GOT@.
21266While this is relatively efficient, it only works if the GOT
21267is smaller than about 64k.  Anything larger causes the linker
21268to report an error such as:
21269
21270@cindex relocation truncated to fit (ColdFire)
21271@smallexample
21272relocation truncated to fit: R_68K_GOT16O foobar
21273@end smallexample
21274
21275If this happens, you should recompile your code with @option{-mxgot}.
21276It should then work with very large GOTs.  However, code generated with
21277@option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21278the value of a global symbol.
21279
21280Note that some linkers, including newer versions of the GNU linker,
21281can create multiple GOTs and sort GOT entries.  If you have such a linker,
21282you should only need to use @option{-mxgot} when compiling a single
21283object file that accesses more than 8192 GOT entries.  Very few do.
21284
21285These options have no effect unless GCC is generating
21286position-independent code.
21287
21288@item -mlong-jump-table-offsets
21289@opindex mlong-jump-table-offsets
21290Use 32-bit offsets in @code{switch} tables.  The default is to use
2129116-bit offsets.
21292
21293@end table
21294
21295@node MCore Options
21296@subsection MCore Options
21297@cindex MCore options
21298
21299These are the @samp{-m} options defined for the Motorola M*Core
21300processors.
21301
21302@table @gcctabopt
21303
21304@item -mhardlit
21305@itemx -mno-hardlit
21306@opindex mhardlit
21307@opindex mno-hardlit
21308Inline constants into the code stream if it can be done in two
21309instructions or less.
21310
21311@item -mdiv
21312@itemx -mno-div
21313@opindex mdiv
21314@opindex mno-div
21315Use the divide instruction.  (Enabled by default).
21316
21317@item -mrelax-immediate
21318@itemx -mno-relax-immediate
21319@opindex mrelax-immediate
21320@opindex mno-relax-immediate
21321Allow arbitrary-sized immediates in bit operations.
21322
21323@item -mwide-bitfields
21324@itemx -mno-wide-bitfields
21325@opindex mwide-bitfields
21326@opindex mno-wide-bitfields
21327Always treat bit-fields as @code{int}-sized.
21328
21329@item -m4byte-functions
21330@itemx -mno-4byte-functions
21331@opindex m4byte-functions
21332@opindex mno-4byte-functions
21333Force all functions to be aligned to a 4-byte boundary.
21334
21335@item -mcallgraph-data
21336@itemx -mno-callgraph-data
21337@opindex mcallgraph-data
21338@opindex mno-callgraph-data
21339Emit callgraph information.
21340
21341@item -mslow-bytes
21342@itemx -mno-slow-bytes
21343@opindex mslow-bytes
21344@opindex mno-slow-bytes
21345Prefer word access when reading byte quantities.
21346
21347@item -mlittle-endian
21348@itemx -mbig-endian
21349@opindex mlittle-endian
21350@opindex mbig-endian
21351Generate code for a little-endian target.
21352
21353@item -m210
21354@itemx -m340
21355@opindex m210
21356@opindex m340
21357Generate code for the 210 processor.
21358
21359@item -mno-lsim
21360@opindex mno-lsim
21361Assume that runtime support has been provided and so omit the
21362simulator library (@file{libsim.a)} from the linker command line.
21363
21364@item -mstack-increment=@var{size}
21365@opindex mstack-increment
21366Set the maximum amount for a single stack increment operation.  Large
21367values can increase the speed of programs that contain functions
21368that need a large amount of stack space, but they can also trigger a
21369segmentation fault if the stack is extended too much.  The default
21370value is 0x1000.
21371
21372@end table
21373
21374@node MeP Options
21375@subsection MeP Options
21376@cindex MeP options
21377
21378@table @gcctabopt
21379
21380@item -mabsdiff
21381@opindex mabsdiff
21382Enables the @code{abs} instruction, which is the absolute difference
21383between two registers.
21384
21385@item -mall-opts
21386@opindex mall-opts
21387Enables all the optional instructions---average, multiply, divide, bit
21388operations, leading zero, absolute difference, min/max, clip, and
21389saturation.
21390
21391
21392@item -maverage
21393@opindex maverage
21394Enables the @code{ave} instruction, which computes the average of two
21395registers.
21396
21397@item -mbased=@var{n}
21398@opindex mbased=
21399Variables of size @var{n} bytes or smaller are placed in the
21400@code{.based} section by default.  Based variables use the @code{$tp}
21401register as a base register, and there is a 128-byte limit to the
21402@code{.based} section.
21403
21404@item -mbitops
21405@opindex mbitops
21406Enables the bit operation instructions---bit test (@code{btstm}), set
21407(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21408test-and-set (@code{tas}).
21409
21410@item -mc=@var{name}
21411@opindex mc=
21412Selects which section constant data is placed in.  @var{name} may
21413be @samp{tiny}, @samp{near}, or @samp{far}.
21414
21415@item -mclip
21416@opindex mclip
21417Enables the @code{clip} instruction.  Note that @option{-mclip} is not
21418useful unless you also provide @option{-mminmax}.
21419
21420@item -mconfig=@var{name}
21421@opindex mconfig=
21422Selects one of the built-in core configurations.  Each MeP chip has
21423one or more modules in it; each module has a core CPU and a variety of
21424coprocessors, optional instructions, and peripherals.  The
21425@code{MeP-Integrator} tool, not part of GCC, provides these
21426configurations through this option; using this option is the same as
21427using all the corresponding command-line options.  The default
21428configuration is @samp{default}.
21429
21430@item -mcop
21431@opindex mcop
21432Enables the coprocessor instructions.  By default, this is a 32-bit
21433coprocessor.  Note that the coprocessor is normally enabled via the
21434@option{-mconfig=} option.
21435
21436@item -mcop32
21437@opindex mcop32
21438Enables the 32-bit coprocessor's instructions.
21439
21440@item -mcop64
21441@opindex mcop64
21442Enables the 64-bit coprocessor's instructions.
21443
21444@item -mivc2
21445@opindex mivc2
21446Enables IVC2 scheduling.  IVC2 is a 64-bit VLIW coprocessor.
21447
21448@item -mdc
21449@opindex mdc
21450Causes constant variables to be placed in the @code{.near} section.
21451
21452@item -mdiv
21453@opindex mdiv
21454Enables the @code{div} and @code{divu} instructions.
21455
21456@item -meb
21457@opindex meb
21458Generate big-endian code.
21459
21460@item -mel
21461@opindex mel
21462Generate little-endian code.
21463
21464@item -mio-volatile
21465@opindex mio-volatile
21466Tells the compiler that any variable marked with the @code{io}
21467attribute is to be considered volatile.
21468
21469@item -ml
21470@opindex ml
21471Causes variables to be assigned to the @code{.far} section by default.
21472
21473@item -mleadz
21474@opindex mleadz
21475Enables the @code{leadz} (leading zero) instruction.
21476
21477@item -mm
21478@opindex mm
21479Causes variables to be assigned to the @code{.near} section by default.
21480
21481@item -mminmax
21482@opindex mminmax
21483Enables the @code{min} and @code{max} instructions.
21484
21485@item -mmult
21486@opindex mmult
21487Enables the multiplication and multiply-accumulate instructions.
21488
21489@item -mno-opts
21490@opindex mno-opts
21491Disables all the optional instructions enabled by @option{-mall-opts}.
21492
21493@item -mrepeat
21494@opindex mrepeat
21495Enables the @code{repeat} and @code{erepeat} instructions, used for
21496low-overhead looping.
21497
21498@item -ms
21499@opindex ms
21500Causes all variables to default to the @code{.tiny} section.  Note
21501that there is a 65536-byte limit to this section.  Accesses to these
21502variables use the @code{%gp} base register.
21503
21504@item -msatur
21505@opindex msatur
21506Enables the saturation instructions.  Note that the compiler does not
21507currently generate these itself, but this option is included for
21508compatibility with other tools, like @code{as}.
21509
21510@item -msdram
21511@opindex msdram
21512Link the SDRAM-based runtime instead of the default ROM-based runtime.
21513
21514@item -msim
21515@opindex msim
21516Link the simulator run-time libraries.
21517
21518@item -msimnovec
21519@opindex msimnovec
21520Link the simulator runtime libraries, excluding built-in support
21521for reset and exception vectors and tables.
21522
21523@item -mtf
21524@opindex mtf
21525Causes all functions to default to the @code{.far} section.  Without
21526this option, functions default to the @code{.near} section.
21527
21528@item -mtiny=@var{n}
21529@opindex mtiny=
21530Variables that are @var{n} bytes or smaller are allocated to the
21531@code{.tiny} section.  These variables use the @code{$gp} base
21532register.  The default for this option is 4, but note that there's a
2153365536-byte limit to the @code{.tiny} section.
21534
21535@end table
21536
21537@node MicroBlaze Options
21538@subsection MicroBlaze Options
21539@cindex MicroBlaze Options
21540
21541@table @gcctabopt
21542
21543@item -msoft-float
21544@opindex msoft-float
21545Use software emulation for floating point (default).
21546
21547@item -mhard-float
21548@opindex mhard-float
21549Use hardware floating-point instructions.
21550
21551@item -mmemcpy
21552@opindex mmemcpy
21553Do not optimize block moves, use @code{memcpy}.
21554
21555@item -mno-clearbss
21556@opindex mno-clearbss
21557This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
21558
21559@item -mcpu=@var{cpu-type}
21560@opindex mcpu=
21561Use features of, and schedule code for, the given CPU.
21562Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21563where @var{X} is a major version, @var{YY} is the minor version, and
21564@var{Z} is compatibility code.  Example values are @samp{v3.00.a},
21565@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21566
21567@item -mxl-soft-mul
21568@opindex mxl-soft-mul
21569Use software multiply emulation (default).
21570
21571@item -mxl-soft-div
21572@opindex mxl-soft-div
21573Use software emulation for divides (default).
21574
21575@item -mxl-barrel-shift
21576@opindex mxl-barrel-shift
21577Use the hardware barrel shifter.
21578
21579@item -mxl-pattern-compare
21580@opindex mxl-pattern-compare
21581Use pattern compare instructions.
21582
21583@item -msmall-divides
21584@opindex msmall-divides
21585Use table lookup optimization for small signed integer divisions.
21586
21587@item -mxl-stack-check
21588@opindex mxl-stack-check
21589This option is deprecated.  Use @option{-fstack-check} instead.
21590
21591@item -mxl-gp-opt
21592@opindex mxl-gp-opt
21593Use GP-relative @code{.sdata}/@code{.sbss} sections.
21594
21595@item -mxl-multiply-high
21596@opindex mxl-multiply-high
21597Use multiply high instructions for high part of 32x32 multiply.
21598
21599@item -mxl-float-convert
21600@opindex mxl-float-convert
21601Use hardware floating-point conversion instructions.
21602
21603@item -mxl-float-sqrt
21604@opindex mxl-float-sqrt
21605Use hardware floating-point square root instruction.
21606
21607@item -mbig-endian
21608@opindex mbig-endian
21609Generate code for a big-endian target.
21610
21611@item -mlittle-endian
21612@opindex mlittle-endian
21613Generate code for a little-endian target.
21614
21615@item -mxl-reorder
21616@opindex mxl-reorder
21617Use reorder instructions (swap and byte reversed load/store).
21618
21619@item -mxl-mode-@var{app-model}
21620Select application model @var{app-model}.  Valid models are
21621@table @samp
21622@item executable
21623normal executable (default), uses startup code @file{crt0.o}.
21624
21625@item -mpic-data-is-text-relative
21626@opindex mpic-data-is-text-relative
21627Assume that the displacement between the text and data segments is fixed
21628at static link time.  This allows data to be referenced by offset from start of
21629text address instead of GOT since PC-relative addressing is not supported.
21630
21631@item xmdstub
21632for use with Xilinx Microprocessor Debugger (XMD) based
21633software intrusive debug agent called xmdstub. This uses startup file
21634@file{crt1.o} and sets the start address of the program to 0x800.
21635
21636@item bootstrap
21637for applications that are loaded using a bootloader.
21638This model uses startup file @file{crt2.o} which does not contain a processor
21639reset vector handler. This is suitable for transferring control on a
21640processor reset to the bootloader rather than the application.
21641
21642@item novectors
21643for applications that do not require any of the
21644MicroBlaze vectors. This option may be useful for applications running
21645within a monitoring application. This model uses @file{crt3.o} as a startup file.
21646@end table
21647
21648Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21649@option{-mxl-mode-@var{app-model}}.
21650
21651@end table
21652
21653@node MIPS Options
21654@subsection MIPS Options
21655@cindex MIPS options
21656
21657@table @gcctabopt
21658
21659@item -EB
21660@opindex EB
21661Generate big-endian code.
21662
21663@item -EL
21664@opindex EL
21665Generate little-endian code.  This is the default for @samp{mips*el-*-*}
21666configurations.
21667
21668@item -march=@var{arch}
21669@opindex march
21670Generate code that runs on @var{arch}, which can be the name of a
21671generic MIPS ISA, or the name of a particular processor.
21672The ISA names are:
21673@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21674@samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21675@samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21676@samp{mips64r5} and @samp{mips64r6}.
21677The processor names are:
21678@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21679@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21680@samp{5kc}, @samp{5kf},
21681@samp{20kc},
21682@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21683@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21684@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21685@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21686@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21687@samp{i6400}, @samp{i6500},
21688@samp{interaptiv},
21689@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21690@samp{gs464e}, @samp{gs264e},
21691@samp{m4k},
21692@samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21693@samp{m5100}, @samp{m5101},
21694@samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21695@samp{orion},
21696@samp{p5600}, @samp{p6600},
21697@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21698@samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21699@samp{r6000}, @samp{r8000},
21700@samp{rm7000}, @samp{rm9000},
21701@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21702@samp{sb1},
21703@samp{sr71000},
21704@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21705@samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21706@samp{xlr} and @samp{xlp}.
21707The special value @samp{from-abi} selects the
21708most compatible architecture for the selected ABI (that is,
21709@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21710
21711The native Linux/GNU toolchain also supports the value @samp{native},
21712which selects the best architecture option for the host processor.
21713@option{-march=native} has no effect if GCC does not recognize
21714the processor.
21715
21716In processor names, a final @samp{000} can be abbreviated as @samp{k}
21717(for example, @option{-march=r2k}).  Prefixes are optional, and
21718@samp{vr} may be written @samp{r}.
21719
21720Names of the form @samp{@var{n}f2_1} refer to processors with
21721FPUs clocked at half the rate of the core, names of the form
21722@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21723rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21724processors with FPUs clocked a ratio of 3:2 with respect to the core.
21725For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21726for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21727accepted as synonyms for @samp{@var{n}f1_1}.
21728
21729GCC defines two macros based on the value of this option.  The first
21730is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21731a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
21732where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21733For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21734to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21735
21736Note that the @code{_MIPS_ARCH} macro uses the processor names given
21737above.  In other words, it has the full prefix and does not
21738abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
21739the macro names the resolved architecture (either @code{"mips1"} or
21740@code{"mips3"}).  It names the default architecture when no
21741@option{-march} option is given.
21742
21743@item -mtune=@var{arch}
21744@opindex mtune
21745Optimize for @var{arch}.  Among other things, this option controls
21746the way instructions are scheduled, and the perceived cost of arithmetic
21747operations.  The list of @var{arch} values is the same as for
21748@option{-march}.
21749
21750When this option is not used, GCC optimizes for the processor
21751specified by @option{-march}.  By using @option{-march} and
21752@option{-mtune} together, it is possible to generate code that
21753runs on a family of processors, but optimize the code for one
21754particular member of that family.
21755
21756@option{-mtune} defines the macros @code{_MIPS_TUNE} and
21757@code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21758@option{-march} ones described above.
21759
21760@item -mips1
21761@opindex mips1
21762Equivalent to @option{-march=mips1}.
21763
21764@item -mips2
21765@opindex mips2
21766Equivalent to @option{-march=mips2}.
21767
21768@item -mips3
21769@opindex mips3
21770Equivalent to @option{-march=mips3}.
21771
21772@item -mips4
21773@opindex mips4
21774Equivalent to @option{-march=mips4}.
21775
21776@item -mips32
21777@opindex mips32
21778Equivalent to @option{-march=mips32}.
21779
21780@item -mips32r3
21781@opindex mips32r3
21782Equivalent to @option{-march=mips32r3}.
21783
21784@item -mips32r5
21785@opindex mips32r5
21786Equivalent to @option{-march=mips32r5}.
21787
21788@item -mips32r6
21789@opindex mips32r6
21790Equivalent to @option{-march=mips32r6}.
21791
21792@item -mips64
21793@opindex mips64
21794Equivalent to @option{-march=mips64}.
21795
21796@item -mips64r2
21797@opindex mips64r2
21798Equivalent to @option{-march=mips64r2}.
21799
21800@item -mips64r3
21801@opindex mips64r3
21802Equivalent to @option{-march=mips64r3}.
21803
21804@item -mips64r5
21805@opindex mips64r5
21806Equivalent to @option{-march=mips64r5}.
21807
21808@item -mips64r6
21809@opindex mips64r6
21810Equivalent to @option{-march=mips64r6}.
21811
21812@item -mips16
21813@itemx -mno-mips16
21814@opindex mips16
21815@opindex mno-mips16
21816Generate (do not generate) MIPS16 code.  If GCC is targeting a
21817MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21818
21819MIPS16 code generation can also be controlled on a per-function basis
21820by means of @code{mips16} and @code{nomips16} attributes.
21821@xref{Function Attributes}, for more information.
21822
21823@item -mflip-mips16
21824@opindex mflip-mips16
21825Generate MIPS16 code on alternating functions.  This option is provided
21826for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21827not intended for ordinary use in compiling user code.
21828
21829@item -minterlink-compressed
21830@itemx -mno-interlink-compressed
21831@opindex minterlink-compressed
21832@opindex mno-interlink-compressed
21833Require (do not require) that code using the standard (uncompressed) MIPS ISA
21834be link-compatible with MIPS16 and microMIPS code, and vice versa.
21835
21836For example, code using the standard ISA encoding cannot jump directly
21837to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21838@option{-minterlink-compressed} therefore disables direct jumps unless GCC
21839knows that the target of the jump is not compressed.
21840
21841@item -minterlink-mips16
21842@itemx -mno-interlink-mips16
21843@opindex minterlink-mips16
21844@opindex mno-interlink-mips16
21845Aliases of @option{-minterlink-compressed} and
21846@option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
21847and are retained for backwards compatibility.
21848
21849@item -mabi=32
21850@itemx -mabi=o64
21851@itemx -mabi=n32
21852@itemx -mabi=64
21853@itemx -mabi=eabi
21854@opindex mabi=32
21855@opindex mabi=o64
21856@opindex mabi=n32
21857@opindex mabi=64
21858@opindex mabi=eabi
21859Generate code for the given ABI@.
21860
21861Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
21862generates 64-bit code when you select a 64-bit architecture, but you
21863can use @option{-mgp32} to get 32-bit code instead.
21864
21865For information about the O64 ABI, see
21866@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21867
21868GCC supports a variant of the o32 ABI in which floating-point registers
21869are 64 rather than 32 bits wide.  You can select this combination with
21870@option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
21871and @code{mfhc1} instructions and is therefore only supported for
21872MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21873
21874The register assignments for arguments and return values remain the
21875same, but each scalar value is passed in a single 64-bit register
21876rather than a pair of 32-bit registers.  For example, scalar
21877floating-point values are returned in @samp{$f0} only, not a
21878@samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
21879remains the same in that the even-numbered double-precision registers
21880are saved.
21881
21882Two additional variants of the o32 ABI are supported to enable
21883a transition from 32-bit to 64-bit registers.  These are FPXX
21884(@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21885The FPXX extension mandates that all code must execute correctly
21886when run using 32-bit or 64-bit registers.  The code can be interlinked
21887with either FP32 or FP64, but not both.
21888The FP64A extension is similar to the FP64 extension but forbids the
21889use of odd-numbered single-precision registers.  This can be used
21890in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21891processors and allows both FP32 and FP64A code to interlink and
21892run in the same process without changing FPU modes.
21893
21894@item -mabicalls
21895@itemx -mno-abicalls
21896@opindex mabicalls
21897@opindex mno-abicalls
21898Generate (do not generate) code that is suitable for SVR4-style
21899dynamic objects.  @option{-mabicalls} is the default for SVR4-based
21900systems.
21901
21902@item -mshared
21903@itemx -mno-shared
21904Generate (do not generate) code that is fully position-independent,
21905and that can therefore be linked into shared libraries.  This option
21906only affects @option{-mabicalls}.
21907
21908All @option{-mabicalls} code has traditionally been position-independent,
21909regardless of options like @option{-fPIC} and @option{-fpic}.  However,
21910as an extension, the GNU toolchain allows executables to use absolute
21911accesses for locally-binding symbols.  It can also use shorter GP
21912initialization sequences and generate direct calls to locally-defined
21913functions.  This mode is selected by @option{-mno-shared}.
21914
21915@option{-mno-shared} depends on binutils 2.16 or higher and generates
21916objects that can only be linked by the GNU linker.  However, the option
21917does not affect the ABI of the final executable; it only affects the ABI
21918of relocatable objects.  Using @option{-mno-shared} generally makes
21919executables both smaller and quicker.
21920
21921@option{-mshared} is the default.
21922
21923@item -mplt
21924@itemx -mno-plt
21925@opindex mplt
21926@opindex mno-plt
21927Assume (do not assume) that the static and dynamic linkers
21928support PLTs and copy relocations.  This option only affects
21929@option{-mno-shared -mabicalls}.  For the n64 ABI, this option
21930has no effect without @option{-msym32}.
21931
21932You can make @option{-mplt} the default by configuring
21933GCC with @option{--with-mips-plt}.  The default is
21934@option{-mno-plt} otherwise.
21935
21936@item -mxgot
21937@itemx -mno-xgot
21938@opindex mxgot
21939@opindex mno-xgot
21940Lift (do not lift) the usual restrictions on the size of the global
21941offset table.
21942
21943GCC normally uses a single instruction to load values from the GOT@.
21944While this is relatively efficient, it only works if the GOT
21945is smaller than about 64k.  Anything larger causes the linker
21946to report an error such as:
21947
21948@cindex relocation truncated to fit (MIPS)
21949@smallexample
21950relocation truncated to fit: R_MIPS_GOT16 foobar
21951@end smallexample
21952
21953If this happens, you should recompile your code with @option{-mxgot}.
21954This works with very large GOTs, although the code is also
21955less efficient, since it takes three instructions to fetch the
21956value of a global symbol.
21957
21958Note that some linkers can create multiple GOTs.  If you have such a
21959linker, you should only need to use @option{-mxgot} when a single object
21960file accesses more than 64k's worth of GOT entries.  Very few do.
21961
21962These options have no effect unless GCC is generating position
21963independent code.
21964
21965@item -mgp32
21966@opindex mgp32
21967Assume that general-purpose registers are 32 bits wide.
21968
21969@item -mgp64
21970@opindex mgp64
21971Assume that general-purpose registers are 64 bits wide.
21972
21973@item -mfp32
21974@opindex mfp32
21975Assume that floating-point registers are 32 bits wide.
21976
21977@item -mfp64
21978@opindex mfp64
21979Assume that floating-point registers are 64 bits wide.
21980
21981@item -mfpxx
21982@opindex mfpxx
21983Do not assume the width of floating-point registers.
21984
21985@item -mhard-float
21986@opindex mhard-float
21987Use floating-point coprocessor instructions.
21988
21989@item -msoft-float
21990@opindex msoft-float
21991Do not use floating-point coprocessor instructions.  Implement
21992floating-point calculations using library calls instead.
21993
21994@item -mno-float
21995@opindex mno-float
21996Equivalent to @option{-msoft-float}, but additionally asserts that the
21997program being compiled does not perform any floating-point operations.
21998This option is presently supported only by some bare-metal MIPS
21999configurations, where it may select a special set of libraries
22000that lack all floating-point support (including, for example, the
22001floating-point @code{printf} formats).
22002If code compiled with @option{-mno-float} accidentally contains
22003floating-point operations, it is likely to suffer a link-time
22004or run-time failure.
22005
22006@item -msingle-float
22007@opindex msingle-float
22008Assume that the floating-point coprocessor only supports single-precision
22009operations.
22010
22011@item -mdouble-float
22012@opindex mdouble-float
22013Assume that the floating-point coprocessor supports double-precision
22014operations.  This is the default.
22015
22016@item -modd-spreg
22017@itemx -mno-odd-spreg
22018@opindex modd-spreg
22019@opindex mno-odd-spreg
22020Enable the use of odd-numbered single-precision floating-point registers
22021for the o32 ABI.  This is the default for processors that are known to
22022support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22023is set by default.
22024
22025@item -mabs=2008
22026@itemx -mabs=legacy
22027@opindex mabs=2008
22028@opindex mabs=legacy
22029These options control the treatment of the special not-a-number (NaN)
22030IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22031@code{neg.@i{fmt}} machine instructions.
22032
22033By default or when @option{-mabs=legacy} is used the legacy
22034treatment is selected.  In this case these instructions are considered
22035arithmetic and avoided where correct operation is required and the
22036input operand might be a NaN.  A longer sequence of instructions that
22037manipulate the sign bit of floating-point datum manually is used
22038instead unless the @option{-ffinite-math-only} option has also been
22039specified.
22040
22041The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
22042this case these instructions are considered non-arithmetic and therefore
22043operating correctly in all cases, including in particular where the
22044input operand is a NaN.  These instructions are therefore always used
22045for the respective operations.
22046
22047@item -mnan=2008
22048@itemx -mnan=legacy
22049@opindex mnan=2008
22050@opindex mnan=legacy
22051These options control the encoding of the special not-a-number (NaN)
22052IEEE 754 floating-point data.
22053
22054The @option{-mnan=legacy} option selects the legacy encoding.  In this
22055case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22056significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22057by the first bit of their trailing significand field being 1.
22058
22059The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
22060this case qNaNs are denoted by the first bit of their trailing
22061significand field being 1, whereas sNaNs are denoted by the first bit of
22062their trailing significand field being 0.
22063
22064The default is @option{-mnan=legacy} unless GCC has been configured with
22065@option{--with-nan=2008}.
22066
22067@item -mllsc
22068@itemx -mno-llsc
22069@opindex mllsc
22070@opindex mno-llsc
22071Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22072implement atomic memory built-in functions.  When neither option is
22073specified, GCC uses the instructions if the target architecture
22074supports them.
22075
22076@option{-mllsc} is useful if the runtime environment can emulate the
22077instructions and @option{-mno-llsc} can be useful when compiling for
22078nonstandard ISAs.  You can make either option the default by
22079configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22080respectively.  @option{--with-llsc} is the default for some
22081configurations; see the installation documentation for details.
22082
22083@item -mdsp
22084@itemx -mno-dsp
22085@opindex mdsp
22086@opindex mno-dsp
22087Use (do not use) revision 1 of the MIPS DSP ASE@.
22088@xref{MIPS DSP Built-in Functions}.  This option defines the
22089preprocessor macro @code{__mips_dsp}.  It also defines
22090@code{__mips_dsp_rev} to 1.
22091
22092@item -mdspr2
22093@itemx -mno-dspr2
22094@opindex mdspr2
22095@opindex mno-dspr2
22096Use (do not use) revision 2 of the MIPS DSP ASE@.
22097@xref{MIPS DSP Built-in Functions}.  This option defines the
22098preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22099It also defines @code{__mips_dsp_rev} to 2.
22100
22101@item -msmartmips
22102@itemx -mno-smartmips
22103@opindex msmartmips
22104@opindex mno-smartmips
22105Use (do not use) the MIPS SmartMIPS ASE.
22106
22107@item -mpaired-single
22108@itemx -mno-paired-single
22109@opindex mpaired-single
22110@opindex mno-paired-single
22111Use (do not use) paired-single floating-point instructions.
22112@xref{MIPS Paired-Single Support}.  This option requires
22113hardware floating-point support to be enabled.
22114
22115@item -mdmx
22116@itemx -mno-mdmx
22117@opindex mdmx
22118@opindex mno-mdmx
22119Use (do not use) MIPS Digital Media Extension instructions.
22120This option can only be used when generating 64-bit code and requires
22121hardware floating-point support to be enabled.
22122
22123@item -mips3d
22124@itemx -mno-mips3d
22125@opindex mips3d
22126@opindex mno-mips3d
22127Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
22128The option @option{-mips3d} implies @option{-mpaired-single}.
22129
22130@item -mmicromips
22131@itemx -mno-micromips
22132@opindex mmicromips
22133@opindex mno-mmicromips
22134Generate (do not generate) microMIPS code.
22135
22136MicroMIPS code generation can also be controlled on a per-function basis
22137by means of @code{micromips} and @code{nomicromips} attributes.
22138@xref{Function Attributes}, for more information.
22139
22140@item -mmt
22141@itemx -mno-mt
22142@opindex mmt
22143@opindex mno-mt
22144Use (do not use) MT Multithreading instructions.
22145
22146@item -mmcu
22147@itemx -mno-mcu
22148@opindex mmcu
22149@opindex mno-mcu
22150Use (do not use) the MIPS MCU ASE instructions.
22151
22152@item -meva
22153@itemx -mno-eva
22154@opindex meva
22155@opindex mno-eva
22156Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22157
22158@item -mvirt
22159@itemx -mno-virt
22160@opindex mvirt
22161@opindex mno-virt
22162Use (do not use) the MIPS Virtualization (VZ) instructions.
22163
22164@item -mxpa
22165@itemx -mno-xpa
22166@opindex mxpa
22167@opindex mno-xpa
22168Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22169
22170@item -mcrc
22171@itemx -mno-crc
22172@opindex mcrc
22173@opindex mno-crc
22174Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22175
22176@item -mginv
22177@itemx -mno-ginv
22178@opindex mginv
22179@opindex mno-ginv
22180Use (do not use) the MIPS Global INValidate (GINV) instructions.
22181
22182@item -mloongson-mmi
22183@itemx -mno-loongson-mmi
22184@opindex mloongson-mmi
22185@opindex mno-loongson-mmi
22186Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22187
22188@item -mloongson-ext
22189@itemx -mno-loongson-ext
22190@opindex mloongson-ext
22191@opindex mno-loongson-ext
22192Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22193
22194@item -mloongson-ext2
22195@itemx -mno-loongson-ext2
22196@opindex mloongson-ext2
22197@opindex mno-loongson-ext2
22198Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22199
22200@item -mlong64
22201@opindex mlong64
22202Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
22203an explanation of the default and the way that the pointer size is
22204determined.
22205
22206@item -mlong32
22207@opindex mlong32
22208Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22209
22210The default size of @code{int}s, @code{long}s and pointers depends on
22211the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
22212uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
2221332-bit @code{long}s.  Pointers are the same size as @code{long}s,
22214or the same size as integer registers, whichever is smaller.
22215
22216@item -msym32
22217@itemx -mno-sym32
22218@opindex msym32
22219@opindex mno-sym32
22220Assume (do not assume) that all symbols have 32-bit values, regardless
22221of the selected ABI@.  This option is useful in combination with
22222@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22223to generate shorter and faster references to symbolic addresses.
22224
22225@item -G @var{num}
22226@opindex G
22227Put definitions of externally-visible data in a small data section
22228if that data is no bigger than @var{num} bytes.  GCC can then generate
22229more efficient accesses to the data; see @option{-mgpopt} for details.
22230
22231The default @option{-G} option depends on the configuration.
22232
22233@item -mlocal-sdata
22234@itemx -mno-local-sdata
22235@opindex mlocal-sdata
22236@opindex mno-local-sdata
22237Extend (do not extend) the @option{-G} behavior to local data too,
22238such as to static variables in C@.  @option{-mlocal-sdata} is the
22239default for all configurations.
22240
22241If the linker complains that an application is using too much small data,
22242you might want to try rebuilding the less performance-critical parts with
22243@option{-mno-local-sdata}.  You might also want to build large
22244libraries with @option{-mno-local-sdata}, so that the libraries leave
22245more room for the main program.
22246
22247@item -mextern-sdata
22248@itemx -mno-extern-sdata
22249@opindex mextern-sdata
22250@opindex mno-extern-sdata
22251Assume (do not assume) that externally-defined data is in
22252a small data section if the size of that data is within the @option{-G} limit.
22253@option{-mextern-sdata} is the default for all configurations.
22254
22255If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22256@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22257that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22258is placed in a small data section.  If @var{Var} is defined by another
22259module, you must either compile that module with a high-enough
22260@option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22261definition.  If @var{Var} is common, you must link the application
22262with a high-enough @option{-G} setting.
22263
22264The easiest way of satisfying these restrictions is to compile
22265and link every module with the same @option{-G} option.  However,
22266you may wish to build a library that supports several different
22267small data limits.  You can do this by compiling the library with
22268the highest supported @option{-G} setting and additionally using
22269@option{-mno-extern-sdata} to stop the library from making assumptions
22270about externally-defined data.
22271
22272@item -mgpopt
22273@itemx -mno-gpopt
22274@opindex mgpopt
22275@opindex mno-gpopt
22276Use (do not use) GP-relative accesses for symbols that are known to be
22277in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22278@option{-mextern-sdata}.  @option{-mgpopt} is the default for all
22279configurations.
22280
22281@option{-mno-gpopt} is useful for cases where the @code{$gp} register
22282might not hold the value of @code{_gp}.  For example, if the code is
22283part of a library that might be used in a boot monitor, programs that
22284call boot monitor routines pass an unknown value in @code{$gp}.
22285(In such situations, the boot monitor itself is usually compiled
22286with @option{-G0}.)
22287
22288@option{-mno-gpopt} implies @option{-mno-local-sdata} and
22289@option{-mno-extern-sdata}.
22290
22291@item -membedded-data
22292@itemx -mno-embedded-data
22293@opindex membedded-data
22294@opindex mno-embedded-data
22295Allocate variables to the read-only data section first if possible, then
22296next in the small data section if possible, otherwise in data.  This gives
22297slightly slower code than the default, but reduces the amount of RAM required
22298when executing, and thus may be preferred for some embedded systems.
22299
22300@item -muninit-const-in-rodata
22301@itemx -mno-uninit-const-in-rodata
22302@opindex muninit-const-in-rodata
22303@opindex mno-uninit-const-in-rodata
22304Put uninitialized @code{const} variables in the read-only data section.
22305This option is only meaningful in conjunction with @option{-membedded-data}.
22306
22307@item -mcode-readable=@var{setting}
22308@opindex mcode-readable
22309Specify whether GCC may generate code that reads from executable sections.
22310There are three possible settings:
22311
22312@table @gcctabopt
22313@item -mcode-readable=yes
22314Instructions may freely access executable sections.  This is the
22315default setting.
22316
22317@item -mcode-readable=pcrel
22318MIPS16 PC-relative load instructions can access executable sections,
22319but other instructions must not do so.  This option is useful on 4KSc
22320and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22321It is also useful on processors that can be configured to have a dual
22322instruction/data SRAM interface and that, like the M4K, automatically
22323redirect PC-relative loads to the instruction RAM.
22324
22325@item -mcode-readable=no
22326Instructions must not access executable sections.  This option can be
22327useful on targets that are configured to have a dual instruction/data
22328SRAM interface but that (unlike the M4K) do not automatically redirect
22329PC-relative loads to the instruction RAM.
22330@end table
22331
22332@item -msplit-addresses
22333@itemx -mno-split-addresses
22334@opindex msplit-addresses
22335@opindex mno-split-addresses
22336Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22337relocation operators.  This option has been superseded by
22338@option{-mexplicit-relocs} but is retained for backwards compatibility.
22339
22340@item -mexplicit-relocs
22341@itemx -mno-explicit-relocs
22342@opindex mexplicit-relocs
22343@opindex mno-explicit-relocs
22344Use (do not use) assembler relocation operators when dealing with symbolic
22345addresses.  The alternative, selected by @option{-mno-explicit-relocs},
22346is to use assembler macros instead.
22347
22348@option{-mexplicit-relocs} is the default if GCC was configured
22349to use an assembler that supports relocation operators.
22350
22351@item -mcheck-zero-division
22352@itemx -mno-check-zero-division
22353@opindex mcheck-zero-division
22354@opindex mno-check-zero-division
22355Trap (do not trap) on integer division by zero.
22356
22357The default is @option{-mcheck-zero-division}.
22358
22359@item -mdivide-traps
22360@itemx -mdivide-breaks
22361@opindex mdivide-traps
22362@opindex mdivide-breaks
22363MIPS systems check for division by zero by generating either a
22364conditional trap or a break instruction.  Using traps results in
22365smaller code, but is only supported on MIPS II and later.  Also, some
22366versions of the Linux kernel have a bug that prevents trap from
22367generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
22368allow conditional traps on architectures that support them and
22369@option{-mdivide-breaks} to force the use of breaks.
22370
22371The default is usually @option{-mdivide-traps}, but this can be
22372overridden at configure time using @option{--with-divide=breaks}.
22373Divide-by-zero checks can be completely disabled using
22374@option{-mno-check-zero-division}.
22375
22376@item -mload-store-pairs
22377@itemx -mno-load-store-pairs
22378@opindex mload-store-pairs
22379@opindex mno-load-store-pairs
22380Enable (disable) an optimization that pairs consecutive load or store
22381instructions to enable load/store bonding.  This option is enabled by
22382default but only takes effect when the selected architecture is known
22383to support bonding.
22384
22385@item -mmemcpy
22386@itemx -mno-memcpy
22387@opindex mmemcpy
22388@opindex mno-memcpy
22389Force (do not force) the use of @code{memcpy} for non-trivial block
22390moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
22391most constant-sized copies.
22392
22393@item -mlong-calls
22394@itemx -mno-long-calls
22395@opindex mlong-calls
22396@opindex mno-long-calls
22397Disable (do not disable) use of the @code{jal} instruction.  Calling
22398functions using @code{jal} is more efficient but requires the caller
22399and callee to be in the same 256 megabyte segment.
22400
22401This option has no effect on abicalls code.  The default is
22402@option{-mno-long-calls}.
22403
22404@item -mmad
22405@itemx -mno-mad
22406@opindex mmad
22407@opindex mno-mad
22408Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22409instructions, as provided by the R4650 ISA@.
22410
22411@item -mimadd
22412@itemx -mno-imadd
22413@opindex mimadd
22414@opindex mno-imadd
22415Enable (disable) use of the @code{madd} and @code{msub} integer
22416instructions.  The default is @option{-mimadd} on architectures
22417that support @code{madd} and @code{msub} except for the 74k
22418architecture where it was found to generate slower code.
22419
22420@item -mfused-madd
22421@itemx -mno-fused-madd
22422@opindex mfused-madd
22423@opindex mno-fused-madd
22424Enable (disable) use of the floating-point multiply-accumulate
22425instructions, when they are available.  The default is
22426@option{-mfused-madd}.
22427
22428On the R8000 CPU when multiply-accumulate instructions are used,
22429the intermediate product is calculated to infinite precision
22430and is not subject to the FCSR Flush to Zero bit.  This may be
22431undesirable in some circumstances.  On other processors the result
22432is numerically identical to the equivalent computation using
22433separate multiply, add, subtract and negate instructions.
22434
22435@item -nocpp
22436@opindex nocpp
22437Tell the MIPS assembler to not run its preprocessor over user
22438assembler files (with a @samp{.s} suffix) when assembling them.
22439
22440@item -mfix-24k
22441@itemx -mno-fix-24k
22442@opindex mfix-24k
22443@opindex mno-fix-24k
22444Work around the 24K E48 (lost data on stores during refill) errata.
22445The workarounds are implemented by the assembler rather than by GCC@.
22446
22447@item -mfix-r4000
22448@itemx -mno-fix-r4000
22449@opindex mfix-r4000
22450@opindex mno-fix-r4000
22451Work around certain R4000 CPU errata:
22452@itemize @minus
22453@item
22454A double-word or a variable shift may give an incorrect result if executed
22455immediately after starting an integer division.
22456@item
22457A double-word or a variable shift may give an incorrect result if executed
22458while an integer multiplication is in progress.
22459@item
22460An integer division may give an incorrect result if started in a delay slot
22461of a taken branch or a jump.
22462@end itemize
22463
22464@item -mfix-r4400
22465@itemx -mno-fix-r4400
22466@opindex mfix-r4400
22467@opindex mno-fix-r4400
22468Work around certain R4400 CPU errata:
22469@itemize @minus
22470@item
22471A double-word or a variable shift may give an incorrect result if executed
22472immediately after starting an integer division.
22473@end itemize
22474
22475@item -mfix-r10000
22476@itemx -mno-fix-r10000
22477@opindex mfix-r10000
22478@opindex mno-fix-r10000
22479Work around certain R10000 errata:
22480@itemize @minus
22481@item
22482@code{ll}/@code{sc} sequences may not behave atomically on revisions
22483prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
22484@end itemize
22485
22486This option can only be used if the target architecture supports
22487branch-likely instructions.  @option{-mfix-r10000} is the default when
22488@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22489otherwise.
22490
22491@item -mfix-r5900
22492@itemx -mno-fix-r5900
22493@opindex mfix-r5900
22494Do not attempt to schedule the preceding instruction into the delay slot
22495of a branch instruction placed at the end of a short loop of six
22496instructions or fewer and always schedule a @code{nop} instruction there
22497instead.  The short loop bug under certain conditions causes loops to
22498execute only once or twice, due to a hardware bug in the R5900 chip.  The
22499workaround is implemented by the assembler rather than by GCC@.
22500
22501@item -mfix-rm7000
22502@itemx -mno-fix-rm7000
22503@opindex mfix-rm7000
22504Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
22505workarounds are implemented by the assembler rather than by GCC@.
22506
22507@item -mfix-vr4120
22508@itemx -mno-fix-vr4120
22509@opindex mfix-vr4120
22510Work around certain VR4120 errata:
22511@itemize @minus
22512@item
22513@code{dmultu} does not always produce the correct result.
22514@item
22515@code{div} and @code{ddiv} do not always produce the correct result if one
22516of the operands is negative.
22517@end itemize
22518The workarounds for the division errata rely on special functions in
22519@file{libgcc.a}.  At present, these functions are only provided by
22520the @code{mips64vr*-elf} configurations.
22521
22522Other VR4120 errata require a NOP to be inserted between certain pairs of
22523instructions.  These errata are handled by the assembler, not by GCC itself.
22524
22525@item -mfix-vr4130
22526@opindex mfix-vr4130
22527Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
22528workarounds are implemented by the assembler rather than by GCC,
22529although GCC avoids using @code{mflo} and @code{mfhi} if the
22530VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22531instructions are available instead.
22532
22533@item -mfix-sb1
22534@itemx -mno-fix-sb1
22535@opindex mfix-sb1
22536Work around certain SB-1 CPU core errata.
22537(This flag currently works around the SB-1 revision 2
22538``F1'' and ``F2'' floating-point errata.)
22539
22540@item -mr10k-cache-barrier=@var{setting}
22541@opindex mr10k-cache-barrier
22542Specify whether GCC should insert cache barriers to avoid the
22543side effects of speculation on R10K processors.
22544
22545In common with many processors, the R10K tries to predict the outcome
22546of a conditional branch and speculatively executes instructions from
22547the ``taken'' branch.  It later aborts these instructions if the
22548predicted outcome is wrong.  However, on the R10K, even aborted
22549instructions can have side effects.
22550
22551This problem only affects kernel stores and, depending on the system,
22552kernel loads.  As an example, a speculatively-executed store may load
22553the target memory into cache and mark the cache line as dirty, even if
22554the store itself is later aborted.  If a DMA operation writes to the
22555same area of memory before the ``dirty'' line is flushed, the cached
22556data overwrites the DMA-ed data.  See the R10K processor manual
22557for a full description, including other potential problems.
22558
22559One workaround is to insert cache barrier instructions before every memory
22560access that might be speculatively executed and that might have side
22561effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
22562controls GCC's implementation of this workaround.  It assumes that
22563aborted accesses to any byte in the following regions does not have
22564side effects:
22565
22566@enumerate
22567@item
22568the memory occupied by the current function's stack frame;
22569
22570@item
22571the memory occupied by an incoming stack argument;
22572
22573@item
22574the memory occupied by an object with a link-time-constant address.
22575@end enumerate
22576
22577It is the kernel's responsibility to ensure that speculative
22578accesses to these regions are indeed safe.
22579
22580If the input program contains a function declaration such as:
22581
22582@smallexample
22583void foo (void);
22584@end smallexample
22585
22586then the implementation of @code{foo} must allow @code{j foo} and
22587@code{jal foo} to be executed speculatively.  GCC honors this
22588restriction for functions it compiles itself.  It expects non-GCC
22589functions (such as hand-written assembly code) to do the same.
22590
22591The option has three forms:
22592
22593@table @gcctabopt
22594@item -mr10k-cache-barrier=load-store
22595Insert a cache barrier before a load or store that might be
22596speculatively executed and that might have side effects even
22597if aborted.
22598
22599@item -mr10k-cache-barrier=store
22600Insert a cache barrier before a store that might be speculatively
22601executed and that might have side effects even if aborted.
22602
22603@item -mr10k-cache-barrier=none
22604Disable the insertion of cache barriers.  This is the default setting.
22605@end table
22606
22607@item -mflush-func=@var{func}
22608@itemx -mno-flush-func
22609@opindex mflush-func
22610Specifies the function to call to flush the I and D caches, or to not
22611call any such function.  If called, the function must take the same
22612arguments as the common @code{_flush_func}, that is, the address of the
22613memory range for which the cache is being flushed, the size of the
22614memory range, and the number 3 (to flush both caches).  The default
22615depends on the target GCC was configured for, but commonly is either
22616@code{_flush_func} or @code{__cpu_flush}.
22617
22618@item mbranch-cost=@var{num}
22619@opindex mbranch-cost
22620Set the cost of branches to roughly @var{num} ``simple'' instructions.
22621This cost is only a heuristic and is not guaranteed to produce
22622consistent results across releases.  A zero cost redundantly selects
22623the default, which is based on the @option{-mtune} setting.
22624
22625@item -mbranch-likely
22626@itemx -mno-branch-likely
22627@opindex mbranch-likely
22628@opindex mno-branch-likely
22629Enable or disable use of Branch Likely instructions, regardless of the
22630default for the selected architecture.  By default, Branch Likely
22631instructions may be generated if they are supported by the selected
22632architecture.  An exception is for the MIPS32 and MIPS64 architectures
22633and processors that implement those architectures; for those, Branch
22634Likely instructions are not be generated by default because the MIPS32
22635and MIPS64 architectures specifically deprecate their use.
22636
22637@item -mcompact-branches=never
22638@itemx -mcompact-branches=optimal
22639@itemx -mcompact-branches=always
22640@opindex mcompact-branches=never
22641@opindex mcompact-branches=optimal
22642@opindex mcompact-branches=always
22643These options control which form of branches will be generated.  The
22644default is @option{-mcompact-branches=optimal}.
22645
22646The @option{-mcompact-branches=never} option ensures that compact branch
22647instructions will never be generated.
22648
22649The @option{-mcompact-branches=always} option ensures that a compact
22650branch instruction will be generated if available.  If a compact branch
22651instruction is not available, a delay slot form of the branch will be
22652used instead.
22653
22654This option is supported from MIPS Release 6 onwards.
22655
22656The @option{-mcompact-branches=optimal} option will cause a delay slot
22657branch to be used if one is available in the current ISA and the delay
22658slot is successfully filled.  If the delay slot is not filled, a compact
22659branch will be chosen if one is available.
22660
22661@item -mfp-exceptions
22662@itemx -mno-fp-exceptions
22663@opindex mfp-exceptions
22664Specifies whether FP exceptions are enabled.  This affects how
22665FP instructions are scheduled for some processors.
22666The default is that FP exceptions are
22667enabled.
22668
22669For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
2267064-bit code, then we can use both FP pipes.  Otherwise, we can only use one
22671FP pipe.
22672
22673@item -mvr4130-align
22674@itemx -mno-vr4130-align
22675@opindex mvr4130-align
22676The VR4130 pipeline is two-way superscalar, but can only issue two
22677instructions together if the first one is 8-byte aligned.  When this
22678option is enabled, GCC aligns pairs of instructions that it
22679thinks should execute in parallel.
22680
22681This option only has an effect when optimizing for the VR4130.
22682It normally makes code faster, but at the expense of making it bigger.
22683It is enabled by default at optimization level @option{-O3}.
22684
22685@item -msynci
22686@itemx -mno-synci
22687@opindex msynci
22688Enable (disable) generation of @code{synci} instructions on
22689architectures that support it.  The @code{synci} instructions (if
22690enabled) are generated when @code{__builtin___clear_cache} is
22691compiled.
22692
22693This option defaults to @option{-mno-synci}, but the default can be
22694overridden by configuring GCC with @option{--with-synci}.
22695
22696When compiling code for single processor systems, it is generally safe
22697to use @code{synci}.  However, on many multi-core (SMP) systems, it
22698does not invalidate the instruction caches on all cores and may lead
22699to undefined behavior.
22700
22701@item -mrelax-pic-calls
22702@itemx -mno-relax-pic-calls
22703@opindex mrelax-pic-calls
22704Try to turn PIC calls that are normally dispatched via register
22705@code{$25} into direct calls.  This is only possible if the linker can
22706resolve the destination at link time and if the destination is within
22707range for a direct call.
22708
22709@option{-mrelax-pic-calls} is the default if GCC was configured to use
22710an assembler and a linker that support the @code{.reloc} assembly
22711directive and @option{-mexplicit-relocs} is in effect.  With
22712@option{-mno-explicit-relocs}, this optimization can be performed by the
22713assembler and the linker alone without help from the compiler.
22714
22715@item -mmcount-ra-address
22716@itemx -mno-mcount-ra-address
22717@opindex mmcount-ra-address
22718@opindex mno-mcount-ra-address
22719Emit (do not emit) code that allows @code{_mcount} to modify the
22720calling function's return address.  When enabled, this option extends
22721the usual @code{_mcount} interface with a new @var{ra-address}
22722parameter, which has type @code{intptr_t *} and is passed in register
22723@code{$12}.  @code{_mcount} can then modify the return address by
22724doing both of the following:
22725@itemize
22726@item
22727Returning the new address in register @code{$31}.
22728@item
22729Storing the new address in @code{*@var{ra-address}},
22730if @var{ra-address} is nonnull.
22731@end itemize
22732
22733The default is @option{-mno-mcount-ra-address}.
22734
22735@item -mframe-header-opt
22736@itemx -mno-frame-header-opt
22737@opindex mframe-header-opt
22738Enable (disable) frame header optimization in the o32 ABI.  When using the
22739o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22740function to write out register arguments.  When enabled, this optimization
22741will suppress the allocation of the frame header if it can be determined that
22742it is unused.
22743
22744This optimization is off by default at all optimization levels.
22745
22746@item -mlxc1-sxc1
22747@itemx -mno-lxc1-sxc1
22748@opindex mlxc1-sxc1
22749When applicable, enable (disable) the generation of @code{lwxc1},
22750@code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
22751
22752@item -mmadd4
22753@itemx -mno-madd4
22754@opindex mmadd4
22755When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22756@code{madd.d} and related instructions.  Enabled by default.
22757
22758@end table
22759
22760@node MMIX Options
22761@subsection MMIX Options
22762@cindex MMIX Options
22763
22764These options are defined for the MMIX:
22765
22766@table @gcctabopt
22767@item -mlibfuncs
22768@itemx -mno-libfuncs
22769@opindex mlibfuncs
22770@opindex mno-libfuncs
22771Specify that intrinsic library functions are being compiled, passing all
22772values in registers, no matter the size.
22773
22774@item -mepsilon
22775@itemx -mno-epsilon
22776@opindex mepsilon
22777@opindex mno-epsilon
22778Generate floating-point comparison instructions that compare with respect
22779to the @code{rE} epsilon register.
22780
22781@item -mabi=mmixware
22782@itemx -mabi=gnu
22783@opindex mabi=mmixware
22784@opindex mabi=gnu
22785Generate code that passes function parameters and return values that (in
22786the called function) are seen as registers @code{$0} and up, as opposed to
22787the GNU ABI which uses global registers @code{$231} and up.
22788
22789@item -mzero-extend
22790@itemx -mno-zero-extend
22791@opindex mzero-extend
22792@opindex mno-zero-extend
22793When reading data from memory in sizes shorter than 64 bits, use (do not
22794use) zero-extending load instructions by default, rather than
22795sign-extending ones.
22796
22797@item -mknuthdiv
22798@itemx -mno-knuthdiv
22799@opindex mknuthdiv
22800@opindex mno-knuthdiv
22801Make the result of a division yielding a remainder have the same sign as
22802the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
22803remainder follows the sign of the dividend.  Both methods are
22804arithmetically valid, the latter being almost exclusively used.
22805
22806@item -mtoplevel-symbols
22807@itemx -mno-toplevel-symbols
22808@opindex mtoplevel-symbols
22809@opindex mno-toplevel-symbols
22810Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22811code can be used with the @code{PREFIX} assembly directive.
22812
22813@item -melf
22814@opindex melf
22815Generate an executable in the ELF format, rather than the default
22816@samp{mmo} format used by the @command{mmix} simulator.
22817
22818@item -mbranch-predict
22819@itemx -mno-branch-predict
22820@opindex mbranch-predict
22821@opindex mno-branch-predict
22822Use (do not use) the probable-branch instructions, when static branch
22823prediction indicates a probable branch.
22824
22825@item -mbase-addresses
22826@itemx -mno-base-addresses
22827@opindex mbase-addresses
22828@opindex mno-base-addresses
22829Generate (do not generate) code that uses @emph{base addresses}.  Using a
22830base address automatically generates a request (handled by the assembler
22831and the linker) for a constant to be set up in a global register.  The
22832register is used for one or more base address requests within the range 0
22833to 255 from the value held in the register.  The generally leads to short
22834and fast code, but the number of different data items that can be
22835addressed is limited.  This means that a program that uses lots of static
22836data may require @option{-mno-base-addresses}.
22837
22838@item -msingle-exit
22839@itemx -mno-single-exit
22840@opindex msingle-exit
22841@opindex mno-single-exit
22842Force (do not force) generated code to have a single exit point in each
22843function.
22844@end table
22845
22846@node MN10300 Options
22847@subsection MN10300 Options
22848@cindex MN10300 options
22849
22850These @option{-m} options are defined for Matsushita MN10300 architectures:
22851
22852@table @gcctabopt
22853@item -mmult-bug
22854@opindex mmult-bug
22855Generate code to avoid bugs in the multiply instructions for the MN10300
22856processors.  This is the default.
22857
22858@item -mno-mult-bug
22859@opindex mno-mult-bug
22860Do not generate code to avoid bugs in the multiply instructions for the
22861MN10300 processors.
22862
22863@item -mam33
22864@opindex mam33
22865Generate code using features specific to the AM33 processor.
22866
22867@item -mno-am33
22868@opindex mno-am33
22869Do not generate code using features specific to the AM33 processor.  This
22870is the default.
22871
22872@item -mam33-2
22873@opindex mam33-2
22874Generate code using features specific to the AM33/2.0 processor.
22875
22876@item -mam34
22877@opindex mam34
22878Generate code using features specific to the AM34 processor.
22879
22880@item -mtune=@var{cpu-type}
22881@opindex mtune
22882Use the timing characteristics of the indicated CPU type when
22883scheduling instructions.  This does not change the targeted processor
22884type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
22885@samp{am33-2} or @samp{am34}.
22886
22887@item -mreturn-pointer-on-d0
22888@opindex mreturn-pointer-on-d0
22889When generating a function that returns a pointer, return the pointer
22890in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
22891only in @code{a0}, and attempts to call such functions without a prototype
22892result in errors.  Note that this option is on by default; use
22893@option{-mno-return-pointer-on-d0} to disable it.
22894
22895@item -mno-crt0
22896@opindex mno-crt0
22897Do not link in the C run-time initialization object file.
22898
22899@item -mrelax
22900@opindex mrelax
22901Indicate to the linker that it should perform a relaxation optimization pass
22902to shorten branches, calls and absolute memory addresses.  This option only
22903has an effect when used on the command line for the final link step.
22904
22905This option makes symbolic debugging impossible.
22906
22907@item -mliw
22908@opindex mliw
22909Allow the compiler to generate @emph{Long Instruction Word}
22910instructions if the target is the @samp{AM33} or later.  This is the
22911default.  This option defines the preprocessor macro @code{__LIW__}.
22912
22913@item -mno-liw
22914@opindex mno-liw
22915Do not allow the compiler to generate @emph{Long Instruction Word}
22916instructions.  This option defines the preprocessor macro
22917@code{__NO_LIW__}.
22918
22919@item -msetlb
22920@opindex msetlb
22921Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22922instructions if the target is the @samp{AM33} or later.  This is the
22923default.  This option defines the preprocessor macro @code{__SETLB__}.
22924
22925@item -mno-setlb
22926@opindex mno-setlb
22927Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22928instructions.  This option defines the preprocessor macro
22929@code{__NO_SETLB__}.
22930
22931@end table
22932
22933@node Moxie Options
22934@subsection Moxie Options
22935@cindex Moxie Options
22936
22937@table @gcctabopt
22938
22939@item -meb
22940@opindex meb
22941Generate big-endian code.  This is the default for @samp{moxie-*-*}
22942configurations.
22943
22944@item -mel
22945@opindex mel
22946Generate little-endian code.
22947
22948@item -mmul.x
22949@opindex mmul.x
22950Generate mul.x and umul.x instructions.  This is the default for
22951@samp{moxiebox-*-*} configurations.
22952
22953@item -mno-crt0
22954@opindex mno-crt0
22955Do not link in the C run-time initialization object file.
22956
22957@end table
22958
22959@node MSP430 Options
22960@subsection MSP430 Options
22961@cindex MSP430 Options
22962
22963These options are defined for the MSP430:
22964
22965@table @gcctabopt
22966
22967@item -masm-hex
22968@opindex masm-hex
22969Force assembly output to always use hex constants.  Normally such
22970constants are signed decimals, but this option is available for
22971testsuite and/or aesthetic purposes.
22972
22973@item -mmcu=
22974@opindex mmcu=
22975Select the MCU to target.  This is used to create a C preprocessor
22976symbol based upon the MCU name, converted to upper case and pre- and
22977post-fixed with @samp{__}.  This in turn is used by the
22978@file{msp430.h} header file to select an MCU-specific supplementary
22979header file.
22980
22981The option also sets the ISA to use.  If the MCU name is one that is
22982known to only support the 430 ISA then that is selected, otherwise the
22983430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
22984used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
22985name selects the 430X ISA.
22986
22987In addition an MCU-specific linker script is added to the linker
22988command line.  The script's name is the name of the MCU with
22989@file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
22990command line defines the C preprocessor symbol @code{__XXX__} and
22991cause the linker to search for a script called @file{xxx.ld}.
22992
22993This option is also passed on to the assembler.
22994
22995@item -mwarn-mcu
22996@itemx -mno-warn-mcu
22997@opindex mwarn-mcu
22998@opindex mno-warn-mcu
22999This option enables or disables warnings about conflicts between the
23000MCU name specified by the @option{-mmcu} option and the ISA set by the
23001@option{-mcpu} option and/or the hardware multiply support set by the
23002@option{-mhwmult} option.  It also toggles warnings about unrecognized
23003MCU names.  This option is on by default.
23004
23005@item -mcpu=
23006@opindex mcpu=
23007Specifies the ISA to use.  Accepted values are @samp{msp430},
23008@samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
23009@option{-mmcu=} option should be used to select the ISA.
23010
23011@item -msim
23012@opindex msim
23013Link to the simulator runtime libraries and linker script.  Overrides
23014any scripts that would be selected by the @option{-mmcu=} option.
23015
23016@item -mlarge
23017@opindex mlarge
23018Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23019
23020@item -msmall
23021@opindex msmall
23022Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23023
23024@item -mrelax
23025@opindex mrelax
23026This option is passed to the assembler and linker, and allows the
23027linker to perform certain optimizations that cannot be done until
23028the final link.
23029
23030@item mhwmult=
23031@opindex mhwmult=
23032Describes the type of hardware multiply supported by the target.
23033Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23034for the original 16-bit-only multiply supported by early MCUs.
23035@samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23036@samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23037A value of @samp{auto} can also be given.  This tells GCC to deduce
23038the hardware multiply support based upon the MCU name provided by the
23039@option{-mmcu} option.  If no @option{-mmcu} option is specified or if
23040the MCU name is not recognized then no hardware multiply support is
23041assumed.  @code{auto} is the default setting.
23042
23043Hardware multiplies are normally performed by calling a library
23044routine.  This saves space in the generated code.  When compiling at
23045@option{-O3} or higher however the hardware multiplier is invoked
23046inline.  This makes for bigger, but faster code.
23047
23048The hardware multiply routines disable interrupts whilst running and
23049restore the previous interrupt state when they finish.  This makes
23050them safe to use inside interrupt handlers as well as in normal code.
23051
23052@item -minrt
23053@opindex minrt
23054Enable the use of a minimum runtime environment - no static
23055initializers or constructors.  This is intended for memory-constrained
23056devices.  The compiler includes special symbols in some objects
23057that tell the linker and runtime which code fragments are required.
23058
23059@item -mcode-region=
23060@itemx -mdata-region=
23061@opindex mcode-region
23062@opindex mdata-region
23063These options tell the compiler where to place functions and data that
23064do not have one of the @code{lower}, @code{upper}, @code{either} or
23065@code{section} attributes.  Possible values are @code{lower},
23066@code{upper}, @code{either} or @code{any}.  The first three behave
23067like the corresponding attribute.  The fourth possible value -
23068@code{any} - is the default.  It leaves placement entirely up to the
23069linker script and how it assigns the standard sections
23070(@code{.text}, @code{.data}, etc) to the memory regions.
23071
23072@item -msilicon-errata=
23073@opindex msilicon-errata
23074This option passes on a request to assembler to enable the fixes for
23075the named silicon errata.
23076
23077@item -msilicon-errata-warn=
23078@opindex msilicon-errata-warn
23079This option passes on a request to the assembler to enable warning
23080messages when a silicon errata might need to be applied.
23081
23082@end table
23083
23084@node NDS32 Options
23085@subsection NDS32 Options
23086@cindex NDS32 Options
23087
23088These options are defined for NDS32 implementations:
23089
23090@table @gcctabopt
23091
23092@item -mbig-endian
23093@opindex mbig-endian
23094Generate code in big-endian mode.
23095
23096@item -mlittle-endian
23097@opindex mlittle-endian
23098Generate code in little-endian mode.
23099
23100@item -mreduced-regs
23101@opindex mreduced-regs
23102Use reduced-set registers for register allocation.
23103
23104@item -mfull-regs
23105@opindex mfull-regs
23106Use full-set registers for register allocation.
23107
23108@item -mcmov
23109@opindex mcmov
23110Generate conditional move instructions.
23111
23112@item -mno-cmov
23113@opindex mno-cmov
23114Do not generate conditional move instructions.
23115
23116@item -mext-perf
23117@opindex mext-perf
23118Generate performance extension instructions.
23119
23120@item -mno-ext-perf
23121@opindex mno-ext-perf
23122Do not generate performance extension instructions.
23123
23124@item -mext-perf2
23125@opindex mext-perf2
23126Generate performance extension 2 instructions.
23127
23128@item -mno-ext-perf2
23129@opindex mno-ext-perf2
23130Do not generate performance extension 2 instructions.
23131
23132@item -mext-string
23133@opindex mext-string
23134Generate string extension instructions.
23135
23136@item -mno-ext-string
23137@opindex mno-ext-string
23138Do not generate string extension instructions.
23139
23140@item -mv3push
23141@opindex mv3push
23142Generate v3 push25/pop25 instructions.
23143
23144@item -mno-v3push
23145@opindex mno-v3push
23146Do not generate v3 push25/pop25 instructions.
23147
23148@item -m16-bit
23149@opindex m16-bit
23150Generate 16-bit instructions.
23151
23152@item -mno-16-bit
23153@opindex mno-16-bit
23154Do not generate 16-bit instructions.
23155
23156@item -misr-vector-size=@var{num}
23157@opindex misr-vector-size
23158Specify the size of each interrupt vector, which must be 4 or 16.
23159
23160@item -mcache-block-size=@var{num}
23161@opindex mcache-block-size
23162Specify the size of each cache block,
23163which must be a power of 2 between 4 and 512.
23164
23165@item -march=@var{arch}
23166@opindex march
23167Specify the name of the target architecture.
23168
23169@item -mcmodel=@var{code-model}
23170@opindex mcmodel
23171Set the code model to one of
23172@table @asis
23173@item @samp{small}
23174All the data and read-only data segments must be within 512KB addressing space.
23175The text segment must be within 16MB addressing space.
23176@item @samp{medium}
23177The data segment must be within 512KB while the read-only data segment can be
23178within 4GB addressing space.  The text segment should be still within 16MB
23179addressing space.
23180@item @samp{large}
23181All the text and data segments can be within 4GB addressing space.
23182@end table
23183
23184@item -mctor-dtor
23185@opindex mctor-dtor
23186Enable constructor/destructor feature.
23187
23188@item -mrelax
23189@opindex mrelax
23190Guide linker to relax instructions.
23191
23192@end table
23193
23194@node Nios II Options
23195@subsection Nios II Options
23196@cindex Nios II options
23197@cindex Altera Nios II options
23198
23199These are the options defined for the Altera Nios II processor.
23200
23201@table @gcctabopt
23202
23203@item -G @var{num}
23204@opindex G
23205@cindex smaller data references
23206Put global and static objects less than or equal to @var{num} bytes
23207into the small data or BSS sections instead of the normal data or BSS
23208sections.  The default value of @var{num} is 8.
23209
23210@item -mgpopt=@var{option}
23211@itemx -mgpopt
23212@itemx -mno-gpopt
23213@opindex mgpopt
23214@opindex mno-gpopt
23215Generate (do not generate) GP-relative accesses.  The following
23216@var{option} names are recognized:
23217
23218@table @samp
23219
23220@item none
23221Do not generate GP-relative accesses.
23222
23223@item local
23224Generate GP-relative accesses for small data objects that are not
23225external, weak, or uninitialized common symbols.
23226Also use GP-relative addressing for objects that
23227have been explicitly placed in a small data section via a @code{section}
23228attribute.
23229
23230@item global
23231As for @samp{local}, but also generate GP-relative accesses for
23232small data objects that are external, weak, or common.  If you use this option,
23233you must ensure that all parts of your program (including libraries) are
23234compiled with the same @option{-G} setting.
23235
23236@item data
23237Generate GP-relative accesses for all data objects in the program.  If you
23238use this option, the entire data and BSS segments
23239of your program must fit in 64K of memory and you must use an appropriate
23240linker script to allocate them within the addressable range of the
23241global pointer.
23242
23243@item all
23244Generate GP-relative addresses for function pointers as well as data
23245pointers.  If you use this option, the entire text, data, and BSS segments
23246of your program must fit in 64K of memory and you must use an appropriate
23247linker script to allocate them within the addressable range of the
23248global pointer.
23249
23250@end table
23251
23252@option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23253@option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23254
23255The default is @option{-mgpopt} except when @option{-fpic} or
23256@option{-fPIC} is specified to generate position-independent code.
23257Note that the Nios II ABI does not permit GP-relative accesses from
23258shared libraries.
23259
23260You may need to specify @option{-mno-gpopt} explicitly when building
23261programs that include large amounts of small data, including large
23262GOT data sections.  In this case, the 16-bit offset for GP-relative
23263addressing may not be large enough to allow access to the entire
23264small data section.
23265
23266@item -mgprel-sec=@var{regexp}
23267@opindex mgprel-sec
23268This option specifies additional section names that can be accessed via
23269GP-relative addressing.  It is most useful in conjunction with
23270@code{section} attributes on variable declarations
23271(@pxref{Common Variable Attributes}) and a custom linker script.
23272The @var{regexp} is a POSIX Extended Regular Expression.
23273
23274This option does not affect the behavior of the @option{-G} option, and
23275the specified sections are in addition to the standard @code{.sdata}
23276and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23277
23278@item -mr0rel-sec=@var{regexp}
23279@opindex mr0rel-sec
23280This option specifies names of sections that can be accessed via a
2328116-bit offset from @code{r0}; that is, in the low 32K or high 32K
23282of the 32-bit address space.  It is most useful in conjunction with
23283@code{section} attributes on variable declarations
23284(@pxref{Common Variable Attributes}) and a custom linker script.
23285The @var{regexp} is a POSIX Extended Regular Expression.
23286
23287In contrast to the use of GP-relative addressing for small data,
23288zero-based addressing is never generated by default and there are no
23289conventional section names used in standard linker scripts for sections
23290in the low or high areas of memory.
23291
23292@item -mel
23293@itemx -meb
23294@opindex mel
23295@opindex meb
23296Generate little-endian (default) or big-endian (experimental) code,
23297respectively.
23298
23299@item -march=@var{arch}
23300@opindex march
23301This specifies the name of the target Nios II architecture.  GCC uses this
23302name to determine what kind of instructions it can emit when generating
23303assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
23304
23305The preprocessor macro @code{__nios2_arch__} is available to programs,
23306with value 1 or 2, indicating the targeted ISA level.
23307
23308@item -mbypass-cache
23309@itemx -mno-bypass-cache
23310@opindex mno-bypass-cache
23311@opindex mbypass-cache
23312Force all load and store instructions to always bypass cache by
23313using I/O variants of the instructions. The default is not to
23314bypass the cache.
23315
23316@item -mno-cache-volatile
23317@itemx -mcache-volatile
23318@opindex mcache-volatile
23319@opindex mno-cache-volatile
23320Volatile memory access bypass the cache using the I/O variants of
23321the load and store instructions. The default is not to bypass the cache.
23322
23323@item -mno-fast-sw-div
23324@itemx -mfast-sw-div
23325@opindex mno-fast-sw-div
23326@opindex mfast-sw-div
23327Do not use table-based fast divide for small numbers. The default
23328is to use the fast divide at @option{-O3} and above.
23329
23330@item -mno-hw-mul
23331@itemx -mhw-mul
23332@itemx -mno-hw-mulx
23333@itemx -mhw-mulx
23334@itemx -mno-hw-div
23335@itemx -mhw-div
23336@opindex mno-hw-mul
23337@opindex mhw-mul
23338@opindex mno-hw-mulx
23339@opindex mhw-mulx
23340@opindex mno-hw-div
23341@opindex mhw-div
23342Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23343instructions by the compiler. The default is to emit @code{mul}
23344and not emit @code{div} and @code{mulx}.
23345
23346@item -mbmx
23347@itemx -mno-bmx
23348@itemx -mcdx
23349@itemx -mno-cdx
23350Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23351CDX (code density) instructions.  Enabling these instructions also
23352requires @option{-march=r2}.  Since these instructions are optional
23353extensions to the R2 architecture, the default is not to emit them.
23354
23355@item -mcustom-@var{insn}=@var{N}
23356@itemx -mno-custom-@var{insn}
23357@opindex mcustom-@var{insn}
23358@opindex mno-custom-@var{insn}
23359Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23360custom instruction with encoding @var{N} when generating code that uses
23361@var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
23362instruction 253 for single-precision floating-point add operations instead
23363of the default behavior of using a library call.
23364
23365The following values of @var{insn} are supported.  Except as otherwise
23366noted, floating-point operations are expected to be implemented with
23367normal IEEE 754 semantics and correspond directly to the C operators or the
23368equivalent GCC built-in functions (@pxref{Other Builtins}).
23369
23370Single-precision floating point:
23371@table @asis
23372
23373@item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23374Binary arithmetic operations.
23375
23376@item @samp{fnegs}
23377Unary negation.
23378
23379@item @samp{fabss}
23380Unary absolute value.
23381
23382@item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23383Comparison operations.
23384
23385@item @samp{fmins}, @samp{fmaxs}
23386Floating-point minimum and maximum.  These instructions are only
23387generated if @option{-ffinite-math-only} is specified.
23388
23389@item @samp{fsqrts}
23390Unary square root operation.
23391
23392@item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23393Floating-point trigonometric and exponential functions.  These instructions
23394are only generated if @option{-funsafe-math-optimizations} is also specified.
23395
23396@end table
23397
23398Double-precision floating point:
23399@table @asis
23400
23401@item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23402Binary arithmetic operations.
23403
23404@item @samp{fnegd}
23405Unary negation.
23406
23407@item @samp{fabsd}
23408Unary absolute value.
23409
23410@item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23411Comparison operations.
23412
23413@item @samp{fmind}, @samp{fmaxd}
23414Double-precision minimum and maximum.  These instructions are only
23415generated if @option{-ffinite-math-only} is specified.
23416
23417@item @samp{fsqrtd}
23418Unary square root operation.
23419
23420@item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23421Double-precision trigonometric and exponential functions.  These instructions
23422are only generated if @option{-funsafe-math-optimizations} is also specified.
23423
23424@end table
23425
23426Conversions:
23427@table @asis
23428@item @samp{fextsd}
23429Conversion from single precision to double precision.
23430
23431@item @samp{ftruncds}
23432Conversion from double precision to single precision.
23433
23434@item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23435Conversion from floating point to signed or unsigned integer types, with
23436truncation towards zero.
23437
23438@item @samp{round}
23439Conversion from single-precision floating point to signed integer,
23440rounding to the nearest integer and ties away from zero.
23441This corresponds to the @code{__builtin_lroundf} function when
23442@option{-fno-math-errno} is used.
23443
23444@item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23445Conversion from signed or unsigned integer types to floating-point types.
23446
23447@end table
23448
23449In addition, all of the following transfer instructions for internal
23450registers X and Y must be provided to use any of the double-precision
23451floating-point instructions.  Custom instructions taking two
23452double-precision source operands expect the first operand in the
2345364-bit register X.  The other operand (or only operand of a unary
23454operation) is given to the custom arithmetic instruction with the
23455least significant half in source register @var{src1} and the most
23456significant half in @var{src2}.  A custom instruction that returns a
23457double-precision result returns the most significant 32 bits in the
23458destination register and the other half in 32-bit register Y.
23459GCC automatically generates the necessary code sequences to write
23460register X and/or read register Y when double-precision floating-point
23461instructions are used.
23462
23463@table @asis
23464
23465@item @samp{fwrx}
23466Write @var{src1} into the least significant half of X and @var{src2} into
23467the most significant half of X.
23468
23469@item @samp{fwry}
23470Write @var{src1} into Y.
23471
23472@item @samp{frdxhi}, @samp{frdxlo}
23473Read the most or least (respectively) significant half of X and store it in
23474@var{dest}.
23475
23476@item @samp{frdy}
23477Read the value of Y and store it into @var{dest}.
23478@end table
23479
23480Note that you can gain more local control over generation of Nios II custom
23481instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23482and @code{target("no-custom-@var{insn}")} function attributes
23483(@pxref{Function Attributes})
23484or pragmas (@pxref{Function Specific Option Pragmas}).
23485
23486@item -mcustom-fpu-cfg=@var{name}
23487@opindex mcustom-fpu-cfg
23488
23489This option enables a predefined, named set of custom instruction encodings
23490(see @option{-mcustom-@var{insn}} above).
23491Currently, the following sets are defined:
23492
23493@option{-mcustom-fpu-cfg=60-1} is equivalent to:
23494@gccoptlist{-mcustom-fmuls=252 @gol
23495-mcustom-fadds=253 @gol
23496-mcustom-fsubs=254 @gol
23497-fsingle-precision-constant}
23498
23499@option{-mcustom-fpu-cfg=60-2} is equivalent to:
23500@gccoptlist{-mcustom-fmuls=252 @gol
23501-mcustom-fadds=253 @gol
23502-mcustom-fsubs=254 @gol
23503-mcustom-fdivs=255 @gol
23504-fsingle-precision-constant}
23505
23506@option{-mcustom-fpu-cfg=72-3} is equivalent to:
23507@gccoptlist{-mcustom-floatus=243 @gol
23508-mcustom-fixsi=244 @gol
23509-mcustom-floatis=245 @gol
23510-mcustom-fcmpgts=246 @gol
23511-mcustom-fcmples=249 @gol
23512-mcustom-fcmpeqs=250 @gol
23513-mcustom-fcmpnes=251 @gol
23514-mcustom-fmuls=252 @gol
23515-mcustom-fadds=253 @gol
23516-mcustom-fsubs=254 @gol
23517-mcustom-fdivs=255 @gol
23518-fsingle-precision-constant}
23519
23520Custom instruction assignments given by individual
23521@option{-mcustom-@var{insn}=} options override those given by
23522@option{-mcustom-fpu-cfg=}, regardless of the
23523order of the options on the command line.
23524
23525Note that you can gain more local control over selection of a FPU
23526configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23527function attribute (@pxref{Function Attributes})
23528or pragma (@pxref{Function Specific Option Pragmas}).
23529
23530@end table
23531
23532These additional @samp{-m} options are available for the Altera Nios II
23533ELF (bare-metal) target:
23534
23535@table @gcctabopt
23536
23537@item -mhal
23538@opindex mhal
23539Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
23540startup and termination code, and is typically used in conjunction with
23541@option{-msys-crt0=} to specify the location of the alternate startup code
23542provided by the HAL BSP.
23543
23544@item -msmallc
23545@opindex msmallc
23546Link with a limited version of the C library, @option{-lsmallc}, rather than
23547Newlib.
23548
23549@item -msys-crt0=@var{startfile}
23550@opindex msys-crt0
23551@var{startfile} is the file name of the startfile (crt0) to use
23552when linking.  This option is only useful in conjunction with @option{-mhal}.
23553
23554@item -msys-lib=@var{systemlib}
23555@opindex msys-lib
23556@var{systemlib} is the library name of the library that provides
23557low-level system calls required by the C library,
23558e.g.@: @code{read} and @code{write}.
23559This option is typically used to link with a library provided by a HAL BSP.
23560
23561@end table
23562
23563@node Nvidia PTX Options
23564@subsection Nvidia PTX Options
23565@cindex Nvidia PTX options
23566@cindex nvptx options
23567
23568These options are defined for Nvidia PTX:
23569
23570@table @gcctabopt
23571
23572@item -m32
23573@itemx -m64
23574@opindex m32
23575@opindex m64
23576Generate code for 32-bit or 64-bit ABI.
23577
23578@item -misa=@var{ISA-string}
23579@opindex march
23580Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}).  ISA
23581strings must be lower-case.  Valid ISA strings include @samp{sm_30} and
23582@samp{sm_35}.  The default ISA is sm_30.
23583
23584@item -mmainkernel
23585@opindex mmainkernel
23586Link in code for a __main kernel.  This is for stand-alone instead of
23587offloading execution.
23588
23589@item -moptimize
23590@opindex moptimize
23591Apply partitioned execution optimizations.  This is the default when any
23592level of optimization is selected.
23593
23594@item -msoft-stack
23595@opindex msoft-stack
23596Generate code that does not use @code{.local} memory
23597directly for stack storage. Instead, a per-warp stack pointer is
23598maintained explicitly. This enables variable-length stack allocation (with
23599variable-length arrays or @code{alloca}), and when global memory is used for
23600underlying storage, makes it possible to access automatic variables from other
23601threads, or with atomic instructions. This code generation variant is used
23602for OpenMP offloading, but the option is exposed on its own for the purpose
23603of testing the compiler; to generate code suitable for linking into programs
23604using OpenMP offloading, use option @option{-mgomp}.
23605
23606@item -muniform-simt
23607@opindex muniform-simt
23608Switch to code generation variant that allows to execute all threads in each
23609warp, while maintaining memory state and side effects as if only one thread
23610in each warp was active outside of OpenMP SIMD regions.  All atomic operations
23611and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23612current lane index equals the master lane index), and the register being
23613assigned is copied via a shuffle instruction from the master lane.  Outside of
23614SIMD regions lane 0 is the master; inside, each thread sees itself as the
23615master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23616all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23617regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
23618with current lane index to compute the master lane index.
23619
23620@item -mgomp
23621@opindex mgomp
23622Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23623@option{-muniform-simt} options, and selects corresponding multilib variant.
23624
23625@end table
23626
23627@node OpenRISC Options
23628@subsection OpenRISC Options
23629@cindex OpenRISC Options
23630
23631These options are defined for OpenRISC:
23632
23633@table @gcctabopt
23634
23635@item -mboard=@var{name}
23636@opindex mboard
23637Configure a board specific runtime.  This will be passed to the linker for
23638newlib board library linking.  The default is @code{or1ksim}.
23639
23640@item -mnewlib
23641@opindex mnewlib
23642For compatibility, it's always newlib for elf now.
23643
23644@item -mhard-div
23645@opindex mhard-div
23646Generate code for hardware which supports divide instructions.  This is the
23647default.
23648
23649@item -mhard-mul
23650@opindex mhard-mul
23651Generate code for hardware which supports multiply instructions.  This is the
23652default.
23653
23654@item -mcmov
23655@opindex mcmov
23656Generate code for hardware which supports the conditional move (@code{l.cmov})
23657instruction.
23658
23659@item -mror
23660@opindex mror
23661Generate code for hardware which supports rotate right instructions.
23662
23663@item -msext
23664@opindex msext
23665Generate code for hardware which supports sign-extension instructions.
23666
23667@item -msfimm
23668@opindex msfimm
23669Generate code for hardware which supports set flag immediate (@code{l.sf*i})
23670instructions.
23671
23672@item -mshftimm
23673@opindex mshftimm
23674Generate code for hardware which supports shift immediate related instructions
23675(i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}).  Note, to
23676enable generation of the @code{l.rori} instruction the @option{-mror} flag must
23677also be specified.
23678
23679@item -msoft-div
23680@opindex msoft-div
23681Generate code for hardware which requires divide instruction emulation.
23682
23683@item -msoft-mul
23684@opindex msoft-mul
23685Generate code for hardware which requires multiply instruction emulation.
23686
23687@end table
23688
23689@node PDP-11 Options
23690@subsection PDP-11 Options
23691@cindex PDP-11 Options
23692
23693These options are defined for the PDP-11:
23694
23695@table @gcctabopt
23696@item -mfpu
23697@opindex mfpu
23698Use hardware FPP floating point.  This is the default.  (FIS floating
23699point on the PDP-11/40 is not supported.)  Implies -m45.
23700
23701@item -msoft-float
23702@opindex msoft-float
23703Do not use hardware floating point.
23704
23705@item -mac0
23706@opindex mac0
23707Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23708
23709@item -mno-ac0
23710@opindex mno-ac0
23711Return floating-point results in memory.  This is the default.
23712
23713@item -m40
23714@opindex m40
23715Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
23716
23717@item -m45
23718@opindex m45
23719Generate code for a PDP-11/45.  This is the default.
23720
23721@item -m10
23722@opindex m10
23723Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
23724
23725@item -mint16
23726@itemx -mno-int32
23727@opindex mint16
23728@opindex mno-int32
23729Use 16-bit @code{int}.  This is the default.
23730
23731@item -mint32
23732@itemx -mno-int16
23733@opindex mint32
23734@opindex mno-int16
23735Use 32-bit @code{int}.
23736
23737@item -msplit
23738@opindex msplit
23739Target has split instruction and data space.  Implies -m45.
23740
23741@item -munix-asm
23742@opindex munix-asm
23743Use Unix assembler syntax.
23744
23745@item -mdec-asm
23746@opindex mdec-asm
23747Use DEC assembler syntax.
23748
23749@item -mgnu-asm
23750@opindex mgnu-asm
23751Use GNU assembler syntax.  This is the default.
23752
23753@item -mlra
23754@opindex mlra
23755Use the new LRA register allocator.  By default, the old ``reload''
23756allocator is used.
23757@end table
23758
23759@node picoChip Options
23760@subsection picoChip Options
23761@cindex picoChip options
23762
23763These @samp{-m} options are defined for picoChip implementations:
23764
23765@table @gcctabopt
23766
23767@item -mae=@var{ae_type}
23768@opindex mcpu
23769Set the instruction set, register set, and instruction scheduling
23770parameters for array element type @var{ae_type}.  Supported values
23771for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23772
23773@option{-mae=ANY} selects a completely generic AE type.  Code
23774generated with this option runs on any of the other AE types.  The
23775code is not as efficient as it would be if compiled for a specific
23776AE type, and some types of operation (e.g., multiplication) do not
23777work properly on all types of AE.
23778
23779@option{-mae=MUL} selects a MUL AE type.  This is the most useful AE type
23780for compiled code, and is the default.
23781
23782@option{-mae=MAC} selects a DSP-style MAC AE.  Code compiled with this
23783option may suffer from poor performance of byte (char) manipulation,
23784since the DSP AE does not provide hardware support for byte load/stores.
23785
23786@item -msymbol-as-address
23787Enable the compiler to directly use a symbol name as an address in a
23788load/store instruction, without first loading it into a
23789register.  Typically, the use of this option generates larger
23790programs, which run faster than when the option isn't used.  However, the
23791results vary from program to program, so it is left as a user option,
23792rather than being permanently enabled.
23793
23794@item -mno-inefficient-warnings
23795Disables warnings about the generation of inefficient code.  These
23796warnings can be generated, for example, when compiling code that
23797performs byte-level memory operations on the MAC AE type.  The MAC AE has
23798no hardware support for byte-level memory operations, so all byte
23799load/stores must be synthesized from word load/store operations.  This is
23800inefficient and a warning is generated to indicate
23801that you should rewrite the code to avoid byte operations, or to target
23802an AE type that has the necessary hardware support.  This option disables
23803these warnings.
23804
23805@end table
23806
23807@node PowerPC Options
23808@subsection PowerPC Options
23809@cindex PowerPC options
23810
23811These are listed under @xref{RS/6000 and PowerPC Options}.
23812
23813@node RISC-V Options
23814@subsection RISC-V Options
23815@cindex RISC-V Options
23816
23817These command-line options are defined for RISC-V targets:
23818
23819@table @gcctabopt
23820@item -mbranch-cost=@var{n}
23821@opindex mbranch-cost
23822Set the cost of branches to roughly @var{n} instructions.
23823
23824@item -mplt
23825@itemx -mno-plt
23826@opindex plt
23827When generating PIC code, do or don't allow the use of PLTs. Ignored for
23828non-PIC.  The default is @option{-mplt}.
23829
23830@item -mabi=@var{ABI-string}
23831@opindex mabi
23832Specify integer and floating-point calling convention.  @var{ABI-string}
23833contains two parts: the size of integer types and the registers used for
23834floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
23835@samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
2383632-bit), and that floating-point values up to 64 bits wide are passed in F
23837registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23838allows the compiler to generate code that uses the F and D extensions but only
23839allows floating-point values up to 32 bits long to be passed in registers; or
23840@samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23841passed in registers.
23842
23843The default for this argument is system dependent, users who want a specific
23844calling convention should specify one explicitly.  The valid calling
23845conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23846@samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
23847implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23848invalid because the ABI requires 64-bit values be passed in F registers, but F
23849registers are only 32 bits wide.  There is also the @samp{ilp32e} ABI that can
23850only be used with the @samp{rv32e} architecture.  This ABI is not well
23851specified at present, and is subject to change.
23852
23853@item -mfdiv
23854@itemx -mno-fdiv
23855@opindex mfdiv
23856Do or don't use hardware floating-point divide and square root instructions.
23857This requires the F or D extensions for floating-point registers.  The default
23858is to use them if the specified architecture has these instructions.
23859
23860@item -mdiv
23861@itemx -mno-div
23862@opindex mdiv
23863Do or don't use hardware instructions for integer division.  This requires the
23864M extension.  The default is to use them if the specified architecture has
23865these instructions.
23866
23867@item -march=@var{ISA-string}
23868@opindex march
23869Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
23870lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23871@samp{rv32imaf}.
23872
23873@item -mtune=@var{processor-string}
23874@opindex mtune
23875Optimize the output for the given processor, specified by microarchitecture
23876name.  Permissible values for this option are: @samp{rocket},
23877@samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
23878and @samp{size}.
23879
23880When @option{-mtune=} is not specified, the default is @samp{rocket}.
23881
23882The @samp{size} choice is not intended for use by end-users.  This is used
23883when @option{-Os} is specified.  It overrides the instruction cost info
23884provided by @option{-mtune=}, but does not override the pipeline info.  This
23885helps reduce code size while still giving good performance.
23886
23887@item -mpreferred-stack-boundary=@var{num}
23888@opindex mpreferred-stack-boundary
23889Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23890byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
23891the default is 4 (16 bytes or 128-bits).
23892
23893@strong{Warning:} If you use this switch, then you must build all modules with
23894the same value, including any libraries.  This includes the system libraries
23895and startup modules.
23896
23897@item -msmall-data-limit=@var{n}
23898@opindex msmall-data-limit
23899Put global and static data smaller than @var{n} bytes into a special section
23900(on some targets).
23901
23902@item -msave-restore
23903@itemx -mno-save-restore
23904@opindex msave-restore
23905Do or don't use smaller but slower prologue and epilogue code that uses
23906library function calls.  The default is to use fast inline prologues and
23907epilogues.
23908
23909@item -mstrict-align
23910@itemx -mno-strict-align
23911@opindex mstrict-align
23912Do not or do generate unaligned memory accesses.  The default is set depending
23913on whether the processor we are optimizing for supports fast unaligned access
23914or not.
23915
23916@item -mcmodel=medlow
23917@opindex mcmodel=medlow
23918Generate code for the medium-low code model. The program and its statically
23919defined symbols must lie within a single 2 GiB address range and must lie
23920between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23921statically or dynamically linked. This is the default code model.
23922
23923@item -mcmodel=medany
23924@opindex mcmodel=medany
23925Generate code for the medium-any code model. The program and its statically
23926defined symbols must be within any single 2 GiB address range. Programs can be
23927statically or dynamically linked.
23928
23929@item -mexplicit-relocs
23930@itemx -mno-exlicit-relocs
23931Use or do not use assembler relocation operators when dealing with symbolic
23932addresses.  The alternative is to use assembler macros instead, which may
23933limit optimization.
23934
23935@item -mrelax
23936@itemx -mno-relax
23937Take advantage of linker relaxations to reduce the number of instructions
23938required to materialize symbol addresses. The default is to take advantage of
23939linker relaxations.
23940
23941@item -memit-attribute
23942@itemx -mno-emit-attribute
23943Emit (do not emit) RISC-V attribute to record extra information into ELF
23944objects.  This feature requires at least binutils 2.32.
23945@end table
23946
23947@node RL78 Options
23948@subsection RL78 Options
23949@cindex RL78 Options
23950
23951@table @gcctabopt
23952
23953@item -msim
23954@opindex msim
23955Links in additional target libraries to support operation within a
23956simulator.
23957
23958@item -mmul=none
23959@itemx -mmul=g10
23960@itemx -mmul=g13
23961@itemx -mmul=g14
23962@itemx -mmul=rl78
23963@opindex mmul
23964Specifies the type of hardware multiplication and division support to
23965be used.  The simplest is @code{none}, which uses software for both
23966multiplication and division.  This is the default.  The @code{g13}
23967value is for the hardware multiply/divide peripheral found on the
23968RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
23969the multiplication and division instructions supported by the RL78/G14
23970(S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
23971the value @code{mg10} is an alias for @code{none}.
23972
23973In addition a C preprocessor macro is defined, based upon the setting
23974of this option.  Possible values are: @code{__RL78_MUL_NONE__},
23975@code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
23976
23977@item -mcpu=g10
23978@itemx -mcpu=g13
23979@itemx -mcpu=g14
23980@itemx -mcpu=rl78
23981@opindex mcpu
23982Specifies the RL78 core to target.  The default is the G14 core, also
23983known as an S3 core or just RL78.  The G13 or S2 core does not have
23984multiply or divide instructions, instead it uses a hardware peripheral
23985for these operations.  The G10 or S1 core does not have register
23986banks, so it uses a different calling convention.
23987
23988If this option is set it also selects the type of hardware multiply
23989support to use, unless this is overridden by an explicit
23990@option{-mmul=none} option on the command line.  Thus specifying
23991@option{-mcpu=g13} enables the use of the G13 hardware multiply
23992peripheral and specifying @option{-mcpu=g10} disables the use of
23993hardware multiplications altogether.
23994
23995Note, although the RL78/G14 core is the default target, specifying
23996@option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
23997change the behavior of the toolchain since it also enables G14
23998hardware multiply support.  If these options are not specified on the
23999command line then software multiplication routines will be used even
24000though the code targets the RL78 core.  This is for backwards
24001compatibility with older toolchains which did not have hardware
24002multiply and divide support.
24003
24004In addition a C preprocessor macro is defined, based upon the setting
24005of this option.  Possible values are: @code{__RL78_G10__},
24006@code{__RL78_G13__} or @code{__RL78_G14__}.
24007
24008@item -mg10
24009@itemx -mg13
24010@itemx -mg14
24011@itemx -mrl78
24012@opindex mg10
24013@opindex mg13
24014@opindex mg14
24015@opindex mrl78
24016These are aliases for the corresponding @option{-mcpu=} option.  They
24017are provided for backwards compatibility.
24018
24019@item -mallregs
24020@opindex mallregs
24021Allow the compiler to use all of the available registers.  By default
24022registers @code{r24..r31} are reserved for use in interrupt handlers.
24023With this option enabled these registers can be used in ordinary
24024functions as well.
24025
24026@item -m64bit-doubles
24027@itemx -m32bit-doubles
24028@opindex m64bit-doubles
24029@opindex m32bit-doubles
24030Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24031or 32 bits (@option{-m32bit-doubles}) in size.  The default is
24032@option{-m32bit-doubles}.
24033
24034@item -msave-mduc-in-interrupts
24035@itemx -mno-save-mduc-in-interrupts
24036@opindex msave-mduc-in-interrupts
24037@opindex mno-save-mduc-in-interrupts
24038Specifies that interrupt handler functions should preserve the
24039MDUC registers.  This is only necessary if normal code might use
24040the MDUC registers, for example because it performs multiplication
24041and division operations.  The default is to ignore the MDUC registers
24042as this makes the interrupt handlers faster.  The target option -mg13
24043needs to be passed for this to work as this feature is only available
24044on the G13 target (S2 core).  The MDUC registers will only be saved
24045if the interrupt handler performs a multiplication or division
24046operation or it calls another function.
24047
24048@end table
24049
24050@node RS/6000 and PowerPC Options
24051@subsection IBM RS/6000 and PowerPC Options
24052@cindex RS/6000 and PowerPC Options
24053@cindex IBM RS/6000 and PowerPC Options
24054
24055These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24056@table @gcctabopt
24057@item -mpowerpc-gpopt
24058@itemx -mno-powerpc-gpopt
24059@itemx -mpowerpc-gfxopt
24060@itemx -mno-powerpc-gfxopt
24061@need 800
24062@itemx -mpowerpc64
24063@itemx -mno-powerpc64
24064@itemx -mmfcrf
24065@itemx -mno-mfcrf
24066@itemx -mpopcntb
24067@itemx -mno-popcntb
24068@itemx -mpopcntd
24069@itemx -mno-popcntd
24070@itemx -mfprnd
24071@itemx -mno-fprnd
24072@need 800
24073@itemx -mcmpb
24074@itemx -mno-cmpb
24075@itemx -mmfpgpr
24076@itemx -mno-mfpgpr
24077@itemx -mhard-dfp
24078@itemx -mno-hard-dfp
24079@opindex mpowerpc-gpopt
24080@opindex mno-powerpc-gpopt
24081@opindex mpowerpc-gfxopt
24082@opindex mno-powerpc-gfxopt
24083@opindex mpowerpc64
24084@opindex mno-powerpc64
24085@opindex mmfcrf
24086@opindex mno-mfcrf
24087@opindex mpopcntb
24088@opindex mno-popcntb
24089@opindex mpopcntd
24090@opindex mno-popcntd
24091@opindex mfprnd
24092@opindex mno-fprnd
24093@opindex mcmpb
24094@opindex mno-cmpb
24095@opindex mmfpgpr
24096@opindex mno-mfpgpr
24097@opindex mhard-dfp
24098@opindex mno-hard-dfp
24099You use these options to specify which instructions are available on the
24100processor you are using.  The default value of these options is
24101determined when configuring GCC@.  Specifying the
24102@option{-mcpu=@var{cpu_type}} overrides the specification of these
24103options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
24104rather than the options listed above.
24105
24106Specifying @option{-mpowerpc-gpopt} allows
24107GCC to use the optional PowerPC architecture instructions in the
24108General Purpose group, including floating-point square root.  Specifying
24109@option{-mpowerpc-gfxopt} allows GCC to
24110use the optional PowerPC architecture instructions in the Graphics
24111group, including floating-point select.
24112
24113The @option{-mmfcrf} option allows GCC to generate the move from
24114condition register field instruction implemented on the POWER4
24115processor and other processors that support the PowerPC V2.01
24116architecture.
24117The @option{-mpopcntb} option allows GCC to generate the popcount and
24118double-precision FP reciprocal estimate instruction implemented on the
24119POWER5 processor and other processors that support the PowerPC V2.02
24120architecture.
24121The @option{-mpopcntd} option allows GCC to generate the popcount
24122instruction implemented on the POWER7 processor and other processors
24123that support the PowerPC V2.06 architecture.
24124The @option{-mfprnd} option allows GCC to generate the FP round to
24125integer instructions implemented on the POWER5+ processor and other
24126processors that support the PowerPC V2.03 architecture.
24127The @option{-mcmpb} option allows GCC to generate the compare bytes
24128instruction implemented on the POWER6 processor and other processors
24129that support the PowerPC V2.05 architecture.
24130The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
24131general-purpose register instructions implemented on the POWER6X
24132processor and other processors that support the extended PowerPC V2.05
24133architecture.
24134The @option{-mhard-dfp} option allows GCC to generate the decimal
24135floating-point instructions implemented on some POWER processors.
24136
24137The @option{-mpowerpc64} option allows GCC to generate the additional
2413864-bit instructions that are found in the full PowerPC64 architecture
24139and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
24140@option{-mno-powerpc64}.
24141
24142@item -mcpu=@var{cpu_type}
24143@opindex mcpu
24144Set architecture type, register usage, and
24145instruction scheduling parameters for machine type @var{cpu_type}.
24146Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24147@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24148@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24149@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24150@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24151@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24152@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24153@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24154@samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24155@samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24156@samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
24157@samp{rs64}, and @samp{native}.
24158
24159@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24160@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24161endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24162architecture machine types, with an appropriate, generic processor
24163model assumed for scheduling purposes.
24164
24165Specifying @samp{native} as cpu type detects and selects the
24166architecture option that corresponds to the host processor of the
24167system performing the compilation.
24168@option{-mcpu=native} has no effect if GCC does not recognize the
24169processor.
24170
24171The other options specify a specific processor.  Code generated under
24172those options runs best on that processor, and may not run at all on
24173others.
24174
24175The @option{-mcpu} options automatically enable or disable the
24176following options:
24177
24178@gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple @gol
24179-mpopcntb  -mpopcntd  -mpowerpc64 @gol
24180-mpowerpc-gpopt  -mpowerpc-gfxopt @gol
24181-mmulhw  -mdlmzb  -mmfpgpr  -mvsx @gol
24182-mcrypto  -mhtm  -mpower8-fusion  -mpower8-vector @gol
24183-mquad-memory  -mquad-memory-atomic  -mfloat128  -mfloat128-hardware}
24184
24185The particular options set for any particular CPU varies between
24186compiler versions, depending on what setting seems to produce optimal
24187code for that CPU; it doesn't necessarily reflect the actual hardware's
24188capabilities.  If you wish to set an individual option to a particular
24189value, you may specify it after the @option{-mcpu} option, like
24190@option{-mcpu=970 -mno-altivec}.
24191
24192On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24193not enabled or disabled by the @option{-mcpu} option at present because
24194AIX does not have full support for these options.  You may still
24195enable or disable them individually if you're sure it'll work in your
24196environment.
24197
24198@item -mtune=@var{cpu_type}
24199@opindex mtune
24200Set the instruction scheduling parameters for machine type
24201@var{cpu_type}, but do not set the architecture type or register usage,
24202as @option{-mcpu=@var{cpu_type}} does.  The same
24203values for @var{cpu_type} are used for @option{-mtune} as for
24204@option{-mcpu}.  If both are specified, the code generated uses the
24205architecture and registers set by @option{-mcpu}, but the
24206scheduling parameters set by @option{-mtune}.
24207
24208@item -mcmodel=small
24209@opindex mcmodel=small
24210Generate PowerPC64 code for the small model: The TOC is limited to
2421164k.
24212
24213@item -mcmodel=medium
24214@opindex mcmodel=medium
24215Generate PowerPC64 code for the medium model: The TOC and other static
24216data may be up to a total of 4G in size.  This is the default for 64-bit
24217Linux.
24218
24219@item -mcmodel=large
24220@opindex mcmodel=large
24221Generate PowerPC64 code for the large model: The TOC may be up to 4G
24222in size.  Other data and code is only limited by the 64-bit address
24223space.
24224
24225@item -maltivec
24226@itemx -mno-altivec
24227@opindex maltivec
24228@opindex mno-altivec
24229Generate code that uses (does not use) AltiVec instructions, and also
24230enable the use of built-in functions that allow more direct access to
24231the AltiVec instruction set.  You may also need to set
24232@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24233enhancements.
24234
24235When @option{-maltivec} is used, the element order for AltiVec intrinsics
24236such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24237match array element order corresponding to the endianness of the
24238target.  That is, element zero identifies the leftmost element in a
24239vector register when targeting a big-endian platform, and identifies
24240the rightmost element in a vector register when targeting a
24241little-endian platform.
24242
24243@item -mvrsave
24244@itemx -mno-vrsave
24245@opindex mvrsave
24246@opindex mno-vrsave
24247Generate VRSAVE instructions when generating AltiVec code.
24248
24249@item -msecure-plt
24250@opindex msecure-plt
24251Generate code that allows @command{ld} and @command{ld.so}
24252to build executables and shared
24253libraries with non-executable @code{.plt} and @code{.got} sections.
24254This is a PowerPC
2425532-bit SYSV ABI option.
24256
24257@item -mbss-plt
24258@opindex mbss-plt
24259Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24260fills in, and
24261requires @code{.plt} and @code{.got}
24262sections that are both writable and executable.
24263This is a PowerPC 32-bit SYSV ABI option.
24264
24265@item -misel
24266@itemx -mno-isel
24267@opindex misel
24268@opindex mno-isel
24269This switch enables or disables the generation of ISEL instructions.
24270
24271@item -mvsx
24272@itemx -mno-vsx
24273@opindex mvsx
24274@opindex mno-vsx
24275Generate code that uses (does not use) vector/scalar (VSX)
24276instructions, and also enable the use of built-in functions that allow
24277more direct access to the VSX instruction set.
24278
24279@item -mcrypto
24280@itemx -mno-crypto
24281@opindex mcrypto
24282@opindex mno-crypto
24283Enable the use (disable) of the built-in functions that allow direct
24284access to the cryptographic instructions that were added in version
242852.07 of the PowerPC ISA.
24286
24287@item -mhtm
24288@itemx -mno-htm
24289@opindex mhtm
24290@opindex mno-htm
24291Enable (disable) the use of the built-in functions that allow direct
24292access to the Hardware Transactional Memory (HTM) instructions that
24293were added in version 2.07 of the PowerPC ISA.
24294
24295@item -mpower8-fusion
24296@itemx -mno-power8-fusion
24297@opindex mpower8-fusion
24298@opindex mno-power8-fusion
24299Generate code that keeps (does not keeps) some integer operations
24300adjacent so that the instructions can be fused together on power8 and
24301later processors.
24302
24303@item -mpower8-vector
24304@itemx -mno-power8-vector
24305@opindex mpower8-vector
24306@opindex mno-power8-vector
24307Generate code that uses (does not use) the vector and scalar
24308instructions that were added in version 2.07 of the PowerPC ISA.  Also
24309enable the use of built-in functions that allow more direct access to
24310the vector instructions.
24311
24312@item -mquad-memory
24313@itemx -mno-quad-memory
24314@opindex mquad-memory
24315@opindex mno-quad-memory
24316Generate code that uses (does not use) the non-atomic quad word memory
24317instructions.  The @option{-mquad-memory} option requires use of
2431864-bit mode.
24319
24320@item -mquad-memory-atomic
24321@itemx -mno-quad-memory-atomic
24322@opindex mquad-memory-atomic
24323@opindex mno-quad-memory-atomic
24324Generate code that uses (does not use) the atomic quad word memory
24325instructions.  The @option{-mquad-memory-atomic} option requires use of
2432664-bit mode.
24327
24328@item -mfloat128
24329@itemx -mno-float128
24330@opindex mfloat128
24331@opindex mno-float128
24332Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24333and use either software emulation for IEEE 128-bit floating point or
24334hardware instructions.
24335
24336The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24337@option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24338use the IEEE 128-bit floating point support.  The IEEE 128-bit
24339floating point support only works on PowerPC Linux systems.
24340
24341The default for @option{-mfloat128} is enabled on PowerPC Linux
24342systems using the VSX instruction set, and disabled on other systems.
24343
24344If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24345@option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24346point support will also enable the generation of ISA 3.0 IEEE 128-bit
24347floating point instructions.  Otherwise, if you do not specify to
24348generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24349system, IEEE 128-bit floating point will be done with software
24350emulation.
24351
24352@item -mfloat128-hardware
24353@itemx -mno-float128-hardware
24354@opindex mfloat128-hardware
24355@opindex mno-float128-hardware
24356Enable/disable using ISA 3.0 hardware instructions to support the
24357@var{__float128} data type.
24358
24359The default for @option{-mfloat128-hardware} is enabled on PowerPC
24360Linux systems using the ISA 3.0 instruction set, and disabled on other
24361systems.
24362
24363@item -m32
24364@itemx -m64
24365@opindex m32
24366@opindex m64
24367Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24368targets (including GNU/Linux).  The 32-bit environment sets int, long
24369and pointer to 32 bits and generates code that runs on any PowerPC
24370variant.  The 64-bit environment sets int to 32 bits and long and
24371pointer to 64 bits, and generates code for PowerPC64, as for
24372@option{-mpowerpc64}.
24373
24374@item -mfull-toc
24375@itemx -mno-fp-in-toc
24376@itemx -mno-sum-in-toc
24377@itemx -mminimal-toc
24378@opindex mfull-toc
24379@opindex mno-fp-in-toc
24380@opindex mno-sum-in-toc
24381@opindex mminimal-toc
24382Modify generation of the TOC (Table Of Contents), which is created for
24383every executable file.  The @option{-mfull-toc} option is selected by
24384default.  In that case, GCC allocates at least one TOC entry for
24385each unique non-automatic variable reference in your program.  GCC
24386also places floating-point constants in the TOC@.  However, only
2438716,384 entries are available in the TOC@.
24388
24389If you receive a linker error message that saying you have overflowed
24390the available TOC space, you can reduce the amount of TOC space used
24391with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24392@option{-mno-fp-in-toc} prevents GCC from putting floating-point
24393constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24394generate code to calculate the sum of an address and a constant at
24395run time instead of putting that sum into the TOC@.  You may specify one
24396or both of these options.  Each causes GCC to produce very slightly
24397slower and larger code at the expense of conserving TOC space.
24398
24399If you still run out of space in the TOC even when you specify both of
24400these options, specify @option{-mminimal-toc} instead.  This option causes
24401GCC to make only one TOC entry for every file.  When you specify this
24402option, GCC produces code that is slower and larger but which
24403uses extremely little TOC space.  You may wish to use this option
24404only on files that contain less frequently-executed code.
24405
24406@item -maix64
24407@itemx -maix32
24408@opindex maix64
24409@opindex maix32
24410Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24411@code{long} type, and the infrastructure needed to support them.
24412Specifying @option{-maix64} implies @option{-mpowerpc64},
24413while @option{-maix32} disables the 64-bit ABI and
24414implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
24415
24416@item -mxl-compat
24417@itemx -mno-xl-compat
24418@opindex mxl-compat
24419@opindex mno-xl-compat
24420Produce code that conforms more closely to IBM XL compiler semantics
24421when using AIX-compatible ABI@.  Pass floating-point arguments to
24422prototyped functions beyond the register save area (RSA) on the stack
24423in addition to argument FPRs.  Do not assume that most significant
24424double in 128-bit long double value is properly rounded when comparing
24425values and converting to double.  Use XL symbol names for long double
24426support routines.
24427
24428The AIX calling convention was extended but not initially documented to
24429handle an obscure K&R C case of calling a function that takes the
24430address of its arguments with fewer arguments than declared.  IBM XL
24431compilers access floating-point arguments that do not fit in the
24432RSA from the stack when a subroutine is compiled without
24433optimization.  Because always storing floating-point arguments on the
24434stack is inefficient and rarely needed, this option is not enabled by
24435default and only is necessary when calling subroutines compiled by IBM
24436XL compilers without optimization.
24437
24438@item -mpe
24439@opindex mpe
24440Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
24441application written to use message passing with special startup code to
24442enable the application to run.  The system must have PE installed in the
24443standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24444must be overridden with the @option{-specs=} option to specify the
24445appropriate directory location.  The Parallel Environment does not
24446support threads, so the @option{-mpe} option and the @option{-pthread}
24447option are incompatible.
24448
24449@item -malign-natural
24450@itemx -malign-power
24451@opindex malign-natural
24452@opindex malign-power
24453On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24454@option{-malign-natural} overrides the ABI-defined alignment of larger
24455types, such as floating-point doubles, on their natural size-based boundary.
24456The option @option{-malign-power} instructs GCC to follow the ABI-specified
24457alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
24458
24459On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24460is not supported.
24461
24462@item -msoft-float
24463@itemx -mhard-float
24464@opindex msoft-float
24465@opindex mhard-float
24466Generate code that does not use (uses) the floating-point register set.
24467Software floating-point emulation is provided if you use the
24468@option{-msoft-float} option, and pass the option to GCC when linking.
24469
24470@item -mmultiple
24471@itemx -mno-multiple
24472@opindex mmultiple
24473@opindex mno-multiple
24474Generate code that uses (does not use) the load multiple word
24475instructions and the store multiple word instructions.  These
24476instructions are generated by default on POWER systems, and not
24477generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
24478PowerPC systems, since those instructions do not work when the
24479processor is in little-endian mode.  The exceptions are PPC740 and
24480PPC750 which permit these instructions in little-endian mode.
24481
24482@item -mupdate
24483@itemx -mno-update
24484@opindex mupdate
24485@opindex mno-update
24486Generate code that uses (does not use) the load or store instructions
24487that update the base register to the address of the calculated memory
24488location.  These instructions are generated by default.  If you use
24489@option{-mno-update}, there is a small window between the time that the
24490stack pointer is updated and the address of the previous frame is
24491stored, which means code that walks the stack frame across interrupts or
24492signals may get corrupted data.
24493
24494@item -mavoid-indexed-addresses
24495@itemx -mno-avoid-indexed-addresses
24496@opindex mavoid-indexed-addresses
24497@opindex mno-avoid-indexed-addresses
24498Generate code that tries to avoid (not avoid) the use of indexed load
24499or store instructions. These instructions can incur a performance
24500penalty on Power6 processors in certain situations, such as when
24501stepping through large arrays that cross a 16M boundary.  This option
24502is enabled by default when targeting Power6 and disabled otherwise.
24503
24504@item -mfused-madd
24505@itemx -mno-fused-madd
24506@opindex mfused-madd
24507@opindex mno-fused-madd
24508Generate code that uses (does not use) the floating-point multiply and
24509accumulate instructions.  These instructions are generated by default
24510if hardware floating point is used.  The machine-dependent
24511@option{-mfused-madd} option is now mapped to the machine-independent
24512@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24513mapped to @option{-ffp-contract=off}.
24514
24515@item -mmulhw
24516@itemx -mno-mulhw
24517@opindex mmulhw
24518@opindex mno-mulhw
24519Generate code that uses (does not use) the half-word multiply and
24520multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24521These instructions are generated by default when targeting those
24522processors.
24523
24524@item -mdlmzb
24525@itemx -mno-dlmzb
24526@opindex mdlmzb
24527@opindex mno-dlmzb
24528Generate code that uses (does not use) the string-search @samp{dlmzb}
24529instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
24530generated by default when targeting those processors.
24531
24532@item -mno-bit-align
24533@itemx -mbit-align
24534@opindex mno-bit-align
24535@opindex mbit-align
24536On System V.4 and embedded PowerPC systems do not (do) force structures
24537and unions that contain bit-fields to be aligned to the base type of the
24538bit-field.
24539
24540For example, by default a structure containing nothing but 8
24541@code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24542boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
24543the structure is aligned to a 1-byte boundary and is 1 byte in
24544size.
24545
24546@item -mno-strict-align
24547@itemx -mstrict-align
24548@opindex mno-strict-align
24549@opindex mstrict-align
24550On System V.4 and embedded PowerPC systems do not (do) assume that
24551unaligned memory references are handled by the system.
24552
24553@item -mrelocatable
24554@itemx -mno-relocatable
24555@opindex mrelocatable
24556@opindex mno-relocatable
24557Generate code that allows (does not allow) a static executable to be
24558relocated to a different address at run time.  A simple embedded
24559PowerPC system loader should relocate the entire contents of
24560@code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24561a table of 32-bit addresses generated by this option.  For this to
24562work, all objects linked together must be compiled with
24563@option{-mrelocatable} or @option{-mrelocatable-lib}.
24564@option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24565
24566@item -mrelocatable-lib
24567@itemx -mno-relocatable-lib
24568@opindex mrelocatable-lib
24569@opindex mno-relocatable-lib
24570Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24571@code{.fixup} section to allow static executables to be relocated at
24572run time, but @option{-mrelocatable-lib} does not use the smaller stack
24573alignment of @option{-mrelocatable}.  Objects compiled with
24574@option{-mrelocatable-lib} may be linked with objects compiled with
24575any combination of the @option{-mrelocatable} options.
24576
24577@item -mno-toc
24578@itemx -mtoc
24579@opindex mno-toc
24580@opindex mtoc
24581On System V.4 and embedded PowerPC systems do not (do) assume that
24582register 2 contains a pointer to a global area pointing to the addresses
24583used in the program.
24584
24585@item -mlittle
24586@itemx -mlittle-endian
24587@opindex mlittle
24588@opindex mlittle-endian
24589On System V.4 and embedded PowerPC systems compile code for the
24590processor in little-endian mode.  The @option{-mlittle-endian} option is
24591the same as @option{-mlittle}.
24592
24593@item -mbig
24594@itemx -mbig-endian
24595@opindex mbig
24596@opindex mbig-endian
24597On System V.4 and embedded PowerPC systems compile code for the
24598processor in big-endian mode.  The @option{-mbig-endian} option is
24599the same as @option{-mbig}.
24600
24601@item -mdynamic-no-pic
24602@opindex mdynamic-no-pic
24603On Darwin and Mac OS X systems, compile code so that it is not
24604relocatable, but that its external references are relocatable.  The
24605resulting code is suitable for applications, but not shared
24606libraries.
24607
24608@item -msingle-pic-base
24609@opindex msingle-pic-base
24610Treat the register used for PIC addressing as read-only, rather than
24611loading it in the prologue for each function.  The runtime system is
24612responsible for initializing this register with an appropriate value
24613before execution begins.
24614
24615@item -mprioritize-restricted-insns=@var{priority}
24616@opindex mprioritize-restricted-insns
24617This option controls the priority that is assigned to
24618dispatch-slot restricted instructions during the second scheduling
24619pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
24620or @samp{2} to assign no, highest, or second-highest (respectively)
24621priority to dispatch-slot restricted
24622instructions.
24623
24624@item -msched-costly-dep=@var{dependence_type}
24625@opindex msched-costly-dep
24626This option controls which dependences are considered costly
24627by the target during instruction scheduling.  The argument
24628@var{dependence_type} takes one of the following values:
24629
24630@table @asis
24631@item @samp{no}
24632No dependence is costly.
24633
24634@item @samp{all}
24635All dependences are costly.
24636
24637@item @samp{true_store_to_load}
24638A true dependence from store to load is costly.
24639
24640@item @samp{store_to_load}
24641Any dependence from store to load is costly.
24642
24643@item @var{number}
24644Any dependence for which the latency is greater than or equal to
24645@var{number} is costly.
24646@end table
24647
24648@item -minsert-sched-nops=@var{scheme}
24649@opindex minsert-sched-nops
24650This option controls which NOP insertion scheme is used during
24651the second scheduling pass.  The argument @var{scheme} takes one of the
24652following values:
24653
24654@table @asis
24655@item @samp{no}
24656Don't insert NOPs.
24657
24658@item @samp{pad}
24659Pad with NOPs any dispatch group that has vacant issue slots,
24660according to the scheduler's grouping.
24661
24662@item @samp{regroup_exact}
24663Insert NOPs to force costly dependent insns into
24664separate groups.  Insert exactly as many NOPs as needed to force an insn
24665to a new group, according to the estimated processor grouping.
24666
24667@item @var{number}
24668Insert NOPs to force costly dependent insns into
24669separate groups.  Insert @var{number} NOPs to force an insn to a new group.
24670@end table
24671
24672@item -mcall-sysv
24673@opindex mcall-sysv
24674On System V.4 and embedded PowerPC systems compile code using calling
24675conventions that adhere to the March 1995 draft of the System V
24676Application Binary Interface, PowerPC processor supplement.  This is the
24677default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24678
24679@item -mcall-sysv-eabi
24680@itemx -mcall-eabi
24681@opindex mcall-sysv-eabi
24682@opindex mcall-eabi
24683Specify both @option{-mcall-sysv} and @option{-meabi} options.
24684
24685@item -mcall-sysv-noeabi
24686@opindex mcall-sysv-noeabi
24687Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24688
24689@item -mcall-aixdesc
24690@opindex m
24691On System V.4 and embedded PowerPC systems compile code for the AIX
24692operating system.
24693
24694@item -mcall-linux
24695@opindex mcall-linux
24696On System V.4 and embedded PowerPC systems compile code for the
24697Linux-based GNU system.
24698
24699@item -mcall-freebsd
24700@opindex mcall-freebsd
24701On System V.4 and embedded PowerPC systems compile code for the
24702FreeBSD operating system.
24703
24704@item -mcall-netbsd
24705@opindex mcall-netbsd
24706On System V.4 and embedded PowerPC systems compile code for the
24707NetBSD operating system.
24708
24709@item -mcall-openbsd
24710@opindex mcall-netbsd
24711On System V.4 and embedded PowerPC systems compile code for the
24712OpenBSD operating system.
24713
24714@item -mtraceback=@var{traceback_type}
24715@opindex mtraceback
24716Select the type of traceback table. Valid values for @var{traceback_type}
24717are @samp{full}, @samp{part}, and @samp{no}.
24718
24719@item -maix-struct-return
24720@opindex maix-struct-return
24721Return all structures in memory (as specified by the AIX ABI)@.
24722
24723@item -msvr4-struct-return
24724@opindex msvr4-struct-return
24725Return structures smaller than 8 bytes in registers (as specified by the
24726SVR4 ABI)@.
24727
24728@item -mabi=@var{abi-type}
24729@opindex mabi
24730Extend the current ABI with a particular extension, or remove such extension.
24731Valid values are @samp{altivec}, @samp{no-altivec},
24732@samp{ibmlongdouble}, @samp{ieeelongdouble},
24733@samp{elfv1}, @samp{elfv2}@.
24734
24735@item -mabi=ibmlongdouble
24736@opindex mabi=ibmlongdouble
24737Change the current ABI to use IBM extended-precision long double.
24738This is not likely to work if your system defaults to using IEEE
24739extended-precision long double.  If you change the long double type
24740from IEEE extended-precision, the compiler will issue a warning unless
24741you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
24742to be enabled.
24743
24744@item -mabi=ieeelongdouble
24745@opindex mabi=ieeelongdouble
24746Change the current ABI to use IEEE extended-precision long double.
24747This is not likely to work if your system defaults to using IBM
24748extended-precision long double.  If you change the long double type
24749from IBM extended-precision, the compiler will issue a warning unless
24750you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
24751to be enabled.
24752
24753@item -mabi=elfv1
24754@opindex mabi=elfv1
24755Change the current ABI to use the ELFv1 ABI.
24756This is the default ABI for big-endian PowerPC 64-bit Linux.
24757Overriding the default ABI requires special system support and is
24758likely to fail in spectacular ways.
24759
24760@item -mabi=elfv2
24761@opindex mabi=elfv2
24762Change the current ABI to use the ELFv2 ABI.
24763This is the default ABI for little-endian PowerPC 64-bit Linux.
24764Overriding the default ABI requires special system support and is
24765likely to fail in spectacular ways.
24766
24767@item -mgnu-attribute
24768@itemx -mno-gnu-attribute
24769@opindex mgnu-attribute
24770@opindex mno-gnu-attribute
24771Emit .gnu_attribute assembly directives to set tag/value pairs in a
24772.gnu.attributes section that specify ABI variations in function
24773parameters or return values.
24774
24775@item -mprototype
24776@itemx -mno-prototype
24777@opindex mprototype
24778@opindex mno-prototype
24779On System V.4 and embedded PowerPC systems assume that all calls to
24780variable argument functions are properly prototyped.  Otherwise, the
24781compiler must insert an instruction before every non-prototyped call to
24782set or clear bit 6 of the condition code register (@code{CR}) to
24783indicate whether floating-point values are passed in the floating-point
24784registers in case the function takes variable arguments.  With
24785@option{-mprototype}, only calls to prototyped variable argument functions
24786set or clear the bit.
24787
24788@item -msim
24789@opindex msim
24790On embedded PowerPC systems, assume that the startup module is called
24791@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24792@file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
24793configurations.
24794
24795@item -mmvme
24796@opindex mmvme
24797On embedded PowerPC systems, assume that the startup module is called
24798@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24799@file{libc.a}.
24800
24801@item -mads
24802@opindex mads
24803On embedded PowerPC systems, assume that the startup module is called
24804@file{crt0.o} and the standard C libraries are @file{libads.a} and
24805@file{libc.a}.
24806
24807@item -myellowknife
24808@opindex myellowknife
24809On embedded PowerPC systems, assume that the startup module is called
24810@file{crt0.o} and the standard C libraries are @file{libyk.a} and
24811@file{libc.a}.
24812
24813@item -mvxworks
24814@opindex mvxworks
24815On System V.4 and embedded PowerPC systems, specify that you are
24816compiling for a VxWorks system.
24817
24818@item -memb
24819@opindex memb
24820On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24821header to indicate that @samp{eabi} extended relocations are used.
24822
24823@item -meabi
24824@itemx -mno-eabi
24825@opindex meabi
24826@opindex mno-eabi
24827On System V.4 and embedded PowerPC systems do (do not) adhere to the
24828Embedded Applications Binary Interface (EABI), which is a set of
24829modifications to the System V.4 specifications.  Selecting @option{-meabi}
24830means that the stack is aligned to an 8-byte boundary, a function
24831@code{__eabi} is called from @code{main} to set up the EABI
24832environment, and the @option{-msdata} option can use both @code{r2} and
24833@code{r13} to point to two separate small data areas.  Selecting
24834@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24835no EABI initialization function is called from @code{main}, and the
24836@option{-msdata} option only uses @code{r13} to point to a single
24837small data area.  The @option{-meabi} option is on by default if you
24838configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24839
24840@item -msdata=eabi
24841@opindex msdata=eabi
24842On System V.4 and embedded PowerPC systems, put small initialized
24843@code{const} global and static data in the @code{.sdata2} section, which
24844is pointed to by register @code{r2}.  Put small initialized
24845non-@code{const} global and static data in the @code{.sdata} section,
24846which is pointed to by register @code{r13}.  Put small uninitialized
24847global and static data in the @code{.sbss} section, which is adjacent to
24848the @code{.sdata} section.  The @option{-msdata=eabi} option is
24849incompatible with the @option{-mrelocatable} option.  The
24850@option{-msdata=eabi} option also sets the @option{-memb} option.
24851
24852@item -msdata=sysv
24853@opindex msdata=sysv
24854On System V.4 and embedded PowerPC systems, put small global and static
24855data in the @code{.sdata} section, which is pointed to by register
24856@code{r13}.  Put small uninitialized global and static data in the
24857@code{.sbss} section, which is adjacent to the @code{.sdata} section.
24858The @option{-msdata=sysv} option is incompatible with the
24859@option{-mrelocatable} option.
24860
24861@item -msdata=default
24862@itemx -msdata
24863@opindex msdata=default
24864@opindex msdata
24865On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24866compile code the same as @option{-msdata=eabi}, otherwise compile code the
24867same as @option{-msdata=sysv}.
24868
24869@item -msdata=data
24870@opindex msdata=data
24871On System V.4 and embedded PowerPC systems, put small global
24872data in the @code{.sdata} section.  Put small uninitialized global
24873data in the @code{.sbss} section.  Do not use register @code{r13}
24874to address small data however.  This is the default behavior unless
24875other @option{-msdata} options are used.
24876
24877@item -msdata=none
24878@itemx -mno-sdata
24879@opindex msdata=none
24880@opindex mno-sdata
24881On embedded PowerPC systems, put all initialized global and static data
24882in the @code{.data} section, and all uninitialized data in the
24883@code{.bss} section.
24884
24885@item -mreadonly-in-sdata
24886@opindex mreadonly-in-sdata
24887@opindex mno-readonly-in-sdata
24888Put read-only objects in the @code{.sdata} section as well.  This is the
24889default.
24890
24891@item -mblock-move-inline-limit=@var{num}
24892@opindex mblock-move-inline-limit
24893Inline all block moves (such as calls to @code{memcpy} or structure
24894copies) less than or equal to @var{num} bytes.  The minimum value for
24895@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24896targets.  The default value is target-specific.
24897
24898@item -mblock-compare-inline-limit=@var{num}
24899@opindex mblock-compare-inline-limit
24900Generate non-looping inline code for all block compares (such as calls
24901to @code{memcmp} or structure compares) less than or equal to @var{num}
24902bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24903block compare is disabled. The default value is target-specific.
24904
24905@item -mblock-compare-inline-loop-limit=@var{num}
24906@opindex mblock-compare-inline-loop-limit
24907Generate an inline expansion using loop code for all block compares that
24908are less than or equal to @var{num} bytes, but greater than the limit
24909for non-loop inline block compare expansion. If the block length is not
24910constant, at most @var{num} bytes will be compared before @code{memcmp}
24911is called to compare the remainder of the block. The default value is
24912target-specific.
24913
24914@item -mstring-compare-inline-limit=@var{num}
24915@opindex mstring-compare-inline-limit
24916Compare at most @var{num} string bytes with inline code.
24917If the difference or end of string is not found at the
24918end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24919take care of the rest of the comparison. The default is 64 bytes.
24920
24921@item -G @var{num}
24922@opindex G
24923@cindex smaller data references (PowerPC)
24924@cindex .sdata/.sdata2 references (PowerPC)
24925On embedded PowerPC systems, put global and static items less than or
24926equal to @var{num} bytes into the small data or BSS sections instead of
24927the normal data or BSS section.  By default, @var{num} is 8.  The
24928@option{-G @var{num}} switch is also passed to the linker.
24929All modules should be compiled with the same @option{-G @var{num}} value.
24930
24931@item -mregnames
24932@itemx -mno-regnames
24933@opindex mregnames
24934@opindex mno-regnames
24935On System V.4 and embedded PowerPC systems do (do not) emit register
24936names in the assembly language output using symbolic forms.
24937
24938@item -mlongcall
24939@itemx -mno-longcall
24940@opindex mlongcall
24941@opindex mno-longcall
24942By default assume that all calls are far away so that a longer and more
24943expensive calling sequence is required.  This is required for calls
24944farther than 32 megabytes (33,554,432 bytes) from the current location.
24945A short call is generated if the compiler knows
24946the call cannot be that far away.  This setting can be overridden by
24947the @code{shortcall} function attribute, or by @code{#pragma
24948longcall(0)}.
24949
24950Some linkers are capable of detecting out-of-range calls and generating
24951glue code on the fly.  On these systems, long calls are unnecessary and
24952generate slower code.  As of this writing, the AIX linker can do this,
24953as can the GNU linker for PowerPC/64.  It is planned to add this feature
24954to the GNU linker for 32-bit PowerPC systems as well.
24955
24956On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
24957GCC can generate long calls using an inline PLT call sequence (see
24958@option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
24959ELFv1 (big-endian) do not support inline PLT calls.
24960
24961On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
24962callee, L42}, plus a @dfn{branch island} (glue code).  The two target
24963addresses represent the callee and the branch island.  The
24964Darwin/PPC linker prefers the first address and generates a @code{bl
24965callee} if the PPC @code{bl} instruction reaches the callee directly;
24966otherwise, the linker generates @code{bl L42} to call the branch
24967island.  The branch island is appended to the body of the
24968calling function; it computes the full 32-bit address of the callee
24969and jumps to it.
24970
24971On Mach-O (Darwin) systems, this option directs the compiler emit to
24972the glue for every direct call, and the Darwin linker decides whether
24973to use or discard it.
24974
24975In the future, GCC may ignore all longcall specifications
24976when the linker is known to generate glue.
24977
24978@item -mpltseq
24979@itemx -mno-pltseq
24980@opindex mpltseq
24981@opindex mno-pltseq
24982Implement (do not implement) -fno-plt and long calls using an inline
24983PLT call sequence that supports lazy linking and long calls to
24984functions in dlopen'd shared libraries.  Inline PLT calls are only
24985supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
24986linkers, and are enabled by default if the support is detected when
24987configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
24988configured with @option{--enable-secureplt}.  @option{-mpltseq} code
24989and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
24990linked together.
24991
24992@item -mtls-markers
24993@itemx -mno-tls-markers
24994@opindex mtls-markers
24995@opindex mno-tls-markers
24996Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24997specifying the function argument.  The relocation allows the linker to
24998reliably associate function call with argument setup instructions for
24999TLS optimization, which in turn allows GCC to better schedule the
25000sequence.
25001
25002@item -mrecip
25003@itemx -mno-recip
25004@opindex mrecip
25005This option enables use of the reciprocal estimate and
25006reciprocal square root estimate instructions with additional
25007Newton-Raphson steps to increase precision instead of doing a divide or
25008square root and divide for floating-point arguments.  You should use
25009the @option{-ffast-math} option when using @option{-mrecip} (or at
25010least @option{-funsafe-math-optimizations},
25011@option{-ffinite-math-only}, @option{-freciprocal-math} and
25012@option{-fno-trapping-math}).  Note that while the throughput of the
25013sequence is generally higher than the throughput of the non-reciprocal
25014instruction, the precision of the sequence can be decreased by up to 2
25015ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25016roots.
25017
25018@item -mrecip=@var{opt}
25019@opindex mrecip=opt
25020This option controls which reciprocal estimate instructions
25021may be used.  @var{opt} is a comma-separated list of options, which may
25022be preceded by a @code{!} to invert the option:
25023
25024@table @samp
25025
25026@item all
25027Enable all estimate instructions.
25028
25029@item default
25030Enable the default instructions, equivalent to @option{-mrecip}.
25031
25032@item none
25033Disable all estimate instructions, equivalent to @option{-mno-recip}.
25034
25035@item div
25036Enable the reciprocal approximation instructions for both
25037single and double precision.
25038
25039@item divf
25040Enable the single-precision reciprocal approximation instructions.
25041
25042@item divd
25043Enable the double-precision reciprocal approximation instructions.
25044
25045@item rsqrt
25046Enable the reciprocal square root approximation instructions for both
25047single and double precision.
25048
25049@item rsqrtf
25050Enable the single-precision reciprocal square root approximation instructions.
25051
25052@item rsqrtd
25053Enable the double-precision reciprocal square root approximation instructions.
25054
25055@end table
25056
25057So, for example, @option{-mrecip=all,!rsqrtd} enables
25058all of the reciprocal estimate instructions, except for the
25059@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25060which handle the double-precision reciprocal square root calculations.
25061
25062@item -mrecip-precision
25063@itemx -mno-recip-precision
25064@opindex mrecip-precision
25065Assume (do not assume) that the reciprocal estimate instructions
25066provide higher-precision estimates than is mandated by the PowerPC
25067ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25068@option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25069The double-precision square root estimate instructions are not generated by
25070default on low-precision machines, since they do not provide an
25071estimate that converges after three steps.
25072
25073@item -mveclibabi=@var{type}
25074@opindex mveclibabi
25075Specifies the ABI type to use for vectorizing intrinsics using an
25076external library.  The only type supported at present is @samp{mass},
25077which specifies to use IBM's Mathematical Acceleration Subsystem
25078(MASS) libraries for vectorizing intrinsics using external libraries.
25079GCC currently emits calls to @code{acosd2}, @code{acosf4},
25080@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25081@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25082@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25083@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25084@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25085@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25086@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25087@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25088@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25089@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25090@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25091@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25092@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25093for power7.  Both @option{-ftree-vectorize} and
25094@option{-funsafe-math-optimizations} must also be enabled.  The MASS
25095libraries must be specified at link time.
25096
25097@item -mfriz
25098@itemx -mno-friz
25099@opindex mfriz
25100Generate (do not generate) the @code{friz} instruction when the
25101@option{-funsafe-math-optimizations} option is used to optimize
25102rounding of floating-point values to 64-bit integer and back to floating
25103point.  The @code{friz} instruction does not return the same value if
25104the floating-point number is too large to fit in an integer.
25105
25106@item -mpointers-to-nested-functions
25107@itemx -mno-pointers-to-nested-functions
25108@opindex mpointers-to-nested-functions
25109Generate (do not generate) code to load up the static chain register
25110(@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25111systems where a function pointer points to a 3-word descriptor giving
25112the function address, TOC value to be loaded in register @code{r2}, and
25113static chain value to be loaded in register @code{r11}.  The
25114@option{-mpointers-to-nested-functions} is on by default.  You cannot
25115call through pointers to nested functions or pointers
25116to functions compiled in other languages that use the static chain if
25117you use @option{-mno-pointers-to-nested-functions}.
25118
25119@item -msave-toc-indirect
25120@itemx -mno-save-toc-indirect
25121@opindex msave-toc-indirect
25122Generate (do not generate) code to save the TOC value in the reserved
25123stack location in the function prologue if the function calls through
25124a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
25125saved in the prologue, it is saved just before the call through the
25126pointer.  The @option{-mno-save-toc-indirect} option is the default.
25127
25128@item -mcompat-align-parm
25129@itemx -mno-compat-align-parm
25130@opindex mcompat-align-parm
25131Generate (do not generate) code to pass structure parameters with a
25132maximum alignment of 64 bits, for compatibility with older versions
25133of GCC.
25134
25135Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25136structure parameter on a 128-bit boundary when that structure contained
25137a member requiring 128-bit alignment.  This is corrected in more
25138recent versions of GCC.  This option may be used to generate code
25139that is compatible with functions compiled with older versions of
25140GCC.
25141
25142The @option{-mno-compat-align-parm} option is the default.
25143
25144@item -mstack-protector-guard=@var{guard}
25145@itemx -mstack-protector-guard-reg=@var{reg}
25146@itemx -mstack-protector-guard-offset=@var{offset}
25147@itemx -mstack-protector-guard-symbol=@var{symbol}
25148@opindex mstack-protector-guard
25149@opindex mstack-protector-guard-reg
25150@opindex mstack-protector-guard-offset
25151@opindex mstack-protector-guard-symbol
25152Generate stack protection code using canary at @var{guard}.  Supported
25153locations are @samp{global} for global canary or @samp{tls} for per-thread
25154canary in the TLS block (the default with GNU libc version 2.4 or later).
25155
25156With the latter choice the options
25157@option{-mstack-protector-guard-reg=@var{reg}} and
25158@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25159which register to use as base register for reading the canary, and from what
25160offset from that base register. The default for those is as specified in the
25161relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25162the offset with a symbol reference to a canary in the TLS block.
25163@end table
25164
25165@node RX Options
25166@subsection RX Options
25167@cindex RX Options
25168
25169These command-line options are defined for RX targets:
25170
25171@table @gcctabopt
25172@item -m64bit-doubles
25173@itemx -m32bit-doubles
25174@opindex m64bit-doubles
25175@opindex m32bit-doubles
25176Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25177or 32 bits (@option{-m32bit-doubles}) in size.  The default is
25178@option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
25179works on 32-bit values, which is why the default is
25180@option{-m32bit-doubles}.
25181
25182@item -fpu
25183@itemx -nofpu
25184@opindex fpu
25185@opindex nofpu
25186Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25187floating-point hardware.  The default is enabled for the RX600
25188series and disabled for the RX200 series.
25189
25190Floating-point instructions are only generated for 32-bit floating-point
25191values, however, so the FPU hardware is not used for doubles if the
25192@option{-m64bit-doubles} option is used.
25193
25194@emph{Note} If the @option{-fpu} option is enabled then
25195@option{-funsafe-math-optimizations} is also enabled automatically.
25196This is because the RX FPU instructions are themselves unsafe.
25197
25198@item -mcpu=@var{name}
25199@opindex mcpu
25200Selects the type of RX CPU to be targeted.  Currently three types are
25201supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25202the specific @samp{RX610} CPU.  The default is @samp{RX600}.
25203
25204The only difference between @samp{RX600} and @samp{RX610} is that the
25205@samp{RX610} does not support the @code{MVTIPL} instruction.
25206
25207The @samp{RX200} series does not have a hardware floating-point unit
25208and so @option{-nofpu} is enabled by default when this type is
25209selected.
25210
25211@item -mbig-endian-data
25212@itemx -mlittle-endian-data
25213@opindex mbig-endian-data
25214@opindex mlittle-endian-data
25215Store data (but not code) in the big-endian format.  The default is
25216@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25217format.
25218
25219@item -msmall-data-limit=@var{N}
25220@opindex msmall-data-limit
25221Specifies the maximum size in bytes of global and static variables
25222which can be placed into the small data area.  Using the small data
25223area can lead to smaller and faster code, but the size of area is
25224limited and it is up to the programmer to ensure that the area does
25225not overflow.  Also when the small data area is used one of the RX's
25226registers (usually @code{r13}) is reserved for use pointing to this
25227area, so it is no longer available for use by the compiler.  This
25228could result in slower and/or larger code if variables are pushed onto
25229the stack instead of being held in this register.
25230
25231Note, common variables (variables that have not been initialized) and
25232constants are not placed into the small data area as they are assigned
25233to other sections in the output executable.
25234
25235The default value is zero, which disables this feature.  Note, this
25236feature is not enabled by default with higher optimization levels
25237(@option{-O2} etc) because of the potentially detrimental effects of
25238reserving a register.  It is up to the programmer to experiment and
25239discover whether this feature is of benefit to their program.  See the
25240description of the @option{-mpid} option for a description of how the
25241actual register to hold the small data area pointer is chosen.
25242
25243@item -msim
25244@itemx -mno-sim
25245@opindex msim
25246@opindex mno-sim
25247Use the simulator runtime.  The default is to use the libgloss
25248board-specific runtime.
25249
25250@item -mas100-syntax
25251@itemx -mno-as100-syntax
25252@opindex mas100-syntax
25253@opindex mno-as100-syntax
25254When generating assembler output use a syntax that is compatible with
25255Renesas's AS100 assembler.  This syntax can also be handled by the GAS
25256assembler, but it has some restrictions so it is not generated by default.
25257
25258@item -mmax-constant-size=@var{N}
25259@opindex mmax-constant-size
25260Specifies the maximum size, in bytes, of a constant that can be used as
25261an operand in a RX instruction.  Although the RX instruction set does
25262allow constants of up to 4 bytes in length to be used in instructions,
25263a longer value equates to a longer instruction.  Thus in some
25264circumstances it can be beneficial to restrict the size of constants
25265that are used in instructions.  Constants that are too big are instead
25266placed into a constant pool and referenced via register indirection.
25267
25268The value @var{N} can be between 0 and 4.  A value of 0 (the default)
25269or 4 means that constants of any size are allowed.
25270
25271@item -mrelax
25272@opindex mrelax
25273Enable linker relaxation.  Linker relaxation is a process whereby the
25274linker attempts to reduce the size of a program by finding shorter
25275versions of various instructions.  Disabled by default.
25276
25277@item -mint-register=@var{N}
25278@opindex mint-register
25279Specify the number of registers to reserve for fast interrupt handler
25280functions.  The value @var{N} can be between 0 and 4.  A value of 1
25281means that register @code{r13} is reserved for the exclusive use
25282of fast interrupt handlers.  A value of 2 reserves @code{r13} and
25283@code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
25284@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25285A value of 0, the default, does not reserve any registers.
25286
25287@item -msave-acc-in-interrupts
25288@opindex msave-acc-in-interrupts
25289Specifies that interrupt handler functions should preserve the
25290accumulator register.  This is only necessary if normal code might use
25291the accumulator register, for example because it performs 64-bit
25292multiplications.  The default is to ignore the accumulator as this
25293makes the interrupt handlers faster.
25294
25295@item -mpid
25296@itemx -mno-pid
25297@opindex mpid
25298@opindex mno-pid
25299Enables the generation of position independent data.  When enabled any
25300access to constant data is done via an offset from a base address
25301held in a register.  This allows the location of constant data to be
25302determined at run time without requiring the executable to be
25303relocated, which is a benefit to embedded applications with tight
25304memory constraints.  Data that can be modified is not affected by this
25305option.
25306
25307Note, using this feature reserves a register, usually @code{r13}, for
25308the constant data base address.  This can result in slower and/or
25309larger code, especially in complicated functions.
25310
25311The actual register chosen to hold the constant data base address
25312depends upon whether the @option{-msmall-data-limit} and/or the
25313@option{-mint-register} command-line options are enabled.  Starting
25314with register @code{r13} and proceeding downwards, registers are
25315allocated first to satisfy the requirements of @option{-mint-register},
25316then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
25317is possible for the small data area register to be @code{r8} if both
25318@option{-mint-register=4} and @option{-mpid} are specified on the
25319command line.
25320
25321By default this feature is not enabled.  The default can be restored
25322via the @option{-mno-pid} command-line option.
25323
25324@item -mno-warn-multiple-fast-interrupts
25325@itemx -mwarn-multiple-fast-interrupts
25326@opindex mno-warn-multiple-fast-interrupts
25327@opindex mwarn-multiple-fast-interrupts
25328Prevents GCC from issuing a warning message if it finds more than one
25329fast interrupt handler when it is compiling a file.  The default is to
25330issue a warning for each extra fast interrupt handler found, as the RX
25331only supports one such interrupt.
25332
25333@item -mallow-string-insns
25334@itemx -mno-allow-string-insns
25335@opindex mallow-string-insns
25336@opindex mno-allow-string-insns
25337Enables or disables the use of the string manipulation instructions
25338@code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25339@code{SWHILE} and also the @code{RMPA} instruction.  These
25340instructions may prefetch data, which is not safe to do if accessing
25341an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
25342for more information).
25343
25344The default is to allow these instructions, but it is not possible for
25345GCC to reliably detect all circumstances where a string instruction
25346might be used to access an I/O register, so their use cannot be
25347disabled automatically.  Instead it is reliant upon the programmer to
25348use the @option{-mno-allow-string-insns} option if their program
25349accesses I/O space.
25350
25351When the instructions are enabled GCC defines the C preprocessor
25352symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25353symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25354
25355@item -mjsr
25356@itemx -mno-jsr
25357@opindex mjsr
25358@opindex mno-jsr
25359Use only (or not only) @code{JSR} instructions to access functions.
25360This option can be used when code size exceeds the range of @code{BSR}
25361instructions.  Note that @option{-mno-jsr} does not mean to not use
25362@code{JSR} but instead means that any type of branch may be used.
25363@end table
25364
25365@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25366has special significance to the RX port when used with the
25367@code{interrupt} function attribute.  This attribute indicates a
25368function intended to process fast interrupts.  GCC ensures
25369that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25370and/or @code{r13} and only provided that the normal use of the
25371corresponding registers have been restricted via the
25372@option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25373options.
25374
25375@node S/390 and zSeries Options
25376@subsection S/390 and zSeries Options
25377@cindex S/390 and zSeries Options
25378
25379These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25380
25381@table @gcctabopt
25382@item -mhard-float
25383@itemx -msoft-float
25384@opindex mhard-float
25385@opindex msoft-float
25386Use (do not use) the hardware floating-point instructions and registers
25387for floating-point operations.  When @option{-msoft-float} is specified,
25388functions in @file{libgcc.a} are used to perform floating-point
25389operations.  When @option{-mhard-float} is specified, the compiler
25390generates IEEE floating-point instructions.  This is the default.
25391
25392@item -mhard-dfp
25393@itemx -mno-hard-dfp
25394@opindex mhard-dfp
25395@opindex mno-hard-dfp
25396Use (do not use) the hardware decimal-floating-point instructions for
25397decimal-floating-point operations.  When @option{-mno-hard-dfp} is
25398specified, functions in @file{libgcc.a} are used to perform
25399decimal-floating-point operations.  When @option{-mhard-dfp} is
25400specified, the compiler generates decimal-floating-point hardware
25401instructions.  This is the default for @option{-march=z9-ec} or higher.
25402
25403@item -mlong-double-64
25404@itemx -mlong-double-128
25405@opindex mlong-double-64
25406@opindex mlong-double-128
25407These switches control the size of @code{long double} type. A size
25408of 64 bits makes the @code{long double} type equivalent to the @code{double}
25409type. This is the default.
25410
25411@item -mbackchain
25412@itemx -mno-backchain
25413@opindex mbackchain
25414@opindex mno-backchain
25415Store (do not store) the address of the caller's frame as backchain pointer
25416into the callee's stack frame.
25417A backchain may be needed to allow debugging using tools that do not understand
25418DWARF call frame information.
25419When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25420at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25421the backchain is placed into the topmost word of the 96/160 byte register
25422save area.
25423
25424In general, code compiled with @option{-mbackchain} is call-compatible with
25425code compiled with @option{-mmo-backchain}; however, use of the backchain
25426for debugging purposes usually requires that the whole binary is built with
25427@option{-mbackchain}.  Note that the combination of @option{-mbackchain},
25428@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
25429to build a linux kernel use @option{-msoft-float}.
25430
25431The default is to not maintain the backchain.
25432
25433@item -mpacked-stack
25434@itemx -mno-packed-stack
25435@opindex mpacked-stack
25436@opindex mno-packed-stack
25437Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
25438specified, the compiler uses the all fields of the 96/160 byte register save
25439area only for their default purpose; unused fields still take up stack space.
25440When @option{-mpacked-stack} is specified, register save slots are densely
25441packed at the top of the register save area; unused space is reused for other
25442purposes, allowing for more efficient use of the available stack space.
25443However, when @option{-mbackchain} is also in effect, the topmost word of
25444the save area is always used to store the backchain, and the return address
25445register is always saved two words below the backchain.
25446
25447As long as the stack frame backchain is not used, code generated with
25448@option{-mpacked-stack} is call-compatible with code generated with
25449@option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
25450S/390 or zSeries generated code that uses the stack frame backchain at run
25451time, not just for debugging purposes.  Such code is not call-compatible
25452with code compiled with @option{-mpacked-stack}.  Also, note that the
25453combination of @option{-mbackchain},
25454@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
25455to build a linux kernel use @option{-msoft-float}.
25456
25457The default is to not use the packed stack layout.
25458
25459@item -msmall-exec
25460@itemx -mno-small-exec
25461@opindex msmall-exec
25462@opindex mno-small-exec
25463Generate (or do not generate) code using the @code{bras} instruction
25464to do subroutine calls.
25465This only works reliably if the total executable size does not
25466exceed 64k.  The default is to use the @code{basr} instruction instead,
25467which does not have this limitation.
25468
25469@item -m64
25470@itemx -m31
25471@opindex m64
25472@opindex m31
25473When @option{-m31} is specified, generate code compliant to the
25474GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
25475code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
25476particular to generate 64-bit instructions.  For the @samp{s390}
25477targets, the default is @option{-m31}, while the @samp{s390x}
25478targets default to @option{-m64}.
25479
25480@item -mzarch
25481@itemx -mesa
25482@opindex mzarch
25483@opindex mesa
25484When @option{-mzarch} is specified, generate code using the
25485instructions available on z/Architecture.
25486When @option{-mesa} is specified, generate code using the
25487instructions available on ESA/390.  Note that @option{-mesa} is
25488not possible with @option{-m64}.
25489When generating code compliant to the GNU/Linux for S/390 ABI,
25490the default is @option{-mesa}.  When generating code compliant
25491to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25492
25493@item -mhtm
25494@itemx -mno-htm
25495@opindex mhtm
25496@opindex mno-htm
25497The @option{-mhtm} option enables a set of builtins making use of
25498instructions available with the transactional execution facility
25499introduced with the IBM zEnterprise EC12 machine generation
25500@ref{S/390 System z Built-in Functions}.
25501@option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25502
25503@item -mvx
25504@itemx -mno-vx
25505@opindex mvx
25506@opindex mno-vx
25507When @option{-mvx} is specified, generate code using the instructions
25508available with the vector extension facility introduced with the IBM
25509z13 machine generation.
25510This option changes the ABI for some vector type values with regard to
25511alignment and calling conventions.  In case vector type values are
25512being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25513command will be added to mark the resulting binary with the ABI used.
25514@option{-mvx} is enabled by default when using @option{-march=z13}.
25515
25516@item -mzvector
25517@itemx -mno-zvector
25518@opindex mzvector
25519@opindex mno-zvector
25520The @option{-mzvector} option enables vector language extensions and
25521builtins using instructions available with the vector extension
25522facility introduced with the IBM z13 machine generation.
25523This option adds support for @samp{vector} to be used as a keyword to
25524define vector type variables and arguments.  @samp{vector} is only
25525available when GNU extensions are enabled.  It will not be expanded
25526when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25527In addition to the GCC low-level builtins @option{-mzvector} enables
25528a set of builtins added for compatibility with AltiVec-style
25529implementations like Power and Cell.  In order to make use of these
25530builtins the header file @file{vecintrin.h} needs to be included.
25531@option{-mzvector} is disabled by default.
25532
25533@item -mmvcle
25534@itemx -mno-mvcle
25535@opindex mmvcle
25536@opindex mno-mvcle
25537Generate (or do not generate) code using the @code{mvcle} instruction
25538to perform block moves.  When @option{-mno-mvcle} is specified,
25539use a @code{mvc} loop instead.  This is the default unless optimizing for
25540size.
25541
25542@item -mdebug
25543@itemx -mno-debug
25544@opindex mdebug
25545@opindex mno-debug
25546Print (or do not print) additional debug information when compiling.
25547The default is to not print debug information.
25548
25549@item -march=@var{cpu-type}
25550@opindex march
25551Generate code that runs on @var{cpu-type}, which is the name of a
25552system representing a certain processor type.  Possible values for
25553@var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25554@samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25555@samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25556@samp{z14}/@samp{arch12}, and @samp{native}.
25557
25558The default is @option{-march=z900}.
25559
25560Specifying @samp{native} as cpu type can be used to select the best
25561architecture option for the host processor.
25562@option{-march=native} has no effect if GCC does not recognize the
25563processor.
25564
25565@item -mtune=@var{cpu-type}
25566@opindex mtune
25567Tune to @var{cpu-type} everything applicable about the generated code,
25568except for the ABI and the set of available instructions.
25569The list of @var{cpu-type} values is the same as for @option{-march}.
25570The default is the value used for @option{-march}.
25571
25572@item -mtpf-trace
25573@itemx -mno-tpf-trace
25574@opindex mtpf-trace
25575@opindex mno-tpf-trace
25576Generate code that adds (does not add) in TPF OS specific branches to trace
25577routines in the operating system.  This option is off by default, even
25578when compiling for the TPF OS@.
25579
25580@item -mfused-madd
25581@itemx -mno-fused-madd
25582@opindex mfused-madd
25583@opindex mno-fused-madd
25584Generate code that uses (does not use) the floating-point multiply and
25585accumulate instructions.  These instructions are generated by default if
25586hardware floating point is used.
25587
25588@item -mwarn-framesize=@var{framesize}
25589@opindex mwarn-framesize
25590Emit a warning if the current function exceeds the given frame size.  Because
25591this is a compile-time check it doesn't need to be a real problem when the program
25592runs.  It is intended to identify functions that most probably cause
25593a stack overflow.  It is useful to be used in an environment with limited stack
25594size e.g.@: the linux kernel.
25595
25596@item -mwarn-dynamicstack
25597@opindex mwarn-dynamicstack
25598Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25599arrays.  This is generally a bad idea with a limited stack size.
25600
25601@item -mstack-guard=@var{stack-guard}
25602@itemx -mstack-size=@var{stack-size}
25603@opindex mstack-guard
25604@opindex mstack-size
25605If these options are provided the S/390 back end emits additional instructions in
25606the function prologue that trigger a trap if the stack size is @var{stack-guard}
25607bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25608If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25609the frame size of the compiled function is chosen.
25610These options are intended to be used to help debugging stack overflow problems.
25611The additionally emitted code causes only little overhead and hence can also be
25612used in production-like systems without greater performance degradation.  The given
25613values have to be exact powers of 2 and @var{stack-size} has to be greater than
25614@var{stack-guard} without exceeding 64k.
25615In order to be efficient the extra code makes the assumption that the stack starts
25616at an address aligned to the value given by @var{stack-size}.
25617The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25618
25619@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25620@opindex mhotpatch
25621If the hotpatch option is enabled, a ``hot-patching'' function
25622prologue is generated for all functions in the compilation unit.
25623The funtion label is prepended with the given number of two-byte
25624NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
25625the label, 2 * @var{post-halfwords} bytes are appended, using the
25626largest NOP like instructions the architecture allows (maximum
256271000000).
25628
25629If both arguments are zero, hotpatching is disabled.
25630
25631This option can be overridden for individual functions with the
25632@code{hotpatch} attribute.
25633@end table
25634
25635@node Score Options
25636@subsection Score Options
25637@cindex Score Options
25638
25639These options are defined for Score implementations:
25640
25641@table @gcctabopt
25642@item -meb
25643@opindex meb
25644Compile code for big-endian mode.  This is the default.
25645
25646@item -mel
25647@opindex mel
25648Compile code for little-endian mode.
25649
25650@item -mnhwloop
25651@opindex mnhwloop
25652Disable generation of @code{bcnz} instructions.
25653
25654@item -muls
25655@opindex muls
25656Enable generation of unaligned load and store instructions.
25657
25658@item -mmac
25659@opindex mmac
25660Enable the use of multiply-accumulate instructions. Disabled by default.
25661
25662@item -mscore5
25663@opindex mscore5
25664Specify the SCORE5 as the target architecture.
25665
25666@item -mscore5u
25667@opindex mscore5u
25668Specify the SCORE5U of the target architecture.
25669
25670@item -mscore7
25671@opindex mscore7
25672Specify the SCORE7 as the target architecture. This is the default.
25673
25674@item -mscore7d
25675@opindex mscore7d
25676Specify the SCORE7D as the target architecture.
25677@end table
25678
25679@node SH Options
25680@subsection SH Options
25681
25682These @samp{-m} options are defined for the SH implementations:
25683
25684@table @gcctabopt
25685@item -m1
25686@opindex m1
25687Generate code for the SH1.
25688
25689@item -m2
25690@opindex m2
25691Generate code for the SH2.
25692
25693@item -m2e
25694Generate code for the SH2e.
25695
25696@item -m2a-nofpu
25697@opindex m2a-nofpu
25698Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25699that the floating-point unit is not used.
25700
25701@item -m2a-single-only
25702@opindex m2a-single-only
25703Generate code for the SH2a-FPU, in such a way that no double-precision
25704floating-point operations are used.
25705
25706@item -m2a-single
25707@opindex m2a-single
25708Generate code for the SH2a-FPU assuming the floating-point unit is in
25709single-precision mode by default.
25710
25711@item -m2a
25712@opindex m2a
25713Generate code for the SH2a-FPU assuming the floating-point unit is in
25714double-precision mode by default.
25715
25716@item -m3
25717@opindex m3
25718Generate code for the SH3.
25719
25720@item -m3e
25721@opindex m3e
25722Generate code for the SH3e.
25723
25724@item -m4-nofpu
25725@opindex m4-nofpu
25726Generate code for the SH4 without a floating-point unit.
25727
25728@item -m4-single-only
25729@opindex m4-single-only
25730Generate code for the SH4 with a floating-point unit that only
25731supports single-precision arithmetic.
25732
25733@item -m4-single
25734@opindex m4-single
25735Generate code for the SH4 assuming the floating-point unit is in
25736single-precision mode by default.
25737
25738@item -m4
25739@opindex m4
25740Generate code for the SH4.
25741
25742@item -m4-100
25743@opindex m4-100
25744Generate code for SH4-100.
25745
25746@item -m4-100-nofpu
25747@opindex m4-100-nofpu
25748Generate code for SH4-100 in such a way that the
25749floating-point unit is not used.
25750
25751@item -m4-100-single
25752@opindex m4-100-single
25753Generate code for SH4-100 assuming the floating-point unit is in
25754single-precision mode by default.
25755
25756@item -m4-100-single-only
25757@opindex m4-100-single-only
25758Generate code for SH4-100 in such a way that no double-precision
25759floating-point operations are used.
25760
25761@item -m4-200
25762@opindex m4-200
25763Generate code for SH4-200.
25764
25765@item -m4-200-nofpu
25766@opindex m4-200-nofpu
25767Generate code for SH4-200 without in such a way that the
25768floating-point unit is not used.
25769
25770@item -m4-200-single
25771@opindex m4-200-single
25772Generate code for SH4-200 assuming the floating-point unit is in
25773single-precision mode by default.
25774
25775@item -m4-200-single-only
25776@opindex m4-200-single-only
25777Generate code for SH4-200 in such a way that no double-precision
25778floating-point operations are used.
25779
25780@item -m4-300
25781@opindex m4-300
25782Generate code for SH4-300.
25783
25784@item -m4-300-nofpu
25785@opindex m4-300-nofpu
25786Generate code for SH4-300 without in such a way that the
25787floating-point unit is not used.
25788
25789@item -m4-300-single
25790@opindex m4-300-single
25791Generate code for SH4-300 in such a way that no double-precision
25792floating-point operations are used.
25793
25794@item -m4-300-single-only
25795@opindex m4-300-single-only
25796Generate code for SH4-300 in such a way that no double-precision
25797floating-point operations are used.
25798
25799@item -m4-340
25800@opindex m4-340
25801Generate code for SH4-340 (no MMU, no FPU).
25802
25803@item -m4-500
25804@opindex m4-500
25805Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
25806assembler.
25807
25808@item -m4a-nofpu
25809@opindex m4a-nofpu
25810Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25811floating-point unit is not used.
25812
25813@item -m4a-single-only
25814@opindex m4a-single-only
25815Generate code for the SH4a, in such a way that no double-precision
25816floating-point operations are used.
25817
25818@item -m4a-single
25819@opindex m4a-single
25820Generate code for the SH4a assuming the floating-point unit is in
25821single-precision mode by default.
25822
25823@item -m4a
25824@opindex m4a
25825Generate code for the SH4a.
25826
25827@item -m4al
25828@opindex m4al
25829Same as @option{-m4a-nofpu}, except that it implicitly passes
25830@option{-dsp} to the assembler.  GCC doesn't generate any DSP
25831instructions at the moment.
25832
25833@item -mb
25834@opindex mb
25835Compile code for the processor in big-endian mode.
25836
25837@item -ml
25838@opindex ml
25839Compile code for the processor in little-endian mode.
25840
25841@item -mdalign
25842@opindex mdalign
25843Align doubles at 64-bit boundaries.  Note that this changes the calling
25844conventions, and thus some functions from the standard C library do
25845not work unless you recompile it first with @option{-mdalign}.
25846
25847@item -mrelax
25848@opindex mrelax
25849Shorten some address references at link time, when possible; uses the
25850linker option @option{-relax}.
25851
25852@item -mbigtable
25853@opindex mbigtable
25854Use 32-bit offsets in @code{switch} tables.  The default is to use
2585516-bit offsets.
25856
25857@item -mbitops
25858@opindex mbitops
25859Enable the use of bit manipulation instructions on SH2A.
25860
25861@item -mfmovd
25862@opindex mfmovd
25863Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
25864alignment constraints.
25865
25866@item -mrenesas
25867@opindex mrenesas
25868Comply with the calling conventions defined by Renesas.
25869
25870@item -mno-renesas
25871@opindex mno-renesas
25872Comply with the calling conventions defined for GCC before the Renesas
25873conventions were available.  This option is the default for all
25874targets of the SH toolchain.
25875
25876@item -mnomacsave
25877@opindex mnomacsave
25878Mark the @code{MAC} register as call-clobbered, even if
25879@option{-mrenesas} is given.
25880
25881@item -mieee
25882@itemx -mno-ieee
25883@opindex mieee
25884@opindex mno-ieee
25885Control the IEEE compliance of floating-point comparisons, which affects the
25886handling of cases where the result of a comparison is unordered.  By default
25887@option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
25888enabled @option{-mno-ieee} is implicitly set, which results in faster
25889floating-point greater-equal and less-equal comparisons.  The implicit settings
25890can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25891
25892@item -minline-ic_invalidate
25893@opindex minline-ic_invalidate
25894Inline code to invalidate instruction cache entries after setting up
25895nested function trampolines.
25896This option has no effect if @option{-musermode} is in effect and the selected
25897code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
25898instruction.
25899If the selected code generation option does not allow the use of the @code{icbi}
25900instruction, and @option{-musermode} is not in effect, the inlined code
25901manipulates the instruction cache address array directly with an associative
25902write.  This not only requires privileged mode at run time, but it also
25903fails if the cache line had been mapped via the TLB and has become unmapped.
25904
25905@item -misize
25906@opindex misize
25907Dump instruction size and location in the assembly code.
25908
25909@item -mpadstruct
25910@opindex mpadstruct
25911This option is deprecated.  It pads structures to multiple of 4 bytes,
25912which is incompatible with the SH ABI@.
25913
25914@item -matomic-model=@var{model}
25915@opindex matomic-model=@var{model}
25916Sets the model of atomic operations and additional parameters as a comma
25917separated list.  For details on the atomic built-in functions see
25918@ref{__atomic Builtins}.  The following models and parameters are supported:
25919
25920@table @samp
25921
25922@item none
25923Disable compiler generated atomic sequences and emit library calls for atomic
25924operations.  This is the default if the target is not @code{sh*-*-linux*}.
25925
25926@item soft-gusa
25927Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25928built-in functions.  The generated atomic sequences require additional support
25929from the interrupt/exception handling code of the system and are only suitable
25930for SH3* and SH4* single-core systems.  This option is enabled by default when
25931the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
25932this option also partially utilizes the hardware atomic instructions
25933@code{movli.l} and @code{movco.l} to create more efficient code, unless
25934@samp{strict} is specified.
25935
25936@item soft-tcb
25937Generate software atomic sequences that use a variable in the thread control
25938block.  This is a variation of the gUSA sequences which can also be used on
25939SH1* and SH2* targets.  The generated atomic sequences require additional
25940support from the interrupt/exception handling code of the system and are only
25941suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
25942parameter has to be specified as well.
25943
25944@item soft-imask
25945Generate software atomic sequences that temporarily disable interrupts by
25946setting @code{SR.IMASK = 1111}.  This model works only when the program runs
25947in privileged mode and is only suitable for single-core systems.  Additional
25948support from the interrupt/exception handling code of the system is not
25949required.  This model is enabled by default when the target is
25950@code{sh*-*-linux*} and SH1* or SH2*.
25951
25952@item hard-llcs
25953Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25954instructions only.  This is only available on SH4A and is suitable for
25955multi-core systems.  Since the hardware instructions support only 32 bit atomic
25956variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25957Code compiled with this option is also compatible with other software
25958atomic model interrupt/exception handling systems if executed on an SH4A
25959system.  Additional support from the interrupt/exception handling code of the
25960system is not required for this model.
25961
25962@item gbr-offset=
25963This parameter specifies the offset in bytes of the variable in the thread
25964control block structure that should be used by the generated atomic sequences
25965when the @samp{soft-tcb} model has been selected.  For other models this
25966parameter is ignored.  The specified value must be an integer multiple of four
25967and in the range 0-1020.
25968
25969@item strict
25970This parameter prevents mixed usage of multiple atomic models, even if they
25971are compatible, and makes the compiler generate atomic sequences of the
25972specified model only.
25973
25974@end table
25975
25976@item -mtas
25977@opindex mtas
25978Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
25979Notice that depending on the particular hardware and software configuration
25980this can degrade overall performance due to the operand cache line flushes
25981that are implied by the @code{tas.b} instruction.  On multi-core SH4A
25982processors the @code{tas.b} instruction must be used with caution since it
25983can result in data corruption for certain cache configurations.
25984
25985@item -mprefergot
25986@opindex mprefergot
25987When generating position-independent code, emit function calls using
25988the Global Offset Table instead of the Procedure Linkage Table.
25989
25990@item -musermode
25991@itemx -mno-usermode
25992@opindex musermode
25993@opindex mno-usermode
25994Don't allow (allow) the compiler generating privileged mode code.  Specifying
25995@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
25996inlined code would not work in user mode.  @option{-musermode} is the default
25997when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
25998@option{-musermode} has no effect, since there is no user mode.
25999
26000@item -multcost=@var{number}
26001@opindex multcost=@var{number}
26002Set the cost to assume for a multiply insn.
26003
26004@item -mdiv=@var{strategy}
26005@opindex mdiv=@var{strategy}
26006Set the division strategy to be used for integer division operations.
26007@var{strategy} can be one of:
26008
26009@table @samp
26010
26011@item call-div1
26012Calls a library function that uses the single-step division instruction
26013@code{div1} to perform the operation.  Division by zero calculates an
26014unspecified result and does not trap.  This is the default except for SH4,
26015SH2A and SHcompact.
26016
26017@item call-fp
26018Calls a library function that performs the operation in double precision
26019floating point.  Division by zero causes a floating-point exception.  This is
26020the default for SHcompact with FPU.  Specifying this for targets that do not
26021have a double precision FPU defaults to @code{call-div1}.
26022
26023@item call-table
26024Calls a library function that uses a lookup table for small divisors and
26025the @code{div1} instruction with case distinction for larger divisors.  Division
26026by zero calculates an unspecified result and does not trap.  This is the default
26027for SH4.  Specifying this for targets that do not have dynamic shift
26028instructions defaults to @code{call-div1}.
26029
26030@end table
26031
26032When a division strategy has not been specified the default strategy is
26033selected based on the current target.  For SH2A the default strategy is to
26034use the @code{divs} and @code{divu} instructions instead of library function
26035calls.
26036
26037@item -maccumulate-outgoing-args
26038@opindex maccumulate-outgoing-args
26039Reserve space once for outgoing arguments in the function prologue rather
26040than around each call.  Generally beneficial for performance and size.  Also
26041needed for unwinding to avoid changing the stack frame around conditional code.
26042
26043@item -mdivsi3_libfunc=@var{name}
26044@opindex mdivsi3_libfunc=@var{name}
26045Set the name of the library function used for 32-bit signed division to
26046@var{name}.
26047This only affects the name used in the @samp{call} division strategies, and
26048the compiler still expects the same sets of input/output/clobbered registers as
26049if this option were not present.
26050
26051@item -mfixed-range=@var{register-range}
26052@opindex mfixed-range
26053Generate code treating the given register range as fixed registers.
26054A fixed register is one that the register allocator cannot use.  This is
26055useful when compiling kernel code.  A register range is specified as
26056two registers separated by a dash.  Multiple register ranges can be
26057specified separated by a comma.
26058
26059@item -mbranch-cost=@var{num}
26060@opindex mbranch-cost=@var{num}
26061Assume @var{num} to be the cost for a branch instruction.  Higher numbers
26062make the compiler try to generate more branch-free code if possible.
26063If not specified the value is selected depending on the processor type that
26064is being compiled for.
26065
26066@item -mzdcbranch
26067@itemx -mno-zdcbranch
26068@opindex mzdcbranch
26069@opindex mno-zdcbranch
26070Assume (do not assume) that zero displacement conditional branch instructions
26071@code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
26072compiler prefers zero displacement branch code sequences.  This is
26073enabled by default when generating code for SH4 and SH4A.  It can be explicitly
26074disabled by specifying @option{-mno-zdcbranch}.
26075
26076@item -mcbranch-force-delay-slot
26077@opindex mcbranch-force-delay-slot
26078Force the usage of delay slots for conditional branches, which stuffs the delay
26079slot with a @code{nop} if a suitable instruction cannot be found.  By default
26080this option is disabled.  It can be enabled to work around hardware bugs as
26081found in the original SH7055.
26082
26083@item -mfused-madd
26084@itemx -mno-fused-madd
26085@opindex mfused-madd
26086@opindex mno-fused-madd
26087Generate code that uses (does not use) the floating-point multiply and
26088accumulate instructions.  These instructions are generated by default
26089if hardware floating point is used.  The machine-dependent
26090@option{-mfused-madd} option is now mapped to the machine-independent
26091@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26092mapped to @option{-ffp-contract=off}.
26093
26094@item -mfsca
26095@itemx -mno-fsca
26096@opindex mfsca
26097@opindex mno-fsca
26098Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26099and cosine approximations.  The option @option{-mfsca} must be used in
26100combination with @option{-funsafe-math-optimizations}.  It is enabled by default
26101when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
26102approximations even if @option{-funsafe-math-optimizations} is in effect.
26103
26104@item -mfsrra
26105@itemx -mno-fsrra
26106@opindex mfsrra
26107@opindex mno-fsrra
26108Allow or disallow the compiler to emit the @code{fsrra} instruction for
26109reciprocal square root approximations.  The option @option{-mfsrra} must be used
26110in combination with @option{-funsafe-math-optimizations} and
26111@option{-ffinite-math-only}.  It is enabled by default when generating code for
26112SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
26113even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26114in effect.
26115
26116@item -mpretend-cmove
26117@opindex mpretend-cmove
26118Prefer zero-displacement conditional branches for conditional move instruction
26119patterns.  This can result in faster code on the SH4 processor.
26120
26121@item -mfdpic
26122@opindex fdpic
26123Generate code using the FDPIC ABI.
26124
26125@end table
26126
26127@node Solaris 2 Options
26128@subsection Solaris 2 Options
26129@cindex Solaris 2 options
26130
26131These @samp{-m} options are supported on Solaris 2:
26132
26133@table @gcctabopt
26134@item -mclear-hwcap
26135@opindex mclear-hwcap
26136@option{-mclear-hwcap} tells the compiler to remove the hardware
26137capabilities generated by the Solaris assembler.  This is only necessary
26138when object files use ISA extensions not supported by the current
26139machine, but check at runtime whether or not to use them.
26140
26141@item -mimpure-text
26142@opindex mimpure-text
26143@option{-mimpure-text}, used in addition to @option{-shared}, tells
26144the compiler to not pass @option{-z text} to the linker when linking a
26145shared object.  Using this option, you can link position-dependent
26146code into a shared object.
26147
26148@option{-mimpure-text} suppresses the ``relocations remain against
26149allocatable but non-writable sections'' linker error message.
26150However, the necessary relocations trigger copy-on-write, and the
26151shared object is not actually shared across processes.  Instead of
26152using @option{-mimpure-text}, you should compile all source code with
26153@option{-fpic} or @option{-fPIC}.
26154
26155@end table
26156
26157These switches are supported in addition to the above on Solaris 2:
26158
26159@table @gcctabopt
26160@item -pthreads
26161@opindex pthreads
26162This is a synonym for @option{-pthread}.
26163@end table
26164
26165@node SPARC Options
26166@subsection SPARC Options
26167@cindex SPARC options
26168
26169These @samp{-m} options are supported on the SPARC:
26170
26171@table @gcctabopt
26172@item -mno-app-regs
26173@itemx -mapp-regs
26174@opindex mno-app-regs
26175@opindex mapp-regs
26176Specify @option{-mapp-regs} to generate output using the global registers
261772 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
26178global register 1, each global register 2 through 4 is then treated as an
26179allocable register that is clobbered by function calls.  This is the default.
26180
26181To be fully SVR4 ABI-compliant at the cost of some performance loss,
26182specify @option{-mno-app-regs}.  You should compile libraries and system
26183software with this option.
26184
26185@item -mflat
26186@itemx -mno-flat
26187@opindex mflat
26188@opindex mno-flat
26189With @option{-mflat}, the compiler does not generate save/restore instructions
26190and uses a ``flat'' or single register window model.  This model is compatible
26191with the regular register window model.  The local registers and the input
26192registers (0--5) are still treated as ``call-saved'' registers and are
26193saved on the stack as needed.
26194
26195With @option{-mno-flat} (the default), the compiler generates save/restore
26196instructions (except for leaf functions).  This is the normal operating mode.
26197
26198@item -mfpu
26199@itemx -mhard-float
26200@opindex mfpu
26201@opindex mhard-float
26202Generate output containing floating-point instructions.  This is the
26203default.
26204
26205@item -mno-fpu
26206@itemx -msoft-float
26207@opindex mno-fpu
26208@opindex msoft-float
26209Generate output containing library calls for floating point.
26210@strong{Warning:} the requisite libraries are not available for all SPARC
26211targets.  Normally the facilities of the machine's usual C compiler are
26212used, but this cannot be done directly in cross-compilation.  You must make
26213your own arrangements to provide suitable library functions for
26214cross-compilation.  The embedded targets @samp{sparc-*-aout} and
26215@samp{sparclite-*-*} do provide software floating-point support.
26216
26217@option{-msoft-float} changes the calling convention in the output file;
26218therefore, it is only useful if you compile @emph{all} of a program with
26219this option.  In particular, you need to compile @file{libgcc.a}, the
26220library that comes with GCC, with @option{-msoft-float} in order for
26221this to work.
26222
26223@item -mhard-quad-float
26224@opindex mhard-quad-float
26225Generate output containing quad-word (long double) floating-point
26226instructions.
26227
26228@item -msoft-quad-float
26229@opindex msoft-quad-float
26230Generate output containing library calls for quad-word (long double)
26231floating-point instructions.  The functions called are those specified
26232in the SPARC ABI@.  This is the default.
26233
26234As of this writing, there are no SPARC implementations that have hardware
26235support for the quad-word floating-point instructions.  They all invoke
26236a trap handler for one of these instructions, and then the trap handler
26237emulates the effect of the instruction.  Because of the trap handler overhead,
26238this is much slower than calling the ABI library routines.  Thus the
26239@option{-msoft-quad-float} option is the default.
26240
26241@item -mno-unaligned-doubles
26242@itemx -munaligned-doubles
26243@opindex mno-unaligned-doubles
26244@opindex munaligned-doubles
26245Assume that doubles have 8-byte alignment.  This is the default.
26246
26247With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26248alignment only if they are contained in another type, or if they have an
26249absolute address.  Otherwise, it assumes they have 4-byte alignment.
26250Specifying this option avoids some rare compatibility problems with code
26251generated by other compilers.  It is not the default because it results
26252in a performance loss, especially for floating-point code.
26253
26254@item -muser-mode
26255@itemx -mno-user-mode
26256@opindex muser-mode
26257@opindex mno-user-mode
26258Do not generate code that can only run in supervisor mode.  This is relevant
26259only for the @code{casa} instruction emitted for the LEON3 processor.  This
26260is the default.
26261
26262@item -mfaster-structs
26263@itemx -mno-faster-structs
26264@opindex mfaster-structs
26265@opindex mno-faster-structs
26266With @option{-mfaster-structs}, the compiler assumes that structures
26267should have 8-byte alignment.  This enables the use of pairs of
26268@code{ldd} and @code{std} instructions for copies in structure
26269assignment, in place of twice as many @code{ld} and @code{st} pairs.
26270However, the use of this changed alignment directly violates the SPARC
26271ABI@.  Thus, it's intended only for use on targets where the developer
26272acknowledges that their resulting code is not directly in line with
26273the rules of the ABI@.
26274
26275@item -mstd-struct-return
26276@itemx -mno-std-struct-return
26277@opindex mstd-struct-return
26278@opindex mno-std-struct-return
26279With @option{-mstd-struct-return}, the compiler generates checking code
26280in functions returning structures or unions to detect size mismatches
26281between the two sides of function calls, as per the 32-bit ABI@.
26282
26283The default is @option{-mno-std-struct-return}.  This option has no effect
26284in 64-bit mode.
26285
26286@item -mlra
26287@itemx -mno-lra
26288@opindex mlra
26289@opindex mno-lra
26290Enable Local Register Allocation.  This is the default for SPARC since GCC 7
26291so @option{-mno-lra} needs to be passed to get old Reload.
26292
26293@item -mcpu=@var{cpu_type}
26294@opindex mcpu
26295Set the instruction set, register set, and instruction scheduling parameters
26296for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
26297@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26298@samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26299@samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26300@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26301@samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26302
26303Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26304which selects the best architecture option for the host processor.
26305@option{-mcpu=native} has no effect if GCC does not recognize
26306the processor.
26307
26308Default instruction scheduling parameters are used for values that select
26309an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
26310@samp{sparclite}, @samp{sparclet}, @samp{v9}.
26311
26312Here is a list of each supported architecture and their supported
26313implementations.
26314
26315@table @asis
26316@item v7
26317cypress, leon3v7
26318
26319@item v8
26320supersparc, hypersparc, leon, leon3
26321
26322@item sparclite
26323f930, f934, sparclite86x
26324
26325@item sparclet
26326tsc701
26327
26328@item v9
26329ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26330niagara7, m8
26331@end table
26332
26333By default (unless configured otherwise), GCC generates code for the V7
26334variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
26335additionally optimizes it for the Cypress CY7C602 chip, as used in the
26336SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
26337SPARCStation 1, 2, IPX etc.
26338
26339With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26340architecture.  The only difference from V7 code is that the compiler emits
26341the integer multiply and integer divide instructions which exist in SPARC-V8
26342but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
26343optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
263442000 series.
26345
26346With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26347the SPARC architecture.  This adds the integer multiply, integer divide step
26348and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26349With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26350Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
26351@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26352MB86934 chip, which is the more recent SPARClite with FPU@.
26353
26354With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26355the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
26356integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26357but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
26358optimizes it for the TEMIC SPARClet chip.
26359
26360With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26361architecture.  This adds 64-bit integer and floating-point move instructions,
263623 additional floating-point condition code registers and conditional move
26363instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
26364optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
26365@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26366Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
26367@option{-mcpu=niagara}, the compiler additionally optimizes it for
26368Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
26369additionally optimizes it for Sun UltraSPARC T2 chips. With
26370@option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26371UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
26372additionally optimizes it for Sun UltraSPARC T4 chips.  With
26373@option{-mcpu=niagara7}, the compiler additionally optimizes it for
26374Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
26375additionally optimizes it for Oracle M8 chips.
26376
26377@item -mtune=@var{cpu_type}
26378@opindex mtune
26379Set the instruction scheduling parameters for machine type
26380@var{cpu_type}, but do not set the instruction set or register set that the
26381option @option{-mcpu=@var{cpu_type}} does.
26382
26383The same values for @option{-mcpu=@var{cpu_type}} can be used for
26384@option{-mtune=@var{cpu_type}}, but the only useful values are those
26385that select a particular CPU implementation.  Those are
26386@samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26387@samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26388@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26389@samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26390@samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
26391and GNU/Linux toolchains, @samp{native} can also be used.
26392
26393@item -mv8plus
26394@itemx -mno-v8plus
26395@opindex mv8plus
26396@opindex mno-v8plus
26397With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
26398difference from the V8 ABI is that the global and out registers are
26399considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
26400mode for all SPARC-V9 processors.
26401
26402@item -mvis
26403@itemx -mno-vis
26404@opindex mvis
26405@opindex mno-vis
26406With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26407Visual Instruction Set extensions.  The default is @option{-mno-vis}.
26408
26409@item -mvis2
26410@itemx -mno-vis2
26411@opindex mvis2
26412@opindex mno-vis2
26413With @option{-mvis2}, GCC generates code that takes advantage of
26414version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
26415default is @option{-mvis2} when targeting a cpu that supports such
26416instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
26417also sets @option{-mvis}.
26418
26419@item -mvis3
26420@itemx -mno-vis3
26421@opindex mvis3
26422@opindex mno-vis3
26423With @option{-mvis3}, GCC generates code that takes advantage of
26424version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
26425default is @option{-mvis3} when targeting a cpu that supports such
26426instructions, such as niagara-3 and later.  Setting @option{-mvis3}
26427also sets @option{-mvis2} and @option{-mvis}.
26428
26429@item -mvis4
26430@itemx -mno-vis4
26431@opindex mvis4
26432@opindex mno-vis4
26433With @option{-mvis4}, GCC generates code that takes advantage of
26434version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
26435default is @option{-mvis4} when targeting a cpu that supports such
26436instructions, such as niagara-7 and later.  Setting @option{-mvis4}
26437also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26438
26439@item -mvis4b
26440@itemx -mno-vis4b
26441@opindex mvis4b
26442@opindex mno-vis4b
26443With @option{-mvis4b}, GCC generates code that takes advantage of
26444version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26445the additional VIS instructions introduced in the Oracle SPARC
26446Architecture 2017.  The default is @option{-mvis4b} when targeting a
26447cpu that supports such instructions, such as m8 and later.  Setting
26448@option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26449@option{-mvis2} and @option{-mvis}.
26450
26451@item -mcbcond
26452@itemx -mno-cbcond
26453@opindex mcbcond
26454@opindex mno-cbcond
26455With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26456Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
26457when targeting a CPU that supports such instructions, such as Niagara-4 and
26458later.
26459
26460@item -mfmaf
26461@itemx -mno-fmaf
26462@opindex mfmaf
26463@opindex mno-fmaf
26464With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26465Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
26466when targeting a CPU that supports such instructions, such as Niagara-3 and
26467later.
26468
26469@item -mfsmuld
26470@itemx -mno-fsmuld
26471@opindex mfsmuld
26472@opindex mno-fsmuld
26473With @option{-mfsmuld}, GCC generates code that takes advantage of the
26474Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
26475@option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26476or V9 with FPU except @option{-mcpu=leon}.
26477
26478@item -mpopc
26479@itemx -mno-popc
26480@opindex mpopc
26481@opindex mno-popc
26482With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26483Population Count instruction.  The default is @option{-mpopc}
26484when targeting a CPU that supports such an instruction, such as Niagara-2 and
26485later.
26486
26487@item -msubxc
26488@itemx -mno-subxc
26489@opindex msubxc
26490@opindex mno-subxc
26491With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26492Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
26493when targeting a CPU that supports such an instruction, such as Niagara-7 and
26494later.
26495
26496@item -mfix-at697f
26497@opindex mfix-at697f
26498Enable the documented workaround for the single erratum of the Atmel AT697F
26499processor (which corresponds to erratum #13 of the AT697E processor).
26500
26501@item -mfix-ut699
26502@opindex mfix-ut699
26503Enable the documented workarounds for the floating-point errata and the data
26504cache nullify errata of the UT699 processor.
26505
26506@item -mfix-ut700
26507@opindex mfix-ut700
26508Enable the documented workaround for the back-to-back store errata of
26509the UT699E/UT700 processor.
26510
26511@item -mfix-gr712rc
26512@opindex mfix-gr712rc
26513Enable the documented workaround for the back-to-back store errata of
26514the GR712RC processor.
26515@end table
26516
26517These @samp{-m} options are supported in addition to the above
26518on SPARC-V9 processors in 64-bit environments:
26519
26520@table @gcctabopt
26521@item -m32
26522@itemx -m64
26523@opindex m32
26524@opindex m64
26525Generate code for a 32-bit or 64-bit environment.
26526The 32-bit environment sets int, long and pointer to 32 bits.
26527The 64-bit environment sets int to 32 bits and long and pointer
26528to 64 bits.
26529
26530@item -mcmodel=@var{which}
26531@opindex mcmodel
26532Set the code model to one of
26533
26534@table @samp
26535@item medlow
26536The Medium/Low code model: 64-bit addresses, programs
26537must be linked in the low 32 bits of memory.  Programs can be statically
26538or dynamically linked.
26539
26540@item medmid
26541The Medium/Middle code model: 64-bit addresses, programs
26542must be linked in the low 44 bits of memory, the text and data segments must
26543be less than 2GB in size and the data segment must be located within 2GB of
26544the text segment.
26545
26546@item medany
26547The Medium/Anywhere code model: 64-bit addresses, programs
26548may be linked anywhere in memory, the text and data segments must be less
26549than 2GB in size and the data segment must be located within 2GB of the
26550text segment.
26551
26552@item embmedany
26553The Medium/Anywhere code model for embedded systems:
2655464-bit addresses, the text and data segments must be less than 2GB in
26555size, both starting anywhere in memory (determined at link time).  The
26556global register %g4 points to the base of the data segment.  Programs
26557are statically linked and PIC is not supported.
26558@end table
26559
26560@item -mmemory-model=@var{mem-model}
26561@opindex mmemory-model
26562Set the memory model in force on the processor to one of
26563
26564@table @samp
26565@item default
26566The default memory model for the processor and operating system.
26567
26568@item rmo
26569Relaxed Memory Order
26570
26571@item pso
26572Partial Store Order
26573
26574@item tso
26575Total Store Order
26576
26577@item sc
26578Sequential Consistency
26579@end table
26580
26581These memory models are formally defined in Appendix D of the SPARC-V9
26582architecture manual, as set in the processor's @code{PSTATE.MM} field.
26583
26584@item -mstack-bias
26585@itemx -mno-stack-bias
26586@opindex mstack-bias
26587@opindex mno-stack-bias
26588With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26589frame pointer if present, are offset by @minus{}2047 which must be added back
26590when making stack frame references.  This is the default in 64-bit mode.
26591Otherwise, assume no such offset is present.
26592@end table
26593
26594@node SPU Options
26595@subsection SPU Options
26596@cindex SPU options
26597
26598These @samp{-m} options are supported on the SPU:
26599
26600@table @gcctabopt
26601@item -mwarn-reloc
26602@itemx -merror-reloc
26603@opindex mwarn-reloc
26604@opindex merror-reloc
26605
26606The loader for SPU does not handle dynamic relocations.  By default, GCC
26607gives an error when it generates code that requires a dynamic
26608relocation.  @option{-mno-error-reloc} disables the error,
26609@option{-mwarn-reloc} generates a warning instead.
26610
26611@item -msafe-dma
26612@itemx -munsafe-dma
26613@opindex msafe-dma
26614@opindex munsafe-dma
26615
26616Instructions that initiate or test completion of DMA must not be
26617reordered with respect to loads and stores of the memory that is being
26618accessed.
26619With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26620memory accesses, but that can lead to inefficient code in places where the
26621memory is known to not change.  Rather than mark the memory as volatile,
26622you can use @option{-msafe-dma} to tell the compiler to treat
26623the DMA instructions as potentially affecting all memory.
26624
26625@item -mbranch-hints
26626@opindex mbranch-hints
26627
26628By default, GCC generates a branch hint instruction to avoid
26629pipeline stalls for always-taken or probably-taken branches.  A hint
26630is not generated closer than 8 instructions away from its branch.
26631There is little reason to disable them, except for debugging purposes,
26632or to make an object a little bit smaller.
26633
26634@item -msmall-mem
26635@itemx -mlarge-mem
26636@opindex msmall-mem
26637@opindex mlarge-mem
26638
26639By default, GCC generates code assuming that addresses are never larger
26640than 18 bits.  With @option{-mlarge-mem} code is generated that assumes
26641a full 32-bit address.
26642
26643@item -mstdmain
26644@opindex mstdmain
26645
26646By default, GCC links against startup code that assumes the SPU-style
26647main function interface (which has an unconventional parameter list).
26648With @option{-mstdmain}, GCC links your program against startup
26649code that assumes a C99-style interface to @code{main}, including a
26650local copy of @code{argv} strings.
26651
26652@item -mfixed-range=@var{register-range}
26653@opindex mfixed-range
26654Generate code treating the given register range as fixed registers.
26655A fixed register is one that the register allocator cannot use.  This is
26656useful when compiling kernel code.  A register range is specified as
26657two registers separated by a dash.  Multiple register ranges can be
26658specified separated by a comma.
26659
26660@item -mea32
26661@itemx -mea64
26662@opindex mea32
26663@opindex mea64
26664Compile code assuming that pointers to the PPU address space accessed
26665via the @code{__ea} named address space qualifier are either 32 or 64
26666bits wide.  The default is 32 bits.  As this is an ABI-changing option,
26667all object code in an executable must be compiled with the same setting.
26668
26669@item -maddress-space-conversion
26670@itemx -mno-address-space-conversion
26671@opindex maddress-space-conversion
26672@opindex mno-address-space-conversion
26673Allow/disallow treating the @code{__ea} address space as superset
26674of the generic address space.  This enables explicit type casts
26675between @code{__ea} and generic pointer as well as implicit
26676conversions of generic pointers to @code{__ea} pointers.  The
26677default is to allow address space pointer conversions.
26678
26679@item -mcache-size=@var{cache-size}
26680@opindex mcache-size
26681This option controls the version of libgcc that the compiler links to an
26682executable and selects a software-managed cache for accessing variables
26683in the @code{__ea} address space with a particular cache size.  Possible
26684options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26685and @samp{128}.  The default cache size is 64KB.
26686
26687@item -matomic-updates
26688@itemx -mno-atomic-updates
26689@opindex matomic-updates
26690@opindex mno-atomic-updates
26691This option controls the version of libgcc that the compiler links to an
26692executable and selects whether atomic updates to the software-managed
26693cache of PPU-side variables are used.  If you use atomic updates, changes
26694to a PPU variable from SPU code using the @code{__ea} named address space
26695qualifier do not interfere with changes to other PPU variables residing
26696in the same cache line from PPU code.  If you do not use atomic updates,
26697such interference may occur; however, writing back cache lines is
26698more efficient.  The default behavior is to use atomic updates.
26699
26700@item -mdual-nops
26701@itemx -mdual-nops=@var{n}
26702@opindex mdual-nops
26703By default, GCC inserts NOPs to increase dual issue when it expects
26704it to increase performance.  @var{n} can be a value from 0 to 10.  A
26705smaller @var{n} inserts fewer NOPs.  10 is the default, 0 is the
26706same as @option{-mno-dual-nops}.  Disabled with @option{-Os}.
26707
26708@item -mhint-max-nops=@var{n}
26709@opindex mhint-max-nops
26710Maximum number of NOPs to insert for a branch hint.  A branch hint must
26711be at least 8 instructions away from the branch it is affecting.  GCC
26712inserts up to @var{n} NOPs to enforce this, otherwise it does not
26713generate the branch hint.
26714
26715@item -mhint-max-distance=@var{n}
26716@opindex mhint-max-distance
26717The encoding of the branch hint instruction limits the hint to be within
26718256 instructions of the branch it is affecting.  By default, GCC makes
26719sure it is within 125.
26720
26721@item -msafe-hints
26722@opindex msafe-hints
26723Work around a hardware bug that causes the SPU to stall indefinitely.
26724By default, GCC inserts the @code{hbrp} instruction to make sure
26725this stall won't happen.
26726
26727@end table
26728
26729@node System V Options
26730@subsection Options for System V
26731
26732These additional options are available on System V Release 4 for
26733compatibility with other compilers on those systems:
26734
26735@table @gcctabopt
26736@item -G
26737@opindex G
26738Create a shared object.
26739It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26740
26741@item -Qy
26742@opindex Qy
26743Identify the versions of each tool used by the compiler, in a
26744@code{.ident} assembler directive in the output.
26745
26746@item -Qn
26747@opindex Qn
26748Refrain from adding @code{.ident} directives to the output file (this is
26749the default).
26750
26751@item -YP,@var{dirs}
26752@opindex YP
26753Search the directories @var{dirs}, and no others, for libraries
26754specified with @option{-l}.
26755
26756@item -Ym,@var{dir}
26757@opindex Ym
26758Look in the directory @var{dir} to find the M4 preprocessor.
26759The assembler uses this option.
26760@c This is supposed to go with a -Yd for predefined M4 macro files, but
26761@c the generic assembler that comes with Solaris takes just -Ym.
26762@end table
26763
26764@node TILE-Gx Options
26765@subsection TILE-Gx Options
26766@cindex TILE-Gx options
26767
26768These @samp{-m} options are supported on the TILE-Gx:
26769
26770@table @gcctabopt
26771@item -mcmodel=small
26772@opindex mcmodel=small
26773Generate code for the small model.  The distance for direct calls is
26774limited to 500M in either direction.  PC-relative addresses are 32
26775bits.  Absolute addresses support the full address range.
26776
26777@item -mcmodel=large
26778@opindex mcmodel=large
26779Generate code for the large model.  There is no limitation on call
26780distance, pc-relative addresses, or absolute addresses.
26781
26782@item -mcpu=@var{name}
26783@opindex mcpu
26784Selects the type of CPU to be targeted.  Currently the only supported
26785type is @samp{tilegx}.
26786
26787@item -m32
26788@itemx -m64
26789@opindex m32
26790@opindex m64
26791Generate code for a 32-bit or 64-bit environment.  The 32-bit
26792environment sets int, long, and pointer to 32 bits.  The 64-bit
26793environment sets int to 32 bits and long and pointer to 64 bits.
26794
26795@item -mbig-endian
26796@itemx -mlittle-endian
26797@opindex mbig-endian
26798@opindex mlittle-endian
26799Generate code in big/little endian mode, respectively.
26800@end table
26801
26802@node TILEPro Options
26803@subsection TILEPro Options
26804@cindex TILEPro options
26805
26806These @samp{-m} options are supported on the TILEPro:
26807
26808@table @gcctabopt
26809@item -mcpu=@var{name}
26810@opindex mcpu
26811Selects the type of CPU to be targeted.  Currently the only supported
26812type is @samp{tilepro}.
26813
26814@item -m32
26815@opindex m32
26816Generate code for a 32-bit environment, which sets int, long, and
26817pointer to 32 bits.  This is the only supported behavior so the flag
26818is essentially ignored.
26819@end table
26820
26821@node V850 Options
26822@subsection V850 Options
26823@cindex V850 Options
26824
26825These @samp{-m} options are defined for V850 implementations:
26826
26827@table @gcctabopt
26828@item -mlong-calls
26829@itemx -mno-long-calls
26830@opindex mlong-calls
26831@opindex mno-long-calls
26832Treat all calls as being far away (near).  If calls are assumed to be
26833far away, the compiler always loads the function's address into a
26834register, and calls indirect through the pointer.
26835
26836@item -mno-ep
26837@itemx -mep
26838@opindex mno-ep
26839@opindex mep
26840Do not optimize (do optimize) basic blocks that use the same index
26841pointer 4 or more times to copy pointer into the @code{ep} register, and
26842use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
26843option is on by default if you optimize.
26844
26845@item -mno-prolog-function
26846@itemx -mprolog-function
26847@opindex mno-prolog-function
26848@opindex mprolog-function
26849Do not use (do use) external functions to save and restore registers
26850at the prologue and epilogue of a function.  The external functions
26851are slower, but use less code space if more than one function saves
26852the same number of registers.  The @option{-mprolog-function} option
26853is on by default if you optimize.
26854
26855@item -mspace
26856@opindex mspace
26857Try to make the code as small as possible.  At present, this just turns
26858on the @option{-mep} and @option{-mprolog-function} options.
26859
26860@item -mtda=@var{n}
26861@opindex mtda
26862Put static or global variables whose size is @var{n} bytes or less into
26863the tiny data area that register @code{ep} points to.  The tiny data
26864area can hold up to 256 bytes in total (128 bytes for byte references).
26865
26866@item -msda=@var{n}
26867@opindex msda
26868Put static or global variables whose size is @var{n} bytes or less into
26869the small data area that register @code{gp} points to.  The small data
26870area can hold up to 64 kilobytes.
26871
26872@item -mzda=@var{n}
26873@opindex mzda
26874Put static or global variables whose size is @var{n} bytes or less into
26875the first 32 kilobytes of memory.
26876
26877@item -mv850
26878@opindex mv850
26879Specify that the target processor is the V850.
26880
26881@item -mv850e3v5
26882@opindex mv850e3v5
26883Specify that the target processor is the V850E3V5.  The preprocessor
26884constant @code{__v850e3v5__} is defined if this option is used.
26885
26886@item -mv850e2v4
26887@opindex mv850e2v4
26888Specify that the target processor is the V850E3V5.  This is an alias for
26889the @option{-mv850e3v5} option.
26890
26891@item -mv850e2v3
26892@opindex mv850e2v3
26893Specify that the target processor is the V850E2V3.  The preprocessor
26894constant @code{__v850e2v3__} is defined if this option is used.
26895
26896@item -mv850e2
26897@opindex mv850e2
26898Specify that the target processor is the V850E2.  The preprocessor
26899constant @code{__v850e2__} is defined if this option is used.
26900
26901@item -mv850e1
26902@opindex mv850e1
26903Specify that the target processor is the V850E1.  The preprocessor
26904constants @code{__v850e1__} and @code{__v850e__} are defined if
26905this option is used.
26906
26907@item -mv850es
26908@opindex mv850es
26909Specify that the target processor is the V850ES.  This is an alias for
26910the @option{-mv850e1} option.
26911
26912@item -mv850e
26913@opindex mv850e
26914Specify that the target processor is the V850E@.  The preprocessor
26915constant @code{__v850e__} is defined if this option is used.
26916
26917If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26918nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26919are defined then a default target processor is chosen and the
26920relevant @samp{__v850*__} preprocessor constant is defined.
26921
26922The preprocessor constants @code{__v850} and @code{__v851__} are always
26923defined, regardless of which processor variant is the target.
26924
26925@item -mdisable-callt
26926@itemx -mno-disable-callt
26927@opindex mdisable-callt
26928@opindex mno-disable-callt
26929This option suppresses generation of the @code{CALLT} instruction for the
26930v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26931architecture.
26932
26933This option is enabled by default when the RH850 ABI is
26934in use (see @option{-mrh850-abi}), and disabled by default when the
26935GCC ABI is in use.  If @code{CALLT} instructions are being generated
26936then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26937
26938@item -mrelax
26939@itemx -mno-relax
26940@opindex mrelax
26941@opindex mno-relax
26942Pass on (or do not pass on) the @option{-mrelax} command-line option
26943to the assembler.
26944
26945@item -mlong-jumps
26946@itemx -mno-long-jumps
26947@opindex mlong-jumps
26948@opindex mno-long-jumps
26949Disable (or re-enable) the generation of PC-relative jump instructions.
26950
26951@item -msoft-float
26952@itemx -mhard-float
26953@opindex msoft-float
26954@opindex mhard-float
26955Disable (or re-enable) the generation of hardware floating point
26956instructions.  This option is only significant when the target
26957architecture is @samp{V850E2V3} or higher.  If hardware floating point
26958instructions are being generated then the C preprocessor symbol
26959@code{__FPU_OK__} is defined, otherwise the symbol
26960@code{__NO_FPU__} is defined.
26961
26962@item -mloop
26963@opindex mloop
26964Enables the use of the e3v5 LOOP instruction.  The use of this
26965instruction is not enabled by default when the e3v5 architecture is
26966selected because its use is still experimental.
26967
26968@item -mrh850-abi
26969@itemx -mghs
26970@opindex mrh850-abi
26971@opindex mghs
26972Enables support for the RH850 version of the V850 ABI.  This is the
26973default.  With this version of the ABI the following rules apply:
26974
26975@itemize
26976@item
26977Integer sized structures and unions are returned via a memory pointer
26978rather than a register.
26979
26980@item
26981Large structures and unions (more than 8 bytes in size) are passed by
26982value.
26983
26984@item
26985Functions are aligned to 16-bit boundaries.
26986
26987@item
26988The @option{-m8byte-align} command-line option is supported.
26989
26990@item
26991The @option{-mdisable-callt} command-line option is enabled by
26992default.  The @option{-mno-disable-callt} command-line option is not
26993supported.
26994@end itemize
26995
26996When this version of the ABI is enabled the C preprocessor symbol
26997@code{__V850_RH850_ABI__} is defined.
26998
26999@item -mgcc-abi
27000@opindex mgcc-abi
27001Enables support for the old GCC version of the V850 ABI.  With this
27002version of the ABI the following rules apply:
27003
27004@itemize
27005@item
27006Integer sized structures and unions are returned in register @code{r10}.
27007
27008@item
27009Large structures and unions (more than 8 bytes in size) are passed by
27010reference.
27011
27012@item
27013Functions are aligned to 32-bit boundaries, unless optimizing for
27014size.
27015
27016@item
27017The @option{-m8byte-align} command-line option is not supported.
27018
27019@item
27020The @option{-mdisable-callt} command-line option is supported but not
27021enabled by default.
27022@end itemize
27023
27024When this version of the ABI is enabled the C preprocessor symbol
27025@code{__V850_GCC_ABI__} is defined.
27026
27027@item -m8byte-align
27028@itemx -mno-8byte-align
27029@opindex m8byte-align
27030@opindex mno-8byte-align
27031Enables support for @code{double} and @code{long long} types to be
27032aligned on 8-byte boundaries.  The default is to restrict the
27033alignment of all objects to at most 4-bytes.  When
27034@option{-m8byte-align} is in effect the C preprocessor symbol
27035@code{__V850_8BYTE_ALIGN__} is defined.
27036
27037@item -mbig-switch
27038@opindex mbig-switch
27039Generate code suitable for big switch tables.  Use this option only if
27040the assembler/linker complain about out of range branches within a switch
27041table.
27042
27043@item -mapp-regs
27044@opindex mapp-regs
27045This option causes r2 and r5 to be used in the code generated by
27046the compiler.  This setting is the default.
27047
27048@item -mno-app-regs
27049@opindex mno-app-regs
27050This option causes r2 and r5 to be treated as fixed registers.
27051
27052@end table
27053
27054@node VAX Options
27055@subsection VAX Options
27056@cindex VAX options
27057
27058These @samp{-m} options are defined for the VAX:
27059
27060@table @gcctabopt
27061@item -munix
27062@opindex munix
27063Do not output certain jump instructions (@code{aobleq} and so on)
27064that the Unix assembler for the VAX cannot handle across long
27065ranges.
27066
27067@item -mgnu
27068@opindex mgnu
27069Do output those jump instructions, on the assumption that the
27070GNU assembler is being used.
27071
27072@item -mg
27073@opindex mg
27074Output code for G-format floating-point numbers instead of D-format.
27075@end table
27076
27077@node Visium Options
27078@subsection Visium Options
27079@cindex Visium options
27080
27081@table @gcctabopt
27082
27083@item -mdebug
27084@opindex mdebug
27085A program which performs file I/O and is destined to run on an MCM target
27086should be linked with this option.  It causes the libraries libc.a and
27087libdebug.a to be linked.  The program should be run on the target under
27088the control of the GDB remote debugging stub.
27089
27090@item -msim
27091@opindex msim
27092A program which performs file I/O and is destined to run on the simulator
27093should be linked with option.  This causes libraries libc.a and libsim.a to
27094be linked.
27095
27096@item -mfpu
27097@itemx -mhard-float
27098@opindex mfpu
27099@opindex mhard-float
27100Generate code containing floating-point instructions.  This is the
27101default.
27102
27103@item -mno-fpu
27104@itemx -msoft-float
27105@opindex mno-fpu
27106@opindex msoft-float
27107Generate code containing library calls for floating-point.
27108
27109@option{-msoft-float} changes the calling convention in the output file;
27110therefore, it is only useful if you compile @emph{all} of a program with
27111this option.  In particular, you need to compile @file{libgcc.a}, the
27112library that comes with GCC, with @option{-msoft-float} in order for
27113this to work.
27114
27115@item -mcpu=@var{cpu_type}
27116@opindex mcpu
27117Set the instruction set, register set, and instruction scheduling parameters
27118for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
27119@samp{mcm}, @samp{gr5} and @samp{gr6}.
27120
27121@samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27122
27123By default (unless configured otherwise), GCC generates code for the GR5
27124variant of the Visium architecture.
27125
27126With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27127architecture.  The only difference from GR5 code is that the compiler will
27128generate block move instructions.
27129
27130@item -mtune=@var{cpu_type}
27131@opindex mtune
27132Set the instruction scheduling parameters for machine type @var{cpu_type},
27133but do not set the instruction set or register set that the option
27134@option{-mcpu=@var{cpu_type}} would.
27135
27136@item -msv-mode
27137@opindex msv-mode
27138Generate code for the supervisor mode, where there are no restrictions on
27139the access to general registers.  This is the default.
27140
27141@item -muser-mode
27142@opindex muser-mode
27143Generate code for the user mode, where the access to some general registers
27144is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27145mode; on the GR6, only registers r29 to r31 are affected.
27146@end table
27147
27148@node VMS Options
27149@subsection VMS Options
27150
27151These @samp{-m} options are defined for the VMS implementations:
27152
27153@table @gcctabopt
27154@item -mvms-return-codes
27155@opindex mvms-return-codes
27156Return VMS condition codes from @code{main}. The default is to return POSIX-style
27157condition (e.g.@: error) codes.
27158
27159@item -mdebug-main=@var{prefix}
27160@opindex mdebug-main=@var{prefix}
27161Flag the first routine whose name starts with @var{prefix} as the main
27162routine for the debugger.
27163
27164@item -mmalloc64
27165@opindex mmalloc64
27166Default to 64-bit memory allocation routines.
27167
27168@item -mpointer-size=@var{size}
27169@opindex mpointer-size=@var{size}
27170Set the default size of pointers. Possible options for @var{size} are
27171@samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27172for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27173The later option disables @code{pragma pointer_size}.
27174@end table
27175
27176@node VxWorks Options
27177@subsection VxWorks Options
27178@cindex VxWorks Options
27179
27180The options in this section are defined for all VxWorks targets.
27181Options specific to the target hardware are listed with the other
27182options for that target.
27183
27184@table @gcctabopt
27185@item -mrtp
27186@opindex mrtp
27187GCC can generate code for both VxWorks kernels and real time processes
27188(RTPs).  This option switches from the former to the latter.  It also
27189defines the preprocessor macro @code{__RTP__}.
27190
27191@item -non-static
27192@opindex non-static
27193Link an RTP executable against shared libraries rather than static
27194libraries.  The options @option{-static} and @option{-shared} can
27195also be used for RTPs (@pxref{Link Options}); @option{-static}
27196is the default.
27197
27198@item -Bstatic
27199@itemx -Bdynamic
27200@opindex Bstatic
27201@opindex Bdynamic
27202These options are passed down to the linker.  They are defined for
27203compatibility with Diab.
27204
27205@item -Xbind-lazy
27206@opindex Xbind-lazy
27207Enable lazy binding of function calls.  This option is equivalent to
27208@option{-Wl,-z,now} and is defined for compatibility with Diab.
27209
27210@item -Xbind-now
27211@opindex Xbind-now
27212Disable lazy binding of function calls.  This option is the default and
27213is defined for compatibility with Diab.
27214@end table
27215
27216@node x86 Options
27217@subsection x86 Options
27218@cindex x86 Options
27219
27220These @samp{-m} options are defined for the x86 family of computers.
27221
27222@table @gcctabopt
27223
27224@item -march=@var{cpu-type}
27225@opindex march
27226Generate instructions for the machine type @var{cpu-type}.  In contrast to
27227@option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27228for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27229to generate code that may not run at all on processors other than the one
27230indicated.  Specifying @option{-march=@var{cpu-type}} implies
27231@option{-mtune=@var{cpu-type}}.
27232
27233The choices for @var{cpu-type} are:
27234
27235@table @samp
27236@item native
27237This selects the CPU to generate code for at compilation time by determining
27238the processor type of the compiling machine.  Using @option{-march=native}
27239enables all instruction subsets supported by the local machine (hence
27240the result might not run on different machines).  Using @option{-mtune=native}
27241produces code optimized for the local machine under the constraints
27242of the selected instruction set.
27243
27244@item x86-64
27245A generic CPU with 64-bit extensions.
27246
27247@item i386
27248Original Intel i386 CPU@.
27249
27250@item i486
27251Intel i486 CPU@.  (No scheduling is implemented for this chip.)
27252
27253@item i586
27254@itemx pentium
27255Intel Pentium CPU with no MMX support.
27256
27257@item lakemont
27258Intel Lakemont MCU, based on Intel Pentium CPU.
27259
27260@item pentium-mmx
27261Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27262
27263@item pentiumpro
27264Intel Pentium Pro CPU@.
27265
27266@item i686
27267When used with @option{-march}, the Pentium Pro
27268instruction set is used, so the code runs on all i686 family chips.
27269When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27270
27271@item pentium2
27272Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27273support.
27274
27275@item pentium3
27276@itemx pentium3m
27277Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27278set support.
27279
27280@item pentium-m
27281Intel Pentium M; low-power version of Intel Pentium III CPU
27282with MMX, SSE and SSE2 instruction set support.  Used by Centrino notebooks.
27283
27284@item pentium4
27285@itemx pentium4m
27286Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27287
27288@item prescott
27289Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27290set support.
27291
27292@item nocona
27293Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27294SSE2 and SSE3 instruction set support.
27295
27296@item core2
27297Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27298instruction set support.
27299
27300@item nehalem
27301Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27302SSE4.1, SSE4.2 and POPCNT instruction set support.
27303
27304@item westmere
27305Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27306SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27307
27308@item sandybridge
27309Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27310SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27311
27312@item ivybridge
27313Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27314SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27315instruction set support.
27316
27317@item haswell
27318Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27319SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27320BMI, BMI2 and F16C instruction set support.
27321
27322@item broadwell
27323Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27324SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2,
27325F16C, RDSEED ADCX and PREFETCHW instruction set support.
27326
27327@item skylake
27328Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27329SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27330BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES
27331instruction set support.
27332
27333@item bonnell
27334Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27335instruction set support.
27336
27337@item silvermont
27338Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27339SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL and RDRND instruction set support.
27340
27341@item goldmont
27342Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27343SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
27344XSAVEOPT and FSGSBASE instruction set support.
27345
27346@item goldmont-plus
27347Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27348SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
27349XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP instruction set support.
27350
27351@item tremont
27352Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27353SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
27354XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI,
27355MOVDIR64B, CLDEMOTE and WAITPKG instruction set support.
27356
27357@item knl
27358Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27359SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27360BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
27361AVX512ER and AVX512CD instruction set support.
27362
27363@item knm
27364Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27365SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27366BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
27367AVX512ER, AVX512CD, AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction
27368set support.
27369
27370@item skylake-avx512
27371Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27372SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27373BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27374CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27375
27376@item cannonlake
27377Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27378SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27379RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27380XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27381AVX512IFMA, SHA and UMIP instruction set support.
27382
27383@item icelake-client
27384Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27385SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27386RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27387XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27388AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27389AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27390
27391@item icelake-server
27392Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27393SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27394RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27395XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27396AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27397AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27398set support.
27399
27400@item cascadelake
27401Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27402SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27403BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27404AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27405
27406@item tigerlake
27407Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27408SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27409BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27410AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
27411RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
27412VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and CLWB instruction set support.
27413
27414@item k6
27415AMD K6 CPU with MMX instruction set support.
27416
27417@item k6-2
27418@itemx k6-3
27419Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27420
27421@item athlon
27422@itemx athlon-tbird
27423AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27424support.
27425
27426@item athlon-4
27427@itemx athlon-xp
27428@itemx athlon-mp
27429Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27430instruction set support.
27431
27432@item k8
27433@itemx opteron
27434@itemx athlon64
27435@itemx athlon-fx
27436Processors based on the AMD K8 core with x86-64 instruction set support,
27437including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27438(This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27439instruction set extensions.)
27440
27441@item k8-sse3
27442@itemx opteron-sse3
27443@itemx athlon64-sse3
27444Improved versions of AMD K8 cores with SSE3 instruction set support.
27445
27446@item amdfam10
27447@itemx barcelona
27448CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
27449supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27450instruction set extensions.)
27451
27452@item bdver1
27453CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
27454supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27455SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27456@item bdver2
27457AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
27458supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
27459SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27460extensions.)
27461@item bdver3
27462AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
27463supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27464PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
2746564-bit instruction set extensions.
27466@item bdver4
27467AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
27468supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27469AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27470SSE4.2, ABM and 64-bit instruction set extensions.
27471
27472@item znver1
27473AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
27474supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27475SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27476SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27477instruction set extensions.
27478@item znver2
27479AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27480supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27481MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27482SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27483instruction set extensions.)
27484
27485
27486@item btver1
27487CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
27488supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27489instruction set extensions.)
27490
27491@item btver2
27492CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27493includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27494SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27495
27496@item winchip-c6
27497IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27498set support.
27499
27500@item winchip2
27501IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27502instruction set support.
27503
27504@item c3
27505VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27506(No scheduling is implemented for this chip.)
27507
27508@item c3-2
27509VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27510(No scheduling is implemented for this chip.)
27511
27512@item c7
27513VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27514(No scheduling is implemented for this chip.)
27515
27516@item samuel-2
27517VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27518(No scheduling is implemented for this chip.)
27519
27520@item nehemiah
27521VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27522(No scheduling is implemented for this chip.)
27523
27524@item esther
27525VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27526(No scheduling is implemented for this chip.)
27527
27528@item eden-x2
27529VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27530(No scheduling is implemented for this chip.)
27531
27532@item eden-x4
27533VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27534AVX and AVX2 instruction set support.
27535(No scheduling is implemented for this chip.)
27536
27537@item nano
27538Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27539instruction set support.
27540(No scheduling is implemented for this chip.)
27541
27542@item nano-1000
27543VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27544instruction set support.
27545(No scheduling is implemented for this chip.)
27546
27547@item nano-2000
27548VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27549instruction set support.
27550(No scheduling is implemented for this chip.)
27551
27552@item nano-3000
27553VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27554instruction set support.
27555(No scheduling is implemented for this chip.)
27556
27557@item nano-x2
27558VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27559instruction set support.
27560(No scheduling is implemented for this chip.)
27561
27562@item nano-x4
27563VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27564instruction set support.
27565(No scheduling is implemented for this chip.)
27566
27567@item geode
27568AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27569@end table
27570
27571@item -mtune=@var{cpu-type}
27572@opindex mtune
27573Tune to @var{cpu-type} everything applicable about the generated code, except
27574for the ABI and the set of available instructions.
27575While picking a specific @var{cpu-type} schedules things appropriately
27576for that particular chip, the compiler does not generate any code that
27577cannot run on the default machine type unless you use a
27578@option{-march=@var{cpu-type}} option.
27579For example, if GCC is configured for i686-pc-linux-gnu
27580then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27581but still runs on i686 machines.
27582
27583The choices for @var{cpu-type} are the same as for @option{-march}.
27584In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27585
27586@table @samp
27587@item generic
27588Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27589If you know the CPU on which your code will run, then you should use
27590the corresponding @option{-mtune} or @option{-march} option instead of
27591@option{-mtune=generic}.  But, if you do not know exactly what CPU users
27592of your application will have, then you should use this option.
27593
27594As new processors are deployed in the marketplace, the behavior of this
27595option will change.  Therefore, if you upgrade to a newer version of
27596GCC, code generation controlled by this option will change to reflect
27597the processors
27598that are most common at the time that version of GCC is released.
27599
27600There is no @option{-march=generic} option because @option{-march}
27601indicates the instruction set the compiler can use, and there is no
27602generic instruction set applicable to all processors.  In contrast,
27603@option{-mtune} indicates the processor (or, in this case, collection of
27604processors) for which the code is optimized.
27605
27606@item intel
27607Produce code optimized for the most current Intel processors, which are
27608Haswell and Silvermont for this version of GCC.  If you know the CPU
27609on which your code will run, then you should use the corresponding
27610@option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27611But, if you want your application performs better on both Haswell and
27612Silvermont, then you should use this option.
27613
27614As new Intel processors are deployed in the marketplace, the behavior of
27615this option will change.  Therefore, if you upgrade to a newer version of
27616GCC, code generation controlled by this option will change to reflect
27617the most current Intel processors at the time that version of GCC is
27618released.
27619
27620There is no @option{-march=intel} option because @option{-march} indicates
27621the instruction set the compiler can use, and there is no common
27622instruction set applicable to all processors.  In contrast,
27623@option{-mtune} indicates the processor (or, in this case, collection of
27624processors) for which the code is optimized.
27625@end table
27626
27627@item -mcpu=@var{cpu-type}
27628@opindex mcpu
27629A deprecated synonym for @option{-mtune}.
27630
27631@item -mfpmath=@var{unit}
27632@opindex mfpmath
27633Generate floating-point arithmetic for selected unit @var{unit}.  The choices
27634for @var{unit} are:
27635
27636@table @samp
27637@item 387
27638Use the standard 387 floating-point coprocessor present on the majority of chips and
27639emulated otherwise.  Code compiled with this option runs almost everywhere.
27640The temporary results are computed in 80-bit precision instead of the precision
27641specified by the type, resulting in slightly different results compared to most
27642of other chips.  See @option{-ffloat-store} for more detailed description.
27643
27644This is the default choice for non-Darwin x86-32 targets.
27645
27646@item sse
27647Use scalar floating-point instructions present in the SSE instruction set.
27648This instruction set is supported by Pentium III and newer chips,
27649and in the AMD line
27650by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
27651instruction set supports only single-precision arithmetic, thus the double and
27652extended-precision arithmetic are still done using 387.  A later version, present
27653only in Pentium 4 and AMD x86-64 chips, supports double-precision
27654arithmetic too.
27655
27656For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27657or @option{-msse2} switches to enable SSE extensions and make this option
27658effective.  For the x86-64 compiler, these extensions are enabled by default.
27659
27660The resulting code should be considerably faster in the majority of cases and avoid
27661the numerical instability problems of 387 code, but may break some existing
27662code that expects temporaries to be 80 bits.
27663
27664This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27665and the default choice for x86-32 targets with the SSE2 instruction set
27666when @option{-ffast-math} is enabled.
27667
27668@item sse,387
27669@itemx sse+387
27670@itemx both
27671Attempt to utilize both instruction sets at once.  This effectively doubles the
27672amount of available registers, and on chips with separate execution units for
27673387 and SSE the execution resources too.  Use this option with care, as it is
27674still experimental, because the GCC register allocator does not model separate
27675functional units well, resulting in unstable performance.
27676@end table
27677
27678@item -masm=@var{dialect}
27679@opindex masm=@var{dialect}
27680Output assembly instructions using selected @var{dialect}.  Also affects
27681which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27682extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27683order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27684not support @samp{intel}.
27685
27686@item -mieee-fp
27687@itemx -mno-ieee-fp
27688@opindex mieee-fp
27689@opindex mno-ieee-fp
27690Control whether or not the compiler uses IEEE floating-point
27691comparisons.  These correctly handle the case where the result of a
27692comparison is unordered.
27693
27694@item -m80387
27695@itemx -mhard-float
27696@opindex 80387
27697@opindex mhard-float
27698Generate output containing 80387 instructions for floating point.
27699
27700@item -mno-80387
27701@itemx -msoft-float
27702@opindex no-80387
27703@opindex msoft-float
27704Generate output containing library calls for floating point.
27705
27706@strong{Warning:} the requisite libraries are not part of GCC@.
27707Normally the facilities of the machine's usual C compiler are used, but
27708this cannot be done directly in cross-compilation.  You must make your
27709own arrangements to provide suitable library functions for
27710cross-compilation.
27711
27712On machines where a function returns floating-point results in the 80387
27713register stack, some floating-point opcodes may be emitted even if
27714@option{-msoft-float} is used.
27715
27716@item -mno-fp-ret-in-387
27717@opindex mno-fp-ret-in-387
27718@opindex mfp-ret-in-387
27719Do not use the FPU registers for return values of functions.
27720
27721The usual calling convention has functions return values of types
27722@code{float} and @code{double} in an FPU register, even if there
27723is no FPU@.  The idea is that the operating system should emulate
27724an FPU@.
27725
27726The option @option{-mno-fp-ret-in-387} causes such values to be returned
27727in ordinary CPU registers instead.
27728
27729@item -mno-fancy-math-387
27730@opindex mno-fancy-math-387
27731@opindex mfancy-math-387
27732Some 387 emulators do not support the @code{sin}, @code{cos} and
27733@code{sqrt} instructions for the 387.  Specify this option to avoid
27734generating those instructions.
27735This option is overridden when @option{-march}
27736indicates that the target CPU always has an FPU and so the
27737instruction does not need emulation.  These
27738instructions are not generated unless you also use the
27739@option{-funsafe-math-optimizations} switch.
27740
27741@item -malign-double
27742@itemx -mno-align-double
27743@opindex malign-double
27744@opindex mno-align-double
27745Control whether GCC aligns @code{double}, @code{long double}, and
27746@code{long long} variables on a two-word boundary or a one-word
27747boundary.  Aligning @code{double} variables on a two-word boundary
27748produces code that runs somewhat faster on a Pentium at the
27749expense of more memory.
27750
27751On x86-64, @option{-malign-double} is enabled by default.
27752
27753@strong{Warning:} if you use the @option{-malign-double} switch,
27754structures containing the above types are aligned differently than
27755the published application binary interface specifications for the x86-32
27756and are not binary compatible with structures in code compiled
27757without that switch.
27758
27759@item -m96bit-long-double
27760@itemx -m128bit-long-double
27761@opindex m96bit-long-double
27762@opindex m128bit-long-double
27763These switches control the size of @code{long double} type.  The x86-32
27764application binary interface specifies the size to be 96 bits,
27765so @option{-m96bit-long-double} is the default in 32-bit mode.
27766
27767Modern architectures (Pentium and newer) prefer @code{long double}
27768to be aligned to an 8- or 16-byte boundary.  In arrays or structures
27769conforming to the ABI, this is not possible.  So specifying
27770@option{-m128bit-long-double} aligns @code{long double}
27771to a 16-byte boundary by padding the @code{long double} with an additional
2777232-bit zero.
27773
27774In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27775its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27776
27777Notice that neither of these options enable any extra precision over the x87
27778standard of 80 bits for a @code{long double}.
27779
27780@strong{Warning:} if you override the default value for your target ABI, this
27781changes the size of
27782structures and arrays containing @code{long double} variables,
27783as well as modifying the function calling convention for functions taking
27784@code{long double}.  Hence they are not binary-compatible
27785with code compiled without that switch.
27786
27787@item -mlong-double-64
27788@itemx -mlong-double-80
27789@itemx -mlong-double-128
27790@opindex mlong-double-64
27791@opindex mlong-double-80
27792@opindex mlong-double-128
27793These switches control the size of @code{long double} type. A size
27794of 64 bits makes the @code{long double} type equivalent to the @code{double}
27795type. This is the default for 32-bit Bionic C library.  A size
27796of 128 bits makes the @code{long double} type equivalent to the
27797@code{__float128} type. This is the default for 64-bit Bionic C library.
27798
27799@strong{Warning:} if you override the default value for your target ABI, this
27800changes the size of
27801structures and arrays containing @code{long double} variables,
27802as well as modifying the function calling convention for functions taking
27803@code{long double}.  Hence they are not binary-compatible
27804with code compiled without that switch.
27805
27806@item -malign-data=@var{type}
27807@opindex malign-data
27808Control how GCC aligns variables.  Supported values for @var{type} are
27809@samp{compat} uses increased alignment value compatible uses GCC 4.8
27810and earlier, @samp{abi} uses alignment value as specified by the
27811psABI, and @samp{cacheline} uses increased alignment value to match
27812the cache line size.  @samp{compat} is the default.
27813
27814@item -mlarge-data-threshold=@var{threshold}
27815@opindex mlarge-data-threshold
27816When @option{-mcmodel=medium} is specified, data objects larger than
27817@var{threshold} are placed in the large data section.  This value must be the
27818same across all objects linked into the binary, and defaults to 65535.
27819
27820@item -mrtd
27821@opindex mrtd
27822Use a different function-calling convention, in which functions that
27823take a fixed number of arguments return with the @code{ret @var{num}}
27824instruction, which pops their arguments while returning.  This saves one
27825instruction in the caller since there is no need to pop the arguments
27826there.
27827
27828You can specify that an individual function is called with this calling
27829sequence with the function attribute @code{stdcall}.  You can also
27830override the @option{-mrtd} option by using the function attribute
27831@code{cdecl}.  @xref{Function Attributes}.
27832
27833@strong{Warning:} this calling convention is incompatible with the one
27834normally used on Unix, so you cannot use it if you need to call
27835libraries compiled with the Unix compiler.
27836
27837Also, you must provide function prototypes for all functions that
27838take variable numbers of arguments (including @code{printf});
27839otherwise incorrect code is generated for calls to those
27840functions.
27841
27842In addition, seriously incorrect code results if you call a
27843function with too many arguments.  (Normally, extra arguments are
27844harmlessly ignored.)
27845
27846@item -mregparm=@var{num}
27847@opindex mregparm
27848Control how many registers are used to pass integer arguments.  By
27849default, no registers are used to pass arguments, and at most 3
27850registers can be used.  You can control this behavior for a specific
27851function by using the function attribute @code{regparm}.
27852@xref{Function Attributes}.
27853
27854@strong{Warning:} if you use this switch, and
27855@var{num} is nonzero, then you must build all modules with the same
27856value, including any libraries.  This includes the system libraries and
27857startup modules.
27858
27859@item -msseregparm
27860@opindex msseregparm
27861Use SSE register passing conventions for float and double arguments
27862and return values.  You can control this behavior for a specific
27863function by using the function attribute @code{sseregparm}.
27864@xref{Function Attributes}.
27865
27866@strong{Warning:} if you use this switch then you must build all
27867modules with the same value, including any libraries.  This includes
27868the system libraries and startup modules.
27869
27870@item -mvect8-ret-in-mem
27871@opindex mvect8-ret-in-mem
27872Return 8-byte vectors in memory instead of MMX registers.  This is the
27873default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
27874Studio compilers until version 12.  Later compiler versions (starting
27875with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
27876is the default on Solaris@tie{}10 and later.  @emph{Only} use this option if
27877you need to remain compatible with existing code produced by those
27878previous compiler versions or older versions of GCC@.
27879
27880@item -mpc32
27881@itemx -mpc64
27882@itemx -mpc80
27883@opindex mpc32
27884@opindex mpc64
27885@opindex mpc80
27886
27887Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
27888is specified, the significands of results of floating-point operations are
27889rounded to 24 bits (single precision); @option{-mpc64} rounds the
27890significands of results of floating-point operations to 53 bits (double
27891precision) and @option{-mpc80} rounds the significands of results of
27892floating-point operations to 64 bits (extended double precision), which is
27893the default.  When this option is used, floating-point operations in higher
27894precisions are not available to the programmer without setting the FPU
27895control word explicitly.
27896
27897Setting the rounding of floating-point operations to less than the default
2789880 bits can speed some programs by 2% or more.  Note that some mathematical
27899libraries assume that extended-precision (80-bit) floating-point operations
27900are enabled by default; routines in such libraries could suffer significant
27901loss of accuracy, typically through so-called ``catastrophic cancellation'',
27902when this option is used to set the precision to less than extended precision.
27903
27904@item -mstackrealign
27905@opindex mstackrealign
27906Realign the stack at entry.  On the x86, the @option{-mstackrealign}
27907option generates an alternate prologue and epilogue that realigns the
27908run-time stack if necessary.  This supports mixing legacy codes that keep
279094-byte stack alignment with modern codes that keep 16-byte stack alignment for
27910SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
27911applicable to individual functions.
27912
27913@item -mpreferred-stack-boundary=@var{num}
27914@opindex mpreferred-stack-boundary
27915Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27916byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
27917the default is 4 (16 bytes or 128 bits).
27918
27919@strong{Warning:} When generating code for the x86-64 architecture with
27920SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27921used to keep the stack boundary aligned to 8 byte boundary.  Since
27922x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27923intended to be used in controlled environment where stack space is
27924important limitation.  This option leads to wrong code when functions
27925compiled with 16 byte stack alignment (such as functions from a standard
27926library) are called with misaligned stack.  In this case, SSE
27927instructions may lead to misaligned memory access traps.  In addition,
27928variable arguments are handled incorrectly for 16 byte aligned
27929objects (including x87 long double and __int128), leading to wrong
27930results.  You must build all modules with
27931@option{-mpreferred-stack-boundary=3}, including any libraries.  This
27932includes the system libraries and startup modules.
27933
27934@item -mincoming-stack-boundary=@var{num}
27935@opindex mincoming-stack-boundary
27936Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27937boundary.  If @option{-mincoming-stack-boundary} is not specified,
27938the one specified by @option{-mpreferred-stack-boundary} is used.
27939
27940On Pentium and Pentium Pro, @code{double} and @code{long double} values
27941should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27942suffer significant run time performance penalties.  On Pentium III, the
27943Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27944properly if it is not 16-byte aligned.
27945
27946To ensure proper alignment of this values on the stack, the stack boundary
27947must be as aligned as that required by any value stored on the stack.
27948Further, every function must be generated such that it keeps the stack
27949aligned.  Thus calling a function compiled with a higher preferred
27950stack boundary from a function compiled with a lower preferred stack
27951boundary most likely misaligns the stack.  It is recommended that
27952libraries that use callbacks always use the default setting.
27953
27954This extra alignment does consume extra stack space, and generally
27955increases code size.  Code that is sensitive to stack space usage, such
27956as embedded systems and operating system kernels, may want to reduce the
27957preferred alignment to @option{-mpreferred-stack-boundary=2}.
27958
27959@need 200
27960@item -mmmx
27961@opindex mmmx
27962@need 200
27963@itemx -msse
27964@opindex msse
27965@need 200
27966@itemx -msse2
27967@opindex msse2
27968@need 200
27969@itemx -msse3
27970@opindex msse3
27971@need 200
27972@itemx -mssse3
27973@opindex mssse3
27974@need 200
27975@itemx -msse4
27976@opindex msse4
27977@need 200
27978@itemx -msse4a
27979@opindex msse4a
27980@need 200
27981@itemx -msse4.1
27982@opindex msse4.1
27983@need 200
27984@itemx -msse4.2
27985@opindex msse4.2
27986@need 200
27987@itemx -mavx
27988@opindex mavx
27989@need 200
27990@itemx -mavx2
27991@opindex mavx2
27992@need 200
27993@itemx -mavx512f
27994@opindex mavx512f
27995@need 200
27996@itemx -mavx512pf
27997@opindex mavx512pf
27998@need 200
27999@itemx -mavx512er
28000@opindex mavx512er
28001@need 200
28002@itemx -mavx512cd
28003@opindex mavx512cd
28004@need 200
28005@itemx -mavx512vl
28006@opindex mavx512vl
28007@need 200
28008@itemx -mavx512bw
28009@opindex mavx512bw
28010@need 200
28011@itemx -mavx512dq
28012@opindex mavx512dq
28013@need 200
28014@itemx -mavx512ifma
28015@opindex mavx512ifma
28016@need 200
28017@itemx -mavx512vbmi
28018@opindex mavx512vbmi
28019@need 200
28020@itemx -msha
28021@opindex msha
28022@need 200
28023@itemx -maes
28024@opindex maes
28025@need 200
28026@itemx -mpclmul
28027@opindex mpclmul
28028@need 200
28029@itemx -mclflushopt
28030@opindex mclflushopt
28031@need 200
28032@itemx -mclwb
28033@opindex mclwb
28034@need 200
28035@itemx -mfsgsbase
28036@opindex mfsgsbase
28037@need 200
28038@itemx -mptwrite
28039@opindex mptwrite
28040@need 200
28041@itemx -mrdrnd
28042@opindex mrdrnd
28043@need 200
28044@itemx -mf16c
28045@opindex mf16c
28046@need 200
28047@itemx -mfma
28048@opindex mfma
28049@need 200
28050@itemx -mpconfig
28051@opindex mpconfig
28052@need 200
28053@itemx -mwbnoinvd
28054@opindex mwbnoinvd
28055@need 200
28056@itemx -mfma4
28057@opindex mfma4
28058@need 200
28059@itemx -mprfchw
28060@opindex mprfchw
28061@need 200
28062@itemx -mrdpid
28063@opindex mrdpid
28064@need 200
28065@itemx -mprefetchwt1
28066@opindex mprefetchwt1
28067@need 200
28068@itemx -mrdseed
28069@opindex mrdseed
28070@need 200
28071@itemx -msgx
28072@opindex msgx
28073@need 200
28074@itemx -mxop
28075@opindex mxop
28076@need 200
28077@itemx -mlwp
28078@opindex mlwp
28079@need 200
28080@itemx -m3dnow
28081@opindex m3dnow
28082@need 200
28083@itemx -m3dnowa
28084@opindex m3dnowa
28085@need 200
28086@itemx -mpopcnt
28087@opindex mpopcnt
28088@need 200
28089@itemx -mabm
28090@opindex mabm
28091@need 200
28092@itemx -madx
28093@opindex madx
28094@need 200
28095@itemx -mbmi
28096@opindex mbmi
28097@need 200
28098@itemx -mbmi2
28099@opindex mbmi2
28100@need 200
28101@itemx -mlzcnt
28102@opindex mlzcnt
28103@need 200
28104@itemx -mfxsr
28105@opindex mfxsr
28106@need 200
28107@itemx -mxsave
28108@opindex mxsave
28109@need 200
28110@itemx -mxsaveopt
28111@opindex mxsaveopt
28112@need 200
28113@itemx -mxsavec
28114@opindex mxsavec
28115@need 200
28116@itemx -mxsaves
28117@opindex mxsaves
28118@need 200
28119@itemx -mrtm
28120@opindex mrtm
28121@need 200
28122@itemx -mhle
28123@opindex mhle
28124@need 200
28125@itemx -mtbm
28126@opindex mtbm
28127@need 200
28128@itemx -mmwaitx
28129@opindex mmwaitx
28130@need 200
28131@itemx -mclzero
28132@opindex mclzero
28133@need 200
28134@itemx -mpku
28135@opindex mpku
28136@need 200
28137@itemx -mavx512vbmi2
28138@opindex mavx512vbmi2
28139@need 200
28140@itemx -mgfni
28141@opindex mgfni
28142@need 200
28143@itemx -mvaes
28144@opindex mvaes
28145@need 200
28146@itemx -mwaitpkg
28147@opindex mwaitpkg
28148@need 200
28149@itemx -mvpclmulqdq
28150@opindex mvpclmulqdq
28151@need 200
28152@itemx -mavx512bitalg
28153@opindex mavx512bitalg
28154@need 200
28155@itemx -mmovdiri
28156@opindex mmovdiri
28157@need 200
28158@itemx -mmovdir64b
28159@opindex mmovdir64b
28160@need 200
28161@itemx -mavx512vpopcntdq
28162@opindex mavx512vpopcntdq
28163@need 200
28164@itemx -mavx5124fmaps
28165@opindex mavx5124fmaps
28166@need 200
28167@itemx -mavx512vnni
28168@opindex mavx512vnni
28169@need 200
28170@itemx -mavx5124vnniw
28171@opindex mavx5124vnniw
28172@need 200
28173@itemx -mcldemote
28174@opindex mcldemote
28175These switches enable the use of instructions in the MMX, SSE,
28176SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28177AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28178AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28179WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
281803DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28181XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28182GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
28183AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28184extended instruction sets.  Each has a corresponding @option{-mno-} option to
28185disable use of these instructions.
28186
28187These extensions are also available as built-in functions: see
28188@ref{x86 Built-in Functions}, for details of the functions enabled and
28189disabled by these switches.
28190
28191To generate SSE/SSE2 instructions automatically from floating-point
28192code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28193
28194GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28195generates new AVX instructions or AVX equivalence for all SSEx instructions
28196when needed.
28197
28198These options enable GCC to use these extended instructions in
28199generated code, even without @option{-mfpmath=sse}.  Applications that
28200perform run-time CPU detection must compile separate files for each
28201supported architecture, using the appropriate flags.  In particular,
28202the file containing the CPU detection code should be compiled without
28203these options.
28204
28205@item -mdump-tune-features
28206@opindex mdump-tune-features
28207This option instructs GCC to dump the names of the x86 performance
28208tuning features and default settings. The names can be used in
28209@option{-mtune-ctrl=@var{feature-list}}.
28210
28211@item -mtune-ctrl=@var{feature-list}
28212@opindex mtune-ctrl=@var{feature-list}
28213This option is used to do fine grain control of x86 code generation features.
28214@var{feature-list} is a comma separated list of @var{feature} names. See also
28215@option{-mdump-tune-features}. When specified, the @var{feature} is turned
28216on if it is not preceded with @samp{^}, otherwise, it is turned off.
28217@option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28218developers. Using it may lead to code paths not covered by testing and can
28219potentially result in compiler ICEs or runtime errors.
28220
28221@item -mno-default
28222@opindex mno-default
28223This option instructs GCC to turn off all tunable features. See also
28224@option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28225
28226@item -mcld
28227@opindex mcld
28228This option instructs GCC to emit a @code{cld} instruction in the prologue
28229of functions that use string instructions.  String instructions depend on
28230the DF flag to select between autoincrement or autodecrement mode.  While the
28231ABI specifies the DF flag to be cleared on function entry, some operating
28232systems violate this specification by not clearing the DF flag in their
28233exception dispatchers.  The exception handler can be invoked with the DF flag
28234set, which leads to wrong direction mode when string instructions are used.
28235This option can be enabled by default on 32-bit x86 targets by configuring
28236GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
28237instructions can be suppressed with the @option{-mno-cld} compiler option
28238in this case.
28239
28240@item -mvzeroupper
28241@opindex mvzeroupper
28242This option instructs GCC to emit a @code{vzeroupper} instruction
28243before a transfer of control flow out of the function to minimize
28244the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28245intrinsics.
28246
28247@item -mprefer-avx128
28248@opindex mprefer-avx128
28249This option instructs GCC to use 128-bit AVX instructions instead of
28250256-bit AVX instructions in the auto-vectorizer.
28251
28252@item -mprefer-vector-width=@var{opt}
28253@opindex mprefer-vector-width
28254This option instructs GCC to use @var{opt}-bit vector width in instructions
28255instead of default on the selected platform.
28256
28257@table @samp
28258@item none
28259No extra limitations applied to GCC other than defined by the selected platform.
28260
28261@item 128
28262Prefer 128-bit vector width for instructions.
28263
28264@item 256
28265Prefer 256-bit vector width for instructions.
28266
28267@item 512
28268Prefer 512-bit vector width for instructions.
28269@end table
28270
28271@item -mcx16
28272@opindex mcx16
28273This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28274code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28275objects.  This is useful for atomic updates of data structures exceeding one
28276machine word in size.  The compiler uses this instruction to implement
28277@ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
28278128-bit integers, a library call is always used.
28279
28280@item -msahf
28281@opindex msahf
28282This option enables generation of @code{SAHF} instructions in 64-bit code.
28283Early Intel Pentium 4 CPUs with Intel 64 support,
28284prior to the introduction of Pentium 4 G1 step in December 2005,
28285lacked the @code{LAHF} and @code{SAHF} instructions
28286which are supported by AMD64.
28287These are load and store instructions, respectively, for certain status flags.
28288In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28289@code{drem}, and @code{remainder} built-in functions;
28290see @ref{Other Builtins} for details.
28291
28292@item -mmovbe
28293@opindex mmovbe
28294This option enables use of the @code{movbe} instruction to implement
28295@code{__builtin_bswap32} and @code{__builtin_bswap64}.
28296
28297@item -mshstk
28298@opindex mshstk
28299The @option{-mshstk} option enables shadow stack built-in functions
28300from x86 Control-flow Enforcement Technology (CET).
28301
28302@item -mcrc32
28303@opindex mcrc32
28304This option enables built-in functions @code{__builtin_ia32_crc32qi},
28305@code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28306@code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28307
28308@item -mrecip
28309@opindex mrecip
28310This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28311(and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28312with an additional Newton-Raphson step
28313to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28314(and their vectorized
28315variants) for single-precision floating-point arguments.  These instructions
28316are generated only when @option{-funsafe-math-optimizations} is enabled
28317together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28318Note that while the throughput of the sequence is higher than the throughput
28319of the non-reciprocal instruction, the precision of the sequence can be
28320decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28321
28322Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28323(or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28324combination), and doesn't need @option{-mrecip}.
28325
28326Also note that GCC emits the above sequence with additional Newton-Raphson step
28327for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28328already with @option{-ffast-math} (or the above option combination), and
28329doesn't need @option{-mrecip}.
28330
28331@item -mrecip=@var{opt}
28332@opindex mrecip=opt
28333This option controls which reciprocal estimate instructions
28334may be used.  @var{opt} is a comma-separated list of options, which may
28335be preceded by a @samp{!} to invert the option:
28336
28337@table @samp
28338@item all
28339Enable all estimate instructions.
28340
28341@item default
28342Enable the default instructions, equivalent to @option{-mrecip}.
28343
28344@item none
28345Disable all estimate instructions, equivalent to @option{-mno-recip}.
28346
28347@item div
28348Enable the approximation for scalar division.
28349
28350@item vec-div
28351Enable the approximation for vectorized division.
28352
28353@item sqrt
28354Enable the approximation for scalar square root.
28355
28356@item vec-sqrt
28357Enable the approximation for vectorized square root.
28358@end table
28359
28360So, for example, @option{-mrecip=all,!sqrt} enables
28361all of the reciprocal approximations, except for square root.
28362
28363@item -mveclibabi=@var{type}
28364@opindex mveclibabi
28365Specifies the ABI type to use for vectorizing intrinsics using an
28366external library.  Supported values for @var{type} are @samp{svml}
28367for the Intel short
28368vector math library and @samp{acml} for the AMD math core library.
28369To use this option, both @option{-ftree-vectorize} and
28370@option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28371ABI-compatible library must be specified at link time.
28372
28373GCC currently emits calls to @code{vmldExp2},
28374@code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28375@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28376@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28377@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28378@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28379@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28380@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28381@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28382@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28383function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28384@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28385@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28386@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28387@code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28388when @option{-mveclibabi=acml} is used.
28389
28390@item -mabi=@var{name}
28391@opindex mabi
28392Generate code for the specified calling convention.  Permissible values
28393are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28394@samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
28395ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28396You can control this behavior for specific functions by
28397using the function attributes @code{ms_abi} and @code{sysv_abi}.
28398@xref{Function Attributes}.
28399
28400@item -mforce-indirect-call
28401@opindex mforce-indirect-call
28402Force all calls to functions to be indirect. This is useful
28403when using Intel Processor Trace where it generates more precise timing
28404information for function calls.
28405
28406@item -mmanual-endbr
28407@opindex mmanual-endbr
28408Insert ENDBR instruction at function entry only via the @code{cf_check}
28409function attribute. This is useful when used with the option
28410@option{-fcf-protection=branch} to control ENDBR insertion at the
28411function entry.
28412
28413@item -mcall-ms2sysv-xlogues
28414@opindex mcall-ms2sysv-xlogues
28415@opindex mno-call-ms2sysv-xlogues
28416Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28417System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
28418default, the code for saving and restoring these registers is emitted inline,
28419resulting in fairly lengthy prologues and epilogues.  Using
28420@option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28421use stubs in the static portion of libgcc to perform these saves and restores,
28422thus reducing function size at the cost of a few extra instructions.
28423
28424@item -mtls-dialect=@var{type}
28425@opindex mtls-dialect
28426Generate code to access thread-local storage using the @samp{gnu} or
28427@samp{gnu2} conventions.  @samp{gnu} is the conservative default;
28428@samp{gnu2} is more efficient, but it may add compile- and run-time
28429requirements that cannot be satisfied on all systems.
28430
28431@item -mpush-args
28432@itemx -mno-push-args
28433@opindex mpush-args
28434@opindex mno-push-args
28435Use PUSH operations to store outgoing parameters.  This method is shorter
28436and usually equally fast as method using SUB/MOV operations and is enabled
28437by default.  In some cases disabling it may improve performance because of
28438improved scheduling and reduced dependencies.
28439
28440@item -maccumulate-outgoing-args
28441@opindex maccumulate-outgoing-args
28442If enabled, the maximum amount of space required for outgoing arguments is
28443computed in the function prologue.  This is faster on most modern CPUs
28444because of reduced dependencies, improved scheduling and reduced stack usage
28445when the preferred stack boundary is not equal to 2.  The drawback is a notable
28446increase in code size.  This switch implies @option{-mno-push-args}.
28447
28448@item -mthreads
28449@opindex mthreads
28450Support thread-safe exception handling on MinGW.  Programs that rely
28451on thread-safe exception handling must compile and link all code with the
28452@option{-mthreads} option.  When compiling, @option{-mthreads} defines
28453@option{-D_MT}; when linking, it links in a special thread helper library
28454@option{-lmingwthrd} which cleans up per-thread exception-handling data.
28455
28456@item -mms-bitfields
28457@itemx -mno-ms-bitfields
28458@opindex mms-bitfields
28459@opindex mno-ms-bitfields
28460
28461Enable/disable bit-field layout compatible with the native Microsoft
28462Windows compiler.
28463
28464If @code{packed} is used on a structure, or if bit-fields are used,
28465it may be that the Microsoft ABI lays out the structure differently
28466than the way GCC normally does.  Particularly when moving packed
28467data between functions compiled with GCC and the native Microsoft compiler
28468(either via function call or as data in a file), it may be necessary to access
28469either format.
28470
28471This option is enabled by default for Microsoft Windows
28472targets.  This behavior can also be controlled locally by use of variable
28473or type attributes.  For more information, see @ref{x86 Variable Attributes}
28474and @ref{x86 Type Attributes}.
28475
28476The Microsoft structure layout algorithm is fairly simple with the exception
28477of the bit-field packing.
28478The padding and alignment of members of structures and whether a bit-field
28479can straddle a storage-unit boundary are determine by these rules:
28480
28481@enumerate
28482@item Structure members are stored sequentially in the order in which they are
28483declared: the first member has the lowest memory address and the last member
28484the highest.
28485
28486@item Every data object has an alignment requirement.  The alignment requirement
28487for all data except structures, unions, and arrays is either the size of the
28488object or the current packing size (specified with either the
28489@code{aligned} attribute or the @code{pack} pragma),
28490whichever is less.  For structures, unions, and arrays,
28491the alignment requirement is the largest alignment requirement of its members.
28492Every object is allocated an offset so that:
28493
28494@smallexample
28495offset % alignment_requirement == 0
28496@end smallexample
28497
28498@item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28499unit if the integral types are the same size and if the next bit-field fits
28500into the current allocation unit without crossing the boundary imposed by the
28501common alignment requirements of the bit-fields.
28502@end enumerate
28503
28504MSVC interprets zero-length bit-fields in the following ways:
28505
28506@enumerate
28507@item If a zero-length bit-field is inserted between two bit-fields that
28508are normally coalesced, the bit-fields are not coalesced.
28509
28510For example:
28511
28512@smallexample
28513struct
28514 @{
28515   unsigned long bf_1 : 12;
28516   unsigned long : 0;
28517   unsigned long bf_2 : 12;
28518 @} t1;
28519@end smallexample
28520
28521@noindent
28522The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
28523zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28524
28525@item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28526alignment of the zero-length bit-field is greater than the member that follows it,
28527@code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28528
28529For example:
28530
28531@smallexample
28532struct
28533 @{
28534   char foo : 4;
28535   short : 0;
28536   char bar;
28537 @} t2;
28538
28539struct
28540 @{
28541   char foo : 4;
28542   short : 0;
28543   double bar;
28544 @} t3;
28545@end smallexample
28546
28547@noindent
28548For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28549Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
28550bit-field does not affect the alignment of @code{bar} or, as a result, the size
28551of the structure.
28552
28553Taking this into account, it is important to note the following:
28554
28555@enumerate
28556@item If a zero-length bit-field follows a normal bit-field, the type of the
28557zero-length bit-field may affect the alignment of the structure as whole. For
28558example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28559normal bit-field, and is of type short.
28560
28561@item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28562still affect the alignment of the structure:
28563
28564@smallexample
28565struct
28566 @{
28567   char foo : 6;
28568   long : 0;
28569 @} t4;
28570@end smallexample
28571
28572@noindent
28573Here, @code{t4} takes up 4 bytes.
28574@end enumerate
28575
28576@item Zero-length bit-fields following non-bit-field members are ignored:
28577
28578@smallexample
28579struct
28580 @{
28581   char foo;
28582   long : 0;
28583   char bar;
28584 @} t5;
28585@end smallexample
28586
28587@noindent
28588Here, @code{t5} takes up 2 bytes.
28589@end enumerate
28590
28591
28592@item -mno-align-stringops
28593@opindex mno-align-stringops
28594@opindex malign-stringops
28595Do not align the destination of inlined string operations.  This switch reduces
28596code size and improves performance in case the destination is already aligned,
28597but GCC doesn't know about it.
28598
28599@item -minline-all-stringops
28600@opindex minline-all-stringops
28601By default GCC inlines string operations only when the destination is
28602known to be aligned to least a 4-byte boundary.
28603This enables more inlining and increases code
28604size, but may improve performance of code that depends on fast
28605@code{memcpy}, @code{strlen},
28606and @code{memset} for short lengths.
28607
28608@item -minline-stringops-dynamically
28609@opindex minline-stringops-dynamically
28610For string operations of unknown size, use run-time checks with
28611inline code for small blocks and a library call for large blocks.
28612
28613@item -mstringop-strategy=@var{alg}
28614@opindex mstringop-strategy=@var{alg}
28615Override the internal decision heuristic for the particular algorithm to use
28616for inlining string operations.  The allowed values for @var{alg} are:
28617
28618@table @samp
28619@item rep_byte
28620@itemx rep_4byte
28621@itemx rep_8byte
28622Expand using i386 @code{rep} prefix of the specified size.
28623
28624@item byte_loop
28625@itemx loop
28626@itemx unrolled_loop
28627Expand into an inline loop.
28628
28629@item libcall
28630Always use a library call.
28631@end table
28632
28633@item -mmemcpy-strategy=@var{strategy}
28634@opindex mmemcpy-strategy=@var{strategy}
28635Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28636should be inlined and what inline algorithm to use when the expected size
28637of the copy operation is known. @var{strategy}
28638is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28639@var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28640the max byte size with which inline algorithm @var{alg} is allowed.  For the last
28641triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28642in the list must be specified in increasing order.  The minimal byte size for
28643@var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28644preceding range.
28645
28646@item -mmemset-strategy=@var{strategy}
28647@opindex mmemset-strategy=@var{strategy}
28648The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28649@code{__builtin_memset} expansion.
28650
28651@item -momit-leaf-frame-pointer
28652@opindex momit-leaf-frame-pointer
28653Don't keep the frame pointer in a register for leaf functions.  This
28654avoids the instructions to save, set up, and restore frame pointers and
28655makes an extra register available in leaf functions.  The option
28656@option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28657which might make debugging harder.
28658
28659@item -mtls-direct-seg-refs
28660@itemx -mno-tls-direct-seg-refs
28661@opindex mtls-direct-seg-refs
28662Controls whether TLS variables may be accessed with offsets from the
28663TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28664or whether the thread base pointer must be added.  Whether or not this
28665is valid depends on the operating system, and whether it maps the
28666segment to cover the entire TLS area.
28667
28668For systems that use the GNU C Library, the default is on.
28669
28670@item -msse2avx
28671@itemx -mno-sse2avx
28672@opindex msse2avx
28673Specify that the assembler should encode SSE instructions with VEX
28674prefix.  The option @option{-mavx} turns this on by default.
28675
28676@item -mfentry
28677@itemx -mno-fentry
28678@opindex mfentry
28679If profiling is active (@option{-pg}), put the profiling
28680counter call before the prologue.
28681Note: On x86 architectures the attribute @code{ms_hook_prologue}
28682isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28683
28684@item -mrecord-mcount
28685@itemx -mno-record-mcount
28686@opindex mrecord-mcount
28687If profiling is active (@option{-pg}), generate a __mcount_loc section
28688that contains pointers to each profiling call. This is useful for
28689automatically patching and out calls.
28690
28691@item -mnop-mcount
28692@itemx -mno-nop-mcount
28693@opindex mnop-mcount
28694If profiling is active (@option{-pg}), generate the calls to
28695the profiling functions as NOPs. This is useful when they
28696should be patched in later dynamically. This is likely only
28697useful together with @option{-mrecord-mcount}.
28698
28699@item -minstrument-return=@var{type}
28700@opindex minstrument-return
28701Instrument function exit in -pg -mfentry instrumented functions with
28702call to specified function. This only instruments true returns ending
28703with ret, but not sibling calls ending with jump. Valid types
28704are @var{none} to not instrument, @var{call} to generate a call to __return__,
28705or @var{nop5} to generate a 5 byte nop.
28706
28707@item -mrecord-return
28708@itemx -mno-record-return
28709@opindex mrecord-return
28710Generate a __return_loc section pointing to all return instrumentation code.
28711
28712@item -mfentry-name=@var{name}
28713@opindex mfentry-name
28714Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28715
28716@item -mfentry-section=@var{name}
28717@opindex mfentry-section
28718Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28719
28720@item -mskip-rax-setup
28721@itemx -mno-skip-rax-setup
28722@opindex mskip-rax-setup
28723When generating code for the x86-64 architecture with SSE extensions
28724disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28725register when there are no variable arguments passed in vector registers.
28726
28727@strong{Warning:} Since RAX register is used to avoid unnecessarily
28728saving vector registers on stack when passing variable arguments, the
28729impacts of this option are callees may waste some stack space,
28730misbehave or jump to a random location.  GCC 4.4 or newer don't have
28731those issues, regardless the RAX register value.
28732
28733@item -m8bit-idiv
28734@itemx -mno-8bit-idiv
28735@opindex m8bit-idiv
28736On some processors, like Intel Atom, 8-bit unsigned integer divide is
28737much faster than 32-bit/64-bit integer divide.  This option generates a
28738run-time check.  If both dividend and divisor are within range of 0
28739to 255, 8-bit unsigned integer divide is used instead of
2874032-bit/64-bit integer divide.
28741
28742@item -mavx256-split-unaligned-load
28743@itemx -mavx256-split-unaligned-store
28744@opindex mavx256-split-unaligned-load
28745@opindex mavx256-split-unaligned-store
28746Split 32-byte AVX unaligned load and store.
28747
28748@item -mstack-protector-guard=@var{guard}
28749@itemx -mstack-protector-guard-reg=@var{reg}
28750@itemx -mstack-protector-guard-offset=@var{offset}
28751@opindex mstack-protector-guard
28752@opindex mstack-protector-guard-reg
28753@opindex mstack-protector-guard-offset
28754Generate stack protection code using canary at @var{guard}.  Supported
28755locations are @samp{global} for global canary or @samp{tls} for per-thread
28756canary in the TLS block (the default).  This option has effect only when
28757@option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28758
28759With the latter choice the options
28760@option{-mstack-protector-guard-reg=@var{reg}} and
28761@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28762which segment register (@code{%fs} or @code{%gs}) to use as base register
28763for reading the canary, and from what offset from that base register.
28764The default for those is as specified in the relevant ABI.
28765
28766@item -mgeneral-regs-only
28767@opindex mgeneral-regs-only
28768Generate code that uses only the general-purpose registers.  This
28769prevents the compiler from using floating-point, vector, mask and bound
28770registers.
28771
28772@item -mindirect-branch=@var{choice}
28773@opindex mindirect-branch
28774Convert indirect call and jump with @var{choice}.  The default is
28775@samp{keep}, which keeps indirect call and jump unmodified.
28776@samp{thunk} converts indirect call and jump to call and return thunk.
28777@samp{thunk-inline} converts indirect call and jump to inlined call
28778and return thunk.  @samp{thunk-extern} converts indirect call and jump
28779to external call and return thunk provided in a separate object file.
28780You can control this behavior for a specific function by using the
28781function attribute @code{indirect_branch}.  @xref{Function Attributes}.
28782
28783Note that @option{-mcmodel=large} is incompatible with
28784@option{-mindirect-branch=thunk} and
28785@option{-mindirect-branch=thunk-extern} since the thunk function may
28786not be reachable in the large code model.
28787
28788Note that @option{-mindirect-branch=thunk-extern} is compatible with
28789@option{-fcf-protection=branch} since the external thunk can be made
28790to enable control-flow check.
28791
28792@item -mfunction-return=@var{choice}
28793@opindex mfunction-return
28794Convert function return with @var{choice}.  The default is @samp{keep},
28795which keeps function return unmodified.  @samp{thunk} converts function
28796return to call and return thunk.  @samp{thunk-inline} converts function
28797return to inlined call and return thunk.  @samp{thunk-extern} converts
28798function return to external call and return thunk provided in a separate
28799object file.  You can control this behavior for a specific function by
28800using the function attribute @code{function_return}.
28801@xref{Function Attributes}.
28802
28803Note that @option{-mindirect-return=thunk-extern} is compatible with
28804@option{-fcf-protection=branch} since the external thunk can be made
28805to enable control-flow check.
28806
28807Note that @option{-mcmodel=large} is incompatible with
28808@option{-mfunction-return=thunk} and
28809@option{-mfunction-return=thunk-extern} since the thunk function may
28810not be reachable in the large code model.
28811
28812
28813@item -mindirect-branch-register
28814@opindex mindirect-branch-register
28815Force indirect call and jump via register.
28816
28817@end table
28818
28819These @samp{-m} switches are supported in addition to the above
28820on x86-64 processors in 64-bit environments.
28821
28822@table @gcctabopt
28823@item -m32
28824@itemx -m64
28825@itemx -mx32
28826@itemx -m16
28827@itemx -miamcu
28828@opindex m32
28829@opindex m64
28830@opindex mx32
28831@opindex m16
28832@opindex miamcu
28833Generate code for a 16-bit, 32-bit or 64-bit environment.
28834The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28835to 32 bits, and
28836generates code that runs on any i386 system.
28837
28838The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28839types to 64 bits, and generates code for the x86-64 architecture.
28840For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28841and @option{-mdynamic-no-pic} options.
28842
28843The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28844to 32 bits, and
28845generates code for the x86-64 architecture.
28846
28847The @option{-m16} option is the same as @option{-m32}, except for that
28848it outputs the @code{.code16gcc} assembly directive at the beginning of
28849the assembly output so that the binary can run in 16-bit mode.
28850
28851The @option{-miamcu} option generates code which conforms to Intel MCU
28852psABI.  It requires the @option{-m32} option to be turned on.
28853
28854@item -mno-red-zone
28855@opindex mno-red-zone
28856@opindex mred-zone
28857Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
28858by the x86-64 ABI; it is a 128-byte area beyond the location of the
28859stack pointer that is not modified by signal or interrupt handlers
28860and therefore can be used for temporary data without adjusting the stack
28861pointer.  The flag @option{-mno-red-zone} disables this red zone.
28862
28863@item -mcmodel=small
28864@opindex mcmodel=small
28865Generate code for the small code model: the program and its symbols must
28866be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
28867Programs can be statically or dynamically linked.  This is the default
28868code model.
28869
28870@item -mcmodel=kernel
28871@opindex mcmodel=kernel
28872Generate code for the kernel code model.  The kernel runs in the
28873negative 2 GB of the address space.
28874This model has to be used for Linux kernel code.
28875
28876@item -mcmodel=medium
28877@opindex mcmodel=medium
28878Generate code for the medium model: the program is linked in the lower 2
28879GB of the address space.  Small symbols are also placed there.  Symbols
28880with sizes larger than @option{-mlarge-data-threshold} are put into
28881large data or BSS sections and can be located above 2GB.  Programs can
28882be statically or dynamically linked.
28883
28884@item -mcmodel=large
28885@opindex mcmodel=large
28886Generate code for the large model.  This model makes no assumptions
28887about addresses and sizes of sections.
28888
28889@item -maddress-mode=long
28890@opindex maddress-mode=long
28891Generate code for long address mode.  This is only supported for 64-bit
28892and x32 environments.  It is the default address mode for 64-bit
28893environments.
28894
28895@item -maddress-mode=short
28896@opindex maddress-mode=short
28897Generate code for short address mode.  This is only supported for 32-bit
28898and x32 environments.  It is the default address mode for 32-bit and
28899x32 environments.
28900@end table
28901
28902@node x86 Windows Options
28903@subsection x86 Windows Options
28904@cindex x86 Windows Options
28905@cindex Windows Options for x86
28906
28907These additional options are available for Microsoft Windows targets:
28908
28909@table @gcctabopt
28910@item -mconsole
28911@opindex mconsole
28912This option
28913specifies that a console application is to be generated, by
28914instructing the linker to set the PE header subsystem type
28915required for console applications.
28916This option is available for Cygwin and MinGW targets and is
28917enabled by default on those targets.
28918
28919@item -mdll
28920@opindex mdll
28921This option is available for Cygwin and MinGW targets.  It
28922specifies that a DLL---a dynamic link library---is to be
28923generated, enabling the selection of the required runtime
28924startup object and entry point.
28925
28926@item -mnop-fun-dllimport
28927@opindex mnop-fun-dllimport
28928This option is available for Cygwin and MinGW targets.  It
28929specifies that the @code{dllimport} attribute should be ignored.
28930
28931@item -mthread
28932@opindex mthread
28933This option is available for MinGW targets. It specifies
28934that MinGW-specific thread support is to be used.
28935
28936@item -municode
28937@opindex municode
28938This option is available for MinGW-w64 targets.  It causes
28939the @code{UNICODE} preprocessor macro to be predefined, and
28940chooses Unicode-capable runtime startup code.
28941
28942@item -mwin32
28943@opindex mwin32
28944This option is available for Cygwin and MinGW targets.  It
28945specifies that the typical Microsoft Windows predefined macros are to
28946be set in the pre-processor, but does not influence the choice
28947of runtime library/startup code.
28948
28949@item -mwindows
28950@opindex mwindows
28951This option is available for Cygwin and MinGW targets.  It
28952specifies that a GUI application is to be generated by
28953instructing the linker to set the PE header subsystem type
28954appropriately.
28955
28956@item -fno-set-stack-executable
28957@opindex fno-set-stack-executable
28958@opindex fset-stack-executable
28959This option is available for MinGW targets. It specifies that
28960the executable flag for the stack used by nested functions isn't
28961set. This is necessary for binaries running in kernel mode of
28962Microsoft Windows, as there the User32 API, which is used to set executable
28963privileges, isn't available.
28964
28965@item -fwritable-relocated-rdata
28966@opindex fno-writable-relocated-rdata
28967@opindex fwritable-relocated-rdata
28968This option is available for MinGW and Cygwin targets.  It specifies
28969that relocated-data in read-only section is put into the @code{.data}
28970section.  This is a necessary for older runtimes not supporting
28971modification of @code{.rdata} sections for pseudo-relocation.
28972
28973@item -mpe-aligned-commons
28974@opindex mpe-aligned-commons
28975This option is available for Cygwin and MinGW targets.  It
28976specifies that the GNU extension to the PE file format that
28977permits the correct alignment of COMMON variables should be
28978used when generating code.  It is enabled by default if
28979GCC detects that the target assembler found during configuration
28980supports the feature.
28981@end table
28982
28983See also under @ref{x86 Options} for standard options.
28984
28985@node Xstormy16 Options
28986@subsection Xstormy16 Options
28987@cindex Xstormy16 Options
28988
28989These options are defined for Xstormy16:
28990
28991@table @gcctabopt
28992@item -msim
28993@opindex msim
28994Choose startup files and linker script suitable for the simulator.
28995@end table
28996
28997@node Xtensa Options
28998@subsection Xtensa Options
28999@cindex Xtensa Options
29000
29001These options are supported for Xtensa targets:
29002
29003@table @gcctabopt
29004@item -mconst16
29005@itemx -mno-const16
29006@opindex mconst16
29007@opindex mno-const16
29008Enable or disable use of @code{CONST16} instructions for loading
29009constant values.  The @code{CONST16} instruction is currently not a
29010standard option from Tensilica.  When enabled, @code{CONST16}
29011instructions are always used in place of the standard @code{L32R}
29012instructions.  The use of @code{CONST16} is enabled by default only if
29013the @code{L32R} instruction is not available.
29014
29015@item -mfused-madd
29016@itemx -mno-fused-madd
29017@opindex mfused-madd
29018@opindex mno-fused-madd
29019Enable or disable use of fused multiply/add and multiply/subtract
29020instructions in the floating-point option.  This has no effect if the
29021floating-point option is not also enabled.  Disabling fused multiply/add
29022and multiply/subtract instructions forces the compiler to use separate
29023instructions for the multiply and add/subtract operations.  This may be
29024desirable in some cases where strict IEEE 754-compliant results are
29025required: the fused multiply add/subtract instructions do not round the
29026intermediate result, thereby producing results with @emph{more} bits of
29027precision than specified by the IEEE standard.  Disabling fused multiply
29028add/subtract instructions also ensures that the program output is not
29029sensitive to the compiler's ability to combine multiply and add/subtract
29030operations.
29031
29032@item -mserialize-volatile
29033@itemx -mno-serialize-volatile
29034@opindex mserialize-volatile
29035@opindex mno-serialize-volatile
29036When this option is enabled, GCC inserts @code{MEMW} instructions before
29037@code{volatile} memory references to guarantee sequential consistency.
29038The default is @option{-mserialize-volatile}.  Use
29039@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29040
29041@item -mforce-no-pic
29042@opindex mforce-no-pic
29043For targets, like GNU/Linux, where all user-mode Xtensa code must be
29044position-independent code (PIC), this option disables PIC for compiling
29045kernel code.
29046
29047@item -mtext-section-literals
29048@itemx -mno-text-section-literals
29049@opindex mtext-section-literals
29050@opindex mno-text-section-literals
29051These options control the treatment of literal pools.  The default is
29052@option{-mno-text-section-literals}, which places literals in a separate
29053section in the output file.  This allows the literal pool to be placed
29054in a data RAM/ROM, and it also allows the linker to combine literal
29055pools from separate object files to remove redundant literals and
29056improve code size.  With @option{-mtext-section-literals}, the literals
29057are interspersed in the text section in order to keep them as close as
29058possible to their references.  This may be necessary for large assembly
29059files.  Literals for each function are placed right before that function.
29060
29061@item -mauto-litpools
29062@itemx -mno-auto-litpools
29063@opindex mauto-litpools
29064@opindex mno-auto-litpools
29065These options control the treatment of literal pools.  The default is
29066@option{-mno-auto-litpools}, which places literals in a separate
29067section in the output file unless @option{-mtext-section-literals} is
29068used.  With @option{-mauto-litpools} the literals are interspersed in
29069the text section by the assembler.  Compiler does not produce explicit
29070@code{.literal} directives and loads literals into registers with
29071@code{MOVI} instructions instead of @code{L32R} to let the assembler
29072do relaxation and place literals as necessary.  This option allows
29073assembler to create several literal pools per function and assemble
29074very big functions, which may not be possible with
29075@option{-mtext-section-literals}.
29076
29077@item -mtarget-align
29078@itemx -mno-target-align
29079@opindex mtarget-align
29080@opindex mno-target-align
29081When this option is enabled, GCC instructs the assembler to
29082automatically align instructions to reduce branch penalties at the
29083expense of some code density.  The assembler attempts to widen density
29084instructions to align branch targets and the instructions following call
29085instructions.  If there are not enough preceding safe density
29086instructions to align a target, no widening is performed.  The
29087default is @option{-mtarget-align}.  These options do not affect the
29088treatment of auto-aligned instructions like @code{LOOP}, which the
29089assembler always aligns, either by widening density instructions or
29090by inserting NOP instructions.
29091
29092@item -mlongcalls
29093@itemx -mno-longcalls
29094@opindex mlongcalls
29095@opindex mno-longcalls
29096When this option is enabled, GCC instructs the assembler to translate
29097direct calls to indirect calls unless it can determine that the target
29098of a direct call is in the range allowed by the call instruction.  This
29099translation typically occurs for calls to functions in other source
29100files.  Specifically, the assembler translates a direct @code{CALL}
29101instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29102The default is @option{-mno-longcalls}.  This option should be used in
29103programs where the call target can potentially be out of range.  This
29104option is implemented in the assembler, not the compiler, so the
29105assembly code generated by GCC still shows direct call
29106instructions---look at the disassembled object code to see the actual
29107instructions.  Note that the assembler uses an indirect call for
29108every cross-file call, not just those that really are out of range.
29109@end table
29110
29111@node zSeries Options
29112@subsection zSeries Options
29113@cindex zSeries options
29114
29115These are listed under @xref{S/390 and zSeries Options}.
29116
29117
29118@c man end
29119
29120@node Spec Files
29121@section Specifying Subprocesses and the Switches to Pass to Them
29122@cindex Spec Files
29123
29124@command{gcc} is a driver program.  It performs its job by invoking a
29125sequence of other programs to do the work of compiling, assembling and
29126linking.  GCC interprets its command-line parameters and uses these to
29127deduce which programs it should invoke, and which command-line options
29128it ought to place on their command lines.  This behavior is controlled
29129by @dfn{spec strings}.  In most cases there is one spec string for each
29130program that GCC can invoke, but a few programs have multiple spec
29131strings to control their behavior.  The spec strings built into GCC can
29132be overridden by using the @option{-specs=} command-line switch to specify
29133a spec file.
29134
29135@dfn{Spec files} are plain-text files that are used to construct spec
29136strings.  They consist of a sequence of directives separated by blank
29137lines.  The type of directive is determined by the first non-whitespace
29138character on the line, which can be one of the following:
29139
29140@table @code
29141@item %@var{command}
29142Issues a @var{command} to the spec file processor.  The commands that can
29143appear here are:
29144
29145@table @code
29146@item %include <@var{file}>
29147@cindex @code{%include}
29148Search for @var{file} and insert its text at the current point in the
29149specs file.
29150
29151@item %include_noerr <@var{file}>
29152@cindex @code{%include_noerr}
29153Just like @samp{%include}, but do not generate an error message if the include
29154file cannot be found.
29155
29156@item %rename @var{old_name} @var{new_name}
29157@cindex @code{%rename}
29158Rename the spec string @var{old_name} to @var{new_name}.
29159
29160@end table
29161
29162@item *[@var{spec_name}]:
29163This tells the compiler to create, override or delete the named spec
29164string.  All lines after this directive up to the next directive or
29165blank line are considered to be the text for the spec string.  If this
29166results in an empty string then the spec is deleted.  (Or, if the
29167spec did not exist, then nothing happens.)  Otherwise, if the spec
29168does not currently exist a new spec is created.  If the spec does
29169exist then its contents are overridden by the text of this
29170directive, unless the first character of that text is the @samp{+}
29171character, in which case the text is appended to the spec.
29172
29173@item [@var{suffix}]:
29174Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
29175and up to the next directive or blank line are considered to make up the
29176spec string for the indicated suffix.  When the compiler encounters an
29177input file with the named suffix, it processes the spec string in
29178order to work out how to compile that file.  For example:
29179
29180@smallexample
29181.ZZ:
29182z-compile -input %i
29183@end smallexample
29184
29185This says that any input file whose name ends in @samp{.ZZ} should be
29186passed to the program @samp{z-compile}, which should be invoked with the
29187command-line switch @option{-input} and with the result of performing the
29188@samp{%i} substitution.  (See below.)
29189
29190As an alternative to providing a spec string, the text following a
29191suffix directive can be one of the following:
29192
29193@table @code
29194@item @@@var{language}
29195This says that the suffix is an alias for a known @var{language}.  This is
29196similar to using the @option{-x} command-line switch to GCC to specify a
29197language explicitly.  For example:
29198
29199@smallexample
29200.ZZ:
29201@@c++
29202@end smallexample
29203
29204Says that .ZZ files are, in fact, C++ source files.
29205
29206@item #@var{name}
29207This causes an error messages saying:
29208
29209@smallexample
29210@var{name} compiler not installed on this system.
29211@end smallexample
29212@end table
29213
29214GCC already has an extensive list of suffixes built into it.
29215This directive adds an entry to the end of the list of suffixes, but
29216since the list is searched from the end backwards, it is effectively
29217possible to override earlier entries using this technique.
29218
29219@end table
29220
29221GCC has the following spec strings built into it.  Spec files can
29222override these strings or create their own.  Note that individual
29223targets can also add their own spec strings to this list.
29224
29225@smallexample
29226asm          Options to pass to the assembler
29227asm_final    Options to pass to the assembler post-processor
29228cpp          Options to pass to the C preprocessor
29229cc1          Options to pass to the C compiler
29230cc1plus      Options to pass to the C++ compiler
29231endfile      Object files to include at the end of the link
29232link         Options to pass to the linker
29233lib          Libraries to include on the command line to the linker
29234libgcc       Decides which GCC support library to pass to the linker
29235linker       Sets the name of the linker
29236predefines   Defines to be passed to the C preprocessor
29237signed_char  Defines to pass to CPP to say whether @code{char} is signed
29238             by default
29239startfile    Object files to include at the start of the link
29240@end smallexample
29241
29242Here is a small example of a spec file:
29243
29244@smallexample
29245%rename lib                 old_lib
29246
29247*lib:
29248--start-group -lgcc -lc -leval1 --end-group %(old_lib)
29249@end smallexample
29250
29251This example renames the spec called @samp{lib} to @samp{old_lib} and
29252then overrides the previous definition of @samp{lib} with a new one.
29253The new definition adds in some extra command-line options before
29254including the text of the old definition.
29255
29256@dfn{Spec strings} are a list of command-line options to be passed to their
29257corresponding program.  In addition, the spec strings can contain
29258@samp{%}-prefixed sequences to substitute variable text or to
29259conditionally insert text into the command line.  Using these constructs
29260it is possible to generate quite complex command lines.
29261
29262Here is a table of all defined @samp{%}-sequences for spec
29263strings.  Note that spaces are not generated automatically around the
29264results of expanding these sequences.  Therefore you can concatenate them
29265together or combine them with constant text in a single argument.
29266
29267@table @code
29268@item %%
29269Substitute one @samp{%} into the program name or argument.
29270
29271@item %i
29272Substitute the name of the input file being processed.
29273
29274@item %b
29275Substitute the basename of the input file being processed.
29276This is the substring up to (and not including) the last period
29277and not including the directory.
29278
29279@item %B
29280This is the same as @samp{%b}, but include the file suffix (text after
29281the last period).
29282
29283@item %d
29284Marks the argument containing or following the @samp{%d} as a
29285temporary file name, so that that file is deleted if GCC exits
29286successfully.  Unlike @samp{%g}, this contributes no text to the
29287argument.
29288
29289@item %g@var{suffix}
29290Substitute a file name that has suffix @var{suffix} and is chosen
29291once per compilation, and mark the argument in the same way as
29292@samp{%d}.  To reduce exposure to denial-of-service attacks, the file
29293name is now chosen in a way that is hard to predict even when previously
29294chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29295might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
29296the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29297treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
29298was simply substituted with a file name chosen once per compilation,
29299without regard to any appended suffix (which was therefore treated
29300just like ordinary text), making such attacks more likely to succeed.
29301
29302@item %u@var{suffix}
29303Like @samp{%g}, but generates a new temporary file name
29304each time it appears instead of once per compilation.
29305
29306@item %U@var{suffix}
29307Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29308new one if there is no such last file name.  In the absence of any
29309@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29310the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29311involves the generation of two distinct file names, one
29312for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
29313simply substituted with a file name chosen for the previous @samp{%u},
29314without regard to any appended suffix.
29315
29316@item %j@var{suffix}
29317Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29318writable, and if @option{-save-temps} is not used;
29319otherwise, substitute the name
29320of a temporary file, just like @samp{%u}.  This temporary file is not
29321meant for communication between processes, but rather as a junk
29322disposal mechanism.
29323
29324@item %|@var{suffix}
29325@itemx %m@var{suffix}
29326Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
29327@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29328all.  These are the two most common ways to instruct a program that it
29329should read from standard input or write to standard output.  If you
29330need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29331construct: see for example @file{f/lang-specs.h}.
29332
29333@item %.@var{SUFFIX}
29334Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29335when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
29336terminated by the next space or %.
29337
29338@item %w
29339Marks the argument containing or following the @samp{%w} as the
29340designated output file of this compilation.  This puts the argument
29341into the sequence of arguments that @samp{%o} substitutes.
29342
29343@item %o
29344Substitutes the names of all the output files, with spaces
29345automatically placed around them.  You should write spaces
29346around the @samp{%o} as well or the results are undefined.
29347@samp{%o} is for use in the specs for running the linker.
29348Input files whose names have no recognized suffix are not compiled
29349at all, but they are included among the output files, so they are
29350linked.
29351
29352@item %O
29353Substitutes the suffix for object files.  Note that this is
29354handled specially when it immediately follows @samp{%g, %u, or %U},
29355because of the need for those to form complete file names.  The
29356handling is such that @samp{%O} is treated exactly as if it had already
29357been substituted, except that @samp{%g, %u, and %U} do not currently
29358support additional @var{suffix} characters following @samp{%O} as they do
29359following, for example, @samp{.o}.
29360
29361@item %p
29362Substitutes the standard macro predefinitions for the
29363current target machine.  Use this when running @command{cpp}.
29364
29365@item %P
29366Like @samp{%p}, but puts @samp{__} before and after the name of each
29367predefined macro, except for macros that start with @samp{__} or with
29368@samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
29369C@.
29370
29371@item %I
29372Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29373@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29374@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29375and @option{-imultilib} as necessary.
29376
29377@item %s
29378Current argument is the name of a library or startup file of some sort.
29379Search for that file in a standard list of directories and substitute
29380the full name found.  The current working directory is included in the
29381list of directories scanned.
29382
29383@item %T
29384Current argument is the name of a linker script.  Search for that file
29385in the current list of directories to scan for libraries. If the file
29386is located insert a @option{--script} option into the command line
29387followed by the full path name found.  If the file is not found then
29388generate an error message.  Note: the current working directory is not
29389searched.
29390
29391@item %e@var{str}
29392Print @var{str} as an error message.  @var{str} is terminated by a newline.
29393Use this when inconsistent options are detected.
29394
29395@item %(@var{name})
29396Substitute the contents of spec string @var{name} at this point.
29397
29398@item %x@{@var{option}@}
29399Accumulate an option for @samp{%X}.
29400
29401@item %X
29402Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29403spec string.
29404
29405@item %Y
29406Output the accumulated assembler options specified by @option{-Wa}.
29407
29408@item %Z
29409Output the accumulated preprocessor options specified by @option{-Wp}.
29410
29411@item %a
29412Process the @code{asm} spec.  This is used to compute the
29413switches to be passed to the assembler.
29414
29415@item %A
29416Process the @code{asm_final} spec.  This is a spec string for
29417passing switches to an assembler post-processor, if such a program is
29418needed.
29419
29420@item %l
29421Process the @code{link} spec.  This is the spec for computing the
29422command line passed to the linker.  Typically it makes use of the
29423@samp{%L %G %S %D and %E} sequences.
29424
29425@item %D
29426Dump out a @option{-L} option for each directory that GCC believes might
29427contain startup files.  If the target supports multilibs then the
29428current multilib directory is prepended to each of these paths.
29429
29430@item %L
29431Process the @code{lib} spec.  This is a spec string for deciding which
29432libraries are included on the command line to the linker.
29433
29434@item %G
29435Process the @code{libgcc} spec.  This is a spec string for deciding
29436which GCC support library is included on the command line to the linker.
29437
29438@item %S
29439Process the @code{startfile} spec.  This is a spec for deciding which
29440object files are the first ones passed to the linker.  Typically
29441this might be a file named @file{crt0.o}.
29442
29443@item %E
29444Process the @code{endfile} spec.  This is a spec string that specifies
29445the last object files that are passed to the linker.
29446
29447@item %C
29448Process the @code{cpp} spec.  This is used to construct the arguments
29449to be passed to the C preprocessor.
29450
29451@item %1
29452Process the @code{cc1} spec.  This is used to construct the options to be
29453passed to the actual C compiler (@command{cc1}).
29454
29455@item %2
29456Process the @code{cc1plus} spec.  This is used to construct the options to be
29457passed to the actual C++ compiler (@command{cc1plus}).
29458
29459@item %*
29460Substitute the variable part of a matched option.  See below.
29461Note that each comma in the substituted string is replaced by
29462a single space.
29463
29464@item %<S
29465Remove all occurrences of @code{-S} from the command line.  Note---this
29466command is position dependent.  @samp{%} commands in the spec string
29467before this one see @code{-S}, @samp{%} commands in the spec string
29468after this one do not.
29469
29470@item %:@var{function}(@var{args})
29471Call the named function @var{function}, passing it @var{args}.
29472@var{args} is first processed as a nested spec string, then split
29473into an argument vector in the usual fashion.  The function returns
29474a string which is processed as if it had appeared literally as part
29475of the current spec.
29476
29477The following built-in spec functions are provided:
29478
29479@table @code
29480@item @code{getenv}
29481The @code{getenv} spec function takes two arguments: an environment
29482variable name and a string.  If the environment variable is not
29483defined, a fatal error is issued.  Otherwise, the return value is the
29484value of the environment variable concatenated with the string.  For
29485example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29486
29487@smallexample
29488%:getenv(TOPDIR /include)
29489@end smallexample
29490
29491expands to @file{/path/to/top/include}.
29492
29493@item @code{if-exists}
29494The @code{if-exists} spec function takes one argument, an absolute
29495pathname to a file.  If the file exists, @code{if-exists} returns the
29496pathname.  Here is a small example of its usage:
29497
29498@smallexample
29499*startfile:
29500crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29501@end smallexample
29502
29503@item @code{if-exists-else}
29504The @code{if-exists-else} spec function is similar to the @code{if-exists}
29505spec function, except that it takes two arguments.  The first argument is
29506an absolute pathname to a file.  If the file exists, @code{if-exists-else}
29507returns the pathname.  If it does not exist, it returns the second argument.
29508This way, @code{if-exists-else} can be used to select one file or another,
29509based on the existence of the first.  Here is a small example of its usage:
29510
29511@smallexample
29512*startfile:
29513crt0%O%s %:if-exists(crti%O%s) \
29514%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29515@end smallexample
29516
29517@item @code{replace-outfile}
29518The @code{replace-outfile} spec function takes two arguments.  It looks for the
29519first argument in the outfiles array and replaces it with the second argument.  Here
29520is a small example of its usage:
29521
29522@smallexample
29523%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29524@end smallexample
29525
29526@item @code{remove-outfile}
29527The @code{remove-outfile} spec function takes one argument.  It looks for the
29528first argument in the outfiles array and removes it.  Here is a small example
29529its usage:
29530
29531@smallexample
29532%:remove-outfile(-lm)
29533@end smallexample
29534
29535@item @code{pass-through-libs}
29536The @code{pass-through-libs} spec function takes any number of arguments.  It
29537finds any @option{-l} options and any non-options ending in @file{.a} (which it
29538assumes are the names of linker input library archive files) and returns a
29539result containing all the found arguments each prepended by
29540@option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
29541intended to be passed to the LTO linker plugin.
29542
29543@smallexample
29544%:pass-through-libs(%G %L %G)
29545@end smallexample
29546
29547@item @code{print-asm-header}
29548The @code{print-asm-header} function takes no arguments and simply
29549prints a banner like:
29550
29551@smallexample
29552Assembler options
29553=================
29554
29555Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29556@end smallexample
29557
29558It is used to separate compiler options from assembler options
29559in the @option{--target-help} output.
29560@end table
29561
29562@item %@{S@}
29563Substitutes the @code{-S} switch, if that switch is given to GCC@.
29564If that switch is not specified, this substitutes nothing.  Note that
29565the leading dash is omitted when specifying this option, and it is
29566automatically inserted if the substitution is performed.  Thus the spec
29567string @samp{%@{foo@}} matches the command-line option @option{-foo}
29568and outputs the command-line option @option{-foo}.
29569
29570@item %W@{S@}
29571Like %@{@code{S}@} but mark last argument supplied within as a file to be
29572deleted on failure.
29573
29574@item %@{S*@}
29575Substitutes all the switches specified to GCC whose names start
29576with @code{-S}, but which also take an argument.  This is used for
29577switches like @option{-o}, @option{-D}, @option{-I}, etc.
29578GCC considers @option{-o foo} as being
29579one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
29580text, including the space.  Thus two arguments are generated.
29581
29582@item %@{S*&T*@}
29583Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29584(the order of @code{S} and @code{T} in the spec is not significant).
29585There can be any number of ampersand-separated variables; for each the
29586wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
29587
29588@item %@{S:X@}
29589Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29590
29591@item %@{!S:X@}
29592Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29593
29594@item %@{S*:X@}
29595Substitutes @code{X} if one or more switches whose names start with
29596@code{-S} are specified to GCC@.  Normally @code{X} is substituted only
29597once, no matter how many such switches appeared.  However, if @code{%*}
29598appears somewhere in @code{X}, then @code{X} is substituted once
29599for each matching switch, with the @code{%*} replaced by the part of
29600that switch matching the @code{*}.
29601
29602If @code{%*} appears as the last part of a spec sequence then a space
29603is added after the end of the last substitution.  If there is more
29604text in the sequence, however, then a space is not generated.  This
29605allows the @code{%*} substitution to be used as part of a larger
29606string.  For example, a spec string like this:
29607
29608@smallexample
29609%@{mcu=*:--script=%*/memory.ld@}
29610@end smallexample
29611
29612@noindent
29613when matching an option like @option{-mcu=newchip} produces:
29614
29615@smallexample
29616--script=newchip/memory.ld
29617@end smallexample
29618
29619@item %@{.S:X@}
29620Substitutes @code{X}, if processing a file with suffix @code{S}.
29621
29622@item %@{!.S:X@}
29623Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29624
29625@item %@{,S:X@}
29626Substitutes @code{X}, if processing a file for language @code{S}.
29627
29628@item %@{!,S:X@}
29629Substitutes @code{X}, if not processing a file for language @code{S}.
29630
29631@item %@{S|P:X@}
29632Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29633GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29634@code{*} sequences as well, although they have a stronger binding than
29635the @samp{|}.  If @code{%*} appears in @code{X}, all of the
29636alternatives must be starred, and only the first matching alternative
29637is substituted.
29638
29639For example, a spec string like this:
29640
29641@smallexample
29642%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29643@end smallexample
29644
29645@noindent
29646outputs the following command-line options from the following input
29647command-line options:
29648
29649@smallexample
29650fred.c        -foo -baz
29651jim.d         -bar -boggle
29652-d fred.c     -foo -baz -boggle
29653-d jim.d      -bar -baz -boggle
29654@end smallexample
29655
29656@item %@{S:X; T:Y; :D@}
29657
29658If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29659given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
29660be as many clauses as you need.  This may be combined with @code{.},
29661@code{,}, @code{!}, @code{|}, and @code{*} as needed.
29662
29663
29664@end table
29665
29666The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29667or similar construct can use a backslash to ignore the special meaning
29668of the character following it, thus allowing literal matching of a
29669character that is otherwise specially treated.  For example,
29670@samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29671@option{-std=iso9899:1999} option is given.
29672
29673The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29674construct may contain other nested @samp{%} constructs or spaces, or
29675even newlines.  They are processed as usual, as described above.
29676Trailing white space in @code{X} is ignored.  White space may also
29677appear anywhere on the left side of the colon in these constructs,
29678except between @code{.} or @code{*} and the corresponding word.
29679
29680The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29681handled specifically in these constructs.  If another value of
29682@option{-O} or the negated form of a @option{-f}, @option{-m}, or
29683@option{-W} switch is found later in the command line, the earlier
29684switch value is ignored, except with @{@code{S}*@} where @code{S} is
29685just one letter, which passes all matching options.
29686
29687The character @samp{|} at the beginning of the predicate text is used to
29688indicate that a command should be piped to the following command, but
29689only if @option{-pipe} is specified.
29690
29691It is built into GCC which switches take arguments and which do not.
29692(You might think it would be useful to generalize this to allow each
29693compiler's spec to say which switches take arguments.  But this cannot
29694be done in a consistent fashion.  GCC cannot even decide which input
29695files have been specified without knowing which switches take arguments,
29696and it must know which input files to compile in order to tell which
29697compilers to run).
29698
29699GCC also knows implicitly that arguments starting in @option{-l} are to be
29700treated as compiler output files, and passed to the linker in their
29701proper position among the other output files.
29702
29703@node Environment Variables
29704@section Environment Variables Affecting GCC
29705@cindex environment variables
29706
29707@c man begin ENVIRONMENT
29708This section describes several environment variables that affect how GCC
29709operates.  Some of them work by specifying directories or prefixes to use
29710when searching for various kinds of files.  Some are used to specify other
29711aspects of the compilation environment.
29712
29713Note that you can also specify places to search using options such as
29714@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
29715take precedence over places specified using environment variables, which
29716in turn take precedence over those specified by the configuration of GCC@.
29717@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29718GNU Compiler Collection (GCC) Internals}.
29719
29720@table @env
29721@item LANG
29722@itemx LC_CTYPE
29723@c @itemx LC_COLLATE
29724@itemx LC_MESSAGES
29725@c @itemx LC_MONETARY
29726@c @itemx LC_NUMERIC
29727@c @itemx LC_TIME
29728@itemx LC_ALL
29729@findex LANG
29730@findex LC_CTYPE
29731@c @findex LC_COLLATE
29732@findex LC_MESSAGES
29733@c @findex LC_MONETARY
29734@c @findex LC_NUMERIC
29735@c @findex LC_TIME
29736@findex LC_ALL
29737@cindex locale
29738These environment variables control the way that GCC uses
29739localization information which allows GCC to work with different
29740national conventions.  GCC inspects the locale categories
29741@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29742so.  These locale categories can be set to any value supported by your
29743installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
29744Kingdom encoded in UTF-8.
29745
29746The @env{LC_CTYPE} environment variable specifies character
29747classification.  GCC uses it to determine the character boundaries in
29748a string; this is needed for some multibyte encodings that contain quote
29749and escape characters that are otherwise interpreted as a string
29750end or escape.
29751
29752The @env{LC_MESSAGES} environment variable specifies the language to
29753use in diagnostic messages.
29754
29755If the @env{LC_ALL} environment variable is set, it overrides the value
29756of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29757and @env{LC_MESSAGES} default to the value of the @env{LANG}
29758environment variable.  If none of these variables are set, GCC
29759defaults to traditional C English behavior.
29760
29761@item TMPDIR
29762@findex TMPDIR
29763If @env{TMPDIR} is set, it specifies the directory to use for temporary
29764files.  GCC uses temporary files to hold the output of one stage of
29765compilation which is to be used as input to the next stage: for example,
29766the output of the preprocessor, which is the input to the compiler
29767proper.
29768
29769@item GCC_COMPARE_DEBUG
29770@findex GCC_COMPARE_DEBUG
29771Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29772@option{-fcompare-debug} to the compiler driver.  See the documentation
29773of this option for more details.
29774
29775@item GCC_EXEC_PREFIX
29776@findex GCC_EXEC_PREFIX
29777If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29778names of the subprograms executed by the compiler.  No slash is added
29779when this prefix is combined with the name of a subprogram, but you can
29780specify a prefix that ends with a slash if you wish.
29781
29782If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29783an appropriate prefix to use based on the pathname it is invoked with.
29784
29785If GCC cannot find the subprogram using the specified prefix, it
29786tries looking in the usual places for the subprogram.
29787
29788The default value of @env{GCC_EXEC_PREFIX} is
29789@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29790the installed compiler. In many cases @var{prefix} is the value
29791of @code{prefix} when you ran the @file{configure} script.
29792
29793Other prefixes specified with @option{-B} take precedence over this prefix.
29794
29795This prefix is also used for finding files such as @file{crt0.o} that are
29796used for linking.
29797
29798In addition, the prefix is used in an unusual way in finding the
29799directories to search for header files.  For each of the standard
29800directories whose name normally begins with @samp{/usr/local/lib/gcc}
29801(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29802replacing that beginning with the specified prefix to produce an
29803alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
29804@file{foo/bar} just before it searches the standard directory
29805@file{/usr/local/lib/bar}.
29806If a standard directory begins with the configured
29807@var{prefix} then the value of @var{prefix} is replaced by
29808@env{GCC_EXEC_PREFIX} when looking for header files.
29809
29810@item COMPILER_PATH
29811@findex COMPILER_PATH
29812The value of @env{COMPILER_PATH} is a colon-separated list of
29813directories, much like @env{PATH}.  GCC tries the directories thus
29814specified when searching for subprograms, if it cannot find the
29815subprograms using @env{GCC_EXEC_PREFIX}.
29816
29817@item LIBRARY_PATH
29818@findex LIBRARY_PATH
29819The value of @env{LIBRARY_PATH} is a colon-separated list of
29820directories, much like @env{PATH}.  When configured as a native compiler,
29821GCC tries the directories thus specified when searching for special
29822linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
29823using GCC also uses these directories when searching for ordinary
29824libraries for the @option{-l} option (but directories specified with
29825@option{-L} come first).
29826
29827@item LANG
29828@findex LANG
29829@cindex locale definition
29830This variable is used to pass locale information to the compiler.  One way in
29831which this information is used is to determine the character set to be used
29832when character literals, string literals and comments are parsed in C and C++.
29833When the compiler is configured to allow multibyte characters,
29834the following values for @env{LANG} are recognized:
29835
29836@table @samp
29837@item C-JIS
29838Recognize JIS characters.
29839@item C-SJIS
29840Recognize SJIS characters.
29841@item C-EUCJP
29842Recognize EUCJP characters.
29843@end table
29844
29845If @env{LANG} is not defined, or if it has some other value, then the
29846compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29847recognize and translate multibyte characters.
29848@end table
29849
29850@noindent
29851Some additional environment variables affect the behavior of the
29852preprocessor.
29853
29854@include cppenv.texi
29855
29856@c man end
29857
29858@node Precompiled Headers
29859@section Using Precompiled Headers
29860@cindex precompiled headers
29861@cindex speed of compilation
29862
29863Often large projects have many header files that are included in every
29864source file.  The time the compiler takes to process these header files
29865over and over again can account for nearly all of the time required to
29866build the project.  To make builds faster, GCC allows you to
29867@dfn{precompile} a header file.
29868
29869To create a precompiled header file, simply compile it as you would any
29870other file, if necessary using the @option{-x} option to make the driver
29871treat it as a C or C++ header file.  You may want to use a
29872tool like @command{make} to keep the precompiled header up-to-date when
29873the headers it contains change.
29874
29875A precompiled header file is searched for when @code{#include} is
29876seen in the compilation.  As it searches for the included file
29877(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29878compiler looks for a precompiled header in each directory just before it
29879looks for the include file in that directory.  The name searched for is
29880the name specified in the @code{#include} with @samp{.gch} appended.  If
29881the precompiled header file cannot be used, it is ignored.
29882
29883For instance, if you have @code{#include "all.h"}, and you have
29884@file{all.h.gch} in the same directory as @file{all.h}, then the
29885precompiled header file is used if possible, and the original
29886header is used otherwise.
29887
29888Alternatively, you might decide to put the precompiled header file in a
29889directory and use @option{-I} to ensure that directory is searched
29890before (or instead of) the directory containing the original header.
29891Then, if you want to check that the precompiled header file is always
29892used, you can put a file of the same name as the original header in this
29893directory containing an @code{#error} command.
29894
29895This also works with @option{-include}.  So yet another way to use
29896precompiled headers, good for projects not designed with precompiled
29897header files in mind, is to simply take most of the header files used by
29898a project, include them from another header file, precompile that header
29899file, and @option{-include} the precompiled header.  If the header files
29900have guards against multiple inclusion, they are skipped because
29901they've already been included (in the precompiled header).
29902
29903If you need to precompile the same header file for different
29904languages, targets, or compiler options, you can instead make a
29905@emph{directory} named like @file{all.h.gch}, and put each precompiled
29906header in the directory, perhaps using @option{-o}.  It doesn't matter
29907what you call the files in the directory; every precompiled header in
29908the directory is considered.  The first precompiled header
29909encountered in the directory that is valid for this compilation is
29910used; they're searched in no particular order.
29911
29912There are many other possibilities, limited only by your imagination,
29913good sense, and the constraints of your build system.
29914
29915A precompiled header file can be used only when these conditions apply:
29916
29917@itemize
29918@item
29919Only one precompiled header can be used in a particular compilation.
29920
29921@item
29922A precompiled header cannot be used once the first C token is seen.  You
29923can have preprocessor directives before a precompiled header; you cannot
29924include a precompiled header from inside another header.
29925
29926@item
29927The precompiled header file must be produced for the same language as
29928the current compilation.  You cannot use a C precompiled header for a C++
29929compilation.
29930
29931@item
29932The precompiled header file must have been produced by the same compiler
29933binary as the current compilation is using.
29934
29935@item
29936Any macros defined before the precompiled header is included must
29937either be defined in the same way as when the precompiled header was
29938generated, or must not affect the precompiled header, which usually
29939means that they don't appear in the precompiled header at all.
29940
29941The @option{-D} option is one way to define a macro before a
29942precompiled header is included; using a @code{#define} can also do it.
29943There are also some options that define macros implicitly, like
29944@option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29945defined this way.
29946
29947@item If debugging information is output when using the precompiled
29948header, using @option{-g} or similar, the same kind of debugging information
29949must have been output when building the precompiled header.  However,
29950a precompiled header built using @option{-g} can be used in a compilation
29951when no debugging information is being output.
29952
29953@item The same @option{-m} options must generally be used when building
29954and using the precompiled header.  @xref{Submodel Options},
29955for any cases where this rule is relaxed.
29956
29957@item Each of the following options must be the same when building and using
29958the precompiled header:
29959
29960@gccoptlist{-fexceptions}
29961
29962@item
29963Some other command-line options starting with @option{-f},
29964@option{-p}, or @option{-O} must be defined in the same way as when
29965the precompiled header was generated.  At present, it's not clear
29966which options are safe to change and which are not; the safest choice
29967is to use exactly the same options when generating and using the
29968precompiled header.  The following are known to be safe:
29969
29970@gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock @gol
29971-fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous @gol
29972-fsched-verbose=@var{number}  -fschedule-insns  -fvisibility= @gol
29973-pedantic-errors}
29974
29975@end itemize
29976
29977For all of these except the last, the compiler automatically
29978ignores the precompiled header if the conditions aren't met.  If you
29979find an option combination that doesn't work and doesn't cause the
29980precompiled header to be ignored, please consider filing a bug report,
29981see @ref{Bugs}.
29982
29983If you do use differing options when generating and using the
29984precompiled header, the actual behavior is a mixture of the
29985behavior for the options.  For instance, if you use @option{-g} to
29986generate the precompiled header but not when using it, you may or may
29987not get debugging information for routines in the precompiled header.
29988