lto-opts.c (lto_write_options): Stream -g when debug is enabled.
[official-gcc.git] / gcc / doc / invoke.texi
blob6e91a66c9479b2acc5feaa5897d31079c165b85c
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.
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2019 Free Software Foundation, Inc.
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below).  A copy of the license is
19 included in the gfdl(7) man page.
21 (a) The FSF's Front-Cover Text is:
23      A GNU Manual
25 (b) The FSF's Back-Cover Text is:
27      You have freedom to copy and modify this GNU Manual, like GNU
28      software.  Copies published by the Free Software Foundation raise
29      funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37     [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41     [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
43 Only the most useful options are listed here; see below for the
44 remainder.  @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), dbx(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking.  The ``overall options'' allow you to stop this
72 process at an intermediate stage.  For example, the @option{-c} option
73 says not to run the linker.  Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
77 Other options are passed on to one or more stages of processing.  Some options
78 control the preprocessor and others the compiler itself.  Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly.  If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++} 
98 instead.  @xref{Invoking G++,,Compiling C++ Programs}, 
99 for information about the differences in behavior between @command{gcc} 
100 and @code{g++} when compiling C++ programs.
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands.  Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments.  For the most part, the order
112 you use doesn't matter.  Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified.  Also,
115 the placement of the @option{-l} option is significant.
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on.  Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}.  This manual documents
122 only one of these two forms, whichever one is not the default.
124 Some options take one or more arguments typically separated either
125 by a space or by the equals sign (@samp{=}) from the option name.
126 Unless documented otherwise, an argument can be either numeric or
127 a string.  Numeric arguments must typically be small unsigned decimal
128 or hexadecimal integers.  Hexadecimal arguments must begin with
129 the @samp{0x} prefix.  Arguments to options that specify a size
130 threshold of some sort may be arbitrarily large decimal or hexadecimal
131 integers followed by a byte size suffix designating a multiple of bytes
132 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
133 @code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and
134 @code{GiB} for gigabyte and gigibyte, and so on.  Such arguments are
135 designated by @var{byte-size} in the following text.  Refer to the NIST,
136 IEC, and other relevant national and international standards for the full
137 listing and explanation of the binary and decimal byte size prefixes.
139 @c man end
141 @xref{Option Index}, for an index to GCC's options.
143 @menu
144 * Option Summary::      Brief list of all options, without explanations.
145 * Overall Options::     Controlling the kind of output:
146                         an executable, object files, assembler files,
147                         or preprocessed source.
148 * Invoking G++::        Compiling C++ programs.
149 * C Dialect Options::   Controlling the variant of C language compiled.
150 * C++ Dialect Options:: Variations on C++.
151 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152                         and Objective-C++.
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
154                         be formatted.
155 * Warning Options::     How picky should the compiler be?
156 * 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
176 @c man begin OPTIONS
178 @node Option Summary
179 @section Option Summary
181 Here is a summary of all the options, grouped by type.  Explanations are
182 in the following sections.
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}}
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}
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-cache-depth=@var{n} @gol
213 -fconstexpr-loop-limit=@var{n}  -fconstexpr-ops-limit=@var{n} @gol
214 -fno-elide-constructors @gol
215 -fno-enforce-eh-specs @gol
216 -fno-gnu-keywords @gol
217 -fno-implicit-templates @gol
218 -fno-implicit-inline-templates @gol
219 -fno-implement-inlines  -fms-extensions @gol
220 -fnew-inheriting-ctors @gol
221 -fnew-ttp-matching @gol
222 -fno-nonansi-builtins  -fnothrow-opt  -fno-operator-names @gol
223 -fno-optional-diags  -fpermissive @gol
224 -fno-pretty-templates @gol
225 -fno-rtti  -fsized-deallocation @gol
226 -ftemplate-backtrace-limit=@var{n} @gol
227 -ftemplate-depth=@var{n} @gol
228 -fno-threadsafe-statics  -fuse-cxa-atexit @gol
229 -fno-weak  -nostdinc++ @gol
230 -fvisibility-inlines-hidden @gol
231 -fvisibility-ms-compat @gol
232 -fext-numeric-literals @gol
233 -Wabi=@var{n}  -Wabi-tag  -Wcomma-subscript  -Wconversion-null @gol
234 -Wctor-dtor-privacy @gol
235 -Wdelete-non-virtual-dtor  -Wdeprecated-copy  -Wdeprecated-copy-dtor @gol
236 -Wliteral-suffix @gol
237 -Wmultiple-inheritance  -Wno-init-list-lifetime @gol
238 -Wnamespaces  -Wnarrowing @gol
239 -Wpessimizing-move  -Wredundant-move @gol
240 -Wnoexcept  -Wnoexcept-type  -Wclass-memaccess @gol
241 -Wnon-virtual-dtor  -Wreorder  -Wregister @gol
242 -Weffc++  -Wstrict-null-sentinel  -Wtemplates @gol
243 -Wno-non-template-friend  -Wold-style-cast @gol
244 -Woverloaded-virtual  -Wno-pmf-conversions @gol
245 -Wno-class-conversion  -Wno-terminate @gol
246 -Wsign-promo  -Wvirtual-inheritance  -Wvolatile}
248 @item Objective-C and Objective-C++ Language Options
249 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
250 Objective-C and Objective-C++ Dialects}.
251 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
252 -fgnu-runtime  -fnext-runtime @gol
253 -fno-nil-receivers @gol
254 -fobjc-abi-version=@var{n} @gol
255 -fobjc-call-cxx-cdtors @gol
256 -fobjc-direct-dispatch @gol
257 -fobjc-exceptions @gol
258 -fobjc-gc @gol
259 -fobjc-nilcheck @gol
260 -fobjc-std=objc1 @gol
261 -fno-local-ivars @gol
262 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
263 -freplace-objc-classes @gol
264 -fzero-link @gol
265 -gen-decls @gol
266 -Wassign-intercept @gol
267 -Wno-protocol  -Wselector @gol
268 -Wstrict-selector-match @gol
269 -Wundeclared-selector}
271 @item Diagnostic Message Formatting Options
272 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
273 @gccoptlist{-fmessage-length=@var{n}  @gol
274 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}  @gol
275 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]}  @gol
276 -fdiagnostics-format=@r{[}text@r{|}json@r{]}  @gol
277 -fno-diagnostics-show-option  -fno-diagnostics-show-caret @gol
278 -fno-diagnostics-show-labels  -fno-diagnostics-show-line-numbers @gol
279 -fdiagnostics-minimum-margin-width=@var{width} @gol
280 -fdiagnostics-parseable-fixits  -fdiagnostics-generate-patch @gol
281 -fdiagnostics-show-template-tree  -fno-elide-type @gol
282 -fno-show-column}
284 @item Warning Options
285 @xref{Warning Options,,Options to Request or Suppress Warnings}.
286 @gccoptlist{-fsyntax-only  -fmax-errors=@var{n}  -Wpedantic @gol
287 -pedantic-errors @gol
288 -w  -Wextra  -Wall  -Waddress  -Waddress-of-packed-member @gol
289 -Waggregate-return  -Waligned-new @gol
290 -Walloc-zero  -Walloc-size-larger-than=@var{byte-size} @gol
291 -Walloca  -Walloca-larger-than=@var{byte-size} @gol
292 -Wno-aggressive-loop-optimizations  -Warray-bounds  -Warray-bounds=@var{n} @gol
293 -Wno-attributes  -Wattribute-alias=@var{n}  @gol
294 -Wbool-compare  -Wbool-operation @gol
295 -Wno-builtin-declaration-mismatch @gol
296 -Wno-builtin-macro-redefined  -Wc90-c99-compat  -Wc99-c11-compat @gol
297 -Wc++-compat  -Wc++11-compat  -Wc++14-compat  -Wc++17-compat  @gol
298 -Wc++20-compat  @gol
299 -Wcast-align  -Wcast-align=strict  -Wcast-function-type  -Wcast-qual  @gol
300 -Wchar-subscripts  -Wcatch-value  -Wcatch-value=@var{n} @gol
301 -Wclobbered  -Wcomment  -Wconditionally-supported @gol
302 -Wconversion  -Wcoverage-mismatch  -Wno-cpp  -Wdangling-else  -Wdate-time @gol
303 -Wdelete-incomplete @gol
304 -Wno-attribute-warning @gol
305 -Wno-deprecated  -Wno-deprecated-declarations  -Wno-designated-init @gol
306 -Wdisabled-optimization @gol
307 -Wno-discarded-qualifiers  -Wno-discarded-array-qualifiers @gol
308 -Wno-div-by-zero  -Wdouble-promotion @gol
309 -Wduplicated-branches  -Wduplicated-cond @gol
310 -Wempty-body  -Wenum-compare  -Wenum-conversion @gol
311 -Wno-endif-labels  -Wexpansion-to-defined @gol
312 -Werror  -Werror=*  -Wextra-semi  -Wfatal-errors @gol
313 -Wfloat-equal  -Wformat  -Wformat=2 @gol
314 -Wno-format-contains-nul  -Wno-format-extra-args  @gol
315 -Wformat-nonliteral  -Wformat-overflow=@var{n} @gol
316 -Wformat-security  -Wformat-signedness  -Wformat-truncation=@var{n} @gol
317 -Wformat-y2k  -Wframe-address @gol
318 -Wframe-larger-than=@var{byte-size}  -Wno-free-nonheap-object @gol
319 -Wjump-misses-init @gol
320 -Whsa  -Wif-not-aligned @gol
321 -Wignored-qualifiers  -Wignored-attributes  -Wincompatible-pointer-types @gol
322 -Wimplicit  -Wimplicit-fallthrough  -Wimplicit-fallthrough=@var{n} @gol
323 -Wimplicit-function-declaration  -Wimplicit-int @gol
324 -Winaccessible-base @gol
325 -Winit-self  -Winline  -Wno-int-conversion  -Wint-in-bool-context @gol
326 -Wno-int-to-pointer-cast  -Winvalid-memory-model  -Wno-invalid-offsetof @gol
327 -Winvalid-pch  -Wlarger-than=@var{byte-size} @gol
328 -Wlogical-op  -Wlogical-not-parentheses  -Wlong-long @gol
329 -Wmain  -Wmaybe-uninitialized  -Wmemset-elt-size  -Wmemset-transposed-args @gol
330 -Wmisleading-indentation  -Wmissing-attributes  -Wmissing-braces @gol
331 -Wmissing-field-initializers  -Wmissing-format-attribute @gol
332 -Wmissing-include-dirs  -Wmissing-noreturn  -Wmissing-profile @gol
333 -Wno-multichar  -Wmultistatement-macros  -Wnonnull  -Wnonnull-compare @gol
334 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
335 -Wnull-dereference  -Wodr  -Wno-overflow  -Wopenmp-simd  @gol
336 -Woverride-init-side-effects  -Woverlength-strings @gol
337 -Wpacked  -Wpacked-bitfield-compat -Wpacked-not-aligned  -Wpadded @gol
338 -Wparentheses  -Wno-pedantic-ms-format @gol
339 -Wplacement-new  -Wplacement-new=@var{n} @gol
340 -Wpointer-arith  -Wpointer-compare  -Wno-pointer-to-int-cast @gol
341 -Wno-pragmas  -Wno-prio-ctor-dtor  -Wredundant-decls @gol
342 -Wrestrict  -Wno-return-local-addr @gol
343 -Wreturn-type  -Wsequence-point  -Wshadow  -Wno-shadow-ivar @gol
344 -Wshadow=global,  -Wshadow=local,  -Wshadow=compatible-local @gol
345 -Wshift-overflow  -Wshift-overflow=@var{n} @gol
346 -Wshift-count-negative  -Wshift-count-overflow  -Wshift-negative-value @gol
347 -Wsign-compare  -Wsign-conversion  -Wfloat-conversion @gol
348 -Wno-scalar-storage-order  -Wsizeof-pointer-div @gol
349 -Wsizeof-pointer-memaccess  -Wsizeof-array-argument @gol
350 -Wstack-protector  -Wstack-usage=@var{byte-size}  -Wstrict-aliasing @gol
351 -Wstrict-aliasing=n  -Wstrict-overflow  -Wstrict-overflow=@var{n} @gol
352 -Wstringop-overflow=@var{n}  -Wstringop-truncation  -Wsubobject-linkage @gol
353 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
354 -Wsuggest-final-types @gol  -Wsuggest-final-methods  -Wsuggest-override @gol
355 -Wswitch  -Wswitch-bool  -Wswitch-default  -Wswitch-enum @gol
356 -Wswitch-unreachable  -Wsync-nand @gol
357 -Wsystem-headers  -Wtautological-compare  -Wtrampolines  -Wtrigraphs @gol
358 -Wtype-limits  -Wundef @gol
359 -Wuninitialized  -Wunknown-pragmas @gol
360 -Wunsuffixed-float-constants  -Wunused  -Wunused-function @gol
361 -Wunused-label  -Wunused-local-typedefs  -Wunused-macros @gol
362 -Wunused-parameter  -Wno-unused-result @gol
363 -Wunused-value  -Wunused-variable @gol
364 -Wunused-const-variable  -Wunused-const-variable=@var{n} @gol
365 -Wunused-but-set-parameter  -Wunused-but-set-variable @gol
366 -Wuseless-cast  -Wvariadic-macros  -Wvector-operation-performance @gol
367 -Wvla  -Wvla-larger-than=@var{byte-size}  -Wvolatile-register-var @gol
368 -Wwrite-strings @gol
369 -Wzero-as-null-pointer-constant}
371 @item C and Objective-C-only Warning Options
372 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
373 -Wmissing-parameter-type  -Wmissing-prototypes  -Wnested-externs @gol
374 -Wold-style-declaration  -Wold-style-definition @gol
375 -Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion @gol
376 -Wdeclaration-after-statement  -Wpointer-sign}
378 @item Debugging Options
379 @xref{Debugging Options,,Options for Debugging Your Program}.
380 @gccoptlist{-g  -g@var{level}  -gdwarf  -gdwarf-@var{version} @gol
381 -ggdb  -grecord-gcc-switches  -gno-record-gcc-switches @gol
382 -gstabs  -gstabs+  -gstrict-dwarf  -gno-strict-dwarf @gol
383 -gas-loc-support  -gno-as-loc-support @gol
384 -gas-locview-support  -gno-as-locview-support @gol
385 -gcolumn-info  -gno-column-info @gol
386 -gstatement-frontiers  -gno-statement-frontiers @gol
387 -gvariable-location-views  -gno-variable-location-views @gol
388 -ginternal-reset-location-views  -gno-internal-reset-location-views @gol
389 -ginline-points  -gno-inline-points @gol
390 -gvms  -gxcoff  -gxcoff+  -gz@r{[}=@var{type}@r{]} @gol
391 -gsplit-dwarf  -gdescribe-dies  -gno-describe-dies @gol
392 -fdebug-prefix-map=@var{old}=@var{new}  -fdebug-types-section @gol
393 -fno-eliminate-unused-debug-types @gol
394 -femit-struct-debug-baseonly  -femit-struct-debug-reduced @gol
395 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
396 -fno-eliminate-unused-debug-symbols  -femit-class-debug-always @gol
397 -fno-merge-debug-strings  -fno-dwarf2-cfi-asm @gol
398 -fvar-tracking  -fvar-tracking-assignments}
400 @item Optimization Options
401 @xref{Optimize Options,,Options that Control Optimization}.
402 @gccoptlist{-faggressive-loop-optimizations @gol
403 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
404 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
405 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
406 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
407 -fassociative-math  -fauto-profile  -fauto-profile[=@var{path}] @gol
408 -fauto-inc-dec  -fbranch-probabilities @gol
409 -fcaller-saves @gol
410 -fcombine-stack-adjustments  -fconserve-stack @gol
411 -fcompare-elim  -fcprop-registers  -fcrossjumping @gol
412 -fcse-follow-jumps  -fcse-skip-blocks  -fcx-fortran-rules @gol
413 -fcx-limited-range @gol
414 -fdata-sections  -fdce  -fdelayed-branch @gol
415 -fdelete-null-pointer-checks  -fdevirtualize  -fdevirtualize-speculatively @gol
416 -fdevirtualize-at-ltrans  -fdse @gol
417 -fearly-inlining  -fipa-sra  -fexpensive-optimizations  -ffat-lto-objects @gol
418 -ffast-math  -ffinite-math-only  -ffloat-store  -fexcess-precision=@var{style} @gol
419 -ffinite-loops @gol
420 -fforward-propagate  -ffp-contract=@var{style}  -ffunction-sections @gol
421 -fgcse  -fgcse-after-reload  -fgcse-las  -fgcse-lm  -fgraphite-identity @gol
422 -fgcse-sm  -fhoist-adjacent-loads  -fif-conversion @gol
423 -fif-conversion2  -findirect-inlining @gol
424 -finline-functions  -finline-functions-called-once  -finline-limit=@var{n} @gol
425 -finline-small-functions  -fipa-cp  -fipa-cp-clone @gol
426 -fipa-bit-cp  -fipa-vrp  -fipa-pta  -fipa-profile  -fipa-pure-const @gol
427 -fipa-reference  -fipa-reference-addressable @gol
428 -fipa-stack-alignment  -fipa-icf  -fira-algorithm=@var{algorithm} @gol
429 -flive-patching=@var{level} @gol
430 -fira-region=@var{region}  -fira-hoist-pressure @gol
431 -fira-loop-pressure  -fno-ira-share-save-slots @gol
432 -fno-ira-share-spill-slots @gol
433 -fisolate-erroneous-paths-dereference  -fisolate-erroneous-paths-attribute @gol
434 -fivopts  -fkeep-inline-functions  -fkeep-static-functions @gol
435 -fkeep-static-consts  -flimit-function-alignment  -flive-range-shrinkage @gol
436 -floop-block  -floop-interchange  -floop-strip-mine @gol
437 -floop-unroll-and-jam  -floop-nest-optimize @gol
438 -floop-parallelize-all  -flra-remat  -flto  -flto-compression-level @gol
439 -flto-partition=@var{alg}  -fmerge-all-constants @gol
440 -fmerge-constants  -fmodulo-sched  -fmodulo-sched-allow-regmoves @gol
441 -fmove-loop-invariants  -fno-branch-count-reg @gol
442 -fno-defer-pop  -fno-fp-int-builtin-inexact  -fno-function-cse @gol
443 -fno-guess-branch-probability  -fno-inline  -fno-math-errno  -fno-peephole @gol
444 -fno-peephole2  -fno-printf-return-value  -fno-sched-interblock @gol
445 -fno-sched-spec  -fno-signed-zeros @gol
446 -fno-toplevel-reorder  -fno-trapping-math  -fno-zero-initialized-in-bss @gol
447 -fomit-frame-pointer  -foptimize-sibling-calls @gol
448 -fpartial-inlining  -fpeel-loops  -fpredictive-commoning @gol
449 -fprefetch-loop-arrays @gol
450 -fprofile-correction @gol
451 -fprofile-use  -fprofile-use=@var{path}  -fprofile-values @gol
452 -fprofile-reorder-functions @gol
453 -freciprocal-math  -free  -frename-registers  -freorder-blocks @gol
454 -freorder-blocks-algorithm=@var{algorithm} @gol
455 -freorder-blocks-and-partition  -freorder-functions @gol
456 -frerun-cse-after-loop  -freschedule-modulo-scheduled-loops @gol
457 -frounding-math  -fsave-optimization-record @gol
458 -fsched2-use-superblocks  -fsched-pressure @gol
459 -fsched-spec-load  -fsched-spec-load-dangerous @gol
460 -fsched-stalled-insns-dep[=@var{n}]  -fsched-stalled-insns[=@var{n}] @gol
461 -fsched-group-heuristic  -fsched-critical-path-heuristic @gol
462 -fsched-spec-insn-heuristic  -fsched-rank-heuristic @gol
463 -fsched-last-insn-heuristic  -fsched-dep-count-heuristic @gol
464 -fschedule-fusion @gol
465 -fschedule-insns  -fschedule-insns2  -fsection-anchors @gol
466 -fselective-scheduling  -fselective-scheduling2 @gol
467 -fsel-sched-pipelining  -fsel-sched-pipelining-outer-loops @gol
468 -fsemantic-interposition  -fshrink-wrap  -fshrink-wrap-separate @gol
469 -fsignaling-nans @gol
470 -fsingle-precision-constant  -fsplit-ivs-in-unroller  -fsplit-loops@gol
471 -fsplit-paths @gol
472 -fsplit-wide-types  -fsplit-wide-types-early  -fssa-backprop  -fssa-phiopt @gol
473 -fstdarg-opt  -fstore-merging  -fstrict-aliasing @gol
474 -fthread-jumps  -ftracer  -ftree-bit-ccp @gol
475 -ftree-builtin-call-dce  -ftree-ccp  -ftree-ch @gol
476 -ftree-coalesce-vars  -ftree-copy-prop  -ftree-dce  -ftree-dominator-opts @gol
477 -ftree-dse  -ftree-forwprop  -ftree-fre  -fcode-hoisting @gol
478 -ftree-loop-if-convert  -ftree-loop-im @gol
479 -ftree-phiprop  -ftree-loop-distribution  -ftree-loop-distribute-patterns @gol
480 -ftree-loop-ivcanon  -ftree-loop-linear  -ftree-loop-optimize @gol
481 -ftree-loop-vectorize @gol
482 -ftree-parallelize-loops=@var{n}  -ftree-pre  -ftree-partial-pre  -ftree-pta @gol
483 -ftree-reassoc  -ftree-scev-cprop  -ftree-sink  -ftree-slsr  -ftree-sra @gol
484 -ftree-switch-conversion  -ftree-tail-merge @gol
485 -ftree-ter  -ftree-vectorize  -ftree-vrp  -funconstrained-commons @gol
486 -funit-at-a-time  -funroll-all-loops  -funroll-loops @gol
487 -funsafe-math-optimizations  -funswitch-loops @gol
488 -fipa-ra  -fvariable-expansion-in-unroller  -fvect-cost-model  -fvpt @gol
489 -fweb  -fwhole-program  -fwpa  -fuse-linker-plugin @gol
490 --param @var{name}=@var{value}
491 -O  -O0  -O1  -O2  -O3  -Os  -Ofast  -Og}
493 @item Program Instrumentation Options
494 @xref{Instrumentation Options,,Program Instrumentation Options}.
495 @gccoptlist{-p  -pg  -fprofile-arcs  --coverage  -ftest-coverage @gol
496 -fprofile-abs-path @gol
497 -fprofile-dir=@var{path}  -fprofile-generate  -fprofile-generate=@var{path} @gol
498 -fprofile-note=@var{path}  -fprofile-update=@var{method} @gol
499 -fprofile-filter-files=@var{regex}  -fprofile-exclude-files=@var{regex} @gol
500 -fsanitize=@var{style}  -fsanitize-recover  -fsanitize-recover=@var{style} @gol
501 -fasan-shadow-offset=@var{number}  -fsanitize-sections=@var{s1},@var{s2},... @gol
502 -fsanitize-undefined-trap-on-error  -fbounds-check @gol
503 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
504 -fstack-protector  -fstack-protector-all  -fstack-protector-strong @gol
505 -fstack-protector-explicit  -fstack-check @gol
506 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
507 -fno-stack-limit  -fsplit-stack @gol
508 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
509 -fvtv-counts  -fvtv-debug @gol
510 -finstrument-functions @gol
511 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
512 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
514 @item Preprocessor Options
515 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
516 @gccoptlist{-A@var{question}=@var{answer} @gol
517 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
518 -C  -CC  -D@var{macro}@r{[}=@var{defn}@r{]} @gol
519 -dD  -dI  -dM  -dN  -dU @gol
520 -fdebug-cpp  -fdirectives-only  -fdollars-in-identifiers  @gol
521 -fexec-charset=@var{charset}  -fextended-identifiers  @gol
522 -finput-charset=@var{charset}  -fmacro-prefix-map=@var{old}=@var{new}  @gol
523 -fmax-include-depth=@var{depth} @gol
524 -fno-canonical-system-headers  -fpch-deps  -fpch-preprocess  @gol
525 -fpreprocessed  -ftabstop=@var{width}  -ftrack-macro-expansion  @gol
526 -fwide-exec-charset=@var{charset}  -fworking-directory @gol
527 -H  -imacros @var{file}  -include @var{file} @gol
528 -M  -MD  -MF  -MG  -MM  -MMD  -MP  -MQ  -MT @gol
529 -no-integrated-cpp  -P  -pthread  -remap @gol
530 -traditional  -traditional-cpp  -trigraphs @gol
531 -U@var{macro}  -undef  @gol
532 -Wp,@var{option}  -Xpreprocessor @var{option}}
534 @item Assembler Options
535 @xref{Assembler Options,,Passing Options to the Assembler}.
536 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
538 @item Linker Options
539 @xref{Link Options,,Options for Linking}.
540 @gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library} @gol
541 -nostartfiles  -nodefaultlibs  -nolibc  -nostdlib @gol
542 -e @var{entry}  --entry=@var{entry} @gol
543 -pie  -pthread  -r  -rdynamic @gol
544 -s  -static  -static-pie  -static-libgcc  -static-libstdc++ @gol
545 -static-libasan  -static-libtsan  -static-liblsan  -static-libubsan @gol
546 -shared  -shared-libgcc  -symbolic @gol
547 -T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
548 -u @var{symbol}  -z @var{keyword}}
550 @item Directory Options
551 @xref{Directory Options,,Options for Directory Search}.
552 @gccoptlist{-B@var{prefix}  -I@var{dir}  -I- @gol
553 -idirafter @var{dir} @gol
554 -imacros @var{file}  -imultilib @var{dir} @gol
555 -iplugindir=@var{dir}  -iprefix @var{file} @gol
556 -iquote @var{dir}  -isysroot @var{dir}  -isystem @var{dir} @gol
557 -iwithprefix @var{dir}  -iwithprefixbefore @var{dir}  @gol
558 -L@var{dir}  -no-canonical-prefixes  --no-sysroot-suffix @gol
559 -nostdinc  -nostdinc++  --sysroot=@var{dir}}
561 @item Code Generation Options
562 @xref{Code Gen Options,,Options for Code Generation Conventions}.
563 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
564 -ffixed-@var{reg}  -fexceptions @gol
565 -fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables @gol
566 -fasynchronous-unwind-tables @gol
567 -fno-gnu-unique @gol
568 -finhibit-size-directive  -fno-common  -fno-ident @gol
569 -fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt @gol
570 -fno-jump-tables @gol
571 -frecord-gcc-switches @gol
572 -freg-struct-return  -fshort-enums  -fshort-wchar @gol
573 -fverbose-asm  -fpack-struct[=@var{n}]  @gol
574 -fleading-underscore  -ftls-model=@var{model} @gol
575 -fstack-reuse=@var{reuse_level} @gol
576 -ftrampolines  -ftrapv  -fwrapv @gol
577 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
578 -fstrict-volatile-bitfields  -fsync-libcalls}
580 @item Developer Options
581 @xref{Developer Options,,GCC Developer Options}.
582 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
583 -dumpfullversion  -fchecking  -fchecking=@var{n}  -fdbg-cnt-list @gol
584 -fdbg-cnt=@var{counter-value-list} @gol
585 -fdisable-ipa-@var{pass_name} @gol
586 -fdisable-rtl-@var{pass_name} @gol
587 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
588 -fdisable-tree-@var{pass_name} @gol
589 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
590 -fdump-debug  -fdump-earlydebug @gol
591 -fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links @gol
592 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
593 -fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline @gol
594 -fdump-lang-all @gol
595 -fdump-lang-@var{switch} @gol
596 -fdump-lang-@var{switch}-@var{options} @gol
597 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
598 -fdump-passes @gol
599 -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename} @gol
600 -fdump-statistics @gol
601 -fdump-tree-all @gol
602 -fdump-tree-@var{switch} @gol
603 -fdump-tree-@var{switch}-@var{options} @gol
604 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
605 -fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second @gol
606 -fenable-@var{kind}-@var{pass} @gol
607 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
608 -fira-verbose=@var{n} @gol
609 -flto-report  -flto-report-wpa  -fmem-report-wpa @gol
610 -fmem-report  -fpre-ipa-mem-report  -fpost-ipa-mem-report @gol
611 -fopt-info  -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
612 -fprofile-report @gol
613 -frandom-seed=@var{string}  -fsched-verbose=@var{n} @gol
614 -fsel-sched-verbose  -fsel-sched-dump-cfg  -fsel-sched-pipelining-verbose @gol
615 -fstats  -fstack-usage  -ftime-report  -ftime-report-details @gol
616 -fvar-tracking-assignments-toggle  -gtoggle @gol
617 -print-file-name=@var{library}  -print-libgcc-file-name @gol
618 -print-multi-directory  -print-multi-lib  -print-multi-os-directory @gol
619 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
620 -print-sysroot  -print-sysroot-headers-suffix @gol
621 -save-temps  -save-temps=cwd  -save-temps=obj  -time@r{[}=@var{file}@r{]}}
623 @item Machine-Dependent Options
624 @xref{Submodel Options,,Machine-Dependent Options}.
625 @c This list is ordered alphanumerically by subsection name.
626 @c Try and put the significant identifier (CPU or system) first,
627 @c so users have a clue at guessing where the ones they want will be.
629 @emph{AArch64 Options}
630 @gccoptlist{-mabi=@var{name}  -mbig-endian  -mlittle-endian @gol
631 -mgeneral-regs-only @gol
632 -mcmodel=tiny  -mcmodel=small  -mcmodel=large @gol
633 -mstrict-align  -mno-strict-align @gol
634 -momit-leaf-frame-pointer @gol
635 -mtls-dialect=desc  -mtls-dialect=traditional @gol
636 -mtls-size=@var{size} @gol
637 -mfix-cortex-a53-835769  -mfix-cortex-a53-843419 @gol
638 -mlow-precision-recip-sqrt  -mlow-precision-sqrt  -mlow-precision-div @gol
639 -mpc-relative-literal-loads @gol
640 -msign-return-address=@var{scope} @gol
641 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
642 +@var{b-key}]|@var{bti} @gol
643 -march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}  @gol
644 -moverride=@var{string}  -mverbose-cost-dump @gol
645 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
646 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation }
648 @emph{Adapteva Epiphany Options}
649 @gccoptlist{-mhalf-reg-file  -mprefer-short-insn-regs @gol
650 -mbranch-cost=@var{num}  -mcmove  -mnops=@var{num}  -msoft-cmpsf @gol
651 -msplit-lohi  -mpost-inc  -mpost-modify  -mstack-offset=@var{num} @gol
652 -mround-nearest  -mlong-calls  -mshort-calls  -msmall16 @gol
653 -mfp-mode=@var{mode}  -mvect-double  -max-vect-align=@var{num} @gol
654 -msplit-vecmove-early  -m1reg-@var{reg}}
656 @emph{AMD GCN Options}
657 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
659 @emph{ARC Options}
660 @gccoptlist{-mbarrel-shifter  -mjli-always @gol
661 -mcpu=@var{cpu}  -mA6  -mARC600  -mA7  -mARC700 @gol
662 -mdpfp  -mdpfp-compact  -mdpfp-fast  -mno-dpfp-lrsr @gol
663 -mea  -mno-mpy  -mmul32x16  -mmul64  -matomic @gol
664 -mnorm  -mspfp  -mspfp-compact  -mspfp-fast  -msimd  -msoft-float  -mswap @gol
665 -mcrc  -mdsp-packa  -mdvbf  -mlock  -mmac-d16  -mmac-24  -mrtsc  -mswape @gol
666 -mtelephony  -mxy  -misize  -mannotate-align  -marclinux  -marclinux_prof @gol
667 -mlong-calls  -mmedium-calls  -msdata  -mirq-ctrl-saved @gol
668 -mrgf-banked-regs  -mlpc-width=@var{width}  -G @var{num} @gol
669 -mvolatile-cache  -mtp-regno=@var{regno} @gol
670 -malign-call  -mauto-modify-reg  -mbbit-peephole  -mno-brcc @gol
671 -mcase-vector-pcrel  -mcompact-casesi  -mno-cond-exec  -mearly-cbranchsi @gol
672 -mexpand-adddi  -mindexed-loads  -mlra  -mlra-priority-none @gol
673 -mlra-priority-compact mlra-priority-noncompact  -mmillicode @gol
674 -mmixed-code  -mq-class  -mRcq  -mRcw  -msize-level=@var{level} @gol
675 -mtune=@var{cpu}  -mmultcost=@var{num}  -mcode-density-frame @gol
676 -munalign-prob-threshold=@var{probability}  -mmpy-option=@var{multo} @gol
677 -mdiv-rem  -mcode-density  -mll64  -mfpu=@var{fpu}  -mrf16  -mbranch-index}
679 @emph{ARM Options}
680 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
681 -mabi=@var{name} @gol
682 -mapcs-stack-check  -mno-apcs-stack-check @gol
683 -mapcs-reentrant  -mno-apcs-reentrant @gol
684 -mgeneral-regs-only @gol
685 -msched-prolog  -mno-sched-prolog @gol
686 -mlittle-endian  -mbig-endian @gol
687 -mbe8  -mbe32 @gol
688 -mfloat-abi=@var{name} @gol
689 -mfp16-format=@var{name}
690 -mthumb-interwork  -mno-thumb-interwork @gol
691 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
692 -mtune=@var{name}  -mprint-tune-info @gol
693 -mstructure-size-boundary=@var{n} @gol
694 -mabort-on-noreturn @gol
695 -mlong-calls  -mno-long-calls @gol
696 -msingle-pic-base  -mno-single-pic-base @gol
697 -mpic-register=@var{reg} @gol
698 -mnop-fun-dllimport @gol
699 -mpoke-function-name @gol
700 -mthumb  -marm  -mflip-thumb @gol
701 -mtpcs-frame  -mtpcs-leaf-frame @gol
702 -mcaller-super-interworking  -mcallee-super-interworking @gol
703 -mtp=@var{name}  -mtls-dialect=@var{dialect} @gol
704 -mword-relocations @gol
705 -mfix-cortex-m3-ldrd @gol
706 -munaligned-access @gol
707 -mneon-for-64bits @gol
708 -mslow-flash-data @gol
709 -masm-syntax-unified @gol
710 -mrestrict-it @gol
711 -mverbose-cost-dump @gol
712 -mpure-code @gol
713 -mcmse @gol
714 -mfdpic}
716 @emph{AVR Options}
717 @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args @gol
718 -mbranch-cost=@var{cost} @gol
719 -mcall-prologues  -mgas-isr-prologues  -mint8 @gol
720 -mn_flash=@var{size}  -mno-interrupts @gol
721 -mmain-is-OS_task  -mrelax  -mrmw  -mstrict-X  -mtiny-stack @gol
722 -mfract-convert-truncate @gol
723 -mshort-calls  -nodevicelib @gol
724 -Waddr-space-convert  -Wmisspelled-isr}
726 @emph{Blackfin Options}
727 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
728 -msim  -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer @gol
729 -mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly @gol
730 -mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library @gol
731 -mno-id-shared-library  -mshared-library-id=@var{n} @gol
732 -mleaf-id-shared-library  -mno-leaf-id-shared-library @gol
733 -msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls @gol
734 -mfast-fp  -minline-plt  -mmulticore  -mcorea  -mcoreb  -msdram @gol
735 -micplb}
737 @emph{C6X Options}
738 @gccoptlist{-mbig-endian  -mlittle-endian  -march=@var{cpu} @gol
739 -msim  -msdata=@var{sdata-type}}
741 @emph{CRIS Options}
742 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
743 -mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
744 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
745 -mstack-align  -mdata-align  -mconst-align @gol
746 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
747 -melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
748 -mmul-bug-workaround  -mno-mul-bug-workaround}
750 @emph{CR16 Options}
751 @gccoptlist{-mmac @gol
752 -mcr16cplus  -mcr16c @gol
753 -msim  -mint32  -mbit-ops
754 -mdata-model=@var{model}}
756 @emph{C-SKY Options}
757 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu} @gol
758 -mbig-endian  -EB  -mlittle-endian  -EL @gol
759 -mhard-float  -msoft-float  -mfpu=@var{fpu}  -mdouble-float  -mfdivdu @gol
760 -melrw  -mistack  -mmp  -mcp  -mcache  -msecurity  -mtrust @gol
761 -mdsp  -medsp  -mvdsp @gol
762 -mdiv  -msmart  -mhigh-registers  -manchor @gol
763 -mpushpop  -mmultiple-stld  -mconstpool  -mstack-size  -mccrt @gol
764 -mbranch-cost=@var{n}  -mcse-cc  -msched-prolog}
766 @emph{Darwin Options}
767 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
768 -arch_only  -bind_at_load  -bundle  -bundle_loader @gol
769 -client_name  -compatibility_version  -current_version @gol
770 -dead_strip @gol
771 -dependency-file  -dylib_file  -dylinker_install_name @gol
772 -dynamic  -dynamiclib  -exported_symbols_list @gol
773 -filelist  -flat_namespace  -force_cpusubtype_ALL @gol
774 -force_flat_namespace  -headerpad_max_install_names @gol
775 -iframework @gol
776 -image_base  -init  -install_name  -keep_private_externs @gol
777 -multi_module  -multiply_defined  -multiply_defined_unused @gol
778 -noall_load   -no_dead_strip_inits_and_terms @gol
779 -nofixprebinding  -nomultidefs  -noprebind  -noseglinkedit @gol
780 -pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
781 -private_bundle  -read_only_relocs  -sectalign @gol
782 -sectobjectsymbols  -whyload  -seg1addr @gol
783 -sectcreate  -sectobjectsymbols  -sectorder @gol
784 -segaddr  -segs_read_only_addr  -segs_read_write_addr @gol
785 -seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
786 -segprot  -segs_read_only_addr  -segs_read_write_addr @gol
787 -single_module  -static  -sub_library  -sub_umbrella @gol
788 -twolevel_namespace  -umbrella  -undefined @gol
789 -unexported_symbols_list  -weak_reference_mismatches @gol
790 -whatsloaded  -F  -gused  -gfull  -mmacosx-version-min=@var{version} @gol
791 -mkernel  -mone-byte-bool}
793 @emph{DEC Alpha Options}
794 @gccoptlist{-mno-fp-regs  -msoft-float @gol
795 -mieee  -mieee-with-inexact  -mieee-conformant @gol
796 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
797 -mtrap-precision=@var{mode}  -mbuild-constants @gol
798 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
799 -mbwx  -mmax  -mfix  -mcix @gol
800 -mfloat-vax  -mfloat-ieee @gol
801 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
802 -msmall-text  -mlarge-text @gol
803 -mmemory-latency=@var{time}}
805 @emph{eBPF Options}
806 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
807 -mframe-limit=@var{bytes}}
809 @emph{FR30 Options}
810 @gccoptlist{-msmall-model  -mno-lsim}
812 @emph{FT32 Options}
813 @gccoptlist{-msim  -mlra  -mnodiv  -mft32b  -mcompress  -mnopm}
815 @emph{FRV Options}
816 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
817 -mhard-float  -msoft-float @gol
818 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
819 -mdouble  -mno-double @gol
820 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
821 -mfdpic  -minline-plt  -mgprel-ro  -multilib-library-pic @gol
822 -mlinked-fp  -mlong-calls  -malign-labels @gol
823 -mlibrary-pic  -macc-4  -macc-8 @gol
824 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
825 -moptimize-membar  -mno-optimize-membar @gol
826 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
827 -mvliw-branch  -mno-vliw-branch @gol
828 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
829 -mno-nested-cond-exec  -mtomcat-stats @gol
830 -mTLS  -mtls @gol
831 -mcpu=@var{cpu}}
833 @emph{GNU/Linux Options}
834 @gccoptlist{-mglibc  -muclibc  -mmusl  -mbionic  -mandroid @gol
835 -tno-android-cc  -tno-android-ld}
837 @emph{H8/300 Options}
838 @gccoptlist{-mrelax  -mh  -ms  -mn  -mexr  -mno-exr  -mint32  -malign-300}
840 @emph{HPPA Options}
841 @gccoptlist{-march=@var{architecture-type} @gol
842 -mcaller-copies  -mdisable-fpregs  -mdisable-indexing @gol
843 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
844 -mfixed-range=@var{register-range} @gol
845 -mjump-in-delay  -mlinker-opt  -mlong-calls @gol
846 -mlong-load-store  -mno-disable-fpregs @gol
847 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
848 -mno-jump-in-delay  -mno-long-load-store @gol
849 -mno-portable-runtime  -mno-soft-float @gol
850 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
851 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
852 -mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
853 -munix=@var{unix-std}  -nolibdld  -static  -threads}
855 @emph{IA-64 Options}
856 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
857 -mvolatile-asm-stop  -mregister-names  -msdata  -mno-sdata @gol
858 -mconstant-gp  -mauto-pic  -mfused-madd @gol
859 -minline-float-divide-min-latency @gol
860 -minline-float-divide-max-throughput @gol
861 -mno-inline-float-divide @gol
862 -minline-int-divide-min-latency @gol
863 -minline-int-divide-max-throughput  @gol
864 -mno-inline-int-divide @gol
865 -minline-sqrt-min-latency  -minline-sqrt-max-throughput @gol
866 -mno-inline-sqrt @gol
867 -mdwarf2-asm  -mearly-stop-bits @gol
868 -mfixed-range=@var{register-range}  -mtls-size=@var{tls-size} @gol
869 -mtune=@var{cpu-type}  -milp32  -mlp64 @gol
870 -msched-br-data-spec  -msched-ar-data-spec  -msched-control-spec @gol
871 -msched-br-in-data-spec  -msched-ar-in-data-spec  -msched-in-control-spec @gol
872 -msched-spec-ldc  -msched-spec-control-ldc @gol
873 -msched-prefer-non-data-spec-insns  -msched-prefer-non-control-spec-insns @gol
874 -msched-stop-bits-after-every-cycle  -msched-count-spec-in-critical-path @gol
875 -msel-sched-dont-check-control-spec  -msched-fp-mem-deps-zero-cost @gol
876 -msched-max-memory-insns-hard-limit  -msched-max-memory-insns=@var{max-insns}}
878 @emph{LM32 Options}
879 @gccoptlist{-mbarrel-shift-enabled  -mdivide-enabled  -mmultiply-enabled @gol
880 -msign-extend-enabled  -muser-enabled}
882 @emph{M32R/D Options}
883 @gccoptlist{-m32r2  -m32rx  -m32r @gol
884 -mdebug @gol
885 -malign-loops  -mno-align-loops @gol
886 -missue-rate=@var{number} @gol
887 -mbranch-cost=@var{number} @gol
888 -mmodel=@var{code-size-model-type} @gol
889 -msdata=@var{sdata-type} @gol
890 -mno-flush-func  -mflush-func=@var{name} @gol
891 -mno-flush-trap  -mflush-trap=@var{number} @gol
892 -G @var{num}}
894 @emph{M32C Options}
895 @gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
897 @emph{M680x0 Options}
898 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune} @gol
899 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
900 -m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407 @gol
901 -mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020 @gol
902 -mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort @gol
903 -mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel @gol
904 -malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
905 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library @gol
906 -mxgot  -mno-xgot  -mlong-jump-table-offsets}
908 @emph{MCore Options}
909 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
910 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
911 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
912 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
913 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
915 @emph{MeP Options}
916 @gccoptlist{-mabsdiff  -mall-opts  -maverage  -mbased=@var{n}  -mbitops @gol
917 -mc=@var{n}  -mclip  -mconfig=@var{name}  -mcop  -mcop32  -mcop64  -mivc2 @gol
918 -mdc  -mdiv  -meb  -mel  -mio-volatile  -ml  -mleadz  -mm  -mminmax @gol
919 -mmult  -mno-opts  -mrepeat  -ms  -msatur  -msdram  -msim  -msimnovec  -mtf @gol
920 -mtiny=@var{n}}
922 @emph{MicroBlaze Options}
923 @gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu} @gol
924 -mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift @gol
925 -mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss @gol
926 -mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt @gol
927 -mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model} @gol
928 -mpic-data-is-text-relative}
930 @emph{MIPS Options}
931 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
932 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5 @gol
933 -mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6 @gol
934 -mips16  -mno-mips16  -mflip-mips16 @gol
935 -minterlink-compressed  -mno-interlink-compressed @gol
936 -minterlink-mips16  -mno-interlink-mips16 @gol
937 -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
938 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
939 -mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float @gol
940 -mno-float  -msingle-float  -mdouble-float @gol
941 -modd-spreg  -mno-odd-spreg @gol
942 -mabs=@var{mode}  -mnan=@var{encoding} @gol
943 -mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
944 -mmcu  -mmno-mcu @gol
945 -meva  -mno-eva @gol
946 -mvirt  -mno-virt @gol
947 -mxpa  -mno-xpa @gol
948 -mcrc  -mno-crc @gol
949 -mginv  -mno-ginv @gol
950 -mmicromips  -mno-micromips @gol
951 -mmsa  -mno-msa @gol
952 -mloongson-mmi  -mno-loongson-mmi @gol
953 -mloongson-ext  -mno-loongson-ext @gol
954 -mloongson-ext2  -mno-loongson-ext2 @gol
955 -mfpu=@var{fpu-type} @gol
956 -msmartmips  -mno-smartmips @gol
957 -mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx @gol
958 -mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc @gol
959 -mlong64  -mlong32  -msym32  -mno-sym32 @gol
960 -G@var{num}  -mlocal-sdata  -mno-local-sdata @gol
961 -mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt @gol
962 -membedded-data  -mno-embedded-data @gol
963 -muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
964 -mcode-readable=@var{setting} @gol
965 -msplit-addresses  -mno-split-addresses @gol
966 -mexplicit-relocs  -mno-explicit-relocs @gol
967 -mcheck-zero-division  -mno-check-zero-division @gol
968 -mdivide-traps  -mdivide-breaks @gol
969 -mload-store-pairs  -mno-load-store-pairs @gol
970 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
971 -mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp @gol
972 -mfix-24k  -mno-fix-24k @gol
973 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
974 -mfix-r5900  -mno-fix-r5900 @gol
975 -mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000 @gol
976 -mfix-vr4120  -mno-fix-vr4120 @gol
977 -mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1 @gol
978 -mflush-func=@var{func}  -mno-flush-func @gol
979 -mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely @gol
980 -mcompact-branches=@var{policy} @gol
981 -mfp-exceptions  -mno-fp-exceptions @gol
982 -mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci @gol
983 -mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4 @gol
984 -mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address @gol
985 -mframe-header-opt  -mno-frame-header-opt}
987 @emph{MMIX Options}
988 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
989 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
990 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
991 -mno-base-addresses  -msingle-exit  -mno-single-exit}
993 @emph{MN10300 Options}
994 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
995 -mno-am33  -mam33  -mam33-2  -mam34 @gol
996 -mtune=@var{cpu-type} @gol
997 -mreturn-pointer-on-d0 @gol
998 -mno-crt0  -mrelax  -mliw  -msetlb}
1000 @emph{Moxie Options}
1001 @gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
1003 @emph{MSP430 Options}
1004 @gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax @gol
1005 -mwarn-mcu @gol
1006 -mcode-region=  -mdata-region= @gol
1007 -msilicon-errata=  -msilicon-errata-warn= @gol
1008 -mhwmult=  -minrt}
1010 @emph{NDS32 Options}
1011 @gccoptlist{-mbig-endian  -mlittle-endian @gol
1012 -mreduced-regs  -mfull-regs @gol
1013 -mcmov  -mno-cmov @gol
1014 -mext-perf  -mno-ext-perf @gol
1015 -mext-perf2  -mno-ext-perf2 @gol
1016 -mext-string  -mno-ext-string @gol
1017 -mv3push  -mno-v3push @gol
1018 -m16bit  -mno-16bit @gol
1019 -misr-vector-size=@var{num} @gol
1020 -mcache-block-size=@var{num} @gol
1021 -march=@var{arch} @gol
1022 -mcmodel=@var{code-model} @gol
1023 -mctor-dtor  -mrelax}
1025 @emph{Nios II Options}
1026 @gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt @gol
1027 -mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp} @gol
1028 -mel  -meb @gol
1029 -mno-bypass-cache  -mbypass-cache @gol
1030 -mno-cache-volatile  -mcache-volatile @gol
1031 -mno-fast-sw-div  -mfast-sw-div @gol
1032 -mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div @gol
1033 -mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn} @gol
1034 -mcustom-fpu-cfg=@var{name} @gol
1035 -mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name} @gol
1036 -march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1038 @emph{Nvidia PTX Options}
1039 @gccoptlist{-m32  -m64  -mmainkernel  -moptimize}
1041 @emph{OpenRISC Options}
1042 @gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div @gol
1043 -msoft-mul  -msoft-div @gol
1044 -msoft-float  -mhard-float  -mdouble-float -munordered-float @gol
1045 -mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm}
1047 @emph{PDP-11 Options}
1048 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
1049 -mint32  -mno-int16  -mint16  -mno-int32 @gol
1050 -msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1052 @emph{picoChip Options}
1053 @gccoptlist{-mae=@var{ae_type}  -mvliw-lookahead=@var{N} @gol
1054 -msymbol-as-address  -mno-inefficient-warnings}
1056 @emph{PowerPC Options}
1057 See RS/6000 and PowerPC Options.
1059 @emph{PRU Options}
1060 @gccoptlist{-mmcu=@var{mcu}  -minrt  -mno-relax  -mloop @gol
1061 -mabi=@var{variant} @gol}
1063 @emph{RISC-V Options}
1064 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1065 -mplt  -mno-plt @gol
1066 -mabi=@var{ABI-string} @gol
1067 -mfdiv  -mno-fdiv @gol
1068 -mdiv  -mno-div @gol
1069 -march=@var{ISA-string} @gol
1070 -mtune=@var{processor-string} @gol
1071 -mpreferred-stack-boundary=@var{num} @gol
1072 -msmall-data-limit=@var{N-bytes} @gol
1073 -msave-restore  -mno-save-restore @gol
1074 -mstrict-align  -mno-strict-align @gol
1075 -mcmodel=medlow  -mcmodel=medany @gol
1076 -mexplicit-relocs  -mno-explicit-relocs @gol
1077 -mrelax  -mno-relax @gol
1078 -mriscv-attribute  -mmo-riscv-attribute @gol
1079 -malign-data=@var{type}}
1081 @emph{RL78 Options}
1082 @gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs @gol
1083 -mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14 @gol
1084 -m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1086 @emph{RS/6000 and PowerPC Options}
1087 @gccoptlist{-mcpu=@var{cpu-type} @gol
1088 -mtune=@var{cpu-type} @gol
1089 -mcmodel=@var{code-model} @gol
1090 -mpowerpc64 @gol
1091 -maltivec  -mno-altivec @gol
1092 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
1093 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
1094 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd @gol
1095 -mfprnd  -mno-fprnd @gol
1096 -mcmpb  -mno-cmpb  -mhard-dfp  -mno-hard-dfp @gol
1097 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
1098 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
1099 -malign-power  -malign-natural @gol
1100 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
1101 -mupdate  -mno-update @gol
1102 -mavoid-indexed-addresses  -mno-avoid-indexed-addresses @gol
1103 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
1104 -mstrict-align  -mno-strict-align  -mrelocatable @gol
1105 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
1106 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
1107 -mdynamic-no-pic  -mswdiv  -msingle-pic-base @gol
1108 -mprioritize-restricted-insns=@var{priority} @gol
1109 -msched-costly-dep=@var{dependence_type} @gol
1110 -minsert-sched-nops=@var{scheme} @gol
1111 -mcall-aixdesc  -mcall-eabi  -mcall-freebsd  @gol
1112 -mcall-linux  -mcall-netbsd  -mcall-openbsd  @gol
1113 -mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi @gol
1114 -mtraceback=@var{traceback_type} @gol
1115 -maix-struct-return  -msvr4-struct-return @gol
1116 -mabi=@var{abi-type}  -msecure-plt  -mbss-plt @gol
1117 -mlongcall  -mno-longcall  -mpltseq  -mno-pltseq  @gol
1118 -mblock-move-inline-limit=@var{num} @gol
1119 -mblock-compare-inline-limit=@var{num} @gol
1120 -mblock-compare-inline-loop-limit=@var{num} @gol
1121 -mstring-compare-inline-limit=@var{num} @gol
1122 -misel  -mno-isel @gol
1123 -mvrsave  -mno-vrsave @gol
1124 -mmulhw  -mno-mulhw @gol
1125 -mdlmzb  -mno-dlmzb @gol
1126 -mprototype  -mno-prototype @gol
1127 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
1128 -msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num} @gol
1129 -mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision @gol
1130 -mno-recip-precision @gol
1131 -mveclibabi=@var{type}  -mfriz  -mno-friz @gol
1132 -mpointers-to-nested-functions  -mno-pointers-to-nested-functions @gol
1133 -msave-toc-indirect  -mno-save-toc-indirect @gol
1134 -mpower8-fusion  -mno-mpower8-fusion  -mpower8-vector  -mno-power8-vector @gol
1135 -mcrypto  -mno-crypto  -mhtm  -mno-htm @gol
1136 -mquad-memory  -mno-quad-memory @gol
1137 -mquad-memory-atomic  -mno-quad-memory-atomic @gol
1138 -mcompat-align-parm  -mno-compat-align-parm @gol
1139 -mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware @gol
1140 -mgnu-attribute  -mno-gnu-attribute @gol
1141 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1142 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1144 @emph{RX Options}
1145 @gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu@gol
1146 -mcpu=@gol
1147 -mbig-endian-data  -mlittle-endian-data @gol
1148 -msmall-data @gol
1149 -msim  -mno-sim@gol
1150 -mas100-syntax  -mno-as100-syntax@gol
1151 -mrelax@gol
1152 -mmax-constant-size=@gol
1153 -mint-register=@gol
1154 -mpid@gol
1155 -mallow-string-insns  -mno-allow-string-insns@gol
1156 -mjsr@gol
1157 -mno-warn-multiple-fast-interrupts@gol
1158 -msave-acc-in-interrupts}
1160 @emph{S/390 and zSeries Options}
1161 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1162 -mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp @gol
1163 -mlong-double-64  -mlong-double-128 @gol
1164 -mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack @gol
1165 -msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle @gol
1166 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
1167 -mhtm  -mvx  -mzvector @gol
1168 -mtpf-trace  -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
1169 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard @gol
1170 -mhotpatch=@var{halfwords},@var{halfwords}}
1172 @emph{Score Options}
1173 @gccoptlist{-meb  -mel @gol
1174 -mnhwloop @gol
1175 -muls @gol
1176 -mmac @gol
1177 -mscore5  -mscore5u  -mscore7  -mscore7d}
1179 @emph{SH Options}
1180 @gccoptlist{-m1  -m2  -m2e @gol
1181 -m2a-nofpu  -m2a-single-only  -m2a-single  -m2a @gol
1182 -m3  -m3e @gol
1183 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
1184 -m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al @gol
1185 -mb  -ml  -mdalign  -mrelax @gol
1186 -mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave @gol
1187 -mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct @gol
1188 -mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy} @gol
1189 -mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range} @gol
1190 -maccumulate-outgoing-args @gol
1191 -matomic-model=@var{atomic-model} @gol
1192 -mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch @gol
1193 -mcbranch-force-delay-slot @gol
1194 -mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra @gol
1195 -mpretend-cmove  -mtas}
1197 @emph{Solaris 2 Options}
1198 @gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text @gol
1199 -pthreads}
1201 @emph{SPARC Options}
1202 @gccoptlist{-mcpu=@var{cpu-type} @gol
1203 -mtune=@var{cpu-type} @gol
1204 -mcmodel=@var{code-model} @gol
1205 -mmemory-model=@var{mem-model} @gol
1206 -m32  -m64  -mapp-regs  -mno-app-regs @gol
1207 -mfaster-structs  -mno-faster-structs  -mflat  -mno-flat @gol
1208 -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1209 -mhard-quad-float  -msoft-quad-float @gol
1210 -mstack-bias  -mno-stack-bias @gol
1211 -mstd-struct-return  -mno-std-struct-return @gol
1212 -munaligned-doubles  -mno-unaligned-doubles @gol
1213 -muser-mode  -mno-user-mode @gol
1214 -mv8plus  -mno-v8plus  -mvis  -mno-vis @gol
1215 -mvis2  -mno-vis2  -mvis3  -mno-vis3 @gol
1216 -mvis4  -mno-vis4  -mvis4b  -mno-vis4b @gol
1217 -mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld  @gol
1218 -mpopc  -mno-popc  -msubxc  -mno-subxc @gol
1219 -mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc @gol
1220 -mlra  -mno-lra}
1222 @emph{System V Options}
1223 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1225 @emph{TILE-Gx Options}
1226 @gccoptlist{-mcpu=CPU  -m32  -m64  -mbig-endian  -mlittle-endian @gol
1227 -mcmodel=@var{code-model}}
1229 @emph{TILEPro Options}
1230 @gccoptlist{-mcpu=@var{cpu}  -m32}
1232 @emph{V850 Options}
1233 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
1234 -mprolog-function  -mno-prolog-function  -mspace @gol
1235 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
1236 -mapp-regs  -mno-app-regs @gol
1237 -mdisable-callt  -mno-disable-callt @gol
1238 -mv850e2v3  -mv850e2  -mv850e1  -mv850es @gol
1239 -mv850e  -mv850  -mv850e3v5 @gol
1240 -mloop @gol
1241 -mrelax @gol
1242 -mlong-jumps @gol
1243 -msoft-float @gol
1244 -mhard-float @gol
1245 -mgcc-abi @gol
1246 -mrh850-abi @gol
1247 -mbig-switch}
1249 @emph{VAX Options}
1250 @gccoptlist{-mg  -mgnu  -munix}
1252 @emph{Visium Options}
1253 @gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1254 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1256 @emph{VMS Options}
1257 @gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64 @gol
1258 -mpointer-size=@var{size}}
1260 @emph{VxWorks Options}
1261 @gccoptlist{-mrtp  -non-static  -Bstatic  -Bdynamic @gol
1262 -Xbind-lazy  -Xbind-now}
1264 @emph{x86 Options}
1265 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1266 -mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default @gol
1267 -mfpmath=@var{unit} @gol
1268 -masm=@var{dialect}  -mno-fancy-math-387 @gol
1269 -mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float @gol
1270 -mno-wide-multiply  -mrtd  -malign-double @gol
1271 -mpreferred-stack-boundary=@var{num} @gol
1272 -mincoming-stack-boundary=@var{num} @gol
1273 -mcld  -mcx16  -msahf  -mmovbe  -mcrc32 @gol
1274 -mrecip  -mrecip=@var{opt} @gol
1275 -mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt} @gol
1276 -mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx @gol
1277 -mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl @gol
1278 -mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes @gol
1279 -mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd  @gol
1280 -mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves @gol
1281 -msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop @gol
1282 -madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp @gol
1283 -mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg @gol
1284 -mshstk -mmanual-endbr -mforce-indirect-call  -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1285 -mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq @gol
1286 -mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid @gol
1287 -mrdseed  -msgx -mavx512vp2intersect@gol
1288 -mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops @gol
1289 -minline-stringops-dynamically  -mstringop-strategy=@var{alg} @gol
1290 -mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy} @gol
1291 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
1292 -m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128 @gol
1293 -mregparm=@var{num}  -msseregparm @gol
1294 -mveclibabi=@var{type}  -mvect8-ret-in-mem @gol
1295 -mpc32  -mpc64  -mpc80  -mstackrealign @gol
1296 -momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs @gol
1297 -mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode} @gol
1298 -m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num} @gol
1299 -msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv @gol
1300 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1301 -mavx256-split-unaligned-load  -mavx256-split-unaligned-store @gol
1302 -malign-data=@var{type}  -mstack-protector-guard=@var{guard} @gol
1303 -mstack-protector-guard-reg=@var{reg} @gol
1304 -mstack-protector-guard-offset=@var{offset} @gol
1305 -mstack-protector-guard-symbol=@var{symbol} @gol
1306 -mgeneral-regs-only  -mcall-ms2sysv-xlogues @gol
1307 -mindirect-branch=@var{choice}  -mfunction-return=@var{choice} @gol
1308 -mindirect-branch-register}
1310 @emph{x86 Windows Options}
1311 @gccoptlist{-mconsole  -mcygwin  -mno-cygwin  -mdll @gol
1312 -mnop-fun-dllimport  -mthread @gol
1313 -municode  -mwin32  -mwindows  -fno-set-stack-executable}
1315 @emph{Xstormy16 Options}
1316 @gccoptlist{-msim}
1318 @emph{Xtensa Options}
1319 @gccoptlist{-mconst16  -mno-const16 @gol
1320 -mfused-madd  -mno-fused-madd @gol
1321 -mforce-no-pic @gol
1322 -mserialize-volatile  -mno-serialize-volatile @gol
1323 -mtext-section-literals  -mno-text-section-literals @gol
1324 -mauto-litpools  -mno-auto-litpools @gol
1325 -mtarget-align  -mno-target-align @gol
1326 -mlongcalls  -mno-longcalls}
1328 @emph{zSeries Options}
1329 See S/390 and zSeries Options.
1330 @end table
1333 @node Overall Options
1334 @section Options Controlling the Kind of Output
1336 Compilation can involve up to four stages: preprocessing, compilation
1337 proper, assembly and linking, always in that order.  GCC is capable of
1338 preprocessing and compiling several files either into several
1339 assembler input files, or into one assembler input file; then each
1340 assembler input file produces an object file, and linking combines all
1341 the object files (those newly compiled, and those specified as input)
1342 into an executable file.
1344 @cindex file name suffix
1345 For any given input file, the file name suffix determines what kind of
1346 compilation is done:
1348 @table @gcctabopt
1349 @item @var{file}.c
1350 C source code that must be preprocessed.
1352 @item @var{file}.i
1353 C source code that should not be preprocessed.
1355 @item @var{file}.ii
1356 C++ source code that should not be preprocessed.
1358 @item @var{file}.m
1359 Objective-C source code.  Note that you must link with the @file{libobjc}
1360 library to make an Objective-C program work.
1362 @item @var{file}.mi
1363 Objective-C source code that should not be preprocessed.
1365 @item @var{file}.mm
1366 @itemx @var{file}.M
1367 Objective-C++ source code.  Note that you must link with the @file{libobjc}
1368 library to make an Objective-C++ program work.  Note that @samp{.M} refers
1369 to a literal capital M@.
1371 @item @var{file}.mii
1372 Objective-C++ source code that should not be preprocessed.
1374 @item @var{file}.h
1375 C, C++, Objective-C or Objective-C++ header file to be turned into a
1376 precompiled header (default), or C, C++ header file to be turned into an
1377 Ada spec (via the @option{-fdump-ada-spec} switch).
1379 @item @var{file}.cc
1380 @itemx @var{file}.cp
1381 @itemx @var{file}.cxx
1382 @itemx @var{file}.cpp
1383 @itemx @var{file}.CPP
1384 @itemx @var{file}.c++
1385 @itemx @var{file}.C
1386 C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1387 the last two letters must both be literally @samp{x}.  Likewise,
1388 @samp{.C} refers to a literal capital C@.
1390 @item @var{file}.mm
1391 @itemx @var{file}.M
1392 Objective-C++ source code that must be preprocessed.
1394 @item @var{file}.mii
1395 Objective-C++ source code that should not be preprocessed.
1397 @item @var{file}.hh
1398 @itemx @var{file}.H
1399 @itemx @var{file}.hp
1400 @itemx @var{file}.hxx
1401 @itemx @var{file}.hpp
1402 @itemx @var{file}.HPP
1403 @itemx @var{file}.h++
1404 @itemx @var{file}.tcc
1405 C++ header file to be turned into a precompiled header or Ada spec.
1407 @item @var{file}.f
1408 @itemx @var{file}.for
1409 @itemx @var{file}.ftn
1410 Fixed form Fortran source code that should not be preprocessed.
1412 @item @var{file}.F
1413 @itemx @var{file}.FOR
1414 @itemx @var{file}.fpp
1415 @itemx @var{file}.FPP
1416 @itemx @var{file}.FTN
1417 Fixed form Fortran source code that must be preprocessed (with the traditional
1418 preprocessor).
1420 @item @var{file}.f90
1421 @itemx @var{file}.f95
1422 @itemx @var{file}.f03
1423 @itemx @var{file}.f08
1424 Free form Fortran source code that should not be preprocessed.
1426 @item @var{file}.F90
1427 @itemx @var{file}.F95
1428 @itemx @var{file}.F03
1429 @itemx @var{file}.F08
1430 Free form Fortran source code that must be preprocessed (with the
1431 traditional preprocessor).
1433 @item @var{file}.go
1434 Go source code.
1436 @item @var{file}.brig
1437 BRIG files (binary representation of HSAIL).
1439 @item @var{file}.d
1440 D source code.
1442 @item @var{file}.di
1443 D interface file.
1445 @item @var{file}.dd
1446 D documentation code (Ddoc).
1448 @item @var{file}.ads
1449 Ada source code file that contains a library unit declaration (a
1450 declaration of a package, subprogram, or generic, or a generic
1451 instantiation), or a library unit renaming declaration (a package,
1452 generic, or subprogram renaming declaration).  Such files are also
1453 called @dfn{specs}.
1455 @item @var{file}.adb
1456 Ada source code file containing a library unit body (a subprogram or
1457 package body).  Such files are also called @dfn{bodies}.
1459 @c GCC also knows about some suffixes for languages not yet included:
1460 @c Ratfor:
1461 @c @var{file}.r
1463 @item @var{file}.s
1464 Assembler code.
1466 @item @var{file}.S
1467 @itemx @var{file}.sx
1468 Assembler code that must be preprocessed.
1470 @item @var{other}
1471 An object file to be fed straight into linking.
1472 Any file name with no recognized suffix is treated this way.
1473 @end table
1475 @opindex x
1476 You can specify the input language explicitly with the @option{-x} option:
1478 @table @gcctabopt
1479 @item -x @var{language}
1480 Specify explicitly the @var{language} for the following input files
1481 (rather than letting the compiler choose a default based on the file
1482 name suffix).  This option applies to all following input files until
1483 the next @option{-x} option.  Possible values for @var{language} are:
1484 @smallexample
1485 c  c-header  cpp-output
1486 c++  c++-header  c++-cpp-output
1487 objective-c  objective-c-header  objective-c-cpp-output
1488 objective-c++ objective-c++-header objective-c++-cpp-output
1489 assembler  assembler-with-cpp
1492 f77  f77-cpp-input f95  f95-cpp-input
1494 brig
1495 @end smallexample
1497 @item -x none
1498 Turn off any specification of a language, so that subsequent files are
1499 handled according to their file name suffixes (as they are if @option{-x}
1500 has not been used at all).
1501 @end table
1503 If you only want some of the stages of compilation, you can use
1504 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1505 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1506 @command{gcc} is to stop.  Note that some combinations (for example,
1507 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1509 @table @gcctabopt
1510 @item -c
1511 @opindex c
1512 Compile or assemble the source files, but do not link.  The linking
1513 stage simply is not done.  The ultimate output is in the form of an
1514 object file for each source file.
1516 By default, the object file name for a source file is made by replacing
1517 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1519 Unrecognized input files, not requiring compilation or assembly, are
1520 ignored.
1522 @item -S
1523 @opindex S
1524 Stop after the stage of compilation proper; do not assemble.  The output
1525 is in the form of an assembler code file for each non-assembler input
1526 file specified.
1528 By default, the assembler file name for a source file is made by
1529 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1531 Input files that don't require compilation are ignored.
1533 @item -E
1534 @opindex E
1535 Stop after the preprocessing stage; do not run the compiler proper.  The
1536 output is in the form of preprocessed source code, which is sent to the
1537 standard output.
1539 Input files that don't require preprocessing are ignored.
1541 @cindex output file option
1542 @item -o @var{file}
1543 @opindex o
1544 Place output in file @var{file}.  This applies to whatever
1545 sort of output is being produced, whether it be an executable file,
1546 an object file, an assembler file or preprocessed C code.
1548 If @option{-o} is not specified, the default is to put an executable
1549 file in @file{a.out}, the object file for
1550 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1551 assembler file in @file{@var{source}.s}, a precompiled header file in
1552 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1553 standard output.
1555 @item -v
1556 @opindex v
1557 Print (on standard error output) the commands executed to run the stages
1558 of compilation.  Also print the version number of the compiler driver
1559 program and of the preprocessor and the compiler proper.
1561 @item -###
1562 @opindex ###
1563 Like @option{-v} except the commands are not executed and arguments
1564 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1565 This is useful for shell scripts to capture the driver-generated command lines.
1567 @item --help
1568 @opindex help
1569 Print (on the standard output) a description of the command-line options
1570 understood by @command{gcc}.  If the @option{-v} option is also specified
1571 then @option{--help} is also passed on to the various processes
1572 invoked by @command{gcc}, so that they can display the command-line options
1573 they accept.  If the @option{-Wextra} option has also been specified
1574 (prior to the @option{--help} option), then command-line options that
1575 have no documentation associated with them are also displayed.
1577 @item --target-help
1578 @opindex target-help
1579 Print (on the standard output) a description of target-specific command-line
1580 options for each tool.  For some targets extra target-specific
1581 information may also be printed.
1583 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1584 Print (on the standard output) a description of the command-line
1585 options understood by the compiler that fit into all specified classes
1586 and qualifiers.  These are the supported classes:
1588 @table @asis
1589 @item @samp{optimizers}
1590 Display all of the optimization options supported by the
1591 compiler.
1593 @item @samp{warnings}
1594 Display all of the options controlling warning messages
1595 produced by the compiler.
1597 @item @samp{target}
1598 Display target-specific options.  Unlike the
1599 @option{--target-help} option however, target-specific options of the
1600 linker and assembler are not displayed.  This is because those
1601 tools do not currently support the extended @option{--help=} syntax.
1603 @item @samp{params}
1604 Display the values recognized by the @option{--param}
1605 option.
1607 @item @var{language}
1608 Display the options supported for @var{language}, where
1609 @var{language} is the name of one of the languages supported in this
1610 version of GCC@.
1612 @item @samp{common}
1613 Display the options that are common to all languages.
1614 @end table
1616 These are the supported qualifiers:
1618 @table @asis
1619 @item @samp{undocumented}
1620 Display only those options that are undocumented.
1622 @item @samp{joined}
1623 Display options taking an argument that appears after an equal
1624 sign in the same continuous piece of text, such as:
1625 @samp{--help=target}.
1627 @item @samp{separate}
1628 Display options taking an argument that appears as a separate word
1629 following the original option, such as: @samp{-o output-file}.
1630 @end table
1632 Thus for example to display all the undocumented target-specific
1633 switches supported by the compiler, use:
1635 @smallexample
1636 --help=target,undocumented
1637 @end smallexample
1639 The sense of a qualifier can be inverted by prefixing it with the
1640 @samp{^} character, so for example to display all binary warning
1641 options (i.e., ones that are either on or off and that do not take an
1642 argument) that have a description, use:
1644 @smallexample
1645 --help=warnings,^joined,^undocumented
1646 @end smallexample
1648 The argument to @option{--help=} should not consist solely of inverted
1649 qualifiers.
1651 Combining several classes is possible, although this usually
1652 restricts the output so much that there is nothing to display.  One
1653 case where it does work, however, is when one of the classes is
1654 @var{target}.  For example, to display all the target-specific
1655 optimization options, use:
1657 @smallexample
1658 --help=target,optimizers
1659 @end smallexample
1661 The @option{--help=} option can be repeated on the command line.  Each
1662 successive use displays its requested class of options, skipping
1663 those that have already been displayed.  If @option{--help} is also
1664 specified anywhere on the command line then this takes precedence
1665 over any @option{--help=} option.
1667 If the @option{-Q} option appears on the command line before the
1668 @option{--help=} option, then the descriptive text displayed by
1669 @option{--help=} is changed.  Instead of describing the displayed
1670 options, an indication is given as to whether the option is enabled,
1671 disabled or set to a specific value (assuming that the compiler
1672 knows this at the point where the @option{--help=} option is used).
1674 Here is a truncated example from the ARM port of @command{gcc}:
1676 @smallexample
1677   % gcc -Q -mabi=2 --help=target -c
1678   The following options are target specific:
1679   -mabi=                                2
1680   -mabort-on-noreturn                   [disabled]
1681   -mapcs                                [disabled]
1682 @end smallexample
1684 The output is sensitive to the effects of previous command-line
1685 options, so for example it is possible to find out which optimizations
1686 are enabled at @option{-O2} by using:
1688 @smallexample
1689 -Q -O2 --help=optimizers
1690 @end smallexample
1692 Alternatively you can discover which binary optimizations are enabled
1693 by @option{-O3} by using:
1695 @smallexample
1696 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1697 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1698 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1699 @end smallexample
1701 @item --version
1702 @opindex version
1703 Display the version number and copyrights of the invoked GCC@.
1705 @item -pass-exit-codes
1706 @opindex pass-exit-codes
1707 Normally the @command{gcc} program exits with the code of 1 if any
1708 phase of the compiler returns a non-success return code.  If you specify
1709 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1710 the numerically highest error produced by any phase returning an error
1711 indication.  The C, C++, and Fortran front ends return 4 if an internal
1712 compiler error is encountered.
1714 @item -pipe
1715 @opindex pipe
1716 Use pipes rather than temporary files for communication between the
1717 various stages of compilation.  This fails to work on some systems where
1718 the assembler is unable to read from a pipe; but the GNU assembler has
1719 no trouble.
1721 @item -specs=@var{file}
1722 @opindex specs
1723 Process @var{file} after the compiler reads in the standard @file{specs}
1724 file, in order to override the defaults which the @command{gcc} driver
1725 program uses when determining what switches to pass to @command{cc1},
1726 @command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
1727 @option{-specs=@var{file}} can be specified on the command line, and they
1728 are processed in order, from left to right.  @xref{Spec Files}, for
1729 information about the format of the @var{file}.
1731 @item -wrapper
1732 @opindex wrapper
1733 Invoke all subcommands under a wrapper program.  The name of the
1734 wrapper program and its parameters are passed as a comma separated
1735 list.
1737 @smallexample
1738 gcc -c t.c -wrapper gdb,--args
1739 @end smallexample
1741 @noindent
1742 This invokes all subprograms of @command{gcc} under
1743 @samp{gdb --args}, thus the invocation of @command{cc1} is
1744 @samp{gdb --args cc1 @dots{}}.
1746 @item -ffile-prefix-map=@var{old}=@var{new}
1747 @opindex ffile-prefix-map
1748 When compiling files residing in directory @file{@var{old}}, record
1749 any references to them in the result of the compilation as if the
1750 files resided in directory @file{@var{new}} instead.  Specifying this
1751 option is equivalent to specifying all the individual
1752 @option{-f*-prefix-map} options.  This can be used to make reproducible
1753 builds that are location independent.  See also
1754 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1756 @item -fplugin=@var{name}.so
1757 @opindex fplugin
1758 Load the plugin code in file @var{name}.so, assumed to be a
1759 shared object to be dlopen'd by the compiler.  The base name of
1760 the shared object file is used to identify the plugin for the
1761 purposes of argument parsing (See
1762 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1763 Each plugin should define the callback functions specified in the
1764 Plugins API.
1766 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1767 @opindex fplugin-arg
1768 Define an argument called @var{key} with a value of @var{value}
1769 for the plugin called @var{name}.
1771 @item -fdump-ada-spec@r{[}-slim@r{]}
1772 @opindex fdump-ada-spec
1773 For C and C++ source and include files, generate corresponding Ada specs.
1774 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1775 GNAT User's Guide}, which provides detailed documentation on this feature.
1777 @item -fada-spec-parent=@var{unit}
1778 @opindex fada-spec-parent
1779 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1780 Ada specs as child units of parent @var{unit}.
1782 @item -fdump-go-spec=@var{file}
1783 @opindex fdump-go-spec
1784 For input files in any language, generate corresponding Go
1785 declarations in @var{file}.  This generates Go @code{const},
1786 @code{type}, @code{var}, and @code{func} declarations which may be a
1787 useful way to start writing a Go interface to code written in some
1788 other language.
1790 @include @value{srcdir}/../libiberty/at-file.texi
1791 @end table
1793 @node Invoking G++
1794 @section Compiling C++ Programs
1796 @cindex suffixes for C++ source
1797 @cindex C++ source file suffixes
1798 C++ source files conventionally use one of the suffixes @samp{.C},
1799 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1800 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1801 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1802 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
1803 files with these names and compiles them as C++ programs even if you
1804 call the compiler the same way as for compiling C programs (usually
1805 with the name @command{gcc}).
1807 @findex g++
1808 @findex c++
1809 However, the use of @command{gcc} does not add the C++ library.
1810 @command{g++} is a program that calls GCC and automatically specifies linking
1811 against the C++ library.  It treats @samp{.c},
1812 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1813 files unless @option{-x} is used.  This program is also useful when
1814 precompiling a C header file with a @samp{.h} extension for use in C++
1815 compilations.  On many systems, @command{g++} is also installed with
1816 the name @command{c++}.
1818 @cindex invoking @command{g++}
1819 When you compile C++ programs, you may specify many of the same
1820 command-line options that you use for compiling programs in any
1821 language; or command-line options meaningful for C and related
1822 languages; or options that are meaningful only for C++ programs.
1823 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1824 explanations of options for languages related to C@.
1825 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1826 explanations of options that are meaningful only for C++ programs.
1828 @node C Dialect Options
1829 @section Options Controlling C Dialect
1830 @cindex dialect options
1831 @cindex language dialect options
1832 @cindex options, dialect
1834 The following options control the dialect of C (or languages derived
1835 from C, such as C++, Objective-C and Objective-C++) that the compiler
1836 accepts:
1838 @table @gcctabopt
1839 @cindex ANSI support
1840 @cindex ISO support
1841 @item -ansi
1842 @opindex ansi
1843 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1844 equivalent to @option{-std=c++98}.
1846 This turns off certain features of GCC that are incompatible with ISO
1847 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1848 such as the @code{asm} and @code{typeof} keywords, and
1849 predefined macros such as @code{unix} and @code{vax} that identify the
1850 type of system you are using.  It also enables the undesirable and
1851 rarely used ISO trigraph feature.  For the C compiler,
1852 it disables recognition of C++ style @samp{//} comments as well as
1853 the @code{inline} keyword.
1855 The alternate keywords @code{__asm__}, @code{__extension__},
1856 @code{__inline__} and @code{__typeof__} continue to work despite
1857 @option{-ansi}.  You would not want to use them in an ISO C program, of
1858 course, but it is useful to put them in header files that might be included
1859 in compilations done with @option{-ansi}.  Alternate predefined macros
1860 such as @code{__unix__} and @code{__vax__} are also available, with or
1861 without @option{-ansi}.
1863 The @option{-ansi} option does not cause non-ISO programs to be
1864 rejected gratuitously.  For that, @option{-Wpedantic} is required in
1865 addition to @option{-ansi}.  @xref{Warning Options}.
1867 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1868 option is used.  Some header files may notice this macro and refrain
1869 from declaring certain functions or defining certain macros that the
1870 ISO standard doesn't call for; this is to avoid interfering with any
1871 programs that might use these names for other things.
1873 Functions that are normally built in but do not have semantics
1874 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1875 functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
1876 built-in functions provided by GCC}, for details of the functions
1877 affected.
1879 @item -std=
1880 @opindex std
1881 Determine the language standard. @xref{Standards,,Language Standards
1882 Supported by GCC}, for details of these standard versions.  This option
1883 is currently only supported when compiling C or C++.
1885 The compiler can accept several base standards, such as @samp{c90} or
1886 @samp{c++98}, and GNU dialects of those standards, such as
1887 @samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
1888 compiler accepts all programs following that standard plus those
1889 using GNU extensions that do not contradict it.  For example,
1890 @option{-std=c90} turns off certain features of GCC that are
1891 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1892 keywords, but not other GNU extensions that do not have a meaning in
1893 ISO C90, such as omitting the middle term of a @code{?:}
1894 expression. On the other hand, when a GNU dialect of a standard is
1895 specified, all features supported by the compiler are enabled, even when
1896 those features change the meaning of the base standard.  As a result, some
1897 strict-conforming programs may be rejected.  The particular standard
1898 is used by @option{-Wpedantic} to identify which features are GNU
1899 extensions given that version of the standard. For example
1900 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1901 comments, while @option{-std=gnu99 -Wpedantic} does not.
1903 A value for this option must be provided; possible values are
1905 @table @samp
1906 @item c90
1907 @itemx c89
1908 @itemx iso9899:1990
1909 Support all ISO C90 programs (certain GNU extensions that conflict
1910 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1912 @item iso9899:199409
1913 ISO C90 as modified in amendment 1.
1915 @item c99
1916 @itemx c9x
1917 @itemx iso9899:1999
1918 @itemx iso9899:199x
1919 ISO C99.  This standard is substantially completely supported, modulo
1920 bugs and floating-point issues
1921 (mainly but not entirely relating to optional C99 features from
1922 Annexes F and G).  See
1923 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1924 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1926 @item c11
1927 @itemx c1x
1928 @itemx iso9899:2011
1929 ISO C11, the 2011 revision of the ISO C standard.  This standard is
1930 substantially completely supported, modulo bugs, floating-point issues
1931 (mainly but not entirely relating to optional C11 features from
1932 Annexes F and G) and the optional Annexes K (Bounds-checking
1933 interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
1935 @item c17
1936 @itemx c18
1937 @itemx iso9899:2017
1938 @itemx iso9899:2018
1939 ISO C17, the 2017 revision of the ISO C standard
1940 (published in 2018).  This standard is
1941 same as C11 except for corrections of defects (all of which are also
1942 applied with @option{-std=c11}) and a new value of
1943 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1945 @item c2x
1946 The next version of the ISO C standard, still under development.  The
1947 support for this version is experimental and incomplete.
1949 @item gnu90
1950 @itemx gnu89
1951 GNU dialect of ISO C90 (including some C99 features).
1953 @item gnu99
1954 @itemx gnu9x
1955 GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
1957 @item gnu11
1958 @itemx gnu1x
1959 GNU dialect of ISO C11.
1960 The name @samp{gnu1x} is deprecated.
1962 @item gnu17
1963 @itemx gnu18
1964 GNU dialect of ISO C17.  This is the default for C code.
1966 @item gnu2x
1967 The next version of the ISO C standard, still under development, plus
1968 GNU extensions.  The support for this version is experimental and
1969 incomplete.
1971 @item c++98
1972 @itemx c++03
1973 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1974 additional defect reports. Same as @option{-ansi} for C++ code.
1976 @item gnu++98
1977 @itemx gnu++03
1978 GNU dialect of @option{-std=c++98}.
1980 @item c++11
1981 @itemx c++0x
1982 The 2011 ISO C++ standard plus amendments.
1983 The name @samp{c++0x} is deprecated.
1985 @item gnu++11
1986 @itemx gnu++0x
1987 GNU dialect of @option{-std=c++11}.
1988 The name @samp{gnu++0x} is deprecated.
1990 @item c++14
1991 @itemx c++1y
1992 The 2014 ISO C++ standard plus amendments.
1993 The name @samp{c++1y} is deprecated.
1995 @item gnu++14
1996 @itemx gnu++1y
1997 GNU dialect of @option{-std=c++14}.
1998 This is the default for C++ code.
1999 The name @samp{gnu++1y} is deprecated.
2001 @item c++17
2002 @itemx c++1z
2003 The 2017 ISO C++ standard plus amendments.
2004 The name @samp{c++1z} is deprecated.
2006 @item gnu++17
2007 @itemx gnu++1z
2008 GNU dialect of @option{-std=c++17}.
2009 The name @samp{gnu++1z} is deprecated.
2011 @item c++2a
2012 The next revision of the ISO C++ standard, tentatively planned for
2013 2020.  Support is highly experimental, and will almost certainly
2014 change in incompatible ways in future releases.
2016 @item gnu++2a
2017 GNU dialect of @option{-std=c++2a}.  Support is highly experimental,
2018 and will almost certainly change in incompatible ways in future
2019 releases.
2020 @end table
2022 @item -fgnu89-inline
2023 @opindex fgnu89-inline
2024 The option @option{-fgnu89-inline} tells GCC to use the traditional
2025 GNU semantics for @code{inline} functions when in C99 mode.
2026 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2027 Using this option is roughly equivalent to adding the
2028 @code{gnu_inline} function attribute to all inline functions
2029 (@pxref{Function Attributes}).
2031 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2032 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2033 specifies the default behavior).
2034 This option is not supported in @option{-std=c90} or
2035 @option{-std=gnu90} mode.
2037 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2038 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2039 in effect for @code{inline} functions.  @xref{Common Predefined
2040 Macros,,,cpp,The C Preprocessor}.
2042 @item -fpermitted-flt-eval-methods=@var{style}
2043 @opindex fpermitted-flt-eval-methods
2044 @opindex fpermitted-flt-eval-methods=c11
2045 @opindex fpermitted-flt-eval-methods=ts-18661-3
2046 ISO/IEC TS 18661-3 defines new permissible values for
2047 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2048 a semantic type that is an interchange or extended format should be
2049 evaluated to the precision and range of that type.  These new values are
2050 a superset of those permitted under C99/C11, which does not specify the
2051 meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2052 conforming to C11 may not have been written expecting the possibility of
2053 the new values.
2055 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2056 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2057 or the extended set of values specified in ISO/IEC TS 18661-3.
2059 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2061 The default when in a standards compliant mode (@option{-std=c11} or similar)
2062 is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2063 dialect (@option{-std=gnu11} or similar) is
2064 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2066 @item -aux-info @var{filename}
2067 @opindex aux-info
2068 Output to the given filename prototyped declarations for all functions
2069 declared and/or defined in a translation unit, including those in header
2070 files.  This option is silently ignored in any language other than C@.
2072 Besides declarations, the file indicates, in comments, the origin of
2073 each declaration (source file and line), whether the declaration was
2074 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2075 @samp{O} for old, respectively, in the first character after the line
2076 number and the colon), and whether it came from a declaration or a
2077 definition (@samp{C} or @samp{F}, respectively, in the following
2078 character).  In the case of function definitions, a K&R-style list of
2079 arguments followed by their declarations is also provided, inside
2080 comments, after the declaration.
2082 @item -fallow-parameterless-variadic-functions
2083 @opindex fallow-parameterless-variadic-functions
2084 Accept variadic functions without named parameters.
2086 Although it is possible to define such a function, this is not very
2087 useful as it is not possible to read the arguments.  This is only
2088 supported for C as this construct is allowed by C++.
2090 @item -fno-asm
2091 @opindex fno-asm
2092 @opindex fasm
2093 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2094 keyword, so that code can use these words as identifiers.  You can use
2095 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2096 instead.  @option{-ansi} implies @option{-fno-asm}.
2098 In C++, this switch only affects the @code{typeof} keyword, since
2099 @code{asm} and @code{inline} are standard keywords.  You may want to
2100 use the @option{-fno-gnu-keywords} flag instead, which has the same
2101 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2102 switch only affects the @code{asm} and @code{typeof} keywords, since
2103 @code{inline} is a standard keyword in ISO C99.
2105 @item -fno-builtin
2106 @itemx -fno-builtin-@var{function}
2107 @opindex fno-builtin
2108 @opindex fbuiltin
2109 @cindex built-in functions
2110 Don't recognize built-in functions that do not begin with
2111 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2112 functions provided by GCC}, for details of the functions affected,
2113 including those which are not built-in functions when @option{-ansi} or
2114 @option{-std} options for strict ISO C conformance are used because they
2115 do not have an ISO standard meaning.
2117 GCC normally generates special code to handle certain built-in functions
2118 more efficiently; for instance, calls to @code{alloca} may become single
2119 instructions which adjust the stack directly, and calls to @code{memcpy}
2120 may become inline copy loops.  The resulting code is often both smaller
2121 and faster, but since the function calls no longer appear as such, you
2122 cannot set a breakpoint on those calls, nor can you change the behavior
2123 of the functions by linking with a different library.  In addition,
2124 when a function is recognized as a built-in function, GCC may use
2125 information about that function to warn about problems with calls to
2126 that function, or to generate more efficient code, even if the
2127 resulting code still contains calls to that function.  For example,
2128 warnings are given with @option{-Wformat} for bad calls to
2129 @code{printf} when @code{printf} is built in and @code{strlen} is
2130 known not to modify global memory.
2132 With the @option{-fno-builtin-@var{function}} option
2133 only the built-in function @var{function} is
2134 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2135 function is named that is not built-in in this version of GCC, this
2136 option is ignored.  There is no corresponding
2137 @option{-fbuiltin-@var{function}} option; if you wish to enable
2138 built-in functions selectively when using @option{-fno-builtin} or
2139 @option{-ffreestanding}, you may define macros such as:
2141 @smallexample
2142 #define abs(n)          __builtin_abs ((n))
2143 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
2144 @end smallexample
2146 @item -fgimple
2147 @opindex fgimple
2149 Enable parsing of function definitions marked with @code{__GIMPLE}.
2150 This is an experimental feature that allows unit testing of GIMPLE
2151 passes.
2153 @item -fhosted
2154 @opindex fhosted
2155 @cindex hosted environment
2157 Assert that compilation targets a hosted environment.  This implies
2158 @option{-fbuiltin}.  A hosted environment is one in which the
2159 entire standard library is available, and in which @code{main} has a return
2160 type of @code{int}.  Examples are nearly everything except a kernel.
2161 This is equivalent to @option{-fno-freestanding}.
2163 @item -ffreestanding
2164 @opindex ffreestanding
2165 @cindex hosted environment
2167 Assert that compilation targets a freestanding environment.  This
2168 implies @option{-fno-builtin}.  A freestanding environment
2169 is one in which the standard library may not exist, and program startup may
2170 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2171 This is equivalent to @option{-fno-hosted}.
2173 @xref{Standards,,Language Standards Supported by GCC}, for details of
2174 freestanding and hosted environments.
2176 @item -fopenacc
2177 @opindex fopenacc
2178 @cindex OpenACC accelerator programming
2179 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2180 @code{!$acc} in Fortran.  When @option{-fopenacc} is specified, the
2181 compiler generates accelerated code according to the OpenACC Application
2182 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}.  This option
2183 implies @option{-pthread}, and thus is only supported on targets that
2184 have support for @option{-pthread}.
2186 @item -fopenacc-dim=@var{geom}
2187 @opindex fopenacc-dim
2188 @cindex OpenACC accelerator programming
2189 Specify default compute dimensions for parallel offload regions that do
2190 not explicitly specify.  The @var{geom} value is a triple of
2191 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2192 can be omitted, to use a target-specific default value.
2194 @item -fopenmp
2195 @opindex fopenmp
2196 @cindex OpenMP parallel
2197 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2198 @code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
2199 compiler generates parallel code according to the OpenMP Application
2200 Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2201 implies @option{-pthread}, and thus is only supported on targets that
2202 have support for @option{-pthread}. @option{-fopenmp} implies
2203 @option{-fopenmp-simd}.
2205 @item -fopenmp-simd
2206 @opindex fopenmp-simd
2207 @cindex OpenMP SIMD
2208 @cindex SIMD
2209 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2210 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2211 are ignored.
2213 @item -fgnu-tm
2214 @opindex fgnu-tm
2215 When the option @option{-fgnu-tm} is specified, the compiler
2216 generates code for the Linux variant of Intel's current Transactional
2217 Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2218 an experimental feature whose interface may change in future versions
2219 of GCC, as the official specification changes.  Please note that not
2220 all architectures are supported for this feature.
2222 For more information on GCC's support for transactional memory,
2223 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2224 Transactional Memory Library}.
2226 Note that the transactional memory feature is not supported with
2227 non-call exceptions (@option{-fnon-call-exceptions}).
2229 @item -fms-extensions
2230 @opindex fms-extensions
2231 Accept some non-standard constructs used in Microsoft header files.
2233 In C++ code, this allows member names in structures to be similar
2234 to previous types declarations.
2236 @smallexample
2237 typedef int UOW;
2238 struct ABC @{
2239   UOW UOW;
2241 @end smallexample
2243 Some cases of unnamed fields in structures and unions are only
2244 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2245 fields within structs/unions}, for details.
2247 Note that this option is off for all targets except for x86
2248 targets using ms-abi.
2250 @item -fplan9-extensions
2251 @opindex fplan9-extensions
2252 Accept some non-standard constructs used in Plan 9 code.
2254 This enables @option{-fms-extensions}, permits passing pointers to
2255 structures with anonymous fields to functions that expect pointers to
2256 elements of the type of the field, and permits referring to anonymous
2257 fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2258 struct/union fields within structs/unions}, for details.  This is only
2259 supported for C, not C++.
2261 @item -fcond-mismatch
2262 @opindex fcond-mismatch
2263 Allow conditional expressions with mismatched types in the second and
2264 third arguments.  The value of such an expression is void.  This option
2265 is not supported for C++.
2267 @item -flax-vector-conversions
2268 @opindex flax-vector-conversions
2269 Allow implicit conversions between vectors with differing numbers of
2270 elements and/or incompatible element types.  This option should not be
2271 used for new code.
2273 @item -funsigned-char
2274 @opindex funsigned-char
2275 Let the type @code{char} be unsigned, like @code{unsigned char}.
2277 Each kind of machine has a default for what @code{char} should
2278 be.  It is either like @code{unsigned char} by default or like
2279 @code{signed char} by default.
2281 Ideally, a portable program should always use @code{signed char} or
2282 @code{unsigned char} when it depends on the signedness of an object.
2283 But many programs have been written to use plain @code{char} and
2284 expect it to be signed, or expect it to be unsigned, depending on the
2285 machines they were written for.  This option, and its inverse, let you
2286 make such a program work with the opposite default.
2288 The type @code{char} is always a distinct type from each of
2289 @code{signed char} or @code{unsigned char}, even though its behavior
2290 is always just like one of those two.
2292 @item -fsigned-char
2293 @opindex fsigned-char
2294 Let the type @code{char} be signed, like @code{signed char}.
2296 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2297 the negative form of @option{-funsigned-char}.  Likewise, the option
2298 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2300 @item -fsigned-bitfields
2301 @itemx -funsigned-bitfields
2302 @itemx -fno-signed-bitfields
2303 @itemx -fno-unsigned-bitfields
2304 @opindex fsigned-bitfields
2305 @opindex funsigned-bitfields
2306 @opindex fno-signed-bitfields
2307 @opindex fno-unsigned-bitfields
2308 These options control whether a bit-field is signed or unsigned, when the
2309 declaration does not use either @code{signed} or @code{unsigned}.  By
2310 default, such a bit-field is signed, because this is consistent: the
2311 basic integer types such as @code{int} are signed types.
2313 @item -fsso-struct=@var{endianness}
2314 @opindex fsso-struct
2315 Set the default scalar storage order of structures and unions to the
2316 specified endianness.  The accepted values are @samp{big-endian},
2317 @samp{little-endian} and @samp{native} for the native endianness of
2318 the target (the default).  This option is not supported for C++.
2320 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2321 code that is not binary compatible with code generated without it if the
2322 specified endianness is not the native endianness of the target.
2323 @end table
2325 @node C++ Dialect Options
2326 @section Options Controlling C++ Dialect
2328 @cindex compiler options, C++
2329 @cindex C++ options, command-line
2330 @cindex options, C++
2331 This section describes the command-line options that are only meaningful
2332 for C++ programs.  You can also use most of the GNU compiler options
2333 regardless of what language your program is in.  For example, you
2334 might compile a file @file{firstClass.C} like this:
2336 @smallexample
2337 g++ -g -fstrict-enums -O -c firstClass.C
2338 @end smallexample
2340 @noindent
2341 In this example, only @option{-fstrict-enums} is an option meant
2342 only for C++ programs; you can use the other options with any
2343 language supported by GCC@.
2345 Some options for compiling C programs, such as @option{-std}, are also
2346 relevant for C++ programs.
2347 @xref{C Dialect Options,,Options Controlling C Dialect}.
2349 Here is a list of options that are @emph{only} for compiling C++ programs:
2351 @table @gcctabopt
2353 @item -fabi-version=@var{n}
2354 @opindex fabi-version
2355 Use version @var{n} of the C++ ABI@.  The default is version 0.
2357 Version 0 refers to the version conforming most closely to
2358 the C++ ABI specification.  Therefore, the ABI obtained using version 0
2359 will change in different versions of G++ as ABI bugs are fixed.
2361 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2363 Version 2 is the version of the C++ ABI that first appeared in G++
2364 3.4, and was the default through G++ 4.9.
2366 Version 3 corrects an error in mangling a constant address as a
2367 template argument.
2369 Version 4, which first appeared in G++ 4.5, implements a standard
2370 mangling for vector types.
2372 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2373 attribute const/volatile on function pointer types, decltype of a
2374 plain decl, and use of a function parameter in the declaration of
2375 another parameter.
2377 Version 6, which first appeared in G++ 4.7, corrects the promotion
2378 behavior of C++11 scoped enums and the mangling of template argument
2379 packs, const/static_cast, prefix ++ and --, and a class scope function
2380 used as a template argument.
2382 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2383 builtin type and corrects the mangling of lambdas in default argument
2384 scope.
2386 Version 8, which first appeared in G++ 4.9, corrects the substitution
2387 behavior of function types with function-cv-qualifiers.
2389 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2390 @code{nullptr_t}.
2392 Version 10, which first appeared in G++ 6.1, adds mangling of
2393 attributes that affect type identity, such as ia32 calling convention
2394 attributes (e.g.@: @samp{stdcall}).
2396 Version 11, which first appeared in G++ 7, corrects the mangling of
2397 sizeof... expressions and operator names.  For multiple entities with
2398 the same name within a function, that are declared in different scopes,
2399 the mangling now changes starting with the twelfth occurrence.  It also
2400 implies @option{-fnew-inheriting-ctors}.
2402 Version 12, which first appeared in G++ 8, corrects the calling
2403 conventions for empty classes on the x86_64 target and for classes
2404 with only deleted copy/move constructors.  It accidentally changes the
2405 calling convention for classes with a deleted copy constructor and a
2406 trivial move constructor.
2408 Version 13, which first appeared in G++ 8.2, fixes the accidental
2409 change in version 12.
2411 See also @option{-Wabi}.
2413 @item -fabi-compat-version=@var{n}
2414 @opindex fabi-compat-version
2415 On targets that support strong aliases, G++
2416 works around mangling changes by creating an alias with the correct
2417 mangled name when defining a symbol with an incorrect mangled name.
2418 This switch specifies which ABI version to use for the alias.
2420 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2421 compatibility).  If another ABI version is explicitly selected, this
2422 defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
2423 use @option{-fabi-compat-version=2}.
2425 If this option is not provided but @option{-Wabi=@var{n}} is, that
2426 version is used for compatibility aliases.  If this option is provided
2427 along with @option{-Wabi} (without the version), the version from this
2428 option is used for the warning.
2430 @item -fno-access-control
2431 @opindex fno-access-control
2432 @opindex faccess-control
2433 Turn off all access checking.  This switch is mainly useful for working
2434 around bugs in the access control code.
2436 @item -faligned-new
2437 @opindex faligned-new
2438 Enable support for C++17 @code{new} of types that require more
2439 alignment than @code{void* ::operator new(std::size_t)} provides.  A
2440 numeric argument such as @code{-faligned-new=32} can be used to
2441 specify how much alignment (in bytes) is provided by that function,
2442 but few users will need to override the default of
2443 @code{alignof(std::max_align_t)}.
2445 This flag is enabled by default for @option{-std=c++17}.
2447 @item -fchar8_t
2448 @itemx -fno-char8_t
2449 @opindex fchar8_t
2450 @opindex fno-char8_t
2451 Enable support for @code{char8_t} as adopted for C++2a.  This includes
2452 the addition of a new @code{char8_t} fundamental type, changes to the
2453 types of UTF-8 string and character literals, new signatures for
2454 user-defined literals, associated standard library updates, and new
2455 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2457 This option enables functions to be overloaded for ordinary and UTF-8
2458 strings:
2460 @smallexample
2461 int f(const char *);    // #1
2462 int f(const char8_t *); // #2
2463 int v1 = f("text");     // Calls #1
2464 int v2 = f(u8"text");   // Calls #2
2465 @end smallexample
2467 @noindent
2468 and introduces new signatures for user-defined literals:
2470 @smallexample
2471 int operator""_udl1(char8_t);
2472 int v3 = u8'x'_udl1;
2473 int operator""_udl2(const char8_t*, std::size_t);
2474 int v4 = u8"text"_udl2;
2475 template<typename T, T...> int operator""_udl3();
2476 int v5 = u8"text"_udl3;
2477 @end smallexample
2479 @noindent
2480 The change to the types of UTF-8 string and character literals introduces
2481 incompatibilities with ISO C++11 and later standards.  For example, the
2482 following code is well-formed under ISO C++11, but is ill-formed when
2483 @option{-fchar8_t} is specified.
2485 @smallexample
2486 char ca[] = u8"xx";     // error: char-array initialized from wide
2487                         //        string
2488 const char *cp = u8"xx";// error: invalid conversion from
2489                         //        `const char8_t*' to `const char*'
2490 int f(const char*);
2491 auto v = f(u8"xx");     // error: invalid conversion from
2492                         //        `const char8_t*' to `const char*'
2493 std::string s@{u8"xx"@};  // error: no matching function for call to
2494                         //        `std::basic_string<char>::basic_string()'
2495 using namespace std::literals;
2496 s = u8"xx"s;            // error: conversion from
2497                         //        `basic_string<char8_t>' to non-scalar
2498                         //        type `basic_string<char>' requested
2499 @end smallexample
2501 @item -fcheck-new
2502 @opindex fcheck-new
2503 Check that the pointer returned by @code{operator new} is non-null
2504 before attempting to modify the storage allocated.  This check is
2505 normally unnecessary because the C++ standard specifies that
2506 @code{operator new} only returns @code{0} if it is declared
2507 @code{throw()}, in which case the compiler always checks the
2508 return value even without this option.  In all other cases, when
2509 @code{operator new} has a non-empty exception specification, memory
2510 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
2511 @samp{new (nothrow)}.
2513 @item -fconcepts
2514 @opindex fconcepts
2515 Enable support for the C++ Extensions for Concepts Technical
2516 Specification, ISO 19217 (2015), which allows code like
2518 @smallexample
2519 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2520 template <Addable T> T add (T a, T b) @{ return a + b; @}
2521 @end smallexample
2523 @item -fconstexpr-depth=@var{n}
2524 @opindex fconstexpr-depth
2525 Set the maximum nested evaluation depth for C++11 constexpr functions
2526 to @var{n}.  A limit is needed to detect endless recursion during
2527 constant expression evaluation.  The minimum specified by the standard
2528 is 512.
2530 @item -fconstexpr-cache-depth=@var{n}
2531 @opindex fconstexpr-cache-depth
2532 Set the maximum level of nested evaluation depth for C++11 constexpr
2533 functions that will be cached to @var{n}.  This is a heuristic that
2534 trades off compilation speed (when the cache avoids repeated
2535 calculations) against memory consumption (when the cache grows very
2536 large from highly recursive evaluations).  The default is 8.  Very few
2537 users are likely to want to adjust it, but if your code does heavy
2538 constexpr calculations you might want to experiment to find which
2539 value works best for you.
2541 @item -fconstexpr-loop-limit=@var{n}
2542 @opindex fconstexpr-loop-limit
2543 Set the maximum number of iterations for a loop in C++14 constexpr functions
2544 to @var{n}.  A limit is needed to detect infinite loops during
2545 constant expression evaluation.  The default is 262144 (1<<18).
2547 @item -fconstexpr-ops-limit=@var{n}
2548 @opindex fconstexpr-ops-limit
2549 Set the maximum number of operations during a single constexpr evaluation.
2550 Even when number of iterations of a single loop is limited with the above limit,
2551 if there are several nested loops and each of them has many iterations but still
2552 smaller than the above limit, or if in a body of some loop or even outside
2553 of a loop too many expressions need to be evaluated, the resulting constexpr
2554 evaluation might take too long.
2555 The default is 33554432 (1<<25).
2557 @item -fno-elide-constructors
2558 @opindex fno-elide-constructors
2559 @opindex felide-constructors
2560 The C++ standard allows an implementation to omit creating a temporary
2561 that is only used to initialize another object of the same type.
2562 Specifying this option disables that optimization, and forces G++ to
2563 call the copy constructor in all cases.  This option also causes G++
2564 to call trivial member functions which otherwise would be expanded inline.
2566 In C++17, the compiler is required to omit these temporaries, but this
2567 option still affects trivial member functions.
2569 @item -fno-enforce-eh-specs
2570 @opindex fno-enforce-eh-specs
2571 @opindex fenforce-eh-specs
2572 Don't generate code to check for violation of exception specifications
2573 at run time.  This option violates the C++ standard, but may be useful
2574 for reducing code size in production builds, much like defining
2575 @code{NDEBUG}.  This does not give user code permission to throw
2576 exceptions in violation of the exception specifications; the compiler
2577 still optimizes based on the specifications, so throwing an
2578 unexpected exception results in undefined behavior at run time.
2580 @item -fextern-tls-init
2581 @itemx -fno-extern-tls-init
2582 @opindex fextern-tls-init
2583 @opindex fno-extern-tls-init
2584 The C++11 and OpenMP standards allow @code{thread_local} and
2585 @code{threadprivate} variables to have dynamic (runtime)
2586 initialization.  To support this, any use of such a variable goes
2587 through a wrapper function that performs any necessary initialization.
2588 When the use and definition of the variable are in the same
2589 translation unit, this overhead can be optimized away, but when the
2590 use is in a different translation unit there is significant overhead
2591 even if the variable doesn't actually need dynamic initialization.  If
2592 the programmer can be sure that no use of the variable in a
2593 non-defining TU needs to trigger dynamic initialization (either
2594 because the variable is statically initialized, or a use of the
2595 variable in the defining TU will be executed before any uses in
2596 another TU), they can avoid this overhead with the
2597 @option{-fno-extern-tls-init} option.
2599 On targets that support symbol aliases, the default is
2600 @option{-fextern-tls-init}.  On targets that do not support symbol
2601 aliases, the default is @option{-fno-extern-tls-init}.
2603 @item -fno-gnu-keywords
2604 @opindex fno-gnu-keywords
2605 @opindex fgnu-keywords
2606 Do not recognize @code{typeof} as a keyword, so that code can use this
2607 word as an identifier.  You can use the keyword @code{__typeof__} instead.
2608 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2609 @option{-std=c++98}, @option{-std=c++11}, etc.
2611 @item -fno-implicit-templates
2612 @opindex fno-implicit-templates
2613 @opindex fimplicit-templates
2614 Never emit code for non-inline templates that are instantiated
2615 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2616 If you use this option, you must take care to structure your code to
2617 include all the necessary explicit instantiations to avoid getting
2618 undefined symbols at link time.
2619 @xref{Template Instantiation}, for more information.
2621 @item -fno-implicit-inline-templates
2622 @opindex fno-implicit-inline-templates
2623 @opindex fimplicit-inline-templates
2624 Don't emit code for implicit instantiations of inline templates, either.
2625 The default is to handle inlines differently so that compiles with and
2626 without optimization need the same set of explicit instantiations.
2628 @item -fno-implement-inlines
2629 @opindex fno-implement-inlines
2630 @opindex fimplement-inlines
2631 To save space, do not emit out-of-line copies of inline functions
2632 controlled by @code{#pragma implementation}.  This causes linker
2633 errors if these functions are not inlined everywhere they are called.
2635 @item -fms-extensions
2636 @opindex fms-extensions
2637 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2638 int and getting a pointer to member function via non-standard syntax.
2640 @item -fnew-inheriting-ctors
2641 @opindex fnew-inheriting-ctors
2642 Enable the P0136 adjustment to the semantics of C++11 constructor
2643 inheritance.  This is part of C++17 but also considered to be a Defect
2644 Report against C++11 and C++14.  This flag is enabled by default
2645 unless @option{-fabi-version=10} or lower is specified.
2647 @item -fnew-ttp-matching
2648 @opindex fnew-ttp-matching
2649 Enable the P0522 resolution to Core issue 150, template template
2650 parameters and default arguments: this allows a template with default
2651 template arguments as an argument for a template template parameter
2652 with fewer template parameters.  This flag is enabled by default for
2653 @option{-std=c++17}.
2655 @item -fno-nonansi-builtins
2656 @opindex fno-nonansi-builtins
2657 @opindex fnonansi-builtins
2658 Disable built-in declarations of functions that are not mandated by
2659 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
2660 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2662 @item -fnothrow-opt
2663 @opindex fnothrow-opt
2664 Treat a @code{throw()} exception specification as if it were a
2665 @code{noexcept} specification to reduce or eliminate the text size
2666 overhead relative to a function with no exception specification.  If
2667 the function has local variables of types with non-trivial
2668 destructors, the exception specification actually makes the
2669 function smaller because the EH cleanups for those variables can be
2670 optimized away.  The semantic effect is that an exception thrown out of
2671 a function with such an exception specification results in a call
2672 to @code{terminate} rather than @code{unexpected}.
2674 @item -fno-operator-names
2675 @opindex fno-operator-names
2676 @opindex foperator-names
2677 Do not treat the operator name keywords @code{and}, @code{bitand},
2678 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2679 synonyms as keywords.
2681 @item -fno-optional-diags
2682 @opindex fno-optional-diags
2683 @opindex foptional-diags
2684 Disable diagnostics that the standard says a compiler does not need to
2685 issue.  Currently, the only such diagnostic issued by G++ is the one for
2686 a name having multiple meanings within a class.
2688 @item -fpermissive
2689 @opindex fpermissive
2690 Downgrade some diagnostics about nonconformant code from errors to
2691 warnings.  Thus, using @option{-fpermissive} allows some
2692 nonconforming code to compile.
2694 @item -fno-pretty-templates
2695 @opindex fno-pretty-templates
2696 @opindex fpretty-templates
2697 When an error message refers to a specialization of a function
2698 template, the compiler normally prints the signature of the
2699 template followed by the template arguments and any typedefs or
2700 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2701 rather than @code{void f(int)}) so that it's clear which template is
2702 involved.  When an error message refers to a specialization of a class
2703 template, the compiler omits any template arguments that match
2704 the default template arguments for that template.  If either of these
2705 behaviors make it harder to understand the error message rather than
2706 easier, you can use @option{-fno-pretty-templates} to disable them.
2708 @item -fno-rtti
2709 @opindex fno-rtti
2710 @opindex frtti
2711 Disable generation of information about every class with virtual
2712 functions for use by the C++ run-time type identification features
2713 (@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
2714 of the language, you can save some space by using this flag.  Note that
2715 exception handling uses the same information, but G++ generates it as
2716 needed. The @code{dynamic_cast} operator can still be used for casts that
2717 do not require run-time type information, i.e.@: casts to @code{void *} or to
2718 unambiguous base classes.
2720 Mixing code compiled with @option{-frtti} with that compiled with
2721 @option{-fno-rtti} may not work.  For example, programs may
2722 fail to link if a class compiled with @option{-fno-rtti} is used as a base 
2723 for a class compiled with @option{-frtti}.  
2725 @item -fsized-deallocation
2726 @opindex fsized-deallocation
2727 Enable the built-in global declarations
2728 @smallexample
2729 void operator delete (void *, std::size_t) noexcept;
2730 void operator delete[] (void *, std::size_t) noexcept;
2731 @end smallexample
2732 as introduced in C++14.  This is useful for user-defined replacement
2733 deallocation functions that, for example, use the size of the object
2734 to make deallocation faster.  Enabled by default under
2735 @option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
2736 warns about places that might want to add a definition.
2738 @item -fstrict-enums
2739 @opindex fstrict-enums
2740 Allow the compiler to optimize using the assumption that a value of
2741 enumerated type can only be one of the values of the enumeration (as
2742 defined in the C++ standard; basically, a value that can be
2743 represented in the minimum number of bits needed to represent all the
2744 enumerators).  This assumption may not be valid if the program uses a
2745 cast to convert an arbitrary integer value to the enumerated type.
2747 @item -fstrong-eval-order
2748 @opindex fstrong-eval-order
2749 Evaluate member access, array subscripting, and shift expressions in
2750 left-to-right order, and evaluate assignment in right-to-left order,
2751 as adopted for C++17.  Enabled by default with @option{-std=c++17}.
2752 @option{-fstrong-eval-order=some} enables just the ordering of member
2753 access and shift expressions, and is the default without
2754 @option{-std=c++17}.
2756 @item -ftemplate-backtrace-limit=@var{n}
2757 @opindex ftemplate-backtrace-limit
2758 Set the maximum number of template instantiation notes for a single
2759 warning or error to @var{n}.  The default value is 10.
2761 @item -ftemplate-depth=@var{n}
2762 @opindex ftemplate-depth
2763 Set the maximum instantiation depth for template classes to @var{n}.
2764 A limit on the template instantiation depth is needed to detect
2765 endless recursions during template class instantiation.  ANSI/ISO C++
2766 conforming programs must not rely on a maximum depth greater than 17
2767 (changed to 1024 in C++11).  The default value is 900, as the compiler
2768 can run out of stack space before hitting 1024 in some situations.
2770 @item -fno-threadsafe-statics
2771 @opindex fno-threadsafe-statics
2772 @opindex fthreadsafe-statics
2773 Do not emit the extra code to use the routines specified in the C++
2774 ABI for thread-safe initialization of local statics.  You can use this
2775 option to reduce code size slightly in code that doesn't need to be
2776 thread-safe.
2778 @item -fuse-cxa-atexit
2779 @opindex fuse-cxa-atexit
2780 Register destructors for objects with static storage duration with the
2781 @code{__cxa_atexit} function rather than the @code{atexit} function.
2782 This option is required for fully standards-compliant handling of static
2783 destructors, but only works if your C library supports
2784 @code{__cxa_atexit}.
2786 @item -fno-use-cxa-get-exception-ptr
2787 @opindex fno-use-cxa-get-exception-ptr
2788 @opindex fuse-cxa-get-exception-ptr
2789 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
2790 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2791 if the runtime routine is not available.
2793 @item -fvisibility-inlines-hidden
2794 @opindex fvisibility-inlines-hidden
2795 This switch declares that the user does not attempt to compare
2796 pointers to inline functions or methods where the addresses of the two functions
2797 are taken in different shared objects.
2799 The effect of this is that GCC may, effectively, mark inline methods with
2800 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2801 appear in the export table of a DSO and do not require a PLT indirection
2802 when used within the DSO@.  Enabling this option can have a dramatic effect
2803 on load and link times of a DSO as it massively reduces the size of the
2804 dynamic export table when the library makes heavy use of templates.
2806 The behavior of this switch is not quite the same as marking the
2807 methods as hidden directly, because it does not affect static variables
2808 local to the function or cause the compiler to deduce that
2809 the function is defined in only one shared object.
2811 You may mark a method as having a visibility explicitly to negate the
2812 effect of the switch for that method.  For example, if you do want to
2813 compare pointers to a particular inline method, you might mark it as
2814 having default visibility.  Marking the enclosing class with explicit
2815 visibility has no effect.
2817 Explicitly instantiated inline methods are unaffected by this option
2818 as their linkage might otherwise cross a shared library boundary.
2819 @xref{Template Instantiation}.
2821 @item -fvisibility-ms-compat
2822 @opindex fvisibility-ms-compat
2823 This flag attempts to use visibility settings to make GCC's C++
2824 linkage model compatible with that of Microsoft Visual Studio.
2826 The flag makes these changes to GCC's linkage model:
2828 @enumerate
2829 @item
2830 It sets the default visibility to @code{hidden}, like
2831 @option{-fvisibility=hidden}.
2833 @item
2834 Types, but not their members, are not hidden by default.
2836 @item
2837 The One Definition Rule is relaxed for types without explicit
2838 visibility specifications that are defined in more than one
2839 shared object: those declarations are permitted if they are
2840 permitted when this option is not used.
2841 @end enumerate
2843 In new code it is better to use @option{-fvisibility=hidden} and
2844 export those classes that are intended to be externally visible.
2845 Unfortunately it is possible for code to rely, perhaps accidentally,
2846 on the Visual Studio behavior.
2848 Among the consequences of these changes are that static data members
2849 of the same type with the same name but defined in different shared
2850 objects are different, so changing one does not change the other;
2851 and that pointers to function members defined in different shared
2852 objects may not compare equal.  When this flag is given, it is a
2853 violation of the ODR to define types with the same name differently.
2855 @item -fno-weak
2856 @opindex fno-weak
2857 @opindex fweak
2858 Do not use weak symbol support, even if it is provided by the linker.
2859 By default, G++ uses weak symbols if they are available.  This
2860 option exists only for testing, and should not be used by end-users;
2861 it results in inferior code and has no benefits.  This option may
2862 be removed in a future release of G++.
2864 @item -nostdinc++
2865 @opindex nostdinc++
2866 Do not search for header files in the standard directories specific to
2867 C++, but do still search the other standard directories.  (This option
2868 is used when building the C++ library.)
2869 @end table
2871 In addition, these optimization, warning, and code generation options
2872 have meanings only for C++ programs:
2874 @table @gcctabopt
2875 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2876 @opindex Wabi
2877 @opindex Wno-abi
2878 Warn when G++ it generates code that is probably not compatible with
2879 the vendor-neutral C++ ABI@.  Since G++ now defaults to updating the
2880 ABI with each major release, normally @option{-Wabi} will warn only if
2881 there is a check added later in a release series for an ABI issue
2882 discovered since the initial release.  @option{-Wabi} will warn about
2883 more things if an older ABI version is selected (with
2884 @option{-fabi-version=@var{n}}).
2886 @option{-Wabi} can also be used with an explicit version number to
2887 warn about compatibility with a particular @option{-fabi-version}
2888 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2889 @option{-fabi-version=2}.
2891 If an explicit version number is provided and
2892 @option{-fabi-compat-version} is not specified, the version number
2893 from this option is used for compatibility aliases.  If no explicit
2894 version number is provided with this option, but
2895 @option{-fabi-compat-version} is specified, that version number is
2896 used for ABI warnings.
2898 Although an effort has been made to warn about
2899 all such cases, there are probably some cases that are not warned about,
2900 even though G++ is generating incompatible code.  There may also be
2901 cases where warnings are emitted even though the code that is generated
2902 is compatible.
2904 You should rewrite your code to avoid these warnings if you are
2905 concerned about the fact that code generated by G++ may not be binary
2906 compatible with code generated by other compilers.
2908 Known incompatibilities in @option{-fabi-version=2} (which was the
2909 default from GCC 3.4 to 4.9) include:
2911 @itemize @bullet
2913 @item
2914 A template with a non-type template parameter of reference type was
2915 mangled incorrectly:
2916 @smallexample
2917 extern int N;
2918 template <int &> struct S @{@};
2919 void n (S<N>) @{2@}
2920 @end smallexample
2922 This was fixed in @option{-fabi-version=3}.
2924 @item
2925 SIMD vector types declared using @code{__attribute ((vector_size))} were
2926 mangled in a non-standard way that does not allow for overloading of
2927 functions taking vectors of different sizes.
2929 The mangling was changed in @option{-fabi-version=4}.
2931 @item
2932 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2933 qualifiers, and @code{decltype} of a plain declaration was folded away.
2935 These mangling issues were fixed in @option{-fabi-version=5}.
2937 @item
2938 Scoped enumerators passed as arguments to a variadic function are
2939 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2940 On most targets this does not actually affect the parameter passing
2941 ABI, as there is no way to pass an argument smaller than @code{int}.
2943 Also, the ABI changed the mangling of template argument packs,
2944 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2945 a class scope function used as a template argument.
2947 These issues were corrected in @option{-fabi-version=6}.
2949 @item
2950 Lambdas in default argument scope were mangled incorrectly, and the
2951 ABI changed the mangling of @code{nullptr_t}.
2953 These issues were corrected in @option{-fabi-version=7}.
2955 @item
2956 When mangling a function type with function-cv-qualifiers, the
2957 un-qualified function type was incorrectly treated as a substitution
2958 candidate.
2960 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2962 @item
2963 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2964 unaligned accesses.  Note that this did not affect the ABI of a
2965 function with a @code{nullptr_t} parameter, as parameters have a
2966 minimum alignment.
2968 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2970 @item
2971 Target-specific attributes that affect the identity of a type, such as
2972 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2973 did not affect the mangled name, leading to name collisions when
2974 function pointers were used as template arguments.
2976 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2978 @end itemize
2980 It also warns about psABI-related changes.  The known psABI changes at this
2981 point include:
2983 @itemize @bullet
2985 @item
2986 For SysV/x86-64, unions with @code{long double} members are 
2987 passed in memory as specified in psABI.  For example:
2989 @smallexample
2990 union U @{
2991   long double ld;
2992   int i;
2994 @end smallexample
2996 @noindent
2997 @code{union U} is always passed in memory.
2999 @end itemize
3001 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3002 @opindex Wabi-tag
3003 @opindex Wabi-tag
3004 Warn when a type with an ABI tag is used in a context that does not
3005 have that ABI tag.  See @ref{C++ Attributes} for more information
3006 about ABI tags.
3008 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3009 @opindex Wcomma-subscript
3010 @opindex Wno-comma-subscript
3011 Warn about uses of a comma expression within a subscripting expression.
3012 This usage was deprecated in C++2a.  However, a comma expression wrapped
3013 in @code{( )} is not deprecated.  Example:
3015 @smallexample
3016 @group
3017 void f(int *a, int b, int c) @{
3018     a[b,c];     // deprecated
3019     a[(b,c)];   // OK
3021 @end group
3022 @end smallexample
3024 Enabled by default with @option{-std=c++2a}.
3026 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3027 @opindex Wctor-dtor-privacy
3028 @opindex Wno-ctor-dtor-privacy
3029 Warn when a class seems unusable because all the constructors or
3030 destructors in that class are private, and it has neither friends nor
3031 public static member functions.  Also warn if there are no non-private
3032 methods, and there's at least one private member function that isn't
3033 a constructor or destructor.
3035 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3036 @opindex Wdelete-non-virtual-dtor
3037 @opindex Wno-delete-non-virtual-dtor
3038 Warn when @code{delete} is used to destroy an instance of a class that
3039 has virtual functions and non-virtual destructor. It is unsafe to delete
3040 an instance of a derived class through a pointer to a base class if the
3041 base class does not have a virtual destructor.  This warning is enabled
3042 by @option{-Wall}.
3044 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3045 @opindex Wdeprecated-copy
3046 @opindex Wno-deprecated-copy
3047 Warn that the implicit declaration of a copy constructor or copy
3048 assignment operator is deprecated if the class has a user-provided
3049 copy constructor or copy assignment operator, in C++11 and up.  This
3050 warning is enabled by @option{-Wextra}.  With
3051 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3052 user-provided destructor.
3054 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3055 @opindex Winit-list-lifetime
3056 @opindex Wno-init-list-lifetime
3057 Do not warn about uses of @code{std::initializer_list} that are likely
3058 to result in dangling pointers.  Since the underlying array for an
3059 @code{initializer_list} is handled like a normal C++ temporary object,
3060 it is easy to inadvertently keep a pointer to the array past the end
3061 of the array's lifetime.  For example:
3063 @itemize @bullet
3064 @item
3065 If a function returns a temporary @code{initializer_list}, or a local
3066 @code{initializer_list} variable, the array's lifetime ends at the end
3067 of the return statement, so the value returned has a dangling pointer.
3069 @item
3070 If a new-expression creates an @code{initializer_list}, the array only
3071 lives until the end of the enclosing full-expression, so the
3072 @code{initializer_list} in the heap has a dangling pointer.
3074 @item
3075 When an @code{initializer_list} variable is assigned from a
3076 brace-enclosed initializer list, the temporary array created for the
3077 right side of the assignment only lives until the end of the
3078 full-expression, so at the next statement the @code{initializer_list}
3079 variable has a dangling pointer.
3081 @smallexample
3082 // li's initial underlying array lives as long as li
3083 std::initializer_list<int> li = @{ 1,2,3 @};
3084 // assignment changes li to point to a temporary array
3085 li = @{ 4, 5 @};
3086 // now the temporary is gone and li has a dangling pointer
3087 int i = li.begin()[0] // undefined behavior
3088 @end smallexample
3090 @item
3091 When a list constructor stores the @code{begin} pointer from the
3092 @code{initializer_list} argument, this doesn't extend the lifetime of
3093 the array, so if a class variable is constructed from a temporary
3094 @code{initializer_list}, the pointer is left dangling by the end of
3095 the variable declaration statement.
3097 @end itemize
3099 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3100 @opindex Wliteral-suffix
3101 @opindex Wno-literal-suffix
3102 Warn when a string or character literal is followed by a ud-suffix which does
3103 not begin with an underscore.  As a conforming extension, GCC treats such
3104 suffixes as separate preprocessing tokens in order to maintain backwards
3105 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3106 For example:
3108 @smallexample
3109 #define __STDC_FORMAT_MACROS
3110 #include <inttypes.h>
3111 #include <stdio.h>
3113 int main() @{
3114   int64_t i64 = 123;
3115   printf("My int64: %" PRId64"\n", i64);
3117 @end smallexample
3119 In this case, @code{PRId64} is treated as a separate preprocessing token.
3121 Additionally, warn when a user-defined literal operator is declared with
3122 a literal suffix identifier that doesn't begin with an underscore. Literal
3123 suffix identifiers that don't begin with an underscore are reserved for
3124 future standardization.
3126 This warning is enabled by default.
3128 @item -Wlto-type-mismatch
3129 @opindex Wlto-type-mismatch
3130 @opindex Wno-lto-type-mismatch
3132 During the link-time optimization warn about type mismatches in
3133 global declarations from different compilation units.
3134 Requires @option{-flto} to be enabled.  Enabled by default.
3136 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3137 @opindex Wnarrowing
3138 @opindex Wno-narrowing
3139 For C++11 and later standards, narrowing conversions are diagnosed by default,
3140 as required by the standard.  A narrowing conversion from a constant produces
3141 an error, and a narrowing conversion from a non-constant produces a warning,
3142 but @option{-Wno-narrowing} suppresses the diagnostic.
3143 Note that this does not affect the meaning of well-formed code;
3144 narrowing conversions are still considered ill-formed in SFINAE contexts.
3146 With @option{-Wnarrowing} in C++98, warn when a narrowing
3147 conversion prohibited by C++11 occurs within
3148 @samp{@{ @}}, e.g.
3150 @smallexample
3151 int i = @{ 2.2 @}; // error: narrowing from double to int
3152 @end smallexample
3154 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3156 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3157 @opindex Wnoexcept
3158 @opindex Wno-noexcept
3159 Warn when a noexcept-expression evaluates to false because of a call
3160 to a function that does not have a non-throwing exception
3161 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3162 the compiler to never throw an exception.
3164 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3165 @opindex Wnoexcept-type
3166 @opindex Wno-noexcept-type
3167 Warn if the C++17 feature making @code{noexcept} part of a function
3168 type changes the mangled name of a symbol relative to C++14.  Enabled
3169 by @option{-Wabi} and @option{-Wc++17-compat}.
3171 As an example:
3173 @smallexample
3174 template <class T> void f(T t) @{ t(); @};
3175 void g() noexcept;
3176 void h() @{ f(g); @} 
3177 @end smallexample
3179 @noindent
3180 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3181 C++17 it calls @code{f<void(*)()noexcept>}.
3183 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3184 @opindex Wclass-memaccess
3185 @opindex Wno-class-memaccess
3186 Warn when the destination of a call to a raw memory function such as
3187 @code{memset} or @code{memcpy} is an object of class type, and when writing
3188 into such an object might bypass the class non-trivial or deleted constructor
3189 or copy assignment, violate const-correctness or encapsulation, or corrupt
3190 virtual table pointers.  Modifying the representation of such objects may
3191 violate invariants maintained by member functions of the class.  For example,
3192 the call to @code{memset} below is undefined because it modifies a non-trivial
3193 class object and is, therefore, diagnosed.  The safe way to either initialize
3194 or clear the storage of objects of such types is by using the appropriate
3195 constructor or assignment operator, if one is available.
3196 @smallexample
3197 std::string str = "abc";
3198 memset (&str, 0, sizeof str);
3199 @end smallexample
3200 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3201 Explicitly casting the pointer to the class object to @code{void *} or
3202 to a type that can be safely accessed by the raw memory function suppresses
3203 the warning.
3205 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3206 @opindex Wnon-virtual-dtor
3207 @opindex Wno-non-virtual-dtor
3208 Warn when a class has virtual functions and an accessible non-virtual
3209 destructor itself or in an accessible polymorphic base class, in which
3210 case it is possible but unsafe to delete an instance of a derived
3211 class through a pointer to the class itself or base class.  This
3212 warning is automatically enabled if @option{-Weffc++} is specified.
3214 @item -Wregister @r{(C++ and Objective-C++ only)}
3215 @opindex Wregister
3216 @opindex Wno-register
3217 Warn on uses of the @code{register} storage class specifier, except
3218 when it is part of the GNU @ref{Explicit Register Variables} extension.
3219 The use of the @code{register} keyword as storage class specifier has
3220 been deprecated in C++11 and removed in C++17.
3221 Enabled by default with @option{-std=c++17}.
3223 @item -Wreorder @r{(C++ and Objective-C++ only)}
3224 @opindex Wreorder
3225 @opindex Wno-reorder
3226 @cindex reordering, warning
3227 @cindex warning for reordering of member initializers
3228 Warn when the order of member initializers given in the code does not
3229 match the order in which they must be executed.  For instance:
3231 @smallexample
3232 struct A @{
3233   int i;
3234   int j;
3235   A(): j (0), i (1) @{ @}
3237 @end smallexample
3239 @noindent
3240 The compiler rearranges the member initializers for @code{i}
3241 and @code{j} to match the declaration order of the members, emitting
3242 a warning to that effect.  This warning is enabled by @option{-Wall}.
3244 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3245 @opindex Wpessimizing-move
3246 @opindex Wno-pessimizing-move
3247 This warning warns when a call to @code{std::move} prevents copy
3248 elision.  A typical scenario when copy elision can occur is when returning in
3249 a function with a class return type, when the expression being returned is the
3250 name of a non-volatile automatic object, and is not a function parameter, and
3251 has the same type as the function return type.
3253 @smallexample
3254 struct T @{
3255 @dots{}
3257 T fn()
3259   T t;
3260   @dots{}
3261   return std::move (t);
3263 @end smallexample
3265 But in this example, the @code{std::move} call prevents copy elision.
3267 This warning is enabled by @option{-Wall}.
3269 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3270 @opindex Wredundant-move
3271 @opindex Wno-redundant-move
3272 This warning warns about redundant calls to @code{std::move}; that is, when
3273 a move operation would have been performed even without the @code{std::move}
3274 call.  This happens because the compiler is forced to treat the object as if
3275 it were an rvalue in certain situations such as returning a local variable,
3276 where copy elision isn't applicable.  Consider:
3278 @smallexample
3279 struct T @{
3280 @dots{}
3282 T fn(T t)
3284   @dots{}
3285   return std::move (t);
3287 @end smallexample
3289 Here, the @code{std::move} call is redundant.  Because G++ implements Core
3290 Issue 1579, another example is:
3292 @smallexample
3293 struct T @{ // convertible to U
3294 @dots{}
3296 struct U @{
3297 @dots{}
3299 U fn()
3301   T t;
3302   @dots{}
3303   return std::move (t);
3305 @end smallexample
3306 In this example, copy elision isn't applicable because the type of the
3307 expression being returned and the function return type differ, yet G++
3308 treats the return value as if it were designated by an rvalue.
3310 This warning is enabled by @option{-Wextra}.
3312 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3313 @opindex fext-numeric-literals
3314 @opindex fno-ext-numeric-literals
3315 Accept imaginary, fixed-point, or machine-defined
3316 literal number suffixes as GNU extensions.
3317 When this option is turned off these suffixes are treated
3318 as C++11 user-defined literal numeric suffixes.
3319 This is on by default for all pre-C++11 dialects and all GNU dialects:
3320 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3321 @option{-std=gnu++14}.
3322 This option is off by default
3323 for ISO C++11 onwards (@option{-std=c++11}, ...).
3324 @end table
3326 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3328 @table @gcctabopt
3329 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3330 @opindex Weffc++
3331 @opindex Wno-effc++
3332 Warn about violations of the following style guidelines from Scott Meyers'
3333 @cite{Effective C++} series of books:
3335 @itemize @bullet
3336 @item
3337 Define a copy constructor and an assignment operator for classes
3338 with dynamically-allocated memory.
3340 @item
3341 Prefer initialization to assignment in constructors.
3343 @item
3344 Have @code{operator=} return a reference to @code{*this}.
3346 @item
3347 Don't try to return a reference when you must return an object.
3349 @item
3350 Distinguish between prefix and postfix forms of increment and
3351 decrement operators.
3353 @item
3354 Never overload @code{&&}, @code{||}, or @code{,}.
3356 @end itemize
3358 This option also enables @option{-Wnon-virtual-dtor}, which is also
3359 one of the effective C++ recommendations.  However, the check is
3360 extended to warn about the lack of virtual destructor in accessible
3361 non-polymorphic bases classes too.
3363 When selecting this option, be aware that the standard library
3364 headers do not obey all of these guidelines; use @samp{grep -v}
3365 to filter out those warnings.
3367 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3368 @opindex Wstrict-null-sentinel
3369 @opindex Wno-strict-null-sentinel
3370 Warn about the use of an uncasted @code{NULL} as sentinel.  When
3371 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3372 to @code{__null}.  Although it is a null pointer constant rather than a
3373 null pointer, it is guaranteed to be of the same size as a pointer.
3374 But this use is not portable across different compilers.
3376 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3377 @opindex Wno-non-template-friend
3378 @opindex Wnon-template-friend
3379 Disable warnings when non-template friend functions are declared
3380 within a template.  In very old versions of GCC that predate implementation
3381 of the ISO standard, declarations such as 
3382 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3383 could be interpreted as a particular specialization of a template
3384 function; the warning exists to diagnose compatibility problems, 
3385 and is enabled by default.
3387 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3388 @opindex Wold-style-cast
3389 @opindex Wno-old-style-cast
3390 Warn if an old-style (C-style) cast to a non-void type is used within
3391 a C++ program.  The new-style casts (@code{dynamic_cast},
3392 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3393 less vulnerable to unintended effects and much easier to search for.
3395 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3396 @opindex Woverloaded-virtual
3397 @opindex Wno-overloaded-virtual
3398 @cindex overloaded virtual function, warning
3399 @cindex warning for overloaded virtual function
3400 Warn when a function declaration hides virtual functions from a
3401 base class.  For example, in:
3403 @smallexample
3404 struct A @{
3405   virtual void f();
3408 struct B: public A @{
3409   void f(int);
3411 @end smallexample
3413 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3414 like:
3416 @smallexample
3417 B* b;
3418 b->f();
3419 @end smallexample
3421 @noindent
3422 fails to compile.
3424 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3425 @opindex Wno-pmf-conversions
3426 @opindex Wpmf-conversions
3427 Disable the diagnostic for converting a bound pointer to member function
3428 to a plain pointer.
3430 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3431 @opindex Wsign-promo
3432 @opindex Wno-sign-promo
3433 Warn when overload resolution chooses a promotion from unsigned or
3434 enumerated type to a signed type, over a conversion to an unsigned type of
3435 the same size.  Previous versions of G++ tried to preserve
3436 unsignedness, but the standard mandates the current behavior.
3438 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3439 @opindex Wtemplates
3440 @opindex Wno-templates
3441 Warn when a primary template declaration is encountered.  Some coding
3442 rules disallow templates, and this may be used to enforce that rule.
3443 The warning is inactive inside a system header file, such as the STL, so
3444 one can still use the STL.  One may also instantiate or specialize
3445 templates.
3447 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3448 @opindex Wmultiple-inheritance
3449 @opindex Wno-multiple-inheritance
3450 Warn when a class is defined with multiple direct base classes.  Some
3451 coding rules disallow multiple inheritance, and this may be used to
3452 enforce that rule.  The warning is inactive inside a system header file,
3453 such as the STL, so one can still use the STL.  One may also define
3454 classes that indirectly use multiple inheritance.
3456 @item -Wvirtual-inheritance
3457 @opindex Wvirtual-inheritance
3458 @opindex Wno-virtual-inheritance
3459 Warn when a class is defined with a virtual direct base class.  Some
3460 coding rules disallow multiple inheritance, and this may be used to
3461 enforce that rule.  The warning is inactive inside a system header file,
3462 such as the STL, so one can still use the STL.  One may also define
3463 classes that indirectly use virtual inheritance.
3465 @item -Wnamespaces
3466 @opindex Wnamespaces
3467 @opindex Wno-namespaces
3468 Warn when a namespace definition is opened.  Some coding rules disallow
3469 namespaces, and this may be used to enforce that rule.  The warning is
3470 inactive inside a system header file, such as the STL, so one can still
3471 use the STL.  One may also use using directives and qualified names.
3473 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3474 @opindex Wterminate
3475 @opindex Wno-terminate
3476 Disable the warning about a throw-expression that will immediately
3477 result in a call to @code{terminate}.
3479 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3480 @opindex Wno-class-conversion
3481 @opindex Wclass-conversion
3482 Disable the warning about the case when a conversion function converts an
3483 object to the same type, to a base class of that type, or to void; such
3484 a conversion function will never be called.
3486 @item -Wvolatile @r{(C++ and Objective-C++ only)}
3487 @opindex Wvolatile
3488 @opindex Wno-volatile
3489 Warn about deprecated uses of the @code{volatile} qualifier.  This includes
3490 postfix and prefix @code{++} and @code{--} expressions of
3491 @code{volatile}-qualified types, using simple assignments where the left
3492 operand is a @code{volatile}-qualified non-class type for their value,
3493 compound assignments where the left operand is a @code{volatile}-qualified
3494 non-class type, @code{volatile}-qualified function return type,
3495 @code{volatile}-qualified parameter type, and structured bindings of a
3496 @code{volatile}-qualified type.  This usage was deprecated in C++20.
3498 Enabled by default with @option{-std=c++2a}.
3499 @end table
3501 @node Objective-C and Objective-C++ Dialect Options
3502 @section Options Controlling Objective-C and Objective-C++ Dialects
3504 @cindex compiler options, Objective-C and Objective-C++
3505 @cindex Objective-C and Objective-C++ options, command-line
3506 @cindex options, Objective-C and Objective-C++
3507 (NOTE: This manual does not describe the Objective-C and Objective-C++
3508 languages themselves.  @xref{Standards,,Language Standards
3509 Supported by GCC}, for references.)
3511 This section describes the command-line options that are only meaningful
3512 for Objective-C and Objective-C++ programs.  You can also use most of
3513 the language-independent GNU compiler options.
3514 For example, you might compile a file @file{some_class.m} like this:
3516 @smallexample
3517 gcc -g -fgnu-runtime -O -c some_class.m
3518 @end smallexample
3520 @noindent
3521 In this example, @option{-fgnu-runtime} is an option meant only for
3522 Objective-C and Objective-C++ programs; you can use the other options with
3523 any language supported by GCC@.
3525 Note that since Objective-C is an extension of the C language, Objective-C
3526 compilations may also use options specific to the C front-end (e.g.,
3527 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
3528 C++-specific options (e.g., @option{-Wabi}).
3530 Here is a list of options that are @emph{only} for compiling Objective-C
3531 and Objective-C++ programs:
3533 @table @gcctabopt
3534 @item -fconstant-string-class=@var{class-name}
3535 @opindex fconstant-string-class
3536 Use @var{class-name} as the name of the class to instantiate for each
3537 literal string specified with the syntax @code{@@"@dots{}"}.  The default
3538 class name is @code{NXConstantString} if the GNU runtime is being used, and
3539 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
3540 @option{-fconstant-cfstrings} option, if also present, overrides the
3541 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3542 to be laid out as constant CoreFoundation strings.
3544 @item -fgnu-runtime
3545 @opindex fgnu-runtime
3546 Generate object code compatible with the standard GNU Objective-C
3547 runtime.  This is the default for most types of systems.
3549 @item -fnext-runtime
3550 @opindex fnext-runtime
3551 Generate output compatible with the NeXT runtime.  This is the default
3552 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
3553 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3554 used.
3556 @item -fno-nil-receivers
3557 @opindex fno-nil-receivers
3558 @opindex fnil-receivers
3559 Assume that all Objective-C message dispatches (@code{[receiver
3560 message:arg]}) in this translation unit ensure that the receiver is
3561 not @code{nil}.  This allows for more efficient entry points in the
3562 runtime to be used.  This option is only available in conjunction with
3563 the NeXT runtime and ABI version 0 or 1.
3565 @item -fobjc-abi-version=@var{n}
3566 @opindex fobjc-abi-version
3567 Use version @var{n} of the Objective-C ABI for the selected runtime.
3568 This option is currently supported only for the NeXT runtime.  In that
3569 case, Version 0 is the traditional (32-bit) ABI without support for
3570 properties and other Objective-C 2.0 additions.  Version 1 is the
3571 traditional (32-bit) ABI with support for properties and other
3572 Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
3573 nothing is specified, the default is Version 0 on 32-bit target
3574 machines, and Version 2 on 64-bit target machines.
3576 @item -fobjc-call-cxx-cdtors
3577 @opindex fobjc-call-cxx-cdtors
3578 For each Objective-C class, check if any of its instance variables is a
3579 C++ object with a non-trivial default constructor.  If so, synthesize a
3580 special @code{- (id) .cxx_construct} instance method which runs
3581 non-trivial default constructors on any such instance variables, in order,
3582 and then return @code{self}.  Similarly, check if any instance variable
3583 is a C++ object with a non-trivial destructor, and if so, synthesize a
3584 special @code{- (void) .cxx_destruct} method which runs
3585 all such default destructors, in reverse order.
3587 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3588 methods thusly generated only operate on instance variables
3589 declared in the current Objective-C class, and not those inherited
3590 from superclasses.  It is the responsibility of the Objective-C
3591 runtime to invoke all such methods in an object's inheritance
3592 hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
3593 by the runtime immediately after a new object instance is allocated;
3594 the @code{- (void) .cxx_destruct} methods are invoked immediately
3595 before the runtime deallocates an object instance.
3597 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3598 support for invoking the @code{- (id) .cxx_construct} and
3599 @code{- (void) .cxx_destruct} methods.
3601 @item -fobjc-direct-dispatch
3602 @opindex fobjc-direct-dispatch
3603 Allow fast jumps to the message dispatcher.  On Darwin this is
3604 accomplished via the comm page.
3606 @item -fobjc-exceptions
3607 @opindex fobjc-exceptions
3608 Enable syntactic support for structured exception handling in
3609 Objective-C, similar to what is offered by C++.  This option
3610 is required to use the Objective-C keywords @code{@@try},
3611 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3612 @code{@@synchronized}.  This option is available with both the GNU
3613 runtime and the NeXT runtime (but not available in conjunction with
3614 the NeXT runtime on Mac OS X 10.2 and earlier).
3616 @item -fobjc-gc
3617 @opindex fobjc-gc
3618 Enable garbage collection (GC) in Objective-C and Objective-C++
3619 programs.  This option is only available with the NeXT runtime; the
3620 GNU runtime has a different garbage collection implementation that
3621 does not require special compiler flags.
3623 @item -fobjc-nilcheck
3624 @opindex fobjc-nilcheck
3625 For the NeXT runtime with version 2 of the ABI, check for a nil
3626 receiver in method invocations before doing the actual method call.
3627 This is the default and can be disabled using
3628 @option{-fno-objc-nilcheck}.  Class methods and super calls are never
3629 checked for nil in this way no matter what this flag is set to.
3630 Currently this flag does nothing when the GNU runtime, or an older
3631 version of the NeXT runtime ABI, is used.
3633 @item -fobjc-std=objc1
3634 @opindex fobjc-std
3635 Conform to the language syntax of Objective-C 1.0, the language
3636 recognized by GCC 4.0.  This only affects the Objective-C additions to
3637 the C/C++ language; it does not affect conformance to C/C++ standards,
3638 which is controlled by the separate C/C++ dialect option flags.  When
3639 this option is used with the Objective-C or Objective-C++ compiler,
3640 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3641 This is useful if you need to make sure that your Objective-C code can
3642 be compiled with older versions of GCC@.
3644 @item -freplace-objc-classes
3645 @opindex freplace-objc-classes
3646 Emit a special marker instructing @command{ld(1)} not to statically link in
3647 the resulting object file, and allow @command{dyld(1)} to load it in at
3648 run time instead.  This is used in conjunction with the Fix-and-Continue
3649 debugging mode, where the object file in question may be recompiled and
3650 dynamically reloaded in the course of program execution, without the need
3651 to restart the program itself.  Currently, Fix-and-Continue functionality
3652 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3653 and later.
3655 @item -fzero-link
3656 @opindex fzero-link
3657 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3658 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3659 compile time) with static class references that get initialized at load time,
3660 which improves run-time performance.  Specifying the @option{-fzero-link} flag
3661 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3662 to be retained.  This is useful in Zero-Link debugging mode, since it allows
3663 for individual class implementations to be modified during program execution.
3664 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3665 regardless of command-line options.
3667 @item -fno-local-ivars
3668 @opindex fno-local-ivars
3669 @opindex flocal-ivars
3670 By default instance variables in Objective-C can be accessed as if
3671 they were local variables from within the methods of the class they're
3672 declared in.  This can lead to shadowing between instance variables
3673 and other variables declared either locally inside a class method or
3674 globally with the same name.  Specifying the @option{-fno-local-ivars}
3675 flag disables this behavior thus avoiding variable shadowing issues.
3677 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3678 @opindex fivar-visibility
3679 Set the default instance variable visibility to the specified option
3680 so that instance variables declared outside the scope of any access
3681 modifier directives default to the specified visibility.
3683 @item -gen-decls
3684 @opindex gen-decls
3685 Dump interface declarations for all classes seen in the source file to a
3686 file named @file{@var{sourcename}.decl}.
3688 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3689 @opindex Wassign-intercept
3690 @opindex Wno-assign-intercept
3691 Warn whenever an Objective-C assignment is being intercepted by the
3692 garbage collector.
3694 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3695 @opindex Wno-protocol
3696 @opindex Wprotocol
3697 If a class is declared to implement a protocol, a warning is issued for
3698 every method in the protocol that is not implemented by the class.  The
3699 default behavior is to issue a warning for every method not explicitly
3700 implemented in the class, even if a method implementation is inherited
3701 from the superclass.  If you use the @option{-Wno-protocol} option, then
3702 methods inherited from the superclass are considered to be implemented,
3703 and no warning is issued for them.
3705 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3706 @opindex Wselector
3707 @opindex Wno-selector
3708 Warn if multiple methods of different types for the same selector are
3709 found during compilation.  The check is performed on the list of methods
3710 in the final stage of compilation.  Additionally, a check is performed
3711 for each selector appearing in a @code{@@selector(@dots{})}
3712 expression, and a corresponding method for that selector has been found
3713 during compilation.  Because these checks scan the method table only at
3714 the end of compilation, these warnings are not produced if the final
3715 stage of compilation is not reached, for example because an error is
3716 found during compilation, or because the @option{-fsyntax-only} option is
3717 being used.
3719 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3720 @opindex Wstrict-selector-match
3721 @opindex Wno-strict-selector-match
3722 Warn if multiple methods with differing argument and/or return types are
3723 found for a given selector when attempting to send a message using this
3724 selector to a receiver of type @code{id} or @code{Class}.  When this flag
3725 is off (which is the default behavior), the compiler omits such warnings
3726 if any differences found are confined to types that share the same size
3727 and alignment.
3729 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3730 @opindex Wundeclared-selector
3731 @opindex Wno-undeclared-selector
3732 Warn if a @code{@@selector(@dots{})} expression referring to an
3733 undeclared selector is found.  A selector is considered undeclared if no
3734 method with that name has been declared before the
3735 @code{@@selector(@dots{})} expression, either explicitly in an
3736 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3737 an @code{@@implementation} section.  This option always performs its
3738 checks as soon as a @code{@@selector(@dots{})} expression is found,
3739 while @option{-Wselector} only performs its checks in the final stage of
3740 compilation.  This also enforces the coding style convention
3741 that methods and selectors must be declared before being used.
3743 @item -print-objc-runtime-info
3744 @opindex print-objc-runtime-info
3745 Generate C header describing the largest structure that is passed by
3746 value, if any.
3748 @end table
3750 @node Diagnostic Message Formatting Options
3751 @section Options to Control Diagnostic Messages Formatting
3752 @cindex options to control diagnostics formatting
3753 @cindex diagnostic messages
3754 @cindex message formatting
3756 Traditionally, diagnostic messages have been formatted irrespective of
3757 the output device's aspect (e.g.@: its width, @dots{}).  You can use the
3758 options described below
3759 to control the formatting algorithm for diagnostic messages, 
3760 e.g.@: how many characters per line, how often source location
3761 information should be reported.  Note that some language front ends may not
3762 honor these options.
3764 @table @gcctabopt
3765 @item -fmessage-length=@var{n}
3766 @opindex fmessage-length
3767 Try to format error messages so that they fit on lines of about
3768 @var{n} characters.  If @var{n} is zero, then no line-wrapping is
3769 done; each error message appears on a single line.  This is the
3770 default for all front ends.
3772 Note - this option also affects the display of the @samp{#error} and
3773 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3774 function/type/variable attribute.  It does not however affect the
3775 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3777 @item -fdiagnostics-show-location=once
3778 @opindex fdiagnostics-show-location
3779 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
3780 reporter to emit source location information @emph{once}; that is, in
3781 case the message is too long to fit on a single physical line and has to
3782 be wrapped, the source location won't be emitted (as prefix) again,
3783 over and over, in subsequent continuation lines.  This is the default
3784 behavior.
3786 @item -fdiagnostics-show-location=every-line
3787 Only meaningful in line-wrapping mode.  Instructs the diagnostic
3788 messages reporter to emit the same source location information (as
3789 prefix) for physical lines that result from the process of breaking
3790 a message which is too long to fit on a single line.
3792 @item -fdiagnostics-color[=@var{WHEN}]
3793 @itemx -fno-diagnostics-color
3794 @opindex fdiagnostics-color
3795 @cindex highlight, color
3796 @vindex GCC_COLORS @r{environment variable}
3797 Use color in diagnostics.  @var{WHEN} is @samp{never}, @samp{always},
3798 or @samp{auto}.  The default depends on how the compiler has been configured,
3799 it can be any of the above @var{WHEN} options or also @samp{never}
3800 if @env{GCC_COLORS} environment variable isn't present in the environment,
3801 and @samp{auto} otherwise.
3802 @samp{auto} means to use color only when the standard error is a terminal.
3803 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3804 aliases for @option{-fdiagnostics-color=always} and
3805 @option{-fdiagnostics-color=never}, respectively.
3807 The colors are defined by the environment variable @env{GCC_COLORS}.
3808 Its value is a colon-separated list of capabilities and Select Graphic
3809 Rendition (SGR) substrings. SGR commands are interpreted by the
3810 terminal or terminal emulator.  (See the section in the documentation
3811 of your text terminal for permitted values and their meanings as
3812 character attributes.)  These substring values are integers in decimal
3813 representation and can be concatenated with semicolons.
3814 Common values to concatenate include
3815 @samp{1} for bold,
3816 @samp{4} for underline,
3817 @samp{5} for blink,
3818 @samp{7} for inverse,
3819 @samp{39} for default foreground color,
3820 @samp{30} to @samp{37} for foreground colors,
3821 @samp{90} to @samp{97} for 16-color mode foreground colors,
3822 @samp{38;5;0} to @samp{38;5;255}
3823 for 88-color and 256-color modes foreground colors,
3824 @samp{49} for default background color,
3825 @samp{40} to @samp{47} for background colors,
3826 @samp{100} to @samp{107} for 16-color mode background colors,
3827 and @samp{48;5;0} to @samp{48;5;255}
3828 for 88-color and 256-color modes background colors.
3830 The default @env{GCC_COLORS} is
3831 @smallexample
3832 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3833 quote=01:fixit-insert=32:fixit-delete=31:\
3834 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3835 type-diff=01;32
3836 @end smallexample
3837 @noindent
3838 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3839 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3840 @samp{01} is bold, and @samp{31} is red.
3841 Setting @env{GCC_COLORS} to the empty string disables colors.
3842 Supported capabilities are as follows.
3844 @table @code
3845 @item error=
3846 @vindex error GCC_COLORS @r{capability}
3847 SGR substring for error: markers.
3849 @item warning=
3850 @vindex warning GCC_COLORS @r{capability}
3851 SGR substring for warning: markers.
3853 @item note=
3854 @vindex note GCC_COLORS @r{capability}
3855 SGR substring for note: markers.
3857 @item range1=
3858 @vindex range1 GCC_COLORS @r{capability}
3859 SGR substring for first additional range.
3861 @item range2=
3862 @vindex range2 GCC_COLORS @r{capability}
3863 SGR substring for second additional range.
3865 @item locus=
3866 @vindex locus GCC_COLORS @r{capability}
3867 SGR substring for location information, @samp{file:line} or
3868 @samp{file:line:column} etc.
3870 @item quote=
3871 @vindex quote GCC_COLORS @r{capability}
3872 SGR substring for information printed within quotes.
3874 @item fixit-insert=
3875 @vindex fixit-insert GCC_COLORS @r{capability}
3876 SGR substring for fix-it hints suggesting text to
3877 be inserted or replaced.
3879 @item fixit-delete=
3880 @vindex fixit-delete GCC_COLORS @r{capability}
3881 SGR substring for fix-it hints suggesting text to
3882 be deleted.
3884 @item diff-filename=
3885 @vindex diff-filename GCC_COLORS @r{capability}
3886 SGR substring for filename headers within generated patches.
3888 @item diff-hunk=
3889 @vindex diff-hunk GCC_COLORS @r{capability}
3890 SGR substring for the starts of hunks within generated patches.
3892 @item diff-delete=
3893 @vindex diff-delete GCC_COLORS @r{capability}
3894 SGR substring for deleted lines within generated patches.
3896 @item diff-insert=
3897 @vindex diff-insert GCC_COLORS @r{capability}
3898 SGR substring for inserted lines within generated patches.
3900 @item type-diff=
3901 @vindex type-diff GCC_COLORS @r{capability}
3902 SGR substring for highlighting mismatching types within template
3903 arguments in the C++ frontend.
3904 @end table
3906 @item -fno-diagnostics-show-option
3907 @opindex fno-diagnostics-show-option
3908 @opindex fdiagnostics-show-option
3909 By default, each diagnostic emitted includes text indicating the
3910 command-line option that directly controls the diagnostic (if such an
3911 option is known to the diagnostic machinery).  Specifying the
3912 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3914 @item -fno-diagnostics-show-caret
3915 @opindex fno-diagnostics-show-caret
3916 @opindex fdiagnostics-show-caret
3917 By default, each diagnostic emitted includes the original source line
3918 and a caret @samp{^} indicating the column.  This option suppresses this
3919 information.  The source line is truncated to @var{n} characters, if
3920 the @option{-fmessage-length=n} option is given.  When the output is done
3921 to the terminal, the width is limited to the width given by the
3922 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3924 @item -fno-diagnostics-show-labels
3925 @opindex fno-diagnostics-show-labels
3926 @opindex fdiagnostics-show-labels
3927 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3928 diagnostics can label ranges of source code with pertinent information, such
3929 as the types of expressions:
3931 @smallexample
3932     printf ("foo %s bar", long_i + long_j);
3933                  ~^       ~~~~~~~~~~~~~~~
3934                   |              |
3935                   char *         long int
3936 @end smallexample
3938 This option suppresses the printing of these labels (in the example above,
3939 the vertical bars and the ``char *'' and ``long int'' text).
3941 @item -fno-diagnostics-show-line-numbers
3942 @opindex fno-diagnostics-show-line-numbers
3943 @opindex fdiagnostics-show-line-numbers
3944 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3945 a left margin is printed, showing line numbers.  This option suppresses this
3946 left margin.
3948 @item -fdiagnostics-minimum-margin-width=@var{width}
3949 @opindex fdiagnostics-minimum-margin-width
3950 This option controls the minimum width of the left margin printed by
3951 @option{-fdiagnostics-show-line-numbers}.  It defaults to 6.
3953 @item -fdiagnostics-parseable-fixits
3954 @opindex fdiagnostics-parseable-fixits
3955 Emit fix-it hints in a machine-parseable format, suitable for consumption
3956 by IDEs.  For each fix-it, a line will be printed after the relevant
3957 diagnostic, starting with the string ``fix-it:''.  For example:
3959 @smallexample
3960 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3961 @end smallexample
3963 The location is expressed as a half-open range, expressed as a count of
3964 bytes, starting at byte 1 for the initial column.  In the above example,
3965 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3966 given string:
3968 @smallexample
3969 00000000011111111112222222222
3970 12345678901234567890123456789
3971   gtk_widget_showall (dlg);
3972   ^^^^^^^^^^^^^^^^^^
3973   gtk_widget_show_all
3974 @end smallexample
3976 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3977 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3978 (e.g. vertical tab as ``\013'').
3980 An empty replacement string indicates that the given range is to be removed.
3981 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3982 be inserted at the given position.
3984 @item -fdiagnostics-generate-patch
3985 @opindex fdiagnostics-generate-patch
3986 Print fix-it hints to stderr in unified diff format, after any diagnostics
3987 are printed.  For example:
3989 @smallexample
3990 --- test.c
3991 +++ test.c
3992 @@ -42,5 +42,5 @@
3994  void show_cb(GtkDialog *dlg)
3995  @{
3996 -  gtk_widget_showall(dlg);
3997 +  gtk_widget_show_all(dlg);
3998  @}
4000 @end smallexample
4002 The diff may or may not be colorized, following the same rules
4003 as for diagnostics (see @option{-fdiagnostics-color}).
4005 @item -fdiagnostics-show-template-tree
4006 @opindex fdiagnostics-show-template-tree
4008 In the C++ frontend, when printing diagnostics showing mismatching
4009 template types, such as:
4011 @smallexample
4012   could not convert 'std::map<int, std::vector<double> >()'
4013     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4014 @end smallexample
4016 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4017 tree-like structure showing the common and differing parts of the types,
4018 such as:
4020 @smallexample
4021   map<
4022     [...],
4023     vector<
4024       [double != float]>>
4025 @end smallexample
4027 The parts that differ are highlighted with color (``double'' and
4028 ``float'' in this case).
4030 @item -fno-elide-type
4031 @opindex fno-elide-type
4032 @opindex felide-type
4033 By default when the C++ frontend prints diagnostics showing mismatching
4034 template types, common parts of the types are printed as ``[...]'' to
4035 simplify the error message.  For example:
4037 @smallexample
4038   could not convert 'std::map<int, std::vector<double> >()'
4039     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4040 @end smallexample
4042 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4043 This flag also affects the output of the
4044 @option{-fdiagnostics-show-template-tree} flag.
4046 @item -fno-show-column
4047 @opindex fno-show-column
4048 @opindex fshow-column
4049 Do not print column numbers in diagnostics.  This may be necessary if
4050 diagnostics are being scanned by a program that does not understand the
4051 column numbers, such as @command{dejagnu}.
4053 @item -fdiagnostics-format=@var{FORMAT}
4054 @opindex fdiagnostics-format
4055 Select a different format for printing diagnostics.
4056 @var{FORMAT} is @samp{text} or @samp{json}.
4057 The default is @samp{text}.
4059 The @samp{json} format consists of a top-level JSON array containing JSON
4060 objects representing the diagnostics.
4062 The JSON is emitted as one line, without formatting; the examples below
4063 have been formatted for clarity.
4065 Diagnostics can have child diagnostics.  For example, this error and note:
4067 @smallexample
4068 misleading-indentation.c:15:3: warning: this 'if' clause does not
4069   guard... [-Wmisleading-indentation]
4070    15 |   if (flag)
4071       |   ^~
4072 misleading-indentation.c:17:5: note: ...this statement, but the latter
4073   is misleadingly indented as if it were guarded by the 'if'
4074    17 |     y = 2;
4075       |     ^
4076 @end smallexample
4078 @noindent
4079 might be printed in JSON form (after formatting) like this:
4081 @smallexample
4083     @{
4084         "kind": "warning",
4085         "locations": [
4086             @{
4087                 "caret": @{
4088                     "column": 3,
4089                     "file": "misleading-indentation.c",
4090                     "line": 15
4091                 @},
4092                 "finish": @{
4093                     "column": 4,
4094                     "file": "misleading-indentation.c",
4095                     "line": 15
4096                 @}
4097             @}
4098         ],
4099         "message": "this \u2018if\u2019 clause does not guard...",
4100         "option": "-Wmisleading-indentation",
4101         "children": [
4102             @{
4103                 "kind": "note",
4104                 "locations": [
4105                     @{
4106                         "caret": @{
4107                             "column": 5,
4108                             "file": "misleading-indentation.c",
4109                             "line": 17
4110                         @}
4111                     @}
4112                 ],
4113                 "message": "...this statement, but the latter is @dots{}"
4114             @}
4115         ]
4116     @},
4117     @dots{}
4119 @end smallexample
4121 @noindent
4122 where the @code{note} is a child of the @code{warning}.
4124 A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
4125 an @code{option} key describing the command-line option controlling the
4126 warning.
4128 A diagnostic can contain zero or more locations.  Each location has up
4129 to three positions within it: a @code{caret} position and optional
4130 @code{start} and @code{finish} positions.  A location can also have
4131 an optional @code{label} string.  For example, this error:
4133 @smallexample
4134 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4135    'struct s'@} and 'T' @{aka 'struct t'@})
4136    64 |   return callee_4a () + callee_4b ();
4137       |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4138       |          |              |
4139       |          |              T @{aka struct t@}
4140       |          S @{aka struct s@}
4141 @end smallexample
4143 @noindent
4144 has three locations.  Its primary location is at the ``+'' token at column
4145 23.  It has two secondary locations, describing the left and right-hand sides
4146 of the expression, which have labels.  It might be printed in JSON form as:
4148 @smallexample
4149     @{
4150         "children": [],
4151         "kind": "error",
4152         "locations": [
4153             @{
4154                 "caret": @{
4155                     "column": 23, "file": "bad-binary-ops.c", "line": 64
4156                 @}
4157             @},
4158             @{
4159                 "caret": @{
4160                     "column": 10, "file": "bad-binary-ops.c", "line": 64
4161                 @},
4162                 "finish": @{
4163                     "column": 21, "file": "bad-binary-ops.c", "line": 64
4164                 @},
4165                 "label": "S @{aka struct s@}"
4166             @},
4167             @{
4168                 "caret": @{
4169                     "column": 25, "file": "bad-binary-ops.c", "line": 64
4170                 @},
4171                 "finish": @{
4172                     "column": 36, "file": "bad-binary-ops.c", "line": 64
4173                 @},
4174                 "label": "T @{aka struct t@}"
4175             @}
4176         ],
4177         "message": "invalid operands to binary + @dots{}"
4178     @}
4179 @end smallexample
4181 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4182 consisting of half-open intervals, similar to the output of
4183 @option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
4184 with a replacement fix-it hint:
4186 @smallexample
4187 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4188   mean 'color'?
4189     8 |   return ptr->colour;
4190       |               ^~~~~~
4191       |               color
4192 @end smallexample
4194 @noindent
4195 might be printed in JSON form as:
4197 @smallexample
4198     @{
4199         "children": [],
4200         "fixits": [
4201             @{
4202                 "next": @{
4203                     "column": 21,
4204                     "file": "demo.c",
4205                     "line": 8
4206                 @},
4207                 "start": @{
4208                     "column": 15,
4209                     "file": "demo.c",
4210                     "line": 8
4211                 @},
4212                 "string": "color"
4213             @}
4214         ],
4215         "kind": "error",
4216         "locations": [
4217             @{
4218                 "caret": @{
4219                     "column": 15,
4220                     "file": "demo.c",
4221                     "line": 8
4222                 @},
4223                 "finish": @{
4224                     "column": 20,
4225                     "file": "demo.c",
4226                     "line": 8
4227                 @}
4228             @}
4229         ],
4230         "message": "\u2018struct s\u2019 has no member named @dots{}"
4231     @}
4232 @end smallexample
4234 @noindent
4235 where the fix-it hint suggests replacing the text from @code{start} up
4236 to but not including @code{next} with @code{string}'s value.  Deletions
4237 are expressed via an empty value for @code{string}, insertions by
4238 having @code{start} equal @code{next}.
4240 @end table
4242 @node Warning Options
4243 @section Options to Request or Suppress Warnings
4244 @cindex options to control warnings
4245 @cindex warning messages
4246 @cindex messages, warning
4247 @cindex suppressing warnings
4249 Warnings are diagnostic messages that report constructions that
4250 are not inherently erroneous but that are risky or suggest there
4251 may have been an error.
4253 The following language-independent options do not enable specific
4254 warnings but control the kinds of diagnostics produced by GCC@.
4256 @table @gcctabopt
4257 @cindex syntax checking
4258 @item -fsyntax-only
4259 @opindex fsyntax-only
4260 Check the code for syntax errors, but don't do anything beyond that.
4262 @item -fmax-errors=@var{n}
4263 @opindex fmax-errors
4264 Limits the maximum number of error messages to @var{n}, at which point
4265 GCC bails out rather than attempting to continue processing the source
4266 code.  If @var{n} is 0 (the default), there is no limit on the number
4267 of error messages produced.  If @option{-Wfatal-errors} is also
4268 specified, then @option{-Wfatal-errors} takes precedence over this
4269 option.
4271 @item -w
4272 @opindex w
4273 Inhibit all warning messages.
4275 @item -Werror
4276 @opindex Werror
4277 @opindex Wno-error
4278 Make all warnings into errors.
4280 @item -Werror=
4281 @opindex Werror=
4282 @opindex Wno-error=
4283 Make the specified warning into an error.  The specifier for a warning
4284 is appended; for example @option{-Werror=switch} turns the warnings
4285 controlled by @option{-Wswitch} into errors.  This switch takes a
4286 negative form, to be used to negate @option{-Werror} for specific
4287 warnings; for example @option{-Wno-error=switch} makes
4288 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4289 is in effect.
4291 The warning message for each controllable warning includes the
4292 option that controls the warning.  That option can then be used with
4293 @option{-Werror=} and @option{-Wno-error=} as described above.
4294 (Printing of the option in the warning message can be disabled using the
4295 @option{-fno-diagnostics-show-option} flag.)
4297 Note that specifying @option{-Werror=}@var{foo} automatically implies
4298 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
4299 imply anything.
4301 @item -Wfatal-errors
4302 @opindex Wfatal-errors
4303 @opindex Wno-fatal-errors
4304 This option causes the compiler to abort compilation on the first error
4305 occurred rather than trying to keep going and printing further error
4306 messages.
4308 @end table
4310 You can request many specific warnings with options beginning with
4311 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4312 implicit declarations.  Each of these specific warning options also
4313 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4314 example, @option{-Wno-implicit}.  This manual lists only one of the
4315 two forms, whichever is not the default.  For further
4316 language-specific options also refer to @ref{C++ Dialect Options} and
4317 @ref{Objective-C and Objective-C++ Dialect Options}.
4319 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4320 options, such as @option{-Wunused}, which may turn on further options,
4321 such as @option{-Wunused-value}. The combined effect of positive and
4322 negative forms is that more specific options have priority over less
4323 specific ones, independently of their position in the command-line. For
4324 options of the same specificity, the last one takes effect. Options
4325 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4326 as if they appeared at the end of the command-line.
4328 When an unrecognized warning option is requested (e.g.,
4329 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4330 that the option is not recognized.  However, if the @option{-Wno-} form
4331 is used, the behavior is slightly different: no diagnostic is
4332 produced for @option{-Wno-unknown-warning} unless other diagnostics
4333 are being produced.  This allows the use of new @option{-Wno-} options
4334 with old compilers, but if something goes wrong, the compiler
4335 warns that an unrecognized option is present.
4337 @table @gcctabopt
4338 @item -Wpedantic
4339 @itemx -pedantic
4340 @opindex pedantic
4341 @opindex Wpedantic
4342 @opindex Wno-pedantic
4343 Issue all the warnings demanded by strict ISO C and ISO C++;
4344 reject all programs that use forbidden extensions, and some other
4345 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
4346 version of the ISO C standard specified by any @option{-std} option used.
4348 Valid ISO C and ISO C++ programs should compile properly with or without
4349 this option (though a rare few require @option{-ansi} or a
4350 @option{-std} option specifying the required version of ISO C)@.  However,
4351 without this option, certain GNU extensions and traditional C and C++
4352 features are supported as well.  With this option, they are rejected.
4354 @option{-Wpedantic} does not cause warning messages for use of the
4355 alternate keywords whose names begin and end with @samp{__}.  This alternate
4356 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4357 i.e. @samp{__intN__}.
4358 Pedantic warnings are also disabled in the expression that follows
4359 @code{__extension__}.  However, only system header files should use
4360 these escape routes; application programs should avoid them.
4361 @xref{Alternate Keywords}.
4363 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4364 C conformance.  They soon find that it does not do quite what they want:
4365 it finds some non-ISO practices, but not all---only those for which
4366 ISO C @emph{requires} a diagnostic, and some others for which
4367 diagnostics have been added.
4369 A feature to report any failure to conform to ISO C might be useful in
4370 some instances, but would require considerable additional work and would
4371 be quite different from @option{-Wpedantic}.  We don't have plans to
4372 support such a feature in the near future.
4374 Where the standard specified with @option{-std} represents a GNU
4375 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4376 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4377 extended dialect is based.  Warnings from @option{-Wpedantic} are given
4378 where they are required by the base standard.  (It does not make sense
4379 for such warnings to be given only for features not in the specified GNU
4380 C dialect, since by definition the GNU dialects of C include all
4381 features the compiler supports with the given option, and there would be
4382 nothing to warn about.)
4384 @item -pedantic-errors
4385 @opindex pedantic-errors
4386 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4387 requires a diagnostic, in some cases where there is undefined behavior
4388 at compile-time and in some other cases that do not prevent compilation
4389 of programs that are valid according to the standard. This is not
4390 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4391 by this option and not enabled by the latter and vice versa.
4393 @item -Wall
4394 @opindex Wall
4395 @opindex Wno-all
4396 This enables all the warnings about constructions that some users
4397 consider questionable, and that are easy to avoid (or modify to
4398 prevent the warning), even in conjunction with macros.  This also
4399 enables some language-specific warnings described in @ref{C++ Dialect
4400 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4402 @option{-Wall} turns on the following warning flags:
4404 @gccoptlist{-Waddress   @gol
4405 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)}  @gol
4406 -Wbool-compare  @gol
4407 -Wbool-operation  @gol
4408 -Wc++11-compat  -Wc++14-compat  @gol
4409 -Wcatch-value @r{(C++ and Objective-C++ only)}  @gol
4410 -Wchar-subscripts  @gol
4411 -Wcomment  @gol
4412 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4413 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4414 -Wenum-conversion @r{in C/ObjC;} @gol
4415 -Wformat   @gol
4416 -Wint-in-bool-context  @gol
4417 -Wimplicit @r{(C and Objective-C only)} @gol
4418 -Wimplicit-int @r{(C and Objective-C only)} @gol
4419 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4420 -Winit-self @r{(only for C++)} @gol
4421 -Wlogical-not-parentheses @gol
4422 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}  @gol
4423 -Wmaybe-uninitialized @gol
4424 -Wmemset-elt-size @gol
4425 -Wmemset-transposed-args @gol
4426 -Wmisleading-indentation @r{(only for C/C++)} @gol
4427 -Wmissing-attributes @gol
4428 -Wmissing-braces @r{(only for C/ObjC)} @gol
4429 -Wmultistatement-macros  @gol
4430 -Wnarrowing @r{(only for C++)}  @gol
4431 -Wnonnull  @gol
4432 -Wnonnull-compare  @gol
4433 -Wopenmp-simd @gol
4434 -Wparentheses  @gol
4435 -Wpessimizing-move @r{(only for C++)}  @gol
4436 -Wpointer-sign  @gol
4437 -Wreorder   @gol
4438 -Wrestrict   @gol
4439 -Wreturn-type  @gol
4440 -Wsequence-point  @gol
4441 -Wsign-compare @r{(only in C++)}  @gol
4442 -Wsizeof-pointer-div @gol
4443 -Wsizeof-pointer-memaccess @gol
4444 -Wstrict-aliasing  @gol
4445 -Wstrict-overflow=1  @gol
4446 -Wswitch  @gol
4447 -Wtautological-compare  @gol
4448 -Wtrigraphs  @gol
4449 -Wuninitialized  @gol
4450 -Wunknown-pragmas  @gol
4451 -Wunused-function  @gol
4452 -Wunused-label     @gol
4453 -Wunused-value     @gol
4454 -Wunused-variable  @gol
4455 -Wvolatile-register-var}
4457 Note that some warning flags are not implied by @option{-Wall}.  Some of
4458 them warn about constructions that users generally do not consider
4459 questionable, but which occasionally you might wish to check for;
4460 others warn about constructions that are necessary or hard to avoid in
4461 some cases, and there is no simple way to modify the code to suppress
4462 the warning. Some of them are enabled by @option{-Wextra} but many of
4463 them must be enabled individually.
4465 @item -Wextra
4466 @opindex W
4467 @opindex Wextra
4468 @opindex Wno-extra
4469 This enables some extra warning flags that are not enabled by
4470 @option{-Wall}. (This option used to be called @option{-W}.  The older
4471 name is still supported, but the newer name is more descriptive.)
4473 @gccoptlist{-Wclobbered  @gol
4474 -Wcast-function-type  @gol
4475 -Wdeprecated-copy @r{(C++ only)} @gol
4476 -Wempty-body  @gol
4477 -Wignored-qualifiers @gol
4478 -Wimplicit-fallthrough=3 @gol
4479 -Wmissing-field-initializers  @gol
4480 -Wmissing-parameter-type @r{(C only)}  @gol
4481 -Wold-style-declaration @r{(C only)}  @gol
4482 -Woverride-init  @gol
4483 -Wsign-compare @r{(C only)} @gol
4484 -Wredundant-move @r{(only for C++)}  @gol
4485 -Wtype-limits  @gol
4486 -Wuninitialized  @gol
4487 -Wshift-negative-value @r{(in C++03 and in C99 and newer)}  @gol
4488 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4489 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4492 The option @option{-Wextra} also prints warning messages for the
4493 following cases:
4495 @itemize @bullet
4497 @item
4498 A pointer is compared against integer zero with @code{<}, @code{<=},
4499 @code{>}, or @code{>=}.
4501 @item
4502 (C++ only) An enumerator and a non-enumerator both appear in a
4503 conditional expression.
4505 @item
4506 (C++ only) Ambiguous virtual bases.
4508 @item
4509 (C++ only) Subscripting an array that has been declared @code{register}.
4511 @item
4512 (C++ only) Taking the address of a variable that has been declared
4513 @code{register}.
4515 @item
4516 (C++ only) A base class is not initialized in the copy constructor
4517 of a derived class.
4519 @end itemize
4521 @item -Wchar-subscripts
4522 @opindex Wchar-subscripts
4523 @opindex Wno-char-subscripts
4524 Warn if an array subscript has type @code{char}.  This is a common cause
4525 of error, as programmers often forget that this type is signed on some
4526 machines.
4527 This warning is enabled by @option{-Wall}.
4529 @item -Wno-coverage-mismatch
4530 @opindex Wno-coverage-mismatch
4531 @opindex Wcoverage-mismatch
4532 Warn if feedback profiles do not match when using the
4533 @option{-fprofile-use} option.
4534 If a source file is changed between compiling with @option{-fprofile-generate}
4535 and with @option{-fprofile-use}, the files with the profile feedback can fail
4536 to match the source file and GCC cannot use the profile feedback
4537 information.  By default, this warning is enabled and is treated as an
4538 error.  @option{-Wno-coverage-mismatch} can be used to disable the
4539 warning or @option{-Wno-error=coverage-mismatch} can be used to
4540 disable the error.  Disabling the error for this warning can result in
4541 poorly optimized code and is useful only in the
4542 case of very minor changes such as bug fixes to an existing code-base.
4543 Completely disabling the warning is not recommended.
4545 @item -Wno-cpp
4546 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4548 Suppress warning messages emitted by @code{#warning} directives.
4550 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4551 @opindex Wdouble-promotion
4552 @opindex Wno-double-promotion
4553 Give a warning when a value of type @code{float} is implicitly
4554 promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
4555 floating-point unit implement @code{float} in hardware, but emulate
4556 @code{double} in software.  On such a machine, doing computations
4557 using @code{double} values is much more expensive because of the
4558 overhead required for software emulation.
4560 It is easy to accidentally do computations with @code{double} because
4561 floating-point literals are implicitly of type @code{double}.  For
4562 example, in:
4563 @smallexample
4564 @group
4565 float area(float radius)
4567    return 3.14159 * radius * radius;
4569 @end group
4570 @end smallexample
4571 the compiler performs the entire computation with @code{double}
4572 because the floating-point literal is a @code{double}.
4574 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4575 @opindex Wduplicate-decl-specifier
4576 @opindex Wno-duplicate-decl-specifier
4577 Warn if a declaration has duplicate @code{const}, @code{volatile},
4578 @code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
4579 @option{-Wall}.
4581 @item -Wformat
4582 @itemx -Wformat=@var{n}
4583 @opindex Wformat
4584 @opindex Wno-format
4585 @opindex ffreestanding
4586 @opindex fno-builtin
4587 @opindex Wformat=
4588 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4589 the arguments supplied have types appropriate to the format string
4590 specified, and that the conversions specified in the format string make
4591 sense.  This includes standard functions, and others specified by format
4592 attributes (@pxref{Function Attributes}), in the @code{printf},
4593 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4594 not in the C standard) families (or other target-specific families).
4595 Which functions are checked without format attributes having been
4596 specified depends on the standard version selected, and such checks of
4597 functions without the attribute specified are disabled by
4598 @option{-ffreestanding} or @option{-fno-builtin}.
4600 The formats are checked against the format features supported by GNU
4601 libc version 2.2.  These include all ISO C90 and C99 features, as well
4602 as features from the Single Unix Specification and some BSD and GNU
4603 extensions.  Other library implementations may not support all these
4604 features; GCC does not support warning about features that go beyond a
4605 particular library's limitations.  However, if @option{-Wpedantic} is used
4606 with @option{-Wformat}, warnings are given about format features not
4607 in the selected standard version (but not for @code{strfmon} formats,
4608 since those are not in any version of the C standard).  @xref{C Dialect
4609 Options,,Options Controlling C Dialect}.
4611 @table @gcctabopt
4612 @item -Wformat=1
4613 @itemx -Wformat
4614 @opindex Wformat
4615 @opindex Wformat=1
4616 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4617 @option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
4618 @option{-Wformat} also checks for null format arguments for several
4619 functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
4620 aspects of this level of format checking can be disabled by the
4621 options: @option{-Wno-format-contains-nul},
4622 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4623 @option{-Wformat} is enabled by @option{-Wall}.
4625 @item -Wno-format-contains-nul
4626 @opindex Wno-format-contains-nul
4627 @opindex Wformat-contains-nul
4628 If @option{-Wformat} is specified, do not warn about format strings that
4629 contain NUL bytes.
4631 @item -Wno-format-extra-args
4632 @opindex Wno-format-extra-args
4633 @opindex Wformat-extra-args
4634 If @option{-Wformat} is specified, do not warn about excess arguments to a
4635 @code{printf} or @code{scanf} format function.  The C standard specifies
4636 that such arguments are ignored.
4638 Where the unused arguments lie between used arguments that are
4639 specified with @samp{$} operand number specifications, normally
4640 warnings are still given, since the implementation could not know what
4641 type to pass to @code{va_arg} to skip the unused arguments.  However,
4642 in the case of @code{scanf} formats, this option suppresses the
4643 warning if the unused arguments are all pointers, since the Single
4644 Unix Specification says that such unused arguments are allowed.
4646 @item -Wformat-overflow
4647 @itemx -Wformat-overflow=@var{level}
4648 @opindex Wformat-overflow
4649 @opindex Wno-format-overflow
4650 Warn about calls to formatted input/output functions such as @code{sprintf}
4651 and @code{vsprintf} that might overflow the destination buffer.  When the
4652 exact number of bytes written by a format directive cannot be determined
4653 at compile-time it is estimated based on heuristics that depend on the
4654 @var{level} argument and on optimization.  While enabling optimization
4655 will in most cases improve the accuracy of the warning, it may also
4656 result in false positives.
4658 @table @gcctabopt
4659 @item -Wformat-overflow
4660 @itemx -Wformat-overflow=1
4661 @opindex Wformat-overflow
4662 @opindex Wno-format-overflow
4663 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4664 employs a conservative approach that warns only about calls that most
4665 likely overflow the buffer.  At this level, numeric arguments to format
4666 directives with unknown values are assumed to have the value of one, and
4667 strings of unknown length to be empty.  Numeric arguments that are known
4668 to be bounded to a subrange of their type, or string arguments whose output
4669 is bounded either by their directive's precision or by a finite set of
4670 string literals, are assumed to take on the value within the range that
4671 results in the most bytes on output.  For example, the call to @code{sprintf}
4672 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4673 the terminating NUL character (@code{'\0'}) appended by the function
4674 to the destination buffer will be written past its end.  Increasing
4675 the size of the buffer by a single byte is sufficient to avoid the
4676 warning, though it may not be sufficient to avoid the overflow.
4678 @smallexample
4679 void f (int a, int b)
4681   char buf [13];
4682   sprintf (buf, "a = %i, b = %i\n", a, b);
4684 @end smallexample
4686 @item -Wformat-overflow=2
4687 Level @var{2} warns also about calls that might overflow the destination
4688 buffer given an argument of sufficient length or magnitude.  At level
4689 @var{2}, unknown numeric arguments are assumed to have the minimum
4690 representable value for signed types with a precision greater than 1, and
4691 the maximum representable value otherwise.  Unknown string arguments whose
4692 length cannot be assumed to be bounded either by the directive's precision,
4693 or by a finite set of string literals they may evaluate to, or the character
4694 array they may point to, are assumed to be 1 character long.
4696 At level @var{2}, the call in the example above is again diagnosed, but
4697 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4698 @code{%i} directive will write some of its digits beyond the end of
4699 the destination buffer.  To make the call safe regardless of the values
4700 of the two variables, the size of the destination buffer must be increased
4701 to at least 34 bytes.  GCC includes the minimum size of the buffer in
4702 an informational note following the warning.
4704 An alternative to increasing the size of the destination buffer is to
4705 constrain the range of formatted values.  The maximum length of string
4706 arguments can be bounded by specifying the precision in the format
4707 directive.  When numeric arguments of format directives can be assumed
4708 to be bounded by less than the precision of their type, choosing
4709 an appropriate length modifier to the format specifier will reduce
4710 the required buffer size.  For example, if @var{a} and @var{b} in the
4711 example above can be assumed to be within the precision of
4712 the @code{short int} type then using either the @code{%hi} format
4713 directive or casting the argument to @code{short} reduces the maximum
4714 required size of the buffer to 24 bytes.
4716 @smallexample
4717 void f (int a, int b)
4719   char buf [23];
4720   sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4722 @end smallexample
4723 @end table
4725 @item -Wno-format-zero-length
4726 @opindex Wno-format-zero-length
4727 @opindex Wformat-zero-length
4728 If @option{-Wformat} is specified, do not warn about zero-length formats.
4729 The C standard specifies that zero-length formats are allowed.
4732 @item -Wformat=2
4733 @opindex Wformat=2
4734 Enable @option{-Wformat} plus additional format checks.  Currently
4735 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4736 -Wformat-y2k}.
4738 @item -Wformat-nonliteral
4739 @opindex Wformat-nonliteral
4740 @opindex Wno-format-nonliteral
4741 If @option{-Wformat} is specified, also warn if the format string is not a
4742 string literal and so cannot be checked, unless the format function
4743 takes its format arguments as a @code{va_list}.
4745 @item -Wformat-security
4746 @opindex Wformat-security
4747 @opindex Wno-format-security
4748 If @option{-Wformat} is specified, also warn about uses of format
4749 functions that represent possible security problems.  At present, this
4750 warns about calls to @code{printf} and @code{scanf} functions where the
4751 format string is not a string literal and there are no format arguments,
4752 as in @code{printf (foo);}.  This may be a security hole if the format
4753 string came from untrusted input and contains @samp{%n}.  (This is
4754 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4755 in future warnings may be added to @option{-Wformat-security} that are not
4756 included in @option{-Wformat-nonliteral}.)
4758 @item -Wformat-signedness
4759 @opindex Wformat-signedness
4760 @opindex Wno-format-signedness
4761 If @option{-Wformat} is specified, also warn if the format string
4762 requires an unsigned argument and the argument is signed and vice versa.
4764 @item -Wformat-truncation
4765 @itemx -Wformat-truncation=@var{level}
4766 @opindex Wformat-truncation
4767 @opindex Wno-format-truncation
4768 Warn about calls to formatted input/output functions such as @code{snprintf}
4769 and @code{vsnprintf} that might result in output truncation.  When the exact
4770 number of bytes written by a format directive cannot be determined at
4771 compile-time it is estimated based on heuristics that depend on
4772 the @var{level} argument and on optimization.  While enabling optimization
4773 will in most cases improve the accuracy of the warning, it may also result
4774 in false positives.  Except as noted otherwise, the option uses the same
4775 logic @option{-Wformat-overflow}.
4777 @table @gcctabopt
4778 @item -Wformat-truncation
4779 @itemx -Wformat-truncation=1
4780 @opindex Wformat-truncation
4781 @opindex Wno-format-truncation
4782 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4783 employs a conservative approach that warns only about calls to bounded
4784 functions whose return value is unused and that will most likely result
4785 in output truncation.
4787 @item -Wformat-truncation=2
4788 Level @var{2} warns also about calls to bounded functions whose return
4789 value is used and that might result in truncation given an argument of
4790 sufficient length or magnitude.
4791 @end table
4793 @item -Wformat-y2k
4794 @opindex Wformat-y2k
4795 @opindex Wno-format-y2k
4796 If @option{-Wformat} is specified, also warn about @code{strftime}
4797 formats that may yield only a two-digit year.
4798 @end table
4800 @item -Wnonnull
4801 @opindex Wnonnull
4802 @opindex Wno-nonnull
4803 Warn about passing a null pointer for arguments marked as
4804 requiring a non-null value by the @code{nonnull} function attribute.
4806 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
4807 can be disabled with the @option{-Wno-nonnull} option.
4809 @item -Wnonnull-compare
4810 @opindex Wnonnull-compare
4811 @opindex Wno-nonnull-compare
4812 Warn when comparing an argument marked with the @code{nonnull}
4813 function attribute against null inside the function.
4815 @option{-Wnonnull-compare} is included in @option{-Wall}.  It
4816 can be disabled with the @option{-Wno-nonnull-compare} option.
4818 @item -Wnull-dereference
4819 @opindex Wnull-dereference
4820 @opindex Wno-null-dereference
4821 Warn if the compiler detects paths that trigger erroneous or
4822 undefined behavior due to dereferencing a null pointer.  This option
4823 is only active when @option{-fdelete-null-pointer-checks} is active,
4824 which is enabled by optimizations in most targets.  The precision of
4825 the warnings depends on the optimization options used.
4827 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4828 @opindex Winaccessible-base
4829 @opindex Wno-inaccessible-base
4830 Warn when a base class is inaccessible in a class derived from it due to
4831 ambiguity.  The warning is enabled by default.  Note the warning for virtual
4832 bases is enabled by the @option{-Wextra} option.
4833 @smallexample
4834 @group
4835 struct A @{ int a; @};
4837 struct B : A @{ @};
4839 struct C : B, A @{ @};
4840 @end group
4841 @end smallexample
4843 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4844 @opindex Winit-self
4845 @opindex Wno-init-self
4846 Warn about uninitialized variables that are initialized with themselves.
4847 Note this option can only be used with the @option{-Wuninitialized} option.
4849 For example, GCC warns about @code{i} being uninitialized in the
4850 following snippet only when @option{-Winit-self} has been specified:
4851 @smallexample
4852 @group
4853 int f()
4855   int i = i;
4856   return i;
4858 @end group
4859 @end smallexample
4861 This warning is enabled by @option{-Wall} in C++.
4863 @item -Wimplicit-int @r{(C and Objective-C only)}
4864 @opindex Wimplicit-int
4865 @opindex Wno-implicit-int
4866 Warn when a declaration does not specify a type.
4867 This warning is enabled by @option{-Wall}.
4869 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4870 @opindex Wimplicit-function-declaration
4871 @opindex Wno-implicit-function-declaration
4872 Give a warning whenever a function is used before being declared. In
4873 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4874 enabled by default and it is made into an error by
4875 @option{-pedantic-errors}. This warning is also enabled by
4876 @option{-Wall}.
4878 @item -Wimplicit @r{(C and Objective-C only)}
4879 @opindex Wimplicit
4880 @opindex Wno-implicit
4881 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4882 This warning is enabled by @option{-Wall}.
4884 @item -Wimplicit-fallthrough
4885 @opindex Wimplicit-fallthrough
4886 @opindex Wno-implicit-fallthrough
4887 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4888 and @option{-Wno-implicit-fallthrough} is the same as
4889 @option{-Wimplicit-fallthrough=0}.
4891 @item -Wimplicit-fallthrough=@var{n}
4892 @opindex Wimplicit-fallthrough=
4893 Warn when a switch case falls through.  For example:
4895 @smallexample
4896 @group
4897 switch (cond)
4898   @{
4899   case 1:
4900     a = 1;
4901     break;
4902   case 2:
4903     a = 2;
4904   case 3:
4905     a = 3;
4906     break;
4907   @}
4908 @end group
4909 @end smallexample
4911 This warning does not warn when the last statement of a case cannot
4912 fall through, e.g. when there is a return statement or a call to function
4913 declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
4914 also takes into account control flow statements, such as ifs, and only
4915 warns when appropriate.  E.g.@:
4917 @smallexample
4918 @group
4919 switch (cond)
4920   @{
4921   case 1:
4922     if (i > 3) @{
4923       bar (5);
4924       break;
4925     @} else if (i < 1) @{
4926       bar (0);
4927     @} else
4928       return;
4929   default:
4930     @dots{}
4931   @}
4932 @end group
4933 @end smallexample
4935 Since there are occasions where a switch case fall through is desirable,
4936 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4937 to be used along with a null statement to suppress this warning that
4938 would normally occur:
4940 @smallexample
4941 @group
4942 switch (cond)
4943   @{
4944   case 1:
4945     bar (0);
4946     __attribute__ ((fallthrough));
4947   default:
4948     @dots{}
4949   @}
4950 @end group
4951 @end smallexample
4953 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4954 warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
4955 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4956 Instead of these attributes, it is also possible to add a fallthrough comment
4957 to silence the warning.  The whole body of the C or C++ style comment should
4958 match the given regular expressions listed below.  The option argument @var{n}
4959 specifies what kind of comments are accepted:
4961 @itemize @bullet
4963 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4965 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4966 expression, any comment is used as fallthrough comment.
4968 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4969 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4971 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4972 following regular expressions:
4974 @itemize @bullet
4976 @item @code{-fallthrough}
4978 @item @code{@@fallthrough@@}
4980 @item @code{lint -fallthrough[ \t]*}
4982 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4984 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4986 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4988 @end itemize
4990 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4991 following regular expressions:
4993 @itemize @bullet
4995 @item @code{-fallthrough}
4997 @item @code{@@fallthrough@@}
4999 @item @code{lint -fallthrough[ \t]*}
5001 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5003 @end itemize
5005 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5006 fallthrough comments, only attributes disable the warning.
5008 @end itemize
5010 The comment needs to be followed after optional whitespace and other comments
5011 by @code{case} or @code{default} keywords or by a user label that precedes some
5012 @code{case} or @code{default} label.
5014 @smallexample
5015 @group
5016 switch (cond)
5017   @{
5018   case 1:
5019     bar (0);
5020     /* FALLTHRU */
5021   default:
5022     @dots{}
5023   @}
5024 @end group
5025 @end smallexample
5027 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5029 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5030 @opindex Wif-not-aligned
5031 @opindex Wno-if-not-aligned
5032 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5033 should be issued.  This is enabled by default.
5034 Use @option{-Wno-if-not-aligned} to disable it.
5036 @item -Wignored-qualifiers @r{(C and C++ only)}
5037 @opindex Wignored-qualifiers
5038 @opindex Wno-ignored-qualifiers
5039 Warn if the return type of a function has a type qualifier
5040 such as @code{const}.  For ISO C such a type qualifier has no effect,
5041 since the value returned by a function is not an lvalue.
5042 For C++, the warning is only emitted for scalar types or @code{void}.
5043 ISO C prohibits qualified @code{void} return types on function
5044 definitions, so such return types always receive a warning
5045 even without this option.
5047 This warning is also enabled by @option{-Wextra}.
5049 @item -Wignored-attributes @r{(C and C++ only)}
5050 @opindex Wignored-attributes
5051 @opindex Wno-ignored-attributes
5052 Warn when an attribute is ignored.  This is different from the
5053 @option{-Wattributes} option in that it warns whenever the compiler decides
5054 to drop an attribute, not that the attribute is either unknown, used in a
5055 wrong place, etc.  This warning is enabled by default.
5057 @item -Wmain
5058 @opindex Wmain
5059 @opindex Wno-main
5060 Warn if the type of @code{main} is suspicious.  @code{main} should be
5061 a function with external linkage, returning int, taking either zero
5062 arguments, two, or three arguments of appropriate types.  This warning
5063 is enabled by default in C++ and is enabled by either @option{-Wall}
5064 or @option{-Wpedantic}.
5066 @item -Wmisleading-indentation @r{(C and C++ only)}
5067 @opindex Wmisleading-indentation
5068 @opindex Wno-misleading-indentation
5069 Warn when the indentation of the code does not reflect the block structure.
5070 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5071 @code{for} clauses with a guarded statement that does not use braces,
5072 followed by an unguarded statement with the same indentation.
5074 In the following example, the call to ``bar'' is misleadingly indented as
5075 if it were guarded by the ``if'' conditional.
5077 @smallexample
5078   if (some_condition ())
5079     foo ();
5080     bar ();  /* Gotcha: this is not guarded by the "if".  */
5081 @end smallexample
5083 In the case of mixed tabs and spaces, the warning uses the
5084 @option{-ftabstop=} option to determine if the statements line up
5085 (defaulting to 8).
5087 The warning is not issued for code involving multiline preprocessor logic
5088 such as the following example.
5090 @smallexample
5091   if (flagA)
5092     foo (0);
5093 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5094   if (flagB)
5095 #endif
5096     foo (1);
5097 @end smallexample
5099 The warning is not issued after a @code{#line} directive, since this
5100 typically indicates autogenerated code, and no assumptions can be made
5101 about the layout of the file that the directive references.
5103 This warning is enabled by @option{-Wall} in C and C++.
5105 @item -Wmissing-attributes
5106 @opindex Wmissing-attributes
5107 @opindex Wno-missing-attributes
5108 Warn when a declaration of a function is missing one or more attributes
5109 that a related function is declared with and whose absence may adversely
5110 affect the correctness or efficiency of generated code.  For example,
5111 the warning is issued for declarations of aliases that use attributes
5112 to specify less restrictive requirements than those of their targets.
5113 This typically represents a potential optimization opportunity.
5114 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5115 issued when the alias is more restrictive than the target, which could
5116 lead to incorrect code generation.
5117 Attributes considered include @code{alloc_align}, @code{alloc_size},
5118 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5119 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5120 @code{returns_nonnull}, and @code{returns_twice}.
5122 In C++, the warning is issued when an explicit specialization of a primary
5123 template declared with attribute @code{alloc_align}, @code{alloc_size},
5124 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5125 or @code{nonnull} is declared without it.  Attributes @code{deprecated},
5126 @code{error}, and @code{warning} suppress the warning.
5127 (@pxref{Function Attributes}).
5129 You can use the @code{copy} attribute to apply the same
5130 set of attributes to a declaration as that on another declaration without
5131 explicitly enumerating the attributes. This attribute can be applied
5132 to declarations of functions (@pxref{Common Function Attributes}),
5133 variables (@pxref{Common Variable Attributes}), or types
5134 (@pxref{Common Type Attributes}).
5136 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5138 For example, since the declaration of the primary function template
5139 below makes use of both attribute @code{malloc} and @code{alloc_size}
5140 the declaration of the explicit specialization of the template is
5141 diagnosed because it is missing one of the attributes.
5143 @smallexample
5144 template <class T>
5145 T* __attribute__ ((malloc, alloc_size (1)))
5146 allocate (size_t);
5148 template <>
5149 void* __attribute__ ((malloc))   // missing alloc_size
5150 allocate<void> (size_t);
5151 @end smallexample
5153 @item -Wmissing-braces
5154 @opindex Wmissing-braces
5155 @opindex Wno-missing-braces
5156 Warn if an aggregate or union initializer is not fully bracketed.  In
5157 the following example, the initializer for @code{a} is not fully
5158 bracketed, but that for @code{b} is fully bracketed.  This warning is
5159 enabled by @option{-Wall} in C.
5161 @smallexample
5162 int a[2][2] = @{ 0, 1, 2, 3 @};
5163 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5164 @end smallexample
5166 This warning is enabled by @option{-Wall}.
5168 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5169 @opindex Wmissing-include-dirs
5170 @opindex Wno-missing-include-dirs
5171 Warn if a user-supplied include directory does not exist.
5173 @item -Wmissing-profile
5174 @opindex Wmissing-profile
5175 @opindex Wno-missing-profile
5176 Warn if feedback profiles are missing when using the
5177 @option{-fprofile-use} option.
5178 This option diagnoses those cases where a new function or a new file is added
5179 to the user code between compiling with @option{-fprofile-generate} and with
5180 @option{-fprofile-use}, without regenerating the profiles.  In these cases, the
5181 profile feedback data files do not contain any profile feedback information for
5182 the newly added function or file respectively.  Also, in the case when profile
5183 count data (.gcda) files are removed, GCC cannot use any profile feedback
5184 information.  In all these cases, warnings are issued to inform the user that a
5185 profile generation step is due.  @option{-Wno-missing-profile} can be used to
5186 disable the warning.  Ignoring the warning can result in poorly optimized code.
5187 Completely disabling the warning is not recommended and should be done only
5188 when non-existent profile data is justified.
5190 @item -Wmultistatement-macros
5191 @opindex Wmultistatement-macros
5192 @opindex Wno-multistatement-macros
5193 Warn about unsafe multiple statement macros that appear to be guarded
5194 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5195 @code{while}, in which only the first statement is actually guarded after
5196 the macro is expanded.
5198 For example:
5200 @smallexample
5201 #define DOIT x++; y++
5202 if (c)
5203   DOIT;
5204 @end smallexample
5206 will increment @code{y} unconditionally, not just when @code{c} holds.
5207 The can usually be fixed by wrapping the macro in a do-while loop:
5208 @smallexample
5209 #define DOIT do @{ x++; y++; @} while (0)
5210 if (c)
5211   DOIT;
5212 @end smallexample
5214 This warning is enabled by @option{-Wall} in C and C++.
5216 @item -Wparentheses
5217 @opindex Wparentheses
5218 @opindex Wno-parentheses
5219 Warn if parentheses are omitted in certain contexts, such
5220 as when there is an assignment in a context where a truth value
5221 is expected, or when operators are nested whose precedence people
5222 often get confused about.
5224 Also warn if a comparison like @code{x<=y<=z} appears; this is
5225 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5226 interpretation from that of ordinary mathematical notation.
5228 Also warn for dangerous uses of the GNU extension to
5229 @code{?:} with omitted middle operand. When the condition
5230 in the @code{?}: operator is a boolean expression, the omitted value is
5231 always 1.  Often programmers expect it to be a value computed
5232 inside the conditional expression instead.
5234 For C++ this also warns for some cases of unnecessary parentheses in
5235 declarations, which can indicate an attempt at a function call instead
5236 of a declaration:
5237 @smallexample
5239   // Declares a local variable called mymutex.
5240   std::unique_lock<std::mutex> (mymutex);
5241   // User meant std::unique_lock<std::mutex> lock (mymutex);
5243 @end smallexample
5245 This warning is enabled by @option{-Wall}.
5247 @item -Wsequence-point
5248 @opindex Wsequence-point
5249 @opindex Wno-sequence-point
5250 Warn about code that may have undefined semantics because of violations
5251 of sequence point rules in the C and C++ standards.
5253 The C and C++ standards define the order in which expressions in a C/C++
5254 program are evaluated in terms of @dfn{sequence points}, which represent
5255 a partial ordering between the execution of parts of the program: those
5256 executed before the sequence point, and those executed after it.  These
5257 occur after the evaluation of a full expression (one which is not part
5258 of a larger expression), after the evaluation of the first operand of a
5259 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5260 function is called (but after the evaluation of its arguments and the
5261 expression denoting the called function), and in certain other places.
5262 Other than as expressed by the sequence point rules, the order of
5263 evaluation of subexpressions of an expression is not specified.  All
5264 these rules describe only a partial order rather than a total order,
5265 since, for example, if two functions are called within one expression
5266 with no sequence point between them, the order in which the functions
5267 are called is not specified.  However, the standards committee have
5268 ruled that function calls do not overlap.
5270 It is not specified when between sequence points modifications to the
5271 values of objects take effect.  Programs whose behavior depends on this
5272 have undefined behavior; the C and C++ standards specify that ``Between
5273 the previous and next sequence point an object shall have its stored
5274 value modified at most once by the evaluation of an expression.
5275 Furthermore, the prior value shall be read only to determine the value
5276 to be stored.''.  If a program breaks these rules, the results on any
5277 particular implementation are entirely unpredictable.
5279 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5280 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
5281 diagnosed by this option, and it may give an occasional false positive
5282 result, but in general it has been found fairly effective at detecting
5283 this sort of problem in programs.
5285 The C++17 standard will define the order of evaluation of operands in
5286 more cases: in particular it requires that the right-hand side of an
5287 assignment be evaluated before the left-hand side, so the above
5288 examples are no longer undefined.  But this warning will still warn
5289 about them, to help people avoid writing code that is undefined in C
5290 and earlier revisions of C++.
5292 The standard is worded confusingly, therefore there is some debate
5293 over the precise meaning of the sequence point rules in subtle cases.
5294 Links to discussions of the problem, including proposed formal
5295 definitions, may be found on the GCC readings page, at
5296 @uref{http://gcc.gnu.org/@/readings.html}.
5298 This warning is enabled by @option{-Wall} for C and C++.
5300 @item -Wno-return-local-addr
5301 @opindex Wno-return-local-addr
5302 @opindex Wreturn-local-addr
5303 Do not warn about returning a pointer (or in C++, a reference) to a
5304 variable that goes out of scope after the function returns.
5306 @item -Wreturn-type
5307 @opindex Wreturn-type
5308 @opindex Wno-return-type
5309 Warn whenever a function is defined with a return type that defaults
5310 to @code{int}.  Also warn about any @code{return} statement with no
5311 return value in a function whose return type is not @code{void}
5312 (falling off the end of the function body is considered returning
5313 without a value).
5315 For C only, warn about a @code{return} statement with an expression in a
5316 function whose return type is @code{void}, unless the expression type is
5317 also @code{void}.  As a GNU extension, the latter case is accepted
5318 without a warning unless @option{-Wpedantic} is used.  Attempting
5319 to use the return value of a non-@code{void} function other than @code{main}
5320 that flows off the end by reaching the closing curly brace that terminates
5321 the function is undefined.
5323 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5324 than @code{main} results in undefined behavior even when the value of
5325 the function is not used.
5327 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5329 @item -Wshift-count-negative
5330 @opindex Wshift-count-negative
5331 @opindex Wno-shift-count-negative
5332 Warn if shift count is negative. This warning is enabled by default.
5334 @item -Wshift-count-overflow
5335 @opindex Wshift-count-overflow
5336 @opindex Wno-shift-count-overflow
5337 Warn if shift count >= width of type. This warning is enabled by default.
5339 @item -Wshift-negative-value
5340 @opindex Wshift-negative-value
5341 @opindex Wno-shift-negative-value
5342 Warn if left shifting a negative value.  This warning is enabled by
5343 @option{-Wextra} in C99 and C++11 modes (and newer).
5345 @item -Wshift-overflow
5346 @itemx -Wshift-overflow=@var{n}
5347 @opindex Wshift-overflow
5348 @opindex Wno-shift-overflow
5349 Warn about left shift overflows.  This warning is enabled by
5350 default in C99 and C++11 modes (and newer).
5352 @table @gcctabopt
5353 @item -Wshift-overflow=1
5354 This is the warning level of @option{-Wshift-overflow} and is enabled
5355 by default in C99 and C++11 modes (and newer).  This warning level does
5356 not warn about left-shifting 1 into the sign bit.  (However, in C, such
5357 an overflow is still rejected in contexts where an integer constant expression
5358 is required.)  No warning is emitted in C++2A mode (and newer), as signed left
5359 shifts always wrap.
5361 @item -Wshift-overflow=2
5362 This warning level also warns about left-shifting 1 into the sign bit,
5363 unless C++14 mode (or newer) is active.
5364 @end table
5366 @item -Wswitch
5367 @opindex Wswitch
5368 @opindex Wno-switch
5369 Warn whenever a @code{switch} statement has an index of enumerated type
5370 and lacks a @code{case} for one or more of the named codes of that
5371 enumeration.  (The presence of a @code{default} label prevents this
5372 warning.)  @code{case} labels outside the enumeration range also
5373 provoke warnings when this option is used (even if there is a
5374 @code{default} label).
5375 This warning is enabled by @option{-Wall}.
5377 @item -Wswitch-default
5378 @opindex Wswitch-default
5379 @opindex Wno-switch-default
5380 Warn whenever a @code{switch} statement does not have a @code{default}
5381 case.
5383 @item -Wswitch-enum
5384 @opindex Wswitch-enum
5385 @opindex Wno-switch-enum
5386 Warn whenever a @code{switch} statement has an index of enumerated type
5387 and lacks a @code{case} for one or more of the named codes of that
5388 enumeration.  @code{case} labels outside the enumeration range also
5389 provoke warnings when this option is used.  The only difference
5390 between @option{-Wswitch} and this option is that this option gives a
5391 warning about an omitted enumeration code even if there is a
5392 @code{default} label.
5394 @item -Wswitch-bool
5395 @opindex Wswitch-bool
5396 @opindex Wno-switch-bool
5397 Warn whenever a @code{switch} statement has an index of boolean type
5398 and the case values are outside the range of a boolean type.
5399 It is possible to suppress this warning by casting the controlling
5400 expression to a type other than @code{bool}.  For example:
5401 @smallexample
5402 @group
5403 switch ((int) (a == 4))
5404   @{
5405   @dots{}
5406   @}
5407 @end group
5408 @end smallexample
5409 This warning is enabled by default for C and C++ programs.
5411 @item -Wswitch-outside-range
5412 @opindex Wswitch-outside-range
5413 @opindex Wno-switch-outside-range
5414 Warn whenever a @code{switch} case has a value that is outside of its
5415 respective type range.  This warning is enabled by default for
5416 C and C++ programs.
5418 @item -Wswitch-unreachable
5419 @opindex Wswitch-unreachable
5420 @opindex Wno-switch-unreachable
5421 Warn whenever a @code{switch} statement contains statements between the
5422 controlling expression and the first case label, which will never be
5423 executed.  For example:
5424 @smallexample
5425 @group
5426 switch (cond)
5427   @{
5428    i = 15;
5429   @dots{}
5430    case 5:
5431   @dots{}
5432   @}
5433 @end group
5434 @end smallexample
5435 @option{-Wswitch-unreachable} does not warn if the statement between the
5436 controlling expression and the first case label is just a declaration:
5437 @smallexample
5438 @group
5439 switch (cond)
5440   @{
5441    int i;
5442   @dots{}
5443    case 5:
5444    i = 5;
5445   @dots{}
5446   @}
5447 @end group
5448 @end smallexample
5449 This warning is enabled by default for C and C++ programs.
5451 @item -Wsync-nand @r{(C and C++ only)}
5452 @opindex Wsync-nand
5453 @opindex Wno-sync-nand
5454 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5455 built-in functions are used.  These functions changed semantics in GCC 4.4.
5457 @item -Wunused-but-set-parameter
5458 @opindex Wunused-but-set-parameter
5459 @opindex Wno-unused-but-set-parameter
5460 Warn whenever a function parameter is assigned to, but otherwise unused
5461 (aside from its declaration).
5463 To suppress this warning use the @code{unused} attribute
5464 (@pxref{Variable Attributes}).
5466 This warning is also enabled by @option{-Wunused} together with
5467 @option{-Wextra}.
5469 @item -Wunused-but-set-variable
5470 @opindex Wunused-but-set-variable
5471 @opindex Wno-unused-but-set-variable
5472 Warn whenever a local variable is assigned to, but otherwise unused
5473 (aside from its declaration).
5474 This warning is enabled by @option{-Wall}.
5476 To suppress this warning use the @code{unused} attribute
5477 (@pxref{Variable Attributes}).
5479 This warning is also enabled by @option{-Wunused}, which is enabled
5480 by @option{-Wall}.
5482 @item -Wunused-function
5483 @opindex Wunused-function
5484 @opindex Wno-unused-function
5485 Warn whenever a static function is declared but not defined or a
5486 non-inline static function is unused.
5487 This warning is enabled by @option{-Wall}.
5489 @item -Wunused-label
5490 @opindex Wunused-label
5491 @opindex Wno-unused-label
5492 Warn whenever a label is declared but not used.
5493 This warning is enabled by @option{-Wall}.
5495 To suppress this warning use the @code{unused} attribute
5496 (@pxref{Variable Attributes}).
5498 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5499 @opindex Wunused-local-typedefs
5500 @opindex Wno-unused-local-typedefs
5501 Warn when a typedef locally defined in a function is not used.
5502 This warning is enabled by @option{-Wall}.
5504 @item -Wunused-parameter
5505 @opindex Wunused-parameter
5506 @opindex Wno-unused-parameter
5507 Warn whenever a function parameter is unused aside from its declaration.
5509 To suppress this warning use the @code{unused} attribute
5510 (@pxref{Variable Attributes}).
5512 @item -Wno-unused-result
5513 @opindex Wunused-result
5514 @opindex Wno-unused-result
5515 Do not warn if a caller of a function marked with attribute
5516 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5517 its return value. The default is @option{-Wunused-result}.
5519 @item -Wunused-variable
5520 @opindex Wunused-variable
5521 @opindex Wno-unused-variable
5522 Warn whenever a local or static variable is unused aside from its
5523 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5524 but not for C++. This warning is enabled by @option{-Wall}.
5526 To suppress this warning use the @code{unused} attribute
5527 (@pxref{Variable Attributes}).
5529 @item -Wunused-const-variable
5530 @itemx -Wunused-const-variable=@var{n}
5531 @opindex Wunused-const-variable
5532 @opindex Wno-unused-const-variable
5533 Warn whenever a constant static variable is unused aside from its declaration.
5534 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5535 for C, but not for C++. In C this declares variable storage, but in C++ this
5536 is not an error since const variables take the place of @code{#define}s.
5538 To suppress this warning use the @code{unused} attribute
5539 (@pxref{Variable Attributes}).
5541 @table @gcctabopt
5542 @item -Wunused-const-variable=1
5543 This is the warning level that is enabled by @option{-Wunused-variable} for
5544 C.  It warns only about unused static const variables defined in the main
5545 compilation unit, but not about static const variables declared in any
5546 header included.
5548 @item -Wunused-const-variable=2
5549 This warning level also warns for unused constant static variables in
5550 headers (excluding system headers).  This is the warning level of
5551 @option{-Wunused-const-variable} and must be explicitly requested since
5552 in C++ this isn't an error and in C it might be harder to clean up all
5553 headers included.
5554 @end table
5556 @item -Wunused-value
5557 @opindex Wunused-value
5558 @opindex Wno-unused-value
5559 Warn whenever a statement computes a result that is explicitly not
5560 used. To suppress this warning cast the unused expression to
5561 @code{void}. This includes an expression-statement or the left-hand
5562 side of a comma expression that contains no side effects. For example,
5563 an expression such as @code{x[i,j]} causes a warning, while
5564 @code{x[(void)i,j]} does not.
5566 This warning is enabled by @option{-Wall}.
5568 @item -Wunused
5569 @opindex Wunused
5570 @opindex Wno-unused
5571 All the above @option{-Wunused} options combined.
5573 In order to get a warning about an unused function parameter, you must
5574 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5575 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5577 @item -Wuninitialized
5578 @opindex Wuninitialized
5579 @opindex Wno-uninitialized
5580 Warn if an automatic variable is used without first being initialized
5581 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5582 warn if a non-static reference or non-static @code{const} member
5583 appears in a class without constructors.
5585 If you want to warn about code that uses the uninitialized value of the
5586 variable in its own initializer, use the @option{-Winit-self} option.
5588 These warnings occur for individual uninitialized or clobbered
5589 elements of structure, union or array variables as well as for
5590 variables that are uninitialized or clobbered as a whole.  They do
5591 not occur for variables or elements declared @code{volatile}.  Because
5592 these warnings depend on optimization, the exact variables or elements
5593 for which there are warnings depends on the precise optimization
5594 options and version of GCC used.
5596 Note that there may be no warning about a variable that is used only
5597 to compute a value that itself is never used, because such
5598 computations may be deleted by data flow analysis before the warnings
5599 are printed.
5601 @item -Winvalid-memory-model
5602 @opindex Winvalid-memory-model
5603 @opindex Wno-invalid-memory-model
5604 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5605 and the C11 atomic generic functions with a memory consistency argument
5606 that is either invalid for the operation or outside the range of values
5607 of the @code{memory_order} enumeration.  For example, since the
5608 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5609 defined for the relaxed, release, and sequentially consistent memory
5610 orders the following code is diagnosed:
5612 @smallexample
5613 void store (int *i)
5615   __atomic_store_n (i, 0, memory_order_consume);
5617 @end smallexample
5619 @option{-Winvalid-memory-model} is enabled by default.
5621 @item -Wmaybe-uninitialized
5622 @opindex Wmaybe-uninitialized
5623 @opindex Wno-maybe-uninitialized
5624 For an automatic (i.e.@: local) variable, if there exists a path from the
5625 function entry to a use of the variable that is initialized, but there exist
5626 some other paths for which the variable is not initialized, the compiler
5627 emits a warning if it cannot prove the uninitialized paths are not
5628 executed at run time.
5630 These warnings are only possible in optimizing compilation, because otherwise
5631 GCC does not keep track of the state of variables.
5633 These warnings are made optional because GCC may not be able to determine when
5634 the code is correct in spite of appearing to have an error.  Here is one
5635 example of how this can happen:
5637 @smallexample
5638 @group
5640   int x;
5641   switch (y)
5642     @{
5643     case 1: x = 1;
5644       break;
5645     case 2: x = 4;
5646       break;
5647     case 3: x = 5;
5648     @}
5649   foo (x);
5651 @end group
5652 @end smallexample
5654 @noindent
5655 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5656 always initialized, but GCC doesn't know this. To suppress the
5657 warning, you need to provide a default case with assert(0) or
5658 similar code.
5660 @cindex @code{longjmp} warnings
5661 This option also warns when a non-volatile automatic variable might be
5662 changed by a call to @code{longjmp}.
5663 The compiler sees only the calls to @code{setjmp}.  It cannot know
5664 where @code{longjmp} will be called; in fact, a signal handler could
5665 call it at any point in the code.  As a result, you may get a warning
5666 even when there is in fact no problem because @code{longjmp} cannot
5667 in fact be called at the place that would cause a problem.
5669 Some spurious warnings can be avoided if you declare all the functions
5670 you use that never return as @code{noreturn}.  @xref{Function
5671 Attributes}.
5673 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5675 @item -Wunknown-pragmas
5676 @opindex Wunknown-pragmas
5677 @opindex Wno-unknown-pragmas
5678 @cindex warning for unknown pragmas
5679 @cindex unknown pragmas, warning
5680 @cindex pragmas, warning of unknown
5681 Warn when a @code{#pragma} directive is encountered that is not understood by 
5682 GCC@.  If this command-line option is used, warnings are even issued
5683 for unknown pragmas in system header files.  This is not the case if
5684 the warnings are only enabled by the @option{-Wall} command-line option.
5686 @item -Wno-pragmas
5687 @opindex Wno-pragmas
5688 @opindex Wpragmas
5689 Do not warn about misuses of pragmas, such as incorrect parameters,
5690 invalid syntax, or conflicts between pragmas.  See also
5691 @option{-Wunknown-pragmas}.
5693 @item -Wno-prio-ctor-dtor
5694 @opindex Wno-prio-ctor-dtor
5695 @opindex Wprio-ctor-dtor
5696 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5697 The use of constructor and destructor attributes allow you to assign a
5698 priority to the constructor/destructor to control its order of execution
5699 before @code{main} is called or after it returns.  The priority values must be
5700 greater than 100 as the compiler reserves priority values between 0--100 for
5701 the implementation.
5703 @item -Wstrict-aliasing
5704 @opindex Wstrict-aliasing
5705 @opindex Wno-strict-aliasing
5706 This option is only active when @option{-fstrict-aliasing} is active.
5707 It warns about code that might break the strict aliasing rules that the
5708 compiler is using for optimization.  The warning does not catch all
5709 cases, but does attempt to catch the more common pitfalls.  It is
5710 included in @option{-Wall}.
5711 It is equivalent to @option{-Wstrict-aliasing=3}
5713 @item -Wstrict-aliasing=n
5714 @opindex Wstrict-aliasing=n
5715 This option is only active when @option{-fstrict-aliasing} is active.
5716 It warns about code that might break the strict aliasing rules that the
5717 compiler is using for optimization.
5718 Higher levels correspond to higher accuracy (fewer false positives).
5719 Higher levels also correspond to more effort, similar to the way @option{-O} 
5720 works.
5721 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5723 Level 1: Most aggressive, quick, least accurate.
5724 Possibly useful when higher levels
5725 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5726 false negatives.  However, it has many false positives.
5727 Warns for all pointer conversions between possibly incompatible types,
5728 even if never dereferenced.  Runs in the front end only.
5730 Level 2: Aggressive, quick, not too precise.
5731 May still have many false positives (not as many as level 1 though),
5732 and few false negatives (but possibly more than level 1).
5733 Unlike level 1, it only warns when an address is taken.  Warns about
5734 incomplete types.  Runs in the front end only.
5736 Level 3 (default for @option{-Wstrict-aliasing}):
5737 Should have very few false positives and few false
5738 negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
5739 Takes care of the common pun+dereference pattern in the front end:
5740 @code{*(int*)&some_float}.
5741 If optimization is enabled, it also runs in the back end, where it deals
5742 with multiple statement cases using flow-sensitive points-to information.
5743 Only warns when the converted pointer is dereferenced.
5744 Does not warn about incomplete types.
5746 @item -Wstrict-overflow
5747 @itemx -Wstrict-overflow=@var{n}
5748 @opindex Wstrict-overflow
5749 @opindex Wno-strict-overflow
5750 This option is only active when signed overflow is undefined.
5751 It warns about cases where the compiler optimizes based on the
5752 assumption that signed overflow does not occur.  Note that it does not
5753 warn about all cases where the code might overflow: it only warns
5754 about cases where the compiler implements some optimization.  Thus
5755 this warning depends on the optimization level.
5757 An optimization that assumes that signed overflow does not occur is
5758 perfectly safe if the values of the variables involved are such that
5759 overflow never does, in fact, occur.  Therefore this warning can
5760 easily give a false positive: a warning about code that is not
5761 actually a problem.  To help focus on important issues, several
5762 warning levels are defined.  No warnings are issued for the use of
5763 undefined signed overflow when estimating how many iterations a loop
5764 requires, in particular when determining whether a loop will be
5765 executed at all.
5767 @table @gcctabopt
5768 @item -Wstrict-overflow=1
5769 Warn about cases that are both questionable and easy to avoid.  For
5770 example the compiler simplifies
5771 @code{x + 1 > x} to @code{1}.  This level of
5772 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5773 are not, and must be explicitly requested.
5775 @item -Wstrict-overflow=2
5776 Also warn about other cases where a comparison is simplified to a
5777 constant.  For example: @code{abs (x) >= 0}.  This can only be
5778 simplified when signed integer overflow is undefined, because
5779 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5780 zero.  @option{-Wstrict-overflow} (with no level) is the same as
5781 @option{-Wstrict-overflow=2}.
5783 @item -Wstrict-overflow=3
5784 Also warn about other cases where a comparison is simplified.  For
5785 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5787 @item -Wstrict-overflow=4
5788 Also warn about other simplifications not covered by the above cases.
5789 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5791 @item -Wstrict-overflow=5
5792 Also warn about cases where the compiler reduces the magnitude of a
5793 constant involved in a comparison.  For example: @code{x + 2 > y} is
5794 simplified to @code{x + 1 >= y}.  This is reported only at the
5795 highest warning level because this simplification applies to many
5796 comparisons, so this warning level gives a very large number of
5797 false positives.
5798 @end table
5800 @item -Wstringop-overflow
5801 @itemx -Wstringop-overflow=@var{type}
5802 @opindex Wstringop-overflow
5803 @opindex Wno-stringop-overflow
5804 Warn for calls to string manipulation functions such as @code{memcpy} and
5805 @code{strcpy} that are determined to overflow the destination buffer.  The
5806 optional argument is one greater than the type of Object Size Checking to
5807 perform to determine the size of the destination.  @xref{Object Size Checking}.
5808 The argument is meaningful only for functions that operate on character arrays
5809 but not for raw memory functions like @code{memcpy} which always make use
5810 of Object Size type-0.  The option also warns for calls that specify a size
5811 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5812 The option produces the best results with optimization enabled but can detect
5813 a small subset of simple buffer overflows even without optimization in
5814 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5815 correspond to the standard functions.  In any case, the option warns about
5816 just a subset of buffer overflows detected by the corresponding overflow
5817 checking built-ins.  For example, the option will issue a warning for
5818 the @code{strcpy} call below because it copies at least 5 characters
5819 (the string @code{"blue"} including the terminating NUL) into the buffer
5820 of size 4.
5822 @smallexample
5823 enum Color @{ blue, purple, yellow @};
5824 const char* f (enum Color clr)
5826   static char buf [4];
5827   const char *str;
5828   switch (clr)
5829     @{
5830       case blue: str = "blue"; break;
5831       case purple: str = "purple"; break;
5832       case yellow: str = "yellow"; break;
5833     @}
5835   return strcpy (buf, str);   // warning here
5837 @end smallexample
5839 Option @option{-Wstringop-overflow=2} is enabled by default.
5841 @table @gcctabopt
5842 @item -Wstringop-overflow
5843 @itemx -Wstringop-overflow=1
5844 @opindex Wstringop-overflow
5845 @opindex Wno-stringop-overflow
5846 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5847 to determine the sizes of destination objects.  This is the default setting
5848 of the option.  At this setting the option will not warn for writes past
5849 the end of subobjects of larger objects accessed by pointers unless the
5850 size of the largest surrounding object is known.  When the destination may
5851 be one of several objects it is assumed to be the largest one of them.  On
5852 Linux systems, when optimization is enabled at this setting the option warns
5853 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5854 a non-zero value.
5856 @item -Wstringop-overflow=2
5857 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5858 to determine the sizes of destination objects.  At this setting the option
5859 will warn about overflows when writing to members of the largest complete
5860 objects whose exact size is known.  It will, however, not warn for excessive
5861 writes to the same members of unknown objects referenced by pointers since
5862 they may point to arrays containing unknown numbers of elements.
5864 @item -Wstringop-overflow=3
5865 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5866 to determine the sizes of destination objects.  At this setting the option
5867 warns about overflowing the smallest object or data member.  This is the
5868 most restrictive setting of the option that may result in warnings for safe
5869 code.
5871 @item -Wstringop-overflow=4
5872 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5873 to determine the sizes of destination objects.  At this setting the option
5874 will warn about overflowing any data members, and when the destination is
5875 one of several objects it uses the size of the largest of them to decide
5876 whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
5877 setting of the option may result in warnings for benign code.
5878 @end table
5880 @item -Wstringop-truncation
5881 @opindex Wstringop-truncation
5882 @opindex Wno-stringop-truncation
5883 Warn for calls to bounded string manipulation functions such as @code{strncat},
5884 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5885 or leave the destination unchanged.
5887 In the following example, the call to @code{strncat} specifies a bound that
5888 is less than the length of the source string.  As a result, the copy of
5889 the source will be truncated and so the call is diagnosed.  To avoid the
5890 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5892 @smallexample
5893 void append (char *buf, size_t bufsize)
5895   strncat (buf, ".txt", 3);
5897 @end smallexample
5899 As another example, the following call to @code{strncpy} results in copying
5900 to @code{d} just the characters preceding the terminating NUL, without
5901 appending the NUL to the end.  Assuming the result of @code{strncpy} is
5902 necessarily a NUL-terminated string is a common mistake, and so the call
5903 is diagnosed.  To avoid the warning when the result is not expected to be
5904 NUL-terminated, call @code{memcpy} instead.
5906 @smallexample
5907 void copy (char *d, const char *s)
5909   strncpy (d, s, strlen (s));
5911 @end smallexample
5913 In the following example, the call to @code{strncpy} specifies the size
5914 of the destination buffer as the bound.  If the length of the source
5915 string is equal to or greater than this size the result of the copy will
5916 not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
5917 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5918 element of the buffer to @code{NUL}.
5920 @smallexample
5921 void copy (const char *s)
5923   char buf[80];
5924   strncpy (buf, s, sizeof buf);
5925   @dots{}
5927 @end smallexample
5929 In situations where a character array is intended to store a sequence
5930 of bytes with no terminating @code{NUL} such an array may be annotated
5931 with attribute @code{nonstring} to avoid this warning.  Such arrays,
5932 however, are not suitable arguments to functions that expect
5933 @code{NUL}-terminated strings.  To help detect accidental misuses of
5934 such arrays GCC issues warnings unless it can prove that the use is
5935 safe.  @xref{Common Variable Attributes}.
5937 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5938 @opindex Wsuggest-attribute=
5939 @opindex Wno-suggest-attribute=
5940 Warn for cases where adding an attribute may be beneficial. The
5941 attributes currently supported are listed below.
5943 @table @gcctabopt
5944 @item -Wsuggest-attribute=pure
5945 @itemx -Wsuggest-attribute=const
5946 @itemx -Wsuggest-attribute=noreturn
5947 @itemx -Wmissing-noreturn
5948 @itemx -Wsuggest-attribute=malloc
5949 @opindex Wsuggest-attribute=pure
5950 @opindex Wno-suggest-attribute=pure
5951 @opindex Wsuggest-attribute=const
5952 @opindex Wno-suggest-attribute=const
5953 @opindex Wsuggest-attribute=noreturn
5954 @opindex Wno-suggest-attribute=noreturn
5955 @opindex Wmissing-noreturn
5956 @opindex Wno-missing-noreturn
5957 @opindex Wsuggest-attribute=malloc
5958 @opindex Wno-suggest-attribute=malloc
5960 Warn about functions that might be candidates for attributes
5961 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5962 only warns for functions visible in other compilation units or (in the case of
5963 @code{pure} and @code{const}) if it cannot prove that the function returns
5964 normally. A function returns normally if it doesn't contain an infinite loop or
5965 return abnormally by throwing, calling @code{abort} or trapping.  This analysis
5966 requires option @option{-fipa-pure-const}, which is enabled by default at
5967 @option{-O} and higher.  Higher optimization levels improve the accuracy
5968 of the analysis.
5970 @item -Wsuggest-attribute=format
5971 @itemx -Wmissing-format-attribute
5972 @opindex Wsuggest-attribute=format
5973 @opindex Wmissing-format-attribute
5974 @opindex Wno-suggest-attribute=format
5975 @opindex Wno-missing-format-attribute
5976 @opindex Wformat
5977 @opindex Wno-format
5979 Warn about function pointers that might be candidates for @code{format}
5980 attributes.  Note these are only possible candidates, not absolute ones.
5981 GCC guesses that function pointers with @code{format} attributes that
5982 are used in assignment, initialization, parameter passing or return
5983 statements should have a corresponding @code{format} attribute in the
5984 resulting type.  I.e.@: the left-hand side of the assignment or
5985 initialization, the type of the parameter variable, or the return type
5986 of the containing function respectively should also have a @code{format}
5987 attribute to avoid the warning.
5989 GCC also warns about function definitions that might be
5990 candidates for @code{format} attributes.  Again, these are only
5991 possible candidates.  GCC guesses that @code{format} attributes
5992 might be appropriate for any function that calls a function like
5993 @code{vprintf} or @code{vscanf}, but this might not always be the
5994 case, and some functions for which @code{format} attributes are
5995 appropriate may not be detected.
5997 @item -Wsuggest-attribute=cold
5998 @opindex Wsuggest-attribute=cold
5999 @opindex Wno-suggest-attribute=cold
6001 Warn about functions that might be candidates for @code{cold} attribute.  This
6002 is based on static detection and generally will only warn about functions which
6003 always leads to a call to another @code{cold} function such as wrappers of
6004 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6005 @end table
6007 @item -Wsuggest-final-types
6008 @opindex Wno-suggest-final-types
6009 @opindex Wsuggest-final-types
6010 Warn about types with virtual methods where code quality would be improved
6011 if the type were declared with the C++11 @code{final} specifier, 
6012 or, if possible,
6013 declared in an anonymous namespace. This allows GCC to more aggressively
6014 devirtualize the polymorphic calls. This warning is more effective with 
6015 link-time optimization, 
6016 where the information about the class hierarchy graph is
6017 more complete.
6019 @item -Wsuggest-final-methods
6020 @opindex Wno-suggest-final-methods
6021 @opindex Wsuggest-final-methods
6022 Warn about virtual methods where code quality would be improved if the method
6023 were declared with the C++11 @code{final} specifier, 
6024 or, if possible, its type were
6025 declared in an anonymous namespace or with the @code{final} specifier.
6026 This warning is
6027 more effective with link-time optimization, where the information about the
6028 class hierarchy graph is more complete. It is recommended to first consider
6029 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6030 annotations.
6032 @item -Wsuggest-override
6033 Warn about overriding virtual functions that are not marked with the override
6034 keyword.
6036 @item -Walloc-zero
6037 @opindex Wno-alloc-zero
6038 @opindex Walloc-zero
6039 Warn about calls to allocation functions decorated with attribute
6040 @code{alloc_size} that specify zero bytes, including those to the built-in
6041 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6042 @code{malloc}, and @code{realloc}.  Because the behavior of these functions
6043 when called with a zero size differs among implementations (and in the case
6044 of @code{realloc} has been deprecated) relying on it may result in subtle
6045 portability bugs and should be avoided.
6047 @item -Walloc-size-larger-than=@var{byte-size}
6048 @opindex Walloc-size-larger-than=
6049 @opindex Wno-alloc-size-larger-than
6050 Warn about calls to functions decorated with attribute @code{alloc_size}
6051 that attempt to allocate objects larger than the specified number of bytes,
6052 or where the result of the size computation in an integer type with infinite
6053 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6054 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6055 Warnings controlled by the option can be disabled either by specifying
6056 @var{byte-size} of @samp{SIZE_MAX} or more or by
6057 @option{-Wno-alloc-size-larger-than}.
6058 @xref{Function Attributes}.
6060 @item -Wno-alloc-size-larger-than
6061 @opindex Wno-alloc-size-larger-than
6062 Disable @option{-Walloc-size-larger-than=} warnings.  The option is
6063 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6064 larger.
6066 @item -Walloca
6067 @opindex Wno-alloca
6068 @opindex Walloca
6069 This option warns on all uses of @code{alloca} in the source.
6071 @item -Walloca-larger-than=@var{byte-size}
6072 @opindex Walloca-larger-than=
6073 @opindex Wno-alloca-larger-than
6074 This option warns on calls to @code{alloca} with an integer argument whose
6075 value is either zero, or that is not bounded by a controlling predicate
6076 that limits its value to at most @var{byte-size}.  It also warns for calls
6077 to @code{alloca} where the bound value is unknown.  Arguments of non-integer
6078 types are considered unbounded even if they appear to be constrained to
6079 the expected range.
6081 For example, a bounded case of @code{alloca} could be:
6083 @smallexample
6084 void func (size_t n)
6086   void *p;
6087   if (n <= 1000)
6088     p = alloca (n);
6089   else
6090     p = malloc (n);
6091   f (p);
6093 @end smallexample
6095 In the above example, passing @code{-Walloca-larger-than=1000} would not
6096 issue a warning because the call to @code{alloca} is known to be at most
6097 1000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
6098 the compiler would emit a warning.
6100 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6101 controlling predicate constraining its integer argument.  For example:
6103 @smallexample
6104 void func ()
6106   void *p = alloca (n);
6107   f (p);
6109 @end smallexample
6111 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6112 a warning, but this time because of the lack of bounds checking.
6114 Note, that even seemingly correct code involving signed integers could
6115 cause a warning:
6117 @smallexample
6118 void func (signed int n)
6120   if (n < 500)
6121     @{
6122       p = alloca (n);
6123       f (p);
6124     @}
6126 @end smallexample
6128 In the above example, @var{n} could be negative, causing a larger than
6129 expected argument to be implicitly cast into the @code{alloca} call.
6131 This option also warns when @code{alloca} is used in a loop.
6133 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6134 but is usually only effective  when @option{-ftree-vrp} is active (default
6135 for @option{-O2} and above).
6137 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6139 @item -Wno-alloca-larger-than
6140 @opindex Wno-alloca-larger-than
6141 Disable @option{-Walloca-larger-than=} warnings.  The option is
6142 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6144 @item -Warray-bounds
6145 @itemx -Warray-bounds=@var{n}
6146 @opindex Wno-array-bounds
6147 @opindex Warray-bounds
6148 This option is only active when @option{-ftree-vrp} is active
6149 (default for @option{-O2} and above). It warns about subscripts to arrays
6150 that are always out of bounds. This warning is enabled by @option{-Wall}.
6152 @table @gcctabopt
6153 @item -Warray-bounds=1
6154 This is the warning level of @option{-Warray-bounds} and is enabled
6155 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6157 @item -Warray-bounds=2
6158 This warning level also warns about out of bounds access for
6159 arrays at the end of a struct and for arrays accessed through
6160 pointers. This warning level may give a larger number of
6161 false positives and is deactivated by default.
6162 @end table
6164 @item -Wattribute-alias=@var{n}
6165 @itemx -Wno-attribute-alias
6166 @opindex Wattribute-alias
6167 @opindex Wno-attribute-alias
6168 Warn about declarations using the @code{alias} and similar attributes whose
6169 target is incompatible with the type of the alias.
6170 @xref{Function Attributes,,Declaring Attributes of Functions}.
6172 @table @gcctabopt
6173 @item -Wattribute-alias=1
6174 The default warning level of the @option{-Wattribute-alias} option diagnoses
6175 incompatibilities between the type of the alias declaration and that of its
6176 target.  Such incompatibilities are typically indicative of bugs.
6178 @item -Wattribute-alias=2
6180 At this level @option{-Wattribute-alias} also diagnoses cases where
6181 the attributes of the alias declaration are more restrictive than the
6182 attributes applied to its target.  These mismatches can potentially
6183 result in incorrect code generation.  In other cases they may be
6184 benign and could be resolved simply by adding the missing attribute to
6185 the target.  For comparison, see the @option{-Wmissing-attributes}
6186 option, which controls diagnostics when the alias declaration is less
6187 restrictive than the target, rather than more restrictive.
6189 Attributes considered include @code{alloc_align}, @code{alloc_size},
6190 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6191 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6192 @code{returns_nonnull}, and @code{returns_twice}.
6193 @end table
6195 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6196 This is the default.  You can disable these warnings with either
6197 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6199 @item -Wbool-compare
6200 @opindex Wno-bool-compare
6201 @opindex Wbool-compare
6202 Warn about boolean expression compared with an integer value different from
6203 @code{true}/@code{false}.  For instance, the following comparison is
6204 always false:
6205 @smallexample
6206 int n = 5;
6207 @dots{}
6208 if ((n > 1) == 2) @{ @dots{} @}
6209 @end smallexample
6210 This warning is enabled by @option{-Wall}.
6212 @item -Wbool-operation
6213 @opindex Wno-bool-operation
6214 @opindex Wbool-operation
6215 Warn about suspicious operations on expressions of a boolean type.  For
6216 instance, bitwise negation of a boolean is very likely a bug in the program.
6217 For C, this warning also warns about incrementing or decrementing a boolean,
6218 which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
6219 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6221 This warning is enabled by @option{-Wall}.
6223 @item -Wduplicated-branches
6224 @opindex Wno-duplicated-branches
6225 @opindex Wduplicated-branches
6226 Warn when an if-else has identical branches.  This warning detects cases like
6227 @smallexample
6228 if (p != NULL)
6229   return 0;
6230 else
6231   return 0;
6232 @end smallexample
6233 It doesn't warn when both branches contain just a null statement.  This warning
6234 also warn for conditional operators:
6235 @smallexample
6236   int i = x ? *p : *p;
6237 @end smallexample
6239 @item -Wduplicated-cond
6240 @opindex Wno-duplicated-cond
6241 @opindex Wduplicated-cond
6242 Warn about duplicated conditions in an if-else-if chain.  For instance,
6243 warn for the following code:
6244 @smallexample
6245 if (p->q != NULL) @{ @dots{} @}
6246 else if (p->q != NULL) @{ @dots{} @}
6247 @end smallexample
6249 @item -Wframe-address
6250 @opindex Wno-frame-address
6251 @opindex Wframe-address
6252 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6253 is called with an argument greater than 0.  Such calls may return indeterminate
6254 values or crash the program.  The warning is included in @option{-Wall}.
6256 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6257 @opindex Wno-discarded-qualifiers
6258 @opindex Wdiscarded-qualifiers
6259 Do not warn if type qualifiers on pointers are being discarded.
6260 Typically, the compiler warns if a @code{const char *} variable is
6261 passed to a function that takes a @code{char *} parameter.  This option
6262 can be used to suppress such a warning.
6264 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6265 @opindex Wno-discarded-array-qualifiers
6266 @opindex Wdiscarded-array-qualifiers
6267 Do not warn if type qualifiers on arrays which are pointer targets
6268 are being discarded. Typically, the compiler warns if a
6269 @code{const int (*)[]} variable is passed to a function that
6270 takes a @code{int (*)[]} parameter.  This option can be used to
6271 suppress such a warning.
6273 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6274 @opindex Wno-incompatible-pointer-types
6275 @opindex Wincompatible-pointer-types
6276 Do not warn when there is a conversion between pointers that have incompatible
6277 types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
6278 which warns for pointer argument passing or assignment with different
6279 signedness.
6281 @item -Wno-int-conversion @r{(C and Objective-C only)}
6282 @opindex Wno-int-conversion
6283 @opindex Wint-conversion
6284 Do not warn about incompatible integer to pointer and pointer to integer
6285 conversions.  This warning is about implicit conversions; for explicit
6286 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6287 @option{-Wno-pointer-to-int-cast} may be used.
6289 @item -Wno-div-by-zero
6290 @opindex Wno-div-by-zero
6291 @opindex Wdiv-by-zero
6292 Do not warn about compile-time integer division by zero.  Floating-point
6293 division by zero is not warned about, as it can be a legitimate way of
6294 obtaining infinities and NaNs.
6296 @item -Wsystem-headers
6297 @opindex Wsystem-headers
6298 @opindex Wno-system-headers
6299 @cindex warnings from system headers
6300 @cindex system headers, warnings from
6301 Print warning messages for constructs found in system header files.
6302 Warnings from system headers are normally suppressed, on the assumption
6303 that they usually do not indicate real problems and would only make the
6304 compiler output harder to read.  Using this command-line option tells
6305 GCC to emit warnings from system headers as if they occurred in user
6306 code.  However, note that using @option{-Wall} in conjunction with this
6307 option does @emph{not} warn about unknown pragmas in system
6308 headers---for that, @option{-Wunknown-pragmas} must also be used.
6310 @item -Wtautological-compare
6311 @opindex Wtautological-compare
6312 @opindex Wno-tautological-compare
6313 Warn if a self-comparison always evaluates to true or false.  This
6314 warning detects various mistakes such as:
6315 @smallexample
6316 int i = 1;
6317 @dots{}
6318 if (i > i) @{ @dots{} @}
6319 @end smallexample
6321 This warning also warns about bitwise comparisons that always evaluate
6322 to true or false, for instance:
6323 @smallexample
6324 if ((a & 16) == 10) @{ @dots{} @}
6325 @end smallexample
6326 will always be false.
6328 This warning is enabled by @option{-Wall}.
6330 @item -Wtrampolines
6331 @opindex Wtrampolines
6332 @opindex Wno-trampolines
6333 Warn about trampolines generated for pointers to nested functions.
6334 A trampoline is a small piece of data or code that is created at run
6335 time on the stack when the address of a nested function is taken, and is
6336 used to call the nested function indirectly.  For some targets, it is
6337 made up of data only and thus requires no special treatment.  But, for
6338 most targets, it is made up of code and thus requires the stack to be
6339 made executable in order for the program to work properly.
6341 @item -Wfloat-equal
6342 @opindex Wfloat-equal
6343 @opindex Wno-float-equal
6344 Warn if floating-point values are used in equality comparisons.
6346 The idea behind this is that sometimes it is convenient (for the
6347 programmer) to consider floating-point values as approximations to
6348 infinitely precise real numbers.  If you are doing this, then you need
6349 to compute (by analyzing the code, or in some other way) the maximum or
6350 likely maximum error that the computation introduces, and allow for it
6351 when performing comparisons (and when producing output, but that's a
6352 different problem).  In particular, instead of testing for equality, you
6353 should check to see whether the two values have ranges that overlap; and
6354 this is done with the relational operators, so equality comparisons are
6355 probably mistaken.
6357 @item -Wtraditional @r{(C and Objective-C only)}
6358 @opindex Wtraditional
6359 @opindex Wno-traditional
6360 Warn about certain constructs that behave differently in traditional and
6361 ISO C@.  Also warn about ISO C constructs that have no traditional C
6362 equivalent, and/or problematic constructs that should be avoided.
6364 @itemize @bullet
6365 @item
6366 Macro parameters that appear within string literals in the macro body.
6367 In traditional C macro replacement takes place within string literals,
6368 but in ISO C it does not.
6370 @item
6371 In traditional C, some preprocessor directives did not exist.
6372 Traditional preprocessors only considered a line to be a directive
6373 if the @samp{#} appeared in column 1 on the line.  Therefore
6374 @option{-Wtraditional} warns about directives that traditional C
6375 understands but ignores because the @samp{#} does not appear as the
6376 first character on the line.  It also suggests you hide directives like
6377 @code{#pragma} not understood by traditional C by indenting them.  Some
6378 traditional implementations do not recognize @code{#elif}, so this option
6379 suggests avoiding it altogether.
6381 @item
6382 A function-like macro that appears without arguments.
6384 @item
6385 The unary plus operator.
6387 @item
6388 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6389 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
6390 constants.)  Note, these suffixes appear in macros defined in the system
6391 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6392 Use of these macros in user code might normally lead to spurious
6393 warnings, however GCC's integrated preprocessor has enough context to
6394 avoid warning in these cases.
6396 @item
6397 A function declared external in one block and then used after the end of
6398 the block.
6400 @item
6401 A @code{switch} statement has an operand of type @code{long}.
6403 @item
6404 A non-@code{static} function declaration follows a @code{static} one.
6405 This construct is not accepted by some traditional C compilers.
6407 @item
6408 The ISO type of an integer constant has a different width or
6409 signedness from its traditional type.  This warning is only issued if
6410 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
6411 typically represent bit patterns, are not warned about.
6413 @item
6414 Usage of ISO string concatenation is detected.
6416 @item
6417 Initialization of automatic aggregates.
6419 @item
6420 Identifier conflicts with labels.  Traditional C lacks a separate
6421 namespace for labels.
6423 @item
6424 Initialization of unions.  If the initializer is zero, the warning is
6425 omitted.  This is done under the assumption that the zero initializer in
6426 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6427 initializer warnings and relies on default initialization to zero in the
6428 traditional C case.
6430 @item
6431 Conversions by prototypes between fixed/floating-point values and vice
6432 versa.  The absence of these prototypes when compiling with traditional
6433 C causes serious problems.  This is a subset of the possible
6434 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6436 @item
6437 Use of ISO C style function definitions.  This warning intentionally is
6438 @emph{not} issued for prototype declarations or variadic functions
6439 because these ISO C features appear in your code when using
6440 libiberty's traditional C compatibility macros, @code{PARAMS} and
6441 @code{VPARAMS}.  This warning is also bypassed for nested functions
6442 because that feature is already a GCC extension and thus not relevant to
6443 traditional C compatibility.
6444 @end itemize
6446 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6447 @opindex Wtraditional-conversion
6448 @opindex Wno-traditional-conversion
6449 Warn if a prototype causes a type conversion that is different from what
6450 would happen to the same argument in the absence of a prototype.  This
6451 includes conversions of fixed point to floating and vice versa, and
6452 conversions changing the width or signedness of a fixed-point argument
6453 except when the same as the default promotion.
6455 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6456 @opindex Wdeclaration-after-statement
6457 @opindex Wno-declaration-after-statement
6458 Warn when a declaration is found after a statement in a block.  This
6459 construct, known from C++, was introduced with ISO C99 and is by default
6460 allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Declarations}.
6462 @item -Wshadow
6463 @opindex Wshadow
6464 @opindex Wno-shadow
6465 Warn whenever a local variable or type declaration shadows another
6466 variable, parameter, type, class member (in C++), or instance variable
6467 (in Objective-C) or whenever a built-in function is shadowed. Note
6468 that in C++, the compiler warns if a local variable shadows an
6469 explicit typedef, but not if it shadows a struct/class/enum.
6470 Same as @option{-Wshadow=global}.
6472 @item -Wno-shadow-ivar @r{(Objective-C only)}
6473 @opindex Wno-shadow-ivar
6474 @opindex Wshadow-ivar
6475 Do not warn whenever a local variable shadows an instance variable in an
6476 Objective-C method.
6478 @item -Wshadow=global
6479 @opindex Wshadow=local
6480 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6482 @item -Wshadow=local
6483 @opindex Wshadow=local
6484 Warn when a local variable shadows another local variable or parameter.
6485 This warning is enabled by @option{-Wshadow=global}.
6487 @item -Wshadow=compatible-local
6488 @opindex Wshadow=compatible-local
6489 Warn when a local variable shadows another local variable or parameter
6490 whose type is compatible with that of the shadowing variable. In C++,
6491 type compatibility here means the type of the shadowing variable can be
6492 converted to that of the shadowed variable. The creation of this flag
6493 (in addition to @option{-Wshadow=local}) is based on the idea that when
6494 a local variable shadows another one of incompatible type, it is most
6495 likely intentional, not a bug or typo, as shown in the following example:
6497 @smallexample
6498 @group
6499 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6501   for (int i = 0; i < N; ++i)
6502   @{
6503     ...
6504   @}
6505   ...
6507 @end group
6508 @end smallexample
6510 Since the two variable @code{i} in the example above have incompatible types,
6511 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6512 Because their types are incompatible, if a programmer accidentally uses one
6513 in place of the other, type checking will catch that and emit an error or
6514 warning. So not warning (about shadowing) in this case will not lead to
6515 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6516 possibly reduce the number of warnings triggered by intentional shadowing.
6518 This warning is enabled by @option{-Wshadow=local}.
6520 @item -Wlarger-than=@var{byte-size}
6521 @opindex Wlarger-than=
6522 @opindex Wlarger-than-@var{byte-size}
6523 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6524 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6525 Warnings controlled by the option can be disabled either by specifying
6526 @var{byte-size} of @samp{SIZE_MAX} or more or by
6527 @option{-Wno-larger-than}.
6529 @item -Wno-larger-than
6530 @opindex Wno-larger-than
6531 Disable @option{-Wlarger-than=} warnings.  The option is equivalent
6532 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6534 @item -Wframe-larger-than=@var{byte-size}
6535 @opindex Wframe-larger-than=
6536 @opindex Wno-frame-larger-than
6537 Warn if the size of a function frame exceeds @var{byte-size}.
6538 The computation done to determine the stack frame size is approximate
6539 and not conservative.
6540 The actual requirements may be somewhat greater than @var{byte-size}
6541 even if you do not get a warning.  In addition, any space allocated
6542 via @code{alloca}, variable-length arrays, or related constructs
6543 is not included by the compiler when determining
6544 whether or not to issue a warning.
6545 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6546 Warnings controlled by the option can be disabled either by specifying
6547 @var{byte-size} of @samp{SIZE_MAX} or more or by
6548 @option{-Wno-frame-larger-than}.
6550 @item -Wno-frame-larger-than
6551 @opindex Wno-frame-larger-than
6552 Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
6553 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6555 @item -Wno-free-nonheap-object
6556 @opindex Wno-free-nonheap-object
6557 @opindex Wfree-nonheap-object
6558 Do not warn when attempting to free an object that was not allocated
6559 on the heap.
6561 @item -Wstack-usage=@var{byte-size}
6562 @opindex Wstack-usage
6563 @opindex Wno-stack-usage
6564 Warn if the stack usage of a function might exceed @var{byte-size}.
6565 The computation done to determine the stack usage is conservative.
6566 Any space allocated via @code{alloca}, variable-length arrays, or related
6567 constructs is included by the compiler when determining whether or not to
6568 issue a warning.
6570 The message is in keeping with the output of @option{-fstack-usage}.
6572 @itemize
6573 @item
6574 If the stack usage is fully static but exceeds the specified amount, it's:
6576 @smallexample
6577   warning: stack usage is 1120 bytes
6578 @end smallexample
6579 @item
6580 If the stack usage is (partly) dynamic but bounded, it's:
6582 @smallexample
6583   warning: stack usage might be 1648 bytes
6584 @end smallexample
6585 @item
6586 If the stack usage is (partly) dynamic and not bounded, it's:
6588 @smallexample
6589   warning: stack usage might be unbounded
6590 @end smallexample
6591 @end itemize
6593 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6594 Warnings controlled by the option can be disabled either by specifying
6595 @var{byte-size} of @samp{SIZE_MAX} or more or by
6596 @option{-Wno-stack-usage}.
6598 @item -Wno-stack-usage
6599 @opindex Wno-stack-usage
6600 Disable @option{-Wstack-usage=} warnings.  The option is equivalent
6601 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6603 @item -Wunsafe-loop-optimizations
6604 @opindex Wunsafe-loop-optimizations
6605 @opindex Wno-unsafe-loop-optimizations
6606 Warn if the loop cannot be optimized because the compiler cannot
6607 assume anything on the bounds of the loop indices.  With
6608 @option{-funsafe-loop-optimizations} warn if the compiler makes
6609 such assumptions.
6611 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6612 @opindex Wno-pedantic-ms-format
6613 @opindex Wpedantic-ms-format
6614 When used in combination with @option{-Wformat}
6615 and @option{-pedantic} without GNU extensions, this option
6616 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6617 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6618 which depend on the MS runtime.
6620 @item -Waligned-new
6621 @opindex Waligned-new
6622 @opindex Wno-aligned-new
6623 Warn about a new-expression of a type that requires greater alignment
6624 than the @code{alignof(std::max_align_t)} but uses an allocation
6625 function without an explicit alignment parameter. This option is
6626 enabled by @option{-Wall}.
6628 Normally this only warns about global allocation functions, but
6629 @option{-Waligned-new=all} also warns about class member allocation
6630 functions.
6632 @item -Wplacement-new
6633 @itemx -Wplacement-new=@var{n}
6634 @opindex Wplacement-new
6635 @opindex Wno-placement-new
6636 Warn about placement new expressions with undefined behavior, such as
6637 constructing an object in a buffer that is smaller than the type of
6638 the object.  For example, the placement new expression below is diagnosed
6639 because it attempts to construct an array of 64 integers in a buffer only
6640 64 bytes large.
6641 @smallexample
6642 char buf [64];
6643 new (buf) int[64];
6644 @end smallexample
6645 This warning is enabled by default.
6647 @table @gcctabopt
6648 @item -Wplacement-new=1
6649 This is the default warning level of @option{-Wplacement-new}.  At this
6650 level the warning is not issued for some strictly undefined constructs that
6651 GCC allows as extensions for compatibility with legacy code.  For example,
6652 the following @code{new} expression is not diagnosed at this level even
6653 though it has undefined behavior according to the C++ standard because
6654 it writes past the end of the one-element array.
6655 @smallexample
6656 struct S @{ int n, a[1]; @};
6657 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6658 new (s->a)int [32]();
6659 @end smallexample
6661 @item -Wplacement-new=2
6662 At this level, in addition to diagnosing all the same constructs as at level
6663 1, a diagnostic is also issued for placement new expressions that construct
6664 an object in the last member of structure whose type is an array of a single
6665 element and whose size is less than the size of the object being constructed.
6666 While the previous example would be diagnosed, the following construct makes
6667 use of the flexible member array extension to avoid the warning at level 2.
6668 @smallexample
6669 struct S @{ int n, a[]; @};
6670 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6671 new (s->a)int [32]();
6672 @end smallexample
6674 @end table
6676 @item -Wpointer-arith
6677 @opindex Wpointer-arith
6678 @opindex Wno-pointer-arith
6679 Warn about anything that depends on the ``size of'' a function type or
6680 of @code{void}.  GNU C assigns these types a size of 1, for
6681 convenience in calculations with @code{void *} pointers and pointers
6682 to functions.  In C++, warn also when an arithmetic operation involves
6683 @code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
6685 @item -Wpointer-compare
6686 @opindex Wpointer-compare
6687 @opindex Wno-pointer-compare
6688 Warn if a pointer is compared with a zero character constant.  This usually
6689 means that the pointer was meant to be dereferenced.  For example:
6691 @smallexample
6692 const char *p = foo ();
6693 if (p == '\0')
6694   return 42;
6695 @end smallexample
6697 Note that the code above is invalid in C++11.
6699 This warning is enabled by default.
6701 @item -Wtype-limits
6702 @opindex Wtype-limits
6703 @opindex Wno-type-limits
6704 Warn if a comparison is always true or always false due to the limited
6705 range of the data type, but do not warn for constant expressions.  For
6706 example, warn if an unsigned variable is compared against zero with
6707 @code{<} or @code{>=}.  This warning is also enabled by
6708 @option{-Wextra}.
6710 @item -Wabsolute-value @r{(C and Objective-C only)}
6711 @opindex Wabsolute-value
6712 @opindex Wno-absolute-value
6713 Warn for calls to standard functions that compute the absolute value
6714 of an argument when a more appropriate standard function is available.
6715 For example, calling @code{abs(3.14)} triggers the warning because the
6716 appropriate function to call to compute the absolute value of a double
6717 argument is @code{fabs}.  The option also triggers warnings when the
6718 argument in a call to such a function has an unsigned type.  This
6719 warning can be suppressed with an explicit type cast and it is also
6720 enabled by @option{-Wextra}.
6722 @include cppwarnopts.texi
6724 @item -Wbad-function-cast @r{(C and Objective-C only)}
6725 @opindex Wbad-function-cast
6726 @opindex Wno-bad-function-cast
6727 Warn when a function call is cast to a non-matching type.
6728 For example, warn if a call to a function returning an integer type 
6729 is cast to a pointer type.
6731 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6732 @opindex Wc90-c99-compat
6733 @opindex Wno-c90-c99-compat
6734 Warn about features not present in ISO C90, but present in ISO C99.
6735 For instance, warn about use of variable length arrays, @code{long long}
6736 type, @code{bool} type, compound literals, designated initializers, and so
6737 on.  This option is independent of the standards mode.  Warnings are disabled
6738 in the expression that follows @code{__extension__}.
6740 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6741 @opindex Wc99-c11-compat
6742 @opindex Wno-c99-c11-compat
6743 Warn about features not present in ISO C99, but present in ISO C11.
6744 For instance, warn about use of anonymous structures and unions,
6745 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6746 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6747 and so on.  This option is independent of the standards mode.  Warnings are
6748 disabled in the expression that follows @code{__extension__}.
6750 @item -Wc++-compat @r{(C and Objective-C only)}
6751 @opindex Wc++-compat
6752 @opindex Wno-c++-compat
6753 Warn about ISO C constructs that are outside of the common subset of
6754 ISO C and ISO C++, e.g.@: request for implicit conversion from
6755 @code{void *} to a pointer to non-@code{void} type.
6757 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6758 @opindex Wc++11-compat
6759 @opindex Wno-c++11-compat
6760 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6761 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6762 in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
6763 enabled by @option{-Wall}.
6765 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6766 @opindex Wc++14-compat
6767 @opindex Wno-c++14-compat
6768 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6769 and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
6771 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6772 @opindex Wc++17-compat
6773 @opindex Wno-c++17-compat
6774 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6775 and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
6777 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
6778 @opindex Wc++20-compat
6779 @opindex Wno-c++20-compat
6780 Warn about C++ constructs whose meaning differs between ISO C++ 2017
6781 and ISO C++ 2020.  This warning is enabled by @option{-Wall}.
6783 @item -Wcast-qual
6784 @opindex Wcast-qual
6785 @opindex Wno-cast-qual
6786 Warn whenever a pointer is cast so as to remove a type qualifier from
6787 the target type.  For example, warn if a @code{const char *} is cast
6788 to an ordinary @code{char *}.
6790 Also warn when making a cast that introduces a type qualifier in an
6791 unsafe way.  For example, casting @code{char **} to @code{const char **}
6792 is unsafe, as in this example:
6794 @smallexample
6795   /* p is char ** value.  */
6796   const char **q = (const char **) p;
6797   /* Assignment of readonly string to const char * is OK.  */
6798   *q = "string";
6799   /* Now char** pointer points to read-only memory.  */
6800   **p = 'b';
6801 @end smallexample
6803 @item -Wcast-align
6804 @opindex Wcast-align
6805 @opindex Wno-cast-align
6806 Warn whenever a pointer is cast such that the required alignment of the
6807 target is increased.  For example, warn if a @code{char *} is cast to
6808 an @code{int *} on machines where integers can only be accessed at
6809 two- or four-byte boundaries.
6811 @item -Wcast-align=strict
6812 @opindex Wcast-align=strict
6813 Warn whenever a pointer is cast such that the required alignment of the
6814 target is increased.  For example, warn if a @code{char *} is cast to
6815 an @code{int *} regardless of the target machine.
6817 @item -Wcast-function-type
6818 @opindex Wcast-function-type
6819 @opindex Wno-cast-function-type
6820 Warn when a function pointer is cast to an incompatible function pointer.
6821 In a cast involving function types with a variable argument list only
6822 the types of initial arguments that are provided are considered.
6823 Any parameter of pointer-type matches any other pointer-type.  Any benign
6824 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6825 on ILP32 targets.  Likewise type qualifiers are ignored.  The function
6826 type @code{void (*) (void)} is special and matches everything, which can
6827 be used to suppress this warning.
6828 In a cast involving pointer to member types this warning warns whenever
6829 the type cast is changing the pointer to member type.
6830 This warning is enabled by @option{-Wextra}.
6832 @item -Wwrite-strings
6833 @opindex Wwrite-strings
6834 @opindex Wno-write-strings
6835 When compiling C, give string constants the type @code{const
6836 char[@var{length}]} so that copying the address of one into a
6837 non-@code{const} @code{char *} pointer produces a warning.  These
6838 warnings help you find at compile time code that can try to write
6839 into a string constant, but only if you have been very careful about
6840 using @code{const} in declarations and prototypes.  Otherwise, it is
6841 just a nuisance. This is why we did not make @option{-Wall} request
6842 these warnings.
6844 When compiling C++, warn about the deprecated conversion from string
6845 literals to @code{char *}.  This warning is enabled by default for C++
6846 programs.
6848 @item -Wcatch-value
6849 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6850 @opindex Wcatch-value
6851 @opindex Wno-catch-value
6852 Warn about catch handlers that do not catch via reference.
6853 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6854 warn about polymorphic class types that are caught by value.
6855 With @option{-Wcatch-value=2} warn about all class types that are caught
6856 by value. With @option{-Wcatch-value=3} warn about all types that are
6857 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6859 @item -Wclobbered
6860 @opindex Wclobbered
6861 @opindex Wno-clobbered
6862 Warn for variables that might be changed by @code{longjmp} or
6863 @code{vfork}.  This warning is also enabled by @option{-Wextra}.
6865 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6866 @opindex Wconditionally-supported
6867 @opindex Wno-conditionally-supported
6868 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6870 @item -Wconversion
6871 @opindex Wconversion
6872 @opindex Wno-conversion
6873 Warn for implicit conversions that may alter a value. This includes
6874 conversions between real and integer, like @code{abs (x)} when
6875 @code{x} is @code{double}; conversions between signed and unsigned,
6876 like @code{unsigned ui = -1}; and conversions to smaller types, like
6877 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6878 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6879 changed by the conversion like in @code{abs (2.0)}.  Warnings about
6880 conversions between signed and unsigned integers can be disabled by
6881 using @option{-Wno-sign-conversion}.
6883 For C++, also warn for confusing overload resolution for user-defined
6884 conversions; and conversions that never use a type conversion
6885 operator: conversions to @code{void}, the same type, a base class or a
6886 reference to them. Warnings about conversions between signed and
6887 unsigned integers are disabled by default in C++ unless
6888 @option{-Wsign-conversion} is explicitly enabled.
6890 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6891 @opindex Wconversion-null
6892 @opindex Wno-conversion-null
6893 Do not warn for conversions between @code{NULL} and non-pointer
6894 types. @option{-Wconversion-null} is enabled by default.
6896 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6897 @opindex Wzero-as-null-pointer-constant
6898 @opindex Wno-zero-as-null-pointer-constant
6899 Warn when a literal @samp{0} is used as null pointer constant.  This can
6900 be useful to facilitate the conversion to @code{nullptr} in C++11.
6902 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6903 @opindex Wsubobject-linkage
6904 @opindex Wno-subobject-linkage
6905 Warn if a class type has a base or a field whose type uses the anonymous
6906 namespace or depends on a type with no linkage.  If a type A depends on
6907 a type B with no or internal linkage, defining it in multiple
6908 translation units would be an ODR violation because the meaning of B
6909 is different in each translation unit.  If A only appears in a single
6910 translation unit, the best way to silence the warning is to give it
6911 internal linkage by putting it in an anonymous namespace as well.  The
6912 compiler doesn't give this warning for types defined in the main .C
6913 file, as those are unlikely to have multiple definitions.
6914 @option{-Wsubobject-linkage} is enabled by default.
6916 @item -Wdangling-else
6917 @opindex Wdangling-else
6918 @opindex Wno-dangling-else
6919 Warn about constructions where there may be confusion to which
6920 @code{if} statement an @code{else} branch belongs.  Here is an example of
6921 such a case:
6923 @smallexample
6924 @group
6926   if (a)
6927     if (b)
6928       foo ();
6929   else
6930     bar ();
6932 @end group
6933 @end smallexample
6935 In C/C++, every @code{else} branch belongs to the innermost possible
6936 @code{if} statement, which in this example is @code{if (b)}.  This is
6937 often not what the programmer expected, as illustrated in the above
6938 example by indentation the programmer chose.  When there is the
6939 potential for this confusion, GCC issues a warning when this flag
6940 is specified.  To eliminate the warning, add explicit braces around
6941 the innermost @code{if} statement so there is no way the @code{else}
6942 can belong to the enclosing @code{if}.  The resulting code
6943 looks like this:
6945 @smallexample
6946 @group
6948   if (a)
6949     @{
6950       if (b)
6951         foo ();
6952       else
6953         bar ();
6954     @}
6956 @end group
6957 @end smallexample
6959 This warning is enabled by @option{-Wparentheses}.
6961 @item -Wdate-time
6962 @opindex Wdate-time
6963 @opindex Wno-date-time
6964 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6965 are encountered as they might prevent bit-wise-identical reproducible
6966 compilations.
6968 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6969 @opindex Wdelete-incomplete
6970 @opindex Wno-delete-incomplete
6971 Warn when deleting a pointer to incomplete type, which may cause
6972 undefined behavior at runtime.  This warning is enabled by default.
6974 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6975 @opindex Wuseless-cast
6976 @opindex Wno-useless-cast
6977 Warn when an expression is casted to its own type.
6979 @item -Wempty-body
6980 @opindex Wempty-body
6981 @opindex Wno-empty-body
6982 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6983 while} statement.  This warning is also enabled by @option{-Wextra}.
6985 @item -Wenum-compare
6986 @opindex Wenum-compare
6987 @opindex Wno-enum-compare
6988 Warn about a comparison between values of different enumerated types.
6989 In C++ enumerated type mismatches in conditional expressions are also
6990 diagnosed and the warning is enabled by default.  In C this warning is 
6991 enabled by @option{-Wall}.
6993 @item -Wenum-conversion @r{(C, Objective-C only)}
6994 @opindex Wenum-conversion
6995 @opindex Wno-enum-conversion
6996 Warn when a value of enumerated type is implicitly converted to a 
6997 different enumerated type.  This warning is enabled by @option{-Wextra}.
6999 @item -Wextra-semi @r{(C++, Objective-C++ only)}
7000 @opindex Wextra-semi
7001 @opindex Wno-extra-semi
7002 Warn about redundant semicolon after in-class function definition.
7004 @item -Wjump-misses-init @r{(C, Objective-C only)}
7005 @opindex Wjump-misses-init
7006 @opindex Wno-jump-misses-init
7007 Warn if a @code{goto} statement or a @code{switch} statement jumps
7008 forward across the initialization of a variable, or jumps backward to a
7009 label after the variable has been initialized.  This only warns about
7010 variables that are initialized when they are declared.  This warning is
7011 only supported for C and Objective-C; in C++ this sort of branch is an
7012 error in any case.
7014 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
7015 can be disabled with the @option{-Wno-jump-misses-init} option.
7017 @item -Wsign-compare
7018 @opindex Wsign-compare
7019 @opindex Wno-sign-compare
7020 @cindex warning for comparison of signed and unsigned values
7021 @cindex comparison of signed and unsigned values, warning
7022 @cindex signed and unsigned values, comparison warning
7023 Warn when a comparison between signed and unsigned values could produce
7024 an incorrect result when the signed value is converted to unsigned.
7025 In C++, this warning is also enabled by @option{-Wall}.  In C, it is
7026 also enabled by @option{-Wextra}.
7028 @item -Wsign-conversion
7029 @opindex Wsign-conversion
7030 @opindex Wno-sign-conversion
7031 Warn for implicit conversions that may change the sign of an integer
7032 value, like assigning a signed integer expression to an unsigned
7033 integer variable. An explicit cast silences the warning. In C, this
7034 option is enabled also by @option{-Wconversion}.
7036 @item -Wfloat-conversion
7037 @opindex Wfloat-conversion
7038 @opindex Wno-float-conversion
7039 Warn for implicit conversions that reduce the precision of a real value.
7040 This includes conversions from real to integer, and from higher precision
7041 real to lower precision real values.  This option is also enabled by
7042 @option{-Wconversion}.
7044 @item -Wno-scalar-storage-order
7045 @opindex Wno-scalar-storage-order
7046 @opindex Wscalar-storage-order
7047 Do not warn on suspicious constructs involving reverse scalar storage order.
7049 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7050 @opindex Wsized-deallocation
7051 @opindex Wno-sized-deallocation
7052 Warn about a definition of an unsized deallocation function
7053 @smallexample
7054 void operator delete (void *) noexcept;
7055 void operator delete[] (void *) noexcept;
7056 @end smallexample
7057 without a definition of the corresponding sized deallocation function
7058 @smallexample
7059 void operator delete (void *, std::size_t) noexcept;
7060 void operator delete[] (void *, std::size_t) noexcept;
7061 @end smallexample
7062 or vice versa.  Enabled by @option{-Wextra} along with
7063 @option{-fsized-deallocation}.
7065 @item -Wsizeof-pointer-div
7066 @opindex Wsizeof-pointer-div
7067 @opindex Wno-sizeof-pointer-div
7068 Warn for suspicious divisions of two sizeof expressions that divide
7069 the pointer size by the element size, which is the usual way to compute
7070 the array size but won't work out correctly with pointers.  This warning
7071 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7072 not an array, but a pointer.  This warning is enabled by @option{-Wall}.
7074 @item -Wsizeof-pointer-memaccess
7075 @opindex Wsizeof-pointer-memaccess
7076 @opindex Wno-sizeof-pointer-memaccess
7077 Warn for suspicious length parameters to certain string and memory built-in
7078 functions if the argument uses @code{sizeof}.  This warning triggers for
7079 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7080 an array, but a pointer, and suggests a possible fix, or about
7081 @code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
7082 also warns about calls to bounded string copy functions like @code{strncat}
7083 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7084 the source array.  For example, in the following function the call to
7085 @code{strncat} specifies the size of the source string as the bound.  That
7086 is almost certainly a mistake and so the call is diagnosed.
7087 @smallexample
7088 void make_file (const char *name)
7090   char path[PATH_MAX];
7091   strncpy (path, name, sizeof path - 1);
7092   strncat (path, ".text", sizeof ".text");
7093   @dots{}
7095 @end smallexample
7097 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7099 @item -Wsizeof-array-argument
7100 @opindex Wsizeof-array-argument
7101 @opindex Wno-sizeof-array-argument
7102 Warn when the @code{sizeof} operator is applied to a parameter that is
7103 declared as an array in a function definition.  This warning is enabled by
7104 default for C and C++ programs.
7106 @item -Wmemset-elt-size
7107 @opindex Wmemset-elt-size
7108 @opindex Wno-memset-elt-size
7109 Warn for suspicious calls to the @code{memset} built-in function, if the
7110 first argument references an array, and the third argument is a number
7111 equal to the number of elements, but not equal to the size of the array
7112 in memory.  This indicates that the user has omitted a multiplication by
7113 the element size.  This warning is enabled by @option{-Wall}.
7115 @item -Wmemset-transposed-args
7116 @opindex Wmemset-transposed-args
7117 @opindex Wno-memset-transposed-args
7118 Warn for suspicious calls to the @code{memset} built-in function where
7119 the second argument is not zero and the third argument is zero.  For
7120 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7121 @code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
7122 is only emitted if the third argument is a literal zero.  Otherwise, if
7123 it is an expression that is folded to zero, or a cast of zero to some
7124 type, it is far less likely that the arguments have been mistakenly
7125 transposed and no warning is emitted.  This warning is enabled
7126 by @option{-Wall}.
7128 @item -Waddress
7129 @opindex Waddress
7130 @opindex Wno-address
7131 Warn about suspicious uses of memory addresses. These include using
7132 the address of a function in a conditional expression, such as
7133 @code{void func(void); if (func)}, and comparisons against the memory
7134 address of a string literal, such as @code{if (x == "abc")}.  Such
7135 uses typically indicate a programmer error: the address of a function
7136 always evaluates to true, so their use in a conditional usually
7137 indicate that the programmer forgot the parentheses in a function
7138 call; and comparisons against string literals result in unspecified
7139 behavior and are not portable in C, so they usually indicate that the
7140 programmer intended to use @code{strcmp}.  This warning is enabled by
7141 @option{-Wall}.
7143 @item -Waddress-of-packed-member
7144 @opindex Waddress-of-packed-member
7145 @opindex Wno-address-of-packed-member
7146 Warn when the address of packed member of struct or union is taken,
7147 which usually results in an unaligned pointer value.  This is
7148 enabled by default.
7150 @item -Wlogical-op
7151 @opindex Wlogical-op
7152 @opindex Wno-logical-op
7153 Warn about suspicious uses of logical operators in expressions.
7154 This includes using logical operators in contexts where a
7155 bit-wise operator is likely to be expected.  Also warns when
7156 the operands of a logical operator are the same:
7157 @smallexample
7158 extern int a;
7159 if (a < 0 && a < 0) @{ @dots{} @}
7160 @end smallexample
7162 @item -Wlogical-not-parentheses
7163 @opindex Wlogical-not-parentheses
7164 @opindex Wno-logical-not-parentheses
7165 Warn about logical not used on the left hand side operand of a comparison.
7166 This option does not warn if the right operand is considered to be a boolean
7167 expression.  Its purpose is to detect suspicious code like the following:
7168 @smallexample
7169 int a;
7170 @dots{}
7171 if (!a > 1) @{ @dots{} @}
7172 @end smallexample
7174 It is possible to suppress the warning by wrapping the LHS into
7175 parentheses:
7176 @smallexample
7177 if ((!a) > 1) @{ @dots{} @}
7178 @end smallexample
7180 This warning is enabled by @option{-Wall}.
7182 @item -Waggregate-return
7183 @opindex Waggregate-return
7184 @opindex Wno-aggregate-return
7185 Warn if any functions that return structures or unions are defined or
7186 called.  (In languages where you can return an array, this also elicits
7187 a warning.)
7189 @item -Wno-aggressive-loop-optimizations
7190 @opindex Wno-aggressive-loop-optimizations
7191 @opindex Waggressive-loop-optimizations
7192 Warn if in a loop with constant number of iterations the compiler detects
7193 undefined behavior in some statement during one or more of the iterations.
7195 @item -Wno-attributes
7196 @opindex Wno-attributes
7197 @opindex Wattributes
7198 Do not warn if an unexpected @code{__attribute__} is used, such as
7199 unrecognized attributes, function attributes applied to variables,
7200 etc.  This does not stop errors for incorrect use of supported
7201 attributes.
7203 @item -Wno-builtin-declaration-mismatch
7204 @opindex Wno-builtin-declaration-mismatch
7205 @opindex Wbuiltin-declaration-mismatch
7206 Warn if a built-in function is declared with an incompatible signature
7207 or as a non-function, or when a built-in function declared with a type
7208 that does not include a prototype is called with arguments whose promoted
7209 types do not match those expected by the function.  When @option{-Wextra}
7210 is specified, also warn when a built-in function that takes arguments is
7211 declared without a prototype.  The @option{-Wno-builtin-declaration-mismatch}
7212 warning is enabled by default.  To avoid the warning include the appropriate
7213 header to bring the prototypes of built-in functions into scope.
7215 For example, the call to @code{memset} below is diagnosed by the warning
7216 because the function expects a value of type @code{size_t} as its argument
7217 but the type of @code{32} is @code{int}.  With @option{-Wextra},
7218 the declaration of the function is diagnosed as well.
7219 @smallexample
7220 extern void* memset ();
7221 void f (void *d)
7223   memset (d, '\0', 32);
7225 @end smallexample
7227 @item -Wno-builtin-macro-redefined
7228 @opindex Wno-builtin-macro-redefined
7229 @opindex Wbuiltin-macro-redefined
7230 Do not warn if certain built-in macros are redefined.  This suppresses
7231 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7232 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7234 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7235 @opindex Wstrict-prototypes
7236 @opindex Wno-strict-prototypes
7237 Warn if a function is declared or defined without specifying the
7238 argument types.  (An old-style function definition is permitted without
7239 a warning if preceded by a declaration that specifies the argument
7240 types.)
7242 @item -Wold-style-declaration @r{(C and Objective-C only)}
7243 @opindex Wold-style-declaration
7244 @opindex Wno-old-style-declaration
7245 Warn for obsolescent usages, according to the C Standard, in a
7246 declaration. For example, warn if storage-class specifiers like
7247 @code{static} are not the first things in a declaration.  This warning
7248 is also enabled by @option{-Wextra}.
7250 @item -Wold-style-definition @r{(C and Objective-C only)}
7251 @opindex Wold-style-definition
7252 @opindex Wno-old-style-definition
7253 Warn if an old-style function definition is used.  A warning is given
7254 even if there is a previous prototype.
7256 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7257 @opindex Wmissing-parameter-type
7258 @opindex Wno-missing-parameter-type
7259 A function parameter is declared without a type specifier in K&R-style
7260 functions:
7262 @smallexample
7263 void foo(bar) @{ @}
7264 @end smallexample
7266 This warning is also enabled by @option{-Wextra}.
7268 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7269 @opindex Wmissing-prototypes
7270 @opindex Wno-missing-prototypes
7271 Warn if a global function is defined without a previous prototype
7272 declaration.  This warning is issued even if the definition itself
7273 provides a prototype.  Use this option to detect global functions
7274 that do not have a matching prototype declaration in a header file.
7275 This option is not valid for C++ because all function declarations
7276 provide prototypes and a non-matching declaration declares an
7277 overload rather than conflict with an earlier declaration.
7278 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7280 @item -Wmissing-declarations
7281 @opindex Wmissing-declarations
7282 @opindex Wno-missing-declarations
7283 Warn if a global function is defined without a previous declaration.
7284 Do so even if the definition itself provides a prototype.
7285 Use this option to detect global functions that are not declared in
7286 header files.  In C, no warnings are issued for functions with previous
7287 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7288 missing prototypes.  In C++, no warnings are issued for function templates,
7289 or for inline functions, or for functions in anonymous namespaces.
7291 @item -Wmissing-field-initializers
7292 @opindex Wmissing-field-initializers
7293 @opindex Wno-missing-field-initializers
7294 @opindex W
7295 @opindex Wextra
7296 @opindex Wno-extra
7297 Warn if a structure's initializer has some fields missing.  For
7298 example, the following code causes such a warning, because
7299 @code{x.h} is implicitly zero:
7301 @smallexample
7302 struct s @{ int f, g, h; @};
7303 struct s x = @{ 3, 4 @};
7304 @end smallexample
7306 This option does not warn about designated initializers, so the following
7307 modification does not trigger a warning:
7309 @smallexample
7310 struct s @{ int f, g, h; @};
7311 struct s x = @{ .f = 3, .g = 4 @};
7312 @end smallexample
7314 In C this option does not warn about the universal zero initializer
7315 @samp{@{ 0 @}}:
7317 @smallexample
7318 struct s @{ int f, g, h; @};
7319 struct s x = @{ 0 @};
7320 @end smallexample
7322 Likewise, in C++ this option does not warn about the empty @{ @}
7323 initializer, for example:
7325 @smallexample
7326 struct s @{ int f, g, h; @};
7327 s x = @{ @};
7328 @end smallexample
7330 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
7331 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7333 @item -Wno-multichar
7334 @opindex Wno-multichar
7335 @opindex Wmultichar
7336 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7337 Usually they indicate a typo in the user's code, as they have
7338 implementation-defined values, and should not be used in portable code.
7340 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7341 @opindex Wnormalized=
7342 @opindex Wnormalized
7343 @opindex Wno-normalized
7344 @cindex NFC
7345 @cindex NFKC
7346 @cindex character set, input normalization
7347 In ISO C and ISO C++, two identifiers are different if they are
7348 different sequences of characters.  However, sometimes when characters
7349 outside the basic ASCII character set are used, you can have two
7350 different character sequences that look the same.  To avoid confusion,
7351 the ISO 10646 standard sets out some @dfn{normalization rules} which
7352 when applied ensure that two sequences that look the same are turned into
7353 the same sequence.  GCC can warn you if you are using identifiers that
7354 have not been normalized; this option controls that warning.
7356 There are four levels of warning supported by GCC@.  The default is
7357 @option{-Wnormalized=nfc}, which warns about any identifier that is
7358 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
7359 recommended form for most uses.  It is equivalent to
7360 @option{-Wnormalized}.
7362 Unfortunately, there are some characters allowed in identifiers by
7363 ISO C and ISO C++ that, when turned into NFC, are not allowed in 
7364 identifiers.  That is, there's no way to use these symbols in portable
7365 ISO C or C++ and have all your identifiers in NFC@.
7366 @option{-Wnormalized=id} suppresses the warning for these characters.
7367 It is hoped that future versions of the standards involved will correct
7368 this, which is why this option is not the default.
7370 You can switch the warning off for all characters by writing
7371 @option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
7372 only do this if you are using some other normalization scheme (like
7373 ``D''), because otherwise you can easily create bugs that are
7374 literally impossible to see.
7376 Some characters in ISO 10646 have distinct meanings but look identical
7377 in some fonts or display methodologies, especially once formatting has
7378 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7379 LETTER N'', displays just like a regular @code{n} that has been
7380 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
7381 normalization scheme to convert all these into a standard form as
7382 well, and GCC warns if your code is not in NFKC if you use
7383 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
7384 about every identifier that contains the letter O because it might be
7385 confused with the digit 0, and so is not the default, but may be
7386 useful as a local coding convention if the programming environment 
7387 cannot be fixed to display these characters distinctly.
7389 @item -Wno-attribute-warning
7390 @opindex Wno-attribute-warning
7391 @opindex Wattribute-warning
7392 Do not warn about usage of functions (@pxref{Function Attributes})
7393 declared with @code{warning} attribute.  By default, this warning is
7394 enabled.  @option{-Wno-attribute-warning} can be used to disable the
7395 warning or @option{-Wno-error=attribute-warning} can be used to
7396 disable the error when compiled with @option{-Werror} flag.
7398 @item -Wno-deprecated
7399 @opindex Wno-deprecated
7400 @opindex Wdeprecated
7401 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
7403 @item -Wno-deprecated-declarations
7404 @opindex Wno-deprecated-declarations
7405 @opindex Wdeprecated-declarations
7406 Do not warn about uses of functions (@pxref{Function Attributes}),
7407 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7408 Attributes}) marked as deprecated by using the @code{deprecated}
7409 attribute.
7411 @item -Wno-overflow
7412 @opindex Wno-overflow
7413 @opindex Woverflow
7414 Do not warn about compile-time overflow in constant expressions.
7416 @item -Wno-odr
7417 @opindex Wno-odr
7418 @opindex Wodr
7419 Warn about One Definition Rule violations during link-time optimization.
7420 Enabled by default.
7422 @item -Wopenmp-simd
7423 @opindex Wopenmp-simd
7424 @opindex Wno-openmp-simd
7425 Warn if the vectorizer cost model overrides the OpenMP
7426 simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
7427 option can be used to relax the cost model.
7429 @item -Woverride-init @r{(C and Objective-C only)}
7430 @opindex Woverride-init
7431 @opindex Wno-override-init
7432 @opindex W
7433 @opindex Wextra
7434 @opindex Wno-extra
7435 Warn if an initialized field without side effects is overridden when
7436 using designated initializers (@pxref{Designated Inits, , Designated
7437 Initializers}).
7439 This warning is included in @option{-Wextra}.  To get other
7440 @option{-Wextra} warnings without this one, use @option{-Wextra
7441 -Wno-override-init}.
7443 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7444 @opindex Woverride-init-side-effects
7445 @opindex Wno-override-init-side-effects
7446 Warn if an initialized field with side effects is overridden when
7447 using designated initializers (@pxref{Designated Inits, , Designated
7448 Initializers}).  This warning is enabled by default.
7450 @item -Wpacked
7451 @opindex Wpacked
7452 @opindex Wno-packed
7453 Warn if a structure is given the packed attribute, but the packed
7454 attribute has no effect on the layout or size of the structure.
7455 Such structures may be mis-aligned for little benefit.  For
7456 instance, in this code, the variable @code{f.x} in @code{struct bar}
7457 is misaligned even though @code{struct bar} does not itself
7458 have the packed attribute:
7460 @smallexample
7461 @group
7462 struct foo @{
7463   int x;
7464   char a, b, c, d;
7465 @} __attribute__((packed));
7466 struct bar @{
7467   char z;
7468   struct foo f;
7470 @end group
7471 @end smallexample
7473 @item -Wpacked-bitfield-compat
7474 @opindex Wpacked-bitfield-compat
7475 @opindex Wno-packed-bitfield-compat
7476 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7477 on bit-fields of type @code{char}.  This has been fixed in GCC 4.4 but
7478 the change can lead to differences in the structure layout.  GCC
7479 informs you when the offset of such a field has changed in GCC 4.4.
7480 For example there is no longer a 4-bit padding between field @code{a}
7481 and @code{b} in this structure:
7483 @smallexample
7484 struct foo
7486   char a:4;
7487   char b:8;
7488 @} __attribute__ ((packed));
7489 @end smallexample
7491 This warning is enabled by default.  Use
7492 @option{-Wno-packed-bitfield-compat} to disable this warning.
7494 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7495 @opindex Wpacked-not-aligned
7496 @opindex Wno-packed-not-aligned
7497 Warn if a structure field with explicitly specified alignment in a
7498 packed struct or union is misaligned.  For example, a warning will
7499 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7500 'struct S' is less than 8}, in this code:
7502 @smallexample
7503 @group
7504 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7505 struct __attribute__ ((packed)) S @{
7506   struct S8 s8;
7508 @end group
7509 @end smallexample
7511 This warning is enabled by @option{-Wall}.
7513 @item -Wpadded
7514 @opindex Wpadded
7515 @opindex Wno-padded
7516 Warn if padding is included in a structure, either to align an element
7517 of the structure or to align the whole structure.  Sometimes when this
7518 happens it is possible to rearrange the fields of the structure to
7519 reduce the padding and so make the structure smaller.
7521 @item -Wredundant-decls
7522 @opindex Wredundant-decls
7523 @opindex Wno-redundant-decls
7524 Warn if anything is declared more than once in the same scope, even in
7525 cases where multiple declaration is valid and changes nothing.
7527 @item -Wno-restrict
7528 @opindex Wrestrict
7529 @opindex Wno-restrict
7530 Warn when an object referenced by a @code{restrict}-qualified parameter
7531 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7532 argument, or when copies between such objects overlap.  For example,
7533 the call to the @code{strcpy} function below attempts to truncate the string
7534 by replacing its initial characters with the last four.  However, because
7535 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7536 the call is diagnosed.
7538 @smallexample
7539 void foo (void)
7541   char a[] = "abcd1234";
7542   strcpy (a, a + 4);
7543   @dots{}
7545 @end smallexample
7546 The @option{-Wrestrict} option detects some instances of simple overlap
7547 even without optimization but works best at @option{-O2} and above.  It
7548 is included in @option{-Wall}.
7550 @item -Wnested-externs @r{(C and Objective-C only)}
7551 @opindex Wnested-externs
7552 @opindex Wno-nested-externs
7553 Warn if an @code{extern} declaration is encountered within a function.
7555 @item -Wno-inherited-variadic-ctor
7556 @opindex Winherited-variadic-ctor
7557 @opindex Wno-inherited-variadic-ctor
7558 Suppress warnings about use of C++11 inheriting constructors when the
7559 base class inherited from has a C variadic constructor; the warning is
7560 on by default because the ellipsis is not inherited.
7562 @item -Winline
7563 @opindex Winline
7564 @opindex Wno-inline
7565 Warn if a function that is declared as inline cannot be inlined.
7566 Even with this option, the compiler does not warn about failures to
7567 inline functions declared in system headers.
7569 The compiler uses a variety of heuristics to determine whether or not
7570 to inline a function.  For example, the compiler takes into account
7571 the size of the function being inlined and the amount of inlining
7572 that has already been done in the current function.  Therefore,
7573 seemingly insignificant changes in the source program can cause the
7574 warnings produced by @option{-Winline} to appear or disappear.
7576 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7577 @opindex Wno-invalid-offsetof
7578 @opindex Winvalid-offsetof
7579 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7580 type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
7581 to a non-standard-layout type is undefined.  In existing C++ implementations,
7582 however, @code{offsetof} typically gives meaningful results.
7583 This flag is for users who are aware that they are
7584 writing nonportable code and who have deliberately chosen to ignore the
7585 warning about it.
7587 The restrictions on @code{offsetof} may be relaxed in a future version
7588 of the C++ standard.
7590 @item -Wint-in-bool-context
7591 @opindex Wint-in-bool-context
7592 @opindex Wno-int-in-bool-context
7593 Warn for suspicious use of integer values where boolean values are expected,
7594 such as conditional expressions (?:) using non-boolean integer constants in
7595 boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
7596 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
7597 for all kinds of multiplications regardless of the data type.
7598 This warning is enabled by @option{-Wall}.
7600 @item -Wno-int-to-pointer-cast
7601 @opindex Wno-int-to-pointer-cast
7602 @opindex Wint-to-pointer-cast
7603 Suppress warnings from casts to pointer type of an integer of a
7604 different size. In C++, casting to a pointer type of smaller size is
7605 an error. @option{Wint-to-pointer-cast} is enabled by default.
7608 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7609 @opindex Wno-pointer-to-int-cast
7610 @opindex Wpointer-to-int-cast
7611 Suppress warnings from casts from a pointer to an integer type of a
7612 different size.
7614 @item -Winvalid-pch
7615 @opindex Winvalid-pch
7616 @opindex Wno-invalid-pch
7617 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7618 the search path but cannot be used.
7620 @item -Wlong-long
7621 @opindex Wlong-long
7622 @opindex Wno-long-long
7623 Warn if @code{long long} type is used.  This is enabled by either
7624 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7625 modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
7627 @item -Wvariadic-macros
7628 @opindex Wvariadic-macros
7629 @opindex Wno-variadic-macros
7630 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7631 alternate syntax is used in ISO C99 mode.  This is enabled by either
7632 @option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
7633 messages, use @option{-Wno-variadic-macros}.
7635 @item -Wvarargs
7636 @opindex Wvarargs
7637 @opindex Wno-varargs
7638 Warn upon questionable usage of the macros used to handle variable
7639 arguments like @code{va_start}.  This is default.  To inhibit the
7640 warning messages, use @option{-Wno-varargs}.
7642 @item -Wvector-operation-performance
7643 @opindex Wvector-operation-performance
7644 @opindex Wno-vector-operation-performance
7645 Warn if vector operation is not implemented via SIMD capabilities of the
7646 architecture.  Mainly useful for the performance tuning.
7647 Vector operation can be implemented @code{piecewise}, which means that the
7648 scalar operation is performed on every vector element; 
7649 @code{in parallel}, which means that the vector operation is implemented
7650 using scalars of wider type, which normally is more performance efficient;
7651 and @code{as a single scalar}, which means that vector fits into a
7652 scalar type.
7654 @item -Wno-virtual-move-assign
7655 @opindex Wvirtual-move-assign
7656 @opindex Wno-virtual-move-assign
7657 Suppress warnings about inheriting from a virtual base with a
7658 non-trivial C++11 move assignment operator.  This is dangerous because
7659 if the virtual base is reachable along more than one path, it is
7660 moved multiple times, which can mean both objects end up in the
7661 moved-from state.  If the move assignment operator is written to avoid
7662 moving from a moved-from object, this warning can be disabled.
7664 @item -Wvla
7665 @opindex Wvla
7666 @opindex Wno-vla
7667 Warn if a variable-length array is used in the code.
7668 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7669 the variable-length array.
7671 @item -Wvla-larger-than=@var{byte-size}
7672 @opindex Wvla-larger-than=
7673 @opindex Wno-vla-larger-than
7674 If this option is used, the compiler will warn for declarations of
7675 variable-length arrays whose size is either unbounded, or bounded
7676 by an argument that allows the array size to exceed @var{byte-size}
7677 bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7678 works, but with variable-length arrays.
7680 Note that GCC may optimize small variable-length arrays of a known
7681 value into plain arrays, so this warning may not get triggered for
7682 such arrays.
7684 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7685 is typically only effective when @option{-ftree-vrp} is active (default
7686 for @option{-O2} and above).
7688 See also @option{-Walloca-larger-than=@var{byte-size}}.
7690 @item -Wno-vla-larger-than
7691 @opindex Wno-vla-larger-than
7692 Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
7693 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7695 @item -Wvolatile-register-var
7696 @opindex Wvolatile-register-var
7697 @opindex Wno-volatile-register-var
7698 Warn if a register variable is declared volatile.  The volatile
7699 modifier does not inhibit all optimizations that may eliminate reads
7700 and/or writes to register variables.  This warning is enabled by
7701 @option{-Wall}.
7703 @item -Wdisabled-optimization
7704 @opindex Wdisabled-optimization
7705 @opindex Wno-disabled-optimization
7706 Warn if a requested optimization pass is disabled.  This warning does
7707 not generally indicate that there is anything wrong with your code; it
7708 merely indicates that GCC's optimizers are unable to handle the code
7709 effectively.  Often, the problem is that your code is too big or too
7710 complex; GCC refuses to optimize programs when the optimization
7711 itself is likely to take inordinate amounts of time.
7713 @item -Wpointer-sign @r{(C and Objective-C only)}
7714 @opindex Wpointer-sign
7715 @opindex Wno-pointer-sign
7716 Warn for pointer argument passing or assignment with different signedness.
7717 This option is only supported for C and Objective-C@.  It is implied by
7718 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7719 @option{-Wno-pointer-sign}.
7721 @item -Wstack-protector
7722 @opindex Wstack-protector
7723 @opindex Wno-stack-protector
7724 This option is only active when @option{-fstack-protector} is active.  It
7725 warns about functions that are not protected against stack smashing.
7727 @item -Woverlength-strings
7728 @opindex Woverlength-strings
7729 @opindex Wno-overlength-strings
7730 Warn about string constants that are longer than the ``minimum
7731 maximum'' length specified in the C standard.  Modern compilers
7732 generally allow string constants that are much longer than the
7733 standard's minimum limit, but very portable programs should avoid
7734 using longer strings.
7736 The limit applies @emph{after} string constant concatenation, and does
7737 not count the trailing NUL@.  In C90, the limit was 509 characters; in
7738 C99, it was raised to 4095.  C++98 does not specify a normative
7739 minimum maximum, so we do not diagnose overlength strings in C++@.
7741 This option is implied by @option{-Wpedantic}, and can be disabled with
7742 @option{-Wno-overlength-strings}.
7744 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7745 @opindex Wunsuffixed-float-constants
7746 @opindex Wno-unsuffixed-float-constants
7748 Issue a warning for any floating constant that does not have
7749 a suffix.  When used together with @option{-Wsystem-headers} it
7750 warns about such constants in system header files.  This can be useful
7751 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7752 from the decimal floating-point extension to C99.
7754 @item -Wno-designated-init @r{(C and Objective-C only)}
7755 Suppress warnings when a positional initializer is used to initialize
7756 a structure that has been marked with the @code{designated_init}
7757 attribute.
7759 @item -Whsa
7760 Issue a warning when HSAIL cannot be emitted for the compiled function or
7761 OpenMP construct.
7763 @end table
7765 @node Debugging Options
7766 @section Options for Debugging Your Program
7767 @cindex options, debugging
7768 @cindex debugging information options
7770 To tell GCC to emit extra information for use by a debugger, in almost 
7771 all cases you need only to add @option{-g} to your other options.
7773 GCC allows you to use @option{-g} with
7774 @option{-O}.  The shortcuts taken by optimized code may occasionally
7775 be surprising: some variables you declared may not exist
7776 at all; flow of control may briefly move where you did not expect it;
7777 some statements may not be executed because they compute constant
7778 results or their values are already at hand; some statements may
7779 execute in different places because they have been moved out of loops.
7780 Nevertheless it is possible to debug optimized output.  This makes
7781 it reasonable to use the optimizer for programs that might have bugs.
7783 If you are not using some other optimization option, consider
7784 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.  
7785 With no @option{-O} option at all, some compiler passes that collect
7786 information useful for debugging do not run at all, so that
7787 @option{-Og} may result in a better debugging experience.
7789 @table @gcctabopt
7790 @item -g
7791 @opindex g
7792 Produce debugging information in the operating system's native format
7793 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
7794 information.
7796 On most systems that use stabs format, @option{-g} enables use of extra
7797 debugging information that only GDB can use; this extra information
7798 makes debugging work better in GDB but probably makes other debuggers
7799 crash or
7800 refuse to read the program.  If you want to control for certain whether
7801 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7802 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7804 @item -ggdb
7805 @opindex ggdb
7806 Produce debugging information for use by GDB@.  This means to use the
7807 most expressive format available (DWARF, stabs, or the native format
7808 if neither of those are supported), including GDB extensions if at all
7809 possible.
7811 @item -gdwarf
7812 @itemx -gdwarf-@var{version}
7813 @opindex gdwarf
7814 Produce debugging information in DWARF format (if that is supported).
7815 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7816 for most targets is 4.  DWARF Version 5 is only experimental.
7818 Note that with DWARF Version 2, some ports require and always
7819 use some non-conflicting DWARF 3 extensions in the unwind tables.
7821 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7822 for maximum benefit.
7824 GCC no longer supports DWARF Version 1, which is substantially
7825 different than Version 2 and later.  For historical reasons, some
7826 other DWARF-related options such as
7827 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7828 in their names, but apply to all currently-supported versions of DWARF.
7830 @item -gstabs
7831 @opindex gstabs
7832 Produce debugging information in stabs format (if that is supported),
7833 without GDB extensions.  This is the format used by DBX on most BSD
7834 systems.  On MIPS, Alpha and System V Release 4 systems this option
7835 produces stabs debugging output that is not understood by DBX@.
7836 On System V Release 4 systems this option requires the GNU assembler.
7838 @item -gstabs+
7839 @opindex gstabs+
7840 Produce debugging information in stabs format (if that is supported),
7841 using GNU extensions understood only by the GNU debugger (GDB)@.  The
7842 use of these extensions is likely to make other debuggers crash or
7843 refuse to read the program.
7845 @item -gxcoff
7846 @opindex gxcoff
7847 Produce debugging information in XCOFF format (if that is supported).
7848 This is the format used by the DBX debugger on IBM RS/6000 systems.
7850 @item -gxcoff+
7851 @opindex gxcoff+
7852 Produce debugging information in XCOFF format (if that is supported),
7853 using GNU extensions understood only by the GNU debugger (GDB)@.  The
7854 use of these extensions is likely to make other debuggers crash or
7855 refuse to read the program, and may cause assemblers other than the GNU
7856 assembler (GAS) to fail with an error.
7858 @item -gvms
7859 @opindex gvms
7860 Produce debugging information in Alpha/VMS debug format (if that is
7861 supported).  This is the format used by DEBUG on Alpha/VMS systems.
7863 @item -g@var{level}
7864 @itemx -ggdb@var{level}
7865 @itemx -gstabs@var{level}
7866 @itemx -gxcoff@var{level}
7867 @itemx -gvms@var{level}
7868 Request debugging information and also use @var{level} to specify how
7869 much information.  The default level is 2.
7871 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
7872 @option{-g}.
7874 Level 1 produces minimal information, enough for making backtraces in
7875 parts of the program that you don't plan to debug.  This includes
7876 descriptions of functions and external variables, and line number
7877 tables, but no information about local variables.
7879 Level 3 includes extra information, such as all the macro definitions
7880 present in the program.  Some debuggers support macro expansion when
7881 you use @option{-g3}.
7883 If you use multiple @option{-g} options, with or without level numbers,
7884 the last such option is the one that is effective.
7886 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7887 confusion with @option{-gdwarf-@var{level}}.
7888 Instead use an additional @option{-g@var{level}} option to change the
7889 debug level for DWARF.
7891 @item -fno-eliminate-unused-debug-symbols
7892 @opindex feliminate-unused-debug-symbols
7893 @opindex fno-eliminate-unused-debug-symbols
7894 By default, no debug information is produced for symbols that are not actually
7895 used. Use this option if you want debug information for all symbols.
7897 @item -femit-class-debug-always
7898 @opindex femit-class-debug-always
7899 Instead of emitting debugging information for a C++ class in only one
7900 object file, emit it in all object files using the class.  This option
7901 should be used only with debuggers that are unable to handle the way GCC
7902 normally emits debugging information for classes because using this
7903 option increases the size of debugging information by as much as a
7904 factor of two.
7906 @item -fno-merge-debug-strings
7907 @opindex fmerge-debug-strings
7908 @opindex fno-merge-debug-strings
7909 Direct the linker to not merge together strings in the debugging
7910 information that are identical in different object files.  Merging is
7911 not supported by all assemblers or linkers.  Merging decreases the size
7912 of the debug information in the output file at the cost of increasing
7913 link processing time.  Merging is enabled by default.
7915 @item -fdebug-prefix-map=@var{old}=@var{new}
7916 @opindex fdebug-prefix-map
7917 When compiling files residing in directory @file{@var{old}}, record
7918 debugging information describing them as if the files resided in
7919 directory @file{@var{new}} instead.  This can be used to replace a
7920 build-time path with an install-time path in the debug info.  It can
7921 also be used to change an absolute path to a relative path by using
7922 @file{.} for @var{new}.  This can give more reproducible builds, which
7923 are location independent, but may require an extra command to tell GDB
7924 where to find the source files. See also @option{-ffile-prefix-map}.
7926 @item -fvar-tracking
7927 @opindex fvar-tracking
7928 Run variable tracking pass.  It computes where variables are stored at each
7929 position in code.  Better debugging information is then generated
7930 (if the debugging information format supports this information).
7932 It is enabled by default when compiling with optimization (@option{-Os},
7933 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7934 the debug info format supports it.
7936 @item -fvar-tracking-assignments
7937 @opindex fvar-tracking-assignments
7938 @opindex fno-var-tracking-assignments
7939 Annotate assignments to user variables early in the compilation and
7940 attempt to carry the annotations over throughout the compilation all the
7941 way to the end, in an attempt to improve debug information while
7942 optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
7944 It can be enabled even if var-tracking is disabled, in which case
7945 annotations are created and maintained, but discarded at the end.
7946 By default, this flag is enabled together with @option{-fvar-tracking},
7947 except when selective scheduling is enabled.
7949 @item -gsplit-dwarf
7950 @opindex gsplit-dwarf
7951 Separate as much DWARF debugging information as possible into a
7952 separate output file with the extension @file{.dwo}.  This option allows
7953 the build system to avoid linking files with debug information.  To
7954 be useful, this option requires a debugger capable of reading @file{.dwo}
7955 files.
7957 @item -gdescribe-dies
7958 @opindex gdescribe-dies
7959 Add description attributes to some DWARF DIEs that have no name attribute,
7960 such as artificial variables, external references and call site
7961 parameter DIEs.
7963 @item -gpubnames
7964 @opindex gpubnames
7965 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7967 @item -ggnu-pubnames
7968 @opindex ggnu-pubnames
7969 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7970 suitable for conversion into a GDB@ index.  This option is only useful
7971 with a linker that can produce GDB@ index version 7.
7973 @item -fdebug-types-section
7974 @opindex fdebug-types-section
7975 @opindex fno-debug-types-section
7976 When using DWARF Version 4 or higher, type DIEs can be put into
7977 their own @code{.debug_types} section instead of making them part of the
7978 @code{.debug_info} section.  It is more efficient to put them in a separate
7979 comdat section since the linker can then remove duplicates.
7980 But not all DWARF consumers support @code{.debug_types} sections yet
7981 and on some objects @code{.debug_types} produces larger instead of smaller
7982 debugging information.
7984 @item -grecord-gcc-switches
7985 @itemx -gno-record-gcc-switches
7986 @opindex grecord-gcc-switches
7987 @opindex gno-record-gcc-switches
7988 This switch causes the command-line options used to invoke the
7989 compiler that may affect code generation to be appended to the
7990 DW_AT_producer attribute in DWARF debugging information.  The options
7991 are concatenated with spaces separating them from each other and from
7992 the compiler version.  
7993 It is enabled by default.
7994 See also @option{-frecord-gcc-switches} for another
7995 way of storing compiler options into the object file.  
7997 @item -gstrict-dwarf
7998 @opindex gstrict-dwarf
7999 Disallow using extensions of later DWARF standard version than selected
8000 with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
8001 DWARF extensions from later standard versions is allowed.
8003 @item -gno-strict-dwarf
8004 @opindex gno-strict-dwarf
8005 Allow using extensions of later DWARF standard version than selected with
8006 @option{-gdwarf-@var{version}}.
8008 @item -gas-loc-support
8009 @opindex gas-loc-support
8010 Inform the compiler that the assembler supports @code{.loc} directives.
8011 It may then use them for the assembler to generate DWARF2+ line number
8012 tables.
8014 This is generally desirable, because assembler-generated line-number
8015 tables are a lot more compact than those the compiler can generate
8016 itself.
8018 This option will be enabled by default if, at GCC configure time, the
8019 assembler was found to support such directives.
8021 @item -gno-as-loc-support
8022 @opindex gno-as-loc-support
8023 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8024 line number tables are to be generated.
8026 @item -gas-locview-support
8027 @opindex gas-locview-support
8028 Inform the compiler that the assembler supports @code{view} assignment
8029 and reset assertion checking in @code{.loc} directives.
8031 This option will be enabled by default if, at GCC configure time, the
8032 assembler was found to support them.
8034 @item -gno-as-locview-support
8035 Force GCC to assign view numbers internally, if
8036 @option{-gvariable-location-views} are explicitly requested.
8038 @item -gcolumn-info
8039 @itemx -gno-column-info
8040 @opindex gcolumn-info
8041 @opindex gno-column-info
8042 Emit location column information into DWARF debugging information, rather
8043 than just file and line.
8044 This option is enabled by default.
8046 @item -gstatement-frontiers
8047 @itemx -gno-statement-frontiers
8048 @opindex gstatement-frontiers
8049 @opindex gno-statement-frontiers
8050 This option causes GCC to create markers in the internal representation
8051 at the beginning of statements, and to keep them roughly in place
8052 throughout compilation, using them to guide the output of @code{is_stmt}
8053 markers in the line number table.  This is enabled by default when
8054 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8055 @dots{}), and outputting DWARF 2 debug information at the normal level.
8057 @item -gvariable-location-views
8058 @itemx -gvariable-location-views=incompat5
8059 @itemx -gno-variable-location-views
8060 @opindex gvariable-location-views
8061 @opindex gvariable-location-views=incompat5
8062 @opindex gno-variable-location-views
8063 Augment variable location lists with progressive view numbers implied
8064 from the line number table.  This enables debug information consumers to
8065 inspect state at certain points of the program, even if no instructions
8066 associated with the corresponding source locations are present at that
8067 point.  If the assembler lacks support for view numbers in line number
8068 tables, this will cause the compiler to emit the line number table,
8069 which generally makes them somewhat less compact.  The augmented line
8070 number tables and location lists are fully backward-compatible, so they
8071 can be consumed by debug information consumers that are not aware of
8072 these augmentations, but they won't derive any benefit from them either.
8074 This is enabled by default when outputting DWARF 2 debug information at
8075 the normal level, as long as there is assembler support,
8076 @option{-fvar-tracking-assignments} is enabled and
8077 @option{-gstrict-dwarf} is not.  When assembler support is not
8078 available, this may still be enabled, but it will force GCC to output
8079 internal line number tables, and if
8080 @option{-ginternal-reset-location-views} is not enabled, that will most
8081 certainly lead to silently mismatching location views.
8083 There is a proposed representation for view numbers that is not backward
8084 compatible with the location list format introduced in DWARF 5, that can
8085 be enabled with @option{-gvariable-location-views=incompat5}.  This
8086 option may be removed in the future, is only provided as a reference
8087 implementation of the proposed representation.  Debug information
8088 consumers are not expected to support this extended format, and they
8089 would be rendered unable to decode location lists using it.
8091 @item -ginternal-reset-location-views
8092 @itemx -gnointernal-reset-location-views
8093 @opindex ginternal-reset-location-views
8094 @opindex gno-internal-reset-location-views
8095 Attempt to determine location views that can be omitted from location
8096 view lists.  This requires the compiler to have very accurate insn
8097 length estimates, which isn't always the case, and it may cause
8098 incorrect view lists to be generated silently when using an assembler
8099 that does not support location view lists.  The GNU assembler will flag
8100 any such error as a @code{view number mismatch}.  This is only enabled
8101 on ports that define a reliable estimation function.
8103 @item -ginline-points
8104 @itemx -gno-inline-points
8105 @opindex ginline-points
8106 @opindex gno-inline-points
8107 Generate extended debug information for inlined functions.  Location
8108 view tracking markers are inserted at inlined entry points, so that
8109 address and view numbers can be computed and output in debug
8110 information.  This can be enabled independently of location views, in
8111 which case the view numbers won't be output, but it can only be enabled
8112 along with statement frontiers, and it is only enabled by default if
8113 location views are enabled.
8115 @item -gz@r{[}=@var{type}@r{]}
8116 @opindex gz
8117 Produce compressed debug sections in DWARF format, if that is supported.
8118 If @var{type} is not given, the default type depends on the capabilities
8119 of the assembler and linker used.  @var{type} may be one of
8120 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8121 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8122 compression in traditional GNU format).  If the linker doesn't support
8123 writing compressed debug sections, the option is rejected.  Otherwise,
8124 if the assembler does not support them, @option{-gz} is silently ignored
8125 when producing object files.
8127 @item -femit-struct-debug-baseonly
8128 @opindex femit-struct-debug-baseonly
8129 Emit debug information for struct-like types
8130 only when the base name of the compilation source file
8131 matches the base name of file in which the struct is defined.
8133 This option substantially reduces the size of debugging information,
8134 but at significant potential loss in type information to the debugger.
8135 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8136 See @option{-femit-struct-debug-detailed} for more detailed control.
8138 This option works only with DWARF debug output.
8140 @item -femit-struct-debug-reduced
8141 @opindex femit-struct-debug-reduced
8142 Emit debug information for struct-like types
8143 only when the base name of the compilation source file
8144 matches the base name of file in which the type is defined,
8145 unless the struct is a template or defined in a system header.
8147 This option significantly reduces the size of debugging information,
8148 with some potential loss in type information to the debugger.
8149 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8150 See @option{-femit-struct-debug-detailed} for more detailed control.
8152 This option works only with DWARF debug output.
8154 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8155 @opindex femit-struct-debug-detailed
8156 Specify the struct-like types
8157 for which the compiler generates debug information.
8158 The intent is to reduce duplicate struct debug information
8159 between different object files within the same program.
8161 This option is a detailed version of
8162 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8163 which serves for most needs.
8165 A specification has the syntax@*
8166 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8168 The optional first word limits the specification to
8169 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8170 A struct type is used directly when it is the type of a variable, member.
8171 Indirect uses arise through pointers to structs.
8172 That is, when use of an incomplete struct is valid, the use is indirect.
8173 An example is
8174 @samp{struct one direct; struct two * indirect;}.
8176 The optional second word limits the specification to
8177 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8178 Generic structs are a bit complicated to explain.
8179 For C++, these are non-explicit specializations of template classes,
8180 or non-template classes within the above.
8181 Other programming languages have generics,
8182 but @option{-femit-struct-debug-detailed} does not yet implement them.
8184 The third word specifies the source files for those
8185 structs for which the compiler should emit debug information.
8186 The values @samp{none} and @samp{any} have the normal meaning.
8187 The value @samp{base} means that
8188 the base of name of the file in which the type declaration appears
8189 must match the base of the name of the main compilation file.
8190 In practice, this means that when compiling @file{foo.c}, debug information
8191 is generated for types declared in that file and @file{foo.h},
8192 but not other header files.
8193 The value @samp{sys} means those types satisfying @samp{base}
8194 or declared in system or compiler headers.
8196 You may need to experiment to determine the best settings for your application.
8198 The default is @option{-femit-struct-debug-detailed=all}.
8200 This option works only with DWARF debug output.
8202 @item -fno-dwarf2-cfi-asm
8203 @opindex fdwarf2-cfi-asm
8204 @opindex fno-dwarf2-cfi-asm
8205 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8206 instead of using GAS @code{.cfi_*} directives.
8208 @item -fno-eliminate-unused-debug-types
8209 @opindex feliminate-unused-debug-types
8210 @opindex fno-eliminate-unused-debug-types
8211 Normally, when producing DWARF output, GCC avoids producing debug symbol 
8212 output for types that are nowhere used in the source file being compiled.
8213 Sometimes it is useful to have GCC emit debugging
8214 information for all types declared in a compilation
8215 unit, regardless of whether or not they are actually used
8216 in that compilation unit, for example 
8217 if, in the debugger, you want to cast a value to a type that is
8218 not actually used in your program (but is declared).  More often,
8219 however, this results in a significant amount of wasted space.
8220 @end table
8222 @node Optimize Options
8223 @section Options That Control Optimization
8224 @cindex optimize options
8225 @cindex options, optimization
8227 These options control various sorts of optimizations.
8229 Without any optimization option, the compiler's goal is to reduce the
8230 cost of compilation and to make debugging produce the expected
8231 results.  Statements are independent: if you stop the program with a
8232 breakpoint between statements, you can then assign a new value to any
8233 variable or change the program counter to any other statement in the
8234 function and get exactly the results you expect from the source
8235 code.
8237 Turning on optimization flags makes the compiler attempt to improve
8238 the performance and/or code size at the expense of compilation time
8239 and possibly the ability to debug the program.
8241 The compiler performs optimization based on the knowledge it has of the
8242 program.  Compiling multiple files at once to a single output file mode allows
8243 the compiler to use information gained from all of the files when compiling
8244 each of them.
8246 Not all optimizations are controlled directly by a flag.  Only
8247 optimizations that have a flag are listed in this section.
8249 Most optimizations are completely disabled at @option{-O0} or if an
8250 @option{-O} level is not set on the command line, even if individual
8251 optimization flags are specified.  Similarly, @option{-Og} suppresses
8252 many optimization passes.
8254 Depending on the target and how GCC was configured, a slightly different
8255 set of optimizations may be enabled at each @option{-O} level than
8256 those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
8257 to find out the exact set of optimizations that are enabled at each level.
8258 @xref{Overall Options}, for examples.
8260 @table @gcctabopt
8261 @item -O
8262 @itemx -O1
8263 @opindex O
8264 @opindex O1
8265 Optimize.  Optimizing compilation takes somewhat more time, and a lot
8266 more memory for a large function.
8268 With @option{-O}, the compiler tries to reduce code size and execution
8269 time, without performing any optimizations that take a great deal of
8270 compilation time.
8272 @c Note that in addition to the default_options_table list in opts.c,
8273 @c several optimization flags default to true but control optimization
8274 @c passes that are explicitly disabled at -O0.
8276 @option{-O} turns on the following optimization flags:
8278 @c Please keep the following list alphabetized.
8279 @gccoptlist{-fauto-inc-dec @gol
8280 -fbranch-count-reg @gol
8281 -fcombine-stack-adjustments @gol
8282 -fcompare-elim @gol
8283 -fcprop-registers @gol
8284 -fdce @gol
8285 -fdefer-pop @gol
8286 -fdelayed-branch @gol
8287 -fdse @gol
8288 -fforward-propagate @gol
8289 -fguess-branch-probability @gol
8290 -fif-conversion @gol
8291 -fif-conversion2 @gol
8292 -finline-functions-called-once @gol
8293 -fipa-profile @gol
8294 -fipa-pure-const @gol
8295 -fipa-reference @gol
8296 -fipa-reference-addressable @gol
8297 -fmerge-constants @gol
8298 -fmove-loop-invariants @gol
8299 -fomit-frame-pointer @gol
8300 -freorder-blocks @gol
8301 -fshrink-wrap @gol
8302 -fshrink-wrap-separate @gol
8303 -fsplit-wide-types @gol
8304 -fssa-backprop @gol
8305 -fssa-phiopt @gol
8306 -ftree-bit-ccp @gol
8307 -ftree-ccp @gol
8308 -ftree-ch @gol
8309 -ftree-coalesce-vars @gol
8310 -ftree-copy-prop @gol
8311 -ftree-dce @gol
8312 -ftree-dominator-opts @gol
8313 -ftree-dse @gol
8314 -ftree-forwprop @gol
8315 -ftree-fre @gol
8316 -ftree-phiprop @gol
8317 -ftree-pta @gol
8318 -ftree-scev-cprop @gol
8319 -ftree-sink @gol
8320 -ftree-slsr @gol
8321 -ftree-sra @gol
8322 -ftree-ter @gol
8323 -funit-at-a-time}
8325 @item -O2
8326 @opindex O2
8327 Optimize even more.  GCC performs nearly all supported optimizations
8328 that do not involve a space-speed tradeoff.
8329 As compared to @option{-O}, this option increases both compilation time
8330 and the performance of the generated code.
8332 @option{-O2} turns on all optimization flags specified by @option{-O}.  It
8333 also turns on the following optimization flags:
8335 @c Please keep the following list alphabetized!
8336 @gccoptlist{-falign-functions  -falign-jumps @gol
8337 -falign-labels  -falign-loops @gol
8338 -fcaller-saves @gol
8339 -fcode-hoisting @gol
8340 -fcrossjumping @gol
8341 -fcse-follow-jumps  -fcse-skip-blocks @gol
8342 -fdelete-null-pointer-checks @gol
8343 -fdevirtualize  -fdevirtualize-speculatively @gol
8344 -fexpensive-optimizations @gol
8345 -ffinite-loops @gol
8346 -fgcse  -fgcse-lm  @gol
8347 -fhoist-adjacent-loads @gol
8348 -finline-small-functions @gol
8349 -findirect-inlining @gol
8350 -fipa-bit-cp  -fipa-cp  -fipa-icf @gol
8351 -fipa-ra  -fipa-sra  -fipa-vrp @gol
8352 -fisolate-erroneous-paths-dereference @gol
8353 -flra-remat @gol
8354 -foptimize-sibling-calls @gol
8355 -foptimize-strlen @gol
8356 -fpartial-inlining @gol
8357 -fpeephole2 @gol
8358 -freorder-blocks-algorithm=stc @gol
8359 -freorder-blocks-and-partition  -freorder-functions @gol
8360 -frerun-cse-after-loop  @gol
8361 -fschedule-insns  -fschedule-insns2 @gol
8362 -fsched-interblock  -fsched-spec @gol
8363 -fstore-merging @gol
8364 -fstrict-aliasing @gol
8365 -fthread-jumps @gol
8366 -ftree-builtin-call-dce @gol
8367 -ftree-pre @gol
8368 -ftree-switch-conversion  -ftree-tail-merge @gol
8369 -ftree-vrp}
8371 Please note the warning under @option{-fgcse} about
8372 invoking @option{-O2} on programs that use computed gotos.
8374 @item -O3
8375 @opindex O3
8376 Optimize yet more.  @option{-O3} turns on all optimizations specified
8377 by @option{-O2} and also turns on the following optimization flags:
8379 @c Please keep the following list alphabetized!
8380 @gccoptlist{-fgcse-after-reload @gol
8381 -finline-functions @gol
8382 -fipa-cp-clone
8383 -floop-interchange @gol
8384 -floop-unroll-and-jam @gol
8385 -fpeel-loops @gol
8386 -fpredictive-commoning @gol
8387 -fsplit-paths @gol
8388 -ftree-loop-distribute-patterns @gol
8389 -ftree-loop-distribution @gol
8390 -ftree-loop-vectorize @gol
8391 -ftree-partial-pre @gol
8392 -ftree-slp-vectorize @gol
8393 -funswitch-loops @gol
8394 -fvect-cost-model @gol
8395 -fversion-loops-for-strides}
8397 @item -O0
8398 @opindex O0
8399 Reduce compilation time and make debugging produce the expected
8400 results.  This is the default.
8402 @item -Os
8403 @opindex Os
8404 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations 
8405 except those that often increase code size:
8407 @gccoptlist{-falign-functions  -falign-jumps @gol
8408 -falign-labels  -falign-loops @gol
8409 -fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
8411 It also enables @option{-finline-functions}, causes the compiler to tune for
8412 code size rather than execution speed, and performs further optimizations
8413 designed to reduce code size.
8415 @item -Ofast
8416 @opindex Ofast
8417 Disregard strict standards compliance.  @option{-Ofast} enables all
8418 @option{-O3} optimizations.  It also enables optimizations that are not
8419 valid for all standard-compliant programs.
8420 It turns on @option{-ffast-math} and the Fortran-specific
8421 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8422 specified, and @option{-fno-protect-parens}.
8424 @item -Og
8425 @opindex Og
8426 Optimize debugging experience.  @option{-Og} should be the optimization
8427 level of choice for the standard edit-compile-debug cycle, offering
8428 a reasonable level of optimization while maintaining fast compilation
8429 and a good debugging experience.  It is a better choice than @option{-O0}
8430 for producing debuggable code because some compiler passes
8431 that collect debug information are disabled at @option{-O0}.
8433 Like @option{-O0}, @option{-Og} completely disables a number of 
8434 optimization passes so that individual options controlling them have
8435 no effect.  Otherwise @option{-Og} enables all @option{-O1} 
8436 optimization flags except for those that may interfere with debugging:
8438 @gccoptlist{-fbranch-count-reg  -fdelayed-branch @gol
8439 -fdse  -fif-conversion  -fif-conversion2  @gol
8440 -finline-functions-called-once @gol
8441 -fmove-loop-invariants  -fssa-phiopt @gol
8442 -ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
8444 @end table
8446 If you use multiple @option{-O} options, with or without level numbers,
8447 the last such option is the one that is effective.
8449 Options of the form @option{-f@var{flag}} specify machine-independent
8450 flags.  Most flags have both positive and negative forms; the negative
8451 form of @option{-ffoo} is @option{-fno-foo}.  In the table
8452 below, only one of the forms is listed---the one you typically 
8453 use.  You can figure out the other form by either removing @samp{no-}
8454 or adding it.
8456 The following options control specific optimizations.  They are either
8457 activated by @option{-O} options or are related to ones that are.  You
8458 can use the following flags in the rare cases when ``fine-tuning'' of
8459 optimizations to be performed is desired.
8461 @table @gcctabopt
8462 @item -fno-defer-pop
8463 @opindex fno-defer-pop
8464 @opindex fdefer-pop
8465 For machines that must pop arguments after a function call, always pop 
8466 the arguments as soon as each function returns.  
8467 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8468 this allows the compiler to let arguments accumulate on the stack for several
8469 function calls and pop them all at once.
8471 @item -fforward-propagate
8472 @opindex fforward-propagate
8473 Perform a forward propagation pass on RTL@.  The pass tries to combine two
8474 instructions and checks if the result can be simplified.  If loop unrolling
8475 is active, two passes are performed and the second is scheduled after
8476 loop unrolling.
8478 This option is enabled by default at optimization levels @option{-O},
8479 @option{-O2}, @option{-O3}, @option{-Os}.
8481 @item -ffp-contract=@var{style}
8482 @opindex ffp-contract
8483 @option{-ffp-contract=off} disables floating-point expression contraction.
8484 @option{-ffp-contract=fast} enables floating-point expression contraction
8485 such as forming of fused multiply-add operations if the target has
8486 native support for them.
8487 @option{-ffp-contract=on} enables floating-point expression contraction
8488 if allowed by the language standard.  This is currently not implemented
8489 and treated equal to @option{-ffp-contract=off}.
8491 The default is @option{-ffp-contract=fast}.
8493 @item -fomit-frame-pointer
8494 @opindex fomit-frame-pointer
8495 Omit the frame pointer in functions that don't need one.  This avoids the
8496 instructions to save, set up and restore the frame pointer; on many targets
8497 it also makes an extra register available.
8499 On some targets this flag has no effect because the standard calling sequence
8500 always uses a frame pointer, so it cannot be omitted.
8502 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8503 is used in all functions.  Several targets always omit the frame pointer in
8504 leaf functions.
8506 Enabled by default at @option{-O} and higher.
8508 @item -foptimize-sibling-calls
8509 @opindex foptimize-sibling-calls
8510 Optimize sibling and tail recursive calls.
8512 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8514 @item -foptimize-strlen
8515 @opindex foptimize-strlen
8516 Optimize various standard C string functions (e.g.@: @code{strlen},
8517 @code{strchr} or @code{strcpy}) and
8518 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8520 Enabled at levels @option{-O2}, @option{-O3}.
8522 @item -fno-inline
8523 @opindex fno-inline
8524 @opindex finline
8525 Do not expand any functions inline apart from those marked with
8526 the @code{always_inline} attribute.  This is the default when not
8527 optimizing.
8529 Single functions can be exempted from inlining by marking them
8530 with the @code{noinline} attribute.
8532 @item -finline-small-functions
8533 @opindex finline-small-functions
8534 Integrate functions into their callers when their body is smaller than expected
8535 function call code (so overall size of program gets smaller).  The compiler
8536 heuristically decides which functions are simple enough to be worth integrating
8537 in this way.  This inlining applies to all functions, even those not declared
8538 inline.
8540 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8542 @item -findirect-inlining
8543 @opindex findirect-inlining
8544 Inline also indirect calls that are discovered to be known at compile
8545 time thanks to previous inlining.  This option has any effect only
8546 when inlining itself is turned on by the @option{-finline-functions}
8547 or @option{-finline-small-functions} options.
8549 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8551 @item -finline-functions
8552 @opindex finline-functions
8553 Consider all functions for inlining, even if they are not declared inline.
8554 The compiler heuristically decides which functions are worth integrating
8555 in this way.
8557 If all calls to a given function are integrated, and the function is
8558 declared @code{static}, then the function is normally not output as
8559 assembler code in its own right.
8561 Enabled at levels @option{-O3}, @option{-Os}.  Also enabled
8562 by @option{-fprofile-use} and @option{-fauto-profile}.
8564 @item -finline-functions-called-once
8565 @opindex finline-functions-called-once
8566 Consider all @code{static} functions called once for inlining into their
8567 caller even if they are not marked @code{inline}.  If a call to a given
8568 function is integrated, then the function is not output as assembler code
8569 in its own right.
8571 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8572 but not @option{-Og}.
8574 @item -fearly-inlining
8575 @opindex fearly-inlining
8576 Inline functions marked by @code{always_inline} and functions whose body seems
8577 smaller than the function call overhead early before doing
8578 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
8579 makes profiling significantly cheaper and usually inlining faster on programs
8580 having large chains of nested wrapper functions.
8582 Enabled by default.
8584 @item -fipa-sra
8585 @opindex fipa-sra
8586 Perform interprocedural scalar replacement of aggregates, removal of
8587 unused parameters and replacement of parameters passed by reference
8588 by parameters passed by value.
8590 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8592 @item -finline-limit=@var{n}
8593 @opindex finline-limit
8594 By default, GCC limits the size of functions that can be inlined.  This flag
8595 allows coarse control of this limit.  @var{n} is the size of functions that
8596 can be inlined in number of pseudo instructions.
8598 Inlining is actually controlled by a number of parameters, which may be
8599 specified individually by using @option{--param @var{name}=@var{value}}.
8600 The @option{-finline-limit=@var{n}} option sets some of these parameters
8601 as follows:
8603 @table @gcctabopt
8604 @item max-inline-insns-single
8605 is set to @var{n}/2.
8606 @item max-inline-insns-auto
8607 is set to @var{n}/2.
8608 @end table
8610 See below for a documentation of the individual
8611 parameters controlling inlining and for the defaults of these parameters.
8613 @emph{Note:} there may be no value to @option{-finline-limit} that results
8614 in default behavior.
8616 @emph{Note:} pseudo instruction represents, in this particular context, an
8617 abstract measurement of function's size.  In no way does it represent a count
8618 of assembly instructions and as such its exact meaning might change from one
8619 release to an another.
8621 @item -fno-keep-inline-dllexport
8622 @opindex fno-keep-inline-dllexport
8623 @opindex fkeep-inline-dllexport
8624 This is a more fine-grained version of @option{-fkeep-inline-functions},
8625 which applies only to functions that are declared using the @code{dllexport}
8626 attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
8627 Functions}.
8629 @item -fkeep-inline-functions
8630 @opindex fkeep-inline-functions
8631 In C, emit @code{static} functions that are declared @code{inline}
8632 into the object file, even if the function has been inlined into all
8633 of its callers.  This switch does not affect functions using the
8634 @code{extern inline} extension in GNU C90@.  In C++, emit any and all
8635 inline functions into the object file.
8637 @item -fkeep-static-functions
8638 @opindex fkeep-static-functions
8639 Emit @code{static} functions into the object file, even if the function
8640 is never used.
8642 @item -fkeep-static-consts
8643 @opindex fkeep-static-consts
8644 Emit variables declared @code{static const} when optimization isn't turned
8645 on, even if the variables aren't referenced.
8647 GCC enables this option by default.  If you want to force the compiler to
8648 check if a variable is referenced, regardless of whether or not
8649 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8651 @item -fmerge-constants
8652 @opindex fmerge-constants
8653 Attempt to merge identical constants (string constants and floating-point
8654 constants) across compilation units.
8656 This option is the default for optimized compilation if the assembler and
8657 linker support it.  Use @option{-fno-merge-constants} to inhibit this
8658 behavior.
8660 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8662 @item -fmerge-all-constants
8663 @opindex fmerge-all-constants
8664 Attempt to merge identical constants and identical variables.
8666 This option implies @option{-fmerge-constants}.  In addition to
8667 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8668 arrays or initialized constant variables with integral or floating-point
8669 types.  Languages like C or C++ require each variable, including multiple
8670 instances of the same variable in recursive calls, to have distinct locations,
8671 so using this option results in non-conforming
8672 behavior.
8674 @item -fmodulo-sched
8675 @opindex fmodulo-sched
8676 Perform swing modulo scheduling immediately before the first scheduling
8677 pass.  This pass looks at innermost loops and reorders their
8678 instructions by overlapping different iterations.
8680 @item -fmodulo-sched-allow-regmoves
8681 @opindex fmodulo-sched-allow-regmoves
8682 Perform more aggressive SMS-based modulo scheduling with register moves
8683 allowed.  By setting this flag certain anti-dependences edges are
8684 deleted, which triggers the generation of reg-moves based on the
8685 life-range analysis.  This option is effective only with
8686 @option{-fmodulo-sched} enabled.
8688 @item -fno-branch-count-reg
8689 @opindex fno-branch-count-reg
8690 @opindex fbranch-count-reg
8691 Disable the optimization pass that scans for opportunities to use 
8692 ``decrement and branch'' instructions on a count register instead of
8693 instruction sequences that decrement a register, compare it against zero, and
8694 then branch based upon the result.  This option is only meaningful on
8695 architectures that support such instructions, which include x86, PowerPC,
8696 IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
8697 doesn't remove the decrement and branch instructions from the generated
8698 instruction stream introduced by other optimization passes.
8700 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8701 except for @option{-Og}.
8703 @item -fno-function-cse
8704 @opindex fno-function-cse
8705 @opindex ffunction-cse
8706 Do not put function addresses in registers; make each instruction that
8707 calls a constant function contain the function's address explicitly.
8709 This option results in less efficient code, but some strange hacks
8710 that alter the assembler output may be confused by the optimizations
8711 performed when this option is not used.
8713 The default is @option{-ffunction-cse}
8715 @item -fno-zero-initialized-in-bss
8716 @opindex fno-zero-initialized-in-bss
8717 @opindex fzero-initialized-in-bss
8718 If the target supports a BSS section, GCC by default puts variables that
8719 are initialized to zero into BSS@.  This can save space in the resulting
8720 code.
8722 This option turns off this behavior because some programs explicitly
8723 rely on variables going to the data section---e.g., so that the
8724 resulting executable can find the beginning of that section and/or make
8725 assumptions based on that.
8727 The default is @option{-fzero-initialized-in-bss}.
8729 @item -fthread-jumps
8730 @opindex fthread-jumps
8731 Perform optimizations that check to see if a jump branches to a
8732 location where another comparison subsumed by the first is found.  If
8733 so, the first branch is redirected to either the destination of the
8734 second branch or a point immediately following it, depending on whether
8735 the condition is known to be true or false.
8737 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8739 @item -fsplit-wide-types
8740 @opindex fsplit-wide-types
8741 When using a type that occupies multiple registers, such as @code{long
8742 long} on a 32-bit system, split the registers apart and allocate them
8743 independently.  This normally generates better code for those types,
8744 but may make debugging more difficult.
8746 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8747 @option{-Os}.
8749 @item -fsplit-wide-types-early
8750 @opindex fsplit-wide-types-early
8751 Fully split wide types early, instead of very late.
8752 This option has no effect unless @option{-fsplit-wide-types} is turned on.
8754 This is the default on some targets.
8756 @item -fcse-follow-jumps
8757 @opindex fcse-follow-jumps
8758 In common subexpression elimination (CSE), scan through jump instructions
8759 when the target of the jump is not reached by any other path.  For
8760 example, when CSE encounters an @code{if} statement with an
8761 @code{else} clause, CSE follows the jump when the condition
8762 tested is false.
8764 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8766 @item -fcse-skip-blocks
8767 @opindex fcse-skip-blocks
8768 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8769 follow jumps that conditionally skip over blocks.  When CSE
8770 encounters a simple @code{if} statement with no else clause,
8771 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8772 body of the @code{if}.
8774 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8776 @item -frerun-cse-after-loop
8777 @opindex frerun-cse-after-loop
8778 Re-run common subexpression elimination after loop optimizations are
8779 performed.
8781 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8783 @item -fgcse
8784 @opindex fgcse
8785 Perform a global common subexpression elimination pass.
8786 This pass also performs global constant and copy propagation.
8788 @emph{Note:} When compiling a program using computed gotos, a GCC
8789 extension, you may get better run-time performance if you disable
8790 the global common subexpression elimination pass by adding
8791 @option{-fno-gcse} to the command line.
8793 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8795 @item -fgcse-lm
8796 @opindex fgcse-lm
8797 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8798 attempts to move loads that are only killed by stores into themselves.  This
8799 allows a loop containing a load/store sequence to be changed to a load outside
8800 the loop, and a copy/store within the loop.
8802 Enabled by default when @option{-fgcse} is enabled.
8804 @item -fgcse-sm
8805 @opindex fgcse-sm
8806 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8807 global common subexpression elimination.  This pass attempts to move
8808 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
8809 loops containing a load/store sequence can be changed to a load before
8810 the loop and a store after the loop.
8812 Not enabled at any optimization level.
8814 @item -fgcse-las
8815 @opindex fgcse-las
8816 When @option{-fgcse-las} is enabled, the global common subexpression
8817 elimination pass eliminates redundant loads that come after stores to the
8818 same memory location (both partial and full redundancies).
8820 Not enabled at any optimization level.
8822 @item -fgcse-after-reload
8823 @opindex fgcse-after-reload
8824 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8825 pass is performed after reload.  The purpose of this pass is to clean up
8826 redundant spilling.
8828 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8830 @item -faggressive-loop-optimizations
8831 @opindex faggressive-loop-optimizations
8832 This option tells the loop optimizer to use language constraints to
8833 derive bounds for the number of iterations of a loop.  This assumes that
8834 loop code does not invoke undefined behavior by for example causing signed
8835 integer overflows or out-of-bound array accesses.  The bounds for the
8836 number of iterations of a loop are used to guide loop unrolling and peeling
8837 and loop exit test optimizations.
8838 This option is enabled by default.
8840 @item -funconstrained-commons
8841 @opindex funconstrained-commons
8842 This option tells the compiler that variables declared in common blocks
8843 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8844 prevents certain optimizations that depend on knowing the array bounds.
8846 @item -fcrossjumping
8847 @opindex fcrossjumping
8848 Perform cross-jumping transformation.
8849 This transformation unifies equivalent code and saves code size.  The
8850 resulting code may or may not perform better than without cross-jumping.
8852 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8854 @item -fauto-inc-dec
8855 @opindex fauto-inc-dec
8856 Combine increments or decrements of addresses with memory accesses.
8857 This pass is always skipped on architectures that do not have
8858 instructions to support this.  Enabled by default at @option{-O} and
8859 higher on architectures that support this.
8861 @item -fdce
8862 @opindex fdce
8863 Perform dead code elimination (DCE) on RTL@.
8864 Enabled by default at @option{-O} and higher.
8866 @item -fdse
8867 @opindex fdse
8868 Perform dead store elimination (DSE) on RTL@.
8869 Enabled by default at @option{-O} and higher.
8871 @item -fif-conversion
8872 @opindex fif-conversion
8873 Attempt to transform conditional jumps into branch-less equivalents.  This
8874 includes use of conditional moves, min, max, set flags and abs instructions, and
8875 some tricks doable by standard arithmetics.  The use of conditional execution
8876 on chips where it is available is controlled by @option{-fif-conversion2}.
8878 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8879 not with @option{-Og}.
8881 @item -fif-conversion2
8882 @opindex fif-conversion2
8883 Use conditional execution (where available) to transform conditional jumps into
8884 branch-less equivalents.
8886 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8887 not with @option{-Og}.
8889 @item -fdeclone-ctor-dtor
8890 @opindex fdeclone-ctor-dtor
8891 The C++ ABI requires multiple entry points for constructors and
8892 destructors: one for a base subobject, one for a complete object, and
8893 one for a virtual destructor that calls operator delete afterwards.
8894 For a hierarchy with virtual bases, the base and complete variants are
8895 clones, which means two copies of the function.  With this option, the
8896 base and complete variants are changed to be thunks that call a common
8897 implementation.
8899 Enabled by @option{-Os}.
8901 @item -fdelete-null-pointer-checks
8902 @opindex fdelete-null-pointer-checks
8903 Assume that programs cannot safely dereference null pointers, and that
8904 no code or data element resides at address zero.
8905 This option enables simple constant
8906 folding optimizations at all optimization levels.  In addition, other
8907 optimization passes in GCC use this flag to control global dataflow
8908 analyses that eliminate useless checks for null pointers; these assume
8909 that a memory access to address zero always results in a trap, so
8910 that if a pointer is checked after it has already been dereferenced,
8911 it cannot be null.
8913 Note however that in some environments this assumption is not true.
8914 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8915 for programs that depend on that behavior.
8917 This option is enabled by default on most targets.  On Nios II ELF, it
8918 defaults to off.  On AVR, CR16, and MSP430, this option is completely disabled.
8920 Passes that use the dataflow information
8921 are enabled independently at different optimization levels.
8923 @item -fdevirtualize
8924 @opindex fdevirtualize
8925 Attempt to convert calls to virtual functions to direct calls.  This
8926 is done both within a procedure and interprocedurally as part of
8927 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8928 propagation (@option{-fipa-cp}).
8929 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8931 @item -fdevirtualize-speculatively
8932 @opindex fdevirtualize-speculatively
8933 Attempt to convert calls to virtual functions to speculative direct calls.
8934 Based on the analysis of the type inheritance graph, determine for a given call
8935 the set of likely targets. If the set is small, preferably of size 1, change
8936 the call into a conditional deciding between direct and indirect calls.  The
8937 speculative calls enable more optimizations, such as inlining.  When they seem
8938 useless after further optimization, they are converted back into original form.
8940 @item -fdevirtualize-at-ltrans
8941 @opindex fdevirtualize-at-ltrans
8942 Stream extra information needed for aggressive devirtualization when running
8943 the link-time optimizer in local transformation mode.  
8944 This option enables more devirtualization but
8945 significantly increases the size of streamed data. For this reason it is
8946 disabled by default.
8948 @item -fexpensive-optimizations
8949 @opindex fexpensive-optimizations
8950 Perform a number of minor optimizations that are relatively expensive.
8952 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8954 @item -free
8955 @opindex free
8956 Attempt to remove redundant extension instructions.  This is especially
8957 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8958 registers after writing to their lower 32-bit half.
8960 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8961 @option{-O3}, @option{-Os}.
8963 @item -fno-lifetime-dse
8964 @opindex fno-lifetime-dse
8965 @opindex flifetime-dse
8966 In C++ the value of an object is only affected by changes within its
8967 lifetime: when the constructor begins, the object has an indeterminate
8968 value, and any changes during the lifetime of the object are dead when
8969 the object is destroyed.  Normally dead store elimination will take
8970 advantage of this; if your code relies on the value of the object
8971 storage persisting beyond the lifetime of the object, you can use this
8972 flag to disable this optimization.  To preserve stores before the
8973 constructor starts (e.g.@: because your operator new clears the object
8974 storage) but still treat the object as dead after the destructor you,
8975 can use @option{-flifetime-dse=1}.  The default behavior can be
8976 explicitly selected with @option{-flifetime-dse=2}.
8977 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8979 @item -flive-range-shrinkage
8980 @opindex flive-range-shrinkage
8981 Attempt to decrease register pressure through register live range
8982 shrinkage.  This is helpful for fast processors with small or moderate
8983 size register sets.
8985 @item -fira-algorithm=@var{algorithm}
8986 @opindex fira-algorithm
8987 Use the specified coloring algorithm for the integrated register
8988 allocator.  The @var{algorithm} argument can be @samp{priority}, which
8989 specifies Chow's priority coloring, or @samp{CB}, which specifies
8990 Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
8991 for all architectures, but for those targets that do support it, it is
8992 the default because it generates better code.
8994 @item -fira-region=@var{region}
8995 @opindex fira-region
8996 Use specified regions for the integrated register allocator.  The
8997 @var{region} argument should be one of the following:
8999 @table @samp
9001 @item all
9002 Use all loops as register allocation regions.
9003 This can give the best results for machines with a small and/or
9004 irregular register set.
9006 @item mixed
9007 Use all loops except for loops with small register pressure 
9008 as the regions.  This value usually gives
9009 the best results in most cases and for most architectures,
9010 and is enabled by default when compiling with optimization for speed
9011 (@option{-O}, @option{-O2}, @dots{}).
9013 @item one
9014 Use all functions as a single region.  
9015 This typically results in the smallest code size, and is enabled by default for
9016 @option{-Os} or @option{-O0}.
9018 @end table
9020 @item -fira-hoist-pressure
9021 @opindex fira-hoist-pressure
9022 Use IRA to evaluate register pressure in the code hoisting pass for
9023 decisions to hoist expressions.  This option usually results in smaller
9024 code, but it can slow the compiler down.
9026 This option is enabled at level @option{-Os} for all targets.
9028 @item -fira-loop-pressure
9029 @opindex fira-loop-pressure
9030 Use IRA to evaluate register pressure in loops for decisions to move
9031 loop invariants.  This option usually results in generation
9032 of faster and smaller code on machines with large register files (>= 32
9033 registers), but it can slow the compiler down.
9035 This option is enabled at level @option{-O3} for some targets.
9037 @item -fno-ira-share-save-slots
9038 @opindex fno-ira-share-save-slots
9039 @opindex fira-share-save-slots
9040 Disable sharing of stack slots used for saving call-used hard
9041 registers living through a call.  Each hard register gets a
9042 separate stack slot, and as a result function stack frames are
9043 larger.
9045 @item -fno-ira-share-spill-slots
9046 @opindex fno-ira-share-spill-slots
9047 @opindex fira-share-spill-slots
9048 Disable sharing of stack slots allocated for pseudo-registers.  Each
9049 pseudo-register that does not get a hard register gets a separate
9050 stack slot, and as a result function stack frames are larger.
9052 @item -flra-remat
9053 @opindex flra-remat
9054 Enable CFG-sensitive rematerialization in LRA.  Instead of loading
9055 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9056 values if it is profitable.
9058 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9060 @item -fdelayed-branch
9061 @opindex fdelayed-branch
9062 If supported for the target machine, attempt to reorder instructions
9063 to exploit instruction slots available after delayed branch
9064 instructions.
9066 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9067 but not at @option{-Og}.
9069 @item -fschedule-insns
9070 @opindex fschedule-insns
9071 If supported for the target machine, attempt to reorder instructions to
9072 eliminate execution stalls due to required data being unavailable.  This
9073 helps machines that have slow floating point or memory load instructions
9074 by allowing other instructions to be issued until the result of the load
9075 or floating-point instruction is required.
9077 Enabled at levels @option{-O2}, @option{-O3}.
9079 @item -fschedule-insns2
9080 @opindex fschedule-insns2
9081 Similar to @option{-fschedule-insns}, but requests an additional pass of
9082 instruction scheduling after register allocation has been done.  This is
9083 especially useful on machines with a relatively small number of
9084 registers and where memory load instructions take more than one cycle.
9086 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9088 @item -fno-sched-interblock
9089 @opindex fno-sched-interblock
9090 @opindex fsched-interblock
9091 Disable instruction scheduling across basic blocks, which
9092 is normally enabled when scheduling before register allocation, i.e.@:
9093 with @option{-fschedule-insns} or at @option{-O2} or higher.
9095 @item -fno-sched-spec
9096 @opindex fno-sched-spec
9097 @opindex fsched-spec
9098 Disable speculative motion of non-load instructions, which
9099 is normally enabled when scheduling before register allocation, i.e.@:
9100 with @option{-fschedule-insns} or at @option{-O2} or higher.
9102 @item -fsched-pressure
9103 @opindex fsched-pressure
9104 Enable register pressure sensitive insn scheduling before register
9105 allocation.  This only makes sense when scheduling before register
9106 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9107 @option{-O2} or higher.  Usage of this option can improve the
9108 generated code and decrease its size by preventing register pressure
9109 increase above the number of available hard registers and subsequent
9110 spills in register allocation.
9112 @item -fsched-spec-load
9113 @opindex fsched-spec-load
9114 Allow speculative motion of some load instructions.  This only makes
9115 sense when scheduling before register allocation, i.e.@: with
9116 @option{-fschedule-insns} or at @option{-O2} or higher.
9118 @item -fsched-spec-load-dangerous
9119 @opindex fsched-spec-load-dangerous
9120 Allow speculative motion of more load instructions.  This only makes
9121 sense when scheduling before register allocation, i.e.@: with
9122 @option{-fschedule-insns} or at @option{-O2} or higher.
9124 @item -fsched-stalled-insns
9125 @itemx -fsched-stalled-insns=@var{n}
9126 @opindex fsched-stalled-insns
9127 Define how many insns (if any) can be moved prematurely from the queue
9128 of stalled insns into the ready list during the second scheduling pass.
9129 @option{-fno-sched-stalled-insns} means that no insns are moved
9130 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9131 on how many queued insns can be moved prematurely.
9132 @option{-fsched-stalled-insns} without a value is equivalent to
9133 @option{-fsched-stalled-insns=1}.
9135 @item -fsched-stalled-insns-dep
9136 @itemx -fsched-stalled-insns-dep=@var{n}
9137 @opindex fsched-stalled-insns-dep
9138 Define how many insn groups (cycles) are examined for a dependency
9139 on a stalled insn that is a candidate for premature removal from the queue
9140 of stalled insns.  This has an effect only during the second scheduling pass,
9141 and only if @option{-fsched-stalled-insns} is used.
9142 @option{-fno-sched-stalled-insns-dep} is equivalent to
9143 @option{-fsched-stalled-insns-dep=0}.
9144 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9145 @option{-fsched-stalled-insns-dep=1}.
9147 @item -fsched2-use-superblocks
9148 @opindex fsched2-use-superblocks
9149 When scheduling after register allocation, use superblock scheduling.
9150 This allows motion across basic block boundaries,
9151 resulting in faster schedules.  This option is experimental, as not all machine
9152 descriptions used by GCC model the CPU closely enough to avoid unreliable
9153 results from the algorithm.
9155 This only makes sense when scheduling after register allocation, i.e.@: with
9156 @option{-fschedule-insns2} or at @option{-O2} or higher.
9158 @item -fsched-group-heuristic
9159 @opindex fsched-group-heuristic
9160 Enable the group heuristic in the scheduler.  This heuristic favors
9161 the instruction that belongs to a schedule group.  This is enabled
9162 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9163 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9165 @item -fsched-critical-path-heuristic
9166 @opindex fsched-critical-path-heuristic
9167 Enable the critical-path heuristic in the scheduler.  This heuristic favors
9168 instructions on the critical path.  This is enabled by default when
9169 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9170 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9172 @item -fsched-spec-insn-heuristic
9173 @opindex fsched-spec-insn-heuristic
9174 Enable the speculative instruction heuristic in the scheduler.  This
9175 heuristic favors speculative instructions with greater dependency weakness.
9176 This is enabled by default when scheduling is enabled, i.e.@:
9177 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9178 or at @option{-O2} or higher.
9180 @item -fsched-rank-heuristic
9181 @opindex fsched-rank-heuristic
9182 Enable the rank heuristic in the scheduler.  This heuristic favors
9183 the instruction belonging to a basic block with greater size or frequency.
9184 This is enabled by default when scheduling is enabled, i.e.@:
9185 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9186 at @option{-O2} or higher.
9188 @item -fsched-last-insn-heuristic
9189 @opindex fsched-last-insn-heuristic
9190 Enable the last-instruction heuristic in the scheduler.  This heuristic
9191 favors the instruction that is less dependent on the last instruction
9192 scheduled.  This is enabled by default when scheduling is enabled,
9193 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9194 at @option{-O2} or higher.
9196 @item -fsched-dep-count-heuristic
9197 @opindex fsched-dep-count-heuristic
9198 Enable the dependent-count heuristic in the scheduler.  This heuristic
9199 favors the instruction that has more instructions depending on it.
9200 This is enabled by default when scheduling is enabled, i.e.@:
9201 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9202 at @option{-O2} or higher.
9204 @item -freschedule-modulo-scheduled-loops
9205 @opindex freschedule-modulo-scheduled-loops
9206 Modulo scheduling is performed before traditional scheduling.  If a loop
9207 is modulo scheduled, later scheduling passes may change its schedule.  
9208 Use this option to control that behavior.
9210 @item -fselective-scheduling
9211 @opindex fselective-scheduling
9212 Schedule instructions using selective scheduling algorithm.  Selective
9213 scheduling runs instead of the first scheduler pass.
9215 @item -fselective-scheduling2
9216 @opindex fselective-scheduling2
9217 Schedule instructions using selective scheduling algorithm.  Selective
9218 scheduling runs instead of the second scheduler pass.
9220 @item -fsel-sched-pipelining
9221 @opindex fsel-sched-pipelining
9222 Enable software pipelining of innermost loops during selective scheduling.
9223 This option has no effect unless one of @option{-fselective-scheduling} or
9224 @option{-fselective-scheduling2} is turned on.
9226 @item -fsel-sched-pipelining-outer-loops
9227 @opindex fsel-sched-pipelining-outer-loops
9228 When pipelining loops during selective scheduling, also pipeline outer loops.
9229 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9231 @item -fsemantic-interposition
9232 @opindex fsemantic-interposition
9233 Some object formats, like ELF, allow interposing of symbols by the 
9234 dynamic linker.
9235 This means that for symbols exported from the DSO, the compiler cannot perform
9236 interprocedural propagation, inlining and other optimizations in anticipation
9237 that the function or variable in question may change. While this feature is
9238 useful, for example, to rewrite memory allocation functions by a debugging
9239 implementation, it is expensive in the terms of code quality.
9240 With @option{-fno-semantic-interposition} the compiler assumes that 
9241 if interposition happens for functions the overwriting function will have 
9242 precisely the same semantics (and side effects). 
9243 Similarly if interposition happens
9244 for variables, the constructor of the variable will be the same. The flag
9245 has no effect for functions explicitly declared inline 
9246 (where it is never allowed for interposition to change semantics) 
9247 and for symbols explicitly declared weak.
9249 @item -fshrink-wrap
9250 @opindex fshrink-wrap
9251 Emit function prologues only before parts of the function that need it,
9252 rather than at the top of the function.  This flag is enabled by default at
9253 @option{-O} and higher.
9255 @item -fshrink-wrap-separate
9256 @opindex fshrink-wrap-separate
9257 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9258 those parts are only executed when needed.
9259 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9260 is also turned on and the target supports this.
9262 @item -fcaller-saves
9263 @opindex fcaller-saves
9264 Enable allocation of values to registers that are clobbered by
9265 function calls, by emitting extra instructions to save and restore the
9266 registers around such calls.  Such allocation is done only when it
9267 seems to result in better code.
9269 This option is always enabled by default on certain machines, usually
9270 those which have no call-preserved registers to use instead.
9272 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9274 @item -fcombine-stack-adjustments
9275 @opindex fcombine-stack-adjustments
9276 Tracks stack adjustments (pushes and pops) and stack memory references
9277 and then tries to find ways to combine them.
9279 Enabled by default at @option{-O1} and higher.
9281 @item -fipa-ra
9282 @opindex fipa-ra
9283 Use caller save registers for allocation if those registers are not used by
9284 any called function.  In that case it is not necessary to save and restore
9285 them around calls.  This is only possible if called functions are part of
9286 same compilation unit as current function and they are compiled before it.
9288 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9289 is disabled if generated code will be instrumented for profiling
9290 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9291 exactly (this happens on targets that do not expose prologues
9292 and epilogues in RTL).
9294 @item -fconserve-stack
9295 @opindex fconserve-stack
9296 Attempt to minimize stack usage.  The compiler attempts to use less
9297 stack space, even if that makes the program slower.  This option
9298 implies setting the @option{large-stack-frame} parameter to 100
9299 and the @option{large-stack-frame-growth} parameter to 400.
9301 @item -ftree-reassoc
9302 @opindex ftree-reassoc
9303 Perform reassociation on trees.  This flag is enabled by default
9304 at @option{-O} and higher.
9306 @item -fcode-hoisting
9307 @opindex fcode-hoisting
9308 Perform code hoisting.  Code hoisting tries to move the
9309 evaluation of expressions executed on all paths to the function exit
9310 as early as possible.  This is especially useful as a code size
9311 optimization, but it often helps for code speed as well.
9312 This flag is enabled by default at @option{-O2} and higher.
9314 @item -ftree-pre
9315 @opindex ftree-pre
9316 Perform partial redundancy elimination (PRE) on trees.  This flag is
9317 enabled by default at @option{-O2} and @option{-O3}.
9319 @item -ftree-partial-pre
9320 @opindex ftree-partial-pre
9321 Make partial redundancy elimination (PRE) more aggressive.  This flag is
9322 enabled by default at @option{-O3}.
9324 @item -ftree-forwprop
9325 @opindex ftree-forwprop
9326 Perform forward propagation on trees.  This flag is enabled by default
9327 at @option{-O} and higher.
9329 @item -ftree-fre
9330 @opindex ftree-fre
9331 Perform full redundancy elimination (FRE) on trees.  The difference
9332 between FRE and PRE is that FRE only considers expressions
9333 that are computed on all paths leading to the redundant computation.
9334 This analysis is faster than PRE, though it exposes fewer redundancies.
9335 This flag is enabled by default at @option{-O} and higher.
9337 @item -ftree-phiprop
9338 @opindex ftree-phiprop
9339 Perform hoisting of loads from conditional pointers on trees.  This
9340 pass is enabled by default at @option{-O} and higher.
9342 @item -fhoist-adjacent-loads
9343 @opindex fhoist-adjacent-loads
9344 Speculatively hoist loads from both branches of an if-then-else if the
9345 loads are from adjacent locations in the same structure and the target
9346 architecture has a conditional move instruction.  This flag is enabled
9347 by default at @option{-O2} and higher.
9349 @item -ftree-copy-prop
9350 @opindex ftree-copy-prop
9351 Perform copy propagation on trees.  This pass eliminates unnecessary
9352 copy operations.  This flag is enabled by default at @option{-O} and
9353 higher.
9355 @item -fipa-pure-const
9356 @opindex fipa-pure-const
9357 Discover which functions are pure or constant.
9358 Enabled by default at @option{-O} and higher.
9360 @item -fipa-reference
9361 @opindex fipa-reference
9362 Discover which static variables do not escape the
9363 compilation unit.
9364 Enabled by default at @option{-O} and higher.
9366 @item -fipa-reference-addressable
9367 @opindex fipa-reference-addressable
9368 Discover read-only, write-only and non-addressable static variables.
9369 Enabled by default at @option{-O} and higher.
9371 @item -fipa-stack-alignment
9372 @opindex fipa-stack-alignment
9373 Reduce stack alignment on call sites if possible.
9374 Enabled by default.
9376 @item -fipa-pta
9377 @opindex fipa-pta
9378 Perform interprocedural pointer analysis and interprocedural modification
9379 and reference analysis.  This option can cause excessive memory and
9380 compile-time usage on large compilation units.  It is not enabled by
9381 default at any optimization level.
9383 @item -fipa-profile
9384 @opindex fipa-profile
9385 Perform interprocedural profile propagation.  The functions called only from
9386 cold functions are marked as cold. Also functions executed once (such as
9387 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9388 functions and loop less parts of functions executed once are then optimized for
9389 size.
9390 Enabled by default at @option{-O} and higher.
9392 @item -fipa-cp
9393 @opindex fipa-cp
9394 Perform interprocedural constant propagation.
9395 This optimization analyzes the program to determine when values passed
9396 to functions are constants and then optimizes accordingly.
9397 This optimization can substantially increase performance
9398 if the application has constants passed to functions.
9399 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9400 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9402 @item -fipa-cp-clone
9403 @opindex fipa-cp-clone
9404 Perform function cloning to make interprocedural constant propagation stronger.
9405 When enabled, interprocedural constant propagation performs function cloning
9406 when externally visible function can be called with constant arguments.
9407 Because this optimization can create multiple copies of functions,
9408 it may significantly increase code size
9409 (see @option{--param ipcp-unit-growth=@var{value}}).
9410 This flag is enabled by default at @option{-O3}.
9411 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9413 @item -fipa-bit-cp
9414 @opindex fipa-bit-cp
9415 When enabled, perform interprocedural bitwise constant
9416 propagation. This flag is enabled by default at @option{-O2} and
9417 by @option{-fprofile-use} and @option{-fauto-profile}.
9418 It requires that @option{-fipa-cp} is enabled.  
9420 @item -fipa-vrp
9421 @opindex fipa-vrp
9422 When enabled, perform interprocedural propagation of value
9423 ranges. This flag is enabled by default at @option{-O2}. It requires
9424 that @option{-fipa-cp} is enabled.
9426 @item -fipa-icf
9427 @opindex fipa-icf
9428 Perform Identical Code Folding for functions and read-only variables.
9429 The optimization reduces code size and may disturb unwind stacks by replacing
9430 a function by equivalent one with a different name. The optimization works
9431 more effectively with link-time optimization enabled.
9433 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9434 works on different levels and thus the optimizations are not same - there are
9435 equivalences that are found only by GCC and equivalences found only by Gold.
9437 This flag is enabled by default at @option{-O2} and @option{-Os}.
9439 @item -flive-patching=@var{level}
9440 @opindex flive-patching
9441 Control GCC's optimizations to produce output suitable for live-patching.
9443 If the compiler's optimization uses a function's body or information extracted
9444 from its body to optimize/change another function, the latter is called an
9445 impacted function of the former.  If a function is patched, its impacted
9446 functions should be patched too.
9448 The impacted functions are determined by the compiler's interprocedural
9449 optimizations.  For example, a caller is impacted when inlining a function
9450 into its caller,
9451 cloning a function and changing its caller to call this new clone,
9452 or extracting a function's pureness/constness information to optimize
9453 its direct or indirect callers, etc.
9455 Usually, the more IPA optimizations enabled, the larger the number of
9456 impacted functions for each function.  In order to control the number of
9457 impacted functions and more easily compute the list of impacted function,
9458 IPA optimizations can be partially enabled at two different levels.
9460 The @var{level} argument should be one of the following:
9462 @table @samp
9464 @item inline-clone
9466 Only enable inlining and cloning optimizations, which includes inlining,
9467 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9468 As a result, when patching a function, all its callers and its clones'
9469 callers are impacted, therefore need to be patched as well.
9471 @option{-flive-patching=inline-clone} disables the following optimization flags:
9472 @gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra @gol
9473 -fipa-icf  -fipa-icf-functions  -fipa-icf-variables @gol
9474 -fipa-bit-cp  -fipa-vrp  -fipa-pure-const  -fipa-reference-addressable @gol
9475 -fipa-stack-alignment}
9477 @item inline-only-static
9479 Only enable inlining of static functions.
9480 As a result, when patching a static function, all its callers are impacted
9481 and so need to be patched as well.
9483 In addition to all the flags that @option{-flive-patching=inline-clone}
9484 disables,
9485 @option{-flive-patching=inline-only-static} disables the following additional
9486 optimization flags:
9487 @gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
9489 @end table
9491 When @option{-flive-patching} is specified without any value, the default value
9492 is @var{inline-clone}.
9494 This flag is disabled by default.
9496 Note that @option{-flive-patching} is not supported with link-time optimization
9497 (@option{-flto}).
9499 @item -fisolate-erroneous-paths-dereference
9500 @opindex fisolate-erroneous-paths-dereference
9501 Detect paths that trigger erroneous or undefined behavior due to
9502 dereferencing a null pointer.  Isolate those paths from the main control
9503 flow and turn the statement with erroneous or undefined behavior into a trap.
9504 This flag is enabled by default at @option{-O2} and higher and depends on
9505 @option{-fdelete-null-pointer-checks} also being enabled.
9507 @item -fisolate-erroneous-paths-attribute
9508 @opindex fisolate-erroneous-paths-attribute
9509 Detect paths that trigger erroneous or undefined behavior due to a null value
9510 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9511 attribute.  Isolate those paths from the main control flow and turn the
9512 statement with erroneous or undefined behavior into a trap.  This is not
9513 currently enabled, but may be enabled by @option{-O2} in the future.
9515 @item -ftree-sink
9516 @opindex ftree-sink
9517 Perform forward store motion on trees.  This flag is
9518 enabled by default at @option{-O} and higher.
9520 @item -ftree-bit-ccp
9521 @opindex ftree-bit-ccp
9522 Perform sparse conditional bit constant propagation on trees and propagate
9523 pointer alignment information.
9524 This pass only operates on local scalar variables and is enabled by default
9525 at @option{-O1} and higher, except for @option{-Og}.
9526 It requires that @option{-ftree-ccp} is enabled.
9528 @item -ftree-ccp
9529 @opindex ftree-ccp
9530 Perform sparse conditional constant propagation (CCP) on trees.  This
9531 pass only operates on local scalar variables and is enabled by default
9532 at @option{-O} and higher.
9534 @item -fssa-backprop
9535 @opindex fssa-backprop
9536 Propagate information about uses of a value up the definition chain
9537 in order to simplify the definitions.  For example, this pass strips
9538 sign operations if the sign of a value never matters.  The flag is
9539 enabled by default at @option{-O} and higher.
9541 @item -fssa-phiopt
9542 @opindex fssa-phiopt
9543 Perform pattern matching on SSA PHI nodes to optimize conditional
9544 code.  This pass is enabled by default at @option{-O1} and higher,
9545 except for @option{-Og}.
9547 @item -ftree-switch-conversion
9548 @opindex ftree-switch-conversion
9549 Perform conversion of simple initializations in a switch to
9550 initializations from a scalar array.  This flag is enabled by default
9551 at @option{-O2} and higher.
9553 @item -ftree-tail-merge
9554 @opindex ftree-tail-merge
9555 Look for identical code sequences.  When found, replace one with a jump to the
9556 other.  This optimization is known as tail merging or cross jumping.  This flag
9557 is enabled by default at @option{-O2} and higher.  The compilation time
9558 in this pass can
9559 be limited using @option{max-tail-merge-comparisons} parameter and
9560 @option{max-tail-merge-iterations} parameter.
9562 @item -ftree-dce
9563 @opindex ftree-dce
9564 Perform dead code elimination (DCE) on trees.  This flag is enabled by
9565 default at @option{-O} and higher.
9567 @item -ftree-builtin-call-dce
9568 @opindex ftree-builtin-call-dce
9569 Perform conditional dead code elimination (DCE) for calls to built-in functions
9570 that may set @code{errno} but are otherwise free of side effects.  This flag is
9571 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9572 specified.
9574 @item -ffinite-loops
9575 @opindex ffinite-loops
9576 @opindex fno-finite-loops
9577 Assume that a loop with an exit will eventually take the exit and not loop
9578 indefinitely.  This allows the compiler to remove loops that otherwise have
9579 no side-effects, not considering eventual endless looping as such.
9581 This option is enabled by default at @option{-O2}.
9583 @item -ftree-dominator-opts
9584 @opindex ftree-dominator-opts
9585 Perform a variety of simple scalar cleanups (constant/copy
9586 propagation, redundancy elimination, range propagation and expression
9587 simplification) based on a dominator tree traversal.  This also
9588 performs jump threading (to reduce jumps to jumps). This flag is
9589 enabled by default at @option{-O} and higher.
9591 @item -ftree-dse
9592 @opindex ftree-dse
9593 Perform dead store elimination (DSE) on trees.  A dead store is a store into
9594 a memory location that is later overwritten by another store without
9595 any intervening loads.  In this case the earlier store can be deleted.  This
9596 flag is enabled by default at @option{-O} and higher.
9598 @item -ftree-ch
9599 @opindex ftree-ch
9600 Perform loop header copying on trees.  This is beneficial since it increases
9601 effectiveness of code motion optimizations.  It also saves one jump.  This flag
9602 is enabled by default at @option{-O} and higher.  It is not enabled
9603 for @option{-Os}, since it usually increases code size.
9605 @item -ftree-loop-optimize
9606 @opindex ftree-loop-optimize
9607 Perform loop optimizations on trees.  This flag is enabled by default
9608 at @option{-O} and higher.
9610 @item -ftree-loop-linear
9611 @itemx -floop-strip-mine
9612 @itemx -floop-block
9613 @opindex ftree-loop-linear
9614 @opindex floop-strip-mine
9615 @opindex floop-block
9616 Perform loop nest optimizations.  Same as
9617 @option{-floop-nest-optimize}.  To use this code transformation, GCC has
9618 to be configured with @option{--with-isl} to enable the Graphite loop
9619 transformation infrastructure.
9621 @item -fgraphite-identity
9622 @opindex fgraphite-identity
9623 Enable the identity transformation for graphite.  For every SCoP we generate
9624 the polyhedral representation and transform it back to gimple.  Using
9625 @option{-fgraphite-identity} we can check the costs or benefits of the
9626 GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
9627 are also performed by the code generator isl, like index splitting and
9628 dead code elimination in loops.
9630 @item -floop-nest-optimize
9631 @opindex floop-nest-optimize
9632 Enable the isl based loop nest optimizer.  This is a generic loop nest
9633 optimizer based on the Pluto optimization algorithms.  It calculates a loop
9634 structure optimized for data-locality and parallelism.  This option
9635 is experimental.
9637 @item -floop-parallelize-all
9638 @opindex floop-parallelize-all
9639 Use the Graphite data dependence analysis to identify loops that can
9640 be parallelized.  Parallelize all the loops that can be analyzed to
9641 not contain loop carried dependences without checking that it is
9642 profitable to parallelize the loops.
9644 @item -ftree-coalesce-vars
9645 @opindex ftree-coalesce-vars
9646 While transforming the program out of the SSA representation, attempt to
9647 reduce copying by coalescing versions of different user-defined
9648 variables, instead of just compiler temporaries.  This may severely
9649 limit the ability to debug an optimized program compiled with
9650 @option{-fno-var-tracking-assignments}.  In the negated form, this flag
9651 prevents SSA coalescing of user variables.  This option is enabled by
9652 default if optimization is enabled, and it does very little otherwise.
9654 @item -ftree-loop-if-convert
9655 @opindex ftree-loop-if-convert
9656 Attempt to transform conditional jumps in the innermost loops to
9657 branch-less equivalents.  The intent is to remove control-flow from
9658 the innermost loops in order to improve the ability of the
9659 vectorization pass to handle these loops.  This is enabled by default
9660 if vectorization is enabled.
9662 @item -ftree-loop-distribution
9663 @opindex ftree-loop-distribution
9664 Perform loop distribution.  This flag can improve cache performance on
9665 big loop bodies and allow further loop optimizations, like
9666 parallelization or vectorization, to take place.  For example, the loop
9667 @smallexample
9668 DO I = 1, N
9669   A(I) = B(I) + C
9670   D(I) = E(I) * F
9671 ENDDO
9672 @end smallexample
9673 is transformed to
9674 @smallexample
9675 DO I = 1, N
9676    A(I) = B(I) + C
9677 ENDDO
9678 DO I = 1, N
9679    D(I) = E(I) * F
9680 ENDDO
9681 @end smallexample
9682 This flag is enabled by default at @option{-O3}.
9683 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9685 @item -ftree-loop-distribute-patterns
9686 @opindex ftree-loop-distribute-patterns
9687 Perform loop distribution of patterns that can be code generated with
9688 calls to a library.  This flag is enabled by default at @option{-O3}, and
9689 by @option{-fprofile-use} and @option{-fauto-profile}.
9691 This pass distributes the initialization loops and generates a call to
9692 memset zero.  For example, the loop
9693 @smallexample
9694 DO I = 1, N
9695   A(I) = 0
9696   B(I) = A(I) + I
9697 ENDDO
9698 @end smallexample
9699 is transformed to
9700 @smallexample
9701 DO I = 1, N
9702    A(I) = 0
9703 ENDDO
9704 DO I = 1, N
9705    B(I) = A(I) + I
9706 ENDDO
9707 @end smallexample
9708 and the initialization loop is transformed into a call to memset zero.
9709 This flag is enabled by default at @option{-O3}.
9710 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9712 @item -floop-interchange
9713 @opindex floop-interchange
9714 Perform loop interchange outside of graphite.  This flag can improve cache
9715 performance on loop nest and allow further loop optimizations, like
9716 vectorization, to take place.  For example, the loop
9717 @smallexample
9718 for (int i = 0; i < N; i++)
9719   for (int j = 0; j < N; j++)
9720     for (int k = 0; k < N; k++)
9721       c[i][j] = c[i][j] + a[i][k]*b[k][j];
9722 @end smallexample
9723 is transformed to
9724 @smallexample
9725 for (int i = 0; i < N; i++)
9726   for (int k = 0; k < N; k++)
9727     for (int j = 0; j < N; j++)
9728       c[i][j] = c[i][j] + a[i][k]*b[k][j];
9729 @end smallexample
9730 This flag is enabled by default at @option{-O3}.
9731 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9733 @item -floop-unroll-and-jam
9734 @opindex floop-unroll-and-jam
9735 Apply unroll and jam transformations on feasible loops.  In a loop
9736 nest this unrolls the outer loop by some factor and fuses the resulting
9737 multiple inner loops.  This flag is enabled by default at @option{-O3}.
9738 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9740 @item -ftree-loop-im
9741 @opindex ftree-loop-im
9742 Perform loop invariant motion on trees.  This pass moves only invariants that
9743 are hard to handle at RTL level (function calls, operations that expand to
9744 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
9745 operands of conditions that are invariant out of the loop, so that we can use
9746 just trivial invariantness analysis in loop unswitching.  The pass also includes
9747 store motion.
9749 @item -ftree-loop-ivcanon
9750 @opindex ftree-loop-ivcanon
9751 Create a canonical counter for number of iterations in loops for which
9752 determining number of iterations requires complicated analysis.  Later
9753 optimizations then may determine the number easily.  Useful especially
9754 in connection with unrolling.
9756 @item -ftree-scev-cprop
9757 @opindex ftree-scev-cprop
9758 Perform final value replacement.  If a variable is modified in a loop
9759 in such a way that its value when exiting the loop can be determined using
9760 only its initial value and the number of loop iterations, replace uses of
9761 the final value by such a computation, provided it is sufficiently cheap.
9762 This reduces data dependencies and may allow further simplifications.
9763 Enabled by default at @option{-O} and higher.
9765 @item -fivopts
9766 @opindex fivopts
9767 Perform induction variable optimizations (strength reduction, induction
9768 variable merging and induction variable elimination) on trees.
9770 @item -ftree-parallelize-loops=n
9771 @opindex ftree-parallelize-loops
9772 Parallelize loops, i.e., split their iteration space to run in n threads.
9773 This is only possible for loops whose iterations are independent
9774 and can be arbitrarily reordered.  The optimization is only
9775 profitable on multiprocessor machines, for loops that are CPU-intensive,
9776 rather than constrained e.g.@: by memory bandwidth.  This option
9777 implies @option{-pthread}, and thus is only supported on targets
9778 that have support for @option{-pthread}.
9780 @item -ftree-pta
9781 @opindex ftree-pta
9782 Perform function-local points-to analysis on trees.  This flag is
9783 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9785 @item -ftree-sra
9786 @opindex ftree-sra
9787 Perform scalar replacement of aggregates.  This pass replaces structure
9788 references with scalars to prevent committing structures to memory too
9789 early.  This flag is enabled by default at @option{-O1} and higher,
9790 except for @option{-Og}.
9792 @item -fstore-merging
9793 @opindex fstore-merging
9794 Perform merging of narrow stores to consecutive memory addresses.  This pass
9795 merges contiguous stores of immediate values narrower than a word into fewer
9796 wider stores to reduce the number of instructions.  This is enabled by default
9797 at @option{-O2} and higher as well as @option{-Os}.
9799 @item -ftree-ter
9800 @opindex ftree-ter
9801 Perform temporary expression replacement during the SSA->normal phase.  Single
9802 use/single def temporaries are replaced at their use location with their
9803 defining expression.  This results in non-GIMPLE code, but gives the expanders
9804 much more complex trees to work on resulting in better RTL generation.  This is
9805 enabled by default at @option{-O} and higher.
9807 @item -ftree-slsr
9808 @opindex ftree-slsr
9809 Perform straight-line strength reduction on trees.  This recognizes related
9810 expressions involving multiplications and replaces them by less expensive
9811 calculations when possible.  This is enabled by default at @option{-O} and
9812 higher.
9814 @item -ftree-vectorize
9815 @opindex ftree-vectorize
9816 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9817 and @option{-ftree-slp-vectorize} if not explicitly specified.
9819 @item -ftree-loop-vectorize
9820 @opindex ftree-loop-vectorize
9821 Perform loop vectorization on trees. This flag is enabled by default at
9822 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9823 and @option{-fauto-profile}.
9825 @item -ftree-slp-vectorize
9826 @opindex ftree-slp-vectorize
9827 Perform basic block vectorization on trees. This flag is enabled by default at
9828 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9829 and @option{-fauto-profile}.
9831 @item -fvect-cost-model=@var{model}
9832 @opindex fvect-cost-model
9833 Alter the cost model used for vectorization.  The @var{model} argument
9834 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9835 With the @samp{unlimited} model the vectorized code-path is assumed
9836 to be profitable while with the @samp{dynamic} model a runtime check
9837 guards the vectorized code-path to enable it only for iteration
9838 counts that will likely execute faster than when executing the original
9839 scalar loop.  The @samp{cheap} model disables vectorization of
9840 loops where doing so would be cost prohibitive for example due to
9841 required runtime checks for data dependence or alignment but otherwise
9842 is equal to the @samp{dynamic} model.
9843 The default cost model depends on other optimization flags and is
9844 either @samp{dynamic} or @samp{cheap}.
9846 @item -fsimd-cost-model=@var{model}
9847 @opindex fsimd-cost-model
9848 Alter the cost model used for vectorization of loops marked with the OpenMP
9849 simd directive.  The @var{model} argument should be one of
9850 @samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
9851 have the same meaning as described in @option{-fvect-cost-model} and by
9852 default a cost model defined with @option{-fvect-cost-model} is used.
9854 @item -ftree-vrp
9855 @opindex ftree-vrp
9856 Perform Value Range Propagation on trees.  This is similar to the
9857 constant propagation pass, but instead of values, ranges of values are
9858 propagated.  This allows the optimizers to remove unnecessary range
9859 checks like array bound checks and null pointer checks.  This is
9860 enabled by default at @option{-O2} and higher.  Null pointer check
9861 elimination is only done if @option{-fdelete-null-pointer-checks} is
9862 enabled.
9864 @item -fsplit-paths
9865 @opindex fsplit-paths
9866 Split paths leading to loop backedges.  This can improve dead code
9867 elimination and common subexpression elimination.  This is enabled by
9868 default at @option{-O3} and above.
9870 @item -fsplit-ivs-in-unroller
9871 @opindex fsplit-ivs-in-unroller
9872 Enables expression of values of induction variables in later iterations
9873 of the unrolled loop using the value in the first iteration.  This breaks
9874 long dependency chains, thus improving efficiency of the scheduling passes.
9876 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9877 same effect.  However, that is not reliable in cases where the loop body
9878 is more complicated than a single basic block.  It also does not work at all
9879 on some architectures due to restrictions in the CSE pass.
9881 This optimization is enabled by default.
9883 @item -fvariable-expansion-in-unroller
9884 @opindex fvariable-expansion-in-unroller
9885 With this option, the compiler creates multiple copies of some
9886 local variables when unrolling a loop, which can result in superior code.
9888 This optimization is enabled by default for PowerPC targets, but disabled
9889 by default otherwise.
9891 @item -fpartial-inlining
9892 @opindex fpartial-inlining
9893 Inline parts of functions.  This option has any effect only
9894 when inlining itself is turned on by the @option{-finline-functions}
9895 or @option{-finline-small-functions} options.
9897 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9899 @item -fpredictive-commoning
9900 @opindex fpredictive-commoning
9901 Perform predictive commoning optimization, i.e., reusing computations
9902 (especially memory loads and stores) performed in previous
9903 iterations of loops.
9905 This option is enabled at level @option{-O3}.
9906 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9908 @item -fprefetch-loop-arrays
9909 @opindex fprefetch-loop-arrays
9910 If supported by the target machine, generate instructions to prefetch
9911 memory to improve the performance of loops that access large arrays.
9913 This option may generate better or worse code; results are highly
9914 dependent on the structure of loops within the source code.
9916 Disabled at level @option{-Os}.
9918 @item -fno-printf-return-value
9919 @opindex fno-printf-return-value
9920 @opindex fprintf-return-value
9921 Do not substitute constants for known return value of formatted output
9922 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9923 @code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
9924 transformation allows GCC to optimize or even eliminate branches based
9925 on the known return value of these functions called with arguments that
9926 are either constant, or whose values are known to be in a range that
9927 makes determining the exact return value possible.  For example, when
9928 @option{-fprintf-return-value} is in effect, both the branch and the
9929 body of the @code{if} statement (but not the call to @code{snprint})
9930 can be optimized away when @code{i} is a 32-bit or smaller integer
9931 because the return value is guaranteed to be at most 8.
9933 @smallexample
9934 char buf[9];
9935 if (snprintf (buf, "%08x", i) >= sizeof buf)
9936   @dots{}
9937 @end smallexample
9939 The @option{-fprintf-return-value} option relies on other optimizations
9940 and yields best results with @option{-O2} and above.  It works in tandem
9941 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9942 options.  The @option{-fprintf-return-value} option is enabled by default.
9944 @item -fno-peephole
9945 @itemx -fno-peephole2
9946 @opindex fno-peephole
9947 @opindex fpeephole
9948 @opindex fno-peephole2
9949 @opindex fpeephole2
9950 Disable any machine-specific peephole optimizations.  The difference
9951 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9952 are implemented in the compiler; some targets use one, some use the
9953 other, a few use both.
9955 @option{-fpeephole} is enabled by default.
9956 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9958 @item -fno-guess-branch-probability
9959 @opindex fno-guess-branch-probability
9960 @opindex fguess-branch-probability
9961 Do not guess branch probabilities using heuristics.
9963 GCC uses heuristics to guess branch probabilities if they are
9964 not provided by profiling feedback (@option{-fprofile-arcs}).  These
9965 heuristics are based on the control flow graph.  If some branch probabilities
9966 are specified by @code{__builtin_expect}, then the heuristics are
9967 used to guess branch probabilities for the rest of the control flow graph,
9968 taking the @code{__builtin_expect} info into account.  The interactions
9969 between the heuristics and @code{__builtin_expect} can be complex, and in
9970 some cases, it may be useful to disable the heuristics so that the effects
9971 of @code{__builtin_expect} are easier to understand.
9973 It is also possible to specify expected probability of the expression
9974 with @code{__builtin_expect_with_probability} built-in function.
9976 The default is @option{-fguess-branch-probability} at levels
9977 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9979 @item -freorder-blocks
9980 @opindex freorder-blocks
9981 Reorder basic blocks in the compiled function in order to reduce number of
9982 taken branches and improve code locality.
9984 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9986 @item -freorder-blocks-algorithm=@var{algorithm}
9987 @opindex freorder-blocks-algorithm
9988 Use the specified algorithm for basic block reordering.  The
9989 @var{algorithm} argument can be @samp{simple}, which does not increase
9990 code size (except sometimes due to secondary effects like alignment),
9991 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9992 put all often executed code together, minimizing the number of branches
9993 executed by making extra copies of code.
9995 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9996 @samp{stc} at levels @option{-O2}, @option{-O3}.
9998 @item -freorder-blocks-and-partition
9999 @opindex freorder-blocks-and-partition
10000 In addition to reordering basic blocks in the compiled function, in order
10001 to reduce number of taken branches, partitions hot and cold basic blocks
10002 into separate sections of the assembly and @file{.o} files, to improve
10003 paging and cache locality performance.
10005 This optimization is automatically turned off in the presence of
10006 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10007 section attribute and on any architecture that does not support named
10008 sections.  When @option{-fsplit-stack} is used this option is not
10009 enabled by default (to avoid linker errors), but may be enabled
10010 explicitly (if using a working linker).
10012 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10014 @item -freorder-functions
10015 @opindex freorder-functions
10016 Reorder functions in the object file in order to
10017 improve code locality.  This is implemented by using special
10018 subsections @code{.text.hot} for most frequently executed functions and
10019 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
10020 the linker so object file format must support named sections and linker must
10021 place them in a reasonable way.
10023 This option isn't effective unless you either provide profile feedback
10024 (see @option{-fprofile-arcs} for details) or manually annotate functions with 
10025 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10027 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10029 @item -fstrict-aliasing
10030 @opindex fstrict-aliasing
10031 Allow the compiler to assume the strictest aliasing rules applicable to
10032 the language being compiled.  For C (and C++), this activates
10033 optimizations based on the type of expressions.  In particular, an
10034 object of one type is assumed never to reside at the same address as an
10035 object of a different type, unless the types are almost the same.  For
10036 example, an @code{unsigned int} can alias an @code{int}, but not a
10037 @code{void*} or a @code{double}.  A character type may alias any other
10038 type.
10040 @anchor{Type-punning}Pay special attention to code like this:
10041 @smallexample
10042 union a_union @{
10043   int i;
10044   double d;
10047 int f() @{
10048   union a_union t;
10049   t.d = 3.0;
10050   return t.i;
10052 @end smallexample
10053 The practice of reading from a different union member than the one most
10054 recently written to (called ``type-punning'') is common.  Even with
10055 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10056 is accessed through the union type.  So, the code above works as
10057 expected.  @xref{Structures unions enumerations and bit-fields
10058 implementation}.  However, this code might not:
10059 @smallexample
10060 int f() @{
10061   union a_union t;
10062   int* ip;
10063   t.d = 3.0;
10064   ip = &t.i;
10065   return *ip;
10067 @end smallexample
10069 Similarly, access by taking the address, casting the resulting pointer
10070 and dereferencing the result has undefined behavior, even if the cast
10071 uses a union type, e.g.:
10072 @smallexample
10073 int f() @{
10074   double d = 3.0;
10075   return ((union a_union *) &d)->i;
10077 @end smallexample
10079 The @option{-fstrict-aliasing} option is enabled at levels
10080 @option{-O2}, @option{-O3}, @option{-Os}.
10082 @item -falign-functions
10083 @itemx -falign-functions=@var{n}
10084 @itemx -falign-functions=@var{n}:@var{m}
10085 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10086 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10087 @opindex falign-functions
10088 Align the start of functions to the next power-of-two greater than
10089 @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at least
10090 the first @var{m} bytes of the function can be fetched by the CPU
10091 without crossing an @var{n}-byte alignment boundary.
10093 If @var{m} is not specified, it defaults to @var{n}.
10095 Examples: @option{-falign-functions=32} aligns functions to the next
10096 32-byte boundary, @option{-falign-functions=24} aligns to the next
10097 32-byte boundary only if this can be done by skipping 23 bytes or less,
10098 @option{-falign-functions=32:7} aligns to the next
10099 32-byte boundary only if this can be done by skipping 6 bytes or less.
10101 The second pair of @var{n2}:@var{m2} values allows you to specify
10102 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10103 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10104 otherwise aligns to the next 32-byte boundary if this can be done
10105 by skipping 2 bytes or less.
10106 If @var{m2} is not specified, it defaults to @var{n2}.
10108 Some assemblers only support this flag when @var{n} is a power of two;
10109 in that case, it is rounded up.
10111 @option{-fno-align-functions} and @option{-falign-functions=1} are
10112 equivalent and mean that functions are not aligned.
10114 If @var{n} is not specified or is zero, use a machine-dependent default.
10115 The maximum allowed @var{n} option value is 65536.
10117 Enabled at levels @option{-O2}, @option{-O3}.
10119 @item -flimit-function-alignment
10120 If this option is enabled, the compiler tries to avoid unnecessarily
10121 overaligning functions. It attempts to instruct the assembler to align
10122 by the amount specified by @option{-falign-functions}, but not to
10123 skip more bytes than the size of the function.
10125 @item -falign-labels
10126 @itemx -falign-labels=@var{n}
10127 @itemx -falign-labels=@var{n}:@var{m}
10128 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10129 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10130 @opindex falign-labels
10131 Align all branch targets to a power-of-two boundary.
10133 Parameters of this option are analogous to the @option{-falign-functions} option.
10134 @option{-fno-align-labels} and @option{-falign-labels=1} are
10135 equivalent and mean that labels are not aligned.
10137 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10138 are greater than this value, then their values are used instead.
10140 If @var{n} is not specified or is zero, use a machine-dependent default
10141 which is very likely to be @samp{1}, meaning no alignment.
10142 The maximum allowed @var{n} option value is 65536.
10144 Enabled at levels @option{-O2}, @option{-O3}.
10146 @item -falign-loops
10147 @itemx -falign-loops=@var{n}
10148 @itemx -falign-loops=@var{n}:@var{m}
10149 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10150 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10151 @opindex falign-loops
10152 Align loops to a power-of-two boundary.  If the loops are executed
10153 many times, this makes up for any execution of the dummy padding
10154 instructions.
10156 Parameters of this option are analogous to the @option{-falign-functions} option.
10157 @option{-fno-align-loops} and @option{-falign-loops=1} are
10158 equivalent and mean that loops are not aligned.
10159 The maximum allowed @var{n} option value is 65536.
10161 If @var{n} is not specified or is zero, use a machine-dependent default.
10163 Enabled at levels @option{-O2}, @option{-O3}.
10165 @item -falign-jumps
10166 @itemx -falign-jumps=@var{n}
10167 @itemx -falign-jumps=@var{n}:@var{m}
10168 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10169 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10170 @opindex falign-jumps
10171 Align branch targets to a power-of-two boundary, for branch targets
10172 where the targets can only be reached by jumping.  In this case,
10173 no dummy operations need be executed.
10175 Parameters of this option are analogous to the @option{-falign-functions} option.
10176 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10177 equivalent and mean that loops are not aligned.
10179 If @var{n} is not specified or is zero, use a machine-dependent default.
10180 The maximum allowed @var{n} option value is 65536.
10182 Enabled at levels @option{-O2}, @option{-O3}.
10184 @item -funit-at-a-time
10185 @opindex funit-at-a-time
10186 This option is left for compatibility reasons. @option{-funit-at-a-time}
10187 has no effect, while @option{-fno-unit-at-a-time} implies
10188 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10190 Enabled by default.
10192 @item -fno-toplevel-reorder
10193 @opindex fno-toplevel-reorder
10194 @opindex ftoplevel-reorder
10195 Do not reorder top-level functions, variables, and @code{asm}
10196 statements.  Output them in the same order that they appear in the
10197 input file.  When this option is used, unreferenced static variables
10198 are not removed.  This option is intended to support existing code
10199 that relies on a particular ordering.  For new code, it is better to
10200 use attributes when possible.
10202 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10203 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10204 Additionally @option{-fno-toplevel-reorder} implies
10205 @option{-fno-section-anchors}.
10207 @item -fweb
10208 @opindex fweb
10209 Constructs webs as commonly used for register allocation purposes and assign
10210 each web individual pseudo register.  This allows the register allocation pass
10211 to operate on pseudos directly, but also strengthens several other optimization
10212 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
10213 however, make debugging impossible, since variables no longer stay in a
10214 ``home register''.
10216 Enabled by default with @option{-funroll-loops}.
10218 @item -fwhole-program
10219 @opindex fwhole-program
10220 Assume that the current compilation unit represents the whole program being
10221 compiled.  All public functions and variables with the exception of @code{main}
10222 and those merged by attribute @code{externally_visible} become static functions
10223 and in effect are optimized more aggressively by interprocedural optimizers.
10225 This option should not be used in combination with @option{-flto}.
10226 Instead relying on a linker plugin should provide safer and more precise
10227 information.
10229 @item -flto[=@var{n}]
10230 @opindex flto
10231 This option runs the standard link-time optimizer.  When invoked
10232 with source code, it generates GIMPLE (one of GCC's internal
10233 representations) and writes it to special ELF sections in the object
10234 file.  When the object files are linked together, all the function
10235 bodies are read from these ELF sections and instantiated as if they
10236 had been part of the same translation unit.
10238 To use the link-time optimizer, @option{-flto} and optimization
10239 options should be specified at compile time and during the final link.
10240 It is recommended that you compile all the files participating in the
10241 same link with the same options and also specify those options at
10242 link time.  
10243 For example:
10245 @smallexample
10246 gcc -c -O2 -flto foo.c
10247 gcc -c -O2 -flto bar.c
10248 gcc -o myprog -flto -O2 foo.o bar.o
10249 @end smallexample
10251 The first two invocations to GCC save a bytecode representation
10252 of GIMPLE into special ELF sections inside @file{foo.o} and
10253 @file{bar.o}.  The final invocation reads the GIMPLE bytecode from
10254 @file{foo.o} and @file{bar.o}, merges the two files into a single
10255 internal image, and compiles the result as usual.  Since both
10256 @file{foo.o} and @file{bar.o} are merged into a single image, this
10257 causes all the interprocedural analyses and optimizations in GCC to
10258 work across the two files as if they were a single one.  This means,
10259 for example, that the inliner is able to inline functions in
10260 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10262 Another (simpler) way to enable link-time optimization is:
10264 @smallexample
10265 gcc -o myprog -flto -O2 foo.c bar.c
10266 @end smallexample
10268 The above generates bytecode for @file{foo.c} and @file{bar.c},
10269 merges them together into a single GIMPLE representation and optimizes
10270 them as usual to produce @file{myprog}.
10272 The important thing to keep in mind is that to enable link-time
10273 optimizations you need to use the GCC driver to perform the link step.
10274 GCC automatically performs link-time optimization if any of the
10275 objects involved were compiled with the @option{-flto} command-line option.  
10276 You can always override
10277 the automatic decision to do link-time optimization
10278 by passing @option{-fno-lto} to the link command.
10280 To make whole program optimization effective, it is necessary to make
10281 certain whole program assumptions.  The compiler needs to know
10282 what functions and variables can be accessed by libraries and runtime
10283 outside of the link-time optimized unit.  When supported by the linker,
10284 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10285 to the compiler about used and externally visible symbols.  When
10286 the linker plugin is not available, @option{-fwhole-program} should be
10287 used to allow the compiler to make these assumptions, which leads
10288 to more aggressive optimization decisions.
10290 When a file is compiled with @option{-flto} without
10291 @option{-fuse-linker-plugin}, the generated object file is larger than
10292 a regular object file because it contains GIMPLE bytecodes and the usual
10293 final code (see @option{-ffat-lto-objects}.  This means that
10294 object files with LTO information can be linked as normal object
10295 files; if @option{-fno-lto} is passed to the linker, no
10296 interprocedural optimizations are applied.  Note that when
10297 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10298 but you cannot perform a regular, non-LTO link on them.
10300 When producing the final binary, GCC only
10301 applies link-time optimizations to those files that contain bytecode.
10302 Therefore, you can mix and match object files and libraries with
10303 GIMPLE bytecodes and final object code.  GCC automatically selects
10304 which files to optimize in LTO mode and which files to link without
10305 further processing.
10307 Generally, options specified at link time override those
10308 specified at compile time, although in some cases GCC attempts to infer
10309 link-time options from the settings used to compile the input files.
10311 If you do not specify an optimization level option @option{-O} at
10312 link time, then GCC uses the highest optimization level 
10313 used when compiling the object files.  Note that it is generally 
10314 ineffective to specify an optimization level option only at link time and 
10315 not at compile time, for two reasons.  First, compiling without 
10316 optimization suppresses compiler passes that gather information 
10317 needed for effective optimization at link time.  Second, some early
10318 optimization passes can be performed only at compile time and 
10319 not at link time.
10321 There are some code generation flags preserved by GCC when
10322 generating bytecodes, as they need to be used during the final link.
10323 Currently, the following options and their settings are taken from
10324 the first object file that explicitly specifies them: 
10325 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10326 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10327 and all the @option{-m} target flags.
10329 Certain ABI-changing flags are required to match in all compilation units,
10330 and trying to override this at link time with a conflicting value
10331 is ignored.  This includes options such as @option{-freg-struct-return}
10332 and @option{-fpcc-struct-return}. 
10334 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10335 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10336 are passed through to the link stage and merged conservatively for
10337 conflicting translation units.  Specifically
10338 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10339 precedence; and for example @option{-ffp-contract=off} takes precedence
10340 over @option{-ffp-contract=fast}.  You can override them at link time.
10342 To enable debug info generation you need to supply @option{-g} at
10343 compile-time.  If any of the input files at link time were built
10344 with debug info generation enabled the link will enable debug info
10345 generation as well.  Any elaborate debug info settings
10346 like the dwarf level @option{-gdwarf-5} need to be explicitely repeated
10347 at the linker command line and mixing different settings in different
10348 translation units is discouraged.
10350 If LTO encounters objects with C linkage declared with incompatible
10351 types in separate translation units to be linked together (undefined
10352 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10353 issued.  The behavior is still undefined at run time.  Similar
10354 diagnostics may be raised for other languages.
10356 Another feature of LTO is that it is possible to apply interprocedural
10357 optimizations on files written in different languages:
10359 @smallexample
10360 gcc -c -flto foo.c
10361 g++ -c -flto bar.cc
10362 gfortran -c -flto baz.f90
10363 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10364 @end smallexample
10366 Notice that the final link is done with @command{g++} to get the C++
10367 runtime libraries and @option{-lgfortran} is added to get the Fortran
10368 runtime libraries.  In general, when mixing languages in LTO mode, you
10369 should use the same link command options as when mixing languages in a
10370 regular (non-LTO) compilation.
10372 If object files containing GIMPLE bytecode are stored in a library archive, say
10373 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10374 are using a linker with plugin support.  To create static libraries suitable
10375 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10376 and @command{ranlib}; 
10377 to show the symbols of object files with GIMPLE bytecode, use
10378 @command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
10379 and @command{nm} have been compiled with plugin support.  At link time, use the
10380 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10381 the LTO optimization process:
10383 @smallexample
10384 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10385 @end smallexample
10387 With the linker plugin enabled, the linker extracts the needed
10388 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10389 to make them part of the aggregated GIMPLE image to be optimized.
10391 If you are not using a linker with plugin support and/or do not
10392 enable the linker plugin, then the objects inside @file{libfoo.a}
10393 are extracted and linked as usual, but they do not participate
10394 in the LTO optimization process.  In order to make a static library suitable
10395 for both LTO optimization and usual linkage, compile its object files with
10396 @option{-flto} @option{-ffat-lto-objects}.
10398 Link-time optimizations do not require the presence of the whole program to
10399 operate.  If the program does not require any symbols to be exported, it is
10400 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10401 the interprocedural optimizers to use more aggressive assumptions which may
10402 lead to improved optimization opportunities.
10403 Use of @option{-fwhole-program} is not needed when linker plugin is
10404 active (see @option{-fuse-linker-plugin}).
10406 The current implementation of LTO makes no
10407 attempt to generate bytecode that is portable between different
10408 types of hosts.  The bytecode files are versioned and there is a
10409 strict version check, so bytecode files generated in one version of
10410 GCC do not work with an older or newer version of GCC.
10412 Link-time optimization does not work well with generation of debugging
10413 information on systems other than those using a combination of ELF and
10414 DWARF.
10416 If you specify the optional @var{n}, the optimization and code
10417 generation done at link time is executed in parallel using @var{n}
10418 parallel jobs by utilizing an installed @command{make} program.  The
10419 environment variable @env{MAKE} may be used to override the program
10420 used.
10422 You can also specify @option{-flto=jobserver} to use GNU make's
10423 job server mode to determine the number of parallel jobs. This
10424 is useful when the Makefile calling GCC is already executing in parallel.
10425 You must prepend a @samp{+} to the command recipe in the parent Makefile
10426 for this to work.  This option likely only works if @env{MAKE} is
10427 GNU make.  Even without the option value, GCC tries to automatically
10428 detect a running GNU make's job server.
10430 Use @option{-flto=auto} to use GNU make's job server, if available,
10431 or otherwise fall back to autodetection of the number of CPU threads
10432 present in your system.
10434 @item -flto-partition=@var{alg}
10435 @opindex flto-partition
10436 Specify the partitioning algorithm used by the link-time optimizer.
10437 The value is either @samp{1to1} to specify a partitioning mirroring
10438 the original source files or @samp{balanced} to specify partitioning
10439 into equally sized chunks (whenever possible) or @samp{max} to create
10440 new partition for every symbol where possible.  Specifying @samp{none}
10441 as an algorithm disables partitioning and streaming completely. 
10442 The default value is @samp{balanced}. While @samp{1to1} can be used
10443 as an workaround for various code ordering issues, the @samp{max}
10444 partitioning is intended for internal testing only.
10445 The value @samp{one} specifies that exactly one partition should be
10446 used while the value @samp{none} bypasses partitioning and executes
10447 the link-time optimization step directly from the WPA phase.
10449 @item -flto-compression-level=@var{n}
10450 @opindex flto-compression-level
10451 This option specifies the level of compression used for intermediate
10452 language written to LTO object files, and is only meaningful in
10453 conjunction with LTO mode (@option{-flto}).  Valid
10454 values are 0 (no compression) to 9 (maximum compression).  Values
10455 outside this range are clamped to either 0 or 9.  If the option is not
10456 given, a default balanced compression setting is used.
10458 @item -fuse-linker-plugin
10459 @opindex fuse-linker-plugin
10460 Enables the use of a linker plugin during link-time optimization.  This
10461 option relies on plugin support in the linker, which is available in gold
10462 or in GNU ld 2.21 or newer.
10464 This option enables the extraction of object files with GIMPLE bytecode out
10465 of library archives. This improves the quality of optimization by exposing
10466 more code to the link-time optimizer.  This information specifies what
10467 symbols can be accessed externally (by non-LTO object or during dynamic
10468 linking).  Resulting code quality improvements on binaries (and shared
10469 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10470 See @option{-flto} for a description of the effect of this flag and how to
10471 use it.
10473 This option is enabled by default when LTO support in GCC is enabled
10474 and GCC was configured for use with
10475 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10477 @item -ffat-lto-objects
10478 @opindex ffat-lto-objects
10479 Fat LTO objects are object files that contain both the intermediate language
10480 and the object code. This makes them usable for both LTO linking and normal
10481 linking. This option is effective only when compiling with @option{-flto}
10482 and is ignored at link time.
10484 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10485 requires the complete toolchain to be aware of LTO. It requires a linker with
10486 linker plugin support for basic functionality.  Additionally,
10487 @command{nm}, @command{ar} and @command{ranlib}
10488 need to support linker plugins to allow a full-featured build environment
10489 (capable of building static libraries etc).  GCC provides the @command{gcc-ar},
10490 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10491 to these tools. With non fat LTO makefiles need to be modified to use them.
10493 Note that modern binutils provide plugin auto-load mechanism.
10494 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10495 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10496 @command{gcc-ranlib}).
10498 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10499 support.
10501 @item -fcompare-elim
10502 @opindex fcompare-elim
10503 After register allocation and post-register allocation instruction splitting,
10504 identify arithmetic instructions that compute processor flags similar to a
10505 comparison operation based on that arithmetic.  If possible, eliminate the
10506 explicit comparison operation.
10508 This pass only applies to certain targets that cannot explicitly represent
10509 the comparison operation before register allocation is complete.
10511 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10513 @item -fcprop-registers
10514 @opindex fcprop-registers
10515 After register allocation and post-register allocation instruction splitting,
10516 perform a copy-propagation pass to try to reduce scheduling dependencies
10517 and occasionally eliminate the copy.
10519 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10521 @item -fprofile-correction
10522 @opindex fprofile-correction
10523 Profiles collected using an instrumented binary for multi-threaded programs may
10524 be inconsistent due to missed counter updates. When this option is specified,
10525 GCC uses heuristics to correct or smooth out such inconsistencies. By
10526 default, GCC emits an error message when an inconsistent profile is detected.
10528 This option is enabled by @option{-fauto-profile}.
10530 @item -fprofile-use
10531 @itemx -fprofile-use=@var{path}
10532 @opindex fprofile-use
10533 Enable profile feedback-directed optimizations, 
10534 and the following optimizations, many of which
10535 are generally profitable only with profile feedback available:
10537 @gccoptlist{-fbranch-probabilities  -fprofile-values @gol
10538 -funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
10539 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
10540 -fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
10541 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
10542 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
10543 -fprofile-reorder-functions}
10545 Before you can use this option, you must first generate profiling information.
10546 @xref{Instrumentation Options}, for information about the
10547 @option{-fprofile-generate} option.
10549 By default, GCC emits an error message if the feedback profiles do not
10550 match the source code.  This error can be turned into a warning by using
10551 @option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
10552 optimized code.  Additionally, by default, GCC also emits a warning message if
10553 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10555 If @var{path} is specified, GCC looks at the @var{path} to find
10556 the profile feedback data files. See @option{-fprofile-dir}.
10558 @item -fauto-profile
10559 @itemx -fauto-profile=@var{path}
10560 @opindex fauto-profile
10561 Enable sampling-based feedback-directed optimizations, 
10562 and the following optimizations,
10563 many of which are generally profitable only with profile feedback available:
10565 @gccoptlist{-fbranch-probabilities  -fprofile-values @gol
10566 -funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
10567 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
10568 -fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
10569 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
10570 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
10571 -fprofile-correction}
10573 @var{path} is the name of a file containing AutoFDO profile information.
10574 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10576 Producing an AutoFDO profile data file requires running your program
10577 with the @command{perf} utility on a supported GNU/Linux target system.
10578 For more information, see @uref{https://perf.wiki.kernel.org/}.
10580 E.g.
10581 @smallexample
10582 perf record -e br_inst_retired:near_taken -b -o perf.data \
10583     -- your_program
10584 @end smallexample
10586 Then use the @command{create_gcov} tool to convert the raw profile data
10587 to a format that can be used by GCC.@  You must also supply the 
10588 unstripped binary for your program to this tool.  
10589 See @uref{https://github.com/google/autofdo}.
10591 E.g.
10592 @smallexample
10593 create_gcov --binary=your_program.unstripped --profile=perf.data \
10594     --gcov=profile.afdo
10595 @end smallexample
10596 @end table
10598 The following options control compiler behavior regarding floating-point 
10599 arithmetic.  These options trade off between speed and
10600 correctness.  All must be specifically enabled.
10602 @table @gcctabopt
10603 @item -ffloat-store
10604 @opindex ffloat-store
10605 Do not store floating-point variables in registers, and inhibit other
10606 options that might change whether a floating-point value is taken from a
10607 register or memory.
10609 @cindex floating-point precision
10610 This option prevents undesirable excess precision on machines such as
10611 the 68000 where the floating registers (of the 68881) keep more
10612 precision than a @code{double} is supposed to have.  Similarly for the
10613 x86 architecture.  For most programs, the excess precision does only
10614 good, but a few programs rely on the precise definition of IEEE floating
10615 point.  Use @option{-ffloat-store} for such programs, after modifying
10616 them to store all pertinent intermediate computations into variables.
10618 @item -fexcess-precision=@var{style}
10619 @opindex fexcess-precision
10620 This option allows further control over excess precision on machines
10621 where floating-point operations occur in a format with more precision or
10622 range than the IEEE standard and interchange floating-point types.  By
10623 default, @option{-fexcess-precision=fast} is in effect; this means that
10624 operations may be carried out in a wider precision than the types specified
10625 in the source if that would result in faster code, and it is unpredictable
10626 when rounding to the types specified in the source code takes place.
10627 When compiling C, if @option{-fexcess-precision=standard} is specified then
10628 excess precision follows the rules specified in ISO C99; in particular,
10629 both casts and assignments cause values to be rounded to their
10630 semantic types (whereas @option{-ffloat-store} only affects
10631 assignments).  This option is enabled by default for C if a strict
10632 conformance option such as @option{-std=c99} is used.
10633 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10634 regardless of whether a strict conformance option is used.
10636 @opindex mfpmath
10637 @option{-fexcess-precision=standard} is not implemented for languages
10638 other than C.  On the x86, it has no effect if @option{-mfpmath=sse}
10639 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10640 semantics apply without excess precision, and in the latter, rounding
10641 is unpredictable.
10643 @item -ffast-math
10644 @opindex ffast-math
10645 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10646 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10647 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10648 @option{-fexcess-precision=fast}.
10650 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10652 This option is not turned on by any @option{-O} option besides
10653 @option{-Ofast} since it can result in incorrect output for programs
10654 that depend on an exact implementation of IEEE or ISO rules/specifications
10655 for math functions. It may, however, yield faster code for programs
10656 that do not require the guarantees of these specifications.
10658 @item -fno-math-errno
10659 @opindex fno-math-errno
10660 @opindex fmath-errno
10661 Do not set @code{errno} after calling math functions that are executed
10662 with a single instruction, e.g., @code{sqrt}.  A program that relies on
10663 IEEE exceptions for math error handling may want to use this flag
10664 for speed while maintaining IEEE arithmetic compatibility.
10666 This option is not turned on by any @option{-O} option since
10667 it can result in incorrect output for programs that depend on
10668 an exact implementation of IEEE or ISO rules/specifications for
10669 math functions. It may, however, yield faster code for programs
10670 that do not require the guarantees of these specifications.
10672 The default is @option{-fmath-errno}.
10674 On Darwin systems, the math library never sets @code{errno}.  There is
10675 therefore no reason for the compiler to consider the possibility that
10676 it might, and @option{-fno-math-errno} is the default.
10678 @item -funsafe-math-optimizations
10679 @opindex funsafe-math-optimizations
10681 Allow optimizations for floating-point arithmetic that (a) assume
10682 that arguments and results are valid and (b) may violate IEEE or
10683 ANSI standards.  When used at link time, it may include libraries
10684 or startup files that change the default FPU control word or other
10685 similar optimizations.
10687 This option is not turned on by any @option{-O} option since
10688 it can result in incorrect output for programs that depend on
10689 an exact implementation of IEEE or ISO rules/specifications for
10690 math functions. It may, however, yield faster code for programs
10691 that do not require the guarantees of these specifications.
10692 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10693 @option{-fassociative-math} and @option{-freciprocal-math}.
10695 The default is @option{-fno-unsafe-math-optimizations}.
10697 @item -fassociative-math
10698 @opindex fassociative-math
10700 Allow re-association of operands in series of floating-point operations.
10701 This violates the ISO C and C++ language standard by possibly changing
10702 computation result.  NOTE: re-ordering may change the sign of zero as
10703 well as ignore NaNs and inhibit or create underflow or overflow (and
10704 thus cannot be used on code that relies on rounding behavior like
10705 @code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
10706 and thus may not be used when ordered comparisons are required.
10707 This option requires that both @option{-fno-signed-zeros} and
10708 @option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
10709 much sense with @option{-frounding-math}. For Fortran the option
10710 is automatically enabled when both @option{-fno-signed-zeros} and
10711 @option{-fno-trapping-math} are in effect.
10713 The default is @option{-fno-associative-math}.
10715 @item -freciprocal-math
10716 @opindex freciprocal-math
10718 Allow the reciprocal of a value to be used instead of dividing by
10719 the value if this enables optimizations.  For example @code{x / y}
10720 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10721 is subject to common subexpression elimination.  Note that this loses
10722 precision and increases the number of flops operating on the value.
10724 The default is @option{-fno-reciprocal-math}.
10726 @item -ffinite-math-only
10727 @opindex ffinite-math-only
10728 Allow optimizations for floating-point arithmetic that assume
10729 that arguments and results are not NaNs or +-Infs.
10731 This option is not turned on by any @option{-O} option since
10732 it can result in incorrect output for programs that depend on
10733 an exact implementation of IEEE or ISO rules/specifications for
10734 math functions. It may, however, yield faster code for programs
10735 that do not require the guarantees of these specifications.
10737 The default is @option{-fno-finite-math-only}.
10739 @item -fno-signed-zeros
10740 @opindex fno-signed-zeros
10741 @opindex fsigned-zeros
10742 Allow optimizations for floating-point arithmetic that ignore the
10743 signedness of zero.  IEEE arithmetic specifies the behavior of
10744 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10745 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10746 This option implies that the sign of a zero result isn't significant.
10748 The default is @option{-fsigned-zeros}.
10750 @item -fno-trapping-math
10751 @opindex fno-trapping-math
10752 @opindex ftrapping-math
10753 Compile code assuming that floating-point operations cannot generate
10754 user-visible traps.  These traps include division by zero, overflow,
10755 underflow, inexact result and invalid operation.  This option requires
10756 that @option{-fno-signaling-nans} be in effect.  Setting this option may
10757 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10759 This option should never be turned on by any @option{-O} option since
10760 it can result in incorrect output for programs that depend on
10761 an exact implementation of IEEE or ISO rules/specifications for
10762 math functions.
10764 The default is @option{-ftrapping-math}.
10766 @item -frounding-math
10767 @opindex frounding-math
10768 Disable transformations and optimizations that assume default floating-point
10769 rounding behavior.  This is round-to-zero for all floating point
10770 to integer conversions, and round-to-nearest for all other arithmetic
10771 truncations.  This option should be specified for programs that change
10772 the FP rounding mode dynamically, or that may be executed with a
10773 non-default rounding mode.  This option disables constant folding of
10774 floating-point expressions at compile time (which may be affected by
10775 rounding mode) and arithmetic transformations that are unsafe in the
10776 presence of sign-dependent rounding modes.
10778 The default is @option{-fno-rounding-math}.
10780 This option is experimental and does not currently guarantee to
10781 disable all GCC optimizations that are affected by rounding mode.
10782 Future versions of GCC may provide finer control of this setting
10783 using C99's @code{FENV_ACCESS} pragma.  This command-line option
10784 will be used to specify the default state for @code{FENV_ACCESS}.
10786 @item -fsignaling-nans
10787 @opindex fsignaling-nans
10788 Compile code assuming that IEEE signaling NaNs may generate user-visible
10789 traps during floating-point operations.  Setting this option disables
10790 optimizations that may change the number of exceptions visible with
10791 signaling NaNs.  This option implies @option{-ftrapping-math}.
10793 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10794 be defined.
10796 The default is @option{-fno-signaling-nans}.
10798 This option is experimental and does not currently guarantee to
10799 disable all GCC optimizations that affect signaling NaN behavior.
10801 @item -fno-fp-int-builtin-inexact
10802 @opindex fno-fp-int-builtin-inexact
10803 @opindex ffp-int-builtin-inexact
10804 Do not allow the built-in functions @code{ceil}, @code{floor},
10805 @code{round} and @code{trunc}, and their @code{float} and @code{long
10806 double} variants, to generate code that raises the ``inexact''
10807 floating-point exception for noninteger arguments.  ISO C99 and C11
10808 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10809 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10810 functions to do so.
10812 The default is @option{-ffp-int-builtin-inexact}, allowing the
10813 exception to be raised.  This option does nothing unless
10814 @option{-ftrapping-math} is in effect.
10816 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10817 generate a call to a library function then the ``inexact'' exception
10818 may be raised if the library implementation does not follow TS 18661.
10820 @item -fsingle-precision-constant
10821 @opindex fsingle-precision-constant
10822 Treat floating-point constants as single precision instead of
10823 implicitly converting them to double-precision constants.
10825 @item -fcx-limited-range
10826 @opindex fcx-limited-range
10827 When enabled, this option states that a range reduction step is not
10828 needed when performing complex division.  Also, there is no checking
10829 whether the result of a complex multiplication or division is @code{NaN
10830 + I*NaN}, with an attempt to rescue the situation in that case.  The
10831 default is @option{-fno-cx-limited-range}, but is enabled by
10832 @option{-ffast-math}.
10834 This option controls the default setting of the ISO C99
10835 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
10836 all languages.
10838 @item -fcx-fortran-rules
10839 @opindex fcx-fortran-rules
10840 Complex multiplication and division follow Fortran rules.  Range
10841 reduction is done as part of complex division, but there is no checking
10842 whether the result of a complex multiplication or division is @code{NaN
10843 + I*NaN}, with an attempt to rescue the situation in that case.
10845 The default is @option{-fno-cx-fortran-rules}.
10847 @end table
10849 The following options control optimizations that may improve
10850 performance, but are not enabled by any @option{-O} options.  This
10851 section includes experimental options that may produce broken code.
10853 @table @gcctabopt
10854 @item -fbranch-probabilities
10855 @opindex fbranch-probabilities
10856 After running a program compiled with @option{-fprofile-arcs}
10857 (@pxref{Instrumentation Options}),
10858 you can compile it a second time using
10859 @option{-fbranch-probabilities}, to improve optimizations based on
10860 the number of times each branch was taken.  When a program
10861 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10862 counts to a file called @file{@var{sourcename}.gcda} for each source
10863 file.  The information in this data file is very dependent on the
10864 structure of the generated code, so you must use the same source code
10865 and the same optimization options for both compilations.
10867 With @option{-fbranch-probabilities}, GCC puts a
10868 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10869 These can be used to improve optimization.  Currently, they are only
10870 used in one place: in @file{reorg.c}, instead of guessing which path a
10871 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10872 exactly determine which path is taken more often.
10874 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10876 @item -fprofile-values
10877 @opindex fprofile-values
10878 If combined with @option{-fprofile-arcs}, it adds code so that some
10879 data about values of expressions in the program is gathered.
10881 With @option{-fbranch-probabilities}, it reads back the data gathered
10882 from profiling values of expressions for usage in optimizations.
10884 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10885 @option{-fauto-profile}.
10887 @item -fprofile-reorder-functions
10888 @opindex fprofile-reorder-functions
10889 Function reordering based on profile instrumentation collects
10890 first time of execution of a function and orders these functions
10891 in ascending order.
10893 Enabled with @option{-fprofile-use}.
10895 @item -fvpt
10896 @opindex fvpt
10897 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10898 to add code to gather information about values of expressions.
10900 With @option{-fbranch-probabilities}, it reads back the data gathered
10901 and actually performs the optimizations based on them.
10902 Currently the optimizations include specialization of division operations
10903 using the knowledge about the value of the denominator.
10905 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10907 @item -frename-registers
10908 @opindex frename-registers
10909 Attempt to avoid false dependencies in scheduled code by making use
10910 of registers left over after register allocation.  This optimization
10911 most benefits processors with lots of registers.  Depending on the
10912 debug information format adopted by the target, however, it can
10913 make debugging impossible, since variables no longer stay in
10914 a ``home register''.
10916 Enabled by default with @option{-funroll-loops}.
10918 @item -fschedule-fusion
10919 @opindex fschedule-fusion
10920 Performs a target dependent pass over the instruction stream to schedule
10921 instructions of same type together because target machine can execute them
10922 more efficiently if they are adjacent to each other in the instruction flow.
10924 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10926 @item -ftracer
10927 @opindex ftracer
10928 Perform tail duplication to enlarge superblock size.  This transformation
10929 simplifies the control flow of the function allowing other optimizations to do
10930 a better job.
10932 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10934 @item -funroll-loops
10935 @opindex funroll-loops
10936 Unroll loops whose number of iterations can be determined at compile time or
10937 upon entry to the loop.  @option{-funroll-loops} implies
10938 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10939 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10940 a small constant number of iterations).  This option makes code larger, and may
10941 or may not make it run faster.
10943 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10945 @item -funroll-all-loops
10946 @opindex funroll-all-loops
10947 Unroll all loops, even if their number of iterations is uncertain when
10948 the loop is entered.  This usually makes programs run more slowly.
10949 @option{-funroll-all-loops} implies the same options as
10950 @option{-funroll-loops}.
10952 @item -fpeel-loops
10953 @opindex fpeel-loops
10954 Peels loops for which there is enough information that they do not
10955 roll much (from profile feedback or static analysis).  It also turns on
10956 complete loop peeling (i.e.@: complete removal of loops with small constant
10957 number of iterations).
10959 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10961 @item -fmove-loop-invariants
10962 @opindex fmove-loop-invariants
10963 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
10964 at level @option{-O1} and higher, except for @option{-Og}.
10966 @item -fsplit-loops
10967 @opindex fsplit-loops
10968 Split a loop into two if it contains a condition that's always true
10969 for one side of the iteration space and false for the other.
10971 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10973 @item -funswitch-loops
10974 @opindex funswitch-loops
10975 Move branches with loop invariant conditions out of the loop, with duplicates
10976 of the loop on both branches (modified according to result of the condition).
10978 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10980 @item -fversion-loops-for-strides
10981 @opindex fversion-loops-for-strides
10982 If a loop iterates over an array with a variable stride, create another
10983 version of the loop that assumes the stride is always one.  For example:
10985 @smallexample
10986 for (int i = 0; i < n; ++i)
10987   x[i * stride] = @dots{};
10988 @end smallexample
10990 becomes:
10992 @smallexample
10993 if (stride == 1)
10994   for (int i = 0; i < n; ++i)
10995     x[i] = @dots{};
10996 else
10997   for (int i = 0; i < n; ++i)
10998     x[i * stride] = @dots{};
10999 @end smallexample
11001 This is particularly useful for assumed-shape arrays in Fortran where
11002 (for example) it allows better vectorization assuming contiguous accesses.
11003 This flag is enabled by default at @option{-O3}.
11004 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11006 @item -ffunction-sections
11007 @itemx -fdata-sections
11008 @opindex ffunction-sections
11009 @opindex fdata-sections
11010 Place each function or data item into its own section in the output
11011 file if the target supports arbitrary sections.  The name of the
11012 function or the name of the data item determines the section's name
11013 in the output file.
11015 Use these options on systems where the linker can perform optimizations to
11016 improve locality of reference in the instruction space.  Most systems using the
11017 ELF object format have linkers with such optimizations.  On AIX, the linker
11018 rearranges sections (CSECTs) based on the call graph.  The performance impact
11019 varies.
11021 Together with a linker garbage collection (linker @option{--gc-sections}
11022 option) these options may lead to smaller statically-linked executables (after
11023 stripping).
11025 On ELF/DWARF systems these options do not degenerate the quality of the debug
11026 information.  There could be issues with other object files/debug info formats.
11028 Only use these options when there are significant benefits from doing so.  When
11029 you specify these options, the assembler and linker create larger object and
11030 executable files and are also slower.  These options affect code generation.
11031 They prevent optimizations by the compiler and assembler using relative
11032 locations inside a translation unit since the locations are unknown until
11033 link time.  An example of such an optimization is relaxing calls to short call
11034 instructions.
11036 @item -fstdarg-opt
11037 @opindex fstdarg-opt
11038 Optimize the prologue of variadic argument functions with respect to usage of
11039 those arguments.
11041 @item -fsection-anchors
11042 @opindex fsection-anchors
11043 Try to reduce the number of symbolic address calculations by using
11044 shared ``anchor'' symbols to address nearby objects.  This transformation
11045 can help to reduce the number of GOT entries and GOT accesses on some
11046 targets.
11048 For example, the implementation of the following function @code{foo}:
11050 @smallexample
11051 static int a, b, c;
11052 int foo (void) @{ return a + b + c; @}
11053 @end smallexample
11055 @noindent
11056 usually calculates the addresses of all three variables, but if you
11057 compile it with @option{-fsection-anchors}, it accesses the variables
11058 from a common anchor point instead.  The effect is similar to the
11059 following pseudocode (which isn't valid C):
11061 @smallexample
11062 int foo (void)
11064   register int *xr = &x;
11065   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11067 @end smallexample
11069 Not all targets support this option.
11071 @item --param @var{name}=@var{value}
11072 @opindex param
11073 In some places, GCC uses various constants to control the amount of
11074 optimization that is done.  For example, GCC does not inline functions
11075 that contain more than a certain number of instructions.  You can
11076 control some of these constants on the command line using the
11077 @option{--param} option.
11079 The names of specific parameters, and the meaning of the values, are
11080 tied to the internals of the compiler, and are subject to change
11081 without notice in future releases.
11083 In order to get minimal, maximal and default value of a parameter,
11084 one can use @option{--help=param -Q} options.
11086 In each case, the @var{value} is an integer.  The allowable choices for
11087 @var{name} are:
11089 @table @gcctabopt
11090 @item predictable-branch-outcome
11091 When branch is predicted to be taken with probability lower than this threshold
11092 (in percent), then it is considered well predictable.
11094 @item max-rtl-if-conversion-insns
11095 RTL if-conversion tries to remove conditional branches around a block and
11096 replace them with conditionally executed instructions.  This parameter
11097 gives the maximum number of instructions in a block which should be
11098 considered for if-conversion.  The compiler will
11099 also use other heuristics to decide whether if-conversion is likely to be
11100 profitable.
11102 @item max-rtl-if-conversion-predictable-cost
11103 @itemx max-rtl-if-conversion-unpredictable-cost
11104 RTL if-conversion will try to remove conditional branches around a block
11105 and replace them with conditionally executed instructions.  These parameters
11106 give the maximum permissible cost for the sequence that would be generated
11107 by if-conversion depending on whether the branch is statically determined
11108 to be predictable or not.  The units for this parameter are the same as
11109 those for the GCC internal seq_cost metric.  The compiler will try to
11110 provide a reasonable default for this parameter using the BRANCH_COST
11111 target macro.
11113 @item max-crossjump-edges
11114 The maximum number of incoming edges to consider for cross-jumping.
11115 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11116 the number of edges incoming to each block.  Increasing values mean
11117 more aggressive optimization, making the compilation time increase with
11118 probably small improvement in executable size.
11120 @item min-crossjump-insns
11121 The minimum number of instructions that must be matched at the end
11122 of two blocks before cross-jumping is performed on them.  This
11123 value is ignored in the case where all instructions in the block being
11124 cross-jumped from are matched.
11126 @item max-grow-copy-bb-insns
11127 The maximum code size expansion factor when copying basic blocks
11128 instead of jumping.  The expansion is relative to a jump instruction.
11130 @item max-goto-duplication-insns
11131 The maximum number of instructions to duplicate to a block that jumps
11132 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
11133 passes, GCC factors computed gotos early in the compilation process,
11134 and unfactors them as late as possible.  Only computed jumps at the
11135 end of a basic blocks with no more than max-goto-duplication-insns are
11136 unfactored.
11138 @item max-delay-slot-insn-search
11139 The maximum number of instructions to consider when looking for an
11140 instruction to fill a delay slot.  If more than this arbitrary number of
11141 instructions are searched, the time savings from filling the delay slot
11142 are minimal, so stop searching.  Increasing values mean more
11143 aggressive optimization, making the compilation time increase with probably
11144 small improvement in execution time.
11146 @item max-delay-slot-live-search
11147 When trying to fill delay slots, the maximum number of instructions to
11148 consider when searching for a block with valid live register
11149 information.  Increasing this arbitrarily chosen value means more
11150 aggressive optimization, increasing the compilation time.  This parameter
11151 should be removed when the delay slot code is rewritten to maintain the
11152 control-flow graph.
11154 @item max-gcse-memory
11155 The approximate maximum amount of memory that can be allocated in
11156 order to perform the global common subexpression elimination
11157 optimization.  If more memory than specified is required, the
11158 optimization is not done.
11160 @item max-gcse-insertion-ratio
11161 If the ratio of expression insertions to deletions is larger than this value
11162 for any expression, then RTL PRE inserts or removes the expression and thus
11163 leaves partially redundant computations in the instruction stream.
11165 @item max-pending-list-length
11166 The maximum number of pending dependencies scheduling allows
11167 before flushing the current state and starting over.  Large functions
11168 with few branches or calls can create excessively large lists which
11169 needlessly consume memory and resources.
11171 @item max-modulo-backtrack-attempts
11172 The maximum number of backtrack attempts the scheduler should make
11173 when modulo scheduling a loop.  Larger values can exponentially increase
11174 compilation time.
11176 @item max-inline-insns-single
11177 Several parameters control the tree inliner used in GCC@.
11178 This number sets the maximum number of instructions (counted in GCC's
11179 internal representation) in a single function that the tree inliner
11180 considers for inlining.  This only affects functions declared
11181 inline and methods implemented in a class declaration (C++).
11183 @item max-inline-insns-auto
11184 When you use @option{-finline-functions} (included in @option{-O3}),
11185 a lot of functions that would otherwise not be considered for inlining
11186 by the compiler are investigated.  To those functions, a different
11187 (more restrictive) limit compared to functions declared inline can
11188 be applied.
11190 @item max-inline-insns-small
11191 This is bound applied to calls which are considered relevant with
11192 @option{-finline-small-functions}.
11194 @item max-inline-insns-size
11195 This is bound applied to calls which are optimized for size. Small growth
11196 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11198 @item uninlined-function-insns
11199 Number of instructions accounted by inliner for function overhead such as
11200 function prologue and epilogue.
11202 @item uninlined-function-time
11203 Extra time accounted by inliner for function overhead such as time needed to
11204 execute function prologue and epilogue
11206 @item uninlined-thunk-insns
11207 @item uninlined-thunk-time
11208 Same as @option{--param uninlined-function-insns} and
11209 @option{--param uninlined-function-time} but applied to function thunks
11211 @item inline-min-speedup
11212 When estimated performance improvement of caller + callee runtime exceeds this
11213 threshold (in percent), the function can be inlined regardless of the limit on
11214 @option{--param max-inline-insns-single} and @option{--param
11215 max-inline-insns-auto}.
11217 @item large-function-insns
11218 The limit specifying really large functions.  For functions larger than this
11219 limit after inlining, inlining is constrained by
11220 @option{--param large-function-growth}.  This parameter is useful primarily
11221 to avoid extreme compilation time caused by non-linear algorithms used by the
11222 back end.
11224 @item large-function-growth
11225 Specifies maximal growth of large function caused by inlining in percents.
11226 For example, parameter value 100 limits large function growth to 2.0 times
11227 the original size.
11229 @item large-unit-insns
11230 The limit specifying large translation unit.  Growth caused by inlining of
11231 units larger than this limit is limited by @option{--param inline-unit-growth}.
11232 For small units this might be too tight.
11233 For example, consider a unit consisting of function A
11234 that is inline and B that just calls A three times.  If B is small relative to
11235 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
11236 large units consisting of small inlineable functions, however, the overall unit
11237 growth limit is needed to avoid exponential explosion of code size.  Thus for
11238 smaller units, the size is increased to @option{--param large-unit-insns}
11239 before applying @option{--param inline-unit-growth}.
11241 @item inline-unit-growth
11242 Specifies maximal overall growth of the compilation unit caused by inlining.
11243 For example, parameter value 20 limits unit growth to 1.2 times the original
11244 size. Cold functions (either marked cold via an attribute or by profile
11245 feedback) are not accounted into the unit size.
11247 @item ipcp-unit-growth
11248 Specifies maximal overall growth of the compilation unit caused by
11249 interprocedural constant propagation.  For example, parameter value 10 limits
11250 unit growth to 1.1 times the original size.
11252 @item large-stack-frame
11253 The limit specifying large stack frames.  While inlining the algorithm is trying
11254 to not grow past this limit too much.
11256 @item large-stack-frame-growth
11257 Specifies maximal growth of large stack frames caused by inlining in percents.
11258 For example, parameter value 1000 limits large stack frame growth to 11 times
11259 the original size.
11261 @item max-inline-insns-recursive
11262 @itemx max-inline-insns-recursive-auto
11263 Specifies the maximum number of instructions an out-of-line copy of a
11264 self-recursive inline
11265 function can grow into by performing recursive inlining.
11267 @option{--param max-inline-insns-recursive} applies to functions
11268 declared inline.
11269 For functions not declared inline, recursive inlining
11270 happens only when @option{-finline-functions} (included in @option{-O3}) is
11271 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11273 @item max-inline-recursive-depth
11274 @itemx max-inline-recursive-depth-auto
11275 Specifies the maximum recursion depth used for recursive inlining.
11277 @option{--param max-inline-recursive-depth} applies to functions
11278 declared inline.  For functions not declared inline, recursive inlining
11279 happens only when @option{-finline-functions} (included in @option{-O3}) is
11280 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11282 @item min-inline-recursive-probability
11283 Recursive inlining is profitable only for function having deep recursion
11284 in average and can hurt for function having little recursion depth by
11285 increasing the prologue size or complexity of function body to other
11286 optimizers.
11288 When profile feedback is available (see @option{-fprofile-generate}) the actual
11289 recursion depth can be guessed from the probability that function recurses
11290 via a given call expression.  This parameter limits inlining only to call
11291 expressions whose probability exceeds the given threshold (in percents).
11293 @item early-inlining-insns
11294 Specify growth that the early inliner can make.  In effect it increases
11295 the amount of inlining for code having a large abstraction penalty.
11297 @item max-early-inliner-iterations
11298 Limit of iterations of the early inliner.  This basically bounds
11299 the number of nested indirect calls the early inliner can resolve.
11300 Deeper chains are still handled by late inlining.
11302 @item comdat-sharing-probability
11303 Probability (in percent) that C++ inline function with comdat visibility
11304 are shared across multiple compilation units.
11306 @item profile-func-internal-id
11307 A parameter to control whether to use function internal id in profile
11308 database lookup. If the value is 0, the compiler uses an id that
11309 is based on function assembler name and filename, which makes old profile
11310 data more tolerant to source changes such as function reordering etc.
11312 @item min-vect-loop-bound
11313 The minimum number of iterations under which loops are not vectorized
11314 when @option{-ftree-vectorize} is used.  The number of iterations after
11315 vectorization needs to be greater than the value specified by this option
11316 to allow vectorization.
11318 @item gcse-cost-distance-ratio
11319 Scaling factor in calculation of maximum distance an expression
11320 can be moved by GCSE optimizations.  This is currently supported only in the
11321 code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
11322 is with simple expressions, i.e., the expressions that have cost
11323 less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
11324 hoisting of simple expressions.
11326 @item gcse-unrestricted-cost
11327 Cost, roughly measured as the cost of a single typical machine
11328 instruction, at which GCSE optimizations do not constrain
11329 the distance an expression can travel.  This is currently
11330 supported only in the code hoisting pass.  The lesser the cost,
11331 the more aggressive code hoisting is.  Specifying 0 
11332 allows all expressions to travel unrestricted distances.
11334 @item max-hoist-depth
11335 The depth of search in the dominator tree for expressions to hoist.
11336 This is used to avoid quadratic behavior in hoisting algorithm.
11337 The value of 0 does not limit on the search, but may slow down compilation
11338 of huge functions.
11340 @item max-tail-merge-comparisons
11341 The maximum amount of similar bbs to compare a bb with.  This is used to
11342 avoid quadratic behavior in tree tail merging.
11344 @item max-tail-merge-iterations
11345 The maximum amount of iterations of the pass over the function.  This is used to
11346 limit compilation time in tree tail merging.
11348 @item store-merging-allow-unaligned
11349 Allow the store merging pass to introduce unaligned stores if it is legal to
11350 do so.
11352 @item max-stores-to-merge
11353 The maximum number of stores to attempt to merge into wider stores in the store
11354 merging pass.
11356 @item max-unrolled-insns
11357 The maximum number of instructions that a loop may have to be unrolled.
11358 If a loop is unrolled, this parameter also determines how many times
11359 the loop code is unrolled.
11361 @item max-average-unrolled-insns
11362 The maximum number of instructions biased by probabilities of their execution
11363 that a loop may have to be unrolled.  If a loop is unrolled,
11364 this parameter also determines how many times the loop code is unrolled.
11366 @item max-unroll-times
11367 The maximum number of unrollings of a single loop.
11369 @item max-peeled-insns
11370 The maximum number of instructions that a loop may have to be peeled.
11371 If a loop is peeled, this parameter also determines how many times
11372 the loop code is peeled.
11374 @item max-peel-times
11375 The maximum number of peelings of a single loop.
11377 @item max-peel-branches
11378 The maximum number of branches on the hot path through the peeled sequence.
11380 @item max-completely-peeled-insns
11381 The maximum number of insns of a completely peeled loop.
11383 @item max-completely-peel-times
11384 The maximum number of iterations of a loop to be suitable for complete peeling.
11386 @item max-completely-peel-loop-nest-depth
11387 The maximum depth of a loop nest suitable for complete peeling.
11389 @item max-unswitch-insns
11390 The maximum number of insns of an unswitched loop.
11392 @item max-unswitch-level
11393 The maximum number of branches unswitched in a single loop.
11395 @item lim-expensive
11396 The minimum cost of an expensive expression in the loop invariant motion.
11398 @item iv-consider-all-candidates-bound
11399 Bound on number of candidates for induction variables, below which
11400 all candidates are considered for each use in induction variable
11401 optimizations.  If there are more candidates than this,
11402 only the most relevant ones are considered to avoid quadratic time complexity.
11404 @item iv-max-considered-uses
11405 The induction variable optimizations give up on loops that contain more
11406 induction variable uses.
11408 @item iv-always-prune-cand-set-bound
11409 If the number of candidates in the set is smaller than this value,
11410 always try to remove unnecessary ivs from the set
11411 when adding a new one.
11413 @item avg-loop-niter
11414 Average number of iterations of a loop.
11416 @item dse-max-object-size
11417 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11418 Larger values may result in larger compilation times.
11420 @item dse-max-alias-queries-per-store
11421 Maximum number of queries into the alias oracle per store.
11422 Larger values result in larger compilation times and may result in more
11423 removed dead stores.
11425 @item scev-max-expr-size
11426 Bound on size of expressions used in the scalar evolutions analyzer.
11427 Large expressions slow the analyzer.
11429 @item scev-max-expr-complexity
11430 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11431 Complex expressions slow the analyzer.
11433 @item max-tree-if-conversion-phi-args
11434 Maximum number of arguments in a PHI supported by TREE if conversion
11435 unless the loop is marked with simd pragma.
11437 @item vect-max-version-for-alignment-checks
11438 The maximum number of run-time checks that can be performed when
11439 doing loop versioning for alignment in the vectorizer.
11441 @item vect-max-version-for-alias-checks
11442 The maximum number of run-time checks that can be performed when
11443 doing loop versioning for alias in the vectorizer.
11445 @item vect-max-peeling-for-alignment
11446 The maximum number of loop peels to enhance access alignment
11447 for vectorizer. Value -1 means no limit.
11449 @item max-iterations-to-track
11450 The maximum number of iterations of a loop the brute-force algorithm
11451 for analysis of the number of iterations of the loop tries to evaluate.
11453 @item hot-bb-count-fraction
11454 The denominator n of fraction 1/n of the maximal execution count of a
11455 basic block in the entire program that a basic block needs to at least
11456 have in order to be considered hot.  The default is 10000, which means
11457 that a basic block is considered hot if its execution count is greater
11458 than 1/10000 of the maximal execution count.  0 means that it is never
11459 considered hot.  Used in non-LTO mode.
11461 @item hot-bb-count-ws-permille
11462 The number of most executed permilles, ranging from 0 to 1000, of the
11463 profiled execution of the entire program to which the execution count
11464 of a basic block must be part of in order to be considered hot.  The
11465 default is 990, which means that a basic block is considered hot if
11466 its execution count contributes to the upper 990 permilles, or 99.0%,
11467 of the profiled execution of the entire program.  0 means that it is
11468 never considered hot.  Used in LTO mode.
11470 @item hot-bb-frequency-fraction
11471 The denominator n of fraction 1/n of the execution frequency of the
11472 entry block of a function that a basic block of this function needs
11473 to at least have in order to be considered hot.  The default is 1000,
11474 which means that a basic block is considered hot in a function if it
11475 is executed more frequently than 1/1000 of the frequency of the entry
11476 block of the function.  0 means that it is never considered hot.
11478 @item unlikely-bb-count-fraction
11479 The denominator n of fraction 1/n of the number of profiled runs of
11480 the entire program below which the execution count of a basic block
11481 must be in order for the basic block to be considered unlikely executed.
11482 The default is 20, which means that a basic block is considered unlikely
11483 executed if it is executed in fewer than 1/20, or 5%, of the runs of
11484 the program.  0 means that it is always considered unlikely executed.
11486 @item max-predicted-iterations
11487 The maximum number of loop iterations we predict statically.  This is useful
11488 in cases where a function contains a single loop with known bound and
11489 another loop with unknown bound.
11490 The known number of iterations is predicted correctly, while
11491 the unknown number of iterations average to roughly 10.  This means that the
11492 loop without bounds appears artificially cold relative to the other one.
11494 @item builtin-expect-probability
11495 Control the probability of the expression having the specified value. This
11496 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11498 @item builtin-string-cmp-inline-length
11499 The maximum length of a constant string for a builtin string cmp call 
11500 eligible for inlining.
11502 @item align-threshold
11504 Select fraction of the maximal frequency of executions of a basic block in
11505 a function to align the basic block.
11507 @item align-loop-iterations
11509 A loop expected to iterate at least the selected number of iterations is
11510 aligned.
11512 @item tracer-dynamic-coverage
11513 @itemx tracer-dynamic-coverage-feedback
11515 This value is used to limit superblock formation once the given percentage of
11516 executed instructions is covered.  This limits unnecessary code size
11517 expansion.
11519 The @option{tracer-dynamic-coverage-feedback} parameter
11520 is used only when profile
11521 feedback is available.  The real profiles (as opposed to statically estimated
11522 ones) are much less balanced allowing the threshold to be larger value.
11524 @item tracer-max-code-growth
11525 Stop tail duplication once code growth has reached given percentage.  This is
11526 a rather artificial limit, as most of the duplicates are eliminated later in
11527 cross jumping, so it may be set to much higher values than is the desired code
11528 growth.
11530 @item tracer-min-branch-ratio
11532 Stop reverse growth when the reverse probability of best edge is less than this
11533 threshold (in percent).
11535 @item tracer-min-branch-probability
11536 @itemx tracer-min-branch-probability-feedback
11538 Stop forward growth if the best edge has probability lower than this
11539 threshold.
11541 Similarly to @option{tracer-dynamic-coverage} two parameters are
11542 provided.  @option{tracer-min-branch-probability-feedback} is used for
11543 compilation with profile feedback and @option{tracer-min-branch-probability}
11544 compilation without.  The value for compilation with profile feedback
11545 needs to be more conservative (higher) in order to make tracer
11546 effective.
11548 @item stack-clash-protection-guard-size
11549 Specify the size of the operating system provided stack guard as
11550 2 raised to @var{num} bytes.  Higher values may reduce the
11551 number of explicit probes, but a value larger than the operating system
11552 provided guard will leave code vulnerable to stack clash style attacks.
11554 @item stack-clash-protection-probe-interval
11555 Stack clash protection involves probing stack space as it is allocated.  This
11556 param controls the maximum distance between probes into the stack as 2 raised
11557 to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
11558 larger than the operating system provided guard will leave code vulnerable to
11559 stack clash style attacks.
11561 @item max-cse-path-length
11563 The maximum number of basic blocks on path that CSE considers.
11565 @item max-cse-insns
11566 The maximum number of instructions CSE processes before flushing.
11568 @item ggc-min-expand
11570 GCC uses a garbage collector to manage its own memory allocation.  This
11571 parameter specifies the minimum percentage by which the garbage
11572 collector's heap should be allowed to expand between collections.
11573 Tuning this may improve compilation speed; it has no effect on code
11574 generation.
11576 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11577 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
11578 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
11579 GCC is not able to calculate RAM on a particular platform, the lower
11580 bound of 30% is used.  Setting this parameter and
11581 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11582 every opportunity.  This is extremely slow, but can be useful for
11583 debugging.
11585 @item ggc-min-heapsize
11587 Minimum size of the garbage collector's heap before it begins bothering
11588 to collect garbage.  The first collection occurs after the heap expands
11589 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
11590 tuning this may improve compilation speed, and has no effect on code
11591 generation.
11593 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11594 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11595 with a lower bound of 4096 (four megabytes) and an upper bound of
11596 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
11597 particular platform, the lower bound is used.  Setting this parameter
11598 very large effectively disables garbage collection.  Setting this
11599 parameter and @option{ggc-min-expand} to zero causes a full collection
11600 to occur at every opportunity.
11602 @item max-reload-search-insns
11603 The maximum number of instruction reload should look backward for equivalent
11604 register.  Increasing values mean more aggressive optimization, making the
11605 compilation time increase with probably slightly better performance.
11607 @item max-cselib-memory-locations
11608 The maximum number of memory locations cselib should take into account.
11609 Increasing values mean more aggressive optimization, making the compilation time
11610 increase with probably slightly better performance.
11612 @item max-sched-ready-insns
11613 The maximum number of instructions ready to be issued the scheduler should
11614 consider at any given time during the first scheduling pass.  Increasing
11615 values mean more thorough searches, making the compilation time increase
11616 with probably little benefit.
11618 @item max-sched-region-blocks
11619 The maximum number of blocks in a region to be considered for
11620 interblock scheduling.
11622 @item max-pipeline-region-blocks
11623 The maximum number of blocks in a region to be considered for
11624 pipelining in the selective scheduler.
11626 @item max-sched-region-insns
11627 The maximum number of insns in a region to be considered for
11628 interblock scheduling.
11630 @item max-pipeline-region-insns
11631 The maximum number of insns in a region to be considered for
11632 pipelining in the selective scheduler.
11634 @item min-spec-prob
11635 The minimum probability (in percents) of reaching a source block
11636 for interblock speculative scheduling.
11638 @item max-sched-extend-regions-iters
11639 The maximum number of iterations through CFG to extend regions.
11640 A value of 0 disables region extensions.
11642 @item max-sched-insn-conflict-delay
11643 The maximum conflict delay for an insn to be considered for speculative motion.
11645 @item sched-spec-prob-cutoff
11646 The minimal probability of speculation success (in percents), so that
11647 speculative insns are scheduled.
11649 @item sched-state-edge-prob-cutoff
11650 The minimum probability an edge must have for the scheduler to save its
11651 state across it.
11653 @item sched-mem-true-dep-cost
11654 Minimal distance (in CPU cycles) between store and load targeting same
11655 memory locations.
11657 @item selsched-max-lookahead
11658 The maximum size of the lookahead window of selective scheduling.  It is a
11659 depth of search for available instructions.
11661 @item selsched-max-sched-times
11662 The maximum number of times that an instruction is scheduled during
11663 selective scheduling.  This is the limit on the number of iterations
11664 through which the instruction may be pipelined.
11666 @item selsched-insns-to-rename
11667 The maximum number of best instructions in the ready list that are considered
11668 for renaming in the selective scheduler.
11670 @item sms-min-sc
11671 The minimum value of stage count that swing modulo scheduler
11672 generates.
11674 @item max-last-value-rtl
11675 The maximum size measured as number of RTLs that can be recorded in an expression
11676 in combiner for a pseudo register as last known value of that register.
11678 @item max-combine-insns
11679 The maximum number of instructions the RTL combiner tries to combine.
11681 @item integer-share-limit
11682 Small integer constants can use a shared data structure, reducing the
11683 compiler's memory usage and increasing its speed.  This sets the maximum
11684 value of a shared integer constant.
11686 @item ssp-buffer-size
11687 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11688 protection when @option{-fstack-protection} is used.
11690 @item min-size-for-stack-sharing
11691 The minimum size of variables taking part in stack slot sharing when not
11692 optimizing.
11694 @item max-jump-thread-duplication-stmts
11695 Maximum number of statements allowed in a block that needs to be
11696 duplicated when threading jumps.
11698 @item max-fields-for-field-sensitive
11699 Maximum number of fields in a structure treated in
11700 a field sensitive manner during pointer analysis.
11702 @item prefetch-latency
11703 Estimate on average number of instructions that are executed before
11704 prefetch finishes.  The distance prefetched ahead is proportional
11705 to this constant.  Increasing this number may also lead to less
11706 streams being prefetched (see @option{simultaneous-prefetches}).
11708 @item simultaneous-prefetches
11709 Maximum number of prefetches that can run at the same time.
11711 @item l1-cache-line-size
11712 The size of cache line in L1 data cache, in bytes.
11714 @item l1-cache-size
11715 The size of L1 data cache, in kilobytes.
11717 @item l2-cache-size
11718 The size of L2 data cache, in kilobytes.
11720 @item prefetch-dynamic-strides
11721 Whether the loop array prefetch pass should issue software prefetch hints
11722 for strides that are non-constant.  In some cases this may be
11723 beneficial, though the fact the stride is non-constant may make it
11724 hard to predict when there is clear benefit to issuing these hints.
11726 Set to 1 if the prefetch hints should be issued for non-constant
11727 strides.  Set to 0 if prefetch hints should be issued only for strides that
11728 are known to be constant and below @option{prefetch-minimum-stride}.
11730 @item prefetch-minimum-stride
11731 Minimum constant stride, in bytes, to start using prefetch hints for.  If
11732 the stride is less than this threshold, prefetch hints will not be issued.
11734 This setting is useful for processors that have hardware prefetchers, in
11735 which case there may be conflicts between the hardware prefetchers and
11736 the software prefetchers.  If the hardware prefetchers have a maximum
11737 stride they can handle, it should be used here to improve the use of
11738 software prefetchers.
11740 A value of -1 means we don't have a threshold and therefore
11741 prefetch hints can be issued for any constant stride.
11743 This setting is only useful for strides that are known and constant.
11745 @item loop-interchange-max-num-stmts
11746 The maximum number of stmts in a loop to be interchanged.
11748 @item loop-interchange-stride-ratio
11749 The minimum ratio between stride of two loops for interchange to be profitable.
11751 @item min-insn-to-prefetch-ratio
11752 The minimum ratio between the number of instructions and the
11753 number of prefetches to enable prefetching in a loop.
11755 @item prefetch-min-insn-to-mem-ratio
11756 The minimum ratio between the number of instructions and the
11757 number of memory references to enable prefetching in a loop.
11759 @item use-canonical-types
11760 Whether the compiler should use the ``canonical'' type system.
11761 Should always be 1, which uses a more efficient internal
11762 mechanism for comparing types in C++ and Objective-C++.  However, if
11763 bugs in the canonical type system are causing compilation failures,
11764 set this value to 0 to disable canonical types.
11766 @item switch-conversion-max-branch-ratio
11767 Switch initialization conversion refuses to create arrays that are
11768 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11769 branches in the switch.
11771 @item max-partial-antic-length
11772 Maximum length of the partial antic set computed during the tree
11773 partial redundancy elimination optimization (@option{-ftree-pre}) when
11774 optimizing at @option{-O3} and above.  For some sorts of source code
11775 the enhanced partial redundancy elimination optimization can run away,
11776 consuming all of the memory available on the host machine.  This
11777 parameter sets a limit on the length of the sets that are computed,
11778 which prevents the runaway behavior.  Setting a value of 0 for
11779 this parameter allows an unlimited set length.
11781 @item rpo-vn-max-loop-depth
11782 Maximum loop depth that is value-numbered optimistically.
11783 When the limit hits the innermost
11784 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11785 loop nest are value-numbered optimistically and the remaining ones not.
11787 @item sccvn-max-alias-queries-per-access
11788 Maximum number of alias-oracle queries we perform when looking for
11789 redundancies for loads and stores.  If this limit is hit the search
11790 is aborted and the load or store is not considered redundant.  The
11791 number of queries is algorithmically limited to the number of
11792 stores on all paths from the load to the function entry.
11794 @item ira-max-loops-num
11795 IRA uses regional register allocation by default.  If a function
11796 contains more loops than the number given by this parameter, only at most
11797 the given number of the most frequently-executed loops form regions
11798 for regional register allocation.
11800 @item ira-max-conflict-table-size 
11801 Although IRA uses a sophisticated algorithm to compress the conflict
11802 table, the table can still require excessive amounts of memory for
11803 huge functions.  If the conflict table for a function could be more
11804 than the size in MB given by this parameter, the register allocator
11805 instead uses a faster, simpler, and lower-quality
11806 algorithm that does not require building a pseudo-register conflict table.  
11808 @item ira-loop-reserved-regs
11809 IRA can be used to evaluate more accurate register pressure in loops
11810 for decisions to move loop invariants (see @option{-O3}).  The number
11811 of available registers reserved for some other purposes is given
11812 by this parameter.  Default of the parameter
11813 is the best found from numerous experiments.
11815 @item lra-inheritance-ebb-probability-cutoff
11816 LRA tries to reuse values reloaded in registers in subsequent insns.
11817 This optimization is called inheritance.  EBB is used as a region to
11818 do this optimization.  The parameter defines a minimal fall-through
11819 edge probability in percentage used to add BB to inheritance EBB in
11820 LRA.  The default value was chosen
11821 from numerous runs of SPEC2000 on x86-64.
11823 @item loop-invariant-max-bbs-in-loop
11824 Loop invariant motion can be very expensive, both in compilation time and
11825 in amount of needed compile-time memory, with very large loops.  Loops
11826 with more basic blocks than this parameter won't have loop invariant
11827 motion optimization performed on them.
11829 @item loop-max-datarefs-for-datadeps
11830 Building data dependencies is expensive for very large loops.  This
11831 parameter limits the number of data references in loops that are
11832 considered for data dependence analysis.  These large loops are no
11833 handled by the optimizations using loop data dependencies.
11835 @item max-vartrack-size
11836 Sets a maximum number of hash table slots to use during variable
11837 tracking dataflow analysis of any function.  If this limit is exceeded
11838 with variable tracking at assignments enabled, analysis for that
11839 function is retried without it, after removing all debug insns from
11840 the function.  If the limit is exceeded even without debug insns, var
11841 tracking analysis is completely disabled for the function.  Setting
11842 the parameter to zero makes it unlimited.
11844 @item max-vartrack-expr-depth
11845 Sets a maximum number of recursion levels when attempting to map
11846 variable names or debug temporaries to value expressions.  This trades
11847 compilation time for more complete debug information.  If this is set too
11848 low, value expressions that are available and could be represented in
11849 debug information may end up not being used; setting this higher may
11850 enable the compiler to find more complex debug expressions, but compile
11851 time and memory use may grow.
11853 @item max-debug-marker-count
11854 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11855 markers) to avoid complexity explosion at inlining or expanding to RTL.
11856 If a function has more such gimple stmts than the set limit, such stmts
11857 will be dropped from the inlined copy of a function, and from its RTL
11858 expansion.
11860 @item min-nondebug-insn-uid
11861 Use uids starting at this parameter for nondebug insns.  The range below
11862 the parameter is reserved exclusively for debug insns created by
11863 @option{-fvar-tracking-assignments}, but debug insns may get
11864 (non-overlapping) uids above it if the reserved range is exhausted.
11866 @item ipa-sra-ptr-growth-factor
11867 IPA-SRA replaces a pointer to an aggregate with one or more new
11868 parameters only when their cumulative size is less or equal to
11869 @option{ipa-sra-ptr-growth-factor} times the size of the original
11870 pointer parameter.
11872 @item sra-max-scalarization-size-Ospeed
11873 @itemx sra-max-scalarization-size-Osize
11874 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11875 replace scalar parts of aggregates with uses of independent scalar
11876 variables.  These parameters control the maximum size, in storage units,
11877 of aggregate which is considered for replacement when compiling for
11878 speed
11879 (@option{sra-max-scalarization-size-Ospeed}) or size
11880 (@option{sra-max-scalarization-size-Osize}) respectively.
11882 @item tm-max-aggregate-size
11883 When making copies of thread-local variables in a transaction, this
11884 parameter specifies the size in bytes after which variables are
11885 saved with the logging functions as opposed to save/restore code
11886 sequence pairs.  This option only applies when using
11887 @option{-fgnu-tm}.
11889 @item graphite-max-nb-scop-params
11890 To avoid exponential effects in the Graphite loop transforms, the
11891 number of parameters in a Static Control Part (SCoP) is bounded.
11892 A value of zero can be used to lift
11893 the bound.  A variable whose value is unknown at compilation time and
11894 defined outside a SCoP is a parameter of the SCoP.
11896 @item loop-block-tile-size
11897 Loop blocking or strip mining transforms, enabled with
11898 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11899 loop in the loop nest by a given number of iterations.  The strip
11900 length can be changed using the @option{loop-block-tile-size}
11901 parameter.
11903 @item ipa-cp-value-list-size
11904 IPA-CP attempts to track all possible values and types passed to a function's
11905 parameter in order to propagate them and perform devirtualization.
11906 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11907 stores per one formal parameter of a function.
11909 @item ipa-cp-eval-threshold
11910 IPA-CP calculates its own score of cloning profitability heuristics
11911 and performs those cloning opportunities with scores that exceed
11912 @option{ipa-cp-eval-threshold}.
11914 @item ipa-cp-recursion-penalty
11915 Percentage penalty the recursive functions will receive when they
11916 are evaluated for cloning.
11918 @item ipa-cp-single-call-penalty
11919 Percentage penalty functions containing a single call to another
11920 function will receive when they are evaluated for cloning.
11922 @item ipa-max-agg-items
11923 IPA-CP is also capable to propagate a number of scalar values passed
11924 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11925 number of such values per one parameter.
11927 @item ipa-cp-loop-hint-bonus
11928 When IPA-CP determines that a cloning candidate would make the number
11929 of iterations of a loop known, it adds a bonus of
11930 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11931 the candidate.
11933 @item ipa-max-aa-steps
11934 During its analysis of function bodies, IPA-CP employs alias analysis
11935 in order to track values pointed to by function parameters.  In order
11936 not spend too much time analyzing huge functions, it gives up and
11937 consider all memory clobbered after examining
11938 @option{ipa-max-aa-steps} statements modifying memory.
11940 @item lto-partitions
11941 Specify desired number of partitions produced during WHOPR compilation.
11942 The number of partitions should exceed the number of CPUs used for compilation.
11944 @item lto-min-partition
11945 Size of minimal partition for WHOPR (in estimated instructions).
11946 This prevents expenses of splitting very small programs into too many
11947 partitions.
11949 @item lto-max-partition
11950 Size of max partition for WHOPR (in estimated instructions).
11951 to provide an upper bound for individual size of partition.
11952 Meant to be used only with balanced partitioning.
11954 @item lto-max-streaming-parallelism
11955 Maximal number of parallel processes used for LTO streaming.
11957 @item cxx-max-namespaces-for-diagnostic-help
11958 The maximum number of namespaces to consult for suggestions when C++
11959 name lookup fails for an identifier.
11961 @item sink-frequency-threshold
11962 The maximum relative execution frequency (in percents) of the target block
11963 relative to a statement's original block to allow statement sinking of a
11964 statement.  Larger numbers result in more aggressive statement sinking.
11965 A small positive adjustment is applied for
11966 statements with memory operands as those are even more profitable so sink.
11968 @item max-stores-to-sink
11969 The maximum number of conditional store pairs that can be sunk.  Set to 0
11970 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11971 (@option{-ftree-loop-if-convert}) is disabled.
11973 @item allow-store-data-races
11974 Allow optimizers to introduce new data races on stores.
11975 Set to 1 to allow, otherwise to 0.
11977 @item case-values-threshold
11978 The smallest number of different values for which it is best to use a
11979 jump-table instead of a tree of conditional branches.  If the value is
11980 0, use the default for the machine.
11982 @item jump-table-max-growth-ratio-for-size
11983 The maximum code size growth ratio when expanding
11984 into a jump table (in percent).  The parameter is used when
11985 optimizing for size.
11987 @item jump-table-max-growth-ratio-for-speed
11988 The maximum code size growth ratio when expanding
11989 into a jump table (in percent).  The parameter is used when
11990 optimizing for speed.
11992 @item tree-reassoc-width
11993 Set the maximum number of instructions executed in parallel in
11994 reassociated tree. This parameter overrides target dependent
11995 heuristics used by default if has non zero value.
11997 @item sched-pressure-algorithm
11998 Choose between the two available implementations of
11999 @option{-fsched-pressure}.  Algorithm 1 is the original implementation
12000 and is the more likely to prevent instructions from being reordered.
12001 Algorithm 2 was designed to be a compromise between the relatively
12002 conservative approach taken by algorithm 1 and the rather aggressive
12003 approach taken by the default scheduler.  It relies more heavily on
12004 having a regular register file and accurate register pressure classes.
12005 See @file{haifa-sched.c} in the GCC sources for more details.
12007 The default choice depends on the target.
12009 @item max-slsr-cand-scan
12010 Set the maximum number of existing candidates that are considered when
12011 seeking a basis for a new straight-line strength reduction candidate.
12013 @item asan-globals
12014 Enable buffer overflow detection for global objects.  This kind
12015 of protection is enabled by default if you are using
12016 @option{-fsanitize=address} option.
12017 To disable global objects protection use @option{--param asan-globals=0}.
12019 @item asan-stack
12020 Enable buffer overflow detection for stack objects.  This kind of
12021 protection is enabled by default when using @option{-fsanitize=address}.
12022 To disable stack protection use @option{--param asan-stack=0} option.
12024 @item asan-instrument-reads
12025 Enable buffer overflow detection for memory reads.  This kind of
12026 protection is enabled by default when using @option{-fsanitize=address}.
12027 To disable memory reads protection use
12028 @option{--param asan-instrument-reads=0}.
12030 @item asan-instrument-writes
12031 Enable buffer overflow detection for memory writes.  This kind of
12032 protection is enabled by default when using @option{-fsanitize=address}.
12033 To disable memory writes protection use
12034 @option{--param asan-instrument-writes=0} option.
12036 @item asan-memintrin
12037 Enable detection for built-in functions.  This kind of protection
12038 is enabled by default when using @option{-fsanitize=address}.
12039 To disable built-in functions protection use
12040 @option{--param asan-memintrin=0}.
12042 @item asan-use-after-return
12043 Enable detection of use-after-return.  This kind of protection
12044 is enabled by default when using the @option{-fsanitize=address} option.
12045 To disable it use @option{--param asan-use-after-return=0}.
12047 Note: By default the check is disabled at run time.  To enable it,
12048 add @code{detect_stack_use_after_return=1} to the environment variable
12049 @env{ASAN_OPTIONS}.
12051 @item asan-instrumentation-with-call-threshold
12052 If number of memory accesses in function being instrumented
12053 is greater or equal to this number, use callbacks instead of inline checks.
12054 E.g. to disable inline code use
12055 @option{--param asan-instrumentation-with-call-threshold=0}.
12057 @item use-after-scope-direct-emission-threshold
12058 If the size of a local variable in bytes is smaller or equal to this
12059 number, directly poison (or unpoison) shadow memory instead of using
12060 run-time callbacks.
12062 @item max-fsm-thread-path-insns
12063 Maximum number of instructions to copy when duplicating blocks on a
12064 finite state automaton jump thread path.
12066 @item max-fsm-thread-length
12067 Maximum number of basic blocks on a finite state automaton jump thread
12068 path.
12070 @item max-fsm-thread-paths
12071 Maximum number of new jump thread paths to create for a finite state
12072 automaton.
12074 @item parloops-chunk-size
12075 Chunk size of omp schedule for loops parallelized by parloops.
12077 @item parloops-schedule
12078 Schedule type of omp schedule for loops parallelized by parloops (static,
12079 dynamic, guided, auto, runtime).
12081 @item parloops-min-per-thread
12082 The minimum number of iterations per thread of an innermost parallelized
12083 loop for which the parallelized variant is preferred over the single threaded
12084 one.  Note that for a parallelized loop nest the
12085 minimum number of iterations of the outermost loop per thread is two.
12087 @item max-ssa-name-query-depth
12088 Maximum depth of recursion when querying properties of SSA names in things
12089 like fold routines.  One level of recursion corresponds to following a
12090 use-def chain.
12092 @item hsa-gen-debug-stores
12093 Enable emission of special debug stores within HSA kernels which are
12094 then read and reported by libgomp plugin.  Generation of these stores
12095 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12096 enable it.
12098 @item max-speculative-devirt-maydefs
12099 The maximum number of may-defs we analyze when looking for a must-def
12100 specifying the dynamic type of an object that invokes a virtual call
12101 we may be able to devirtualize speculatively.
12103 @item max-vrp-switch-assertions
12104 The maximum number of assertions to add along the default edge of a switch
12105 statement during VRP.
12107 @item unroll-jam-min-percent
12108 The minimum percentage of memory references that must be optimized
12109 away for the unroll-and-jam transformation to be considered profitable.
12111 @item unroll-jam-max-unroll
12112 The maximum number of times the outer loop should be unrolled by
12113 the unroll-and-jam transformation.
12115 @item max-rtl-if-conversion-unpredictable-cost
12116 Maximum permissible cost for the sequence that would be generated
12117 by the RTL if-conversion pass for a branch that is considered unpredictable.
12119 @item max-variable-expansions-in-unroller
12120 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12121 of times that an individual variable will be expanded during loop unrolling.
12123 @item tracer-min-branch-probability-feedback
12124 Stop forward growth if the probability of best edge is less than
12125 this threshold (in percent). Used when profile feedback is available.
12127 @item partial-inlining-entry-probability
12128 Maximum probability of the entry BB of split region
12129 (in percent relative to entry BB of the function)
12130 to make partial inlining happen.
12132 @item max-tracked-strlens
12133 Maximum number of strings for which strlen optimization pass will
12134 track string lengths.
12136 @item gcse-after-reload-partial-fraction
12137 The threshold ratio for performing partial redundancy
12138 elimination after reload.
12140 @item gcse-after-reload-critical-fraction
12141 The threshold ratio of critical edges execution count that
12142 permit performing redundancy elimination after reload.
12144 @item max-loop-header-insns
12145 The maximum number of insns in loop header duplicated
12146 by the copy loop headers pass.
12148 @item vect-epilogues-nomask
12149 Enable loop epilogue vectorization using smaller vector size.
12151 @item slp-max-insns-in-bb
12152 Maximum number of instructions in basic block to be
12153 considered for SLP vectorization.
12155 @item avoid-fma-max-bits
12156 Maximum number of bits for which we avoid creating FMAs.
12158 @item sms-loop-average-count-threshold
12159 A threshold on the average loop count considered by the swing modulo scheduler.
12161 @item sms-dfa-history
12162 The number of cycles the swing modulo scheduler considers when checking
12163 conflicts using DFA.
12165 @item max-inline-insns-recursive-auto
12166 The maximum number of instructions non-inline function
12167 can grow to via recursive inlining.
12169 @item graphite-allow-codegen-errors
12170 Whether codegen errors should be ICEs when @option{-fchecking}.
12172 @item sms-max-ii-factor
12173 A factor for tuning the upper bound that swing modulo scheduler
12174 uses for scheduling a loop.
12176 @item lra-max-considered-reload-pseudos
12177 The max number of reload pseudos which are considered during
12178 spilling a non-reload pseudo.
12180 @item max-pow-sqrt-depth
12181 Maximum depth of sqrt chains to use when synthesizing exponentiation
12182 by a real constant.
12184 @item max-dse-active-local-stores
12185 Maximum number of active local stores in RTL dead store elimination.
12187 @item asan-instrument-allocas
12188 Enable asan allocas/VLAs protection.
12190 @item max-iterations-computation-cost
12191 Bound on the cost of an expression to compute the number of iterations.
12193 @item max-isl-operations
12194 Maximum number of isl operations, 0 means unlimited.
12196 @item graphite-max-arrays-per-scop
12197 Maximum number of arrays per scop.
12199 @item max-vartrack-reverse-op-size
12200 Max. size of loc list for which reverse ops should be added.
12202 @item tracer-dynamic-coverage-feedback
12203 The percentage of function, weighted by execution frequency,
12204 that must be covered by trace formation.
12205 Used when profile feedback is available.
12207 @item max-inline-recursive-depth-auto
12208 The maximum depth of recursive inlining for non-inline functions.
12210 @item fsm-scale-path-stmts
12211 Scale factor to apply to the number of statements in a threading path
12212 when comparing to the number of (scaled) blocks.
12214 @item fsm-maximum-phi-arguments
12215 Maximum number of arguments a PHI may have before the FSM threader
12216 will not try to thread through its block.
12218 @item uninit-control-dep-attempts
12219 Maximum number of nested calls to search for control dependencies
12220 during uninitialized variable analysis.
12222 @item max-once-peeled-insns
12223 The maximum number of insns of a peeled loop that rolls only once.
12225 @item sra-max-scalarization-size-Osize
12226 Maximum size, in storage units, of an aggregate
12227 which should be considered for scalarization when compiling for size.
12229 @item fsm-scale-path-blocks
12230 Scale factor to apply to the number of blocks in a threading path
12231 when comparing to the number of (scaled) statements.
12233 @item sched-autopref-queue-depth
12234 Hardware autoprefetcher scheduler model control flag.
12235 Number of lookahead cycles the model looks into; at '
12236 ' only enable instruction sorting heuristic.
12238 @item loop-versioning-max-inner-insns
12239 The maximum number of instructions that an inner loop can have
12240 before the loop versioning pass considers it too big to copy.
12242 @item loop-versioning-max-outer-insns
12243 The maximum number of instructions that an outer loop can have
12244 before the loop versioning pass considers it too big to copy,
12245 discounting any instructions in inner loops that directly benefit
12246 from versioning.
12248 @item ssa-name-def-chain-limit
12249 The maximum number of SSA_NAME assignments to follow in determining
12250 a property of a variable such as its value.  This limits the number
12251 of iterations or recursive calls GCC performs when optimizing certain
12252 statements or when determining their validity prior to issuing
12253 diagnostics.
12255 @end table
12256 @end table
12258 @node Instrumentation Options
12259 @section Program Instrumentation Options
12260 @cindex instrumentation options
12261 @cindex program instrumentation options
12262 @cindex run-time error checking options
12263 @cindex profiling options
12264 @cindex options, program instrumentation
12265 @cindex options, run-time error checking
12266 @cindex options, profiling
12268 GCC supports a number of command-line options that control adding
12269 run-time instrumentation to the code it normally generates.  
12270 For example, one purpose of instrumentation is collect profiling
12271 statistics for use in finding program hot spots, code coverage
12272 analysis, or profile-guided optimizations.
12273 Another class of program instrumentation is adding run-time checking 
12274 to detect programming errors like invalid pointer
12275 dereferences or out-of-bounds array accesses, as well as deliberately
12276 hostile attacks such as stack smashing or C++ vtable hijacking.
12277 There is also a general hook which can be used to implement other
12278 forms of tracing or function-level instrumentation for debug or
12279 program analysis purposes.
12281 @table @gcctabopt
12282 @cindex @command{prof}
12283 @cindex @command{gprof}
12284 @item -p
12285 @itemx -pg
12286 @opindex p
12287 @opindex pg
12288 Generate extra code to write profile information suitable for the
12289 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12290 (for @option{-pg}).  You must use this option when compiling
12291 the source files you want data about, and you must also use it when
12292 linking.
12294 You can use the function attribute @code{no_instrument_function} to
12295 suppress profiling of individual functions when compiling with these options.
12296 @xref{Common Function Attributes}.
12298 @item -fprofile-arcs
12299 @opindex fprofile-arcs
12300 Add code so that program flow @dfn{arcs} are instrumented.  During
12301 execution the program records how many times each branch and call is
12302 executed and how many times it is taken or returns.  On targets that support
12303 constructors with priority support, profiling properly handles constructors,
12304 destructors and C++ constructors (and destructors) of classes which are used
12305 as a type of a global variable.
12307 When the compiled
12308 program exits it saves this data to a file called
12309 @file{@var{auxname}.gcda} for each source file.  The data may be used for
12310 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12311 test coverage analysis (@option{-ftest-coverage}).  Each object file's
12312 @var{auxname} is generated from the name of the output file, if
12313 explicitly specified and it is not the final executable, otherwise it is
12314 the basename of the source file.  In both cases any suffix is removed
12315 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12316 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12317 @xref{Cross-profiling}.
12319 @cindex @command{gcov}
12320 @item --coverage
12321 @opindex coverage
12323 This option is used to compile and link code instrumented for coverage
12324 analysis.  The option is a synonym for @option{-fprofile-arcs}
12325 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12326 linking).  See the documentation for those options for more details.
12328 @itemize
12330 @item
12331 Compile the source files with @option{-fprofile-arcs} plus optimization
12332 and code generation options.  For test coverage analysis, use the
12333 additional @option{-ftest-coverage} option.  You do not need to profile
12334 every source file in a program.
12336 @item
12337 Compile the source files additionally with @option{-fprofile-abs-path}
12338 to create absolute path names in the @file{.gcno} files.  This allows
12339 @command{gcov} to find the correct sources in projects where compilations
12340 occur with different working directories.
12342 @item
12343 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12344 (the latter implies the former).
12346 @item
12347 Run the program on a representative workload to generate the arc profile
12348 information.  This may be repeated any number of times.  You can run
12349 concurrent instances of your program, and provided that the file system
12350 supports locking, the data files will be correctly updated.  Unless
12351 a strict ISO C dialect option is in effect, @code{fork} calls are
12352 detected and correctly handled without double counting.
12354 @item
12355 For profile-directed optimizations, compile the source files again with
12356 the same optimization and code generation options plus
12357 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12358 Control Optimization}).
12360 @item
12361 For test coverage analysis, use @command{gcov} to produce human readable
12362 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
12363 @command{gcov} documentation for further information.
12365 @end itemize
12367 With @option{-fprofile-arcs}, for each function of your program GCC
12368 creates a program flow graph, then finds a spanning tree for the graph.
12369 Only arcs that are not on the spanning tree have to be instrumented: the
12370 compiler adds code to count the number of times that these arcs are
12371 executed.  When an arc is the only exit or only entrance to a block, the
12372 instrumentation code can be added to the block; otherwise, a new basic
12373 block must be created to hold the instrumentation code.
12375 @need 2000
12376 @item -ftest-coverage
12377 @opindex ftest-coverage
12378 Produce a notes file that the @command{gcov} code-coverage utility
12379 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12380 show program coverage.  Each source file's note file is called
12381 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
12382 above for a description of @var{auxname} and instructions on how to
12383 generate test coverage data.  Coverage data matches the source files
12384 more closely if you do not optimize.
12386 @item -fprofile-abs-path
12387 @opindex fprofile-abs-path
12388 Automatically convert relative source file names to absolute path names
12389 in the @file{.gcno} files.  This allows @command{gcov} to find the correct
12390 sources in projects where compilations occur with different working
12391 directories.
12393 @item -fprofile-dir=@var{path}
12394 @opindex fprofile-dir
12396 Set the directory to search for the profile data files in to @var{path}.
12397 This option affects only the profile data generated by
12398 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12399 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12400 and its related options.  Both absolute and relative paths can be used.
12401 By default, GCC uses the current directory as @var{path}, thus the
12402 profile data file appears in the same directory as the object file.
12403 In order to prevent the file name clashing, if the object file name is
12404 not an absolute path, we mangle the absolute path of the
12405 @file{@var{sourcename}.gcda} file and use it as the file name of a
12406 @file{.gcda} file.  See similar option @option{-fprofile-note}.
12408 When an executable is run in a massive parallel environment, it is recommended
12409 to save profile to different folders.  That can be done with variables
12410 in @var{path} that are exported during run-time:
12412 @table @gcctabopt
12414 @item %p
12415 process ID.
12417 @item %q@{VAR@}
12418 value of environment variable @var{VAR}
12420 @end table
12422 @item -fprofile-generate
12423 @itemx -fprofile-generate=@var{path}
12424 @opindex fprofile-generate
12426 Enable options usually used for instrumenting application to produce
12427 profile useful for later recompilation with profile feedback based
12428 optimization.  You must use @option{-fprofile-generate} both when
12429 compiling and when linking your program.
12431 The following options are enabled:
12432 @option{-fprofile-arcs}, @option{-fprofile-values},
12433 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12435 If @var{path} is specified, GCC looks at the @var{path} to find
12436 the profile feedback data files. See @option{-fprofile-dir}.
12438 To optimize the program based on the collected profile information, use
12439 @option{-fprofile-use}.  @xref{Optimize Options}, for more information.
12441 @item -fprofile-note=@var{path}
12442 @opindex fprofile-note
12444 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
12445 location.  If you combine the option with multiple source files,
12446 the @file{.gcno} file will be overwritten.
12448 @item -fprofile-update=@var{method}
12449 @opindex fprofile-update
12451 Alter the update method for an application instrumented for profile
12452 feedback based optimization.  The @var{method} argument should be one of
12453 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12454 The first one is useful for single-threaded applications,
12455 while the second one prevents profile corruption by emitting thread-safe code.
12457 @strong{Warning:} When an application does not properly join all threads
12458 (or creates an detached thread), a profile file can be still corrupted.
12460 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12461 when supported by a target, or to @samp{single} otherwise.  The GCC driver
12462 automatically selects @samp{prefer-atomic} when @option{-pthread}
12463 is present in the command line.
12465 @item -fprofile-filter-files=@var{regex}
12466 @opindex fprofile-filter-files
12468 Instrument only functions from files where names match
12469 any regular expression (separated by a semi-colon).
12471 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12472 only @file{main.c} and all C files starting with 'module'.
12474 @item -fprofile-exclude-files=@var{regex}
12475 @opindex fprofile-exclude-files
12477 Instrument only functions from files where names do not match
12478 all the regular expressions (separated by a semi-colon).
12480 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12481 of all files that are located in @file{/usr/} folder.
12483 @item -fsanitize=address
12484 @opindex fsanitize=address
12485 Enable AddressSanitizer, a fast memory error detector.
12486 Memory access instructions are instrumented to detect
12487 out-of-bounds and use-after-free bugs.
12488 The option enables @option{-fsanitize-address-use-after-scope}.
12489 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12490 more details.  The run-time behavior can be influenced using the
12491 @env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
12492 the available options are shown at startup of the instrumented program.  See
12493 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12494 for a list of supported options.
12495 The option cannot be combined with @option{-fsanitize=thread}.
12497 @item -fsanitize=kernel-address
12498 @opindex fsanitize=kernel-address
12499 Enable AddressSanitizer for Linux kernel.
12500 See @uref{https://github.com/google/kasan/wiki} for more details.
12502 @item -fsanitize=pointer-compare
12503 @opindex fsanitize=pointer-compare
12504 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12505 The option must be combined with either @option{-fsanitize=kernel-address} or
12506 @option{-fsanitize=address}
12507 The option cannot be combined with @option{-fsanitize=thread}.
12508 Note: By default the check is disabled at run time.  To enable it,
12509 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12510 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12511 invalid operation only when both pointers are non-null.
12513 @item -fsanitize=pointer-subtract
12514 @opindex fsanitize=pointer-subtract
12515 Instrument subtraction with pointer operands.
12516 The option must be combined with either @option{-fsanitize=kernel-address} or
12517 @option{-fsanitize=address}
12518 The option cannot be combined with @option{-fsanitize=thread}.
12519 Note: By default the check is disabled at run time.  To enable it,
12520 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12521 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12522 invalid operation only when both pointers are non-null.
12524 @item -fsanitize=thread
12525 @opindex fsanitize=thread
12526 Enable ThreadSanitizer, a fast data race detector.
12527 Memory access instructions are instrumented to detect
12528 data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12529 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12530 environment variable; see
12531 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12532 supported options.
12533 The option cannot be combined with @option{-fsanitize=address},
12534 @option{-fsanitize=leak}.
12536 Note that sanitized atomic builtins cannot throw exceptions when
12537 operating on invalid memory addresses with non-call exceptions
12538 (@option{-fnon-call-exceptions}).
12540 @item -fsanitize=leak
12541 @opindex fsanitize=leak
12542 Enable LeakSanitizer, a memory leak detector.
12543 This option only matters for linking of executables and
12544 the executable is linked against a library that overrides @code{malloc}
12545 and other allocator functions.  See
12546 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12547 details.  The run-time behavior can be influenced using the
12548 @env{LSAN_OPTIONS} environment variable.
12549 The option cannot be combined with @option{-fsanitize=thread}.
12551 @item -fsanitize=undefined
12552 @opindex fsanitize=undefined
12553 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12554 Various computations are instrumented to detect undefined behavior
12555 at runtime.  Current suboptions are:
12557 @table @gcctabopt
12559 @item -fsanitize=shift
12560 @opindex fsanitize=shift
12561 This option enables checking that the result of a shift operation is
12562 not undefined.  Note that what exactly is considered undefined differs
12563 slightly between C and C++, as well as between ISO C90 and C99, etc.
12564 This option has two suboptions, @option{-fsanitize=shift-base} and
12565 @option{-fsanitize=shift-exponent}.
12567 @item -fsanitize=shift-exponent
12568 @opindex fsanitize=shift-exponent
12569 This option enables checking that the second argument of a shift operation
12570 is not negative and is smaller than the precision of the promoted first
12571 argument.
12573 @item -fsanitize=shift-base
12574 @opindex fsanitize=shift-base
12575 If the second argument of a shift operation is within range, check that the
12576 result of a shift operation is not undefined.  Note that what exactly is
12577 considered undefined differs slightly between C and C++, as well as between
12578 ISO C90 and C99, etc.
12580 @item -fsanitize=integer-divide-by-zero
12581 @opindex fsanitize=integer-divide-by-zero
12582 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12584 @item -fsanitize=unreachable
12585 @opindex fsanitize=unreachable
12586 With this option, the compiler turns the @code{__builtin_unreachable}
12587 call into a diagnostics message call instead.  When reaching the
12588 @code{__builtin_unreachable} call, the behavior is undefined.
12590 @item -fsanitize=vla-bound
12591 @opindex fsanitize=vla-bound
12592 This option instructs the compiler to check that the size of a variable
12593 length array is positive.
12595 @item -fsanitize=null
12596 @opindex fsanitize=null
12597 This option enables pointer checking.  Particularly, the application
12598 built with this option turned on will issue an error message when it
12599 tries to dereference a NULL pointer, or if a reference (possibly an
12600 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12601 on an object pointed by a NULL pointer.
12603 @item -fsanitize=return
12604 @opindex fsanitize=return
12605 This option enables return statement checking.  Programs
12606 built with this option turned on will issue an error message
12607 when the end of a non-void function is reached without actually
12608 returning a value.  This option works in C++ only.
12610 @item -fsanitize=signed-integer-overflow
12611 @opindex fsanitize=signed-integer-overflow
12612 This option enables signed integer overflow checking.  We check that
12613 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12614 does not overflow in the signed arithmetics.  Note, integer promotion
12615 rules must be taken into account.  That is, the following is not an
12616 overflow:
12617 @smallexample
12618 signed char a = SCHAR_MAX;
12619 a++;
12620 @end smallexample
12622 @item -fsanitize=bounds
12623 @opindex fsanitize=bounds
12624 This option enables instrumentation of array bounds.  Various out of bounds
12625 accesses are detected.  Flexible array members, flexible array member-like
12626 arrays, and initializers of variables with static storage are not instrumented.
12628 @item -fsanitize=bounds-strict
12629 @opindex fsanitize=bounds-strict
12630 This option enables strict instrumentation of array bounds.  Most out of bounds
12631 accesses are detected, including flexible array members and flexible array
12632 member-like arrays.  Initializers of variables with static storage are not
12633 instrumented.
12635 @item -fsanitize=alignment
12636 @opindex fsanitize=alignment
12638 This option enables checking of alignment of pointers when they are
12639 dereferenced, or when a reference is bound to insufficiently aligned target,
12640 or when a method or constructor is invoked on insufficiently aligned object.
12642 @item -fsanitize=object-size
12643 @opindex fsanitize=object-size
12644 This option enables instrumentation of memory references using the
12645 @code{__builtin_object_size} function.  Various out of bounds pointer
12646 accesses are detected.
12648 @item -fsanitize=float-divide-by-zero
12649 @opindex fsanitize=float-divide-by-zero
12650 Detect floating-point division by zero.  Unlike other similar options,
12651 @option{-fsanitize=float-divide-by-zero} is not enabled by
12652 @option{-fsanitize=undefined}, since floating-point division by zero can
12653 be a legitimate way of obtaining infinities and NaNs.
12655 @item -fsanitize=float-cast-overflow
12656 @opindex fsanitize=float-cast-overflow
12657 This option enables floating-point type to integer conversion checking.
12658 We check that the result of the conversion does not overflow.
12659 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12660 not enabled by @option{-fsanitize=undefined}.
12661 This option does not work well with @code{FE_INVALID} exceptions enabled.
12663 @item -fsanitize=nonnull-attribute
12664 @opindex fsanitize=nonnull-attribute
12666 This option enables instrumentation of calls, checking whether null values
12667 are not passed to arguments marked as requiring a non-null value by the
12668 @code{nonnull} function attribute.
12670 @item -fsanitize=returns-nonnull-attribute
12671 @opindex fsanitize=returns-nonnull-attribute
12673 This option enables instrumentation of return statements in functions
12674 marked with @code{returns_nonnull} function attribute, to detect returning
12675 of null values from such functions.
12677 @item -fsanitize=bool
12678 @opindex fsanitize=bool
12680 This option enables instrumentation of loads from bool.  If a value other
12681 than 0/1 is loaded, a run-time error is issued.
12683 @item -fsanitize=enum
12684 @opindex fsanitize=enum
12686 This option enables instrumentation of loads from an enum type.  If
12687 a value outside the range of values for the enum type is loaded,
12688 a run-time error is issued.
12690 @item -fsanitize=vptr
12691 @opindex fsanitize=vptr
12693 This option enables instrumentation of C++ member function calls, member
12694 accesses and some conversions between pointers to base and derived classes,
12695 to verify the referenced object has the correct dynamic type.
12697 @item -fsanitize=pointer-overflow
12698 @opindex fsanitize=pointer-overflow
12700 This option enables instrumentation of pointer arithmetics.  If the pointer
12701 arithmetics overflows, a run-time error is issued.
12703 @item -fsanitize=builtin
12704 @opindex fsanitize=builtin
12706 This option enables instrumentation of arguments to selected builtin
12707 functions.  If an invalid value is passed to such arguments, a run-time
12708 error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12709 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12710 by this option.
12712 @end table
12714 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12715 @option{-fsanitize=undefined} gives a diagnostic message.
12716 This currently works only for the C family of languages.
12718 @item -fno-sanitize=all
12719 @opindex fno-sanitize=all
12721 This option disables all previously enabled sanitizers.
12722 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12723 together.
12725 @item -fasan-shadow-offset=@var{number}
12726 @opindex fasan-shadow-offset
12727 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12728 It is useful for experimenting with different shadow memory layouts in
12729 Kernel AddressSanitizer.
12731 @item -fsanitize-sections=@var{s1},@var{s2},...
12732 @opindex fsanitize-sections
12733 Sanitize global variables in selected user-defined sections.  @var{si} may
12734 contain wildcards.
12736 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12737 @opindex fsanitize-recover
12738 @opindex fno-sanitize-recover
12739 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12740 mentioned in comma-separated list of @var{opts}.  Enabling this option
12741 for a sanitizer component causes it to attempt to continue
12742 running the program as if no error happened.  This means multiple
12743 runtime errors can be reported in a single program run, and the exit
12744 code of the program may indicate success even when errors
12745 have been reported.  The @option{-fno-sanitize-recover=} option
12746 can be used to alter
12747 this behavior: only the first detected error is reported
12748 and program then exits with a non-zero exit code.
12750 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12751 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12752 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12753 @option{-fsanitize=bounds-strict},
12754 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12755 For these sanitizers error recovery is turned on by default,
12756 except @option{-fsanitize=address}, for which this feature is experimental.
12757 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12758 accepted, the former enables recovery for all sanitizers that support it,
12759 the latter disables recovery for all sanitizers that support it.
12761 Even if a recovery mode is turned on the compiler side, it needs to be also
12762 enabled on the runtime library side, otherwise the failures are still fatal.
12763 The runtime library defaults to @code{halt_on_error=0} for
12764 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12765 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12766 setting the @code{halt_on_error} flag in the corresponding environment variable.
12768 Syntax without an explicit @var{opts} parameter is deprecated.  It is
12769 equivalent to specifying an @var{opts} list of:
12771 @smallexample
12772 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12773 @end smallexample
12775 @item -fsanitize-address-use-after-scope
12776 @opindex fsanitize-address-use-after-scope
12777 Enable sanitization of local variables to detect use-after-scope bugs.
12778 The option sets @option{-fstack-reuse} to @samp{none}.
12780 @item -fsanitize-undefined-trap-on-error
12781 @opindex fsanitize-undefined-trap-on-error
12782 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12783 report undefined behavior using @code{__builtin_trap} rather than
12784 a @code{libubsan} library routine.  The advantage of this is that the
12785 @code{libubsan} library is not needed and is not linked in, so this
12786 is usable even in freestanding environments.
12788 @item -fsanitize-coverage=trace-pc
12789 @opindex fsanitize-coverage=trace-pc
12790 Enable coverage-guided fuzzing code instrumentation.
12791 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12793 @item -fsanitize-coverage=trace-cmp
12794 @opindex fsanitize-coverage=trace-cmp
12795 Enable dataflow guided fuzzing code instrumentation.
12796 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12797 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12798 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12799 variable or @code{__sanitizer_cov_trace_const_cmp1},
12800 @code{__sanitizer_cov_trace_const_cmp2},
12801 @code{__sanitizer_cov_trace_const_cmp4} or
12802 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12803 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12804 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12805 @code{__sanitizer_cov_trace_switch} for switch statements.
12807 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12808 @opindex fcf-protection
12809 Enable code instrumentation of control-flow transfers to increase
12810 program security by checking that target addresses of control-flow
12811 transfer instructions (such as indirect function call, function return,
12812 indirect jump) are valid.  This prevents diverting the flow of control
12813 to an unexpected target.  This is intended to protect against such
12814 threats as Return-oriented Programming (ROP), and similarly
12815 call/jmp-oriented programming (COP/JOP).
12817 The value @code{branch} tells the compiler to implement checking of
12818 validity of control-flow transfer at the point of indirect branch
12819 instructions, i.e.@: call/jmp instructions.  The value @code{return}
12820 implements checking of validity at the point of returning from a
12821 function.  The value @code{full} is an alias for specifying both
12822 @code{branch} and @code{return}. The value @code{none} turns off
12823 instrumentation.
12825 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12826 used.  The first bit of @code{__CET__} is set to 1 for the value
12827 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12828 the @code{return}.
12830 You can also use the @code{nocf_check} attribute to identify
12831 which functions and calls should be skipped from instrumentation
12832 (@pxref{Function Attributes}).
12834 Currently the x86 GNU/Linux target provides an implementation based
12835 on Intel Control-flow Enforcement Technology (CET).
12837 @item -fstack-protector
12838 @opindex fstack-protector
12839 Emit extra code to check for buffer overflows, such as stack smashing
12840 attacks.  This is done by adding a guard variable to functions with
12841 vulnerable objects.  This includes functions that call @code{alloca}, and
12842 functions with buffers larger than 8 bytes.  The guards are initialized
12843 when a function is entered and then checked when the function exits.
12844 If a guard check fails, an error message is printed and the program exits.
12846 @item -fstack-protector-all
12847 @opindex fstack-protector-all
12848 Like @option{-fstack-protector} except that all functions are protected.
12850 @item -fstack-protector-strong
12851 @opindex fstack-protector-strong
12852 Like @option{-fstack-protector} but includes additional functions to
12853 be protected --- those that have local array definitions, or have
12854 references to local frame addresses.
12856 @item -fstack-protector-explicit
12857 @opindex fstack-protector-explicit
12858 Like @option{-fstack-protector} but only protects those functions which
12859 have the @code{stack_protect} attribute.
12861 @item -fstack-check
12862 @opindex fstack-check
12863 Generate code to verify that you do not go beyond the boundary of the
12864 stack.  You should specify this flag if you are running in an
12865 environment with multiple threads, but you only rarely need to specify it in
12866 a single-threaded environment since stack overflow is automatically
12867 detected on nearly all systems if there is only one stack.
12869 Note that this switch does not actually cause checking to be done; the
12870 operating system or the language runtime must do that.  The switch causes
12871 generation of code to ensure that they see the stack being extended.
12873 You can additionally specify a string parameter: @samp{no} means no
12874 checking, @samp{generic} means force the use of old-style checking,
12875 @samp{specific} means use the best checking method and is equivalent
12876 to bare @option{-fstack-check}.
12878 Old-style checking is a generic mechanism that requires no specific
12879 target support in the compiler but comes with the following drawbacks:
12881 @enumerate
12882 @item
12883 Modified allocation strategy for large objects: they are always
12884 allocated dynamically if their size exceeds a fixed threshold.  Note this
12885 may change the semantics of some code.
12887 @item
12888 Fixed limit on the size of the static frame of functions: when it is
12889 topped by a particular function, stack checking is not reliable and
12890 a warning is issued by the compiler.
12892 @item
12893 Inefficiency: because of both the modified allocation strategy and the
12894 generic implementation, code performance is hampered.
12895 @end enumerate
12897 Note that old-style stack checking is also the fallback method for
12898 @samp{specific} if no target support has been added in the compiler.
12900 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12901 and stack overflows.  @samp{specific} is an excellent choice when compiling
12902 Ada code.  It is not generally sufficient to protect against stack-clash
12903 attacks.  To protect against those you want @samp{-fstack-clash-protection}.
12905 @item -fstack-clash-protection
12906 @opindex fstack-clash-protection
12907 Generate code to prevent stack clash style attacks.  When this option is
12908 enabled, the compiler will only allocate one page of stack space at a time
12909 and each page is accessed immediately after allocation.  Thus, it prevents
12910 allocations from jumping over any stack guard page provided by the
12911 operating system.
12913 Most targets do not fully support stack clash protection.  However, on
12914 those targets @option{-fstack-clash-protection} will protect dynamic stack
12915 allocations.  @option{-fstack-clash-protection} may also provide limited
12916 protection for static stack allocations if the target supports
12917 @option{-fstack-check=specific}.
12919 @item -fstack-limit-register=@var{reg}
12920 @itemx -fstack-limit-symbol=@var{sym}
12921 @itemx -fno-stack-limit
12922 @opindex fstack-limit-register
12923 @opindex fstack-limit-symbol
12924 @opindex fno-stack-limit
12925 Generate code to ensure that the stack does not grow beyond a certain value,
12926 either the value of a register or the address of a symbol.  If a larger
12927 stack is required, a signal is raised at run time.  For most targets,
12928 the signal is raised before the stack overruns the boundary, so
12929 it is possible to catch the signal without taking special precautions.
12931 For instance, if the stack starts at absolute address @samp{0x80000000}
12932 and grows downwards, you can use the flags
12933 @option{-fstack-limit-symbol=__stack_limit} and
12934 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12935 of 128KB@.  Note that this may only work with the GNU linker.
12937 You can locally override stack limit checking by using the
12938 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12940 @item -fsplit-stack
12941 @opindex fsplit-stack
12942 Generate code to automatically split the stack before it overflows.
12943 The resulting program has a discontiguous stack which can only
12944 overflow if the program is unable to allocate any more memory.  This
12945 is most useful when running threaded programs, as it is no longer
12946 necessary to calculate a good stack size to use for each thread.  This
12947 is currently only implemented for the x86 targets running
12948 GNU/Linux.
12950 When code compiled with @option{-fsplit-stack} calls code compiled
12951 without @option{-fsplit-stack}, there may not be much stack space
12952 available for the latter code to run.  If compiling all code,
12953 including library code, with @option{-fsplit-stack} is not an option,
12954 then the linker can fix up these calls so that the code compiled
12955 without @option{-fsplit-stack} always has a large stack.  Support for
12956 this is implemented in the gold linker in GNU binutils release 2.21
12957 and later.
12959 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12960 @opindex fvtable-verify
12961 This option is only available when compiling C++ code.
12962 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12963 feature that verifies at run time, for every virtual call, that
12964 the vtable pointer through which the call is made is valid for the type of
12965 the object, and has not been corrupted or overwritten.  If an invalid vtable
12966 pointer is detected at run time, an error is reported and execution of the
12967 program is immediately halted.
12969 This option causes run-time data structures to be built at program startup,
12970 which are used for verifying the vtable pointers.  
12971 The options @samp{std} and @samp{preinit}
12972 control the timing of when these data structures are built.  In both cases the
12973 data structures are built before execution reaches @code{main}.  Using
12974 @option{-fvtable-verify=std} causes the data structures to be built after
12975 shared libraries have been loaded and initialized.
12976 @option{-fvtable-verify=preinit} causes them to be built before shared
12977 libraries have been loaded and initialized.
12979 If this option appears multiple times in the command line with different
12980 values specified, @samp{none} takes highest priority over both @samp{std} and
12981 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12983 @item -fvtv-debug
12984 @opindex fvtv-debug
12985 When used in conjunction with @option{-fvtable-verify=std} or 
12986 @option{-fvtable-verify=preinit}, causes debug versions of the 
12987 runtime functions for the vtable verification feature to be called.  
12988 This flag also causes the compiler to log information about which 
12989 vtable pointers it finds for each class.
12990 This information is written to a file named @file{vtv_set_ptr_data.log} 
12991 in the directory named by the environment variable @env{VTV_LOGS_DIR} 
12992 if that is defined or the current working directory otherwise.
12994 Note:  This feature @emph{appends} data to the log file. If you want a fresh log
12995 file, be sure to delete any existing one.
12997 @item -fvtv-counts
12998 @opindex fvtv-counts
12999 This is a debugging flag.  When used in conjunction with
13000 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
13001 causes the compiler to keep track of the total number of virtual calls
13002 it encounters and the number of verifications it inserts.  It also
13003 counts the number of calls to certain run-time library functions
13004 that it inserts and logs this information for each compilation unit.
13005 The compiler writes this information to a file named
13006 @file{vtv_count_data.log} in the directory named by the environment
13007 variable @env{VTV_LOGS_DIR} if that is defined or the current working
13008 directory otherwise.  It also counts the size of the vtable pointer sets
13009 for each class, and writes this information to @file{vtv_class_set_sizes.log}
13010 in the same directory.
13012 Note:  This feature @emph{appends} data to the log files.  To get fresh log
13013 files, be sure to delete any existing ones.
13015 @item -finstrument-functions
13016 @opindex finstrument-functions
13017 Generate instrumentation calls for entry and exit to functions.  Just
13018 after function entry and just before function exit, the following
13019 profiling functions are called with the address of the current
13020 function and its call site.  (On some platforms,
13021 @code{__builtin_return_address} does not work beyond the current
13022 function, so the call site information may not be available to the
13023 profiling functions otherwise.)
13025 @smallexample
13026 void __cyg_profile_func_enter (void *this_fn,
13027                                void *call_site);
13028 void __cyg_profile_func_exit  (void *this_fn,
13029                                void *call_site);
13030 @end smallexample
13032 The first argument is the address of the start of the current function,
13033 which may be looked up exactly in the symbol table.
13035 This instrumentation is also done for functions expanded inline in other
13036 functions.  The profiling calls indicate where, conceptually, the
13037 inline function is entered and exited.  This means that addressable
13038 versions of such functions must be available.  If all your uses of a
13039 function are expanded inline, this may mean an additional expansion of
13040 code size.  If you use @code{extern inline} in your C code, an
13041 addressable version of such functions must be provided.  (This is
13042 normally the case anyway, but if you get lucky and the optimizer always
13043 expands the functions inline, you might have gotten away without
13044 providing static copies.)
13046 A function may be given the attribute @code{no_instrument_function}, in
13047 which case this instrumentation is not done.  This can be used, for
13048 example, for the profiling functions listed above, high-priority
13049 interrupt routines, and any functions from which the profiling functions
13050 cannot safely be called (perhaps signal handlers, if the profiling
13051 routines generate output or allocate memory).
13052 @xref{Common Function Attributes}.
13054 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13055 @opindex finstrument-functions-exclude-file-list
13057 Set the list of functions that are excluded from instrumentation (see
13058 the description of @option{-finstrument-functions}).  If the file that
13059 contains a function definition matches with one of @var{file}, then
13060 that function is not instrumented.  The match is done on substrings:
13061 if the @var{file} parameter is a substring of the file name, it is
13062 considered to be a match.
13064 For example:
13066 @smallexample
13067 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13068 @end smallexample
13070 @noindent
13071 excludes any inline function defined in files whose pathnames
13072 contain @file{/bits/stl} or @file{include/sys}.
13074 If, for some reason, you want to include letter @samp{,} in one of
13075 @var{sym}, write @samp{\,}. For example,
13076 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13077 (note the single quote surrounding the option).
13079 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13080 @opindex finstrument-functions-exclude-function-list
13082 This is similar to @option{-finstrument-functions-exclude-file-list},
13083 but this option sets the list of function names to be excluded from
13084 instrumentation.  The function name to be matched is its user-visible
13085 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13086 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
13087 match is done on substrings: if the @var{sym} parameter is a substring
13088 of the function name, it is considered to be a match.  For C99 and C++
13089 extended identifiers, the function name must be given in UTF-8, not
13090 using universal character names.
13092 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13093 @opindex fpatchable-function-entry
13094 Generate @var{N} NOPs right at the beginning
13095 of each function, with the function entry point before the @var{M}th NOP.
13096 If @var{M} is omitted, it defaults to @code{0} so the
13097 function entry points to the address just at the first NOP.
13098 The NOP instructions reserve extra space which can be used to patch in
13099 any desired instrumentation at run time, provided that the code segment
13100 is writable.  The amount of space is controllable indirectly via
13101 the number of NOPs; the NOP instruction used corresponds to the instruction
13102 emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
13103 is target-specific and may also depend on the architecture variant and/or
13104 other compilation options.
13106 For run-time identification, the starting addresses of these areas,
13107 which correspond to their respective function entries minus @var{M},
13108 are additionally collected in the @code{__patchable_function_entries}
13109 section of the resulting binary.
13111 Note that the value of @code{__attribute__ ((patchable_function_entry
13112 (N,M)))} takes precedence over command-line option
13113 @option{-fpatchable-function-entry=N,M}.  This can be used to increase
13114 the area size or to remove it completely on a single function.
13115 If @code{N=0}, no pad location is recorded.
13117 The NOP instructions are inserted at---and maybe before, depending on
13118 @var{M}---the function entry address, even before the prologue.
13120 @end table
13123 @node Preprocessor Options
13124 @section Options Controlling the Preprocessor
13125 @cindex preprocessor options
13126 @cindex options, preprocessor
13128 These options control the C preprocessor, which is run on each C source
13129 file before actual compilation.
13131 If you use the @option{-E} option, nothing is done except preprocessing.
13132 Some of these options make sense only together with @option{-E} because
13133 they cause the preprocessor output to be unsuitable for actual
13134 compilation.
13136 In addition to the options listed here, there are a number of options 
13137 to control search paths for include files documented in 
13138 @ref{Directory Options}.  
13139 Options to control preprocessor diagnostics are listed in 
13140 @ref{Warning Options}.
13142 @table @gcctabopt
13143 @include cppopts.texi
13145 @item -Wp,@var{option}
13146 @opindex Wp
13147 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13148 and pass @var{option} directly through to the preprocessor.  If
13149 @var{option} contains commas, it is split into multiple options at the
13150 commas.  However, many options are modified, translated or interpreted
13151 by the compiler driver before being passed to the preprocessor, and
13152 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
13153 interface is undocumented and subject to change, so whenever possible
13154 you should avoid using @option{-Wp} and let the driver handle the
13155 options instead.
13157 @item -Xpreprocessor @var{option}
13158 @opindex Xpreprocessor
13159 Pass @var{option} as an option to the preprocessor.  You can use this to
13160 supply system-specific preprocessor options that GCC does not 
13161 recognize.
13163 If you want to pass an option that takes an argument, you must use
13164 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13166 @item -no-integrated-cpp
13167 @opindex no-integrated-cpp
13168 Perform preprocessing as a separate pass before compilation.
13169 By default, GCC performs preprocessing as an integrated part of
13170 input tokenization and parsing.
13171 If this option is provided, the appropriate language front end
13172 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13173 and Objective-C, respectively) is instead invoked twice,
13174 once for preprocessing only and once for actual compilation
13175 of the preprocessed input.
13176 This option may be useful in conjunction with the @option{-B} or
13177 @option{-wrapper} options to specify an alternate preprocessor or
13178 perform additional processing of the program source between
13179 normal preprocessing and compilation.
13181 @end table
13183 @node Assembler Options
13184 @section Passing Options to the Assembler
13186 @c prevent bad page break with this line
13187 You can pass options to the assembler.
13189 @table @gcctabopt
13190 @item -Wa,@var{option}
13191 @opindex Wa
13192 Pass @var{option} as an option to the assembler.  If @var{option}
13193 contains commas, it is split into multiple options at the commas.
13195 @item -Xassembler @var{option}
13196 @opindex Xassembler
13197 Pass @var{option} as an option to the assembler.  You can use this to
13198 supply system-specific assembler options that GCC does not
13199 recognize.
13201 If you want to pass an option that takes an argument, you must use
13202 @option{-Xassembler} twice, once for the option and once for the argument.
13204 @end table
13206 @node Link Options
13207 @section Options for Linking
13208 @cindex link options
13209 @cindex options, linking
13211 These options come into play when the compiler links object files into
13212 an executable output file.  They are meaningless if the compiler is
13213 not doing a link step.
13215 @table @gcctabopt
13216 @cindex file names
13217 @item @var{object-file-name}
13218 A file name that does not end in a special recognized suffix is
13219 considered to name an object file or library.  (Object files are
13220 distinguished from libraries by the linker according to the file
13221 contents.)  If linking is done, these object files are used as input
13222 to the linker.
13224 @item -c
13225 @itemx -S
13226 @itemx -E
13227 @opindex c
13228 @opindex S
13229 @opindex E
13230 If any of these options is used, then the linker is not run, and
13231 object file names should not be used as arguments.  @xref{Overall
13232 Options}.
13234 @item -flinker-output=@var{type}
13235 @opindex flinker-output
13236 This option controls code generation of the link-time optimizer.  By
13237 default the linker output is automatically determined by the linker
13238 plugin.  For debugging the compiler and if incremental linking with a 
13239 non-LTO object file is desired, it may be useful to control the type
13240 manually.
13242 If @var{type} is @samp{exec}, code generation produces a static
13243 binary. In this case @option{-fpic} and @option{-fpie} are both
13244 disabled.
13246 If @var{type} is @samp{dyn}, code generation produces a shared
13247 library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
13248 but not enabled automatically.  This allows to build shared libraries
13249 without position-independent code on architectures where this is
13250 possible, i.e.@: on x86.
13252 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
13253 executable. This results in similar optimizations as @samp{exec}
13254 except that @option{-fpie} is not disabled if specified at compilation
13255 time.
13257 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
13258 done.  The sections containing intermediate code for link-time optimization are
13259 merged, pre-optimized, and output to the resulting object file. In addition, if
13260 @option{-ffat-lto-objects} is specified, binary code is produced for future
13261 non-LTO linking. The object file produced by incremental linking is smaller
13262 than a static library produced from the same object files.  At link time the
13263 result of incremental linking also loads faster than a static
13264 library assuming that the majority of objects in the library are used.
13266 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13267 code generation is forced, a final binary is produced, and the intermediate
13268 code for later link-time optimization is stripped. When multiple object files
13269 are linked together the resulting code is better optimized than with
13270 link-time optimizations disabled (for example, cross-module inlining 
13271 happens), but most of benefits of whole program optimizations are lost. 
13273 During the incremental link (by @option{-r}) the linker plugin defaults to
13274 @option{rel}. With current interfaces to GNU Binutils it is however not
13275 possible to incrementally link LTO objects and non-LTO objects into a single
13276 mixed object file.  If any of object files in incremental link cannot
13277 be used for link-time optimization, the linker plugin issues a warning and
13278 uses @samp{nolto-rel}. To maintain whole program optimization, it is
13279 recommended to link such objects into static library instead. Alternatively it
13280 is possible to use H.J. Lu's binutils with support for mixed objects.
13282 @item -fuse-ld=bfd
13283 @opindex fuse-ld=bfd
13284 Use the @command{bfd} linker instead of the default linker.
13286 @item -fuse-ld=gold
13287 @opindex fuse-ld=gold
13288 Use the @command{gold} linker instead of the default linker.
13290 @item -fuse-ld=lld
13291 @opindex fuse-ld=lld
13292 Use the LLVM @command{lld} linker instead of the default linker.
13294 @cindex Libraries
13295 @item -l@var{library}
13296 @itemx -l @var{library}
13297 @opindex l
13298 Search the library named @var{library} when linking.  (The second
13299 alternative with the library as a separate argument is only for
13300 POSIX compliance and is not recommended.)
13302 The @option{-l} option is passed directly to the linker by GCC.  Refer
13303 to your linker documentation for exact details.  The general
13304 description below applies to the GNU linker.  
13306 The linker searches a standard list of directories for the library.
13307 The directories searched include several standard system directories
13308 plus any that you specify with @option{-L}.
13310 Static libraries are archives of object files, and have file names
13311 like @file{lib@var{library}.a}.  Some targets also support shared
13312 libraries, which typically have names like @file{lib@var{library}.so}.
13313 If both static and shared libraries are found, the linker gives
13314 preference to linking with the shared library unless the
13315 @option{-static} option is used.
13317 It makes a difference where in the command you write this option; the
13318 linker searches and processes libraries and object files in the order they
13319 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13320 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
13321 to functions in @samp{z}, those functions may not be loaded.
13323 @item -lobjc
13324 @opindex lobjc
13325 You need this special case of the @option{-l} option in order to
13326 link an Objective-C or Objective-C++ program.
13328 @item -nostartfiles
13329 @opindex nostartfiles
13330 Do not use the standard system startup files when linking.
13331 The standard system libraries are used normally, unless @option{-nostdlib},
13332 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13334 @item -nodefaultlibs
13335 @opindex nodefaultlibs
13336 Do not use the standard system libraries when linking.
13337 Only the libraries you specify are passed to the linker, and options
13338 specifying linkage of the system libraries, such as @option{-static-libgcc}
13339 or @option{-shared-libgcc}, are ignored.  
13340 The standard startup files are used normally, unless @option{-nostartfiles}
13341 is used.  
13343 The compiler may generate calls to @code{memcmp},
13344 @code{memset}, @code{memcpy} and @code{memmove}.
13345 These entries are usually resolved by entries in
13346 libc.  These entry points should be supplied through some other
13347 mechanism when this option is specified.
13349 @item -nolibc
13350 @opindex nolibc
13351 Do not use the C library or system libraries tightly coupled with it when
13352 linking.  Still link with the startup files, @file{libgcc} or toolchain
13353 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13354 or @file{libstdc++} unless options preventing their inclusion are used as
13355 well.  This typically removes @option{-lc} from the link command line, as well
13356 as system libraries that normally go with it and become meaningless when
13357 absence of a C library is assumed, for example @option{-lpthread} or
13358 @option{-lm} in some configurations.  This is intended for bare-board
13359 targets when there is indeed no C library available.
13361 @item -nostdlib
13362 @opindex nostdlib
13363 Do not use the standard system startup files or libraries when linking.
13364 No startup files and only the libraries you specify are passed to
13365 the linker, and options specifying linkage of the system libraries, such as
13366 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13368 The compiler may generate calls to @code{memcmp}, @code{memset},
13369 @code{memcpy} and @code{memmove}.
13370 These entries are usually resolved by entries in
13371 libc.  These entry points should be supplied through some other
13372 mechanism when this option is specified.
13374 @cindex @option{-lgcc}, use with @option{-nostdlib}
13375 @cindex @option{-nostdlib} and unresolved references
13376 @cindex unresolved references and @option{-nostdlib}
13377 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13378 @cindex @option{-nodefaultlibs} and unresolved references
13379 @cindex unresolved references and @option{-nodefaultlibs}
13380 One of the standard libraries bypassed by @option{-nostdlib} and
13381 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13382 which GCC uses to overcome shortcomings of particular machines, or special
13383 needs for some languages.
13384 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13385 Collection (GCC) Internals},
13386 for more discussion of @file{libgcc.a}.)
13387 In most cases, you need @file{libgcc.a} even when you want to avoid
13388 other standard libraries.  In other words, when you specify @option{-nostdlib}
13389 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13390 This ensures that you have no unresolved references to internal GCC
13391 library subroutines.
13392 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13393 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13394 GNU Compiler Collection (GCC) Internals}.)
13396 @item -e @var{entry}
13397 @itemx --entry=@var{entry}
13398 @opindex e
13399 @opindex entry
13401 Specify that the program entry point is @var{entry}.  The argument is
13402 interpreted by the linker; the GNU linker accepts either a symbol name
13403 or an address.
13405 @item -pie
13406 @opindex pie
13407 Produce a dynamically linked position independent executable on targets
13408 that support it.  For predictable results, you must also specify the same
13409 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13410 or model suboptions) when you specify this linker option.
13412 @item -no-pie
13413 @opindex no-pie
13414 Don't produce a dynamically linked position independent executable.
13416 @item -static-pie
13417 @opindex static-pie
13418 Produce a static position independent executable on targets that support
13419 it.  A static position independent executable is similar to a static
13420 executable, but can be loaded at any address without a dynamic linker.
13421 For predictable results, you must also specify the same set of options
13422 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13423 suboptions) when you specify this linker option.
13425 @item -pthread
13426 @opindex pthread
13427 Link with the POSIX threads library.  This option is supported on 
13428 GNU/Linux targets, most other Unix derivatives, and also on 
13429 x86 Cygwin and MinGW targets.  On some targets this option also sets 
13430 flags for the preprocessor, so it should be used consistently for both
13431 compilation and linking.
13433 @item -r
13434 @opindex r
13435 Produce a relocatable object as output.  This is also known as partial
13436 linking.
13438 @item -rdynamic
13439 @opindex rdynamic
13440 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13441 that support it. This instructs the linker to add all symbols, not
13442 only used ones, to the dynamic symbol table. This option is needed
13443 for some uses of @code{dlopen} or to allow obtaining backtraces
13444 from within a program.
13446 @item -s
13447 @opindex s
13448 Remove all symbol table and relocation information from the executable.
13450 @item -static
13451 @opindex static
13452 On systems that support dynamic linking, this overrides @option{-pie}
13453 and prevents linking with the shared libraries.  On other systems, this
13454 option has no effect.
13456 @item -shared
13457 @opindex shared
13458 Produce a shared object which can then be linked with other objects to
13459 form an executable.  Not all systems support this option.  For predictable
13460 results, you must also specify the same set of options used for compilation
13461 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13462 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13463 needs to build supplementary stub code for constructors to work.  On
13464 multi-libbed systems, @samp{gcc -shared} must select the correct support
13465 libraries to link against.  Failing to supply the correct flags may lead
13466 to subtle defects.  Supplying them in cases where they are not necessary
13467 is innocuous.}
13469 @item -shared-libgcc
13470 @itemx -static-libgcc
13471 @opindex shared-libgcc
13472 @opindex static-libgcc
13473 On systems that provide @file{libgcc} as a shared library, these options
13474 force the use of either the shared or static version, respectively.
13475 If no shared version of @file{libgcc} was built when the compiler was
13476 configured, these options have no effect.
13478 There are several situations in which an application should use the
13479 shared @file{libgcc} instead of the static version.  The most common
13480 of these is when the application wishes to throw and catch exceptions
13481 across different shared libraries.  In that case, each of the libraries
13482 as well as the application itself should use the shared @file{libgcc}.
13484 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13485 whenever you build a shared library or a main executable, because C++
13486 programs typically use exceptions, so this is the right thing to do.
13488 If, instead, you use the GCC driver to create shared libraries, you may
13489 find that they are not always linked with the shared @file{libgcc}.
13490 If GCC finds, at its configuration time, that you have a non-GNU linker
13491 or a GNU linker that does not support option @option{--eh-frame-hdr},
13492 it links the shared version of @file{libgcc} into shared libraries
13493 by default.  Otherwise, it takes advantage of the linker and optimizes
13494 away the linking with the shared version of @file{libgcc}, linking with
13495 the static version of libgcc by default.  This allows exceptions to
13496 propagate through such shared libraries, without incurring relocation
13497 costs at library load time.
13499 However, if a library or main executable is supposed to throw or catch
13500 exceptions, you must link it using the G++ driver, or using the option
13501 @option{-shared-libgcc}, such that it is linked with the shared
13502 @file{libgcc}.
13504 @item -static-libasan
13505 @opindex static-libasan
13506 When the @option{-fsanitize=address} option is used to link a program,
13507 the GCC driver automatically links against @option{libasan}.  If
13508 @file{libasan} is available as a shared library, and the @option{-static}
13509 option is not used, then this links against the shared version of
13510 @file{libasan}.  The @option{-static-libasan} option directs the GCC
13511 driver to link @file{libasan} statically, without necessarily linking
13512 other libraries statically.
13514 @item -static-libtsan
13515 @opindex static-libtsan
13516 When the @option{-fsanitize=thread} option is used to link a program,
13517 the GCC driver automatically links against @option{libtsan}.  If
13518 @file{libtsan} is available as a shared library, and the @option{-static}
13519 option is not used, then this links against the shared version of
13520 @file{libtsan}.  The @option{-static-libtsan} option directs the GCC
13521 driver to link @file{libtsan} statically, without necessarily linking
13522 other libraries statically.
13524 @item -static-liblsan
13525 @opindex static-liblsan
13526 When the @option{-fsanitize=leak} option is used to link a program,
13527 the GCC driver automatically links against @option{liblsan}.  If
13528 @file{liblsan} is available as a shared library, and the @option{-static}
13529 option is not used, then this links against the shared version of
13530 @file{liblsan}.  The @option{-static-liblsan} option directs the GCC
13531 driver to link @file{liblsan} statically, without necessarily linking
13532 other libraries statically.
13534 @item -static-libubsan
13535 @opindex static-libubsan
13536 When the @option{-fsanitize=undefined} option is used to link a program,
13537 the GCC driver automatically links against @option{libubsan}.  If
13538 @file{libubsan} is available as a shared library, and the @option{-static}
13539 option is not used, then this links against the shared version of
13540 @file{libubsan}.  The @option{-static-libubsan} option directs the GCC
13541 driver to link @file{libubsan} statically, without necessarily linking
13542 other libraries statically.
13544 @item -static-libstdc++
13545 @opindex static-libstdc++
13546 When the @command{g++} program is used to link a C++ program, it
13547 normally automatically links against @option{libstdc++}.  If
13548 @file{libstdc++} is available as a shared library, and the
13549 @option{-static} option is not used, then this links against the
13550 shared version of @file{libstdc++}.  That is normally fine.  However, it
13551 is sometimes useful to freeze the version of @file{libstdc++} used by
13552 the program without going all the way to a fully static link.  The
13553 @option{-static-libstdc++} option directs the @command{g++} driver to
13554 link @file{libstdc++} statically, without necessarily linking other
13555 libraries statically.
13557 @item -symbolic
13558 @opindex symbolic
13559 Bind references to global symbols when building a shared object.  Warn
13560 about any unresolved references (unless overridden by the link editor
13561 option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
13562 this option.
13564 @item -T @var{script}
13565 @opindex T
13566 @cindex linker script
13567 Use @var{script} as the linker script.  This option is supported by most
13568 systems using the GNU linker.  On some targets, such as bare-board
13569 targets without an operating system, the @option{-T} option may be required
13570 when linking to avoid references to undefined symbols.
13572 @item -Xlinker @var{option}
13573 @opindex Xlinker
13574 Pass @var{option} as an option to the linker.  You can use this to
13575 supply system-specific linker options that GCC does not recognize.
13577 If you want to pass an option that takes a separate argument, you must use
13578 @option{-Xlinker} twice, once for the option and once for the argument.
13579 For example, to pass @option{-assert definitions}, you must write
13580 @option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
13581 @option{-Xlinker "-assert definitions"}, because this passes the entire
13582 string as a single argument, which is not what the linker expects.
13584 When using the GNU linker, it is usually more convenient to pass
13585 arguments to linker options using the @option{@var{option}=@var{value}}
13586 syntax than as separate arguments.  For example, you can specify
13587 @option{-Xlinker -Map=output.map} rather than
13588 @option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
13589 this syntax for command-line options.
13591 @item -Wl,@var{option}
13592 @opindex Wl
13593 Pass @var{option} as an option to the linker.  If @var{option} contains
13594 commas, it is split into multiple options at the commas.  You can use this
13595 syntax to pass an argument to the option.
13596 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13597 linker.  When using the GNU linker, you can also get the same effect with
13598 @option{-Wl,-Map=output.map}.
13600 @item -u @var{symbol}
13601 @opindex u
13602 Pretend the symbol @var{symbol} is undefined, to force linking of
13603 library modules to define it.  You can use @option{-u} multiple times with
13604 different symbols to force loading of additional library modules.
13606 @item -z @var{keyword}
13607 @opindex z
13608 @option{-z} is passed directly on to the linker along with the keyword
13609 @var{keyword}. See the section in the documentation of your linker for
13610 permitted values and their meanings.
13611 @end table
13613 @node Directory Options
13614 @section Options for Directory Search
13615 @cindex directory options
13616 @cindex options, directory search
13617 @cindex search path
13619 These options specify directories to search for header files, for
13620 libraries and for parts of the compiler:
13622 @table @gcctabopt
13623 @include cppdiropts.texi
13625 @item -iplugindir=@var{dir}
13626 @opindex iplugindir=
13627 Set the directory to search for plugins that are passed
13628 by @option{-fplugin=@var{name}} instead of
13629 @option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
13630 to be used by the user, but only passed by the driver.
13632 @item -L@var{dir}
13633 @opindex L
13634 Add directory @var{dir} to the list of directories to be searched
13635 for @option{-l}.
13637 @item -B@var{prefix}
13638 @opindex B
13639 This option specifies where to find the executables, libraries,
13640 include files, and data files of the compiler itself.
13642 The compiler driver program runs one or more of the subprograms
13643 @command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
13644 @var{prefix} as a prefix for each program it tries to run, both with and
13645 without @samp{@var{machine}/@var{version}/} for the corresponding target
13646 machine and compiler version.
13648 For each subprogram to be run, the compiler driver first tries the
13649 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
13650 is not specified, the driver tries two standard prefixes, 
13651 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
13652 those results in a file name that is found, the unmodified program
13653 name is searched for using the directories specified in your
13654 @env{PATH} environment variable.
13656 The compiler checks to see if the path provided by @option{-B}
13657 refers to a directory, and if necessary it adds a directory
13658 separator character at the end of the path.
13660 @option{-B} prefixes that effectively specify directory names also apply
13661 to libraries in the linker, because the compiler translates these
13662 options into @option{-L} options for the linker.  They also apply to
13663 include files in the preprocessor, because the compiler translates these
13664 options into @option{-isystem} options for the preprocessor.  In this case,
13665 the compiler appends @samp{include} to the prefix.
13667 The runtime support file @file{libgcc.a} can also be searched for using
13668 the @option{-B} prefix, if needed.  If it is not found there, the two
13669 standard prefixes above are tried, and that is all.  The file is left
13670 out of the link if it is not found by those means.
13672 Another way to specify a prefix much like the @option{-B} prefix is to use
13673 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
13674 Variables}.
13676 As a special kludge, if the path provided by @option{-B} is
13677 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13678 9, then it is replaced by @file{[dir/]include}.  This is to help
13679 with boot-strapping the compiler.
13681 @item -no-canonical-prefixes
13682 @opindex no-canonical-prefixes
13683 Do not expand any symbolic links, resolve references to @samp{/../}
13684 or @samp{/./}, or make the path absolute when generating a relative
13685 prefix.
13687 @item --sysroot=@var{dir}
13688 @opindex sysroot
13689 Use @var{dir} as the logical root directory for headers and libraries.
13690 For example, if the compiler normally searches for headers in
13691 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13692 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13694 If you use both this option and the @option{-isysroot} option, then
13695 the @option{--sysroot} option applies to libraries, but the
13696 @option{-isysroot} option applies to header files.
13698 The GNU linker (beginning with version 2.16) has the necessary support
13699 for this option.  If your linker does not support this option, the
13700 header file aspect of @option{--sysroot} still works, but the
13701 library aspect does not.
13703 @item --no-sysroot-suffix
13704 @opindex no-sysroot-suffix
13705 For some targets, a suffix is added to the root directory specified
13706 with @option{--sysroot}, depending on the other options used, so that
13707 headers may for example be found in
13708 @file{@var{dir}/@var{suffix}/usr/include} instead of
13709 @file{@var{dir}/usr/include}.  This option disables the addition of
13710 such a suffix.
13712 @end table
13714 @node Code Gen Options
13715 @section Options for Code Generation Conventions
13716 @cindex code generation conventions
13717 @cindex options, code generation
13718 @cindex run-time options
13720 These machine-independent options control the interface conventions
13721 used in code generation.
13723 Most of them have both positive and negative forms; the negative form
13724 of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
13725 one of the forms is listed---the one that is not the default.  You
13726 can figure out the other form by either removing @samp{no-} or adding
13729 @table @gcctabopt
13730 @item -fstack-reuse=@var{reuse-level}
13731 @opindex fstack_reuse
13732 This option controls stack space reuse for user declared local/auto variables
13733 and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
13734 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13735 local variables and temporaries, @samp{named_vars} enables the reuse only for
13736 user defined local variables with names, and @samp{none} disables stack reuse
13737 completely. The default value is @samp{all}. The option is needed when the
13738 program extends the lifetime of a scoped local variable or a compiler generated
13739 temporary beyond the end point defined by the language.  When a lifetime of
13740 a variable ends, and if the variable lives in memory, the optimizing compiler
13741 has the freedom to reuse its stack space with other temporaries or scoped
13742 local variables whose live range does not overlap with it. Legacy code extending
13743 local lifetime is likely to break with the stack reuse optimization.
13745 For example,
13747 @smallexample
13748    int *p;
13749    @{
13750      int local1;
13752      p = &local1;
13753      local1 = 10;
13754      ....
13755    @}
13756    @{
13757       int local2;
13758       local2 = 20;
13759       ...
13760    @}
13762    if (*p == 10)  // out of scope use of local1
13763      @{
13765      @}
13766 @end smallexample
13768 Another example:
13769 @smallexample
13771    struct A
13772    @{
13773        A(int k) : i(k), j(k) @{ @}
13774        int i;
13775        int j;
13776    @};
13778    A *ap;
13780    void foo(const A& ar)
13781    @{
13782       ap = &ar;
13783    @}
13785    void bar()
13786    @{
13787       foo(A(10)); // temp object's lifetime ends when foo returns
13789       @{
13790         A a(20);
13791         ....
13792       @}
13793       ap->i+= 10;  // ap references out of scope temp whose space
13794                    // is reused with a. What is the value of ap->i?
13795    @}
13797 @end smallexample
13799 The lifetime of a compiler generated temporary is well defined by the C++
13800 standard. When a lifetime of a temporary ends, and if the temporary lives
13801 in memory, the optimizing compiler has the freedom to reuse its stack
13802 space with other temporaries or scoped local variables whose live range
13803 does not overlap with it. However some of the legacy code relies on
13804 the behavior of older compilers in which temporaries' stack space is
13805 not reused, the aggressive stack reuse can lead to runtime errors. This
13806 option is used to control the temporary stack reuse optimization.
13808 @item -ftrapv
13809 @opindex ftrapv
13810 This option generates traps for signed overflow on addition, subtraction,
13811 multiplication operations.
13812 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13813 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13814 @option{-fwrapv} being effective.  Note that only active options override, so
13815 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13816 results in @option{-ftrapv} being effective.
13818 @item -fwrapv
13819 @opindex fwrapv
13820 This option instructs the compiler to assume that signed arithmetic
13821 overflow of addition, subtraction and multiplication wraps around
13822 using twos-complement representation.  This flag enables some optimizations
13823 and disables others.
13824 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13825 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13826 @option{-fwrapv} being effective.  Note that only active options override, so
13827 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13828 results in @option{-ftrapv} being effective.
13830 @item -fwrapv-pointer
13831 @opindex fwrapv-pointer
13832 This option instructs the compiler to assume that pointer arithmetic
13833 overflow on addition and subtraction wraps around using twos-complement
13834 representation.  This flag disables some optimizations which assume
13835 pointer overflow is invalid.
13837 @item -fstrict-overflow
13838 @opindex fstrict-overflow
13839 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13840 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13842 @item -fexceptions
13843 @opindex fexceptions
13844 Enable exception handling.  Generates extra code needed to propagate
13845 exceptions.  For some targets, this implies GCC generates frame
13846 unwind information for all functions, which can produce significant data
13847 size overhead, although it does not affect execution.  If you do not
13848 specify this option, GCC enables it by default for languages like
13849 C++ that normally require exception handling, and disables it for
13850 languages like C that do not normally require it.  However, you may need
13851 to enable this option when compiling C code that needs to interoperate
13852 properly with exception handlers written in C++.  You may also wish to
13853 disable this option if you are compiling older C++ programs that don't
13854 use exception handling.
13856 @item -fnon-call-exceptions
13857 @opindex fnon-call-exceptions
13858 Generate code that allows trapping instructions to throw exceptions.
13859 Note that this requires platform-specific runtime support that does
13860 not exist everywhere.  Moreover, it only allows @emph{trapping}
13861 instructions to throw exceptions, i.e.@: memory references or floating-point
13862 instructions.  It does not allow exceptions to be thrown from
13863 arbitrary signal handlers such as @code{SIGALRM}.
13865 @item -fdelete-dead-exceptions
13866 @opindex fdelete-dead-exceptions
13867 Consider that instructions that may throw exceptions but don't otherwise
13868 contribute to the execution of the program can be optimized away.
13869 This option is enabled by default for the Ada front end, as permitted by
13870 the Ada language specification.
13871 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13873 @item -funwind-tables
13874 @opindex funwind-tables
13875 Similar to @option{-fexceptions}, except that it just generates any needed
13876 static data, but does not affect the generated code in any other way.
13877 You normally do not need to enable this option; instead, a language processor
13878 that needs this handling enables it on your behalf.
13880 @item -fasynchronous-unwind-tables
13881 @opindex fasynchronous-unwind-tables
13882 Generate unwind table in DWARF format, if supported by target machine.  The
13883 table is exact at each instruction boundary, so it can be used for stack
13884 unwinding from asynchronous events (such as debugger or garbage collector).
13886 @item -fno-gnu-unique
13887 @opindex fno-gnu-unique
13888 @opindex fgnu-unique
13889 On systems with recent GNU assembler and C library, the C++ compiler
13890 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13891 of template static data members and static local variables in inline
13892 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13893 is necessary to avoid problems with a library used by two different
13894 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13895 therefore disagreeing with the other one about the binding of the
13896 symbol.  But this causes @code{dlclose} to be ignored for affected
13897 DSOs; if your program relies on reinitialization of a DSO via
13898 @code{dlclose} and @code{dlopen}, you can use
13899 @option{-fno-gnu-unique}.
13901 @item -fpcc-struct-return
13902 @opindex fpcc-struct-return
13903 Return ``short'' @code{struct} and @code{union} values in memory like
13904 longer ones, rather than in registers.  This convention is less
13905 efficient, but it has the advantage of allowing intercallability between
13906 GCC-compiled files and files compiled with other compilers, particularly
13907 the Portable C Compiler (pcc).
13909 The precise convention for returning structures in memory depends
13910 on the target configuration macros.
13912 Short structures and unions are those whose size and alignment match
13913 that of some integer type.
13915 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13916 switch is not binary compatible with code compiled with the
13917 @option{-freg-struct-return} switch.
13918 Use it to conform to a non-default application binary interface.
13920 @item -freg-struct-return
13921 @opindex freg-struct-return
13922 Return @code{struct} and @code{union} values in registers when possible.
13923 This is more efficient for small structures than
13924 @option{-fpcc-struct-return}.
13926 If you specify neither @option{-fpcc-struct-return} nor
13927 @option{-freg-struct-return}, GCC defaults to whichever convention is
13928 standard for the target.  If there is no standard convention, GCC
13929 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13930 the principal compiler.  In those cases, we can choose the standard, and
13931 we chose the more efficient register return alternative.
13933 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13934 switch is not binary compatible with code compiled with the
13935 @option{-fpcc-struct-return} switch.
13936 Use it to conform to a non-default application binary interface.
13938 @item -fshort-enums
13939 @opindex fshort-enums
13940 Allocate to an @code{enum} type only as many bytes as it needs for the
13941 declared range of possible values.  Specifically, the @code{enum} type
13942 is equivalent to the smallest integer type that has enough room.
13944 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13945 code that is not binary compatible with code generated without that switch.
13946 Use it to conform to a non-default application binary interface.
13948 @item -fshort-wchar
13949 @opindex fshort-wchar
13950 Override the underlying type for @code{wchar_t} to be @code{short
13951 unsigned int} instead of the default for the target.  This option is
13952 useful for building programs to run under WINE@.
13954 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13955 code that is not binary compatible with code generated without that switch.
13956 Use it to conform to a non-default application binary interface.
13958 @item -fno-common
13959 @opindex fno-common
13960 @opindex fcommon
13961 @cindex tentative definitions
13962 In C code, this option controls the placement of global variables 
13963 defined without an initializer, known as @dfn{tentative definitions} 
13964 in the C standard.  Tentative definitions are distinct from declarations 
13965 of a variable with the @code{extern} keyword, which do not allocate storage.
13967 Unix C compilers have traditionally allocated storage for
13968 uninitialized global variables in a common block.  This allows the
13969 linker to resolve all tentative definitions of the same variable
13970 in different compilation units to the same object, or to a non-tentative
13971 definition.  
13972 This is the behavior specified by @option{-fcommon}, and is the default for 
13973 GCC on most targets.  
13974 On the other hand, this behavior is not required by ISO
13975 C, and on some targets may carry a speed or code size penalty on
13976 variable references.
13978 The @option{-fno-common} option specifies that the compiler should instead
13979 place uninitialized global variables in the BSS section of the object file.
13980 This inhibits the merging of tentative definitions by the linker so
13981 you get a multiple-definition error if the same 
13982 variable is defined in more than one compilation unit.
13983 Compiling with @option{-fno-common} is useful on targets for which
13984 it provides better performance, or if you wish to verify that the
13985 program will work on other systems that always treat uninitialized
13986 variable definitions this way.
13988 @item -fno-ident
13989 @opindex fno-ident
13990 @opindex fident
13991 Ignore the @code{#ident} directive.
13993 @item -finhibit-size-directive
13994 @opindex finhibit-size-directive
13995 Don't output a @code{.size} assembler directive, or anything else that
13996 would cause trouble if the function is split in the middle, and the
13997 two halves are placed at locations far apart in memory.  This option is
13998 used when compiling @file{crtstuff.c}; you should not need to use it
13999 for anything else.
14001 @item -fverbose-asm
14002 @opindex fverbose-asm
14003 Put extra commentary information in the generated assembly code to
14004 make it more readable.  This option is generally only of use to those
14005 who actually need to read the generated assembly code (perhaps while
14006 debugging the compiler itself).
14008 @option{-fno-verbose-asm}, the default, causes the
14009 extra information to be omitted and is useful when comparing two assembler
14010 files.
14012 The added comments include:
14014 @itemize @bullet
14016 @item
14017 information on the compiler version and command-line options,
14019 @item
14020 the source code lines associated with the assembly instructions,
14021 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14023 @item
14024 hints on which high-level expressions correspond to
14025 the various assembly instruction operands.
14027 @end itemize
14029 For example, given this C source file:
14031 @smallexample
14032 int test (int n)
14034   int i;
14035   int total = 0;
14037   for (i = 0; i < n; i++)
14038     total += i * i;
14040   return total;
14042 @end smallexample
14044 compiling to (x86_64) assembly via @option{-S} and emitting the result
14045 direct to stdout via @option{-o} @option{-}
14047 @smallexample
14048 gcc -S test.c -fverbose-asm -Os -o -
14049 @end smallexample
14051 gives output similar to this:
14053 @smallexample
14054         .file   "test.c"
14055 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14056   [...snip...]
14057 # options passed:
14058   [...snip...]
14060         .text
14061         .globl  test
14062         .type   test, @@function
14063 test:
14064 .LFB0:
14065         .cfi_startproc
14066 # test.c:4:   int total = 0;
14067         xorl    %eax, %eax      # <retval>
14068 # test.c:6:   for (i = 0; i < n; i++)
14069         xorl    %edx, %edx      # i
14070 .L2:
14071 # test.c:6:   for (i = 0; i < n; i++)
14072         cmpl    %edi, %edx      # n, i
14073         jge     .L5     #,
14074 # test.c:7:     total += i * i;
14075         movl    %edx, %ecx      # i, tmp92
14076         imull   %edx, %ecx      # i, tmp92
14077 # test.c:6:   for (i = 0; i < n; i++)
14078         incl    %edx    # i
14079 # test.c:7:     total += i * i;
14080         addl    %ecx, %eax      # tmp92, <retval>
14081         jmp     .L2     #
14082 .L5:
14083 # test.c:10: @}
14084         ret
14085         .cfi_endproc
14086 .LFE0:
14087         .size   test, .-test
14088         .ident  "GCC: (GNU) 7.0.0 20160809 (experimental)"
14089         .section        .note.GNU-stack,"",@@progbits
14090 @end smallexample
14092 The comments are intended for humans rather than machines and hence the
14093 precise format of the comments is subject to change.
14095 @item -frecord-gcc-switches
14096 @opindex frecord-gcc-switches
14097 This switch causes the command line used to invoke the
14098 compiler to be recorded into the object file that is being created.
14099 This switch is only implemented on some targets and the exact format
14100 of the recording is target and binary file format dependent, but it
14101 usually takes the form of a section containing ASCII text.  This
14102 switch is related to the @option{-fverbose-asm} switch, but that
14103 switch only records information in the assembler output file as
14104 comments, so it never reaches the object file.
14105 See also @option{-grecord-gcc-switches} for another
14106 way of storing compiler options into the object file.
14108 @item -fpic
14109 @opindex fpic
14110 @cindex global offset table
14111 @cindex PIC
14112 Generate position-independent code (PIC) suitable for use in a shared
14113 library, if supported for the target machine.  Such code accesses all
14114 constant addresses through a global offset table (GOT)@.  The dynamic
14115 loader resolves the GOT entries when the program starts (the dynamic
14116 loader is not part of GCC; it is part of the operating system).  If
14117 the GOT size for the linked executable exceeds a machine-specific
14118 maximum size, you get an error message from the linker indicating that
14119 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14120 instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14121 on the m68k and RS/6000.  The x86 has no such limit.)
14123 Position-independent code requires special support, and therefore works
14124 only on certain machines.  For the x86, GCC supports PIC for System V
14125 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
14126 position-independent.
14128 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14129 are defined to 1.
14131 @item -fPIC
14132 @opindex fPIC
14133 If supported for the target machine, emit position-independent code,
14134 suitable for dynamic linking and avoiding any limit on the size of the
14135 global offset table.  This option makes a difference on AArch64, m68k,
14136 PowerPC and SPARC@.
14138 Position-independent code requires special support, and therefore works
14139 only on certain machines.
14141 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14142 are defined to 2.
14144 @item -fpie
14145 @itemx -fPIE
14146 @opindex fpie
14147 @opindex fPIE
14148 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14149 generated position-independent code can be only linked into executables.
14150 Usually these options are used to compile code that will be linked using
14151 the @option{-pie} GCC option.
14153 @option{-fpie} and @option{-fPIE} both define the macros
14154 @code{__pie__} and @code{__PIE__}.  The macros have the value 1
14155 for @option{-fpie} and 2 for @option{-fPIE}.
14157 @item -fno-plt
14158 @opindex fno-plt
14159 @opindex fplt
14160 Do not use the PLT for external function calls in position-independent code.
14161 Instead, load the callee address at call sites from the GOT and branch to it.
14162 This leads to more efficient code by eliminating PLT stubs and exposing
14163 GOT loads to optimizations.  On architectures such as 32-bit x86 where
14164 PLT stubs expect the GOT pointer in a specific register, this gives more
14165 register allocation freedom to the compiler.
14166 Lazy binding requires use of the PLT; 
14167 with @option{-fno-plt} all external symbols are resolved at load time.
14169 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14170 through the PLT for specific external functions.
14172 In position-dependent code, a few targets also convert calls to
14173 functions that are marked to not use the PLT to use the GOT instead.
14175 @item -fno-jump-tables
14176 @opindex fno-jump-tables
14177 @opindex fjump-tables
14178 Do not use jump tables for switch statements even where it would be
14179 more efficient than other code generation strategies.  This option is
14180 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14181 building code that forms part of a dynamic linker and cannot
14182 reference the address of a jump table.  On some targets, jump tables
14183 do not require a GOT and this option is not needed.
14185 @item -ffixed-@var{reg}
14186 @opindex ffixed
14187 Treat the register named @var{reg} as a fixed register; generated code
14188 should never refer to it (except perhaps as a stack pointer, frame
14189 pointer or in some other fixed role).
14191 @var{reg} must be the name of a register.  The register names accepted
14192 are machine-specific and are defined in the @code{REGISTER_NAMES}
14193 macro in the machine description macro file.
14195 This flag does not have a negative form, because it specifies a
14196 three-way choice.
14198 @item -fcall-used-@var{reg}
14199 @opindex fcall-used
14200 Treat the register named @var{reg} as an allocable register that is
14201 clobbered by function calls.  It may be allocated for temporaries or
14202 variables that do not live across a call.  Functions compiled this way
14203 do not save and restore the register @var{reg}.
14205 It is an error to use this flag with the frame pointer or stack pointer.
14206 Use of this flag for other registers that have fixed pervasive roles in
14207 the machine's execution model produces disastrous results.
14209 This flag does not have a negative form, because it specifies a
14210 three-way choice.
14212 @item -fcall-saved-@var{reg}
14213 @opindex fcall-saved
14214 Treat the register named @var{reg} as an allocable register saved by
14215 functions.  It may be allocated even for temporaries or variables that
14216 live across a call.  Functions compiled this way save and restore
14217 the register @var{reg} if they use it.
14219 It is an error to use this flag with the frame pointer or stack pointer.
14220 Use of this flag for other registers that have fixed pervasive roles in
14221 the machine's execution model produces disastrous results.
14223 A different sort of disaster results from the use of this flag for
14224 a register in which function values may be returned.
14226 This flag does not have a negative form, because it specifies a
14227 three-way choice.
14229 @item -fpack-struct[=@var{n}]
14230 @opindex fpack-struct
14231 Without a value specified, pack all structure members together without
14232 holes.  When a value is specified (which must be a small power of two), pack
14233 structure members according to this value, representing the maximum
14234 alignment (that is, objects with default alignment requirements larger than
14235 this are output potentially unaligned at the next fitting location.
14237 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14238 code that is not binary compatible with code generated without that switch.
14239 Additionally, it makes the code suboptimal.
14240 Use it to conform to a non-default application binary interface.
14242 @item -fleading-underscore
14243 @opindex fleading-underscore
14244 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14245 change the way C symbols are represented in the object file.  One use
14246 is to help link with legacy assembly code.
14248 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14249 generate code that is not binary compatible with code generated without that
14250 switch.  Use it to conform to a non-default application binary interface.
14251 Not all targets provide complete support for this switch.
14253 @item -ftls-model=@var{model}
14254 @opindex ftls-model
14255 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14256 The @var{model} argument should be one of @samp{global-dynamic},
14257 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14258 Note that the choice is subject to optimization: the compiler may use
14259 a more efficient model for symbols not visible outside of the translation
14260 unit, or if @option{-fpic} is not given on the command line.
14262 The default without @option{-fpic} is @samp{initial-exec}; with
14263 @option{-fpic} the default is @samp{global-dynamic}.
14265 @item -ftrampolines
14266 @opindex ftrampolines
14267 For targets that normally need trampolines for nested functions, always
14268 generate them instead of using descriptors.  Otherwise, for targets that
14269 do not need them, like for example HP-PA or IA-64, do nothing.
14271 A trampoline is a small piece of code that is created at run time on the
14272 stack when the address of a nested function is taken, and is used to call
14273 the nested function indirectly.  Therefore, it requires the stack to be
14274 made executable in order for the program to work properly.
14276 @option{-fno-trampolines} is enabled by default on a language by language
14277 basis to let the compiler avoid generating them, if it computes that this
14278 is safe, and replace them with descriptors.  Descriptors are made up of data
14279 only, but the generated code must be prepared to deal with them.  As of this
14280 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14282 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14283 @option{-fno-trampolines} are not binary compatible if nested functions are
14284 present.  This option must therefore be used on a program-wide basis and be
14285 manipulated with extreme care.
14287 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14288 @opindex fvisibility
14289 Set the default ELF image symbol visibility to the specified option---all
14290 symbols are marked with this unless overridden within the code.
14291 Using this feature can very substantially improve linking and
14292 load times of shared object libraries, produce more optimized
14293 code, provide near-perfect API export and prevent symbol clashes.
14294 It is @strong{strongly} recommended that you use this in any shared objects
14295 you distribute.
14297 Despite the nomenclature, @samp{default} always means public; i.e.,
14298 available to be linked against from outside the shared object.
14299 @samp{protected} and @samp{internal} are pretty useless in real-world
14300 usage so the only other commonly used option is @samp{hidden}.
14301 The default if @option{-fvisibility} isn't specified is
14302 @samp{default}, i.e., make every symbol public.
14304 A good explanation of the benefits offered by ensuring ELF
14305 symbols have the correct visibility is given by ``How To Write
14306 Shared Libraries'' by Ulrich Drepper (which can be found at
14307 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14308 solution made possible by this option to marking things hidden when
14309 the default is public is to make the default hidden and mark things
14310 public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14311 and @code{__attribute__ ((visibility("default")))} instead of
14312 @code{__declspec(dllexport)} you get almost identical semantics with
14313 identical syntax.  This is a great boon to those working with
14314 cross-platform projects.
14316 For those adding visibility support to existing code, you may find
14317 @code{#pragma GCC visibility} of use.  This works by you enclosing
14318 the declarations you wish to set visibility for with (for example)
14319 @code{#pragma GCC visibility push(hidden)} and
14320 @code{#pragma GCC visibility pop}.
14321 Bear in mind that symbol visibility should be viewed @strong{as
14322 part of the API interface contract} and thus all new code should
14323 always specify visibility when it is not the default; i.e., declarations
14324 only for use within the local DSO should @strong{always} be marked explicitly
14325 as hidden as so to avoid PLT indirection overheads---making this
14326 abundantly clear also aids readability and self-documentation of the code.
14327 Note that due to ISO C++ specification requirements, @code{operator new} and
14328 @code{operator delete} must always be of default visibility.
14330 Be aware that headers from outside your project, in particular system
14331 headers and headers from any other library you use, may not be
14332 expecting to be compiled with visibility other than the default.  You
14333 may need to explicitly say @code{#pragma GCC visibility push(default)}
14334 before including any such headers.
14336 @code{extern} declarations are not affected by @option{-fvisibility}, so
14337 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14338 no modifications.  However, this means that calls to @code{extern}
14339 functions with no explicit visibility use the PLT, so it is more
14340 effective to use @code{__attribute ((visibility))} and/or
14341 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14342 declarations should be treated as hidden.
14344 Note that @option{-fvisibility} does affect C++ vague linkage
14345 entities. This means that, for instance, an exception class that is
14346 be thrown between DSOs must be explicitly marked with default
14347 visibility so that the @samp{type_info} nodes are unified between
14348 the DSOs.
14350 An overview of these techniques, their benefits and how to use them
14351 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14353 @item -fstrict-volatile-bitfields
14354 @opindex fstrict-volatile-bitfields
14355 This option should be used if accesses to volatile bit-fields (or other
14356 structure fields, although the compiler usually honors those types
14357 anyway) should use a single access of the width of the
14358 field's type, aligned to a natural alignment if possible.  For
14359 example, targets with memory-mapped peripheral registers might require
14360 all such accesses to be 16 bits wide; with this flag you can
14361 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14362 is 16 bits on these targets) to force GCC to use 16-bit accesses
14363 instead of, perhaps, a more efficient 32-bit access.
14365 If this option is disabled, the compiler uses the most efficient
14366 instruction.  In the previous example, that might be a 32-bit load
14367 instruction, even though that accesses bytes that do not contain
14368 any portion of the bit-field, or memory-mapped registers unrelated to
14369 the one being updated.
14371 In some cases, such as when the @code{packed} attribute is applied to a 
14372 structure field, it may not be possible to access the field with a single
14373 read or write that is correctly aligned for the target machine.  In this
14374 case GCC falls back to generating multiple accesses rather than code that 
14375 will fault or truncate the result at run time.
14377 Note:  Due to restrictions of the C/C++11 memory model, write accesses are
14378 not allowed to touch non bit-field members.  It is therefore recommended
14379 to define all bits of the field's type as bit-field members.
14381 The default value of this option is determined by the application binary
14382 interface for the target processor.
14384 @item -fsync-libcalls
14385 @opindex fsync-libcalls
14386 This option controls whether any out-of-line instance of the @code{__sync}
14387 family of functions may be used to implement the C++11 @code{__atomic}
14388 family of functions.
14390 The default value of this option is enabled, thus the only useful form
14391 of the option is @option{-fno-sync-libcalls}.  This option is used in
14392 the implementation of the @file{libatomic} runtime library.
14394 @end table
14396 @node Developer Options
14397 @section GCC Developer Options
14398 @cindex developer options
14399 @cindex debugging GCC
14400 @cindex debug dump options
14401 @cindex dump options
14402 @cindex compilation statistics
14404 This section describes command-line options that are primarily of
14405 interest to GCC developers, including options to support compiler
14406 testing and investigation of compiler bugs and compile-time
14407 performance problems.  This includes options that produce debug dumps
14408 at various points in the compilation; that print statistics such as
14409 memory use and execution time; and that print information about GCC's
14410 configuration, such as where it searches for libraries.  You should
14411 rarely need to use any of these options for ordinary compilation and
14412 linking tasks.
14414 Many developer options that cause GCC to dump output to a file take an
14415 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14416 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14417 error.
14419 If @samp{=@var{filename}} is omitted, a default dump file name is
14420 constructed by concatenating the base dump file name, a pass number,
14421 phase letter, and pass name.  The base dump file name is the name of
14422 output file produced by the compiler if explicitly specified and not
14423 an executable; otherwise it is the source file name.
14424 The pass number is determined by the order passes are registered with
14425 the compiler's pass manager. 
14426 This is generally the same as the order of execution, but passes
14427 registered by plugins, target-specific passes, or passes that are
14428 otherwise registered late are numbered higher than the pass named
14429 @samp{final}, even if they are executed earlier.  The phase letter is
14430 one of @samp{i} (inter-procedural analysis), @samp{l}
14431 (language-specific), @samp{r} (RTL), or @samp{t} (tree). 
14432 The files are created in the directory of the output file. 
14434 @table @gcctabopt
14436 @item -d@var{letters}
14437 @itemx -fdump-rtl-@var{pass}
14438 @itemx -fdump-rtl-@var{pass}=@var{filename}
14439 @opindex d
14440 @opindex fdump-rtl-@var{pass}
14441 Says to make debugging dumps during compilation at times specified by
14442 @var{letters}.  This is used for debugging the RTL-based passes of the
14443 compiler.
14445 Some @option{-d@var{letters}} switches have different meaning when
14446 @option{-E} is used for preprocessing.  @xref{Preprocessor Options},
14447 for information about preprocessor-specific dump options.
14449 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14450 @option{-d} option @var{letters}.  Here are the possible
14451 letters for use in @var{pass} and @var{letters}, and their meanings:
14453 @table @gcctabopt
14455 @item -fdump-rtl-alignments
14456 @opindex fdump-rtl-alignments
14457 Dump after branch alignments have been computed.
14459 @item -fdump-rtl-asmcons
14460 @opindex fdump-rtl-asmcons
14461 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14463 @item -fdump-rtl-auto_inc_dec
14464 @opindex fdump-rtl-auto_inc_dec
14465 Dump after auto-inc-dec discovery.  This pass is only run on
14466 architectures that have auto inc or auto dec instructions.
14468 @item -fdump-rtl-barriers
14469 @opindex fdump-rtl-barriers
14470 Dump after cleaning up the barrier instructions.
14472 @item -fdump-rtl-bbpart
14473 @opindex fdump-rtl-bbpart
14474 Dump after partitioning hot and cold basic blocks.
14476 @item -fdump-rtl-bbro
14477 @opindex fdump-rtl-bbro
14478 Dump after block reordering.
14480 @item -fdump-rtl-btl1
14481 @itemx -fdump-rtl-btl2
14482 @opindex fdump-rtl-btl2
14483 @opindex fdump-rtl-btl2
14484 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14485 after the two branch
14486 target load optimization passes.
14488 @item -fdump-rtl-bypass
14489 @opindex fdump-rtl-bypass
14490 Dump after jump bypassing and control flow optimizations.
14492 @item -fdump-rtl-combine
14493 @opindex fdump-rtl-combine
14494 Dump after the RTL instruction combination pass.
14496 @item -fdump-rtl-compgotos
14497 @opindex fdump-rtl-compgotos
14498 Dump after duplicating the computed gotos.
14500 @item -fdump-rtl-ce1
14501 @itemx -fdump-rtl-ce2
14502 @itemx -fdump-rtl-ce3
14503 @opindex fdump-rtl-ce1
14504 @opindex fdump-rtl-ce2
14505 @opindex fdump-rtl-ce3
14506 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14507 @option{-fdump-rtl-ce3} enable dumping after the three
14508 if conversion passes.
14510 @item -fdump-rtl-cprop_hardreg
14511 @opindex fdump-rtl-cprop_hardreg
14512 Dump after hard register copy propagation.
14514 @item -fdump-rtl-csa
14515 @opindex fdump-rtl-csa
14516 Dump after combining stack adjustments.
14518 @item -fdump-rtl-cse1
14519 @itemx -fdump-rtl-cse2
14520 @opindex fdump-rtl-cse1
14521 @opindex fdump-rtl-cse2
14522 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14523 the two common subexpression elimination passes.
14525 @item -fdump-rtl-dce
14526 @opindex fdump-rtl-dce
14527 Dump after the standalone dead code elimination passes.
14529 @item -fdump-rtl-dbr
14530 @opindex fdump-rtl-dbr
14531 Dump after delayed branch scheduling.
14533 @item -fdump-rtl-dce1
14534 @itemx -fdump-rtl-dce2
14535 @opindex fdump-rtl-dce1
14536 @opindex fdump-rtl-dce2
14537 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14538 the two dead store elimination passes.
14540 @item -fdump-rtl-eh
14541 @opindex fdump-rtl-eh
14542 Dump after finalization of EH handling code.
14544 @item -fdump-rtl-eh_ranges
14545 @opindex fdump-rtl-eh_ranges
14546 Dump after conversion of EH handling range regions.
14548 @item -fdump-rtl-expand
14549 @opindex fdump-rtl-expand
14550 Dump after RTL generation.
14552 @item -fdump-rtl-fwprop1
14553 @itemx -fdump-rtl-fwprop2
14554 @opindex fdump-rtl-fwprop1
14555 @opindex fdump-rtl-fwprop2
14556 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14557 dumping after the two forward propagation passes.
14559 @item -fdump-rtl-gcse1
14560 @itemx -fdump-rtl-gcse2
14561 @opindex fdump-rtl-gcse1
14562 @opindex fdump-rtl-gcse2
14563 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14564 after global common subexpression elimination.
14566 @item -fdump-rtl-init-regs
14567 @opindex fdump-rtl-init-regs
14568 Dump after the initialization of the registers.
14570 @item -fdump-rtl-initvals
14571 @opindex fdump-rtl-initvals
14572 Dump after the computation of the initial value sets.
14574 @item -fdump-rtl-into_cfglayout
14575 @opindex fdump-rtl-into_cfglayout
14576 Dump after converting to cfglayout mode.
14578 @item -fdump-rtl-ira
14579 @opindex fdump-rtl-ira
14580 Dump after iterated register allocation.
14582 @item -fdump-rtl-jump
14583 @opindex fdump-rtl-jump
14584 Dump after the second jump optimization.
14586 @item -fdump-rtl-loop2
14587 @opindex fdump-rtl-loop2
14588 @option{-fdump-rtl-loop2} enables dumping after the rtl
14589 loop optimization passes.
14591 @item -fdump-rtl-mach
14592 @opindex fdump-rtl-mach
14593 Dump after performing the machine dependent reorganization pass, if that
14594 pass exists.
14596 @item -fdump-rtl-mode_sw
14597 @opindex fdump-rtl-mode_sw
14598 Dump after removing redundant mode switches.
14600 @item -fdump-rtl-rnreg
14601 @opindex fdump-rtl-rnreg
14602 Dump after register renumbering.
14604 @item -fdump-rtl-outof_cfglayout
14605 @opindex fdump-rtl-outof_cfglayout
14606 Dump after converting from cfglayout mode.
14608 @item -fdump-rtl-peephole2
14609 @opindex fdump-rtl-peephole2
14610 Dump after the peephole pass.
14612 @item -fdump-rtl-postreload
14613 @opindex fdump-rtl-postreload
14614 Dump after post-reload optimizations.
14616 @item -fdump-rtl-pro_and_epilogue
14617 @opindex fdump-rtl-pro_and_epilogue
14618 Dump after generating the function prologues and epilogues.
14620 @item -fdump-rtl-sched1
14621 @itemx -fdump-rtl-sched2
14622 @opindex fdump-rtl-sched1
14623 @opindex fdump-rtl-sched2
14624 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14625 after the basic block scheduling passes.
14627 @item -fdump-rtl-ree
14628 @opindex fdump-rtl-ree
14629 Dump after sign/zero extension elimination.
14631 @item -fdump-rtl-seqabstr
14632 @opindex fdump-rtl-seqabstr
14633 Dump after common sequence discovery.
14635 @item -fdump-rtl-shorten
14636 @opindex fdump-rtl-shorten
14637 Dump after shortening branches.
14639 @item -fdump-rtl-sibling
14640 @opindex fdump-rtl-sibling
14641 Dump after sibling call optimizations.
14643 @item -fdump-rtl-split1
14644 @itemx -fdump-rtl-split2
14645 @itemx -fdump-rtl-split3
14646 @itemx -fdump-rtl-split4
14647 @itemx -fdump-rtl-split5
14648 @opindex fdump-rtl-split1
14649 @opindex fdump-rtl-split2
14650 @opindex fdump-rtl-split3
14651 @opindex fdump-rtl-split4
14652 @opindex fdump-rtl-split5
14653 These options enable dumping after five rounds of
14654 instruction splitting.
14656 @item -fdump-rtl-sms
14657 @opindex fdump-rtl-sms
14658 Dump after modulo scheduling.  This pass is only run on some
14659 architectures.
14661 @item -fdump-rtl-stack
14662 @opindex fdump-rtl-stack
14663 Dump after conversion from GCC's ``flat register file'' registers to the
14664 x87's stack-like registers.  This pass is only run on x86 variants.
14666 @item -fdump-rtl-subreg1
14667 @itemx -fdump-rtl-subreg2
14668 @opindex fdump-rtl-subreg1
14669 @opindex fdump-rtl-subreg2
14670 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14671 the two subreg expansion passes.
14673 @item -fdump-rtl-unshare
14674 @opindex fdump-rtl-unshare
14675 Dump after all rtl has been unshared.
14677 @item -fdump-rtl-vartrack
14678 @opindex fdump-rtl-vartrack
14679 Dump after variable tracking.
14681 @item -fdump-rtl-vregs
14682 @opindex fdump-rtl-vregs
14683 Dump after converting virtual registers to hard registers.
14685 @item -fdump-rtl-web
14686 @opindex fdump-rtl-web
14687 Dump after live range splitting.
14689 @item -fdump-rtl-regclass
14690 @itemx -fdump-rtl-subregs_of_mode_init
14691 @itemx -fdump-rtl-subregs_of_mode_finish
14692 @itemx -fdump-rtl-dfinit
14693 @itemx -fdump-rtl-dfinish
14694 @opindex fdump-rtl-regclass
14695 @opindex fdump-rtl-subregs_of_mode_init
14696 @opindex fdump-rtl-subregs_of_mode_finish
14697 @opindex fdump-rtl-dfinit
14698 @opindex fdump-rtl-dfinish
14699 These dumps are defined but always produce empty files.
14701 @item -da
14702 @itemx -fdump-rtl-all
14703 @opindex da
14704 @opindex fdump-rtl-all
14705 Produce all the dumps listed above.
14707 @item -dA
14708 @opindex dA
14709 Annotate the assembler output with miscellaneous debugging information.
14711 @item -dD
14712 @opindex dD
14713 Dump all macro definitions, at the end of preprocessing, in addition to
14714 normal output.
14716 @item -dH
14717 @opindex dH
14718 Produce a core dump whenever an error occurs.
14720 @item -dp
14721 @opindex dp
14722 Annotate the assembler output with a comment indicating which
14723 pattern and alternative is used.  The length and cost of each instruction are
14724 also printed.
14726 @item -dP
14727 @opindex dP
14728 Dump the RTL in the assembler output as a comment before each instruction.
14729 Also turns on @option{-dp} annotation.
14731 @item -dx
14732 @opindex dx
14733 Just generate RTL for a function instead of compiling it.  Usually used
14734 with @option{-fdump-rtl-expand}.
14735 @end table
14737 @item -fdump-debug
14738 @opindex fdump-debug
14739 Dump debugging information generated during the debug
14740 generation phase.
14742 @item -fdump-earlydebug
14743 @opindex fdump-earlydebug
14744 Dump debugging information generated during the early debug
14745 generation phase.
14747 @item -fdump-noaddr
14748 @opindex fdump-noaddr
14749 When doing debugging dumps, suppress address output.  This makes it more
14750 feasible to use diff on debugging dumps for compiler invocations with
14751 different compiler binaries and/or different
14752 text / bss / data / heap / stack / dso start locations.
14754 @item -freport-bug
14755 @opindex freport-bug
14756 Collect and dump debug information into a temporary file if an
14757 internal compiler error (ICE) occurs.
14759 @item -fdump-unnumbered
14760 @opindex fdump-unnumbered
14761 When doing debugging dumps, suppress instruction numbers and address output.
14762 This makes it more feasible to use diff on debugging dumps for compiler
14763 invocations with different options, in particular with and without
14764 @option{-g}.
14766 @item -fdump-unnumbered-links
14767 @opindex fdump-unnumbered-links
14768 When doing debugging dumps (see @option{-d} option above), suppress
14769 instruction numbers for the links to the previous and next instructions
14770 in a sequence.
14772 @item -fdump-ipa-@var{switch}
14773 @itemx -fdump-ipa-@var{switch}-@var{options}
14774 @opindex fdump-ipa
14775 Control the dumping at various stages of inter-procedural analysis
14776 language tree to a file.  The file name is generated by appending a
14777 switch specific suffix to the source file name, and the file is created
14778 in the same directory as the output file.  The following dumps are
14779 possible:
14781 @table @samp
14782 @item all
14783 Enables all inter-procedural analysis dumps.
14785 @item cgraph
14786 Dumps information about call-graph optimization, unused function removal,
14787 and inlining decisions.
14789 @item inline
14790 Dump after function inlining.
14792 @end table
14794 Additionally, the options @option{-optimized}, @option{-missed},
14795 @option{-note}, and @option{-all} can be provided, with the same meaning
14796 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14798 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14799 information on callsites that were inlined, along with callsites
14800 that were not inlined.
14802 By default, the dump will contain messages about successful
14803 optimizations (equivalent to @option{-optimized}) together with
14804 low-level details about the analysis.
14806 @item -fdump-lang-all
14807 @itemx -fdump-lang-@var{switch}
14808 @itemx -fdump-lang-@var{switch}-@var{options}
14809 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14810 @opindex fdump-lang-all
14811 @opindex fdump-lang
14812 Control the dumping of language-specific information.  The @var{options}
14813 and @var{filename} portions behave as described in the
14814 @option{-fdump-tree} option.  The following @var{switch} values are
14815 accepted:
14817 @table @samp
14818 @item all
14820 Enable all language-specific dumps.
14822 @item class
14823 Dump class hierarchy information.  Virtual table information is emitted
14824 unless '@option{slim}' is specified.  This option is applicable to C++ only.
14826 @item raw
14827 Dump the raw internal tree data.  This option is applicable to C++ only.
14829 @end table
14831 @item -fdump-passes
14832 @opindex fdump-passes
14833 Print on @file{stderr} the list of optimization passes that are turned
14834 on and off by the current command-line options.
14836 @item -fdump-statistics-@var{option}
14837 @opindex fdump-statistics
14838 Enable and control dumping of pass statistics in a separate file.  The
14839 file name is generated by appending a suffix ending in
14840 @samp{.statistics} to the source file name, and the file is created in
14841 the same directory as the output file.  If the @samp{-@var{option}}
14842 form is used, @samp{-stats} causes counters to be summed over the
14843 whole compilation unit while @samp{-details} dumps every event as
14844 the passes generate them.  The default with no option is to sum
14845 counters for each function compiled.
14847 @item -fdump-tree-all
14848 @itemx -fdump-tree-@var{switch}
14849 @itemx -fdump-tree-@var{switch}-@var{options}
14850 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14851 @opindex fdump-tree-all
14852 @opindex fdump-tree
14853 Control the dumping at various stages of processing the intermediate
14854 language tree to a file.  If the @samp{-@var{options}}
14855 form is used, @var{options} is a list of @samp{-} separated options
14856 which control the details of the dump.  Not all options are applicable
14857 to all dumps; those that are not meaningful are ignored.  The
14858 following options are available
14860 @table @samp
14861 @item address
14862 Print the address of each node.  Usually this is not meaningful as it
14863 changes according to the environment and source file.  Its primary use
14864 is for tying up a dump file with a debug environment.
14865 @item asmname
14866 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14867 in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
14868 use working backward from mangled names in the assembly file.
14869 @item slim
14870 When dumping front-end intermediate representations, inhibit dumping
14871 of members of a scope or body of a function merely because that scope
14872 has been reached.  Only dump such items when they are directly reachable
14873 by some other path.
14875 When dumping pretty-printed trees, this option inhibits dumping the
14876 bodies of control structures.
14878 When dumping RTL, print the RTL in slim (condensed) form instead of
14879 the default LISP-like representation.
14880 @item raw
14881 Print a raw representation of the tree.  By default, trees are
14882 pretty-printed into a C-like representation.
14883 @item details
14884 Enable more detailed dumps (not honored by every dump option). Also
14885 include information from the optimization passes.
14886 @item stats
14887 Enable dumping various statistics about the pass (not honored by every dump
14888 option).
14889 @item blocks
14890 Enable showing basic block boundaries (disabled in raw dumps).
14891 @item graph
14892 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14893 dump a representation of the control flow graph suitable for viewing with
14894 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
14895 the file is pretty-printed as a subgraph, so that GraphViz can render them
14896 all in a single plot.
14898 This option currently only works for RTL dumps, and the RTL is always
14899 dumped in slim form.
14900 @item vops
14901 Enable showing virtual operands for every statement.
14902 @item lineno
14903 Enable showing line numbers for statements.
14904 @item uid
14905 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14906 @item verbose
14907 Enable showing the tree dump for each statement.
14908 @item eh
14909 Enable showing the EH region number holding each statement.
14910 @item scev
14911 Enable showing scalar evolution analysis details.
14912 @item optimized
14913 Enable showing optimization information (only available in certain
14914 passes).
14915 @item missed
14916 Enable showing missed optimization information (only available in certain
14917 passes).
14918 @item note
14919 Enable other detailed optimization information (only available in
14920 certain passes).
14921 @item all
14922 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14923 and @option{lineno}.
14924 @item optall
14925 Turn on all optimization options, i.e., @option{optimized},
14926 @option{missed}, and @option{note}.
14927 @end table
14929 To determine what tree dumps are available or find the dump for a pass
14930 of interest follow the steps below.
14932 @enumerate
14933 @item
14934 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14935 look for a code that corresponds to the pass you are interested in.
14936 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14937 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14938 The number at the end distinguishes distinct invocations of the same pass.
14939 @item
14940 To enable the creation of the dump file, append the pass code to
14941 the @option{-fdump-} option prefix and invoke GCC with it.  For example,
14942 to enable the dump from the Early Value Range Propagation pass, invoke
14943 GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
14944 specify the name of the dump file.  If you don't specify one, GCC
14945 creates as described below.
14946 @item
14947 Find the pass dump in a file whose name is composed of three components
14948 separated by a period: the name of the source file GCC was invoked to
14949 compile, a numeric suffix indicating the pass number followed by the
14950 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14951 and finally the pass code.  For example, the Early VRP pass dump might
14952 be in a file named @file{myfile.c.038t.evrp} in the current working
14953 directory.  Note that the numeric codes are not stable and may change
14954 from one version of GCC to another.
14955 @end enumerate
14957 @item -fopt-info
14958 @itemx -fopt-info-@var{options}
14959 @itemx -fopt-info-@var{options}=@var{filename}
14960 @opindex fopt-info
14961 Controls optimization dumps from various optimization passes. If the
14962 @samp{-@var{options}} form is used, @var{options} is a list of
14963 @samp{-} separated option keywords to select the dump details and
14964 optimizations.  
14966 The @var{options} can be divided into three groups:
14967 @enumerate
14968 @item
14969 options describing what kinds of messages should be emitted,
14970 @item
14971 options describing the verbosity of the dump, and
14972 @item
14973 options describing which optimizations should be included.
14974 @end enumerate
14975 The options from each group can be freely mixed as they are
14976 non-overlapping. However, in case of any conflicts,
14977 the later options override the earlier options on the command
14978 line. 
14980 The following options control which kinds of messages should be emitted:
14982 @table @samp
14983 @item optimized
14984 Print information when an optimization is successfully applied. It is
14985 up to a pass to decide which information is relevant. For example, the
14986 vectorizer passes print the source location of loops which are
14987 successfully vectorized.
14988 @item missed
14989 Print information about missed optimizations. Individual passes
14990 control which information to include in the output. 
14991 @item note
14992 Print verbose information about optimizations, such as certain
14993 transformations, more detailed messages about decisions etc.
14994 @item all
14995 Print detailed optimization information. This includes
14996 @samp{optimized}, @samp{missed}, and @samp{note}.
14997 @end table
14999 The following option controls the dump verbosity:
15001 @table @samp
15002 @item internals
15003 By default, only ``high-level'' messages are emitted. This option enables
15004 additional, more detailed, messages, which are likely to only be of interest
15005 to GCC developers.
15006 @end table
15008 One or more of the following option keywords can be used to describe a
15009 group of optimizations:
15011 @table @samp
15012 @item ipa
15013 Enable dumps from all interprocedural optimizations.
15014 @item loop
15015 Enable dumps from all loop optimizations.
15016 @item inline
15017 Enable dumps from all inlining optimizations.
15018 @item omp
15019 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
15020 @item vec
15021 Enable dumps from all vectorization optimizations.
15022 @item optall
15023 Enable dumps from all optimizations. This is a superset of
15024 the optimization groups listed above.
15025 @end table
15027 If @var{options} is
15028 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
15029 about successful optimizations from all the passes, omitting messages
15030 that are treated as ``internals''.
15032 If the @var{filename} is provided, then the dumps from all the
15033 applicable optimizations are concatenated into the @var{filename}.
15034 Otherwise the dump is output onto @file{stderr}. Though multiple
15035 @option{-fopt-info} options are accepted, only one of them can include
15036 a @var{filename}. If other filenames are provided then all but the
15037 first such option are ignored.
15039 Note that the output @var{filename} is overwritten
15040 in case of multiple translation units. If a combined output from
15041 multiple translation units is desired, @file{stderr} should be used
15042 instead.
15044 In the following example, the optimization info is output to
15045 @file{stderr}:
15047 @smallexample
15048 gcc -O3 -fopt-info
15049 @end smallexample
15051 This example:
15052 @smallexample
15053 gcc -O3 -fopt-info-missed=missed.all
15054 @end smallexample
15056 @noindent
15057 outputs missed optimization report from all the passes into
15058 @file{missed.all}, and this one:
15060 @smallexample
15061 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15062 @end smallexample
15064 @noindent
15065 prints information about missed optimization opportunities from
15066 vectorization passes on @file{stderr}.  
15067 Note that @option{-fopt-info-vec-missed} is equivalent to 
15068 @option{-fopt-info-missed-vec}.  The order of the optimization group
15069 names and message types listed after @option{-fopt-info} does not matter.
15071 As another example,
15072 @smallexample
15073 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15074 @end smallexample
15076 @noindent
15077 outputs information about missed optimizations as well as
15078 optimized locations from all the inlining passes into
15079 @file{inline.txt}.
15081 Finally, consider:
15083 @smallexample
15084 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15085 @end smallexample
15087 @noindent
15088 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15089 in conflict since only one output file is allowed. In this case, only
15090 the first option takes effect and the subsequent options are
15091 ignored. Thus only @file{vec.miss} is produced which contains
15092 dumps from the vectorizer about missed opportunities.
15094 @item -fsave-optimization-record
15095 @opindex fsave-optimization-record
15096 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15097 were performed, for those optimizations that support @option{-fopt-info}.
15099 This option is experimental and the format of the data within the
15100 compressed JSON file is subject to change.
15102 It is roughly equivalent to a machine-readable version of
15103 @option{-fopt-info-all}, as a collection of messages with source file,
15104 line number and column number, with the following additional data for
15105 each message:
15107 @itemize @bullet
15109 @item
15110 the execution count of the code being optimized, along with metadata about
15111 whether this was from actual profile data, or just an estimate, allowing
15112 consumers to prioritize messages by code hotness,
15114 @item
15115 the function name of the code being optimized, where applicable,
15117 @item
15118 the ``inlining chain'' for the code being optimized, so that when
15119 a function is inlined into several different places (which might
15120 themselves be inlined), the reader can distinguish between the copies,
15122 @item
15123 objects identifying those parts of the message that refer to expressions,
15124 statements or symbol-table nodes, which of these categories they are, and,
15125 when available, their source code location,
15127 @item
15128 the GCC pass that emitted the message, and
15130 @item
15131 the location in GCC's own code from which the message was emitted
15133 @end itemize
15135 Additionally, some messages are logically nested within other
15136 messages, reflecting implementation details of the optimization
15137 passes.
15139 @item -fsched-verbose=@var{n}
15140 @opindex fsched-verbose
15141 On targets that use instruction scheduling, this option controls the
15142 amount of debugging output the scheduler prints to the dump files.
15144 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15145 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15146 For @var{n} greater than one, it also output basic block probabilities,
15147 detailed ready list information and unit/insn info.  For @var{n} greater
15148 than two, it includes RTL at abort point, control-flow and regions info.
15149 And for @var{n} over four, @option{-fsched-verbose} also includes
15150 dependence info.
15154 @item -fenable-@var{kind}-@var{pass}
15155 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15156 @opindex fdisable-
15157 @opindex fenable-
15159 This is a set of options that are used to explicitly disable/enable
15160 optimization passes.  These options are intended for use for debugging GCC.
15161 Compiler users should use regular options for enabling/disabling
15162 passes instead.
15164 @table @gcctabopt
15166 @item -fdisable-ipa-@var{pass}
15167 Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
15168 statically invoked in the compiler multiple times, the pass name should be
15169 appended with a sequential number starting from 1.
15171 @item -fdisable-rtl-@var{pass}
15172 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15173 Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
15174 statically invoked in the compiler multiple times, the pass name should be
15175 appended with a sequential number starting from 1.  @var{range-list} is a 
15176 comma-separated list of function ranges or assembler names.  Each range is a number
15177 pair separated by a colon.  The range is inclusive in both ends.  If the range
15178 is trivial, the number pair can be simplified as a single number.  If the
15179 function's call graph node's @var{uid} falls within one of the specified ranges,
15180 the @var{pass} is disabled for that function.  The @var{uid} is shown in the
15181 function header of a dump file, and the pass names can be dumped by using
15182 option @option{-fdump-passes}.
15184 @item -fdisable-tree-@var{pass}
15185 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15186 Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
15187 option arguments.
15189 @item -fenable-ipa-@var{pass}
15190 Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
15191 statically invoked in the compiler multiple times, the pass name should be
15192 appended with a sequential number starting from 1.
15194 @item -fenable-rtl-@var{pass}
15195 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15196 Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
15197 description and examples.
15199 @item -fenable-tree-@var{pass}
15200 @itemx -fenable-tree-@var{pass}=@var{range-list}
15201 Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
15202 of option arguments.
15204 @end table
15206 Here are some examples showing uses of these options.
15208 @smallexample
15210 # disable ccp1 for all functions
15211    -fdisable-tree-ccp1
15212 # disable complete unroll for function whose cgraph node uid is 1
15213    -fenable-tree-cunroll=1
15214 # disable gcse2 for functions at the following ranges [1,1],
15215 # [300,400], and [400,1000]
15216 # disable gcse2 for functions foo and foo2
15217    -fdisable-rtl-gcse2=foo,foo2
15218 # disable early inlining
15219    -fdisable-tree-einline
15220 # disable ipa inlining
15221    -fdisable-ipa-inline
15222 # enable tree full unroll
15223    -fenable-tree-unroll
15225 @end smallexample
15227 @item -fchecking
15228 @itemx -fchecking=@var{n}
15229 @opindex fchecking
15230 @opindex fno-checking
15231 Enable internal consistency checking.  The default depends on
15232 the compiler configuration.  @option{-fchecking=2} enables further
15233 internal consistency checking that might affect code generation.
15235 @item -frandom-seed=@var{string}
15236 @opindex frandom-seed
15237 This option provides a seed that GCC uses in place of
15238 random numbers in generating certain symbol names
15239 that have to be different in every compiled file.  It is also used to
15240 place unique stamps in coverage data files and the object files that
15241 produce them.  You can use the @option{-frandom-seed} option to produce
15242 reproducibly identical object files.
15244 The @var{string} can either be a number (decimal, octal or hex) or an
15245 arbitrary string (in which case it's converted to a number by
15246 computing CRC32).
15248 The @var{string} should be different for every file you compile.
15250 @item -save-temps
15251 @itemx -save-temps=cwd
15252 @opindex save-temps
15253 Store the usual ``temporary'' intermediate files permanently; place them
15254 in the current directory and name them based on the source file.  Thus,
15255 compiling @file{foo.c} with @option{-c -save-temps} produces files
15256 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
15257 preprocessed @file{foo.i} output file even though the compiler now
15258 normally uses an integrated preprocessor.
15260 When used in combination with the @option{-x} command-line option,
15261 @option{-save-temps} is sensible enough to avoid over writing an
15262 input source file with the same extension as an intermediate file.
15263 The corresponding intermediate file may be obtained by renaming the
15264 source file before using @option{-save-temps}.
15266 If you invoke GCC in parallel, compiling several different source
15267 files that share a common base name in different subdirectories or the
15268 same source file compiled for multiple output destinations, it is
15269 likely that the different parallel compilers will interfere with each
15270 other, and overwrite the temporary files.  For instance:
15272 @smallexample
15273 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15274 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15275 @end smallexample
15277 may result in @file{foo.i} and @file{foo.o} being written to
15278 simultaneously by both compilers.
15280 @item -save-temps=obj
15281 @opindex save-temps=obj
15282 Store the usual ``temporary'' intermediate files permanently.  If the
15283 @option{-o} option is used, the temporary files are based on the
15284 object file.  If the @option{-o} option is not used, the
15285 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15287 For example:
15289 @smallexample
15290 gcc -save-temps=obj -c foo.c
15291 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15292 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15293 @end smallexample
15295 @noindent
15296 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15297 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15298 @file{dir2/yfoobar.o}.
15300 @item -time@r{[}=@var{file}@r{]}
15301 @opindex time
15302 Report the CPU time taken by each subprocess in the compilation
15303 sequence.  For C source files, this is the compiler proper and assembler
15304 (plus the linker if linking is done).
15306 Without the specification of an output file, the output looks like this:
15308 @smallexample
15309 # cc1 0.12 0.01
15310 # as 0.00 0.01
15311 @end smallexample
15313 The first number on each line is the ``user time'', that is time spent
15314 executing the program itself.  The second number is ``system time'',
15315 time spent executing operating system routines on behalf of the program.
15316 Both numbers are in seconds.
15318 With the specification of an output file, the output is appended to the
15319 named file, and it looks like this:
15321 @smallexample
15322 0.12 0.01 cc1 @var{options}
15323 0.00 0.01 as @var{options}
15324 @end smallexample
15326 The ``user time'' and the ``system time'' are moved before the program
15327 name, and the options passed to the program are displayed, so that one
15328 can later tell what file was being compiled, and with which options.
15330 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15331 @opindex fdump-final-insns
15332 Dump the final internal representation (RTL) to @var{file}.  If the
15333 optional argument is omitted (or if @var{file} is @code{.}), the name
15334 of the dump file is determined by appending @code{.gkd} to the
15335 compilation output file name.
15337 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15338 @opindex fcompare-debug
15339 @opindex fno-compare-debug
15340 If no error occurs during compilation, run the compiler a second time,
15341 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15342 passed to the second compilation.  Dump the final internal
15343 representation in both compilations, and print an error if they differ.
15345 If the equal sign is omitted, the default @option{-gtoggle} is used.
15347 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15348 and nonzero, implicitly enables @option{-fcompare-debug}.  If
15349 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15350 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15351 is used.
15353 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15354 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15355 of the final representation and the second compilation, preventing even
15356 @env{GCC_COMPARE_DEBUG} from taking effect.
15358 To verify full coverage during @option{-fcompare-debug} testing, set
15359 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15360 which GCC rejects as an invalid option in any actual compilation
15361 (rather than preprocessing, assembly or linking).  To get just a
15362 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15363 not overridden} will do.
15365 @item -fcompare-debug-second
15366 @opindex fcompare-debug-second
15367 This option is implicitly passed to the compiler for the second
15368 compilation requested by @option{-fcompare-debug}, along with options to
15369 silence warnings, and omitting other options that would cause the compiler
15370 to produce output to files or to standard output as a side effect.  Dump
15371 files and preserved temporary files are renamed so as to contain the
15372 @code{.gk} additional extension during the second compilation, to avoid
15373 overwriting those generated by the first.
15375 When this option is passed to the compiler driver, it causes the
15376 @emph{first} compilation to be skipped, which makes it useful for little
15377 other than debugging the compiler proper.
15379 @item -gtoggle
15380 @opindex gtoggle
15381 Turn off generation of debug info, if leaving out this option
15382 generates it, or turn it on at level 2 otherwise.  The position of this
15383 argument in the command line does not matter; it takes effect after all
15384 other options are processed, and it does so only once, no matter how
15385 many times it is given.  This is mainly intended to be used with
15386 @option{-fcompare-debug}.
15388 @item -fvar-tracking-assignments-toggle
15389 @opindex fvar-tracking-assignments-toggle
15390 @opindex fno-var-tracking-assignments-toggle
15391 Toggle @option{-fvar-tracking-assignments}, in the same way that
15392 @option{-gtoggle} toggles @option{-g}.
15394 @item -Q
15395 @opindex Q
15396 Makes the compiler print out each function name as it is compiled, and
15397 print some statistics about each pass when it finishes.
15399 @item -ftime-report
15400 @opindex ftime-report
15401 Makes the compiler print some statistics about the time consumed by each
15402 pass when it finishes.
15404 @item -ftime-report-details
15405 @opindex ftime-report-details
15406 Record the time consumed by infrastructure parts separately for each pass.
15408 @item -fira-verbose=@var{n}
15409 @opindex fira-verbose
15410 Control the verbosity of the dump file for the integrated register allocator.
15411 The default value is 5.  If the value @var{n} is greater or equal to 10,
15412 the dump output is sent to stderr using the same format as @var{n} minus 10.
15414 @item -flto-report
15415 @opindex flto-report
15416 Prints a report with internal details on the workings of the link-time
15417 optimizer.  The contents of this report vary from version to version.
15418 It is meant to be useful to GCC developers when processing object
15419 files in LTO mode (via @option{-flto}).
15421 Disabled by default.
15423 @item -flto-report-wpa
15424 @opindex flto-report-wpa
15425 Like @option{-flto-report}, but only print for the WPA phase of link-time
15426 optimization.
15428 @item -fmem-report
15429 @opindex fmem-report
15430 Makes the compiler print some statistics about permanent memory
15431 allocation when it finishes.
15433 @item -fmem-report-wpa
15434 @opindex fmem-report-wpa
15435 Makes the compiler print some statistics about permanent memory
15436 allocation for the WPA phase only.
15438 @item -fpre-ipa-mem-report
15439 @opindex fpre-ipa-mem-report
15440 @item -fpost-ipa-mem-report
15441 @opindex fpost-ipa-mem-report
15442 Makes the compiler print some statistics about permanent memory
15443 allocation before or after interprocedural optimization.
15445 @item -fprofile-report
15446 @opindex fprofile-report
15447 Makes the compiler print some statistics about consistency of the
15448 (estimated) profile and effect of individual passes.
15450 @item -fstack-usage
15451 @opindex fstack-usage
15452 Makes the compiler output stack usage information for the program, on a
15453 per-function basis.  The filename for the dump is made by appending
15454 @file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
15455 the output file, if explicitly specified and it is not an executable,
15456 otherwise it is the basename of the source file.  An entry is made up
15457 of three fields:
15459 @itemize
15460 @item
15461 The name of the function.
15462 @item
15463 A number of bytes.
15464 @item
15465 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15466 @end itemize
15468 The qualifier @code{static} means that the function manipulates the stack
15469 statically: a fixed number of bytes are allocated for the frame on function
15470 entry and released on function exit; no stack adjustments are otherwise made
15471 in the function.  The second field is this fixed number of bytes.
15473 The qualifier @code{dynamic} means that the function manipulates the stack
15474 dynamically: in addition to the static allocation described above, stack
15475 adjustments are made in the body of the function, for example to push/pop
15476 arguments around function calls.  If the qualifier @code{bounded} is also
15477 present, the amount of these adjustments is bounded at compile time and
15478 the second field is an upper bound of the total amount of stack used by
15479 the function.  If it is not present, the amount of these adjustments is
15480 not bounded at compile time and the second field only represents the
15481 bounded part.
15483 @item -fstats
15484 @opindex fstats
15485 Emit statistics about front-end processing at the end of the compilation.
15486 This option is supported only by the C++ front end, and
15487 the information is generally only useful to the G++ development team.
15489 @item -fdbg-cnt-list
15490 @opindex fdbg-cnt-list
15491 Print the name and the counter upper bound for all debug counters.
15494 @item -fdbg-cnt=@var{counter-value-list}
15495 @opindex fdbg-cnt
15496 Set the internal debug counter lower and upper bound.  @var{counter-value-list}
15497 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15498 tuples which sets the lower and the upper bound of each debug
15499 counter @var{name}.  The @var{lower_bound} is optional and is zero
15500 initialized if not set.
15501 All debug counters have the initial upper bound of @code{UINT_MAX};
15502 thus @code{dbg_cnt} returns true always unless the upper bound
15503 is set by this option.
15504 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15505 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15506 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15508 @item -print-file-name=@var{library}
15509 @opindex print-file-name
15510 Print the full absolute name of the library file @var{library} that
15511 would be used when linking---and don't do anything else.  With this
15512 option, GCC does not compile or link anything; it just prints the
15513 file name.
15515 @item -print-multi-directory
15516 @opindex print-multi-directory
15517 Print the directory name corresponding to the multilib selected by any
15518 other switches present in the command line.  This directory is supposed
15519 to exist in @env{GCC_EXEC_PREFIX}.
15521 @item -print-multi-lib
15522 @opindex print-multi-lib
15523 Print the mapping from multilib directory names to compiler switches
15524 that enable them.  The directory name is separated from the switches by
15525 @samp{;}, and each switch starts with an @samp{@@} instead of the
15526 @samp{-}, without spaces between multiple switches.  This is supposed to
15527 ease shell processing.
15529 @item -print-multi-os-directory
15530 @opindex print-multi-os-directory
15531 Print the path to OS libraries for the selected
15532 multilib, relative to some @file{lib} subdirectory.  If OS libraries are
15533 present in the @file{lib} subdirectory and no multilibs are used, this is
15534 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15535 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15536 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15537 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15539 @item -print-multiarch
15540 @opindex print-multiarch
15541 Print the path to OS libraries for the selected multiarch,
15542 relative to some @file{lib} subdirectory.
15544 @item -print-prog-name=@var{program}
15545 @opindex print-prog-name
15546 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15548 @item -print-libgcc-file-name
15549 @opindex print-libgcc-file-name
15550 Same as @option{-print-file-name=libgcc.a}.
15552 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15553 but you do want to link with @file{libgcc.a}.  You can do:
15555 @smallexample
15556 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15557 @end smallexample
15559 @item -print-search-dirs
15560 @opindex print-search-dirs
15561 Print the name of the configured installation directory and a list of
15562 program and library directories @command{gcc} searches---and don't do anything else.
15564 This is useful when @command{gcc} prints the error message
15565 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15566 To resolve this you either need to put @file{cpp0} and the other compiler
15567 components where @command{gcc} expects to find them, or you can set the environment
15568 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15569 Don't forget the trailing @samp{/}.
15570 @xref{Environment Variables}.
15572 @item -print-sysroot
15573 @opindex print-sysroot
15574 Print the target sysroot directory that is used during
15575 compilation.  This is the target sysroot specified either at configure
15576 time or using the @option{--sysroot} option, possibly with an extra
15577 suffix that depends on compilation options.  If no target sysroot is
15578 specified, the option prints nothing.
15580 @item -print-sysroot-headers-suffix
15581 @opindex print-sysroot-headers-suffix
15582 Print the suffix added to the target sysroot when searching for
15583 headers, or give an error if the compiler is not configured with such
15584 a suffix---and don't do anything else.
15586 @item -dumpmachine
15587 @opindex dumpmachine
15588 Print the compiler's target machine (for example,
15589 @samp{i686-pc-linux-gnu})---and don't do anything else.
15591 @item -dumpversion
15592 @opindex dumpversion
15593 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15594 anything else.  This is the compiler version used in filesystem paths and
15595 specs. Depending on how the compiler has been configured it can be just
15596 a single number (major version), two numbers separated by a dot (major and
15597 minor version) or three numbers separated by dots (major, minor and patchlevel
15598 version).
15600 @item -dumpfullversion
15601 @opindex dumpfullversion
15602 Print the full compiler version---and don't do anything else. The output is
15603 always three numbers separated by dots, major, minor and patchlevel version.
15605 @item -dumpspecs
15606 @opindex dumpspecs
15607 Print the compiler's built-in specs---and don't do anything else.  (This
15608 is used when GCC itself is being built.)  @xref{Spec Files}.
15609 @end table
15611 @node Submodel Options
15612 @section Machine-Dependent Options
15613 @cindex submodel options
15614 @cindex specifying hardware config
15615 @cindex hardware models and configurations, specifying
15616 @cindex target-dependent options
15617 @cindex machine-dependent options
15619 Each target machine supported by GCC can have its own options---for
15620 example, to allow you to compile for a particular processor variant or
15621 ABI, or to control optimizations specific to that machine.  By
15622 convention, the names of machine-specific options start with
15623 @samp{-m}.
15625 Some configurations of the compiler also support additional target-specific
15626 options, usually for compatibility with other compilers on the same
15627 platform.
15629 @c This list is ordered alphanumerically by subsection name.
15630 @c It should be the same order and spelling as these options are listed
15631 @c in Machine Dependent Options
15633 @menu
15634 * AArch64 Options::
15635 * Adapteva Epiphany Options::
15636 * AMD GCN Options::
15637 * ARC Options::
15638 * ARM Options::
15639 * AVR Options::
15640 * Blackfin Options::
15641 * C6X Options::
15642 * CRIS Options::
15643 * CR16 Options::
15644 * C-SKY Options::
15645 * Darwin Options::
15646 * DEC Alpha Options::
15647 * eBPF Options::
15648 * FR30 Options::
15649 * FT32 Options::
15650 * FRV Options::
15651 * GNU/Linux Options::
15652 * H8/300 Options::
15653 * HPPA Options::
15654 * IA-64 Options::
15655 * LM32 Options::
15656 * M32C Options::
15657 * M32R/D Options::
15658 * M680x0 Options::
15659 * MCore Options::
15660 * MeP Options::
15661 * MicroBlaze Options::
15662 * MIPS Options::
15663 * MMIX Options::
15664 * MN10300 Options::
15665 * Moxie Options::
15666 * MSP430 Options::
15667 * NDS32 Options::
15668 * Nios II Options::
15669 * Nvidia PTX Options::
15670 * OpenRISC Options::
15671 * PDP-11 Options::
15672 * picoChip Options::
15673 * PowerPC Options::
15674 * PRU Options::
15675 * RISC-V Options::
15676 * RL78 Options::
15677 * RS/6000 and PowerPC Options::
15678 * RX Options::
15679 * S/390 and zSeries Options::
15680 * Score Options::
15681 * SH Options::
15682 * Solaris 2 Options::
15683 * SPARC Options::
15684 * System V Options::
15685 * TILE-Gx Options::
15686 * TILEPro Options::
15687 * V850 Options::
15688 * VAX Options::
15689 * Visium Options::
15690 * VMS Options::
15691 * VxWorks Options::
15692 * x86 Options::
15693 * x86 Windows Options::
15694 * Xstormy16 Options::
15695 * Xtensa Options::
15696 * zSeries Options::
15697 @end menu
15699 @node AArch64 Options
15700 @subsection AArch64 Options
15701 @cindex AArch64 Options
15703 These options are defined for AArch64 implementations:
15705 @table @gcctabopt
15707 @item -mabi=@var{name}
15708 @opindex mabi
15709 Generate code for the specified data model.  Permissible values
15710 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15711 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15712 but long int and pointers are 64 bits.
15714 The default depends on the specific target configuration.  Note that
15715 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15716 entire program with the same ABI, and link with a compatible set of libraries.
15718 @item -mbig-endian
15719 @opindex mbig-endian
15720 Generate big-endian code.  This is the default when GCC is configured for an
15721 @samp{aarch64_be-*-*} target.
15723 @item -mgeneral-regs-only
15724 @opindex mgeneral-regs-only
15725 Generate code which uses only the general-purpose registers.  This will prevent
15726 the compiler from using floating-point and Advanced SIMD registers but will not
15727 impose any restrictions on the assembler.
15729 @item -mlittle-endian
15730 @opindex mlittle-endian
15731 Generate little-endian code.  This is the default when GCC is configured for an
15732 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15734 @item -mcmodel=tiny
15735 @opindex mcmodel=tiny
15736 Generate code for the tiny code model.  The program and its statically defined
15737 symbols must be within 1MB of each other.  Programs can be statically or
15738 dynamically linked.
15740 @item -mcmodel=small
15741 @opindex mcmodel=small
15742 Generate code for the small code model.  The program and its statically defined
15743 symbols must be within 4GB of each other.  Programs can be statically or
15744 dynamically linked.  This is the default code model.
15746 @item -mcmodel=large
15747 @opindex mcmodel=large
15748 Generate code for the large code model.  This makes no assumptions about
15749 addresses and sizes of sections.  Programs can be statically linked only.
15751 @item -mstrict-align
15752 @itemx -mno-strict-align
15753 @opindex mstrict-align
15754 @opindex mno-strict-align
15755 Avoid or allow generating memory accesses that may not be aligned on a natural
15756 object boundary as described in the architecture specification.
15758 @item -momit-leaf-frame-pointer
15759 @itemx -mno-omit-leaf-frame-pointer
15760 @opindex momit-leaf-frame-pointer
15761 @opindex mno-omit-leaf-frame-pointer
15762 Omit or keep the frame pointer in leaf functions.  The former behavior is the
15763 default.
15765 @item -mstack-protector-guard=@var{guard}
15766 @itemx -mstack-protector-guard-reg=@var{reg}
15767 @itemx -mstack-protector-guard-offset=@var{offset}
15768 @opindex mstack-protector-guard
15769 @opindex mstack-protector-guard-reg
15770 @opindex mstack-protector-guard-offset
15771 Generate stack protection code using canary at @var{guard}.  Supported
15772 locations are @samp{global} for a global canary or @samp{sysreg} for a
15773 canary in an appropriate system register.
15775 With the latter choice the options
15776 @option{-mstack-protector-guard-reg=@var{reg}} and
15777 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15778 which system register to use as base register for reading the canary,
15779 and from what offset from that base register. There is no default
15780 register or offset as this is entirely for use within the Linux
15781 kernel.
15783 @item -mstack-protector-guard=@var{guard}
15784 @itemx -mstack-protector-guard-reg=@var{reg}
15785 @itemx -mstack-protector-guard-offset=@var{offset}
15786 @opindex mstack-protector-guard
15787 @opindex mstack-protector-guard-reg
15788 @opindex mstack-protector-guard-offset
15789 Generate stack protection code using canary at @var{guard}.  Supported
15790 locations are @samp{global} for a global canary or @samp{sysreg} for a
15791 canary in an appropriate system register.
15793 With the latter choice the options
15794 @option{-mstack-protector-guard-reg=@var{reg}} and
15795 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15796 which system register to use as base register for reading the canary,
15797 and from what offset from that base register. There is no default
15798 register or offset as this is entirely for use within the Linux
15799 kernel.
15801 @item -mtls-dialect=desc
15802 @opindex mtls-dialect=desc
15803 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15804 of TLS variables.  This is the default.
15806 @item -mtls-dialect=traditional
15807 @opindex mtls-dialect=traditional
15808 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15809 of TLS variables.
15811 @item -mtls-size=@var{size}
15812 @opindex mtls-size
15813 Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
15814 This option requires binutils 2.26 or newer.
15816 @item -mfix-cortex-a53-835769
15817 @itemx -mno-fix-cortex-a53-835769
15818 @opindex mfix-cortex-a53-835769
15819 @opindex mno-fix-cortex-a53-835769
15820 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15821 This involves inserting a NOP instruction between memory instructions and
15822 64-bit integer multiply-accumulate instructions.
15824 @item -mfix-cortex-a53-843419
15825 @itemx -mno-fix-cortex-a53-843419
15826 @opindex mfix-cortex-a53-843419
15827 @opindex mno-fix-cortex-a53-843419
15828 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15829 This erratum workaround is made at link time and this will only pass the
15830 corresponding flag to the linker.
15832 @item -mlow-precision-recip-sqrt
15833 @itemx -mno-low-precision-recip-sqrt
15834 @opindex mlow-precision-recip-sqrt
15835 @opindex mno-low-precision-recip-sqrt
15836 Enable or disable the reciprocal square root approximation.
15837 This option only has an effect if @option{-ffast-math} or
15838 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
15839 precision of reciprocal square root results to about 16 bits for
15840 single precision and to 32 bits for double precision.
15842 @item -mlow-precision-sqrt
15843 @itemx -mno-low-precision-sqrt
15844 @opindex mlow-precision-sqrt
15845 @opindex mno-low-precision-sqrt
15846 Enable or disable the square root approximation.
15847 This option only has an effect if @option{-ffast-math} or
15848 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
15849 precision of square root results to about 16 bits for
15850 single precision and to 32 bits for double precision.
15851 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15853 @item -mlow-precision-div
15854 @itemx -mno-low-precision-div
15855 @opindex mlow-precision-div
15856 @opindex mno-low-precision-div
15857 Enable or disable the division approximation.
15858 This option only has an effect if @option{-ffast-math} or
15859 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
15860 precision of division results to about 16 bits for
15861 single precision and to 32 bits for double precision.
15863 @item -mtrack-speculation
15864 @itemx -mno-track-speculation
15865 Enable or disable generation of additional code to track speculative
15866 execution through conditional branches.  The tracking state can then
15867 be used by the compiler when expanding calls to
15868 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15869 sequence to be generated.
15871 @item -march=@var{name}
15872 @opindex march
15873 Specify the name of the target architecture and, optionally, one or
15874 more feature modifiers.  This option has the form
15875 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15877 The permissible values for @var{arch} are @samp{armv8-a},
15878 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15879 @samp{armv8.5-a} or @var{native}.
15881 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15882 support for the ARMv8.5-A architecture extensions.
15884 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15885 support for the ARMv8.4-A architecture extensions.
15887 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15888 support for the ARMv8.3-A architecture extensions.
15890 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15891 support for the ARMv8.2-A architecture extensions.
15893 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15894 support for the ARMv8.1-A architecture extension.  In particular, it
15895 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15897 The value @samp{native} is available on native AArch64 GNU/Linux and
15898 causes the compiler to pick the architecture of the host system.  This
15899 option has no effect if the compiler is unable to recognize the
15900 architecture of the host system,
15902 The permissible values for @var{feature} are listed in the sub-section
15903 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15904 Feature Modifiers}.  Where conflicting feature modifiers are
15905 specified, the right-most feature is used.
15907 GCC uses @var{name} to determine what kind of instructions it can emit
15908 when generating assembly code.  If @option{-march} is specified
15909 without either of @option{-mtune} or @option{-mcpu} also being
15910 specified, the code is tuned to perform well across a range of target
15911 processors implementing the target architecture.
15913 @item -mtune=@var{name}
15914 @opindex mtune
15915 Specify the name of the target processor for which GCC should tune the
15916 performance of the code.  Permissible values for this option are:
15917 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15918 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15919 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
15920 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
15921 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15922 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
15923 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
15924 @samp{octeontx81},  @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
15925 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
15926 @samp{thunderxt83}, @samp{thunderx2t99},
15927 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15928 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15929 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15930 @samp{native}.
15932 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15933 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15934 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15935 should tune for a big.LITTLE system.
15937 Additionally on native AArch64 GNU/Linux systems the value
15938 @samp{native} tunes performance to the host system.  This option has no effect
15939 if the compiler is unable to recognize the processor of the host system.
15941 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15942 are specified, the code is tuned to perform well across a range
15943 of target processors.
15945 This option cannot be suffixed by feature modifiers.
15947 @item -mcpu=@var{name}
15948 @opindex mcpu
15949 Specify the name of the target processor, optionally suffixed by one
15950 or more feature modifiers.  This option has the form
15951 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15952 the permissible values for @var{cpu} are the same as those available
15953 for @option{-mtune}.  The permissible values for @var{feature} are
15954 documented in the sub-section on
15955 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15956 Feature Modifiers}.  Where conflicting feature modifiers are
15957 specified, the right-most feature is used.
15959 GCC uses @var{name} to determine what kind of instructions it can emit when
15960 generating assembly code (as if by @option{-march}) and to determine
15961 the target processor for which to tune for performance (as if
15962 by @option{-mtune}).  Where this option is used in conjunction
15963 with @option{-march} or @option{-mtune}, those options take precedence
15964 over the appropriate part of this option.
15966 @item -moverride=@var{string}
15967 @opindex moverride
15968 Override tuning decisions made by the back-end in response to a
15969 @option{-mtune=} switch.  The syntax, semantics, and accepted values
15970 for @var{string} in this option are not guaranteed to be consistent
15971 across releases.
15973 This option is only intended to be useful when developing GCC.
15975 @item -mverbose-cost-dump
15976 @opindex mverbose-cost-dump
15977 Enable verbose cost model dumping in the debug dump files.  This option is
15978 provided for use in debugging the compiler.
15980 @item -mpc-relative-literal-loads
15981 @itemx -mno-pc-relative-literal-loads
15982 @opindex mpc-relative-literal-loads
15983 @opindex mno-pc-relative-literal-loads
15984 Enable or disable PC-relative literal loads.  With this option literal pools are
15985 accessed using a single instruction and emitted after each function.  This
15986 limits the maximum size of functions to 1MB.  This is enabled by default for
15987 @option{-mcmodel=tiny}.
15989 @item -msign-return-address=@var{scope}
15990 @opindex msign-return-address
15991 Select the function scope on which return address signing will be applied.
15992 Permissible values are @samp{none}, which disables return address signing,
15993 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15994 functions, and @samp{all}, which enables pointer signing for all functions.  The
15995 default value is @samp{none}. This option has been deprecated by
15996 -mbranch-protection.
15998 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
15999 @opindex mbranch-protection
16000 Select the branch protection features to use.
16001 @samp{none} is the default and turns off all types of branch protection.
16002 @samp{standard} turns on all types of branch protection features.  If a feature
16003 has additional tuning options, then @samp{standard} sets it to its standard
16004 level.
16005 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
16006 level: signing functions that save the return address to memory (non-leaf
16007 functions will practically always do this) using the a-key.  The optional
16008 argument @samp{leaf} can be used to extend the signing to include leaf
16009 functions.  The optional argument @samp{b-key} can be used to sign the functions
16010 with the B-key instead of the A-key.
16011 @samp{bti} turns on branch target identification mechanism.
16013 @item -msve-vector-bits=@var{bits}
16014 @opindex msve-vector-bits
16015 Specify the number of bits in an SVE vector register.  This option only has
16016 an effect when SVE is enabled.
16018 GCC supports two forms of SVE code generation: ``vector-length
16019 agnostic'' output that works with any size of vector register and
16020 ``vector-length specific'' output that allows GCC to make assumptions
16021 about the vector length when it is useful for optimization reasons.
16022 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
16023 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
16024 Specifying @samp{scalable} selects vector-length agnostic
16025 output.  At present @samp{-msve-vector-bits=128} also generates vector-length
16026 agnostic output.  All other values generate vector-length specific code.
16027 The behavior of these values may change in future releases and no value except
16028 @samp{scalable} should be relied on for producing code that is portable across
16029 different hardware SVE vector lengths.
16031 The default is @samp{-msve-vector-bits=scalable}, which produces
16032 vector-length agnostic code.
16033 @end table
16035 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16036 @anchor{aarch64-feature-modifiers}
16037 @cindex @option{-march} feature modifiers
16038 @cindex @option{-mcpu} feature modifiers
16039 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16040 the following and their inverses @option{no@var{feature}}:
16042 @table @samp
16043 @item crc
16044 Enable CRC extension.  This is on by default for
16045 @option{-march=armv8.1-a}.
16046 @item crypto
16047 Enable Crypto extension.  This also enables Advanced SIMD and floating-point
16048 instructions.
16049 @item fp
16050 Enable floating-point instructions.  This is on by default for all possible
16051 values for options @option{-march} and @option{-mcpu}.
16052 @item simd
16053 Enable Advanced SIMD instructions.  This also enables floating-point
16054 instructions.  This is on by default for all possible values for options
16055 @option{-march} and @option{-mcpu}.
16056 @item sve
16057 Enable Scalable Vector Extension instructions.  This also enables Advanced
16058 SIMD and floating-point instructions.
16059 @item lse
16060 Enable Large System Extension instructions.  This is on by default for
16061 @option{-march=armv8.1-a}.
16062 @item rdma
16063 Enable Round Double Multiply Accumulate instructions.  This is on by default
16064 for @option{-march=armv8.1-a}.
16065 @item fp16
16066 Enable FP16 extension.  This also enables floating-point instructions.
16067 @item fp16fml
16068 Enable FP16 fmla extension.  This also enables FP16 extensions and
16069 floating-point instructions. This option is enabled by default for @option{-march=armv8.4-a}. Use of this option with architectures prior to Armv8.2-A is not supported.
16071 @item rcpc
16072 Enable the RcPc extension.  This does not change code generation from GCC,
16073 but is passed on to the assembler, enabling inline asm statements to use
16074 instructions from the RcPc extension.
16075 @item dotprod
16076 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
16077 @item aes
16078 Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
16079 SIMD instructions.
16080 @item sha2
16081 Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
16082 @item sha3
16083 Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
16084 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16085 @item sm4
16086 Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
16087 Use of this option with architectures prior to Armv8.2-A is not supported.
16088 @item profile
16089 Enable the Statistical Profiling extension.  This option is only to enable the
16090 extension at the assembler level and does not affect code generation.
16091 @item rng
16092 Enable the Armv8.5-a Random Number instructions.  This option is only to
16093 enable the extension at the assembler level and does not affect code
16094 generation.
16095 @item memtag
16096 Enable the Armv8.5-a Memory Tagging Extensions.  This option is only to
16097 enable the extension at the assembler level and does not affect code
16098 generation.
16099 @item sb
16100 Enable the Armv8-a Speculation Barrier instruction.  This option is only to
16101 enable the extension at the assembler level and does not affect code
16102 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
16103 @item ssbs
16104 Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
16105 is only to enable the extension at the assembler level and does not affect code
16106 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
16107 @item predres
16108 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16109 This option is only to enable the extension at the assembler level and does
16110 not affect code generation.  This option is enabled by default for
16111 @item sve2
16112 Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
16113 instructions.
16114 @item sve2-bitperm
16115 Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
16116 @item sve2-sm4
16117 Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
16118 @item sve2-aes
16119 Enable SVE2 aes instructions.  This also enables SVE2 instructions.
16120 @item sve2-sha3
16121 Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
16122 @option{-march=armv8.5-a}.
16123 @item tme
16124 Enable the Transactional Memory Extension.
16126 @end table
16128 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16129 which implies @option{fp}.
16130 Conversely, @option{nofp} implies @option{nosimd}, which implies
16131 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16133 @node Adapteva Epiphany Options
16134 @subsection Adapteva Epiphany Options
16136 These @samp{-m} options are defined for Adapteva Epiphany:
16138 @table @gcctabopt
16139 @item -mhalf-reg-file
16140 @opindex mhalf-reg-file
16141 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16142 That allows code to run on hardware variants that lack these registers.
16144 @item -mprefer-short-insn-regs
16145 @opindex mprefer-short-insn-regs
16146 Preferentially allocate registers that allow short instruction generation.
16147 This can result in increased instruction count, so this may either reduce or
16148 increase overall code size.
16150 @item -mbranch-cost=@var{num}
16151 @opindex mbranch-cost
16152 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16153 This cost is only a heuristic and is not guaranteed to produce
16154 consistent results across releases.
16156 @item -mcmove
16157 @opindex mcmove
16158 Enable the generation of conditional moves.
16160 @item -mnops=@var{num}
16161 @opindex mnops
16162 Emit @var{num} NOPs before every other generated instruction.
16164 @item -mno-soft-cmpsf
16165 @opindex mno-soft-cmpsf
16166 @opindex msoft-cmpsf
16167 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16168 and test the flags.  This is faster than a software comparison, but can
16169 get incorrect results in the presence of NaNs, or when two different small
16170 numbers are compared such that their difference is calculated as zero.
16171 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16172 software comparisons.
16174 @item -mstack-offset=@var{num}
16175 @opindex mstack-offset
16176 Set the offset between the top of the stack and the stack pointer.
16177 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16178 can be used by leaf functions without stack allocation.
16179 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16180 Note also that this option changes the ABI; compiling a program with a
16181 different stack offset than the libraries have been compiled with
16182 generally does not work.
16183 This option can be useful if you want to evaluate if a different stack
16184 offset would give you better code, but to actually use a different stack
16185 offset to build working programs, it is recommended to configure the
16186 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16188 @item -mno-round-nearest
16189 @opindex mno-round-nearest
16190 @opindex mround-nearest
16191 Make the scheduler assume that the rounding mode has been set to
16192 truncating.  The default is @option{-mround-nearest}.
16194 @item -mlong-calls
16195 @opindex mlong-calls
16196 If not otherwise specified by an attribute, assume all calls might be beyond
16197 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16198 function address into a register before performing a (otherwise direct) call.
16199 This is the default.
16201 @item -mshort-calls
16202 @opindex short-calls
16203 If not otherwise specified by an attribute, assume all direct calls are
16204 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16205 for direct calls.  The default is @option{-mlong-calls}.
16207 @item -msmall16
16208 @opindex msmall16
16209 Assume addresses can be loaded as 16-bit unsigned values.  This does not
16210 apply to function addresses for which @option{-mlong-calls} semantics
16211 are in effect.
16213 @item -mfp-mode=@var{mode}
16214 @opindex mfp-mode
16215 Set the prevailing mode of the floating-point unit.
16216 This determines the floating-point mode that is provided and expected
16217 at function call and return time.  Making this mode match the mode you
16218 predominantly need at function start can make your programs smaller and
16219 faster by avoiding unnecessary mode switches.
16221 @var{mode} can be set to one the following values:
16223 @table @samp
16224 @item caller
16225 Any mode at function entry is valid, and retained or restored when
16226 the function returns, and when it calls other functions.
16227 This mode is useful for compiling libraries or other compilation units
16228 you might want to incorporate into different programs with different
16229 prevailing FPU modes, and the convenience of being able to use a single
16230 object file outweighs the size and speed overhead for any extra
16231 mode switching that might be needed, compared with what would be needed
16232 with a more specific choice of prevailing FPU mode.
16234 @item truncate
16235 This is the mode used for floating-point calculations with
16236 truncating (i.e.@: round towards zero) rounding mode.  That includes
16237 conversion from floating point to integer.
16239 @item round-nearest
16240 This is the mode used for floating-point calculations with
16241 round-to-nearest-or-even rounding mode.
16243 @item int
16244 This is the mode used to perform integer calculations in the FPU, e.g.@:
16245 integer multiply, or integer multiply-and-accumulate.
16246 @end table
16248 The default is @option{-mfp-mode=caller}
16250 @item -mno-split-lohi
16251 @itemx -mno-postinc
16252 @itemx -mno-postmodify
16253 @opindex mno-split-lohi
16254 @opindex msplit-lohi
16255 @opindex mno-postinc
16256 @opindex mpostinc
16257 @opindex mno-postmodify
16258 @opindex mpostmodify
16259 Code generation tweaks that disable, respectively, splitting of 32-bit
16260 loads, generation of post-increment addresses, and generation of
16261 post-modify addresses.  The defaults are @option{msplit-lohi},
16262 @option{-mpost-inc}, and @option{-mpost-modify}.
16264 @item -mnovect-double
16265 @opindex mno-vect-double
16266 @opindex mvect-double
16267 Change the preferred SIMD mode to SImode.  The default is
16268 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16270 @item -max-vect-align=@var{num}
16271 @opindex max-vect-align
16272 The maximum alignment for SIMD vector mode types.
16273 @var{num} may be 4 or 8.  The default is 8.
16274 Note that this is an ABI change, even though many library function
16275 interfaces are unaffected if they don't use SIMD vector modes
16276 in places that affect size and/or alignment of relevant types.
16278 @item -msplit-vecmove-early
16279 @opindex msplit-vecmove-early
16280 Split vector moves into single word moves before reload.  In theory this
16281 can give better register allocation, but so far the reverse seems to be
16282 generally the case.
16284 @item -m1reg-@var{reg}
16285 @opindex m1reg-
16286 Specify a register to hold the constant @minus{}1, which makes loading small negative
16287 constants and certain bitmasks faster.
16288 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16289 which specify use of that register as a fixed register,
16290 and @samp{none}, which means that no register is used for this
16291 purpose.  The default is @option{-m1reg-none}.
16293 @end table
16295 @node AMD GCN Options
16296 @subsection AMD GCN Options
16297 @cindex AMD GCN Options
16299 These options are defined specifically for the AMD GCN port.
16301 @table @gcctabopt
16303 @item -march=@var{gpu}
16304 @opindex march
16305 @itemx -mtune=@var{gpu}
16306 @opindex mtune
16307 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16310 @table @samp
16311 @opindex fiji
16312 @item fiji
16313 Compile for GCN3 Fiji devices (gfx803).
16315 @item gfx900
16316 Compile for GCN5 Vega 10 devices (gfx900).
16318 @item gfx906
16319 Compile for GCN5 Vega 20 devices (gfx906).
16321 @end table
16323 @item -mstack-size=@var{bytes}
16324 @opindex mstack-size
16325 Specify how many @var{bytes} of stack space will be requested for each GPU
16326 thread (wave-front).  Beware that there may be many threads and limited memory
16327 available.  The size of the stack allocation may also have an impact on
16328 run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
16329 1MB otherwise.
16331 @end table
16333 @node ARC Options
16334 @subsection ARC Options
16335 @cindex ARC options
16337 The following options control the architecture variant for which code
16338 is being compiled:
16340 @c architecture variants
16341 @table @gcctabopt
16343 @item -mbarrel-shifter
16344 @opindex mbarrel-shifter
16345 Generate instructions supported by barrel shifter.  This is the default
16346 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16348 @item -mjli-always
16349 @opindex mjli-alawys
16350 Force to call a function using jli_s instruction.  This option is
16351 valid only for ARCv2 architecture.
16353 @item -mcpu=@var{cpu}
16354 @opindex mcpu
16355 Set architecture type, register usage, and instruction scheduling
16356 parameters for @var{cpu}.  There are also shortcut alias options
16357 available for backward compatibility and convenience.  Supported
16358 values for @var{cpu} are
16360 @table @samp
16361 @opindex mA6
16362 @opindex mARC600
16363 @item arc600
16364 Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
16366 @item arc601
16367 @opindex mARC601
16368 Compile for ARC601.  Alias: @option{-mARC601}.
16370 @item arc700
16371 @opindex mA7
16372 @opindex mARC700
16373 Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
16374 This is the default when configured with @option{--with-cpu=arc700}@.
16376 @item arcem
16377 Compile for ARC EM.
16379 @item archs
16380 Compile for ARC HS.
16382 @item em
16383 Compile for ARC EM CPU with no hardware extensions.
16385 @item em4
16386 Compile for ARC EM4 CPU.
16388 @item em4_dmips
16389 Compile for ARC EM4 DMIPS CPU.
16391 @item em4_fpus
16392 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16393 extension.
16395 @item em4_fpuda
16396 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16397 double assist instructions.
16399 @item hs
16400 Compile for ARC HS CPU with no hardware extensions except the atomic
16401 instructions.
16403 @item hs34
16404 Compile for ARC HS34 CPU.
16406 @item hs38
16407 Compile for ARC HS38 CPU.
16409 @item hs38_linux
16410 Compile for ARC HS38 CPU with all hardware extensions on.
16412 @item arc600_norm
16413 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16415 @item arc600_mul32x16
16416 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 
16417 instructions enabled.
16419 @item arc600_mul64
16420 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 
16421 instructions enabled.
16423 @item arc601_norm
16424 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16426 @item arc601_mul32x16
16427 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16428 instructions enabled.
16430 @item arc601_mul64
16431 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16432 instructions enabled.
16434 @item nps400
16435 Compile for ARC 700 on NPS400 chip.
16437 @item em_mini
16438 Compile for ARC EM minimalist configuration featuring reduced register
16439 set.
16441 @end table
16443 @item -mdpfp
16444 @opindex mdpfp
16445 @itemx -mdpfp-compact
16446 @opindex mdpfp-compact
16447 Generate double-precision FPX instructions, tuned for the compact
16448 implementation.
16450 @item -mdpfp-fast
16451 @opindex mdpfp-fast
16452 Generate double-precision FPX instructions, tuned for the fast
16453 implementation.
16455 @item -mno-dpfp-lrsr
16456 @opindex mno-dpfp-lrsr
16457 Disable @code{lr} and @code{sr} instructions from using FPX extension
16458 aux registers.
16460 @item -mea
16461 @opindex mea
16462 Generate extended arithmetic instructions.  Currently only
16463 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16464 supported.  This is always enabled for @option{-mcpu=ARC700}.
16466 @item -mno-mpy
16467 @opindex mno-mpy
16468 @opindex mmpy
16469 Do not generate @code{mpy}-family instructions for ARC700.  This option is
16470 deprecated.
16472 @item -mmul32x16
16473 @opindex mmul32x16
16474 Generate 32x16-bit multiply and multiply-accumulate instructions.
16476 @item -mmul64
16477 @opindex mmul64
16478 Generate @code{mul64} and @code{mulu64} instructions.  
16479 Only valid for @option{-mcpu=ARC600}.
16481 @item -mnorm
16482 @opindex mnorm
16483 Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
16484 is in effect.
16486 @item -mspfp
16487 @opindex mspfp
16488 @itemx -mspfp-compact
16489 @opindex mspfp-compact
16490 Generate single-precision FPX instructions, tuned for the compact
16491 implementation.
16493 @item -mspfp-fast
16494 @opindex mspfp-fast
16495 Generate single-precision FPX instructions, tuned for the fast
16496 implementation.
16498 @item -msimd
16499 @opindex msimd
16500 Enable generation of ARC SIMD instructions via target-specific
16501 builtins.  Only valid for @option{-mcpu=ARC700}.
16503 @item -msoft-float
16504 @opindex msoft-float
16505 This option ignored; it is provided for compatibility purposes only.
16506 Software floating-point code is emitted by default, and this default
16507 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16508 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16509 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16511 @item -mswap
16512 @opindex mswap
16513 Generate @code{swap} instructions.
16515 @item -matomic
16516 @opindex matomic
16517 This enables use of the locked load/store conditional extension to implement
16518 atomic memory built-in functions.  Not available for ARC 6xx or ARC
16519 EM cores.
16521 @item -mdiv-rem
16522 @opindex mdiv-rem
16523 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16525 @item -mcode-density
16526 @opindex mcode-density
16527 Enable code density instructions for ARC EM.  
16528 This option is on by default for ARC HS.
16530 @item -mll64
16531 @opindex mll64
16532 Enable double load/store operations for ARC HS cores.
16534 @item -mtp-regno=@var{regno}
16535 @opindex mtp-regno
16536 Specify thread pointer register number.
16538 @item -mmpy-option=@var{multo}
16539 @opindex mmpy-option
16540 Compile ARCv2 code with a multiplier design option.  You can specify 
16541 the option using either a string or numeric value for @var{multo}.  
16542 @samp{wlh1} is the default value.  The recognized values are:
16544 @table @samp
16545 @item 0
16546 @itemx none
16547 No multiplier available.
16549 @item 1
16550 @itemx w
16551 16x16 multiplier, fully pipelined.
16552 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16554 @item 2
16555 @itemx wlh1
16556 32x32 multiplier, fully
16557 pipelined (1 stage).  The following instructions are additionally
16558 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16560 @item 3
16561 @itemx wlh2
16562 32x32 multiplier, fully pipelined
16563 (2 stages).  The following instructions are additionally enabled: @code{mpy},
16564 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16566 @item 4
16567 @itemx wlh3
16568 Two 16x16 multipliers, blocking,
16569 sequential.  The following instructions are additionally enabled: @code{mpy},
16570 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16572 @item 5
16573 @itemx wlh4
16574 One 16x16 multiplier, blocking,
16575 sequential.  The following instructions are additionally enabled: @code{mpy},
16576 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16578 @item 6
16579 @itemx wlh5
16580 One 32x4 multiplier, blocking,
16581 sequential.  The following instructions are additionally enabled: @code{mpy},
16582 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16584 @item 7
16585 @itemx plus_dmpy
16586 ARC HS SIMD support.
16588 @item 8
16589 @itemx plus_macd
16590 ARC HS SIMD support.
16592 @item 9
16593 @itemx plus_qmacw
16594 ARC HS SIMD support.
16596 @end table
16598 This option is only available for ARCv2 cores@.
16600 @item -mfpu=@var{fpu}
16601 @opindex mfpu
16602 Enables support for specific floating-point hardware extensions for ARCv2
16603 cores.  Supported values for @var{fpu} are:
16605 @table @samp
16607 @item fpus
16608 Enables support for single-precision floating-point hardware
16609 extensions@.
16611 @item fpud
16612 Enables support for double-precision floating-point hardware
16613 extensions.  The single-precision floating-point extension is also
16614 enabled.  Not available for ARC EM@.
16616 @item fpuda
16617 Enables support for double-precision floating-point hardware
16618 extensions using double-precision assist instructions.  The single-precision
16619 floating-point extension is also enabled.  This option is
16620 only available for ARC EM@.
16622 @item fpuda_div
16623 Enables support for double-precision floating-point hardware
16624 extensions using double-precision assist instructions.
16625 The single-precision floating-point, square-root, and divide 
16626 extensions are also enabled.  This option is
16627 only available for ARC EM@.
16629 @item fpuda_fma
16630 Enables support for double-precision floating-point hardware
16631 extensions using double-precision assist instructions.
16632 The single-precision floating-point and fused multiply and add 
16633 hardware extensions are also enabled.  This option is
16634 only available for ARC EM@.
16636 @item fpuda_all
16637 Enables support for double-precision floating-point hardware
16638 extensions using double-precision assist instructions.
16639 All single-precision floating-point hardware extensions are also
16640 enabled.  This option is only available for ARC EM@.
16642 @item fpus_div
16643 Enables support for single-precision floating-point, square-root and divide 
16644 hardware extensions@.
16646 @item fpud_div
16647 Enables support for double-precision floating-point, square-root and divide 
16648 hardware extensions.  This option
16649 includes option @samp{fpus_div}. Not available for ARC EM@.
16651 @item fpus_fma
16652 Enables support for single-precision floating-point and 
16653 fused multiply and add hardware extensions@.
16655 @item fpud_fma
16656 Enables support for double-precision floating-point and 
16657 fused multiply and add hardware extensions.  This option
16658 includes option @samp{fpus_fma}.  Not available for ARC EM@.
16660 @item fpus_all
16661 Enables support for all single-precision floating-point hardware
16662 extensions@.
16664 @item fpud_all
16665 Enables support for all single- and double-precision floating-point
16666 hardware extensions.  Not available for ARC EM@.
16668 @end table
16670 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16671 @opindex mirq-ctrl-saved
16672 Specifies general-purposes registers that the processor automatically
16673 saves/restores on interrupt entry and exit.  @var{register-range} is
16674 specified as two registers separated by a dash.  The register range
16675 always starts with @code{r0}, the upper limit is @code{fp} register.
16676 @var{blink} and @var{lp_count} are optional.  This option is only
16677 valid for ARC EM and ARC HS cores.
16679 @item -mrgf-banked-regs=@var{number}
16680 @opindex mrgf-banked-regs
16681 Specifies the number of registers replicated in second register bank
16682 on entry to fast interrupt.  Fast interrupts are interrupts with the
16683 highest priority level P0.  These interrupts save only PC and STATUS32
16684 registers to avoid memory transactions during interrupt entry and exit
16685 sequences.  Use this option when you are using fast interrupts in an
16686 ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
16688 @item -mlpc-width=@var{width}
16689 @opindex mlpc-width
16690 Specify the width of the @code{lp_count} register.  Valid values for
16691 @var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
16692 fixed to 32 bits.  If the width is less than 32, the compiler does not
16693 attempt to transform loops in your program to use the zero-delay loop
16694 mechanism unless it is known that the @code{lp_count} register can
16695 hold the required loop-counter value.  Depending on the width
16696 specified, the compiler and run-time library might continue to use the
16697 loop mechanism for various needs.  This option defines macro
16698 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16700 @item -mrf16
16701 @opindex mrf16
16702 This option instructs the compiler to generate code for a 16-entry
16703 register file.  This option defines the @code{__ARC_RF16__}
16704 preprocessor macro.
16706 @item -mbranch-index
16707 @opindex mbranch-index
16708 Enable use of @code{bi} or @code{bih} instructions to implement jump
16709 tables.
16711 @end table
16713 The following options are passed through to the assembler, and also
16714 define preprocessor macro symbols.
16716 @c Flags used by the assembler, but for which we define preprocessor
16717 @c macro symbols as well.
16718 @table @gcctabopt
16719 @item -mdsp-packa
16720 @opindex mdsp-packa
16721 Passed down to the assembler to enable the DSP Pack A extensions.
16722 Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
16723 deprecated.
16725 @item -mdvbf
16726 @opindex mdvbf
16727 Passed down to the assembler to enable the dual Viterbi butterfly
16728 extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
16729 option is deprecated.
16731 @c ARC700 4.10 extension instruction
16732 @item -mlock
16733 @opindex mlock
16734 Passed down to the assembler to enable the locked load/store
16735 conditional extension.  Also sets the preprocessor symbol
16736 @code{__Xlock}.
16738 @item -mmac-d16
16739 @opindex mmac-d16
16740 Passed down to the assembler.  Also sets the preprocessor symbol
16741 @code{__Xxmac_d16}.  This option is deprecated.
16743 @item -mmac-24
16744 @opindex mmac-24
16745 Passed down to the assembler.  Also sets the preprocessor symbol
16746 @code{__Xxmac_24}.  This option is deprecated.
16748 @c ARC700 4.10 extension instruction
16749 @item -mrtsc
16750 @opindex mrtsc
16751 Passed down to the assembler to enable the 64-bit time-stamp counter
16752 extension instruction.  Also sets the preprocessor symbol
16753 @code{__Xrtsc}.  This option is deprecated.
16755 @c ARC700 4.10 extension instruction
16756 @item -mswape
16757 @opindex mswape
16758 Passed down to the assembler to enable the swap byte ordering
16759 extension instruction.  Also sets the preprocessor symbol
16760 @code{__Xswape}.
16762 @item -mtelephony
16763 @opindex mtelephony
16764 Passed down to the assembler to enable dual- and single-operand
16765 instructions for telephony.  Also sets the preprocessor symbol
16766 @code{__Xtelephony}.  This option is deprecated.
16768 @item -mxy
16769 @opindex mxy
16770 Passed down to the assembler to enable the XY memory extension.  Also
16771 sets the preprocessor symbol @code{__Xxy}.
16773 @end table
16775 The following options control how the assembly code is annotated:
16777 @c Assembly annotation options
16778 @table @gcctabopt
16779 @item -misize
16780 @opindex misize
16781 Annotate assembler instructions with estimated addresses.
16783 @item -mannotate-align
16784 @opindex mannotate-align
16785 Explain what alignment considerations lead to the decision to make an
16786 instruction short or long.
16788 @end table
16790 The following options are passed through to the linker:
16792 @c options passed through to the linker
16793 @table @gcctabopt
16794 @item -marclinux
16795 @opindex marclinux
16796 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16797 This option is enabled by default in tool chains built for
16798 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16799 when profiling is not requested.
16801 @item -marclinux_prof
16802 @opindex marclinux_prof
16803 Passed through to the linker, to specify use of the
16804 @code{arclinux_prof} emulation.  This option is enabled by default in
16805 tool chains built for @w{@code{arc-linux-uclibc}} and
16806 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16808 @end table
16810 The following options control the semantics of generated code:
16812 @c semantically relevant code generation options
16813 @table @gcctabopt
16814 @item -mlong-calls
16815 @opindex mlong-calls
16816 Generate calls as register indirect calls, thus providing access
16817 to the full 32-bit address range.
16819 @item -mmedium-calls
16820 @opindex mmedium-calls
16821 Don't use less than 25-bit addressing range for calls, which is the
16822 offset available for an unconditional branch-and-link
16823 instruction.  Conditional execution of function calls is suppressed, to
16824 allow use of the 25-bit range, rather than the 21-bit range with
16825 conditional branch-and-link.  This is the default for tool chains built
16826 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16828 @item -G @var{num}
16829 @opindex G
16830 Put definitions of externally-visible data in a small data section if
16831 that data is no bigger than @var{num} bytes.  The default value of
16832 @var{num} is 4 for any ARC configuration, or 8 when we have double
16833 load/store operations.
16835 @item -mno-sdata
16836 @opindex mno-sdata
16837 @opindex msdata
16838 Do not generate sdata references.  This is the default for tool chains
16839 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16840 targets.
16842 @item -mvolatile-cache
16843 @opindex mvolatile-cache
16844 Use ordinarily cached memory accesses for volatile references.  This is the
16845 default.
16847 @item -mno-volatile-cache
16848 @opindex mno-volatile-cache
16849 @opindex mvolatile-cache
16850 Enable cache bypass for volatile references.
16852 @end table
16854 The following options fine tune code generation:
16855 @c code generation tuning options
16856 @table @gcctabopt
16857 @item -malign-call
16858 @opindex malign-call
16859 Do alignment optimizations for call instructions.
16861 @item -mauto-modify-reg
16862 @opindex mauto-modify-reg
16863 Enable the use of pre/post modify with register displacement.
16865 @item -mbbit-peephole
16866 @opindex mbbit-peephole
16867 Enable bbit peephole2.
16869 @item -mno-brcc
16870 @opindex mno-brcc
16871 This option disables a target-specific pass in @file{arc_reorg} to
16872 generate compare-and-branch (@code{br@var{cc}}) instructions.  
16873 It has no effect on
16874 generation of these instructions driven by the combiner pass.
16876 @item -mcase-vector-pcrel
16877 @opindex mcase-vector-pcrel
16878 Use PC-relative switch case tables to enable case table shortening.
16879 This is the default for @option{-Os}.
16881 @item -mcompact-casesi
16882 @opindex mcompact-casesi
16883 Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
16884 and only available for ARCv1 cores.  This option is deprecated.
16886 @item -mno-cond-exec
16887 @opindex mno-cond-exec
16888 Disable the ARCompact-specific pass to generate conditional 
16889 execution instructions.
16891 Due to delay slot scheduling and interactions between operand numbers,
16892 literal sizes, instruction lengths, and the support for conditional execution,
16893 the target-independent pass to generate conditional execution is often lacking,
16894 so the ARC port has kept a special pass around that tries to find more
16895 conditional execution generation opportunities after register allocation,
16896 branch shortening, and delay slot scheduling have been done.  This pass
16897 generally, but not always, improves performance and code size, at the cost of
16898 extra compilation time, which is why there is an option to switch it off.
16899 If you have a problem with call instructions exceeding their allowable
16900 offset range because they are conditionalized, you should consider using
16901 @option{-mmedium-calls} instead.
16903 @item -mearly-cbranchsi
16904 @opindex mearly-cbranchsi
16905 Enable pre-reload use of the @code{cbranchsi} pattern.
16907 @item -mexpand-adddi
16908 @opindex mexpand-adddi
16909 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16910 @code{add.f}, @code{adc} etc.  This option is deprecated.
16912 @item -mindexed-loads
16913 @opindex mindexed-loads
16914 Enable the use of indexed loads.  This can be problematic because some
16915 optimizers then assume that indexed stores exist, which is not
16916 the case.
16918 @item -mlra
16919 @opindex mlra
16920 Enable Local Register Allocation.  This is still experimental for ARC,
16921 so by default the compiler uses standard reload
16922 (i.e.@: @option{-mno-lra}).
16924 @item -mlra-priority-none
16925 @opindex mlra-priority-none
16926 Don't indicate any priority for target registers.
16928 @item -mlra-priority-compact
16929 @opindex mlra-priority-compact
16930 Indicate target register priority for r0..r3 / r12..r15.
16932 @item -mlra-priority-noncompact
16933 @opindex mlra-priority-noncompact
16934 Reduce target register priority for r0..r3 / r12..r15.
16936 @item -mmillicode
16937 @opindex mmillicode
16938 When optimizing for size (using @option{-Os}), prologues and epilogues
16939 that have to save or restore a large number of registers are often
16940 shortened by using call to a special function in libgcc; this is
16941 referred to as a @emph{millicode} call.  As these calls can pose
16942 performance issues, and/or cause linking issues when linking in a
16943 nonstandard way, this option is provided to turn on or off millicode
16944 call generation.
16946 @item -mcode-density-frame
16947 @opindex mcode-density-frame
16948 This option enable the compiler to emit @code{enter} and @code{leave}
16949 instructions.  These instructions are only valid for CPUs with
16950 code-density feature.
16952 @item -mmixed-code
16953 @opindex mmixed-code
16954 Tweak register allocation to help 16-bit instruction generation.
16955 This generally has the effect of decreasing the average instruction size
16956 while increasing the instruction count.
16958 @item -mq-class
16959 @opindex mq-class
16960 Enable @samp{q} instruction alternatives.
16961 This is the default for @option{-Os}.
16963 @item -mRcq
16964 @opindex mRcq
16965 Enable @samp{Rcq} constraint handling.  
16966 Most short code generation depends on this.
16967 This is the default.
16969 @item -mRcw
16970 @opindex mRcw
16971 Enable @samp{Rcw} constraint handling.  
16972 Most ccfsm condexec mostly depends on this.
16973 This is the default.
16975 @item -msize-level=@var{level}
16976 @opindex msize-level
16977 Fine-tune size optimization with regards to instruction lengths and alignment.
16978 The recognized values for @var{level} are:
16979 @table @samp
16980 @item 0
16981 No size optimization.  This level is deprecated and treated like @samp{1}.
16983 @item 1
16984 Short instructions are used opportunistically.
16986 @item 2
16987 In addition, alignment of loops and of code after barriers are dropped.
16989 @item 3
16990 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16992 @end table
16994 This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
16995 the behavior when this is not set is equivalent to level @samp{1}.
16997 @item -mtune=@var{cpu}
16998 @opindex mtune
16999 Set instruction scheduling parameters for @var{cpu}, overriding any implied
17000 by @option{-mcpu=}.
17002 Supported values for @var{cpu} are
17004 @table @samp
17005 @item ARC600
17006 Tune for ARC600 CPU.
17008 @item ARC601
17009 Tune for ARC601 CPU.
17011 @item ARC700
17012 Tune for ARC700 CPU with standard multiplier block.
17014 @item ARC700-xmac
17015 Tune for ARC700 CPU with XMAC block.
17017 @item ARC725D
17018 Tune for ARC725D CPU.
17020 @item ARC750D
17021 Tune for ARC750D CPU.
17023 @end table
17025 @item -mmultcost=@var{num}
17026 @opindex mmultcost
17027 Cost to assume for a multiply instruction, with @samp{4} being equal to a
17028 normal instruction.
17030 @item -munalign-prob-threshold=@var{probability}
17031 @opindex munalign-prob-threshold
17032 Set probability threshold for unaligning branches.
17033 When tuning for @samp{ARC700} and optimizing for speed, branches without
17034 filled delay slot are preferably emitted unaligned and long, unless
17035 profiling indicates that the probability for the branch to be taken
17036 is below @var{probability}.  @xref{Cross-profiling}.
17037 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
17039 @end table
17041 The following options are maintained for backward compatibility, but
17042 are now deprecated and will be removed in a future release:
17044 @c Deprecated options
17045 @table @gcctabopt
17047 @item -margonaut
17048 @opindex margonaut
17049 Obsolete FPX.
17051 @item -mbig-endian
17052 @opindex mbig-endian
17053 @itemx -EB
17054 @opindex EB
17055 Compile code for big-endian targets.  Use of these options is now
17056 deprecated.  Big-endian code is supported by configuring GCC to build
17057 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17058 for which big endian is the default.
17060 @item -mlittle-endian
17061 @opindex mlittle-endian
17062 @itemx -EL
17063 @opindex EL
17064 Compile code for little-endian targets.  Use of these options is now
17065 deprecated.  Little-endian code is supported by configuring GCC to build 
17066 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17067 for which little endian is the default.
17069 @item -mbarrel_shifter
17070 @opindex mbarrel_shifter
17071 Replaced by @option{-mbarrel-shifter}.
17073 @item -mdpfp_compact
17074 @opindex mdpfp_compact
17075 Replaced by @option{-mdpfp-compact}.
17077 @item -mdpfp_fast
17078 @opindex mdpfp_fast
17079 Replaced by @option{-mdpfp-fast}.
17081 @item -mdsp_packa
17082 @opindex mdsp_packa
17083 Replaced by @option{-mdsp-packa}.
17085 @item -mEA
17086 @opindex mEA
17087 Replaced by @option{-mea}.
17089 @item -mmac_24
17090 @opindex mmac_24
17091 Replaced by @option{-mmac-24}.
17093 @item -mmac_d16
17094 @opindex mmac_d16
17095 Replaced by @option{-mmac-d16}.
17097 @item -mspfp_compact
17098 @opindex mspfp_compact
17099 Replaced by @option{-mspfp-compact}.
17101 @item -mspfp_fast
17102 @opindex mspfp_fast
17103 Replaced by @option{-mspfp-fast}.
17105 @item -mtune=@var{cpu}
17106 @opindex mtune
17107 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17108 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17109 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17111 @item -multcost=@var{num}
17112 @opindex multcost
17113 Replaced by @option{-mmultcost}.
17115 @end table
17117 @node ARM Options
17118 @subsection ARM Options
17119 @cindex ARM options
17121 These @samp{-m} options are defined for the ARM port:
17123 @table @gcctabopt
17124 @item -mabi=@var{name}
17125 @opindex mabi
17126 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
17127 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17129 @item -mapcs-frame
17130 @opindex mapcs-frame
17131 Generate a stack frame that is compliant with the ARM Procedure Call
17132 Standard for all functions, even if this is not strictly necessary for
17133 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
17134 with this option causes the stack frames not to be generated for
17135 leaf functions.  The default is @option{-mno-apcs-frame}.
17136 This option is deprecated.
17138 @item -mapcs
17139 @opindex mapcs
17140 This is a synonym for @option{-mapcs-frame} and is deprecated.
17142 @ignore
17143 @c not currently implemented
17144 @item -mapcs-stack-check
17145 @opindex mapcs-stack-check
17146 Generate code to check the amount of stack space available upon entry to
17147 every function (that actually uses some stack space).  If there is
17148 insufficient space available then either the function
17149 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17150 called, depending upon the amount of stack space required.  The runtime
17151 system is required to provide these functions.  The default is
17152 @option{-mno-apcs-stack-check}, since this produces smaller code.
17154 @c not currently implemented
17155 @item -mapcs-reentrant
17156 @opindex mapcs-reentrant
17157 Generate reentrant, position-independent code.  The default is
17158 @option{-mno-apcs-reentrant}.
17159 @end ignore
17161 @item -mthumb-interwork
17162 @opindex mthumb-interwork
17163 Generate code that supports calling between the ARM and Thumb
17164 instruction sets.  Without this option, on pre-v5 architectures, the
17165 two instruction sets cannot be reliably used inside one program.  The
17166 default is @option{-mno-thumb-interwork}, since slightly larger code
17167 is generated when @option{-mthumb-interwork} is specified.  In AAPCS
17168 configurations this option is meaningless.
17170 @item -mno-sched-prolog
17171 @opindex mno-sched-prolog
17172 @opindex msched-prolog
17173 Prevent the reordering of instructions in the function prologue, or the
17174 merging of those instruction with the instructions in the function's
17175 body.  This means that all functions start with a recognizable set
17176 of instructions (or in fact one of a choice from a small set of
17177 different function prologues), and this information can be used to
17178 locate the start of functions inside an executable piece of code.  The
17179 default is @option{-msched-prolog}.
17181 @item -mfloat-abi=@var{name}
17182 @opindex mfloat-abi
17183 Specifies which floating-point ABI to use.  Permissible values
17184 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17186 Specifying @samp{soft} causes GCC to generate output containing
17187 library calls for floating-point operations.
17188 @samp{softfp} allows the generation of code using hardware floating-point
17189 instructions, but still uses the soft-float calling conventions.
17190 @samp{hard} allows generation of floating-point instructions
17191 and uses FPU-specific calling conventions.
17193 The default depends on the specific target configuration.  Note that
17194 the hard-float and soft-float ABIs are not link-compatible; you must
17195 compile your entire program with the same ABI, and link with a
17196 compatible set of libraries.
17198 @item -mgeneral-regs-only
17199 @opindex mgeneral-regs-only
17200 Generate code which uses only the general-purpose registers.  This will prevent
17201 the compiler from using floating-point and Advanced SIMD registers but will not
17202 impose any restrictions on the assembler.
17204 @item -mlittle-endian
17205 @opindex mlittle-endian
17206 Generate code for a processor running in little-endian mode.  This is
17207 the default for all standard configurations.
17209 @item -mbig-endian
17210 @opindex mbig-endian
17211 Generate code for a processor running in big-endian mode; the default is
17212 to compile code for a little-endian processor.
17214 @item -mbe8
17215 @itemx -mbe32
17216 @opindex mbe8
17217 When linking a big-endian image select between BE8 and BE32 formats.
17218 The option has no effect for little-endian images and is ignored.  The
17219 default is dependent on the selected target architecture.  For ARMv6
17220 and later architectures the default is BE8, for older architectures
17221 the default is BE32.  BE32 format has been deprecated by ARM.
17223 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17224 @opindex march
17225 This specifies the name of the target ARM architecture.  GCC uses this
17226 name to determine what kind of instructions it can emit when generating
17227 assembly code.  This option can be used in conjunction with or instead
17228 of the @option{-mcpu=} option.
17230 Permissible names are:
17231 @samp{armv4t},
17232 @samp{armv5t}, @samp{armv5te},
17233 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17234 @samp{armv6z}, @samp{armv6zk},
17235 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 
17236 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17237 @samp{armv8.4-a},
17238 @samp{armv8.5-a},
17239 @samp{armv7-r},
17240 @samp{armv8-r},
17241 @samp{armv6-m}, @samp{armv6s-m},
17242 @samp{armv7-m}, @samp{armv7e-m},
17243 @samp{armv8-m.base}, @samp{armv8-m.main},
17244 @samp{iwmmxt} and @samp{iwmmxt2}.
17246 Additionally, the following architectures, which lack support for the
17247 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17249 Many of the architectures support extensions.  These can be added by
17250 appending @samp{+@var{extension}} to the architecture name.  Extension
17251 options are processed in order and capabilities accumulate.  An extension
17252 will also enable any necessary base extensions
17253 upon which it depends.  For example, the @samp{+crypto} extension
17254 will always enable the @samp{+simd} extension.  The exception to the
17255 additive construction is for extensions that are prefixed with
17256 @samp{+no@dots{}}: these extensions disable the specified option and
17257 any other extensions that may depend on the presence of that
17258 extension.
17260 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17261 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17262 entirely disabled by the @samp{+nofp} option that follows it.
17264 Most extension names are generically named, but have an effect that is
17265 dependent upon the architecture to which it is applied.  For example,
17266 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17267 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17268 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17269 variant for @samp{armv8-a}.
17271 The table below lists the supported extensions for each architecture.
17272 Architectures not mentioned do not support any extensions.
17274 @table @samp
17275 @item armv5te
17276 @itemx armv6
17277 @itemx armv6j
17278 @itemx armv6k
17279 @itemx armv6kz
17280 @itemx armv6t2
17281 @itemx armv6z
17282 @itemx armv6zk
17283 @table @samp
17284 @item +fp
17285 The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
17286 used as an alias for this extension.
17288 @item +nofp
17289 Disable the floating-point instructions.
17290 @end table
17292 @item armv7
17293 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17294 @table @samp
17295 @item +fp
17296 The VFPv3 floating-point instructions, with 16 double-precision
17297 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
17298 for this extension.  Note that floating-point is not supported by the
17299 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17300 ARMv7-R architectures.
17302 @item +nofp
17303 Disable the floating-point instructions.
17304 @end table
17306 @item armv7-a
17307 @table @samp
17308 @item +mp
17309 The multiprocessing extension.
17311 @item +sec
17312 The security extension.
17314 @item +fp
17315 The VFPv3 floating-point instructions, with 16 double-precision
17316 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
17317 for this extension.
17319 @item +simd
17320 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17321 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17322 for this extension.
17324 @item +vfpv3
17325 The VFPv3 floating-point instructions, with 32 double-precision
17326 registers.
17328 @item +vfpv3-d16-fp16
17329 The VFPv3 floating-point instructions, with 16 double-precision
17330 registers and the half-precision floating-point conversion operations.
17332 @item +vfpv3-fp16
17333 The VFPv3 floating-point instructions, with 32 double-precision
17334 registers and the half-precision floating-point conversion operations.
17336 @item +vfpv4-d16
17337 The VFPv4 floating-point instructions, with 16 double-precision
17338 registers.
17340 @item +vfpv4
17341 The VFPv4 floating-point instructions, with 32 double-precision
17342 registers.
17344 @item +neon-fp16
17345 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17346 the half-precision floating-point conversion operations.
17348 @item +neon-vfpv4
17349 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17351 @item +nosimd
17352 Disable the Advanced SIMD instructions (does not disable floating point).
17354 @item +nofp
17355 Disable the floating-point and Advanced SIMD instructions.
17356 @end table
17358 @item armv7ve
17359 The extended version of the ARMv7-A architecture with support for
17360 virtualization.
17361 @table @samp
17362 @item +fp
17363 The VFPv4 floating-point instructions, with 16 double-precision registers.
17364 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17366 @item +simd
17367 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
17368 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17370 @item +vfpv3-d16
17371 The VFPv3 floating-point instructions, with 16 double-precision
17372 registers.
17374 @item +vfpv3
17375 The VFPv3 floating-point instructions, with 32 double-precision
17376 registers.
17378 @item +vfpv3-d16-fp16
17379 The VFPv3 floating-point instructions, with 16 double-precision
17380 registers and the half-precision floating-point conversion operations.
17382 @item +vfpv3-fp16
17383 The VFPv3 floating-point instructions, with 32 double-precision
17384 registers and the half-precision floating-point conversion operations.
17386 @item +vfpv4-d16
17387 The VFPv4 floating-point instructions, with 16 double-precision
17388 registers.
17390 @item +vfpv4
17391 The VFPv4 floating-point instructions, with 32 double-precision
17392 registers.
17394 @item +neon
17395 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17396 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17398 @item +neon-fp16
17399 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17400 the half-precision floating-point conversion operations.
17402 @item +nosimd
17403 Disable the Advanced SIMD instructions (does not disable floating point).
17405 @item +nofp
17406 Disable the floating-point and Advanced SIMD instructions.
17407 @end table
17409 @item armv8-a
17410 @table @samp
17411 @item +crc
17412 The Cyclic Redundancy Check (CRC) instructions.
17413 @item +simd
17414 The ARMv8-A Advanced SIMD and floating-point instructions.
17415 @item +crypto
17416 The cryptographic instructions.
17417 @item +nocrypto
17418 Disable the cryptographic instructions.
17419 @item +nofp
17420 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17421 @item +sb
17422 Speculation Barrier Instruction.
17423 @item +predres
17424 Execution and Data Prediction Restriction Instructions.
17425 @end table
17427 @item armv8.1-a
17428 @table @samp
17429 @item +simd
17430 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17432 @item +crypto
17433 The cryptographic instructions.  This also enables the Advanced SIMD and
17434 floating-point instructions.
17436 @item +nocrypto
17437 Disable the cryptographic instructions.
17439 @item +nofp
17440 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17442 @item +sb
17443 Speculation Barrier Instruction.
17445 @item +predres
17446 Execution and Data Prediction Restriction Instructions.
17447 @end table
17449 @item armv8.2-a
17450 @itemx armv8.3-a
17451 @table @samp
17452 @item +fp16
17453 The half-precision floating-point data processing instructions.
17454 This also enables the Advanced SIMD and floating-point instructions.
17456 @item +fp16fml
17457 The half-precision floating-point fmla extension.  This also enables
17458 the half-precision floating-point extension and Advanced SIMD and
17459 floating-point instructions.
17461 @item +simd
17462 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17464 @item +crypto
17465 The cryptographic instructions.  This also enables the Advanced SIMD and
17466 floating-point instructions.
17468 @item +dotprod
17469 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
17471 @item +nocrypto
17472 Disable the cryptographic extension.
17474 @item +nofp
17475 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17477 @item +sb
17478 Speculation Barrier Instruction.
17480 @item +predres
17481 Execution and Data Prediction Restriction Instructions.
17482 @end table
17484 @item armv8.4-a
17485 @table @samp
17486 @item +fp16
17487 The half-precision floating-point data processing instructions.
17488 This also enables the Advanced SIMD and floating-point instructions as well
17489 as the Dot Product extension and the half-precision floating-point fmla
17490 extension.
17492 @item +simd
17493 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17494 Dot Product extension.
17496 @item +crypto
17497 The cryptographic instructions.  This also enables the Advanced SIMD and
17498 floating-point instructions as well as the Dot Product extension.
17500 @item +nocrypto
17501 Disable the cryptographic extension.
17503 @item +nofp
17504 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17506 @item +sb
17507 Speculation Barrier Instruction.
17509 @item +predres
17510 Execution and Data Prediction Restriction Instructions.
17511 @end table
17513 @item armv8.5-a
17514 @table @samp
17515 @item +fp16
17516 The half-precision floating-point data processing instructions.
17517 This also enables the Advanced SIMD and floating-point instructions as well
17518 as the Dot Product extension and the half-precision floating-point fmla
17519 extension.
17521 @item +simd
17522 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17523 Dot Product extension.
17525 @item +crypto
17526 The cryptographic instructions.  This also enables the Advanced SIMD and
17527 floating-point instructions as well as the Dot Product extension.
17529 @item +nocrypto
17530 Disable the cryptographic extension.
17532 @item +nofp
17533 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17534 @end table
17536 @item armv7-r
17537 @table @samp
17538 @item +fp.sp
17539 The single-precision VFPv3 floating-point instructions.  The extension
17540 @samp{+vfpv3xd} can be used as an alias for this extension.
17542 @item +fp
17543 The VFPv3 floating-point instructions with 16 double-precision registers.
17544 The extension +vfpv3-d16 can be used as an alias for this extension.
17546 @item +vfpv3xd-d16-fp16
17547 The single-precision VFPv3 floating-point instructions with 16 double-precision
17548 registers and the half-precision floating-point conversion operations.
17550 @item +vfpv3-d16-fp16
17551 The VFPv3 floating-point instructions with 16 double-precision
17552 registers and the half-precision floating-point conversion operations.
17554 @item +nofp
17555 Disable the floating-point extension.
17557 @item +idiv
17558 The ARM-state integer division instructions.
17560 @item +noidiv
17561 Disable the ARM-state integer division extension.
17562 @end table
17564 @item armv7e-m
17565 @table @samp
17566 @item +fp
17567 The single-precision VFPv4 floating-point instructions.
17569 @item +fpv5
17570 The single-precision FPv5 floating-point instructions.
17572 @item +fp.dp
17573 The single- and double-precision FPv5 floating-point instructions.
17575 @item +nofp
17576 Disable the floating-point extensions.
17577 @end table
17579 @item  armv8-m.main
17580 @table @samp
17581 @item +dsp
17582 The DSP instructions.
17584 @item +nodsp
17585 Disable the DSP extension.
17587 @item +fp
17588 The single-precision floating-point instructions.
17590 @item +fp.dp
17591 The single- and double-precision floating-point instructions.
17593 @item +nofp
17594 Disable the floating-point extension.
17595 @end table
17597 @item armv8-r
17598 @table @samp
17599 @item +crc
17600 The Cyclic Redundancy Check (CRC) instructions.
17601 @item +fp.sp
17602 The single-precision FPv5 floating-point instructions.
17603 @item +simd
17604 The ARMv8-A Advanced SIMD and floating-point instructions.
17605 @item +crypto
17606 The cryptographic instructions.
17607 @item +nocrypto
17608 Disable the cryptographic instructions.
17609 @item +nofp
17610 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17611 @end table
17613 @end table
17615 @option{-march=native} causes the compiler to auto-detect the architecture
17616 of the build computer.  At present, this feature is only supported on
17617 GNU/Linux, and not all architectures are recognized.  If the auto-detect
17618 is unsuccessful the option has no effect.
17620 @item -mtune=@var{name}
17621 @opindex mtune
17622 This option specifies the name of the target ARM processor for
17623 which GCC should tune the performance of the code.
17624 For some ARM implementations better performance can be obtained by using
17625 this option.
17626 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17627 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17628 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17629 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17630 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17631 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17632 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17633 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17634 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17635 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17636 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17637 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17638 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17639 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
17640 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17641 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17642 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17643 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17644 @samp{cortex-m35p},
17645 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17646 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17647 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17648 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17649 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17651 Additionally, this option can specify that GCC should tune the performance
17652 of the code for a big.LITTLE system.  Permissible names are:
17653 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17654 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17655 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17656 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17658 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17659 performance for a blend of processors within architecture @var{arch}.
17660 The aim is to generate code that run well on the current most popular
17661 processors, balancing between optimizations that benefit some CPUs in the
17662 range, and avoiding performance pitfalls of other CPUs.  The effects of
17663 this option may change in future GCC versions as CPU models come and go.
17665 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17666 the extension options do not affect the tuning of the generated code.
17668 @option{-mtune=native} causes the compiler to auto-detect the CPU
17669 of the build computer.  At present, this feature is only supported on
17670 GNU/Linux, and not all architectures are recognized.  If the auto-detect is
17671 unsuccessful the option has no effect.
17673 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17674 @opindex mcpu
17675 This specifies the name of the target ARM processor.  GCC uses this name
17676 to derive the name of the target ARM architecture (as if specified
17677 by @option{-march}) and the ARM processor type for which to tune for
17678 performance (as if specified by @option{-mtune}).  Where this option
17679 is used in conjunction with @option{-march} or @option{-mtune},
17680 those options take precedence over the appropriate part of this option.
17682 Many of the supported CPUs implement optional architectural
17683 extensions.  Where this is so the architectural extensions are
17684 normally enabled by default.  If implementations that lack the
17685 extension exist, then the extension syntax can be used to disable
17686 those extensions that have been omitted.  For floating-point and
17687 Advanced SIMD (Neon) instructions, the settings of the options
17688 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17689 floating-point and Advanced SIMD instructions will only be used if
17690 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17691 @option{-mfpu} other than @samp{auto} will override the available
17692 floating-point and SIMD extension instructions.
17694 For example, @samp{cortex-a9} can be found in three major
17695 configurations: integer only, with just a floating-point unit or with
17696 floating-point and Advanced SIMD.  The default is to enable all the
17697 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17698 be used to disable just the SIMD or both the SIMD and floating-point
17699 instructions respectively.
17701 Permissible names for this option are the same as those for
17702 @option{-mtune}.
17704 The following extension options are common to the listed CPUs:
17706 @table @samp
17707 @item +nodsp
17708 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
17710 @item  +nofp
17711 Disables the floating-point instructions on @samp{arm9e},
17712 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17713 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17714 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17715 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
17716 Disables the floating-point and SIMD instructions on
17717 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17718 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17719 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17720 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17721 @samp{cortex-a53} and @samp{cortex-a55}.
17723 @item +nofp.dp
17724 Disables the double-precision component of the floating-point instructions
17725 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17726 @samp{cortex-m7}.
17728 @item +nosimd
17729 Disables the SIMD (but not floating-point) instructions on
17730 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17731 and @samp{cortex-a9}.
17733 @item +crypto
17734 Enables the cryptographic instructions on @samp{cortex-a32},
17735 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17736 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17737 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17738 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17739 @samp{cortex-a75.cortex-a55}.
17740 @end table
17742 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17743 VFPv3 with 16 double-precision registers.  It supports the following
17744 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17745 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17746 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17747 @samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
17748 the extensions to @option{-march=armv7-a}.
17750 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17751 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17752 See @option{-mtune} for more information.
17754 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17755 of the build computer.  At present, this feature is only supported on
17756 GNU/Linux, and not all architectures are recognized.  If the auto-detect
17757 is unsuccessful the option has no effect.
17759 @item -mfpu=@var{name}
17760 @opindex mfpu
17761 This specifies what floating-point hardware (or hardware emulation) is
17762 available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
17763 @samp{vfpv3},
17764 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17765 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17766 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17767 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17768 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17769 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17770 is an alias for @samp{vfpv2}.
17772 The setting @samp{auto} is the default and is special.  It causes the
17773 compiler to select the floating-point and Advanced SIMD instructions
17774 based on the settings of @option{-mcpu} and @option{-march}.
17776 If the selected floating-point hardware includes the NEON extension
17777 (e.g.@: @option{-mfpu=neon}), note that floating-point
17778 operations are not generated by GCC's auto-vectorization pass unless
17779 @option{-funsafe-math-optimizations} is also specified.  This is
17780 because NEON hardware does not fully implement the IEEE 754 standard for
17781 floating-point arithmetic (in particular denormal values are treated as
17782 zero), so the use of NEON instructions may lead to a loss of precision.
17784 You can also set the fpu name at function level by using the @code{target("fpu=")} function attributes (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17786 @item -mfp16-format=@var{name}
17787 @opindex mfp16-format
17788 Specify the format of the @code{__fp16} half-precision floating-point type.
17789 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17790 the default is @samp{none}, in which case the @code{__fp16} type is not
17791 defined.  @xref{Half-Precision}, for more information.
17793 @item -mstructure-size-boundary=@var{n}
17794 @opindex mstructure-size-boundary
17795 The sizes of all structures and unions are rounded up to a multiple
17796 of the number of bits set by this option.  Permissible values are 8, 32
17797 and 64.  The default value varies for different toolchains.  For the COFF
17798 targeted toolchain the default value is 8.  A value of 64 is only allowed
17799 if the underlying ABI supports it.
17801 Specifying a larger number can produce faster, more efficient code, but
17802 can also increase the size of the program.  Different values are potentially
17803 incompatible.  Code compiled with one value cannot necessarily expect to
17804 work with code or libraries compiled with another value, if they exchange
17805 information using structures or unions.
17807 This option is deprecated.
17809 @item -mabort-on-noreturn
17810 @opindex mabort-on-noreturn
17811 Generate a call to the function @code{abort} at the end of a
17812 @code{noreturn} function.  It is executed if the function tries to
17813 return.
17815 @item -mlong-calls
17816 @itemx -mno-long-calls
17817 @opindex mlong-calls
17818 @opindex mno-long-calls
17819 Tells the compiler to perform function calls by first loading the
17820 address of the function into a register and then performing a subroutine
17821 call on this register.  This switch is needed if the target function
17822 lies outside of the 64-megabyte addressing range of the offset-based
17823 version of subroutine call instruction.
17825 Even if this switch is enabled, not all function calls are turned
17826 into long calls.  The heuristic is that static functions, functions
17827 that have the @code{short_call} attribute, functions that are inside
17828 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17829 definitions have already been compiled within the current compilation
17830 unit are not turned into long calls.  The exceptions to this rule are
17831 that weak function definitions, functions with the @code{long_call}
17832 attribute or the @code{section} attribute, and functions that are within
17833 the scope of a @code{#pragma long_calls} directive are always
17834 turned into long calls.
17836 This feature is not enabled by default.  Specifying
17837 @option{-mno-long-calls} restores the default behavior, as does
17838 placing the function calls within the scope of a @code{#pragma
17839 long_calls_off} directive.  Note these switches have no effect on how
17840 the compiler generates code to handle function calls via function
17841 pointers.
17843 @item -msingle-pic-base
17844 @opindex msingle-pic-base
17845 Treat the register used for PIC addressing as read-only, rather than
17846 loading it in the prologue for each function.  The runtime system is
17847 responsible for initializing this register with an appropriate value
17848 before execution begins.
17850 @item -mpic-register=@var{reg}
17851 @opindex mpic-register
17852 Specify the register to be used for PIC addressing.
17853 For standard PIC base case, the default is any suitable register
17854 determined by compiler.  For single PIC base case, the default is
17855 @samp{R9} if target is EABI based or stack-checking is enabled,
17856 otherwise the default is @samp{R10}.
17858 @item -mpic-data-is-text-relative
17859 @opindex mpic-data-is-text-relative
17860 Assume that the displacement between the text and data segments is fixed
17861 at static link time.  This permits using PC-relative addressing
17862 operations to access data known to be in the data segment.  For
17863 non-VxWorks RTP targets, this option is enabled by default.  When
17864 disabled on such targets, it will enable @option{-msingle-pic-base} by
17865 default.
17867 @item -mpoke-function-name
17868 @opindex mpoke-function-name
17869 Write the name of each function into the text section, directly
17870 preceding the function prologue.  The generated code is similar to this:
17872 @smallexample
17873      t0
17874          .ascii "arm_poke_function_name", 0
17875          .align
17876      t1
17877          .word 0xff000000 + (t1 - t0)
17878      arm_poke_function_name
17879          mov     ip, sp
17880          stmfd   sp!, @{fp, ip, lr, pc@}
17881          sub     fp, ip, #4
17882 @end smallexample
17884 When performing a stack backtrace, code can inspect the value of
17885 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
17886 location @code{pc - 12} and the top 8 bits are set, then we know that
17887 there is a function name embedded immediately preceding this location
17888 and has length @code{((pc[-3]) & 0xff000000)}.
17890 @item -mthumb
17891 @itemx -marm
17892 @opindex marm
17893 @opindex mthumb
17895 Select between generating code that executes in ARM and Thumb
17896 states.  The default for most configurations is to generate code
17897 that executes in ARM state, but the default can be changed by
17898 configuring GCC with the @option{--with-mode=}@var{state}
17899 configure option.
17901 You can also override the ARM and Thumb mode for each function
17902 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17903 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17905 @item -mflip-thumb 
17906 @opindex mflip-thumb
17907 Switch ARM/Thumb modes on alternating functions.
17908 This option is provided for regression testing of mixed Thumb/ARM code
17909 generation, and is not intended for ordinary use in compiling code.
17911 @item -mtpcs-frame
17912 @opindex mtpcs-frame
17913 Generate a stack frame that is compliant with the Thumb Procedure Call
17914 Standard for all non-leaf functions.  (A leaf function is one that does
17915 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
17917 @item -mtpcs-leaf-frame
17918 @opindex mtpcs-leaf-frame
17919 Generate a stack frame that is compliant with the Thumb Procedure Call
17920 Standard for all leaf functions.  (A leaf function is one that does
17921 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
17923 @item -mcallee-super-interworking
17924 @opindex mcallee-super-interworking
17925 Gives all externally visible functions in the file being compiled an ARM
17926 instruction set header which switches to Thumb mode before executing the
17927 rest of the function.  This allows these functions to be called from
17928 non-interworking code.  This option is not valid in AAPCS configurations
17929 because interworking is enabled by default.
17931 @item -mcaller-super-interworking
17932 @opindex mcaller-super-interworking
17933 Allows calls via function pointers (including virtual functions) to
17934 execute correctly regardless of whether the target code has been
17935 compiled for interworking or not.  There is a small overhead in the cost
17936 of executing a function pointer if this option is enabled.  This option
17937 is not valid in AAPCS configurations because interworking is enabled
17938 by default.
17940 @item -mtp=@var{name}
17941 @opindex mtp
17942 Specify the access model for the thread local storage pointer.  The valid
17943 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17944 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17945 (supported in the arm6k architecture), and @samp{auto}, which uses the
17946 best available method for the selected processor.  The default setting is
17947 @samp{auto}.
17949 @item -mtls-dialect=@var{dialect}
17950 @opindex mtls-dialect
17951 Specify the dialect to use for accessing thread local storage.  Two
17952 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
17953 @samp{gnu} dialect selects the original GNU scheme for supporting
17954 local and global dynamic TLS models.  The @samp{gnu2} dialect
17955 selects the GNU descriptor scheme, which provides better performance
17956 for shared libraries.  The GNU descriptor scheme is compatible with
17957 the original scheme, but does require new assembler, linker and
17958 library support.  Initial and local exec TLS models are unaffected by
17959 this option and always use the original scheme.
17961 @item -mword-relocations
17962 @opindex mword-relocations
17963 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17964 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17965 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17966 is specified. This option conflicts with @option{-mslow-flash-data}.
17968 @item -mfix-cortex-m3-ldrd
17969 @opindex mfix-cortex-m3-ldrd
17970 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17971 with overlapping destination and base registers are used.  This option avoids
17972 generating these instructions.  This option is enabled by default when
17973 @option{-mcpu=cortex-m3} is specified.
17975 @item -munaligned-access
17976 @itemx -mno-unaligned-access
17977 @opindex munaligned-access
17978 @opindex mno-unaligned-access
17979 Enables (or disables) reading and writing of 16- and 32- bit values
17980 from addresses that are not 16- or 32- bit aligned.  By default
17981 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17982 ARMv8-M Baseline architectures, and enabled for all other
17983 architectures.  If unaligned access is not enabled then words in packed
17984 data structures are accessed a byte at a time.
17986 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17987 generated object file to either true or false, depending upon the
17988 setting of this option.  If unaligned access is enabled then the
17989 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17990 defined.
17992 @item -mneon-for-64bits
17993 @opindex mneon-for-64bits
17994 This option is deprecated and has no effect.
17996 @item -mslow-flash-data
17997 @opindex mslow-flash-data
17998 Assume loading data from flash is slower than fetching instruction.
17999 Therefore literal load is minimized for better performance.
18000 This option is only supported when compiling for ARMv7 M-profile and
18001 off by default. It conflicts with @option{-mword-relocations}.
18003 @item -masm-syntax-unified
18004 @opindex masm-syntax-unified
18005 Assume inline assembler is using unified asm syntax.  The default is
18006 currently off which implies divided syntax.  This option has no impact
18007 on Thumb2. However, this may change in future releases of GCC.
18008 Divided syntax should be considered deprecated.
18010 @item -mrestrict-it
18011 @opindex mrestrict-it
18012 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
18013 IT blocks can only contain a single 16-bit instruction from a select
18014 set of instructions. This option is on by default for ARMv8-A Thumb mode.
18016 @item -mprint-tune-info
18017 @opindex mprint-tune-info
18018 Print CPU tuning information as comment in assembler file.  This is
18019 an option used only for regression testing of the compiler and not
18020 intended for ordinary use in compiling code.  This option is disabled
18021 by default.
18023 @item -mverbose-cost-dump
18024 @opindex mverbose-cost-dump
18025 Enable verbose cost model dumping in the debug dump files.  This option is
18026 provided for use in debugging the compiler.
18028 @item -mpure-code
18029 @opindex mpure-code
18030 Do not allow constant data to be placed in code sections.
18031 Additionally, when compiling for ELF object format give all text sections the
18032 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
18033 is only available when generating non-pic code for M-profile targets with the
18034 MOVT instruction.
18036 @item -mcmse
18037 @opindex mcmse
18038 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
18039 Development Tools Engineering Specification", which can be found on
18040 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
18042 @item -mfdpic
18043 @itemx -mno-fdpic
18044 @opindex mfdpic
18045 @opindex mno-fdpic
18046 Select the FDPIC ABI, which uses 64-bit function descriptors to
18047 represent pointers to functions.  When the compiler is configured for
18048 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
18049 and implies @option{-fPIE} if none of the PIC/PIE-related options is
18050 provided.  On other targets, it only enables the FDPIC-specific code
18051 generation features, and the user should explicitly provide the
18052 PIC/PIE-related options as needed.
18054 Note that static linking is not supported because it would still
18055 involve the dynamic linker when the program self-relocates.  If such
18056 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
18058 The opposite @option{-mno-fdpic} option is useful (and required) to
18059 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
18060 toolchain as the one used to build the userland programs.
18062 @end table
18064 @node AVR Options
18065 @subsection AVR Options
18066 @cindex AVR Options
18068 These options are defined for AVR implementations:
18070 @table @gcctabopt
18071 @item -mmcu=@var{mcu}
18072 @opindex mmcu
18073 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18075 The default for this option is@tie{}@samp{avr2}.
18077 GCC supports the following AVR devices and ISAs:
18079 @include avr-mmcu.texi
18081 @item -mabsdata
18082 @opindex mabsdata
18084 Assume that all data in static storage can be accessed by LDS / STS
18085 instructions.  This option has only an effect on reduced Tiny devices like
18086 ATtiny40.  See also the @code{absdata}
18087 @ref{AVR Variable Attributes,variable attribute}.
18089 @item -maccumulate-args
18090 @opindex maccumulate-args
18091 Accumulate outgoing function arguments and acquire/release the needed
18092 stack space for outgoing function arguments once in function
18093 prologue/epilogue.  Without this option, outgoing arguments are pushed
18094 before calling a function and popped afterwards.
18096 Popping the arguments after the function call can be expensive on
18097 AVR so that accumulating the stack space might lead to smaller
18098 executables because arguments need not be removed from the
18099 stack after such a function call.
18101 This option can lead to reduced code size for functions that perform
18102 several calls to functions that get their arguments on the stack like
18103 calls to printf-like functions.
18105 @item -mbranch-cost=@var{cost}
18106 @opindex mbranch-cost
18107 Set the branch costs for conditional branch instructions to
18108 @var{cost}.  Reasonable values for @var{cost} are small, non-negative
18109 integers. The default branch cost is 0.
18111 @item -mcall-prologues
18112 @opindex mcall-prologues
18113 Functions prologues/epilogues are expanded as calls to appropriate
18114 subroutines.  Code size is smaller.
18116 @item -mgas-isr-prologues
18117 @opindex mgas-isr-prologues
18118 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18119 instruction supported by GNU Binutils.
18120 If this option is on, the feature can still be disabled for individual
18121 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18122 function attribute.  This feature is activated per default
18123 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18124 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18126 @item -mint8
18127 @opindex mint8
18128 Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
18129 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18130 and @code{long long} is 4 bytes.  Please note that this option does not
18131 conform to the C standards, but it results in smaller code
18132 size.
18134 @item -mmain-is-OS_task
18135 @opindex mmain-is-OS_task
18136 Do not save registers in @code{main}.  The effect is the same like
18137 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18138 to @code{main}. It is activated per default if optimization is on.
18140 @item -mn-flash=@var{num}
18141 @opindex mn-flash
18142 Assume that the flash memory has a size of 
18143 @var{num} times 64@tie{}KiB.
18145 @item -mno-interrupts
18146 @opindex mno-interrupts
18147 Generated code is not compatible with hardware interrupts.
18148 Code size is smaller.
18150 @item -mrelax
18151 @opindex mrelax
18152 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18153 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18154 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18155 the assembler's command line and the @option{--relax} option to the
18156 linker's command line.
18158 Jump relaxing is performed by the linker because jump offsets are not
18159 known before code is located. Therefore, the assembler code generated by the
18160 compiler is the same, but the instructions in the executable may
18161 differ from instructions in the assembler code.
18163 Relaxing must be turned on if linker stubs are needed, see the
18164 section on @code{EIND} and linker stubs below.
18166 @item -mrmw
18167 @opindex mrmw
18168 Assume that the device supports the Read-Modify-Write
18169 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18171 @item -mshort-calls
18172 @opindex mshort-calls
18174 Assume that @code{RJMP} and @code{RCALL} can target the whole
18175 program memory.
18177 This option is used internally for multilib selection.  It is
18178 not an optimization option, and you don't need to set it by hand.
18180 @item -msp8
18181 @opindex msp8
18182 Treat the stack pointer register as an 8-bit register,
18183 i.e.@: assume the high byte of the stack pointer is zero.
18184 In general, you don't need to set this option by hand.
18186 This option is used internally by the compiler to select and
18187 build multilibs for architectures @code{avr2} and @code{avr25}.
18188 These architectures mix devices with and without @code{SPH}.
18189 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18190 the compiler driver adds or removes this option from the compiler
18191 proper's command line, because the compiler then knows if the device
18192 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18193 register or not.
18195 @item -mstrict-X
18196 @opindex mstrict-X
18197 Use address register @code{X} in a way proposed by the hardware.  This means
18198 that @code{X} is only used in indirect, post-increment or
18199 pre-decrement addressing.
18201 Without this option, the @code{X} register may be used in the same way
18202 as @code{Y} or @code{Z} which then is emulated by additional
18203 instructions.  
18204 For example, loading a value with @code{X+const} addressing with a
18205 small non-negative @code{const < 64} to a register @var{Rn} is
18206 performed as
18208 @example
18209 adiw r26, const   ; X += const
18210 ld   @var{Rn}, X        ; @var{Rn} = *X
18211 sbiw r26, const   ; X -= const
18212 @end example
18214 @item -mtiny-stack
18215 @opindex mtiny-stack
18216 Only change the lower 8@tie{}bits of the stack pointer.
18218 @item -mfract-convert-truncate
18219 @opindex mfract-convert-truncate
18220 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18222 @item -nodevicelib
18223 @opindex nodevicelib
18224 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18226 @item -Waddr-space-convert
18227 @opindex Waddr-space-convert
18228 @opindex Wno-addr-space-convert
18229 Warn about conversions between address spaces in the case where the
18230 resulting address space is not contained in the incoming address space.
18232 @item -Wmisspelled-isr
18233 @opindex Wmisspelled-isr
18234 @opindex Wno-misspelled-isr
18235 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18236 Enabled by default.
18237 @end table
18239 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18240 @cindex @code{EIND}
18241 Pointers in the implementation are 16@tie{}bits wide.
18242 The address of a function or label is represented as word address so
18243 that indirect jumps and calls can target any code address in the
18244 range of 64@tie{}Ki words.
18246 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18247 bytes of program memory space, there is a special function register called
18248 @code{EIND} that serves as most significant part of the target address
18249 when @code{EICALL} or @code{EIJMP} instructions are used.
18251 Indirect jumps and calls on these devices are handled as follows by
18252 the compiler and are subject to some limitations:
18254 @itemize @bullet
18256 @item
18257 The compiler never sets @code{EIND}.
18259 @item
18260 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18261 instructions or might read @code{EIND} directly in order to emulate an
18262 indirect call/jump by means of a @code{RET} instruction.
18264 @item
18265 The compiler assumes that @code{EIND} never changes during the startup
18266 code or during the application. In particular, @code{EIND} is not
18267 saved/restored in function or interrupt service routine
18268 prologue/epilogue.
18270 @item
18271 For indirect calls to functions and computed goto, the linker
18272 generates @emph{stubs}. Stubs are jump pads sometimes also called
18273 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18274 The stub contains a direct jump to the desired address.
18276 @item
18277 Linker relaxation must be turned on so that the linker generates
18278 the stubs correctly in all situations. See the compiler option
18279 @option{-mrelax} and the linker option @option{--relax}.
18280 There are corner cases where the linker is supposed to generate stubs
18281 but aborts without relaxation and without a helpful error message.
18283 @item
18284 The default linker script is arranged for code with @code{EIND = 0}.
18285 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18286 linker script has to be used in order to place the sections whose
18287 name start with @code{.trampolines} into the segment where @code{EIND}
18288 points to.
18290 @item
18291 The startup code from libgcc never sets @code{EIND}.
18292 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18293 For the impact of AVR-LibC on @code{EIND}, see the
18294 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18296 @item
18297 It is legitimate for user-specific startup code to set up @code{EIND}
18298 early, for example by means of initialization code located in
18299 section @code{.init3}. Such code runs prior to general startup code
18300 that initializes RAM and calls constructors, but after the bit
18301 of startup code from AVR-LibC that sets @code{EIND} to the segment
18302 where the vector table is located.
18303 @example
18304 #include <avr/io.h>
18306 static void
18307 __attribute__((section(".init3"),naked,used,no_instrument_function))
18308 init3_set_eind (void)
18310   __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18311                   "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18313 @end example
18315 @noindent
18316 The @code{__trampolines_start} symbol is defined in the linker script.
18318 @item
18319 Stubs are generated automatically by the linker if
18320 the following two conditions are met:
18321 @itemize @minus
18323 @item The address of a label is taken by means of the @code{gs} modifier
18324 (short for @emph{generate stubs}) like so:
18325 @example
18326 LDI r24, lo8(gs(@var{func}))
18327 LDI r25, hi8(gs(@var{func}))
18328 @end example
18329 @item The final location of that label is in a code segment
18330 @emph{outside} the segment where the stubs are located.
18331 @end itemize
18333 @item
18334 The compiler emits such @code{gs} modifiers for code labels in the
18335 following situations:
18336 @itemize @minus
18337 @item Taking address of a function or code label.
18338 @item Computed goto.
18339 @item If prologue-save function is used, see @option{-mcall-prologues}
18340 command-line option.
18341 @item Switch/case dispatch tables. If you do not want such dispatch
18342 tables you can specify the @option{-fno-jump-tables} command-line option.
18343 @item C and C++ constructors/destructors called during startup/shutdown.
18344 @item If the tools hit a @code{gs()} modifier explained above.
18345 @end itemize
18347 @item
18348 Jumping to non-symbolic addresses like so is @emph{not} supported:
18350 @example
18351 int main (void)
18353     /* Call function at word address 0x2 */
18354     return ((int(*)(void)) 0x2)();
18356 @end example
18358 Instead, a stub has to be set up, i.e.@: the function has to be called
18359 through a symbol (@code{func_4} in the example):
18361 @example
18362 int main (void)
18364     extern int func_4 (void);
18366     /* Call function at byte address 0x4 */
18367     return func_4();
18369 @end example
18371 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18372 Alternatively, @code{func_4} can be defined in the linker script.
18373 @end itemize
18375 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18376 @cindex @code{RAMPD}
18377 @cindex @code{RAMPX}
18378 @cindex @code{RAMPY}
18379 @cindex @code{RAMPZ}
18380 Some AVR devices support memories larger than the 64@tie{}KiB range
18381 that can be accessed with 16-bit pointers.  To access memory locations
18382 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18383 register is used as high part of the address:
18384 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18385 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18386 register, respectively, to get a wide address. Similarly,
18387 @code{RAMPD} is used together with direct addressing.
18389 @itemize
18390 @item
18391 The startup code initializes the @code{RAMP} special function
18392 registers with zero.
18394 @item
18395 If a @ref{AVR Named Address Spaces,named address space} other than
18396 generic or @code{__flash} is used, then @code{RAMPZ} is set
18397 as needed before the operation.
18399 @item
18400 If the device supports RAM larger than 64@tie{}KiB and the compiler
18401 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18402 is reset to zero after the operation.
18404 @item
18405 If the device comes with a specific @code{RAMP} register, the ISR
18406 prologue/epilogue saves/restores that SFR and initializes it with
18407 zero in case the ISR code might (implicitly) use it.
18409 @item
18410 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18411 If you use inline assembler to read from locations outside the
18412 16-bit address range and change one of the @code{RAMP} registers,
18413 you must reset it to zero after the access.
18415 @end itemize
18417 @subsubsection AVR Built-in Macros
18419 GCC defines several built-in macros so that the user code can test
18420 for the presence or absence of features.  Almost any of the following
18421 built-in macros are deduced from device capabilities and thus
18422 triggered by the @option{-mmcu=} command-line option.
18424 For even more AVR-specific built-in macros see
18425 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18427 @table @code
18429 @item __AVR_ARCH__
18430 Build-in macro that resolves to a decimal number that identifies the
18431 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18432 Possible values are:
18434 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18435 @code{4}, @code{5}, @code{51}, @code{6}
18437 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18438 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18440 respectively and
18442 @code{100},
18443 @code{102}, @code{103}, @code{104},
18444 @code{105}, @code{106}, @code{107}
18446 for @var{mcu}=@code{avrtiny},
18447 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18448 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18449 If @var{mcu} specifies a device, this built-in macro is set
18450 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18451 defined to @code{4}.
18453 @item __AVR_@var{Device}__
18454 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18455 the device's name. For example, @option{-mmcu=atmega8} defines the
18456 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18457 @code{__AVR_ATtiny261A__}, etc.
18459 The built-in macros' names follow
18460 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18461 the device name as from the AVR user manual. The difference between
18462 @var{Device} in the built-in macro and @var{device} in
18463 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18465 If @var{device} is not a device but only a core architecture like
18466 @samp{avr51}, this macro is not defined.
18468 @item __AVR_DEVICE_NAME__
18469 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18470 the device's name. For example, with @option{-mmcu=atmega8} the macro
18471 is defined to @code{atmega8}.
18473 If @var{device} is not a device but only a core architecture like
18474 @samp{avr51}, this macro is not defined.
18476 @item __AVR_XMEGA__
18477 The device / architecture belongs to the XMEGA family of devices.
18479 @item __AVR_HAVE_ELPM__
18480 The device has the @code{ELPM} instruction.
18482 @item __AVR_HAVE_ELPMX__
18483 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18484 R@var{n},Z+} instructions.
18486 @item __AVR_HAVE_MOVW__
18487 The device has the @code{MOVW} instruction to perform 16-bit
18488 register-register moves.
18490 @item __AVR_HAVE_LPMX__
18491 The device has the @code{LPM R@var{n},Z} and
18492 @code{LPM R@var{n},Z+} instructions.
18494 @item __AVR_HAVE_MUL__
18495 The device has a hardware multiplier. 
18497 @item __AVR_HAVE_JMP_CALL__
18498 The device has the @code{JMP} and @code{CALL} instructions.
18499 This is the case for devices with more than 8@tie{}KiB of program
18500 memory.
18502 @item __AVR_HAVE_EIJMP_EICALL__
18503 @itemx __AVR_3_BYTE_PC__
18504 The device has the @code{EIJMP} and @code{EICALL} instructions.
18505 This is the case for devices with more than 128@tie{}KiB of program memory.
18506 This also means that the program counter
18507 (PC) is 3@tie{}bytes wide.
18509 @item __AVR_2_BYTE_PC__
18510 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18511 with up to 128@tie{}KiB of program memory.
18513 @item __AVR_HAVE_8BIT_SP__
18514 @itemx __AVR_HAVE_16BIT_SP__
18515 The stack pointer (SP) register is treated as 8-bit respectively
18516 16-bit register by the compiler.
18517 The definition of these macros is affected by @option{-mtiny-stack}.
18519 @item __AVR_HAVE_SPH__
18520 @itemx __AVR_SP8__
18521 The device has the SPH (high part of stack pointer) special function
18522 register or has an 8-bit stack pointer, respectively.
18523 The definition of these macros is affected by @option{-mmcu=} and
18524 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18525 by @option{-msp8}.
18527 @item __AVR_HAVE_RAMPD__
18528 @itemx __AVR_HAVE_RAMPX__
18529 @itemx __AVR_HAVE_RAMPY__
18530 @itemx __AVR_HAVE_RAMPZ__
18531 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18532 @code{RAMPZ} special function register, respectively.
18534 @item __NO_INTERRUPTS__
18535 This macro reflects the @option{-mno-interrupts} command-line option.
18537 @item __AVR_ERRATA_SKIP__
18538 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18539 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18540 instructions because of a hardware erratum.  Skip instructions are
18541 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18542 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18543 set.
18545 @item __AVR_ISA_RMW__
18546 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18548 @item __AVR_SFR_OFFSET__=@var{offset}
18549 Instructions that can address I/O special function registers directly
18550 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18551 address as if addressed by an instruction to access RAM like @code{LD}
18552 or @code{STS}. This offset depends on the device architecture and has
18553 to be subtracted from the RAM address in order to get the
18554 respective I/O@tie{}address.
18556 @item __AVR_SHORT_CALLS__
18557 The @option{-mshort-calls} command line option is set.
18559 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18560 Some devices support reading from flash memory by means of @code{LD*}
18561 instructions.  The flash memory is seen in the data address space
18562 at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
18563 is not defined, this feature is not available.  If defined,
18564 the address space is linear and there is no need to put
18565 @code{.rodata} into RAM.  This is handled by the default linker
18566 description file, and is currently available for
18567 @code{avrtiny} and @code{avrxmega3}.  Even more convenient,
18568 there is no need to use address spaces like @code{__flash} or
18569 features like attribute @code{progmem} and @code{pgm_read_*}.
18571 @item __WITH_AVRLIBC__
18572 The compiler is configured to be used together with AVR-Libc.
18573 See the @option{--with-avrlibc} configure option.
18575 @end table
18577 @node Blackfin Options
18578 @subsection Blackfin Options
18579 @cindex Blackfin Options
18581 @table @gcctabopt
18582 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18583 @opindex mcpu=
18584 Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
18585 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18586 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18587 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18588 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18589 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18590 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18591 @samp{bf561}, @samp{bf592}.
18593 The optional @var{sirevision} specifies the silicon revision of the target
18594 Blackfin processor.  Any workarounds available for the targeted silicon revision
18595 are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
18596 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18597 are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
18598 hexadecimal digits representing the major and minor numbers in the silicon
18599 revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18600 is not defined.  If @var{sirevision} is @samp{any}, the
18601 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18602 If this optional @var{sirevision} is not used, GCC assumes the latest known
18603 silicon revision of the targeted Blackfin processor.
18605 GCC defines a preprocessor macro for the specified @var{cpu}.
18606 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18607 provided by libgloss to be linked in if @option{-msim} is not given.
18609 Without this option, @samp{bf532} is used as the processor by default.
18611 Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
18612 only the preprocessor macro is defined.
18614 @item -msim
18615 @opindex msim
18616 Specifies that the program will be run on the simulator.  This causes
18617 the simulator BSP provided by libgloss to be linked in.  This option
18618 has effect only for @samp{bfin-elf} toolchain.
18619 Certain other options, such as @option{-mid-shared-library} and
18620 @option{-mfdpic}, imply @option{-msim}.
18622 @item -momit-leaf-frame-pointer
18623 @opindex momit-leaf-frame-pointer
18624 Don't keep the frame pointer in a register for leaf functions.  This
18625 avoids the instructions to save, set up and restore frame pointers and
18626 makes an extra register available in leaf functions.
18628 @item -mspecld-anomaly
18629 @opindex mspecld-anomaly
18630 When enabled, the compiler ensures that the generated code does not
18631 contain speculative loads after jump instructions. If this option is used,
18632 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18634 @item -mno-specld-anomaly
18635 @opindex mno-specld-anomaly
18636 @opindex mspecld-anomaly
18637 Don't generate extra code to prevent speculative loads from occurring.
18639 @item -mcsync-anomaly
18640 @opindex mcsync-anomaly
18641 When enabled, the compiler ensures that the generated code does not
18642 contain CSYNC or SSYNC instructions too soon after conditional branches.
18643 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18645 @item -mno-csync-anomaly
18646 @opindex mno-csync-anomaly
18647 @opindex mcsync-anomaly
18648 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18649 occurring too soon after a conditional branch.
18651 @item -mlow64k
18652 @opindex mlow64k
18653 When enabled, the compiler is free to take advantage of the knowledge that
18654 the entire program fits into the low 64k of memory.
18656 @item -mno-low64k
18657 @opindex mno-low64k
18658 Assume that the program is arbitrarily large.  This is the default.
18660 @item -mstack-check-l1
18661 @opindex mstack-check-l1
18662 Do stack checking using information placed into L1 scratchpad memory by the
18663 uClinux kernel.
18665 @item -mid-shared-library
18666 @opindex mid-shared-library
18667 Generate code that supports shared libraries via the library ID method.
18668 This allows for execute in place and shared libraries in an environment
18669 without virtual memory management.  This option implies @option{-fPIC}.
18670 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18672 @item -mno-id-shared-library
18673 @opindex mno-id-shared-library
18674 @opindex mid-shared-library
18675 Generate code that doesn't assume ID-based shared libraries are being used.
18676 This is the default.
18678 @item -mleaf-id-shared-library
18679 @opindex mleaf-id-shared-library
18680 Generate code that supports shared libraries via the library ID method,
18681 but assumes that this library or executable won't link against any other
18682 ID shared libraries.  That allows the compiler to use faster code for jumps
18683 and calls.
18685 @item -mno-leaf-id-shared-library
18686 @opindex mno-leaf-id-shared-library
18687 @opindex mleaf-id-shared-library
18688 Do not assume that the code being compiled won't link against any ID shared
18689 libraries.  Slower code is generated for jump and call insns.
18691 @item -mshared-library-id=n
18692 @opindex mshared-library-id
18693 Specifies the identification number of the ID-based shared library being
18694 compiled.  Specifying a value of 0 generates more compact code; specifying
18695 other values forces the allocation of that number to the current
18696 library but is no more space- or time-efficient than omitting this option.
18698 @item -msep-data
18699 @opindex msep-data
18700 Generate code that allows the data segment to be located in a different
18701 area of memory from the text segment.  This allows for execute in place in
18702 an environment without virtual memory management by eliminating relocations
18703 against the text section.
18705 @item -mno-sep-data
18706 @opindex mno-sep-data
18707 @opindex msep-data
18708 Generate code that assumes that the data segment follows the text segment.
18709 This is the default.
18711 @item -mlong-calls
18712 @itemx -mno-long-calls
18713 @opindex mlong-calls
18714 @opindex mno-long-calls
18715 Tells the compiler to perform function calls by first loading the
18716 address of the function into a register and then performing a subroutine
18717 call on this register.  This switch is needed if the target function
18718 lies outside of the 24-bit addressing range of the offset-based
18719 version of subroutine call instruction.
18721 This feature is not enabled by default.  Specifying
18722 @option{-mno-long-calls} restores the default behavior.  Note these
18723 switches have no effect on how the compiler generates code to handle
18724 function calls via function pointers.
18726 @item -mfast-fp
18727 @opindex mfast-fp
18728 Link with the fast floating-point library. This library relaxes some of
18729 the IEEE floating-point standard's rules for checking inputs against
18730 Not-a-Number (NAN), in the interest of performance.
18732 @item -minline-plt
18733 @opindex minline-plt
18734 Enable inlining of PLT entries in function calls to functions that are
18735 not known to bind locally.  It has no effect without @option{-mfdpic}.
18737 @item -mmulticore
18738 @opindex mmulticore
18739 Build a standalone application for multicore Blackfin processors. 
18740 This option causes proper start files and link scripts supporting 
18741 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 
18742 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 
18744 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18745 selects the one-application-per-core programming model.  Without
18746 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18747 programming model is used. In this model, the main function of Core B
18748 should be named as @code{coreb_main}.
18750 If this option is not used, the single-core application programming
18751 model is used.
18753 @item -mcorea
18754 @opindex mcorea
18755 Build a standalone application for Core A of BF561 when using
18756 the one-application-per-core programming model. Proper start files
18757 and link scripts are used to support Core A, and the macro
18758 @code{__BFIN_COREA} is defined.
18759 This option can only be used in conjunction with @option{-mmulticore}.
18761 @item -mcoreb
18762 @opindex mcoreb
18763 Build a standalone application for Core B of BF561 when using
18764 the one-application-per-core programming model. Proper start files
18765 and link scripts are used to support Core B, and the macro
18766 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18767 should be used instead of @code{main}. 
18768 This option can only be used in conjunction with @option{-mmulticore}.
18770 @item -msdram
18771 @opindex msdram
18772 Build a standalone application for SDRAM. Proper start files and
18773 link scripts are used to put the application into SDRAM, and the macro
18774 @code{__BFIN_SDRAM} is defined.
18775 The loader should initialize SDRAM before loading the application.
18777 @item -micplb
18778 @opindex micplb
18779 Assume that ICPLBs are enabled at run time.  This has an effect on certain
18780 anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
18781 are enabled; for standalone applications the default is off.
18782 @end table
18784 @node C6X Options
18785 @subsection C6X Options
18786 @cindex C6X Options
18788 @table @gcctabopt
18789 @item -march=@var{name}
18790 @opindex march
18791 This specifies the name of the target architecture.  GCC uses this
18792 name to determine what kind of instructions it can emit when generating
18793 assembly code.  Permissible names are: @samp{c62x},
18794 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18796 @item -mbig-endian
18797 @opindex mbig-endian
18798 Generate code for a big-endian target.
18800 @item -mlittle-endian
18801 @opindex mlittle-endian
18802 Generate code for a little-endian target.  This is the default.
18804 @item -msim
18805 @opindex msim
18806 Choose startup files and linker script suitable for the simulator.
18808 @item -msdata=default
18809 @opindex msdata=default
18810 Put small global and static data in the @code{.neardata} section,
18811 which is pointed to by register @code{B14}.  Put small uninitialized
18812 global and static data in the @code{.bss} section, which is adjacent
18813 to the @code{.neardata} section.  Put small read-only data into the
18814 @code{.rodata} section.  The corresponding sections used for large
18815 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18817 @item -msdata=all
18818 @opindex msdata=all
18819 Put all data, not just small objects, into the sections reserved for
18820 small data, and use addressing relative to the @code{B14} register to
18821 access them.
18823 @item -msdata=none
18824 @opindex msdata=none
18825 Make no use of the sections reserved for small data, and use absolute
18826 addresses to access all data.  Put all initialized global and static
18827 data in the @code{.fardata} section, and all uninitialized data in the
18828 @code{.far} section.  Put all constant data into the @code{.const}
18829 section.
18830 @end table
18832 @node CRIS Options
18833 @subsection CRIS Options
18834 @cindex CRIS Options
18836 These options are defined specifically for the CRIS ports.
18838 @table @gcctabopt
18839 @item -march=@var{architecture-type}
18840 @itemx -mcpu=@var{architecture-type}
18841 @opindex march
18842 @opindex mcpu
18843 Generate code for the specified architecture.  The choices for
18844 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18845 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18846 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18847 @samp{v10}.
18849 @item -mtune=@var{architecture-type}
18850 @opindex mtune
18851 Tune to @var{architecture-type} everything applicable about the generated
18852 code, except for the ABI and the set of available instructions.  The
18853 choices for @var{architecture-type} are the same as for
18854 @option{-march=@var{architecture-type}}.
18856 @item -mmax-stack-frame=@var{n}
18857 @opindex mmax-stack-frame
18858 Warn when the stack frame of a function exceeds @var{n} bytes.
18860 @item -metrax4
18861 @itemx -metrax100
18862 @opindex metrax4
18863 @opindex metrax100
18864 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18865 @option{-march=v3} and @option{-march=v8} respectively.
18867 @item -mmul-bug-workaround
18868 @itemx -mno-mul-bug-workaround
18869 @opindex mmul-bug-workaround
18870 @opindex mno-mul-bug-workaround
18871 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18872 models where it applies.  This option is active by default.
18874 @item -mpdebug
18875 @opindex mpdebug
18876 Enable CRIS-specific verbose debug-related information in the assembly
18877 code.  This option also has the effect of turning off the @samp{#NO_APP}
18878 formatted-code indicator to the assembler at the beginning of the
18879 assembly file.
18881 @item -mcc-init
18882 @opindex mcc-init
18883 Do not use condition-code results from previous instruction; always emit
18884 compare and test instructions before use of condition codes.
18886 @item -mno-side-effects
18887 @opindex mno-side-effects
18888 @opindex mside-effects
18889 Do not emit instructions with side effects in addressing modes other than
18890 post-increment.
18892 @item -mstack-align
18893 @itemx -mno-stack-align
18894 @itemx -mdata-align
18895 @itemx -mno-data-align
18896 @itemx -mconst-align
18897 @itemx -mno-const-align
18898 @opindex mstack-align
18899 @opindex mno-stack-align
18900 @opindex mdata-align
18901 @opindex mno-data-align
18902 @opindex mconst-align
18903 @opindex mno-const-align
18904 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18905 stack frame, individual data and constants to be aligned for the maximum
18906 single data access size for the chosen CPU model.  The default is to
18907 arrange for 32-bit alignment.  ABI details such as structure layout are
18908 not affected by these options.
18910 @item -m32-bit
18911 @itemx -m16-bit
18912 @itemx -m8-bit
18913 @opindex m32-bit
18914 @opindex m16-bit
18915 @opindex m8-bit
18916 Similar to the stack- data- and const-align options above, these options
18917 arrange for stack frame, writable data and constants to all be 32-bit,
18918 16-bit or 8-bit aligned.  The default is 32-bit alignment.
18920 @item -mno-prologue-epilogue
18921 @itemx -mprologue-epilogue
18922 @opindex mno-prologue-epilogue
18923 @opindex mprologue-epilogue
18924 With @option{-mno-prologue-epilogue}, the normal function prologue and
18925 epilogue which set up the stack frame are omitted and no return
18926 instructions or return sequences are generated in the code.  Use this
18927 option only together with visual inspection of the compiled code: no
18928 warnings or errors are generated when call-saved registers must be saved,
18929 or storage for local variables needs to be allocated.
18931 @item -mno-gotplt
18932 @itemx -mgotplt
18933 @opindex mno-gotplt
18934 @opindex mgotplt
18935 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18936 instruction sequences that load addresses for functions from the PLT part
18937 of the GOT rather than (traditional on other architectures) calls to the
18938 PLT@.  The default is @option{-mgotplt}.
18940 @item -melf
18941 @opindex melf
18942 Legacy no-op option only recognized with the cris-axis-elf and
18943 cris-axis-linux-gnu targets.
18945 @item -mlinux
18946 @opindex mlinux
18947 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18949 @item -sim
18950 @opindex sim
18951 This option, recognized for the cris-axis-elf, arranges
18952 to link with input-output functions from a simulator library.  Code,
18953 initialized data and zero-initialized data are allocated consecutively.
18955 @item -sim2
18956 @opindex sim2
18957 Like @option{-sim}, but pass linker options to locate initialized data at
18958 0x40000000 and zero-initialized data at 0x80000000.
18959 @end table
18961 @node CR16 Options
18962 @subsection CR16 Options
18963 @cindex CR16 Options
18965 These options are defined specifically for the CR16 ports.
18967 @table @gcctabopt
18969 @item -mmac
18970 @opindex mmac
18971 Enable the use of multiply-accumulate instructions. Disabled by default.
18973 @item -mcr16cplus
18974 @itemx -mcr16c
18975 @opindex mcr16cplus
18976 @opindex mcr16c
18977 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture 
18978 is default.
18980 @item -msim
18981 @opindex msim
18982 Links the library libsim.a which is in compatible with simulator. Applicable
18983 to ELF compiler only.
18985 @item -mint32
18986 @opindex mint32
18987 Choose integer type as 32-bit wide.
18989 @item -mbit-ops
18990 @opindex mbit-ops
18991 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18993 @item -mdata-model=@var{model}
18994 @opindex mdata-model
18995 Choose a data model. The choices for @var{model} are @samp{near},
18996 @samp{far} or @samp{medium}. @samp{medium} is default.
18997 However, @samp{far} is not valid with @option{-mcr16c}, as the
18998 CR16C architecture does not support the far data model.
18999 @end table
19001 @node C-SKY Options
19002 @subsection C-SKY Options
19003 @cindex C-SKY Options
19005 GCC supports these options when compiling for C-SKY V2 processors.
19007 @table @gcctabopt
19009 @item -march=@var{arch}
19010 @opindex march=
19011 Specify the C-SKY target architecture.  Valid values for @var{arch} are:
19012 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
19013 The default is @samp{ck810}.
19015 @item -mcpu=@var{cpu}
19016 @opindex mcpu=
19017 Specify the C-SKY target processor.  Valid values for @var{cpu} are:
19018 @samp{ck801}, @samp{ck801t},
19019 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
19020 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
19021 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
19022 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
19023 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
19024 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
19025 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
19026 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
19027 @samp{ck803eftr1}, @samp{ck803efhtr1},
19028 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
19029 @samp{ck803sef}, @samp{ck803seft},
19030 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
19031 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
19032 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
19033 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
19035 @item -mbig-endian
19036 @opindex mbig-endian
19037 @itemx -EB
19038 @opindex EB
19039 @itemx -mlittle-endian
19040 @opindex mlittle-endian
19041 @itemx -EL
19042 @opindex EL
19044 Select big- or little-endian code.  The default is little-endian.
19046 @item -mhard-float
19047 @opindex mhard-float
19048 @itemx -msoft-float
19049 @opindex msoft-float
19051 Select hardware or software floating-point implementations.
19052 The default is soft float.
19054 @item -mdouble-float
19055 @itemx -mno-double-float
19056 @opindex mdouble-float
19057 When @option{-mhard-float} is in effect, enable generation of
19058 double-precision float instructions.  This is the default except
19059 when compiling for CK803.
19061 @item -mfdivdu
19062 @itemx -mno-fdivdu
19063 @opindex mfdivdu
19064 When @option{-mhard-float} is in effect, enable generation of
19065 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
19066 This is the default except when compiling for CK803.
19068 @item -mfpu=@var{fpu}
19069 @opindex mfpu=
19070 Select the floating-point processor.  This option can only be used with
19071 @option{-mhard-float}.
19072 Values for @var{fpu} are
19073 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19074 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19075 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19077 @item -melrw
19078 @itemx -mno-elrw
19079 @opindex melrw
19080 Enable the extended @code{lrw} instruction.  This option defaults to on
19081 for CK801 and off otherwise.
19083 @item -mistack
19084 @itemx -mno-istack
19085 @opindex mistack
19086 Enable interrupt stack instructions; the default is off.
19088 The @option{-mistack} option is required to handle the
19089 @code{interrupt} and @code{isr} function attributes
19090 (@pxref{C-SKY Function Attributes}).
19092 @item -mmp
19093 @opindex mmp
19094 Enable multiprocessor instructions; the default is off.
19096 @item -mcp
19097 @opindex mcp
19098 Enable coprocessor instructions; the default is off.
19100 @item -mcache
19101 @opindex mcache
19102 Enable coprocessor instructions; the default is off.
19104 @item -msecurity
19105 @opindex msecurity
19106 Enable C-SKY security instructions; the default is off.
19108 @item -mtrust
19109 @opindex mtrust
19110 Enable C-SKY trust instructions; the default is off.
19112 @item -mdsp
19113 @opindex mdsp
19114 @itemx -medsp
19115 @opindex medsp
19116 @itemx -mvdsp
19117 @opindex mvdsp
19118 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19119 All of these options default to off.
19121 @item -mdiv
19122 @itemx -mno-div
19123 @opindex mdiv
19124 Generate divide instructions.  Default is off.
19126 @item -msmart
19127 @itemx -mno-smart
19128 @opindex msmart
19129 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19130 use of 16-bit instructions.  This option is ignored for CK801 where this
19131 is the required behavior, and it defaults to on for CK802.
19132 For other targets, the default is off.
19134 @item -mhigh-registers
19135 @itemx -mno-high-registers
19136 @opindex mhigh-registers
19137 Generate code using the high registers numbered 16-31.  This option
19138 is not supported on CK801, CK802, or CK803, and is enabled by default
19139 for other processors.
19141 @item -manchor
19142 @itemx -mno-anchor
19143 @opindex manchor
19144 Generate code using global anchor symbol addresses.
19146 @item -mpushpop
19147 @itemx -mno-pushpop
19148 @opindex mpushpop
19149 Generate code using @code{push} and @code{pop} instructions.  This option
19150 defaults to on.
19152 @item -mmultiple-stld
19153 @itemx -mstm
19154 @itemx -mno-multiple-stld
19155 @itemx -mno-stm
19156 @opindex mmultiple-stld
19157 Generate code using @code{stm} and @code{ldm} instructions.  This option
19158 isn't supported on CK801 but is enabled by default on other processors.
19160 @item -mconstpool
19161 @itemx -mno-constpool
19162 @opindex mconstpool
19163 Create constant pools in the compiler instead of deferring it to the
19164 assembler.  This option is the default and required for correct code
19165 generation on CK801 and CK802, and is optional on other processors.
19167 @item -mstack-size
19168 @item -mno-stack-size
19169 @opindex mstack-size
19170 Emit @code{.stack_size} directives for each function in the assembly
19171 output.  This option defaults to off.
19173 @item -mccrt
19174 @itemx -mno-ccrt
19175 @opindex mccrt
19176 Generate code for the C-SKY compiler runtime instead of libgcc.  This
19177 option defaults to off.
19179 @item -mbranch-cost=@var{n}
19180 @opindex mbranch-cost=
19181 Set the branch costs to roughly @code{n} instructions.  The default is 1.
19183 @item -msched-prolog
19184 @itemx -mno-sched-prolog
19185 @opindex msched-prolog
19186 Permit scheduling of function prologue and epilogue sequences.  Using
19187 this option can result in code that is not compliant with the C-SKY V2 ABI
19188 prologue requirements and that cannot be debugged or backtraced.
19189 It is disabled by default.
19191 @end table
19193 @node Darwin Options
19194 @subsection Darwin Options
19195 @cindex Darwin options
19197 These options are defined for all architectures running the Darwin operating
19198 system.
19200 FSF GCC on Darwin does not create ``fat'' object files; it creates
19201 an object file for the single architecture that GCC was built to
19202 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
19203 @option{-arch} options are used; it does so by running the compiler or
19204 linker multiple times and joining the results together with
19205 @file{lipo}.
19207 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19208 @samp{i686}) is determined by the flags that specify the ISA
19209 that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
19210 @option{-force_cpusubtype_ALL} option can be used to override this.
19212 The Darwin tools vary in their behavior when presented with an ISA
19213 mismatch.  The assembler, @file{as}, only permits instructions to
19214 be used that are valid for the subtype of the file it is generating,
19215 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19216 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19217 and prints an error if asked to create a shared library with a less
19218 restrictive subtype than its input files (for instance, trying to put
19219 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
19220 for executables, @command{ld}, quietly gives the executable the most
19221 restrictive subtype of any of its input files.
19223 @table @gcctabopt
19224 @item -F@var{dir}
19225 @opindex F
19226 Add the framework directory @var{dir} to the head of the list of
19227 directories to be searched for header files.  These directories are
19228 interleaved with those specified by @option{-I} options and are
19229 scanned in a left-to-right order.
19231 A framework directory is a directory with frameworks in it.  A
19232 framework is a directory with a @file{Headers} and/or
19233 @file{PrivateHeaders} directory contained directly in it that ends
19234 in @file{.framework}.  The name of a framework is the name of this
19235 directory excluding the @file{.framework}.  Headers associated with
19236 the framework are found in one of those two directories, with
19237 @file{Headers} being searched first.  A subframework is a framework
19238 directory that is in a framework's @file{Frameworks} directory.
19239 Includes of subframework headers can only appear in a header of a
19240 framework that contains the subframework, or in a sibling subframework
19241 header.  Two subframeworks are siblings if they occur in the same
19242 framework.  A subframework should not have the same name as a
19243 framework; a warning is issued if this is violated.  Currently a
19244 subframework cannot have subframeworks; in the future, the mechanism
19245 may be extended to support this.  The standard frameworks can be found
19246 in @file{/System/Library/Frameworks} and
19247 @file{/Library/Frameworks}.  An example include looks like
19248 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19249 the name of the framework and @file{header.h} is found in the
19250 @file{PrivateHeaders} or @file{Headers} directory.
19252 @item -iframework@var{dir}
19253 @opindex iframework
19254 Like @option{-F} except the directory is a treated as a system
19255 directory.  The main difference between this @option{-iframework} and
19256 @option{-F} is that with @option{-iframework} the compiler does not
19257 warn about constructs contained within header files found via
19258 @var{dir}.  This option is valid only for the C family of languages.
19260 @item -gused
19261 @opindex gused
19262 Emit debugging information for symbols that are used.  For stabs
19263 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19264 This is by default ON@.
19266 @item -gfull
19267 @opindex gfull
19268 Emit debugging information for all symbols and types.
19270 @item -mmacosx-version-min=@var{version}
19271 The earliest version of MacOS X that this executable will run on
19272 is @var{version}.  Typical values of @var{version} include @code{10.1},
19273 @code{10.2}, and @code{10.3.9}.
19275 If the compiler was built to use the system's headers by default,
19276 then the default for this option is the system version on which the
19277 compiler is running, otherwise the default is to make choices that
19278 are compatible with as many systems and code bases as possible.
19280 @item -mkernel
19281 @opindex mkernel
19282 Enable kernel development mode.  The @option{-mkernel} option sets
19283 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19284 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19285 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19286 applicable.  This mode also sets @option{-mno-altivec},
19287 @option{-msoft-float}, @option{-fno-builtin} and
19288 @option{-mlong-branch} for PowerPC targets.
19290 @item -mone-byte-bool
19291 @opindex mone-byte-bool
19292 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19293 By default @code{sizeof(bool)} is @code{4} when compiling for
19294 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19295 option has no effect on x86.
19297 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19298 to generate code that is not binary compatible with code generated
19299 without that switch.  Using this switch may require recompiling all
19300 other modules in a program, including system libraries.  Use this
19301 switch to conform to a non-default data model.
19303 @item -mfix-and-continue
19304 @itemx -ffix-and-continue
19305 @itemx -findirect-data
19306 @opindex mfix-and-continue
19307 @opindex ffix-and-continue
19308 @opindex findirect-data
19309 Generate code suitable for fast turnaround development, such as to
19310 allow GDB to dynamically load @file{.o} files into already-running
19311 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
19312 are provided for backwards compatibility.
19314 @item -all_load
19315 @opindex all_load
19316 Loads all members of static archive libraries.
19317 See man ld(1) for more information.
19319 @item -arch_errors_fatal
19320 @opindex arch_errors_fatal
19321 Cause the errors having to do with files that have the wrong architecture
19322 to be fatal.
19324 @item -bind_at_load
19325 @opindex bind_at_load
19326 Causes the output file to be marked such that the dynamic linker will
19327 bind all undefined references when the file is loaded or launched.
19329 @item -bundle
19330 @opindex bundle
19331 Produce a Mach-o bundle format file.
19332 See man ld(1) for more information.
19334 @item -bundle_loader @var{executable}
19335 @opindex bundle_loader
19336 This option specifies the @var{executable} that will load the build
19337 output file being linked.  See man ld(1) for more information.
19339 @item -dynamiclib
19340 @opindex dynamiclib
19341 When passed this option, GCC produces a dynamic library instead of
19342 an executable when linking, using the Darwin @file{libtool} command.
19344 @item -force_cpusubtype_ALL
19345 @opindex force_cpusubtype_ALL
19346 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19347 one controlled by the @option{-mcpu} or @option{-march} option.
19349 @item -allowable_client  @var{client_name}
19350 @itemx -client_name
19351 @itemx -compatibility_version
19352 @itemx -current_version
19353 @itemx -dead_strip
19354 @itemx -dependency-file
19355 @itemx -dylib_file
19356 @itemx -dylinker_install_name
19357 @itemx -dynamic
19358 @itemx -exported_symbols_list
19359 @itemx -filelist
19360 @need 800
19361 @itemx -flat_namespace
19362 @itemx -force_flat_namespace
19363 @itemx -headerpad_max_install_names
19364 @itemx -image_base
19365 @itemx -init
19366 @itemx -install_name
19367 @itemx -keep_private_externs
19368 @itemx -multi_module
19369 @itemx -multiply_defined
19370 @itemx -multiply_defined_unused
19371 @need 800
19372 @itemx -noall_load
19373 @itemx -no_dead_strip_inits_and_terms
19374 @itemx -nofixprebinding
19375 @itemx -nomultidefs
19376 @itemx -noprebind
19377 @itemx -noseglinkedit
19378 @itemx -pagezero_size
19379 @itemx -prebind
19380 @itemx -prebind_all_twolevel_modules
19381 @itemx -private_bundle
19382 @need 800
19383 @itemx -read_only_relocs
19384 @itemx -sectalign
19385 @itemx -sectobjectsymbols
19386 @itemx -whyload
19387 @itemx -seg1addr
19388 @itemx -sectcreate
19389 @itemx -sectobjectsymbols
19390 @itemx -sectorder
19391 @itemx -segaddr
19392 @itemx -segs_read_only_addr
19393 @need 800
19394 @itemx -segs_read_write_addr
19395 @itemx -seg_addr_table
19396 @itemx -seg_addr_table_filename
19397 @itemx -seglinkedit
19398 @itemx -segprot
19399 @itemx -segs_read_only_addr
19400 @itemx -segs_read_write_addr
19401 @itemx -single_module
19402 @itemx -static
19403 @itemx -sub_library
19404 @need 800
19405 @itemx -sub_umbrella
19406 @itemx -twolevel_namespace
19407 @itemx -umbrella
19408 @itemx -undefined
19409 @itemx -unexported_symbols_list
19410 @itemx -weak_reference_mismatches
19411 @itemx -whatsloaded
19412 @opindex allowable_client
19413 @opindex client_name
19414 @opindex compatibility_version
19415 @opindex current_version
19416 @opindex dead_strip
19417 @opindex dependency-file
19418 @opindex dylib_file
19419 @opindex dylinker_install_name
19420 @opindex dynamic
19421 @opindex exported_symbols_list
19422 @opindex filelist
19423 @opindex flat_namespace
19424 @opindex force_flat_namespace
19425 @opindex headerpad_max_install_names
19426 @opindex image_base
19427 @opindex init
19428 @opindex install_name
19429 @opindex keep_private_externs
19430 @opindex multi_module
19431 @opindex multiply_defined
19432 @opindex multiply_defined_unused
19433 @opindex noall_load
19434 @opindex no_dead_strip_inits_and_terms
19435 @opindex nofixprebinding
19436 @opindex nomultidefs
19437 @opindex noprebind
19438 @opindex noseglinkedit
19439 @opindex pagezero_size
19440 @opindex prebind
19441 @opindex prebind_all_twolevel_modules
19442 @opindex private_bundle
19443 @opindex read_only_relocs
19444 @opindex sectalign
19445 @opindex sectobjectsymbols
19446 @opindex whyload
19447 @opindex seg1addr
19448 @opindex sectcreate
19449 @opindex sectobjectsymbols
19450 @opindex sectorder
19451 @opindex segaddr
19452 @opindex segs_read_only_addr
19453 @opindex segs_read_write_addr
19454 @opindex seg_addr_table
19455 @opindex seg_addr_table_filename
19456 @opindex seglinkedit
19457 @opindex segprot
19458 @opindex segs_read_only_addr
19459 @opindex segs_read_write_addr
19460 @opindex single_module
19461 @opindex static
19462 @opindex sub_library
19463 @opindex sub_umbrella
19464 @opindex twolevel_namespace
19465 @opindex umbrella
19466 @opindex undefined
19467 @opindex unexported_symbols_list
19468 @opindex weak_reference_mismatches
19469 @opindex whatsloaded
19470 These options are passed to the Darwin linker.  The Darwin linker man page
19471 describes them in detail.
19472 @end table
19474 @node DEC Alpha Options
19475 @subsection DEC Alpha Options
19477 These @samp{-m} options are defined for the DEC Alpha implementations:
19479 @table @gcctabopt
19480 @item -mno-soft-float
19481 @itemx -msoft-float
19482 @opindex mno-soft-float
19483 @opindex msoft-float
19484 Use (do not use) the hardware floating-point instructions for
19485 floating-point operations.  When @option{-msoft-float} is specified,
19486 functions in @file{libgcc.a} are used to perform floating-point
19487 operations.  Unless they are replaced by routines that emulate the
19488 floating-point operations, or compiled in such a way as to call such
19489 emulations routines, these routines issue floating-point
19490 operations.   If you are compiling for an Alpha without floating-point
19491 operations, you must ensure that the library is built so as not to call
19492 them.
19494 Note that Alpha implementations without floating-point operations are
19495 required to have floating-point registers.
19497 @item -mfp-reg
19498 @itemx -mno-fp-regs
19499 @opindex mfp-reg
19500 @opindex mno-fp-regs
19501 Generate code that uses (does not use) the floating-point register set.
19502 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
19503 register set is not used, floating-point operands are passed in integer
19504 registers as if they were integers and floating-point results are passed
19505 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
19506 so any function with a floating-point argument or return value called by code
19507 compiled with @option{-mno-fp-regs} must also be compiled with that
19508 option.
19510 A typical use of this option is building a kernel that does not use,
19511 and hence need not save and restore, any floating-point registers.
19513 @item -mieee
19514 @opindex mieee
19515 The Alpha architecture implements floating-point hardware optimized for
19516 maximum performance.  It is mostly compliant with the IEEE floating-point
19517 standard.  However, for full compliance, software assistance is
19518 required.  This option generates code fully IEEE-compliant code
19519 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19520 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19521 defined during compilation.  The resulting code is less efficient but is
19522 able to correctly support denormalized numbers and exceptional IEEE
19523 values such as not-a-number and plus/minus infinity.  Other Alpha
19524 compilers call this option @option{-ieee_with_no_inexact}.
19526 @item -mieee-with-inexact
19527 @opindex mieee-with-inexact
19528 This is like @option{-mieee} except the generated code also maintains
19529 the IEEE @var{inexact-flag}.  Turning on this option causes the
19530 generated code to implement fully-compliant IEEE math.  In addition to
19531 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19532 macro.  On some Alpha implementations the resulting code may execute
19533 significantly slower than the code generated by default.  Since there is
19534 very little code that depends on the @var{inexact-flag}, you should
19535 normally not specify this option.  Other Alpha compilers call this
19536 option @option{-ieee_with_inexact}.
19538 @item -mfp-trap-mode=@var{trap-mode}
19539 @opindex mfp-trap-mode
19540 This option controls what floating-point related traps are enabled.
19541 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19542 The trap mode can be set to one of four values:
19544 @table @samp
19545 @item n
19546 This is the default (normal) setting.  The only traps that are enabled
19547 are the ones that cannot be disabled in software (e.g., division by zero
19548 trap).
19550 @item u
19551 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19552 as well.
19554 @item su
19555 Like @samp{u}, but the instructions are marked to be safe for software
19556 completion (see Alpha architecture manual for details).
19558 @item sui
19559 Like @samp{su}, but inexact traps are enabled as well.
19560 @end table
19562 @item -mfp-rounding-mode=@var{rounding-mode}
19563 @opindex mfp-rounding-mode
19564 Selects the IEEE rounding mode.  Other Alpha compilers call this option
19565 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
19568 @table @samp
19569 @item n
19570 Normal IEEE rounding mode.  Floating-point numbers are rounded towards
19571 the nearest machine number or towards the even machine number in case
19572 of a tie.
19574 @item m
19575 Round towards minus infinity.
19577 @item c
19578 Chopped rounding mode.  Floating-point numbers are rounded towards zero.
19580 @item d
19581 Dynamic rounding mode.  A field in the floating-point control register
19582 (@var{fpcr}, see Alpha architecture reference manual) controls the
19583 rounding mode in effect.  The C library initializes this register for
19584 rounding towards plus infinity.  Thus, unless your program modifies the
19585 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19586 @end table
19588 @item -mtrap-precision=@var{trap-precision}
19589 @opindex mtrap-precision
19590 In the Alpha architecture, floating-point traps are imprecise.  This
19591 means without software assistance it is impossible to recover from a
19592 floating trap and program execution normally needs to be terminated.
19593 GCC can generate code that can assist operating system trap handlers
19594 in determining the exact location that caused a floating-point trap.
19595 Depending on the requirements of an application, different levels of
19596 precisions can be selected:
19598 @table @samp
19599 @item p
19600 Program precision.  This option is the default and means a trap handler
19601 can only identify which program caused a floating-point exception.
19603 @item f
19604 Function precision.  The trap handler can determine the function that
19605 caused a floating-point exception.
19607 @item i
19608 Instruction precision.  The trap handler can determine the exact
19609 instruction that caused a floating-point exception.
19610 @end table
19612 Other Alpha compilers provide the equivalent options called
19613 @option{-scope_safe} and @option{-resumption_safe}.
19615 @item -mieee-conformant
19616 @opindex mieee-conformant
19617 This option marks the generated code as IEEE conformant.  You must not
19618 use this option unless you also specify @option{-mtrap-precision=i} and either
19619 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
19620 is to emit the line @samp{.eflag 48} in the function prologue of the
19621 generated assembly file.
19623 @item -mbuild-constants
19624 @opindex mbuild-constants
19625 Normally GCC examines a 32- or 64-bit integer constant to
19626 see if it can construct it from smaller constants in two or three
19627 instructions.  If it cannot, it outputs the constant as a literal and
19628 generates code to load it from the data segment at run time.
19630 Use this option to require GCC to construct @emph{all} integer constants
19631 using code, even if it takes more instructions (the maximum is six).
19633 You typically use this option to build a shared library dynamic
19634 loader.  Itself a shared library, it must relocate itself in memory
19635 before it can find the variables and constants in its own data segment.
19637 @item -mbwx
19638 @itemx -mno-bwx
19639 @itemx -mcix
19640 @itemx -mno-cix
19641 @itemx -mfix
19642 @itemx -mno-fix
19643 @itemx -mmax
19644 @itemx -mno-max
19645 @opindex mbwx
19646 @opindex mno-bwx
19647 @opindex mcix
19648 @opindex mno-cix
19649 @opindex mfix
19650 @opindex mno-fix
19651 @opindex mmax
19652 @opindex mno-max
19653 Indicate whether GCC should generate code to use the optional BWX,
19654 CIX, FIX and MAX instruction sets.  The default is to use the instruction
19655 sets supported by the CPU type specified via @option{-mcpu=} option or that
19656 of the CPU on which GCC was built if none is specified.
19658 @item -mfloat-vax
19659 @itemx -mfloat-ieee
19660 @opindex mfloat-vax
19661 @opindex mfloat-ieee
19662 Generate code that uses (does not use) VAX F and G floating-point
19663 arithmetic instead of IEEE single and double precision.
19665 @item -mexplicit-relocs
19666 @itemx -mno-explicit-relocs
19667 @opindex mexplicit-relocs
19668 @opindex mno-explicit-relocs
19669 Older Alpha assemblers provided no way to generate symbol relocations
19670 except via assembler macros.  Use of these macros does not allow
19671 optimal instruction scheduling.  GNU binutils as of version 2.12
19672 supports a new syntax that allows the compiler to explicitly mark
19673 which relocations should apply to which instructions.  This option
19674 is mostly useful for debugging, as GCC detects the capabilities of
19675 the assembler when it is built and sets the default accordingly.
19677 @item -msmall-data
19678 @itemx -mlarge-data
19679 @opindex msmall-data
19680 @opindex mlarge-data
19681 When @option{-mexplicit-relocs} is in effect, static data is
19682 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
19683 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19684 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19685 16-bit relocations off of the @code{$gp} register.  This limits the
19686 size of the small data area to 64KB, but allows the variables to be
19687 directly accessed via a single instruction.
19689 The default is @option{-mlarge-data}.  With this option the data area
19690 is limited to just below 2GB@.  Programs that require more than 2GB of
19691 data must use @code{malloc} or @code{mmap} to allocate the data in the
19692 heap instead of in the program's data segment.
19694 When generating code for shared libraries, @option{-fpic} implies
19695 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19697 @item -msmall-text
19698 @itemx -mlarge-text
19699 @opindex msmall-text
19700 @opindex mlarge-text
19701 When @option{-msmall-text} is used, the compiler assumes that the
19702 code of the entire program (or shared library) fits in 4MB, and is
19703 thus reachable with a branch instruction.  When @option{-msmall-data}
19704 is used, the compiler can assume that all local symbols share the
19705 same @code{$gp} value, and thus reduce the number of instructions
19706 required for a function call from 4 to 1.
19708 The default is @option{-mlarge-text}.
19710 @item -mcpu=@var{cpu_type}
19711 @opindex mcpu
19712 Set the instruction set and instruction scheduling parameters for
19713 machine type @var{cpu_type}.  You can specify either the @samp{EV}
19714 style name or the corresponding chip number.  GCC supports scheduling
19715 parameters for the EV4, EV5 and EV6 family of processors and
19716 chooses the default values for the instruction set from the processor
19717 you specify.  If you do not specify a processor type, GCC defaults
19718 to the processor on which the compiler was built.
19720 Supported values for @var{cpu_type} are
19722 @table @samp
19723 @item ev4
19724 @itemx ev45
19725 @itemx 21064
19726 Schedules as an EV4 and has no instruction set extensions.
19728 @item ev5
19729 @itemx 21164
19730 Schedules as an EV5 and has no instruction set extensions.
19732 @item ev56
19733 @itemx 21164a
19734 Schedules as an EV5 and supports the BWX extension.
19736 @item pca56
19737 @itemx 21164pc
19738 @itemx 21164PC
19739 Schedules as an EV5 and supports the BWX and MAX extensions.
19741 @item ev6
19742 @itemx 21264
19743 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19745 @item ev67
19746 @itemx 21264a
19747 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19748 @end table
19750 Native toolchains also support the value @samp{native},
19751 which selects the best architecture option for the host processor.
19752 @option{-mcpu=native} has no effect if GCC does not recognize
19753 the processor.
19755 @item -mtune=@var{cpu_type}
19756 @opindex mtune
19757 Set only the instruction scheduling parameters for machine type
19758 @var{cpu_type}.  The instruction set is not changed.
19760 Native toolchains also support the value @samp{native},
19761 which selects the best architecture option for the host processor.
19762 @option{-mtune=native} has no effect if GCC does not recognize
19763 the processor.
19765 @item -mmemory-latency=@var{time}
19766 @opindex mmemory-latency
19767 Sets the latency the scheduler should assume for typical memory
19768 references as seen by the application.  This number is highly
19769 dependent on the memory access patterns used by the application
19770 and the size of the external cache on the machine.
19772 Valid options for @var{time} are
19774 @table @samp
19775 @item @var{number}
19776 A decimal number representing clock cycles.
19778 @item L1
19779 @itemx L2
19780 @itemx L3
19781 @itemx main
19782 The compiler contains estimates of the number of clock cycles for
19783 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19784 (also called Dcache, Scache, and Bcache), as well as to main memory.
19785 Note that L3 is only valid for EV5.
19787 @end table
19788 @end table
19790 @node eBPF Options
19791 @subsection eBPF Options
19792 @cindex eBPF Options
19794 @table @gcctabopt
19795 @item -mframe-limit=@var{bytes}
19796 This specifies the hard limit for frame sizes, in bytes.  Currently,
19797 the value that can be specified should be less than or equal to
19798 @samp{32767}.  Defaults to whatever limit is imposed by the version of
19799 the Linux kernel targeted.
19801 @item -mkernel=@var{version}
19802 @opindex mkernel
19803 This specifies the minimum version of the kernel that will run the
19804 compiled program.  GCC uses this version to determine which
19805 instructions to use, what kernel helpers to allow, etc.  Currently,
19806 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
19807 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
19808 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
19809 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
19810 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
19811 @samp{5.2}, @samp{latest} and @samp{native}.
19813 @item -mbig-endian
19814 @opindex mbig-endian
19815 Generate code for a big-endian target.
19817 @item -mlittle-endian
19818 @opindex mlittle-endian
19819 Generate code for a little-endian target.  This is the default.
19820 @end table
19822 @node FR30 Options
19823 @subsection FR30 Options
19824 @cindex FR30 Options
19826 These options are defined specifically for the FR30 port.
19828 @table @gcctabopt
19830 @item -msmall-model
19831 @opindex msmall-model
19832 Use the small address space model.  This can produce smaller code, but
19833 it does assume that all symbolic values and addresses fit into a
19834 20-bit range.
19836 @item -mno-lsim
19837 @opindex mno-lsim
19838 Assume that runtime support has been provided and so there is no need
19839 to include the simulator library (@file{libsim.a}) on the linker
19840 command line.
19842 @end table
19844 @node FT32 Options
19845 @subsection FT32 Options
19846 @cindex FT32 Options
19848 These options are defined specifically for the FT32 port.
19850 @table @gcctabopt
19852 @item -msim
19853 @opindex msim
19854 Specifies that the program will be run on the simulator.  This causes
19855 an alternate runtime startup and library to be linked.
19856 You must not use this option when generating programs that will run on
19857 real hardware; you must provide your own runtime library for whatever
19858 I/O functions are needed.
19860 @item -mlra
19861 @opindex mlra
19862 Enable Local Register Allocation.  This is still experimental for FT32,
19863 so by default the compiler uses standard reload.
19865 @item -mnodiv
19866 @opindex mnodiv
19867 Do not use div and mod instructions.
19869 @item -mft32b
19870 @opindex mft32b
19871 Enable use of the extended instructions of the FT32B processor.
19873 @item -mcompress
19874 @opindex mcompress
19875 Compress all code using the Ft32B code compression scheme.
19877 @item -mnopm
19878 @opindex  mnopm
19879 Do not generate code that reads program memory.
19881 @end table
19883 @node FRV Options
19884 @subsection FRV Options
19885 @cindex FRV Options
19887 @table @gcctabopt
19888 @item -mgpr-32
19889 @opindex mgpr-32
19891 Only use the first 32 general-purpose registers.
19893 @item -mgpr-64
19894 @opindex mgpr-64
19896 Use all 64 general-purpose registers.
19898 @item -mfpr-32
19899 @opindex mfpr-32
19901 Use only the first 32 floating-point registers.
19903 @item -mfpr-64
19904 @opindex mfpr-64
19906 Use all 64 floating-point registers.
19908 @item -mhard-float
19909 @opindex mhard-float
19911 Use hardware instructions for floating-point operations.
19913 @item -msoft-float
19914 @opindex msoft-float
19916 Use library routines for floating-point operations.
19918 @item -malloc-cc
19919 @opindex malloc-cc
19921 Dynamically allocate condition code registers.
19923 @item -mfixed-cc
19924 @opindex mfixed-cc
19926 Do not try to dynamically allocate condition code registers, only
19927 use @code{icc0} and @code{fcc0}.
19929 @item -mdword
19930 @opindex mdword
19932 Change ABI to use double word insns.
19934 @item -mno-dword
19935 @opindex mno-dword
19936 @opindex mdword
19938 Do not use double word instructions.
19940 @item -mdouble
19941 @opindex mdouble
19943 Use floating-point double instructions.
19945 @item -mno-double
19946 @opindex mno-double
19948 Do not use floating-point double instructions.
19950 @item -mmedia
19951 @opindex mmedia
19953 Use media instructions.
19955 @item -mno-media
19956 @opindex mno-media
19958 Do not use media instructions.
19960 @item -mmuladd
19961 @opindex mmuladd
19963 Use multiply and add/subtract instructions.
19965 @item -mno-muladd
19966 @opindex mno-muladd
19968 Do not use multiply and add/subtract instructions.
19970 @item -mfdpic
19971 @opindex mfdpic
19973 Select the FDPIC ABI, which uses function descriptors to represent
19974 pointers to functions.  Without any PIC/PIE-related options, it
19975 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
19976 assumes GOT entries and small data are within a 12-bit range from the
19977 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19978 are computed with 32 bits.
19979 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19981 @item -minline-plt
19982 @opindex minline-plt
19984 Enable inlining of PLT entries in function calls to functions that are
19985 not known to bind locally.  It has no effect without @option{-mfdpic}.
19986 It's enabled by default if optimizing for speed and compiling for
19987 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19988 optimization option such as @option{-O3} or above is present in the
19989 command line.
19991 @item -mTLS
19992 @opindex mTLS
19994 Assume a large TLS segment when generating thread-local code.
19996 @item -mtls
19997 @opindex mtls
19999 Do not assume a large TLS segment when generating thread-local code.
20001 @item -mgprel-ro
20002 @opindex mgprel-ro
20004 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
20005 that is known to be in read-only sections.  It's enabled by default,
20006 except for @option{-fpic} or @option{-fpie}: even though it may help
20007 make the global offset table smaller, it trades 1 instruction for 4.
20008 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
20009 one of which may be shared by multiple symbols, and it avoids the need
20010 for a GOT entry for the referenced symbol, so it's more likely to be a
20011 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
20013 @item -multilib-library-pic
20014 @opindex multilib-library-pic
20016 Link with the (library, not FD) pic libraries.  It's implied by
20017 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
20018 @option{-fpic} without @option{-mfdpic}.  You should never have to use
20019 it explicitly.
20021 @item -mlinked-fp
20022 @opindex mlinked-fp
20024 Follow the EABI requirement of always creating a frame pointer whenever
20025 a stack frame is allocated.  This option is enabled by default and can
20026 be disabled with @option{-mno-linked-fp}.
20028 @item -mlong-calls
20029 @opindex mlong-calls
20031 Use indirect addressing to call functions outside the current
20032 compilation unit.  This allows the functions to be placed anywhere
20033 within the 32-bit address space.
20035 @item -malign-labels
20036 @opindex malign-labels
20038 Try to align labels to an 8-byte boundary by inserting NOPs into the
20039 previous packet.  This option only has an effect when VLIW packing
20040 is enabled.  It doesn't create new packets; it merely adds NOPs to
20041 existing ones.
20043 @item -mlibrary-pic
20044 @opindex mlibrary-pic
20046 Generate position-independent EABI code.
20048 @item -macc-4
20049 @opindex macc-4
20051 Use only the first four media accumulator registers.
20053 @item -macc-8
20054 @opindex macc-8
20056 Use all eight media accumulator registers.
20058 @item -mpack
20059 @opindex mpack
20061 Pack VLIW instructions.
20063 @item -mno-pack
20064 @opindex mno-pack
20066 Do not pack VLIW instructions.
20068 @item -mno-eflags
20069 @opindex mno-eflags
20071 Do not mark ABI switches in e_flags.
20073 @item -mcond-move
20074 @opindex mcond-move
20076 Enable the use of conditional-move instructions (default).
20078 This switch is mainly for debugging the compiler and will likely be removed
20079 in a future version.
20081 @item -mno-cond-move
20082 @opindex mno-cond-move
20084 Disable the use of conditional-move instructions.
20086 This switch is mainly for debugging the compiler and will likely be removed
20087 in a future version.
20089 @item -mscc
20090 @opindex mscc
20092 Enable the use of conditional set instructions (default).
20094 This switch is mainly for debugging the compiler and will likely be removed
20095 in a future version.
20097 @item -mno-scc
20098 @opindex mno-scc
20100 Disable the use of conditional set instructions.
20102 This switch is mainly for debugging the compiler and will likely be removed
20103 in a future version.
20105 @item -mcond-exec
20106 @opindex mcond-exec
20108 Enable the use of conditional execution (default).
20110 This switch is mainly for debugging the compiler and will likely be removed
20111 in a future version.
20113 @item -mno-cond-exec
20114 @opindex mno-cond-exec
20116 Disable the use of conditional execution.
20118 This switch is mainly for debugging the compiler and will likely be removed
20119 in a future version.
20121 @item -mvliw-branch
20122 @opindex mvliw-branch
20124 Run a pass to pack branches into VLIW instructions (default).
20126 This switch is mainly for debugging the compiler and will likely be removed
20127 in a future version.
20129 @item -mno-vliw-branch
20130 @opindex mno-vliw-branch
20132 Do not run a pass to pack branches into VLIW instructions.
20134 This switch is mainly for debugging the compiler and will likely be removed
20135 in a future version.
20137 @item -mmulti-cond-exec
20138 @opindex mmulti-cond-exec
20140 Enable optimization of @code{&&} and @code{||} in conditional execution
20141 (default).
20143 This switch is mainly for debugging the compiler and will likely be removed
20144 in a future version.
20146 @item -mno-multi-cond-exec
20147 @opindex mno-multi-cond-exec
20149 Disable optimization of @code{&&} and @code{||} in conditional execution.
20151 This switch is mainly for debugging the compiler and will likely be removed
20152 in a future version.
20154 @item -mnested-cond-exec
20155 @opindex mnested-cond-exec
20157 Enable nested conditional execution optimizations (default).
20159 This switch is mainly for debugging the compiler and will likely be removed
20160 in a future version.
20162 @item -mno-nested-cond-exec
20163 @opindex mno-nested-cond-exec
20165 Disable nested conditional execution optimizations.
20167 This switch is mainly for debugging the compiler and will likely be removed
20168 in a future version.
20170 @item -moptimize-membar
20171 @opindex moptimize-membar
20173 This switch removes redundant @code{membar} instructions from the
20174 compiler-generated code.  It is enabled by default.
20176 @item -mno-optimize-membar
20177 @opindex mno-optimize-membar
20178 @opindex moptimize-membar
20180 This switch disables the automatic removal of redundant @code{membar}
20181 instructions from the generated code.
20183 @item -mtomcat-stats
20184 @opindex mtomcat-stats
20186 Cause gas to print out tomcat statistics.
20188 @item -mcpu=@var{cpu}
20189 @opindex mcpu
20191 Select the processor type for which to generate code.  Possible values are
20192 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20193 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20195 @end table
20197 @node GNU/Linux Options
20198 @subsection GNU/Linux Options
20200 These @samp{-m} options are defined for GNU/Linux targets:
20202 @table @gcctabopt
20203 @item -mglibc
20204 @opindex mglibc
20205 Use the GNU C library.  This is the default except
20206 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20207 @samp{*-*-linux-*android*} targets.
20209 @item -muclibc
20210 @opindex muclibc
20211 Use uClibc C library.  This is the default on
20212 @samp{*-*-linux-*uclibc*} targets.
20214 @item -mmusl
20215 @opindex mmusl
20216 Use the musl C library.  This is the default on
20217 @samp{*-*-linux-*musl*} targets.
20219 @item -mbionic
20220 @opindex mbionic
20221 Use Bionic C library.  This is the default on
20222 @samp{*-*-linux-*android*} targets.
20224 @item -mandroid
20225 @opindex mandroid
20226 Compile code compatible with Android platform.  This is the default on
20227 @samp{*-*-linux-*android*} targets.
20229 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20230 @option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
20231 this option makes the GCC driver pass Android-specific options to the linker.
20232 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20233 to be defined.
20235 @item -tno-android-cc
20236 @opindex tno-android-cc
20237 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20238 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20239 @option{-fno-rtti} by default.
20241 @item -tno-android-ld
20242 @opindex tno-android-ld
20243 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20244 linking options to the linker.
20246 @end table
20248 @node H8/300 Options
20249 @subsection H8/300 Options
20251 These @samp{-m} options are defined for the H8/300 implementations:
20253 @table @gcctabopt
20254 @item -mrelax
20255 @opindex mrelax
20256 Shorten some address references at link time, when possible; uses the
20257 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
20258 ld, Using ld}, for a fuller description.
20260 @item -mh
20261 @opindex mh
20262 Generate code for the H8/300H@.
20264 @item -ms
20265 @opindex ms
20266 Generate code for the H8S@.
20268 @item -mn
20269 @opindex mn
20270 Generate code for the H8S and H8/300H in the normal mode.  This switch
20271 must be used either with @option{-mh} or @option{-ms}.
20273 @item -ms2600
20274 @opindex ms2600
20275 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
20277 @item -mexr
20278 @opindex mexr
20279 Extended registers are stored on stack before execution of function
20280 with monitor attribute. Default option is @option{-mexr}.
20281 This option is valid only for H8S targets.
20283 @item -mno-exr
20284 @opindex mno-exr
20285 @opindex mexr
20286 Extended registers are not stored on stack before execution of function 
20287 with monitor attribute. Default option is @option{-mno-exr}. 
20288 This option is valid only for H8S targets.
20290 @item -mint32
20291 @opindex mint32
20292 Make @code{int} data 32 bits by default.
20294 @item -malign-300
20295 @opindex malign-300
20296 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20297 The default for the H8/300H and H8S is to align longs and floats on
20298 4-byte boundaries.
20299 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20300 This option has no effect on the H8/300.
20301 @end table
20303 @node HPPA Options
20304 @subsection HPPA Options
20305 @cindex HPPA Options
20307 These @samp{-m} options are defined for the HPPA family of computers:
20309 @table @gcctabopt
20310 @item -march=@var{architecture-type}
20311 @opindex march
20312 Generate code for the specified architecture.  The choices for
20313 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20314 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
20315 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20316 architecture option for your machine.  Code compiled for lower numbered
20317 architectures runs on higher numbered architectures, but not the
20318 other way around.
20320 @item -mpa-risc-1-0
20321 @itemx -mpa-risc-1-1
20322 @itemx -mpa-risc-2-0
20323 @opindex mpa-risc-1-0
20324 @opindex mpa-risc-1-1
20325 @opindex mpa-risc-2-0
20326 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20328 @item -mcaller-copies
20329 @opindex mcaller-copies
20330 The caller copies function arguments passed by hidden reference.  This
20331 option should be used with care as it is not compatible with the default
20332 32-bit runtime.  However, only aggregates larger than eight bytes are
20333 passed by hidden reference and the option provides better compatibility
20334 with OpenMP.
20336 @item -mjump-in-delay
20337 @opindex mjump-in-delay
20338 This option is ignored and provided for compatibility purposes only.
20340 @item -mdisable-fpregs
20341 @opindex mdisable-fpregs
20342 Prevent floating-point registers from being used in any manner.  This is
20343 necessary for compiling kernels that perform lazy context switching of
20344 floating-point registers.  If you use this option and attempt to perform
20345 floating-point operations, the compiler aborts.
20347 @item -mdisable-indexing
20348 @opindex mdisable-indexing
20349 Prevent the compiler from using indexing address modes.  This avoids some
20350 rather obscure problems when compiling MIG generated code under MACH@.
20352 @item -mno-space-regs
20353 @opindex mno-space-regs
20354 @opindex mspace-regs
20355 Generate code that assumes the target has no space registers.  This allows
20356 GCC to generate faster indirect calls and use unscaled index address modes.
20358 Such code is suitable for level 0 PA systems and kernels.
20360 @item -mfast-indirect-calls
20361 @opindex mfast-indirect-calls
20362 Generate code that assumes calls never cross space boundaries.  This
20363 allows GCC to emit code that performs faster indirect calls.
20365 This option does not work in the presence of shared libraries or nested
20366 functions.
20368 @item -mfixed-range=@var{register-range}
20369 @opindex mfixed-range
20370 Generate code treating the given register range as fixed registers.
20371 A fixed register is one that the register allocator cannot use.  This is
20372 useful when compiling kernel code.  A register range is specified as
20373 two registers separated by a dash.  Multiple register ranges can be
20374 specified separated by a comma.
20376 @item -mlong-load-store
20377 @opindex mlong-load-store
20378 Generate 3-instruction load and store sequences as sometimes required by
20379 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
20380 the HP compilers.
20382 @item -mportable-runtime
20383 @opindex mportable-runtime
20384 Use the portable calling conventions proposed by HP for ELF systems.
20386 @item -mgas
20387 @opindex mgas
20388 Enable the use of assembler directives only GAS understands.
20390 @item -mschedule=@var{cpu-type}
20391 @opindex mschedule
20392 Schedule code according to the constraints for the machine type
20393 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
20394 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
20395 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20396 proper scheduling option for your machine.  The default scheduling is
20397 @samp{8000}.
20399 @item -mlinker-opt
20400 @opindex mlinker-opt
20401 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
20402 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
20403 linkers in which they give bogus error messages when linking some programs.
20405 @item -msoft-float
20406 @opindex msoft-float
20407 Generate output containing library calls for floating point.
20408 @strong{Warning:} the requisite libraries are not available for all HPPA
20409 targets.  Normally the facilities of the machine's usual C compiler are
20410 used, but this cannot be done directly in cross-compilation.  You must make
20411 your own arrangements to provide suitable library functions for
20412 cross-compilation.
20414 @option{-msoft-float} changes the calling convention in the output file;
20415 therefore, it is only useful if you compile @emph{all} of a program with
20416 this option.  In particular, you need to compile @file{libgcc.a}, the
20417 library that comes with GCC, with @option{-msoft-float} in order for
20418 this to work.
20420 @item -msio
20421 @opindex msio
20422 Generate the predefine, @code{_SIO}, for server IO@.  The default is
20423 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
20424 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
20425 options are available under HP-UX and HI-UX@.
20427 @item -mgnu-ld
20428 @opindex mgnu-ld
20429 Use options specific to GNU @command{ld}.
20430 This passes @option{-shared} to @command{ld} when
20431 building a shared library.  It is the default when GCC is configured,
20432 explicitly or implicitly, with the GNU linker.  This option does not
20433 affect which @command{ld} is called; it only changes what parameters
20434 are passed to that @command{ld}.
20435 The @command{ld} that is called is determined by the
20436 @option{--with-ld} configure option, GCC's program search path, and
20437 finally by the user's @env{PATH}.  The linker used by GCC can be printed
20438 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
20439 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20441 @item -mhp-ld
20442 @opindex mhp-ld
20443 Use options specific to HP @command{ld}.
20444 This passes @option{-b} to @command{ld} when building
20445 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20446 links.  It is the default when GCC is configured, explicitly or
20447 implicitly, with the HP linker.  This option does not affect
20448 which @command{ld} is called; it only changes what parameters are passed to that
20449 @command{ld}.
20450 The @command{ld} that is called is determined by the @option{--with-ld}
20451 configure option, GCC's program search path, and finally by the user's
20452 @env{PATH}.  The linker used by GCC can be printed using @samp{which
20453 `gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
20454 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20456 @item -mlong-calls
20457 @opindex mno-long-calls
20458 @opindex mlong-calls
20459 Generate code that uses long call sequences.  This ensures that a call
20460 is always able to reach linker generated stubs.  The default is to generate
20461 long calls only when the distance from the call site to the beginning
20462 of the function or translation unit, as the case may be, exceeds a
20463 predefined limit set by the branch type being used.  The limits for
20464 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20465 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
20466 240,000 bytes.
20468 Distances are measured from the beginning of functions when using the
20469 @option{-ffunction-sections} option, or when using the @option{-mgas}
20470 and @option{-mno-portable-runtime} options together under HP-UX with
20471 the SOM linker.
20473 It is normally not desirable to use this option as it degrades
20474 performance.  However, it may be useful in large applications,
20475 particularly when partial linking is used to build the application.
20477 The types of long calls used depends on the capabilities of the
20478 assembler and linker, and the type of code being generated.  The
20479 impact on systems that support long absolute calls, and long pic
20480 symbol-difference or pc-relative calls should be relatively small.
20481 However, an indirect call is used on 32-bit ELF systems in pic code
20482 and it is quite long.
20484 @item -munix=@var{unix-std}
20485 @opindex march
20486 Generate compiler predefines and select a startfile for the specified
20487 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
20488 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
20489 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
20490 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
20491 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20492 and later.
20494 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20495 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20496 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20497 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20498 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20499 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20501 It is @emph{important} to note that this option changes the interfaces
20502 for various library routines.  It also affects the operational behavior
20503 of the C library.  Thus, @emph{extreme} care is needed in using this
20504 option.
20506 Library code that is intended to operate with more than one UNIX
20507 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20508 as appropriate.  Most GNU software doesn't provide this capability.
20510 @item -nolibdld
20511 @opindex nolibdld
20512 Suppress the generation of link options to search libdld.sl when the
20513 @option{-static} option is specified on HP-UX 10 and later.
20515 @item -static
20516 @opindex static
20517 The HP-UX implementation of setlocale in libc has a dependency on
20518 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
20519 when the @option{-static} option is specified, special link options
20520 are needed to resolve this dependency.
20522 On HP-UX 10 and later, the GCC driver adds the necessary options to
20523 link with libdld.sl when the @option{-static} option is specified.
20524 This causes the resulting binary to be dynamic.  On the 64-bit port,
20525 the linkers generate dynamic binaries by default in any case.  The
20526 @option{-nolibdld} option can be used to prevent the GCC driver from
20527 adding these link options.
20529 @item -threads
20530 @opindex threads
20531 Add support for multithreading with the @dfn{dce thread} library
20532 under HP-UX@.  This option sets flags for both the preprocessor and
20533 linker.
20534 @end table
20536 @node IA-64 Options
20537 @subsection IA-64 Options
20538 @cindex IA-64 Options
20540 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20542 @table @gcctabopt
20543 @item -mbig-endian
20544 @opindex mbig-endian
20545 Generate code for a big-endian target.  This is the default for HP-UX@.
20547 @item -mlittle-endian
20548 @opindex mlittle-endian
20549 Generate code for a little-endian target.  This is the default for AIX5
20550 and GNU/Linux.
20552 @item -mgnu-as
20553 @itemx -mno-gnu-as
20554 @opindex mgnu-as
20555 @opindex mno-gnu-as
20556 Generate (or don't) code for the GNU assembler.  This is the default.
20557 @c Also, this is the default if the configure option @option{--with-gnu-as}
20558 @c is used.
20560 @item -mgnu-ld
20561 @itemx -mno-gnu-ld
20562 @opindex mgnu-ld
20563 @opindex mno-gnu-ld
20564 Generate (or don't) code for the GNU linker.  This is the default.
20565 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20566 @c is used.
20568 @item -mno-pic
20569 @opindex mno-pic
20570 Generate code that does not use a global pointer register.  The result
20571 is not position independent code, and violates the IA-64 ABI@.
20573 @item -mvolatile-asm-stop
20574 @itemx -mno-volatile-asm-stop
20575 @opindex mvolatile-asm-stop
20576 @opindex mno-volatile-asm-stop
20577 Generate (or don't) a stop bit immediately before and after volatile asm
20578 statements.
20580 @item -mregister-names
20581 @itemx -mno-register-names
20582 @opindex mregister-names
20583 @opindex mno-register-names
20584 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20585 the stacked registers.  This may make assembler output more readable.
20587 @item -mno-sdata
20588 @itemx -msdata
20589 @opindex mno-sdata
20590 @opindex msdata
20591 Disable (or enable) optimizations that use the small data section.  This may
20592 be useful for working around optimizer bugs.
20594 @item -mconstant-gp
20595 @opindex mconstant-gp
20596 Generate code that uses a single constant global pointer value.  This is
20597 useful when compiling kernel code.
20599 @item -mauto-pic
20600 @opindex mauto-pic
20601 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
20602 This is useful when compiling firmware code.
20604 @item -minline-float-divide-min-latency
20605 @opindex minline-float-divide-min-latency
20606 Generate code for inline divides of floating-point values
20607 using the minimum latency algorithm.
20609 @item -minline-float-divide-max-throughput
20610 @opindex minline-float-divide-max-throughput
20611 Generate code for inline divides of floating-point values
20612 using the maximum throughput algorithm.
20614 @item -mno-inline-float-divide
20615 @opindex mno-inline-float-divide
20616 Do not generate inline code for divides of floating-point values.
20618 @item -minline-int-divide-min-latency
20619 @opindex minline-int-divide-min-latency
20620 Generate code for inline divides of integer values
20621 using the minimum latency algorithm.
20623 @item -minline-int-divide-max-throughput
20624 @opindex minline-int-divide-max-throughput
20625 Generate code for inline divides of integer values
20626 using the maximum throughput algorithm.
20628 @item -mno-inline-int-divide
20629 @opindex mno-inline-int-divide
20630 @opindex minline-int-divide
20631 Do not generate inline code for divides of integer values.
20633 @item -minline-sqrt-min-latency
20634 @opindex minline-sqrt-min-latency
20635 Generate code for inline square roots
20636 using the minimum latency algorithm.
20638 @item -minline-sqrt-max-throughput
20639 @opindex minline-sqrt-max-throughput
20640 Generate code for inline square roots
20641 using the maximum throughput algorithm.
20643 @item -mno-inline-sqrt
20644 @opindex mno-inline-sqrt
20645 Do not generate inline code for @code{sqrt}.
20647 @item -mfused-madd
20648 @itemx -mno-fused-madd
20649 @opindex mfused-madd
20650 @opindex mno-fused-madd
20651 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20652 instructions.  The default is to use these instructions.
20654 @item -mno-dwarf2-asm
20655 @itemx -mdwarf2-asm
20656 @opindex mno-dwarf2-asm
20657 @opindex mdwarf2-asm
20658 Don't (or do) generate assembler code for the DWARF line number debugging
20659 info.  This may be useful when not using the GNU assembler.
20661 @item -mearly-stop-bits
20662 @itemx -mno-early-stop-bits
20663 @opindex mearly-stop-bits
20664 @opindex mno-early-stop-bits
20665 Allow stop bits to be placed earlier than immediately preceding the
20666 instruction that triggered the stop bit.  This can improve instruction
20667 scheduling, but does not always do so.
20669 @item -mfixed-range=@var{register-range}
20670 @opindex mfixed-range
20671 Generate code treating the given register range as fixed registers.
20672 A fixed register is one that the register allocator cannot use.  This is
20673 useful when compiling kernel code.  A register range is specified as
20674 two registers separated by a dash.  Multiple register ranges can be
20675 specified separated by a comma.
20677 @item -mtls-size=@var{tls-size}
20678 @opindex mtls-size
20679 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
20682 @item -mtune=@var{cpu-type}
20683 @opindex mtune
20684 Tune the instruction scheduling for a particular CPU, Valid values are
20685 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20686 and @samp{mckinley}.
20688 @item -milp32
20689 @itemx -mlp64
20690 @opindex milp32
20691 @opindex mlp64
20692 Generate code for a 32-bit or 64-bit environment.
20693 The 32-bit environment sets int, long and pointer to 32 bits.
20694 The 64-bit environment sets int to 32 bits and long and pointer
20695 to 64 bits.  These are HP-UX specific flags.
20697 @item -mno-sched-br-data-spec
20698 @itemx -msched-br-data-spec
20699 @opindex mno-sched-br-data-spec
20700 @opindex msched-br-data-spec
20701 (Dis/En)able data speculative scheduling before reload.
20702 This results in generation of @code{ld.a} instructions and
20703 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20704 The default setting is disabled.
20706 @item -msched-ar-data-spec
20707 @itemx -mno-sched-ar-data-spec
20708 @opindex msched-ar-data-spec
20709 @opindex mno-sched-ar-data-spec
20710 (En/Dis)able data speculative scheduling after reload.
20711 This results in generation of @code{ld.a} instructions and
20712 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20713 The default setting is enabled.
20715 @item -mno-sched-control-spec
20716 @itemx -msched-control-spec
20717 @opindex mno-sched-control-spec
20718 @opindex msched-control-spec
20719 (Dis/En)able control speculative scheduling.  This feature is
20720 available only during region scheduling (i.e.@: before reload).
20721 This results in generation of the @code{ld.s} instructions and
20722 the corresponding check instructions @code{chk.s}.
20723 The default setting is disabled.
20725 @item -msched-br-in-data-spec
20726 @itemx -mno-sched-br-in-data-spec
20727 @opindex msched-br-in-data-spec
20728 @opindex mno-sched-br-in-data-spec
20729 (En/Dis)able speculative scheduling of the instructions that
20730 are dependent on the data speculative loads before reload.
20731 This is effective only with @option{-msched-br-data-spec} enabled.
20732 The default setting is enabled.
20734 @item -msched-ar-in-data-spec
20735 @itemx -mno-sched-ar-in-data-spec
20736 @opindex msched-ar-in-data-spec
20737 @opindex mno-sched-ar-in-data-spec
20738 (En/Dis)able speculative scheduling of the instructions that
20739 are dependent on the data speculative loads after reload.
20740 This is effective only with @option{-msched-ar-data-spec} enabled.
20741 The default setting is enabled.
20743 @item -msched-in-control-spec
20744 @itemx -mno-sched-in-control-spec
20745 @opindex msched-in-control-spec
20746 @opindex mno-sched-in-control-spec
20747 (En/Dis)able speculative scheduling of the instructions that
20748 are dependent on the control speculative loads.
20749 This is effective only with @option{-msched-control-spec} enabled.
20750 The default setting is enabled.
20752 @item -mno-sched-prefer-non-data-spec-insns
20753 @itemx -msched-prefer-non-data-spec-insns
20754 @opindex mno-sched-prefer-non-data-spec-insns
20755 @opindex msched-prefer-non-data-spec-insns
20756 If enabled, data-speculative instructions are chosen for schedule
20757 only if there are no other choices at the moment.  This makes
20758 the use of the data speculation much more conservative.
20759 The default setting is disabled.
20761 @item -mno-sched-prefer-non-control-spec-insns
20762 @itemx -msched-prefer-non-control-spec-insns
20763 @opindex mno-sched-prefer-non-control-spec-insns
20764 @opindex msched-prefer-non-control-spec-insns
20765 If enabled, control-speculative instructions are chosen for schedule
20766 only if there are no other choices at the moment.  This makes
20767 the use of the control speculation much more conservative.
20768 The default setting is disabled.
20770 @item -mno-sched-count-spec-in-critical-path
20771 @itemx -msched-count-spec-in-critical-path
20772 @opindex mno-sched-count-spec-in-critical-path
20773 @opindex msched-count-spec-in-critical-path
20774 If enabled, speculative dependencies are considered during
20775 computation of the instructions priorities.  This makes the use of the
20776 speculation a bit more conservative.
20777 The default setting is disabled.
20779 @item -msched-spec-ldc
20780 @opindex msched-spec-ldc
20781 Use a simple data speculation check.  This option is on by default.
20783 @item -msched-control-spec-ldc
20784 @opindex msched-spec-ldc
20785 Use a simple check for control speculation.  This option is on by default.
20787 @item -msched-stop-bits-after-every-cycle
20788 @opindex msched-stop-bits-after-every-cycle
20789 Place a stop bit after every cycle when scheduling.  This option is on
20790 by default.
20792 @item -msched-fp-mem-deps-zero-cost
20793 @opindex msched-fp-mem-deps-zero-cost
20794 Assume that floating-point stores and loads are not likely to cause a conflict
20795 when placed into the same instruction group.  This option is disabled by
20796 default.
20798 @item -msel-sched-dont-check-control-spec
20799 @opindex msel-sched-dont-check-control-spec
20800 Generate checks for control speculation in selective scheduling.
20801 This flag is disabled by default.
20803 @item -msched-max-memory-insns=@var{max-insns}
20804 @opindex msched-max-memory-insns
20805 Limit on the number of memory insns per instruction group, giving lower
20806 priority to subsequent memory insns attempting to schedule in the same
20807 instruction group. Frequently useful to prevent cache bank conflicts.
20808 The default value is 1.
20810 @item -msched-max-memory-insns-hard-limit
20811 @opindex msched-max-memory-insns-hard-limit
20812 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20813 disallowing more than that number in an instruction group.
20814 Otherwise, the limit is ``soft'', meaning that non-memory operations
20815 are preferred when the limit is reached, but memory operations may still
20816 be scheduled.
20818 @end table
20820 @node LM32 Options
20821 @subsection LM32 Options
20822 @cindex LM32 options
20824 These @option{-m} options are defined for the LatticeMico32 architecture:
20826 @table @gcctabopt
20827 @item -mbarrel-shift-enabled
20828 @opindex mbarrel-shift-enabled
20829 Enable barrel-shift instructions.
20831 @item -mdivide-enabled
20832 @opindex mdivide-enabled
20833 Enable divide and modulus instructions.
20835 @item -mmultiply-enabled
20836 @opindex multiply-enabled
20837 Enable multiply instructions.
20839 @item -msign-extend-enabled
20840 @opindex msign-extend-enabled
20841 Enable sign extend instructions.
20843 @item -muser-enabled
20844 @opindex muser-enabled
20845 Enable user-defined instructions.
20847 @end table
20849 @node M32C Options
20850 @subsection M32C Options
20851 @cindex M32C options
20853 @table @gcctabopt
20854 @item -mcpu=@var{name}
20855 @opindex mcpu=
20856 Select the CPU for which code is generated.  @var{name} may be one of
20857 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20858 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20859 the M32C/80 series.
20861 @item -msim
20862 @opindex msim
20863 Specifies that the program will be run on the simulator.  This causes
20864 an alternate runtime library to be linked in which supports, for
20865 example, file I/O@.  You must not use this option when generating
20866 programs that will run on real hardware; you must provide your own
20867 runtime library for whatever I/O functions are needed.
20869 @item -memregs=@var{number}
20870 @opindex memregs=
20871 Specifies the number of memory-based pseudo-registers GCC uses
20872 during code generation.  These pseudo-registers are used like real
20873 registers, so there is a tradeoff between GCC's ability to fit the
20874 code into available registers, and the performance penalty of using
20875 memory instead of registers.  Note that all modules in a program must
20876 be compiled with the same value for this option.  Because of that, you
20877 must not use this option with GCC's default runtime libraries.
20879 @end table
20881 @node M32R/D Options
20882 @subsection M32R/D Options
20883 @cindex M32R/D options
20885 These @option{-m} options are defined for Renesas M32R/D architectures:
20887 @table @gcctabopt
20888 @item -m32r2
20889 @opindex m32r2
20890 Generate code for the M32R/2@.
20892 @item -m32rx
20893 @opindex m32rx
20894 Generate code for the M32R/X@.
20896 @item -m32r
20897 @opindex m32r
20898 Generate code for the M32R@.  This is the default.
20900 @item -mmodel=small
20901 @opindex mmodel=small
20902 Assume all objects live in the lower 16MB of memory (so that their addresses
20903 can be loaded with the @code{ld24} instruction), and assume all subroutines
20904 are reachable with the @code{bl} instruction.
20905 This is the default.
20907 The addressability of a particular object can be set with the
20908 @code{model} attribute.
20910 @item -mmodel=medium
20911 @opindex mmodel=medium
20912 Assume objects may be anywhere in the 32-bit address space (the compiler
20913 generates @code{seth/add3} instructions to load their addresses), and
20914 assume all subroutines are reachable with the @code{bl} instruction.
20916 @item -mmodel=large
20917 @opindex mmodel=large
20918 Assume objects may be anywhere in the 32-bit address space (the compiler
20919 generates @code{seth/add3} instructions to load their addresses), and
20920 assume subroutines may not be reachable with the @code{bl} instruction
20921 (the compiler generates the much slower @code{seth/add3/jl}
20922 instruction sequence).
20924 @item -msdata=none
20925 @opindex msdata=none
20926 Disable use of the small data area.  Variables are put into
20927 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20928 @code{section} attribute has been specified).
20929 This is the default.
20931 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20932 Objects may be explicitly put in the small data area with the
20933 @code{section} attribute using one of these sections.
20935 @item -msdata=sdata
20936 @opindex msdata=sdata
20937 Put small global and static data in the small data area, but do not
20938 generate special code to reference them.
20940 @item -msdata=use
20941 @opindex msdata=use
20942 Put small global and static data in the small data area, and generate
20943 special instructions to reference them.
20945 @item -G @var{num}
20946 @opindex G
20947 @cindex smaller data references
20948 Put global and static objects less than or equal to @var{num} bytes
20949 into the small data or BSS sections instead of the normal data or BSS
20950 sections.  The default value of @var{num} is 8.
20951 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20952 for this option to have any effect.
20954 All modules should be compiled with the same @option{-G @var{num}} value.
20955 Compiling with different values of @var{num} may or may not work; if it
20956 doesn't the linker gives an error message---incorrect code is not
20957 generated.
20959 @item -mdebug
20960 @opindex mdebug
20961 Makes the M32R-specific code in the compiler display some statistics
20962 that might help in debugging programs.
20964 @item -malign-loops
20965 @opindex malign-loops
20966 Align all loops to a 32-byte boundary.
20968 @item -mno-align-loops
20969 @opindex mno-align-loops
20970 Do not enforce a 32-byte alignment for loops.  This is the default.
20972 @item -missue-rate=@var{number}
20973 @opindex missue-rate=@var{number}
20974 Issue @var{number} instructions per cycle.  @var{number} can only be 1
20975 or 2.
20977 @item -mbranch-cost=@var{number}
20978 @opindex mbranch-cost=@var{number}
20979 @var{number} can only be 1 or 2.  If it is 1 then branches are
20980 preferred over conditional code, if it is 2, then the opposite applies.
20982 @item -mflush-trap=@var{number}
20983 @opindex mflush-trap=@var{number}
20984 Specifies the trap number to use to flush the cache.  The default is
20985 12.  Valid numbers are between 0 and 15 inclusive.
20987 @item -mno-flush-trap
20988 @opindex mno-flush-trap
20989 Specifies that the cache cannot be flushed by using a trap.
20991 @item -mflush-func=@var{name}
20992 @opindex mflush-func=@var{name}
20993 Specifies the name of the operating system function to call to flush
20994 the cache.  The default is @samp{_flush_cache}, but a function call
20995 is only used if a trap is not available.
20997 @item -mno-flush-func
20998 @opindex mno-flush-func
20999 Indicates that there is no OS function for flushing the cache.
21001 @end table
21003 @node M680x0 Options
21004 @subsection M680x0 Options
21005 @cindex M680x0 options
21007 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
21008 The default settings depend on which architecture was selected when
21009 the compiler was configured; the defaults for the most common choices
21010 are given below.
21012 @table @gcctabopt
21013 @item -march=@var{arch}
21014 @opindex march
21015 Generate code for a specific M680x0 or ColdFire instruction set
21016 architecture.  Permissible values of @var{arch} for M680x0
21017 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
21018 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
21019 architectures are selected according to Freescale's ISA classification
21020 and the permissible values are: @samp{isaa}, @samp{isaaplus},
21021 @samp{isab} and @samp{isac}.
21023 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
21024 code for a ColdFire target.  The @var{arch} in this macro is one of the
21025 @option{-march} arguments given above.
21027 When used together, @option{-march} and @option{-mtune} select code
21028 that runs on a family of similar processors but that is optimized
21029 for a particular microarchitecture.
21031 @item -mcpu=@var{cpu}
21032 @opindex mcpu
21033 Generate code for a specific M680x0 or ColdFire processor.
21034 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
21035 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
21036 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
21037 below, which also classifies the CPUs into families:
21039 @multitable @columnfractions 0.20 0.80
21040 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
21041 @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}
21042 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
21043 @item @samp{5206e} @tab @samp{5206e}
21044 @item @samp{5208} @tab @samp{5207} @samp{5208}
21045 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
21046 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
21047 @item @samp{5216} @tab @samp{5214} @samp{5216}
21048 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
21049 @item @samp{5225} @tab @samp{5224} @samp{5225}
21050 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
21051 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
21052 @item @samp{5249} @tab @samp{5249}
21053 @item @samp{5250} @tab @samp{5250}
21054 @item @samp{5271} @tab @samp{5270} @samp{5271}
21055 @item @samp{5272} @tab @samp{5272}
21056 @item @samp{5275} @tab @samp{5274} @samp{5275}
21057 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
21058 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
21059 @item @samp{5307} @tab @samp{5307}
21060 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
21061 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
21062 @item @samp{5407} @tab @samp{5407}
21063 @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}
21064 @end multitable
21066 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
21067 @var{arch} is compatible with @var{cpu}.  Other combinations of
21068 @option{-mcpu} and @option{-march} are rejected.
21070 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
21071 @var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
21072 where the value of @var{family} is given by the table above.
21074 @item -mtune=@var{tune}
21075 @opindex mtune
21076 Tune the code for a particular microarchitecture within the
21077 constraints set by @option{-march} and @option{-mcpu}.
21078 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
21079 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
21080 and @samp{cpu32}.  The ColdFire microarchitectures
21081 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
21083 You can also use @option{-mtune=68020-40} for code that needs
21084 to run relatively well on 68020, 68030 and 68040 targets.
21085 @option{-mtune=68020-60} is similar but includes 68060 targets
21086 as well.  These two options select the same tuning decisions as
21087 @option{-m68020-40} and @option{-m68020-60} respectively.
21089 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
21090 when tuning for 680x0 architecture @var{arch}.  It also defines
21091 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
21092 option is used.  If GCC is tuning for a range of architectures,
21093 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
21094 it defines the macros for every architecture in the range.
21096 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
21097 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
21098 of the arguments given above.
21100 @item -m68000
21101 @itemx -mc68000
21102 @opindex m68000
21103 @opindex mc68000
21104 Generate output for a 68000.  This is the default
21105 when the compiler is configured for 68000-based systems.
21106 It is equivalent to @option{-march=68000}.
21108 Use this option for microcontrollers with a 68000 or EC000 core,
21109 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21111 @item -m68010
21112 @opindex m68010
21113 Generate output for a 68010.  This is the default
21114 when the compiler is configured for 68010-based systems.
21115 It is equivalent to @option{-march=68010}.
21117 @item -m68020
21118 @itemx -mc68020
21119 @opindex m68020
21120 @opindex mc68020
21121 Generate output for a 68020.  This is the default
21122 when the compiler is configured for 68020-based systems.
21123 It is equivalent to @option{-march=68020}.
21125 @item -m68030
21126 @opindex m68030
21127 Generate output for a 68030.  This is the default when the compiler is
21128 configured for 68030-based systems.  It is equivalent to
21129 @option{-march=68030}.
21131 @item -m68040
21132 @opindex m68040
21133 Generate output for a 68040.  This is the default when the compiler is
21134 configured for 68040-based systems.  It is equivalent to
21135 @option{-march=68040}.
21137 This option inhibits the use of 68881/68882 instructions that have to be
21138 emulated by software on the 68040.  Use this option if your 68040 does not
21139 have code to emulate those instructions.
21141 @item -m68060
21142 @opindex m68060
21143 Generate output for a 68060.  This is the default when the compiler is
21144 configured for 68060-based systems.  It is equivalent to
21145 @option{-march=68060}.
21147 This option inhibits the use of 68020 and 68881/68882 instructions that
21148 have to be emulated by software on the 68060.  Use this option if your 68060
21149 does not have code to emulate those instructions.
21151 @item -mcpu32
21152 @opindex mcpu32
21153 Generate output for a CPU32.  This is the default
21154 when the compiler is configured for CPU32-based systems.
21155 It is equivalent to @option{-march=cpu32}.
21157 Use this option for microcontrollers with a
21158 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21159 68336, 68340, 68341, 68349 and 68360.
21161 @item -m5200
21162 @opindex m5200
21163 Generate output for a 520X ColdFire CPU@.  This is the default
21164 when the compiler is configured for 520X-based systems.
21165 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21166 in favor of that option.
21168 Use this option for microcontroller with a 5200 core, including
21169 the MCF5202, MCF5203, MCF5204 and MCF5206.
21171 @item -m5206e
21172 @opindex m5206e
21173 Generate output for a 5206e ColdFire CPU@.  The option is now
21174 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21176 @item -m528x
21177 @opindex m528x
21178 Generate output for a member of the ColdFire 528X family.
21179 The option is now deprecated in favor of the equivalent
21180 @option{-mcpu=528x}.
21182 @item -m5307
21183 @opindex m5307
21184 Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
21185 in favor of the equivalent @option{-mcpu=5307}.
21187 @item -m5407
21188 @opindex m5407
21189 Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
21190 in favor of the equivalent @option{-mcpu=5407}.
21192 @item -mcfv4e
21193 @opindex mcfv4e
21194 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21195 This includes use of hardware floating-point instructions.
21196 The option is equivalent to @option{-mcpu=547x}, and is now
21197 deprecated in favor of that option.
21199 @item -m68020-40
21200 @opindex m68020-40
21201 Generate output for a 68040, without using any of the new instructions.
21202 This results in code that can run relatively efficiently on either a
21203 68020/68881 or a 68030 or a 68040.  The generated code does use the
21204 68881 instructions that are emulated on the 68040.
21206 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21208 @item -m68020-60
21209 @opindex m68020-60
21210 Generate output for a 68060, without using any of the new instructions.
21211 This results in code that can run relatively efficiently on either a
21212 68020/68881 or a 68030 or a 68040.  The generated code does use the
21213 68881 instructions that are emulated on the 68060.
21215 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21217 @item -mhard-float
21218 @itemx -m68881
21219 @opindex mhard-float
21220 @opindex m68881
21221 Generate floating-point instructions.  This is the default for 68020
21222 and above, and for ColdFire devices that have an FPU@.  It defines the
21223 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21224 on ColdFire targets.
21226 @item -msoft-float
21227 @opindex msoft-float
21228 Do not generate floating-point instructions; use library calls instead.
21229 This is the default for 68000, 68010, and 68832 targets.  It is also
21230 the default for ColdFire devices that have no FPU.
21232 @item -mdiv
21233 @itemx -mno-div
21234 @opindex mdiv
21235 @opindex mno-div
21236 Generate (do not generate) ColdFire hardware divide and remainder
21237 instructions.  If @option{-march} is used without @option{-mcpu},
21238 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21239 architectures.  Otherwise, the default is taken from the target CPU
21240 (either the default CPU, or the one specified by @option{-mcpu}).  For
21241 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21242 @option{-mcpu=5206e}.
21244 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21246 @item -mshort
21247 @opindex mshort
21248 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21249 Additionally, parameters passed on the stack are also aligned to a
21250 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21252 @item -mno-short
21253 @opindex mno-short
21254 Do not consider type @code{int} to be 16 bits wide.  This is the default.
21256 @item -mnobitfield
21257 @itemx -mno-bitfield
21258 @opindex mnobitfield
21259 @opindex mno-bitfield
21260 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
21261 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21263 @item -mbitfield
21264 @opindex mbitfield
21265 Do use the bit-field instructions.  The @option{-m68020} option implies
21266 @option{-mbitfield}.  This is the default if you use a configuration
21267 designed for a 68020.
21269 @item -mrtd
21270 @opindex mrtd
21271 Use a different function-calling convention, in which functions
21272 that take a fixed number of arguments return with the @code{rtd}
21273 instruction, which pops their arguments while returning.  This
21274 saves one instruction in the caller since there is no need to pop
21275 the arguments there.
21277 This calling convention is incompatible with the one normally
21278 used on Unix, so you cannot use it if you need to call libraries
21279 compiled with the Unix compiler.
21281 Also, you must provide function prototypes for all functions that
21282 take variable numbers of arguments (including @code{printf});
21283 otherwise incorrect code is generated for calls to those
21284 functions.
21286 In addition, seriously incorrect code results if you call a
21287 function with too many arguments.  (Normally, extra arguments are
21288 harmlessly ignored.)
21290 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21291 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21293 The default is @option{-mno-rtd}.
21295 @item -malign-int
21296 @itemx -mno-align-int
21297 @opindex malign-int
21298 @opindex mno-align-int
21299 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21300 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21301 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21302 Aligning variables on 32-bit boundaries produces code that runs somewhat
21303 faster on processors with 32-bit busses at the expense of more memory.
21305 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21306 aligns structures containing the above types differently than
21307 most published application binary interface specifications for the m68k.
21309 @item -mpcrel
21310 @opindex mpcrel
21311 Use the pc-relative addressing mode of the 68000 directly, instead of
21312 using a global offset table.  At present, this option implies @option{-fpic},
21313 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
21314 not presently supported with @option{-mpcrel}, though this could be supported for
21315 68020 and higher processors.
21317 @item -mno-strict-align
21318 @itemx -mstrict-align
21319 @opindex mno-strict-align
21320 @opindex mstrict-align
21321 Do not (do) assume that unaligned memory references are handled by
21322 the system.
21324 @item -msep-data
21325 Generate code that allows the data segment to be located in a different
21326 area of memory from the text segment.  This allows for execute-in-place in
21327 an environment without virtual memory management.  This option implies
21328 @option{-fPIC}.
21330 @item -mno-sep-data
21331 Generate code that assumes that the data segment follows the text segment.
21332 This is the default.
21334 @item -mid-shared-library
21335 Generate code that supports shared libraries via the library ID method.
21336 This allows for execute-in-place and shared libraries in an environment
21337 without virtual memory management.  This option implies @option{-fPIC}.
21339 @item -mno-id-shared-library
21340 Generate code that doesn't assume ID-based shared libraries are being used.
21341 This is the default.
21343 @item -mshared-library-id=n
21344 Specifies the identification number of the ID-based shared library being
21345 compiled.  Specifying a value of 0 generates more compact code; specifying
21346 other values forces the allocation of that number to the current
21347 library, but is no more space- or time-efficient than omitting this option.
21349 @item -mxgot
21350 @itemx -mno-xgot
21351 @opindex mxgot
21352 @opindex mno-xgot
21353 When generating position-independent code for ColdFire, generate code
21354 that works if the GOT has more than 8192 entries.  This code is
21355 larger and slower than code generated without this option.  On M680x0
21356 processors, this option is not needed; @option{-fPIC} suffices.
21358 GCC normally uses a single instruction to load values from the GOT@.
21359 While this is relatively efficient, it only works if the GOT
21360 is smaller than about 64k.  Anything larger causes the linker
21361 to report an error such as:
21363 @cindex relocation truncated to fit (ColdFire)
21364 @smallexample
21365 relocation truncated to fit: R_68K_GOT16O foobar
21366 @end smallexample
21368 If this happens, you should recompile your code with @option{-mxgot}.
21369 It should then work with very large GOTs.  However, code generated with
21370 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21371 the value of a global symbol.
21373 Note that some linkers, including newer versions of the GNU linker,
21374 can create multiple GOTs and sort GOT entries.  If you have such a linker,
21375 you should only need to use @option{-mxgot} when compiling a single
21376 object file that accesses more than 8192 GOT entries.  Very few do.
21378 These options have no effect unless GCC is generating
21379 position-independent code.
21381 @item -mlong-jump-table-offsets
21382 @opindex mlong-jump-table-offsets
21383 Use 32-bit offsets in @code{switch} tables.  The default is to use
21384 16-bit offsets.
21386 @end table
21388 @node MCore Options
21389 @subsection MCore Options
21390 @cindex MCore options
21392 These are the @samp{-m} options defined for the Motorola M*Core
21393 processors.
21395 @table @gcctabopt
21397 @item -mhardlit
21398 @itemx -mno-hardlit
21399 @opindex mhardlit
21400 @opindex mno-hardlit
21401 Inline constants into the code stream if it can be done in two
21402 instructions or less.
21404 @item -mdiv
21405 @itemx -mno-div
21406 @opindex mdiv
21407 @opindex mno-div
21408 Use the divide instruction.  (Enabled by default).
21410 @item -mrelax-immediate
21411 @itemx -mno-relax-immediate
21412 @opindex mrelax-immediate
21413 @opindex mno-relax-immediate
21414 Allow arbitrary-sized immediates in bit operations.
21416 @item -mwide-bitfields
21417 @itemx -mno-wide-bitfields
21418 @opindex mwide-bitfields
21419 @opindex mno-wide-bitfields
21420 Always treat bit-fields as @code{int}-sized.
21422 @item -m4byte-functions
21423 @itemx -mno-4byte-functions
21424 @opindex m4byte-functions
21425 @opindex mno-4byte-functions
21426 Force all functions to be aligned to a 4-byte boundary.
21428 @item -mcallgraph-data
21429 @itemx -mno-callgraph-data
21430 @opindex mcallgraph-data
21431 @opindex mno-callgraph-data
21432 Emit callgraph information.
21434 @item -mslow-bytes
21435 @itemx -mno-slow-bytes
21436 @opindex mslow-bytes
21437 @opindex mno-slow-bytes
21438 Prefer word access when reading byte quantities.
21440 @item -mlittle-endian
21441 @itemx -mbig-endian
21442 @opindex mlittle-endian
21443 @opindex mbig-endian
21444 Generate code for a little-endian target.
21446 @item -m210
21447 @itemx -m340
21448 @opindex m210
21449 @opindex m340
21450 Generate code for the 210 processor.
21452 @item -mno-lsim
21453 @opindex mno-lsim
21454 Assume that runtime support has been provided and so omit the
21455 simulator library (@file{libsim.a)} from the linker command line.
21457 @item -mstack-increment=@var{size}
21458 @opindex mstack-increment
21459 Set the maximum amount for a single stack increment operation.  Large
21460 values can increase the speed of programs that contain functions
21461 that need a large amount of stack space, but they can also trigger a
21462 segmentation fault if the stack is extended too much.  The default
21463 value is 0x1000.
21465 @end table
21467 @node MeP Options
21468 @subsection MeP Options
21469 @cindex MeP options
21471 @table @gcctabopt
21473 @item -mabsdiff
21474 @opindex mabsdiff
21475 Enables the @code{abs} instruction, which is the absolute difference
21476 between two registers.
21478 @item -mall-opts
21479 @opindex mall-opts
21480 Enables all the optional instructions---average, multiply, divide, bit
21481 operations, leading zero, absolute difference, min/max, clip, and
21482 saturation.
21485 @item -maverage
21486 @opindex maverage
21487 Enables the @code{ave} instruction, which computes the average of two
21488 registers.
21490 @item -mbased=@var{n}
21491 @opindex mbased=
21492 Variables of size @var{n} bytes or smaller are placed in the
21493 @code{.based} section by default.  Based variables use the @code{$tp}
21494 register as a base register, and there is a 128-byte limit to the
21495 @code{.based} section.
21497 @item -mbitops
21498 @opindex mbitops
21499 Enables the bit operation instructions---bit test (@code{btstm}), set
21500 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21501 test-and-set (@code{tas}).
21503 @item -mc=@var{name}
21504 @opindex mc=
21505 Selects which section constant data is placed in.  @var{name} may
21506 be @samp{tiny}, @samp{near}, or @samp{far}.
21508 @item -mclip
21509 @opindex mclip
21510 Enables the @code{clip} instruction.  Note that @option{-mclip} is not
21511 useful unless you also provide @option{-mminmax}.
21513 @item -mconfig=@var{name}
21514 @opindex mconfig=
21515 Selects one of the built-in core configurations.  Each MeP chip has
21516 one or more modules in it; each module has a core CPU and a variety of
21517 coprocessors, optional instructions, and peripherals.  The
21518 @code{MeP-Integrator} tool, not part of GCC, provides these
21519 configurations through this option; using this option is the same as
21520 using all the corresponding command-line options.  The default
21521 configuration is @samp{default}.
21523 @item -mcop
21524 @opindex mcop
21525 Enables the coprocessor instructions.  By default, this is a 32-bit
21526 coprocessor.  Note that the coprocessor is normally enabled via the
21527 @option{-mconfig=} option.
21529 @item -mcop32
21530 @opindex mcop32
21531 Enables the 32-bit coprocessor's instructions.
21533 @item -mcop64
21534 @opindex mcop64
21535 Enables the 64-bit coprocessor's instructions.
21537 @item -mivc2
21538 @opindex mivc2
21539 Enables IVC2 scheduling.  IVC2 is a 64-bit VLIW coprocessor.
21541 @item -mdc
21542 @opindex mdc
21543 Causes constant variables to be placed in the @code{.near} section.
21545 @item -mdiv
21546 @opindex mdiv
21547 Enables the @code{div} and @code{divu} instructions.
21549 @item -meb
21550 @opindex meb
21551 Generate big-endian code.
21553 @item -mel
21554 @opindex mel
21555 Generate little-endian code.
21557 @item -mio-volatile
21558 @opindex mio-volatile
21559 Tells the compiler that any variable marked with the @code{io}
21560 attribute is to be considered volatile.
21562 @item -ml
21563 @opindex ml
21564 Causes variables to be assigned to the @code{.far} section by default.
21566 @item -mleadz
21567 @opindex mleadz
21568 Enables the @code{leadz} (leading zero) instruction.
21570 @item -mm
21571 @opindex mm
21572 Causes variables to be assigned to the @code{.near} section by default.
21574 @item -mminmax
21575 @opindex mminmax
21576 Enables the @code{min} and @code{max} instructions.
21578 @item -mmult
21579 @opindex mmult
21580 Enables the multiplication and multiply-accumulate instructions.
21582 @item -mno-opts
21583 @opindex mno-opts
21584 Disables all the optional instructions enabled by @option{-mall-opts}.
21586 @item -mrepeat
21587 @opindex mrepeat
21588 Enables the @code{repeat} and @code{erepeat} instructions, used for
21589 low-overhead looping.
21591 @item -ms
21592 @opindex ms
21593 Causes all variables to default to the @code{.tiny} section.  Note
21594 that there is a 65536-byte limit to this section.  Accesses to these
21595 variables use the @code{%gp} base register.
21597 @item -msatur
21598 @opindex msatur
21599 Enables the saturation instructions.  Note that the compiler does not
21600 currently generate these itself, but this option is included for
21601 compatibility with other tools, like @code{as}.
21603 @item -msdram
21604 @opindex msdram
21605 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21607 @item -msim
21608 @opindex msim
21609 Link the simulator run-time libraries.
21611 @item -msimnovec
21612 @opindex msimnovec
21613 Link the simulator runtime libraries, excluding built-in support
21614 for reset and exception vectors and tables.
21616 @item -mtf
21617 @opindex mtf
21618 Causes all functions to default to the @code{.far} section.  Without
21619 this option, functions default to the @code{.near} section.
21621 @item -mtiny=@var{n}
21622 @opindex mtiny=
21623 Variables that are @var{n} bytes or smaller are allocated to the
21624 @code{.tiny} section.  These variables use the @code{$gp} base
21625 register.  The default for this option is 4, but note that there's a
21626 65536-byte limit to the @code{.tiny} section.
21628 @end table
21630 @node MicroBlaze Options
21631 @subsection MicroBlaze Options
21632 @cindex MicroBlaze Options
21634 @table @gcctabopt
21636 @item -msoft-float
21637 @opindex msoft-float
21638 Use software emulation for floating point (default).
21640 @item -mhard-float
21641 @opindex mhard-float
21642 Use hardware floating-point instructions.
21644 @item -mmemcpy
21645 @opindex mmemcpy
21646 Do not optimize block moves, use @code{memcpy}.
21648 @item -mno-clearbss
21649 @opindex mno-clearbss
21650 This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
21652 @item -mcpu=@var{cpu-type}
21653 @opindex mcpu=
21654 Use features of, and schedule code for, the given CPU.
21655 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21656 where @var{X} is a major version, @var{YY} is the minor version, and
21657 @var{Z} is compatibility code.  Example values are @samp{v3.00.a},
21658 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21660 @item -mxl-soft-mul
21661 @opindex mxl-soft-mul
21662 Use software multiply emulation (default).
21664 @item -mxl-soft-div
21665 @opindex mxl-soft-div
21666 Use software emulation for divides (default).
21668 @item -mxl-barrel-shift
21669 @opindex mxl-barrel-shift
21670 Use the hardware barrel shifter.
21672 @item -mxl-pattern-compare
21673 @opindex mxl-pattern-compare
21674 Use pattern compare instructions.
21676 @item -msmall-divides
21677 @opindex msmall-divides
21678 Use table lookup optimization for small signed integer divisions.
21680 @item -mxl-stack-check
21681 @opindex mxl-stack-check
21682 This option is deprecated.  Use @option{-fstack-check} instead.
21684 @item -mxl-gp-opt
21685 @opindex mxl-gp-opt
21686 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21688 @item -mxl-multiply-high
21689 @opindex mxl-multiply-high
21690 Use multiply high instructions for high part of 32x32 multiply.
21692 @item -mxl-float-convert
21693 @opindex mxl-float-convert
21694 Use hardware floating-point conversion instructions.
21696 @item -mxl-float-sqrt
21697 @opindex mxl-float-sqrt
21698 Use hardware floating-point square root instruction.
21700 @item -mbig-endian
21701 @opindex mbig-endian
21702 Generate code for a big-endian target.
21704 @item -mlittle-endian
21705 @opindex mlittle-endian
21706 Generate code for a little-endian target.
21708 @item -mxl-reorder
21709 @opindex mxl-reorder
21710 Use reorder instructions (swap and byte reversed load/store).
21712 @item -mxl-mode-@var{app-model}
21713 Select application model @var{app-model}.  Valid models are
21714 @table @samp
21715 @item executable
21716 normal executable (default), uses startup code @file{crt0.o}.
21718 @item -mpic-data-is-text-relative
21719 @opindex mpic-data-is-text-relative
21720 Assume that the displacement between the text and data segments is fixed
21721 at static link time.  This allows data to be referenced by offset from start of
21722 text address instead of GOT since PC-relative addressing is not supported.
21724 @item xmdstub
21725 for use with Xilinx Microprocessor Debugger (XMD) based
21726 software intrusive debug agent called xmdstub. This uses startup file
21727 @file{crt1.o} and sets the start address of the program to 0x800.
21729 @item bootstrap
21730 for applications that are loaded using a bootloader.
21731 This model uses startup file @file{crt2.o} which does not contain a processor
21732 reset vector handler. This is suitable for transferring control on a
21733 processor reset to the bootloader rather than the application.
21735 @item novectors
21736 for applications that do not require any of the
21737 MicroBlaze vectors. This option may be useful for applications running
21738 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21739 @end table
21741 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21742 @option{-mxl-mode-@var{app-model}}.
21744 @end table
21746 @node MIPS Options
21747 @subsection MIPS Options
21748 @cindex MIPS options
21750 @table @gcctabopt
21752 @item -EB
21753 @opindex EB
21754 Generate big-endian code.
21756 @item -EL
21757 @opindex EL
21758 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
21759 configurations.
21761 @item -march=@var{arch}
21762 @opindex march
21763 Generate code that runs on @var{arch}, which can be the name of a
21764 generic MIPS ISA, or the name of a particular processor.
21765 The ISA names are:
21766 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21767 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21768 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21769 @samp{mips64r5} and @samp{mips64r6}.
21770 The processor names are:
21771 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21772 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21773 @samp{5kc}, @samp{5kf},
21774 @samp{20kc},
21775 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21776 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21777 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21778 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21779 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21780 @samp{i6400}, @samp{i6500},
21781 @samp{interaptiv},
21782 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21783 @samp{gs464e}, @samp{gs264e},
21784 @samp{m4k},
21785 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21786 @samp{m5100}, @samp{m5101},
21787 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21788 @samp{orion},
21789 @samp{p5600}, @samp{p6600},
21790 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21791 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21792 @samp{r6000}, @samp{r8000},
21793 @samp{rm7000}, @samp{rm9000},
21794 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21795 @samp{sb1},
21796 @samp{sr71000},
21797 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21798 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21799 @samp{xlr} and @samp{xlp}.
21800 The special value @samp{from-abi} selects the
21801 most compatible architecture for the selected ABI (that is,
21802 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21804 The native Linux/GNU toolchain also supports the value @samp{native},
21805 which selects the best architecture option for the host processor.
21806 @option{-march=native} has no effect if GCC does not recognize
21807 the processor.
21809 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21810 (for example, @option{-march=r2k}).  Prefixes are optional, and
21811 @samp{vr} may be written @samp{r}.
21813 Names of the form @samp{@var{n}f2_1} refer to processors with
21814 FPUs clocked at half the rate of the core, names of the form
21815 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21816 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21817 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21818 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21819 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21820 accepted as synonyms for @samp{@var{n}f1_1}.
21822 GCC defines two macros based on the value of this option.  The first
21823 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21824 a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
21825 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21826 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21827 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21829 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21830 above.  In other words, it has the full prefix and does not
21831 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
21832 the macro names the resolved architecture (either @code{"mips1"} or
21833 @code{"mips3"}).  It names the default architecture when no
21834 @option{-march} option is given.
21836 @item -mtune=@var{arch}
21837 @opindex mtune
21838 Optimize for @var{arch}.  Among other things, this option controls
21839 the way instructions are scheduled, and the perceived cost of arithmetic
21840 operations.  The list of @var{arch} values is the same as for
21841 @option{-march}.
21843 When this option is not used, GCC optimizes for the processor
21844 specified by @option{-march}.  By using @option{-march} and
21845 @option{-mtune} together, it is possible to generate code that
21846 runs on a family of processors, but optimize the code for one
21847 particular member of that family.
21849 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21850 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21851 @option{-march} ones described above.
21853 @item -mips1
21854 @opindex mips1
21855 Equivalent to @option{-march=mips1}.
21857 @item -mips2
21858 @opindex mips2
21859 Equivalent to @option{-march=mips2}.
21861 @item -mips3
21862 @opindex mips3
21863 Equivalent to @option{-march=mips3}.
21865 @item -mips4
21866 @opindex mips4
21867 Equivalent to @option{-march=mips4}.
21869 @item -mips32
21870 @opindex mips32
21871 Equivalent to @option{-march=mips32}.
21873 @item -mips32r3
21874 @opindex mips32r3
21875 Equivalent to @option{-march=mips32r3}.
21877 @item -mips32r5
21878 @opindex mips32r5
21879 Equivalent to @option{-march=mips32r5}.
21881 @item -mips32r6
21882 @opindex mips32r6
21883 Equivalent to @option{-march=mips32r6}.
21885 @item -mips64
21886 @opindex mips64
21887 Equivalent to @option{-march=mips64}.
21889 @item -mips64r2
21890 @opindex mips64r2
21891 Equivalent to @option{-march=mips64r2}.
21893 @item -mips64r3
21894 @opindex mips64r3
21895 Equivalent to @option{-march=mips64r3}.
21897 @item -mips64r5
21898 @opindex mips64r5
21899 Equivalent to @option{-march=mips64r5}.
21901 @item -mips64r6
21902 @opindex mips64r6
21903 Equivalent to @option{-march=mips64r6}.
21905 @item -mips16
21906 @itemx -mno-mips16
21907 @opindex mips16
21908 @opindex mno-mips16
21909 Generate (do not generate) MIPS16 code.  If GCC is targeting a
21910 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21912 MIPS16 code generation can also be controlled on a per-function basis
21913 by means of @code{mips16} and @code{nomips16} attributes.
21914 @xref{Function Attributes}, for more information.
21916 @item -mflip-mips16
21917 @opindex mflip-mips16
21918 Generate MIPS16 code on alternating functions.  This option is provided
21919 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21920 not intended for ordinary use in compiling user code.
21922 @item -minterlink-compressed
21923 @itemx -mno-interlink-compressed
21924 @opindex minterlink-compressed
21925 @opindex mno-interlink-compressed
21926 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21927 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21929 For example, code using the standard ISA encoding cannot jump directly
21930 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21931 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21932 knows that the target of the jump is not compressed.
21934 @item -minterlink-mips16
21935 @itemx -mno-interlink-mips16
21936 @opindex minterlink-mips16
21937 @opindex mno-interlink-mips16
21938 Aliases of @option{-minterlink-compressed} and
21939 @option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
21940 and are retained for backwards compatibility.
21942 @item -mabi=32
21943 @itemx -mabi=o64
21944 @itemx -mabi=n32
21945 @itemx -mabi=64
21946 @itemx -mabi=eabi
21947 @opindex mabi=32
21948 @opindex mabi=o64
21949 @opindex mabi=n32
21950 @opindex mabi=64
21951 @opindex mabi=eabi
21952 Generate code for the given ABI@.
21954 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
21955 generates 64-bit code when you select a 64-bit architecture, but you
21956 can use @option{-mgp32} to get 32-bit code instead.
21958 For information about the O64 ABI, see
21959 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21961 GCC supports a variant of the o32 ABI in which floating-point registers
21962 are 64 rather than 32 bits wide.  You can select this combination with
21963 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
21964 and @code{mfhc1} instructions and is therefore only supported for
21965 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21967 The register assignments for arguments and return values remain the
21968 same, but each scalar value is passed in a single 64-bit register
21969 rather than a pair of 32-bit registers.  For example, scalar
21970 floating-point values are returned in @samp{$f0} only, not a
21971 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
21972 remains the same in that the even-numbered double-precision registers
21973 are saved.
21975 Two additional variants of the o32 ABI are supported to enable
21976 a transition from 32-bit to 64-bit registers.  These are FPXX
21977 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21978 The FPXX extension mandates that all code must execute correctly
21979 when run using 32-bit or 64-bit registers.  The code can be interlinked
21980 with either FP32 or FP64, but not both.
21981 The FP64A extension is similar to the FP64 extension but forbids the
21982 use of odd-numbered single-precision registers.  This can be used
21983 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21984 processors and allows both FP32 and FP64A code to interlink and
21985 run in the same process without changing FPU modes.
21987 @item -mabicalls
21988 @itemx -mno-abicalls
21989 @opindex mabicalls
21990 @opindex mno-abicalls
21991 Generate (do not generate) code that is suitable for SVR4-style
21992 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
21993 systems.
21995 @item -mshared
21996 @itemx -mno-shared
21997 Generate (do not generate) code that is fully position-independent,
21998 and that can therefore be linked into shared libraries.  This option
21999 only affects @option{-mabicalls}.
22001 All @option{-mabicalls} code has traditionally been position-independent,
22002 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
22003 as an extension, the GNU toolchain allows executables to use absolute
22004 accesses for locally-binding symbols.  It can also use shorter GP
22005 initialization sequences and generate direct calls to locally-defined
22006 functions.  This mode is selected by @option{-mno-shared}.
22008 @option{-mno-shared} depends on binutils 2.16 or higher and generates
22009 objects that can only be linked by the GNU linker.  However, the option
22010 does not affect the ABI of the final executable; it only affects the ABI
22011 of relocatable objects.  Using @option{-mno-shared} generally makes
22012 executables both smaller and quicker.
22014 @option{-mshared} is the default.
22016 @item -mplt
22017 @itemx -mno-plt
22018 @opindex mplt
22019 @opindex mno-plt
22020 Assume (do not assume) that the static and dynamic linkers
22021 support PLTs and copy relocations.  This option only affects
22022 @option{-mno-shared -mabicalls}.  For the n64 ABI, this option
22023 has no effect without @option{-msym32}.
22025 You can make @option{-mplt} the default by configuring
22026 GCC with @option{--with-mips-plt}.  The default is
22027 @option{-mno-plt} otherwise.
22029 @item -mxgot
22030 @itemx -mno-xgot
22031 @opindex mxgot
22032 @opindex mno-xgot
22033 Lift (do not lift) the usual restrictions on the size of the global
22034 offset table.
22036 GCC normally uses a single instruction to load values from the GOT@.
22037 While this is relatively efficient, it only works if the GOT
22038 is smaller than about 64k.  Anything larger causes the linker
22039 to report an error such as:
22041 @cindex relocation truncated to fit (MIPS)
22042 @smallexample
22043 relocation truncated to fit: R_MIPS_GOT16 foobar
22044 @end smallexample
22046 If this happens, you should recompile your code with @option{-mxgot}.
22047 This works with very large GOTs, although the code is also
22048 less efficient, since it takes three instructions to fetch the
22049 value of a global symbol.
22051 Note that some linkers can create multiple GOTs.  If you have such a
22052 linker, you should only need to use @option{-mxgot} when a single object
22053 file accesses more than 64k's worth of GOT entries.  Very few do.
22055 These options have no effect unless GCC is generating position
22056 independent code.
22058 @item -mgp32
22059 @opindex mgp32
22060 Assume that general-purpose registers are 32 bits wide.
22062 @item -mgp64
22063 @opindex mgp64
22064 Assume that general-purpose registers are 64 bits wide.
22066 @item -mfp32
22067 @opindex mfp32
22068 Assume that floating-point registers are 32 bits wide.
22070 @item -mfp64
22071 @opindex mfp64
22072 Assume that floating-point registers are 64 bits wide.
22074 @item -mfpxx
22075 @opindex mfpxx
22076 Do not assume the width of floating-point registers.
22078 @item -mhard-float
22079 @opindex mhard-float
22080 Use floating-point coprocessor instructions.
22082 @item -msoft-float
22083 @opindex msoft-float
22084 Do not use floating-point coprocessor instructions.  Implement
22085 floating-point calculations using library calls instead.
22087 @item -mno-float
22088 @opindex mno-float
22089 Equivalent to @option{-msoft-float}, but additionally asserts that the
22090 program being compiled does not perform any floating-point operations.
22091 This option is presently supported only by some bare-metal MIPS
22092 configurations, where it may select a special set of libraries
22093 that lack all floating-point support (including, for example, the
22094 floating-point @code{printf} formats).  
22095 If code compiled with @option{-mno-float} accidentally contains
22096 floating-point operations, it is likely to suffer a link-time
22097 or run-time failure.
22099 @item -msingle-float
22100 @opindex msingle-float
22101 Assume that the floating-point coprocessor only supports single-precision
22102 operations.
22104 @item -mdouble-float
22105 @opindex mdouble-float
22106 Assume that the floating-point coprocessor supports double-precision
22107 operations.  This is the default.
22109 @item -modd-spreg
22110 @itemx -mno-odd-spreg
22111 @opindex modd-spreg
22112 @opindex mno-odd-spreg
22113 Enable the use of odd-numbered single-precision floating-point registers
22114 for the o32 ABI.  This is the default for processors that are known to
22115 support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22116 is set by default.
22118 @item -mabs=2008
22119 @itemx -mabs=legacy
22120 @opindex mabs=2008
22121 @opindex mabs=legacy
22122 These options control the treatment of the special not-a-number (NaN)
22123 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22124 @code{neg.@i{fmt}} machine instructions.
22126 By default or when @option{-mabs=legacy} is used the legacy
22127 treatment is selected.  In this case these instructions are considered
22128 arithmetic and avoided where correct operation is required and the
22129 input operand might be a NaN.  A longer sequence of instructions that
22130 manipulate the sign bit of floating-point datum manually is used
22131 instead unless the @option{-ffinite-math-only} option has also been
22132 specified.
22134 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
22135 this case these instructions are considered non-arithmetic and therefore
22136 operating correctly in all cases, including in particular where the
22137 input operand is a NaN.  These instructions are therefore always used
22138 for the respective operations.
22140 @item -mnan=2008
22141 @itemx -mnan=legacy
22142 @opindex mnan=2008
22143 @opindex mnan=legacy
22144 These options control the encoding of the special not-a-number (NaN)
22145 IEEE 754 floating-point data.
22147 The @option{-mnan=legacy} option selects the legacy encoding.  In this
22148 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22149 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22150 by the first bit of their trailing significand field being 1.
22152 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
22153 this case qNaNs are denoted by the first bit of their trailing
22154 significand field being 1, whereas sNaNs are denoted by the first bit of
22155 their trailing significand field being 0.
22157 The default is @option{-mnan=legacy} unless GCC has been configured with
22158 @option{--with-nan=2008}.
22160 @item -mllsc
22161 @itemx -mno-llsc
22162 @opindex mllsc
22163 @opindex mno-llsc
22164 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22165 implement atomic memory built-in functions.  When neither option is
22166 specified, GCC uses the instructions if the target architecture
22167 supports them.
22169 @option{-mllsc} is useful if the runtime environment can emulate the
22170 instructions and @option{-mno-llsc} can be useful when compiling for
22171 nonstandard ISAs.  You can make either option the default by
22172 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22173 respectively.  @option{--with-llsc} is the default for some
22174 configurations; see the installation documentation for details.
22176 @item -mdsp
22177 @itemx -mno-dsp
22178 @opindex mdsp
22179 @opindex mno-dsp
22180 Use (do not use) revision 1 of the MIPS DSP ASE@.
22181 @xref{MIPS DSP Built-in Functions}.  This option defines the
22182 preprocessor macro @code{__mips_dsp}.  It also defines
22183 @code{__mips_dsp_rev} to 1.
22185 @item -mdspr2
22186 @itemx -mno-dspr2
22187 @opindex mdspr2
22188 @opindex mno-dspr2
22189 Use (do not use) revision 2 of the MIPS DSP ASE@.
22190 @xref{MIPS DSP Built-in Functions}.  This option defines the
22191 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22192 It also defines @code{__mips_dsp_rev} to 2.
22194 @item -msmartmips
22195 @itemx -mno-smartmips
22196 @opindex msmartmips
22197 @opindex mno-smartmips
22198 Use (do not use) the MIPS SmartMIPS ASE.
22200 @item -mpaired-single
22201 @itemx -mno-paired-single
22202 @opindex mpaired-single
22203 @opindex mno-paired-single
22204 Use (do not use) paired-single floating-point instructions.
22205 @xref{MIPS Paired-Single Support}.  This option requires
22206 hardware floating-point support to be enabled.
22208 @item -mdmx
22209 @itemx -mno-mdmx
22210 @opindex mdmx
22211 @opindex mno-mdmx
22212 Use (do not use) MIPS Digital Media Extension instructions.
22213 This option can only be used when generating 64-bit code and requires
22214 hardware floating-point support to be enabled.
22216 @item -mips3d
22217 @itemx -mno-mips3d
22218 @opindex mips3d
22219 @opindex mno-mips3d
22220 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
22221 The option @option{-mips3d} implies @option{-mpaired-single}.
22223 @item -mmicromips
22224 @itemx -mno-micromips
22225 @opindex mmicromips
22226 @opindex mno-mmicromips
22227 Generate (do not generate) microMIPS code.
22229 MicroMIPS code generation can also be controlled on a per-function basis
22230 by means of @code{micromips} and @code{nomicromips} attributes.
22231 @xref{Function Attributes}, for more information.
22233 @item -mmt
22234 @itemx -mno-mt
22235 @opindex mmt
22236 @opindex mno-mt
22237 Use (do not use) MT Multithreading instructions.
22239 @item -mmcu
22240 @itemx -mno-mcu
22241 @opindex mmcu
22242 @opindex mno-mcu
22243 Use (do not use) the MIPS MCU ASE instructions.
22245 @item -meva
22246 @itemx -mno-eva
22247 @opindex meva
22248 @opindex mno-eva
22249 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22251 @item -mvirt
22252 @itemx -mno-virt
22253 @opindex mvirt
22254 @opindex mno-virt
22255 Use (do not use) the MIPS Virtualization (VZ) instructions.
22257 @item -mxpa
22258 @itemx -mno-xpa
22259 @opindex mxpa
22260 @opindex mno-xpa
22261 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22263 @item -mcrc
22264 @itemx -mno-crc
22265 @opindex mcrc
22266 @opindex mno-crc
22267 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22269 @item -mginv
22270 @itemx -mno-ginv
22271 @opindex mginv
22272 @opindex mno-ginv
22273 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22275 @item -mloongson-mmi
22276 @itemx -mno-loongson-mmi
22277 @opindex mloongson-mmi
22278 @opindex mno-loongson-mmi
22279 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22281 @item -mloongson-ext
22282 @itemx -mno-loongson-ext
22283 @opindex mloongson-ext
22284 @opindex mno-loongson-ext
22285 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22287 @item -mloongson-ext2
22288 @itemx -mno-loongson-ext2
22289 @opindex mloongson-ext2
22290 @opindex mno-loongson-ext2
22291 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22293 @item -mlong64
22294 @opindex mlong64
22295 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
22296 an explanation of the default and the way that the pointer size is
22297 determined.
22299 @item -mlong32
22300 @opindex mlong32
22301 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22303 The default size of @code{int}s, @code{long}s and pointers depends on
22304 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
22305 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22306 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
22307 or the same size as integer registers, whichever is smaller.
22309 @item -msym32
22310 @itemx -mno-sym32
22311 @opindex msym32
22312 @opindex mno-sym32
22313 Assume (do not assume) that all symbols have 32-bit values, regardless
22314 of the selected ABI@.  This option is useful in combination with
22315 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22316 to generate shorter and faster references to symbolic addresses.
22318 @item -G @var{num}
22319 @opindex G
22320 Put definitions of externally-visible data in a small data section
22321 if that data is no bigger than @var{num} bytes.  GCC can then generate
22322 more efficient accesses to the data; see @option{-mgpopt} for details.
22324 The default @option{-G} option depends on the configuration.
22326 @item -mlocal-sdata
22327 @itemx -mno-local-sdata
22328 @opindex mlocal-sdata
22329 @opindex mno-local-sdata
22330 Extend (do not extend) the @option{-G} behavior to local data too,
22331 such as to static variables in C@.  @option{-mlocal-sdata} is the
22332 default for all configurations.
22334 If the linker complains that an application is using too much small data,
22335 you might want to try rebuilding the less performance-critical parts with
22336 @option{-mno-local-sdata}.  You might also want to build large
22337 libraries with @option{-mno-local-sdata}, so that the libraries leave
22338 more room for the main program.
22340 @item -mextern-sdata
22341 @itemx -mno-extern-sdata
22342 @opindex mextern-sdata
22343 @opindex mno-extern-sdata
22344 Assume (do not assume) that externally-defined data is in
22345 a small data section if the size of that data is within the @option{-G} limit.
22346 @option{-mextern-sdata} is the default for all configurations.
22348 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22349 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22350 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22351 is placed in a small data section.  If @var{Var} is defined by another
22352 module, you must either compile that module with a high-enough
22353 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22354 definition.  If @var{Var} is common, you must link the application
22355 with a high-enough @option{-G} setting.
22357 The easiest way of satisfying these restrictions is to compile
22358 and link every module with the same @option{-G} option.  However,
22359 you may wish to build a library that supports several different
22360 small data limits.  You can do this by compiling the library with
22361 the highest supported @option{-G} setting and additionally using
22362 @option{-mno-extern-sdata} to stop the library from making assumptions
22363 about externally-defined data.
22365 @item -mgpopt
22366 @itemx -mno-gpopt
22367 @opindex mgpopt
22368 @opindex mno-gpopt
22369 Use (do not use) GP-relative accesses for symbols that are known to be
22370 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22371 @option{-mextern-sdata}.  @option{-mgpopt} is the default for all
22372 configurations.
22374 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22375 might not hold the value of @code{_gp}.  For example, if the code is
22376 part of a library that might be used in a boot monitor, programs that
22377 call boot monitor routines pass an unknown value in @code{$gp}.
22378 (In such situations, the boot monitor itself is usually compiled
22379 with @option{-G0}.)
22381 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22382 @option{-mno-extern-sdata}.
22384 @item -membedded-data
22385 @itemx -mno-embedded-data
22386 @opindex membedded-data
22387 @opindex mno-embedded-data
22388 Allocate variables to the read-only data section first if possible, then
22389 next in the small data section if possible, otherwise in data.  This gives
22390 slightly slower code than the default, but reduces the amount of RAM required
22391 when executing, and thus may be preferred for some embedded systems.
22393 @item -muninit-const-in-rodata
22394 @itemx -mno-uninit-const-in-rodata
22395 @opindex muninit-const-in-rodata
22396 @opindex mno-uninit-const-in-rodata
22397 Put uninitialized @code{const} variables in the read-only data section.
22398 This option is only meaningful in conjunction with @option{-membedded-data}.
22400 @item -mcode-readable=@var{setting}
22401 @opindex mcode-readable
22402 Specify whether GCC may generate code that reads from executable sections.
22403 There are three possible settings:
22405 @table @gcctabopt
22406 @item -mcode-readable=yes
22407 Instructions may freely access executable sections.  This is the
22408 default setting.
22410 @item -mcode-readable=pcrel
22411 MIPS16 PC-relative load instructions can access executable sections,
22412 but other instructions must not do so.  This option is useful on 4KSc
22413 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22414 It is also useful on processors that can be configured to have a dual
22415 instruction/data SRAM interface and that, like the M4K, automatically
22416 redirect PC-relative loads to the instruction RAM.
22418 @item -mcode-readable=no
22419 Instructions must not access executable sections.  This option can be
22420 useful on targets that are configured to have a dual instruction/data
22421 SRAM interface but that (unlike the M4K) do not automatically redirect
22422 PC-relative loads to the instruction RAM.
22423 @end table
22425 @item -msplit-addresses
22426 @itemx -mno-split-addresses
22427 @opindex msplit-addresses
22428 @opindex mno-split-addresses
22429 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22430 relocation operators.  This option has been superseded by
22431 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22433 @item -mexplicit-relocs
22434 @itemx -mno-explicit-relocs
22435 @opindex mexplicit-relocs
22436 @opindex mno-explicit-relocs
22437 Use (do not use) assembler relocation operators when dealing with symbolic
22438 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
22439 is to use assembler macros instead.
22441 @option{-mexplicit-relocs} is the default if GCC was configured
22442 to use an assembler that supports relocation operators.
22444 @item -mcheck-zero-division
22445 @itemx -mno-check-zero-division
22446 @opindex mcheck-zero-division
22447 @opindex mno-check-zero-division
22448 Trap (do not trap) on integer division by zero.
22450 The default is @option{-mcheck-zero-division}.
22452 @item -mdivide-traps
22453 @itemx -mdivide-breaks
22454 @opindex mdivide-traps
22455 @opindex mdivide-breaks
22456 MIPS systems check for division by zero by generating either a
22457 conditional trap or a break instruction.  Using traps results in
22458 smaller code, but is only supported on MIPS II and later.  Also, some
22459 versions of the Linux kernel have a bug that prevents trap from
22460 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
22461 allow conditional traps on architectures that support them and
22462 @option{-mdivide-breaks} to force the use of breaks.
22464 The default is usually @option{-mdivide-traps}, but this can be
22465 overridden at configure time using @option{--with-divide=breaks}.
22466 Divide-by-zero checks can be completely disabled using
22467 @option{-mno-check-zero-division}.
22469 @item -mload-store-pairs
22470 @itemx -mno-load-store-pairs
22471 @opindex mload-store-pairs
22472 @opindex mno-load-store-pairs
22473 Enable (disable) an optimization that pairs consecutive load or store
22474 instructions to enable load/store bonding.  This option is enabled by
22475 default but only takes effect when the selected architecture is known
22476 to support bonding.
22478 @item -mmemcpy
22479 @itemx -mno-memcpy
22480 @opindex mmemcpy
22481 @opindex mno-memcpy
22482 Force (do not force) the use of @code{memcpy} for non-trivial block
22483 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
22484 most constant-sized copies.
22486 @item -mlong-calls
22487 @itemx -mno-long-calls
22488 @opindex mlong-calls
22489 @opindex mno-long-calls
22490 Disable (do not disable) use of the @code{jal} instruction.  Calling
22491 functions using @code{jal} is more efficient but requires the caller
22492 and callee to be in the same 256 megabyte segment.
22494 This option has no effect on abicalls code.  The default is
22495 @option{-mno-long-calls}.
22497 @item -mmad
22498 @itemx -mno-mad
22499 @opindex mmad
22500 @opindex mno-mad
22501 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22502 instructions, as provided by the R4650 ISA@.
22504 @item -mimadd
22505 @itemx -mno-imadd
22506 @opindex mimadd
22507 @opindex mno-imadd
22508 Enable (disable) use of the @code{madd} and @code{msub} integer
22509 instructions.  The default is @option{-mimadd} on architectures
22510 that support @code{madd} and @code{msub} except for the 74k 
22511 architecture where it was found to generate slower code.
22513 @item -mfused-madd
22514 @itemx -mno-fused-madd
22515 @opindex mfused-madd
22516 @opindex mno-fused-madd
22517 Enable (disable) use of the floating-point multiply-accumulate
22518 instructions, when they are available.  The default is
22519 @option{-mfused-madd}.
22521 On the R8000 CPU when multiply-accumulate instructions are used,
22522 the intermediate product is calculated to infinite precision
22523 and is not subject to the FCSR Flush to Zero bit.  This may be
22524 undesirable in some circumstances.  On other processors the result
22525 is numerically identical to the equivalent computation using
22526 separate multiply, add, subtract and negate instructions.
22528 @item -nocpp
22529 @opindex nocpp
22530 Tell the MIPS assembler to not run its preprocessor over user
22531 assembler files (with a @samp{.s} suffix) when assembling them.
22533 @item -mfix-24k
22534 @itemx -mno-fix-24k
22535 @opindex mfix-24k
22536 @opindex mno-fix-24k
22537 Work around the 24K E48 (lost data on stores during refill) errata.
22538 The workarounds are implemented by the assembler rather than by GCC@.
22540 @item -mfix-r4000
22541 @itemx -mno-fix-r4000
22542 @opindex mfix-r4000
22543 @opindex mno-fix-r4000
22544 Work around certain R4000 CPU errata:
22545 @itemize @minus
22546 @item
22547 A double-word or a variable shift may give an incorrect result if executed
22548 immediately after starting an integer division.
22549 @item
22550 A double-word or a variable shift may give an incorrect result if executed
22551 while an integer multiplication is in progress.
22552 @item
22553 An integer division may give an incorrect result if started in a delay slot
22554 of a taken branch or a jump.
22555 @end itemize
22557 @item -mfix-r4400
22558 @itemx -mno-fix-r4400
22559 @opindex mfix-r4400
22560 @opindex mno-fix-r4400
22561 Work around certain R4400 CPU errata:
22562 @itemize @minus
22563 @item
22564 A double-word or a variable shift may give an incorrect result if executed
22565 immediately after starting an integer division.
22566 @end itemize
22568 @item -mfix-r10000
22569 @itemx -mno-fix-r10000
22570 @opindex mfix-r10000
22571 @opindex mno-fix-r10000
22572 Work around certain R10000 errata:
22573 @itemize @minus
22574 @item
22575 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22576 prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
22577 @end itemize
22579 This option can only be used if the target architecture supports
22580 branch-likely instructions.  @option{-mfix-r10000} is the default when
22581 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22582 otherwise.
22584 @item -mfix-r5900
22585 @itemx -mno-fix-r5900
22586 @opindex mfix-r5900
22587 Do not attempt to schedule the preceding instruction into the delay slot
22588 of a branch instruction placed at the end of a short loop of six
22589 instructions or fewer and always schedule a @code{nop} instruction there
22590 instead.  The short loop bug under certain conditions causes loops to
22591 execute only once or twice, due to a hardware bug in the R5900 chip.  The
22592 workaround is implemented by the assembler rather than by GCC@.
22594 @item -mfix-rm7000
22595 @itemx -mno-fix-rm7000
22596 @opindex mfix-rm7000
22597 Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
22598 workarounds are implemented by the assembler rather than by GCC@.
22600 @item -mfix-vr4120
22601 @itemx -mno-fix-vr4120
22602 @opindex mfix-vr4120
22603 Work around certain VR4120 errata:
22604 @itemize @minus
22605 @item
22606 @code{dmultu} does not always produce the correct result.
22607 @item
22608 @code{div} and @code{ddiv} do not always produce the correct result if one
22609 of the operands is negative.
22610 @end itemize
22611 The workarounds for the division errata rely on special functions in
22612 @file{libgcc.a}.  At present, these functions are only provided by
22613 the @code{mips64vr*-elf} configurations.
22615 Other VR4120 errata require a NOP to be inserted between certain pairs of
22616 instructions.  These errata are handled by the assembler, not by GCC itself.
22618 @item -mfix-vr4130
22619 @opindex mfix-vr4130
22620 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
22621 workarounds are implemented by the assembler rather than by GCC,
22622 although GCC avoids using @code{mflo} and @code{mfhi} if the
22623 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22624 instructions are available instead.
22626 @item -mfix-sb1
22627 @itemx -mno-fix-sb1
22628 @opindex mfix-sb1
22629 Work around certain SB-1 CPU core errata.
22630 (This flag currently works around the SB-1 revision 2
22631 ``F1'' and ``F2'' floating-point errata.)
22633 @item -mr10k-cache-barrier=@var{setting}
22634 @opindex mr10k-cache-barrier
22635 Specify whether GCC should insert cache barriers to avoid the
22636 side effects of speculation on R10K processors.
22638 In common with many processors, the R10K tries to predict the outcome
22639 of a conditional branch and speculatively executes instructions from
22640 the ``taken'' branch.  It later aborts these instructions if the
22641 predicted outcome is wrong.  However, on the R10K, even aborted
22642 instructions can have side effects.
22644 This problem only affects kernel stores and, depending on the system,
22645 kernel loads.  As an example, a speculatively-executed store may load
22646 the target memory into cache and mark the cache line as dirty, even if
22647 the store itself is later aborted.  If a DMA operation writes to the
22648 same area of memory before the ``dirty'' line is flushed, the cached
22649 data overwrites the DMA-ed data.  See the R10K processor manual
22650 for a full description, including other potential problems.
22652 One workaround is to insert cache barrier instructions before every memory
22653 access that might be speculatively executed and that might have side
22654 effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
22655 controls GCC's implementation of this workaround.  It assumes that
22656 aborted accesses to any byte in the following regions does not have
22657 side effects:
22659 @enumerate
22660 @item
22661 the memory occupied by the current function's stack frame;
22663 @item
22664 the memory occupied by an incoming stack argument;
22666 @item
22667 the memory occupied by an object with a link-time-constant address.
22668 @end enumerate
22670 It is the kernel's responsibility to ensure that speculative
22671 accesses to these regions are indeed safe.
22673 If the input program contains a function declaration such as:
22675 @smallexample
22676 void foo (void);
22677 @end smallexample
22679 then the implementation of @code{foo} must allow @code{j foo} and
22680 @code{jal foo} to be executed speculatively.  GCC honors this
22681 restriction for functions it compiles itself.  It expects non-GCC
22682 functions (such as hand-written assembly code) to do the same.
22684 The option has three forms:
22686 @table @gcctabopt
22687 @item -mr10k-cache-barrier=load-store
22688 Insert a cache barrier before a load or store that might be
22689 speculatively executed and that might have side effects even
22690 if aborted.
22692 @item -mr10k-cache-barrier=store
22693 Insert a cache barrier before a store that might be speculatively
22694 executed and that might have side effects even if aborted.
22696 @item -mr10k-cache-barrier=none
22697 Disable the insertion of cache barriers.  This is the default setting.
22698 @end table
22700 @item -mflush-func=@var{func}
22701 @itemx -mno-flush-func
22702 @opindex mflush-func
22703 Specifies the function to call to flush the I and D caches, or to not
22704 call any such function.  If called, the function must take the same
22705 arguments as the common @code{_flush_func}, that is, the address of the
22706 memory range for which the cache is being flushed, the size of the
22707 memory range, and the number 3 (to flush both caches).  The default
22708 depends on the target GCC was configured for, but commonly is either
22709 @code{_flush_func} or @code{__cpu_flush}.
22711 @item mbranch-cost=@var{num}
22712 @opindex mbranch-cost
22713 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22714 This cost is only a heuristic and is not guaranteed to produce
22715 consistent results across releases.  A zero cost redundantly selects
22716 the default, which is based on the @option{-mtune} setting.
22718 @item -mbranch-likely
22719 @itemx -mno-branch-likely
22720 @opindex mbranch-likely
22721 @opindex mno-branch-likely
22722 Enable or disable use of Branch Likely instructions, regardless of the
22723 default for the selected architecture.  By default, Branch Likely
22724 instructions may be generated if they are supported by the selected
22725 architecture.  An exception is for the MIPS32 and MIPS64 architectures
22726 and processors that implement those architectures; for those, Branch
22727 Likely instructions are not be generated by default because the MIPS32
22728 and MIPS64 architectures specifically deprecate their use.
22730 @item -mcompact-branches=never
22731 @itemx -mcompact-branches=optimal
22732 @itemx -mcompact-branches=always
22733 @opindex mcompact-branches=never
22734 @opindex mcompact-branches=optimal
22735 @opindex mcompact-branches=always
22736 These options control which form of branches will be generated.  The
22737 default is @option{-mcompact-branches=optimal}.
22739 The @option{-mcompact-branches=never} option ensures that compact branch
22740 instructions will never be generated.
22742 The @option{-mcompact-branches=always} option ensures that a compact
22743 branch instruction will be generated if available.  If a compact branch
22744 instruction is not available, a delay slot form of the branch will be
22745 used instead.
22747 This option is supported from MIPS Release 6 onwards.
22749 The @option{-mcompact-branches=optimal} option will cause a delay slot
22750 branch to be used if one is available in the current ISA and the delay
22751 slot is successfully filled.  If the delay slot is not filled, a compact
22752 branch will be chosen if one is available.
22754 @item -mfp-exceptions
22755 @itemx -mno-fp-exceptions
22756 @opindex mfp-exceptions
22757 Specifies whether FP exceptions are enabled.  This affects how
22758 FP instructions are scheduled for some processors.
22759 The default is that FP exceptions are
22760 enabled.
22762 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22763 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
22764 FP pipe.
22766 @item -mvr4130-align
22767 @itemx -mno-vr4130-align
22768 @opindex mvr4130-align
22769 The VR4130 pipeline is two-way superscalar, but can only issue two
22770 instructions together if the first one is 8-byte aligned.  When this
22771 option is enabled, GCC aligns pairs of instructions that it
22772 thinks should execute in parallel.
22774 This option only has an effect when optimizing for the VR4130.
22775 It normally makes code faster, but at the expense of making it bigger.
22776 It is enabled by default at optimization level @option{-O3}.
22778 @item -msynci
22779 @itemx -mno-synci
22780 @opindex msynci
22781 Enable (disable) generation of @code{synci} instructions on
22782 architectures that support it.  The @code{synci} instructions (if
22783 enabled) are generated when @code{__builtin___clear_cache} is
22784 compiled.
22786 This option defaults to @option{-mno-synci}, but the default can be
22787 overridden by configuring GCC with @option{--with-synci}.
22789 When compiling code for single processor systems, it is generally safe
22790 to use @code{synci}.  However, on many multi-core (SMP) systems, it
22791 does not invalidate the instruction caches on all cores and may lead
22792 to undefined behavior.
22794 @item -mrelax-pic-calls
22795 @itemx -mno-relax-pic-calls
22796 @opindex mrelax-pic-calls
22797 Try to turn PIC calls that are normally dispatched via register
22798 @code{$25} into direct calls.  This is only possible if the linker can
22799 resolve the destination at link time and if the destination is within
22800 range for a direct call.
22802 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22803 an assembler and a linker that support the @code{.reloc} assembly
22804 directive and @option{-mexplicit-relocs} is in effect.  With
22805 @option{-mno-explicit-relocs}, this optimization can be performed by the
22806 assembler and the linker alone without help from the compiler.
22808 @item -mmcount-ra-address
22809 @itemx -mno-mcount-ra-address
22810 @opindex mmcount-ra-address
22811 @opindex mno-mcount-ra-address
22812 Emit (do not emit) code that allows @code{_mcount} to modify the
22813 calling function's return address.  When enabled, this option extends
22814 the usual @code{_mcount} interface with a new @var{ra-address}
22815 parameter, which has type @code{intptr_t *} and is passed in register
22816 @code{$12}.  @code{_mcount} can then modify the return address by
22817 doing both of the following:
22818 @itemize
22819 @item
22820 Returning the new address in register @code{$31}.
22821 @item
22822 Storing the new address in @code{*@var{ra-address}},
22823 if @var{ra-address} is nonnull.
22824 @end itemize
22826 The default is @option{-mno-mcount-ra-address}.
22828 @item -mframe-header-opt
22829 @itemx -mno-frame-header-opt
22830 @opindex mframe-header-opt
22831 Enable (disable) frame header optimization in the o32 ABI.  When using the
22832 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22833 function to write out register arguments.  When enabled, this optimization
22834 will suppress the allocation of the frame header if it can be determined that
22835 it is unused.
22837 This optimization is off by default at all optimization levels.
22839 @item -mlxc1-sxc1
22840 @itemx -mno-lxc1-sxc1
22841 @opindex mlxc1-sxc1
22842 When applicable, enable (disable) the generation of @code{lwxc1},
22843 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
22845 @item -mmadd4
22846 @itemx -mno-madd4
22847 @opindex mmadd4
22848 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22849 @code{madd.d} and related instructions.  Enabled by default.
22851 @end table
22853 @node MMIX Options
22854 @subsection MMIX Options
22855 @cindex MMIX Options
22857 These options are defined for the MMIX:
22859 @table @gcctabopt
22860 @item -mlibfuncs
22861 @itemx -mno-libfuncs
22862 @opindex mlibfuncs
22863 @opindex mno-libfuncs
22864 Specify that intrinsic library functions are being compiled, passing all
22865 values in registers, no matter the size.
22867 @item -mepsilon
22868 @itemx -mno-epsilon
22869 @opindex mepsilon
22870 @opindex mno-epsilon
22871 Generate floating-point comparison instructions that compare with respect
22872 to the @code{rE} epsilon register.
22874 @item -mabi=mmixware
22875 @itemx -mabi=gnu
22876 @opindex mabi=mmixware
22877 @opindex mabi=gnu
22878 Generate code that passes function parameters and return values that (in
22879 the called function) are seen as registers @code{$0} and up, as opposed to
22880 the GNU ABI which uses global registers @code{$231} and up.
22882 @item -mzero-extend
22883 @itemx -mno-zero-extend
22884 @opindex mzero-extend
22885 @opindex mno-zero-extend
22886 When reading data from memory in sizes shorter than 64 bits, use (do not
22887 use) zero-extending load instructions by default, rather than
22888 sign-extending ones.
22890 @item -mknuthdiv
22891 @itemx -mno-knuthdiv
22892 @opindex mknuthdiv
22893 @opindex mno-knuthdiv
22894 Make the result of a division yielding a remainder have the same sign as
22895 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
22896 remainder follows the sign of the dividend.  Both methods are
22897 arithmetically valid, the latter being almost exclusively used.
22899 @item -mtoplevel-symbols
22900 @itemx -mno-toplevel-symbols
22901 @opindex mtoplevel-symbols
22902 @opindex mno-toplevel-symbols
22903 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22904 code can be used with the @code{PREFIX} assembly directive.
22906 @item -melf
22907 @opindex melf
22908 Generate an executable in the ELF format, rather than the default
22909 @samp{mmo} format used by the @command{mmix} simulator.
22911 @item -mbranch-predict
22912 @itemx -mno-branch-predict
22913 @opindex mbranch-predict
22914 @opindex mno-branch-predict
22915 Use (do not use) the probable-branch instructions, when static branch
22916 prediction indicates a probable branch.
22918 @item -mbase-addresses
22919 @itemx -mno-base-addresses
22920 @opindex mbase-addresses
22921 @opindex mno-base-addresses
22922 Generate (do not generate) code that uses @emph{base addresses}.  Using a
22923 base address automatically generates a request (handled by the assembler
22924 and the linker) for a constant to be set up in a global register.  The
22925 register is used for one or more base address requests within the range 0
22926 to 255 from the value held in the register.  The generally leads to short
22927 and fast code, but the number of different data items that can be
22928 addressed is limited.  This means that a program that uses lots of static
22929 data may require @option{-mno-base-addresses}.
22931 @item -msingle-exit
22932 @itemx -mno-single-exit
22933 @opindex msingle-exit
22934 @opindex mno-single-exit
22935 Force (do not force) generated code to have a single exit point in each
22936 function.
22937 @end table
22939 @node MN10300 Options
22940 @subsection MN10300 Options
22941 @cindex MN10300 options
22943 These @option{-m} options are defined for Matsushita MN10300 architectures:
22945 @table @gcctabopt
22946 @item -mmult-bug
22947 @opindex mmult-bug
22948 Generate code to avoid bugs in the multiply instructions for the MN10300
22949 processors.  This is the default.
22951 @item -mno-mult-bug
22952 @opindex mno-mult-bug
22953 Do not generate code to avoid bugs in the multiply instructions for the
22954 MN10300 processors.
22956 @item -mam33
22957 @opindex mam33
22958 Generate code using features specific to the AM33 processor.
22960 @item -mno-am33
22961 @opindex mno-am33
22962 Do not generate code using features specific to the AM33 processor.  This
22963 is the default.
22965 @item -mam33-2
22966 @opindex mam33-2
22967 Generate code using features specific to the AM33/2.0 processor.
22969 @item -mam34
22970 @opindex mam34
22971 Generate code using features specific to the AM34 processor.
22973 @item -mtune=@var{cpu-type}
22974 @opindex mtune
22975 Use the timing characteristics of the indicated CPU type when
22976 scheduling instructions.  This does not change the targeted processor
22977 type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
22978 @samp{am33-2} or @samp{am34}.
22980 @item -mreturn-pointer-on-d0
22981 @opindex mreturn-pointer-on-d0
22982 When generating a function that returns a pointer, return the pointer
22983 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
22984 only in @code{a0}, and attempts to call such functions without a prototype
22985 result in errors.  Note that this option is on by default; use
22986 @option{-mno-return-pointer-on-d0} to disable it.
22988 @item -mno-crt0
22989 @opindex mno-crt0
22990 Do not link in the C run-time initialization object file.
22992 @item -mrelax
22993 @opindex mrelax
22994 Indicate to the linker that it should perform a relaxation optimization pass
22995 to shorten branches, calls and absolute memory addresses.  This option only
22996 has an effect when used on the command line for the final link step.
22998 This option makes symbolic debugging impossible.
23000 @item -mliw
23001 @opindex mliw
23002 Allow the compiler to generate @emph{Long Instruction Word}
23003 instructions if the target is the @samp{AM33} or later.  This is the
23004 default.  This option defines the preprocessor macro @code{__LIW__}.
23006 @item -mno-liw
23007 @opindex mno-liw
23008 Do not allow the compiler to generate @emph{Long Instruction Word}
23009 instructions.  This option defines the preprocessor macro
23010 @code{__NO_LIW__}.
23012 @item -msetlb
23013 @opindex msetlb
23014 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
23015 instructions if the target is the @samp{AM33} or later.  This is the
23016 default.  This option defines the preprocessor macro @code{__SETLB__}.
23018 @item -mno-setlb
23019 @opindex mno-setlb
23020 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
23021 instructions.  This option defines the preprocessor macro
23022 @code{__NO_SETLB__}.
23024 @end table
23026 @node Moxie Options
23027 @subsection Moxie Options
23028 @cindex Moxie Options
23030 @table @gcctabopt
23032 @item -meb
23033 @opindex meb
23034 Generate big-endian code.  This is the default for @samp{moxie-*-*}
23035 configurations.
23037 @item -mel
23038 @opindex mel
23039 Generate little-endian code.
23041 @item -mmul.x
23042 @opindex mmul.x
23043 Generate mul.x and umul.x instructions.  This is the default for
23044 @samp{moxiebox-*-*} configurations.
23046 @item -mno-crt0
23047 @opindex mno-crt0
23048 Do not link in the C run-time initialization object file.
23050 @end table
23052 @node MSP430 Options
23053 @subsection MSP430 Options
23054 @cindex MSP430 Options
23056 These options are defined for the MSP430:
23058 @table @gcctabopt
23060 @item -masm-hex
23061 @opindex masm-hex
23062 Force assembly output to always use hex constants.  Normally such
23063 constants are signed decimals, but this option is available for
23064 testsuite and/or aesthetic purposes.
23066 @item -mmcu=
23067 @opindex mmcu=
23068 Select the MCU to target.  This is used to create a C preprocessor
23069 symbol based upon the MCU name, converted to upper case and pre- and
23070 post-fixed with @samp{__}.  This in turn is used by the
23071 @file{msp430.h} header file to select an MCU-specific supplementary
23072 header file.
23074 The option also sets the ISA to use.  If the MCU name is one that is
23075 known to only support the 430 ISA then that is selected, otherwise the
23076 430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
23077 used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
23078 name selects the 430X ISA.
23080 In addition an MCU-specific linker script is added to the linker
23081 command line.  The script's name is the name of the MCU with
23082 @file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
23083 command line defines the C preprocessor symbol @code{__XXX__} and
23084 cause the linker to search for a script called @file{xxx.ld}.
23086 The ISA and hardware multiply supported for the different MCUs is hard-coded
23087 into GCC.  However, an external @samp{devices.csv} file can be used to
23088 extend device support beyond those that have been hard-coded.
23090 GCC searches for the @samp{devices.csv} file on the paths specified
23091 with the @code{-I} and @code{-L} options.
23093 @item -mwarn-mcu
23094 @itemx -mno-warn-mcu
23095 @opindex mwarn-mcu
23096 @opindex mno-warn-mcu
23097 This option enables or disables warnings about conflicts between the
23098 MCU name specified by the @option{-mmcu} option and the ISA set by the
23099 @option{-mcpu} option and/or the hardware multiply support set by the
23100 @option{-mhwmult} option.  It also toggles warnings about unrecognized
23101 MCU names.  This option is on by default.
23103 @item -mcpu=
23104 @opindex mcpu=
23105 Specifies the ISA to use.  Accepted values are @samp{msp430},
23106 @samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
23107 @option{-mmcu=} option should be used to select the ISA.
23109 @item -msim
23110 @opindex msim
23111 Link to the simulator runtime libraries and linker script.  Overrides
23112 any scripts that would be selected by the @option{-mmcu=} option.
23114 @item -mlarge
23115 @opindex mlarge
23116 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23118 @item -msmall
23119 @opindex msmall
23120 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23122 @item -mrelax
23123 @opindex mrelax
23124 This option is passed to the assembler and linker, and allows the
23125 linker to perform certain optimizations that cannot be done until
23126 the final link.
23128 @item mhwmult=
23129 @opindex mhwmult=
23130 Describes the type of hardware multiply supported by the target.
23131 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23132 for the original 16-bit-only multiply supported by early MCUs.
23133 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23134 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23135 A value of @samp{auto} can also be given.  This tells GCC to deduce
23136 the hardware multiply support based upon the MCU name provided by the
23137 @option{-mmcu} option.  If no @option{-mmcu} option is specified or if
23138 the MCU name is not recognized then no hardware multiply support is
23139 assumed.  @code{auto} is the default setting.
23141 Hardware multiplies are normally performed by calling a library
23142 routine.  This saves space in the generated code.  When compiling at
23143 @option{-O3} or higher however the hardware multiplier is invoked
23144 inline.  This makes for bigger, but faster code.
23146 The hardware multiply routines disable interrupts whilst running and
23147 restore the previous interrupt state when they finish.  This makes
23148 them safe to use inside interrupt handlers as well as in normal code.
23150 @item -minrt
23151 @opindex minrt
23152 Enable the use of a minimum runtime environment - no static
23153 initializers or constructors.  This is intended for memory-constrained
23154 devices.  The compiler includes special symbols in some objects
23155 that tell the linker and runtime which code fragments are required.
23157 @item -mcode-region=
23158 @itemx -mdata-region=
23159 @opindex mcode-region
23160 @opindex mdata-region
23161 These options tell the compiler where to place functions and data that
23162 do not have one of the @code{lower}, @code{upper}, @code{either} or
23163 @code{section} attributes.  Possible values are @code{lower},
23164 @code{upper}, @code{either} or @code{any}.  The first three behave
23165 like the corresponding attribute.  The fourth possible value -
23166 @code{any} - is the default.  It leaves placement entirely up to the
23167 linker script and how it assigns the standard sections
23168 (@code{.text}, @code{.data}, etc) to the memory regions.
23170 @item -msilicon-errata=
23171 @opindex msilicon-errata
23172 This option passes on a request to assembler to enable the fixes for
23173 the named silicon errata.
23175 @item -msilicon-errata-warn=
23176 @opindex msilicon-errata-warn
23177 This option passes on a request to the assembler to enable warning
23178 messages when a silicon errata might need to be applied.
23180 @item -mwarn-devices-csv
23181 @itemx -mno-warn-devices-csv
23182 @opindex mwarn-devices-csv
23183 @opindex mno-warn-devices-csv
23184 Warn if @samp{devices.csv} is not found or there are problem parsing it
23185 (default: on).
23187 @end table
23189 @node NDS32 Options
23190 @subsection NDS32 Options
23191 @cindex NDS32 Options
23193 These options are defined for NDS32 implementations:
23195 @table @gcctabopt
23197 @item -mbig-endian
23198 @opindex mbig-endian
23199 Generate code in big-endian mode.
23201 @item -mlittle-endian
23202 @opindex mlittle-endian
23203 Generate code in little-endian mode.
23205 @item -mreduced-regs
23206 @opindex mreduced-regs
23207 Use reduced-set registers for register allocation.
23209 @item -mfull-regs
23210 @opindex mfull-regs
23211 Use full-set registers for register allocation.
23213 @item -mcmov
23214 @opindex mcmov
23215 Generate conditional move instructions.
23217 @item -mno-cmov
23218 @opindex mno-cmov
23219 Do not generate conditional move instructions.
23221 @item -mext-perf
23222 @opindex mext-perf
23223 Generate performance extension instructions.
23225 @item -mno-ext-perf
23226 @opindex mno-ext-perf
23227 Do not generate performance extension instructions.
23229 @item -mext-perf2
23230 @opindex mext-perf2
23231 Generate performance extension 2 instructions.
23233 @item -mno-ext-perf2
23234 @opindex mno-ext-perf2
23235 Do not generate performance extension 2 instructions.
23237 @item -mext-string
23238 @opindex mext-string
23239 Generate string extension instructions.
23241 @item -mno-ext-string
23242 @opindex mno-ext-string
23243 Do not generate string extension instructions.
23245 @item -mv3push
23246 @opindex mv3push
23247 Generate v3 push25/pop25 instructions.
23249 @item -mno-v3push
23250 @opindex mno-v3push
23251 Do not generate v3 push25/pop25 instructions.
23253 @item -m16-bit
23254 @opindex m16-bit
23255 Generate 16-bit instructions.
23257 @item -mno-16-bit
23258 @opindex mno-16-bit
23259 Do not generate 16-bit instructions.
23261 @item -misr-vector-size=@var{num}
23262 @opindex misr-vector-size
23263 Specify the size of each interrupt vector, which must be 4 or 16.
23265 @item -mcache-block-size=@var{num}
23266 @opindex mcache-block-size
23267 Specify the size of each cache block,
23268 which must be a power of 2 between 4 and 512.
23270 @item -march=@var{arch}
23271 @opindex march
23272 Specify the name of the target architecture.
23274 @item -mcmodel=@var{code-model}
23275 @opindex mcmodel
23276 Set the code model to one of
23277 @table @asis
23278 @item @samp{small}
23279 All the data and read-only data segments must be within 512KB addressing space.
23280 The text segment must be within 16MB addressing space.
23281 @item @samp{medium}
23282 The data segment must be within 512KB while the read-only data segment can be
23283 within 4GB addressing space.  The text segment should be still within 16MB
23284 addressing space.
23285 @item @samp{large}
23286 All the text and data segments can be within 4GB addressing space.
23287 @end table
23289 @item -mctor-dtor
23290 @opindex mctor-dtor
23291 Enable constructor/destructor feature.
23293 @item -mrelax
23294 @opindex mrelax
23295 Guide linker to relax instructions.
23297 @end table
23299 @node Nios II Options
23300 @subsection Nios II Options
23301 @cindex Nios II options
23302 @cindex Altera Nios II options
23304 These are the options defined for the Altera Nios II processor.
23306 @table @gcctabopt
23308 @item -G @var{num}
23309 @opindex G
23310 @cindex smaller data references
23311 Put global and static objects less than or equal to @var{num} bytes
23312 into the small data or BSS sections instead of the normal data or BSS
23313 sections.  The default value of @var{num} is 8.
23315 @item -mgpopt=@var{option}
23316 @itemx -mgpopt
23317 @itemx -mno-gpopt
23318 @opindex mgpopt
23319 @opindex mno-gpopt
23320 Generate (do not generate) GP-relative accesses.  The following 
23321 @var{option} names are recognized:
23323 @table @samp
23325 @item none
23326 Do not generate GP-relative accesses.
23328 @item local
23329 Generate GP-relative accesses for small data objects that are not 
23330 external, weak, or uninitialized common symbols.  
23331 Also use GP-relative addressing for objects that
23332 have been explicitly placed in a small data section via a @code{section}
23333 attribute.
23335 @item global
23336 As for @samp{local}, but also generate GP-relative accesses for
23337 small data objects that are external, weak, or common.  If you use this option,
23338 you must ensure that all parts of your program (including libraries) are
23339 compiled with the same @option{-G} setting.
23341 @item data
23342 Generate GP-relative accesses for all data objects in the program.  If you
23343 use this option, the entire data and BSS segments
23344 of your program must fit in 64K of memory and you must use an appropriate
23345 linker script to allocate them within the addressable range of the
23346 global pointer.
23348 @item all
23349 Generate GP-relative addresses for function pointers as well as data
23350 pointers.  If you use this option, the entire text, data, and BSS segments
23351 of your program must fit in 64K of memory and you must use an appropriate
23352 linker script to allocate them within the addressable range of the
23353 global pointer.
23355 @end table
23357 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23358 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23360 The default is @option{-mgpopt} except when @option{-fpic} or
23361 @option{-fPIC} is specified to generate position-independent code.
23362 Note that the Nios II ABI does not permit GP-relative accesses from
23363 shared libraries.
23365 You may need to specify @option{-mno-gpopt} explicitly when building
23366 programs that include large amounts of small data, including large
23367 GOT data sections.  In this case, the 16-bit offset for GP-relative
23368 addressing may not be large enough to allow access to the entire 
23369 small data section.
23371 @item -mgprel-sec=@var{regexp}
23372 @opindex mgprel-sec
23373 This option specifies additional section names that can be accessed via
23374 GP-relative addressing.  It is most useful in conjunction with 
23375 @code{section} attributes on variable declarations 
23376 (@pxref{Common Variable Attributes}) and a custom linker script.  
23377 The @var{regexp} is a POSIX Extended Regular Expression.
23379 This option does not affect the behavior of the @option{-G} option, and 
23380 the specified sections are in addition to the standard @code{.sdata}
23381 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23383 @item -mr0rel-sec=@var{regexp}
23384 @opindex mr0rel-sec
23385 This option specifies names of sections that can be accessed via a 
23386 16-bit offset from @code{r0}; that is, in the low 32K or high 32K 
23387 of the 32-bit address space.  It is most useful in conjunction with 
23388 @code{section} attributes on variable declarations 
23389 (@pxref{Common Variable Attributes}) and a custom linker script.  
23390 The @var{regexp} is a POSIX Extended Regular Expression.
23392 In contrast to the use of GP-relative addressing for small data, 
23393 zero-based addressing is never generated by default and there are no 
23394 conventional section names used in standard linker scripts for sections
23395 in the low or high areas of memory.
23397 @item -mel
23398 @itemx -meb
23399 @opindex mel
23400 @opindex meb
23401 Generate little-endian (default) or big-endian (experimental) code,
23402 respectively.
23404 @item -march=@var{arch}
23405 @opindex march
23406 This specifies the name of the target Nios II architecture.  GCC uses this
23407 name to determine what kind of instructions it can emit when generating
23408 assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
23410 The preprocessor macro @code{__nios2_arch__} is available to programs,
23411 with value 1 or 2, indicating the targeted ISA level.
23413 @item -mbypass-cache
23414 @itemx -mno-bypass-cache
23415 @opindex mno-bypass-cache
23416 @opindex mbypass-cache
23417 Force all load and store instructions to always bypass cache by 
23418 using I/O variants of the instructions. The default is not to
23419 bypass the cache.
23421 @item -mno-cache-volatile 
23422 @itemx -mcache-volatile       
23423 @opindex mcache-volatile 
23424 @opindex mno-cache-volatile
23425 Volatile memory access bypass the cache using the I/O variants of 
23426 the load and store instructions. The default is not to bypass the cache.
23428 @item -mno-fast-sw-div
23429 @itemx -mfast-sw-div
23430 @opindex mno-fast-sw-div
23431 @opindex mfast-sw-div
23432 Do not use table-based fast divide for small numbers. The default 
23433 is to use the fast divide at @option{-O3} and above.
23435 @item -mno-hw-mul
23436 @itemx -mhw-mul
23437 @itemx -mno-hw-mulx
23438 @itemx -mhw-mulx
23439 @itemx -mno-hw-div
23440 @itemx -mhw-div
23441 @opindex mno-hw-mul
23442 @opindex mhw-mul
23443 @opindex mno-hw-mulx
23444 @opindex mhw-mulx
23445 @opindex mno-hw-div
23446 @opindex mhw-div
23447 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 
23448 instructions by the compiler. The default is to emit @code{mul}
23449 and not emit @code{div} and @code{mulx}.
23451 @item -mbmx
23452 @itemx -mno-bmx
23453 @itemx -mcdx
23454 @itemx -mno-cdx
23455 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23456 CDX (code density) instructions.  Enabling these instructions also
23457 requires @option{-march=r2}.  Since these instructions are optional
23458 extensions to the R2 architecture, the default is not to emit them.
23460 @item -mcustom-@var{insn}=@var{N}
23461 @itemx -mno-custom-@var{insn}
23462 @opindex mcustom-@var{insn}
23463 @opindex mno-custom-@var{insn}
23464 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23465 custom instruction with encoding @var{N} when generating code that uses 
23466 @var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
23467 instruction 253 for single-precision floating-point add operations instead
23468 of the default behavior of using a library call.
23470 The following values of @var{insn} are supported.  Except as otherwise
23471 noted, floating-point operations are expected to be implemented with
23472 normal IEEE 754 semantics and correspond directly to the C operators or the
23473 equivalent GCC built-in functions (@pxref{Other Builtins}).
23475 Single-precision floating point:
23476 @table @asis
23478 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23479 Binary arithmetic operations.
23481 @item @samp{fnegs}
23482 Unary negation.
23484 @item @samp{fabss}
23485 Unary absolute value.
23487 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23488 Comparison operations.
23490 @item @samp{fmins}, @samp{fmaxs}
23491 Floating-point minimum and maximum.  These instructions are only
23492 generated if @option{-ffinite-math-only} is specified.
23494 @item @samp{fsqrts}
23495 Unary square root operation.
23497 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23498 Floating-point trigonometric and exponential functions.  These instructions
23499 are only generated if @option{-funsafe-math-optimizations} is also specified.
23501 @end table
23503 Double-precision floating point:
23504 @table @asis
23506 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23507 Binary arithmetic operations.
23509 @item @samp{fnegd}
23510 Unary negation.
23512 @item @samp{fabsd}
23513 Unary absolute value.
23515 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23516 Comparison operations.
23518 @item @samp{fmind}, @samp{fmaxd}
23519 Double-precision minimum and maximum.  These instructions are only
23520 generated if @option{-ffinite-math-only} is specified.
23522 @item @samp{fsqrtd}
23523 Unary square root operation.
23525 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23526 Double-precision trigonometric and exponential functions.  These instructions
23527 are only generated if @option{-funsafe-math-optimizations} is also specified.
23529 @end table
23531 Conversions:
23532 @table @asis
23533 @item @samp{fextsd}
23534 Conversion from single precision to double precision.
23536 @item @samp{ftruncds}
23537 Conversion from double precision to single precision.
23539 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23540 Conversion from floating point to signed or unsigned integer types, with
23541 truncation towards zero.
23543 @item @samp{round}
23544 Conversion from single-precision floating point to signed integer,
23545 rounding to the nearest integer and ties away from zero.
23546 This corresponds to the @code{__builtin_lroundf} function when
23547 @option{-fno-math-errno} is used.
23549 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23550 Conversion from signed or unsigned integer types to floating-point types.
23552 @end table
23554 In addition, all of the following transfer instructions for internal
23555 registers X and Y must be provided to use any of the double-precision
23556 floating-point instructions.  Custom instructions taking two
23557 double-precision source operands expect the first operand in the
23558 64-bit register X.  The other operand (or only operand of a unary
23559 operation) is given to the custom arithmetic instruction with the
23560 least significant half in source register @var{src1} and the most
23561 significant half in @var{src2}.  A custom instruction that returns a
23562 double-precision result returns the most significant 32 bits in the
23563 destination register and the other half in 32-bit register Y.  
23564 GCC automatically generates the necessary code sequences to write
23565 register X and/or read register Y when double-precision floating-point
23566 instructions are used.
23568 @table @asis
23570 @item @samp{fwrx}
23571 Write @var{src1} into the least significant half of X and @var{src2} into
23572 the most significant half of X.
23574 @item @samp{fwry}
23575 Write @var{src1} into Y.
23577 @item @samp{frdxhi}, @samp{frdxlo}
23578 Read the most or least (respectively) significant half of X and store it in
23579 @var{dest}.
23581 @item @samp{frdy}
23582 Read the value of Y and store it into @var{dest}.
23583 @end table
23585 Note that you can gain more local control over generation of Nios II custom
23586 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23587 and @code{target("no-custom-@var{insn}")} function attributes
23588 (@pxref{Function Attributes})
23589 or pragmas (@pxref{Function Specific Option Pragmas}).
23591 @item -mcustom-fpu-cfg=@var{name}
23592 @opindex mcustom-fpu-cfg
23594 This option enables a predefined, named set of custom instruction encodings
23595 (see @option{-mcustom-@var{insn}} above).  
23596 Currently, the following sets are defined:
23598 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23599 @gccoptlist{-mcustom-fmuls=252 @gol
23600 -mcustom-fadds=253 @gol
23601 -mcustom-fsubs=254 @gol
23602 -fsingle-precision-constant}
23604 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23605 @gccoptlist{-mcustom-fmuls=252 @gol
23606 -mcustom-fadds=253 @gol
23607 -mcustom-fsubs=254 @gol
23608 -mcustom-fdivs=255 @gol
23609 -fsingle-precision-constant}
23611 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23612 @gccoptlist{-mcustom-floatus=243 @gol
23613 -mcustom-fixsi=244 @gol
23614 -mcustom-floatis=245 @gol
23615 -mcustom-fcmpgts=246 @gol
23616 -mcustom-fcmples=249 @gol
23617 -mcustom-fcmpeqs=250 @gol
23618 -mcustom-fcmpnes=251 @gol
23619 -mcustom-fmuls=252 @gol
23620 -mcustom-fadds=253 @gol
23621 -mcustom-fsubs=254 @gol
23622 -mcustom-fdivs=255 @gol
23623 -fsingle-precision-constant}
23625 Custom instruction assignments given by individual
23626 @option{-mcustom-@var{insn}=} options override those given by
23627 @option{-mcustom-fpu-cfg=}, regardless of the
23628 order of the options on the command line.
23630 Note that you can gain more local control over selection of a FPU
23631 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23632 function attribute (@pxref{Function Attributes})
23633 or pragma (@pxref{Function Specific Option Pragmas}).
23635 @end table
23637 These additional @samp{-m} options are available for the Altera Nios II
23638 ELF (bare-metal) target:
23640 @table @gcctabopt
23642 @item -mhal
23643 @opindex mhal
23644 Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
23645 startup and termination code, and is typically used in conjunction with
23646 @option{-msys-crt0=} to specify the location of the alternate startup code
23647 provided by the HAL BSP.
23649 @item -msmallc
23650 @opindex msmallc
23651 Link with a limited version of the C library, @option{-lsmallc}, rather than
23652 Newlib.
23654 @item -msys-crt0=@var{startfile}
23655 @opindex msys-crt0
23656 @var{startfile} is the file name of the startfile (crt0) to use 
23657 when linking.  This option is only useful in conjunction with @option{-mhal}.
23659 @item -msys-lib=@var{systemlib}
23660 @opindex msys-lib
23661 @var{systemlib} is the library name of the library that provides
23662 low-level system calls required by the C library,
23663 e.g.@: @code{read} and @code{write}.
23664 This option is typically used to link with a library provided by a HAL BSP.
23666 @end table
23668 @node Nvidia PTX Options
23669 @subsection Nvidia PTX Options
23670 @cindex Nvidia PTX options
23671 @cindex nvptx options
23673 These options are defined for Nvidia PTX:
23675 @table @gcctabopt
23677 @item -m32
23678 @itemx -m64
23679 @opindex m32
23680 @opindex m64
23681 Generate code for 32-bit or 64-bit ABI.
23683 @item -misa=@var{ISA-string}
23684 @opindex march
23685 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}).  ISA
23686 strings must be lower-case.  Valid ISA strings include @samp{sm_30} and
23687 @samp{sm_35}.  The default ISA is sm_30.
23689 @item -mmainkernel
23690 @opindex mmainkernel
23691 Link in code for a __main kernel.  This is for stand-alone instead of
23692 offloading execution.
23694 @item -moptimize
23695 @opindex moptimize
23696 Apply partitioned execution optimizations.  This is the default when any
23697 level of optimization is selected.
23699 @item -msoft-stack
23700 @opindex msoft-stack
23701 Generate code that does not use @code{.local} memory
23702 directly for stack storage. Instead, a per-warp stack pointer is
23703 maintained explicitly. This enables variable-length stack allocation (with
23704 variable-length arrays or @code{alloca}), and when global memory is used for
23705 underlying storage, makes it possible to access automatic variables from other
23706 threads, or with atomic instructions. This code generation variant is used
23707 for OpenMP offloading, but the option is exposed on its own for the purpose
23708 of testing the compiler; to generate code suitable for linking into programs
23709 using OpenMP offloading, use option @option{-mgomp}.
23711 @item -muniform-simt
23712 @opindex muniform-simt
23713 Switch to code generation variant that allows to execute all threads in each
23714 warp, while maintaining memory state and side effects as if only one thread
23715 in each warp was active outside of OpenMP SIMD regions.  All atomic operations
23716 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23717 current lane index equals the master lane index), and the register being
23718 assigned is copied via a shuffle instruction from the master lane.  Outside of
23719 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23720 master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23721 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23722 regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
23723 with current lane index to compute the master lane index.
23725 @item -mgomp
23726 @opindex mgomp
23727 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23728 @option{-muniform-simt} options, and selects corresponding multilib variant.
23730 @end table
23732 @node OpenRISC Options
23733 @subsection OpenRISC Options
23734 @cindex OpenRISC Options
23736 These options are defined for OpenRISC:
23738 @table @gcctabopt
23740 @item -mboard=@var{name}
23741 @opindex mboard
23742 Configure a board specific runtime.  This will be passed to the linker for
23743 newlib board library linking.  The default is @code{or1ksim}.
23745 @item -mnewlib
23746 @opindex mnewlib
23747 This option is ignored; it is for compatibility purposes only.  This used to
23748 select linker and preprocessor options for use with newlib.
23750 @item -msoft-div
23751 @itemx -mhard-div
23752 @opindex msoft-div
23753 @opindex mhard-div
23754 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
23755 This default is hardware divide.
23757 @item -msoft-mul
23758 @itemx -mhard-mul
23759 @opindex msoft-mul
23760 @opindex mhard-mul
23761 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
23762 This default is hardware multiply.
23764 @item -msoft-float
23765 @itemx -mhard-float
23766 @opindex msoft-float
23767 @opindex mhard-float
23768 Select software or hardware for floating point operations.
23769 The default is software.
23771 @item -mdouble-float
23772 @opindex mdouble-float
23773 When @option{-mhard-float} is selected, enables generation of double-precision
23774 floating point instructions.  By default functions from @file{libgcc} are used
23775 to perform double-precision floating point operations.
23777 @item -munordered-float
23778 @opindex munordered-float
23779 When @option{-mhard-float} is selected, enables generation of unordered
23780 floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
23781 functions from @file{libgcc} are used to perform unordered floating point
23782 compare and set flag operations.
23784 @item -mcmov
23785 @opindex mcmov
23786 Enable generation of conditional move (@code{l.cmov}) instructions.  By
23787 default the equivalent will be generated using using set and branch.
23789 @item -mror
23790 @opindex mror
23791 Enable generation of rotate right (@code{l.ror}) instructions.  By default
23792 functions from @file{libgcc} are used to perform rotate right operations.
23794 @item -mrori
23795 @opindex mrori
23796 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
23797 By default functions from @file{libgcc} are used to perform rotate right with
23798 immediate operations.
23800 @item -msext
23801 @opindex msext
23802 Enable generation of sign extension (@code{l.ext*}) instructions.  By default
23803 memory loads are used to perform sign extension.
23805 @item -msfimm
23806 @opindex msfimm
23807 Enable generation of compare and set flag with immediate (@code{l.sf*i})
23808 instructions.  By default extra instructions will be generated to store the
23809 immediate to a register first.
23811 @item -mshftimm
23812 @opindex mshftimm
23813 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
23814 @code{l.slli}) instructions.  By default extra instructions will be generated
23815 to store the immediate to a register first.
23818 @end table
23820 @node PDP-11 Options
23821 @subsection PDP-11 Options
23822 @cindex PDP-11 Options
23824 These options are defined for the PDP-11:
23826 @table @gcctabopt
23827 @item -mfpu
23828 @opindex mfpu
23829 Use hardware FPP floating point.  This is the default.  (FIS floating
23830 point on the PDP-11/40 is not supported.)  Implies -m45.
23832 @item -msoft-float
23833 @opindex msoft-float
23834 Do not use hardware floating point.
23836 @item -mac0
23837 @opindex mac0
23838 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23840 @item -mno-ac0
23841 @opindex mno-ac0
23842 Return floating-point results in memory.  This is the default.
23844 @item -m40
23845 @opindex m40
23846 Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
23848 @item -m45
23849 @opindex m45
23850 Generate code for a PDP-11/45.  This is the default.
23852 @item -m10
23853 @opindex m10
23854 Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
23856 @item -mint16
23857 @itemx -mno-int32
23858 @opindex mint16
23859 @opindex mno-int32
23860 Use 16-bit @code{int}.  This is the default.
23862 @item -mint32
23863 @itemx -mno-int16
23864 @opindex mint32
23865 @opindex mno-int16
23866 Use 32-bit @code{int}.
23868 @item -msplit
23869 @opindex msplit
23870 Target has split instruction and data space.  Implies -m45.
23872 @item -munix-asm
23873 @opindex munix-asm
23874 Use Unix assembler syntax.
23876 @item -mdec-asm
23877 @opindex mdec-asm
23878 Use DEC assembler syntax.
23880 @item -mgnu-asm
23881 @opindex mgnu-asm
23882 Use GNU assembler syntax.  This is the default.
23884 @item -mlra
23885 @opindex mlra
23886 Use the new LRA register allocator.  By default, the old ``reload''
23887 allocator is used.
23888 @end table
23890 @node picoChip Options
23891 @subsection picoChip Options
23892 @cindex picoChip options
23894 These @samp{-m} options are defined for picoChip implementations:
23896 @table @gcctabopt
23898 @item -mae=@var{ae_type}
23899 @opindex mcpu
23900 Set the instruction set, register set, and instruction scheduling
23901 parameters for array element type @var{ae_type}.  Supported values
23902 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23904 @option{-mae=ANY} selects a completely generic AE type.  Code
23905 generated with this option runs on any of the other AE types.  The
23906 code is not as efficient as it would be if compiled for a specific
23907 AE type, and some types of operation (e.g., multiplication) do not
23908 work properly on all types of AE.
23910 @option{-mae=MUL} selects a MUL AE type.  This is the most useful AE type
23911 for compiled code, and is the default.
23913 @option{-mae=MAC} selects a DSP-style MAC AE.  Code compiled with this
23914 option may suffer from poor performance of byte (char) manipulation,
23915 since the DSP AE does not provide hardware support for byte load/stores.
23917 @item -msymbol-as-address
23918 Enable the compiler to directly use a symbol name as an address in a
23919 load/store instruction, without first loading it into a
23920 register.  Typically, the use of this option generates larger
23921 programs, which run faster than when the option isn't used.  However, the
23922 results vary from program to program, so it is left as a user option,
23923 rather than being permanently enabled.
23925 @item -mno-inefficient-warnings
23926 Disables warnings about the generation of inefficient code.  These
23927 warnings can be generated, for example, when compiling code that
23928 performs byte-level memory operations on the MAC AE type.  The MAC AE has
23929 no hardware support for byte-level memory operations, so all byte
23930 load/stores must be synthesized from word load/store operations.  This is
23931 inefficient and a warning is generated to indicate
23932 that you should rewrite the code to avoid byte operations, or to target
23933 an AE type that has the necessary hardware support.  This option disables
23934 these warnings.
23936 @end table
23938 @node PowerPC Options
23939 @subsection PowerPC Options
23940 @cindex PowerPC options
23942 These are listed under @xref{RS/6000 and PowerPC Options}.
23944 @node PRU Options
23945 @subsection PRU Options
23946 @cindex PRU Options
23948 These command-line options are defined for PRU target:
23950 @table @gcctabopt
23951 @item -minrt
23952 @opindex minrt
23953 Link with a minimum runtime environment, with no support for static
23954 initializers and constructors.  Using this option can significantly reduce
23955 the size of the final ELF binary.  Beware that the compiler could still
23956 generate code with static initializers and constructors.  It is up to the
23957 programmer to ensure that the source program will not use those features.
23959 @item -mmcu=@var{mcu}
23960 @opindex mmcu
23961 Specify the PRU MCU variant to use.  Check Newlib for the exact list of
23962 supported MCUs.
23964 @item -mno-relax
23965 @opindex mno-relax
23966 Make GCC pass the @option{--no-relax} command-line option to the linker
23967 instead of the @option{--relax} option.
23969 @item -mloop
23970 @opindex mloop
23971 Allow (or do not allow) GCC to use the LOOP instruction.
23973 @item -mabi=@var{variant}
23974 @opindex mabi
23975 Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
23976 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
23977 more naturally with certain GCC assumptions.  These are the differences:
23979 @table @samp
23980 @item Function Pointer Size
23981 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
23982 supports only 32-bit data and code pointers.
23984 @item Optional Return Value Pointer
23985 Function return values larger than 64 bits are passed by using a hidden
23986 pointer as the first argument of the function.  TI ABI, though, mandates that
23987 the pointer can be NULL in case the caller is not using the returned value.
23988 GNU always passes and expects a valid return value pointer.
23990 @end table
23992 The current @option{-mabi=ti} implementation simply raises a compile error
23993 when any of the above code constructs is detected.  As a consequence
23994 the standard C library cannot be built and it is omitted when linking with
23995 @option{-mabi=ti}.
23997 Relaxation is a GNU feature and for safety reasons is disabled when using
23998 @option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
23999 instructions, so the GNU linker cannot adjust them when shortening adjacent
24000 LDI32 pseudo instructions.
24002 @end table
24004 @node RISC-V Options
24005 @subsection RISC-V Options
24006 @cindex RISC-V Options
24008 These command-line options are defined for RISC-V targets:
24010 @table @gcctabopt
24011 @item -mbranch-cost=@var{n}
24012 @opindex mbranch-cost
24013 Set the cost of branches to roughly @var{n} instructions.
24015 @item -mplt
24016 @itemx -mno-plt
24017 @opindex plt
24018 When generating PIC code, do or don't allow the use of PLTs. Ignored for
24019 non-PIC.  The default is @option{-mplt}.
24021 @item -mabi=@var{ABI-string}
24022 @opindex mabi
24023 Specify integer and floating-point calling convention.  @var{ABI-string}
24024 contains two parts: the size of integer types and the registers used for
24025 floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
24026 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
24027 32-bit), and that floating-point values up to 64 bits wide are passed in F
24028 registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
24029 allows the compiler to generate code that uses the F and D extensions but only
24030 allows floating-point values up to 32 bits long to be passed in registers; or
24031 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
24032 passed in registers.
24034 The default for this argument is system dependent, users who want a specific
24035 calling convention should specify one explicitly.  The valid calling
24036 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
24037 @samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
24038 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
24039 invalid because the ABI requires 64-bit values be passed in F registers, but F
24040 registers are only 32 bits wide.  There is also the @samp{ilp32e} ABI that can
24041 only be used with the @samp{rv32e} architecture.  This ABI is not well
24042 specified at present, and is subject to change.
24044 @item -mfdiv
24045 @itemx -mno-fdiv
24046 @opindex mfdiv
24047 Do or don't use hardware floating-point divide and square root instructions.
24048 This requires the F or D extensions for floating-point registers.  The default
24049 is to use them if the specified architecture has these instructions.
24051 @item -mdiv
24052 @itemx -mno-div
24053 @opindex mdiv
24054 Do or don't use hardware instructions for integer division.  This requires the
24055 M extension.  The default is to use them if the specified architecture has
24056 these instructions.
24058 @item -march=@var{ISA-string}
24059 @opindex march
24060 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
24061 lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
24062 @samp{rv32imaf}.
24064 @item -mtune=@var{processor-string}
24065 @opindex mtune
24066 Optimize the output for the given processor, specified by microarchitecture
24067 name.  Permissible values for this option are: @samp{rocket},
24068 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
24069 and @samp{size}.
24071 When @option{-mtune=} is not specified, the default is @samp{rocket}.
24073 The @samp{size} choice is not intended for use by end-users.  This is used
24074 when @option{-Os} is specified.  It overrides the instruction cost info
24075 provided by @option{-mtune=}, but does not override the pipeline info.  This
24076 helps reduce code size while still giving good performance.
24078 @item -mpreferred-stack-boundary=@var{num}
24079 @opindex mpreferred-stack-boundary
24080 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24081 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
24082 the default is 4 (16 bytes or 128-bits).
24084 @strong{Warning:} If you use this switch, then you must build all modules with
24085 the same value, including any libraries.  This includes the system libraries
24086 and startup modules.
24088 @item -msmall-data-limit=@var{n}
24089 @opindex msmall-data-limit
24090 Put global and static data smaller than @var{n} bytes into a special section
24091 (on some targets).
24093 @item -msave-restore
24094 @itemx -mno-save-restore
24095 @opindex msave-restore
24096 Do or don't use smaller but slower prologue and epilogue code that uses
24097 library function calls.  The default is to use fast inline prologues and
24098 epilogues.
24100 @item -mstrict-align
24101 @itemx -mno-strict-align
24102 @opindex mstrict-align
24103 Do not or do generate unaligned memory accesses.  The default is set depending
24104 on whether the processor we are optimizing for supports fast unaligned access
24105 or not.
24107 @item -mcmodel=medlow
24108 @opindex mcmodel=medlow
24109 Generate code for the medium-low code model. The program and its statically
24110 defined symbols must lie within a single 2 GiB address range and must lie
24111 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24112 statically or dynamically linked. This is the default code model.
24114 @item -mcmodel=medany
24115 @opindex mcmodel=medany
24116 Generate code for the medium-any code model. The program and its statically
24117 defined symbols must be within any single 2 GiB address range. Programs can be
24118 statically or dynamically linked.
24120 @item -mexplicit-relocs
24121 @itemx -mno-exlicit-relocs
24122 Use or do not use assembler relocation operators when dealing with symbolic
24123 addresses.  The alternative is to use assembler macros instead, which may
24124 limit optimization.
24126 @item -mrelax
24127 @itemx -mno-relax
24128 Take advantage of linker relaxations to reduce the number of instructions
24129 required to materialize symbol addresses. The default is to take advantage of
24130 linker relaxations.
24132 @item -memit-attribute
24133 @itemx -mno-emit-attribute
24134 Emit (do not emit) RISC-V attribute to record extra information into ELF
24135 objects.  This feature requires at least binutils 2.32.
24137 @item -malign-data=@var{type}
24138 @opindex malign-data
24139 Control how GCC aligns variables and constants of array, structure, or union
24140 types.  Supported values for @var{type} are @samp{xlen} which uses x register
24141 width as the alignment value, and @samp{natural} which uses natural alignment.
24142 @samp{xlen} is the default.
24143 @end table
24145 @node RL78 Options
24146 @subsection RL78 Options
24147 @cindex RL78 Options
24149 @table @gcctabopt
24151 @item -msim
24152 @opindex msim
24153 Links in additional target libraries to support operation within a
24154 simulator.
24156 @item -mmul=none
24157 @itemx -mmul=g10
24158 @itemx -mmul=g13
24159 @itemx -mmul=g14
24160 @itemx -mmul=rl78
24161 @opindex mmul
24162 Specifies the type of hardware multiplication and division support to
24163 be used.  The simplest is @code{none}, which uses software for both
24164 multiplication and division.  This is the default.  The @code{g13}
24165 value is for the hardware multiply/divide peripheral found on the
24166 RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
24167 the multiplication and division instructions supported by the RL78/G14
24168 (S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
24169 the value @code{mg10} is an alias for @code{none}.
24171 In addition a C preprocessor macro is defined, based upon the setting
24172 of this option.  Possible values are: @code{__RL78_MUL_NONE__},
24173 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24175 @item -mcpu=g10
24176 @itemx -mcpu=g13
24177 @itemx -mcpu=g14
24178 @itemx -mcpu=rl78
24179 @opindex mcpu
24180 Specifies the RL78 core to target.  The default is the G14 core, also
24181 known as an S3 core or just RL78.  The G13 or S2 core does not have
24182 multiply or divide instructions, instead it uses a hardware peripheral
24183 for these operations.  The G10 or S1 core does not have register
24184 banks, so it uses a different calling convention.
24186 If this option is set it also selects the type of hardware multiply
24187 support to use, unless this is overridden by an explicit
24188 @option{-mmul=none} option on the command line.  Thus specifying
24189 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24190 peripheral and specifying @option{-mcpu=g10} disables the use of
24191 hardware multiplications altogether.
24193 Note, although the RL78/G14 core is the default target, specifying
24194 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24195 change the behavior of the toolchain since it also enables G14
24196 hardware multiply support.  If these options are not specified on the
24197 command line then software multiplication routines will be used even
24198 though the code targets the RL78 core.  This is for backwards
24199 compatibility with older toolchains which did not have hardware
24200 multiply and divide support.
24202 In addition a C preprocessor macro is defined, based upon the setting
24203 of this option.  Possible values are: @code{__RL78_G10__},
24204 @code{__RL78_G13__} or @code{__RL78_G14__}.
24206 @item -mg10
24207 @itemx -mg13
24208 @itemx -mg14
24209 @itemx -mrl78
24210 @opindex mg10
24211 @opindex mg13
24212 @opindex mg14
24213 @opindex mrl78
24214 These are aliases for the corresponding @option{-mcpu=} option.  They
24215 are provided for backwards compatibility.
24217 @item -mallregs
24218 @opindex mallregs
24219 Allow the compiler to use all of the available registers.  By default
24220 registers @code{r24..r31} are reserved for use in interrupt handlers.
24221 With this option enabled these registers can be used in ordinary
24222 functions as well.
24224 @item -m64bit-doubles
24225 @itemx -m32bit-doubles
24226 @opindex m64bit-doubles
24227 @opindex m32bit-doubles
24228 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24229 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
24230 @option{-m32bit-doubles}.
24232 @item -msave-mduc-in-interrupts
24233 @itemx -mno-save-mduc-in-interrupts
24234 @opindex msave-mduc-in-interrupts
24235 @opindex mno-save-mduc-in-interrupts
24236 Specifies that interrupt handler functions should preserve the
24237 MDUC registers.  This is only necessary if normal code might use
24238 the MDUC registers, for example because it performs multiplication
24239 and division operations.  The default is to ignore the MDUC registers
24240 as this makes the interrupt handlers faster.  The target option -mg13
24241 needs to be passed for this to work as this feature is only available
24242 on the G13 target (S2 core).  The MDUC registers will only be saved
24243 if the interrupt handler performs a multiplication or division
24244 operation or it calls another function.
24246 @end table
24248 @node RS/6000 and PowerPC Options
24249 @subsection IBM RS/6000 and PowerPC Options
24250 @cindex RS/6000 and PowerPC Options
24251 @cindex IBM RS/6000 and PowerPC Options
24253 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24254 @table @gcctabopt
24255 @item -mpowerpc-gpopt
24256 @itemx -mno-powerpc-gpopt
24257 @itemx -mpowerpc-gfxopt
24258 @itemx -mno-powerpc-gfxopt
24259 @need 800
24260 @itemx -mpowerpc64
24261 @itemx -mno-powerpc64
24262 @itemx -mmfcrf
24263 @itemx -mno-mfcrf
24264 @itemx -mpopcntb
24265 @itemx -mno-popcntb
24266 @itemx -mpopcntd
24267 @itemx -mno-popcntd
24268 @itemx -mfprnd
24269 @itemx -mno-fprnd
24270 @need 800
24271 @itemx -mcmpb
24272 @itemx -mno-cmpb
24273 @itemx -mhard-dfp
24274 @itemx -mno-hard-dfp
24275 @opindex mpowerpc-gpopt
24276 @opindex mno-powerpc-gpopt
24277 @opindex mpowerpc-gfxopt
24278 @opindex mno-powerpc-gfxopt
24279 @opindex mpowerpc64
24280 @opindex mno-powerpc64
24281 @opindex mmfcrf
24282 @opindex mno-mfcrf
24283 @opindex mpopcntb
24284 @opindex mno-popcntb
24285 @opindex mpopcntd
24286 @opindex mno-popcntd
24287 @opindex mfprnd
24288 @opindex mno-fprnd
24289 @opindex mcmpb
24290 @opindex mno-cmpb
24291 @opindex mhard-dfp
24292 @opindex mno-hard-dfp
24293 You use these options to specify which instructions are available on the
24294 processor you are using.  The default value of these options is
24295 determined when configuring GCC@.  Specifying the
24296 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24297 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
24298 rather than the options listed above.
24300 Specifying @option{-mpowerpc-gpopt} allows
24301 GCC to use the optional PowerPC architecture instructions in the
24302 General Purpose group, including floating-point square root.  Specifying
24303 @option{-mpowerpc-gfxopt} allows GCC to
24304 use the optional PowerPC architecture instructions in the Graphics
24305 group, including floating-point select.
24307 The @option{-mmfcrf} option allows GCC to generate the move from
24308 condition register field instruction implemented on the POWER4
24309 processor and other processors that support the PowerPC V2.01
24310 architecture.
24311 The @option{-mpopcntb} option allows GCC to generate the popcount and
24312 double-precision FP reciprocal estimate instruction implemented on the
24313 POWER5 processor and other processors that support the PowerPC V2.02
24314 architecture.
24315 The @option{-mpopcntd} option allows GCC to generate the popcount
24316 instruction implemented on the POWER7 processor and other processors
24317 that support the PowerPC V2.06 architecture.
24318 The @option{-mfprnd} option allows GCC to generate the FP round to
24319 integer instructions implemented on the POWER5+ processor and other
24320 processors that support the PowerPC V2.03 architecture.
24321 The @option{-mcmpb} option allows GCC to generate the compare bytes
24322 instruction implemented on the POWER6 processor and other processors
24323 that support the PowerPC V2.05 architecture.
24324 The @option{-mhard-dfp} option allows GCC to generate the decimal
24325 floating-point instructions implemented on some POWER processors.
24327 The @option{-mpowerpc64} option allows GCC to generate the additional
24328 64-bit instructions that are found in the full PowerPC64 architecture
24329 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
24330 @option{-mno-powerpc64}.
24332 @item -mcpu=@var{cpu_type}
24333 @opindex mcpu
24334 Set architecture type, register usage, and
24335 instruction scheduling parameters for machine type @var{cpu_type}.
24336 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24337 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24338 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24339 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24340 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24341 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24342 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24343 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24344 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24345 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24346 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24347 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24349 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24350 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24351 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24352 architecture machine types, with an appropriate, generic processor
24353 model assumed for scheduling purposes.
24355 Specifying @samp{native} as cpu type detects and selects the
24356 architecture option that corresponds to the host processor of the
24357 system performing the compilation.
24358 @option{-mcpu=native} has no effect if GCC does not recognize the
24359 processor.
24361 The other options specify a specific processor.  Code generated under
24362 those options runs best on that processor, and may not run at all on
24363 others.
24365 The @option{-mcpu} options automatically enable or disable the
24366 following options:
24368 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple @gol
24369 -mpopcntb  -mpopcntd  -mpowerpc64 @gol
24370 -mpowerpc-gpopt  -mpowerpc-gfxopt @gol
24371 -mmulhw  -mdlmzb  -mmfpgpr  -mvsx @gol
24372 -mcrypto  -mhtm  -mpower8-fusion  -mpower8-vector @gol
24373 -mquad-memory  -mquad-memory-atomic  -mfloat128  -mfloat128-hardware}
24375 The particular options set for any particular CPU varies between
24376 compiler versions, depending on what setting seems to produce optimal
24377 code for that CPU; it doesn't necessarily reflect the actual hardware's
24378 capabilities.  If you wish to set an individual option to a particular
24379 value, you may specify it after the @option{-mcpu} option, like
24380 @option{-mcpu=970 -mno-altivec}.
24382 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24383 not enabled or disabled by the @option{-mcpu} option at present because
24384 AIX does not have full support for these options.  You may still
24385 enable or disable them individually if you're sure it'll work in your
24386 environment.
24388 @item -mtune=@var{cpu_type}
24389 @opindex mtune
24390 Set the instruction scheduling parameters for machine type
24391 @var{cpu_type}, but do not set the architecture type or register usage,
24392 as @option{-mcpu=@var{cpu_type}} does.  The same
24393 values for @var{cpu_type} are used for @option{-mtune} as for
24394 @option{-mcpu}.  If both are specified, the code generated uses the
24395 architecture and registers set by @option{-mcpu}, but the
24396 scheduling parameters set by @option{-mtune}.
24398 @item -mcmodel=small
24399 @opindex mcmodel=small
24400 Generate PowerPC64 code for the small model: The TOC is limited to
24401 64k.
24403 @item -mcmodel=medium
24404 @opindex mcmodel=medium
24405 Generate PowerPC64 code for the medium model: The TOC and other static
24406 data may be up to a total of 4G in size.  This is the default for 64-bit
24407 Linux.
24409 @item -mcmodel=large
24410 @opindex mcmodel=large
24411 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24412 in size.  Other data and code is only limited by the 64-bit address
24413 space.
24415 @item -maltivec
24416 @itemx -mno-altivec
24417 @opindex maltivec
24418 @opindex mno-altivec
24419 Generate code that uses (does not use) AltiVec instructions, and also
24420 enable the use of built-in functions that allow more direct access to
24421 the AltiVec instruction set.  You may also need to set
24422 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24423 enhancements.
24425 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24426 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 
24427 match array element order corresponding to the endianness of the
24428 target.  That is, element zero identifies the leftmost element in a
24429 vector register when targeting a big-endian platform, and identifies
24430 the rightmost element in a vector register when targeting a
24431 little-endian platform.
24433 @item -mvrsave
24434 @itemx -mno-vrsave
24435 @opindex mvrsave
24436 @opindex mno-vrsave
24437 Generate VRSAVE instructions when generating AltiVec code.
24439 @item -msecure-plt
24440 @opindex msecure-plt
24441 Generate code that allows @command{ld} and @command{ld.so}
24442 to build executables and shared
24443 libraries with non-executable @code{.plt} and @code{.got} sections.
24444 This is a PowerPC
24445 32-bit SYSV ABI option.
24447 @item -mbss-plt
24448 @opindex mbss-plt
24449 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24450 fills in, and
24451 requires @code{.plt} and @code{.got}
24452 sections that are both writable and executable.
24453 This is a PowerPC 32-bit SYSV ABI option.
24455 @item -misel
24456 @itemx -mno-isel
24457 @opindex misel
24458 @opindex mno-isel
24459 This switch enables or disables the generation of ISEL instructions.
24461 @item -mvsx
24462 @itemx -mno-vsx
24463 @opindex mvsx
24464 @opindex mno-vsx
24465 Generate code that uses (does not use) vector/scalar (VSX)
24466 instructions, and also enable the use of built-in functions that allow
24467 more direct access to the VSX instruction set.
24469 @item -mcrypto
24470 @itemx -mno-crypto
24471 @opindex mcrypto
24472 @opindex mno-crypto
24473 Enable the use (disable) of the built-in functions that allow direct
24474 access to the cryptographic instructions that were added in version
24475 2.07 of the PowerPC ISA.
24477 @item -mhtm
24478 @itemx -mno-htm
24479 @opindex mhtm
24480 @opindex mno-htm
24481 Enable (disable) the use of the built-in functions that allow direct
24482 access to the Hardware Transactional Memory (HTM) instructions that
24483 were added in version 2.07 of the PowerPC ISA.
24485 @item -mpower8-fusion
24486 @itemx -mno-power8-fusion
24487 @opindex mpower8-fusion
24488 @opindex mno-power8-fusion
24489 Generate code that keeps (does not keeps) some integer operations
24490 adjacent so that the instructions can be fused together on power8 and
24491 later processors.
24493 @item -mpower8-vector
24494 @itemx -mno-power8-vector
24495 @opindex mpower8-vector
24496 @opindex mno-power8-vector
24497 Generate code that uses (does not use) the vector and scalar
24498 instructions that were added in version 2.07 of the PowerPC ISA.  Also
24499 enable the use of built-in functions that allow more direct access to
24500 the vector instructions.
24502 @item -mquad-memory
24503 @itemx -mno-quad-memory
24504 @opindex mquad-memory
24505 @opindex mno-quad-memory
24506 Generate code that uses (does not use) the non-atomic quad word memory
24507 instructions.  The @option{-mquad-memory} option requires use of
24508 64-bit mode.
24510 @item -mquad-memory-atomic
24511 @itemx -mno-quad-memory-atomic
24512 @opindex mquad-memory-atomic
24513 @opindex mno-quad-memory-atomic
24514 Generate code that uses (does not use) the atomic quad word memory
24515 instructions.  The @option{-mquad-memory-atomic} option requires use of
24516 64-bit mode.
24518 @item -mfloat128
24519 @itemx -mno-float128
24520 @opindex mfloat128
24521 @opindex mno-float128
24522 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24523 and use either software emulation for IEEE 128-bit floating point or
24524 hardware instructions.
24526 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24527 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24528 use the IEEE 128-bit floating point support.  The IEEE 128-bit
24529 floating point support only works on PowerPC Linux systems.
24531 The default for @option{-mfloat128} is enabled on PowerPC Linux
24532 systems using the VSX instruction set, and disabled on other systems.
24534 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24535 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24536 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24537 floating point instructions.  Otherwise, if you do not specify to
24538 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24539 system, IEEE 128-bit floating point will be done with software
24540 emulation.
24542 @item -mfloat128-hardware
24543 @itemx -mno-float128-hardware
24544 @opindex mfloat128-hardware
24545 @opindex mno-float128-hardware
24546 Enable/disable using ISA 3.0 hardware instructions to support the
24547 @var{__float128} data type.
24549 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24550 Linux systems using the ISA 3.0 instruction set, and disabled on other
24551 systems.
24553 @item -m32
24554 @itemx -m64
24555 @opindex m32
24556 @opindex m64
24557 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24558 targets (including GNU/Linux).  The 32-bit environment sets int, long
24559 and pointer to 32 bits and generates code that runs on any PowerPC
24560 variant.  The 64-bit environment sets int to 32 bits and long and
24561 pointer to 64 bits, and generates code for PowerPC64, as for
24562 @option{-mpowerpc64}.
24564 @item -mfull-toc
24565 @itemx -mno-fp-in-toc
24566 @itemx -mno-sum-in-toc
24567 @itemx -mminimal-toc
24568 @opindex mfull-toc
24569 @opindex mno-fp-in-toc
24570 @opindex mno-sum-in-toc
24571 @opindex mminimal-toc
24572 Modify generation of the TOC (Table Of Contents), which is created for
24573 every executable file.  The @option{-mfull-toc} option is selected by
24574 default.  In that case, GCC allocates at least one TOC entry for
24575 each unique non-automatic variable reference in your program.  GCC
24576 also places floating-point constants in the TOC@.  However, only
24577 16,384 entries are available in the TOC@.
24579 If you receive a linker error message that saying you have overflowed
24580 the available TOC space, you can reduce the amount of TOC space used
24581 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24582 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24583 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24584 generate code to calculate the sum of an address and a constant at
24585 run time instead of putting that sum into the TOC@.  You may specify one
24586 or both of these options.  Each causes GCC to produce very slightly
24587 slower and larger code at the expense of conserving TOC space.
24589 If you still run out of space in the TOC even when you specify both of
24590 these options, specify @option{-mminimal-toc} instead.  This option causes
24591 GCC to make only one TOC entry for every file.  When you specify this
24592 option, GCC produces code that is slower and larger but which
24593 uses extremely little TOC space.  You may wish to use this option
24594 only on files that contain less frequently-executed code.
24596 @item -maix64
24597 @itemx -maix32
24598 @opindex maix64
24599 @opindex maix32
24600 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24601 @code{long} type, and the infrastructure needed to support them.
24602 Specifying @option{-maix64} implies @option{-mpowerpc64},
24603 while @option{-maix32} disables the 64-bit ABI and
24604 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
24606 @item -mxl-compat
24607 @itemx -mno-xl-compat
24608 @opindex mxl-compat
24609 @opindex mno-xl-compat
24610 Produce code that conforms more closely to IBM XL compiler semantics
24611 when using AIX-compatible ABI@.  Pass floating-point arguments to
24612 prototyped functions beyond the register save area (RSA) on the stack
24613 in addition to argument FPRs.  Do not assume that most significant
24614 double in 128-bit long double value is properly rounded when comparing
24615 values and converting to double.  Use XL symbol names for long double
24616 support routines.
24618 The AIX calling convention was extended but not initially documented to
24619 handle an obscure K&R C case of calling a function that takes the
24620 address of its arguments with fewer arguments than declared.  IBM XL
24621 compilers access floating-point arguments that do not fit in the
24622 RSA from the stack when a subroutine is compiled without
24623 optimization.  Because always storing floating-point arguments on the
24624 stack is inefficient and rarely needed, this option is not enabled by
24625 default and only is necessary when calling subroutines compiled by IBM
24626 XL compilers without optimization.
24628 @item -mpe
24629 @opindex mpe
24630 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
24631 application written to use message passing with special startup code to
24632 enable the application to run.  The system must have PE installed in the
24633 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24634 must be overridden with the @option{-specs=} option to specify the
24635 appropriate directory location.  The Parallel Environment does not
24636 support threads, so the @option{-mpe} option and the @option{-pthread}
24637 option are incompatible.
24639 @item -malign-natural
24640 @itemx -malign-power
24641 @opindex malign-natural
24642 @opindex malign-power
24643 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24644 @option{-malign-natural} overrides the ABI-defined alignment of larger
24645 types, such as floating-point doubles, on their natural size-based boundary.
24646 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24647 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
24649 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24650 is not supported.
24652 @item -msoft-float
24653 @itemx -mhard-float
24654 @opindex msoft-float
24655 @opindex mhard-float
24656 Generate code that does not use (uses) the floating-point register set.
24657 Software floating-point emulation is provided if you use the
24658 @option{-msoft-float} option, and pass the option to GCC when linking.
24660 @item -mmultiple
24661 @itemx -mno-multiple
24662 @opindex mmultiple
24663 @opindex mno-multiple
24664 Generate code that uses (does not use) the load multiple word
24665 instructions and the store multiple word instructions.  These
24666 instructions are generated by default on POWER systems, and not
24667 generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
24668 PowerPC systems, since those instructions do not work when the
24669 processor is in little-endian mode.  The exceptions are PPC740 and
24670 PPC750 which permit these instructions in little-endian mode.
24672 @item -mupdate
24673 @itemx -mno-update
24674 @opindex mupdate
24675 @opindex mno-update
24676 Generate code that uses (does not use) the load or store instructions
24677 that update the base register to the address of the calculated memory
24678 location.  These instructions are generated by default.  If you use
24679 @option{-mno-update}, there is a small window between the time that the
24680 stack pointer is updated and the address of the previous frame is
24681 stored, which means code that walks the stack frame across interrupts or
24682 signals may get corrupted data.
24684 @item -mavoid-indexed-addresses
24685 @itemx -mno-avoid-indexed-addresses
24686 @opindex mavoid-indexed-addresses
24687 @opindex mno-avoid-indexed-addresses
24688 Generate code that tries to avoid (not avoid) the use of indexed load
24689 or store instructions. These instructions can incur a performance
24690 penalty on Power6 processors in certain situations, such as when
24691 stepping through large arrays that cross a 16M boundary.  This option
24692 is enabled by default when targeting Power6 and disabled otherwise.
24694 @item -mfused-madd
24695 @itemx -mno-fused-madd
24696 @opindex mfused-madd
24697 @opindex mno-fused-madd
24698 Generate code that uses (does not use) the floating-point multiply and
24699 accumulate instructions.  These instructions are generated by default
24700 if hardware floating point is used.  The machine-dependent
24701 @option{-mfused-madd} option is now mapped to the machine-independent
24702 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24703 mapped to @option{-ffp-contract=off}.
24705 @item -mmulhw
24706 @itemx -mno-mulhw
24707 @opindex mmulhw
24708 @opindex mno-mulhw
24709 Generate code that uses (does not use) the half-word multiply and
24710 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24711 These instructions are generated by default when targeting those
24712 processors.
24714 @item -mdlmzb
24715 @itemx -mno-dlmzb
24716 @opindex mdlmzb
24717 @opindex mno-dlmzb
24718 Generate code that uses (does not use) the string-search @samp{dlmzb}
24719 instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
24720 generated by default when targeting those processors.
24722 @item -mno-bit-align
24723 @itemx -mbit-align
24724 @opindex mno-bit-align
24725 @opindex mbit-align
24726 On System V.4 and embedded PowerPC systems do not (do) force structures
24727 and unions that contain bit-fields to be aligned to the base type of the
24728 bit-field.
24730 For example, by default a structure containing nothing but 8
24731 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24732 boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
24733 the structure is aligned to a 1-byte boundary and is 1 byte in
24734 size.
24736 @item -mno-strict-align
24737 @itemx -mstrict-align
24738 @opindex mno-strict-align
24739 @opindex mstrict-align
24740 On System V.4 and embedded PowerPC systems do not (do) assume that
24741 unaligned memory references are handled by the system.
24743 @item -mrelocatable
24744 @itemx -mno-relocatable
24745 @opindex mrelocatable
24746 @opindex mno-relocatable
24747 Generate code that allows (does not allow) a static executable to be
24748 relocated to a different address at run time.  A simple embedded
24749 PowerPC system loader should relocate the entire contents of
24750 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24751 a table of 32-bit addresses generated by this option.  For this to
24752 work, all objects linked together must be compiled with
24753 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24754 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24756 @item -mrelocatable-lib
24757 @itemx -mno-relocatable-lib
24758 @opindex mrelocatable-lib
24759 @opindex mno-relocatable-lib
24760 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24761 @code{.fixup} section to allow static executables to be relocated at
24762 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24763 alignment of @option{-mrelocatable}.  Objects compiled with
24764 @option{-mrelocatable-lib} may be linked with objects compiled with
24765 any combination of the @option{-mrelocatable} options.
24767 @item -mno-toc
24768 @itemx -mtoc
24769 @opindex mno-toc
24770 @opindex mtoc
24771 On System V.4 and embedded PowerPC systems do not (do) assume that
24772 register 2 contains a pointer to a global area pointing to the addresses
24773 used in the program.
24775 @item -mlittle
24776 @itemx -mlittle-endian
24777 @opindex mlittle
24778 @opindex mlittle-endian
24779 On System V.4 and embedded PowerPC systems compile code for the
24780 processor in little-endian mode.  The @option{-mlittle-endian} option is
24781 the same as @option{-mlittle}.
24783 @item -mbig
24784 @itemx -mbig-endian
24785 @opindex mbig
24786 @opindex mbig-endian
24787 On System V.4 and embedded PowerPC systems compile code for the
24788 processor in big-endian mode.  The @option{-mbig-endian} option is
24789 the same as @option{-mbig}.
24791 @item -mdynamic-no-pic
24792 @opindex mdynamic-no-pic
24793 On Darwin and Mac OS X systems, compile code so that it is not
24794 relocatable, but that its external references are relocatable.  The
24795 resulting code is suitable for applications, but not shared
24796 libraries.
24798 @item -msingle-pic-base
24799 @opindex msingle-pic-base
24800 Treat the register used for PIC addressing as read-only, rather than
24801 loading it in the prologue for each function.  The runtime system is
24802 responsible for initializing this register with an appropriate value
24803 before execution begins.
24805 @item -mprioritize-restricted-insns=@var{priority}
24806 @opindex mprioritize-restricted-insns
24807 This option controls the priority that is assigned to
24808 dispatch-slot restricted instructions during the second scheduling
24809 pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
24810 or @samp{2} to assign no, highest, or second-highest (respectively) 
24811 priority to dispatch-slot restricted
24812 instructions.
24814 @item -msched-costly-dep=@var{dependence_type}
24815 @opindex msched-costly-dep
24816 This option controls which dependences are considered costly
24817 by the target during instruction scheduling.  The argument
24818 @var{dependence_type} takes one of the following values:
24820 @table @asis
24821 @item @samp{no}
24822 No dependence is costly.
24824 @item @samp{all}
24825 All dependences are costly.
24827 @item @samp{true_store_to_load}
24828 A true dependence from store to load is costly.
24830 @item @samp{store_to_load}
24831 Any dependence from store to load is costly.
24833 @item @var{number}
24834 Any dependence for which the latency is greater than or equal to 
24835 @var{number} is costly.
24836 @end table
24838 @item -minsert-sched-nops=@var{scheme}
24839 @opindex minsert-sched-nops
24840 This option controls which NOP insertion scheme is used during
24841 the second scheduling pass.  The argument @var{scheme} takes one of the
24842 following values:
24844 @table @asis
24845 @item @samp{no}
24846 Don't insert NOPs.
24848 @item @samp{pad}
24849 Pad with NOPs any dispatch group that has vacant issue slots,
24850 according to the scheduler's grouping.
24852 @item @samp{regroup_exact}
24853 Insert NOPs to force costly dependent insns into
24854 separate groups.  Insert exactly as many NOPs as needed to force an insn
24855 to a new group, according to the estimated processor grouping.
24857 @item @var{number}
24858 Insert NOPs to force costly dependent insns into
24859 separate groups.  Insert @var{number} NOPs to force an insn to a new group.
24860 @end table
24862 @item -mcall-sysv
24863 @opindex mcall-sysv
24864 On System V.4 and embedded PowerPC systems compile code using calling
24865 conventions that adhere to the March 1995 draft of the System V
24866 Application Binary Interface, PowerPC processor supplement.  This is the
24867 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24869 @item -mcall-sysv-eabi
24870 @itemx -mcall-eabi
24871 @opindex mcall-sysv-eabi
24872 @opindex mcall-eabi
24873 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24875 @item -mcall-sysv-noeabi
24876 @opindex mcall-sysv-noeabi
24877 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24879 @item -mcall-aixdesc
24880 @opindex m
24881 On System V.4 and embedded PowerPC systems compile code for the AIX
24882 operating system.
24884 @item -mcall-linux
24885 @opindex mcall-linux
24886 On System V.4 and embedded PowerPC systems compile code for the
24887 Linux-based GNU system.
24889 @item -mcall-freebsd
24890 @opindex mcall-freebsd
24891 On System V.4 and embedded PowerPC systems compile code for the
24892 FreeBSD operating system.
24894 @item -mcall-netbsd
24895 @opindex mcall-netbsd
24896 On System V.4 and embedded PowerPC systems compile code for the
24897 NetBSD operating system.
24899 @item -mcall-openbsd
24900 @opindex mcall-netbsd
24901 On System V.4 and embedded PowerPC systems compile code for the
24902 OpenBSD operating system.
24904 @item -mtraceback=@var{traceback_type}
24905 @opindex mtraceback
24906 Select the type of traceback table. Valid values for @var{traceback_type}
24907 are @samp{full}, @samp{part}, and @samp{no}.
24909 @item -maix-struct-return
24910 @opindex maix-struct-return
24911 Return all structures in memory (as specified by the AIX ABI)@.
24913 @item -msvr4-struct-return
24914 @opindex msvr4-struct-return
24915 Return structures smaller than 8 bytes in registers (as specified by the
24916 SVR4 ABI)@.
24918 @item -mabi=@var{abi-type}
24919 @opindex mabi
24920 Extend the current ABI with a particular extension, or remove such extension.
24921 Valid values are @samp{altivec}, @samp{no-altivec},
24922 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24923 @samp{elfv1}, @samp{elfv2}@.
24925 @item -mabi=ibmlongdouble
24926 @opindex mabi=ibmlongdouble
24927 Change the current ABI to use IBM extended-precision long double.
24928 This is not likely to work if your system defaults to using IEEE
24929 extended-precision long double.  If you change the long double type
24930 from IEEE extended-precision, the compiler will issue a warning unless
24931 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
24932 to be enabled.
24934 @item -mabi=ieeelongdouble
24935 @opindex mabi=ieeelongdouble
24936 Change the current ABI to use IEEE extended-precision long double.
24937 This is not likely to work if your system defaults to using IBM
24938 extended-precision long double.  If you change the long double type
24939 from IBM extended-precision, the compiler will issue a warning unless
24940 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
24941 to be enabled.
24943 @item -mabi=elfv1
24944 @opindex mabi=elfv1
24945 Change the current ABI to use the ELFv1 ABI.
24946 This is the default ABI for big-endian PowerPC 64-bit Linux.
24947 Overriding the default ABI requires special system support and is
24948 likely to fail in spectacular ways.
24950 @item -mabi=elfv2
24951 @opindex mabi=elfv2
24952 Change the current ABI to use the ELFv2 ABI.
24953 This is the default ABI for little-endian PowerPC 64-bit Linux.
24954 Overriding the default ABI requires special system support and is
24955 likely to fail in spectacular ways.
24957 @item -mgnu-attribute
24958 @itemx -mno-gnu-attribute
24959 @opindex mgnu-attribute
24960 @opindex mno-gnu-attribute
24961 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24962 .gnu.attributes section that specify ABI variations in function
24963 parameters or return values.
24965 @item -mprototype
24966 @itemx -mno-prototype
24967 @opindex mprototype
24968 @opindex mno-prototype
24969 On System V.4 and embedded PowerPC systems assume that all calls to
24970 variable argument functions are properly prototyped.  Otherwise, the
24971 compiler must insert an instruction before every non-prototyped call to
24972 set or clear bit 6 of the condition code register (@code{CR}) to
24973 indicate whether floating-point values are passed in the floating-point
24974 registers in case the function takes variable arguments.  With
24975 @option{-mprototype}, only calls to prototyped variable argument functions
24976 set or clear the bit.
24978 @item -msim
24979 @opindex msim
24980 On embedded PowerPC systems, assume that the startup module is called
24981 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24982 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
24983 configurations.
24985 @item -mmvme
24986 @opindex mmvme
24987 On embedded PowerPC systems, assume that the startup module is called
24988 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24989 @file{libc.a}.
24991 @item -mads
24992 @opindex mads
24993 On embedded PowerPC systems, assume that the startup module is called
24994 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24995 @file{libc.a}.
24997 @item -myellowknife
24998 @opindex myellowknife
24999 On embedded PowerPC systems, assume that the startup module is called
25000 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
25001 @file{libc.a}.
25003 @item -mvxworks
25004 @opindex mvxworks
25005 On System V.4 and embedded PowerPC systems, specify that you are
25006 compiling for a VxWorks system.
25008 @item -memb
25009 @opindex memb
25010 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
25011 header to indicate that @samp{eabi} extended relocations are used.
25013 @item -meabi
25014 @itemx -mno-eabi
25015 @opindex meabi
25016 @opindex mno-eabi
25017 On System V.4 and embedded PowerPC systems do (do not) adhere to the
25018 Embedded Applications Binary Interface (EABI), which is a set of
25019 modifications to the System V.4 specifications.  Selecting @option{-meabi}
25020 means that the stack is aligned to an 8-byte boundary, a function
25021 @code{__eabi} is called from @code{main} to set up the EABI
25022 environment, and the @option{-msdata} option can use both @code{r2} and
25023 @code{r13} to point to two separate small data areas.  Selecting
25024 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
25025 no EABI initialization function is called from @code{main}, and the
25026 @option{-msdata} option only uses @code{r13} to point to a single
25027 small data area.  The @option{-meabi} option is on by default if you
25028 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
25030 @item -msdata=eabi
25031 @opindex msdata=eabi
25032 On System V.4 and embedded PowerPC systems, put small initialized
25033 @code{const} global and static data in the @code{.sdata2} section, which
25034 is pointed to by register @code{r2}.  Put small initialized
25035 non-@code{const} global and static data in the @code{.sdata} section,
25036 which is pointed to by register @code{r13}.  Put small uninitialized
25037 global and static data in the @code{.sbss} section, which is adjacent to
25038 the @code{.sdata} section.  The @option{-msdata=eabi} option is
25039 incompatible with the @option{-mrelocatable} option.  The
25040 @option{-msdata=eabi} option also sets the @option{-memb} option.
25042 @item -msdata=sysv
25043 @opindex msdata=sysv
25044 On System V.4 and embedded PowerPC systems, put small global and static
25045 data in the @code{.sdata} section, which is pointed to by register
25046 @code{r13}.  Put small uninitialized global and static data in the
25047 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
25048 The @option{-msdata=sysv} option is incompatible with the
25049 @option{-mrelocatable} option.
25051 @item -msdata=default
25052 @itemx -msdata
25053 @opindex msdata=default
25054 @opindex msdata
25055 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
25056 compile code the same as @option{-msdata=eabi}, otherwise compile code the
25057 same as @option{-msdata=sysv}.
25059 @item -msdata=data
25060 @opindex msdata=data
25061 On System V.4 and embedded PowerPC systems, put small global
25062 data in the @code{.sdata} section.  Put small uninitialized global
25063 data in the @code{.sbss} section.  Do not use register @code{r13}
25064 to address small data however.  This is the default behavior unless
25065 other @option{-msdata} options are used.
25067 @item -msdata=none
25068 @itemx -mno-sdata
25069 @opindex msdata=none
25070 @opindex mno-sdata
25071 On embedded PowerPC systems, put all initialized global and static data
25072 in the @code{.data} section, and all uninitialized data in the
25073 @code{.bss} section.
25075 @item -mreadonly-in-sdata
25076 @opindex mreadonly-in-sdata
25077 @opindex mno-readonly-in-sdata
25078 Put read-only objects in the @code{.sdata} section as well.  This is the
25079 default.
25081 @item -mblock-move-inline-limit=@var{num}
25082 @opindex mblock-move-inline-limit
25083 Inline all block moves (such as calls to @code{memcpy} or structure
25084 copies) less than or equal to @var{num} bytes.  The minimum value for
25085 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
25086 targets.  The default value is target-specific.
25088 @item -mblock-compare-inline-limit=@var{num}
25089 @opindex mblock-compare-inline-limit
25090 Generate non-looping inline code for all block compares (such as calls
25091 to @code{memcmp} or structure compares) less than or equal to @var{num}
25092 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25093 block compare is disabled. The default value is target-specific.
25095 @item -mblock-compare-inline-loop-limit=@var{num}
25096 @opindex mblock-compare-inline-loop-limit
25097 Generate an inline expansion using loop code for all block compares that
25098 are less than or equal to @var{num} bytes, but greater than the limit
25099 for non-loop inline block compare expansion. If the block length is not
25100 constant, at most @var{num} bytes will be compared before @code{memcmp}
25101 is called to compare the remainder of the block. The default value is
25102 target-specific.
25104 @item -mstring-compare-inline-limit=@var{num}
25105 @opindex mstring-compare-inline-limit
25106 Compare at most @var{num} string bytes with inline code.
25107 If the difference or end of string is not found at the
25108 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25109 take care of the rest of the comparison. The default is 64 bytes.
25111 @item -G @var{num}
25112 @opindex G
25113 @cindex smaller data references (PowerPC)
25114 @cindex .sdata/.sdata2 references (PowerPC)
25115 On embedded PowerPC systems, put global and static items less than or
25116 equal to @var{num} bytes into the small data or BSS sections instead of
25117 the normal data or BSS section.  By default, @var{num} is 8.  The
25118 @option{-G @var{num}} switch is also passed to the linker.
25119 All modules should be compiled with the same @option{-G @var{num}} value.
25121 @item -mregnames
25122 @itemx -mno-regnames
25123 @opindex mregnames
25124 @opindex mno-regnames
25125 On System V.4 and embedded PowerPC systems do (do not) emit register
25126 names in the assembly language output using symbolic forms.
25128 @item -mlongcall
25129 @itemx -mno-longcall
25130 @opindex mlongcall
25131 @opindex mno-longcall
25132 By default assume that all calls are far away so that a longer and more
25133 expensive calling sequence is required.  This is required for calls
25134 farther than 32 megabytes (33,554,432 bytes) from the current location.
25135 A short call is generated if the compiler knows
25136 the call cannot be that far away.  This setting can be overridden by
25137 the @code{shortcall} function attribute, or by @code{#pragma
25138 longcall(0)}.
25140 Some linkers are capable of detecting out-of-range calls and generating
25141 glue code on the fly.  On these systems, long calls are unnecessary and
25142 generate slower code.  As of this writing, the AIX linker can do this,
25143 as can the GNU linker for PowerPC/64.  It is planned to add this feature
25144 to the GNU linker for 32-bit PowerPC systems as well.
25146 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
25147 GCC can generate long calls using an inline PLT call sequence (see
25148 @option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
25149 ELFv1 (big-endian) do not support inline PLT calls.
25151 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25152 callee, L42}, plus a @dfn{branch island} (glue code).  The two target
25153 addresses represent the callee and the branch island.  The
25154 Darwin/PPC linker prefers the first address and generates a @code{bl
25155 callee} if the PPC @code{bl} instruction reaches the callee directly;
25156 otherwise, the linker generates @code{bl L42} to call the branch
25157 island.  The branch island is appended to the body of the
25158 calling function; it computes the full 32-bit address of the callee
25159 and jumps to it.
25161 On Mach-O (Darwin) systems, this option directs the compiler emit to
25162 the glue for every direct call, and the Darwin linker decides whether
25163 to use or discard it.
25165 In the future, GCC may ignore all longcall specifications
25166 when the linker is known to generate glue.
25168 @item -mpltseq
25169 @itemx -mno-pltseq
25170 @opindex mpltseq
25171 @opindex mno-pltseq
25172 Implement (do not implement) -fno-plt and long calls using an inline
25173 PLT call sequence that supports lazy linking and long calls to
25174 functions in dlopen'd shared libraries.  Inline PLT calls are only
25175 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25176 linkers, and are enabled by default if the support is detected when
25177 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25178 configured with @option{--enable-secureplt}.  @option{-mpltseq} code
25179 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25180 linked together.
25182 @item -mtls-markers
25183 @itemx -mno-tls-markers
25184 @opindex mtls-markers
25185 @opindex mno-tls-markers
25186 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25187 specifying the function argument.  The relocation allows the linker to
25188 reliably associate function call with argument setup instructions for
25189 TLS optimization, which in turn allows GCC to better schedule the
25190 sequence.
25192 @item -mrecip
25193 @itemx -mno-recip
25194 @opindex mrecip
25195 This option enables use of the reciprocal estimate and
25196 reciprocal square root estimate instructions with additional
25197 Newton-Raphson steps to increase precision instead of doing a divide or
25198 square root and divide for floating-point arguments.  You should use
25199 the @option{-ffast-math} option when using @option{-mrecip} (or at
25200 least @option{-funsafe-math-optimizations},
25201 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25202 @option{-fno-trapping-math}).  Note that while the throughput of the
25203 sequence is generally higher than the throughput of the non-reciprocal
25204 instruction, the precision of the sequence can be decreased by up to 2
25205 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25206 roots.
25208 @item -mrecip=@var{opt}
25209 @opindex mrecip=opt
25210 This option controls which reciprocal estimate instructions
25211 may be used.  @var{opt} is a comma-separated list of options, which may
25212 be preceded by a @code{!} to invert the option:
25214 @table @samp
25216 @item all
25217 Enable all estimate instructions.
25219 @item default 
25220 Enable the default instructions, equivalent to @option{-mrecip}.
25222 @item none 
25223 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25225 @item div 
25226 Enable the reciprocal approximation instructions for both 
25227 single and double precision.
25229 @item divf 
25230 Enable the single-precision reciprocal approximation instructions.
25232 @item divd 
25233 Enable the double-precision reciprocal approximation instructions.
25235 @item rsqrt 
25236 Enable the reciprocal square root approximation instructions for both
25237 single and double precision.
25239 @item rsqrtf 
25240 Enable the single-precision reciprocal square root approximation instructions.
25242 @item rsqrtd 
25243 Enable the double-precision reciprocal square root approximation instructions.
25245 @end table
25247 So, for example, @option{-mrecip=all,!rsqrtd} enables
25248 all of the reciprocal estimate instructions, except for the
25249 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25250 which handle the double-precision reciprocal square root calculations.
25252 @item -mrecip-precision
25253 @itemx -mno-recip-precision
25254 @opindex mrecip-precision
25255 Assume (do not assume) that the reciprocal estimate instructions
25256 provide higher-precision estimates than is mandated by the PowerPC
25257 ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25258 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25259 The double-precision square root estimate instructions are not generated by
25260 default on low-precision machines, since they do not provide an
25261 estimate that converges after three steps.
25263 @item -mveclibabi=@var{type}
25264 @opindex mveclibabi
25265 Specifies the ABI type to use for vectorizing intrinsics using an
25266 external library.  The only type supported at present is @samp{mass},
25267 which specifies to use IBM's Mathematical Acceleration Subsystem
25268 (MASS) libraries for vectorizing intrinsics using external libraries.
25269 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25270 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25271 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25272 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25273 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25274 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25275 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25276 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25277 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25278 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25279 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25280 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25281 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25282 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25283 for power7.  Both @option{-ftree-vectorize} and
25284 @option{-funsafe-math-optimizations} must also be enabled.  The MASS
25285 libraries must be specified at link time.
25287 @item -mfriz
25288 @itemx -mno-friz
25289 @opindex mfriz
25290 Generate (do not generate) the @code{friz} instruction when the
25291 @option{-funsafe-math-optimizations} option is used to optimize
25292 rounding of floating-point values to 64-bit integer and back to floating
25293 point.  The @code{friz} instruction does not return the same value if
25294 the floating-point number is too large to fit in an integer.
25296 @item -mpointers-to-nested-functions
25297 @itemx -mno-pointers-to-nested-functions
25298 @opindex mpointers-to-nested-functions
25299 Generate (do not generate) code to load up the static chain register
25300 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25301 systems where a function pointer points to a 3-word descriptor giving
25302 the function address, TOC value to be loaded in register @code{r2}, and
25303 static chain value to be loaded in register @code{r11}.  The
25304 @option{-mpointers-to-nested-functions} is on by default.  You cannot
25305 call through pointers to nested functions or pointers
25306 to functions compiled in other languages that use the static chain if
25307 you use @option{-mno-pointers-to-nested-functions}.
25309 @item -msave-toc-indirect
25310 @itemx -mno-save-toc-indirect
25311 @opindex msave-toc-indirect
25312 Generate (do not generate) code to save the TOC value in the reserved
25313 stack location in the function prologue if the function calls through
25314 a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
25315 saved in the prologue, it is saved just before the call through the
25316 pointer.  The @option{-mno-save-toc-indirect} option is the default.
25318 @item -mcompat-align-parm
25319 @itemx -mno-compat-align-parm
25320 @opindex mcompat-align-parm
25321 Generate (do not generate) code to pass structure parameters with a
25322 maximum alignment of 64 bits, for compatibility with older versions
25323 of GCC.
25325 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25326 structure parameter on a 128-bit boundary when that structure contained
25327 a member requiring 128-bit alignment.  This is corrected in more
25328 recent versions of GCC.  This option may be used to generate code
25329 that is compatible with functions compiled with older versions of
25330 GCC.
25332 The @option{-mno-compat-align-parm} option is the default.
25334 @item -mstack-protector-guard=@var{guard}
25335 @itemx -mstack-protector-guard-reg=@var{reg}
25336 @itemx -mstack-protector-guard-offset=@var{offset}
25337 @itemx -mstack-protector-guard-symbol=@var{symbol}
25338 @opindex mstack-protector-guard
25339 @opindex mstack-protector-guard-reg
25340 @opindex mstack-protector-guard-offset
25341 @opindex mstack-protector-guard-symbol
25342 Generate stack protection code using canary at @var{guard}.  Supported
25343 locations are @samp{global} for global canary or @samp{tls} for per-thread
25344 canary in the TLS block (the default with GNU libc version 2.4 or later).
25346 With the latter choice the options
25347 @option{-mstack-protector-guard-reg=@var{reg}} and
25348 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25349 which register to use as base register for reading the canary, and from what
25350 offset from that base register. The default for those is as specified in the
25351 relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25352 the offset with a symbol reference to a canary in the TLS block.
25354 @item -mpcrel
25355 @itemx -mno-pcrel
25356 @opindex mpcrel
25357 @opindex mno-pcrel
25358 Generate (do not generate) pc-relative addressing when the option
25359 @option{-mcpu=future} is used.
25360 @end table
25362 @node RX Options
25363 @subsection RX Options
25364 @cindex RX Options
25366 These command-line options are defined for RX targets:
25368 @table @gcctabopt
25369 @item -m64bit-doubles
25370 @itemx -m32bit-doubles
25371 @opindex m64bit-doubles
25372 @opindex m32bit-doubles
25373 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25374 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
25375 @option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
25376 works on 32-bit values, which is why the default is
25377 @option{-m32bit-doubles}.
25379 @item -fpu
25380 @itemx -nofpu
25381 @opindex fpu
25382 @opindex nofpu
25383 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25384 floating-point hardware.  The default is enabled for the RX600
25385 series and disabled for the RX200 series.
25387 Floating-point instructions are only generated for 32-bit floating-point 
25388 values, however, so the FPU hardware is not used for doubles if the
25389 @option{-m64bit-doubles} option is used.
25391 @emph{Note} If the @option{-fpu} option is enabled then
25392 @option{-funsafe-math-optimizations} is also enabled automatically.
25393 This is because the RX FPU instructions are themselves unsafe.
25395 @item -mcpu=@var{name}
25396 @opindex mcpu
25397 Selects the type of RX CPU to be targeted.  Currently three types are
25398 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25399 the specific @samp{RX610} CPU.  The default is @samp{RX600}.
25401 The only difference between @samp{RX600} and @samp{RX610} is that the
25402 @samp{RX610} does not support the @code{MVTIPL} instruction.
25404 The @samp{RX200} series does not have a hardware floating-point unit
25405 and so @option{-nofpu} is enabled by default when this type is
25406 selected.
25408 @item -mbig-endian-data
25409 @itemx -mlittle-endian-data
25410 @opindex mbig-endian-data
25411 @opindex mlittle-endian-data
25412 Store data (but not code) in the big-endian format.  The default is
25413 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25414 format.
25416 @item -msmall-data-limit=@var{N}
25417 @opindex msmall-data-limit
25418 Specifies the maximum size in bytes of global and static variables
25419 which can be placed into the small data area.  Using the small data
25420 area can lead to smaller and faster code, but the size of area is
25421 limited and it is up to the programmer to ensure that the area does
25422 not overflow.  Also when the small data area is used one of the RX's
25423 registers (usually @code{r13}) is reserved for use pointing to this
25424 area, so it is no longer available for use by the compiler.  This
25425 could result in slower and/or larger code if variables are pushed onto
25426 the stack instead of being held in this register.
25428 Note, common variables (variables that have not been initialized) and
25429 constants are not placed into the small data area as they are assigned
25430 to other sections in the output executable.
25432 The default value is zero, which disables this feature.  Note, this
25433 feature is not enabled by default with higher optimization levels
25434 (@option{-O2} etc) because of the potentially detrimental effects of
25435 reserving a register.  It is up to the programmer to experiment and
25436 discover whether this feature is of benefit to their program.  See the
25437 description of the @option{-mpid} option for a description of how the
25438 actual register to hold the small data area pointer is chosen.
25440 @item -msim
25441 @itemx -mno-sim
25442 @opindex msim
25443 @opindex mno-sim
25444 Use the simulator runtime.  The default is to use the libgloss
25445 board-specific runtime.
25447 @item -mas100-syntax
25448 @itemx -mno-as100-syntax
25449 @opindex mas100-syntax
25450 @opindex mno-as100-syntax
25451 When generating assembler output use a syntax that is compatible with
25452 Renesas's AS100 assembler.  This syntax can also be handled by the GAS
25453 assembler, but it has some restrictions so it is not generated by default.
25455 @item -mmax-constant-size=@var{N}
25456 @opindex mmax-constant-size
25457 Specifies the maximum size, in bytes, of a constant that can be used as
25458 an operand in a RX instruction.  Although the RX instruction set does
25459 allow constants of up to 4 bytes in length to be used in instructions,
25460 a longer value equates to a longer instruction.  Thus in some
25461 circumstances it can be beneficial to restrict the size of constants
25462 that are used in instructions.  Constants that are too big are instead
25463 placed into a constant pool and referenced via register indirection.
25465 The value @var{N} can be between 0 and 4.  A value of 0 (the default)
25466 or 4 means that constants of any size are allowed.
25468 @item -mrelax
25469 @opindex mrelax
25470 Enable linker relaxation.  Linker relaxation is a process whereby the
25471 linker attempts to reduce the size of a program by finding shorter
25472 versions of various instructions.  Disabled by default.
25474 @item -mint-register=@var{N}
25475 @opindex mint-register
25476 Specify the number of registers to reserve for fast interrupt handler
25477 functions.  The value @var{N} can be between 0 and 4.  A value of 1
25478 means that register @code{r13} is reserved for the exclusive use
25479 of fast interrupt handlers.  A value of 2 reserves @code{r13} and
25480 @code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
25481 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25482 A value of 0, the default, does not reserve any registers.
25484 @item -msave-acc-in-interrupts
25485 @opindex msave-acc-in-interrupts
25486 Specifies that interrupt handler functions should preserve the
25487 accumulator register.  This is only necessary if normal code might use
25488 the accumulator register, for example because it performs 64-bit
25489 multiplications.  The default is to ignore the accumulator as this
25490 makes the interrupt handlers faster.
25492 @item -mpid
25493 @itemx -mno-pid
25494 @opindex mpid
25495 @opindex mno-pid
25496 Enables the generation of position independent data.  When enabled any
25497 access to constant data is done via an offset from a base address
25498 held in a register.  This allows the location of constant data to be
25499 determined at run time without requiring the executable to be
25500 relocated, which is a benefit to embedded applications with tight
25501 memory constraints.  Data that can be modified is not affected by this
25502 option.
25504 Note, using this feature reserves a register, usually @code{r13}, for
25505 the constant data base address.  This can result in slower and/or
25506 larger code, especially in complicated functions.
25508 The actual register chosen to hold the constant data base address
25509 depends upon whether the @option{-msmall-data-limit} and/or the
25510 @option{-mint-register} command-line options are enabled.  Starting
25511 with register @code{r13} and proceeding downwards, registers are
25512 allocated first to satisfy the requirements of @option{-mint-register},
25513 then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
25514 is possible for the small data area register to be @code{r8} if both
25515 @option{-mint-register=4} and @option{-mpid} are specified on the
25516 command line.
25518 By default this feature is not enabled.  The default can be restored
25519 via the @option{-mno-pid} command-line option.
25521 @item -mno-warn-multiple-fast-interrupts
25522 @itemx -mwarn-multiple-fast-interrupts
25523 @opindex mno-warn-multiple-fast-interrupts
25524 @opindex mwarn-multiple-fast-interrupts
25525 Prevents GCC from issuing a warning message if it finds more than one
25526 fast interrupt handler when it is compiling a file.  The default is to
25527 issue a warning for each extra fast interrupt handler found, as the RX
25528 only supports one such interrupt.
25530 @item -mallow-string-insns
25531 @itemx -mno-allow-string-insns
25532 @opindex mallow-string-insns
25533 @opindex mno-allow-string-insns
25534 Enables or disables the use of the string manipulation instructions
25535 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25536 @code{SWHILE} and also the @code{RMPA} instruction.  These
25537 instructions may prefetch data, which is not safe to do if accessing
25538 an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
25539 for more information).
25541 The default is to allow these instructions, but it is not possible for
25542 GCC to reliably detect all circumstances where a string instruction
25543 might be used to access an I/O register, so their use cannot be
25544 disabled automatically.  Instead it is reliant upon the programmer to
25545 use the @option{-mno-allow-string-insns} option if their program
25546 accesses I/O space.
25548 When the instructions are enabled GCC defines the C preprocessor
25549 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25550 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25552 @item -mjsr
25553 @itemx -mno-jsr
25554 @opindex mjsr
25555 @opindex mno-jsr
25556 Use only (or not only) @code{JSR} instructions to access functions.
25557 This option can be used when code size exceeds the range of @code{BSR}
25558 instructions.  Note that @option{-mno-jsr} does not mean to not use
25559 @code{JSR} but instead means that any type of branch may be used.
25560 @end table
25562 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25563 has special significance to the RX port when used with the
25564 @code{interrupt} function attribute.  This attribute indicates a
25565 function intended to process fast interrupts.  GCC ensures
25566 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25567 and/or @code{r13} and only provided that the normal use of the
25568 corresponding registers have been restricted via the
25569 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25570 options.
25572 @node S/390 and zSeries Options
25573 @subsection S/390 and zSeries Options
25574 @cindex S/390 and zSeries Options
25576 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25578 @table @gcctabopt
25579 @item -mhard-float
25580 @itemx -msoft-float
25581 @opindex mhard-float
25582 @opindex msoft-float
25583 Use (do not use) the hardware floating-point instructions and registers
25584 for floating-point operations.  When @option{-msoft-float} is specified,
25585 functions in @file{libgcc.a} are used to perform floating-point
25586 operations.  When @option{-mhard-float} is specified, the compiler
25587 generates IEEE floating-point instructions.  This is the default.
25589 @item -mhard-dfp
25590 @itemx -mno-hard-dfp
25591 @opindex mhard-dfp
25592 @opindex mno-hard-dfp
25593 Use (do not use) the hardware decimal-floating-point instructions for
25594 decimal-floating-point operations.  When @option{-mno-hard-dfp} is
25595 specified, functions in @file{libgcc.a} are used to perform
25596 decimal-floating-point operations.  When @option{-mhard-dfp} is
25597 specified, the compiler generates decimal-floating-point hardware
25598 instructions.  This is the default for @option{-march=z9-ec} or higher.
25600 @item -mlong-double-64
25601 @itemx -mlong-double-128
25602 @opindex mlong-double-64
25603 @opindex mlong-double-128
25604 These switches control the size of @code{long double} type. A size
25605 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25606 type. This is the default.
25608 @item -mbackchain
25609 @itemx -mno-backchain
25610 @opindex mbackchain
25611 @opindex mno-backchain
25612 Store (do not store) the address of the caller's frame as backchain pointer
25613 into the callee's stack frame.
25614 A backchain may be needed to allow debugging using tools that do not understand
25615 DWARF call frame information.
25616 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25617 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25618 the backchain is placed into the topmost word of the 96/160 byte register
25619 save area.
25621 In general, code compiled with @option{-mbackchain} is call-compatible with
25622 code compiled with @option{-mmo-backchain}; however, use of the backchain
25623 for debugging purposes usually requires that the whole binary is built with
25624 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
25625 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
25626 to build a linux kernel use @option{-msoft-float}.
25628 The default is to not maintain the backchain.
25630 @item -mpacked-stack
25631 @itemx -mno-packed-stack
25632 @opindex mpacked-stack
25633 @opindex mno-packed-stack
25634 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
25635 specified, the compiler uses the all fields of the 96/160 byte register save
25636 area only for their default purpose; unused fields still take up stack space.
25637 When @option{-mpacked-stack} is specified, register save slots are densely
25638 packed at the top of the register save area; unused space is reused for other
25639 purposes, allowing for more efficient use of the available stack space.
25640 However, when @option{-mbackchain} is also in effect, the topmost word of
25641 the save area is always used to store the backchain, and the return address
25642 register is always saved two words below the backchain.
25644 As long as the stack frame backchain is not used, code generated with
25645 @option{-mpacked-stack} is call-compatible with code generated with
25646 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
25647 S/390 or zSeries generated code that uses the stack frame backchain at run
25648 time, not just for debugging purposes.  Such code is not call-compatible
25649 with code compiled with @option{-mpacked-stack}.  Also, note that the
25650 combination of @option{-mbackchain},
25651 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
25652 to build a linux kernel use @option{-msoft-float}.
25654 The default is to not use the packed stack layout.
25656 @item -msmall-exec
25657 @itemx -mno-small-exec
25658 @opindex msmall-exec
25659 @opindex mno-small-exec
25660 Generate (or do not generate) code using the @code{bras} instruction
25661 to do subroutine calls.
25662 This only works reliably if the total executable size does not
25663 exceed 64k.  The default is to use the @code{basr} instruction instead,
25664 which does not have this limitation.
25666 @item -m64
25667 @itemx -m31
25668 @opindex m64
25669 @opindex m31
25670 When @option{-m31} is specified, generate code compliant to the
25671 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
25672 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
25673 particular to generate 64-bit instructions.  For the @samp{s390}
25674 targets, the default is @option{-m31}, while the @samp{s390x}
25675 targets default to @option{-m64}.
25677 @item -mzarch
25678 @itemx -mesa
25679 @opindex mzarch
25680 @opindex mesa
25681 When @option{-mzarch} is specified, generate code using the
25682 instructions available on z/Architecture.
25683 When @option{-mesa} is specified, generate code using the
25684 instructions available on ESA/390.  Note that @option{-mesa} is
25685 not possible with @option{-m64}.
25686 When generating code compliant to the GNU/Linux for S/390 ABI,
25687 the default is @option{-mesa}.  When generating code compliant
25688 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25690 @item -mhtm
25691 @itemx -mno-htm
25692 @opindex mhtm
25693 @opindex mno-htm
25694 The @option{-mhtm} option enables a set of builtins making use of
25695 instructions available with the transactional execution facility
25696 introduced with the IBM zEnterprise EC12 machine generation
25697 @ref{S/390 System z Built-in Functions}.
25698 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25700 @item -mvx
25701 @itemx -mno-vx
25702 @opindex mvx
25703 @opindex mno-vx
25704 When @option{-mvx} is specified, generate code using the instructions
25705 available with the vector extension facility introduced with the IBM
25706 z13 machine generation.
25707 This option changes the ABI for some vector type values with regard to
25708 alignment and calling conventions.  In case vector type values are
25709 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25710 command will be added to mark the resulting binary with the ABI used.
25711 @option{-mvx} is enabled by default when using @option{-march=z13}.
25713 @item -mzvector
25714 @itemx -mno-zvector
25715 @opindex mzvector
25716 @opindex mno-zvector
25717 The @option{-mzvector} option enables vector language extensions and
25718 builtins using instructions available with the vector extension
25719 facility introduced with the IBM z13 machine generation.
25720 This option adds support for @samp{vector} to be used as a keyword to
25721 define vector type variables and arguments.  @samp{vector} is only
25722 available when GNU extensions are enabled.  It will not be expanded
25723 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25724 In addition to the GCC low-level builtins @option{-mzvector} enables
25725 a set of builtins added for compatibility with AltiVec-style
25726 implementations like Power and Cell.  In order to make use of these
25727 builtins the header file @file{vecintrin.h} needs to be included.
25728 @option{-mzvector} is disabled by default.
25730 @item -mmvcle
25731 @itemx -mno-mvcle
25732 @opindex mmvcle
25733 @opindex mno-mvcle
25734 Generate (or do not generate) code using the @code{mvcle} instruction
25735 to perform block moves.  When @option{-mno-mvcle} is specified,
25736 use a @code{mvc} loop instead.  This is the default unless optimizing for
25737 size.
25739 @item -mdebug
25740 @itemx -mno-debug
25741 @opindex mdebug
25742 @opindex mno-debug
25743 Print (or do not print) additional debug information when compiling.
25744 The default is to not print debug information.
25746 @item -march=@var{cpu-type}
25747 @opindex march
25748 Generate code that runs on @var{cpu-type}, which is the name of a
25749 system representing a certain processor type.  Possible values for
25750 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25751 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25752 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25753 @samp{z14}/@samp{arch12}, and @samp{native}.
25755 The default is @option{-march=z900}.
25757 Specifying @samp{native} as cpu type can be used to select the best
25758 architecture option for the host processor.
25759 @option{-march=native} has no effect if GCC does not recognize the
25760 processor.
25762 @item -mtune=@var{cpu-type}
25763 @opindex mtune
25764 Tune to @var{cpu-type} everything applicable about the generated code,
25765 except for the ABI and the set of available instructions.
25766 The list of @var{cpu-type} values is the same as for @option{-march}.
25767 The default is the value used for @option{-march}.
25769 @item -mtpf-trace
25770 @itemx -mno-tpf-trace
25771 @opindex mtpf-trace
25772 @opindex mno-tpf-trace
25773 Generate code that adds (does not add) in TPF OS specific branches to trace
25774 routines in the operating system.  This option is off by default, even
25775 when compiling for the TPF OS@.
25777 @item -mfused-madd
25778 @itemx -mno-fused-madd
25779 @opindex mfused-madd
25780 @opindex mno-fused-madd
25781 Generate code that uses (does not use) the floating-point multiply and
25782 accumulate instructions.  These instructions are generated by default if
25783 hardware floating point is used.
25785 @item -mwarn-framesize=@var{framesize}
25786 @opindex mwarn-framesize
25787 Emit a warning if the current function exceeds the given frame size.  Because
25788 this is a compile-time check it doesn't need to be a real problem when the program
25789 runs.  It is intended to identify functions that most probably cause
25790 a stack overflow.  It is useful to be used in an environment with limited stack
25791 size e.g.@: the linux kernel.
25793 @item -mwarn-dynamicstack
25794 @opindex mwarn-dynamicstack
25795 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25796 arrays.  This is generally a bad idea with a limited stack size.
25798 @item -mstack-guard=@var{stack-guard}
25799 @itemx -mstack-size=@var{stack-size}
25800 @opindex mstack-guard
25801 @opindex mstack-size
25802 If these options are provided the S/390 back end emits additional instructions in
25803 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25804 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25805 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25806 the frame size of the compiled function is chosen.
25807 These options are intended to be used to help debugging stack overflow problems.
25808 The additionally emitted code causes only little overhead and hence can also be
25809 used in production-like systems without greater performance degradation.  The given
25810 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25811 @var{stack-guard} without exceeding 64k.
25812 In order to be efficient the extra code makes the assumption that the stack starts
25813 at an address aligned to the value given by @var{stack-size}.
25814 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25816 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25817 @opindex mhotpatch
25818 If the hotpatch option is enabled, a ``hot-patching'' function
25819 prologue is generated for all functions in the compilation unit.
25820 The funtion label is prepended with the given number of two-byte
25821 NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
25822 the label, 2 * @var{post-halfwords} bytes are appended, using the
25823 largest NOP like instructions the architecture allows (maximum
25824 1000000).
25826 If both arguments are zero, hotpatching is disabled.
25828 This option can be overridden for individual functions with the
25829 @code{hotpatch} attribute.
25830 @end table
25832 @node Score Options
25833 @subsection Score Options
25834 @cindex Score Options
25836 These options are defined for Score implementations:
25838 @table @gcctabopt
25839 @item -meb
25840 @opindex meb
25841 Compile code for big-endian mode.  This is the default.
25843 @item -mel
25844 @opindex mel
25845 Compile code for little-endian mode.
25847 @item -mnhwloop
25848 @opindex mnhwloop
25849 Disable generation of @code{bcnz} instructions.
25851 @item -muls
25852 @opindex muls
25853 Enable generation of unaligned load and store instructions.
25855 @item -mmac
25856 @opindex mmac
25857 Enable the use of multiply-accumulate instructions. Disabled by default.
25859 @item -mscore5
25860 @opindex mscore5
25861 Specify the SCORE5 as the target architecture.
25863 @item -mscore5u
25864 @opindex mscore5u
25865 Specify the SCORE5U of the target architecture.
25867 @item -mscore7
25868 @opindex mscore7
25869 Specify the SCORE7 as the target architecture. This is the default.
25871 @item -mscore7d
25872 @opindex mscore7d
25873 Specify the SCORE7D as the target architecture.
25874 @end table
25876 @node SH Options
25877 @subsection SH Options
25879 These @samp{-m} options are defined for the SH implementations:
25881 @table @gcctabopt
25882 @item -m1
25883 @opindex m1
25884 Generate code for the SH1.
25886 @item -m2
25887 @opindex m2
25888 Generate code for the SH2.
25890 @item -m2e
25891 Generate code for the SH2e.
25893 @item -m2a-nofpu
25894 @opindex m2a-nofpu
25895 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25896 that the floating-point unit is not used.
25898 @item -m2a-single-only
25899 @opindex m2a-single-only
25900 Generate code for the SH2a-FPU, in such a way that no double-precision
25901 floating-point operations are used.
25903 @item -m2a-single
25904 @opindex m2a-single
25905 Generate code for the SH2a-FPU assuming the floating-point unit is in
25906 single-precision mode by default.
25908 @item -m2a
25909 @opindex m2a
25910 Generate code for the SH2a-FPU assuming the floating-point unit is in
25911 double-precision mode by default.
25913 @item -m3
25914 @opindex m3
25915 Generate code for the SH3.
25917 @item -m3e
25918 @opindex m3e
25919 Generate code for the SH3e.
25921 @item -m4-nofpu
25922 @opindex m4-nofpu
25923 Generate code for the SH4 without a floating-point unit.
25925 @item -m4-single-only
25926 @opindex m4-single-only
25927 Generate code for the SH4 with a floating-point unit that only
25928 supports single-precision arithmetic.
25930 @item -m4-single
25931 @opindex m4-single
25932 Generate code for the SH4 assuming the floating-point unit is in
25933 single-precision mode by default.
25935 @item -m4
25936 @opindex m4
25937 Generate code for the SH4.
25939 @item -m4-100
25940 @opindex m4-100
25941 Generate code for SH4-100.
25943 @item -m4-100-nofpu
25944 @opindex m4-100-nofpu
25945 Generate code for SH4-100 in such a way that the
25946 floating-point unit is not used.
25948 @item -m4-100-single
25949 @opindex m4-100-single
25950 Generate code for SH4-100 assuming the floating-point unit is in
25951 single-precision mode by default.
25953 @item -m4-100-single-only
25954 @opindex m4-100-single-only
25955 Generate code for SH4-100 in such a way that no double-precision
25956 floating-point operations are used.
25958 @item -m4-200
25959 @opindex m4-200
25960 Generate code for SH4-200.
25962 @item -m4-200-nofpu
25963 @opindex m4-200-nofpu
25964 Generate code for SH4-200 without in such a way that the
25965 floating-point unit is not used.
25967 @item -m4-200-single
25968 @opindex m4-200-single
25969 Generate code for SH4-200 assuming the floating-point unit is in
25970 single-precision mode by default.
25972 @item -m4-200-single-only
25973 @opindex m4-200-single-only
25974 Generate code for SH4-200 in such a way that no double-precision
25975 floating-point operations are used.
25977 @item -m4-300
25978 @opindex m4-300
25979 Generate code for SH4-300.
25981 @item -m4-300-nofpu
25982 @opindex m4-300-nofpu
25983 Generate code for SH4-300 without in such a way that the
25984 floating-point unit is not used.
25986 @item -m4-300-single
25987 @opindex m4-300-single
25988 Generate code for SH4-300 in such a way that no double-precision
25989 floating-point operations are used.
25991 @item -m4-300-single-only
25992 @opindex m4-300-single-only
25993 Generate code for SH4-300 in such a way that no double-precision
25994 floating-point operations are used.
25996 @item -m4-340
25997 @opindex m4-340
25998 Generate code for SH4-340 (no MMU, no FPU).
26000 @item -m4-500
26001 @opindex m4-500
26002 Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
26003 assembler.
26005 @item -m4a-nofpu
26006 @opindex m4a-nofpu
26007 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
26008 floating-point unit is not used.
26010 @item -m4a-single-only
26011 @opindex m4a-single-only
26012 Generate code for the SH4a, in such a way that no double-precision
26013 floating-point operations are used.
26015 @item -m4a-single
26016 @opindex m4a-single
26017 Generate code for the SH4a assuming the floating-point unit is in
26018 single-precision mode by default.
26020 @item -m4a
26021 @opindex m4a
26022 Generate code for the SH4a.
26024 @item -m4al
26025 @opindex m4al
26026 Same as @option{-m4a-nofpu}, except that it implicitly passes
26027 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
26028 instructions at the moment.
26030 @item -mb
26031 @opindex mb
26032 Compile code for the processor in big-endian mode.
26034 @item -ml
26035 @opindex ml
26036 Compile code for the processor in little-endian mode.
26038 @item -mdalign
26039 @opindex mdalign
26040 Align doubles at 64-bit boundaries.  Note that this changes the calling
26041 conventions, and thus some functions from the standard C library do
26042 not work unless you recompile it first with @option{-mdalign}.
26044 @item -mrelax
26045 @opindex mrelax
26046 Shorten some address references at link time, when possible; uses the
26047 linker option @option{-relax}.
26049 @item -mbigtable
26050 @opindex mbigtable
26051 Use 32-bit offsets in @code{switch} tables.  The default is to use
26052 16-bit offsets.
26054 @item -mbitops
26055 @opindex mbitops
26056 Enable the use of bit manipulation instructions on SH2A.
26058 @item -mfmovd
26059 @opindex mfmovd
26060 Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
26061 alignment constraints.
26063 @item -mrenesas
26064 @opindex mrenesas
26065 Comply with the calling conventions defined by Renesas.
26067 @item -mno-renesas
26068 @opindex mno-renesas
26069 Comply with the calling conventions defined for GCC before the Renesas
26070 conventions were available.  This option is the default for all
26071 targets of the SH toolchain.
26073 @item -mnomacsave
26074 @opindex mnomacsave
26075 Mark the @code{MAC} register as call-clobbered, even if
26076 @option{-mrenesas} is given.
26078 @item -mieee
26079 @itemx -mno-ieee
26080 @opindex mieee
26081 @opindex mno-ieee
26082 Control the IEEE compliance of floating-point comparisons, which affects the
26083 handling of cases where the result of a comparison is unordered.  By default
26084 @option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
26085 enabled @option{-mno-ieee} is implicitly set, which results in faster
26086 floating-point greater-equal and less-equal comparisons.  The implicit settings
26087 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
26089 @item -minline-ic_invalidate
26090 @opindex minline-ic_invalidate
26091 Inline code to invalidate instruction cache entries after setting up
26092 nested function trampolines.
26093 This option has no effect if @option{-musermode} is in effect and the selected
26094 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26095 instruction.
26096 If the selected code generation option does not allow the use of the @code{icbi}
26097 instruction, and @option{-musermode} is not in effect, the inlined code
26098 manipulates the instruction cache address array directly with an associative
26099 write.  This not only requires privileged mode at run time, but it also
26100 fails if the cache line had been mapped via the TLB and has become unmapped.
26102 @item -misize
26103 @opindex misize
26104 Dump instruction size and location in the assembly code.
26106 @item -mpadstruct
26107 @opindex mpadstruct
26108 This option is deprecated.  It pads structures to multiple of 4 bytes,
26109 which is incompatible with the SH ABI@.
26111 @item -matomic-model=@var{model}
26112 @opindex matomic-model=@var{model}
26113 Sets the model of atomic operations and additional parameters as a comma
26114 separated list.  For details on the atomic built-in functions see
26115 @ref{__atomic Builtins}.  The following models and parameters are supported:
26117 @table @samp
26119 @item none
26120 Disable compiler generated atomic sequences and emit library calls for atomic
26121 operations.  This is the default if the target is not @code{sh*-*-linux*}.
26123 @item soft-gusa
26124 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26125 built-in functions.  The generated atomic sequences require additional support
26126 from the interrupt/exception handling code of the system and are only suitable
26127 for SH3* and SH4* single-core systems.  This option is enabled by default when
26128 the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
26129 this option also partially utilizes the hardware atomic instructions
26130 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26131 @samp{strict} is specified.  
26133 @item soft-tcb
26134 Generate software atomic sequences that use a variable in the thread control
26135 block.  This is a variation of the gUSA sequences which can also be used on
26136 SH1* and SH2* targets.  The generated atomic sequences require additional
26137 support from the interrupt/exception handling code of the system and are only
26138 suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
26139 parameter has to be specified as well.
26141 @item soft-imask
26142 Generate software atomic sequences that temporarily disable interrupts by
26143 setting @code{SR.IMASK = 1111}.  This model works only when the program runs
26144 in privileged mode and is only suitable for single-core systems.  Additional
26145 support from the interrupt/exception handling code of the system is not
26146 required.  This model is enabled by default when the target is
26147 @code{sh*-*-linux*} and SH1* or SH2*.
26149 @item hard-llcs
26150 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26151 instructions only.  This is only available on SH4A and is suitable for
26152 multi-core systems.  Since the hardware instructions support only 32 bit atomic
26153 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26154 Code compiled with this option is also compatible with other software
26155 atomic model interrupt/exception handling systems if executed on an SH4A
26156 system.  Additional support from the interrupt/exception handling code of the
26157 system is not required for this model.
26159 @item gbr-offset=
26160 This parameter specifies the offset in bytes of the variable in the thread
26161 control block structure that should be used by the generated atomic sequences
26162 when the @samp{soft-tcb} model has been selected.  For other models this
26163 parameter is ignored.  The specified value must be an integer multiple of four
26164 and in the range 0-1020.
26166 @item strict
26167 This parameter prevents mixed usage of multiple atomic models, even if they
26168 are compatible, and makes the compiler generate atomic sequences of the
26169 specified model only.
26171 @end table
26173 @item -mtas
26174 @opindex mtas
26175 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26176 Notice that depending on the particular hardware and software configuration
26177 this can degrade overall performance due to the operand cache line flushes
26178 that are implied by the @code{tas.b} instruction.  On multi-core SH4A
26179 processors the @code{tas.b} instruction must be used with caution since it
26180 can result in data corruption for certain cache configurations.
26182 @item -mprefergot
26183 @opindex mprefergot
26184 When generating position-independent code, emit function calls using
26185 the Global Offset Table instead of the Procedure Linkage Table.
26187 @item -musermode
26188 @itemx -mno-usermode
26189 @opindex musermode
26190 @opindex mno-usermode
26191 Don't allow (allow) the compiler generating privileged mode code.  Specifying
26192 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26193 inlined code would not work in user mode.  @option{-musermode} is the default
26194 when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
26195 @option{-musermode} has no effect, since there is no user mode.
26197 @item -multcost=@var{number}
26198 @opindex multcost=@var{number}
26199 Set the cost to assume for a multiply insn.
26201 @item -mdiv=@var{strategy}
26202 @opindex mdiv=@var{strategy}
26203 Set the division strategy to be used for integer division operations.
26204 @var{strategy} can be one of: 
26206 @table @samp
26208 @item call-div1
26209 Calls a library function that uses the single-step division instruction
26210 @code{div1} to perform the operation.  Division by zero calculates an
26211 unspecified result and does not trap.  This is the default except for SH4,
26212 SH2A and SHcompact.
26214 @item call-fp
26215 Calls a library function that performs the operation in double precision
26216 floating point.  Division by zero causes a floating-point exception.  This is
26217 the default for SHcompact with FPU.  Specifying this for targets that do not
26218 have a double precision FPU defaults to @code{call-div1}.
26220 @item call-table
26221 Calls a library function that uses a lookup table for small divisors and
26222 the @code{div1} instruction with case distinction for larger divisors.  Division
26223 by zero calculates an unspecified result and does not trap.  This is the default
26224 for SH4.  Specifying this for targets that do not have dynamic shift
26225 instructions defaults to @code{call-div1}.
26227 @end table
26229 When a division strategy has not been specified the default strategy is
26230 selected based on the current target.  For SH2A the default strategy is to
26231 use the @code{divs} and @code{divu} instructions instead of library function
26232 calls.
26234 @item -maccumulate-outgoing-args
26235 @opindex maccumulate-outgoing-args
26236 Reserve space once for outgoing arguments in the function prologue rather
26237 than around each call.  Generally beneficial for performance and size.  Also
26238 needed for unwinding to avoid changing the stack frame around conditional code.
26240 @item -mdivsi3_libfunc=@var{name}
26241 @opindex mdivsi3_libfunc=@var{name}
26242 Set the name of the library function used for 32-bit signed division to
26243 @var{name}.
26244 This only affects the name used in the @samp{call} division strategies, and
26245 the compiler still expects the same sets of input/output/clobbered registers as
26246 if this option were not present.
26248 @item -mfixed-range=@var{register-range}
26249 @opindex mfixed-range
26250 Generate code treating the given register range as fixed registers.
26251 A fixed register is one that the register allocator cannot use.  This is
26252 useful when compiling kernel code.  A register range is specified as
26253 two registers separated by a dash.  Multiple register ranges can be
26254 specified separated by a comma.
26256 @item -mbranch-cost=@var{num}
26257 @opindex mbranch-cost=@var{num}
26258 Assume @var{num} to be the cost for a branch instruction.  Higher numbers
26259 make the compiler try to generate more branch-free code if possible.  
26260 If not specified the value is selected depending on the processor type that
26261 is being compiled for.
26263 @item -mzdcbranch
26264 @itemx -mno-zdcbranch
26265 @opindex mzdcbranch
26266 @opindex mno-zdcbranch
26267 Assume (do not assume) that zero displacement conditional branch instructions
26268 @code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
26269 compiler prefers zero displacement branch code sequences.  This is
26270 enabled by default when generating code for SH4 and SH4A.  It can be explicitly
26271 disabled by specifying @option{-mno-zdcbranch}.
26273 @item -mcbranch-force-delay-slot
26274 @opindex mcbranch-force-delay-slot
26275 Force the usage of delay slots for conditional branches, which stuffs the delay
26276 slot with a @code{nop} if a suitable instruction cannot be found.  By default
26277 this option is disabled.  It can be enabled to work around hardware bugs as
26278 found in the original SH7055.
26280 @item -mfused-madd
26281 @itemx -mno-fused-madd
26282 @opindex mfused-madd
26283 @opindex mno-fused-madd
26284 Generate code that uses (does not use) the floating-point multiply and
26285 accumulate instructions.  These instructions are generated by default
26286 if hardware floating point is used.  The machine-dependent
26287 @option{-mfused-madd} option is now mapped to the machine-independent
26288 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26289 mapped to @option{-ffp-contract=off}.
26291 @item -mfsca
26292 @itemx -mno-fsca
26293 @opindex mfsca
26294 @opindex mno-fsca
26295 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26296 and cosine approximations.  The option @option{-mfsca} must be used in
26297 combination with @option{-funsafe-math-optimizations}.  It is enabled by default
26298 when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
26299 approximations even if @option{-funsafe-math-optimizations} is in effect.
26301 @item -mfsrra
26302 @itemx -mno-fsrra
26303 @opindex mfsrra
26304 @opindex mno-fsrra
26305 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26306 reciprocal square root approximations.  The option @option{-mfsrra} must be used
26307 in combination with @option{-funsafe-math-optimizations} and
26308 @option{-ffinite-math-only}.  It is enabled by default when generating code for
26309 SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
26310 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26311 in effect.
26313 @item -mpretend-cmove
26314 @opindex mpretend-cmove
26315 Prefer zero-displacement conditional branches for conditional move instruction
26316 patterns.  This can result in faster code on the SH4 processor.
26318 @item -mfdpic
26319 @opindex fdpic
26320 Generate code using the FDPIC ABI.
26322 @end table
26324 @node Solaris 2 Options
26325 @subsection Solaris 2 Options
26326 @cindex Solaris 2 options
26328 These @samp{-m} options are supported on Solaris 2:
26330 @table @gcctabopt
26331 @item -mclear-hwcap
26332 @opindex mclear-hwcap
26333 @option{-mclear-hwcap} tells the compiler to remove the hardware
26334 capabilities generated by the Solaris assembler.  This is only necessary
26335 when object files use ISA extensions not supported by the current
26336 machine, but check at runtime whether or not to use them.
26338 @item -mimpure-text
26339 @opindex mimpure-text
26340 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26341 the compiler to not pass @option{-z text} to the linker when linking a
26342 shared object.  Using this option, you can link position-dependent
26343 code into a shared object.
26345 @option{-mimpure-text} suppresses the ``relocations remain against
26346 allocatable but non-writable sections'' linker error message.
26347 However, the necessary relocations trigger copy-on-write, and the
26348 shared object is not actually shared across processes.  Instead of
26349 using @option{-mimpure-text}, you should compile all source code with
26350 @option{-fpic} or @option{-fPIC}.
26352 @end table
26354 These switches are supported in addition to the above on Solaris 2:
26356 @table @gcctabopt
26357 @item -pthreads
26358 @opindex pthreads
26359 This is a synonym for @option{-pthread}.
26360 @end table
26362 @node SPARC Options
26363 @subsection SPARC Options
26364 @cindex SPARC options
26366 These @samp{-m} options are supported on the SPARC:
26368 @table @gcctabopt
26369 @item -mno-app-regs
26370 @itemx -mapp-regs
26371 @opindex mno-app-regs
26372 @opindex mapp-regs
26373 Specify @option{-mapp-regs} to generate output using the global registers
26374 2 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
26375 global register 1, each global register 2 through 4 is then treated as an
26376 allocable register that is clobbered by function calls.  This is the default.
26378 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26379 specify @option{-mno-app-regs}.  You should compile libraries and system
26380 software with this option.
26382 @item -mflat
26383 @itemx -mno-flat
26384 @opindex mflat
26385 @opindex mno-flat
26386 With @option{-mflat}, the compiler does not generate save/restore instructions
26387 and uses a ``flat'' or single register window model.  This model is compatible
26388 with the regular register window model.  The local registers and the input
26389 registers (0--5) are still treated as ``call-saved'' registers and are
26390 saved on the stack as needed.
26392 With @option{-mno-flat} (the default), the compiler generates save/restore
26393 instructions (except for leaf functions).  This is the normal operating mode.
26395 @item -mfpu
26396 @itemx -mhard-float
26397 @opindex mfpu
26398 @opindex mhard-float
26399 Generate output containing floating-point instructions.  This is the
26400 default.
26402 @item -mno-fpu
26403 @itemx -msoft-float
26404 @opindex mno-fpu
26405 @opindex msoft-float
26406 Generate output containing library calls for floating point.
26407 @strong{Warning:} the requisite libraries are not available for all SPARC
26408 targets.  Normally the facilities of the machine's usual C compiler are
26409 used, but this cannot be done directly in cross-compilation.  You must make
26410 your own arrangements to provide suitable library functions for
26411 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
26412 @samp{sparclite-*-*} do provide software floating-point support.
26414 @option{-msoft-float} changes the calling convention in the output file;
26415 therefore, it is only useful if you compile @emph{all} of a program with
26416 this option.  In particular, you need to compile @file{libgcc.a}, the
26417 library that comes with GCC, with @option{-msoft-float} in order for
26418 this to work.
26420 @item -mhard-quad-float
26421 @opindex mhard-quad-float
26422 Generate output containing quad-word (long double) floating-point
26423 instructions.
26425 @item -msoft-quad-float
26426 @opindex msoft-quad-float
26427 Generate output containing library calls for quad-word (long double)
26428 floating-point instructions.  The functions called are those specified
26429 in the SPARC ABI@.  This is the default.
26431 As of this writing, there are no SPARC implementations that have hardware
26432 support for the quad-word floating-point instructions.  They all invoke
26433 a trap handler for one of these instructions, and then the trap handler
26434 emulates the effect of the instruction.  Because of the trap handler overhead,
26435 this is much slower than calling the ABI library routines.  Thus the
26436 @option{-msoft-quad-float} option is the default.
26438 @item -mno-unaligned-doubles
26439 @itemx -munaligned-doubles
26440 @opindex mno-unaligned-doubles
26441 @opindex munaligned-doubles
26442 Assume that doubles have 8-byte alignment.  This is the default.
26444 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26445 alignment only if they are contained in another type, or if they have an
26446 absolute address.  Otherwise, it assumes they have 4-byte alignment.
26447 Specifying this option avoids some rare compatibility problems with code
26448 generated by other compilers.  It is not the default because it results
26449 in a performance loss, especially for floating-point code.
26451 @item -muser-mode
26452 @itemx -mno-user-mode
26453 @opindex muser-mode
26454 @opindex mno-user-mode
26455 Do not generate code that can only run in supervisor mode.  This is relevant
26456 only for the @code{casa} instruction emitted for the LEON3 processor.  This
26457 is the default.
26459 @item -mfaster-structs
26460 @itemx -mno-faster-structs
26461 @opindex mfaster-structs
26462 @opindex mno-faster-structs
26463 With @option{-mfaster-structs}, the compiler assumes that structures
26464 should have 8-byte alignment.  This enables the use of pairs of
26465 @code{ldd} and @code{std} instructions for copies in structure
26466 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26467 However, the use of this changed alignment directly violates the SPARC
26468 ABI@.  Thus, it's intended only for use on targets where the developer
26469 acknowledges that their resulting code is not directly in line with
26470 the rules of the ABI@.
26472 @item -mstd-struct-return
26473 @itemx -mno-std-struct-return
26474 @opindex mstd-struct-return
26475 @opindex mno-std-struct-return
26476 With @option{-mstd-struct-return}, the compiler generates checking code
26477 in functions returning structures or unions to detect size mismatches
26478 between the two sides of function calls, as per the 32-bit ABI@.
26480 The default is @option{-mno-std-struct-return}.  This option has no effect
26481 in 64-bit mode.
26483 @item -mlra
26484 @itemx -mno-lra
26485 @opindex mlra
26486 @opindex mno-lra
26487 Enable Local Register Allocation.  This is the default for SPARC since GCC 7
26488 so @option{-mno-lra} needs to be passed to get old Reload.
26490 @item -mcpu=@var{cpu_type}
26491 @opindex mcpu
26492 Set the instruction set, register set, and instruction scheduling parameters
26493 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
26494 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26495 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26496 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26497 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26498 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26500 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26501 which selects the best architecture option for the host processor.
26502 @option{-mcpu=native} has no effect if GCC does not recognize
26503 the processor.
26505 Default instruction scheduling parameters are used for values that select
26506 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
26507 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26509 Here is a list of each supported architecture and their supported
26510 implementations.
26512 @table @asis
26513 @item v7
26514 cypress, leon3v7
26516 @item v8
26517 supersparc, hypersparc, leon, leon3
26519 @item sparclite
26520 f930, f934, sparclite86x
26522 @item sparclet
26523 tsc701
26525 @item v9
26526 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26527 niagara7, m8
26528 @end table
26530 By default (unless configured otherwise), GCC generates code for the V7
26531 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
26532 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26533 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
26534 SPARCStation 1, 2, IPX etc.
26536 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26537 architecture.  The only difference from V7 code is that the compiler emits
26538 the integer multiply and integer divide instructions which exist in SPARC-V8
26539 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
26540 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26541 2000 series.
26543 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26544 the SPARC architecture.  This adds the integer multiply, integer divide step
26545 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26546 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26547 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
26548 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26549 MB86934 chip, which is the more recent SPARClite with FPU@.
26551 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26552 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
26553 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26554 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
26555 optimizes it for the TEMIC SPARClet chip.
26557 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26558 architecture.  This adds 64-bit integer and floating-point move instructions,
26559 3 additional floating-point condition code registers and conditional move
26560 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
26561 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
26562 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26563 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
26564 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26565 Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
26566 additionally optimizes it for Sun UltraSPARC T2 chips. With
26567 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26568 UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
26569 additionally optimizes it for Sun UltraSPARC T4 chips.  With
26570 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26571 Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
26572 additionally optimizes it for Oracle M8 chips.
26574 @item -mtune=@var{cpu_type}
26575 @opindex mtune
26576 Set the instruction scheduling parameters for machine type
26577 @var{cpu_type}, but do not set the instruction set or register set that the
26578 option @option{-mcpu=@var{cpu_type}} does.
26580 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26581 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26582 that select a particular CPU implementation.  Those are
26583 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26584 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26585 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26586 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26587 @samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
26588 and GNU/Linux toolchains, @samp{native} can also be used.
26590 @item -mv8plus
26591 @itemx -mno-v8plus
26592 @opindex mv8plus
26593 @opindex mno-v8plus
26594 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
26595 difference from the V8 ABI is that the global and out registers are
26596 considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
26597 mode for all SPARC-V9 processors.
26599 @item -mvis
26600 @itemx -mno-vis
26601 @opindex mvis
26602 @opindex mno-vis
26603 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26604 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
26606 @item -mvis2
26607 @itemx -mno-vis2
26608 @opindex mvis2
26609 @opindex mno-vis2
26610 With @option{-mvis2}, GCC generates code that takes advantage of
26611 version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
26612 default is @option{-mvis2} when targeting a cpu that supports such
26613 instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
26614 also sets @option{-mvis}.
26616 @item -mvis3
26617 @itemx -mno-vis3
26618 @opindex mvis3
26619 @opindex mno-vis3
26620 With @option{-mvis3}, GCC generates code that takes advantage of
26621 version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
26622 default is @option{-mvis3} when targeting a cpu that supports such
26623 instructions, such as niagara-3 and later.  Setting @option{-mvis3}
26624 also sets @option{-mvis2} and @option{-mvis}.
26626 @item -mvis4
26627 @itemx -mno-vis4
26628 @opindex mvis4
26629 @opindex mno-vis4
26630 With @option{-mvis4}, GCC generates code that takes advantage of
26631 version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
26632 default is @option{-mvis4} when targeting a cpu that supports such
26633 instructions, such as niagara-7 and later.  Setting @option{-mvis4}
26634 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26636 @item -mvis4b
26637 @itemx -mno-vis4b
26638 @opindex mvis4b
26639 @opindex mno-vis4b
26640 With @option{-mvis4b}, GCC generates code that takes advantage of
26641 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26642 the additional VIS instructions introduced in the Oracle SPARC
26643 Architecture 2017.  The default is @option{-mvis4b} when targeting a
26644 cpu that supports such instructions, such as m8 and later.  Setting
26645 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26646 @option{-mvis2} and @option{-mvis}.
26648 @item -mcbcond
26649 @itemx -mno-cbcond
26650 @opindex mcbcond
26651 @opindex mno-cbcond
26652 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26653 Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
26654 when targeting a CPU that supports such instructions, such as Niagara-4 and
26655 later.
26657 @item -mfmaf
26658 @itemx -mno-fmaf
26659 @opindex mfmaf
26660 @opindex mno-fmaf
26661 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26662 Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
26663 when targeting a CPU that supports such instructions, such as Niagara-3 and
26664 later.
26666 @item -mfsmuld
26667 @itemx -mno-fsmuld
26668 @opindex mfsmuld
26669 @opindex mno-fsmuld
26670 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26671 Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
26672 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26673 or V9 with FPU except @option{-mcpu=leon}.
26675 @item -mpopc
26676 @itemx -mno-popc
26677 @opindex mpopc
26678 @opindex mno-popc
26679 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26680 Population Count instruction.  The default is @option{-mpopc}
26681 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26682 later.
26684 @item -msubxc
26685 @itemx -mno-subxc
26686 @opindex msubxc
26687 @opindex mno-subxc
26688 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26689 Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
26690 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26691 later.
26693 @item -mfix-at697f
26694 @opindex mfix-at697f
26695 Enable the documented workaround for the single erratum of the Atmel AT697F
26696 processor (which corresponds to erratum #13 of the AT697E processor).
26698 @item -mfix-ut699
26699 @opindex mfix-ut699
26700 Enable the documented workarounds for the floating-point errata and the data
26701 cache nullify errata of the UT699 processor.
26703 @item -mfix-ut700
26704 @opindex mfix-ut700
26705 Enable the documented workaround for the back-to-back store errata of
26706 the UT699E/UT700 processor.
26708 @item -mfix-gr712rc
26709 @opindex mfix-gr712rc
26710 Enable the documented workaround for the back-to-back store errata of
26711 the GR712RC processor.
26712 @end table
26714 These @samp{-m} options are supported in addition to the above
26715 on SPARC-V9 processors in 64-bit environments:
26717 @table @gcctabopt
26718 @item -m32
26719 @itemx -m64
26720 @opindex m32
26721 @opindex m64
26722 Generate code for a 32-bit or 64-bit environment.
26723 The 32-bit environment sets int, long and pointer to 32 bits.
26724 The 64-bit environment sets int to 32 bits and long and pointer
26725 to 64 bits.
26727 @item -mcmodel=@var{which}
26728 @opindex mcmodel
26729 Set the code model to one of
26731 @table @samp
26732 @item medlow
26733 The Medium/Low code model: 64-bit addresses, programs
26734 must be linked in the low 32 bits of memory.  Programs can be statically
26735 or dynamically linked.
26737 @item medmid
26738 The Medium/Middle code model: 64-bit addresses, programs
26739 must be linked in the low 44 bits of memory, the text and data segments must
26740 be less than 2GB in size and the data segment must be located within 2GB of
26741 the text segment.
26743 @item medany
26744 The Medium/Anywhere code model: 64-bit addresses, programs
26745 may be linked anywhere in memory, the text and data segments must be less
26746 than 2GB in size and the data segment must be located within 2GB of the
26747 text segment.
26749 @item embmedany
26750 The Medium/Anywhere code model for embedded systems:
26751 64-bit addresses, the text and data segments must be less than 2GB in
26752 size, both starting anywhere in memory (determined at link time).  The
26753 global register %g4 points to the base of the data segment.  Programs
26754 are statically linked and PIC is not supported.
26755 @end table
26757 @item -mmemory-model=@var{mem-model}
26758 @opindex mmemory-model
26759 Set the memory model in force on the processor to one of
26761 @table @samp
26762 @item default
26763 The default memory model for the processor and operating system.
26765 @item rmo
26766 Relaxed Memory Order
26768 @item pso
26769 Partial Store Order
26771 @item tso
26772 Total Store Order
26774 @item sc
26775 Sequential Consistency
26776 @end table
26778 These memory models are formally defined in Appendix D of the SPARC-V9
26779 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26781 @item -mstack-bias
26782 @itemx -mno-stack-bias
26783 @opindex mstack-bias
26784 @opindex mno-stack-bias
26785 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26786 frame pointer if present, are offset by @minus{}2047 which must be added back
26787 when making stack frame references.  This is the default in 64-bit mode.
26788 Otherwise, assume no such offset is present.
26789 @end table
26791 @node System V Options
26792 @subsection Options for System V
26794 These additional options are available on System V Release 4 for
26795 compatibility with other compilers on those systems:
26797 @table @gcctabopt
26798 @item -G
26799 @opindex G
26800 Create a shared object.
26801 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26803 @item -Qy
26804 @opindex Qy
26805 Identify the versions of each tool used by the compiler, in a
26806 @code{.ident} assembler directive in the output.
26808 @item -Qn
26809 @opindex Qn
26810 Refrain from adding @code{.ident} directives to the output file (this is
26811 the default).
26813 @item -YP,@var{dirs}
26814 @opindex YP
26815 Search the directories @var{dirs}, and no others, for libraries
26816 specified with @option{-l}.
26818 @item -Ym,@var{dir}
26819 @opindex Ym
26820 Look in the directory @var{dir} to find the M4 preprocessor.
26821 The assembler uses this option.
26822 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26823 @c the generic assembler that comes with Solaris takes just -Ym.
26824 @end table
26826 @node TILE-Gx Options
26827 @subsection TILE-Gx Options
26828 @cindex TILE-Gx options
26830 These @samp{-m} options are supported on the TILE-Gx:
26832 @table @gcctabopt
26833 @item -mcmodel=small
26834 @opindex mcmodel=small
26835 Generate code for the small model.  The distance for direct calls is
26836 limited to 500M in either direction.  PC-relative addresses are 32
26837 bits.  Absolute addresses support the full address range.
26839 @item -mcmodel=large
26840 @opindex mcmodel=large
26841 Generate code for the large model.  There is no limitation on call
26842 distance, pc-relative addresses, or absolute addresses.
26844 @item -mcpu=@var{name}
26845 @opindex mcpu
26846 Selects the type of CPU to be targeted.  Currently the only supported
26847 type is @samp{tilegx}.
26849 @item -m32
26850 @itemx -m64
26851 @opindex m32
26852 @opindex m64
26853 Generate code for a 32-bit or 64-bit environment.  The 32-bit
26854 environment sets int, long, and pointer to 32 bits.  The 64-bit
26855 environment sets int to 32 bits and long and pointer to 64 bits.
26857 @item -mbig-endian
26858 @itemx -mlittle-endian
26859 @opindex mbig-endian
26860 @opindex mlittle-endian
26861 Generate code in big/little endian mode, respectively.
26862 @end table
26864 @node TILEPro Options
26865 @subsection TILEPro Options
26866 @cindex TILEPro options
26868 These @samp{-m} options are supported on the TILEPro:
26870 @table @gcctabopt
26871 @item -mcpu=@var{name}
26872 @opindex mcpu
26873 Selects the type of CPU to be targeted.  Currently the only supported
26874 type is @samp{tilepro}.
26876 @item -m32
26877 @opindex m32
26878 Generate code for a 32-bit environment, which sets int, long, and
26879 pointer to 32 bits.  This is the only supported behavior so the flag
26880 is essentially ignored.
26881 @end table
26883 @node V850 Options
26884 @subsection V850 Options
26885 @cindex V850 Options
26887 These @samp{-m} options are defined for V850 implementations:
26889 @table @gcctabopt
26890 @item -mlong-calls
26891 @itemx -mno-long-calls
26892 @opindex mlong-calls
26893 @opindex mno-long-calls
26894 Treat all calls as being far away (near).  If calls are assumed to be
26895 far away, the compiler always loads the function's address into a
26896 register, and calls indirect through the pointer.
26898 @item -mno-ep
26899 @itemx -mep
26900 @opindex mno-ep
26901 @opindex mep
26902 Do not optimize (do optimize) basic blocks that use the same index
26903 pointer 4 or more times to copy pointer into the @code{ep} register, and
26904 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
26905 option is on by default if you optimize.
26907 @item -mno-prolog-function
26908 @itemx -mprolog-function
26909 @opindex mno-prolog-function
26910 @opindex mprolog-function
26911 Do not use (do use) external functions to save and restore registers
26912 at the prologue and epilogue of a function.  The external functions
26913 are slower, but use less code space if more than one function saves
26914 the same number of registers.  The @option{-mprolog-function} option
26915 is on by default if you optimize.
26917 @item -mspace
26918 @opindex mspace
26919 Try to make the code as small as possible.  At present, this just turns
26920 on the @option{-mep} and @option{-mprolog-function} options.
26922 @item -mtda=@var{n}
26923 @opindex mtda
26924 Put static or global variables whose size is @var{n} bytes or less into
26925 the tiny data area that register @code{ep} points to.  The tiny data
26926 area can hold up to 256 bytes in total (128 bytes for byte references).
26928 @item -msda=@var{n}
26929 @opindex msda
26930 Put static or global variables whose size is @var{n} bytes or less into
26931 the small data area that register @code{gp} points to.  The small data
26932 area can hold up to 64 kilobytes.
26934 @item -mzda=@var{n}
26935 @opindex mzda
26936 Put static or global variables whose size is @var{n} bytes or less into
26937 the first 32 kilobytes of memory.
26939 @item -mv850
26940 @opindex mv850
26941 Specify that the target processor is the V850.
26943 @item -mv850e3v5
26944 @opindex mv850e3v5
26945 Specify that the target processor is the V850E3V5.  The preprocessor
26946 constant @code{__v850e3v5__} is defined if this option is used.
26948 @item -mv850e2v4
26949 @opindex mv850e2v4
26950 Specify that the target processor is the V850E3V5.  This is an alias for
26951 the @option{-mv850e3v5} option.
26953 @item -mv850e2v3
26954 @opindex mv850e2v3
26955 Specify that the target processor is the V850E2V3.  The preprocessor
26956 constant @code{__v850e2v3__} is defined if this option is used.
26958 @item -mv850e2
26959 @opindex mv850e2
26960 Specify that the target processor is the V850E2.  The preprocessor
26961 constant @code{__v850e2__} is defined if this option is used.
26963 @item -mv850e1
26964 @opindex mv850e1
26965 Specify that the target processor is the V850E1.  The preprocessor
26966 constants @code{__v850e1__} and @code{__v850e__} are defined if
26967 this option is used.
26969 @item -mv850es
26970 @opindex mv850es
26971 Specify that the target processor is the V850ES.  This is an alias for
26972 the @option{-mv850e1} option.
26974 @item -mv850e
26975 @opindex mv850e
26976 Specify that the target processor is the V850E@.  The preprocessor
26977 constant @code{__v850e__} is defined if this option is used.
26979 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26980 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26981 are defined then a default target processor is chosen and the
26982 relevant @samp{__v850*__} preprocessor constant is defined.
26984 The preprocessor constants @code{__v850} and @code{__v851__} are always
26985 defined, regardless of which processor variant is the target.
26987 @item -mdisable-callt
26988 @itemx -mno-disable-callt
26989 @opindex mdisable-callt
26990 @opindex mno-disable-callt
26991 This option suppresses generation of the @code{CALLT} instruction for the
26992 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26993 architecture.
26995 This option is enabled by default when the RH850 ABI is
26996 in use (see @option{-mrh850-abi}), and disabled by default when the
26997 GCC ABI is in use.  If @code{CALLT} instructions are being generated
26998 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27000 @item -mrelax
27001 @itemx -mno-relax
27002 @opindex mrelax
27003 @opindex mno-relax
27004 Pass on (or do not pass on) the @option{-mrelax} command-line option
27005 to the assembler.
27007 @item -mlong-jumps
27008 @itemx -mno-long-jumps
27009 @opindex mlong-jumps
27010 @opindex mno-long-jumps
27011 Disable (or re-enable) the generation of PC-relative jump instructions.
27013 @item -msoft-float
27014 @itemx -mhard-float
27015 @opindex msoft-float
27016 @opindex mhard-float
27017 Disable (or re-enable) the generation of hardware floating point
27018 instructions.  This option is only significant when the target
27019 architecture is @samp{V850E2V3} or higher.  If hardware floating point
27020 instructions are being generated then the C preprocessor symbol
27021 @code{__FPU_OK__} is defined, otherwise the symbol
27022 @code{__NO_FPU__} is defined.
27024 @item -mloop
27025 @opindex mloop
27026 Enables the use of the e3v5 LOOP instruction.  The use of this
27027 instruction is not enabled by default when the e3v5 architecture is
27028 selected because its use is still experimental.
27030 @item -mrh850-abi
27031 @itemx -mghs
27032 @opindex mrh850-abi
27033 @opindex mghs
27034 Enables support for the RH850 version of the V850 ABI.  This is the
27035 default.  With this version of the ABI the following rules apply:
27037 @itemize
27038 @item
27039 Integer sized structures and unions are returned via a memory pointer
27040 rather than a register.
27042 @item
27043 Large structures and unions (more than 8 bytes in size) are passed by
27044 value.
27046 @item
27047 Functions are aligned to 16-bit boundaries.
27049 @item
27050 The @option{-m8byte-align} command-line option is supported.
27052 @item
27053 The @option{-mdisable-callt} command-line option is enabled by
27054 default.  The @option{-mno-disable-callt} command-line option is not
27055 supported.
27056 @end itemize
27058 When this version of the ABI is enabled the C preprocessor symbol
27059 @code{__V850_RH850_ABI__} is defined.
27061 @item -mgcc-abi
27062 @opindex mgcc-abi
27063 Enables support for the old GCC version of the V850 ABI.  With this
27064 version of the ABI the following rules apply:
27066 @itemize
27067 @item
27068 Integer sized structures and unions are returned in register @code{r10}.
27070 @item
27071 Large structures and unions (more than 8 bytes in size) are passed by
27072 reference.
27074 @item
27075 Functions are aligned to 32-bit boundaries, unless optimizing for
27076 size.
27078 @item
27079 The @option{-m8byte-align} command-line option is not supported.
27081 @item
27082 The @option{-mdisable-callt} command-line option is supported but not
27083 enabled by default.
27084 @end itemize
27086 When this version of the ABI is enabled the C preprocessor symbol
27087 @code{__V850_GCC_ABI__} is defined.
27089 @item -m8byte-align
27090 @itemx -mno-8byte-align
27091 @opindex m8byte-align
27092 @opindex mno-8byte-align
27093 Enables support for @code{double} and @code{long long} types to be
27094 aligned on 8-byte boundaries.  The default is to restrict the
27095 alignment of all objects to at most 4-bytes.  When
27096 @option{-m8byte-align} is in effect the C preprocessor symbol
27097 @code{__V850_8BYTE_ALIGN__} is defined.
27099 @item -mbig-switch
27100 @opindex mbig-switch
27101 Generate code suitable for big switch tables.  Use this option only if
27102 the assembler/linker complain about out of range branches within a switch
27103 table.
27105 @item -mapp-regs
27106 @opindex mapp-regs
27107 This option causes r2 and r5 to be used in the code generated by
27108 the compiler.  This setting is the default.
27110 @item -mno-app-regs
27111 @opindex mno-app-regs
27112 This option causes r2 and r5 to be treated as fixed registers.
27114 @end table
27116 @node VAX Options
27117 @subsection VAX Options
27118 @cindex VAX options
27120 These @samp{-m} options are defined for the VAX:
27122 @table @gcctabopt
27123 @item -munix
27124 @opindex munix
27125 Do not output certain jump instructions (@code{aobleq} and so on)
27126 that the Unix assembler for the VAX cannot handle across long
27127 ranges.
27129 @item -mgnu
27130 @opindex mgnu
27131 Do output those jump instructions, on the assumption that the
27132 GNU assembler is being used.
27134 @item -mg
27135 @opindex mg
27136 Output code for G-format floating-point numbers instead of D-format.
27137 @end table
27139 @node Visium Options
27140 @subsection Visium Options
27141 @cindex Visium options
27143 @table @gcctabopt
27145 @item -mdebug
27146 @opindex mdebug
27147 A program which performs file I/O and is destined to run on an MCM target
27148 should be linked with this option.  It causes the libraries libc.a and
27149 libdebug.a to be linked.  The program should be run on the target under
27150 the control of the GDB remote debugging stub.
27152 @item -msim
27153 @opindex msim
27154 A program which performs file I/O and is destined to run on the simulator
27155 should be linked with option.  This causes libraries libc.a and libsim.a to
27156 be linked.
27158 @item -mfpu
27159 @itemx -mhard-float
27160 @opindex mfpu
27161 @opindex mhard-float
27162 Generate code containing floating-point instructions.  This is the
27163 default.
27165 @item -mno-fpu
27166 @itemx -msoft-float
27167 @opindex mno-fpu
27168 @opindex msoft-float
27169 Generate code containing library calls for floating-point.
27171 @option{-msoft-float} changes the calling convention in the output file;
27172 therefore, it is only useful if you compile @emph{all} of a program with
27173 this option.  In particular, you need to compile @file{libgcc.a}, the
27174 library that comes with GCC, with @option{-msoft-float} in order for
27175 this to work.
27177 @item -mcpu=@var{cpu_type}
27178 @opindex mcpu
27179 Set the instruction set, register set, and instruction scheduling parameters
27180 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
27181 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27183 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27185 By default (unless configured otherwise), GCC generates code for the GR5
27186 variant of the Visium architecture.  
27188 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27189 architecture.  The only difference from GR5 code is that the compiler will
27190 generate block move instructions.
27192 @item -mtune=@var{cpu_type}
27193 @opindex mtune
27194 Set the instruction scheduling parameters for machine type @var{cpu_type},
27195 but do not set the instruction set or register set that the option
27196 @option{-mcpu=@var{cpu_type}} would.
27198 @item -msv-mode
27199 @opindex msv-mode
27200 Generate code for the supervisor mode, where there are no restrictions on
27201 the access to general registers.  This is the default.
27203 @item -muser-mode
27204 @opindex muser-mode
27205 Generate code for the user mode, where the access to some general registers
27206 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27207 mode; on the GR6, only registers r29 to r31 are affected.
27208 @end table
27210 @node VMS Options
27211 @subsection VMS Options
27213 These @samp{-m} options are defined for the VMS implementations:
27215 @table @gcctabopt
27216 @item -mvms-return-codes
27217 @opindex mvms-return-codes
27218 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27219 condition (e.g.@: error) codes.
27221 @item -mdebug-main=@var{prefix}
27222 @opindex mdebug-main=@var{prefix}
27223 Flag the first routine whose name starts with @var{prefix} as the main
27224 routine for the debugger.
27226 @item -mmalloc64
27227 @opindex mmalloc64
27228 Default to 64-bit memory allocation routines.
27230 @item -mpointer-size=@var{size}
27231 @opindex mpointer-size=@var{size}
27232 Set the default size of pointers. Possible options for @var{size} are
27233 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27234 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27235 The later option disables @code{pragma pointer_size}.
27236 @end table
27238 @node VxWorks Options
27239 @subsection VxWorks Options
27240 @cindex VxWorks Options
27242 The options in this section are defined for all VxWorks targets.
27243 Options specific to the target hardware are listed with the other
27244 options for that target.
27246 @table @gcctabopt
27247 @item -mrtp
27248 @opindex mrtp
27249 GCC can generate code for both VxWorks kernels and real time processes
27250 (RTPs).  This option switches from the former to the latter.  It also
27251 defines the preprocessor macro @code{__RTP__}.
27253 @item -non-static
27254 @opindex non-static
27255 Link an RTP executable against shared libraries rather than static
27256 libraries.  The options @option{-static} and @option{-shared} can
27257 also be used for RTPs (@pxref{Link Options}); @option{-static}
27258 is the default.
27260 @item -Bstatic
27261 @itemx -Bdynamic
27262 @opindex Bstatic
27263 @opindex Bdynamic
27264 These options are passed down to the linker.  They are defined for
27265 compatibility with Diab.
27267 @item -Xbind-lazy
27268 @opindex Xbind-lazy
27269 Enable lazy binding of function calls.  This option is equivalent to
27270 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27272 @item -Xbind-now
27273 @opindex Xbind-now
27274 Disable lazy binding of function calls.  This option is the default and
27275 is defined for compatibility with Diab.
27276 @end table
27278 @node x86 Options
27279 @subsection x86 Options
27280 @cindex x86 Options
27282 These @samp{-m} options are defined for the x86 family of computers.
27284 @table @gcctabopt
27286 @item -march=@var{cpu-type}
27287 @opindex march
27288 Generate instructions for the machine type @var{cpu-type}.  In contrast to
27289 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code 
27290 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27291 to generate code that may not run at all on processors other than the one
27292 indicated.  Specifying @option{-march=@var{cpu-type}} implies 
27293 @option{-mtune=@var{cpu-type}}.
27295 The choices for @var{cpu-type} are:
27297 @table @samp
27298 @item native
27299 This selects the CPU to generate code for at compilation time by determining
27300 the processor type of the compiling machine.  Using @option{-march=native}
27301 enables all instruction subsets supported by the local machine (hence
27302 the result might not run on different machines).  Using @option{-mtune=native}
27303 produces code optimized for the local machine under the constraints
27304 of the selected instruction set.  
27306 @item x86-64
27307 A generic CPU with 64-bit extensions.
27309 @item i386
27310 Original Intel i386 CPU@.
27312 @item i486
27313 Intel i486 CPU@.  (No scheduling is implemented for this chip.)
27315 @item i586
27316 @itemx pentium
27317 Intel Pentium CPU with no MMX support.
27319 @item lakemont
27320 Intel Lakemont MCU, based on Intel Pentium CPU.
27322 @item pentium-mmx
27323 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27325 @item pentiumpro
27326 Intel Pentium Pro CPU@.
27328 @item i686
27329 When used with @option{-march}, the Pentium Pro
27330 instruction set is used, so the code runs on all i686 family chips.
27331 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27333 @item pentium2
27334 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27335 support.
27337 @item pentium3
27338 @itemx pentium3m
27339 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27340 set support.
27342 @item pentium-m
27343 Intel Pentium M; low-power version of Intel Pentium III CPU
27344 with MMX, SSE and SSE2 instruction set support.  Used by Centrino notebooks.
27346 @item pentium4
27347 @itemx pentium4m
27348 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27350 @item prescott
27351 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27352 set support.
27354 @item nocona
27355 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27356 SSE2 and SSE3 instruction set support.
27358 @item core2
27359 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27360 instruction set support.
27362 @item nehalem
27363 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27364 SSE4.1, SSE4.2 and POPCNT instruction set support.
27366 @item westmere
27367 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27368 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27370 @item sandybridge
27371 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27372 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27374 @item ivybridge
27375 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27376 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27377 instruction set support.
27379 @item haswell
27380 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27381 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27382 BMI, BMI2 and F16C instruction set support.
27384 @item broadwell
27385 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27386 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27387 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27389 @item skylake
27390 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27391 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27392 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27393 XSAVES instruction set support.
27395 @item bonnell
27396 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27397 instruction set support.
27399 @item silvermont
27400 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27401 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27403 @item goldmont
27404 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27405 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27406 instruction set support.
27408 @item goldmont-plus
27409 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27410 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27411 PTWRITE, RDPID, SGX and UMIP instruction set support.
27413 @item tremont
27414 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27415 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27416 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27418 @item knl
27419 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27420 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27421 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27422 AVX512CD instruction set support.
27424 @item knm
27425 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27426 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27427 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27428 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27430 @item skylake-avx512
27431 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27432 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27433 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27434 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27436 @item cannonlake
27437 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27438 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27439 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27440 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27441 AVX512IFMA, SHA and UMIP instruction set support.
27443 @item icelake-client
27444 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27445 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27446 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27447 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27448 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27449 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27451 @item icelake-server
27452 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27453 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27454 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27455 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27456 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27457 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27458 set support.
27460 @item cascadelake
27461 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27462 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27463 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27464 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27466 @item cooperlake
27467 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27468 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27469 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27470 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
27471 set support.
27473 @item tigerlake
27474 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27475 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27476 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27477 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
27478 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
27479 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and  AVX512VP2INTERSECT instruction
27480 set support.
27482 @item k6
27483 AMD K6 CPU with MMX instruction set support.
27485 @item k6-2
27486 @itemx k6-3
27487 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27489 @item athlon
27490 @itemx athlon-tbird
27491 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27492 support.
27494 @item athlon-4
27495 @itemx athlon-xp
27496 @itemx athlon-mp
27497 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27498 instruction set support.
27500 @item k8
27501 @itemx opteron
27502 @itemx athlon64
27503 @itemx athlon-fx
27504 Processors based on the AMD K8 core with x86-64 instruction set support,
27505 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27506 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27507 instruction set extensions.)
27509 @item k8-sse3
27510 @itemx opteron-sse3
27511 @itemx athlon64-sse3
27512 Improved versions of AMD K8 cores with SSE3 instruction set support.
27514 @item amdfam10
27515 @itemx barcelona
27516 CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
27517 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27518 instruction set extensions.)
27520 @item bdver1
27521 CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
27522 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27523 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27524 @item bdver2
27525 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
27526 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27527 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 
27528 extensions.)
27529 @item bdver3
27530 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
27531 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 
27532 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27533 64-bit instruction set extensions.
27534 @item bdver4
27535 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
27536 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 
27537 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27538 SSE4.2, ABM and 64-bit instruction set extensions.
27540 @item znver1
27541 AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
27542 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27543 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27544 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27545 instruction set extensions.
27546 @item znver2
27547 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27548 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27549 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27550 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27551 instruction set extensions.)
27554 @item btver1
27555 CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
27556 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27557 instruction set extensions.)
27559 @item btver2
27560 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27561 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27562 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27564 @item winchip-c6
27565 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27566 set support.
27568 @item winchip2
27569 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27570 instruction set support.
27572 @item c3
27573 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27574 (No scheduling is implemented for this chip.)
27576 @item c3-2
27577 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27578 (No scheduling is implemented for this chip.)
27580 @item c7
27581 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27582 (No scheduling is implemented for this chip.)
27584 @item samuel-2
27585 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27586 (No scheduling is implemented for this chip.)
27588 @item nehemiah
27589 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27590 (No scheduling is implemented for this chip.)
27592 @item esther
27593 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27594 (No scheduling is implemented for this chip.)
27596 @item eden-x2
27597 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27598 (No scheduling is implemented for this chip.)
27600 @item eden-x4
27601 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27602 AVX and AVX2 instruction set support.
27603 (No scheduling is implemented for this chip.)
27605 @item nano
27606 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27607 instruction set support.
27608 (No scheduling is implemented for this chip.)
27610 @item nano-1000
27611 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27612 instruction set support.
27613 (No scheduling is implemented for this chip.)
27615 @item nano-2000
27616 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27617 instruction set support.
27618 (No scheduling is implemented for this chip.)
27620 @item nano-3000
27621 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27622 instruction set support.
27623 (No scheduling is implemented for this chip.)
27625 @item nano-x2
27626 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27627 instruction set support.
27628 (No scheduling is implemented for this chip.)
27630 @item nano-x4
27631 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27632 instruction set support.
27633 (No scheduling is implemented for this chip.)
27635 @item geode
27636 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27637 @end table
27639 @item -mtune=@var{cpu-type}
27640 @opindex mtune
27641 Tune to @var{cpu-type} everything applicable about the generated code, except
27642 for the ABI and the set of available instructions.  
27643 While picking a specific @var{cpu-type} schedules things appropriately
27644 for that particular chip, the compiler does not generate any code that
27645 cannot run on the default machine type unless you use a
27646 @option{-march=@var{cpu-type}} option.
27647 For example, if GCC is configured for i686-pc-linux-gnu
27648 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27649 but still runs on i686 machines.
27651 The choices for @var{cpu-type} are the same as for @option{-march}.
27652 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27654 @table @samp
27655 @item generic
27656 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27657 If you know the CPU on which your code will run, then you should use
27658 the corresponding @option{-mtune} or @option{-march} option instead of
27659 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
27660 of your application will have, then you should use this option.
27662 As new processors are deployed in the marketplace, the behavior of this
27663 option will change.  Therefore, if you upgrade to a newer version of
27664 GCC, code generation controlled by this option will change to reflect
27665 the processors
27666 that are most common at the time that version of GCC is released.
27668 There is no @option{-march=generic} option because @option{-march}
27669 indicates the instruction set the compiler can use, and there is no
27670 generic instruction set applicable to all processors.  In contrast,
27671 @option{-mtune} indicates the processor (or, in this case, collection of
27672 processors) for which the code is optimized.
27674 @item intel
27675 Produce code optimized for the most current Intel processors, which are
27676 Haswell and Silvermont for this version of GCC.  If you know the CPU
27677 on which your code will run, then you should use the corresponding
27678 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27679 But, if you want your application performs better on both Haswell and
27680 Silvermont, then you should use this option.
27682 As new Intel processors are deployed in the marketplace, the behavior of
27683 this option will change.  Therefore, if you upgrade to a newer version of
27684 GCC, code generation controlled by this option will change to reflect
27685 the most current Intel processors at the time that version of GCC is
27686 released.
27688 There is no @option{-march=intel} option because @option{-march} indicates
27689 the instruction set the compiler can use, and there is no common
27690 instruction set applicable to all processors.  In contrast,
27691 @option{-mtune} indicates the processor (or, in this case, collection of
27692 processors) for which the code is optimized.
27693 @end table
27695 @item -mcpu=@var{cpu-type}
27696 @opindex mcpu
27697 A deprecated synonym for @option{-mtune}.
27699 @item -mfpmath=@var{unit}
27700 @opindex mfpmath
27701 Generate floating-point arithmetic for selected unit @var{unit}.  The choices
27702 for @var{unit} are:
27704 @table @samp
27705 @item 387
27706 Use the standard 387 floating-point coprocessor present on the majority of chips and
27707 emulated otherwise.  Code compiled with this option runs almost everywhere.
27708 The temporary results are computed in 80-bit precision instead of the precision
27709 specified by the type, resulting in slightly different results compared to most
27710 of other chips.  See @option{-ffloat-store} for more detailed description.
27712 This is the default choice for non-Darwin x86-32 targets.
27714 @item sse
27715 Use scalar floating-point instructions present in the SSE instruction set.
27716 This instruction set is supported by Pentium III and newer chips,
27717 and in the AMD line
27718 by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
27719 instruction set supports only single-precision arithmetic, thus the double and
27720 extended-precision arithmetic are still done using 387.  A later version, present
27721 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27722 arithmetic too.
27724 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27725 or @option{-msse2} switches to enable SSE extensions and make this option
27726 effective.  For the x86-64 compiler, these extensions are enabled by default.
27728 The resulting code should be considerably faster in the majority of cases and avoid
27729 the numerical instability problems of 387 code, but may break some existing
27730 code that expects temporaries to be 80 bits.
27732 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27733 and the default choice for x86-32 targets with the SSE2 instruction set
27734 when @option{-ffast-math} is enabled.
27736 @item sse,387
27737 @itemx sse+387
27738 @itemx both
27739 Attempt to utilize both instruction sets at once.  This effectively doubles the
27740 amount of available registers, and on chips with separate execution units for
27741 387 and SSE the execution resources too.  Use this option with care, as it is
27742 still experimental, because the GCC register allocator does not model separate
27743 functional units well, resulting in unstable performance.
27744 @end table
27746 @item -masm=@var{dialect}
27747 @opindex masm=@var{dialect}
27748 Output assembly instructions using selected @var{dialect}.  Also affects
27749 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27750 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27751 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27752 not support @samp{intel}.
27754 @item -mieee-fp
27755 @itemx -mno-ieee-fp
27756 @opindex mieee-fp
27757 @opindex mno-ieee-fp
27758 Control whether or not the compiler uses IEEE floating-point
27759 comparisons.  These correctly handle the case where the result of a
27760 comparison is unordered.
27762 @item -m80387
27763 @itemx -mhard-float
27764 @opindex 80387
27765 @opindex mhard-float
27766 Generate output containing 80387 instructions for floating point.
27768 @item -mno-80387
27769 @itemx -msoft-float
27770 @opindex no-80387
27771 @opindex msoft-float
27772 Generate output containing library calls for floating point.
27774 @strong{Warning:} the requisite libraries are not part of GCC@.
27775 Normally the facilities of the machine's usual C compiler are used, but
27776 this cannot be done directly in cross-compilation.  You must make your
27777 own arrangements to provide suitable library functions for
27778 cross-compilation.
27780 On machines where a function returns floating-point results in the 80387
27781 register stack, some floating-point opcodes may be emitted even if
27782 @option{-msoft-float} is used.
27784 @item -mno-fp-ret-in-387
27785 @opindex mno-fp-ret-in-387
27786 @opindex mfp-ret-in-387
27787 Do not use the FPU registers for return values of functions.
27789 The usual calling convention has functions return values of types
27790 @code{float} and @code{double} in an FPU register, even if there
27791 is no FPU@.  The idea is that the operating system should emulate
27792 an FPU@.
27794 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27795 in ordinary CPU registers instead.
27797 @item -mno-fancy-math-387
27798 @opindex mno-fancy-math-387
27799 @opindex mfancy-math-387
27800 Some 387 emulators do not support the @code{sin}, @code{cos} and
27801 @code{sqrt} instructions for the 387.  Specify this option to avoid
27802 generating those instructions.
27803 This option is overridden when @option{-march}
27804 indicates that the target CPU always has an FPU and so the
27805 instruction does not need emulation.  These
27806 instructions are not generated unless you also use the
27807 @option{-funsafe-math-optimizations} switch.
27809 @item -malign-double
27810 @itemx -mno-align-double
27811 @opindex malign-double
27812 @opindex mno-align-double
27813 Control whether GCC aligns @code{double}, @code{long double}, and
27814 @code{long long} variables on a two-word boundary or a one-word
27815 boundary.  Aligning @code{double} variables on a two-word boundary
27816 produces code that runs somewhat faster on a Pentium at the
27817 expense of more memory.
27819 On x86-64, @option{-malign-double} is enabled by default.
27821 @strong{Warning:} if you use the @option{-malign-double} switch,
27822 structures containing the above types are aligned differently than
27823 the published application binary interface specifications for the x86-32
27824 and are not binary compatible with structures in code compiled
27825 without that switch.
27827 @item -m96bit-long-double
27828 @itemx -m128bit-long-double
27829 @opindex m96bit-long-double
27830 @opindex m128bit-long-double
27831 These switches control the size of @code{long double} type.  The x86-32
27832 application binary interface specifies the size to be 96 bits,
27833 so @option{-m96bit-long-double} is the default in 32-bit mode.
27835 Modern architectures (Pentium and newer) prefer @code{long double}
27836 to be aligned to an 8- or 16-byte boundary.  In arrays or structures
27837 conforming to the ABI, this is not possible.  So specifying
27838 @option{-m128bit-long-double} aligns @code{long double}
27839 to a 16-byte boundary by padding the @code{long double} with an additional
27840 32-bit zero.
27842 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27843 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27845 Notice that neither of these options enable any extra precision over the x87
27846 standard of 80 bits for a @code{long double}.
27848 @strong{Warning:} if you override the default value for your target ABI, this
27849 changes the size of 
27850 structures and arrays containing @code{long double} variables,
27851 as well as modifying the function calling convention for functions taking
27852 @code{long double}.  Hence they are not binary-compatible
27853 with code compiled without that switch.
27855 @item -mlong-double-64
27856 @itemx -mlong-double-80
27857 @itemx -mlong-double-128
27858 @opindex mlong-double-64
27859 @opindex mlong-double-80
27860 @opindex mlong-double-128
27861 These switches control the size of @code{long double} type. A size
27862 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27863 type. This is the default for 32-bit Bionic C library.  A size
27864 of 128 bits makes the @code{long double} type equivalent to the
27865 @code{__float128} type. This is the default for 64-bit Bionic C library.
27867 @strong{Warning:} if you override the default value for your target ABI, this
27868 changes the size of
27869 structures and arrays containing @code{long double} variables,
27870 as well as modifying the function calling convention for functions taking
27871 @code{long double}.  Hence they are not binary-compatible
27872 with code compiled without that switch.
27874 @item -malign-data=@var{type}
27875 @opindex malign-data
27876 Control how GCC aligns variables.  Supported values for @var{type} are
27877 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27878 and earlier, @samp{abi} uses alignment value as specified by the
27879 psABI, and @samp{cacheline} uses increased alignment value to match
27880 the cache line size.  @samp{compat} is the default.
27882 @item -mlarge-data-threshold=@var{threshold}
27883 @opindex mlarge-data-threshold
27884 When @option{-mcmodel=medium} is specified, data objects larger than
27885 @var{threshold} are placed in the large data section.  This value must be the
27886 same across all objects linked into the binary, and defaults to 65535.
27888 @item -mrtd
27889 @opindex mrtd
27890 Use a different function-calling convention, in which functions that
27891 take a fixed number of arguments return with the @code{ret @var{num}}
27892 instruction, which pops their arguments while returning.  This saves one
27893 instruction in the caller since there is no need to pop the arguments
27894 there.
27896 You can specify that an individual function is called with this calling
27897 sequence with the function attribute @code{stdcall}.  You can also
27898 override the @option{-mrtd} option by using the function attribute
27899 @code{cdecl}.  @xref{Function Attributes}.
27901 @strong{Warning:} this calling convention is incompatible with the one
27902 normally used on Unix, so you cannot use it if you need to call
27903 libraries compiled with the Unix compiler.
27905 Also, you must provide function prototypes for all functions that
27906 take variable numbers of arguments (including @code{printf});
27907 otherwise incorrect code is generated for calls to those
27908 functions.
27910 In addition, seriously incorrect code results if you call a
27911 function with too many arguments.  (Normally, extra arguments are
27912 harmlessly ignored.)
27914 @item -mregparm=@var{num}
27915 @opindex mregparm
27916 Control how many registers are used to pass integer arguments.  By
27917 default, no registers are used to pass arguments, and at most 3
27918 registers can be used.  You can control this behavior for a specific
27919 function by using the function attribute @code{regparm}.
27920 @xref{Function Attributes}.
27922 @strong{Warning:} if you use this switch, and
27923 @var{num} is nonzero, then you must build all modules with the same
27924 value, including any libraries.  This includes the system libraries and
27925 startup modules.
27927 @item -msseregparm
27928 @opindex msseregparm
27929 Use SSE register passing conventions for float and double arguments
27930 and return values.  You can control this behavior for a specific
27931 function by using the function attribute @code{sseregparm}.
27932 @xref{Function Attributes}.
27934 @strong{Warning:} if you use this switch then you must build all
27935 modules with the same value, including any libraries.  This includes
27936 the system libraries and startup modules.
27938 @item -mvect8-ret-in-mem
27939 @opindex mvect8-ret-in-mem
27940 Return 8-byte vectors in memory instead of MMX registers.  This is the
27941 default on VxWorks to match the ABI of the Sun Studio compilers until
27942 version 12.  @emph{Only} use this option if you need to remain
27943 compatible with existing code produced by those previous compiler
27944 versions or older versions of GCC@.
27946 @item -mpc32
27947 @itemx -mpc64
27948 @itemx -mpc80
27949 @opindex mpc32
27950 @opindex mpc64
27951 @opindex mpc80
27953 Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
27954 is specified, the significands of results of floating-point operations are
27955 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27956 significands of results of floating-point operations to 53 bits (double
27957 precision) and @option{-mpc80} rounds the significands of results of
27958 floating-point operations to 64 bits (extended double precision), which is
27959 the default.  When this option is used, floating-point operations in higher
27960 precisions are not available to the programmer without setting the FPU
27961 control word explicitly.
27963 Setting the rounding of floating-point operations to less than the default
27964 80 bits can speed some programs by 2% or more.  Note that some mathematical
27965 libraries assume that extended-precision (80-bit) floating-point operations
27966 are enabled by default; routines in such libraries could suffer significant
27967 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27968 when this option is used to set the precision to less than extended precision.
27970 @item -mstackrealign
27971 @opindex mstackrealign
27972 Realign the stack at entry.  On the x86, the @option{-mstackrealign}
27973 option generates an alternate prologue and epilogue that realigns the
27974 run-time stack if necessary.  This supports mixing legacy codes that keep
27975 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27976 SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
27977 applicable to individual functions.
27979 @item -mpreferred-stack-boundary=@var{num}
27980 @opindex mpreferred-stack-boundary
27981 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27982 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
27983 the default is 4 (16 bytes or 128 bits).
27985 @strong{Warning:} When generating code for the x86-64 architecture with
27986 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27987 used to keep the stack boundary aligned to 8 byte boundary.  Since
27988 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27989 intended to be used in controlled environment where stack space is
27990 important limitation.  This option leads to wrong code when functions
27991 compiled with 16 byte stack alignment (such as functions from a standard
27992 library) are called with misaligned stack.  In this case, SSE
27993 instructions may lead to misaligned memory access traps.  In addition,
27994 variable arguments are handled incorrectly for 16 byte aligned
27995 objects (including x87 long double and __int128), leading to wrong
27996 results.  You must build all modules with
27997 @option{-mpreferred-stack-boundary=3}, including any libraries.  This
27998 includes the system libraries and startup modules.
28000 @item -mincoming-stack-boundary=@var{num}
28001 @opindex mincoming-stack-boundary
28002 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28003 boundary.  If @option{-mincoming-stack-boundary} is not specified,
28004 the one specified by @option{-mpreferred-stack-boundary} is used.
28006 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28007 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28008 suffer significant run time performance penalties.  On Pentium III, the
28009 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28010 properly if it is not 16-byte aligned.
28012 To ensure proper alignment of this values on the stack, the stack boundary
28013 must be as aligned as that required by any value stored on the stack.
28014 Further, every function must be generated such that it keeps the stack
28015 aligned.  Thus calling a function compiled with a higher preferred
28016 stack boundary from a function compiled with a lower preferred stack
28017 boundary most likely misaligns the stack.  It is recommended that
28018 libraries that use callbacks always use the default setting.
28020 This extra alignment does consume extra stack space, and generally
28021 increases code size.  Code that is sensitive to stack space usage, such
28022 as embedded systems and operating system kernels, may want to reduce the
28023 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28025 @need 200
28026 @item -mmmx
28027 @opindex mmmx
28028 @need 200
28029 @itemx -msse
28030 @opindex msse
28031 @need 200
28032 @itemx -msse2
28033 @opindex msse2
28034 @need 200
28035 @itemx -msse3
28036 @opindex msse3
28037 @need 200
28038 @itemx -mssse3
28039 @opindex mssse3
28040 @need 200
28041 @itemx -msse4
28042 @opindex msse4
28043 @need 200
28044 @itemx -msse4a
28045 @opindex msse4a
28046 @need 200
28047 @itemx -msse4.1
28048 @opindex msse4.1
28049 @need 200
28050 @itemx -msse4.2
28051 @opindex msse4.2
28052 @need 200
28053 @itemx -mavx
28054 @opindex mavx
28055 @need 200
28056 @itemx -mavx2
28057 @opindex mavx2
28058 @need 200
28059 @itemx -mavx512f
28060 @opindex mavx512f
28061 @need 200
28062 @itemx -mavx512pf
28063 @opindex mavx512pf
28064 @need 200
28065 @itemx -mavx512er
28066 @opindex mavx512er
28067 @need 200
28068 @itemx -mavx512cd
28069 @opindex mavx512cd
28070 @need 200
28071 @itemx -mavx512vl
28072 @opindex mavx512vl
28073 @need 200
28074 @itemx -mavx512bw
28075 @opindex mavx512bw
28076 @need 200
28077 @itemx -mavx512dq
28078 @opindex mavx512dq
28079 @need 200
28080 @itemx -mavx512ifma
28081 @opindex mavx512ifma
28082 @need 200
28083 @itemx -mavx512vbmi
28084 @opindex mavx512vbmi
28085 @need 200
28086 @itemx -msha
28087 @opindex msha
28088 @need 200
28089 @itemx -maes
28090 @opindex maes
28091 @need 200
28092 @itemx -mpclmul
28093 @opindex mpclmul
28094 @need 200
28095 @itemx -mclflushopt
28096 @opindex mclflushopt
28097 @need 200
28098 @itemx -mclwb
28099 @opindex mclwb
28100 @need 200
28101 @itemx -mfsgsbase
28102 @opindex mfsgsbase
28103 @need 200
28104 @itemx -mptwrite
28105 @opindex mptwrite
28106 @need 200
28107 @itemx -mrdrnd
28108 @opindex mrdrnd
28109 @need 200
28110 @itemx -mf16c
28111 @opindex mf16c
28112 @need 200
28113 @itemx -mfma
28114 @opindex mfma
28115 @need 200
28116 @itemx -mpconfig
28117 @opindex mpconfig
28118 @need 200
28119 @itemx -mwbnoinvd
28120 @opindex mwbnoinvd
28121 @need 200
28122 @itemx -mfma4
28123 @opindex mfma4
28124 @need 200
28125 @itemx -mprfchw
28126 @opindex mprfchw
28127 @need 200
28128 @itemx -mrdpid
28129 @opindex mrdpid
28130 @need 200
28131 @itemx -mprefetchwt1
28132 @opindex mprefetchwt1
28133 @need 200
28134 @itemx -mrdseed
28135 @opindex mrdseed
28136 @need 200
28137 @itemx -msgx
28138 @opindex msgx
28139 @need 200
28140 @itemx -mxop
28141 @opindex mxop
28142 @need 200
28143 @itemx -mlwp
28144 @opindex mlwp
28145 @need 200
28146 @itemx -m3dnow
28147 @opindex m3dnow
28148 @need 200
28149 @itemx -m3dnowa
28150 @opindex m3dnowa
28151 @need 200
28152 @itemx -mpopcnt
28153 @opindex mpopcnt
28154 @need 200
28155 @itemx -mabm
28156 @opindex mabm
28157 @need 200
28158 @itemx -madx
28159 @opindex madx
28160 @need 200
28161 @itemx -mbmi
28162 @opindex mbmi
28163 @need 200
28164 @itemx -mbmi2
28165 @opindex mbmi2
28166 @need 200
28167 @itemx -mlzcnt
28168 @opindex mlzcnt
28169 @need 200
28170 @itemx -mfxsr
28171 @opindex mfxsr
28172 @need 200
28173 @itemx -mxsave
28174 @opindex mxsave
28175 @need 200
28176 @itemx -mxsaveopt
28177 @opindex mxsaveopt
28178 @need 200
28179 @itemx -mxsavec
28180 @opindex mxsavec
28181 @need 200
28182 @itemx -mxsaves
28183 @opindex mxsaves
28184 @need 200
28185 @itemx -mrtm
28186 @opindex mrtm
28187 @need 200
28188 @itemx -mhle
28189 @opindex mhle
28190 @need 200
28191 @itemx -mtbm
28192 @opindex mtbm
28193 @need 200
28194 @itemx -mmwaitx
28195 @opindex mmwaitx
28196 @need 200
28197 @itemx -mclzero
28198 @opindex mclzero
28199 @need 200
28200 @itemx -mpku
28201 @opindex mpku
28202 @need 200
28203 @itemx -mavx512vbmi2
28204 @opindex mavx512vbmi2
28205 @need 200
28206 @itemx -mavx512bf16
28207 @opindex mavx512bf16
28208 @need 200
28209 @itemx -mgfni
28210 @opindex mgfni
28211 @need 200
28212 @itemx -mvaes
28213 @opindex mvaes
28214 @need 200
28215 @itemx -mwaitpkg
28216 @opindex mwaitpkg
28217 @need 200
28218 @itemx -mvpclmulqdq
28219 @opindex mvpclmulqdq
28220 @need 200
28221 @itemx -mavx512bitalg
28222 @opindex mavx512bitalg
28223 @need 200
28224 @itemx -mmovdiri
28225 @opindex mmovdiri
28226 @need 200
28227 @itemx -mmovdir64b
28228 @opindex mmovdir64b
28229 @need 200
28230 @itemx -menqcmd
28231 @opindex menqcmd
28232 @need 200
28233 @itemx -mavx512vpopcntdq
28234 @opindex mavx512vpopcntdq
28235 @need 200
28236 @itemx -mavx512vp2intersect
28237 @opindex mavx512vp2intersect
28238 @need 200
28239 @itemx -mavx5124fmaps
28240 @opindex mavx5124fmaps
28241 @need 200
28242 @itemx -mavx512vnni
28243 @opindex mavx512vnni
28244 @need 200
28245 @itemx -mavx5124vnniw
28246 @opindex mavx5124vnniw
28247 @need 200
28248 @itemx -mcldemote
28249 @opindex mcldemote
28250 These switches enable the use of instructions in the MMX, SSE,
28251 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28252 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28253 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28254 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28255 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28256 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28257 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28258 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28259 extended instruction sets.  Each has a corresponding @option{-mno-} option to
28260 disable use of these instructions.
28262 These extensions are also available as built-in functions: see
28263 @ref{x86 Built-in Functions}, for details of the functions enabled and
28264 disabled by these switches.
28266 To generate SSE/SSE2 instructions automatically from floating-point
28267 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28269 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28270 generates new AVX instructions or AVX equivalence for all SSEx instructions
28271 when needed.
28273 These options enable GCC to use these extended instructions in
28274 generated code, even without @option{-mfpmath=sse}.  Applications that
28275 perform run-time CPU detection must compile separate files for each
28276 supported architecture, using the appropriate flags.  In particular,
28277 the file containing the CPU detection code should be compiled without
28278 these options.
28280 @item -mdump-tune-features
28281 @opindex mdump-tune-features
28282 This option instructs GCC to dump the names of the x86 performance 
28283 tuning features and default settings. The names can be used in 
28284 @option{-mtune-ctrl=@var{feature-list}}.
28286 @item -mtune-ctrl=@var{feature-list}
28287 @opindex mtune-ctrl=@var{feature-list}
28288 This option is used to do fine grain control of x86 code generation features.
28289 @var{feature-list} is a comma separated list of @var{feature} names. See also
28290 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28291 on if it is not preceded with @samp{^}, otherwise, it is turned off. 
28292 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28293 developers. Using it may lead to code paths not covered by testing and can
28294 potentially result in compiler ICEs or runtime errors.
28296 @item -mno-default
28297 @opindex mno-default
28298 This option instructs GCC to turn off all tunable features. See also 
28299 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28301 @item -mcld
28302 @opindex mcld
28303 This option instructs GCC to emit a @code{cld} instruction in the prologue
28304 of functions that use string instructions.  String instructions depend on
28305 the DF flag to select between autoincrement or autodecrement mode.  While the
28306 ABI specifies the DF flag to be cleared on function entry, some operating
28307 systems violate this specification by not clearing the DF flag in their
28308 exception dispatchers.  The exception handler can be invoked with the DF flag
28309 set, which leads to wrong direction mode when string instructions are used.
28310 This option can be enabled by default on 32-bit x86 targets by configuring
28311 GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
28312 instructions can be suppressed with the @option{-mno-cld} compiler option
28313 in this case.
28315 @item -mvzeroupper
28316 @opindex mvzeroupper
28317 This option instructs GCC to emit a @code{vzeroupper} instruction
28318 before a transfer of control flow out of the function to minimize
28319 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28320 intrinsics.
28322 @item -mprefer-avx128
28323 @opindex mprefer-avx128
28324 This option instructs GCC to use 128-bit AVX instructions instead of
28325 256-bit AVX instructions in the auto-vectorizer.
28327 @item -mprefer-vector-width=@var{opt}
28328 @opindex mprefer-vector-width
28329 This option instructs GCC to use @var{opt}-bit vector width in instructions
28330 instead of default on the selected platform.
28332 @table @samp
28333 @item none
28334 No extra limitations applied to GCC other than defined by the selected platform.
28336 @item 128
28337 Prefer 128-bit vector width for instructions.
28339 @item 256
28340 Prefer 256-bit vector width for instructions.
28342 @item 512
28343 Prefer 512-bit vector width for instructions.
28344 @end table
28346 @item -mcx16
28347 @opindex mcx16
28348 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28349 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28350 objects.  This is useful for atomic updates of data structures exceeding one
28351 machine word in size.  The compiler uses this instruction to implement
28352 @ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
28353 128-bit integers, a library call is always used.
28355 @item -msahf
28356 @opindex msahf
28357 This option enables generation of @code{SAHF} instructions in 64-bit code.
28358 Early Intel Pentium 4 CPUs with Intel 64 support,
28359 prior to the introduction of Pentium 4 G1 step in December 2005,
28360 lacked the @code{LAHF} and @code{SAHF} instructions
28361 which are supported by AMD64.
28362 These are load and store instructions, respectively, for certain status flags.
28363 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28364 @code{drem}, and @code{remainder} built-in functions;
28365 see @ref{Other Builtins} for details.
28367 @item -mmovbe
28368 @opindex mmovbe
28369 This option enables use of the @code{movbe} instruction to implement
28370 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28372 @item -mshstk
28373 @opindex mshstk
28374 The @option{-mshstk} option enables shadow stack built-in functions
28375 from x86 Control-flow Enforcement Technology (CET).
28377 @item -mcrc32
28378 @opindex mcrc32
28379 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28380 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28381 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28383 @item -mrecip
28384 @opindex mrecip
28385 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28386 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28387 with an additional Newton-Raphson step
28388 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28389 (and their vectorized
28390 variants) for single-precision floating-point arguments.  These instructions
28391 are generated only when @option{-funsafe-math-optimizations} is enabled
28392 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28393 Note that while the throughput of the sequence is higher than the throughput
28394 of the non-reciprocal instruction, the precision of the sequence can be
28395 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28397 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28398 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28399 combination), and doesn't need @option{-mrecip}.
28401 Also note that GCC emits the above sequence with additional Newton-Raphson step
28402 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28403 already with @option{-ffast-math} (or the above option combination), and
28404 doesn't need @option{-mrecip}.
28406 @item -mrecip=@var{opt}
28407 @opindex mrecip=opt
28408 This option controls which reciprocal estimate instructions
28409 may be used.  @var{opt} is a comma-separated list of options, which may
28410 be preceded by a @samp{!} to invert the option:
28412 @table @samp
28413 @item all
28414 Enable all estimate instructions.
28416 @item default
28417 Enable the default instructions, equivalent to @option{-mrecip}.
28419 @item none
28420 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28422 @item div
28423 Enable the approximation for scalar division.
28425 @item vec-div
28426 Enable the approximation for vectorized division.
28428 @item sqrt
28429 Enable the approximation for scalar square root.
28431 @item vec-sqrt
28432 Enable the approximation for vectorized square root.
28433 @end table
28435 So, for example, @option{-mrecip=all,!sqrt} enables
28436 all of the reciprocal approximations, except for square root.
28438 @item -mveclibabi=@var{type}
28439 @opindex mveclibabi
28440 Specifies the ABI type to use for vectorizing intrinsics using an
28441 external library.  Supported values for @var{type} are @samp{svml} 
28442 for the Intel short
28443 vector math library and @samp{acml} for the AMD math core library.
28444 To use this option, both @option{-ftree-vectorize} and
28445 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 
28446 ABI-compatible library must be specified at link time.
28448 GCC currently emits calls to @code{vmldExp2},
28449 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28450 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28451 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28452 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28453 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28454 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28455 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28456 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28457 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28458 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28459 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28460 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28461 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28462 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28463 when @option{-mveclibabi=acml} is used.  
28465 @item -mabi=@var{name}
28466 @opindex mabi
28467 Generate code for the specified calling convention.  Permissible values
28468 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28469 @samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
28470 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28471 You can control this behavior for specific functions by
28472 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28473 @xref{Function Attributes}.
28475 @item -mforce-indirect-call
28476 @opindex mforce-indirect-call
28477 Force all calls to functions to be indirect. This is useful
28478 when using Intel Processor Trace where it generates more precise timing
28479 information for function calls.
28481 @item -mmanual-endbr
28482 @opindex mmanual-endbr
28483 Insert ENDBR instruction at function entry only via the @code{cf_check}
28484 function attribute. This is useful when used with the option
28485 @option{-fcf-protection=branch} to control ENDBR insertion at the
28486 function entry.
28488 @item -mcall-ms2sysv-xlogues
28489 @opindex mcall-ms2sysv-xlogues
28490 @opindex mno-call-ms2sysv-xlogues
28491 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28492 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
28493 default, the code for saving and restoring these registers is emitted inline,
28494 resulting in fairly lengthy prologues and epilogues.  Using
28495 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28496 use stubs in the static portion of libgcc to perform these saves and restores,
28497 thus reducing function size at the cost of a few extra instructions.
28499 @item -mtls-dialect=@var{type}
28500 @opindex mtls-dialect
28501 Generate code to access thread-local storage using the @samp{gnu} or
28502 @samp{gnu2} conventions.  @samp{gnu} is the conservative default;
28503 @samp{gnu2} is more efficient, but it may add compile- and run-time
28504 requirements that cannot be satisfied on all systems.
28506 @item -mpush-args
28507 @itemx -mno-push-args
28508 @opindex mpush-args
28509 @opindex mno-push-args
28510 Use PUSH operations to store outgoing parameters.  This method is shorter
28511 and usually equally fast as method using SUB/MOV operations and is enabled
28512 by default.  In some cases disabling it may improve performance because of
28513 improved scheduling and reduced dependencies.
28515 @item -maccumulate-outgoing-args
28516 @opindex maccumulate-outgoing-args
28517 If enabled, the maximum amount of space required for outgoing arguments is
28518 computed in the function prologue.  This is faster on most modern CPUs
28519 because of reduced dependencies, improved scheduling and reduced stack usage
28520 when the preferred stack boundary is not equal to 2.  The drawback is a notable
28521 increase in code size.  This switch implies @option{-mno-push-args}.
28523 @item -mthreads
28524 @opindex mthreads
28525 Support thread-safe exception handling on MinGW.  Programs that rely
28526 on thread-safe exception handling must compile and link all code with the
28527 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
28528 @option{-D_MT}; when linking, it links in a special thread helper library
28529 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28531 @item -mms-bitfields
28532 @itemx -mno-ms-bitfields
28533 @opindex mms-bitfields
28534 @opindex mno-ms-bitfields
28536 Enable/disable bit-field layout compatible with the native Microsoft
28537 Windows compiler.  
28539 If @code{packed} is used on a structure, or if bit-fields are used,
28540 it may be that the Microsoft ABI lays out the structure differently
28541 than the way GCC normally does.  Particularly when moving packed
28542 data between functions compiled with GCC and the native Microsoft compiler
28543 (either via function call or as data in a file), it may be necessary to access
28544 either format.
28546 This option is enabled by default for Microsoft Windows
28547 targets.  This behavior can also be controlled locally by use of variable
28548 or type attributes.  For more information, see @ref{x86 Variable Attributes}
28549 and @ref{x86 Type Attributes}.
28551 The Microsoft structure layout algorithm is fairly simple with the exception
28552 of the bit-field packing.  
28553 The padding and alignment of members of structures and whether a bit-field 
28554 can straddle a storage-unit boundary are determine by these rules:
28556 @enumerate
28557 @item Structure members are stored sequentially in the order in which they are
28558 declared: the first member has the lowest memory address and the last member
28559 the highest.
28561 @item Every data object has an alignment requirement.  The alignment requirement
28562 for all data except structures, unions, and arrays is either the size of the
28563 object or the current packing size (specified with either the
28564 @code{aligned} attribute or the @code{pack} pragma),
28565 whichever is less.  For structures, unions, and arrays,
28566 the alignment requirement is the largest alignment requirement of its members.
28567 Every object is allocated an offset so that:
28569 @smallexample
28570 offset % alignment_requirement == 0
28571 @end smallexample
28573 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28574 unit if the integral types are the same size and if the next bit-field fits
28575 into the current allocation unit without crossing the boundary imposed by the
28576 common alignment requirements of the bit-fields.
28577 @end enumerate
28579 MSVC interprets zero-length bit-fields in the following ways:
28581 @enumerate
28582 @item If a zero-length bit-field is inserted between two bit-fields that
28583 are normally coalesced, the bit-fields are not coalesced.
28585 For example:
28587 @smallexample
28588 struct
28589  @{
28590    unsigned long bf_1 : 12;
28591    unsigned long : 0;
28592    unsigned long bf_2 : 12;
28593  @} t1;
28594 @end smallexample
28596 @noindent
28597 The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
28598 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28600 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28601 alignment of the zero-length bit-field is greater than the member that follows it,
28602 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28604 For example:
28606 @smallexample
28607 struct
28608  @{
28609    char foo : 4;
28610    short : 0;
28611    char bar;
28612  @} t2;
28614 struct
28615  @{
28616    char foo : 4;
28617    short : 0;
28618    double bar;
28619  @} t3;
28620 @end smallexample
28622 @noindent
28623 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28624 Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
28625 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28626 of the structure.
28628 Taking this into account, it is important to note the following:
28630 @enumerate
28631 @item If a zero-length bit-field follows a normal bit-field, the type of the
28632 zero-length bit-field may affect the alignment of the structure as whole. For
28633 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28634 normal bit-field, and is of type short.
28636 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28637 still affect the alignment of the structure:
28639 @smallexample
28640 struct
28641  @{
28642    char foo : 6;
28643    long : 0;
28644  @} t4;
28645 @end smallexample
28647 @noindent
28648 Here, @code{t4} takes up 4 bytes.
28649 @end enumerate
28651 @item Zero-length bit-fields following non-bit-field members are ignored:
28653 @smallexample
28654 struct
28655  @{
28656    char foo;
28657    long : 0;
28658    char bar;
28659  @} t5;
28660 @end smallexample
28662 @noindent
28663 Here, @code{t5} takes up 2 bytes.
28664 @end enumerate
28667 @item -mno-align-stringops
28668 @opindex mno-align-stringops
28669 @opindex malign-stringops
28670 Do not align the destination of inlined string operations.  This switch reduces
28671 code size and improves performance in case the destination is already aligned,
28672 but GCC doesn't know about it.
28674 @item -minline-all-stringops
28675 @opindex minline-all-stringops
28676 By default GCC inlines string operations only when the destination is 
28677 known to be aligned to least a 4-byte boundary.  
28678 This enables more inlining and increases code
28679 size, but may improve performance of code that depends on fast
28680 @code{memcpy} and @code{memset} for short lengths.
28681 The option enables inline expansion of @code{strlen} for all
28682 pointer alignments.
28684 @item -minline-stringops-dynamically
28685 @opindex minline-stringops-dynamically
28686 For string operations of unknown size, use run-time checks with
28687 inline code for small blocks and a library call for large blocks.
28689 @item -mstringop-strategy=@var{alg}
28690 @opindex mstringop-strategy=@var{alg}
28691 Override the internal decision heuristic for the particular algorithm to use
28692 for inlining string operations.  The allowed values for @var{alg} are:
28694 @table @samp
28695 @item rep_byte
28696 @itemx rep_4byte
28697 @itemx rep_8byte
28698 Expand using i386 @code{rep} prefix of the specified size.
28700 @item byte_loop
28701 @itemx loop
28702 @itemx unrolled_loop
28703 Expand into an inline loop.
28705 @item libcall
28706 Always use a library call.
28707 @end table
28709 @item -mmemcpy-strategy=@var{strategy}
28710 @opindex mmemcpy-strategy=@var{strategy}
28711 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28712 should be inlined and what inline algorithm to use when the expected size
28713 of the copy operation is known. @var{strategy} 
28714 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 
28715 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28716 the max byte size with which inline algorithm @var{alg} is allowed.  For the last
28717 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28718 in the list must be specified in increasing order.  The minimal byte size for 
28719 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 
28720 preceding range.
28722 @item -mmemset-strategy=@var{strategy}
28723 @opindex mmemset-strategy=@var{strategy}
28724 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28725 @code{__builtin_memset} expansion.
28727 @item -momit-leaf-frame-pointer
28728 @opindex momit-leaf-frame-pointer
28729 Don't keep the frame pointer in a register for leaf functions.  This
28730 avoids the instructions to save, set up, and restore frame pointers and
28731 makes an extra register available in leaf functions.  The option
28732 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28733 which might make debugging harder.
28735 @item -mtls-direct-seg-refs
28736 @itemx -mno-tls-direct-seg-refs
28737 @opindex mtls-direct-seg-refs
28738 Controls whether TLS variables may be accessed with offsets from the
28739 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28740 or whether the thread base pointer must be added.  Whether or not this
28741 is valid depends on the operating system, and whether it maps the
28742 segment to cover the entire TLS area.
28744 For systems that use the GNU C Library, the default is on.
28746 @item -msse2avx
28747 @itemx -mno-sse2avx
28748 @opindex msse2avx
28749 Specify that the assembler should encode SSE instructions with VEX
28750 prefix.  The option @option{-mavx} turns this on by default.
28752 @item -mfentry
28753 @itemx -mno-fentry
28754 @opindex mfentry
28755 If profiling is active (@option{-pg}), put the profiling
28756 counter call before the prologue.
28757 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28758 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28760 @item -mrecord-mcount
28761 @itemx -mno-record-mcount
28762 @opindex mrecord-mcount
28763 If profiling is active (@option{-pg}), generate a __mcount_loc section
28764 that contains pointers to each profiling call. This is useful for
28765 automatically patching and out calls.
28767 @item -mnop-mcount
28768 @itemx -mno-nop-mcount
28769 @opindex mnop-mcount
28770 If profiling is active (@option{-pg}), generate the calls to
28771 the profiling functions as NOPs. This is useful when they
28772 should be patched in later dynamically. This is likely only
28773 useful together with @option{-mrecord-mcount}.
28775 @item -minstrument-return=@var{type}
28776 @opindex minstrument-return
28777 Instrument function exit in -pg -mfentry instrumented functions with
28778 call to specified function. This only instruments true returns ending
28779 with ret, but not sibling calls ending with jump. Valid types
28780 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28781 or @var{nop5} to generate a 5 byte nop.
28783 @item -mrecord-return
28784 @itemx -mno-record-return
28785 @opindex mrecord-return
28786 Generate a __return_loc section pointing to all return instrumentation code.
28788 @item -mfentry-name=@var{name}
28789 @opindex mfentry-name
28790 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28792 @item -mfentry-section=@var{name}
28793 @opindex mfentry-section
28794 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28796 @item -mskip-rax-setup
28797 @itemx -mno-skip-rax-setup
28798 @opindex mskip-rax-setup
28799 When generating code for the x86-64 architecture with SSE extensions
28800 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28801 register when there are no variable arguments passed in vector registers.
28803 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28804 saving vector registers on stack when passing variable arguments, the
28805 impacts of this option are callees may waste some stack space,
28806 misbehave or jump to a random location.  GCC 4.4 or newer don't have
28807 those issues, regardless the RAX register value.
28809 @item -m8bit-idiv
28810 @itemx -mno-8bit-idiv
28811 @opindex m8bit-idiv
28812 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28813 much faster than 32-bit/64-bit integer divide.  This option generates a
28814 run-time check.  If both dividend and divisor are within range of 0
28815 to 255, 8-bit unsigned integer divide is used instead of
28816 32-bit/64-bit integer divide.
28818 @item -mavx256-split-unaligned-load
28819 @itemx -mavx256-split-unaligned-store
28820 @opindex mavx256-split-unaligned-load
28821 @opindex mavx256-split-unaligned-store
28822 Split 32-byte AVX unaligned load and store.
28824 @item -mstack-protector-guard=@var{guard}
28825 @itemx -mstack-protector-guard-reg=@var{reg}
28826 @itemx -mstack-protector-guard-offset=@var{offset}
28827 @opindex mstack-protector-guard
28828 @opindex mstack-protector-guard-reg
28829 @opindex mstack-protector-guard-offset
28830 Generate stack protection code using canary at @var{guard}.  Supported
28831 locations are @samp{global} for global canary or @samp{tls} for per-thread
28832 canary in the TLS block (the default).  This option has effect only when
28833 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28835 With the latter choice the options
28836 @option{-mstack-protector-guard-reg=@var{reg}} and
28837 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28838 which segment register (@code{%fs} or @code{%gs}) to use as base register
28839 for reading the canary, and from what offset from that base register.
28840 The default for those is as specified in the relevant ABI.
28842 @item -mgeneral-regs-only
28843 @opindex mgeneral-regs-only
28844 Generate code that uses only the general-purpose registers.  This
28845 prevents the compiler from using floating-point, vector, mask and bound
28846 registers.
28848 @item -mindirect-branch=@var{choice}
28849 @opindex mindirect-branch
28850 Convert indirect call and jump with @var{choice}.  The default is
28851 @samp{keep}, which keeps indirect call and jump unmodified.
28852 @samp{thunk} converts indirect call and jump to call and return thunk.
28853 @samp{thunk-inline} converts indirect call and jump to inlined call
28854 and return thunk.  @samp{thunk-extern} converts indirect call and jump
28855 to external call and return thunk provided in a separate object file.
28856 You can control this behavior for a specific function by using the
28857 function attribute @code{indirect_branch}.  @xref{Function Attributes}.
28859 Note that @option{-mcmodel=large} is incompatible with
28860 @option{-mindirect-branch=thunk} and
28861 @option{-mindirect-branch=thunk-extern} since the thunk function may
28862 not be reachable in the large code model.
28864 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28865 @option{-fcf-protection=branch} since the external thunk cannot be modified
28866 to disable control-flow check.
28868 @item -mfunction-return=@var{choice}
28869 @opindex mfunction-return
28870 Convert function return with @var{choice}.  The default is @samp{keep},
28871 which keeps function return unmodified.  @samp{thunk} converts function
28872 return to call and return thunk.  @samp{thunk-inline} converts function
28873 return to inlined call and return thunk.  @samp{thunk-extern} converts
28874 function return to external call and return thunk provided in a separate
28875 object file.  You can control this behavior for a specific function by
28876 using the function attribute @code{function_return}.
28877 @xref{Function Attributes}.
28879 Note that @option{-mcmodel=large} is incompatible with
28880 @option{-mfunction-return=thunk} and
28881 @option{-mfunction-return=thunk-extern} since the thunk function may
28882 not be reachable in the large code model.
28885 @item -mindirect-branch-register
28886 @opindex mindirect-branch-register
28887 Force indirect call and jump via register.
28889 @end table
28891 These @samp{-m} switches are supported in addition to the above
28892 on x86-64 processors in 64-bit environments.
28894 @table @gcctabopt
28895 @item -m32
28896 @itemx -m64
28897 @itemx -mx32
28898 @itemx -m16
28899 @itemx -miamcu
28900 @opindex m32
28901 @opindex m64
28902 @opindex mx32
28903 @opindex m16
28904 @opindex miamcu
28905 Generate code for a 16-bit, 32-bit or 64-bit environment.
28906 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28907 to 32 bits, and
28908 generates code that runs on any i386 system.
28910 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28911 types to 64 bits, and generates code for the x86-64 architecture.
28912 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28913 and @option{-mdynamic-no-pic} options.
28915 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28916 to 32 bits, and
28917 generates code for the x86-64 architecture.
28919 The @option{-m16} option is the same as @option{-m32}, except for that
28920 it outputs the @code{.code16gcc} assembly directive at the beginning of
28921 the assembly output so that the binary can run in 16-bit mode.
28923 The @option{-miamcu} option generates code which conforms to Intel MCU
28924 psABI.  It requires the @option{-m32} option to be turned on.
28926 @item -mno-red-zone
28927 @opindex mno-red-zone
28928 @opindex mred-zone
28929 Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
28930 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28931 stack pointer that is not modified by signal or interrupt handlers
28932 and therefore can be used for temporary data without adjusting the stack
28933 pointer.  The flag @option{-mno-red-zone} disables this red zone.
28935 @item -mcmodel=small
28936 @opindex mcmodel=small
28937 Generate code for the small code model: the program and its symbols must
28938 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
28939 Programs can be statically or dynamically linked.  This is the default
28940 code model.
28942 @item -mcmodel=kernel
28943 @opindex mcmodel=kernel
28944 Generate code for the kernel code model.  The kernel runs in the
28945 negative 2 GB of the address space.
28946 This model has to be used for Linux kernel code.
28948 @item -mcmodel=medium
28949 @opindex mcmodel=medium
28950 Generate code for the medium model: the program is linked in the lower 2
28951 GB of the address space.  Small symbols are also placed there.  Symbols
28952 with sizes larger than @option{-mlarge-data-threshold} are put into
28953 large data or BSS sections and can be located above 2GB.  Programs can
28954 be statically or dynamically linked.
28956 @item -mcmodel=large
28957 @opindex mcmodel=large
28958 Generate code for the large model.  This model makes no assumptions
28959 about addresses and sizes of sections.
28961 @item -maddress-mode=long
28962 @opindex maddress-mode=long
28963 Generate code for long address mode.  This is only supported for 64-bit
28964 and x32 environments.  It is the default address mode for 64-bit
28965 environments.
28967 @item -maddress-mode=short
28968 @opindex maddress-mode=short
28969 Generate code for short address mode.  This is only supported for 32-bit
28970 and x32 environments.  It is the default address mode for 32-bit and
28971 x32 environments.
28972 @end table
28974 @node x86 Windows Options
28975 @subsection x86 Windows Options
28976 @cindex x86 Windows Options
28977 @cindex Windows Options for x86
28979 These additional options are available for Microsoft Windows targets:
28981 @table @gcctabopt
28982 @item -mconsole
28983 @opindex mconsole
28984 This option
28985 specifies that a console application is to be generated, by
28986 instructing the linker to set the PE header subsystem type
28987 required for console applications.
28988 This option is available for Cygwin and MinGW targets and is
28989 enabled by default on those targets.
28991 @item -mdll
28992 @opindex mdll
28993 This option is available for Cygwin and MinGW targets.  It
28994 specifies that a DLL---a dynamic link library---is to be
28995 generated, enabling the selection of the required runtime
28996 startup object and entry point.
28998 @item -mnop-fun-dllimport
28999 @opindex mnop-fun-dllimport
29000 This option is available for Cygwin and MinGW targets.  It
29001 specifies that the @code{dllimport} attribute should be ignored.
29003 @item -mthread
29004 @opindex mthread
29005 This option is available for MinGW targets. It specifies
29006 that MinGW-specific thread support is to be used.
29008 @item -municode
29009 @opindex municode
29010 This option is available for MinGW-w64 targets.  It causes
29011 the @code{UNICODE} preprocessor macro to be predefined, and
29012 chooses Unicode-capable runtime startup code.
29014 @item -mwin32
29015 @opindex mwin32
29016 This option is available for Cygwin and MinGW targets.  It
29017 specifies that the typical Microsoft Windows predefined macros are to
29018 be set in the pre-processor, but does not influence the choice
29019 of runtime library/startup code.
29021 @item -mwindows
29022 @opindex mwindows
29023 This option is available for Cygwin and MinGW targets.  It
29024 specifies that a GUI application is to be generated by
29025 instructing the linker to set the PE header subsystem type
29026 appropriately.
29028 @item -fno-set-stack-executable
29029 @opindex fno-set-stack-executable
29030 @opindex fset-stack-executable
29031 This option is available for MinGW targets. It specifies that
29032 the executable flag for the stack used by nested functions isn't
29033 set. This is necessary for binaries running in kernel mode of
29034 Microsoft Windows, as there the User32 API, which is used to set executable
29035 privileges, isn't available.
29037 @item -fwritable-relocated-rdata
29038 @opindex fno-writable-relocated-rdata
29039 @opindex fwritable-relocated-rdata
29040 This option is available for MinGW and Cygwin targets.  It specifies
29041 that relocated-data in read-only section is put into the @code{.data}
29042 section.  This is a necessary for older runtimes not supporting
29043 modification of @code{.rdata} sections for pseudo-relocation.
29045 @item -mpe-aligned-commons
29046 @opindex mpe-aligned-commons
29047 This option is available for Cygwin and MinGW targets.  It
29048 specifies that the GNU extension to the PE file format that
29049 permits the correct alignment of COMMON variables should be
29050 used when generating code.  It is enabled by default if
29051 GCC detects that the target assembler found during configuration
29052 supports the feature.
29053 @end table
29055 See also under @ref{x86 Options} for standard options.
29057 @node Xstormy16 Options
29058 @subsection Xstormy16 Options
29059 @cindex Xstormy16 Options
29061 These options are defined for Xstormy16:
29063 @table @gcctabopt
29064 @item -msim
29065 @opindex msim
29066 Choose startup files and linker script suitable for the simulator.
29067 @end table
29069 @node Xtensa Options
29070 @subsection Xtensa Options
29071 @cindex Xtensa Options
29073 These options are supported for Xtensa targets:
29075 @table @gcctabopt
29076 @item -mconst16
29077 @itemx -mno-const16
29078 @opindex mconst16
29079 @opindex mno-const16
29080 Enable or disable use of @code{CONST16} instructions for loading
29081 constant values.  The @code{CONST16} instruction is currently not a
29082 standard option from Tensilica.  When enabled, @code{CONST16}
29083 instructions are always used in place of the standard @code{L32R}
29084 instructions.  The use of @code{CONST16} is enabled by default only if
29085 the @code{L32R} instruction is not available.
29087 @item -mfused-madd
29088 @itemx -mno-fused-madd
29089 @opindex mfused-madd
29090 @opindex mno-fused-madd
29091 Enable or disable use of fused multiply/add and multiply/subtract
29092 instructions in the floating-point option.  This has no effect if the
29093 floating-point option is not also enabled.  Disabling fused multiply/add
29094 and multiply/subtract instructions forces the compiler to use separate
29095 instructions for the multiply and add/subtract operations.  This may be
29096 desirable in some cases where strict IEEE 754-compliant results are
29097 required: the fused multiply add/subtract instructions do not round the
29098 intermediate result, thereby producing results with @emph{more} bits of
29099 precision than specified by the IEEE standard.  Disabling fused multiply
29100 add/subtract instructions also ensures that the program output is not
29101 sensitive to the compiler's ability to combine multiply and add/subtract
29102 operations.
29104 @item -mserialize-volatile
29105 @itemx -mno-serialize-volatile
29106 @opindex mserialize-volatile
29107 @opindex mno-serialize-volatile
29108 When this option is enabled, GCC inserts @code{MEMW} instructions before
29109 @code{volatile} memory references to guarantee sequential consistency.
29110 The default is @option{-mserialize-volatile}.  Use
29111 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29113 @item -mforce-no-pic
29114 @opindex mforce-no-pic
29115 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29116 position-independent code (PIC), this option disables PIC for compiling
29117 kernel code.
29119 @item -mtext-section-literals
29120 @itemx -mno-text-section-literals
29121 @opindex mtext-section-literals
29122 @opindex mno-text-section-literals
29123 These options control the treatment of literal pools.  The default is
29124 @option{-mno-text-section-literals}, which places literals in a separate
29125 section in the output file.  This allows the literal pool to be placed
29126 in a data RAM/ROM, and it also allows the linker to combine literal
29127 pools from separate object files to remove redundant literals and
29128 improve code size.  With @option{-mtext-section-literals}, the literals
29129 are interspersed in the text section in order to keep them as close as
29130 possible to their references.  This may be necessary for large assembly
29131 files.  Literals for each function are placed right before that function.
29133 @item -mauto-litpools
29134 @itemx -mno-auto-litpools
29135 @opindex mauto-litpools
29136 @opindex mno-auto-litpools
29137 These options control the treatment of literal pools.  The default is
29138 @option{-mno-auto-litpools}, which places literals in a separate
29139 section in the output file unless @option{-mtext-section-literals} is
29140 used.  With @option{-mauto-litpools} the literals are interspersed in
29141 the text section by the assembler.  Compiler does not produce explicit
29142 @code{.literal} directives and loads literals into registers with
29143 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29144 do relaxation and place literals as necessary.  This option allows
29145 assembler to create several literal pools per function and assemble
29146 very big functions, which may not be possible with
29147 @option{-mtext-section-literals}.
29149 @item -mtarget-align
29150 @itemx -mno-target-align
29151 @opindex mtarget-align
29152 @opindex mno-target-align
29153 When this option is enabled, GCC instructs the assembler to
29154 automatically align instructions to reduce branch penalties at the
29155 expense of some code density.  The assembler attempts to widen density
29156 instructions to align branch targets and the instructions following call
29157 instructions.  If there are not enough preceding safe density
29158 instructions to align a target, no widening is performed.  The
29159 default is @option{-mtarget-align}.  These options do not affect the
29160 treatment of auto-aligned instructions like @code{LOOP}, which the
29161 assembler always aligns, either by widening density instructions or
29162 by inserting NOP instructions.
29164 @item -mlongcalls
29165 @itemx -mno-longcalls
29166 @opindex mlongcalls
29167 @opindex mno-longcalls
29168 When this option is enabled, GCC instructs the assembler to translate
29169 direct calls to indirect calls unless it can determine that the target
29170 of a direct call is in the range allowed by the call instruction.  This
29171 translation typically occurs for calls to functions in other source
29172 files.  Specifically, the assembler translates a direct @code{CALL}
29173 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29174 The default is @option{-mno-longcalls}.  This option should be used in
29175 programs where the call target can potentially be out of range.  This
29176 option is implemented in the assembler, not the compiler, so the
29177 assembly code generated by GCC still shows direct call
29178 instructions---look at the disassembled object code to see the actual
29179 instructions.  Note that the assembler uses an indirect call for
29180 every cross-file call, not just those that really are out of range.
29181 @end table
29183 @node zSeries Options
29184 @subsection zSeries Options
29185 @cindex zSeries options
29187 These are listed under @xref{S/390 and zSeries Options}.
29190 @c man end
29192 @node Spec Files
29193 @section Specifying Subprocesses and the Switches to Pass to Them
29194 @cindex Spec Files
29196 @command{gcc} is a driver program.  It performs its job by invoking a
29197 sequence of other programs to do the work of compiling, assembling and
29198 linking.  GCC interprets its command-line parameters and uses these to
29199 deduce which programs it should invoke, and which command-line options
29200 it ought to place on their command lines.  This behavior is controlled
29201 by @dfn{spec strings}.  In most cases there is one spec string for each
29202 program that GCC can invoke, but a few programs have multiple spec
29203 strings to control their behavior.  The spec strings built into GCC can
29204 be overridden by using the @option{-specs=} command-line switch to specify
29205 a spec file.
29207 @dfn{Spec files} are plain-text files that are used to construct spec
29208 strings.  They consist of a sequence of directives separated by blank
29209 lines.  The type of directive is determined by the first non-whitespace
29210 character on the line, which can be one of the following:
29212 @table @code
29213 @item %@var{command}
29214 Issues a @var{command} to the spec file processor.  The commands that can
29215 appear here are:
29217 @table @code
29218 @item %include <@var{file}>
29219 @cindex @code{%include}
29220 Search for @var{file} and insert its text at the current point in the
29221 specs file.
29223 @item %include_noerr <@var{file}>
29224 @cindex @code{%include_noerr}
29225 Just like @samp{%include}, but do not generate an error message if the include
29226 file cannot be found.
29228 @item %rename @var{old_name} @var{new_name}
29229 @cindex @code{%rename}
29230 Rename the spec string @var{old_name} to @var{new_name}.
29232 @end table
29234 @item *[@var{spec_name}]:
29235 This tells the compiler to create, override or delete the named spec
29236 string.  All lines after this directive up to the next directive or
29237 blank line are considered to be the text for the spec string.  If this
29238 results in an empty string then the spec is deleted.  (Or, if the
29239 spec did not exist, then nothing happens.)  Otherwise, if the spec
29240 does not currently exist a new spec is created.  If the spec does
29241 exist then its contents are overridden by the text of this
29242 directive, unless the first character of that text is the @samp{+}
29243 character, in which case the text is appended to the spec.
29245 @item [@var{suffix}]:
29246 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
29247 and up to the next directive or blank line are considered to make up the
29248 spec string for the indicated suffix.  When the compiler encounters an
29249 input file with the named suffix, it processes the spec string in
29250 order to work out how to compile that file.  For example:
29252 @smallexample
29253 .ZZ:
29254 z-compile -input %i
29255 @end smallexample
29257 This says that any input file whose name ends in @samp{.ZZ} should be
29258 passed to the program @samp{z-compile}, which should be invoked with the
29259 command-line switch @option{-input} and with the result of performing the
29260 @samp{%i} substitution.  (See below.)
29262 As an alternative to providing a spec string, the text following a
29263 suffix directive can be one of the following:
29265 @table @code
29266 @item @@@var{language}
29267 This says that the suffix is an alias for a known @var{language}.  This is
29268 similar to using the @option{-x} command-line switch to GCC to specify a
29269 language explicitly.  For example:
29271 @smallexample
29272 .ZZ:
29273 @@c++
29274 @end smallexample
29276 Says that .ZZ files are, in fact, C++ source files.
29278 @item #@var{name}
29279 This causes an error messages saying:
29281 @smallexample
29282 @var{name} compiler not installed on this system.
29283 @end smallexample
29284 @end table
29286 GCC already has an extensive list of suffixes built into it.
29287 This directive adds an entry to the end of the list of suffixes, but
29288 since the list is searched from the end backwards, it is effectively
29289 possible to override earlier entries using this technique.
29291 @end table
29293 GCC has the following spec strings built into it.  Spec files can
29294 override these strings or create their own.  Note that individual
29295 targets can also add their own spec strings to this list.
29297 @smallexample
29298 asm          Options to pass to the assembler
29299 asm_final    Options to pass to the assembler post-processor
29300 cpp          Options to pass to the C preprocessor
29301 cc1          Options to pass to the C compiler
29302 cc1plus      Options to pass to the C++ compiler
29303 endfile      Object files to include at the end of the link
29304 link         Options to pass to the linker
29305 lib          Libraries to include on the command line to the linker
29306 libgcc       Decides which GCC support library to pass to the linker
29307 linker       Sets the name of the linker
29308 predefines   Defines to be passed to the C preprocessor
29309 signed_char  Defines to pass to CPP to say whether @code{char} is signed
29310              by default
29311 startfile    Object files to include at the start of the link
29312 @end smallexample
29314 Here is a small example of a spec file:
29316 @smallexample
29317 %rename lib                 old_lib
29319 *lib:
29320 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29321 @end smallexample
29323 This example renames the spec called @samp{lib} to @samp{old_lib} and
29324 then overrides the previous definition of @samp{lib} with a new one.
29325 The new definition adds in some extra command-line options before
29326 including the text of the old definition.
29328 @dfn{Spec strings} are a list of command-line options to be passed to their
29329 corresponding program.  In addition, the spec strings can contain
29330 @samp{%}-prefixed sequences to substitute variable text or to
29331 conditionally insert text into the command line.  Using these constructs
29332 it is possible to generate quite complex command lines.
29334 Here is a table of all defined @samp{%}-sequences for spec
29335 strings.  Note that spaces are not generated automatically around the
29336 results of expanding these sequences.  Therefore you can concatenate them
29337 together or combine them with constant text in a single argument.
29339 @table @code
29340 @item %%
29341 Substitute one @samp{%} into the program name or argument.
29343 @item %i
29344 Substitute the name of the input file being processed.
29346 @item %b
29347 Substitute the basename of the input file being processed.
29348 This is the substring up to (and not including) the last period
29349 and not including the directory.
29351 @item %B
29352 This is the same as @samp{%b}, but include the file suffix (text after
29353 the last period).
29355 @item %d
29356 Marks the argument containing or following the @samp{%d} as a
29357 temporary file name, so that that file is deleted if GCC exits
29358 successfully.  Unlike @samp{%g}, this contributes no text to the
29359 argument.
29361 @item %g@var{suffix}
29362 Substitute a file name that has suffix @var{suffix} and is chosen
29363 once per compilation, and mark the argument in the same way as
29364 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
29365 name is now chosen in a way that is hard to predict even when previously
29366 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29367 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
29368 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29369 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
29370 was simply substituted with a file name chosen once per compilation,
29371 without regard to any appended suffix (which was therefore treated
29372 just like ordinary text), making such attacks more likely to succeed.
29374 @item %u@var{suffix}
29375 Like @samp{%g}, but generates a new temporary file name
29376 each time it appears instead of once per compilation.
29378 @item %U@var{suffix}
29379 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29380 new one if there is no such last file name.  In the absence of any
29381 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29382 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29383 involves the generation of two distinct file names, one
29384 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
29385 simply substituted with a file name chosen for the previous @samp{%u},
29386 without regard to any appended suffix.
29388 @item %j@var{suffix}
29389 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29390 writable, and if @option{-save-temps} is not used; 
29391 otherwise, substitute the name
29392 of a temporary file, just like @samp{%u}.  This temporary file is not
29393 meant for communication between processes, but rather as a junk
29394 disposal mechanism.
29396 @item %|@var{suffix}
29397 @itemx %m@var{suffix}
29398 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
29399 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29400 all.  These are the two most common ways to instruct a program that it
29401 should read from standard input or write to standard output.  If you
29402 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29403 construct: see for example @file{gcc/fortran/lang-specs.h}.
29405 @item %.@var{SUFFIX}
29406 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29407 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
29408 terminated by the next space or %.
29410 @item %w
29411 Marks the argument containing or following the @samp{%w} as the
29412 designated output file of this compilation.  This puts the argument
29413 into the sequence of arguments that @samp{%o} substitutes.
29415 @item %o
29416 Substitutes the names of all the output files, with spaces
29417 automatically placed around them.  You should write spaces
29418 around the @samp{%o} as well or the results are undefined.
29419 @samp{%o} is for use in the specs for running the linker.
29420 Input files whose names have no recognized suffix are not compiled
29421 at all, but they are included among the output files, so they are
29422 linked.
29424 @item %O
29425 Substitutes the suffix for object files.  Note that this is
29426 handled specially when it immediately follows @samp{%g, %u, or %U},
29427 because of the need for those to form complete file names.  The
29428 handling is such that @samp{%O} is treated exactly as if it had already
29429 been substituted, except that @samp{%g, %u, and %U} do not currently
29430 support additional @var{suffix} characters following @samp{%O} as they do
29431 following, for example, @samp{.o}.
29433 @item %p
29434 Substitutes the standard macro predefinitions for the
29435 current target machine.  Use this when running @command{cpp}.
29437 @item %P
29438 Like @samp{%p}, but puts @samp{__} before and after the name of each
29439 predefined macro, except for macros that start with @samp{__} or with
29440 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
29443 @item %I
29444 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29445 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29446 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29447 and @option{-imultilib} as necessary.
29449 @item %s
29450 Current argument is the name of a library or startup file of some sort.
29451 Search for that file in a standard list of directories and substitute
29452 the full name found.  The current working directory is included in the
29453 list of directories scanned.
29455 @item %T
29456 Current argument is the name of a linker script.  Search for that file
29457 in the current list of directories to scan for libraries. If the file
29458 is located insert a @option{--script} option into the command line
29459 followed by the full path name found.  If the file is not found then
29460 generate an error message.  Note: the current working directory is not
29461 searched.
29463 @item %e@var{str}
29464 Print @var{str} as an error message.  @var{str} is terminated by a newline.
29465 Use this when inconsistent options are detected.
29467 @item %(@var{name})
29468 Substitute the contents of spec string @var{name} at this point.
29470 @item %x@{@var{option}@}
29471 Accumulate an option for @samp{%X}.
29473 @item %X
29474 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29475 spec string.
29477 @item %Y
29478 Output the accumulated assembler options specified by @option{-Wa}.
29480 @item %Z
29481 Output the accumulated preprocessor options specified by @option{-Wp}.
29483 @item %a
29484 Process the @code{asm} spec.  This is used to compute the
29485 switches to be passed to the assembler.
29487 @item %A
29488 Process the @code{asm_final} spec.  This is a spec string for
29489 passing switches to an assembler post-processor, if such a program is
29490 needed.
29492 @item %l
29493 Process the @code{link} spec.  This is the spec for computing the
29494 command line passed to the linker.  Typically it makes use of the
29495 @samp{%L %G %S %D and %E} sequences.
29497 @item %D
29498 Dump out a @option{-L} option for each directory that GCC believes might
29499 contain startup files.  If the target supports multilibs then the
29500 current multilib directory is prepended to each of these paths.
29502 @item %L
29503 Process the @code{lib} spec.  This is a spec string for deciding which
29504 libraries are included on the command line to the linker.
29506 @item %G
29507 Process the @code{libgcc} spec.  This is a spec string for deciding
29508 which GCC support library is included on the command line to the linker.
29510 @item %S
29511 Process the @code{startfile} spec.  This is a spec for deciding which
29512 object files are the first ones passed to the linker.  Typically
29513 this might be a file named @file{crt0.o}.
29515 @item %E
29516 Process the @code{endfile} spec.  This is a spec string that specifies
29517 the last object files that are passed to the linker.
29519 @item %C
29520 Process the @code{cpp} spec.  This is used to construct the arguments
29521 to be passed to the C preprocessor.
29523 @item %1
29524 Process the @code{cc1} spec.  This is used to construct the options to be
29525 passed to the actual C compiler (@command{cc1}).
29527 @item %2
29528 Process the @code{cc1plus} spec.  This is used to construct the options to be
29529 passed to the actual C++ compiler (@command{cc1plus}).
29531 @item %*
29532 Substitute the variable part of a matched option.  See below.
29533 Note that each comma in the substituted string is replaced by
29534 a single space.
29536 @item %<S
29537 Remove all occurrences of @code{-S} from the command line.  Note---this
29538 command is position dependent.  @samp{%} commands in the spec string
29539 before this one see @code{-S}, @samp{%} commands in the spec string
29540 after this one do not.
29542 @item %:@var{function}(@var{args})
29543 Call the named function @var{function}, passing it @var{args}.
29544 @var{args} is first processed as a nested spec string, then split
29545 into an argument vector in the usual fashion.  The function returns
29546 a string which is processed as if it had appeared literally as part
29547 of the current spec.
29549 The following built-in spec functions are provided:
29551 @table @code
29552 @item @code{getenv}
29553 The @code{getenv} spec function takes two arguments: an environment
29554 variable name and a string.  If the environment variable is not
29555 defined, a fatal error is issued.  Otherwise, the return value is the
29556 value of the environment variable concatenated with the string.  For
29557 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29559 @smallexample
29560 %:getenv(TOPDIR /include)
29561 @end smallexample
29563 expands to @file{/path/to/top/include}.
29565 @item @code{if-exists}
29566 The @code{if-exists} spec function takes one argument, an absolute
29567 pathname to a file.  If the file exists, @code{if-exists} returns the
29568 pathname.  Here is a small example of its usage:
29570 @smallexample
29571 *startfile:
29572 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29573 @end smallexample
29575 @item @code{if-exists-else}
29576 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29577 spec function, except that it takes two arguments.  The first argument is
29578 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
29579 returns the pathname.  If it does not exist, it returns the second argument.
29580 This way, @code{if-exists-else} can be used to select one file or another,
29581 based on the existence of the first.  Here is a small example of its usage:
29583 @smallexample
29584 *startfile:
29585 crt0%O%s %:if-exists(crti%O%s) \
29586 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29587 @end smallexample
29589 @item @code{replace-outfile}
29590 The @code{replace-outfile} spec function takes two arguments.  It looks for the
29591 first argument in the outfiles array and replaces it with the second argument.  Here
29592 is a small example of its usage:
29594 @smallexample
29595 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29596 @end smallexample
29598 @item @code{remove-outfile}
29599 The @code{remove-outfile} spec function takes one argument.  It looks for the
29600 first argument in the outfiles array and removes it.  Here is a small example
29601 its usage:
29603 @smallexample
29604 %:remove-outfile(-lm)
29605 @end smallexample
29607 @item @code{pass-through-libs}
29608 The @code{pass-through-libs} spec function takes any number of arguments.  It
29609 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29610 assumes are the names of linker input library archive files) and returns a
29611 result containing all the found arguments each prepended by
29612 @option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
29613 intended to be passed to the LTO linker plugin.
29615 @smallexample
29616 %:pass-through-libs(%G %L %G)
29617 @end smallexample
29619 @item @code{print-asm-header}
29620 The @code{print-asm-header} function takes no arguments and simply
29621 prints a banner like:
29623 @smallexample
29624 Assembler options
29625 =================
29627 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29628 @end smallexample
29630 It is used to separate compiler options from assembler options
29631 in the @option{--target-help} output.
29632 @end table
29634 @item %@{S@}
29635 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29636 If that switch is not specified, this substitutes nothing.  Note that
29637 the leading dash is omitted when specifying this option, and it is
29638 automatically inserted if the substitution is performed.  Thus the spec
29639 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29640 and outputs the command-line option @option{-foo}.
29642 @item %W@{S@}
29643 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29644 deleted on failure.
29646 @item %@{S*@}
29647 Substitutes all the switches specified to GCC whose names start
29648 with @code{-S}, but which also take an argument.  This is used for
29649 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29650 GCC considers @option{-o foo} as being
29651 one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
29652 text, including the space.  Thus two arguments are generated.
29654 @item %@{S*&T*@}
29655 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29656 (the order of @code{S} and @code{T} in the spec is not significant).
29657 There can be any number of ampersand-separated variables; for each the
29658 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
29660 @item %@{S:X@}
29661 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29663 @item %@{!S:X@}
29664 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29666 @item %@{S*:X@}
29667 Substitutes @code{X} if one or more switches whose names start with
29668 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
29669 once, no matter how many such switches appeared.  However, if @code{%*}
29670 appears somewhere in @code{X}, then @code{X} is substituted once
29671 for each matching switch, with the @code{%*} replaced by the part of
29672 that switch matching the @code{*}.
29674 If @code{%*} appears as the last part of a spec sequence then a space
29675 is added after the end of the last substitution.  If there is more
29676 text in the sequence, however, then a space is not generated.  This
29677 allows the @code{%*} substitution to be used as part of a larger
29678 string.  For example, a spec string like this:
29680 @smallexample
29681 %@{mcu=*:--script=%*/memory.ld@}
29682 @end smallexample
29684 @noindent
29685 when matching an option like @option{-mcu=newchip} produces:
29687 @smallexample
29688 --script=newchip/memory.ld
29689 @end smallexample
29691 @item %@{.S:X@}
29692 Substitutes @code{X}, if processing a file with suffix @code{S}.
29694 @item %@{!.S:X@}
29695 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29697 @item %@{,S:X@}
29698 Substitutes @code{X}, if processing a file for language @code{S}.
29700 @item %@{!,S:X@}
29701 Substitutes @code{X}, if not processing a file for language @code{S}.
29703 @item %@{S|P:X@}
29704 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29705 GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29706 @code{*} sequences as well, although they have a stronger binding than
29707 the @samp{|}.  If @code{%*} appears in @code{X}, all of the
29708 alternatives must be starred, and only the first matching alternative
29709 is substituted.
29711 For example, a spec string like this:
29713 @smallexample
29714 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29715 @end smallexample
29717 @noindent
29718 outputs the following command-line options from the following input
29719 command-line options:
29721 @smallexample
29722 fred.c        -foo -baz
29723 jim.d         -bar -boggle
29724 -d fred.c     -foo -baz -boggle
29725 -d jim.d      -bar -baz -boggle
29726 @end smallexample
29728 @item %@{S:X; T:Y; :D@}
29730 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29731 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
29732 be as many clauses as you need.  This may be combined with @code{.},
29733 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29736 @end table
29738 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29739 or similar construct can use a backslash to ignore the special meaning
29740 of the character following it, thus allowing literal matching of a
29741 character that is otherwise specially treated.  For example,
29742 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29743 @option{-std=iso9899:1999} option is given.
29745 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29746 construct may contain other nested @samp{%} constructs or spaces, or
29747 even newlines.  They are processed as usual, as described above.
29748 Trailing white space in @code{X} is ignored.  White space may also
29749 appear anywhere on the left side of the colon in these constructs,
29750 except between @code{.} or @code{*} and the corresponding word.
29752 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29753 handled specifically in these constructs.  If another value of
29754 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29755 @option{-W} switch is found later in the command line, the earlier
29756 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29757 just one letter, which passes all matching options.
29759 The character @samp{|} at the beginning of the predicate text is used to
29760 indicate that a command should be piped to the following command, but
29761 only if @option{-pipe} is specified.
29763 It is built into GCC which switches take arguments and which do not.
29764 (You might think it would be useful to generalize this to allow each
29765 compiler's spec to say which switches take arguments.  But this cannot
29766 be done in a consistent fashion.  GCC cannot even decide which input
29767 files have been specified without knowing which switches take arguments,
29768 and it must know which input files to compile in order to tell which
29769 compilers to run).
29771 GCC also knows implicitly that arguments starting in @option{-l} are to be
29772 treated as compiler output files, and passed to the linker in their
29773 proper position among the other output files.
29775 @node Environment Variables
29776 @section Environment Variables Affecting GCC
29777 @cindex environment variables
29779 @c man begin ENVIRONMENT
29780 This section describes several environment variables that affect how GCC
29781 operates.  Some of them work by specifying directories or prefixes to use
29782 when searching for various kinds of files.  Some are used to specify other
29783 aspects of the compilation environment.
29785 Note that you can also specify places to search using options such as
29786 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
29787 take precedence over places specified using environment variables, which
29788 in turn take precedence over those specified by the configuration of GCC@.
29789 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29790 GNU Compiler Collection (GCC) Internals}.
29792 @table @env
29793 @item LANG
29794 @itemx LC_CTYPE
29795 @c @itemx LC_COLLATE
29796 @itemx LC_MESSAGES
29797 @c @itemx LC_MONETARY
29798 @c @itemx LC_NUMERIC
29799 @c @itemx LC_TIME
29800 @itemx LC_ALL
29801 @findex LANG
29802 @findex LC_CTYPE
29803 @c @findex LC_COLLATE
29804 @findex LC_MESSAGES
29805 @c @findex LC_MONETARY
29806 @c @findex LC_NUMERIC
29807 @c @findex LC_TIME
29808 @findex LC_ALL
29809 @cindex locale
29810 These environment variables control the way that GCC uses
29811 localization information which allows GCC to work with different
29812 national conventions.  GCC inspects the locale categories
29813 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29814 so.  These locale categories can be set to any value supported by your
29815 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
29816 Kingdom encoded in UTF-8.
29818 The @env{LC_CTYPE} environment variable specifies character
29819 classification.  GCC uses it to determine the character boundaries in
29820 a string; this is needed for some multibyte encodings that contain quote
29821 and escape characters that are otherwise interpreted as a string
29822 end or escape.
29824 The @env{LC_MESSAGES} environment variable specifies the language to
29825 use in diagnostic messages.
29827 If the @env{LC_ALL} environment variable is set, it overrides the value
29828 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29829 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29830 environment variable.  If none of these variables are set, GCC
29831 defaults to traditional C English behavior.
29833 @item TMPDIR
29834 @findex TMPDIR
29835 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29836 files.  GCC uses temporary files to hold the output of one stage of
29837 compilation which is to be used as input to the next stage: for example,
29838 the output of the preprocessor, which is the input to the compiler
29839 proper.
29841 @item GCC_COMPARE_DEBUG
29842 @findex GCC_COMPARE_DEBUG
29843 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29844 @option{-fcompare-debug} to the compiler driver.  See the documentation
29845 of this option for more details.
29847 @item GCC_EXEC_PREFIX
29848 @findex GCC_EXEC_PREFIX
29849 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29850 names of the subprograms executed by the compiler.  No slash is added
29851 when this prefix is combined with the name of a subprogram, but you can
29852 specify a prefix that ends with a slash if you wish.
29854 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29855 an appropriate prefix to use based on the pathname it is invoked with.
29857 If GCC cannot find the subprogram using the specified prefix, it
29858 tries looking in the usual places for the subprogram.
29860 The default value of @env{GCC_EXEC_PREFIX} is
29861 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29862 the installed compiler. In many cases @var{prefix} is the value
29863 of @code{prefix} when you ran the @file{configure} script.
29865 Other prefixes specified with @option{-B} take precedence over this prefix.
29867 This prefix is also used for finding files such as @file{crt0.o} that are
29868 used for linking.
29870 In addition, the prefix is used in an unusual way in finding the
29871 directories to search for header files.  For each of the standard
29872 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29873 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29874 replacing that beginning with the specified prefix to produce an
29875 alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
29876 @file{foo/bar} just before it searches the standard directory 
29877 @file{/usr/local/lib/bar}.
29878 If a standard directory begins with the configured
29879 @var{prefix} then the value of @var{prefix} is replaced by
29880 @env{GCC_EXEC_PREFIX} when looking for header files.
29882 @item COMPILER_PATH
29883 @findex COMPILER_PATH
29884 The value of @env{COMPILER_PATH} is a colon-separated list of
29885 directories, much like @env{PATH}.  GCC tries the directories thus
29886 specified when searching for subprograms, if it cannot find the
29887 subprograms using @env{GCC_EXEC_PREFIX}.
29889 @item LIBRARY_PATH
29890 @findex LIBRARY_PATH
29891 The value of @env{LIBRARY_PATH} is a colon-separated list of
29892 directories, much like @env{PATH}.  When configured as a native compiler,
29893 GCC tries the directories thus specified when searching for special
29894 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
29895 using GCC also uses these directories when searching for ordinary
29896 libraries for the @option{-l} option (but directories specified with
29897 @option{-L} come first).
29899 @item LANG
29900 @findex LANG
29901 @cindex locale definition
29902 This variable is used to pass locale information to the compiler.  One way in
29903 which this information is used is to determine the character set to be used
29904 when character literals, string literals and comments are parsed in C and C++.
29905 When the compiler is configured to allow multibyte characters,
29906 the following values for @env{LANG} are recognized:
29908 @table @samp
29909 @item C-JIS
29910 Recognize JIS characters.
29911 @item C-SJIS
29912 Recognize SJIS characters.
29913 @item C-EUCJP
29914 Recognize EUCJP characters.
29915 @end table
29917 If @env{LANG} is not defined, or if it has some other value, then the
29918 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29919 recognize and translate multibyte characters.
29920 @end table
29922 @noindent
29923 Some additional environment variables affect the behavior of the
29924 preprocessor.
29926 @include cppenv.texi
29928 @c man end
29930 @node Precompiled Headers
29931 @section Using Precompiled Headers
29932 @cindex precompiled headers
29933 @cindex speed of compilation
29935 Often large projects have many header files that are included in every
29936 source file.  The time the compiler takes to process these header files
29937 over and over again can account for nearly all of the time required to
29938 build the project.  To make builds faster, GCC allows you to
29939 @dfn{precompile} a header file.
29941 To create a precompiled header file, simply compile it as you would any
29942 other file, if necessary using the @option{-x} option to make the driver
29943 treat it as a C or C++ header file.  You may want to use a
29944 tool like @command{make} to keep the precompiled header up-to-date when
29945 the headers it contains change.
29947 A precompiled header file is searched for when @code{#include} is
29948 seen in the compilation.  As it searches for the included file
29949 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29950 compiler looks for a precompiled header in each directory just before it
29951 looks for the include file in that directory.  The name searched for is
29952 the name specified in the @code{#include} with @samp{.gch} appended.  If
29953 the precompiled header file cannot be used, it is ignored.
29955 For instance, if you have @code{#include "all.h"}, and you have
29956 @file{all.h.gch} in the same directory as @file{all.h}, then the
29957 precompiled header file is used if possible, and the original
29958 header is used otherwise.
29960 Alternatively, you might decide to put the precompiled header file in a
29961 directory and use @option{-I} to ensure that directory is searched
29962 before (or instead of) the directory containing the original header.
29963 Then, if you want to check that the precompiled header file is always
29964 used, you can put a file of the same name as the original header in this
29965 directory containing an @code{#error} command.
29967 This also works with @option{-include}.  So yet another way to use
29968 precompiled headers, good for projects not designed with precompiled
29969 header files in mind, is to simply take most of the header files used by
29970 a project, include them from another header file, precompile that header
29971 file, and @option{-include} the precompiled header.  If the header files
29972 have guards against multiple inclusion, they are skipped because
29973 they've already been included (in the precompiled header).
29975 If you need to precompile the same header file for different
29976 languages, targets, or compiler options, you can instead make a
29977 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29978 header in the directory, perhaps using @option{-o}.  It doesn't matter
29979 what you call the files in the directory; every precompiled header in
29980 the directory is considered.  The first precompiled header
29981 encountered in the directory that is valid for this compilation is
29982 used; they're searched in no particular order.
29984 There are many other possibilities, limited only by your imagination,
29985 good sense, and the constraints of your build system.
29987 A precompiled header file can be used only when these conditions apply:
29989 @itemize
29990 @item
29991 Only one precompiled header can be used in a particular compilation.
29993 @item
29994 A precompiled header cannot be used once the first C token is seen.  You
29995 can have preprocessor directives before a precompiled header; you cannot
29996 include a precompiled header from inside another header.
29998 @item
29999 The precompiled header file must be produced for the same language as
30000 the current compilation.  You cannot use a C precompiled header for a C++
30001 compilation.
30003 @item
30004 The precompiled header file must have been produced by the same compiler
30005 binary as the current compilation is using.
30007 @item
30008 Any macros defined before the precompiled header is included must
30009 either be defined in the same way as when the precompiled header was
30010 generated, or must not affect the precompiled header, which usually
30011 means that they don't appear in the precompiled header at all.
30013 The @option{-D} option is one way to define a macro before a
30014 precompiled header is included; using a @code{#define} can also do it.
30015 There are also some options that define macros implicitly, like
30016 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30017 defined this way.
30019 @item If debugging information is output when using the precompiled
30020 header, using @option{-g} or similar, the same kind of debugging information
30021 must have been output when building the precompiled header.  However,
30022 a precompiled header built using @option{-g} can be used in a compilation
30023 when no debugging information is being output.
30025 @item The same @option{-m} options must generally be used when building
30026 and using the precompiled header.  @xref{Submodel Options},
30027 for any cases where this rule is relaxed.
30029 @item Each of the following options must be the same when building and using
30030 the precompiled header:
30032 @gccoptlist{-fexceptions}
30034 @item
30035 Some other command-line options starting with @option{-f},
30036 @option{-p}, or @option{-O} must be defined in the same way as when
30037 the precompiled header was generated.  At present, it's not clear
30038 which options are safe to change and which are not; the safest choice
30039 is to use exactly the same options when generating and using the
30040 precompiled header.  The following are known to be safe:
30042 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock @gol
30043 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous @gol
30044 -fsched-verbose=@var{number}  -fschedule-insns  -fvisibility= @gol
30045 -pedantic-errors}
30047 @end itemize
30049 For all of these except the last, the compiler automatically
30050 ignores the precompiled header if the conditions aren't met.  If you
30051 find an option combination that doesn't work and doesn't cause the
30052 precompiled header to be ignored, please consider filing a bug report,
30053 see @ref{Bugs}.
30055 If you do use differing options when generating and using the
30056 precompiled header, the actual behavior is a mixture of the
30057 behavior for the options.  For instance, if you use @option{-g} to
30058 generate the precompiled header but not when using it, you may or may
30059 not get debugging information for routines in the precompiled header.