]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
invoke.texi (Spec Files): Update location of the Fortran spec file.
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2019 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
9
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2019 Free Software Foundation, Inc.
12
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.
20
21 (a) The FSF's Front-Cover Text is:
22
23 A GNU Manual
24
25 (b) The FSF's Back-Cover Text is:
26
27 You have freedom to copy and modify this GNU Manual, like GNU
28 software. Copies published by the Free Software Foundation raise
29 funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
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{}
42
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
62
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
68
69 @c man begin DESCRIPTION
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}.
76
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.
81
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.
88
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
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.
101
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}}.
108
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.
116
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.
123
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.
138
139 @c man end
140
141 @xref{Option Index}, for an index to GCC's options.
142
143 @menu
144 * Option Summary:: Brief list of all options, without explanations.
145 * Overall Options:: Controlling the kind of output:
146 an executable, object files, assembler files,
147 or preprocessed source.
148 * Invoking G++:: Compiling C++ programs.
149 * C Dialect Options:: Controlling the variant of C language compiled.
150 * C++ Dialect Options:: Variations on C++.
151 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152 and Objective-C++.
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
154 be formatted.
155 * Warning Options:: How picky should the compiler be?
156 * Debugging Options:: Producing debuggable code.
157 * Optimize Options:: How much optimization?
158 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
159 * Preprocessor Options:: Controlling header files and macro definitions.
160 Also, getting dependency information for Make.
161 * Assembler Options:: Passing options to the assembler.
162 * Link Options:: Specifying libraries and so on.
163 * Directory Options:: Where to find header files and libraries.
164 Where to find the compiler executable files.
165 * Code Gen Options:: Specifying conventions for function calls, data layout
166 and register usage.
167 * Developer Options:: Printing GCC configuration info, statistics, and
168 debugging dumps.
169 * Submodel Options:: Target-specific options, such as compiling for a
170 specific processor variant.
171 * Spec Files:: How to pass switches to sub-processes.
172 * Environment Variables:: Env vars that affect GCC.
173 * Precompiled Headers:: Compiling a header once, and using it many times.
174 @end menu
175
176 @c man begin OPTIONS
177
178 @node Option Summary
179 @section Option Summary
180
181 Here is a summary of all the options, grouped by type. Explanations are
182 in the following sections.
183
184 @table @emph
185 @item Overall Options
186 @xref{Overall Options,,Options Controlling the Kind of Output}.
187 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
188 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
189 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
190 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
191 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
192 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
193
194 @item C Language Options
195 @xref{C Dialect Options,,Options Controlling C Dialect}.
196 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
197 -fpermitted-flt-eval-methods=@var{standard} @gol
198 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
199 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
200 -fhosted -ffreestanding @gol
201 -fopenacc -fopenacc-dim=@var{geom} @gol
202 -fopenmp -fopenmp-simd @gol
203 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
204 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
205 -fsigned-bitfields -fsigned-char @gol
206 -funsigned-bitfields -funsigned-char}
207
208 @item C++ Language Options
209 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
210 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
211 -faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol
212 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
213 -fconstexpr-ops-limit=@var{n} -fno-elide-constructors @gol
214 -fno-enforce-eh-specs @gol
215 -fno-gnu-keywords @gol
216 -fno-implicit-templates @gol
217 -fno-implicit-inline-templates @gol
218 -fno-implement-inlines -fms-extensions @gol
219 -fnew-inheriting-ctors @gol
220 -fnew-ttp-matching @gol
221 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
222 -fno-optional-diags -fpermissive @gol
223 -fno-pretty-templates @gol
224 -frepo -fno-rtti -fsized-deallocation @gol
225 -ftemplate-backtrace-limit=@var{n} @gol
226 -ftemplate-depth=@var{n} @gol
227 -fno-threadsafe-statics -fuse-cxa-atexit @gol
228 -fno-weak -nostdinc++ @gol
229 -fvisibility-inlines-hidden @gol
230 -fvisibility-ms-compat @gol
231 -fext-numeric-literals @gol
232 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
233 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
234 -Wliteral-suffix @gol
235 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
236 -Wnamespaces -Wnarrowing @gol
237 -Wpessimizing-move -Wredundant-move @gol
238 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
239 -Wnon-virtual-dtor -Wreorder -Wregister @gol
240 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
241 -Wno-non-template-friend -Wold-style-cast @gol
242 -Woverloaded-virtual -Wno-pmf-conversions @gol
243 -Wno-class-conversion -Wno-terminate @gol
244 -Wsign-promo -Wvirtual-inheritance}
245
246 @item Objective-C and Objective-C++ Language Options
247 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
248 Objective-C and Objective-C++ Dialects}.
249 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
250 -fgnu-runtime -fnext-runtime @gol
251 -fno-nil-receivers @gol
252 -fobjc-abi-version=@var{n} @gol
253 -fobjc-call-cxx-cdtors @gol
254 -fobjc-direct-dispatch @gol
255 -fobjc-exceptions @gol
256 -fobjc-gc @gol
257 -fobjc-nilcheck @gol
258 -fobjc-std=objc1 @gol
259 -fno-local-ivars @gol
260 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
261 -freplace-objc-classes @gol
262 -fzero-link @gol
263 -gen-decls @gol
264 -Wassign-intercept @gol
265 -Wno-protocol -Wselector @gol
266 -Wstrict-selector-match @gol
267 -Wundeclared-selector}
268
269 @item Diagnostic Message Formatting Options
270 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
271 @gccoptlist{-fmessage-length=@var{n} @gol
272 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
273 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
274 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
275 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
276 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
277 -fdiagnostics-minimum-margin-width=@var{width} @gol
278 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
279 -fdiagnostics-show-template-tree -fno-elide-type @gol
280 -fno-show-column}
281
282 @item Warning Options
283 @xref{Warning Options,,Options to Request or Suppress Warnings}.
284 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
285 -pedantic-errors @gol
286 -w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol
287 -Waggregate-return -Waligned-new @gol
288 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
289 -Walloca -Walloca-larger-than=@var{byte-size} @gol
290 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
291 -Wno-attributes -Wattribute-alias=@var{n} @gol
292 -Wbool-compare -Wbool-operation @gol
293 -Wno-builtin-declaration-mismatch @gol
294 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
295 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
296 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
297 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
298 -Wclobbered -Wcomment -Wconditionally-supported @gol
299 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
300 -Wdelete-incomplete @gol
301 -Wno-attribute-warning @gol
302 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
303 -Wdisabled-optimization @gol
304 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
305 -Wno-div-by-zero -Wdouble-promotion @gol
306 -Wduplicated-branches -Wduplicated-cond @gol
307 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
308 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
309 -Wfloat-equal -Wformat -Wformat=2 @gol
310 -Wno-format-contains-nul -Wno-format-extra-args @gol
311 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
312 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
313 -Wformat-y2k -Wframe-address @gol
314 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
315 -Wjump-misses-init @gol
316 -Whsa -Wif-not-aligned @gol
317 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
318 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
319 -Wimplicit-function-declaration -Wimplicit-int @gol
320 -Winaccessible-base @gol
321 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
322 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
323 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
324 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
325 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
326 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
327 -Wmissing-field-initializers -Wmissing-format-attribute @gol
328 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
329 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
330 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
331 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
332 -Woverride-init-side-effects -Woverlength-strings @gol
333 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
334 -Wparentheses -Wno-pedantic-ms-format @gol
335 -Wplacement-new -Wplacement-new=@var{n} @gol
336 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
337 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
338 -Wrestrict -Wno-return-local-addr @gol
339 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
340 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
341 -Wshift-overflow -Wshift-overflow=@var{n} @gol
342 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
343 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
344 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
345 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
346 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
347 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
348 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
349 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
350 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
351 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
352 -Wswitch-unreachable -Wsync-nand @gol
353 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
354 -Wtype-limits -Wundef @gol
355 -Wuninitialized -Wunknown-pragmas @gol
356 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
357 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
358 -Wunused-parameter -Wno-unused-result @gol
359 -Wunused-value -Wunused-variable @gol
360 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
361 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
362 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
363 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
364 -Wwrite-strings @gol
365 -Wzero-as-null-pointer-constant}
366
367 @item C and Objective-C-only Warning Options
368 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
369 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
370 -Wold-style-declaration -Wold-style-definition @gol
371 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
372 -Wdeclaration-after-statement -Wpointer-sign}
373
374 @item Debugging Options
375 @xref{Debugging Options,,Options for Debugging Your Program}.
376 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
377 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
378 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
379 -gas-loc-support -gno-as-loc-support @gol
380 -gas-locview-support -gno-as-locview-support @gol
381 -gcolumn-info -gno-column-info @gol
382 -gstatement-frontiers -gno-statement-frontiers @gol
383 -gvariable-location-views -gno-variable-location-views @gol
384 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
385 -ginline-points -gno-inline-points @gol
386 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
387 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
388 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
389 -fno-eliminate-unused-debug-types @gol
390 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
391 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
392 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
393 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
394 -fvar-tracking -fvar-tracking-assignments}
395
396 @item Optimization Options
397 @xref{Optimize Options,,Options that Control Optimization}.
398 @gccoptlist{-faggressive-loop-optimizations @gol
399 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
400 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
401 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
402 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
403 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
404 -fauto-inc-dec -fbranch-probabilities @gol
405 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
406 -fbtr-bb-exclusive -fcaller-saves @gol
407 -fcombine-stack-adjustments -fconserve-stack @gol
408 -fcompare-elim -fcprop-registers -fcrossjumping @gol
409 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
410 -fcx-limited-range @gol
411 -fdata-sections -fdce -fdelayed-branch @gol
412 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
413 -fdevirtualize-at-ltrans -fdse @gol
414 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
415 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
416 -ffinite-loops @gol
417 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
418 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
419 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
420 -fif-conversion2 -findirect-inlining @gol
421 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
422 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
423 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
424 -fipa-reference -fipa-reference-addressable @gol
425 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
426 -flive-patching=@var{level} @gol
427 -fira-region=@var{region} -fira-hoist-pressure @gol
428 -fira-loop-pressure -fno-ira-share-save-slots @gol
429 -fno-ira-share-spill-slots @gol
430 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
431 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
432 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
433 -floop-block -floop-interchange -floop-strip-mine @gol
434 -floop-unroll-and-jam -floop-nest-optimize @gol
435 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
436 -flto-partition=@var{alg} -fmerge-all-constants @gol
437 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
438 -fmove-loop-invariants -fno-branch-count-reg @gol
439 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
440 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
441 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
442 -fno-sched-spec -fno-signed-zeros @gol
443 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
444 -fomit-frame-pointer -foptimize-sibling-calls @gol
445 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
446 -fprefetch-loop-arrays @gol
447 -fprofile-correction @gol
448 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
449 -fprofile-reorder-functions @gol
450 -freciprocal-math -free -frename-registers -freorder-blocks @gol
451 -freorder-blocks-algorithm=@var{algorithm} @gol
452 -freorder-blocks-and-partition -freorder-functions @gol
453 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
454 -frounding-math -fsave-optimization-record @gol
455 -fsched2-use-superblocks -fsched-pressure @gol
456 -fsched-spec-load -fsched-spec-load-dangerous @gol
457 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
458 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
459 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
460 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
461 -fschedule-fusion @gol
462 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
463 -fselective-scheduling -fselective-scheduling2 @gol
464 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
465 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
466 -fsignaling-nans @gol
467 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
468 -fsplit-paths @gol
469 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
470 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
471 -fthread-jumps -ftracer -ftree-bit-ccp @gol
472 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
473 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
474 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
475 -ftree-loop-if-convert -ftree-loop-im @gol
476 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
477 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
478 -ftree-loop-vectorize @gol
479 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
480 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
481 -ftree-switch-conversion -ftree-tail-merge @gol
482 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
483 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
484 -funsafe-math-optimizations -funswitch-loops @gol
485 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
486 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
487 --param @var{name}=@var{value}
488 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
489
490 @item Program Instrumentation Options
491 @xref{Instrumentation Options,,Program Instrumentation Options}.
492 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
493 -fprofile-abs-path @gol
494 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
495 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
496 -fprofile-exclude-files=@var{regex} @gol
497 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
498 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
499 -fsanitize-undefined-trap-on-error -fbounds-check @gol
500 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
501 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
502 -fstack-protector-explicit -fstack-check @gol
503 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
504 -fno-stack-limit -fsplit-stack @gol
505 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
506 -fvtv-counts -fvtv-debug @gol
507 -finstrument-functions @gol
508 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
509 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
510
511 @item Preprocessor Options
512 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
513 @gccoptlist{-A@var{question}=@var{answer} @gol
514 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
515 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
516 -dD -dI -dM -dN -dU @gol
517 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
518 -fexec-charset=@var{charset} -fextended-identifiers @gol
519 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
520 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
521 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
522 -fwide-exec-charset=@var{charset} -fworking-directory @gol
523 -H -imacros @var{file} -include @var{file} @gol
524 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
525 -no-integrated-cpp -P -pthread -remap @gol
526 -traditional -traditional-cpp -trigraphs @gol
527 -U@var{macro} -undef @gol
528 -Wp,@var{option} -Xpreprocessor @var{option}}
529
530 @item Assembler Options
531 @xref{Assembler Options,,Passing Options to the Assembler}.
532 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
533
534 @item Linker Options
535 @xref{Link Options,,Options for Linking}.
536 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
537 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
538 -e @var{entry} --entry=@var{entry} @gol
539 -pie -pthread -r -rdynamic @gol
540 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
541 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
542 -shared -shared-libgcc -symbolic @gol
543 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
544 -u @var{symbol} -z @var{keyword}}
545
546 @item Directory Options
547 @xref{Directory Options,,Options for Directory Search}.
548 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
549 -idirafter @var{dir} @gol
550 -imacros @var{file} -imultilib @var{dir} @gol
551 -iplugindir=@var{dir} -iprefix @var{file} @gol
552 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
553 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
554 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
555 -nostdinc -nostdinc++ --sysroot=@var{dir}}
556
557 @item Code Generation Options
558 @xref{Code Gen Options,,Options for Code Generation Conventions}.
559 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
560 -ffixed-@var{reg} -fexceptions @gol
561 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
562 -fasynchronous-unwind-tables @gol
563 -fno-gnu-unique @gol
564 -finhibit-size-directive -fno-common -fno-ident @gol
565 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
566 -fno-jump-tables @gol
567 -frecord-gcc-switches @gol
568 -freg-struct-return -fshort-enums -fshort-wchar @gol
569 -fverbose-asm -fpack-struct[=@var{n}] @gol
570 -fleading-underscore -ftls-model=@var{model} @gol
571 -fstack-reuse=@var{reuse_level} @gol
572 -ftrampolines -ftrapv -fwrapv @gol
573 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
574 -fstrict-volatile-bitfields -fsync-libcalls}
575
576 @item Developer Options
577 @xref{Developer Options,,GCC Developer Options}.
578 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
579 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
580 -fdbg-cnt=@var{counter-value-list} @gol
581 -fdisable-ipa-@var{pass_name} @gol
582 -fdisable-rtl-@var{pass_name} @gol
583 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
584 -fdisable-tree-@var{pass_name} @gol
585 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
586 -fdump-debug -fdump-earlydebug @gol
587 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
588 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
589 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
590 -fdump-lang-all @gol
591 -fdump-lang-@var{switch} @gol
592 -fdump-lang-@var{switch}-@var{options} @gol
593 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
594 -fdump-passes @gol
595 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
596 -fdump-statistics @gol
597 -fdump-tree-all @gol
598 -fdump-tree-@var{switch} @gol
599 -fdump-tree-@var{switch}-@var{options} @gol
600 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
601 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
602 -fenable-@var{kind}-@var{pass} @gol
603 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
604 -fira-verbose=@var{n} @gol
605 -flto-report -flto-report-wpa -fmem-report-wpa @gol
606 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
607 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
608 -fprofile-report @gol
609 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
610 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
611 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
612 -fvar-tracking-assignments-toggle -gtoggle @gol
613 -print-file-name=@var{library} -print-libgcc-file-name @gol
614 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
615 -print-prog-name=@var{program} -print-search-dirs -Q @gol
616 -print-sysroot -print-sysroot-headers-suffix @gol
617 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
618
619 @item Machine-Dependent Options
620 @xref{Submodel Options,,Machine-Dependent Options}.
621 @c This list is ordered alphanumerically by subsection name.
622 @c Try and put the significant identifier (CPU or system) first,
623 @c so users have a clue at guessing where the ones they want will be.
624
625 @emph{AArch64 Options}
626 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
627 -mgeneral-regs-only @gol
628 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
629 -mstrict-align -mno-strict-align @gol
630 -momit-leaf-frame-pointer @gol
631 -mtls-dialect=desc -mtls-dialect=traditional @gol
632 -mtls-size=@var{size} @gol
633 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
634 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
635 -mpc-relative-literal-loads @gol
636 -msign-return-address=@var{scope} @gol
637 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
638 +@var{b-key}]|@var{bti} @gol
639 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
640 -moverride=@var{string} -mverbose-cost-dump @gol
641 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
642 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation }
643
644 @emph{Adapteva Epiphany Options}
645 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
646 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
647 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
648 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
649 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
650 -msplit-vecmove-early -m1reg-@var{reg}}
651
652 @emph{AMD GCN Options}
653 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
654
655 @emph{ARC Options}
656 @gccoptlist{-mbarrel-shifter -mjli-always @gol
657 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
658 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
659 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
660 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
661 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
662 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
663 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
664 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
665 -mvolatile-cache -mtp-regno=@var{regno} @gol
666 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
667 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
668 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
669 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
670 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
671 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
672 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
673 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
674
675 @emph{ARM Options}
676 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
677 -mabi=@var{name} @gol
678 -mapcs-stack-check -mno-apcs-stack-check @gol
679 -mapcs-reentrant -mno-apcs-reentrant @gol
680 -mgeneral-regs-only @gol
681 -msched-prolog -mno-sched-prolog @gol
682 -mlittle-endian -mbig-endian @gol
683 -mbe8 -mbe32 @gol
684 -mfloat-abi=@var{name} @gol
685 -mfp16-format=@var{name}
686 -mthumb-interwork -mno-thumb-interwork @gol
687 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
688 -mtune=@var{name} -mprint-tune-info @gol
689 -mstructure-size-boundary=@var{n} @gol
690 -mabort-on-noreturn @gol
691 -mlong-calls -mno-long-calls @gol
692 -msingle-pic-base -mno-single-pic-base @gol
693 -mpic-register=@var{reg} @gol
694 -mnop-fun-dllimport @gol
695 -mpoke-function-name @gol
696 -mthumb -marm -mflip-thumb @gol
697 -mtpcs-frame -mtpcs-leaf-frame @gol
698 -mcaller-super-interworking -mcallee-super-interworking @gol
699 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
700 -mword-relocations @gol
701 -mfix-cortex-m3-ldrd @gol
702 -munaligned-access @gol
703 -mneon-for-64bits @gol
704 -mslow-flash-data @gol
705 -masm-syntax-unified @gol
706 -mrestrict-it @gol
707 -mverbose-cost-dump @gol
708 -mpure-code @gol
709 -mcmse}
710
711 @emph{AVR Options}
712 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
713 -mbranch-cost=@var{cost} @gol
714 -mcall-prologues -mgas-isr-prologues -mint8 @gol
715 -mn_flash=@var{size} -mno-interrupts @gol
716 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
717 -mfract-convert-truncate @gol
718 -mshort-calls -nodevicelib @gol
719 -Waddr-space-convert -Wmisspelled-isr}
720
721 @emph{Blackfin Options}
722 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
723 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
724 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
725 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
726 -mno-id-shared-library -mshared-library-id=@var{n} @gol
727 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
728 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
729 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
730 -micplb}
731
732 @emph{C6X Options}
733 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
734 -msim -msdata=@var{sdata-type}}
735
736 @emph{CRIS Options}
737 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
738 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
739 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
740 -mstack-align -mdata-align -mconst-align @gol
741 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
742 -melf -maout -melinux -mlinux -sim -sim2 @gol
743 -mmul-bug-workaround -mno-mul-bug-workaround}
744
745 @emph{CR16 Options}
746 @gccoptlist{-mmac @gol
747 -mcr16cplus -mcr16c @gol
748 -msim -mint32 -mbit-ops
749 -mdata-model=@var{model}}
750
751 @emph{C-SKY Options}
752 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
753 -mbig-endian -EB -mlittle-endian -EL @gol
754 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
755 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
756 -mdsp -medsp -mvdsp @gol
757 -mdiv -msmart -mhigh-registers -manchor @gol
758 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
759 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
760
761 @emph{Darwin Options}
762 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
763 -arch_only -bind_at_load -bundle -bundle_loader @gol
764 -client_name -compatibility_version -current_version @gol
765 -dead_strip @gol
766 -dependency-file -dylib_file -dylinker_install_name @gol
767 -dynamic -dynamiclib -exported_symbols_list @gol
768 -filelist -flat_namespace -force_cpusubtype_ALL @gol
769 -force_flat_namespace -headerpad_max_install_names @gol
770 -iframework @gol
771 -image_base -init -install_name -keep_private_externs @gol
772 -multi_module -multiply_defined -multiply_defined_unused @gol
773 -noall_load -no_dead_strip_inits_and_terms @gol
774 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
775 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
776 -private_bundle -read_only_relocs -sectalign @gol
777 -sectobjectsymbols -whyload -seg1addr @gol
778 -sectcreate -sectobjectsymbols -sectorder @gol
779 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
780 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
781 -segprot -segs_read_only_addr -segs_read_write_addr @gol
782 -single_module -static -sub_library -sub_umbrella @gol
783 -twolevel_namespace -umbrella -undefined @gol
784 -unexported_symbols_list -weak_reference_mismatches @gol
785 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
786 -mkernel -mone-byte-bool}
787
788 @emph{DEC Alpha Options}
789 @gccoptlist{-mno-fp-regs -msoft-float @gol
790 -mieee -mieee-with-inexact -mieee-conformant @gol
791 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
792 -mtrap-precision=@var{mode} -mbuild-constants @gol
793 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
794 -mbwx -mmax -mfix -mcix @gol
795 -mfloat-vax -mfloat-ieee @gol
796 -mexplicit-relocs -msmall-data -mlarge-data @gol
797 -msmall-text -mlarge-text @gol
798 -mmemory-latency=@var{time}}
799
800 @emph{FR30 Options}
801 @gccoptlist{-msmall-model -mno-lsim}
802
803 @emph{FT32 Options}
804 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
805
806 @emph{FRV Options}
807 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
808 -mhard-float -msoft-float @gol
809 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
810 -mdouble -mno-double @gol
811 -mmedia -mno-media -mmuladd -mno-muladd @gol
812 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
813 -mlinked-fp -mlong-calls -malign-labels @gol
814 -mlibrary-pic -macc-4 -macc-8 @gol
815 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
816 -moptimize-membar -mno-optimize-membar @gol
817 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
818 -mvliw-branch -mno-vliw-branch @gol
819 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
820 -mno-nested-cond-exec -mtomcat-stats @gol
821 -mTLS -mtls @gol
822 -mcpu=@var{cpu}}
823
824 @emph{GNU/Linux Options}
825 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
826 -tno-android-cc -tno-android-ld}
827
828 @emph{H8/300 Options}
829 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
830
831 @emph{HPPA Options}
832 @gccoptlist{-march=@var{architecture-type} @gol
833 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
834 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
835 -mfixed-range=@var{register-range} @gol
836 -mjump-in-delay -mlinker-opt -mlong-calls @gol
837 -mlong-load-store -mno-disable-fpregs @gol
838 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
839 -mno-jump-in-delay -mno-long-load-store @gol
840 -mno-portable-runtime -mno-soft-float @gol
841 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
842 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
843 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
844 -munix=@var{unix-std} -nolibdld -static -threads}
845
846 @emph{IA-64 Options}
847 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
848 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
849 -mconstant-gp -mauto-pic -mfused-madd @gol
850 -minline-float-divide-min-latency @gol
851 -minline-float-divide-max-throughput @gol
852 -mno-inline-float-divide @gol
853 -minline-int-divide-min-latency @gol
854 -minline-int-divide-max-throughput @gol
855 -mno-inline-int-divide @gol
856 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
857 -mno-inline-sqrt @gol
858 -mdwarf2-asm -mearly-stop-bits @gol
859 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
860 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
861 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
862 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
863 -msched-spec-ldc -msched-spec-control-ldc @gol
864 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
865 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
866 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
867 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
868
869 @emph{LM32 Options}
870 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
871 -msign-extend-enabled -muser-enabled}
872
873 @emph{M32R/D Options}
874 @gccoptlist{-m32r2 -m32rx -m32r @gol
875 -mdebug @gol
876 -malign-loops -mno-align-loops @gol
877 -missue-rate=@var{number} @gol
878 -mbranch-cost=@var{number} @gol
879 -mmodel=@var{code-size-model-type} @gol
880 -msdata=@var{sdata-type} @gol
881 -mno-flush-func -mflush-func=@var{name} @gol
882 -mno-flush-trap -mflush-trap=@var{number} @gol
883 -G @var{num}}
884
885 @emph{M32C Options}
886 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
887
888 @emph{M680x0 Options}
889 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
890 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
891 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
892 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
893 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
894 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
895 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
896 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
897 -mxgot -mno-xgot -mlong-jump-table-offsets}
898
899 @emph{MCore Options}
900 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
901 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
902 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
903 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
904 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
905
906 @emph{MeP Options}
907 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
908 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
909 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
910 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
911 -mtiny=@var{n}}
912
913 @emph{MicroBlaze Options}
914 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
915 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
916 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
917 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
918 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
919 -mpic-data-is-text-relative}
920
921 @emph{MIPS Options}
922 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
923 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
924 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
925 -mips16 -mno-mips16 -mflip-mips16 @gol
926 -minterlink-compressed -mno-interlink-compressed @gol
927 -minterlink-mips16 -mno-interlink-mips16 @gol
928 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
929 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
930 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
931 -mno-float -msingle-float -mdouble-float @gol
932 -modd-spreg -mno-odd-spreg @gol
933 -mabs=@var{mode} -mnan=@var{encoding} @gol
934 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
935 -mmcu -mmno-mcu @gol
936 -meva -mno-eva @gol
937 -mvirt -mno-virt @gol
938 -mxpa -mno-xpa @gol
939 -mcrc -mno-crc @gol
940 -mginv -mno-ginv @gol
941 -mmicromips -mno-micromips @gol
942 -mmsa -mno-msa @gol
943 -mloongson-mmi -mno-loongson-mmi @gol
944 -mloongson-ext -mno-loongson-ext @gol
945 -mloongson-ext2 -mno-loongson-ext2 @gol
946 -mfpu=@var{fpu-type} @gol
947 -msmartmips -mno-smartmips @gol
948 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
949 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
950 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
951 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
952 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
953 -membedded-data -mno-embedded-data @gol
954 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
955 -mcode-readable=@var{setting} @gol
956 -msplit-addresses -mno-split-addresses @gol
957 -mexplicit-relocs -mno-explicit-relocs @gol
958 -mcheck-zero-division -mno-check-zero-division @gol
959 -mdivide-traps -mdivide-breaks @gol
960 -mload-store-pairs -mno-load-store-pairs @gol
961 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
962 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
963 -mfix-24k -mno-fix-24k @gol
964 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
965 -mfix-r5900 -mno-fix-r5900 @gol
966 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
967 -mfix-vr4120 -mno-fix-vr4120 @gol
968 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
969 -mflush-func=@var{func} -mno-flush-func @gol
970 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
971 -mcompact-branches=@var{policy} @gol
972 -mfp-exceptions -mno-fp-exceptions @gol
973 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
974 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
975 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
976 -mframe-header-opt -mno-frame-header-opt}
977
978 @emph{MMIX Options}
979 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
980 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
981 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
982 -mno-base-addresses -msingle-exit -mno-single-exit}
983
984 @emph{MN10300 Options}
985 @gccoptlist{-mmult-bug -mno-mult-bug @gol
986 -mno-am33 -mam33 -mam33-2 -mam34 @gol
987 -mtune=@var{cpu-type} @gol
988 -mreturn-pointer-on-d0 @gol
989 -mno-crt0 -mrelax -mliw -msetlb}
990
991 @emph{Moxie Options}
992 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
993
994 @emph{MSP430 Options}
995 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
996 -mwarn-mcu @gol
997 -mcode-region= -mdata-region= @gol
998 -msilicon-errata= -msilicon-errata-warn= @gol
999 -mhwmult= -minrt}
1000
1001 @emph{NDS32 Options}
1002 @gccoptlist{-mbig-endian -mlittle-endian @gol
1003 -mreduced-regs -mfull-regs @gol
1004 -mcmov -mno-cmov @gol
1005 -mext-perf -mno-ext-perf @gol
1006 -mext-perf2 -mno-ext-perf2 @gol
1007 -mext-string -mno-ext-string @gol
1008 -mv3push -mno-v3push @gol
1009 -m16bit -mno-16bit @gol
1010 -misr-vector-size=@var{num} @gol
1011 -mcache-block-size=@var{num} @gol
1012 -march=@var{arch} @gol
1013 -mcmodel=@var{code-model} @gol
1014 -mctor-dtor -mrelax}
1015
1016 @emph{Nios II Options}
1017 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1018 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1019 -mel -meb @gol
1020 -mno-bypass-cache -mbypass-cache @gol
1021 -mno-cache-volatile -mcache-volatile @gol
1022 -mno-fast-sw-div -mfast-sw-div @gol
1023 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1024 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1025 -mcustom-fpu-cfg=@var{name} @gol
1026 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1027 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1028
1029 @emph{Nvidia PTX Options}
1030 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1031
1032 @emph{OpenRISC Options}
1033 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1034 -msoft-mul -msoft-div @gol
1035 -mcmov -mror -msext -msfimm -mshftimm}
1036
1037 @emph{PDP-11 Options}
1038 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1039 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1040 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1041
1042 @emph{picoChip Options}
1043 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1044 -msymbol-as-address -mno-inefficient-warnings}
1045
1046 @emph{PowerPC Options}
1047 See RS/6000 and PowerPC Options.
1048
1049 @emph{PRU Options}
1050 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1051 -mabi=@var{variant} @gol}
1052
1053 @emph{RISC-V Options}
1054 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1055 -mplt -mno-plt @gol
1056 -mabi=@var{ABI-string} @gol
1057 -mfdiv -mno-fdiv @gol
1058 -mdiv -mno-div @gol
1059 -march=@var{ISA-string} @gol
1060 -mtune=@var{processor-string} @gol
1061 -mpreferred-stack-boundary=@var{num} @gol
1062 -msmall-data-limit=@var{N-bytes} @gol
1063 -msave-restore -mno-save-restore @gol
1064 -mstrict-align -mno-strict-align @gol
1065 -mcmodel=medlow -mcmodel=medany @gol
1066 -mexplicit-relocs -mno-explicit-relocs @gol
1067 -mrelax -mno-relax @gol
1068 -mriscv-attribute -mmo-riscv-attribute}
1069
1070 @emph{RL78 Options}
1071 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1072 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1073 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1074
1075 @emph{RS/6000 and PowerPC Options}
1076 @gccoptlist{-mcpu=@var{cpu-type} @gol
1077 -mtune=@var{cpu-type} @gol
1078 -mcmodel=@var{code-model} @gol
1079 -mpowerpc64 @gol
1080 -maltivec -mno-altivec @gol
1081 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1082 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1083 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1084 -mfprnd -mno-fprnd @gol
1085 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1086 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1087 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1088 -malign-power -malign-natural @gol
1089 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1090 -mupdate -mno-update @gol
1091 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1092 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1093 -mstrict-align -mno-strict-align -mrelocatable @gol
1094 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1095 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1096 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1097 -mprioritize-restricted-insns=@var{priority} @gol
1098 -msched-costly-dep=@var{dependence_type} @gol
1099 -minsert-sched-nops=@var{scheme} @gol
1100 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1101 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1102 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1103 -mtraceback=@var{traceback_type} @gol
1104 -maix-struct-return -msvr4-struct-return @gol
1105 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1106 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1107 -mblock-move-inline-limit=@var{num} @gol
1108 -mblock-compare-inline-limit=@var{num} @gol
1109 -mblock-compare-inline-loop-limit=@var{num} @gol
1110 -mstring-compare-inline-limit=@var{num} @gol
1111 -misel -mno-isel @gol
1112 -mvrsave -mno-vrsave @gol
1113 -mmulhw -mno-mulhw @gol
1114 -mdlmzb -mno-dlmzb @gol
1115 -mprototype -mno-prototype @gol
1116 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1117 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1118 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1119 -mno-recip-precision @gol
1120 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1121 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1122 -msave-toc-indirect -mno-save-toc-indirect @gol
1123 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1124 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1125 -mquad-memory -mno-quad-memory @gol
1126 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1127 -mcompat-align-parm -mno-compat-align-parm @gol
1128 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1129 -mgnu-attribute -mno-gnu-attribute @gol
1130 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1131 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1132
1133 @emph{RX Options}
1134 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1135 -mcpu=@gol
1136 -mbig-endian-data -mlittle-endian-data @gol
1137 -msmall-data @gol
1138 -msim -mno-sim@gol
1139 -mas100-syntax -mno-as100-syntax@gol
1140 -mrelax@gol
1141 -mmax-constant-size=@gol
1142 -mint-register=@gol
1143 -mpid@gol
1144 -mallow-string-insns -mno-allow-string-insns@gol
1145 -mjsr@gol
1146 -mno-warn-multiple-fast-interrupts@gol
1147 -msave-acc-in-interrupts}
1148
1149 @emph{S/390 and zSeries Options}
1150 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1151 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1152 -mlong-double-64 -mlong-double-128 @gol
1153 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1154 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1155 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1156 -mhtm -mvx -mzvector @gol
1157 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1158 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1159 -mhotpatch=@var{halfwords},@var{halfwords}}
1160
1161 @emph{Score Options}
1162 @gccoptlist{-meb -mel @gol
1163 -mnhwloop @gol
1164 -muls @gol
1165 -mmac @gol
1166 -mscore5 -mscore5u -mscore7 -mscore7d}
1167
1168 @emph{SH Options}
1169 @gccoptlist{-m1 -m2 -m2e @gol
1170 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1171 -m3 -m3e @gol
1172 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1173 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1174 -mb -ml -mdalign -mrelax @gol
1175 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1176 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1177 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1178 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1179 -maccumulate-outgoing-args @gol
1180 -matomic-model=@var{atomic-model} @gol
1181 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1182 -mcbranch-force-delay-slot @gol
1183 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1184 -mpretend-cmove -mtas}
1185
1186 @emph{Solaris 2 Options}
1187 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1188 -pthreads}
1189
1190 @emph{SPARC Options}
1191 @gccoptlist{-mcpu=@var{cpu-type} @gol
1192 -mtune=@var{cpu-type} @gol
1193 -mcmodel=@var{code-model} @gol
1194 -mmemory-model=@var{mem-model} @gol
1195 -m32 -m64 -mapp-regs -mno-app-regs @gol
1196 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1197 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1198 -mhard-quad-float -msoft-quad-float @gol
1199 -mstack-bias -mno-stack-bias @gol
1200 -mstd-struct-return -mno-std-struct-return @gol
1201 -munaligned-doubles -mno-unaligned-doubles @gol
1202 -muser-mode -mno-user-mode @gol
1203 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1204 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1205 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1206 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1207 -mpopc -mno-popc -msubxc -mno-subxc @gol
1208 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1209 -mlra -mno-lra}
1210
1211 @emph{SPU Options}
1212 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1213 -msafe-dma -munsafe-dma @gol
1214 -mbranch-hints @gol
1215 -msmall-mem -mlarge-mem -mstdmain @gol
1216 -mfixed-range=@var{register-range} @gol
1217 -mea32 -mea64 @gol
1218 -maddress-space-conversion -mno-address-space-conversion @gol
1219 -mcache-size=@var{cache-size} @gol
1220 -matomic-updates -mno-atomic-updates}
1221
1222 @emph{System V Options}
1223 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1224
1225 @emph{TILE-Gx Options}
1226 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1227 -mcmodel=@var{code-model}}
1228
1229 @emph{TILEPro Options}
1230 @gccoptlist{-mcpu=@var{cpu} -m32}
1231
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}
1248
1249 @emph{VAX Options}
1250 @gccoptlist{-mg -mgnu -munix}
1251
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}
1255
1256 @emph{VMS Options}
1257 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1258 -mpointer-size=@var{size}}
1259
1260 @emph{VxWorks Options}
1261 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1262 -Xbind-lazy -Xbind-now}
1263
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 @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}
1309
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}
1314
1315 @emph{Xstormy16 Options}
1316 @gccoptlist{-msim}
1317
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}
1327
1328 @emph{zSeries Options}
1329 See S/390 and zSeries Options.
1330 @end table
1331
1332
1333 @node Overall Options
1334 @section Options Controlling the Kind of Output
1335
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.
1343
1344 @cindex file name suffix
1345 For any given input file, the file name suffix determines what kind of
1346 compilation is done:
1347
1348 @table @gcctabopt
1349 @item @var{file}.c
1350 C source code that must be preprocessed.
1351
1352 @item @var{file}.i
1353 C source code that should not be preprocessed.
1354
1355 @item @var{file}.ii
1356 C++ source code that should not be preprocessed.
1357
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.
1361
1362 @item @var{file}.mi
1363 Objective-C source code that should not be preprocessed.
1364
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@.
1370
1371 @item @var{file}.mii
1372 Objective-C++ source code that should not be preprocessed.
1373
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).
1378
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@.
1389
1390 @item @var{file}.mm
1391 @itemx @var{file}.M
1392 Objective-C++ source code that must be preprocessed.
1393
1394 @item @var{file}.mii
1395 Objective-C++ source code that should not be preprocessed.
1396
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.
1406
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.
1411
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).
1419
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.
1425
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).
1432
1433 @item @var{file}.go
1434 Go source code.
1435
1436 @item @var{file}.brig
1437 BRIG files (binary representation of HSAIL).
1438
1439 @item @var{file}.d
1440 D source code.
1441
1442 @item @var{file}.di
1443 D interface file.
1444
1445 @item @var{file}.dd
1446 D documentation code (Ddoc).
1447
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}.
1454
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}.
1458
1459 @c GCC also knows about some suffixes for languages not yet included:
1460 @c Ratfor:
1461 @c @var{file}.r
1462
1463 @item @var{file}.s
1464 Assembler code.
1465
1466 @item @var{file}.S
1467 @itemx @var{file}.sx
1468 Assembler code that must be preprocessed.
1469
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
1474
1475 @opindex x
1476 You can specify the input language explicitly with the @option{-x} option:
1477
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
1490 ada
1491 d
1492 f77 f77-cpp-input f95 f95-cpp-input
1493 go
1494 brig
1495 @end smallexample
1496
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
1502
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.
1508
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.
1515
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}.
1518
1519 Unrecognized input files, not requiring compilation or assembly, are
1520 ignored.
1521
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.
1527
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}.
1530
1531 Input files that don't require compilation are ignored.
1532
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.
1538
1539 Input files that don't require preprocessing are ignored.
1540
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.
1547
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.
1554
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.
1560
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.
1566
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.
1576
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.
1582
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:
1587
1588 @table @asis
1589 @item @samp{optimizers}
1590 Display all of the optimization options supported by the
1591 compiler.
1592
1593 @item @samp{warnings}
1594 Display all of the options controlling warning messages
1595 produced by the compiler.
1596
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.
1602
1603 @item @samp{params}
1604 Display the values recognized by the @option{--param}
1605 option.
1606
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@.
1611
1612 @item @samp{common}
1613 Display the options that are common to all languages.
1614 @end table
1615
1616 These are the supported qualifiers:
1617
1618 @table @asis
1619 @item @samp{undocumented}
1620 Display only those options that are undocumented.
1621
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}.
1626
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
1631
1632 Thus for example to display all the undocumented target-specific
1633 switches supported by the compiler, use:
1634
1635 @smallexample
1636 --help=target,undocumented
1637 @end smallexample
1638
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:
1643
1644 @smallexample
1645 --help=warnings,^joined,^undocumented
1646 @end smallexample
1647
1648 The argument to @option{--help=} should not consist solely of inverted
1649 qualifiers.
1650
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:
1656
1657 @smallexample
1658 --help=target,optimizers
1659 @end smallexample
1660
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.
1666
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).
1673
1674 Here is a truncated example from the ARM port of @command{gcc}:
1675
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
1683
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:
1687
1688 @smallexample
1689 -Q -O2 --help=optimizers
1690 @end smallexample
1691
1692 Alternatively you can discover which binary optimizations are enabled
1693 by @option{-O3} by using:
1694
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
1700
1701 @item --version
1702 @opindex version
1703 Display the version number and copyrights of the invoked GCC@.
1704
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.
1713
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.
1720
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}.
1730
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.
1736
1737 @smallexample
1738 gcc -c t.c -wrapper gdb,--args
1739 @end smallexample
1740
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{}}.
1745
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}.
1755
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.
1765
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}.
1770
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.
1776
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}.
1781
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.
1789
1790 @include @value{srcdir}/../libiberty/at-file.texi
1791 @end table
1792
1793 @node Invoking G++
1794 @section Compiling C++ Programs
1795
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}).
1806
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++}.
1817
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.
1827
1828 @node C Dialect Options
1829 @section Options Controlling C Dialect
1830 @cindex dialect options
1831 @cindex language dialect options
1832 @cindex options, dialect
1833
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:
1837
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}.
1845
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.
1854
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}.
1862
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}.
1866
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.
1872
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.
1878
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++.
1884
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.
1902
1903 A value for this option must be provided; possible values are
1904
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.
1911
1912 @item iso9899:199409
1913 ISO C90 as modified in amendment 1.
1914
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.
1925
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.
1934
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.
1944
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.
1948
1949 @item gnu90
1950 @itemx gnu89
1951 GNU dialect of ISO C90 (including some C99 features).
1952
1953 @item gnu99
1954 @itemx gnu9x
1955 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1956
1957 @item gnu11
1958 @itemx gnu1x
1959 GNU dialect of ISO C11.
1960 The name @samp{gnu1x} is deprecated.
1961
1962 @item gnu17
1963 @itemx gnu18
1964 GNU dialect of ISO C17. This is the default for C code.
1965
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.
1970
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.
1975
1976 @item gnu++98
1977 @itemx gnu++03
1978 GNU dialect of @option{-std=c++98}.
1979
1980 @item c++11
1981 @itemx c++0x
1982 The 2011 ISO C++ standard plus amendments.
1983 The name @samp{c++0x} is deprecated.
1984
1985 @item gnu++11
1986 @itemx gnu++0x
1987 GNU dialect of @option{-std=c++11}.
1988 The name @samp{gnu++0x} is deprecated.
1989
1990 @item c++14
1991 @itemx c++1y
1992 The 2014 ISO C++ standard plus amendments.
1993 The name @samp{c++1y} is deprecated.
1994
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.
2000
2001 @item c++17
2002 @itemx c++1z
2003 The 2017 ISO C++ standard plus amendments.
2004 The name @samp{c++1z} is deprecated.
2005
2006 @item gnu++17
2007 @itemx gnu++1z
2008 GNU dialect of @option{-std=c++17}.
2009 The name @samp{gnu++1z} is deprecated.
2010
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.
2015
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
2021
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}).
2030
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.
2036
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}.
2041
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.
2054
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.
2058
2059 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2060
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}.
2065
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@.
2071
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.
2081
2082 @item -fallow-parameterless-variadic-functions
2083 @opindex fallow-parameterless-variadic-functions
2084 Accept variadic functions without named parameters.
2085
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++.
2089
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}.
2097
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.
2104
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.
2116
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.
2131
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:
2140
2141 @smallexample
2142 #define abs(n) __builtin_abs ((n))
2143 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2144 @end smallexample
2145
2146 @item -fgimple
2147 @opindex fgimple
2148
2149 Enable parsing of function definitions marked with @code{__GIMPLE}.
2150 This is an experimental feature that allows unit testing of GIMPLE
2151 passes.
2152
2153 @item -fhosted
2154 @opindex fhosted
2155 @cindex hosted environment
2156
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}.
2162
2163 @item -ffreestanding
2164 @opindex ffreestanding
2165 @cindex hosted environment
2166
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}.
2172
2173 @xref{Standards,,Language Standards Supported by GCC}, for details of
2174 freestanding and hosted environments.
2175
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}.
2185
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.
2193
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}.
2204
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.
2212
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.
2221
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}.
2225
2226 Note that the transactional memory feature is not supported with
2227 non-call exceptions (@option{-fnon-call-exceptions}).
2228
2229 @item -fms-extensions
2230 @opindex fms-extensions
2231 Accept some non-standard constructs used in Microsoft header files.
2232
2233 In C++ code, this allows member names in structures to be similar
2234 to previous types declarations.
2235
2236 @smallexample
2237 typedef int UOW;
2238 struct ABC @{
2239 UOW UOW;
2240 @};
2241 @end smallexample
2242
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.
2246
2247 Note that this option is off for all targets except for x86
2248 targets using ms-abi.
2249
2250 @item -fplan9-extensions
2251 @opindex fplan9-extensions
2252 Accept some non-standard constructs used in Plan 9 code.
2253
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++.
2260
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++.
2266
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.
2272
2273 @item -funsigned-char
2274 @opindex funsigned-char
2275 Let the type @code{char} be unsigned, like @code{unsigned char}.
2276
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.
2280
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.
2287
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.
2291
2292 @item -fsigned-char
2293 @opindex fsigned-char
2294 Let the type @code{char} be signed, like @code{signed char}.
2295
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}.
2299
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.
2312
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++.
2319
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
2324
2325 @node C++ Dialect Options
2326 @section Options Controlling C++ Dialect
2327
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:
2335
2336 @smallexample
2337 g++ -g -fstrict-enums -O -c firstClass.C
2338 @end smallexample
2339
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@.
2344
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}.
2348
2349 Here is a list of options that are @emph{only} for compiling C++ programs:
2350
2351 @table @gcctabopt
2352
2353 @item -fabi-version=@var{n}
2354 @opindex fabi-version
2355 Use version @var{n} of the C++ ABI@. The default is version 0.
2356
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.
2360
2361 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2362
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.
2365
2366 Version 3 corrects an error in mangling a constant address as a
2367 template argument.
2368
2369 Version 4, which first appeared in G++ 4.5, implements a standard
2370 mangling for vector types.
2371
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.
2376
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.
2381
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.
2385
2386 Version 8, which first appeared in G++ 4.9, corrects the substitution
2387 behavior of function types with function-cv-qualifiers.
2388
2389 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2390 @code{nullptr_t}.
2391
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}).
2395
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}.
2401
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.
2407
2408 Version 13, which first appeared in G++ 8.2, fixes the accidental
2409 change in version 12.
2410
2411 See also @option{-Wabi}.
2412
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.
2419
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}.
2424
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.
2429
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.
2435
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)}.
2444
2445 This flag is enabled by default for @option{-std=c++17}.
2446
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.
2456
2457 This option enables functions to be overloaded for ordinary and UTF-8
2458 strings:
2459
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
2466
2467 @noindent
2468 and introduces new signatures for user-defined literals:
2469
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
2478
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.
2484
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
2500
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)}.
2512
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
2517
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
2522
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.
2529
2530 @item -fconstexpr-loop-limit=@var{n}
2531 @opindex fconstexpr-loop-limit
2532 Set the maximum number of iterations for a loop in C++14 constexpr functions
2533 to @var{n}. A limit is needed to detect infinite loops during
2534 constant expression evaluation. The default is 262144 (1<<18).
2535
2536 @item -fconstexpr-ops-limit=@var{n}
2537 @opindex fconstexpr-ops-limit
2538 Set the maximum number of operations during a single constexpr evaluation.
2539 Even when number of iterations of a single loop is limited with the above limit,
2540 if there are several nested loops and each of them has many iterations but still
2541 smaller than the above limit, or if in a body of some loop or even outside
2542 of a loop too many expressions need to be evaluated, the resulting constexpr
2543 evaluation might take too long.
2544 The default is 33554432 (1<<25).
2545
2546 @item -fdeduce-init-list
2547 @opindex fdeduce-init-list
2548 Enable deduction of a template type parameter as
2549 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2550
2551 @smallexample
2552 template <class T> auto forward(T t) -> decltype (realfn (t))
2553 @{
2554 return realfn (t);
2555 @}
2556
2557 void f()
2558 @{
2559 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2560 @}
2561 @end smallexample
2562
2563 This deduction was implemented as a possible extension to the
2564 originally proposed semantics for the C++11 standard, but was not part
2565 of the final standard, so it is disabled by default. This option is
2566 deprecated, and may be removed in a future version of G++.
2567
2568 @item -fno-elide-constructors
2569 @opindex fno-elide-constructors
2570 @opindex felide-constructors
2571 The C++ standard allows an implementation to omit creating a temporary
2572 that is only used to initialize another object of the same type.
2573 Specifying this option disables that optimization, and forces G++ to
2574 call the copy constructor in all cases. This option also causes G++
2575 to call trivial member functions which otherwise would be expanded inline.
2576
2577 In C++17, the compiler is required to omit these temporaries, but this
2578 option still affects trivial member functions.
2579
2580 @item -fno-enforce-eh-specs
2581 @opindex fno-enforce-eh-specs
2582 @opindex fenforce-eh-specs
2583 Don't generate code to check for violation of exception specifications
2584 at run time. This option violates the C++ standard, but may be useful
2585 for reducing code size in production builds, much like defining
2586 @code{NDEBUG}. This does not give user code permission to throw
2587 exceptions in violation of the exception specifications; the compiler
2588 still optimizes based on the specifications, so throwing an
2589 unexpected exception results in undefined behavior at run time.
2590
2591 @item -fextern-tls-init
2592 @itemx -fno-extern-tls-init
2593 @opindex fextern-tls-init
2594 @opindex fno-extern-tls-init
2595 The C++11 and OpenMP standards allow @code{thread_local} and
2596 @code{threadprivate} variables to have dynamic (runtime)
2597 initialization. To support this, any use of such a variable goes
2598 through a wrapper function that performs any necessary initialization.
2599 When the use and definition of the variable are in the same
2600 translation unit, this overhead can be optimized away, but when the
2601 use is in a different translation unit there is significant overhead
2602 even if the variable doesn't actually need dynamic initialization. If
2603 the programmer can be sure that no use of the variable in a
2604 non-defining TU needs to trigger dynamic initialization (either
2605 because the variable is statically initialized, or a use of the
2606 variable in the defining TU will be executed before any uses in
2607 another TU), they can avoid this overhead with the
2608 @option{-fno-extern-tls-init} option.
2609
2610 On targets that support symbol aliases, the default is
2611 @option{-fextern-tls-init}. On targets that do not support symbol
2612 aliases, the default is @option{-fno-extern-tls-init}.
2613
2614 @item -fno-gnu-keywords
2615 @opindex fno-gnu-keywords
2616 @opindex fgnu-keywords
2617 Do not recognize @code{typeof} as a keyword, so that code can use this
2618 word as an identifier. You can use the keyword @code{__typeof__} instead.
2619 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2620 @option{-std=c++98}, @option{-std=c++11}, etc.
2621
2622 @item -fno-implicit-templates
2623 @opindex fno-implicit-templates
2624 @opindex fimplicit-templates
2625 Never emit code for non-inline templates that are instantiated
2626 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2627 If you use this option, you must take care to structure your code to
2628 include all the necessary explicit instantiations to avoid getting
2629 undefined symbols at link time.
2630 @xref{Template Instantiation}, for more information.
2631
2632 @item -fno-implicit-inline-templates
2633 @opindex fno-implicit-inline-templates
2634 @opindex fimplicit-inline-templates
2635 Don't emit code for implicit instantiations of inline templates, either.
2636 The default is to handle inlines differently so that compiles with and
2637 without optimization need the same set of explicit instantiations.
2638
2639 @item -fno-implement-inlines
2640 @opindex fno-implement-inlines
2641 @opindex fimplement-inlines
2642 To save space, do not emit out-of-line copies of inline functions
2643 controlled by @code{#pragma implementation}. This causes linker
2644 errors if these functions are not inlined everywhere they are called.
2645
2646 @item -fms-extensions
2647 @opindex fms-extensions
2648 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2649 int and getting a pointer to member function via non-standard syntax.
2650
2651 @item -fnew-inheriting-ctors
2652 @opindex fnew-inheriting-ctors
2653 Enable the P0136 adjustment to the semantics of C++11 constructor
2654 inheritance. This is part of C++17 but also considered to be a Defect
2655 Report against C++11 and C++14. This flag is enabled by default
2656 unless @option{-fabi-version=10} or lower is specified.
2657
2658 @item -fnew-ttp-matching
2659 @opindex fnew-ttp-matching
2660 Enable the P0522 resolution to Core issue 150, template template
2661 parameters and default arguments: this allows a template with default
2662 template arguments as an argument for a template template parameter
2663 with fewer template parameters. This flag is enabled by default for
2664 @option{-std=c++17}.
2665
2666 @item -fno-nonansi-builtins
2667 @opindex fno-nonansi-builtins
2668 @opindex fnonansi-builtins
2669 Disable built-in declarations of functions that are not mandated by
2670 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2671 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2672
2673 @item -fnothrow-opt
2674 @opindex fnothrow-opt
2675 Treat a @code{throw()} exception specification as if it were a
2676 @code{noexcept} specification to reduce or eliminate the text size
2677 overhead relative to a function with no exception specification. If
2678 the function has local variables of types with non-trivial
2679 destructors, the exception specification actually makes the
2680 function smaller because the EH cleanups for those variables can be
2681 optimized away. The semantic effect is that an exception thrown out of
2682 a function with such an exception specification results in a call
2683 to @code{terminate} rather than @code{unexpected}.
2684
2685 @item -fno-operator-names
2686 @opindex fno-operator-names
2687 @opindex foperator-names
2688 Do not treat the operator name keywords @code{and}, @code{bitand},
2689 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2690 synonyms as keywords.
2691
2692 @item -fno-optional-diags
2693 @opindex fno-optional-diags
2694 @opindex foptional-diags
2695 Disable diagnostics that the standard says a compiler does not need to
2696 issue. Currently, the only such diagnostic issued by G++ is the one for
2697 a name having multiple meanings within a class.
2698
2699 @item -fpermissive
2700 @opindex fpermissive
2701 Downgrade some diagnostics about nonconformant code from errors to
2702 warnings. Thus, using @option{-fpermissive} allows some
2703 nonconforming code to compile.
2704
2705 @item -fno-pretty-templates
2706 @opindex fno-pretty-templates
2707 @opindex fpretty-templates
2708 When an error message refers to a specialization of a function
2709 template, the compiler normally prints the signature of the
2710 template followed by the template arguments and any typedefs or
2711 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2712 rather than @code{void f(int)}) so that it's clear which template is
2713 involved. When an error message refers to a specialization of a class
2714 template, the compiler omits any template arguments that match
2715 the default template arguments for that template. If either of these
2716 behaviors make it harder to understand the error message rather than
2717 easier, you can use @option{-fno-pretty-templates} to disable them.
2718
2719 @item -frepo
2720 @opindex frepo
2721 Enable automatic template instantiation at link time. This option also
2722 implies @option{-fno-implicit-templates}. @xref{Template
2723 Instantiation}, for more information.
2724
2725 @item -fno-rtti
2726 @opindex fno-rtti
2727 @opindex frtti
2728 Disable generation of information about every class with virtual
2729 functions for use by the C++ run-time type identification features
2730 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2731 of the language, you can save some space by using this flag. Note that
2732 exception handling uses the same information, but G++ generates it as
2733 needed. The @code{dynamic_cast} operator can still be used for casts that
2734 do not require run-time type information, i.e.@: casts to @code{void *} or to
2735 unambiguous base classes.
2736
2737 Mixing code compiled with @option{-frtti} with that compiled with
2738 @option{-fno-rtti} may not work. For example, programs may
2739 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2740 for a class compiled with @option{-frtti}.
2741
2742 @item -fsized-deallocation
2743 @opindex fsized-deallocation
2744 Enable the built-in global declarations
2745 @smallexample
2746 void operator delete (void *, std::size_t) noexcept;
2747 void operator delete[] (void *, std::size_t) noexcept;
2748 @end smallexample
2749 as introduced in C++14. This is useful for user-defined replacement
2750 deallocation functions that, for example, use the size of the object
2751 to make deallocation faster. Enabled by default under
2752 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2753 warns about places that might want to add a definition.
2754
2755 @item -fstrict-enums
2756 @opindex fstrict-enums
2757 Allow the compiler to optimize using the assumption that a value of
2758 enumerated type can only be one of the values of the enumeration (as
2759 defined in the C++ standard; basically, a value that can be
2760 represented in the minimum number of bits needed to represent all the
2761 enumerators). This assumption may not be valid if the program uses a
2762 cast to convert an arbitrary integer value to the enumerated type.
2763
2764 @item -fstrong-eval-order
2765 @opindex fstrong-eval-order
2766 Evaluate member access, array subscripting, and shift expressions in
2767 left-to-right order, and evaluate assignment in right-to-left order,
2768 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2769 @option{-fstrong-eval-order=some} enables just the ordering of member
2770 access and shift expressions, and is the default without
2771 @option{-std=c++17}.
2772
2773 @item -ftemplate-backtrace-limit=@var{n}
2774 @opindex ftemplate-backtrace-limit
2775 Set the maximum number of template instantiation notes for a single
2776 warning or error to @var{n}. The default value is 10.
2777
2778 @item -ftemplate-depth=@var{n}
2779 @opindex ftemplate-depth
2780 Set the maximum instantiation depth for template classes to @var{n}.
2781 A limit on the template instantiation depth is needed to detect
2782 endless recursions during template class instantiation. ANSI/ISO C++
2783 conforming programs must not rely on a maximum depth greater than 17
2784 (changed to 1024 in C++11). The default value is 900, as the compiler
2785 can run out of stack space before hitting 1024 in some situations.
2786
2787 @item -fno-threadsafe-statics
2788 @opindex fno-threadsafe-statics
2789 @opindex fthreadsafe-statics
2790 Do not emit the extra code to use the routines specified in the C++
2791 ABI for thread-safe initialization of local statics. You can use this
2792 option to reduce code size slightly in code that doesn't need to be
2793 thread-safe.
2794
2795 @item -fuse-cxa-atexit
2796 @opindex fuse-cxa-atexit
2797 Register destructors for objects with static storage duration with the
2798 @code{__cxa_atexit} function rather than the @code{atexit} function.
2799 This option is required for fully standards-compliant handling of static
2800 destructors, but only works if your C library supports
2801 @code{__cxa_atexit}.
2802
2803 @item -fno-use-cxa-get-exception-ptr
2804 @opindex fno-use-cxa-get-exception-ptr
2805 @opindex fuse-cxa-get-exception-ptr
2806 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2807 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2808 if the runtime routine is not available.
2809
2810 @item -fvisibility-inlines-hidden
2811 @opindex fvisibility-inlines-hidden
2812 This switch declares that the user does not attempt to compare
2813 pointers to inline functions or methods where the addresses of the two functions
2814 are taken in different shared objects.
2815
2816 The effect of this is that GCC may, effectively, mark inline methods with
2817 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2818 appear in the export table of a DSO and do not require a PLT indirection
2819 when used within the DSO@. Enabling this option can have a dramatic effect
2820 on load and link times of a DSO as it massively reduces the size of the
2821 dynamic export table when the library makes heavy use of templates.
2822
2823 The behavior of this switch is not quite the same as marking the
2824 methods as hidden directly, because it does not affect static variables
2825 local to the function or cause the compiler to deduce that
2826 the function is defined in only one shared object.
2827
2828 You may mark a method as having a visibility explicitly to negate the
2829 effect of the switch for that method. For example, if you do want to
2830 compare pointers to a particular inline method, you might mark it as
2831 having default visibility. Marking the enclosing class with explicit
2832 visibility has no effect.
2833
2834 Explicitly instantiated inline methods are unaffected by this option
2835 as their linkage might otherwise cross a shared library boundary.
2836 @xref{Template Instantiation}.
2837
2838 @item -fvisibility-ms-compat
2839 @opindex fvisibility-ms-compat
2840 This flag attempts to use visibility settings to make GCC's C++
2841 linkage model compatible with that of Microsoft Visual Studio.
2842
2843 The flag makes these changes to GCC's linkage model:
2844
2845 @enumerate
2846 @item
2847 It sets the default visibility to @code{hidden}, like
2848 @option{-fvisibility=hidden}.
2849
2850 @item
2851 Types, but not their members, are not hidden by default.
2852
2853 @item
2854 The One Definition Rule is relaxed for types without explicit
2855 visibility specifications that are defined in more than one
2856 shared object: those declarations are permitted if they are
2857 permitted when this option is not used.
2858 @end enumerate
2859
2860 In new code it is better to use @option{-fvisibility=hidden} and
2861 export those classes that are intended to be externally visible.
2862 Unfortunately it is possible for code to rely, perhaps accidentally,
2863 on the Visual Studio behavior.
2864
2865 Among the consequences of these changes are that static data members
2866 of the same type with the same name but defined in different shared
2867 objects are different, so changing one does not change the other;
2868 and that pointers to function members defined in different shared
2869 objects may not compare equal. When this flag is given, it is a
2870 violation of the ODR to define types with the same name differently.
2871
2872 @item -fno-weak
2873 @opindex fno-weak
2874 @opindex fweak
2875 Do not use weak symbol support, even if it is provided by the linker.
2876 By default, G++ uses weak symbols if they are available. This
2877 option exists only for testing, and should not be used by end-users;
2878 it results in inferior code and has no benefits. This option may
2879 be removed in a future release of G++.
2880
2881 @item -nostdinc++
2882 @opindex nostdinc++
2883 Do not search for header files in the standard directories specific to
2884 C++, but do still search the other standard directories. (This option
2885 is used when building the C++ library.)
2886 @end table
2887
2888 In addition, these optimization, warning, and code generation options
2889 have meanings only for C++ programs:
2890
2891 @table @gcctabopt
2892 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2893 @opindex Wabi
2894 @opindex Wno-abi
2895 Warn when G++ it generates code that is probably not compatible with
2896 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2897 ABI with each major release, normally @option{-Wabi} will warn only if
2898 there is a check added later in a release series for an ABI issue
2899 discovered since the initial release. @option{-Wabi} will warn about
2900 more things if an older ABI version is selected (with
2901 @option{-fabi-version=@var{n}}).
2902
2903 @option{-Wabi} can also be used with an explicit version number to
2904 warn about compatibility with a particular @option{-fabi-version}
2905 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2906 @option{-fabi-version=2}.
2907
2908 If an explicit version number is provided and
2909 @option{-fabi-compat-version} is not specified, the version number
2910 from this option is used for compatibility aliases. If no explicit
2911 version number is provided with this option, but
2912 @option{-fabi-compat-version} is specified, that version number is
2913 used for ABI warnings.
2914
2915 Although an effort has been made to warn about
2916 all such cases, there are probably some cases that are not warned about,
2917 even though G++ is generating incompatible code. There may also be
2918 cases where warnings are emitted even though the code that is generated
2919 is compatible.
2920
2921 You should rewrite your code to avoid these warnings if you are
2922 concerned about the fact that code generated by G++ may not be binary
2923 compatible with code generated by other compilers.
2924
2925 Known incompatibilities in @option{-fabi-version=2} (which was the
2926 default from GCC 3.4 to 4.9) include:
2927
2928 @itemize @bullet
2929
2930 @item
2931 A template with a non-type template parameter of reference type was
2932 mangled incorrectly:
2933 @smallexample
2934 extern int N;
2935 template <int &> struct S @{@};
2936 void n (S<N>) @{2@}
2937 @end smallexample
2938
2939 This was fixed in @option{-fabi-version=3}.
2940
2941 @item
2942 SIMD vector types declared using @code{__attribute ((vector_size))} were
2943 mangled in a non-standard way that does not allow for overloading of
2944 functions taking vectors of different sizes.
2945
2946 The mangling was changed in @option{-fabi-version=4}.
2947
2948 @item
2949 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2950 qualifiers, and @code{decltype} of a plain declaration was folded away.
2951
2952 These mangling issues were fixed in @option{-fabi-version=5}.
2953
2954 @item
2955 Scoped enumerators passed as arguments to a variadic function are
2956 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2957 On most targets this does not actually affect the parameter passing
2958 ABI, as there is no way to pass an argument smaller than @code{int}.
2959
2960 Also, the ABI changed the mangling of template argument packs,
2961 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2962 a class scope function used as a template argument.
2963
2964 These issues were corrected in @option{-fabi-version=6}.
2965
2966 @item
2967 Lambdas in default argument scope were mangled incorrectly, and the
2968 ABI changed the mangling of @code{nullptr_t}.
2969
2970 These issues were corrected in @option{-fabi-version=7}.
2971
2972 @item
2973 When mangling a function type with function-cv-qualifiers, the
2974 un-qualified function type was incorrectly treated as a substitution
2975 candidate.
2976
2977 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2978
2979 @item
2980 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2981 unaligned accesses. Note that this did not affect the ABI of a
2982 function with a @code{nullptr_t} parameter, as parameters have a
2983 minimum alignment.
2984
2985 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2986
2987 @item
2988 Target-specific attributes that affect the identity of a type, such as
2989 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2990 did not affect the mangled name, leading to name collisions when
2991 function pointers were used as template arguments.
2992
2993 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2994
2995 @end itemize
2996
2997 It also warns about psABI-related changes. The known psABI changes at this
2998 point include:
2999
3000 @itemize @bullet
3001
3002 @item
3003 For SysV/x86-64, unions with @code{long double} members are
3004 passed in memory as specified in psABI. For example:
3005
3006 @smallexample
3007 union U @{
3008 long double ld;
3009 int i;
3010 @};
3011 @end smallexample
3012
3013 @noindent
3014 @code{union U} is always passed in memory.
3015
3016 @end itemize
3017
3018 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3019 @opindex Wabi-tag
3020 @opindex Wabi-tag
3021 Warn when a type with an ABI tag is used in a context that does not
3022 have that ABI tag. See @ref{C++ Attributes} for more information
3023 about ABI tags.
3024
3025 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3026 @opindex Wctor-dtor-privacy
3027 @opindex Wno-ctor-dtor-privacy
3028 Warn when a class seems unusable because all the constructors or
3029 destructors in that class are private, and it has neither friends nor
3030 public static member functions. Also warn if there are no non-private
3031 methods, and there's at least one private member function that isn't
3032 a constructor or destructor.
3033
3034 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3035 @opindex Wdelete-non-virtual-dtor
3036 @opindex Wno-delete-non-virtual-dtor
3037 Warn when @code{delete} is used to destroy an instance of a class that
3038 has virtual functions and non-virtual destructor. It is unsafe to delete
3039 an instance of a derived class through a pointer to a base class if the
3040 base class does not have a virtual destructor. This warning is enabled
3041 by @option{-Wall}.
3042
3043 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3044 @opindex Wdeprecated-copy
3045 @opindex Wno-deprecated-copy
3046 Warn that the implicit declaration of a copy constructor or copy
3047 assignment operator is deprecated if the class has a user-provided
3048 copy constructor or copy assignment operator, in C++11 and up. This
3049 warning is enabled by @option{-Wextra}. With
3050 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3051 user-provided destructor.
3052
3053 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3054 @opindex Winit-list-lifetime
3055 @opindex Wno-init-list-lifetime
3056 Do not warn about uses of @code{std::initializer_list} that are likely
3057 to result in dangling pointers. Since the underlying array for an
3058 @code{initializer_list} is handled like a normal C++ temporary object,
3059 it is easy to inadvertently keep a pointer to the array past the end
3060 of the array's lifetime. For example:
3061
3062 @itemize @bullet
3063 @item
3064 If a function returns a temporary @code{initializer_list}, or a local
3065 @code{initializer_list} variable, the array's lifetime ends at the end
3066 of the return statement, so the value returned has a dangling pointer.
3067
3068 @item
3069 If a new-expression creates an @code{initializer_list}, the array only
3070 lives until the end of the enclosing full-expression, so the
3071 @code{initializer_list} in the heap has a dangling pointer.
3072
3073 @item
3074 When an @code{initializer_list} variable is assigned from a
3075 brace-enclosed initializer list, the temporary array created for the
3076 right side of the assignment only lives until the end of the
3077 full-expression, so at the next statement the @code{initializer_list}
3078 variable has a dangling pointer.
3079
3080 @smallexample
3081 // li's initial underlying array lives as long as li
3082 std::initializer_list<int> li = @{ 1,2,3 @};
3083 // assignment changes li to point to a temporary array
3084 li = @{ 4, 5 @};
3085 // now the temporary is gone and li has a dangling pointer
3086 int i = li.begin()[0] // undefined behavior
3087 @end smallexample
3088
3089 @item
3090 When a list constructor stores the @code{begin} pointer from the
3091 @code{initializer_list} argument, this doesn't extend the lifetime of
3092 the array, so if a class variable is constructed from a temporary
3093 @code{initializer_list}, the pointer is left dangling by the end of
3094 the variable declaration statement.
3095
3096 @end itemize
3097
3098 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3099 @opindex Wliteral-suffix
3100 @opindex Wno-literal-suffix
3101 Warn when a string or character literal is followed by a ud-suffix which does
3102 not begin with an underscore. As a conforming extension, GCC treats such
3103 suffixes as separate preprocessing tokens in order to maintain backwards
3104 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3105 For example:
3106
3107 @smallexample
3108 #define __STDC_FORMAT_MACROS
3109 #include <inttypes.h>
3110 #include <stdio.h>
3111
3112 int main() @{
3113 int64_t i64 = 123;
3114 printf("My int64: %" PRId64"\n", i64);
3115 @}
3116 @end smallexample
3117
3118 In this case, @code{PRId64} is treated as a separate preprocessing token.
3119
3120 Additionally, warn when a user-defined literal operator is declared with
3121 a literal suffix identifier that doesn't begin with an underscore. Literal
3122 suffix identifiers that don't begin with an underscore are reserved for
3123 future standardization.
3124
3125 This warning is enabled by default.
3126
3127 @item -Wlto-type-mismatch
3128 @opindex Wlto-type-mismatch
3129 @opindex Wno-lto-type-mismatch
3130
3131 During the link-time optimization warn about type mismatches in
3132 global declarations from different compilation units.
3133 Requires @option{-flto} to be enabled. Enabled by default.
3134
3135 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3136 @opindex Wnarrowing
3137 @opindex Wno-narrowing
3138 For C++11 and later standards, narrowing conversions are diagnosed by default,
3139 as required by the standard. A narrowing conversion from a constant produces
3140 an error, and a narrowing conversion from a non-constant produces a warning,
3141 but @option{-Wno-narrowing} suppresses the diagnostic.
3142 Note that this does not affect the meaning of well-formed code;
3143 narrowing conversions are still considered ill-formed in SFINAE contexts.
3144
3145 With @option{-Wnarrowing} in C++98, warn when a narrowing
3146 conversion prohibited by C++11 occurs within
3147 @samp{@{ @}}, e.g.
3148
3149 @smallexample
3150 int i = @{ 2.2 @}; // error: narrowing from double to int
3151 @end smallexample
3152
3153 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3154
3155 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3156 @opindex Wnoexcept
3157 @opindex Wno-noexcept
3158 Warn when a noexcept-expression evaluates to false because of a call
3159 to a function that does not have a non-throwing exception
3160 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3161 the compiler to never throw an exception.
3162
3163 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3164 @opindex Wnoexcept-type
3165 @opindex Wno-noexcept-type
3166 Warn if the C++17 feature making @code{noexcept} part of a function
3167 type changes the mangled name of a symbol relative to C++14. Enabled
3168 by @option{-Wabi} and @option{-Wc++17-compat}.
3169
3170 As an example:
3171
3172 @smallexample
3173 template <class T> void f(T t) @{ t(); @};
3174 void g() noexcept;
3175 void h() @{ f(g); @}
3176 @end smallexample
3177
3178 @noindent
3179 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3180 C++17 it calls @code{f<void(*)()noexcept>}.
3181
3182 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3183 @opindex Wclass-memaccess
3184 @opindex Wno-class-memaccess
3185 Warn when the destination of a call to a raw memory function such as
3186 @code{memset} or @code{memcpy} is an object of class type, and when writing
3187 into such an object might bypass the class non-trivial or deleted constructor
3188 or copy assignment, violate const-correctness or encapsulation, or corrupt
3189 virtual table pointers. Modifying the representation of such objects may
3190 violate invariants maintained by member functions of the class. For example,
3191 the call to @code{memset} below is undefined because it modifies a non-trivial
3192 class object and is, therefore, diagnosed. The safe way to either initialize
3193 or clear the storage of objects of such types is by using the appropriate
3194 constructor or assignment operator, if one is available.
3195 @smallexample
3196 std::string str = "abc";
3197 memset (&str, 0, sizeof str);
3198 @end smallexample
3199 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3200 Explicitly casting the pointer to the class object to @code{void *} or
3201 to a type that can be safely accessed by the raw memory function suppresses
3202 the warning.
3203
3204 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3205 @opindex Wnon-virtual-dtor
3206 @opindex Wno-non-virtual-dtor
3207 Warn when a class has virtual functions and an accessible non-virtual
3208 destructor itself or in an accessible polymorphic base class, in which
3209 case it is possible but unsafe to delete an instance of a derived
3210 class through a pointer to the class itself or base class. This
3211 warning is automatically enabled if @option{-Weffc++} is specified.
3212
3213 @item -Wregister @r{(C++ and Objective-C++ only)}
3214 @opindex Wregister
3215 @opindex Wno-register
3216 Warn on uses of the @code{register} storage class specifier, except
3217 when it is part of the GNU @ref{Explicit Register Variables} extension.
3218 The use of the @code{register} keyword as storage class specifier has
3219 been deprecated in C++11 and removed in C++17.
3220 Enabled by default with @option{-std=c++17}.
3221
3222 @item -Wreorder @r{(C++ and Objective-C++ only)}
3223 @opindex Wreorder
3224 @opindex Wno-reorder
3225 @cindex reordering, warning
3226 @cindex warning for reordering of member initializers
3227 Warn when the order of member initializers given in the code does not
3228 match the order in which they must be executed. For instance:
3229
3230 @smallexample
3231 struct A @{
3232 int i;
3233 int j;
3234 A(): j (0), i (1) @{ @}
3235 @};
3236 @end smallexample
3237
3238 @noindent
3239 The compiler rearranges the member initializers for @code{i}
3240 and @code{j} to match the declaration order of the members, emitting
3241 a warning to that effect. This warning is enabled by @option{-Wall}.
3242
3243 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3244 @opindex Wpessimizing-move
3245 @opindex Wno-pessimizing-move
3246 This warning warns when a call to @code{std::move} prevents copy
3247 elision. A typical scenario when copy elision can occur is when returning in
3248 a function with a class return type, when the expression being returned is the
3249 name of a non-volatile automatic object, and is not a function parameter, and
3250 has the same type as the function return type.
3251
3252 @smallexample
3253 struct T @{
3254 @dots{}
3255 @};
3256 T fn()
3257 @{
3258 T t;
3259 @dots{}
3260 return std::move (t);
3261 @}
3262 @end smallexample
3263
3264 But in this example, the @code{std::move} call prevents copy elision.
3265
3266 This warning is enabled by @option{-Wall}.
3267
3268 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3269 @opindex Wredundant-move
3270 @opindex Wno-redundant-move
3271 This warning warns about redundant calls to @code{std::move}; that is, when
3272 a move operation would have been performed even without the @code{std::move}
3273 call. This happens because the compiler is forced to treat the object as if
3274 it were an rvalue in certain situations such as returning a local variable,
3275 where copy elision isn't applicable. Consider:
3276
3277 @smallexample
3278 struct T @{
3279 @dots{}
3280 @};
3281 T fn(T t)
3282 @{
3283 @dots{}
3284 return std::move (t);
3285 @}
3286 @end smallexample
3287
3288 Here, the @code{std::move} call is redundant. Because G++ implements Core
3289 Issue 1579, another example is:
3290
3291 @smallexample
3292 struct T @{ // convertible to U
3293 @dots{}
3294 @};
3295 struct U @{
3296 @dots{}
3297 @};
3298 U fn()
3299 @{
3300 T t;
3301 @dots{}
3302 return std::move (t);
3303 @}
3304 @end smallexample
3305 In this example, copy elision isn't applicable because the type of the
3306 expression being returned and the function return type differ, yet G++
3307 treats the return value as if it were designated by an rvalue.
3308
3309 This warning is enabled by @option{-Wextra}.
3310
3311 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3312 @opindex fext-numeric-literals
3313 @opindex fno-ext-numeric-literals
3314 Accept imaginary, fixed-point, or machine-defined
3315 literal number suffixes as GNU extensions.
3316 When this option is turned off these suffixes are treated
3317 as C++11 user-defined literal numeric suffixes.
3318 This is on by default for all pre-C++11 dialects and all GNU dialects:
3319 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3320 @option{-std=gnu++14}.
3321 This option is off by default
3322 for ISO C++11 onwards (@option{-std=c++11}, ...).
3323 @end table
3324
3325 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3326
3327 @table @gcctabopt
3328 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3329 @opindex Weffc++
3330 @opindex Wno-effc++
3331 Warn about violations of the following style guidelines from Scott Meyers'
3332 @cite{Effective C++} series of books:
3333
3334 @itemize @bullet
3335 @item
3336 Define a copy constructor and an assignment operator for classes
3337 with dynamically-allocated memory.
3338
3339 @item
3340 Prefer initialization to assignment in constructors.
3341
3342 @item
3343 Have @code{operator=} return a reference to @code{*this}.
3344
3345 @item
3346 Don't try to return a reference when you must return an object.
3347
3348 @item
3349 Distinguish between prefix and postfix forms of increment and
3350 decrement operators.
3351
3352 @item
3353 Never overload @code{&&}, @code{||}, or @code{,}.
3354
3355 @end itemize
3356
3357 This option also enables @option{-Wnon-virtual-dtor}, which is also
3358 one of the effective C++ recommendations. However, the check is
3359 extended to warn about the lack of virtual destructor in accessible
3360 non-polymorphic bases classes too.
3361
3362 When selecting this option, be aware that the standard library
3363 headers do not obey all of these guidelines; use @samp{grep -v}
3364 to filter out those warnings.
3365
3366 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3367 @opindex Wstrict-null-sentinel
3368 @opindex Wno-strict-null-sentinel
3369 Warn about the use of an uncasted @code{NULL} as sentinel. When
3370 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3371 to @code{__null}. Although it is a null pointer constant rather than a
3372 null pointer, it is guaranteed to be of the same size as a pointer.
3373 But this use is not portable across different compilers.
3374
3375 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3376 @opindex Wno-non-template-friend
3377 @opindex Wnon-template-friend
3378 Disable warnings when non-template friend functions are declared
3379 within a template. In very old versions of GCC that predate implementation
3380 of the ISO standard, declarations such as
3381 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3382 could be interpreted as a particular specialization of a template
3383 function; the warning exists to diagnose compatibility problems,
3384 and is enabled by default.
3385
3386 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3387 @opindex Wold-style-cast
3388 @opindex Wno-old-style-cast
3389 Warn if an old-style (C-style) cast to a non-void type is used within
3390 a C++ program. The new-style casts (@code{dynamic_cast},
3391 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3392 less vulnerable to unintended effects and much easier to search for.
3393
3394 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3395 @opindex Woverloaded-virtual
3396 @opindex Wno-overloaded-virtual
3397 @cindex overloaded virtual function, warning
3398 @cindex warning for overloaded virtual function
3399 Warn when a function declaration hides virtual functions from a
3400 base class. For example, in:
3401
3402 @smallexample
3403 struct A @{
3404 virtual void f();
3405 @};
3406
3407 struct B: public A @{
3408 void f(int);
3409 @};
3410 @end smallexample
3411
3412 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3413 like:
3414
3415 @smallexample
3416 B* b;
3417 b->f();
3418 @end smallexample
3419
3420 @noindent
3421 fails to compile.
3422
3423 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3424 @opindex Wno-pmf-conversions
3425 @opindex Wpmf-conversions
3426 Disable the diagnostic for converting a bound pointer to member function
3427 to a plain pointer.
3428
3429 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3430 @opindex Wsign-promo
3431 @opindex Wno-sign-promo
3432 Warn when overload resolution chooses a promotion from unsigned or
3433 enumerated type to a signed type, over a conversion to an unsigned type of
3434 the same size. Previous versions of G++ tried to preserve
3435 unsignedness, but the standard mandates the current behavior.
3436
3437 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3438 @opindex Wtemplates
3439 @opindex Wno-templates
3440 Warn when a primary template declaration is encountered. Some coding
3441 rules disallow templates, and this may be used to enforce that rule.
3442 The warning is inactive inside a system header file, such as the STL, so
3443 one can still use the STL. One may also instantiate or specialize
3444 templates.
3445
3446 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3447 @opindex Wmultiple-inheritance
3448 @opindex Wno-multiple-inheritance
3449 Warn when a class is defined with multiple direct base classes. Some
3450 coding rules disallow multiple inheritance, and this may be used to
3451 enforce that rule. The warning is inactive inside a system header file,
3452 such as the STL, so one can still use the STL. One may also define
3453 classes that indirectly use multiple inheritance.
3454
3455 @item -Wvirtual-inheritance
3456 @opindex Wvirtual-inheritance
3457 @opindex Wno-virtual-inheritance
3458 Warn when a class is defined with a virtual direct base class. Some
3459 coding rules disallow multiple inheritance, and this may be used to
3460 enforce that rule. The warning is inactive inside a system header file,
3461 such as the STL, so one can still use the STL. One may also define
3462 classes that indirectly use virtual inheritance.
3463
3464 @item -Wnamespaces
3465 @opindex Wnamespaces
3466 @opindex Wno-namespaces
3467 Warn when a namespace definition is opened. Some coding rules disallow
3468 namespaces, and this may be used to enforce that rule. The warning is
3469 inactive inside a system header file, such as the STL, so one can still
3470 use the STL. One may also use using directives and qualified names.
3471
3472 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3473 @opindex Wterminate
3474 @opindex Wno-terminate
3475 Disable the warning about a throw-expression that will immediately
3476 result in a call to @code{terminate}.
3477
3478 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3479 @opindex Wno-class-conversion
3480 @opindex Wclass-conversion
3481 Disable the warning about the case when a conversion function converts an
3482 object to the same type, to a base class of that type, or to void; such
3483 a conversion function will never be called.
3484 @end table
3485
3486 @node Objective-C and Objective-C++ Dialect Options
3487 @section Options Controlling Objective-C and Objective-C++ Dialects
3488
3489 @cindex compiler options, Objective-C and Objective-C++
3490 @cindex Objective-C and Objective-C++ options, command-line
3491 @cindex options, Objective-C and Objective-C++
3492 (NOTE: This manual does not describe the Objective-C and Objective-C++
3493 languages themselves. @xref{Standards,,Language Standards
3494 Supported by GCC}, for references.)
3495
3496 This section describes the command-line options that are only meaningful
3497 for Objective-C and Objective-C++ programs. You can also use most of
3498 the language-independent GNU compiler options.
3499 For example, you might compile a file @file{some_class.m} like this:
3500
3501 @smallexample
3502 gcc -g -fgnu-runtime -O -c some_class.m
3503 @end smallexample
3504
3505 @noindent
3506 In this example, @option{-fgnu-runtime} is an option meant only for
3507 Objective-C and Objective-C++ programs; you can use the other options with
3508 any language supported by GCC@.
3509
3510 Note that since Objective-C is an extension of the C language, Objective-C
3511 compilations may also use options specific to the C front-end (e.g.,
3512 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3513 C++-specific options (e.g., @option{-Wabi}).
3514
3515 Here is a list of options that are @emph{only} for compiling Objective-C
3516 and Objective-C++ programs:
3517
3518 @table @gcctabopt
3519 @item -fconstant-string-class=@var{class-name}
3520 @opindex fconstant-string-class
3521 Use @var{class-name} as the name of the class to instantiate for each
3522 literal string specified with the syntax @code{@@"@dots{}"}. The default
3523 class name is @code{NXConstantString} if the GNU runtime is being used, and
3524 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3525 @option{-fconstant-cfstrings} option, if also present, overrides the
3526 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3527 to be laid out as constant CoreFoundation strings.
3528
3529 @item -fgnu-runtime
3530 @opindex fgnu-runtime
3531 Generate object code compatible with the standard GNU Objective-C
3532 runtime. This is the default for most types of systems.
3533
3534 @item -fnext-runtime
3535 @opindex fnext-runtime
3536 Generate output compatible with the NeXT runtime. This is the default
3537 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3538 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3539 used.
3540
3541 @item -fno-nil-receivers
3542 @opindex fno-nil-receivers
3543 @opindex fnil-receivers
3544 Assume that all Objective-C message dispatches (@code{[receiver
3545 message:arg]}) in this translation unit ensure that the receiver is
3546 not @code{nil}. This allows for more efficient entry points in the
3547 runtime to be used. This option is only available in conjunction with
3548 the NeXT runtime and ABI version 0 or 1.
3549
3550 @item -fobjc-abi-version=@var{n}
3551 @opindex fobjc-abi-version
3552 Use version @var{n} of the Objective-C ABI for the selected runtime.
3553 This option is currently supported only for the NeXT runtime. In that
3554 case, Version 0 is the traditional (32-bit) ABI without support for
3555 properties and other Objective-C 2.0 additions. Version 1 is the
3556 traditional (32-bit) ABI with support for properties and other
3557 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3558 nothing is specified, the default is Version 0 on 32-bit target
3559 machines, and Version 2 on 64-bit target machines.
3560
3561 @item -fobjc-call-cxx-cdtors
3562 @opindex fobjc-call-cxx-cdtors
3563 For each Objective-C class, check if any of its instance variables is a
3564 C++ object with a non-trivial default constructor. If so, synthesize a
3565 special @code{- (id) .cxx_construct} instance method which runs
3566 non-trivial default constructors on any such instance variables, in order,
3567 and then return @code{self}. Similarly, check if any instance variable
3568 is a C++ object with a non-trivial destructor, and if so, synthesize a
3569 special @code{- (void) .cxx_destruct} method which runs
3570 all such default destructors, in reverse order.
3571
3572 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3573 methods thusly generated only operate on instance variables
3574 declared in the current Objective-C class, and not those inherited
3575 from superclasses. It is the responsibility of the Objective-C
3576 runtime to invoke all such methods in an object's inheritance
3577 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3578 by the runtime immediately after a new object instance is allocated;
3579 the @code{- (void) .cxx_destruct} methods are invoked immediately
3580 before the runtime deallocates an object instance.
3581
3582 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3583 support for invoking the @code{- (id) .cxx_construct} and
3584 @code{- (void) .cxx_destruct} methods.
3585
3586 @item -fobjc-direct-dispatch
3587 @opindex fobjc-direct-dispatch
3588 Allow fast jumps to the message dispatcher. On Darwin this is
3589 accomplished via the comm page.
3590
3591 @item -fobjc-exceptions
3592 @opindex fobjc-exceptions
3593 Enable syntactic support for structured exception handling in
3594 Objective-C, similar to what is offered by C++. This option
3595 is required to use the Objective-C keywords @code{@@try},
3596 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3597 @code{@@synchronized}. This option is available with both the GNU
3598 runtime and the NeXT runtime (but not available in conjunction with
3599 the NeXT runtime on Mac OS X 10.2 and earlier).
3600
3601 @item -fobjc-gc
3602 @opindex fobjc-gc
3603 Enable garbage collection (GC) in Objective-C and Objective-C++
3604 programs. This option is only available with the NeXT runtime; the
3605 GNU runtime has a different garbage collection implementation that
3606 does not require special compiler flags.
3607
3608 @item -fobjc-nilcheck
3609 @opindex fobjc-nilcheck
3610 For the NeXT runtime with version 2 of the ABI, check for a nil
3611 receiver in method invocations before doing the actual method call.
3612 This is the default and can be disabled using
3613 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3614 checked for nil in this way no matter what this flag is set to.
3615 Currently this flag does nothing when the GNU runtime, or an older
3616 version of the NeXT runtime ABI, is used.
3617
3618 @item -fobjc-std=objc1
3619 @opindex fobjc-std
3620 Conform to the language syntax of Objective-C 1.0, the language
3621 recognized by GCC 4.0. This only affects the Objective-C additions to
3622 the C/C++ language; it does not affect conformance to C/C++ standards,
3623 which is controlled by the separate C/C++ dialect option flags. When
3624 this option is used with the Objective-C or Objective-C++ compiler,
3625 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3626 This is useful if you need to make sure that your Objective-C code can
3627 be compiled with older versions of GCC@.
3628
3629 @item -freplace-objc-classes
3630 @opindex freplace-objc-classes
3631 Emit a special marker instructing @command{ld(1)} not to statically link in
3632 the resulting object file, and allow @command{dyld(1)} to load it in at
3633 run time instead. This is used in conjunction with the Fix-and-Continue
3634 debugging mode, where the object file in question may be recompiled and
3635 dynamically reloaded in the course of program execution, without the need
3636 to restart the program itself. Currently, Fix-and-Continue functionality
3637 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3638 and later.
3639
3640 @item -fzero-link
3641 @opindex fzero-link
3642 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3643 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3644 compile time) with static class references that get initialized at load time,
3645 which improves run-time performance. Specifying the @option{-fzero-link} flag
3646 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3647 to be retained. This is useful in Zero-Link debugging mode, since it allows
3648 for individual class implementations to be modified during program execution.
3649 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3650 regardless of command-line options.
3651
3652 @item -fno-local-ivars
3653 @opindex fno-local-ivars
3654 @opindex flocal-ivars
3655 By default instance variables in Objective-C can be accessed as if
3656 they were local variables from within the methods of the class they're
3657 declared in. This can lead to shadowing between instance variables
3658 and other variables declared either locally inside a class method or
3659 globally with the same name. Specifying the @option{-fno-local-ivars}
3660 flag disables this behavior thus avoiding variable shadowing issues.
3661
3662 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3663 @opindex fivar-visibility
3664 Set the default instance variable visibility to the specified option
3665 so that instance variables declared outside the scope of any access
3666 modifier directives default to the specified visibility.
3667
3668 @item -gen-decls
3669 @opindex gen-decls
3670 Dump interface declarations for all classes seen in the source file to a
3671 file named @file{@var{sourcename}.decl}.
3672
3673 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3674 @opindex Wassign-intercept
3675 @opindex Wno-assign-intercept
3676 Warn whenever an Objective-C assignment is being intercepted by the
3677 garbage collector.
3678
3679 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3680 @opindex Wno-protocol
3681 @opindex Wprotocol
3682 If a class is declared to implement a protocol, a warning is issued for
3683 every method in the protocol that is not implemented by the class. The
3684 default behavior is to issue a warning for every method not explicitly
3685 implemented in the class, even if a method implementation is inherited
3686 from the superclass. If you use the @option{-Wno-protocol} option, then
3687 methods inherited from the superclass are considered to be implemented,
3688 and no warning is issued for them.
3689
3690 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3691 @opindex Wselector
3692 @opindex Wno-selector
3693 Warn if multiple methods of different types for the same selector are
3694 found during compilation. The check is performed on the list of methods
3695 in the final stage of compilation. Additionally, a check is performed
3696 for each selector appearing in a @code{@@selector(@dots{})}
3697 expression, and a corresponding method for that selector has been found
3698 during compilation. Because these checks scan the method table only at
3699 the end of compilation, these warnings are not produced if the final
3700 stage of compilation is not reached, for example because an error is
3701 found during compilation, or because the @option{-fsyntax-only} option is
3702 being used.
3703
3704 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3705 @opindex Wstrict-selector-match
3706 @opindex Wno-strict-selector-match
3707 Warn if multiple methods with differing argument and/or return types are
3708 found for a given selector when attempting to send a message using this
3709 selector to a receiver of type @code{id} or @code{Class}. When this flag
3710 is off (which is the default behavior), the compiler omits such warnings
3711 if any differences found are confined to types that share the same size
3712 and alignment.
3713
3714 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3715 @opindex Wundeclared-selector
3716 @opindex Wno-undeclared-selector
3717 Warn if a @code{@@selector(@dots{})} expression referring to an
3718 undeclared selector is found. A selector is considered undeclared if no
3719 method with that name has been declared before the
3720 @code{@@selector(@dots{})} expression, either explicitly in an
3721 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3722 an @code{@@implementation} section. This option always performs its
3723 checks as soon as a @code{@@selector(@dots{})} expression is found,
3724 while @option{-Wselector} only performs its checks in the final stage of
3725 compilation. This also enforces the coding style convention
3726 that methods and selectors must be declared before being used.
3727
3728 @item -print-objc-runtime-info
3729 @opindex print-objc-runtime-info
3730 Generate C header describing the largest structure that is passed by
3731 value, if any.
3732
3733 @end table
3734
3735 @node Diagnostic Message Formatting Options
3736 @section Options to Control Diagnostic Messages Formatting
3737 @cindex options to control diagnostics formatting
3738 @cindex diagnostic messages
3739 @cindex message formatting
3740
3741 Traditionally, diagnostic messages have been formatted irrespective of
3742 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3743 options described below
3744 to control the formatting algorithm for diagnostic messages,
3745 e.g.@: how many characters per line, how often source location
3746 information should be reported. Note that some language front ends may not
3747 honor these options.
3748
3749 @table @gcctabopt
3750 @item -fmessage-length=@var{n}
3751 @opindex fmessage-length
3752 Try to format error messages so that they fit on lines of about
3753 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3754 done; each error message appears on a single line. This is the
3755 default for all front ends.
3756
3757 Note - this option also affects the display of the @samp{#error} and
3758 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3759 function/type/variable attribute. It does not however affect the
3760 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3761
3762 @item -fdiagnostics-show-location=once
3763 @opindex fdiagnostics-show-location
3764 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3765 reporter to emit source location information @emph{once}; that is, in
3766 case the message is too long to fit on a single physical line and has to
3767 be wrapped, the source location won't be emitted (as prefix) again,
3768 over and over, in subsequent continuation lines. This is the default
3769 behavior.
3770
3771 @item -fdiagnostics-show-location=every-line
3772 Only meaningful in line-wrapping mode. Instructs the diagnostic
3773 messages reporter to emit the same source location information (as
3774 prefix) for physical lines that result from the process of breaking
3775 a message which is too long to fit on a single line.
3776
3777 @item -fdiagnostics-color[=@var{WHEN}]
3778 @itemx -fno-diagnostics-color
3779 @opindex fdiagnostics-color
3780 @cindex highlight, color
3781 @vindex GCC_COLORS @r{environment variable}
3782 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3783 or @samp{auto}. The default depends on how the compiler has been configured,
3784 it can be any of the above @var{WHEN} options or also @samp{never}
3785 if @env{GCC_COLORS} environment variable isn't present in the environment,
3786 and @samp{auto} otherwise.
3787 @samp{auto} means to use color only when the standard error is a terminal.
3788 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3789 aliases for @option{-fdiagnostics-color=always} and
3790 @option{-fdiagnostics-color=never}, respectively.
3791
3792 The colors are defined by the environment variable @env{GCC_COLORS}.
3793 Its value is a colon-separated list of capabilities and Select Graphic
3794 Rendition (SGR) substrings. SGR commands are interpreted by the
3795 terminal or terminal emulator. (See the section in the documentation
3796 of your text terminal for permitted values and their meanings as
3797 character attributes.) These substring values are integers in decimal
3798 representation and can be concatenated with semicolons.
3799 Common values to concatenate include
3800 @samp{1} for bold,
3801 @samp{4} for underline,
3802 @samp{5} for blink,
3803 @samp{7} for inverse,
3804 @samp{39} for default foreground color,
3805 @samp{30} to @samp{37} for foreground colors,
3806 @samp{90} to @samp{97} for 16-color mode foreground colors,
3807 @samp{38;5;0} to @samp{38;5;255}
3808 for 88-color and 256-color modes foreground colors,
3809 @samp{49} for default background color,
3810 @samp{40} to @samp{47} for background colors,
3811 @samp{100} to @samp{107} for 16-color mode background colors,
3812 and @samp{48;5;0} to @samp{48;5;255}
3813 for 88-color and 256-color modes background colors.
3814
3815 The default @env{GCC_COLORS} is
3816 @smallexample
3817 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3818 quote=01:fixit-insert=32:fixit-delete=31:\
3819 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3820 type-diff=01;32
3821 @end smallexample
3822 @noindent
3823 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3824 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3825 @samp{01} is bold, and @samp{31} is red.
3826 Setting @env{GCC_COLORS} to the empty string disables colors.
3827 Supported capabilities are as follows.
3828
3829 @table @code
3830 @item error=
3831 @vindex error GCC_COLORS @r{capability}
3832 SGR substring for error: markers.
3833
3834 @item warning=
3835 @vindex warning GCC_COLORS @r{capability}
3836 SGR substring for warning: markers.
3837
3838 @item note=
3839 @vindex note GCC_COLORS @r{capability}
3840 SGR substring for note: markers.
3841
3842 @item range1=
3843 @vindex range1 GCC_COLORS @r{capability}
3844 SGR substring for first additional range.
3845
3846 @item range2=
3847 @vindex range2 GCC_COLORS @r{capability}
3848 SGR substring for second additional range.
3849
3850 @item locus=
3851 @vindex locus GCC_COLORS @r{capability}
3852 SGR substring for location information, @samp{file:line} or
3853 @samp{file:line:column} etc.
3854
3855 @item quote=
3856 @vindex quote GCC_COLORS @r{capability}
3857 SGR substring for information printed within quotes.
3858
3859 @item fixit-insert=
3860 @vindex fixit-insert GCC_COLORS @r{capability}
3861 SGR substring for fix-it hints suggesting text to
3862 be inserted or replaced.
3863
3864 @item fixit-delete=
3865 @vindex fixit-delete GCC_COLORS @r{capability}
3866 SGR substring for fix-it hints suggesting text to
3867 be deleted.
3868
3869 @item diff-filename=
3870 @vindex diff-filename GCC_COLORS @r{capability}
3871 SGR substring for filename headers within generated patches.
3872
3873 @item diff-hunk=
3874 @vindex diff-hunk GCC_COLORS @r{capability}
3875 SGR substring for the starts of hunks within generated patches.
3876
3877 @item diff-delete=
3878 @vindex diff-delete GCC_COLORS @r{capability}
3879 SGR substring for deleted lines within generated patches.
3880
3881 @item diff-insert=
3882 @vindex diff-insert GCC_COLORS @r{capability}
3883 SGR substring for inserted lines within generated patches.
3884
3885 @item type-diff=
3886 @vindex type-diff GCC_COLORS @r{capability}
3887 SGR substring for highlighting mismatching types within template
3888 arguments in the C++ frontend.
3889 @end table
3890
3891 @item -fno-diagnostics-show-option
3892 @opindex fno-diagnostics-show-option
3893 @opindex fdiagnostics-show-option
3894 By default, each diagnostic emitted includes text indicating the
3895 command-line option that directly controls the diagnostic (if such an
3896 option is known to the diagnostic machinery). Specifying the
3897 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3898
3899 @item -fno-diagnostics-show-caret
3900 @opindex fno-diagnostics-show-caret
3901 @opindex fdiagnostics-show-caret
3902 By default, each diagnostic emitted includes the original source line
3903 and a caret @samp{^} indicating the column. This option suppresses this
3904 information. The source line is truncated to @var{n} characters, if
3905 the @option{-fmessage-length=n} option is given. When the output is done
3906 to the terminal, the width is limited to the width given by the
3907 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3908
3909 @item -fno-diagnostics-show-labels
3910 @opindex fno-diagnostics-show-labels
3911 @opindex fdiagnostics-show-labels
3912 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3913 diagnostics can label ranges of source code with pertinent information, such
3914 as the types of expressions:
3915
3916 @smallexample
3917 printf ("foo %s bar", long_i + long_j);
3918 ~^ ~~~~~~~~~~~~~~~
3919 | |
3920 char * long int
3921 @end smallexample
3922
3923 This option suppresses the printing of these labels (in the example above,
3924 the vertical bars and the ``char *'' and ``long int'' text).
3925
3926 @item -fno-diagnostics-show-line-numbers
3927 @opindex fno-diagnostics-show-line-numbers
3928 @opindex fdiagnostics-show-line-numbers
3929 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3930 a left margin is printed, showing line numbers. This option suppresses this
3931 left margin.
3932
3933 @item -fdiagnostics-minimum-margin-width=@var{width}
3934 @opindex fdiagnostics-minimum-margin-width
3935 This option controls the minimum width of the left margin printed by
3936 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3937
3938 @item -fdiagnostics-parseable-fixits
3939 @opindex fdiagnostics-parseable-fixits
3940 Emit fix-it hints in a machine-parseable format, suitable for consumption
3941 by IDEs. For each fix-it, a line will be printed after the relevant
3942 diagnostic, starting with the string ``fix-it:''. For example:
3943
3944 @smallexample
3945 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3946 @end smallexample
3947
3948 The location is expressed as a half-open range, expressed as a count of
3949 bytes, starting at byte 1 for the initial column. In the above example,
3950 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3951 given string:
3952
3953 @smallexample
3954 00000000011111111112222222222
3955 12345678901234567890123456789
3956 gtk_widget_showall (dlg);
3957 ^^^^^^^^^^^^^^^^^^
3958 gtk_widget_show_all
3959 @end smallexample
3960
3961 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3962 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3963 (e.g. vertical tab as ``\013'').
3964
3965 An empty replacement string indicates that the given range is to be removed.
3966 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3967 be inserted at the given position.
3968
3969 @item -fdiagnostics-generate-patch
3970 @opindex fdiagnostics-generate-patch
3971 Print fix-it hints to stderr in unified diff format, after any diagnostics
3972 are printed. For example:
3973
3974 @smallexample
3975 --- test.c
3976 +++ test.c
3977 @@ -42,5 +42,5 @@
3978
3979 void show_cb(GtkDialog *dlg)
3980 @{
3981 - gtk_widget_showall(dlg);
3982 + gtk_widget_show_all(dlg);
3983 @}
3984
3985 @end smallexample
3986
3987 The diff may or may not be colorized, following the same rules
3988 as for diagnostics (see @option{-fdiagnostics-color}).
3989
3990 @item -fdiagnostics-show-template-tree
3991 @opindex fdiagnostics-show-template-tree
3992
3993 In the C++ frontend, when printing diagnostics showing mismatching
3994 template types, such as:
3995
3996 @smallexample
3997 could not convert 'std::map<int, std::vector<double> >()'
3998 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3999 @end smallexample
4000
4001 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4002 tree-like structure showing the common and differing parts of the types,
4003 such as:
4004
4005 @smallexample
4006 map<
4007 [...],
4008 vector<
4009 [double != float]>>
4010 @end smallexample
4011
4012 The parts that differ are highlighted with color (``double'' and
4013 ``float'' in this case).
4014
4015 @item -fno-elide-type
4016 @opindex fno-elide-type
4017 @opindex felide-type
4018 By default when the C++ frontend prints diagnostics showing mismatching
4019 template types, common parts of the types are printed as ``[...]'' to
4020 simplify the error message. For example:
4021
4022 @smallexample
4023 could not convert 'std::map<int, std::vector<double> >()'
4024 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4025 @end smallexample
4026
4027 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4028 This flag also affects the output of the
4029 @option{-fdiagnostics-show-template-tree} flag.
4030
4031 @item -fno-show-column
4032 @opindex fno-show-column
4033 @opindex fshow-column
4034 Do not print column numbers in diagnostics. This may be necessary if
4035 diagnostics are being scanned by a program that does not understand the
4036 column numbers, such as @command{dejagnu}.
4037
4038 @item -fdiagnostics-format=@var{FORMAT}
4039 @opindex fdiagnostics-format
4040 Select a different format for printing diagnostics.
4041 @var{FORMAT} is @samp{text} or @samp{json}.
4042 The default is @samp{text}.
4043
4044 The @samp{json} format consists of a top-level JSON array containing JSON
4045 objects representing the diagnostics.
4046
4047 The JSON is emitted as one line, without formatting; the examples below
4048 have been formatted for clarity.
4049
4050 Diagnostics can have child diagnostics. For example, this error and note:
4051
4052 @smallexample
4053 misleading-indentation.c:15:3: warning: this 'if' clause does not
4054 guard... [-Wmisleading-indentation]
4055 15 | if (flag)
4056 | ^~
4057 misleading-indentation.c:17:5: note: ...this statement, but the latter
4058 is misleadingly indented as if it were guarded by the 'if'
4059 17 | y = 2;
4060 | ^
4061 @end smallexample
4062
4063 @noindent
4064 might be printed in JSON form (after formatting) like this:
4065
4066 @smallexample
4067 [
4068 @{
4069 "kind": "warning",
4070 "locations": [
4071 @{
4072 "caret": @{
4073 "column": 3,
4074 "file": "misleading-indentation.c",
4075 "line": 15
4076 @},
4077 "finish": @{
4078 "column": 4,
4079 "file": "misleading-indentation.c",
4080 "line": 15
4081 @}
4082 @}
4083 ],
4084 "message": "this \u2018if\u2019 clause does not guard...",
4085 "option": "-Wmisleading-indentation",
4086 "children": [
4087 @{
4088 "kind": "note",
4089 "locations": [
4090 @{
4091 "caret": @{
4092 "column": 5,
4093 "file": "misleading-indentation.c",
4094 "line": 17
4095 @}
4096 @}
4097 ],
4098 "message": "...this statement, but the latter is @dots{}"
4099 @}
4100 ]
4101 @},
4102 @dots{}
4103 ]
4104 @end smallexample
4105
4106 @noindent
4107 where the @code{note} is a child of the @code{warning}.
4108
4109 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4110 an @code{option} key describing the command-line option controlling the
4111 warning.
4112
4113 A diagnostic can contain zero or more locations. Each location has up
4114 to three positions within it: a @code{caret} position and optional
4115 @code{start} and @code{finish} positions. A location can also have
4116 an optional @code{label} string. For example, this error:
4117
4118 @smallexample
4119 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4120 'struct s'@} and 'T' @{aka 'struct t'@})
4121 64 | return callee_4a () + callee_4b ();
4122 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4123 | | |
4124 | | T @{aka struct t@}
4125 | S @{aka struct s@}
4126 @end smallexample
4127
4128 @noindent
4129 has three locations. Its primary location is at the ``+'' token at column
4130 23. It has two secondary locations, describing the left and right-hand sides
4131 of the expression, which have labels. It might be printed in JSON form as:
4132
4133 @smallexample
4134 @{
4135 "children": [],
4136 "kind": "error",
4137 "locations": [
4138 @{
4139 "caret": @{
4140 "column": 23, "file": "bad-binary-ops.c", "line": 64
4141 @}
4142 @},
4143 @{
4144 "caret": @{
4145 "column": 10, "file": "bad-binary-ops.c", "line": 64
4146 @},
4147 "finish": @{
4148 "column": 21, "file": "bad-binary-ops.c", "line": 64
4149 @},
4150 "label": "S @{aka struct s@}"
4151 @},
4152 @{
4153 "caret": @{
4154 "column": 25, "file": "bad-binary-ops.c", "line": 64
4155 @},
4156 "finish": @{
4157 "column": 36, "file": "bad-binary-ops.c", "line": 64
4158 @},
4159 "label": "T @{aka struct t@}"
4160 @}
4161 ],
4162 "message": "invalid operands to binary + @dots{}"
4163 @}
4164 @end smallexample
4165
4166 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4167 consisting of half-open intervals, similar to the output of
4168 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4169 with a replacement fix-it hint:
4170
4171 @smallexample
4172 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4173 mean 'color'?
4174 8 | return ptr->colour;
4175 | ^~~~~~
4176 | color
4177 @end smallexample
4178
4179 @noindent
4180 might be printed in JSON form as:
4181
4182 @smallexample
4183 @{
4184 "children": [],
4185 "fixits": [
4186 @{
4187 "next": @{
4188 "column": 21,
4189 "file": "demo.c",
4190 "line": 8
4191 @},
4192 "start": @{
4193 "column": 15,
4194 "file": "demo.c",
4195 "line": 8
4196 @},
4197 "string": "color"
4198 @}
4199 ],
4200 "kind": "error",
4201 "locations": [
4202 @{
4203 "caret": @{
4204 "column": 15,
4205 "file": "demo.c",
4206 "line": 8
4207 @},
4208 "finish": @{
4209 "column": 20,
4210 "file": "demo.c",
4211 "line": 8
4212 @}
4213 @}
4214 ],
4215 "message": "\u2018struct s\u2019 has no member named @dots{}"
4216 @}
4217 @end smallexample
4218
4219 @noindent
4220 where the fix-it hint suggests replacing the text from @code{start} up
4221 to but not including @code{next} with @code{string}'s value. Deletions
4222 are expressed via an empty value for @code{string}, insertions by
4223 having @code{start} equal @code{next}.
4224
4225 @end table
4226
4227 @node Warning Options
4228 @section Options to Request or Suppress Warnings
4229 @cindex options to control warnings
4230 @cindex warning messages
4231 @cindex messages, warning
4232 @cindex suppressing warnings
4233
4234 Warnings are diagnostic messages that report constructions that
4235 are not inherently erroneous but that are risky or suggest there
4236 may have been an error.
4237
4238 The following language-independent options do not enable specific
4239 warnings but control the kinds of diagnostics produced by GCC@.
4240
4241 @table @gcctabopt
4242 @cindex syntax checking
4243 @item -fsyntax-only
4244 @opindex fsyntax-only
4245 Check the code for syntax errors, but don't do anything beyond that.
4246
4247 @item -fmax-errors=@var{n}
4248 @opindex fmax-errors
4249 Limits the maximum number of error messages to @var{n}, at which point
4250 GCC bails out rather than attempting to continue processing the source
4251 code. If @var{n} is 0 (the default), there is no limit on the number
4252 of error messages produced. If @option{-Wfatal-errors} is also
4253 specified, then @option{-Wfatal-errors} takes precedence over this
4254 option.
4255
4256 @item -w
4257 @opindex w
4258 Inhibit all warning messages.
4259
4260 @item -Werror
4261 @opindex Werror
4262 @opindex Wno-error
4263 Make all warnings into errors.
4264
4265 @item -Werror=
4266 @opindex Werror=
4267 @opindex Wno-error=
4268 Make the specified warning into an error. The specifier for a warning
4269 is appended; for example @option{-Werror=switch} turns the warnings
4270 controlled by @option{-Wswitch} into errors. This switch takes a
4271 negative form, to be used to negate @option{-Werror} for specific
4272 warnings; for example @option{-Wno-error=switch} makes
4273 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4274 is in effect.
4275
4276 The warning message for each controllable warning includes the
4277 option that controls the warning. That option can then be used with
4278 @option{-Werror=} and @option{-Wno-error=} as described above.
4279 (Printing of the option in the warning message can be disabled using the
4280 @option{-fno-diagnostics-show-option} flag.)
4281
4282 Note that specifying @option{-Werror=}@var{foo} automatically implies
4283 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4284 imply anything.
4285
4286 @item -Wfatal-errors
4287 @opindex Wfatal-errors
4288 @opindex Wno-fatal-errors
4289 This option causes the compiler to abort compilation on the first error
4290 occurred rather than trying to keep going and printing further error
4291 messages.
4292
4293 @end table
4294
4295 You can request many specific warnings with options beginning with
4296 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4297 implicit declarations. Each of these specific warning options also
4298 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4299 example, @option{-Wno-implicit}. This manual lists only one of the
4300 two forms, whichever is not the default. For further
4301 language-specific options also refer to @ref{C++ Dialect Options} and
4302 @ref{Objective-C and Objective-C++ Dialect Options}.
4303
4304 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4305 options, such as @option{-Wunused}, which may turn on further options,
4306 such as @option{-Wunused-value}. The combined effect of positive and
4307 negative forms is that more specific options have priority over less
4308 specific ones, independently of their position in the command-line. For
4309 options of the same specificity, the last one takes effect. Options
4310 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4311 as if they appeared at the end of the command-line.
4312
4313 When an unrecognized warning option is requested (e.g.,
4314 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4315 that the option is not recognized. However, if the @option{-Wno-} form
4316 is used, the behavior is slightly different: no diagnostic is
4317 produced for @option{-Wno-unknown-warning} unless other diagnostics
4318 are being produced. This allows the use of new @option{-Wno-} options
4319 with old compilers, but if something goes wrong, the compiler
4320 warns that an unrecognized option is present.
4321
4322 @table @gcctabopt
4323 @item -Wpedantic
4324 @itemx -pedantic
4325 @opindex pedantic
4326 @opindex Wpedantic
4327 @opindex Wno-pedantic
4328 Issue all the warnings demanded by strict ISO C and ISO C++;
4329 reject all programs that use forbidden extensions, and some other
4330 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4331 version of the ISO C standard specified by any @option{-std} option used.
4332
4333 Valid ISO C and ISO C++ programs should compile properly with or without
4334 this option (though a rare few require @option{-ansi} or a
4335 @option{-std} option specifying the required version of ISO C)@. However,
4336 without this option, certain GNU extensions and traditional C and C++
4337 features are supported as well. With this option, they are rejected.
4338
4339 @option{-Wpedantic} does not cause warning messages for use of the
4340 alternate keywords whose names begin and end with @samp{__}. Pedantic
4341 warnings are also disabled in the expression that follows
4342 @code{__extension__}. However, only system header files should use
4343 these escape routes; application programs should avoid them.
4344 @xref{Alternate Keywords}.
4345
4346 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4347 C conformance. They soon find that it does not do quite what they want:
4348 it finds some non-ISO practices, but not all---only those for which
4349 ISO C @emph{requires} a diagnostic, and some others for which
4350 diagnostics have been added.
4351
4352 A feature to report any failure to conform to ISO C might be useful in
4353 some instances, but would require considerable additional work and would
4354 be quite different from @option{-Wpedantic}. We don't have plans to
4355 support such a feature in the near future.
4356
4357 Where the standard specified with @option{-std} represents a GNU
4358 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4359 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4360 extended dialect is based. Warnings from @option{-Wpedantic} are given
4361 where they are required by the base standard. (It does not make sense
4362 for such warnings to be given only for features not in the specified GNU
4363 C dialect, since by definition the GNU dialects of C include all
4364 features the compiler supports with the given option, and there would be
4365 nothing to warn about.)
4366
4367 @item -pedantic-errors
4368 @opindex pedantic-errors
4369 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4370 requires a diagnostic, in some cases where there is undefined behavior
4371 at compile-time and in some other cases that do not prevent compilation
4372 of programs that are valid according to the standard. This is not
4373 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4374 by this option and not enabled by the latter and vice versa.
4375
4376 @item -Wall
4377 @opindex Wall
4378 @opindex Wno-all
4379 This enables all the warnings about constructions that some users
4380 consider questionable, and that are easy to avoid (or modify to
4381 prevent the warning), even in conjunction with macros. This also
4382 enables some language-specific warnings described in @ref{C++ Dialect
4383 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4384
4385 @option{-Wall} turns on the following warning flags:
4386
4387 @gccoptlist{-Waddress @gol
4388 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4389 -Wbool-compare @gol
4390 -Wbool-operation @gol
4391 -Wc++11-compat -Wc++14-compat @gol
4392 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4393 -Wchar-subscripts @gol
4394 -Wcomment @gol
4395 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4396 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4397 -Wformat @gol
4398 -Wint-in-bool-context @gol
4399 -Wimplicit @r{(C and Objective-C only)} @gol
4400 -Wimplicit-int @r{(C and Objective-C only)} @gol
4401 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4402 -Winit-self @r{(only for C++)} @gol
4403 -Wlogical-not-parentheses @gol
4404 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4405 -Wmaybe-uninitialized @gol
4406 -Wmemset-elt-size @gol
4407 -Wmemset-transposed-args @gol
4408 -Wmisleading-indentation @r{(only for C/C++)} @gol
4409 -Wmissing-attributes @gol
4410 -Wmissing-braces @r{(only for C/ObjC)} @gol
4411 -Wmultistatement-macros @gol
4412 -Wnarrowing @r{(only for C++)} @gol
4413 -Wnonnull @gol
4414 -Wnonnull-compare @gol
4415 -Wopenmp-simd @gol
4416 -Wparentheses @gol
4417 -Wpessimizing-move @r{(only for C++)} @gol
4418 -Wpointer-sign @gol
4419 -Wreorder @gol
4420 -Wrestrict @gol
4421 -Wreturn-type @gol
4422 -Wsequence-point @gol
4423 -Wsign-compare @r{(only in C++)} @gol
4424 -Wsizeof-pointer-div @gol
4425 -Wsizeof-pointer-memaccess @gol
4426 -Wstrict-aliasing @gol
4427 -Wstrict-overflow=1 @gol
4428 -Wswitch @gol
4429 -Wtautological-compare @gol
4430 -Wtrigraphs @gol
4431 -Wuninitialized @gol
4432 -Wunknown-pragmas @gol
4433 -Wunused-function @gol
4434 -Wunused-label @gol
4435 -Wunused-value @gol
4436 -Wunused-variable @gol
4437 -Wvolatile-register-var}
4438
4439 Note that some warning flags are not implied by @option{-Wall}. Some of
4440 them warn about constructions that users generally do not consider
4441 questionable, but which occasionally you might wish to check for;
4442 others warn about constructions that are necessary or hard to avoid in
4443 some cases, and there is no simple way to modify the code to suppress
4444 the warning. Some of them are enabled by @option{-Wextra} but many of
4445 them must be enabled individually.
4446
4447 @item -Wextra
4448 @opindex W
4449 @opindex Wextra
4450 @opindex Wno-extra
4451 This enables some extra warning flags that are not enabled by
4452 @option{-Wall}. (This option used to be called @option{-W}. The older
4453 name is still supported, but the newer name is more descriptive.)
4454
4455 @gccoptlist{-Wclobbered @gol
4456 -Wcast-function-type @gol
4457 -Wdeprecated-copy @r{(C++ only)} @gol
4458 -Wempty-body @gol
4459 -Wignored-qualifiers @gol
4460 -Wimplicit-fallthrough=3 @gol
4461 -Wmissing-field-initializers @gol
4462 -Wmissing-parameter-type @r{(C only)} @gol
4463 -Wold-style-declaration @r{(C only)} @gol
4464 -Woverride-init @gol
4465 -Wsign-compare @r{(C only)} @gol
4466 -Wredundant-move @r{(only for C++)} @gol
4467 -Wtype-limits @gol
4468 -Wuninitialized @gol
4469 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4470 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4471 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4472
4473
4474 The option @option{-Wextra} also prints warning messages for the
4475 following cases:
4476
4477 @itemize @bullet
4478
4479 @item
4480 A pointer is compared against integer zero with @code{<}, @code{<=},
4481 @code{>}, or @code{>=}.
4482
4483 @item
4484 (C++ only) An enumerator and a non-enumerator both appear in a
4485 conditional expression.
4486
4487 @item
4488 (C++ only) Ambiguous virtual bases.
4489
4490 @item
4491 (C++ only) Subscripting an array that has been declared @code{register}.
4492
4493 @item
4494 (C++ only) Taking the address of a variable that has been declared
4495 @code{register}.
4496
4497 @item
4498 (C++ only) A base class is not initialized in the copy constructor
4499 of a derived class.
4500
4501 @end itemize
4502
4503 @item -Wchar-subscripts
4504 @opindex Wchar-subscripts
4505 @opindex Wno-char-subscripts
4506 Warn if an array subscript has type @code{char}. This is a common cause
4507 of error, as programmers often forget that this type is signed on some
4508 machines.
4509 This warning is enabled by @option{-Wall}.
4510
4511 @item -Wno-coverage-mismatch
4512 @opindex Wno-coverage-mismatch
4513 @opindex Wcoverage-mismatch
4514 Warn if feedback profiles do not match when using the
4515 @option{-fprofile-use} option.
4516 If a source file is changed between compiling with @option{-fprofile-generate}
4517 and with @option{-fprofile-use}, the files with the profile feedback can fail
4518 to match the source file and GCC cannot use the profile feedback
4519 information. By default, this warning is enabled and is treated as an
4520 error. @option{-Wno-coverage-mismatch} can be used to disable the
4521 warning or @option{-Wno-error=coverage-mismatch} can be used to
4522 disable the error. Disabling the error for this warning can result in
4523 poorly optimized code and is useful only in the
4524 case of very minor changes such as bug fixes to an existing code-base.
4525 Completely disabling the warning is not recommended.
4526
4527 @item -Wno-cpp
4528 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4529
4530 Suppress warning messages emitted by @code{#warning} directives.
4531
4532 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4533 @opindex Wdouble-promotion
4534 @opindex Wno-double-promotion
4535 Give a warning when a value of type @code{float} is implicitly
4536 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4537 floating-point unit implement @code{float} in hardware, but emulate
4538 @code{double} in software. On such a machine, doing computations
4539 using @code{double} values is much more expensive because of the
4540 overhead required for software emulation.
4541
4542 It is easy to accidentally do computations with @code{double} because
4543 floating-point literals are implicitly of type @code{double}. For
4544 example, in:
4545 @smallexample
4546 @group
4547 float area(float radius)
4548 @{
4549 return 3.14159 * radius * radius;
4550 @}
4551 @end group
4552 @end smallexample
4553 the compiler performs the entire computation with @code{double}
4554 because the floating-point literal is a @code{double}.
4555
4556 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4557 @opindex Wduplicate-decl-specifier
4558 @opindex Wno-duplicate-decl-specifier
4559 Warn if a declaration has duplicate @code{const}, @code{volatile},
4560 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4561 @option{-Wall}.
4562
4563 @item -Wformat
4564 @itemx -Wformat=@var{n}
4565 @opindex Wformat
4566 @opindex Wno-format
4567 @opindex ffreestanding
4568 @opindex fno-builtin
4569 @opindex Wformat=
4570 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4571 the arguments supplied have types appropriate to the format string
4572 specified, and that the conversions specified in the format string make
4573 sense. This includes standard functions, and others specified by format
4574 attributes (@pxref{Function Attributes}), in the @code{printf},
4575 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4576 not in the C standard) families (or other target-specific families).
4577 Which functions are checked without format attributes having been
4578 specified depends on the standard version selected, and such checks of
4579 functions without the attribute specified are disabled by
4580 @option{-ffreestanding} or @option{-fno-builtin}.
4581
4582 The formats are checked against the format features supported by GNU
4583 libc version 2.2. These include all ISO C90 and C99 features, as well
4584 as features from the Single Unix Specification and some BSD and GNU
4585 extensions. Other library implementations may not support all these
4586 features; GCC does not support warning about features that go beyond a
4587 particular library's limitations. However, if @option{-Wpedantic} is used
4588 with @option{-Wformat}, warnings are given about format features not
4589 in the selected standard version (but not for @code{strfmon} formats,
4590 since those are not in any version of the C standard). @xref{C Dialect
4591 Options,,Options Controlling C Dialect}.
4592
4593 @table @gcctabopt
4594 @item -Wformat=1
4595 @itemx -Wformat
4596 @opindex Wformat
4597 @opindex Wformat=1
4598 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4599 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4600 @option{-Wformat} also checks for null format arguments for several
4601 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4602 aspects of this level of format checking can be disabled by the
4603 options: @option{-Wno-format-contains-nul},
4604 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4605 @option{-Wformat} is enabled by @option{-Wall}.
4606
4607 @item -Wno-format-contains-nul
4608 @opindex Wno-format-contains-nul
4609 @opindex Wformat-contains-nul
4610 If @option{-Wformat} is specified, do not warn about format strings that
4611 contain NUL bytes.
4612
4613 @item -Wno-format-extra-args
4614 @opindex Wno-format-extra-args
4615 @opindex Wformat-extra-args
4616 If @option{-Wformat} is specified, do not warn about excess arguments to a
4617 @code{printf} or @code{scanf} format function. The C standard specifies
4618 that such arguments are ignored.
4619
4620 Where the unused arguments lie between used arguments that are
4621 specified with @samp{$} operand number specifications, normally
4622 warnings are still given, since the implementation could not know what
4623 type to pass to @code{va_arg} to skip the unused arguments. However,
4624 in the case of @code{scanf} formats, this option suppresses the
4625 warning if the unused arguments are all pointers, since the Single
4626 Unix Specification says that such unused arguments are allowed.
4627
4628 @item -Wformat-overflow
4629 @itemx -Wformat-overflow=@var{level}
4630 @opindex Wformat-overflow
4631 @opindex Wno-format-overflow
4632 Warn about calls to formatted input/output functions such as @code{sprintf}
4633 and @code{vsprintf} that might overflow the destination buffer. When the
4634 exact number of bytes written by a format directive cannot be determined
4635 at compile-time it is estimated based on heuristics that depend on the
4636 @var{level} argument and on optimization. While enabling optimization
4637 will in most cases improve the accuracy of the warning, it may also
4638 result in false positives.
4639
4640 @table @gcctabopt
4641 @item -Wformat-overflow
4642 @itemx -Wformat-overflow=1
4643 @opindex Wformat-overflow
4644 @opindex Wno-format-overflow
4645 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4646 employs a conservative approach that warns only about calls that most
4647 likely overflow the buffer. At this level, numeric arguments to format
4648 directives with unknown values are assumed to have the value of one, and
4649 strings of unknown length to be empty. Numeric arguments that are known
4650 to be bounded to a subrange of their type, or string arguments whose output
4651 is bounded either by their directive's precision or by a finite set of
4652 string literals, are assumed to take on the value within the range that
4653 results in the most bytes on output. For example, the call to @code{sprintf}
4654 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4655 the terminating NUL character (@code{'\0'}) appended by the function
4656 to the destination buffer will be written past its end. Increasing
4657 the size of the buffer by a single byte is sufficient to avoid the
4658 warning, though it may not be sufficient to avoid the overflow.
4659
4660 @smallexample
4661 void f (int a, int b)
4662 @{
4663 char buf [13];
4664 sprintf (buf, "a = %i, b = %i\n", a, b);
4665 @}
4666 @end smallexample
4667
4668 @item -Wformat-overflow=2
4669 Level @var{2} warns also about calls that might overflow the destination
4670 buffer given an argument of sufficient length or magnitude. At level
4671 @var{2}, unknown numeric arguments are assumed to have the minimum
4672 representable value for signed types with a precision greater than 1, and
4673 the maximum representable value otherwise. Unknown string arguments whose
4674 length cannot be assumed to be bounded either by the directive's precision,
4675 or by a finite set of string literals they may evaluate to, or the character
4676 array they may point to, are assumed to be 1 character long.
4677
4678 At level @var{2}, the call in the example above is again diagnosed, but
4679 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4680 @code{%i} directive will write some of its digits beyond the end of
4681 the destination buffer. To make the call safe regardless of the values
4682 of the two variables, the size of the destination buffer must be increased
4683 to at least 34 bytes. GCC includes the minimum size of the buffer in
4684 an informational note following the warning.
4685
4686 An alternative to increasing the size of the destination buffer is to
4687 constrain the range of formatted values. The maximum length of string
4688 arguments can be bounded by specifying the precision in the format
4689 directive. When numeric arguments of format directives can be assumed
4690 to be bounded by less than the precision of their type, choosing
4691 an appropriate length modifier to the format specifier will reduce
4692 the required buffer size. For example, if @var{a} and @var{b} in the
4693 example above can be assumed to be within the precision of
4694 the @code{short int} type then using either the @code{%hi} format
4695 directive or casting the argument to @code{short} reduces the maximum
4696 required size of the buffer to 24 bytes.
4697
4698 @smallexample
4699 void f (int a, int b)
4700 @{
4701 char buf [23];
4702 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4703 @}
4704 @end smallexample
4705 @end table
4706
4707 @item -Wno-format-zero-length
4708 @opindex Wno-format-zero-length
4709 @opindex Wformat-zero-length
4710 If @option{-Wformat} is specified, do not warn about zero-length formats.
4711 The C standard specifies that zero-length formats are allowed.
4712
4713
4714 @item -Wformat=2
4715 @opindex Wformat=2
4716 Enable @option{-Wformat} plus additional format checks. Currently
4717 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4718 -Wformat-y2k}.
4719
4720 @item -Wformat-nonliteral
4721 @opindex Wformat-nonliteral
4722 @opindex Wno-format-nonliteral
4723 If @option{-Wformat} is specified, also warn if the format string is not a
4724 string literal and so cannot be checked, unless the format function
4725 takes its format arguments as a @code{va_list}.
4726
4727 @item -Wformat-security
4728 @opindex Wformat-security
4729 @opindex Wno-format-security
4730 If @option{-Wformat} is specified, also warn about uses of format
4731 functions that represent possible security problems. At present, this
4732 warns about calls to @code{printf} and @code{scanf} functions where the
4733 format string is not a string literal and there are no format arguments,
4734 as in @code{printf (foo);}. This may be a security hole if the format
4735 string came from untrusted input and contains @samp{%n}. (This is
4736 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4737 in future warnings may be added to @option{-Wformat-security} that are not
4738 included in @option{-Wformat-nonliteral}.)
4739
4740 @item -Wformat-signedness
4741 @opindex Wformat-signedness
4742 @opindex Wno-format-signedness
4743 If @option{-Wformat} is specified, also warn if the format string
4744 requires an unsigned argument and the argument is signed and vice versa.
4745
4746 @item -Wformat-truncation
4747 @itemx -Wformat-truncation=@var{level}
4748 @opindex Wformat-truncation
4749 @opindex Wno-format-truncation
4750 Warn about calls to formatted input/output functions such as @code{snprintf}
4751 and @code{vsnprintf} that might result in output truncation. When the exact
4752 number of bytes written by a format directive cannot be determined at
4753 compile-time it is estimated based on heuristics that depend on
4754 the @var{level} argument and on optimization. While enabling optimization
4755 will in most cases improve the accuracy of the warning, it may also result
4756 in false positives. Except as noted otherwise, the option uses the same
4757 logic @option{-Wformat-overflow}.
4758
4759 @table @gcctabopt
4760 @item -Wformat-truncation
4761 @itemx -Wformat-truncation=1
4762 @opindex Wformat-truncation
4763 @opindex Wno-format-truncation
4764 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4765 employs a conservative approach that warns only about calls to bounded
4766 functions whose return value is unused and that will most likely result
4767 in output truncation.
4768
4769 @item -Wformat-truncation=2
4770 Level @var{2} warns also about calls to bounded functions whose return
4771 value is used and that might result in truncation given an argument of
4772 sufficient length or magnitude.
4773 @end table
4774
4775 @item -Wformat-y2k
4776 @opindex Wformat-y2k
4777 @opindex Wno-format-y2k
4778 If @option{-Wformat} is specified, also warn about @code{strftime}
4779 formats that may yield only a two-digit year.
4780 @end table
4781
4782 @item -Wnonnull
4783 @opindex Wnonnull
4784 @opindex Wno-nonnull
4785 Warn about passing a null pointer for arguments marked as
4786 requiring a non-null value by the @code{nonnull} function attribute.
4787
4788 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4789 can be disabled with the @option{-Wno-nonnull} option.
4790
4791 @item -Wnonnull-compare
4792 @opindex Wnonnull-compare
4793 @opindex Wno-nonnull-compare
4794 Warn when comparing an argument marked with the @code{nonnull}
4795 function attribute against null inside the function.
4796
4797 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4798 can be disabled with the @option{-Wno-nonnull-compare} option.
4799
4800 @item -Wnull-dereference
4801 @opindex Wnull-dereference
4802 @opindex Wno-null-dereference
4803 Warn if the compiler detects paths that trigger erroneous or
4804 undefined behavior due to dereferencing a null pointer. This option
4805 is only active when @option{-fdelete-null-pointer-checks} is active,
4806 which is enabled by optimizations in most targets. The precision of
4807 the warnings depends on the optimization options used.
4808
4809 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4810 @opindex Winaccessible-base
4811 @opindex Wno-inaccessible-base
4812 Warn when a base class is inaccessible in a class derived from it due to
4813 ambiguity. The warning is enabled by default. Note the warning for virtual
4814 bases is enabled by the @option{-Wextra} option.
4815 @smallexample
4816 @group
4817 struct A @{ int a; @};
4818
4819 struct B : A @{ @};
4820
4821 struct C : B, A @{ @};
4822 @end group
4823 @end smallexample
4824
4825 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4826 @opindex Winit-self
4827 @opindex Wno-init-self
4828 Warn about uninitialized variables that are initialized with themselves.
4829 Note this option can only be used with the @option{-Wuninitialized} option.
4830
4831 For example, GCC warns about @code{i} being uninitialized in the
4832 following snippet only when @option{-Winit-self} has been specified:
4833 @smallexample
4834 @group
4835 int f()
4836 @{
4837 int i = i;
4838 return i;
4839 @}
4840 @end group
4841 @end smallexample
4842
4843 This warning is enabled by @option{-Wall} in C++.
4844
4845 @item -Wimplicit-int @r{(C and Objective-C only)}
4846 @opindex Wimplicit-int
4847 @opindex Wno-implicit-int
4848 Warn when a declaration does not specify a type.
4849 This warning is enabled by @option{-Wall}.
4850
4851 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4852 @opindex Wimplicit-function-declaration
4853 @opindex Wno-implicit-function-declaration
4854 Give a warning whenever a function is used before being declared. In
4855 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4856 enabled by default and it is made into an error by
4857 @option{-pedantic-errors}. This warning is also enabled by
4858 @option{-Wall}.
4859
4860 @item -Wimplicit @r{(C and Objective-C only)}
4861 @opindex Wimplicit
4862 @opindex Wno-implicit
4863 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4864 This warning is enabled by @option{-Wall}.
4865
4866 @item -Wimplicit-fallthrough
4867 @opindex Wimplicit-fallthrough
4868 @opindex Wno-implicit-fallthrough
4869 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4870 and @option{-Wno-implicit-fallthrough} is the same as
4871 @option{-Wimplicit-fallthrough=0}.
4872
4873 @item -Wimplicit-fallthrough=@var{n}
4874 @opindex Wimplicit-fallthrough=
4875 Warn when a switch case falls through. For example:
4876
4877 @smallexample
4878 @group
4879 switch (cond)
4880 @{
4881 case 1:
4882 a = 1;
4883 break;
4884 case 2:
4885 a = 2;
4886 case 3:
4887 a = 3;
4888 break;
4889 @}
4890 @end group
4891 @end smallexample
4892
4893 This warning does not warn when the last statement of a case cannot
4894 fall through, e.g. when there is a return statement or a call to function
4895 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4896 also takes into account control flow statements, such as ifs, and only
4897 warns when appropriate. E.g.@:
4898
4899 @smallexample
4900 @group
4901 switch (cond)
4902 @{
4903 case 1:
4904 if (i > 3) @{
4905 bar (5);
4906 break;
4907 @} else if (i < 1) @{
4908 bar (0);
4909 @} else
4910 return;
4911 default:
4912 @dots{}
4913 @}
4914 @end group
4915 @end smallexample
4916
4917 Since there are occasions where a switch case fall through is desirable,
4918 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4919 to be used along with a null statement to suppress this warning that
4920 would normally occur:
4921
4922 @smallexample
4923 @group
4924 switch (cond)
4925 @{
4926 case 1:
4927 bar (0);
4928 __attribute__ ((fallthrough));
4929 default:
4930 @dots{}
4931 @}
4932 @end group
4933 @end smallexample
4934
4935 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4936 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4937 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4938 Instead of these attributes, it is also possible to add a fallthrough comment
4939 to silence the warning. The whole body of the C or C++ style comment should
4940 match the given regular expressions listed below. The option argument @var{n}
4941 specifies what kind of comments are accepted:
4942
4943 @itemize @bullet
4944
4945 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4946
4947 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4948 expression, any comment is used as fallthrough comment.
4949
4950 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4951 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4952
4953 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4954 following regular expressions:
4955
4956 @itemize @bullet
4957
4958 @item @code{-fallthrough}
4959
4960 @item @code{@@fallthrough@@}
4961
4962 @item @code{lint -fallthrough[ \t]*}
4963
4964 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4965
4966 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4967
4968 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4969
4970 @end itemize
4971
4972 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4973 following regular expressions:
4974
4975 @itemize @bullet
4976
4977 @item @code{-fallthrough}
4978
4979 @item @code{@@fallthrough@@}
4980
4981 @item @code{lint -fallthrough[ \t]*}
4982
4983 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4984
4985 @end itemize
4986
4987 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4988 fallthrough comments, only attributes disable the warning.
4989
4990 @end itemize
4991
4992 The comment needs to be followed after optional whitespace and other comments
4993 by @code{case} or @code{default} keywords or by a user label that precedes some
4994 @code{case} or @code{default} label.
4995
4996 @smallexample
4997 @group
4998 switch (cond)
4999 @{
5000 case 1:
5001 bar (0);
5002 /* FALLTHRU */
5003 default:
5004 @dots{}
5005 @}
5006 @end group
5007 @end smallexample
5008
5009 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5010
5011 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5012 @opindex Wif-not-aligned
5013 @opindex Wno-if-not-aligned
5014 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5015 should be issued. This is enabled by default.
5016 Use @option{-Wno-if-not-aligned} to disable it.
5017
5018 @item -Wignored-qualifiers @r{(C and C++ only)}
5019 @opindex Wignored-qualifiers
5020 @opindex Wno-ignored-qualifiers
5021 Warn if the return type of a function has a type qualifier
5022 such as @code{const}. For ISO C such a type qualifier has no effect,
5023 since the value returned by a function is not an lvalue.
5024 For C++, the warning is only emitted for scalar types or @code{void}.
5025 ISO C prohibits qualified @code{void} return types on function
5026 definitions, so such return types always receive a warning
5027 even without this option.
5028
5029 This warning is also enabled by @option{-Wextra}.
5030
5031 @item -Wignored-attributes @r{(C and C++ only)}
5032 @opindex Wignored-attributes
5033 @opindex Wno-ignored-attributes
5034 Warn when an attribute is ignored. This is different from the
5035 @option{-Wattributes} option in that it warns whenever the compiler decides
5036 to drop an attribute, not that the attribute is either unknown, used in a
5037 wrong place, etc. This warning is enabled by default.
5038
5039 @item -Wmain
5040 @opindex Wmain
5041 @opindex Wno-main
5042 Warn if the type of @code{main} is suspicious. @code{main} should be
5043 a function with external linkage, returning int, taking either zero
5044 arguments, two, or three arguments of appropriate types. This warning
5045 is enabled by default in C++ and is enabled by either @option{-Wall}
5046 or @option{-Wpedantic}.
5047
5048 @item -Wmisleading-indentation @r{(C and C++ only)}
5049 @opindex Wmisleading-indentation
5050 @opindex Wno-misleading-indentation
5051 Warn when the indentation of the code does not reflect the block structure.
5052 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5053 @code{for} clauses with a guarded statement that does not use braces,
5054 followed by an unguarded statement with the same indentation.
5055
5056 In the following example, the call to ``bar'' is misleadingly indented as
5057 if it were guarded by the ``if'' conditional.
5058
5059 @smallexample
5060 if (some_condition ())
5061 foo ();
5062 bar (); /* Gotcha: this is not guarded by the "if". */
5063 @end smallexample
5064
5065 In the case of mixed tabs and spaces, the warning uses the
5066 @option{-ftabstop=} option to determine if the statements line up
5067 (defaulting to 8).
5068
5069 The warning is not issued for code involving multiline preprocessor logic
5070 such as the following example.
5071
5072 @smallexample
5073 if (flagA)
5074 foo (0);
5075 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5076 if (flagB)
5077 #endif
5078 foo (1);
5079 @end smallexample
5080
5081 The warning is not issued after a @code{#line} directive, since this
5082 typically indicates autogenerated code, and no assumptions can be made
5083 about the layout of the file that the directive references.
5084
5085 This warning is enabled by @option{-Wall} in C and C++.
5086
5087 @item -Wmissing-attributes
5088 @opindex Wmissing-attributes
5089 @opindex Wno-missing-attributes
5090 Warn when a declaration of a function is missing one or more attributes
5091 that a related function is declared with and whose absence may adversely
5092 affect the correctness or efficiency of generated code. For example,
5093 the warning is issued for declarations of aliases that use attributes
5094 to specify less restrictive requirements than those of their targets.
5095 This typically represents a potential optimization opportunity.
5096 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5097 issued when the alias is more restrictive than the target, which could
5098 lead to incorrect code generation.
5099 Attributes considered include @code{alloc_align}, @code{alloc_size},
5100 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5101 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5102 @code{returns_nonnull}, and @code{returns_twice}.
5103
5104 In C++, the warning is issued when an explicit specialization of a primary
5105 template declared with attribute @code{alloc_align}, @code{alloc_size},
5106 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5107 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5108 @code{error}, and @code{warning} suppress the warning.
5109 (@pxref{Function Attributes}).
5110
5111 You can use the @code{copy} attribute to apply the same
5112 set of attributes to a declaration as that on another declaration without
5113 explicitly enumerating the attributes. This attribute can be applied
5114 to declarations of functions (@pxref{Common Function Attributes}),
5115 variables (@pxref{Common Variable Attributes}), or types
5116 (@pxref{Common Type Attributes}).
5117
5118 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5119
5120 For example, since the declaration of the primary function template
5121 below makes use of both attribute @code{malloc} and @code{alloc_size}
5122 the declaration of the explicit specialization of the template is
5123 diagnosed because it is missing one of the attributes.
5124
5125 @smallexample
5126 template <class T>
5127 T* __attribute__ ((malloc, alloc_size (1)))
5128 allocate (size_t);
5129
5130 template <>
5131 void* __attribute__ ((malloc)) // missing alloc_size
5132 allocate<void> (size_t);
5133 @end smallexample
5134
5135 @item -Wmissing-braces
5136 @opindex Wmissing-braces
5137 @opindex Wno-missing-braces
5138 Warn if an aggregate or union initializer is not fully bracketed. In
5139 the following example, the initializer for @code{a} is not fully
5140 bracketed, but that for @code{b} is fully bracketed. This warning is
5141 enabled by @option{-Wall} in C.
5142
5143 @smallexample
5144 int a[2][2] = @{ 0, 1, 2, 3 @};
5145 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5146 @end smallexample
5147
5148 This warning is enabled by @option{-Wall}.
5149
5150 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5151 @opindex Wmissing-include-dirs
5152 @opindex Wno-missing-include-dirs
5153 Warn if a user-supplied include directory does not exist.
5154
5155 @item -Wmissing-profile
5156 @opindex Wmissing-profile
5157 @opindex Wno-missing-profile
5158 Warn if feedback profiles are missing when using the
5159 @option{-fprofile-use} option.
5160 This option diagnoses those cases where a new function or a new file is added
5161 to the user code between compiling with @option{-fprofile-generate} and with
5162 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5163 profile feedback data files do not contain any profile feedback information for
5164 the newly added function or file respectively. Also, in the case when profile
5165 count data (.gcda) files are removed, GCC cannot use any profile feedback
5166 information. In all these cases, warnings are issued to inform the user that a
5167 profile generation step is due. @option{-Wno-missing-profile} can be used to
5168 disable the warning. Ignoring the warning can result in poorly optimized code.
5169 Completely disabling the warning is not recommended and should be done only
5170 when non-existent profile data is justified.
5171
5172 @item -Wmultistatement-macros
5173 @opindex Wmultistatement-macros
5174 @opindex Wno-multistatement-macros
5175 Warn about unsafe multiple statement macros that appear to be guarded
5176 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5177 @code{while}, in which only the first statement is actually guarded after
5178 the macro is expanded.
5179
5180 For example:
5181
5182 @smallexample
5183 #define DOIT x++; y++
5184 if (c)
5185 DOIT;
5186 @end smallexample
5187
5188 will increment @code{y} unconditionally, not just when @code{c} holds.
5189 The can usually be fixed by wrapping the macro in a do-while loop:
5190 @smallexample
5191 #define DOIT do @{ x++; y++; @} while (0)
5192 if (c)
5193 DOIT;
5194 @end smallexample
5195
5196 This warning is enabled by @option{-Wall} in C and C++.
5197
5198 @item -Wparentheses
5199 @opindex Wparentheses
5200 @opindex Wno-parentheses
5201 Warn if parentheses are omitted in certain contexts, such
5202 as when there is an assignment in a context where a truth value
5203 is expected, or when operators are nested whose precedence people
5204 often get confused about.
5205
5206 Also warn if a comparison like @code{x<=y<=z} appears; this is
5207 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5208 interpretation from that of ordinary mathematical notation.
5209
5210 Also warn for dangerous uses of the GNU extension to
5211 @code{?:} with omitted middle operand. When the condition
5212 in the @code{?}: operator is a boolean expression, the omitted value is
5213 always 1. Often programmers expect it to be a value computed
5214 inside the conditional expression instead.
5215
5216 For C++ this also warns for some cases of unnecessary parentheses in
5217 declarations, which can indicate an attempt at a function call instead
5218 of a declaration:
5219 @smallexample
5220 @{
5221 // Declares a local variable called mymutex.
5222 std::unique_lock<std::mutex> (mymutex);
5223 // User meant std::unique_lock<std::mutex> lock (mymutex);
5224 @}
5225 @end smallexample
5226
5227 This warning is enabled by @option{-Wall}.
5228
5229 @item -Wsequence-point
5230 @opindex Wsequence-point
5231 @opindex Wno-sequence-point
5232 Warn about code that may have undefined semantics because of violations
5233 of sequence point rules in the C and C++ standards.
5234
5235 The C and C++ standards define the order in which expressions in a C/C++
5236 program are evaluated in terms of @dfn{sequence points}, which represent
5237 a partial ordering between the execution of parts of the program: those
5238 executed before the sequence point, and those executed after it. These
5239 occur after the evaluation of a full expression (one which is not part
5240 of a larger expression), after the evaluation of the first operand of a
5241 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5242 function is called (but after the evaluation of its arguments and the
5243 expression denoting the called function), and in certain other places.
5244 Other than as expressed by the sequence point rules, the order of
5245 evaluation of subexpressions of an expression is not specified. All
5246 these rules describe only a partial order rather than a total order,
5247 since, for example, if two functions are called within one expression
5248 with no sequence point between them, the order in which the functions
5249 are called is not specified. However, the standards committee have
5250 ruled that function calls do not overlap.
5251
5252 It is not specified when between sequence points modifications to the
5253 values of objects take effect. Programs whose behavior depends on this
5254 have undefined behavior; the C and C++ standards specify that ``Between
5255 the previous and next sequence point an object shall have its stored
5256 value modified at most once by the evaluation of an expression.
5257 Furthermore, the prior value shall be read only to determine the value
5258 to be stored.''. If a program breaks these rules, the results on any
5259 particular implementation are entirely unpredictable.
5260
5261 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5262 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5263 diagnosed by this option, and it may give an occasional false positive
5264 result, but in general it has been found fairly effective at detecting
5265 this sort of problem in programs.
5266
5267 The C++17 standard will define the order of evaluation of operands in
5268 more cases: in particular it requires that the right-hand side of an
5269 assignment be evaluated before the left-hand side, so the above
5270 examples are no longer undefined. But this warning will still warn
5271 about them, to help people avoid writing code that is undefined in C
5272 and earlier revisions of C++.
5273
5274 The standard is worded confusingly, therefore there is some debate
5275 over the precise meaning of the sequence point rules in subtle cases.
5276 Links to discussions of the problem, including proposed formal
5277 definitions, may be found on the GCC readings page, at
5278 @uref{http://gcc.gnu.org/@/readings.html}.
5279
5280 This warning is enabled by @option{-Wall} for C and C++.
5281
5282 @item -Wno-return-local-addr
5283 @opindex Wno-return-local-addr
5284 @opindex Wreturn-local-addr
5285 Do not warn about returning a pointer (or in C++, a reference) to a
5286 variable that goes out of scope after the function returns.
5287
5288 @item -Wreturn-type
5289 @opindex Wreturn-type
5290 @opindex Wno-return-type
5291 Warn whenever a function is defined with a return type that defaults
5292 to @code{int}. Also warn about any @code{return} statement with no
5293 return value in a function whose return type is not @code{void}
5294 (falling off the end of the function body is considered returning
5295 without a value).
5296
5297 For C only, warn about a @code{return} statement with an expression in a
5298 function whose return type is @code{void}, unless the expression type is
5299 also @code{void}. As a GNU extension, the latter case is accepted
5300 without a warning unless @option{-Wpedantic} is used. Attempting
5301 to use the return value of a non-@code{void} function other than @code{main}
5302 that flows off the end by reaching the closing curly brace that terminates
5303 the function is undefined.
5304
5305 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5306 than @code{main} results in undefined behavior even when the value of
5307 the function is not used.
5308
5309 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5310
5311 @item -Wshift-count-negative
5312 @opindex Wshift-count-negative
5313 @opindex Wno-shift-count-negative
5314 Warn if shift count is negative. This warning is enabled by default.
5315
5316 @item -Wshift-count-overflow
5317 @opindex Wshift-count-overflow
5318 @opindex Wno-shift-count-overflow
5319 Warn if shift count >= width of type. This warning is enabled by default.
5320
5321 @item -Wshift-negative-value
5322 @opindex Wshift-negative-value
5323 @opindex Wno-shift-negative-value
5324 Warn if left shifting a negative value. This warning is enabled by
5325 @option{-Wextra} in C99 and C++11 modes (and newer).
5326
5327 @item -Wshift-overflow
5328 @itemx -Wshift-overflow=@var{n}
5329 @opindex Wshift-overflow
5330 @opindex Wno-shift-overflow
5331 Warn about left shift overflows. This warning is enabled by
5332 default in C99 and C++11 modes (and newer).
5333
5334 @table @gcctabopt
5335 @item -Wshift-overflow=1
5336 This is the warning level of @option{-Wshift-overflow} and is enabled
5337 by default in C99 and C++11 modes (and newer). This warning level does
5338 not warn about left-shifting 1 into the sign bit. (However, in C, such
5339 an overflow is still rejected in contexts where an integer constant expression
5340 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5341 shifts always wrap.
5342
5343 @item -Wshift-overflow=2
5344 This warning level also warns about left-shifting 1 into the sign bit,
5345 unless C++14 mode (or newer) is active.
5346 @end table
5347
5348 @item -Wswitch
5349 @opindex Wswitch
5350 @opindex Wno-switch
5351 Warn whenever a @code{switch} statement has an index of enumerated type
5352 and lacks a @code{case} for one or more of the named codes of that
5353 enumeration. (The presence of a @code{default} label prevents this
5354 warning.) @code{case} labels outside the enumeration range also
5355 provoke warnings when this option is used (even if there is a
5356 @code{default} label).
5357 This warning is enabled by @option{-Wall}.
5358
5359 @item -Wswitch-default
5360 @opindex Wswitch-default
5361 @opindex Wno-switch-default
5362 Warn whenever a @code{switch} statement does not have a @code{default}
5363 case.
5364
5365 @item -Wswitch-enum
5366 @opindex Wswitch-enum
5367 @opindex Wno-switch-enum
5368 Warn whenever a @code{switch} statement has an index of enumerated type
5369 and lacks a @code{case} for one or more of the named codes of that
5370 enumeration. @code{case} labels outside the enumeration range also
5371 provoke warnings when this option is used. The only difference
5372 between @option{-Wswitch} and this option is that this option gives a
5373 warning about an omitted enumeration code even if there is a
5374 @code{default} label.
5375
5376 @item -Wswitch-bool
5377 @opindex Wswitch-bool
5378 @opindex Wno-switch-bool
5379 Warn whenever a @code{switch} statement has an index of boolean type
5380 and the case values are outside the range of a boolean type.
5381 It is possible to suppress this warning by casting the controlling
5382 expression to a type other than @code{bool}. For example:
5383 @smallexample
5384 @group
5385 switch ((int) (a == 4))
5386 @{
5387 @dots{}
5388 @}
5389 @end group
5390 @end smallexample
5391 This warning is enabled by default for C and C++ programs.
5392
5393 @item -Wswitch-unreachable
5394 @opindex Wswitch-unreachable
5395 @opindex Wno-switch-unreachable
5396 Warn whenever a @code{switch} statement contains statements between the
5397 controlling expression and the first case label, which will never be
5398 executed. For example:
5399 @smallexample
5400 @group
5401 switch (cond)
5402 @{
5403 i = 15;
5404 @dots{}
5405 case 5:
5406 @dots{}
5407 @}
5408 @end group
5409 @end smallexample
5410 @option{-Wswitch-unreachable} does not warn if the statement between the
5411 controlling expression and the first case label is just a declaration:
5412 @smallexample
5413 @group
5414 switch (cond)
5415 @{
5416 int i;
5417 @dots{}
5418 case 5:
5419 i = 5;
5420 @dots{}
5421 @}
5422 @end group
5423 @end smallexample
5424 This warning is enabled by default for C and C++ programs.
5425
5426 @item -Wsync-nand @r{(C and C++ only)}
5427 @opindex Wsync-nand
5428 @opindex Wno-sync-nand
5429 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5430 built-in functions are used. These functions changed semantics in GCC 4.4.
5431
5432 @item -Wunused-but-set-parameter
5433 @opindex Wunused-but-set-parameter
5434 @opindex Wno-unused-but-set-parameter
5435 Warn whenever a function parameter is assigned to, but otherwise unused
5436 (aside from its declaration).
5437
5438 To suppress this warning use the @code{unused} attribute
5439 (@pxref{Variable Attributes}).
5440
5441 This warning is also enabled by @option{-Wunused} together with
5442 @option{-Wextra}.
5443
5444 @item -Wunused-but-set-variable
5445 @opindex Wunused-but-set-variable
5446 @opindex Wno-unused-but-set-variable
5447 Warn whenever a local variable is assigned to, but otherwise unused
5448 (aside from its declaration).
5449 This warning is enabled by @option{-Wall}.
5450
5451 To suppress this warning use the @code{unused} attribute
5452 (@pxref{Variable Attributes}).
5453
5454 This warning is also enabled by @option{-Wunused}, which is enabled
5455 by @option{-Wall}.
5456
5457 @item -Wunused-function
5458 @opindex Wunused-function
5459 @opindex Wno-unused-function
5460 Warn whenever a static function is declared but not defined or a
5461 non-inline static function is unused.
5462 This warning is enabled by @option{-Wall}.
5463
5464 @item -Wunused-label
5465 @opindex Wunused-label
5466 @opindex Wno-unused-label
5467 Warn whenever a label is declared but not used.
5468 This warning is enabled by @option{-Wall}.
5469
5470 To suppress this warning use the @code{unused} attribute
5471 (@pxref{Variable Attributes}).
5472
5473 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5474 @opindex Wunused-local-typedefs
5475 @opindex Wno-unused-local-typedefs
5476 Warn when a typedef locally defined in a function is not used.
5477 This warning is enabled by @option{-Wall}.
5478
5479 @item -Wunused-parameter
5480 @opindex Wunused-parameter
5481 @opindex Wno-unused-parameter
5482 Warn whenever a function parameter is unused aside from its declaration.
5483
5484 To suppress this warning use the @code{unused} attribute
5485 (@pxref{Variable Attributes}).
5486
5487 @item -Wno-unused-result
5488 @opindex Wunused-result
5489 @opindex Wno-unused-result
5490 Do not warn if a caller of a function marked with attribute
5491 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5492 its return value. The default is @option{-Wunused-result}.
5493
5494 @item -Wunused-variable
5495 @opindex Wunused-variable
5496 @opindex Wno-unused-variable
5497 Warn whenever a local or static variable is unused aside from its
5498 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5499 but not for C++. This warning is enabled by @option{-Wall}.
5500
5501 To suppress this warning use the @code{unused} attribute
5502 (@pxref{Variable Attributes}).
5503
5504 @item -Wunused-const-variable
5505 @itemx -Wunused-const-variable=@var{n}
5506 @opindex Wunused-const-variable
5507 @opindex Wno-unused-const-variable
5508 Warn whenever a constant static variable is unused aside from its declaration.
5509 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5510 for C, but not for C++. In C this declares variable storage, but in C++ this
5511 is not an error since const variables take the place of @code{#define}s.
5512
5513 To suppress this warning use the @code{unused} attribute
5514 (@pxref{Variable Attributes}).
5515
5516 @table @gcctabopt
5517 @item -Wunused-const-variable=1
5518 This is the warning level that is enabled by @option{-Wunused-variable} for
5519 C. It warns only about unused static const variables defined in the main
5520 compilation unit, but not about static const variables declared in any
5521 header included.
5522
5523 @item -Wunused-const-variable=2
5524 This warning level also warns for unused constant static variables in
5525 headers (excluding system headers). This is the warning level of
5526 @option{-Wunused-const-variable} and must be explicitly requested since
5527 in C++ this isn't an error and in C it might be harder to clean up all
5528 headers included.
5529 @end table
5530
5531 @item -Wunused-value
5532 @opindex Wunused-value
5533 @opindex Wno-unused-value
5534 Warn whenever a statement computes a result that is explicitly not
5535 used. To suppress this warning cast the unused expression to
5536 @code{void}. This includes an expression-statement or the left-hand
5537 side of a comma expression that contains no side effects. For example,
5538 an expression such as @code{x[i,j]} causes a warning, while
5539 @code{x[(void)i,j]} does not.
5540
5541 This warning is enabled by @option{-Wall}.
5542
5543 @item -Wunused
5544 @opindex Wunused
5545 @opindex Wno-unused
5546 All the above @option{-Wunused} options combined.
5547
5548 In order to get a warning about an unused function parameter, you must
5549 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5550 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5551
5552 @item -Wuninitialized
5553 @opindex Wuninitialized
5554 @opindex Wno-uninitialized
5555 Warn if an automatic variable is used without first being initialized
5556 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5557 warn if a non-static reference or non-static @code{const} member
5558 appears in a class without constructors.
5559
5560 If you want to warn about code that uses the uninitialized value of the
5561 variable in its own initializer, use the @option{-Winit-self} option.
5562
5563 These warnings occur for individual uninitialized or clobbered
5564 elements of structure, union or array variables as well as for
5565 variables that are uninitialized or clobbered as a whole. They do
5566 not occur for variables or elements declared @code{volatile}. Because
5567 these warnings depend on optimization, the exact variables or elements
5568 for which there are warnings depends on the precise optimization
5569 options and version of GCC used.
5570
5571 Note that there may be no warning about a variable that is used only
5572 to compute a value that itself is never used, because such
5573 computations may be deleted by data flow analysis before the warnings
5574 are printed.
5575
5576 @item -Winvalid-memory-model
5577 @opindex Winvalid-memory-model
5578 @opindex Wno-invalid-memory-model
5579 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5580 and the C11 atomic generic functions with a memory consistency argument
5581 that is either invalid for the operation or outside the range of values
5582 of the @code{memory_order} enumeration. For example, since the
5583 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5584 defined for the relaxed, release, and sequentially consistent memory
5585 orders the following code is diagnosed:
5586
5587 @smallexample
5588 void store (int *i)
5589 @{
5590 __atomic_store_n (i, 0, memory_order_consume);
5591 @}
5592 @end smallexample
5593
5594 @option{-Winvalid-memory-model} is enabled by default.
5595
5596 @item -Wmaybe-uninitialized
5597 @opindex Wmaybe-uninitialized
5598 @opindex Wno-maybe-uninitialized
5599 For an automatic (i.e.@: local) variable, if there exists a path from the
5600 function entry to a use of the variable that is initialized, but there exist
5601 some other paths for which the variable is not initialized, the compiler
5602 emits a warning if it cannot prove the uninitialized paths are not
5603 executed at run time.
5604
5605 These warnings are only possible in optimizing compilation, because otherwise
5606 GCC does not keep track of the state of variables.
5607
5608 These warnings are made optional because GCC may not be able to determine when
5609 the code is correct in spite of appearing to have an error. Here is one
5610 example of how this can happen:
5611
5612 @smallexample
5613 @group
5614 @{
5615 int x;
5616 switch (y)
5617 @{
5618 case 1: x = 1;
5619 break;
5620 case 2: x = 4;
5621 break;
5622 case 3: x = 5;
5623 @}
5624 foo (x);
5625 @}
5626 @end group
5627 @end smallexample
5628
5629 @noindent
5630 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5631 always initialized, but GCC doesn't know this. To suppress the
5632 warning, you need to provide a default case with assert(0) or
5633 similar code.
5634
5635 @cindex @code{longjmp} warnings
5636 This option also warns when a non-volatile automatic variable might be
5637 changed by a call to @code{longjmp}.
5638 The compiler sees only the calls to @code{setjmp}. It cannot know
5639 where @code{longjmp} will be called; in fact, a signal handler could
5640 call it at any point in the code. As a result, you may get a warning
5641 even when there is in fact no problem because @code{longjmp} cannot
5642 in fact be called at the place that would cause a problem.
5643
5644 Some spurious warnings can be avoided if you declare all the functions
5645 you use that never return as @code{noreturn}. @xref{Function
5646 Attributes}.
5647
5648 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5649
5650 @item -Wunknown-pragmas
5651 @opindex Wunknown-pragmas
5652 @opindex Wno-unknown-pragmas
5653 @cindex warning for unknown pragmas
5654 @cindex unknown pragmas, warning
5655 @cindex pragmas, warning of unknown
5656 Warn when a @code{#pragma} directive is encountered that is not understood by
5657 GCC@. If this command-line option is used, warnings are even issued
5658 for unknown pragmas in system header files. This is not the case if
5659 the warnings are only enabled by the @option{-Wall} command-line option.
5660
5661 @item -Wno-pragmas
5662 @opindex Wno-pragmas
5663 @opindex Wpragmas
5664 Do not warn about misuses of pragmas, such as incorrect parameters,
5665 invalid syntax, or conflicts between pragmas. See also
5666 @option{-Wunknown-pragmas}.
5667
5668 @item -Wno-prio-ctor-dtor
5669 @opindex Wno-prio-ctor-dtor
5670 @opindex Wprio-ctor-dtor
5671 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5672 The use of constructor and destructor attributes allow you to assign a
5673 priority to the constructor/destructor to control its order of execution
5674 before @code{main} is called or after it returns. The priority values must be
5675 greater than 100 as the compiler reserves priority values between 0--100 for
5676 the implementation.
5677
5678 @item -Wstrict-aliasing
5679 @opindex Wstrict-aliasing
5680 @opindex Wno-strict-aliasing
5681 This option is only active when @option{-fstrict-aliasing} is active.
5682 It warns about code that might break the strict aliasing rules that the
5683 compiler is using for optimization. The warning does not catch all
5684 cases, but does attempt to catch the more common pitfalls. It is
5685 included in @option{-Wall}.
5686 It is equivalent to @option{-Wstrict-aliasing=3}
5687
5688 @item -Wstrict-aliasing=n
5689 @opindex Wstrict-aliasing=n
5690 This option is only active when @option{-fstrict-aliasing} is active.
5691 It warns about code that might break the strict aliasing rules that the
5692 compiler is using for optimization.
5693 Higher levels correspond to higher accuracy (fewer false positives).
5694 Higher levels also correspond to more effort, similar to the way @option{-O}
5695 works.
5696 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5697
5698 Level 1: Most aggressive, quick, least accurate.
5699 Possibly useful when higher levels
5700 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5701 false negatives. However, it has many false positives.
5702 Warns for all pointer conversions between possibly incompatible types,
5703 even if never dereferenced. Runs in the front end only.
5704
5705 Level 2: Aggressive, quick, not too precise.
5706 May still have many false positives (not as many as level 1 though),
5707 and few false negatives (but possibly more than level 1).
5708 Unlike level 1, it only warns when an address is taken. Warns about
5709 incomplete types. Runs in the front end only.
5710
5711 Level 3 (default for @option{-Wstrict-aliasing}):
5712 Should have very few false positives and few false
5713 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5714 Takes care of the common pun+dereference pattern in the front end:
5715 @code{*(int*)&some_float}.
5716 If optimization is enabled, it also runs in the back end, where it deals
5717 with multiple statement cases using flow-sensitive points-to information.
5718 Only warns when the converted pointer is dereferenced.
5719 Does not warn about incomplete types.
5720
5721 @item -Wstrict-overflow
5722 @itemx -Wstrict-overflow=@var{n}
5723 @opindex Wstrict-overflow
5724 @opindex Wno-strict-overflow
5725 This option is only active when signed overflow is undefined.
5726 It warns about cases where the compiler optimizes based on the
5727 assumption that signed overflow does not occur. Note that it does not
5728 warn about all cases where the code might overflow: it only warns
5729 about cases where the compiler implements some optimization. Thus
5730 this warning depends on the optimization level.
5731
5732 An optimization that assumes that signed overflow does not occur is
5733 perfectly safe if the values of the variables involved are such that
5734 overflow never does, in fact, occur. Therefore this warning can
5735 easily give a false positive: a warning about code that is not
5736 actually a problem. To help focus on important issues, several
5737 warning levels are defined. No warnings are issued for the use of
5738 undefined signed overflow when estimating how many iterations a loop
5739 requires, in particular when determining whether a loop will be
5740 executed at all.
5741
5742 @table @gcctabopt
5743 @item -Wstrict-overflow=1
5744 Warn about cases that are both questionable and easy to avoid. For
5745 example the compiler simplifies
5746 @code{x + 1 > x} to @code{1}. This level of
5747 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5748 are not, and must be explicitly requested.
5749
5750 @item -Wstrict-overflow=2
5751 Also warn about other cases where a comparison is simplified to a
5752 constant. For example: @code{abs (x) >= 0}. This can only be
5753 simplified when signed integer overflow is undefined, because
5754 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5755 zero. @option{-Wstrict-overflow} (with no level) is the same as
5756 @option{-Wstrict-overflow=2}.
5757
5758 @item -Wstrict-overflow=3
5759 Also warn about other cases where a comparison is simplified. For
5760 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5761
5762 @item -Wstrict-overflow=4
5763 Also warn about other simplifications not covered by the above cases.
5764 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5765
5766 @item -Wstrict-overflow=5
5767 Also warn about cases where the compiler reduces the magnitude of a
5768 constant involved in a comparison. For example: @code{x + 2 > y} is
5769 simplified to @code{x + 1 >= y}. This is reported only at the
5770 highest warning level because this simplification applies to many
5771 comparisons, so this warning level gives a very large number of
5772 false positives.
5773 @end table
5774
5775 @item -Wstringop-overflow
5776 @itemx -Wstringop-overflow=@var{type}
5777 @opindex Wstringop-overflow
5778 @opindex Wno-stringop-overflow
5779 Warn for calls to string manipulation functions such as @code{memcpy} and
5780 @code{strcpy} that are determined to overflow the destination buffer. The
5781 optional argument is one greater than the type of Object Size Checking to
5782 perform to determine the size of the destination. @xref{Object Size Checking}.
5783 The argument is meaningful only for functions that operate on character arrays
5784 but not for raw memory functions like @code{memcpy} which always make use
5785 of Object Size type-0. The option also warns for calls that specify a size
5786 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5787 The option produces the best results with optimization enabled but can detect
5788 a small subset of simple buffer overflows even without optimization in
5789 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5790 correspond to the standard functions. In any case, the option warns about
5791 just a subset of buffer overflows detected by the corresponding overflow
5792 checking built-ins. For example, the option will issue a warning for
5793 the @code{strcpy} call below because it copies at least 5 characters
5794 (the string @code{"blue"} including the terminating NUL) into the buffer
5795 of size 4.
5796
5797 @smallexample
5798 enum Color @{ blue, purple, yellow @};
5799 const char* f (enum Color clr)
5800 @{
5801 static char buf [4];
5802 const char *str;
5803 switch (clr)
5804 @{
5805 case blue: str = "blue"; break;
5806 case purple: str = "purple"; break;
5807 case yellow: str = "yellow"; break;
5808 @}
5809
5810 return strcpy (buf, str); // warning here
5811 @}
5812 @end smallexample
5813
5814 Option @option{-Wstringop-overflow=2} is enabled by default.
5815
5816 @table @gcctabopt
5817 @item -Wstringop-overflow
5818 @itemx -Wstringop-overflow=1
5819 @opindex Wstringop-overflow
5820 @opindex Wno-stringop-overflow
5821 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5822 to determine the sizes of destination objects. This is the default setting
5823 of the option. At this setting the option will not warn for writes past
5824 the end of subobjects of larger objects accessed by pointers unless the
5825 size of the largest surrounding object is known. When the destination may
5826 be one of several objects it is assumed to be the largest one of them. On
5827 Linux systems, when optimization is enabled at this setting the option warns
5828 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5829 a non-zero value.
5830
5831 @item -Wstringop-overflow=2
5832 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5833 to determine the sizes of destination objects. At this setting the option
5834 will warn about overflows when writing to members of the largest complete
5835 objects whose exact size is known. It will, however, not warn for excessive
5836 writes to the same members of unknown objects referenced by pointers since
5837 they may point to arrays containing unknown numbers of elements.
5838
5839 @item -Wstringop-overflow=3
5840 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5841 to determine the sizes of destination objects. At this setting the option
5842 warns about overflowing the smallest object or data member. This is the
5843 most restrictive setting of the option that may result in warnings for safe
5844 code.
5845
5846 @item -Wstringop-overflow=4
5847 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5848 to determine the sizes of destination objects. At this setting the option
5849 will warn about overflowing any data members, and when the destination is
5850 one of several objects it uses the size of the largest of them to decide
5851 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5852 setting of the option may result in warnings for benign code.
5853 @end table
5854
5855 @item -Wstringop-truncation
5856 @opindex Wstringop-truncation
5857 @opindex Wno-stringop-truncation
5858 Warn for calls to bounded string manipulation functions such as @code{strncat},
5859 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5860 or leave the destination unchanged.
5861
5862 In the following example, the call to @code{strncat} specifies a bound that
5863 is less than the length of the source string. As a result, the copy of
5864 the source will be truncated and so the call is diagnosed. To avoid the
5865 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5866
5867 @smallexample
5868 void append (char *buf, size_t bufsize)
5869 @{
5870 strncat (buf, ".txt", 3);
5871 @}
5872 @end smallexample
5873
5874 As another example, the following call to @code{strncpy} results in copying
5875 to @code{d} just the characters preceding the terminating NUL, without
5876 appending the NUL to the end. Assuming the result of @code{strncpy} is
5877 necessarily a NUL-terminated string is a common mistake, and so the call
5878 is diagnosed. To avoid the warning when the result is not expected to be
5879 NUL-terminated, call @code{memcpy} instead.
5880
5881 @smallexample
5882 void copy (char *d, const char *s)
5883 @{
5884 strncpy (d, s, strlen (s));
5885 @}
5886 @end smallexample
5887
5888 In the following example, the call to @code{strncpy} specifies the size
5889 of the destination buffer as the bound. If the length of the source
5890 string is equal to or greater than this size the result of the copy will
5891 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5892 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5893 element of the buffer to @code{NUL}.
5894
5895 @smallexample
5896 void copy (const char *s)
5897 @{
5898 char buf[80];
5899 strncpy (buf, s, sizeof buf);
5900 @dots{}
5901 @}
5902 @end smallexample
5903
5904 In situations where a character array is intended to store a sequence
5905 of bytes with no terminating @code{NUL} such an array may be annotated
5906 with attribute @code{nonstring} to avoid this warning. Such arrays,
5907 however, are not suitable arguments to functions that expect
5908 @code{NUL}-terminated strings. To help detect accidental misuses of
5909 such arrays GCC issues warnings unless it can prove that the use is
5910 safe. @xref{Common Variable Attributes}.
5911
5912 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5913 @opindex Wsuggest-attribute=
5914 @opindex Wno-suggest-attribute=
5915 Warn for cases where adding an attribute may be beneficial. The
5916 attributes currently supported are listed below.
5917
5918 @table @gcctabopt
5919 @item -Wsuggest-attribute=pure
5920 @itemx -Wsuggest-attribute=const
5921 @itemx -Wsuggest-attribute=noreturn
5922 @itemx -Wmissing-noreturn
5923 @itemx -Wsuggest-attribute=malloc
5924 @opindex Wsuggest-attribute=pure
5925 @opindex Wno-suggest-attribute=pure
5926 @opindex Wsuggest-attribute=const
5927 @opindex Wno-suggest-attribute=const
5928 @opindex Wsuggest-attribute=noreturn
5929 @opindex Wno-suggest-attribute=noreturn
5930 @opindex Wmissing-noreturn
5931 @opindex Wno-missing-noreturn
5932 @opindex Wsuggest-attribute=malloc
5933 @opindex Wno-suggest-attribute=malloc
5934
5935 Warn about functions that might be candidates for attributes
5936 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5937 only warns for functions visible in other compilation units or (in the case of
5938 @code{pure} and @code{const}) if it cannot prove that the function returns
5939 normally. A function returns normally if it doesn't contain an infinite loop or
5940 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5941 requires option @option{-fipa-pure-const}, which is enabled by default at
5942 @option{-O} and higher. Higher optimization levels improve the accuracy
5943 of the analysis.
5944
5945 @item -Wsuggest-attribute=format
5946 @itemx -Wmissing-format-attribute
5947 @opindex Wsuggest-attribute=format
5948 @opindex Wmissing-format-attribute
5949 @opindex Wno-suggest-attribute=format
5950 @opindex Wno-missing-format-attribute
5951 @opindex Wformat
5952 @opindex Wno-format
5953
5954 Warn about function pointers that might be candidates for @code{format}
5955 attributes. Note these are only possible candidates, not absolute ones.
5956 GCC guesses that function pointers with @code{format} attributes that
5957 are used in assignment, initialization, parameter passing or return
5958 statements should have a corresponding @code{format} attribute in the
5959 resulting type. I.e.@: the left-hand side of the assignment or
5960 initialization, the type of the parameter variable, or the return type
5961 of the containing function respectively should also have a @code{format}
5962 attribute to avoid the warning.
5963
5964 GCC also warns about function definitions that might be
5965 candidates for @code{format} attributes. Again, these are only
5966 possible candidates. GCC guesses that @code{format} attributes
5967 might be appropriate for any function that calls a function like
5968 @code{vprintf} or @code{vscanf}, but this might not always be the
5969 case, and some functions for which @code{format} attributes are
5970 appropriate may not be detected.
5971
5972 @item -Wsuggest-attribute=cold
5973 @opindex Wsuggest-attribute=cold
5974 @opindex Wno-suggest-attribute=cold
5975
5976 Warn about functions that might be candidates for @code{cold} attribute. This
5977 is based on static detection and generally will only warn about functions which
5978 always leads to a call to another @code{cold} function such as wrappers of
5979 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5980 @end table
5981
5982 @item -Wsuggest-final-types
5983 @opindex Wno-suggest-final-types
5984 @opindex Wsuggest-final-types
5985 Warn about types with virtual methods where code quality would be improved
5986 if the type were declared with the C++11 @code{final} specifier,
5987 or, if possible,
5988 declared in an anonymous namespace. This allows GCC to more aggressively
5989 devirtualize the polymorphic calls. This warning is more effective with link
5990 time optimization, where the information about the class hierarchy graph is
5991 more complete.
5992
5993 @item -Wsuggest-final-methods
5994 @opindex Wno-suggest-final-methods
5995 @opindex Wsuggest-final-methods
5996 Warn about virtual methods where code quality would be improved if the method
5997 were declared with the C++11 @code{final} specifier,
5998 or, if possible, its type were
5999 declared in an anonymous namespace or with the @code{final} specifier.
6000 This warning is
6001 more effective with link-time optimization, where the information about the
6002 class hierarchy graph is more complete. It is recommended to first consider
6003 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6004 annotations.
6005
6006 @item -Wsuggest-override
6007 Warn about overriding virtual functions that are not marked with the override
6008 keyword.
6009
6010 @item -Walloc-zero
6011 @opindex Wno-alloc-zero
6012 @opindex Walloc-zero
6013 Warn about calls to allocation functions decorated with attribute
6014 @code{alloc_size} that specify zero bytes, including those to the built-in
6015 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6016 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6017 when called with a zero size differs among implementations (and in the case
6018 of @code{realloc} has been deprecated) relying on it may result in subtle
6019 portability bugs and should be avoided.
6020
6021 @item -Walloc-size-larger-than=@var{byte-size}
6022 @opindex Walloc-size-larger-than=
6023 @opindex Wno-alloc-size-larger-than
6024 Warn about calls to functions decorated with attribute @code{alloc_size}
6025 that attempt to allocate objects larger than the specified number of bytes,
6026 or where the result of the size computation in an integer type with infinite
6027 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6028 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6029 Warnings controlled by the option can be disabled either by specifying
6030 @var{byte-size} of @samp{SIZE_MAX} or more or by
6031 @option{-Wno-alloc-size-larger-than}.
6032 @xref{Function Attributes}.
6033
6034 @item -Wno-alloc-size-larger-than
6035 @opindex Wno-alloc-size-larger-than
6036 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6037 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6038 larger.
6039
6040 @item -Walloca
6041 @opindex Wno-alloca
6042 @opindex Walloca
6043 This option warns on all uses of @code{alloca} in the source.
6044
6045 @item -Walloca-larger-than=@var{byte-size}
6046 @opindex Walloca-larger-than=
6047 @opindex Wno-alloca-larger-than
6048 This option warns on calls to @code{alloca} with an integer argument whose
6049 value is either zero, or that is not bounded by a controlling predicate
6050 that limits its value to at most @var{byte-size}. It also warns for calls
6051 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6052 types are considered unbounded even if they appear to be constrained to
6053 the expected range.
6054
6055 For example, a bounded case of @code{alloca} could be:
6056
6057 @smallexample
6058 void func (size_t n)
6059 @{
6060 void *p;
6061 if (n <= 1000)
6062 p = alloca (n);
6063 else
6064 p = malloc (n);
6065 f (p);
6066 @}
6067 @end smallexample
6068
6069 In the above example, passing @code{-Walloca-larger-than=1000} would not
6070 issue a warning because the call to @code{alloca} is known to be at most
6071 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6072 the compiler would emit a warning.
6073
6074 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6075 controlling predicate constraining its integer argument. For example:
6076
6077 @smallexample
6078 void func ()
6079 @{
6080 void *p = alloca (n);
6081 f (p);
6082 @}
6083 @end smallexample
6084
6085 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6086 a warning, but this time because of the lack of bounds checking.
6087
6088 Note, that even seemingly correct code involving signed integers could
6089 cause a warning:
6090
6091 @smallexample
6092 void func (signed int n)
6093 @{
6094 if (n < 500)
6095 @{
6096 p = alloca (n);
6097 f (p);
6098 @}
6099 @}
6100 @end smallexample
6101
6102 In the above example, @var{n} could be negative, causing a larger than
6103 expected argument to be implicitly cast into the @code{alloca} call.
6104
6105 This option also warns when @code{alloca} is used in a loop.
6106
6107 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6108 but is usually only effective when @option{-ftree-vrp} is active (default
6109 for @option{-O2} and above).
6110
6111 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6112
6113 @item -Wno-alloca-larger-than
6114 @opindex Wno-alloca-larger-than
6115 Disable @option{-Walloca-larger-than=} warnings. The option is
6116 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6117
6118 @item -Warray-bounds
6119 @itemx -Warray-bounds=@var{n}
6120 @opindex Wno-array-bounds
6121 @opindex Warray-bounds
6122 This option is only active when @option{-ftree-vrp} is active
6123 (default for @option{-O2} and above). It warns about subscripts to arrays
6124 that are always out of bounds. This warning is enabled by @option{-Wall}.
6125
6126 @table @gcctabopt
6127 @item -Warray-bounds=1
6128 This is the warning level of @option{-Warray-bounds} and is enabled
6129 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6130
6131 @item -Warray-bounds=2
6132 This warning level also warns about out of bounds access for
6133 arrays at the end of a struct and for arrays accessed through
6134 pointers. This warning level may give a larger number of
6135 false positives and is deactivated by default.
6136 @end table
6137
6138 @item -Wattribute-alias=@var{n}
6139 @itemx -Wno-attribute-alias
6140 @opindex -Wattribute-alias
6141 @opindex -Wno-attribute-alias
6142 Warn about declarations using the @code{alias} and similar attributes whose
6143 target is incompatible with the type of the alias.
6144 @xref{Function Attributes,,Declaring Attributes of Functions}.
6145
6146 @table @gcctabopt
6147 @item -Wattribute-alias=1
6148 The default warning level of the @option{-Wattribute-alias} option diagnoses
6149 incompatibilities between the type of the alias declaration and that of its
6150 target. Such incompatibilities are typically indicative of bugs.
6151
6152 @item -Wattribute-alias=2
6153
6154 At this level @option{-Wattribute-alias} also diagnoses cases where
6155 the attributes of the alias declaration are more restrictive than the
6156 attributes applied to its target. These mismatches can potentially
6157 result in incorrect code generation. In other cases they may be
6158 benign and could be resolved simply by adding the missing attribute to
6159 the target. For comparison, see the @option{-Wmissing-attributes}
6160 option, which controls diagnostics when the alias declaration is less
6161 restrictive than the target, rather than more restrictive.
6162
6163 Attributes considered include @code{alloc_align}, @code{alloc_size},
6164 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6165 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6166 @code{returns_nonnull}, and @code{returns_twice}.
6167 @end table
6168
6169 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6170 This is the default. You can disable these warnings with either
6171 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6172
6173 @item -Wbool-compare
6174 @opindex Wno-bool-compare
6175 @opindex Wbool-compare
6176 Warn about boolean expression compared with an integer value different from
6177 @code{true}/@code{false}. For instance, the following comparison is
6178 always false:
6179 @smallexample
6180 int n = 5;
6181 @dots{}
6182 if ((n > 1) == 2) @{ @dots{} @}
6183 @end smallexample
6184 This warning is enabled by @option{-Wall}.
6185
6186 @item -Wbool-operation
6187 @opindex Wno-bool-operation
6188 @opindex Wbool-operation
6189 Warn about suspicious operations on expressions of a boolean type. For
6190 instance, bitwise negation of a boolean is very likely a bug in the program.
6191 For C, this warning also warns about incrementing or decrementing a boolean,
6192 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6193 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6194
6195 This warning is enabled by @option{-Wall}.
6196
6197 @item -Wduplicated-branches
6198 @opindex Wno-duplicated-branches
6199 @opindex Wduplicated-branches
6200 Warn when an if-else has identical branches. This warning detects cases like
6201 @smallexample
6202 if (p != NULL)
6203 return 0;
6204 else
6205 return 0;
6206 @end smallexample
6207 It doesn't warn when both branches contain just a null statement. This warning
6208 also warn for conditional operators:
6209 @smallexample
6210 int i = x ? *p : *p;
6211 @end smallexample
6212
6213 @item -Wduplicated-cond
6214 @opindex Wno-duplicated-cond
6215 @opindex Wduplicated-cond
6216 Warn about duplicated conditions in an if-else-if chain. For instance,
6217 warn for the following code:
6218 @smallexample
6219 if (p->q != NULL) @{ @dots{} @}
6220 else if (p->q != NULL) @{ @dots{} @}
6221 @end smallexample
6222
6223 @item -Wframe-address
6224 @opindex Wno-frame-address
6225 @opindex Wframe-address
6226 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6227 is called with an argument greater than 0. Such calls may return indeterminate
6228 values or crash the program. The warning is included in @option{-Wall}.
6229
6230 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6231 @opindex Wno-discarded-qualifiers
6232 @opindex Wdiscarded-qualifiers
6233 Do not warn if type qualifiers on pointers are being discarded.
6234 Typically, the compiler warns if a @code{const char *} variable is
6235 passed to a function that takes a @code{char *} parameter. This option
6236 can be used to suppress such a warning.
6237
6238 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6239 @opindex Wno-discarded-array-qualifiers
6240 @opindex Wdiscarded-array-qualifiers
6241 Do not warn if type qualifiers on arrays which are pointer targets
6242 are being discarded. Typically, the compiler warns if a
6243 @code{const int (*)[]} variable is passed to a function that
6244 takes a @code{int (*)[]} parameter. This option can be used to
6245 suppress such a warning.
6246
6247 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6248 @opindex Wno-incompatible-pointer-types
6249 @opindex Wincompatible-pointer-types
6250 Do not warn when there is a conversion between pointers that have incompatible
6251 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6252 which warns for pointer argument passing or assignment with different
6253 signedness.
6254
6255 @item -Wno-int-conversion @r{(C and Objective-C only)}
6256 @opindex Wno-int-conversion
6257 @opindex Wint-conversion
6258 Do not warn about incompatible integer to pointer and pointer to integer
6259 conversions. This warning is about implicit conversions; for explicit
6260 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6261 @option{-Wno-pointer-to-int-cast} may be used.
6262
6263 @item -Wno-div-by-zero
6264 @opindex Wno-div-by-zero
6265 @opindex Wdiv-by-zero
6266 Do not warn about compile-time integer division by zero. Floating-point
6267 division by zero is not warned about, as it can be a legitimate way of
6268 obtaining infinities and NaNs.
6269
6270 @item -Wsystem-headers
6271 @opindex Wsystem-headers
6272 @opindex Wno-system-headers
6273 @cindex warnings from system headers
6274 @cindex system headers, warnings from
6275 Print warning messages for constructs found in system header files.
6276 Warnings from system headers are normally suppressed, on the assumption
6277 that they usually do not indicate real problems and would only make the
6278 compiler output harder to read. Using this command-line option tells
6279 GCC to emit warnings from system headers as if they occurred in user
6280 code. However, note that using @option{-Wall} in conjunction with this
6281 option does @emph{not} warn about unknown pragmas in system
6282 headers---for that, @option{-Wunknown-pragmas} must also be used.
6283
6284 @item -Wtautological-compare
6285 @opindex Wtautological-compare
6286 @opindex Wno-tautological-compare
6287 Warn if a self-comparison always evaluates to true or false. This
6288 warning detects various mistakes such as:
6289 @smallexample
6290 int i = 1;
6291 @dots{}
6292 if (i > i) @{ @dots{} @}
6293 @end smallexample
6294
6295 This warning also warns about bitwise comparisons that always evaluate
6296 to true or false, for instance:
6297 @smallexample
6298 if ((a & 16) == 10) @{ @dots{} @}
6299 @end smallexample
6300 will always be false.
6301
6302 This warning is enabled by @option{-Wall}.
6303
6304 @item -Wtrampolines
6305 @opindex Wtrampolines
6306 @opindex Wno-trampolines
6307 Warn about trampolines generated for pointers to nested functions.
6308 A trampoline is a small piece of data or code that is created at run
6309 time on the stack when the address of a nested function is taken, and is
6310 used to call the nested function indirectly. For some targets, it is
6311 made up of data only and thus requires no special treatment. But, for
6312 most targets, it is made up of code and thus requires the stack to be
6313 made executable in order for the program to work properly.
6314
6315 @item -Wfloat-equal
6316 @opindex Wfloat-equal
6317 @opindex Wno-float-equal
6318 Warn if floating-point values are used in equality comparisons.
6319
6320 The idea behind this is that sometimes it is convenient (for the
6321 programmer) to consider floating-point values as approximations to
6322 infinitely precise real numbers. If you are doing this, then you need
6323 to compute (by analyzing the code, or in some other way) the maximum or
6324 likely maximum error that the computation introduces, and allow for it
6325 when performing comparisons (and when producing output, but that's a
6326 different problem). In particular, instead of testing for equality, you
6327 should check to see whether the two values have ranges that overlap; and
6328 this is done with the relational operators, so equality comparisons are
6329 probably mistaken.
6330
6331 @item -Wtraditional @r{(C and Objective-C only)}
6332 @opindex Wtraditional
6333 @opindex Wno-traditional
6334 Warn about certain constructs that behave differently in traditional and
6335 ISO C@. Also warn about ISO C constructs that have no traditional C
6336 equivalent, and/or problematic constructs that should be avoided.
6337
6338 @itemize @bullet
6339 @item
6340 Macro parameters that appear within string literals in the macro body.
6341 In traditional C macro replacement takes place within string literals,
6342 but in ISO C it does not.
6343
6344 @item
6345 In traditional C, some preprocessor directives did not exist.
6346 Traditional preprocessors only considered a line to be a directive
6347 if the @samp{#} appeared in column 1 on the line. Therefore
6348 @option{-Wtraditional} warns about directives that traditional C
6349 understands but ignores because the @samp{#} does not appear as the
6350 first character on the line. It also suggests you hide directives like
6351 @code{#pragma} not understood by traditional C by indenting them. Some
6352 traditional implementations do not recognize @code{#elif}, so this option
6353 suggests avoiding it altogether.
6354
6355 @item
6356 A function-like macro that appears without arguments.
6357
6358 @item
6359 The unary plus operator.
6360
6361 @item
6362 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6363 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6364 constants.) Note, these suffixes appear in macros defined in the system
6365 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6366 Use of these macros in user code might normally lead to spurious
6367 warnings, however GCC's integrated preprocessor has enough context to
6368 avoid warning in these cases.
6369
6370 @item
6371 A function declared external in one block and then used after the end of
6372 the block.
6373
6374 @item
6375 A @code{switch} statement has an operand of type @code{long}.
6376
6377 @item
6378 A non-@code{static} function declaration follows a @code{static} one.
6379 This construct is not accepted by some traditional C compilers.
6380
6381 @item
6382 The ISO type of an integer constant has a different width or
6383 signedness from its traditional type. This warning is only issued if
6384 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6385 typically represent bit patterns, are not warned about.
6386
6387 @item
6388 Usage of ISO string concatenation is detected.
6389
6390 @item
6391 Initialization of automatic aggregates.
6392
6393 @item
6394 Identifier conflicts with labels. Traditional C lacks a separate
6395 namespace for labels.
6396
6397 @item
6398 Initialization of unions. If the initializer is zero, the warning is
6399 omitted. This is done under the assumption that the zero initializer in
6400 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6401 initializer warnings and relies on default initialization to zero in the
6402 traditional C case.
6403
6404 @item
6405 Conversions by prototypes between fixed/floating-point values and vice
6406 versa. The absence of these prototypes when compiling with traditional
6407 C causes serious problems. This is a subset of the possible
6408 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6409
6410 @item
6411 Use of ISO C style function definitions. This warning intentionally is
6412 @emph{not} issued for prototype declarations or variadic functions
6413 because these ISO C features appear in your code when using
6414 libiberty's traditional C compatibility macros, @code{PARAMS} and
6415 @code{VPARAMS}. This warning is also bypassed for nested functions
6416 because that feature is already a GCC extension and thus not relevant to
6417 traditional C compatibility.
6418 @end itemize
6419
6420 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6421 @opindex Wtraditional-conversion
6422 @opindex Wno-traditional-conversion
6423 Warn if a prototype causes a type conversion that is different from what
6424 would happen to the same argument in the absence of a prototype. This
6425 includes conversions of fixed point to floating and vice versa, and
6426 conversions changing the width or signedness of a fixed-point argument
6427 except when the same as the default promotion.
6428
6429 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6430 @opindex Wdeclaration-after-statement
6431 @opindex Wno-declaration-after-statement
6432 Warn when a declaration is found after a statement in a block. This
6433 construct, known from C++, was introduced with ISO C99 and is by default
6434 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6435
6436 @item -Wshadow
6437 @opindex Wshadow
6438 @opindex Wno-shadow
6439 Warn whenever a local variable or type declaration shadows another
6440 variable, parameter, type, class member (in C++), or instance variable
6441 (in Objective-C) or whenever a built-in function is shadowed. Note
6442 that in C++, the compiler warns if a local variable shadows an
6443 explicit typedef, but not if it shadows a struct/class/enum.
6444 Same as @option{-Wshadow=global}.
6445
6446 @item -Wno-shadow-ivar @r{(Objective-C only)}
6447 @opindex Wno-shadow-ivar
6448 @opindex Wshadow-ivar
6449 Do not warn whenever a local variable shadows an instance variable in an
6450 Objective-C method.
6451
6452 @item -Wshadow=global
6453 @opindex Wshadow=local
6454 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6455
6456 @item -Wshadow=local
6457 @opindex Wshadow=local
6458 Warn when a local variable shadows another local variable or parameter.
6459 This warning is enabled by @option{-Wshadow=global}.
6460
6461 @item -Wshadow=compatible-local
6462 @opindex Wshadow=compatible-local
6463 Warn when a local variable shadows another local variable or parameter
6464 whose type is compatible with that of the shadowing variable. In C++,
6465 type compatibility here means the type of the shadowing variable can be
6466 converted to that of the shadowed variable. The creation of this flag
6467 (in addition to @option{-Wshadow=local}) is based on the idea that when
6468 a local variable shadows another one of incompatible type, it is most
6469 likely intentional, not a bug or typo, as shown in the following example:
6470
6471 @smallexample
6472 @group
6473 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6474 @{
6475 for (int i = 0; i < N; ++i)
6476 @{
6477 ...
6478 @}
6479 ...
6480 @}
6481 @end group
6482 @end smallexample
6483
6484 Since the two variable @code{i} in the example above have incompatible types,
6485 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6486 Because their types are incompatible, if a programmer accidentally uses one
6487 in place of the other, type checking will catch that and emit an error or
6488 warning. So not warning (about shadowing) in this case will not lead to
6489 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6490 possibly reduce the number of warnings triggered by intentional shadowing.
6491
6492 This warning is enabled by @option{-Wshadow=local}.
6493
6494 @item -Wlarger-than=@var{byte-size}
6495 @opindex Wlarger-than=
6496 @opindex Wlarger-than-@var{byte-size}
6497 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6498 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6499 Warnings controlled by the option can be disabled either by specifying
6500 @var{byte-size} of @samp{SIZE_MAX} or more or by
6501 @option{-Wno-larger-than}.
6502
6503 @item -Wno-larger-than
6504 @opindex Wno-larger-than
6505 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6506 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6507
6508 @item -Wframe-larger-than=@var{byte-size}
6509 @opindex Wframe-larger-than=
6510 @opindex Wno-frame-larger-than
6511 Warn if the size of a function frame exceeds @var{byte-size}.
6512 The computation done to determine the stack frame size is approximate
6513 and not conservative.
6514 The actual requirements may be somewhat greater than @var{byte-size}
6515 even if you do not get a warning. In addition, any space allocated
6516 via @code{alloca}, variable-length arrays, or related constructs
6517 is not included by the compiler when determining
6518 whether or not to issue a warning.
6519 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6520 Warnings controlled by the option can be disabled either by specifying
6521 @var{byte-size} of @samp{SIZE_MAX} or more or by
6522 @option{-Wno-frame-larger-than}.
6523
6524 @item -Wno-frame-larger-than
6525 @opindex Wno-frame-larger-than
6526 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6527 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6528
6529 @item -Wno-free-nonheap-object
6530 @opindex Wno-free-nonheap-object
6531 @opindex Wfree-nonheap-object
6532 Do not warn when attempting to free an object that was not allocated
6533 on the heap.
6534
6535 @item -Wstack-usage=@var{byte-size}
6536 @opindex Wstack-usage
6537 @opindex Wno-stack-usage
6538 Warn if the stack usage of a function might exceed @var{byte-size}.
6539 The computation done to determine the stack usage is conservative.
6540 Any space allocated via @code{alloca}, variable-length arrays, or related
6541 constructs is included by the compiler when determining whether or not to
6542 issue a warning.
6543
6544 The message is in keeping with the output of @option{-fstack-usage}.
6545
6546 @itemize
6547 @item
6548 If the stack usage is fully static but exceeds the specified amount, it's:
6549
6550 @smallexample
6551 warning: stack usage is 1120 bytes
6552 @end smallexample
6553 @item
6554 If the stack usage is (partly) dynamic but bounded, it's:
6555
6556 @smallexample
6557 warning: stack usage might be 1648 bytes
6558 @end smallexample
6559 @item
6560 If the stack usage is (partly) dynamic and not bounded, it's:
6561
6562 @smallexample
6563 warning: stack usage might be unbounded
6564 @end smallexample
6565 @end itemize
6566
6567 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6568 Warnings controlled by the option can be disabled either by specifying
6569 @var{byte-size} of @samp{SIZE_MAX} or more or by
6570 @option{-Wno-stack-usage}.
6571
6572 @item -Wno-stack-usage
6573 @opindex Wno-stack-usage
6574 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6575 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6576
6577 @item -Wunsafe-loop-optimizations
6578 @opindex Wunsafe-loop-optimizations
6579 @opindex Wno-unsafe-loop-optimizations
6580 Warn if the loop cannot be optimized because the compiler cannot
6581 assume anything on the bounds of the loop indices. With
6582 @option{-funsafe-loop-optimizations} warn if the compiler makes
6583 such assumptions.
6584
6585 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6586 @opindex Wno-pedantic-ms-format
6587 @opindex Wpedantic-ms-format
6588 When used in combination with @option{-Wformat}
6589 and @option{-pedantic} without GNU extensions, this option
6590 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6591 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6592 which depend on the MS runtime.
6593
6594 @item -Waligned-new
6595 @opindex Waligned-new
6596 @opindex Wno-aligned-new
6597 Warn about a new-expression of a type that requires greater alignment
6598 than the @code{alignof(std::max_align_t)} but uses an allocation
6599 function without an explicit alignment parameter. This option is
6600 enabled by @option{-Wall}.
6601
6602 Normally this only warns about global allocation functions, but
6603 @option{-Waligned-new=all} also warns about class member allocation
6604 functions.
6605
6606 @item -Wplacement-new
6607 @itemx -Wplacement-new=@var{n}
6608 @opindex Wplacement-new
6609 @opindex Wno-placement-new
6610 Warn about placement new expressions with undefined behavior, such as
6611 constructing an object in a buffer that is smaller than the type of
6612 the object. For example, the placement new expression below is diagnosed
6613 because it attempts to construct an array of 64 integers in a buffer only
6614 64 bytes large.
6615 @smallexample
6616 char buf [64];
6617 new (buf) int[64];
6618 @end smallexample
6619 This warning is enabled by default.
6620
6621 @table @gcctabopt
6622 @item -Wplacement-new=1
6623 This is the default warning level of @option{-Wplacement-new}. At this
6624 level the warning is not issued for some strictly undefined constructs that
6625 GCC allows as extensions for compatibility with legacy code. For example,
6626 the following @code{new} expression is not diagnosed at this level even
6627 though it has undefined behavior according to the C++ standard because
6628 it writes past the end of the one-element array.
6629 @smallexample
6630 struct S @{ int n, a[1]; @};
6631 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6632 new (s->a)int [32]();
6633 @end smallexample
6634
6635 @item -Wplacement-new=2
6636 At this level, in addition to diagnosing all the same constructs as at level
6637 1, a diagnostic is also issued for placement new expressions that construct
6638 an object in the last member of structure whose type is an array of a single
6639 element and whose size is less than the size of the object being constructed.
6640 While the previous example would be diagnosed, the following construct makes
6641 use of the flexible member array extension to avoid the warning at level 2.
6642 @smallexample
6643 struct S @{ int n, a[]; @};
6644 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6645 new (s->a)int [32]();
6646 @end smallexample
6647
6648 @end table
6649
6650 @item -Wpointer-arith
6651 @opindex Wpointer-arith
6652 @opindex Wno-pointer-arith
6653 Warn about anything that depends on the ``size of'' a function type or
6654 of @code{void}. GNU C assigns these types a size of 1, for
6655 convenience in calculations with @code{void *} pointers and pointers
6656 to functions. In C++, warn also when an arithmetic operation involves
6657 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6658
6659 @item -Wpointer-compare
6660 @opindex Wpointer-compare
6661 @opindex Wno-pointer-compare
6662 Warn if a pointer is compared with a zero character constant. This usually
6663 means that the pointer was meant to be dereferenced. For example:
6664
6665 @smallexample
6666 const char *p = foo ();
6667 if (p == '\0')
6668 return 42;
6669 @end smallexample
6670
6671 Note that the code above is invalid in C++11.
6672
6673 This warning is enabled by default.
6674
6675 @item -Wtype-limits
6676 @opindex Wtype-limits
6677 @opindex Wno-type-limits
6678 Warn if a comparison is always true or always false due to the limited
6679 range of the data type, but do not warn for constant expressions. For
6680 example, warn if an unsigned variable is compared against zero with
6681 @code{<} or @code{>=}. This warning is also enabled by
6682 @option{-Wextra}.
6683
6684 @item -Wabsolute-value @r{(C and Objective-C only)}
6685 @opindex Wabsolute-value
6686 @opindex Wno-absolute-value
6687 Warn for calls to standard functions that compute the absolute value
6688 of an argument when a more appropriate standard function is available.
6689 For example, calling @code{abs(3.14)} triggers the warning because the
6690 appropriate function to call to compute the absolute value of a double
6691 argument is @code{fabs}. The option also triggers warnings when the
6692 argument in a call to such a function has an unsigned type. This
6693 warning can be suppressed with an explicit type cast and it is also
6694 enabled by @option{-Wextra}.
6695
6696 @include cppwarnopts.texi
6697
6698 @item -Wbad-function-cast @r{(C and Objective-C only)}
6699 @opindex Wbad-function-cast
6700 @opindex Wno-bad-function-cast
6701 Warn when a function call is cast to a non-matching type.
6702 For example, warn if a call to a function returning an integer type
6703 is cast to a pointer type.
6704
6705 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6706 @opindex Wc90-c99-compat
6707 @opindex Wno-c90-c99-compat
6708 Warn about features not present in ISO C90, but present in ISO C99.
6709 For instance, warn about use of variable length arrays, @code{long long}
6710 type, @code{bool} type, compound literals, designated initializers, and so
6711 on. This option is independent of the standards mode. Warnings are disabled
6712 in the expression that follows @code{__extension__}.
6713
6714 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6715 @opindex Wc99-c11-compat
6716 @opindex Wno-c99-c11-compat
6717 Warn about features not present in ISO C99, but present in ISO C11.
6718 For instance, warn about use of anonymous structures and unions,
6719 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6720 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6721 and so on. This option is independent of the standards mode. Warnings are
6722 disabled in the expression that follows @code{__extension__}.
6723
6724 @item -Wc++-compat @r{(C and Objective-C only)}
6725 @opindex Wc++-compat
6726 @opindex Wno-c++-compat
6727 Warn about ISO C constructs that are outside of the common subset of
6728 ISO C and ISO C++, e.g.@: request for implicit conversion from
6729 @code{void *} to a pointer to non-@code{void} type.
6730
6731 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6732 @opindex Wc++11-compat
6733 @opindex Wno-c++11-compat
6734 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6735 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6736 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6737 enabled by @option{-Wall}.
6738
6739 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6740 @opindex Wc++14-compat
6741 @opindex Wno-c++14-compat
6742 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6743 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6744
6745 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6746 @opindex Wc++17-compat
6747 @opindex Wno-c++17-compat
6748 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6749 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6750
6751 @item -Wcast-qual
6752 @opindex Wcast-qual
6753 @opindex Wno-cast-qual
6754 Warn whenever a pointer is cast so as to remove a type qualifier from
6755 the target type. For example, warn if a @code{const char *} is cast
6756 to an ordinary @code{char *}.
6757
6758 Also warn when making a cast that introduces a type qualifier in an
6759 unsafe way. For example, casting @code{char **} to @code{const char **}
6760 is unsafe, as in this example:
6761
6762 @smallexample
6763 /* p is char ** value. */
6764 const char **q = (const char **) p;
6765 /* Assignment of readonly string to const char * is OK. */
6766 *q = "string";
6767 /* Now char** pointer points to read-only memory. */
6768 **p = 'b';
6769 @end smallexample
6770
6771 @item -Wcast-align
6772 @opindex Wcast-align
6773 @opindex Wno-cast-align
6774 Warn whenever a pointer is cast such that the required alignment of the
6775 target is increased. For example, warn if a @code{char *} is cast to
6776 an @code{int *} on machines where integers can only be accessed at
6777 two- or four-byte boundaries.
6778
6779 @item -Wcast-align=strict
6780 @opindex Wcast-align=strict
6781 Warn whenever a pointer is cast such that the required alignment of the
6782 target is increased. For example, warn if a @code{char *} is cast to
6783 an @code{int *} regardless of the target machine.
6784
6785 @item -Wcast-function-type
6786 @opindex Wcast-function-type
6787 @opindex Wno-cast-function-type
6788 Warn when a function pointer is cast to an incompatible function pointer.
6789 In a cast involving function types with a variable argument list only
6790 the types of initial arguments that are provided are considered.
6791 Any parameter of pointer-type matches any other pointer-type. Any benign
6792 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6793 on ILP32 targets. Likewise type qualifiers are ignored. The function
6794 type @code{void (*) (void)} is special and matches everything, which can
6795 be used to suppress this warning.
6796 In a cast involving pointer to member types this warning warns whenever
6797 the type cast is changing the pointer to member type.
6798 This warning is enabled by @option{-Wextra}.
6799
6800 @item -Wwrite-strings
6801 @opindex Wwrite-strings
6802 @opindex Wno-write-strings
6803 When compiling C, give string constants the type @code{const
6804 char[@var{length}]} so that copying the address of one into a
6805 non-@code{const} @code{char *} pointer produces a warning. These
6806 warnings help you find at compile time code that can try to write
6807 into a string constant, but only if you have been very careful about
6808 using @code{const} in declarations and prototypes. Otherwise, it is
6809 just a nuisance. This is why we did not make @option{-Wall} request
6810 these warnings.
6811
6812 When compiling C++, warn about the deprecated conversion from string
6813 literals to @code{char *}. This warning is enabled by default for C++
6814 programs.
6815
6816 @item -Wcatch-value
6817 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6818 @opindex Wcatch-value
6819 @opindex Wno-catch-value
6820 Warn about catch handlers that do not catch via reference.
6821 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6822 warn about polymorphic class types that are caught by value.
6823 With @option{-Wcatch-value=2} warn about all class types that are caught
6824 by value. With @option{-Wcatch-value=3} warn about all types that are
6825 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6826
6827 @item -Wclobbered
6828 @opindex Wclobbered
6829 @opindex Wno-clobbered
6830 Warn for variables that might be changed by @code{longjmp} or
6831 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6832
6833 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6834 @opindex Wconditionally-supported
6835 @opindex Wno-conditionally-supported
6836 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6837
6838 @item -Wconversion
6839 @opindex Wconversion
6840 @opindex Wno-conversion
6841 Warn for implicit conversions that may alter a value. This includes
6842 conversions between real and integer, like @code{abs (x)} when
6843 @code{x} is @code{double}; conversions between signed and unsigned,
6844 like @code{unsigned ui = -1}; and conversions to smaller types, like
6845 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6846 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6847 changed by the conversion like in @code{abs (2.0)}. Warnings about
6848 conversions between signed and unsigned integers can be disabled by
6849 using @option{-Wno-sign-conversion}.
6850
6851 For C++, also warn for confusing overload resolution for user-defined
6852 conversions; and conversions that never use a type conversion
6853 operator: conversions to @code{void}, the same type, a base class or a
6854 reference to them. Warnings about conversions between signed and
6855 unsigned integers are disabled by default in C++ unless
6856 @option{-Wsign-conversion} is explicitly enabled.
6857
6858 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6859 @opindex Wconversion-null
6860 @opindex Wno-conversion-null
6861 Do not warn for conversions between @code{NULL} and non-pointer
6862 types. @option{-Wconversion-null} is enabled by default.
6863
6864 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6865 @opindex Wzero-as-null-pointer-constant
6866 @opindex Wno-zero-as-null-pointer-constant
6867 Warn when a literal @samp{0} is used as null pointer constant. This can
6868 be useful to facilitate the conversion to @code{nullptr} in C++11.
6869
6870 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6871 @opindex Wsubobject-linkage
6872 @opindex Wno-subobject-linkage
6873 Warn if a class type has a base or a field whose type uses the anonymous
6874 namespace or depends on a type with no linkage. If a type A depends on
6875 a type B with no or internal linkage, defining it in multiple
6876 translation units would be an ODR violation because the meaning of B
6877 is different in each translation unit. If A only appears in a single
6878 translation unit, the best way to silence the warning is to give it
6879 internal linkage by putting it in an anonymous namespace as well. The
6880 compiler doesn't give this warning for types defined in the main .C
6881 file, as those are unlikely to have multiple definitions.
6882 @option{-Wsubobject-linkage} is enabled by default.
6883
6884 @item -Wdangling-else
6885 @opindex Wdangling-else
6886 @opindex Wno-dangling-else
6887 Warn about constructions where there may be confusion to which
6888 @code{if} statement an @code{else} branch belongs. Here is an example of
6889 such a case:
6890
6891 @smallexample
6892 @group
6893 @{
6894 if (a)
6895 if (b)
6896 foo ();
6897 else
6898 bar ();
6899 @}
6900 @end group
6901 @end smallexample
6902
6903 In C/C++, every @code{else} branch belongs to the innermost possible
6904 @code{if} statement, which in this example is @code{if (b)}. This is
6905 often not what the programmer expected, as illustrated in the above
6906 example by indentation the programmer chose. When there is the
6907 potential for this confusion, GCC issues a warning when this flag
6908 is specified. To eliminate the warning, add explicit braces around
6909 the innermost @code{if} statement so there is no way the @code{else}
6910 can belong to the enclosing @code{if}. The resulting code
6911 looks like this:
6912
6913 @smallexample
6914 @group
6915 @{
6916 if (a)
6917 @{
6918 if (b)
6919 foo ();
6920 else
6921 bar ();
6922 @}
6923 @}
6924 @end group
6925 @end smallexample
6926
6927 This warning is enabled by @option{-Wparentheses}.
6928
6929 @item -Wdate-time
6930 @opindex Wdate-time
6931 @opindex Wno-date-time
6932 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6933 are encountered as they might prevent bit-wise-identical reproducible
6934 compilations.
6935
6936 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6937 @opindex Wdelete-incomplete
6938 @opindex Wno-delete-incomplete
6939 Warn when deleting a pointer to incomplete type, which may cause
6940 undefined behavior at runtime. This warning is enabled by default.
6941
6942 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6943 @opindex Wuseless-cast
6944 @opindex Wno-useless-cast
6945 Warn when an expression is casted to its own type.
6946
6947 @item -Wempty-body
6948 @opindex Wempty-body
6949 @opindex Wno-empty-body
6950 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6951 while} statement. This warning is also enabled by @option{-Wextra}.
6952
6953 @item -Wenum-compare
6954 @opindex Wenum-compare
6955 @opindex Wno-enum-compare
6956 Warn about a comparison between values of different enumerated types.
6957 In C++ enumerated type mismatches in conditional expressions are also
6958 diagnosed and the warning is enabled by default. In C this warning is
6959 enabled by @option{-Wall}.
6960
6961 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6962 @opindex Wextra-semi
6963 @opindex Wno-extra-semi
6964 Warn about redundant semicolon after in-class function definition.
6965
6966 @item -Wjump-misses-init @r{(C, Objective-C only)}
6967 @opindex Wjump-misses-init
6968 @opindex Wno-jump-misses-init
6969 Warn if a @code{goto} statement or a @code{switch} statement jumps
6970 forward across the initialization of a variable, or jumps backward to a
6971 label after the variable has been initialized. This only warns about
6972 variables that are initialized when they are declared. This warning is
6973 only supported for C and Objective-C; in C++ this sort of branch is an
6974 error in any case.
6975
6976 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6977 can be disabled with the @option{-Wno-jump-misses-init} option.
6978
6979 @item -Wsign-compare
6980 @opindex Wsign-compare
6981 @opindex Wno-sign-compare
6982 @cindex warning for comparison of signed and unsigned values
6983 @cindex comparison of signed and unsigned values, warning
6984 @cindex signed and unsigned values, comparison warning
6985 Warn when a comparison between signed and unsigned values could produce
6986 an incorrect result when the signed value is converted to unsigned.
6987 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6988 also enabled by @option{-Wextra}.
6989
6990 @item -Wsign-conversion
6991 @opindex Wsign-conversion
6992 @opindex Wno-sign-conversion
6993 Warn for implicit conversions that may change the sign of an integer
6994 value, like assigning a signed integer expression to an unsigned
6995 integer variable. An explicit cast silences the warning. In C, this
6996 option is enabled also by @option{-Wconversion}.
6997
6998 @item -Wfloat-conversion
6999 @opindex Wfloat-conversion
7000 @opindex Wno-float-conversion
7001 Warn for implicit conversions that reduce the precision of a real value.
7002 This includes conversions from real to integer, and from higher precision
7003 real to lower precision real values. This option is also enabled by
7004 @option{-Wconversion}.
7005
7006 @item -Wno-scalar-storage-order
7007 @opindex Wno-scalar-storage-order
7008 @opindex Wscalar-storage-order
7009 Do not warn on suspicious constructs involving reverse scalar storage order.
7010
7011 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7012 @opindex Wsized-deallocation
7013 @opindex Wno-sized-deallocation
7014 Warn about a definition of an unsized deallocation function
7015 @smallexample
7016 void operator delete (void *) noexcept;
7017 void operator delete[] (void *) noexcept;
7018 @end smallexample
7019 without a definition of the corresponding sized deallocation function
7020 @smallexample
7021 void operator delete (void *, std::size_t) noexcept;
7022 void operator delete[] (void *, std::size_t) noexcept;
7023 @end smallexample
7024 or vice versa. Enabled by @option{-Wextra} along with
7025 @option{-fsized-deallocation}.
7026
7027 @item -Wsizeof-pointer-div
7028 @opindex Wsizeof-pointer-div
7029 @opindex Wno-sizeof-pointer-div
7030 Warn for suspicious divisions of two sizeof expressions that divide
7031 the pointer size by the element size, which is the usual way to compute
7032 the array size but won't work out correctly with pointers. This warning
7033 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7034 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7035
7036 @item -Wsizeof-pointer-memaccess
7037 @opindex Wsizeof-pointer-memaccess
7038 @opindex Wno-sizeof-pointer-memaccess
7039 Warn for suspicious length parameters to certain string and memory built-in
7040 functions if the argument uses @code{sizeof}. This warning triggers for
7041 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7042 an array, but a pointer, and suggests a possible fix, or about
7043 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7044 also warns about calls to bounded string copy functions like @code{strncat}
7045 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7046 the source array. For example, in the following function the call to
7047 @code{strncat} specifies the size of the source string as the bound. That
7048 is almost certainly a mistake and so the call is diagnosed.
7049 @smallexample
7050 void make_file (const char *name)
7051 @{
7052 char path[PATH_MAX];
7053 strncpy (path, name, sizeof path - 1);
7054 strncat (path, ".text", sizeof ".text");
7055 @dots{}
7056 @}
7057 @end smallexample
7058
7059 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7060
7061 @item -Wsizeof-array-argument
7062 @opindex Wsizeof-array-argument
7063 @opindex Wno-sizeof-array-argument
7064 Warn when the @code{sizeof} operator is applied to a parameter that is
7065 declared as an array in a function definition. This warning is enabled by
7066 default for C and C++ programs.
7067
7068 @item -Wmemset-elt-size
7069 @opindex Wmemset-elt-size
7070 @opindex Wno-memset-elt-size
7071 Warn for suspicious calls to the @code{memset} built-in function, if the
7072 first argument references an array, and the third argument is a number
7073 equal to the number of elements, but not equal to the size of the array
7074 in memory. This indicates that the user has omitted a multiplication by
7075 the element size. This warning is enabled by @option{-Wall}.
7076
7077 @item -Wmemset-transposed-args
7078 @opindex Wmemset-transposed-args
7079 @opindex Wno-memset-transposed-args
7080 Warn for suspicious calls to the @code{memset} built-in function where
7081 the second argument is not zero and the third argument is zero. For
7082 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7083 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7084 is only emitted if the third argument is a literal zero. Otherwise, if
7085 it is an expression that is folded to zero, or a cast of zero to some
7086 type, it is far less likely that the arguments have been mistakenly
7087 transposed and no warning is emitted. This warning is enabled
7088 by @option{-Wall}.
7089
7090 @item -Waddress
7091 @opindex Waddress
7092 @opindex Wno-address
7093 Warn about suspicious uses of memory addresses. These include using
7094 the address of a function in a conditional expression, such as
7095 @code{void func(void); if (func)}, and comparisons against the memory
7096 address of a string literal, such as @code{if (x == "abc")}. Such
7097 uses typically indicate a programmer error: the address of a function
7098 always evaluates to true, so their use in a conditional usually
7099 indicate that the programmer forgot the parentheses in a function
7100 call; and comparisons against string literals result in unspecified
7101 behavior and are not portable in C, so they usually indicate that the
7102 programmer intended to use @code{strcmp}. This warning is enabled by
7103 @option{-Wall}.
7104
7105 @item -Waddress-of-packed-member
7106 @opindex Waddress-of-packed-member
7107 @opindex Wno-address-of-packed-member
7108 Warn when the address of packed member of struct or union is taken,
7109 which usually results in an unaligned pointer value. This is
7110 enabled by default.
7111
7112 @item -Wlogical-op
7113 @opindex Wlogical-op
7114 @opindex Wno-logical-op
7115 Warn about suspicious uses of logical operators in expressions.
7116 This includes using logical operators in contexts where a
7117 bit-wise operator is likely to be expected. Also warns when
7118 the operands of a logical operator are the same:
7119 @smallexample
7120 extern int a;
7121 if (a < 0 && a < 0) @{ @dots{} @}
7122 @end smallexample
7123
7124 @item -Wlogical-not-parentheses
7125 @opindex Wlogical-not-parentheses
7126 @opindex Wno-logical-not-parentheses
7127 Warn about logical not used on the left hand side operand of a comparison.
7128 This option does not warn if the right operand is considered to be a boolean
7129 expression. Its purpose is to detect suspicious code like the following:
7130 @smallexample
7131 int a;
7132 @dots{}
7133 if (!a > 1) @{ @dots{} @}
7134 @end smallexample
7135
7136 It is possible to suppress the warning by wrapping the LHS into
7137 parentheses:
7138 @smallexample
7139 if ((!a) > 1) @{ @dots{} @}
7140 @end smallexample
7141
7142 This warning is enabled by @option{-Wall}.
7143
7144 @item -Waggregate-return
7145 @opindex Waggregate-return
7146 @opindex Wno-aggregate-return
7147 Warn if any functions that return structures or unions are defined or
7148 called. (In languages where you can return an array, this also elicits
7149 a warning.)
7150
7151 @item -Wno-aggressive-loop-optimizations
7152 @opindex Wno-aggressive-loop-optimizations
7153 @opindex Waggressive-loop-optimizations
7154 Warn if in a loop with constant number of iterations the compiler detects
7155 undefined behavior in some statement during one or more of the iterations.
7156
7157 @item -Wno-attributes
7158 @opindex Wno-attributes
7159 @opindex Wattributes
7160 Do not warn if an unexpected @code{__attribute__} is used, such as
7161 unrecognized attributes, function attributes applied to variables,
7162 etc. This does not stop errors for incorrect use of supported
7163 attributes.
7164
7165 @item -Wno-builtin-declaration-mismatch
7166 @opindex Wno-builtin-declaration-mismatch
7167 @opindex Wbuiltin-declaration-mismatch
7168 Warn if a built-in function is declared with an incompatible signature
7169 or as a non-function, or when a built-in function declared with a type
7170 that does not include a prototype is called with arguments whose promoted
7171 types do not match those expected by the function. When @option{-Wextra}
7172 is specified, also warn when a built-in function that takes arguments is
7173 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7174 warning is enabled by default. To avoid the warning include the appropriate
7175 header to bring the prototypes of built-in functions into scope.
7176
7177 For example, the call to @code{memset} below is diagnosed by the warning
7178 because the function expects a value of type @code{size_t} as its argument
7179 but the type of @code{32} is @code{int}. With @option{-Wextra},
7180 the declaration of the function is diagnosed as well.
7181 @smallexample
7182 extern void* memset ();
7183 void f (void *d)
7184 @{
7185 memset (d, '\0', 32);
7186 @}
7187 @end smallexample
7188
7189 @item -Wno-builtin-macro-redefined
7190 @opindex Wno-builtin-macro-redefined
7191 @opindex Wbuiltin-macro-redefined
7192 Do not warn if certain built-in macros are redefined. This suppresses
7193 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7194 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7195
7196 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7197 @opindex Wstrict-prototypes
7198 @opindex Wno-strict-prototypes
7199 Warn if a function is declared or defined without specifying the
7200 argument types. (An old-style function definition is permitted without
7201 a warning if preceded by a declaration that specifies the argument
7202 types.)
7203
7204 @item -Wold-style-declaration @r{(C and Objective-C only)}
7205 @opindex Wold-style-declaration
7206 @opindex Wno-old-style-declaration
7207 Warn for obsolescent usages, according to the C Standard, in a
7208 declaration. For example, warn if storage-class specifiers like
7209 @code{static} are not the first things in a declaration. This warning
7210 is also enabled by @option{-Wextra}.
7211
7212 @item -Wold-style-definition @r{(C and Objective-C only)}
7213 @opindex Wold-style-definition
7214 @opindex Wno-old-style-definition
7215 Warn if an old-style function definition is used. A warning is given
7216 even if there is a previous prototype.
7217
7218 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7219 @opindex Wmissing-parameter-type
7220 @opindex Wno-missing-parameter-type
7221 A function parameter is declared without a type specifier in K&R-style
7222 functions:
7223
7224 @smallexample
7225 void foo(bar) @{ @}
7226 @end smallexample
7227
7228 This warning is also enabled by @option{-Wextra}.
7229
7230 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7231 @opindex Wmissing-prototypes
7232 @opindex Wno-missing-prototypes
7233 Warn if a global function is defined without a previous prototype
7234 declaration. This warning is issued even if the definition itself
7235 provides a prototype. Use this option to detect global functions
7236 that do not have a matching prototype declaration in a header file.
7237 This option is not valid for C++ because all function declarations
7238 provide prototypes and a non-matching declaration declares an
7239 overload rather than conflict with an earlier declaration.
7240 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7241
7242 @item -Wmissing-declarations
7243 @opindex Wmissing-declarations
7244 @opindex Wno-missing-declarations
7245 Warn if a global function is defined without a previous declaration.
7246 Do so even if the definition itself provides a prototype.
7247 Use this option to detect global functions that are not declared in
7248 header files. In C, no warnings are issued for functions with previous
7249 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7250 missing prototypes. In C++, no warnings are issued for function templates,
7251 or for inline functions, or for functions in anonymous namespaces.
7252
7253 @item -Wmissing-field-initializers
7254 @opindex Wmissing-field-initializers
7255 @opindex Wno-missing-field-initializers
7256 @opindex W
7257 @opindex Wextra
7258 @opindex Wno-extra
7259 Warn if a structure's initializer has some fields missing. For
7260 example, the following code causes such a warning, because
7261 @code{x.h} is implicitly zero:
7262
7263 @smallexample
7264 struct s @{ int f, g, h; @};
7265 struct s x = @{ 3, 4 @};
7266 @end smallexample
7267
7268 This option does not warn about designated initializers, so the following
7269 modification does not trigger a warning:
7270
7271 @smallexample
7272 struct s @{ int f, g, h; @};
7273 struct s x = @{ .f = 3, .g = 4 @};
7274 @end smallexample
7275
7276 In C this option does not warn about the universal zero initializer
7277 @samp{@{ 0 @}}:
7278
7279 @smallexample
7280 struct s @{ int f, g, h; @};
7281 struct s x = @{ 0 @};
7282 @end smallexample
7283
7284 Likewise, in C++ this option does not warn about the empty @{ @}
7285 initializer, for example:
7286
7287 @smallexample
7288 struct s @{ int f, g, h; @};
7289 s x = @{ @};
7290 @end smallexample
7291
7292 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7293 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7294
7295 @item -Wno-multichar
7296 @opindex Wno-multichar
7297 @opindex Wmultichar
7298 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7299 Usually they indicate a typo in the user's code, as they have
7300 implementation-defined values, and should not be used in portable code.
7301
7302 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7303 @opindex Wnormalized=
7304 @opindex Wnormalized
7305 @opindex Wno-normalized
7306 @cindex NFC
7307 @cindex NFKC
7308 @cindex character set, input normalization
7309 In ISO C and ISO C++, two identifiers are different if they are
7310 different sequences of characters. However, sometimes when characters
7311 outside the basic ASCII character set are used, you can have two
7312 different character sequences that look the same. To avoid confusion,
7313 the ISO 10646 standard sets out some @dfn{normalization rules} which
7314 when applied ensure that two sequences that look the same are turned into
7315 the same sequence. GCC can warn you if you are using identifiers that
7316 have not been normalized; this option controls that warning.
7317
7318 There are four levels of warning supported by GCC@. The default is
7319 @option{-Wnormalized=nfc}, which warns about any identifier that is
7320 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7321 recommended form for most uses. It is equivalent to
7322 @option{-Wnormalized}.
7323
7324 Unfortunately, there are some characters allowed in identifiers by
7325 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7326 identifiers. That is, there's no way to use these symbols in portable
7327 ISO C or C++ and have all your identifiers in NFC@.
7328 @option{-Wnormalized=id} suppresses the warning for these characters.
7329 It is hoped that future versions of the standards involved will correct
7330 this, which is why this option is not the default.
7331
7332 You can switch the warning off for all characters by writing
7333 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7334 only do this if you are using some other normalization scheme (like
7335 ``D''), because otherwise you can easily create bugs that are
7336 literally impossible to see.
7337
7338 Some characters in ISO 10646 have distinct meanings but look identical
7339 in some fonts or display methodologies, especially once formatting has
7340 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7341 LETTER N'', displays just like a regular @code{n} that has been
7342 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7343 normalization scheme to convert all these into a standard form as
7344 well, and GCC warns if your code is not in NFKC if you use
7345 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7346 about every identifier that contains the letter O because it might be
7347 confused with the digit 0, and so is not the default, but may be
7348 useful as a local coding convention if the programming environment
7349 cannot be fixed to display these characters distinctly.
7350
7351 @item -Wno-attribute-warning
7352 @opindex Wno-attribute-warning
7353 @opindex Wattribute-warning
7354 Do not warn about usage of functions (@pxref{Function Attributes})
7355 declared with @code{warning} attribute. By default, this warning is
7356 enabled. @option{-Wno-attribute-warning} can be used to disable the
7357 warning or @option{-Wno-error=attribute-warning} can be used to
7358 disable the error when compiled with @option{-Werror} flag.
7359
7360 @item -Wno-deprecated
7361 @opindex Wno-deprecated
7362 @opindex Wdeprecated
7363 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7364
7365 @item -Wno-deprecated-declarations
7366 @opindex Wno-deprecated-declarations
7367 @opindex Wdeprecated-declarations
7368 Do not warn about uses of functions (@pxref{Function Attributes}),
7369 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7370 Attributes}) marked as deprecated by using the @code{deprecated}
7371 attribute.
7372
7373 @item -Wno-overflow
7374 @opindex Wno-overflow
7375 @opindex Woverflow
7376 Do not warn about compile-time overflow in constant expressions.
7377
7378 @item -Wno-odr
7379 @opindex Wno-odr
7380 @opindex Wodr
7381 Warn about One Definition Rule violations during link-time optimization.
7382 Enabled by default.
7383
7384 @item -Wopenmp-simd
7385 @opindex Wopenmp-simd
7386 @opindex Wno-openmp-simd
7387 Warn if the vectorizer cost model overrides the OpenMP
7388 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7389 option can be used to relax the cost model.
7390
7391 @item -Woverride-init @r{(C and Objective-C only)}
7392 @opindex Woverride-init
7393 @opindex Wno-override-init
7394 @opindex W
7395 @opindex Wextra
7396 @opindex Wno-extra
7397 Warn if an initialized field without side effects is overridden when
7398 using designated initializers (@pxref{Designated Inits, , Designated
7399 Initializers}).
7400
7401 This warning is included in @option{-Wextra}. To get other
7402 @option{-Wextra} warnings without this one, use @option{-Wextra
7403 -Wno-override-init}.
7404
7405 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7406 @opindex Woverride-init-side-effects
7407 @opindex Wno-override-init-side-effects
7408 Warn if an initialized field with side effects is overridden when
7409 using designated initializers (@pxref{Designated Inits, , Designated
7410 Initializers}). This warning is enabled by default.
7411
7412 @item -Wpacked
7413 @opindex Wpacked
7414 @opindex Wno-packed
7415 Warn if a structure is given the packed attribute, but the packed
7416 attribute has no effect on the layout or size of the structure.
7417 Such structures may be mis-aligned for little benefit. For
7418 instance, in this code, the variable @code{f.x} in @code{struct bar}
7419 is misaligned even though @code{struct bar} does not itself
7420 have the packed attribute:
7421
7422 @smallexample
7423 @group
7424 struct foo @{
7425 int x;
7426 char a, b, c, d;
7427 @} __attribute__((packed));
7428 struct bar @{
7429 char z;
7430 struct foo f;
7431 @};
7432 @end group
7433 @end smallexample
7434
7435 @item -Wpacked-bitfield-compat
7436 @opindex Wpacked-bitfield-compat
7437 @opindex Wno-packed-bitfield-compat
7438 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7439 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7440 the change can lead to differences in the structure layout. GCC
7441 informs you when the offset of such a field has changed in GCC 4.4.
7442 For example there is no longer a 4-bit padding between field @code{a}
7443 and @code{b} in this structure:
7444
7445 @smallexample
7446 struct foo
7447 @{
7448 char a:4;
7449 char b:8;
7450 @} __attribute__ ((packed));
7451 @end smallexample
7452
7453 This warning is enabled by default. Use
7454 @option{-Wno-packed-bitfield-compat} to disable this warning.
7455
7456 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7457 @opindex Wpacked-not-aligned
7458 @opindex Wno-packed-not-aligned
7459 Warn if a structure field with explicitly specified alignment in a
7460 packed struct or union is misaligned. For example, a warning will
7461 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7462 'struct S' is less than 8}, in this code:
7463
7464 @smallexample
7465 @group
7466 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7467 struct __attribute__ ((packed)) S @{
7468 struct S8 s8;
7469 @};
7470 @end group
7471 @end smallexample
7472
7473 This warning is enabled by @option{-Wall}.
7474
7475 @item -Wpadded
7476 @opindex Wpadded
7477 @opindex Wno-padded
7478 Warn if padding is included in a structure, either to align an element
7479 of the structure or to align the whole structure. Sometimes when this
7480 happens it is possible to rearrange the fields of the structure to
7481 reduce the padding and so make the structure smaller.
7482
7483 @item -Wredundant-decls
7484 @opindex Wredundant-decls
7485 @opindex Wno-redundant-decls
7486 Warn if anything is declared more than once in the same scope, even in
7487 cases where multiple declaration is valid and changes nothing.
7488
7489 @item -Wno-restrict
7490 @opindex Wrestrict
7491 @opindex Wno-restrict
7492 Warn when an object referenced by a @code{restrict}-qualified parameter
7493 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7494 argument, or when copies between such objects overlap. For example,
7495 the call to the @code{strcpy} function below attempts to truncate the string
7496 by replacing its initial characters with the last four. However, because
7497 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7498 the call is diagnosed.
7499
7500 @smallexample
7501 void foo (void)
7502 @{
7503 char a[] = "abcd1234";
7504 strcpy (a, a + 4);
7505 @dots{}
7506 @}
7507 @end smallexample
7508 The @option{-Wrestrict} option detects some instances of simple overlap
7509 even without optimization but works best at @option{-O2} and above. It
7510 is included in @option{-Wall}.
7511
7512 @item -Wnested-externs @r{(C and Objective-C only)}
7513 @opindex Wnested-externs
7514 @opindex Wno-nested-externs
7515 Warn if an @code{extern} declaration is encountered within a function.
7516
7517 @item -Wno-inherited-variadic-ctor
7518 @opindex Winherited-variadic-ctor
7519 @opindex Wno-inherited-variadic-ctor
7520 Suppress warnings about use of C++11 inheriting constructors when the
7521 base class inherited from has a C variadic constructor; the warning is
7522 on by default because the ellipsis is not inherited.
7523
7524 @item -Winline
7525 @opindex Winline
7526 @opindex Wno-inline
7527 Warn if a function that is declared as inline cannot be inlined.
7528 Even with this option, the compiler does not warn about failures to
7529 inline functions declared in system headers.
7530
7531 The compiler uses a variety of heuristics to determine whether or not
7532 to inline a function. For example, the compiler takes into account
7533 the size of the function being inlined and the amount of inlining
7534 that has already been done in the current function. Therefore,
7535 seemingly insignificant changes in the source program can cause the
7536 warnings produced by @option{-Winline} to appear or disappear.
7537
7538 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7539 @opindex Wno-invalid-offsetof
7540 @opindex Winvalid-offsetof
7541 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7542 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7543 to a non-standard-layout type is undefined. In existing C++ implementations,
7544 however, @code{offsetof} typically gives meaningful results.
7545 This flag is for users who are aware that they are
7546 writing nonportable code and who have deliberately chosen to ignore the
7547 warning about it.
7548
7549 The restrictions on @code{offsetof} may be relaxed in a future version
7550 of the C++ standard.
7551
7552 @item -Wint-in-bool-context
7553 @opindex Wint-in-bool-context
7554 @opindex Wno-int-in-bool-context
7555 Warn for suspicious use of integer values where boolean values are expected,
7556 such as conditional expressions (?:) using non-boolean integer constants in
7557 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7558 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7559 for all kinds of multiplications regardless of the data type.
7560 This warning is enabled by @option{-Wall}.
7561
7562 @item -Wno-int-to-pointer-cast
7563 @opindex Wno-int-to-pointer-cast
7564 @opindex Wint-to-pointer-cast
7565 Suppress warnings from casts to pointer type of an integer of a
7566 different size. In C++, casting to a pointer type of smaller size is
7567 an error. @option{Wint-to-pointer-cast} is enabled by default.
7568
7569
7570 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7571 @opindex Wno-pointer-to-int-cast
7572 @opindex Wpointer-to-int-cast
7573 Suppress warnings from casts from a pointer to an integer type of a
7574 different size.
7575
7576 @item -Winvalid-pch
7577 @opindex Winvalid-pch
7578 @opindex Wno-invalid-pch
7579 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7580 the search path but cannot be used.
7581
7582 @item -Wlong-long
7583 @opindex Wlong-long
7584 @opindex Wno-long-long
7585 Warn if @code{long long} type is used. This is enabled by either
7586 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7587 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7588
7589 @item -Wvariadic-macros
7590 @opindex Wvariadic-macros
7591 @opindex Wno-variadic-macros
7592 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7593 alternate syntax is used in ISO C99 mode. This is enabled by either
7594 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7595 messages, use @option{-Wno-variadic-macros}.
7596
7597 @item -Wvarargs
7598 @opindex Wvarargs
7599 @opindex Wno-varargs
7600 Warn upon questionable usage of the macros used to handle variable
7601 arguments like @code{va_start}. This is default. To inhibit the
7602 warning messages, use @option{-Wno-varargs}.
7603
7604 @item -Wvector-operation-performance
7605 @opindex Wvector-operation-performance
7606 @opindex Wno-vector-operation-performance
7607 Warn if vector operation is not implemented via SIMD capabilities of the
7608 architecture. Mainly useful for the performance tuning.
7609 Vector operation can be implemented @code{piecewise}, which means that the
7610 scalar operation is performed on every vector element;
7611 @code{in parallel}, which means that the vector operation is implemented
7612 using scalars of wider type, which normally is more performance efficient;
7613 and @code{as a single scalar}, which means that vector fits into a
7614 scalar type.
7615
7616 @item -Wno-virtual-move-assign
7617 @opindex Wvirtual-move-assign
7618 @opindex Wno-virtual-move-assign
7619 Suppress warnings about inheriting from a virtual base with a
7620 non-trivial C++11 move assignment operator. This is dangerous because
7621 if the virtual base is reachable along more than one path, it is
7622 moved multiple times, which can mean both objects end up in the
7623 moved-from state. If the move assignment operator is written to avoid
7624 moving from a moved-from object, this warning can be disabled.
7625
7626 @item -Wvla
7627 @opindex Wvla
7628 @opindex Wno-vla
7629 Warn if a variable-length array is used in the code.
7630 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7631 the variable-length array.
7632
7633 @item -Wvla-larger-than=@var{byte-size}
7634 @opindex Wvla-larger-than=
7635 @opindex Wno-vla-larger-than
7636 If this option is used, the compiler will warn for declarations of
7637 variable-length arrays whose size is either unbounded, or bounded
7638 by an argument that allows the array size to exceed @var{byte-size}
7639 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7640 works, but with variable-length arrays.
7641
7642 Note that GCC may optimize small variable-length arrays of a known
7643 value into plain arrays, so this warning may not get triggered for
7644 such arrays.
7645
7646 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7647 is typically only effective when @option{-ftree-vrp} is active (default
7648 for @option{-O2} and above).
7649
7650 See also @option{-Walloca-larger-than=@var{byte-size}}.
7651
7652 @item -Wno-vla-larger-than
7653 @opindex Wno-vla-larger-than
7654 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7655 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7656
7657 @item -Wvolatile-register-var
7658 @opindex Wvolatile-register-var
7659 @opindex Wno-volatile-register-var
7660 Warn if a register variable is declared volatile. The volatile
7661 modifier does not inhibit all optimizations that may eliminate reads
7662 and/or writes to register variables. This warning is enabled by
7663 @option{-Wall}.
7664
7665 @item -Wdisabled-optimization
7666 @opindex Wdisabled-optimization
7667 @opindex Wno-disabled-optimization
7668 Warn if a requested optimization pass is disabled. This warning does
7669 not generally indicate that there is anything wrong with your code; it
7670 merely indicates that GCC's optimizers are unable to handle the code
7671 effectively. Often, the problem is that your code is too big or too
7672 complex; GCC refuses to optimize programs when the optimization
7673 itself is likely to take inordinate amounts of time.
7674
7675 @item -Wpointer-sign @r{(C and Objective-C only)}
7676 @opindex Wpointer-sign
7677 @opindex Wno-pointer-sign
7678 Warn for pointer argument passing or assignment with different signedness.
7679 This option is only supported for C and Objective-C@. It is implied by
7680 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7681 @option{-Wno-pointer-sign}.
7682
7683 @item -Wstack-protector
7684 @opindex Wstack-protector
7685 @opindex Wno-stack-protector
7686 This option is only active when @option{-fstack-protector} is active. It
7687 warns about functions that are not protected against stack smashing.
7688
7689 @item -Woverlength-strings
7690 @opindex Woverlength-strings
7691 @opindex Wno-overlength-strings
7692 Warn about string constants that are longer than the ``minimum
7693 maximum'' length specified in the C standard. Modern compilers
7694 generally allow string constants that are much longer than the
7695 standard's minimum limit, but very portable programs should avoid
7696 using longer strings.
7697
7698 The limit applies @emph{after} string constant concatenation, and does
7699 not count the trailing NUL@. In C90, the limit was 509 characters; in
7700 C99, it was raised to 4095. C++98 does not specify a normative
7701 minimum maximum, so we do not diagnose overlength strings in C++@.
7702
7703 This option is implied by @option{-Wpedantic}, and can be disabled with
7704 @option{-Wno-overlength-strings}.
7705
7706 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7707 @opindex Wunsuffixed-float-constants
7708 @opindex Wno-unsuffixed-float-constants
7709
7710 Issue a warning for any floating constant that does not have
7711 a suffix. When used together with @option{-Wsystem-headers} it
7712 warns about such constants in system header files. This can be useful
7713 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7714 from the decimal floating-point extension to C99.
7715
7716 @item -Wno-designated-init @r{(C and Objective-C only)}
7717 Suppress warnings when a positional initializer is used to initialize
7718 a structure that has been marked with the @code{designated_init}
7719 attribute.
7720
7721 @item -Whsa
7722 Issue a warning when HSAIL cannot be emitted for the compiled function or
7723 OpenMP construct.
7724
7725 @end table
7726
7727 @node Debugging Options
7728 @section Options for Debugging Your Program
7729 @cindex options, debugging
7730 @cindex debugging information options
7731
7732 To tell GCC to emit extra information for use by a debugger, in almost
7733 all cases you need only to add @option{-g} to your other options.
7734
7735 GCC allows you to use @option{-g} with
7736 @option{-O}. The shortcuts taken by optimized code may occasionally
7737 be surprising: some variables you declared may not exist
7738 at all; flow of control may briefly move where you did not expect it;
7739 some statements may not be executed because they compute constant
7740 results or their values are already at hand; some statements may
7741 execute in different places because they have been moved out of loops.
7742 Nevertheless it is possible to debug optimized output. This makes
7743 it reasonable to use the optimizer for programs that might have bugs.
7744
7745 If you are not using some other optimization option, consider
7746 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7747 With no @option{-O} option at all, some compiler passes that collect
7748 information useful for debugging do not run at all, so that
7749 @option{-Og} may result in a better debugging experience.
7750
7751 @table @gcctabopt
7752 @item -g
7753 @opindex g
7754 Produce debugging information in the operating system's native format
7755 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7756 information.
7757
7758 On most systems that use stabs format, @option{-g} enables use of extra
7759 debugging information that only GDB can use; this extra information
7760 makes debugging work better in GDB but probably makes other debuggers
7761 crash or
7762 refuse to read the program. If you want to control for certain whether
7763 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7764 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7765
7766 @item -ggdb
7767 @opindex ggdb
7768 Produce debugging information for use by GDB@. This means to use the
7769 most expressive format available (DWARF, stabs, or the native format
7770 if neither of those are supported), including GDB extensions if at all
7771 possible.
7772
7773 @item -gdwarf
7774 @itemx -gdwarf-@var{version}
7775 @opindex gdwarf
7776 Produce debugging information in DWARF format (if that is supported).
7777 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7778 for most targets is 4. DWARF Version 5 is only experimental.
7779
7780 Note that with DWARF Version 2, some ports require and always
7781 use some non-conflicting DWARF 3 extensions in the unwind tables.
7782
7783 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7784 for maximum benefit.
7785
7786 GCC no longer supports DWARF Version 1, which is substantially
7787 different than Version 2 and later. For historical reasons, some
7788 other DWARF-related options such as
7789 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7790 in their names, but apply to all currently-supported versions of DWARF.
7791
7792 @item -gstabs
7793 @opindex gstabs
7794 Produce debugging information in stabs format (if that is supported),
7795 without GDB extensions. This is the format used by DBX on most BSD
7796 systems. On MIPS, Alpha and System V Release 4 systems this option
7797 produces stabs debugging output that is not understood by DBX@.
7798 On System V Release 4 systems this option requires the GNU assembler.
7799
7800 @item -gstabs+
7801 @opindex gstabs+
7802 Produce debugging information in stabs format (if that is supported),
7803 using GNU extensions understood only by the GNU debugger (GDB)@. The
7804 use of these extensions is likely to make other debuggers crash or
7805 refuse to read the program.
7806
7807 @item -gxcoff
7808 @opindex gxcoff
7809 Produce debugging information in XCOFF format (if that is supported).
7810 This is the format used by the DBX debugger on IBM RS/6000 systems.
7811
7812 @item -gxcoff+
7813 @opindex gxcoff+
7814 Produce debugging information in XCOFF format (if that is supported),
7815 using GNU extensions understood only by the GNU debugger (GDB)@. The
7816 use of these extensions is likely to make other debuggers crash or
7817 refuse to read the program, and may cause assemblers other than the GNU
7818 assembler (GAS) to fail with an error.
7819
7820 @item -gvms
7821 @opindex gvms
7822 Produce debugging information in Alpha/VMS debug format (if that is
7823 supported). This is the format used by DEBUG on Alpha/VMS systems.
7824
7825 @item -g@var{level}
7826 @itemx -ggdb@var{level}
7827 @itemx -gstabs@var{level}
7828 @itemx -gxcoff@var{level}
7829 @itemx -gvms@var{level}
7830 Request debugging information and also use @var{level} to specify how
7831 much information. The default level is 2.
7832
7833 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7834 @option{-g}.
7835
7836 Level 1 produces minimal information, enough for making backtraces in
7837 parts of the program that you don't plan to debug. This includes
7838 descriptions of functions and external variables, and line number
7839 tables, but no information about local variables.
7840
7841 Level 3 includes extra information, such as all the macro definitions
7842 present in the program. Some debuggers support macro expansion when
7843 you use @option{-g3}.
7844
7845 If you use multiple @option{-g} options, with or without level numbers,
7846 the last such option is the one that is effective.
7847
7848 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7849 confusion with @option{-gdwarf-@var{level}}.
7850 Instead use an additional @option{-g@var{level}} option to change the
7851 debug level for DWARF.
7852
7853 @item -fno-eliminate-unused-debug-symbols
7854 @opindex feliminate-unused-debug-symbols
7855 @opindex fno-eliminate-unused-debug-symbols
7856 By default, no debug information is produced for symbols that are not actually
7857 used. Use this option if you want debug information for all symbols.
7858
7859 @item -femit-class-debug-always
7860 @opindex femit-class-debug-always
7861 Instead of emitting debugging information for a C++ class in only one
7862 object file, emit it in all object files using the class. This option
7863 should be used only with debuggers that are unable to handle the way GCC
7864 normally emits debugging information for classes because using this
7865 option increases the size of debugging information by as much as a
7866 factor of two.
7867
7868 @item -fno-merge-debug-strings
7869 @opindex fmerge-debug-strings
7870 @opindex fno-merge-debug-strings
7871 Direct the linker to not merge together strings in the debugging
7872 information that are identical in different object files. Merging is
7873 not supported by all assemblers or linkers. Merging decreases the size
7874 of the debug information in the output file at the cost of increasing
7875 link processing time. Merging is enabled by default.
7876
7877 @item -fdebug-prefix-map=@var{old}=@var{new}
7878 @opindex fdebug-prefix-map
7879 When compiling files residing in directory @file{@var{old}}, record
7880 debugging information describing them as if the files resided in
7881 directory @file{@var{new}} instead. This can be used to replace a
7882 build-time path with an install-time path in the debug info. It can
7883 also be used to change an absolute path to a relative path by using
7884 @file{.} for @var{new}. This can give more reproducible builds, which
7885 are location independent, but may require an extra command to tell GDB
7886 where to find the source files. See also @option{-ffile-prefix-map}.
7887
7888 @item -fvar-tracking
7889 @opindex fvar-tracking
7890 Run variable tracking pass. It computes where variables are stored at each
7891 position in code. Better debugging information is then generated
7892 (if the debugging information format supports this information).
7893
7894 It is enabled by default when compiling with optimization (@option{-Os},
7895 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7896 the debug info format supports it.
7897
7898 @item -fvar-tracking-assignments
7899 @opindex fvar-tracking-assignments
7900 @opindex fno-var-tracking-assignments
7901 Annotate assignments to user variables early in the compilation and
7902 attempt to carry the annotations over throughout the compilation all the
7903 way to the end, in an attempt to improve debug information while
7904 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7905
7906 It can be enabled even if var-tracking is disabled, in which case
7907 annotations are created and maintained, but discarded at the end.
7908 By default, this flag is enabled together with @option{-fvar-tracking},
7909 except when selective scheduling is enabled.
7910
7911 @item -gsplit-dwarf
7912 @opindex gsplit-dwarf
7913 Separate as much DWARF debugging information as possible into a
7914 separate output file with the extension @file{.dwo}. This option allows
7915 the build system to avoid linking files with debug information. To
7916 be useful, this option requires a debugger capable of reading @file{.dwo}
7917 files.
7918
7919 @item -gdescribe-dies
7920 @opindex gdescribe-dies
7921 Add description attributes to some DWARF DIEs that have no name attribute,
7922 such as artificial variables, external references and call site
7923 parameter DIEs.
7924
7925 @item -gpubnames
7926 @opindex gpubnames
7927 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7928
7929 @item -ggnu-pubnames
7930 @opindex ggnu-pubnames
7931 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7932 suitable for conversion into a GDB@ index. This option is only useful
7933 with a linker that can produce GDB@ index version 7.
7934
7935 @item -fdebug-types-section
7936 @opindex fdebug-types-section
7937 @opindex fno-debug-types-section
7938 When using DWARF Version 4 or higher, type DIEs can be put into
7939 their own @code{.debug_types} section instead of making them part of the
7940 @code{.debug_info} section. It is more efficient to put them in a separate
7941 comdat section since the linker can then remove duplicates.
7942 But not all DWARF consumers support @code{.debug_types} sections yet
7943 and on some objects @code{.debug_types} produces larger instead of smaller
7944 debugging information.
7945
7946 @item -grecord-gcc-switches
7947 @itemx -gno-record-gcc-switches
7948 @opindex grecord-gcc-switches
7949 @opindex gno-record-gcc-switches
7950 This switch causes the command-line options used to invoke the
7951 compiler that may affect code generation to be appended to the
7952 DW_AT_producer attribute in DWARF debugging information. The options
7953 are concatenated with spaces separating them from each other and from
7954 the compiler version.
7955 It is enabled by default.
7956 See also @option{-frecord-gcc-switches} for another
7957 way of storing compiler options into the object file.
7958
7959 @item -gstrict-dwarf
7960 @opindex gstrict-dwarf
7961 Disallow using extensions of later DWARF standard version than selected
7962 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7963 DWARF extensions from later standard versions is allowed.
7964
7965 @item -gno-strict-dwarf
7966 @opindex gno-strict-dwarf
7967 Allow using extensions of later DWARF standard version than selected with
7968 @option{-gdwarf-@var{version}}.
7969
7970 @item -gas-loc-support
7971 @opindex gas-loc-support
7972 Inform the compiler that the assembler supports @code{.loc} directives.
7973 It may then use them for the assembler to generate DWARF2+ line number
7974 tables.
7975
7976 This is generally desirable, because assembler-generated line-number
7977 tables are a lot more compact than those the compiler can generate
7978 itself.
7979
7980 This option will be enabled by default if, at GCC configure time, the
7981 assembler was found to support such directives.
7982
7983 @item -gno-as-loc-support
7984 @opindex gno-as-loc-support
7985 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7986 line number tables are to be generated.
7987
7988 @item -gas-locview-support
7989 @opindex gas-locview-support
7990 Inform the compiler that the assembler supports @code{view} assignment
7991 and reset assertion checking in @code{.loc} directives.
7992
7993 This option will be enabled by default if, at GCC configure time, the
7994 assembler was found to support them.
7995
7996 @item -gno-as-locview-support
7997 Force GCC to assign view numbers internally, if
7998 @option{-gvariable-location-views} are explicitly requested.
7999
8000 @item -gcolumn-info
8001 @itemx -gno-column-info
8002 @opindex gcolumn-info
8003 @opindex gno-column-info
8004 Emit location column information into DWARF debugging information, rather
8005 than just file and line.
8006 This option is enabled by default.
8007
8008 @item -gstatement-frontiers
8009 @itemx -gno-statement-frontiers
8010 @opindex gstatement-frontiers
8011 @opindex gno-statement-frontiers
8012 This option causes GCC to create markers in the internal representation
8013 at the beginning of statements, and to keep them roughly in place
8014 throughout compilation, using them to guide the output of @code{is_stmt}
8015 markers in the line number table. This is enabled by default when
8016 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8017 @dots{}), and outputting DWARF 2 debug information at the normal level.
8018
8019 @item -gvariable-location-views
8020 @itemx -gvariable-location-views=incompat5
8021 @itemx -gno-variable-location-views
8022 @opindex gvariable-location-views
8023 @opindex gvariable-location-views=incompat5
8024 @opindex gno-variable-location-views
8025 Augment variable location lists with progressive view numbers implied
8026 from the line number table. This enables debug information consumers to
8027 inspect state at certain points of the program, even if no instructions
8028 associated with the corresponding source locations are present at that
8029 point. If the assembler lacks support for view numbers in line number
8030 tables, this will cause the compiler to emit the line number table,
8031 which generally makes them somewhat less compact. The augmented line
8032 number tables and location lists are fully backward-compatible, so they
8033 can be consumed by debug information consumers that are not aware of
8034 these augmentations, but they won't derive any benefit from them either.
8035
8036 This is enabled by default when outputting DWARF 2 debug information at
8037 the normal level, as long as there is assembler support,
8038 @option{-fvar-tracking-assignments} is enabled and
8039 @option{-gstrict-dwarf} is not. When assembler support is not
8040 available, this may still be enabled, but it will force GCC to output
8041 internal line number tables, and if
8042 @option{-ginternal-reset-location-views} is not enabled, that will most
8043 certainly lead to silently mismatching location views.
8044
8045 There is a proposed representation for view numbers that is not backward
8046 compatible with the location list format introduced in DWARF 5, that can
8047 be enabled with @option{-gvariable-location-views=incompat5}. This
8048 option may be removed in the future, is only provided as a reference
8049 implementation of the proposed representation. Debug information
8050 consumers are not expected to support this extended format, and they
8051 would be rendered unable to decode location lists using it.
8052
8053 @item -ginternal-reset-location-views
8054 @itemx -gnointernal-reset-location-views
8055 @opindex ginternal-reset-location-views
8056 @opindex gno-internal-reset-location-views
8057 Attempt to determine location views that can be omitted from location
8058 view lists. This requires the compiler to have very accurate insn
8059 length estimates, which isn't always the case, and it may cause
8060 incorrect view lists to be generated silently when using an assembler
8061 that does not support location view lists. The GNU assembler will flag
8062 any such error as a @code{view number mismatch}. This is only enabled
8063 on ports that define a reliable estimation function.
8064
8065 @item -ginline-points
8066 @itemx -gno-inline-points
8067 @opindex ginline-points
8068 @opindex gno-inline-points
8069 Generate extended debug information for inlined functions. Location
8070 view tracking markers are inserted at inlined entry points, so that
8071 address and view numbers can be computed and output in debug
8072 information. This can be enabled independently of location views, in
8073 which case the view numbers won't be output, but it can only be enabled
8074 along with statement frontiers, and it is only enabled by default if
8075 location views are enabled.
8076
8077 @item -gz@r{[}=@var{type}@r{]}
8078 @opindex gz
8079 Produce compressed debug sections in DWARF format, if that is supported.
8080 If @var{type} is not given, the default type depends on the capabilities
8081 of the assembler and linker used. @var{type} may be one of
8082 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8083 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8084 compression in traditional GNU format). If the linker doesn't support
8085 writing compressed debug sections, the option is rejected. Otherwise,
8086 if the assembler does not support them, @option{-gz} is silently ignored
8087 when producing object files.
8088
8089 @item -femit-struct-debug-baseonly
8090 @opindex femit-struct-debug-baseonly
8091 Emit debug information for struct-like types
8092 only when the base name of the compilation source file
8093 matches the base name of file in which the struct is defined.
8094
8095 This option substantially reduces the size of debugging information,
8096 but at significant potential loss in type information to the debugger.
8097 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8098 See @option{-femit-struct-debug-detailed} for more detailed control.
8099
8100 This option works only with DWARF debug output.
8101
8102 @item -femit-struct-debug-reduced
8103 @opindex femit-struct-debug-reduced
8104 Emit debug information for struct-like types
8105 only when the base name of the compilation source file
8106 matches the base name of file in which the type is defined,
8107 unless the struct is a template or defined in a system header.
8108
8109 This option significantly reduces the size of debugging information,
8110 with some potential loss in type information to the debugger.
8111 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8112 See @option{-femit-struct-debug-detailed} for more detailed control.
8113
8114 This option works only with DWARF debug output.
8115
8116 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8117 @opindex femit-struct-debug-detailed
8118 Specify the struct-like types
8119 for which the compiler generates debug information.
8120 The intent is to reduce duplicate struct debug information
8121 between different object files within the same program.
8122
8123 This option is a detailed version of
8124 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8125 which serves for most needs.
8126
8127 A specification has the syntax@*
8128 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8129
8130 The optional first word limits the specification to
8131 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8132 A struct type is used directly when it is the type of a variable, member.
8133 Indirect uses arise through pointers to structs.
8134 That is, when use of an incomplete struct is valid, the use is indirect.
8135 An example is
8136 @samp{struct one direct; struct two * indirect;}.
8137
8138 The optional second word limits the specification to
8139 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8140 Generic structs are a bit complicated to explain.
8141 For C++, these are non-explicit specializations of template classes,
8142 or non-template classes within the above.
8143 Other programming languages have generics,
8144 but @option{-femit-struct-debug-detailed} does not yet implement them.
8145
8146 The third word specifies the source files for those
8147 structs for which the compiler should emit debug information.
8148 The values @samp{none} and @samp{any} have the normal meaning.
8149 The value @samp{base} means that
8150 the base of name of the file in which the type declaration appears
8151 must match the base of the name of the main compilation file.
8152 In practice, this means that when compiling @file{foo.c}, debug information
8153 is generated for types declared in that file and @file{foo.h},
8154 but not other header files.
8155 The value @samp{sys} means those types satisfying @samp{base}
8156 or declared in system or compiler headers.
8157
8158 You may need to experiment to determine the best settings for your application.
8159
8160 The default is @option{-femit-struct-debug-detailed=all}.
8161
8162 This option works only with DWARF debug output.
8163
8164 @item -fno-dwarf2-cfi-asm
8165 @opindex fdwarf2-cfi-asm
8166 @opindex fno-dwarf2-cfi-asm
8167 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8168 instead of using GAS @code{.cfi_*} directives.
8169
8170 @item -fno-eliminate-unused-debug-types
8171 @opindex feliminate-unused-debug-types
8172 @opindex fno-eliminate-unused-debug-types
8173 Normally, when producing DWARF output, GCC avoids producing debug symbol
8174 output for types that are nowhere used in the source file being compiled.
8175 Sometimes it is useful to have GCC emit debugging
8176 information for all types declared in a compilation
8177 unit, regardless of whether or not they are actually used
8178 in that compilation unit, for example
8179 if, in the debugger, you want to cast a value to a type that is
8180 not actually used in your program (but is declared). More often,
8181 however, this results in a significant amount of wasted space.
8182 @end table
8183
8184 @node Optimize Options
8185 @section Options That Control Optimization
8186 @cindex optimize options
8187 @cindex options, optimization
8188
8189 These options control various sorts of optimizations.
8190
8191 Without any optimization option, the compiler's goal is to reduce the
8192 cost of compilation and to make debugging produce the expected
8193 results. Statements are independent: if you stop the program with a
8194 breakpoint between statements, you can then assign a new value to any
8195 variable or change the program counter to any other statement in the
8196 function and get exactly the results you expect from the source
8197 code.
8198
8199 Turning on optimization flags makes the compiler attempt to improve
8200 the performance and/or code size at the expense of compilation time
8201 and possibly the ability to debug the program.
8202
8203 The compiler performs optimization based on the knowledge it has of the
8204 program. Compiling multiple files at once to a single output file mode allows
8205 the compiler to use information gained from all of the files when compiling
8206 each of them.
8207
8208 Not all optimizations are controlled directly by a flag. Only
8209 optimizations that have a flag are listed in this section.
8210
8211 Most optimizations are completely disabled at @option{-O0} or if an
8212 @option{-O} level is not set on the command line, even if individual
8213 optimization flags are specified. Similarly, @option{-Og} suppresses
8214 many optimization passes.
8215
8216 Depending on the target and how GCC was configured, a slightly different
8217 set of optimizations may be enabled at each @option{-O} level than
8218 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8219 to find out the exact set of optimizations that are enabled at each level.
8220 @xref{Overall Options}, for examples.
8221
8222 @table @gcctabopt
8223 @item -O
8224 @itemx -O1
8225 @opindex O
8226 @opindex O1
8227 Optimize. Optimizing compilation takes somewhat more time, and a lot
8228 more memory for a large function.
8229
8230 With @option{-O}, the compiler tries to reduce code size and execution
8231 time, without performing any optimizations that take a great deal of
8232 compilation time.
8233
8234 @c Note that in addition to the default_options_table list in opts.c,
8235 @c several optimization flags default to true but control optimization
8236 @c passes that are explicitly disabled at -O0.
8237
8238 @option{-O} turns on the following optimization flags:
8239
8240 @c Please keep the following list alphabetized.
8241 @gccoptlist{-fauto-inc-dec @gol
8242 -fbranch-count-reg @gol
8243 -fcombine-stack-adjustments @gol
8244 -fcompare-elim @gol
8245 -fcprop-registers @gol
8246 -fdce @gol
8247 -fdefer-pop @gol
8248 -fdelayed-branch @gol
8249 -fdse @gol
8250 -fforward-propagate @gol
8251 -fguess-branch-probability @gol
8252 -fif-conversion @gol
8253 -fif-conversion2 @gol
8254 -finline-functions-called-once @gol
8255 -fipa-profile @gol
8256 -fipa-pure-const @gol
8257 -fipa-reference @gol
8258 -fipa-reference-addressable @gol
8259 -fmerge-constants @gol
8260 -fmove-loop-invariants @gol
8261 -fomit-frame-pointer @gol
8262 -freorder-blocks @gol
8263 -fshrink-wrap @gol
8264 -fshrink-wrap-separate @gol
8265 -fsplit-wide-types @gol
8266 -fssa-backprop @gol
8267 -fssa-phiopt @gol
8268 -ftree-bit-ccp @gol
8269 -ftree-ccp @gol
8270 -ftree-ch @gol
8271 -ftree-coalesce-vars @gol
8272 -ftree-copy-prop @gol
8273 -ftree-dce @gol
8274 -ftree-dominator-opts @gol
8275 -ftree-dse @gol
8276 -ftree-forwprop @gol
8277 -ftree-fre @gol
8278 -ftree-phiprop @gol
8279 -ftree-pta @gol
8280 -ftree-scev-cprop @gol
8281 -ftree-sink @gol
8282 -ftree-slsr @gol
8283 -ftree-sra @gol
8284 -ftree-ter @gol
8285 -funit-at-a-time}
8286
8287 @item -O2
8288 @opindex O2
8289 Optimize even more. GCC performs nearly all supported optimizations
8290 that do not involve a space-speed tradeoff.
8291 As compared to @option{-O}, this option increases both compilation time
8292 and the performance of the generated code.
8293
8294 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8295 also turns on the following optimization flags:
8296
8297 @c Please keep the following list alphabetized!
8298 @gccoptlist{-falign-functions -falign-jumps @gol
8299 -falign-labels -falign-loops @gol
8300 -fcaller-saves @gol
8301 -fcode-hoisting @gol
8302 -fcrossjumping @gol
8303 -fcse-follow-jumps -fcse-skip-blocks @gol
8304 -fdelete-null-pointer-checks @gol
8305 -fdevirtualize -fdevirtualize-speculatively @gol
8306 -fexpensive-optimizations @gol
8307 -ffinite-loops @gol
8308 -fgcse -fgcse-lm @gol
8309 -fhoist-adjacent-loads @gol
8310 -finline-small-functions @gol
8311 -findirect-inlining @gol
8312 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8313 -fipa-ra -fipa-sra -fipa-vrp @gol
8314 -fisolate-erroneous-paths-dereference @gol
8315 -flra-remat @gol
8316 -foptimize-sibling-calls @gol
8317 -foptimize-strlen @gol
8318 -fpartial-inlining @gol
8319 -fpeephole2 @gol
8320 -freorder-blocks-algorithm=stc @gol
8321 -freorder-blocks-and-partition -freorder-functions @gol
8322 -frerun-cse-after-loop @gol
8323 -fschedule-insns -fschedule-insns2 @gol
8324 -fsched-interblock -fsched-spec @gol
8325 -fstore-merging @gol
8326 -fstrict-aliasing @gol
8327 -fthread-jumps @gol
8328 -ftree-builtin-call-dce @gol
8329 -ftree-pre @gol
8330 -ftree-switch-conversion -ftree-tail-merge @gol
8331 -ftree-vrp}
8332
8333 Please note the warning under @option{-fgcse} about
8334 invoking @option{-O2} on programs that use computed gotos.
8335
8336 @item -O3
8337 @opindex O3
8338 Optimize yet more. @option{-O3} turns on all optimizations specified
8339 by @option{-O2} and also turns on the following optimization flags:
8340
8341 @c Please keep the following list alphabetized!
8342 @gccoptlist{-fgcse-after-reload @gol
8343 -finline-functions @gol
8344 -fipa-cp-clone
8345 -floop-interchange @gol
8346 -floop-unroll-and-jam @gol
8347 -fpeel-loops @gol
8348 -fpredictive-commoning @gol
8349 -fsplit-paths @gol
8350 -ftree-loop-distribute-patterns @gol
8351 -ftree-loop-distribution @gol
8352 -ftree-loop-vectorize @gol
8353 -ftree-partial-pre @gol
8354 -ftree-slp-vectorize @gol
8355 -funswitch-loops @gol
8356 -fvect-cost-model @gol
8357 -fversion-loops-for-strides}
8358
8359 @item -O0
8360 @opindex O0
8361 Reduce compilation time and make debugging produce the expected
8362 results. This is the default.
8363
8364 @item -Os
8365 @opindex Os
8366 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8367 except those that often increase code size:
8368
8369 @gccoptlist{-falign-functions -falign-jumps @gol
8370 -falign-labels -falign-loops @gol
8371 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8372
8373 It also enables @option{-finline-functions}, causes the compiler to tune for
8374 code size rather than execution speed, and performs further optimizations
8375 designed to reduce code size.
8376
8377 @item -Ofast
8378 @opindex Ofast
8379 Disregard strict standards compliance. @option{-Ofast} enables all
8380 @option{-O3} optimizations. It also enables optimizations that are not
8381 valid for all standard-compliant programs.
8382 It turns on @option{-ffast-math} and the Fortran-specific
8383 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8384 specified, and @option{-fno-protect-parens}.
8385
8386 @item -Og
8387 @opindex Og
8388 Optimize debugging experience. @option{-Og} should be the optimization
8389 level of choice for the standard edit-compile-debug cycle, offering
8390 a reasonable level of optimization while maintaining fast compilation
8391 and a good debugging experience. It is a better choice than @option{-O0}
8392 for producing debuggable code because some compiler passes
8393 that collect debug information are disabled at @option{-O0}.
8394
8395 Like @option{-O0}, @option{-Og} completely disables a number of
8396 optimization passes so that individual options controlling them have
8397 no effect. Otherwise @option{-Og} enables all @option{-O1}
8398 optimization flags except for those that may interfere with debugging:
8399
8400 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8401 -fif-conversion -fif-conversion2 @gol
8402 -finline-functions-called-once @gol
8403 -fmove-loop-invariants -fssa-phiopt @gol
8404 -ftree-bit-ccp -ftree-pta -ftree-sra}
8405
8406 @end table
8407
8408 If you use multiple @option{-O} options, with or without level numbers,
8409 the last such option is the one that is effective.
8410
8411 Options of the form @option{-f@var{flag}} specify machine-independent
8412 flags. Most flags have both positive and negative forms; the negative
8413 form of @option{-ffoo} is @option{-fno-foo}. In the table
8414 below, only one of the forms is listed---the one you typically
8415 use. You can figure out the other form by either removing @samp{no-}
8416 or adding it.
8417
8418 The following options control specific optimizations. They are either
8419 activated by @option{-O} options or are related to ones that are. You
8420 can use the following flags in the rare cases when ``fine-tuning'' of
8421 optimizations to be performed is desired.
8422
8423 @table @gcctabopt
8424 @item -fno-defer-pop
8425 @opindex fno-defer-pop
8426 @opindex fdefer-pop
8427 For machines that must pop arguments after a function call, always pop
8428 the arguments as soon as each function returns.
8429 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8430 this allows the compiler to let arguments accumulate on the stack for several
8431 function calls and pop them all at once.
8432
8433 @item -fforward-propagate
8434 @opindex fforward-propagate
8435 Perform a forward propagation pass on RTL@. The pass tries to combine two
8436 instructions and checks if the result can be simplified. If loop unrolling
8437 is active, two passes are performed and the second is scheduled after
8438 loop unrolling.
8439
8440 This option is enabled by default at optimization levels @option{-O},
8441 @option{-O2}, @option{-O3}, @option{-Os}.
8442
8443 @item -ffp-contract=@var{style}
8444 @opindex ffp-contract
8445 @option{-ffp-contract=off} disables floating-point expression contraction.
8446 @option{-ffp-contract=fast} enables floating-point expression contraction
8447 such as forming of fused multiply-add operations if the target has
8448 native support for them.
8449 @option{-ffp-contract=on} enables floating-point expression contraction
8450 if allowed by the language standard. This is currently not implemented
8451 and treated equal to @option{-ffp-contract=off}.
8452
8453 The default is @option{-ffp-contract=fast}.
8454
8455 @item -fomit-frame-pointer
8456 @opindex fomit-frame-pointer
8457 Omit the frame pointer in functions that don't need one. This avoids the
8458 instructions to save, set up and restore the frame pointer; on many targets
8459 it also makes an extra register available.
8460
8461 On some targets this flag has no effect because the standard calling sequence
8462 always uses a frame pointer, so it cannot be omitted.
8463
8464 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8465 is used in all functions. Several targets always omit the frame pointer in
8466 leaf functions.
8467
8468 Enabled by default at @option{-O} and higher.
8469
8470 @item -foptimize-sibling-calls
8471 @opindex foptimize-sibling-calls
8472 Optimize sibling and tail recursive calls.
8473
8474 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8475
8476 @item -foptimize-strlen
8477 @opindex foptimize-strlen
8478 Optimize various standard C string functions (e.g.@: @code{strlen},
8479 @code{strchr} or @code{strcpy}) and
8480 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8481
8482 Enabled at levels @option{-O2}, @option{-O3}.
8483
8484 @item -fno-inline
8485 @opindex fno-inline
8486 @opindex finline
8487 Do not expand any functions inline apart from those marked with
8488 the @code{always_inline} attribute. This is the default when not
8489 optimizing.
8490
8491 Single functions can be exempted from inlining by marking them
8492 with the @code{noinline} attribute.
8493
8494 @item -finline-small-functions
8495 @opindex finline-small-functions
8496 Integrate functions into their callers when their body is smaller than expected
8497 function call code (so overall size of program gets smaller). The compiler
8498 heuristically decides which functions are simple enough to be worth integrating
8499 in this way. This inlining applies to all functions, even those not declared
8500 inline.
8501
8502 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8503
8504 @item -findirect-inlining
8505 @opindex findirect-inlining
8506 Inline also indirect calls that are discovered to be known at compile
8507 time thanks to previous inlining. This option has any effect only
8508 when inlining itself is turned on by the @option{-finline-functions}
8509 or @option{-finline-small-functions} options.
8510
8511 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8512
8513 @item -finline-functions
8514 @opindex finline-functions
8515 Consider all functions for inlining, even if they are not declared inline.
8516 The compiler heuristically decides which functions are worth integrating
8517 in this way.
8518
8519 If all calls to a given function are integrated, and the function is
8520 declared @code{static}, then the function is normally not output as
8521 assembler code in its own right.
8522
8523 Enabled at levels @option{-O3}, @option{-Os}. Also enabled
8524 by @option{-fprofile-use} and @option{-fauto-profile}.
8525
8526 @item -finline-functions-called-once
8527 @opindex finline-functions-called-once
8528 Consider all @code{static} functions called once for inlining into their
8529 caller even if they are not marked @code{inline}. If a call to a given
8530 function is integrated, then the function is not output as assembler code
8531 in its own right.
8532
8533 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8534 but not @option{-Og}.
8535
8536 @item -fearly-inlining
8537 @opindex fearly-inlining
8538 Inline functions marked by @code{always_inline} and functions whose body seems
8539 smaller than the function call overhead early before doing
8540 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8541 makes profiling significantly cheaper and usually inlining faster on programs
8542 having large chains of nested wrapper functions.
8543
8544 Enabled by default.
8545
8546 @item -fipa-sra
8547 @opindex fipa-sra
8548 Perform interprocedural scalar replacement of aggregates, removal of
8549 unused parameters and replacement of parameters passed by reference
8550 by parameters passed by value.
8551
8552 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8553
8554 @item -finline-limit=@var{n}
8555 @opindex finline-limit
8556 By default, GCC limits the size of functions that can be inlined. This flag
8557 allows coarse control of this limit. @var{n} is the size of functions that
8558 can be inlined in number of pseudo instructions.
8559
8560 Inlining is actually controlled by a number of parameters, which may be
8561 specified individually by using @option{--param @var{name}=@var{value}}.
8562 The @option{-finline-limit=@var{n}} option sets some of these parameters
8563 as follows:
8564
8565 @table @gcctabopt
8566 @item max-inline-insns-single
8567 is set to @var{n}/2.
8568 @item max-inline-insns-auto
8569 is set to @var{n}/2.
8570 @end table
8571
8572 See below for a documentation of the individual
8573 parameters controlling inlining and for the defaults of these parameters.
8574
8575 @emph{Note:} there may be no value to @option{-finline-limit} that results
8576 in default behavior.
8577
8578 @emph{Note:} pseudo instruction represents, in this particular context, an
8579 abstract measurement of function's size. In no way does it represent a count
8580 of assembly instructions and as such its exact meaning might change from one
8581 release to an another.
8582
8583 @item -fno-keep-inline-dllexport
8584 @opindex fno-keep-inline-dllexport
8585 @opindex fkeep-inline-dllexport
8586 This is a more fine-grained version of @option{-fkeep-inline-functions},
8587 which applies only to functions that are declared using the @code{dllexport}
8588 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8589 Functions}.
8590
8591 @item -fkeep-inline-functions
8592 @opindex fkeep-inline-functions
8593 In C, emit @code{static} functions that are declared @code{inline}
8594 into the object file, even if the function has been inlined into all
8595 of its callers. This switch does not affect functions using the
8596 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8597 inline functions into the object file.
8598
8599 @item -fkeep-static-functions
8600 @opindex fkeep-static-functions
8601 Emit @code{static} functions into the object file, even if the function
8602 is never used.
8603
8604 @item -fkeep-static-consts
8605 @opindex fkeep-static-consts
8606 Emit variables declared @code{static const} when optimization isn't turned
8607 on, even if the variables aren't referenced.
8608
8609 GCC enables this option by default. If you want to force the compiler to
8610 check if a variable is referenced, regardless of whether or not
8611 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8612
8613 @item -fmerge-constants
8614 @opindex fmerge-constants
8615 Attempt to merge identical constants (string constants and floating-point
8616 constants) across compilation units.
8617
8618 This option is the default for optimized compilation if the assembler and
8619 linker support it. Use @option{-fno-merge-constants} to inhibit this
8620 behavior.
8621
8622 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8623
8624 @item -fmerge-all-constants
8625 @opindex fmerge-all-constants
8626 Attempt to merge identical constants and identical variables.
8627
8628 This option implies @option{-fmerge-constants}. In addition to
8629 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8630 arrays or initialized constant variables with integral or floating-point
8631 types. Languages like C or C++ require each variable, including multiple
8632 instances of the same variable in recursive calls, to have distinct locations,
8633 so using this option results in non-conforming
8634 behavior.
8635
8636 @item -fmodulo-sched
8637 @opindex fmodulo-sched
8638 Perform swing modulo scheduling immediately before the first scheduling
8639 pass. This pass looks at innermost loops and reorders their
8640 instructions by overlapping different iterations.
8641
8642 @item -fmodulo-sched-allow-regmoves
8643 @opindex fmodulo-sched-allow-regmoves
8644 Perform more aggressive SMS-based modulo scheduling with register moves
8645 allowed. By setting this flag certain anti-dependences edges are
8646 deleted, which triggers the generation of reg-moves based on the
8647 life-range analysis. This option is effective only with
8648 @option{-fmodulo-sched} enabled.
8649
8650 @item -fno-branch-count-reg
8651 @opindex fno-branch-count-reg
8652 @opindex fbranch-count-reg
8653 Disable the optimization pass that scans for opportunities to use
8654 ``decrement and branch'' instructions on a count register instead of
8655 instruction sequences that decrement a register, compare it against zero, and
8656 then branch based upon the result. This option is only meaningful on
8657 architectures that support such instructions, which include x86, PowerPC,
8658 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8659 doesn't remove the decrement and branch instructions from the generated
8660 instruction stream introduced by other optimization passes.
8661
8662 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8663 except for @option{-Og}.
8664
8665 @item -fno-function-cse
8666 @opindex fno-function-cse
8667 @opindex ffunction-cse
8668 Do not put function addresses in registers; make each instruction that
8669 calls a constant function contain the function's address explicitly.
8670
8671 This option results in less efficient code, but some strange hacks
8672 that alter the assembler output may be confused by the optimizations
8673 performed when this option is not used.
8674
8675 The default is @option{-ffunction-cse}
8676
8677 @item -fno-zero-initialized-in-bss
8678 @opindex fno-zero-initialized-in-bss
8679 @opindex fzero-initialized-in-bss
8680 If the target supports a BSS section, GCC by default puts variables that
8681 are initialized to zero into BSS@. This can save space in the resulting
8682 code.
8683
8684 This option turns off this behavior because some programs explicitly
8685 rely on variables going to the data section---e.g., so that the
8686 resulting executable can find the beginning of that section and/or make
8687 assumptions based on that.
8688
8689 The default is @option{-fzero-initialized-in-bss}.
8690
8691 @item -fthread-jumps
8692 @opindex fthread-jumps
8693 Perform optimizations that check to see if a jump branches to a
8694 location where another comparison subsumed by the first is found. If
8695 so, the first branch is redirected to either the destination of the
8696 second branch or a point immediately following it, depending on whether
8697 the condition is known to be true or false.
8698
8699 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8700
8701 @item -fsplit-wide-types
8702 @opindex fsplit-wide-types
8703 When using a type that occupies multiple registers, such as @code{long
8704 long} on a 32-bit system, split the registers apart and allocate them
8705 independently. This normally generates better code for those types,
8706 but may make debugging more difficult.
8707
8708 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8709 @option{-Os}.
8710
8711 @item -fcse-follow-jumps
8712 @opindex fcse-follow-jumps
8713 In common subexpression elimination (CSE), scan through jump instructions
8714 when the target of the jump is not reached by any other path. For
8715 example, when CSE encounters an @code{if} statement with an
8716 @code{else} clause, CSE follows the jump when the condition
8717 tested is false.
8718
8719 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8720
8721 @item -fcse-skip-blocks
8722 @opindex fcse-skip-blocks
8723 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8724 follow jumps that conditionally skip over blocks. When CSE
8725 encounters a simple @code{if} statement with no else clause,
8726 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8727 body of the @code{if}.
8728
8729 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8730
8731 @item -frerun-cse-after-loop
8732 @opindex frerun-cse-after-loop
8733 Re-run common subexpression elimination after loop optimizations are
8734 performed.
8735
8736 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8737
8738 @item -fgcse
8739 @opindex fgcse
8740 Perform a global common subexpression elimination pass.
8741 This pass also performs global constant and copy propagation.
8742
8743 @emph{Note:} When compiling a program using computed gotos, a GCC
8744 extension, you may get better run-time performance if you disable
8745 the global common subexpression elimination pass by adding
8746 @option{-fno-gcse} to the command line.
8747
8748 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8749
8750 @item -fgcse-lm
8751 @opindex fgcse-lm
8752 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8753 attempts to move loads that are only killed by stores into themselves. This
8754 allows a loop containing a load/store sequence to be changed to a load outside
8755 the loop, and a copy/store within the loop.
8756
8757 Enabled by default when @option{-fgcse} is enabled.
8758
8759 @item -fgcse-sm
8760 @opindex fgcse-sm
8761 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8762 global common subexpression elimination. This pass attempts to move
8763 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8764 loops containing a load/store sequence can be changed to a load before
8765 the loop and a store after the loop.
8766
8767 Not enabled at any optimization level.
8768
8769 @item -fgcse-las
8770 @opindex fgcse-las
8771 When @option{-fgcse-las} is enabled, the global common subexpression
8772 elimination pass eliminates redundant loads that come after stores to the
8773 same memory location (both partial and full redundancies).
8774
8775 Not enabled at any optimization level.
8776
8777 @item -fgcse-after-reload
8778 @opindex fgcse-after-reload
8779 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8780 pass is performed after reload. The purpose of this pass is to clean up
8781 redundant spilling.
8782
8783 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8784
8785 @item -faggressive-loop-optimizations
8786 @opindex faggressive-loop-optimizations
8787 This option tells the loop optimizer to use language constraints to
8788 derive bounds for the number of iterations of a loop. This assumes that
8789 loop code does not invoke undefined behavior by for example causing signed
8790 integer overflows or out-of-bound array accesses. The bounds for the
8791 number of iterations of a loop are used to guide loop unrolling and peeling
8792 and loop exit test optimizations.
8793 This option is enabled by default.
8794
8795 @item -funconstrained-commons
8796 @opindex funconstrained-commons
8797 This option tells the compiler that variables declared in common blocks
8798 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8799 prevents certain optimizations that depend on knowing the array bounds.
8800
8801 @item -fcrossjumping
8802 @opindex fcrossjumping
8803 Perform cross-jumping transformation.
8804 This transformation unifies equivalent code and saves code size. The
8805 resulting code may or may not perform better than without cross-jumping.
8806
8807 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8808
8809 @item -fauto-inc-dec
8810 @opindex fauto-inc-dec
8811 Combine increments or decrements of addresses with memory accesses.
8812 This pass is always skipped on architectures that do not have
8813 instructions to support this. Enabled by default at @option{-O} and
8814 higher on architectures that support this.
8815
8816 @item -fdce
8817 @opindex fdce
8818 Perform dead code elimination (DCE) on RTL@.
8819 Enabled by default at @option{-O} and higher.
8820
8821 @item -fdse
8822 @opindex fdse
8823 Perform dead store elimination (DSE) on RTL@.
8824 Enabled by default at @option{-O} and higher.
8825
8826 @item -fif-conversion
8827 @opindex fif-conversion
8828 Attempt to transform conditional jumps into branch-less equivalents. This
8829 includes use of conditional moves, min, max, set flags and abs instructions, and
8830 some tricks doable by standard arithmetics. The use of conditional execution
8831 on chips where it is available is controlled by @option{-fif-conversion2}.
8832
8833 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8834 not with @option{-Og}.
8835
8836 @item -fif-conversion2
8837 @opindex fif-conversion2
8838 Use conditional execution (where available) to transform conditional jumps into
8839 branch-less equivalents.
8840
8841 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8842 not with @option{-Og}.
8843
8844 @item -fdeclone-ctor-dtor
8845 @opindex fdeclone-ctor-dtor
8846 The C++ ABI requires multiple entry points for constructors and
8847 destructors: one for a base subobject, one for a complete object, and
8848 one for a virtual destructor that calls operator delete afterwards.
8849 For a hierarchy with virtual bases, the base and complete variants are
8850 clones, which means two copies of the function. With this option, the
8851 base and complete variants are changed to be thunks that call a common
8852 implementation.
8853
8854 Enabled by @option{-Os}.
8855
8856 @item -fdelete-null-pointer-checks
8857 @opindex fdelete-null-pointer-checks
8858 Assume that programs cannot safely dereference null pointers, and that
8859 no code or data element resides at address zero.
8860 This option enables simple constant
8861 folding optimizations at all optimization levels. In addition, other
8862 optimization passes in GCC use this flag to control global dataflow
8863 analyses that eliminate useless checks for null pointers; these assume
8864 that a memory access to address zero always results in a trap, so
8865 that if a pointer is checked after it has already been dereferenced,
8866 it cannot be null.
8867
8868 Note however that in some environments this assumption is not true.
8869 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8870 for programs that depend on that behavior.
8871
8872 This option is enabled by default on most targets. On Nios II ELF, it
8873 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8874
8875 Passes that use the dataflow information
8876 are enabled independently at different optimization levels.
8877
8878 @item -fdevirtualize
8879 @opindex fdevirtualize
8880 Attempt to convert calls to virtual functions to direct calls. This
8881 is done both within a procedure and interprocedurally as part of
8882 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8883 propagation (@option{-fipa-cp}).
8884 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8885
8886 @item -fdevirtualize-speculatively
8887 @opindex fdevirtualize-speculatively
8888 Attempt to convert calls to virtual functions to speculative direct calls.
8889 Based on the analysis of the type inheritance graph, determine for a given call
8890 the set of likely targets. If the set is small, preferably of size 1, change
8891 the call into a conditional deciding between direct and indirect calls. The
8892 speculative calls enable more optimizations, such as inlining. When they seem
8893 useless after further optimization, they are converted back into original form.
8894
8895 @item -fdevirtualize-at-ltrans
8896 @opindex fdevirtualize-at-ltrans
8897 Stream extra information needed for aggressive devirtualization when running
8898 the link-time optimizer in local transformation mode.
8899 This option enables more devirtualization but
8900 significantly increases the size of streamed data. For this reason it is
8901 disabled by default.
8902
8903 @item -fexpensive-optimizations
8904 @opindex fexpensive-optimizations
8905 Perform a number of minor optimizations that are relatively expensive.
8906
8907 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8908
8909 @item -free
8910 @opindex free
8911 Attempt to remove redundant extension instructions. This is especially
8912 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8913 registers after writing to their lower 32-bit half.
8914
8915 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8916 @option{-O3}, @option{-Os}.
8917
8918 @item -fno-lifetime-dse
8919 @opindex fno-lifetime-dse
8920 @opindex flifetime-dse
8921 In C++ the value of an object is only affected by changes within its
8922 lifetime: when the constructor begins, the object has an indeterminate
8923 value, and any changes during the lifetime of the object are dead when
8924 the object is destroyed. Normally dead store elimination will take
8925 advantage of this; if your code relies on the value of the object
8926 storage persisting beyond the lifetime of the object, you can use this
8927 flag to disable this optimization. To preserve stores before the
8928 constructor starts (e.g.@: because your operator new clears the object
8929 storage) but still treat the object as dead after the destructor you,
8930 can use @option{-flifetime-dse=1}. The default behavior can be
8931 explicitly selected with @option{-flifetime-dse=2}.
8932 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8933
8934 @item -flive-range-shrinkage
8935 @opindex flive-range-shrinkage
8936 Attempt to decrease register pressure through register live range
8937 shrinkage. This is helpful for fast processors with small or moderate
8938 size register sets.
8939
8940 @item -fira-algorithm=@var{algorithm}
8941 @opindex fira-algorithm
8942 Use the specified coloring algorithm for the integrated register
8943 allocator. The @var{algorithm} argument can be @samp{priority}, which
8944 specifies Chow's priority coloring, or @samp{CB}, which specifies
8945 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8946 for all architectures, but for those targets that do support it, it is
8947 the default because it generates better code.
8948
8949 @item -fira-region=@var{region}
8950 @opindex fira-region
8951 Use specified regions for the integrated register allocator. The
8952 @var{region} argument should be one of the following:
8953
8954 @table @samp
8955
8956 @item all
8957 Use all loops as register allocation regions.
8958 This can give the best results for machines with a small and/or
8959 irregular register set.
8960
8961 @item mixed
8962 Use all loops except for loops with small register pressure
8963 as the regions. This value usually gives
8964 the best results in most cases and for most architectures,
8965 and is enabled by default when compiling with optimization for speed
8966 (@option{-O}, @option{-O2}, @dots{}).
8967
8968 @item one
8969 Use all functions as a single region.
8970 This typically results in the smallest code size, and is enabled by default for
8971 @option{-Os} or @option{-O0}.
8972
8973 @end table
8974
8975 @item -fira-hoist-pressure
8976 @opindex fira-hoist-pressure
8977 Use IRA to evaluate register pressure in the code hoisting pass for
8978 decisions to hoist expressions. This option usually results in smaller
8979 code, but it can slow the compiler down.
8980
8981 This option is enabled at level @option{-Os} for all targets.
8982
8983 @item -fira-loop-pressure
8984 @opindex fira-loop-pressure
8985 Use IRA to evaluate register pressure in loops for decisions to move
8986 loop invariants. This option usually results in generation
8987 of faster and smaller code on machines with large register files (>= 32
8988 registers), but it can slow the compiler down.
8989
8990 This option is enabled at level @option{-O3} for some targets.
8991
8992 @item -fno-ira-share-save-slots
8993 @opindex fno-ira-share-save-slots
8994 @opindex fira-share-save-slots
8995 Disable sharing of stack slots used for saving call-used hard
8996 registers living through a call. Each hard register gets a
8997 separate stack slot, and as a result function stack frames are
8998 larger.
8999
9000 @item -fno-ira-share-spill-slots
9001 @opindex fno-ira-share-spill-slots
9002 @opindex fira-share-spill-slots
9003 Disable sharing of stack slots allocated for pseudo-registers. Each
9004 pseudo-register that does not get a hard register gets a separate
9005 stack slot, and as a result function stack frames are larger.
9006
9007 @item -flra-remat
9008 @opindex flra-remat
9009 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9010 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9011 values if it is profitable.
9012
9013 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9014
9015 @item -fdelayed-branch
9016 @opindex fdelayed-branch
9017 If supported for the target machine, attempt to reorder instructions
9018 to exploit instruction slots available after delayed branch
9019 instructions.
9020
9021 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9022 but not at @option{-Og}.
9023
9024 @item -fschedule-insns
9025 @opindex fschedule-insns
9026 If supported for the target machine, attempt to reorder instructions to
9027 eliminate execution stalls due to required data being unavailable. This
9028 helps machines that have slow floating point or memory load instructions
9029 by allowing other instructions to be issued until the result of the load
9030 or floating-point instruction is required.
9031
9032 Enabled at levels @option{-O2}, @option{-O3}.
9033
9034 @item -fschedule-insns2
9035 @opindex fschedule-insns2
9036 Similar to @option{-fschedule-insns}, but requests an additional pass of
9037 instruction scheduling after register allocation has been done. This is
9038 especially useful on machines with a relatively small number of
9039 registers and where memory load instructions take more than one cycle.
9040
9041 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9042
9043 @item -fno-sched-interblock
9044 @opindex fno-sched-interblock
9045 @opindex fsched-interblock
9046 Disable instruction scheduling across basic blocks, which
9047 is normally enabled when scheduling before register allocation, i.e.@:
9048 with @option{-fschedule-insns} or at @option{-O2} or higher.
9049
9050 @item -fno-sched-spec
9051 @opindex fno-sched-spec
9052 @opindex fsched-spec
9053 Disable speculative motion of non-load instructions, which
9054 is normally enabled when scheduling before register allocation, i.e.@:
9055 with @option{-fschedule-insns} or at @option{-O2} or higher.
9056
9057 @item -fsched-pressure
9058 @opindex fsched-pressure
9059 Enable register pressure sensitive insn scheduling before register
9060 allocation. This only makes sense when scheduling before register
9061 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9062 @option{-O2} or higher. Usage of this option can improve the
9063 generated code and decrease its size by preventing register pressure
9064 increase above the number of available hard registers and subsequent
9065 spills in register allocation.
9066
9067 @item -fsched-spec-load
9068 @opindex fsched-spec-load
9069 Allow speculative motion of some load instructions. This only makes
9070 sense when scheduling before register allocation, i.e.@: with
9071 @option{-fschedule-insns} or at @option{-O2} or higher.
9072
9073 @item -fsched-spec-load-dangerous
9074 @opindex fsched-spec-load-dangerous
9075 Allow speculative motion of more load instructions. This only makes
9076 sense when scheduling before register allocation, i.e.@: with
9077 @option{-fschedule-insns} or at @option{-O2} or higher.
9078
9079 @item -fsched-stalled-insns
9080 @itemx -fsched-stalled-insns=@var{n}
9081 @opindex fsched-stalled-insns
9082 Define how many insns (if any) can be moved prematurely from the queue
9083 of stalled insns into the ready list during the second scheduling pass.
9084 @option{-fno-sched-stalled-insns} means that no insns are moved
9085 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9086 on how many queued insns can be moved prematurely.
9087 @option{-fsched-stalled-insns} without a value is equivalent to
9088 @option{-fsched-stalled-insns=1}.
9089
9090 @item -fsched-stalled-insns-dep
9091 @itemx -fsched-stalled-insns-dep=@var{n}
9092 @opindex fsched-stalled-insns-dep
9093 Define how many insn groups (cycles) are examined for a dependency
9094 on a stalled insn that is a candidate for premature removal from the queue
9095 of stalled insns. This has an effect only during the second scheduling pass,
9096 and only if @option{-fsched-stalled-insns} is used.
9097 @option{-fno-sched-stalled-insns-dep} is equivalent to
9098 @option{-fsched-stalled-insns-dep=0}.
9099 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9100 @option{-fsched-stalled-insns-dep=1}.
9101
9102 @item -fsched2-use-superblocks
9103 @opindex fsched2-use-superblocks
9104 When scheduling after register allocation, use superblock scheduling.
9105 This allows motion across basic block boundaries,
9106 resulting in faster schedules. This option is experimental, as not all machine
9107 descriptions used by GCC model the CPU closely enough to avoid unreliable
9108 results from the algorithm.
9109
9110 This only makes sense when scheduling after register allocation, i.e.@: with
9111 @option{-fschedule-insns2} or at @option{-O2} or higher.
9112
9113 @item -fsched-group-heuristic
9114 @opindex fsched-group-heuristic
9115 Enable the group heuristic in the scheduler. This heuristic favors
9116 the instruction that belongs to a schedule group. This is enabled
9117 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9118 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9119
9120 @item -fsched-critical-path-heuristic
9121 @opindex fsched-critical-path-heuristic
9122 Enable the critical-path heuristic in the scheduler. This heuristic favors
9123 instructions on the critical path. This is enabled by default when
9124 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9125 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9126
9127 @item -fsched-spec-insn-heuristic
9128 @opindex fsched-spec-insn-heuristic
9129 Enable the speculative instruction heuristic in the scheduler. This
9130 heuristic favors speculative instructions with greater dependency weakness.
9131 This is enabled by default when scheduling is enabled, i.e.@:
9132 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9133 or at @option{-O2} or higher.
9134
9135 @item -fsched-rank-heuristic
9136 @opindex fsched-rank-heuristic
9137 Enable the rank heuristic in the scheduler. This heuristic favors
9138 the instruction belonging to a basic block with greater size or frequency.
9139 This is enabled by default when scheduling is enabled, i.e.@:
9140 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9141 at @option{-O2} or higher.
9142
9143 @item -fsched-last-insn-heuristic
9144 @opindex fsched-last-insn-heuristic
9145 Enable the last-instruction heuristic in the scheduler. This heuristic
9146 favors the instruction that is less dependent on the last instruction
9147 scheduled. This is enabled by default when scheduling is enabled,
9148 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9149 at @option{-O2} or higher.
9150
9151 @item -fsched-dep-count-heuristic
9152 @opindex fsched-dep-count-heuristic
9153 Enable the dependent-count heuristic in the scheduler. This heuristic
9154 favors the instruction that has more instructions depending on it.
9155 This is enabled by default when scheduling is enabled, i.e.@:
9156 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9157 at @option{-O2} or higher.
9158
9159 @item -freschedule-modulo-scheduled-loops
9160 @opindex freschedule-modulo-scheduled-loops
9161 Modulo scheduling is performed before traditional scheduling. If a loop
9162 is modulo scheduled, later scheduling passes may change its schedule.
9163 Use this option to control that behavior.
9164
9165 @item -fselective-scheduling
9166 @opindex fselective-scheduling
9167 Schedule instructions using selective scheduling algorithm. Selective
9168 scheduling runs instead of the first scheduler pass.
9169
9170 @item -fselective-scheduling2
9171 @opindex fselective-scheduling2
9172 Schedule instructions using selective scheduling algorithm. Selective
9173 scheduling runs instead of the second scheduler pass.
9174
9175 @item -fsel-sched-pipelining
9176 @opindex fsel-sched-pipelining
9177 Enable software pipelining of innermost loops during selective scheduling.
9178 This option has no effect unless one of @option{-fselective-scheduling} or
9179 @option{-fselective-scheduling2} is turned on.
9180
9181 @item -fsel-sched-pipelining-outer-loops
9182 @opindex fsel-sched-pipelining-outer-loops
9183 When pipelining loops during selective scheduling, also pipeline outer loops.
9184 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9185
9186 @item -fsemantic-interposition
9187 @opindex fsemantic-interposition
9188 Some object formats, like ELF, allow interposing of symbols by the
9189 dynamic linker.
9190 This means that for symbols exported from the DSO, the compiler cannot perform
9191 interprocedural propagation, inlining and other optimizations in anticipation
9192 that the function or variable in question may change. While this feature is
9193 useful, for example, to rewrite memory allocation functions by a debugging
9194 implementation, it is expensive in the terms of code quality.
9195 With @option{-fno-semantic-interposition} the compiler assumes that
9196 if interposition happens for functions the overwriting function will have
9197 precisely the same semantics (and side effects).
9198 Similarly if interposition happens
9199 for variables, the constructor of the variable will be the same. The flag
9200 has no effect for functions explicitly declared inline
9201 (where it is never allowed for interposition to change semantics)
9202 and for symbols explicitly declared weak.
9203
9204 @item -fshrink-wrap
9205 @opindex fshrink-wrap
9206 Emit function prologues only before parts of the function that need it,
9207 rather than at the top of the function. This flag is enabled by default at
9208 @option{-O} and higher.
9209
9210 @item -fshrink-wrap-separate
9211 @opindex fshrink-wrap-separate
9212 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9213 those parts are only executed when needed.
9214 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9215 is also turned on and the target supports this.
9216
9217 @item -fcaller-saves
9218 @opindex fcaller-saves
9219 Enable allocation of values to registers that are clobbered by
9220 function calls, by emitting extra instructions to save and restore the
9221 registers around such calls. Such allocation is done only when it
9222 seems to result in better code.
9223
9224 This option is always enabled by default on certain machines, usually
9225 those which have no call-preserved registers to use instead.
9226
9227 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9228
9229 @item -fcombine-stack-adjustments
9230 @opindex fcombine-stack-adjustments
9231 Tracks stack adjustments (pushes and pops) and stack memory references
9232 and then tries to find ways to combine them.
9233
9234 Enabled by default at @option{-O1} and higher.
9235
9236 @item -fipa-ra
9237 @opindex fipa-ra
9238 Use caller save registers for allocation if those registers are not used by
9239 any called function. In that case it is not necessary to save and restore
9240 them around calls. This is only possible if called functions are part of
9241 same compilation unit as current function and they are compiled before it.
9242
9243 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9244 is disabled if generated code will be instrumented for profiling
9245 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9246 exactly (this happens on targets that do not expose prologues
9247 and epilogues in RTL).
9248
9249 @item -fconserve-stack
9250 @opindex fconserve-stack
9251 Attempt to minimize stack usage. The compiler attempts to use less
9252 stack space, even if that makes the program slower. This option
9253 implies setting the @option{large-stack-frame} parameter to 100
9254 and the @option{large-stack-frame-growth} parameter to 400.
9255
9256 @item -ftree-reassoc
9257 @opindex ftree-reassoc
9258 Perform reassociation on trees. This flag is enabled by default
9259 at @option{-O} and higher.
9260
9261 @item -fcode-hoisting
9262 @opindex fcode-hoisting
9263 Perform code hoisting. Code hoisting tries to move the
9264 evaluation of expressions executed on all paths to the function exit
9265 as early as possible. This is especially useful as a code size
9266 optimization, but it often helps for code speed as well.
9267 This flag is enabled by default at @option{-O2} and higher.
9268
9269 @item -ftree-pre
9270 @opindex ftree-pre
9271 Perform partial redundancy elimination (PRE) on trees. This flag is
9272 enabled by default at @option{-O2} and @option{-O3}.
9273
9274 @item -ftree-partial-pre
9275 @opindex ftree-partial-pre
9276 Make partial redundancy elimination (PRE) more aggressive. This flag is
9277 enabled by default at @option{-O3}.
9278
9279 @item -ftree-forwprop
9280 @opindex ftree-forwprop
9281 Perform forward propagation on trees. This flag is enabled by default
9282 at @option{-O} and higher.
9283
9284 @item -ftree-fre
9285 @opindex ftree-fre
9286 Perform full redundancy elimination (FRE) on trees. The difference
9287 between FRE and PRE is that FRE only considers expressions
9288 that are computed on all paths leading to the redundant computation.
9289 This analysis is faster than PRE, though it exposes fewer redundancies.
9290 This flag is enabled by default at @option{-O} and higher.
9291
9292 @item -ftree-phiprop
9293 @opindex ftree-phiprop
9294 Perform hoisting of loads from conditional pointers on trees. This
9295 pass is enabled by default at @option{-O} and higher.
9296
9297 @item -fhoist-adjacent-loads
9298 @opindex fhoist-adjacent-loads
9299 Speculatively hoist loads from both branches of an if-then-else if the
9300 loads are from adjacent locations in the same structure and the target
9301 architecture has a conditional move instruction. This flag is enabled
9302 by default at @option{-O2} and higher.
9303
9304 @item -ftree-copy-prop
9305 @opindex ftree-copy-prop
9306 Perform copy propagation on trees. This pass eliminates unnecessary
9307 copy operations. This flag is enabled by default at @option{-O} and
9308 higher.
9309
9310 @item -fipa-pure-const
9311 @opindex fipa-pure-const
9312 Discover which functions are pure or constant.
9313 Enabled by default at @option{-O} and higher.
9314
9315 @item -fipa-reference
9316 @opindex fipa-reference
9317 Discover which static variables do not escape the
9318 compilation unit.
9319 Enabled by default at @option{-O} and higher.
9320
9321 @item -fipa-reference-addressable
9322 @opindex fipa-reference-addressable
9323 Discover read-only, write-only and non-addressable static variables.
9324 Enabled by default at @option{-O} and higher.
9325
9326 @item -fipa-stack-alignment
9327 @opindex fipa-stack-alignment
9328 Reduce stack alignment on call sites if possible.
9329 Enabled by default.
9330
9331 @item -fipa-pta
9332 @opindex fipa-pta
9333 Perform interprocedural pointer analysis and interprocedural modification
9334 and reference analysis. This option can cause excessive memory and
9335 compile-time usage on large compilation units. It is not enabled by
9336 default at any optimization level.
9337
9338 @item -fipa-profile
9339 @opindex fipa-profile
9340 Perform interprocedural profile propagation. The functions called only from
9341 cold functions are marked as cold. Also functions executed once (such as
9342 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9343 functions and loop less parts of functions executed once are then optimized for
9344 size.
9345 Enabled by default at @option{-O} and higher.
9346
9347 @item -fipa-cp
9348 @opindex fipa-cp
9349 Perform interprocedural constant propagation.
9350 This optimization analyzes the program to determine when values passed
9351 to functions are constants and then optimizes accordingly.
9352 This optimization can substantially increase performance
9353 if the application has constants passed to functions.
9354 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9355 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9356
9357 @item -fipa-cp-clone
9358 @opindex fipa-cp-clone
9359 Perform function cloning to make interprocedural constant propagation stronger.
9360 When enabled, interprocedural constant propagation performs function cloning
9361 when externally visible function can be called with constant arguments.
9362 Because this optimization can create multiple copies of functions,
9363 it may significantly increase code size
9364 (see @option{--param ipcp-unit-growth=@var{value}}).
9365 This flag is enabled by default at @option{-O3}.
9366 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9367
9368 @item -fipa-bit-cp
9369 @opindex fipa-bit-cp
9370 When enabled, perform interprocedural bitwise constant
9371 propagation. This flag is enabled by default at @option{-O2} and
9372 by @option{-fprofile-use} and @option{-fauto-profile}.
9373 It requires that @option{-fipa-cp} is enabled.
9374
9375 @item -fipa-vrp
9376 @opindex fipa-vrp
9377 When enabled, perform interprocedural propagation of value
9378 ranges. This flag is enabled by default at @option{-O2}. It requires
9379 that @option{-fipa-cp} is enabled.
9380
9381 @item -fipa-icf
9382 @opindex fipa-icf
9383 Perform Identical Code Folding for functions and read-only variables.
9384 The optimization reduces code size and may disturb unwind stacks by replacing
9385 a function by equivalent one with a different name. The optimization works
9386 more effectively with link-time optimization enabled.
9387
9388 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9389 works on different levels and thus the optimizations are not same - there are
9390 equivalences that are found only by GCC and equivalences found only by Gold.
9391
9392 This flag is enabled by default at @option{-O2} and @option{-Os}.
9393
9394 @item -flive-patching=@var{level}
9395 @opindex flive-patching
9396 Control GCC's optimizations to produce output suitable for live-patching.
9397
9398 If the compiler's optimization uses a function's body or information extracted
9399 from its body to optimize/change another function, the latter is called an
9400 impacted function of the former. If a function is patched, its impacted
9401 functions should be patched too.
9402
9403 The impacted functions are determined by the compiler's interprocedural
9404 optimizations. For example, a caller is impacted when inlining a function
9405 into its caller,
9406 cloning a function and changing its caller to call this new clone,
9407 or extracting a function's pureness/constness information to optimize
9408 its direct or indirect callers, etc.
9409
9410 Usually, the more IPA optimizations enabled, the larger the number of
9411 impacted functions for each function. In order to control the number of
9412 impacted functions and more easily compute the list of impacted function,
9413 IPA optimizations can be partially enabled at two different levels.
9414
9415 The @var{level} argument should be one of the following:
9416
9417 @table @samp
9418
9419 @item inline-clone
9420
9421 Only enable inlining and cloning optimizations, which includes inlining,
9422 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9423 As a result, when patching a function, all its callers and its clones'
9424 callers are impacted, therefore need to be patched as well.
9425
9426 @option{-flive-patching=inline-clone} disables the following optimization flags:
9427 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9428 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9429 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9430 -fipa-stack-alignment}
9431
9432 @item inline-only-static
9433
9434 Only enable inlining of static functions.
9435 As a result, when patching a static function, all its callers are impacted
9436 and so need to be patched as well.
9437
9438 In addition to all the flags that @option{-flive-patching=inline-clone}
9439 disables,
9440 @option{-flive-patching=inline-only-static} disables the following additional
9441 optimization flags:
9442 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9443
9444 @end table
9445
9446 When @option{-flive-patching} is specified without any value, the default value
9447 is @var{inline-clone}.
9448
9449 This flag is disabled by default.
9450
9451 Note that @option{-flive-patching} is not supported with link-time optimization
9452 (@option{-flto}).
9453
9454 @item -fisolate-erroneous-paths-dereference
9455 @opindex fisolate-erroneous-paths-dereference
9456 Detect paths that trigger erroneous or undefined behavior due to
9457 dereferencing a null pointer. Isolate those paths from the main control
9458 flow and turn the statement with erroneous or undefined behavior into a trap.
9459 This flag is enabled by default at @option{-O2} and higher and depends on
9460 @option{-fdelete-null-pointer-checks} also being enabled.
9461
9462 @item -fisolate-erroneous-paths-attribute
9463 @opindex fisolate-erroneous-paths-attribute
9464 Detect paths that trigger erroneous or undefined behavior due to a null value
9465 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9466 attribute. Isolate those paths from the main control flow and turn the
9467 statement with erroneous or undefined behavior into a trap. This is not
9468 currently enabled, but may be enabled by @option{-O2} in the future.
9469
9470 @item -ftree-sink
9471 @opindex ftree-sink
9472 Perform forward store motion on trees. This flag is
9473 enabled by default at @option{-O} and higher.
9474
9475 @item -ftree-bit-ccp
9476 @opindex ftree-bit-ccp
9477 Perform sparse conditional bit constant propagation on trees and propagate
9478 pointer alignment information.
9479 This pass only operates on local scalar variables and is enabled by default
9480 at @option{-O1} and higher, except for @option{-Og}.
9481 It requires that @option{-ftree-ccp} is enabled.
9482
9483 @item -ftree-ccp
9484 @opindex ftree-ccp
9485 Perform sparse conditional constant propagation (CCP) on trees. This
9486 pass only operates on local scalar variables and is enabled by default
9487 at @option{-O} and higher.
9488
9489 @item -fssa-backprop
9490 @opindex fssa-backprop
9491 Propagate information about uses of a value up the definition chain
9492 in order to simplify the definitions. For example, this pass strips
9493 sign operations if the sign of a value never matters. The flag is
9494 enabled by default at @option{-O} and higher.
9495
9496 @item -fssa-phiopt
9497 @opindex fssa-phiopt
9498 Perform pattern matching on SSA PHI nodes to optimize conditional
9499 code. This pass is enabled by default at @option{-O1} and higher,
9500 except for @option{-Og}.
9501
9502 @item -ftree-switch-conversion
9503 @opindex ftree-switch-conversion
9504 Perform conversion of simple initializations in a switch to
9505 initializations from a scalar array. This flag is enabled by default
9506 at @option{-O2} and higher.
9507
9508 @item -ftree-tail-merge
9509 @opindex ftree-tail-merge
9510 Look for identical code sequences. When found, replace one with a jump to the
9511 other. This optimization is known as tail merging or cross jumping. This flag
9512 is enabled by default at @option{-O2} and higher. The compilation time
9513 in this pass can
9514 be limited using @option{max-tail-merge-comparisons} parameter and
9515 @option{max-tail-merge-iterations} parameter.
9516
9517 @item -ftree-dce
9518 @opindex ftree-dce
9519 Perform dead code elimination (DCE) on trees. This flag is enabled by
9520 default at @option{-O} and higher.
9521
9522 @item -ftree-builtin-call-dce
9523 @opindex ftree-builtin-call-dce
9524 Perform conditional dead code elimination (DCE) for calls to built-in functions
9525 that may set @code{errno} but are otherwise free of side effects. This flag is
9526 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9527 specified.
9528
9529 @item -ffinite-loops
9530 @opindex ffinite-loops
9531 @opindex fno-finite-loops
9532 Assume that a loop with an exit will eventually take the exit and not loop
9533 indefinitely. This allows the compiler to remove loops that otherwise have
9534 no side-effects, not considering eventual endless looping as such.
9535
9536 This option is enabled by default at @option{-O2}.
9537
9538 @item -ftree-dominator-opts
9539 @opindex ftree-dominator-opts
9540 Perform a variety of simple scalar cleanups (constant/copy
9541 propagation, redundancy elimination, range propagation and expression
9542 simplification) based on a dominator tree traversal. This also
9543 performs jump threading (to reduce jumps to jumps). This flag is
9544 enabled by default at @option{-O} and higher.
9545
9546 @item -ftree-dse
9547 @opindex ftree-dse
9548 Perform dead store elimination (DSE) on trees. A dead store is a store into
9549 a memory location that is later overwritten by another store without
9550 any intervening loads. In this case the earlier store can be deleted. This
9551 flag is enabled by default at @option{-O} and higher.
9552
9553 @item -ftree-ch
9554 @opindex ftree-ch
9555 Perform loop header copying on trees. This is beneficial since it increases
9556 effectiveness of code motion optimizations. It also saves one jump. This flag
9557 is enabled by default at @option{-O} and higher. It is not enabled
9558 for @option{-Os}, since it usually increases code size.
9559
9560 @item -ftree-loop-optimize
9561 @opindex ftree-loop-optimize
9562 Perform loop optimizations on trees. This flag is enabled by default
9563 at @option{-O} and higher.
9564
9565 @item -ftree-loop-linear
9566 @itemx -floop-strip-mine
9567 @itemx -floop-block
9568 @opindex ftree-loop-linear
9569 @opindex floop-strip-mine
9570 @opindex floop-block
9571 Perform loop nest optimizations. Same as
9572 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9573 to be configured with @option{--with-isl} to enable the Graphite loop
9574 transformation infrastructure.
9575
9576 @item -fgraphite-identity
9577 @opindex fgraphite-identity
9578 Enable the identity transformation for graphite. For every SCoP we generate
9579 the polyhedral representation and transform it back to gimple. Using
9580 @option{-fgraphite-identity} we can check the costs or benefits of the
9581 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9582 are also performed by the code generator isl, like index splitting and
9583 dead code elimination in loops.
9584
9585 @item -floop-nest-optimize
9586 @opindex floop-nest-optimize
9587 Enable the isl based loop nest optimizer. This is a generic loop nest
9588 optimizer based on the Pluto optimization algorithms. It calculates a loop
9589 structure optimized for data-locality and parallelism. This option
9590 is experimental.
9591
9592 @item -floop-parallelize-all
9593 @opindex floop-parallelize-all
9594 Use the Graphite data dependence analysis to identify loops that can
9595 be parallelized. Parallelize all the loops that can be analyzed to
9596 not contain loop carried dependences without checking that it is
9597 profitable to parallelize the loops.
9598
9599 @item -ftree-coalesce-vars
9600 @opindex ftree-coalesce-vars
9601 While transforming the program out of the SSA representation, attempt to
9602 reduce copying by coalescing versions of different user-defined
9603 variables, instead of just compiler temporaries. This may severely
9604 limit the ability to debug an optimized program compiled with
9605 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9606 prevents SSA coalescing of user variables. This option is enabled by
9607 default if optimization is enabled, and it does very little otherwise.
9608
9609 @item -ftree-loop-if-convert
9610 @opindex ftree-loop-if-convert
9611 Attempt to transform conditional jumps in the innermost loops to
9612 branch-less equivalents. The intent is to remove control-flow from
9613 the innermost loops in order to improve the ability of the
9614 vectorization pass to handle these loops. This is enabled by default
9615 if vectorization is enabled.
9616
9617 @item -ftree-loop-distribution
9618 @opindex ftree-loop-distribution
9619 Perform loop distribution. This flag can improve cache performance on
9620 big loop bodies and allow further loop optimizations, like
9621 parallelization or vectorization, to take place. For example, the loop
9622 @smallexample
9623 DO I = 1, N
9624 A(I) = B(I) + C
9625 D(I) = E(I) * F
9626 ENDDO
9627 @end smallexample
9628 is transformed to
9629 @smallexample
9630 DO I = 1, N
9631 A(I) = B(I) + C
9632 ENDDO
9633 DO I = 1, N
9634 D(I) = E(I) * F
9635 ENDDO
9636 @end smallexample
9637 This flag is enabled by default at @option{-O3}.
9638 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9639
9640 @item -ftree-loop-distribute-patterns
9641 @opindex ftree-loop-distribute-patterns
9642 Perform loop distribution of patterns that can be code generated with
9643 calls to a library. This flag is enabled by default at @option{-O3}, and
9644 by @option{-fprofile-use} and @option{-fauto-profile}.
9645
9646 This pass distributes the initialization loops and generates a call to
9647 memset zero. For example, the loop
9648 @smallexample
9649 DO I = 1, N
9650 A(I) = 0
9651 B(I) = A(I) + I
9652 ENDDO
9653 @end smallexample
9654 is transformed to
9655 @smallexample
9656 DO I = 1, N
9657 A(I) = 0
9658 ENDDO
9659 DO I = 1, N
9660 B(I) = A(I) + I
9661 ENDDO
9662 @end smallexample
9663 and the initialization loop is transformed into a call to memset zero.
9664 This flag is enabled by default at @option{-O3}.
9665 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9666
9667 @item -floop-interchange
9668 @opindex floop-interchange
9669 Perform loop interchange outside of graphite. This flag can improve cache
9670 performance on loop nest and allow further loop optimizations, like
9671 vectorization, to take place. For example, the loop
9672 @smallexample
9673 for (int i = 0; i < N; i++)
9674 for (int j = 0; j < N; j++)
9675 for (int k = 0; k < N; k++)
9676 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9677 @end smallexample
9678 is transformed to
9679 @smallexample
9680 for (int i = 0; i < N; i++)
9681 for (int k = 0; k < N; k++)
9682 for (int j = 0; j < N; j++)
9683 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9684 @end smallexample
9685 This flag is enabled by default at @option{-O3}.
9686 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9687
9688 @item -floop-unroll-and-jam
9689 @opindex floop-unroll-and-jam
9690 Apply unroll and jam transformations on feasible loops. In a loop
9691 nest this unrolls the outer loop by some factor and fuses the resulting
9692 multiple inner loops. This flag is enabled by default at @option{-O3}.
9693 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9694
9695 @item -ftree-loop-im
9696 @opindex ftree-loop-im
9697 Perform loop invariant motion on trees. This pass moves only invariants that
9698 are hard to handle at RTL level (function calls, operations that expand to
9699 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9700 operands of conditions that are invariant out of the loop, so that we can use
9701 just trivial invariantness analysis in loop unswitching. The pass also includes
9702 store motion.
9703
9704 @item -ftree-loop-ivcanon
9705 @opindex ftree-loop-ivcanon
9706 Create a canonical counter for number of iterations in loops for which
9707 determining number of iterations requires complicated analysis. Later
9708 optimizations then may determine the number easily. Useful especially
9709 in connection with unrolling.
9710
9711 @item -ftree-scev-cprop
9712 @opindex ftree-scev-cprop
9713 Perform final value replacement. If a variable is modified in a loop
9714 in such a way that its value when exiting the loop can be determined using
9715 only its initial value and the number of loop iterations, replace uses of
9716 the final value by such a computation, provided it is sufficiently cheap.
9717 This reduces data dependencies and may allow further simplifications.
9718 Enabled by default at @option{-O} and higher.
9719
9720 @item -fivopts
9721 @opindex fivopts
9722 Perform induction variable optimizations (strength reduction, induction
9723 variable merging and induction variable elimination) on trees.
9724
9725 @item -ftree-parallelize-loops=n
9726 @opindex ftree-parallelize-loops
9727 Parallelize loops, i.e., split their iteration space to run in n threads.
9728 This is only possible for loops whose iterations are independent
9729 and can be arbitrarily reordered. The optimization is only
9730 profitable on multiprocessor machines, for loops that are CPU-intensive,
9731 rather than constrained e.g.@: by memory bandwidth. This option
9732 implies @option{-pthread}, and thus is only supported on targets
9733 that have support for @option{-pthread}.
9734
9735 @item -ftree-pta
9736 @opindex ftree-pta
9737 Perform function-local points-to analysis on trees. This flag is
9738 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9739
9740 @item -ftree-sra
9741 @opindex ftree-sra
9742 Perform scalar replacement of aggregates. This pass replaces structure
9743 references with scalars to prevent committing structures to memory too
9744 early. This flag is enabled by default at @option{-O1} and higher,
9745 except for @option{-Og}.
9746
9747 @item -fstore-merging
9748 @opindex fstore-merging
9749 Perform merging of narrow stores to consecutive memory addresses. This pass
9750 merges contiguous stores of immediate values narrower than a word into fewer
9751 wider stores to reduce the number of instructions. This is enabled by default
9752 at @option{-O2} and higher as well as @option{-Os}.
9753
9754 @item -ftree-ter
9755 @opindex ftree-ter
9756 Perform temporary expression replacement during the SSA->normal phase. Single
9757 use/single def temporaries are replaced at their use location with their
9758 defining expression. This results in non-GIMPLE code, but gives the expanders
9759 much more complex trees to work on resulting in better RTL generation. This is
9760 enabled by default at @option{-O} and higher.
9761
9762 @item -ftree-slsr
9763 @opindex ftree-slsr
9764 Perform straight-line strength reduction on trees. This recognizes related
9765 expressions involving multiplications and replaces them by less expensive
9766 calculations when possible. This is enabled by default at @option{-O} and
9767 higher.
9768
9769 @item -ftree-vectorize
9770 @opindex ftree-vectorize
9771 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9772 and @option{-ftree-slp-vectorize} if not explicitly specified.
9773
9774 @item -ftree-loop-vectorize
9775 @opindex ftree-loop-vectorize
9776 Perform loop vectorization on trees. This flag is enabled by default at
9777 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9778 and @option{-fauto-profile}.
9779
9780 @item -ftree-slp-vectorize
9781 @opindex ftree-slp-vectorize
9782 Perform basic block vectorization on trees. This flag is enabled by default at
9783 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9784 and @option{-fauto-profile}.
9785
9786 @item -fvect-cost-model=@var{model}
9787 @opindex fvect-cost-model
9788 Alter the cost model used for vectorization. The @var{model} argument
9789 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9790 With the @samp{unlimited} model the vectorized code-path is assumed
9791 to be profitable while with the @samp{dynamic} model a runtime check
9792 guards the vectorized code-path to enable it only for iteration
9793 counts that will likely execute faster than when executing the original
9794 scalar loop. The @samp{cheap} model disables vectorization of
9795 loops where doing so would be cost prohibitive for example due to
9796 required runtime checks for data dependence or alignment but otherwise
9797 is equal to the @samp{dynamic} model.
9798 The default cost model depends on other optimization flags and is
9799 either @samp{dynamic} or @samp{cheap}.
9800
9801 @item -fsimd-cost-model=@var{model}
9802 @opindex fsimd-cost-model
9803 Alter the cost model used for vectorization of loops marked with the OpenMP
9804 simd directive. The @var{model} argument should be one of
9805 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9806 have the same meaning as described in @option{-fvect-cost-model} and by
9807 default a cost model defined with @option{-fvect-cost-model} is used.
9808
9809 @item -ftree-vrp
9810 @opindex ftree-vrp
9811 Perform Value Range Propagation on trees. This is similar to the
9812 constant propagation pass, but instead of values, ranges of values are
9813 propagated. This allows the optimizers to remove unnecessary range
9814 checks like array bound checks and null pointer checks. This is
9815 enabled by default at @option{-O2} and higher. Null pointer check
9816 elimination is only done if @option{-fdelete-null-pointer-checks} is
9817 enabled.
9818
9819 @item -fsplit-paths
9820 @opindex fsplit-paths
9821 Split paths leading to loop backedges. This can improve dead code
9822 elimination and common subexpression elimination. This is enabled by
9823 default at @option{-O3} and above.
9824
9825 @item -fsplit-ivs-in-unroller
9826 @opindex fsplit-ivs-in-unroller
9827 Enables expression of values of induction variables in later iterations
9828 of the unrolled loop using the value in the first iteration. This breaks
9829 long dependency chains, thus improving efficiency of the scheduling passes.
9830
9831 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9832 same effect. However, that is not reliable in cases where the loop body
9833 is more complicated than a single basic block. It also does not work at all
9834 on some architectures due to restrictions in the CSE pass.
9835
9836 This optimization is enabled by default.
9837
9838 @item -fvariable-expansion-in-unroller
9839 @opindex fvariable-expansion-in-unroller
9840 With this option, the compiler creates multiple copies of some
9841 local variables when unrolling a loop, which can result in superior code.
9842
9843 @item -fpartial-inlining
9844 @opindex fpartial-inlining
9845 Inline parts of functions. This option has any effect only
9846 when inlining itself is turned on by the @option{-finline-functions}
9847 or @option{-finline-small-functions} options.
9848
9849 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9850
9851 @item -fpredictive-commoning
9852 @opindex fpredictive-commoning
9853 Perform predictive commoning optimization, i.e., reusing computations
9854 (especially memory loads and stores) performed in previous
9855 iterations of loops.
9856
9857 This option is enabled at level @option{-O3}.
9858 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9859
9860 @item -fprefetch-loop-arrays
9861 @opindex fprefetch-loop-arrays
9862 If supported by the target machine, generate instructions to prefetch
9863 memory to improve the performance of loops that access large arrays.
9864
9865 This option may generate better or worse code; results are highly
9866 dependent on the structure of loops within the source code.
9867
9868 Disabled at level @option{-Os}.
9869
9870 @item -fno-printf-return-value
9871 @opindex fno-printf-return-value
9872 @opindex fprintf-return-value
9873 Do not substitute constants for known return value of formatted output
9874 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9875 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9876 transformation allows GCC to optimize or even eliminate branches based
9877 on the known return value of these functions called with arguments that
9878 are either constant, or whose values are known to be in a range that
9879 makes determining the exact return value possible. For example, when
9880 @option{-fprintf-return-value} is in effect, both the branch and the
9881 body of the @code{if} statement (but not the call to @code{snprint})
9882 can be optimized away when @code{i} is a 32-bit or smaller integer
9883 because the return value is guaranteed to be at most 8.
9884
9885 @smallexample
9886 char buf[9];
9887 if (snprintf (buf, "%08x", i) >= sizeof buf)
9888 @dots{}
9889 @end smallexample
9890
9891 The @option{-fprintf-return-value} option relies on other optimizations
9892 and yields best results with @option{-O2} and above. It works in tandem
9893 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9894 options. The @option{-fprintf-return-value} option is enabled by default.
9895
9896 @item -fno-peephole
9897 @itemx -fno-peephole2
9898 @opindex fno-peephole
9899 @opindex fpeephole
9900 @opindex fno-peephole2
9901 @opindex fpeephole2
9902 Disable any machine-specific peephole optimizations. The difference
9903 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9904 are implemented in the compiler; some targets use one, some use the
9905 other, a few use both.
9906
9907 @option{-fpeephole} is enabled by default.
9908 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9909
9910 @item -fno-guess-branch-probability
9911 @opindex fno-guess-branch-probability
9912 @opindex fguess-branch-probability
9913 Do not guess branch probabilities using heuristics.
9914
9915 GCC uses heuristics to guess branch probabilities if they are
9916 not provided by profiling feedback (@option{-fprofile-arcs}). These
9917 heuristics are based on the control flow graph. If some branch probabilities
9918 are specified by @code{__builtin_expect}, then the heuristics are
9919 used to guess branch probabilities for the rest of the control flow graph,
9920 taking the @code{__builtin_expect} info into account. The interactions
9921 between the heuristics and @code{__builtin_expect} can be complex, and in
9922 some cases, it may be useful to disable the heuristics so that the effects
9923 of @code{__builtin_expect} are easier to understand.
9924
9925 It is also possible to specify expected probability of the expression
9926 with @code{__builtin_expect_with_probability} built-in function.
9927
9928 The default is @option{-fguess-branch-probability} at levels
9929 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9930
9931 @item -freorder-blocks
9932 @opindex freorder-blocks
9933 Reorder basic blocks in the compiled function in order to reduce number of
9934 taken branches and improve code locality.
9935
9936 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9937
9938 @item -freorder-blocks-algorithm=@var{algorithm}
9939 @opindex freorder-blocks-algorithm
9940 Use the specified algorithm for basic block reordering. The
9941 @var{algorithm} argument can be @samp{simple}, which does not increase
9942 code size (except sometimes due to secondary effects like alignment),
9943 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9944 put all often executed code together, minimizing the number of branches
9945 executed by making extra copies of code.
9946
9947 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9948 @samp{stc} at levels @option{-O2}, @option{-O3}.
9949
9950 @item -freorder-blocks-and-partition
9951 @opindex freorder-blocks-and-partition
9952 In addition to reordering basic blocks in the compiled function, in order
9953 to reduce number of taken branches, partitions hot and cold basic blocks
9954 into separate sections of the assembly and @file{.o} files, to improve
9955 paging and cache locality performance.
9956
9957 This optimization is automatically turned off in the presence of
9958 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9959 section attribute and on any architecture that does not support named
9960 sections. When @option{-fsplit-stack} is used this option is not
9961 enabled by default (to avoid linker errors), but may be enabled
9962 explicitly (if using a working linker).
9963
9964 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9965
9966 @item -freorder-functions
9967 @opindex freorder-functions
9968 Reorder functions in the object file in order to
9969 improve code locality. This is implemented by using special
9970 subsections @code{.text.hot} for most frequently executed functions and
9971 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9972 the linker so object file format must support named sections and linker must
9973 place them in a reasonable way.
9974
9975 This option isn't effective unless you either provide profile feedback
9976 (see @option{-fprofile-arcs} for details) or manually annotate functions with
9977 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
9978
9979 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9980
9981 @item -fstrict-aliasing
9982 @opindex fstrict-aliasing
9983 Allow the compiler to assume the strictest aliasing rules applicable to
9984 the language being compiled. For C (and C++), this activates
9985 optimizations based on the type of expressions. In particular, an
9986 object of one type is assumed never to reside at the same address as an
9987 object of a different type, unless the types are almost the same. For
9988 example, an @code{unsigned int} can alias an @code{int}, but not a
9989 @code{void*} or a @code{double}. A character type may alias any other
9990 type.
9991
9992 @anchor{Type-punning}Pay special attention to code like this:
9993 @smallexample
9994 union a_union @{
9995 int i;
9996 double d;
9997 @};
9998
9999 int f() @{
10000 union a_union t;
10001 t.d = 3.0;
10002 return t.i;
10003 @}
10004 @end smallexample
10005 The practice of reading from a different union member than the one most
10006 recently written to (called ``type-punning'') is common. Even with
10007 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10008 is accessed through the union type. So, the code above works as
10009 expected. @xref{Structures unions enumerations and bit-fields
10010 implementation}. However, this code might not:
10011 @smallexample
10012 int f() @{
10013 union a_union t;
10014 int* ip;
10015 t.d = 3.0;
10016 ip = &t.i;
10017 return *ip;
10018 @}
10019 @end smallexample
10020
10021 Similarly, access by taking the address, casting the resulting pointer
10022 and dereferencing the result has undefined behavior, even if the cast
10023 uses a union type, e.g.:
10024 @smallexample
10025 int f() @{
10026 double d = 3.0;
10027 return ((union a_union *) &d)->i;
10028 @}
10029 @end smallexample
10030
10031 The @option{-fstrict-aliasing} option is enabled at levels
10032 @option{-O2}, @option{-O3}, @option{-Os}.
10033
10034 @item -falign-functions
10035 @itemx -falign-functions=@var{n}
10036 @itemx -falign-functions=@var{n}:@var{m}
10037 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10038 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10039 @opindex falign-functions
10040 Align the start of functions to the next power-of-two greater than
10041 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10042 the first @var{m} bytes of the function can be fetched by the CPU
10043 without crossing an @var{n}-byte alignment boundary.
10044
10045 If @var{m} is not specified, it defaults to @var{n}.
10046
10047 Examples: @option{-falign-functions=32} aligns functions to the next
10048 32-byte boundary, @option{-falign-functions=24} aligns to the next
10049 32-byte boundary only if this can be done by skipping 23 bytes or less,
10050 @option{-falign-functions=32:7} aligns to the next
10051 32-byte boundary only if this can be done by skipping 6 bytes or less.
10052
10053 The second pair of @var{n2}:@var{m2} values allows you to specify
10054 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10055 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10056 otherwise aligns to the next 32-byte boundary if this can be done
10057 by skipping 2 bytes or less.
10058 If @var{m2} is not specified, it defaults to @var{n2}.
10059
10060 Some assemblers only support this flag when @var{n} is a power of two;
10061 in that case, it is rounded up.
10062
10063 @option{-fno-align-functions} and @option{-falign-functions=1} are
10064 equivalent and mean that functions are not aligned.
10065
10066 If @var{n} is not specified or is zero, use a machine-dependent default.
10067 The maximum allowed @var{n} option value is 65536.
10068
10069 Enabled at levels @option{-O2}, @option{-O3}.
10070
10071 @item -flimit-function-alignment
10072 If this option is enabled, the compiler tries to avoid unnecessarily
10073 overaligning functions. It attempts to instruct the assembler to align
10074 by the amount specified by @option{-falign-functions}, but not to
10075 skip more bytes than the size of the function.
10076
10077 @item -falign-labels
10078 @itemx -falign-labels=@var{n}
10079 @itemx -falign-labels=@var{n}:@var{m}
10080 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10081 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10082 @opindex falign-labels
10083 Align all branch targets to a power-of-two boundary.
10084
10085 Parameters of this option are analogous to the @option{-falign-functions} option.
10086 @option{-fno-align-labels} and @option{-falign-labels=1} are
10087 equivalent and mean that labels are not aligned.
10088
10089 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10090 are greater than this value, then their values are used instead.
10091
10092 If @var{n} is not specified or is zero, use a machine-dependent default
10093 which is very likely to be @samp{1}, meaning no alignment.
10094 The maximum allowed @var{n} option value is 65536.
10095
10096 Enabled at levels @option{-O2}, @option{-O3}.
10097
10098 @item -falign-loops
10099 @itemx -falign-loops=@var{n}
10100 @itemx -falign-loops=@var{n}:@var{m}
10101 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10102 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10103 @opindex falign-loops
10104 Align loops to a power-of-two boundary. If the loops are executed
10105 many times, this makes up for any execution of the dummy padding
10106 instructions.
10107
10108 Parameters of this option are analogous to the @option{-falign-functions} option.
10109 @option{-fno-align-loops} and @option{-falign-loops=1} are
10110 equivalent and mean that loops are not aligned.
10111 The maximum allowed @var{n} option value is 65536.
10112
10113 If @var{n} is not specified or is zero, use a machine-dependent default.
10114
10115 Enabled at levels @option{-O2}, @option{-O3}.
10116
10117 @item -falign-jumps
10118 @itemx -falign-jumps=@var{n}
10119 @itemx -falign-jumps=@var{n}:@var{m}
10120 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10121 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10122 @opindex falign-jumps
10123 Align branch targets to a power-of-two boundary, for branch targets
10124 where the targets can only be reached by jumping. In this case,
10125 no dummy operations need be executed.
10126
10127 Parameters of this option are analogous to the @option{-falign-functions} option.
10128 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10129 equivalent and mean that loops are not aligned.
10130
10131 If @var{n} is not specified or is zero, use a machine-dependent default.
10132 The maximum allowed @var{n} option value is 65536.
10133
10134 Enabled at levels @option{-O2}, @option{-O3}.
10135
10136 @item -funit-at-a-time
10137 @opindex funit-at-a-time
10138 This option is left for compatibility reasons. @option{-funit-at-a-time}
10139 has no effect, while @option{-fno-unit-at-a-time} implies
10140 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10141
10142 Enabled by default.
10143
10144 @item -fno-toplevel-reorder
10145 @opindex fno-toplevel-reorder
10146 @opindex ftoplevel-reorder
10147 Do not reorder top-level functions, variables, and @code{asm}
10148 statements. Output them in the same order that they appear in the
10149 input file. When this option is used, unreferenced static variables
10150 are not removed. This option is intended to support existing code
10151 that relies on a particular ordering. For new code, it is better to
10152 use attributes when possible.
10153
10154 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10155 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10156 Additionally @option{-fno-toplevel-reorder} implies
10157 @option{-fno-section-anchors}.
10158
10159 @item -fweb
10160 @opindex fweb
10161 Constructs webs as commonly used for register allocation purposes and assign
10162 each web individual pseudo register. This allows the register allocation pass
10163 to operate on pseudos directly, but also strengthens several other optimization
10164 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10165 however, make debugging impossible, since variables no longer stay in a
10166 ``home register''.
10167
10168 Enabled by default with @option{-funroll-loops}.
10169
10170 @item -fwhole-program
10171 @opindex fwhole-program
10172 Assume that the current compilation unit represents the whole program being
10173 compiled. All public functions and variables with the exception of @code{main}
10174 and those merged by attribute @code{externally_visible} become static functions
10175 and in effect are optimized more aggressively by interprocedural optimizers.
10176
10177 This option should not be used in combination with @option{-flto}.
10178 Instead relying on a linker plugin should provide safer and more precise
10179 information.
10180
10181 @item -flto[=@var{n}]
10182 @opindex flto
10183 This option runs the standard link-time optimizer. When invoked
10184 with source code, it generates GIMPLE (one of GCC's internal
10185 representations) and writes it to special ELF sections in the object
10186 file. When the object files are linked together, all the function
10187 bodies are read from these ELF sections and instantiated as if they
10188 had been part of the same translation unit.
10189
10190 To use the link-time optimizer, @option{-flto} and optimization
10191 options should be specified at compile time and during the final link.
10192 It is recommended that you compile all the files participating in the
10193 same link with the same options and also specify those options at
10194 link time.
10195 For example:
10196
10197 @smallexample
10198 gcc -c -O2 -flto foo.c
10199 gcc -c -O2 -flto bar.c
10200 gcc -o myprog -flto -O2 foo.o bar.o
10201 @end smallexample
10202
10203 The first two invocations to GCC save a bytecode representation
10204 of GIMPLE into special ELF sections inside @file{foo.o} and
10205 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10206 @file{foo.o} and @file{bar.o}, merges the two files into a single
10207 internal image, and compiles the result as usual. Since both
10208 @file{foo.o} and @file{bar.o} are merged into a single image, this
10209 causes all the interprocedural analyses and optimizations in GCC to
10210 work across the two files as if they were a single one. This means,
10211 for example, that the inliner is able to inline functions in
10212 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10213
10214 Another (simpler) way to enable link-time optimization is:
10215
10216 @smallexample
10217 gcc -o myprog -flto -O2 foo.c bar.c
10218 @end smallexample
10219
10220 The above generates bytecode for @file{foo.c} and @file{bar.c},
10221 merges them together into a single GIMPLE representation and optimizes
10222 them as usual to produce @file{myprog}.
10223
10224 The important thing to keep in mind is that to enable link-time
10225 optimizations you need to use the GCC driver to perform the link step.
10226 GCC automatically performs link-time optimization if any of the
10227 objects involved were compiled with the @option{-flto} command-line option.
10228 You can always override
10229 the automatic decision to do link-time optimization
10230 by passing @option{-fno-lto} to the link command.
10231
10232 To make whole program optimization effective, it is necessary to make
10233 certain whole program assumptions. The compiler needs to know
10234 what functions and variables can be accessed by libraries and runtime
10235 outside of the link-time optimized unit. When supported by the linker,
10236 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10237 to the compiler about used and externally visible symbols. When
10238 the linker plugin is not available, @option{-fwhole-program} should be
10239 used to allow the compiler to make these assumptions, which leads
10240 to more aggressive optimization decisions.
10241
10242 When a file is compiled with @option{-flto} without
10243 @option{-fuse-linker-plugin}, the generated object file is larger than
10244 a regular object file because it contains GIMPLE bytecodes and the usual
10245 final code (see @option{-ffat-lto-objects}. This means that
10246 object files with LTO information can be linked as normal object
10247 files; if @option{-fno-lto} is passed to the linker, no
10248 interprocedural optimizations are applied. Note that when
10249 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10250 but you cannot perform a regular, non-LTO link on them.
10251
10252 When producing the final binary, GCC only
10253 applies link-time optimizations to those files that contain bytecode.
10254 Therefore, you can mix and match object files and libraries with
10255 GIMPLE bytecodes and final object code. GCC automatically selects
10256 which files to optimize in LTO mode and which files to link without
10257 further processing.
10258
10259 Generally, options specified at link time override those
10260 specified at compile time, although in some cases GCC attempts to infer
10261 link-time options from the settings used to compile the input files.
10262
10263 If you do not specify an optimization level option @option{-O} at
10264 link time, then GCC uses the highest optimization level
10265 used when compiling the object files. Note that it is generally
10266 ineffective to specify an optimization level option only at link time and
10267 not at compile time, for two reasons. First, compiling without
10268 optimization suppresses compiler passes that gather information
10269 needed for effective optimization at link time. Second, some early
10270 optimization passes can be performed only at compile time and
10271 not at link time.
10272
10273 There are some code generation flags preserved by GCC when
10274 generating bytecodes, as they need to be used during the final link.
10275 Currently, the following options and their settings are taken from
10276 the first object file that explicitly specifies them:
10277 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10278 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10279 and all the @option{-m} target flags.
10280
10281 Certain ABI-changing flags are required to match in all compilation units,
10282 and trying to override this at link time with a conflicting value
10283 is ignored. This includes options such as @option{-freg-struct-return}
10284 and @option{-fpcc-struct-return}.
10285
10286 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10287 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10288 are passed through to the link stage and merged conservatively for
10289 conflicting translation units. Specifically
10290 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10291 precedence; and for example @option{-ffp-contract=off} takes precedence
10292 over @option{-ffp-contract=fast}. You can override them at link time.
10293
10294 If LTO encounters objects with C linkage declared with incompatible
10295 types in separate translation units to be linked together (undefined
10296 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10297 issued. The behavior is still undefined at run time. Similar
10298 diagnostics may be raised for other languages.
10299
10300 Another feature of LTO is that it is possible to apply interprocedural
10301 optimizations on files written in different languages:
10302
10303 @smallexample
10304 gcc -c -flto foo.c
10305 g++ -c -flto bar.cc
10306 gfortran -c -flto baz.f90
10307 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10308 @end smallexample
10309
10310 Notice that the final link is done with @command{g++} to get the C++
10311 runtime libraries and @option{-lgfortran} is added to get the Fortran
10312 runtime libraries. In general, when mixing languages in LTO mode, you
10313 should use the same link command options as when mixing languages in a
10314 regular (non-LTO) compilation.
10315
10316 If object files containing GIMPLE bytecode are stored in a library archive, say
10317 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10318 are using a linker with plugin support. To create static libraries suitable
10319 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10320 and @command{ranlib};
10321 to show the symbols of object files with GIMPLE bytecode, use
10322 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10323 and @command{nm} have been compiled with plugin support. At link time, use the
10324 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10325 the LTO optimization process:
10326
10327 @smallexample
10328 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10329 @end smallexample
10330
10331 With the linker plugin enabled, the linker extracts the needed
10332 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10333 to make them part of the aggregated GIMPLE image to be optimized.
10334
10335 If you are not using a linker with plugin support and/or do not
10336 enable the linker plugin, then the objects inside @file{libfoo.a}
10337 are extracted and linked as usual, but they do not participate
10338 in the LTO optimization process. In order to make a static library suitable
10339 for both LTO optimization and usual linkage, compile its object files with
10340 @option{-flto} @option{-ffat-lto-objects}.
10341
10342 Link-time optimizations do not require the presence of the whole program to
10343 operate. If the program does not require any symbols to be exported, it is
10344 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10345 the interprocedural optimizers to use more aggressive assumptions which may
10346 lead to improved optimization opportunities.
10347 Use of @option{-fwhole-program} is not needed when linker plugin is
10348 active (see @option{-fuse-linker-plugin}).
10349
10350 The current implementation of LTO makes no
10351 attempt to generate bytecode that is portable between different
10352 types of hosts. The bytecode files are versioned and there is a
10353 strict version check, so bytecode files generated in one version of
10354 GCC do not work with an older or newer version of GCC.
10355
10356 Link-time optimization does not work well with generation of debugging
10357 information on systems other than those using a combination of ELF and
10358 DWARF.
10359
10360 If you specify the optional @var{n}, the optimization and code
10361 generation done at link time is executed in parallel using @var{n}
10362 parallel jobs by utilizing an installed @command{make} program. The
10363 environment variable @env{MAKE} may be used to override the program
10364 used. The default value for @var{n} is 1.
10365
10366 You can also specify @option{-flto=jobserver} to use GNU make's
10367 job server mode to determine the number of parallel jobs. This
10368 is useful when the Makefile calling GCC is already executing in parallel.
10369 You must prepend a @samp{+} to the command recipe in the parent Makefile
10370 for this to work. This option likely only works if @env{MAKE} is
10371 GNU make.
10372
10373 @item -flto-partition=@var{alg}
10374 @opindex flto-partition
10375 Specify the partitioning algorithm used by the link-time optimizer.
10376 The value is either @samp{1to1} to specify a partitioning mirroring
10377 the original source files or @samp{balanced} to specify partitioning
10378 into equally sized chunks (whenever possible) or @samp{max} to create
10379 new partition for every symbol where possible. Specifying @samp{none}
10380 as an algorithm disables partitioning and streaming completely.
10381 The default value is @samp{balanced}. While @samp{1to1} can be used
10382 as an workaround for various code ordering issues, the @samp{max}
10383 partitioning is intended for internal testing only.
10384 The value @samp{one} specifies that exactly one partition should be
10385 used while the value @samp{none} bypasses partitioning and executes
10386 the link-time optimization step directly from the WPA phase.
10387
10388 @item -flto-compression-level=@var{n}
10389 @opindex flto-compression-level
10390 This option specifies the level of compression used for intermediate
10391 language written to LTO object files, and is only meaningful in
10392 conjunction with LTO mode (@option{-flto}). Valid
10393 values are 0 (no compression) to 9 (maximum compression). Values
10394 outside this range are clamped to either 0 or 9. If the option is not
10395 given, a default balanced compression setting is used.
10396
10397 @item -fuse-linker-plugin
10398 @opindex fuse-linker-plugin
10399 Enables the use of a linker plugin during link-time optimization. This
10400 option relies on plugin support in the linker, which is available in gold
10401 or in GNU ld 2.21 or newer.
10402
10403 This option enables the extraction of object files with GIMPLE bytecode out
10404 of library archives. This improves the quality of optimization by exposing
10405 more code to the link-time optimizer. This information specifies what
10406 symbols can be accessed externally (by non-LTO object or during dynamic
10407 linking). Resulting code quality improvements on binaries (and shared
10408 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10409 See @option{-flto} for a description of the effect of this flag and how to
10410 use it.
10411
10412 This option is enabled by default when LTO support in GCC is enabled
10413 and GCC was configured for use with
10414 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10415
10416 @item -ffat-lto-objects
10417 @opindex ffat-lto-objects
10418 Fat LTO objects are object files that contain both the intermediate language
10419 and the object code. This makes them usable for both LTO linking and normal
10420 linking. This option is effective only when compiling with @option{-flto}
10421 and is ignored at link time.
10422
10423 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10424 requires the complete toolchain to be aware of LTO. It requires a linker with
10425 linker plugin support for basic functionality. Additionally,
10426 @command{nm}, @command{ar} and @command{ranlib}
10427 need to support linker plugins to allow a full-featured build environment
10428 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10429 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10430 to these tools. With non fat LTO makefiles need to be modified to use them.
10431
10432 Note that modern binutils provide plugin auto-load mechanism.
10433 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10434 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10435 @command{gcc-ranlib}).
10436
10437 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10438 support.
10439
10440 @item -fcompare-elim
10441 @opindex fcompare-elim
10442 After register allocation and post-register allocation instruction splitting,
10443 identify arithmetic instructions that compute processor flags similar to a
10444 comparison operation based on that arithmetic. If possible, eliminate the
10445 explicit comparison operation.
10446
10447 This pass only applies to certain targets that cannot explicitly represent
10448 the comparison operation before register allocation is complete.
10449
10450 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10451
10452 @item -fcprop-registers
10453 @opindex fcprop-registers
10454 After register allocation and post-register allocation instruction splitting,
10455 perform a copy-propagation pass to try to reduce scheduling dependencies
10456 and occasionally eliminate the copy.
10457
10458 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10459
10460 @item -fprofile-correction
10461 @opindex fprofile-correction
10462 Profiles collected using an instrumented binary for multi-threaded programs may
10463 be inconsistent due to missed counter updates. When this option is specified,
10464 GCC uses heuristics to correct or smooth out such inconsistencies. By
10465 default, GCC emits an error message when an inconsistent profile is detected.
10466
10467 This option is enabled by @option{-fauto-profile}.
10468
10469 @item -fprofile-use
10470 @itemx -fprofile-use=@var{path}
10471 @opindex fprofile-use
10472 Enable profile feedback-directed optimizations,
10473 and the following optimizations, many of which
10474 are generally profitable only with profile feedback available:
10475
10476 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10477 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10478 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10479 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10480 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10481 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10482 -fprofile-reorder-functions}
10483
10484 Before you can use this option, you must first generate profiling information.
10485 @xref{Instrumentation Options}, for information about the
10486 @option{-fprofile-generate} option.
10487
10488 By default, GCC emits an error message if the feedback profiles do not
10489 match the source code. This error can be turned into a warning by using
10490 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10491 optimized code. Additionally, by default, GCC also emits a warning message if
10492 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10493
10494 If @var{path} is specified, GCC looks at the @var{path} to find
10495 the profile feedback data files. See @option{-fprofile-dir}.
10496
10497 @item -fauto-profile
10498 @itemx -fauto-profile=@var{path}
10499 @opindex fauto-profile
10500 Enable sampling-based feedback-directed optimizations,
10501 and the following optimizations,
10502 many of which are generally profitable only with profile feedback available:
10503
10504 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10505 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10506 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10507 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10508 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10509 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10510 -fprofile-correction}
10511
10512 @var{path} is the name of a file containing AutoFDO profile information.
10513 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10514
10515 Producing an AutoFDO profile data file requires running your program
10516 with the @command{perf} utility on a supported GNU/Linux target system.
10517 For more information, see @uref{https://perf.wiki.kernel.org/}.
10518
10519 E.g.
10520 @smallexample
10521 perf record -e br_inst_retired:near_taken -b -o perf.data \
10522 -- your_program
10523 @end smallexample
10524
10525 Then use the @command{create_gcov} tool to convert the raw profile data
10526 to a format that can be used by GCC.@ You must also supply the
10527 unstripped binary for your program to this tool.
10528 See @uref{https://github.com/google/autofdo}.
10529
10530 E.g.
10531 @smallexample
10532 create_gcov --binary=your_program.unstripped --profile=perf.data \
10533 --gcov=profile.afdo
10534 @end smallexample
10535 @end table
10536
10537 The following options control compiler behavior regarding floating-point
10538 arithmetic. These options trade off between speed and
10539 correctness. All must be specifically enabled.
10540
10541 @table @gcctabopt
10542 @item -ffloat-store
10543 @opindex ffloat-store
10544 Do not store floating-point variables in registers, and inhibit other
10545 options that might change whether a floating-point value is taken from a
10546 register or memory.
10547
10548 @cindex floating-point precision
10549 This option prevents undesirable excess precision on machines such as
10550 the 68000 where the floating registers (of the 68881) keep more
10551 precision than a @code{double} is supposed to have. Similarly for the
10552 x86 architecture. For most programs, the excess precision does only
10553 good, but a few programs rely on the precise definition of IEEE floating
10554 point. Use @option{-ffloat-store} for such programs, after modifying
10555 them to store all pertinent intermediate computations into variables.
10556
10557 @item -fexcess-precision=@var{style}
10558 @opindex fexcess-precision
10559 This option allows further control over excess precision on machines
10560 where floating-point operations occur in a format with more precision or
10561 range than the IEEE standard and interchange floating-point types. By
10562 default, @option{-fexcess-precision=fast} is in effect; this means that
10563 operations may be carried out in a wider precision than the types specified
10564 in the source if that would result in faster code, and it is unpredictable
10565 when rounding to the types specified in the source code takes place.
10566 When compiling C, if @option{-fexcess-precision=standard} is specified then
10567 excess precision follows the rules specified in ISO C99; in particular,
10568 both casts and assignments cause values to be rounded to their
10569 semantic types (whereas @option{-ffloat-store} only affects
10570 assignments). This option is enabled by default for C if a strict
10571 conformance option such as @option{-std=c99} is used.
10572 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10573 regardless of whether a strict conformance option is used.
10574
10575 @opindex mfpmath
10576 @option{-fexcess-precision=standard} is not implemented for languages
10577 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10578 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10579 semantics apply without excess precision, and in the latter, rounding
10580 is unpredictable.
10581
10582 @item -ffast-math
10583 @opindex ffast-math
10584 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10585 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10586 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10587 @option{-fexcess-precision=fast}.
10588
10589 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10590
10591 This option is not turned on by any @option{-O} option besides
10592 @option{-Ofast} since it can result in incorrect output for programs
10593 that depend on an exact implementation of IEEE or ISO rules/specifications
10594 for math functions. It may, however, yield faster code for programs
10595 that do not require the guarantees of these specifications.
10596
10597 @item -fno-math-errno
10598 @opindex fno-math-errno
10599 @opindex fmath-errno
10600 Do not set @code{errno} after calling math functions that are executed
10601 with a single instruction, e.g., @code{sqrt}. A program that relies on
10602 IEEE exceptions for math error handling may want to use this flag
10603 for speed while maintaining IEEE arithmetic compatibility.
10604
10605 This option is not turned on by any @option{-O} option since
10606 it can result in incorrect output for programs that depend on
10607 an exact implementation of IEEE or ISO rules/specifications for
10608 math functions. It may, however, yield faster code for programs
10609 that do not require the guarantees of these specifications.
10610
10611 The default is @option{-fmath-errno}.
10612
10613 On Darwin systems, the math library never sets @code{errno}. There is
10614 therefore no reason for the compiler to consider the possibility that
10615 it might, and @option{-fno-math-errno} is the default.
10616
10617 @item -funsafe-math-optimizations
10618 @opindex funsafe-math-optimizations
10619
10620 Allow optimizations for floating-point arithmetic that (a) assume
10621 that arguments and results are valid and (b) may violate IEEE or
10622 ANSI standards. When used at link time, it may include libraries
10623 or startup files that change the default FPU control word or other
10624 similar optimizations.
10625
10626 This option is not turned on by any @option{-O} option since
10627 it can result in incorrect output for programs that depend on
10628 an exact implementation of IEEE or ISO rules/specifications for
10629 math functions. It may, however, yield faster code for programs
10630 that do not require the guarantees of these specifications.
10631 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10632 @option{-fassociative-math} and @option{-freciprocal-math}.
10633
10634 The default is @option{-fno-unsafe-math-optimizations}.
10635
10636 @item -fassociative-math
10637 @opindex fassociative-math
10638
10639 Allow re-association of operands in series of floating-point operations.
10640 This violates the ISO C and C++ language standard by possibly changing
10641 computation result. NOTE: re-ordering may change the sign of zero as
10642 well as ignore NaNs and inhibit or create underflow or overflow (and
10643 thus cannot be used on code that relies on rounding behavior like
10644 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10645 and thus may not be used when ordered comparisons are required.
10646 This option requires that both @option{-fno-signed-zeros} and
10647 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10648 much sense with @option{-frounding-math}. For Fortran the option
10649 is automatically enabled when both @option{-fno-signed-zeros} and
10650 @option{-fno-trapping-math} are in effect.
10651
10652 The default is @option{-fno-associative-math}.
10653
10654 @item -freciprocal-math
10655 @opindex freciprocal-math
10656
10657 Allow the reciprocal of a value to be used instead of dividing by
10658 the value if this enables optimizations. For example @code{x / y}
10659 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10660 is subject to common subexpression elimination. Note that this loses
10661 precision and increases the number of flops operating on the value.
10662
10663 The default is @option{-fno-reciprocal-math}.
10664
10665 @item -ffinite-math-only
10666 @opindex ffinite-math-only
10667 Allow optimizations for floating-point arithmetic that assume
10668 that arguments and results are not NaNs or +-Infs.
10669
10670 This option is not turned on by any @option{-O} option since
10671 it can result in incorrect output for programs that depend on
10672 an exact implementation of IEEE or ISO rules/specifications for
10673 math functions. It may, however, yield faster code for programs
10674 that do not require the guarantees of these specifications.
10675
10676 The default is @option{-fno-finite-math-only}.
10677
10678 @item -fno-signed-zeros
10679 @opindex fno-signed-zeros
10680 @opindex fsigned-zeros
10681 Allow optimizations for floating-point arithmetic that ignore the
10682 signedness of zero. IEEE arithmetic specifies the behavior of
10683 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10684 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10685 This option implies that the sign of a zero result isn't significant.
10686
10687 The default is @option{-fsigned-zeros}.
10688
10689 @item -fno-trapping-math
10690 @opindex fno-trapping-math
10691 @opindex ftrapping-math
10692 Compile code assuming that floating-point operations cannot generate
10693 user-visible traps. These traps include division by zero, overflow,
10694 underflow, inexact result and invalid operation. This option requires
10695 that @option{-fno-signaling-nans} be in effect. Setting this option may
10696 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10697
10698 This option should never be turned on by any @option{-O} option since
10699 it can result in incorrect output for programs that depend on
10700 an exact implementation of IEEE or ISO rules/specifications for
10701 math functions.
10702
10703 The default is @option{-ftrapping-math}.
10704
10705 @item -frounding-math
10706 @opindex frounding-math
10707 Disable transformations and optimizations that assume default floating-point
10708 rounding behavior. This is round-to-zero for all floating point
10709 to integer conversions, and round-to-nearest for all other arithmetic
10710 truncations. This option should be specified for programs that change
10711 the FP rounding mode dynamically, or that may be executed with a
10712 non-default rounding mode. This option disables constant folding of
10713 floating-point expressions at compile time (which may be affected by
10714 rounding mode) and arithmetic transformations that are unsafe in the
10715 presence of sign-dependent rounding modes.
10716
10717 The default is @option{-fno-rounding-math}.
10718
10719 This option is experimental and does not currently guarantee to
10720 disable all GCC optimizations that are affected by rounding mode.
10721 Future versions of GCC may provide finer control of this setting
10722 using C99's @code{FENV_ACCESS} pragma. This command-line option
10723 will be used to specify the default state for @code{FENV_ACCESS}.
10724
10725 @item -fsignaling-nans
10726 @opindex fsignaling-nans
10727 Compile code assuming that IEEE signaling NaNs may generate user-visible
10728 traps during floating-point operations. Setting this option disables
10729 optimizations that may change the number of exceptions visible with
10730 signaling NaNs. This option implies @option{-ftrapping-math}.
10731
10732 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10733 be defined.
10734
10735 The default is @option{-fno-signaling-nans}.
10736
10737 This option is experimental and does not currently guarantee to
10738 disable all GCC optimizations that affect signaling NaN behavior.
10739
10740 @item -fno-fp-int-builtin-inexact
10741 @opindex fno-fp-int-builtin-inexact
10742 @opindex ffp-int-builtin-inexact
10743 Do not allow the built-in functions @code{ceil}, @code{floor},
10744 @code{round} and @code{trunc}, and their @code{float} and @code{long
10745 double} variants, to generate code that raises the ``inexact''
10746 floating-point exception for noninteger arguments. ISO C99 and C11
10747 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10748 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10749 functions to do so.
10750
10751 The default is @option{-ffp-int-builtin-inexact}, allowing the
10752 exception to be raised. This option does nothing unless
10753 @option{-ftrapping-math} is in effect.
10754
10755 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10756 generate a call to a library function then the ``inexact'' exception
10757 may be raised if the library implementation does not follow TS 18661.
10758
10759 @item -fsingle-precision-constant
10760 @opindex fsingle-precision-constant
10761 Treat floating-point constants as single precision instead of
10762 implicitly converting them to double-precision constants.
10763
10764 @item -fcx-limited-range
10765 @opindex fcx-limited-range
10766 When enabled, this option states that a range reduction step is not
10767 needed when performing complex division. Also, there is no checking
10768 whether the result of a complex multiplication or division is @code{NaN
10769 + I*NaN}, with an attempt to rescue the situation in that case. The
10770 default is @option{-fno-cx-limited-range}, but is enabled by
10771 @option{-ffast-math}.
10772
10773 This option controls the default setting of the ISO C99
10774 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10775 all languages.
10776
10777 @item -fcx-fortran-rules
10778 @opindex fcx-fortran-rules
10779 Complex multiplication and division follow Fortran rules. Range
10780 reduction is done as part of complex division, but there is no checking
10781 whether the result of a complex multiplication or division is @code{NaN
10782 + I*NaN}, with an attempt to rescue the situation in that case.
10783
10784 The default is @option{-fno-cx-fortran-rules}.
10785
10786 @end table
10787
10788 The following options control optimizations that may improve
10789 performance, but are not enabled by any @option{-O} options. This
10790 section includes experimental options that may produce broken code.
10791
10792 @table @gcctabopt
10793 @item -fbranch-probabilities
10794 @opindex fbranch-probabilities
10795 After running a program compiled with @option{-fprofile-arcs}
10796 (@pxref{Instrumentation Options}),
10797 you can compile it a second time using
10798 @option{-fbranch-probabilities}, to improve optimizations based on
10799 the number of times each branch was taken. When a program
10800 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10801 counts to a file called @file{@var{sourcename}.gcda} for each source
10802 file. The information in this data file is very dependent on the
10803 structure of the generated code, so you must use the same source code
10804 and the same optimization options for both compilations.
10805
10806 With @option{-fbranch-probabilities}, GCC puts a
10807 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10808 These can be used to improve optimization. Currently, they are only
10809 used in one place: in @file{reorg.c}, instead of guessing which path a
10810 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10811 exactly determine which path is taken more often.
10812
10813 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10814
10815 @item -fprofile-values
10816 @opindex fprofile-values
10817 If combined with @option{-fprofile-arcs}, it adds code so that some
10818 data about values of expressions in the program is gathered.
10819
10820 With @option{-fbranch-probabilities}, it reads back the data gathered
10821 from profiling values of expressions for usage in optimizations.
10822
10823 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10824 @option{-fauto-profile}.
10825
10826 @item -fprofile-reorder-functions
10827 @opindex fprofile-reorder-functions
10828 Function reordering based on profile instrumentation collects
10829 first time of execution of a function and orders these functions
10830 in ascending order.
10831
10832 Enabled with @option{-fprofile-use}.
10833
10834 @item -fvpt
10835 @opindex fvpt
10836 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10837 to add code to gather information about values of expressions.
10838
10839 With @option{-fbranch-probabilities}, it reads back the data gathered
10840 and actually performs the optimizations based on them.
10841 Currently the optimizations include specialization of division operations
10842 using the knowledge about the value of the denominator.
10843
10844 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10845
10846 @item -frename-registers
10847 @opindex frename-registers
10848 Attempt to avoid false dependencies in scheduled code by making use
10849 of registers left over after register allocation. This optimization
10850 most benefits processors with lots of registers. Depending on the
10851 debug information format adopted by the target, however, it can
10852 make debugging impossible, since variables no longer stay in
10853 a ``home register''.
10854
10855 Enabled by default with @option{-funroll-loops}.
10856
10857 @item -fschedule-fusion
10858 @opindex fschedule-fusion
10859 Performs a target dependent pass over the instruction stream to schedule
10860 instructions of same type together because target machine can execute them
10861 more efficiently if they are adjacent to each other in the instruction flow.
10862
10863 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10864
10865 @item -ftracer
10866 @opindex ftracer
10867 Perform tail duplication to enlarge superblock size. This transformation
10868 simplifies the control flow of the function allowing other optimizations to do
10869 a better job.
10870
10871 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10872
10873 @item -funroll-loops
10874 @opindex funroll-loops
10875 Unroll loops whose number of iterations can be determined at compile time or
10876 upon entry to the loop. @option{-funroll-loops} implies
10877 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10878 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10879 a small constant number of iterations). This option makes code larger, and may
10880 or may not make it run faster.
10881
10882 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10883
10884 @item -funroll-all-loops
10885 @opindex funroll-all-loops
10886 Unroll all loops, even if their number of iterations is uncertain when
10887 the loop is entered. This usually makes programs run more slowly.
10888 @option{-funroll-all-loops} implies the same options as
10889 @option{-funroll-loops}.
10890
10891 @item -fpeel-loops
10892 @opindex fpeel-loops
10893 Peels loops for which there is enough information that they do not
10894 roll much (from profile feedback or static analysis). It also turns on
10895 complete loop peeling (i.e.@: complete removal of loops with small constant
10896 number of iterations).
10897
10898 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10899
10900 @item -fmove-loop-invariants
10901 @opindex fmove-loop-invariants
10902 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10903 at level @option{-O1} and higher, except for @option{-Og}.
10904
10905 @item -fsplit-loops
10906 @opindex fsplit-loops
10907 Split a loop into two if it contains a condition that's always true
10908 for one side of the iteration space and false for the other.
10909
10910 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10911
10912 @item -funswitch-loops
10913 @opindex funswitch-loops
10914 Move branches with loop invariant conditions out of the loop, with duplicates
10915 of the loop on both branches (modified according to result of the condition).
10916
10917 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10918
10919 @item -fversion-loops-for-strides
10920 @opindex fversion-loops-for-strides
10921 If a loop iterates over an array with a variable stride, create another
10922 version of the loop that assumes the stride is always one. For example:
10923
10924 @smallexample
10925 for (int i = 0; i < n; ++i)
10926 x[i * stride] = @dots{};
10927 @end smallexample
10928
10929 becomes:
10930
10931 @smallexample
10932 if (stride == 1)
10933 for (int i = 0; i < n; ++i)
10934 x[i] = @dots{};
10935 else
10936 for (int i = 0; i < n; ++i)
10937 x[i * stride] = @dots{};
10938 @end smallexample
10939
10940 This is particularly useful for assumed-shape arrays in Fortran where
10941 (for example) it allows better vectorization assuming contiguous accesses.
10942 This flag is enabled by default at @option{-O3}.
10943 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10944
10945 @item -ffunction-sections
10946 @itemx -fdata-sections
10947 @opindex ffunction-sections
10948 @opindex fdata-sections
10949 Place each function or data item into its own section in the output
10950 file if the target supports arbitrary sections. The name of the
10951 function or the name of the data item determines the section's name
10952 in the output file.
10953
10954 Use these options on systems where the linker can perform optimizations to
10955 improve locality of reference in the instruction space. Most systems using the
10956 ELF object format have linkers with such optimizations. On AIX, the linker
10957 rearranges sections (CSECTs) based on the call graph. The performance impact
10958 varies.
10959
10960 Together with a linker garbage collection (linker @option{--gc-sections}
10961 option) these options may lead to smaller statically-linked executables (after
10962 stripping).
10963
10964 On ELF/DWARF systems these options do not degenerate the quality of the debug
10965 information. There could be issues with other object files/debug info formats.
10966
10967 Only use these options when there are significant benefits from doing so. When
10968 you specify these options, the assembler and linker create larger object and
10969 executable files and are also slower. These options affect code generation.
10970 They prevent optimizations by the compiler and assembler using relative
10971 locations inside a translation unit since the locations are unknown until
10972 link time. An example of such an optimization is relaxing calls to short call
10973 instructions.
10974
10975 @item -fbranch-target-load-optimize
10976 @opindex fbranch-target-load-optimize
10977 Perform branch target register load optimization before prologue / epilogue
10978 threading.
10979 The use of target registers can typically be exposed only during reload,
10980 thus hoisting loads out of loops and doing inter-block scheduling needs
10981 a separate optimization pass.
10982
10983 @item -fbranch-target-load-optimize2
10984 @opindex fbranch-target-load-optimize2
10985 Perform branch target register load optimization after prologue / epilogue
10986 threading.
10987
10988 @item -fbtr-bb-exclusive
10989 @opindex fbtr-bb-exclusive
10990 When performing branch target register load optimization, don't reuse
10991 branch target registers within any basic block.
10992
10993 @item -fstdarg-opt
10994 @opindex fstdarg-opt
10995 Optimize the prologue of variadic argument functions with respect to usage of
10996 those arguments.
10997
10998 @item -fsection-anchors
10999 @opindex fsection-anchors
11000 Try to reduce the number of symbolic address calculations by using
11001 shared ``anchor'' symbols to address nearby objects. This transformation
11002 can help to reduce the number of GOT entries and GOT accesses on some
11003 targets.
11004
11005 For example, the implementation of the following function @code{foo}:
11006
11007 @smallexample
11008 static int a, b, c;
11009 int foo (void) @{ return a + b + c; @}
11010 @end smallexample
11011
11012 @noindent
11013 usually calculates the addresses of all three variables, but if you
11014 compile it with @option{-fsection-anchors}, it accesses the variables
11015 from a common anchor point instead. The effect is similar to the
11016 following pseudocode (which isn't valid C):
11017
11018 @smallexample
11019 int foo (void)
11020 @{
11021 register int *xr = &x;
11022 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11023 @}
11024 @end smallexample
11025
11026 Not all targets support this option.
11027
11028 @item --param @var{name}=@var{value}
11029 @opindex param
11030 In some places, GCC uses various constants to control the amount of
11031 optimization that is done. For example, GCC does not inline functions
11032 that contain more than a certain number of instructions. You can
11033 control some of these constants on the command line using the
11034 @option{--param} option.
11035
11036 The names of specific parameters, and the meaning of the values, are
11037 tied to the internals of the compiler, and are subject to change
11038 without notice in future releases.
11039
11040 In order to get minimal, maximal and default value of a parameter,
11041 one can use @option{--help=param -Q} options.
11042
11043 In each case, the @var{value} is an integer. The allowable choices for
11044 @var{name} are:
11045
11046 @table @gcctabopt
11047 @item predictable-branch-outcome
11048 When branch is predicted to be taken with probability lower than this threshold
11049 (in percent), then it is considered well predictable.
11050
11051 @item max-rtl-if-conversion-insns
11052 RTL if-conversion tries to remove conditional branches around a block and
11053 replace them with conditionally executed instructions. This parameter
11054 gives the maximum number of instructions in a block which should be
11055 considered for if-conversion. The compiler will
11056 also use other heuristics to decide whether if-conversion is likely to be
11057 profitable.
11058
11059 @item max-rtl-if-conversion-predictable-cost
11060 @itemx max-rtl-if-conversion-unpredictable-cost
11061 RTL if-conversion will try to remove conditional branches around a block
11062 and replace them with conditionally executed instructions. These parameters
11063 give the maximum permissible cost for the sequence that would be generated
11064 by if-conversion depending on whether the branch is statically determined
11065 to be predictable or not. The units for this parameter are the same as
11066 those for the GCC internal seq_cost metric. The compiler will try to
11067 provide a reasonable default for this parameter using the BRANCH_COST
11068 target macro.
11069
11070 @item max-crossjump-edges
11071 The maximum number of incoming edges to consider for cross-jumping.
11072 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11073 the number of edges incoming to each block. Increasing values mean
11074 more aggressive optimization, making the compilation time increase with
11075 probably small improvement in executable size.
11076
11077 @item min-crossjump-insns
11078 The minimum number of instructions that must be matched at the end
11079 of two blocks before cross-jumping is performed on them. This
11080 value is ignored in the case where all instructions in the block being
11081 cross-jumped from are matched.
11082
11083 @item max-grow-copy-bb-insns
11084 The maximum code size expansion factor when copying basic blocks
11085 instead of jumping. The expansion is relative to a jump instruction.
11086
11087 @item max-goto-duplication-insns
11088 The maximum number of instructions to duplicate to a block that jumps
11089 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11090 passes, GCC factors computed gotos early in the compilation process,
11091 and unfactors them as late as possible. Only computed jumps at the
11092 end of a basic blocks with no more than max-goto-duplication-insns are
11093 unfactored.
11094
11095 @item max-delay-slot-insn-search
11096 The maximum number of instructions to consider when looking for an
11097 instruction to fill a delay slot. If more than this arbitrary number of
11098 instructions are searched, the time savings from filling the delay slot
11099 are minimal, so stop searching. Increasing values mean more
11100 aggressive optimization, making the compilation time increase with probably
11101 small improvement in execution time.
11102
11103 @item max-delay-slot-live-search
11104 When trying to fill delay slots, the maximum number of instructions to
11105 consider when searching for a block with valid live register
11106 information. Increasing this arbitrarily chosen value means more
11107 aggressive optimization, increasing the compilation time. This parameter
11108 should be removed when the delay slot code is rewritten to maintain the
11109 control-flow graph.
11110
11111 @item max-gcse-memory
11112 The approximate maximum amount of memory that can be allocated in
11113 order to perform the global common subexpression elimination
11114 optimization. If more memory than specified is required, the
11115 optimization is not done.
11116
11117 @item max-gcse-insertion-ratio
11118 If the ratio of expression insertions to deletions is larger than this value
11119 for any expression, then RTL PRE inserts or removes the expression and thus
11120 leaves partially redundant computations in the instruction stream.
11121
11122 @item max-pending-list-length
11123 The maximum number of pending dependencies scheduling allows
11124 before flushing the current state and starting over. Large functions
11125 with few branches or calls can create excessively large lists which
11126 needlessly consume memory and resources.
11127
11128 @item max-modulo-backtrack-attempts
11129 The maximum number of backtrack attempts the scheduler should make
11130 when modulo scheduling a loop. Larger values can exponentially increase
11131 compilation time.
11132
11133 @item max-inline-insns-single
11134 Several parameters control the tree inliner used in GCC@.
11135 This number sets the maximum number of instructions (counted in GCC's
11136 internal representation) in a single function that the tree inliner
11137 considers for inlining. This only affects functions declared
11138 inline and methods implemented in a class declaration (C++).
11139
11140 @item max-inline-insns-auto
11141 When you use @option{-finline-functions} (included in @option{-O3}),
11142 a lot of functions that would otherwise not be considered for inlining
11143 by the compiler are investigated. To those functions, a different
11144 (more restrictive) limit compared to functions declared inline can
11145 be applied.
11146
11147 @item max-inline-insns-small
11148 This is bound applied to calls which are considered relevant with
11149 @option{-finline-small-functions}.
11150
11151 @item max-inline-insns-size
11152 This is bound applied to calls which are optimized for size. Small growth
11153 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11154
11155 @item uninlined-function-insns
11156 Number of instructions accounted by inliner for function overhead such as
11157 function prologue and epilogue.
11158
11159 @item uninlined-function-time
11160 Extra time accounted by inliner for function overhead such as time needed to
11161 execute function prologue and epilogue
11162
11163 @item uninlined-thunk-insns
11164 @item uninlined-thunk-time
11165 Same as @option{--param uninlined-function-insns} and
11166 @option{--param uninlined-function-time} but applied to function thunks
11167
11168 @item inline-min-speedup
11169 When estimated performance improvement of caller + callee runtime exceeds this
11170 threshold (in percent), the function can be inlined regardless of the limit on
11171 @option{--param max-inline-insns-single} and @option{--param
11172 max-inline-insns-auto}.
11173
11174 @item large-function-insns
11175 The limit specifying really large functions. For functions larger than this
11176 limit after inlining, inlining is constrained by
11177 @option{--param large-function-growth}. This parameter is useful primarily
11178 to avoid extreme compilation time caused by non-linear algorithms used by the
11179 back end.
11180
11181 @item large-function-growth
11182 Specifies maximal growth of large function caused by inlining in percents.
11183 For example, parameter value 100 limits large function growth to 2.0 times
11184 the original size.
11185
11186 @item large-unit-insns
11187 The limit specifying large translation unit. Growth caused by inlining of
11188 units larger than this limit is limited by @option{--param inline-unit-growth}.
11189 For small units this might be too tight.
11190 For example, consider a unit consisting of function A
11191 that is inline and B that just calls A three times. If B is small relative to
11192 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11193 large units consisting of small inlineable functions, however, the overall unit
11194 growth limit is needed to avoid exponential explosion of code size. Thus for
11195 smaller units, the size is increased to @option{--param large-unit-insns}
11196 before applying @option{--param inline-unit-growth}.
11197
11198 @item inline-unit-growth
11199 Specifies maximal overall growth of the compilation unit caused by inlining.
11200 For example, parameter value 20 limits unit growth to 1.2 times the original
11201 size. Cold functions (either marked cold via an attribute or by profile
11202 feedback) are not accounted into the unit size.
11203
11204 @item ipcp-unit-growth
11205 Specifies maximal overall growth of the compilation unit caused by
11206 interprocedural constant propagation. For example, parameter value 10 limits
11207 unit growth to 1.1 times the original size.
11208
11209 @item large-stack-frame
11210 The limit specifying large stack frames. While inlining the algorithm is trying
11211 to not grow past this limit too much.
11212
11213 @item large-stack-frame-growth
11214 Specifies maximal growth of large stack frames caused by inlining in percents.
11215 For example, parameter value 1000 limits large stack frame growth to 11 times
11216 the original size.
11217
11218 @item max-inline-insns-recursive
11219 @itemx max-inline-insns-recursive-auto
11220 Specifies the maximum number of instructions an out-of-line copy of a
11221 self-recursive inline
11222 function can grow into by performing recursive inlining.
11223
11224 @option{--param max-inline-insns-recursive} applies to functions
11225 declared inline.
11226 For functions not declared inline, recursive inlining
11227 happens only when @option{-finline-functions} (included in @option{-O3}) is
11228 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11229
11230 @item max-inline-recursive-depth
11231 @itemx max-inline-recursive-depth-auto
11232 Specifies the maximum recursion depth used for recursive inlining.
11233
11234 @option{--param max-inline-recursive-depth} applies to functions
11235 declared inline. For functions not declared inline, recursive inlining
11236 happens only when @option{-finline-functions} (included in @option{-O3}) is
11237 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11238
11239 @item min-inline-recursive-probability
11240 Recursive inlining is profitable only for function having deep recursion
11241 in average and can hurt for function having little recursion depth by
11242 increasing the prologue size or complexity of function body to other
11243 optimizers.
11244
11245 When profile feedback is available (see @option{-fprofile-generate}) the actual
11246 recursion depth can be guessed from the probability that function recurses
11247 via a given call expression. This parameter limits inlining only to call
11248 expressions whose probability exceeds the given threshold (in percents).
11249
11250 @item early-inlining-insns
11251 Specify growth that the early inliner can make. In effect it increases
11252 the amount of inlining for code having a large abstraction penalty.
11253
11254 @item max-early-inliner-iterations
11255 Limit of iterations of the early inliner. This basically bounds
11256 the number of nested indirect calls the early inliner can resolve.
11257 Deeper chains are still handled by late inlining.
11258
11259 @item comdat-sharing-probability
11260 Probability (in percent) that C++ inline function with comdat visibility
11261 are shared across multiple compilation units.
11262
11263 @item profile-func-internal-id
11264 A parameter to control whether to use function internal id in profile
11265 database lookup. If the value is 0, the compiler uses an id that
11266 is based on function assembler name and filename, which makes old profile
11267 data more tolerant to source changes such as function reordering etc.
11268
11269 @item min-vect-loop-bound
11270 The minimum number of iterations under which loops are not vectorized
11271 when @option{-ftree-vectorize} is used. The number of iterations after
11272 vectorization needs to be greater than the value specified by this option
11273 to allow vectorization.
11274
11275 @item gcse-cost-distance-ratio
11276 Scaling factor in calculation of maximum distance an expression
11277 can be moved by GCSE optimizations. This is currently supported only in the
11278 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11279 is with simple expressions, i.e., the expressions that have cost
11280 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11281 hoisting of simple expressions.
11282
11283 @item gcse-unrestricted-cost
11284 Cost, roughly measured as the cost of a single typical machine
11285 instruction, at which GCSE optimizations do not constrain
11286 the distance an expression can travel. This is currently
11287 supported only in the code hoisting pass. The lesser the cost,
11288 the more aggressive code hoisting is. Specifying 0
11289 allows all expressions to travel unrestricted distances.
11290
11291 @item max-hoist-depth
11292 The depth of search in the dominator tree for expressions to hoist.
11293 This is used to avoid quadratic behavior in hoisting algorithm.
11294 The value of 0 does not limit on the search, but may slow down compilation
11295 of huge functions.
11296
11297 @item max-tail-merge-comparisons
11298 The maximum amount of similar bbs to compare a bb with. This is used to
11299 avoid quadratic behavior in tree tail merging.
11300
11301 @item max-tail-merge-iterations
11302 The maximum amount of iterations of the pass over the function. This is used to
11303 limit compilation time in tree tail merging.
11304
11305 @item store-merging-allow-unaligned
11306 Allow the store merging pass to introduce unaligned stores if it is legal to
11307 do so.
11308
11309 @item max-stores-to-merge
11310 The maximum number of stores to attempt to merge into wider stores in the store
11311 merging pass.
11312
11313 @item max-unrolled-insns
11314 The maximum number of instructions that a loop may have to be unrolled.
11315 If a loop is unrolled, this parameter also determines how many times
11316 the loop code is unrolled.
11317
11318 @item max-average-unrolled-insns
11319 The maximum number of instructions biased by probabilities of their execution
11320 that a loop may have to be unrolled. If a loop is unrolled,
11321 this parameter also determines how many times the loop code is unrolled.
11322
11323 @item max-unroll-times
11324 The maximum number of unrollings of a single loop.
11325
11326 @item max-peeled-insns
11327 The maximum number of instructions that a loop may have to be peeled.
11328 If a loop is peeled, this parameter also determines how many times
11329 the loop code is peeled.
11330
11331 @item max-peel-times
11332 The maximum number of peelings of a single loop.
11333
11334 @item max-peel-branches
11335 The maximum number of branches on the hot path through the peeled sequence.
11336
11337 @item max-completely-peeled-insns
11338 The maximum number of insns of a completely peeled loop.
11339
11340 @item max-completely-peel-times
11341 The maximum number of iterations of a loop to be suitable for complete peeling.
11342
11343 @item max-completely-peel-loop-nest-depth
11344 The maximum depth of a loop nest suitable for complete peeling.
11345
11346 @item max-unswitch-insns
11347 The maximum number of insns of an unswitched loop.
11348
11349 @item max-unswitch-level
11350 The maximum number of branches unswitched in a single loop.
11351
11352 @item lim-expensive
11353 The minimum cost of an expensive expression in the loop invariant motion.
11354
11355 @item iv-consider-all-candidates-bound
11356 Bound on number of candidates for induction variables, below which
11357 all candidates are considered for each use in induction variable
11358 optimizations. If there are more candidates than this,
11359 only the most relevant ones are considered to avoid quadratic time complexity.
11360
11361 @item iv-max-considered-uses
11362 The induction variable optimizations give up on loops that contain more
11363 induction variable uses.
11364
11365 @item iv-always-prune-cand-set-bound
11366 If the number of candidates in the set is smaller than this value,
11367 always try to remove unnecessary ivs from the set
11368 when adding a new one.
11369
11370 @item avg-loop-niter
11371 Average number of iterations of a loop.
11372
11373 @item dse-max-object-size
11374 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11375 Larger values may result in larger compilation times.
11376
11377 @item dse-max-alias-queries-per-store
11378 Maximum number of queries into the alias oracle per store.
11379 Larger values result in larger compilation times and may result in more
11380 removed dead stores.
11381
11382 @item scev-max-expr-size
11383 Bound on size of expressions used in the scalar evolutions analyzer.
11384 Large expressions slow the analyzer.
11385
11386 @item scev-max-expr-complexity
11387 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11388 Complex expressions slow the analyzer.
11389
11390 @item max-tree-if-conversion-phi-args
11391 Maximum number of arguments in a PHI supported by TREE if conversion
11392 unless the loop is marked with simd pragma.
11393
11394 @item vect-max-version-for-alignment-checks
11395 The maximum number of run-time checks that can be performed when
11396 doing loop versioning for alignment in the vectorizer.
11397
11398 @item vect-max-version-for-alias-checks
11399 The maximum number of run-time checks that can be performed when
11400 doing loop versioning for alias in the vectorizer.
11401
11402 @item vect-max-peeling-for-alignment
11403 The maximum number of loop peels to enhance access alignment
11404 for vectorizer. Value -1 means no limit.
11405
11406 @item max-iterations-to-track
11407 The maximum number of iterations of a loop the brute-force algorithm
11408 for analysis of the number of iterations of the loop tries to evaluate.
11409
11410 @item hot-bb-count-ws-permille
11411 A basic block profile count is considered hot if it contributes to
11412 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
11413
11414 @item hot-bb-frequency-fraction
11415 Select fraction of the entry block frequency of executions of basic block in
11416 function given basic block needs to have to be considered hot.
11417
11418 @item max-predicted-iterations
11419 The maximum number of loop iterations we predict statically. This is useful
11420 in cases where a function contains a single loop with known bound and
11421 another loop with unknown bound.
11422 The known number of iterations is predicted correctly, while
11423 the unknown number of iterations average to roughly 10. This means that the
11424 loop without bounds appears artificially cold relative to the other one.
11425
11426 @item builtin-expect-probability
11427 Control the probability of the expression having the specified value. This
11428 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11429
11430 @item builtin-string-cmp-inline-length
11431 The maximum length of a constant string for a builtin string cmp call
11432 eligible for inlining.
11433
11434 @item align-threshold
11435
11436 Select fraction of the maximal frequency of executions of a basic block in
11437 a function to align the basic block.
11438
11439 @item align-loop-iterations
11440
11441 A loop expected to iterate at least the selected number of iterations is
11442 aligned.
11443
11444 @item tracer-dynamic-coverage
11445 @itemx tracer-dynamic-coverage-feedback
11446
11447 This value is used to limit superblock formation once the given percentage of
11448 executed instructions is covered. This limits unnecessary code size
11449 expansion.
11450
11451 The @option{tracer-dynamic-coverage-feedback} parameter
11452 is used only when profile
11453 feedback is available. The real profiles (as opposed to statically estimated
11454 ones) are much less balanced allowing the threshold to be larger value.
11455
11456 @item tracer-max-code-growth
11457 Stop tail duplication once code growth has reached given percentage. This is
11458 a rather artificial limit, as most of the duplicates are eliminated later in
11459 cross jumping, so it may be set to much higher values than is the desired code
11460 growth.
11461
11462 @item tracer-min-branch-ratio
11463
11464 Stop reverse growth when the reverse probability of best edge is less than this
11465 threshold (in percent).
11466
11467 @item tracer-min-branch-probability
11468 @itemx tracer-min-branch-probability-feedback
11469
11470 Stop forward growth if the best edge has probability lower than this
11471 threshold.
11472
11473 Similarly to @option{tracer-dynamic-coverage} two parameters are
11474 provided. @option{tracer-min-branch-probability-feedback} is used for
11475 compilation with profile feedback and @option{tracer-min-branch-probability}
11476 compilation without. The value for compilation with profile feedback
11477 needs to be more conservative (higher) in order to make tracer
11478 effective.
11479
11480 @item stack-clash-protection-guard-size
11481 Specify the size of the operating system provided stack guard as
11482 2 raised to @var{num} bytes. Higher values may reduce the
11483 number of explicit probes, but a value larger than the operating system
11484 provided guard will leave code vulnerable to stack clash style attacks.
11485
11486 @item stack-clash-protection-probe-interval
11487 Stack clash protection involves probing stack space as it is allocated. This
11488 param controls the maximum distance between probes into the stack as 2 raised
11489 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11490 larger than the operating system provided guard will leave code vulnerable to
11491 stack clash style attacks.
11492
11493 @item max-cse-path-length
11494
11495 The maximum number of basic blocks on path that CSE considers.
11496
11497 @item max-cse-insns
11498 The maximum number of instructions CSE processes before flushing.
11499
11500 @item ggc-min-expand
11501
11502 GCC uses a garbage collector to manage its own memory allocation. This
11503 parameter specifies the minimum percentage by which the garbage
11504 collector's heap should be allowed to expand between collections.
11505 Tuning this may improve compilation speed; it has no effect on code
11506 generation.
11507
11508 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11509 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11510 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11511 GCC is not able to calculate RAM on a particular platform, the lower
11512 bound of 30% is used. Setting this parameter and
11513 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11514 every opportunity. This is extremely slow, but can be useful for
11515 debugging.
11516
11517 @item ggc-min-heapsize
11518
11519 Minimum size of the garbage collector's heap before it begins bothering
11520 to collect garbage. The first collection occurs after the heap expands
11521 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11522 tuning this may improve compilation speed, and has no effect on code
11523 generation.
11524
11525 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11526 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11527 with a lower bound of 4096 (four megabytes) and an upper bound of
11528 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11529 particular platform, the lower bound is used. Setting this parameter
11530 very large effectively disables garbage collection. Setting this
11531 parameter and @option{ggc-min-expand} to zero causes a full collection
11532 to occur at every opportunity.
11533
11534 @item max-reload-search-insns
11535 The maximum number of instruction reload should look backward for equivalent
11536 register. Increasing values mean more aggressive optimization, making the
11537 compilation time increase with probably slightly better performance.
11538
11539 @item max-cselib-memory-locations
11540 The maximum number of memory locations cselib should take into account.
11541 Increasing values mean more aggressive optimization, making the compilation time
11542 increase with probably slightly better performance.
11543
11544 @item max-sched-ready-insns
11545 The maximum number of instructions ready to be issued the scheduler should
11546 consider at any given time during the first scheduling pass. Increasing
11547 values mean more thorough searches, making the compilation time increase
11548 with probably little benefit.
11549
11550 @item max-sched-region-blocks
11551 The maximum number of blocks in a region to be considered for
11552 interblock scheduling.
11553
11554 @item max-pipeline-region-blocks
11555 The maximum number of blocks in a region to be considered for
11556 pipelining in the selective scheduler.
11557
11558 @item max-sched-region-insns
11559 The maximum number of insns in a region to be considered for
11560 interblock scheduling.
11561
11562 @item max-pipeline-region-insns
11563 The maximum number of insns in a region to be considered for
11564 pipelining in the selective scheduler.
11565
11566 @item min-spec-prob
11567 The minimum probability (in percents) of reaching a source block
11568 for interblock speculative scheduling.
11569
11570 @item max-sched-extend-regions-iters
11571 The maximum number of iterations through CFG to extend regions.
11572 A value of 0 disables region extensions.
11573
11574 @item max-sched-insn-conflict-delay
11575 The maximum conflict delay for an insn to be considered for speculative motion.
11576
11577 @item sched-spec-prob-cutoff
11578 The minimal probability of speculation success (in percents), so that
11579 speculative insns are scheduled.
11580
11581 @item sched-state-edge-prob-cutoff
11582 The minimum probability an edge must have for the scheduler to save its
11583 state across it.
11584
11585 @item sched-mem-true-dep-cost
11586 Minimal distance (in CPU cycles) between store and load targeting same
11587 memory locations.
11588
11589 @item selsched-max-lookahead
11590 The maximum size of the lookahead window of selective scheduling. It is a
11591 depth of search for available instructions.
11592
11593 @item selsched-max-sched-times
11594 The maximum number of times that an instruction is scheduled during
11595 selective scheduling. This is the limit on the number of iterations
11596 through which the instruction may be pipelined.
11597
11598 @item selsched-insns-to-rename
11599 The maximum number of best instructions in the ready list that are considered
11600 for renaming in the selective scheduler.
11601
11602 @item sms-min-sc
11603 The minimum value of stage count that swing modulo scheduler
11604 generates.
11605
11606 @item max-last-value-rtl
11607 The maximum size measured as number of RTLs that can be recorded in an expression
11608 in combiner for a pseudo register as last known value of that register.
11609
11610 @item max-combine-insns
11611 The maximum number of instructions the RTL combiner tries to combine.
11612
11613 @item integer-share-limit
11614 Small integer constants can use a shared data structure, reducing the
11615 compiler's memory usage and increasing its speed. This sets the maximum
11616 value of a shared integer constant.
11617
11618 @item ssp-buffer-size
11619 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11620 protection when @option{-fstack-protection} is used.
11621
11622 @item min-size-for-stack-sharing
11623 The minimum size of variables taking part in stack slot sharing when not
11624 optimizing.
11625
11626 @item max-jump-thread-duplication-stmts
11627 Maximum number of statements allowed in a block that needs to be
11628 duplicated when threading jumps.
11629
11630 @item max-fields-for-field-sensitive
11631 Maximum number of fields in a structure treated in
11632 a field sensitive manner during pointer analysis.
11633
11634 @item prefetch-latency
11635 Estimate on average number of instructions that are executed before
11636 prefetch finishes. The distance prefetched ahead is proportional
11637 to this constant. Increasing this number may also lead to less
11638 streams being prefetched (see @option{simultaneous-prefetches}).
11639
11640 @item simultaneous-prefetches
11641 Maximum number of prefetches that can run at the same time.
11642
11643 @item l1-cache-line-size
11644 The size of cache line in L1 data cache, in bytes.
11645
11646 @item l1-cache-size
11647 The size of L1 data cache, in kilobytes.
11648
11649 @item l2-cache-size
11650 The size of L2 data cache, in kilobytes.
11651
11652 @item prefetch-dynamic-strides
11653 Whether the loop array prefetch pass should issue software prefetch hints
11654 for strides that are non-constant. In some cases this may be
11655 beneficial, though the fact the stride is non-constant may make it
11656 hard to predict when there is clear benefit to issuing these hints.
11657
11658 Set to 1 if the prefetch hints should be issued for non-constant
11659 strides. Set to 0 if prefetch hints should be issued only for strides that
11660 are known to be constant and below @option{prefetch-minimum-stride}.
11661
11662 @item prefetch-minimum-stride
11663 Minimum constant stride, in bytes, to start using prefetch hints for. If
11664 the stride is less than this threshold, prefetch hints will not be issued.
11665
11666 This setting is useful for processors that have hardware prefetchers, in
11667 which case there may be conflicts between the hardware prefetchers and
11668 the software prefetchers. If the hardware prefetchers have a maximum
11669 stride they can handle, it should be used here to improve the use of
11670 software prefetchers.
11671
11672 A value of -1 means we don't have a threshold and therefore
11673 prefetch hints can be issued for any constant stride.
11674
11675 This setting is only useful for strides that are known and constant.
11676
11677 @item loop-interchange-max-num-stmts
11678 The maximum number of stmts in a loop to be interchanged.
11679
11680 @item loop-interchange-stride-ratio
11681 The minimum ratio between stride of two loops for interchange to be profitable.
11682
11683 @item min-insn-to-prefetch-ratio
11684 The minimum ratio between the number of instructions and the
11685 number of prefetches to enable prefetching in a loop.
11686
11687 @item prefetch-min-insn-to-mem-ratio
11688 The minimum ratio between the number of instructions and the
11689 number of memory references to enable prefetching in a loop.
11690
11691 @item use-canonical-types
11692 Whether the compiler should use the ``canonical'' type system.
11693 Should always be 1, which uses a more efficient internal
11694 mechanism for comparing types in C++ and Objective-C++. However, if
11695 bugs in the canonical type system are causing compilation failures,
11696 set this value to 0 to disable canonical types.
11697
11698 @item switch-conversion-max-branch-ratio
11699 Switch initialization conversion refuses to create arrays that are
11700 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11701 branches in the switch.
11702
11703 @item max-partial-antic-length
11704 Maximum length of the partial antic set computed during the tree
11705 partial redundancy elimination optimization (@option{-ftree-pre}) when
11706 optimizing at @option{-O3} and above. For some sorts of source code
11707 the enhanced partial redundancy elimination optimization can run away,
11708 consuming all of the memory available on the host machine. This
11709 parameter sets a limit on the length of the sets that are computed,
11710 which prevents the runaway behavior. Setting a value of 0 for
11711 this parameter allows an unlimited set length.
11712
11713 @item rpo-vn-max-loop-depth
11714 Maximum loop depth that is value-numbered optimistically.
11715 When the limit hits the innermost
11716 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11717 loop nest are value-numbered optimistically and the remaining ones not.
11718
11719 @item sccvn-max-alias-queries-per-access
11720 Maximum number of alias-oracle queries we perform when looking for
11721 redundancies for loads and stores. If this limit is hit the search
11722 is aborted and the load or store is not considered redundant. The
11723 number of queries is algorithmically limited to the number of
11724 stores on all paths from the load to the function entry.
11725
11726 @item ira-max-loops-num
11727 IRA uses regional register allocation by default. If a function
11728 contains more loops than the number given by this parameter, only at most
11729 the given number of the most frequently-executed loops form regions
11730 for regional register allocation.
11731
11732 @item ira-max-conflict-table-size
11733 Although IRA uses a sophisticated algorithm to compress the conflict
11734 table, the table can still require excessive amounts of memory for
11735 huge functions. If the conflict table for a function could be more
11736 than the size in MB given by this parameter, the register allocator
11737 instead uses a faster, simpler, and lower-quality
11738 algorithm that does not require building a pseudo-register conflict table.
11739
11740 @item ira-loop-reserved-regs
11741 IRA can be used to evaluate more accurate register pressure in loops
11742 for decisions to move loop invariants (see @option{-O3}). The number
11743 of available registers reserved for some other purposes is given
11744 by this parameter. Default of the parameter
11745 is the best found from numerous experiments.
11746
11747 @item lra-inheritance-ebb-probability-cutoff
11748 LRA tries to reuse values reloaded in registers in subsequent insns.
11749 This optimization is called inheritance. EBB is used as a region to
11750 do this optimization. The parameter defines a minimal fall-through
11751 edge probability in percentage used to add BB to inheritance EBB in
11752 LRA. The default value was chosen
11753 from numerous runs of SPEC2000 on x86-64.
11754
11755 @item loop-invariant-max-bbs-in-loop
11756 Loop invariant motion can be very expensive, both in compilation time and
11757 in amount of needed compile-time memory, with very large loops. Loops
11758 with more basic blocks than this parameter won't have loop invariant
11759 motion optimization performed on them.
11760
11761 @item loop-max-datarefs-for-datadeps
11762 Building data dependencies is expensive for very large loops. This
11763 parameter limits the number of data references in loops that are
11764 considered for data dependence analysis. These large loops are no
11765 handled by the optimizations using loop data dependencies.
11766
11767 @item max-vartrack-size
11768 Sets a maximum number of hash table slots to use during variable
11769 tracking dataflow analysis of any function. If this limit is exceeded
11770 with variable tracking at assignments enabled, analysis for that
11771 function is retried without it, after removing all debug insns from
11772 the function. If the limit is exceeded even without debug insns, var
11773 tracking analysis is completely disabled for the function. Setting
11774 the parameter to zero makes it unlimited.
11775
11776 @item max-vartrack-expr-depth
11777 Sets a maximum number of recursion levels when attempting to map
11778 variable names or debug temporaries to value expressions. This trades
11779 compilation time for more complete debug information. If this is set too
11780 low, value expressions that are available and could be represented in
11781 debug information may end up not being used; setting this higher may
11782 enable the compiler to find more complex debug expressions, but compile
11783 time and memory use may grow.
11784
11785 @item max-debug-marker-count
11786 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11787 markers) to avoid complexity explosion at inlining or expanding to RTL.
11788 If a function has more such gimple stmts than the set limit, such stmts
11789 will be dropped from the inlined copy of a function, and from its RTL
11790 expansion.
11791
11792 @item min-nondebug-insn-uid
11793 Use uids starting at this parameter for nondebug insns. The range below
11794 the parameter is reserved exclusively for debug insns created by
11795 @option{-fvar-tracking-assignments}, but debug insns may get
11796 (non-overlapping) uids above it if the reserved range is exhausted.
11797
11798 @item ipa-sra-ptr-growth-factor
11799 IPA-SRA replaces a pointer to an aggregate with one or more new
11800 parameters only when their cumulative size is less or equal to
11801 @option{ipa-sra-ptr-growth-factor} times the size of the original
11802 pointer parameter.
11803
11804 @item sra-max-scalarization-size-Ospeed
11805 @itemx sra-max-scalarization-size-Osize
11806 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11807 replace scalar parts of aggregates with uses of independent scalar
11808 variables. These parameters control the maximum size, in storage units,
11809 of aggregate which is considered for replacement when compiling for
11810 speed
11811 (@option{sra-max-scalarization-size-Ospeed}) or size
11812 (@option{sra-max-scalarization-size-Osize}) respectively.
11813
11814 @item tm-max-aggregate-size
11815 When making copies of thread-local variables in a transaction, this
11816 parameter specifies the size in bytes after which variables are
11817 saved with the logging functions as opposed to save/restore code
11818 sequence pairs. This option only applies when using
11819 @option{-fgnu-tm}.
11820
11821 @item graphite-max-nb-scop-params
11822 To avoid exponential effects in the Graphite loop transforms, the
11823 number of parameters in a Static Control Part (SCoP) is bounded.
11824 A value of zero can be used to lift
11825 the bound. A variable whose value is unknown at compilation time and
11826 defined outside a SCoP is a parameter of the SCoP.
11827
11828 @item loop-block-tile-size
11829 Loop blocking or strip mining transforms, enabled with
11830 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11831 loop in the loop nest by a given number of iterations. The strip
11832 length can be changed using the @option{loop-block-tile-size}
11833 parameter.
11834
11835 @item ipa-cp-value-list-size
11836 IPA-CP attempts to track all possible values and types passed to a function's
11837 parameter in order to propagate them and perform devirtualization.
11838 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11839 stores per one formal parameter of a function.
11840
11841 @item ipa-cp-eval-threshold
11842 IPA-CP calculates its own score of cloning profitability heuristics
11843 and performs those cloning opportunities with scores that exceed
11844 @option{ipa-cp-eval-threshold}.
11845
11846 @item ipa-cp-recursion-penalty
11847 Percentage penalty the recursive functions will receive when they
11848 are evaluated for cloning.
11849
11850 @item ipa-cp-single-call-penalty
11851 Percentage penalty functions containing a single call to another
11852 function will receive when they are evaluated for cloning.
11853
11854 @item ipa-max-agg-items
11855 IPA-CP is also capable to propagate a number of scalar values passed
11856 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11857 number of such values per one parameter.
11858
11859 @item ipa-cp-loop-hint-bonus
11860 When IPA-CP determines that a cloning candidate would make the number
11861 of iterations of a loop known, it adds a bonus of
11862 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11863 the candidate.
11864
11865 @item ipa-cp-array-index-hint-bonus
11866 When IPA-CP determines that a cloning candidate would make the index of
11867 an array access known, it adds a bonus of
11868 @option{ipa-cp-array-index-hint-bonus} to the profitability
11869 score of the candidate.
11870
11871 @item ipa-max-aa-steps
11872 During its analysis of function bodies, IPA-CP employs alias analysis
11873 in order to track values pointed to by function parameters. In order
11874 not spend too much time analyzing huge functions, it gives up and
11875 consider all memory clobbered after examining
11876 @option{ipa-max-aa-steps} statements modifying memory.
11877
11878 @item lto-partitions
11879 Specify desired number of partitions produced during WHOPR compilation.
11880 The number of partitions should exceed the number of CPUs used for compilation.
11881
11882 @item lto-min-partition
11883 Size of minimal partition for WHOPR (in estimated instructions).
11884 This prevents expenses of splitting very small programs into too many
11885 partitions.
11886
11887 @item lto-max-partition
11888 Size of max partition for WHOPR (in estimated instructions).
11889 to provide an upper bound for individual size of partition.
11890 Meant to be used only with balanced partitioning.
11891
11892 @item lto-max-streaming-parallelism
11893 Maximal number of parallel processes used for LTO streaming.
11894
11895 @item cxx-max-namespaces-for-diagnostic-help
11896 The maximum number of namespaces to consult for suggestions when C++
11897 name lookup fails for an identifier.
11898
11899 @item sink-frequency-threshold
11900 The maximum relative execution frequency (in percents) of the target block
11901 relative to a statement's original block to allow statement sinking of a
11902 statement. Larger numbers result in more aggressive statement sinking.
11903 A small positive adjustment is applied for
11904 statements with memory operands as those are even more profitable so sink.
11905
11906 @item max-stores-to-sink
11907 The maximum number of conditional store pairs that can be sunk. Set to 0
11908 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11909 (@option{-ftree-loop-if-convert}) is disabled.
11910
11911 @item allow-store-data-races
11912 Allow optimizers to introduce new data races on stores.
11913 Set to 1 to allow, otherwise to 0.
11914
11915 @item case-values-threshold
11916 The smallest number of different values for which it is best to use a
11917 jump-table instead of a tree of conditional branches. If the value is
11918 0, use the default for the machine.
11919
11920 @item jump-table-max-growth-ratio-for-size
11921 The maximum code size growth ratio when expanding
11922 into a jump table (in percent). The parameter is used when
11923 optimizing for size.
11924
11925 @item jump-table-max-growth-ratio-for-speed
11926 The maximum code size growth ratio when expanding
11927 into a jump table (in percent). The parameter is used when
11928 optimizing for speed.
11929
11930 @item tree-reassoc-width
11931 Set the maximum number of instructions executed in parallel in
11932 reassociated tree. This parameter overrides target dependent
11933 heuristics used by default if has non zero value.
11934
11935 @item sched-pressure-algorithm
11936 Choose between the two available implementations of
11937 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11938 and is the more likely to prevent instructions from being reordered.
11939 Algorithm 2 was designed to be a compromise between the relatively
11940 conservative approach taken by algorithm 1 and the rather aggressive
11941 approach taken by the default scheduler. It relies more heavily on
11942 having a regular register file and accurate register pressure classes.
11943 See @file{haifa-sched.c} in the GCC sources for more details.
11944
11945 The default choice depends on the target.
11946
11947 @item max-slsr-cand-scan
11948 Set the maximum number of existing candidates that are considered when
11949 seeking a basis for a new straight-line strength reduction candidate.
11950
11951 @item asan-globals
11952 Enable buffer overflow detection for global objects. This kind
11953 of protection is enabled by default if you are using
11954 @option{-fsanitize=address} option.
11955 To disable global objects protection use @option{--param asan-globals=0}.
11956
11957 @item asan-stack
11958 Enable buffer overflow detection for stack objects. This kind of
11959 protection is enabled by default when using @option{-fsanitize=address}.
11960 To disable stack protection use @option{--param asan-stack=0} option.
11961
11962 @item asan-instrument-reads
11963 Enable buffer overflow detection for memory reads. This kind of
11964 protection is enabled by default when using @option{-fsanitize=address}.
11965 To disable memory reads protection use
11966 @option{--param asan-instrument-reads=0}.
11967
11968 @item asan-instrument-writes
11969 Enable buffer overflow detection for memory writes. This kind of
11970 protection is enabled by default when using @option{-fsanitize=address}.
11971 To disable memory writes protection use
11972 @option{--param asan-instrument-writes=0} option.
11973
11974 @item asan-memintrin
11975 Enable detection for built-in functions. This kind of protection
11976 is enabled by default when using @option{-fsanitize=address}.
11977 To disable built-in functions protection use
11978 @option{--param asan-memintrin=0}.
11979
11980 @item asan-use-after-return
11981 Enable detection of use-after-return. This kind of protection
11982 is enabled by default when using the @option{-fsanitize=address} option.
11983 To disable it use @option{--param asan-use-after-return=0}.
11984
11985 Note: By default the check is disabled at run time. To enable it,
11986 add @code{detect_stack_use_after_return=1} to the environment variable
11987 @env{ASAN_OPTIONS}.
11988
11989 @item asan-instrumentation-with-call-threshold
11990 If number of memory accesses in function being instrumented
11991 is greater or equal to this number, use callbacks instead of inline checks.
11992 E.g. to disable inline code use
11993 @option{--param asan-instrumentation-with-call-threshold=0}.
11994
11995 @item use-after-scope-direct-emission-threshold
11996 If the size of a local variable in bytes is smaller or equal to this
11997 number, directly poison (or unpoison) shadow memory instead of using
11998 run-time callbacks.
11999
12000 @item max-fsm-thread-path-insns
12001 Maximum number of instructions to copy when duplicating blocks on a
12002 finite state automaton jump thread path.
12003
12004 @item max-fsm-thread-length
12005 Maximum number of basic blocks on a finite state automaton jump thread
12006 path.
12007
12008 @item max-fsm-thread-paths
12009 Maximum number of new jump thread paths to create for a finite state
12010 automaton.
12011
12012 @item parloops-chunk-size
12013 Chunk size of omp schedule for loops parallelized by parloops.
12014
12015 @item parloops-schedule
12016 Schedule type of omp schedule for loops parallelized by parloops (static,
12017 dynamic, guided, auto, runtime).
12018
12019 @item parloops-min-per-thread
12020 The minimum number of iterations per thread of an innermost parallelized
12021 loop for which the parallelized variant is preferred over the single threaded
12022 one. Note that for a parallelized loop nest the
12023 minimum number of iterations of the outermost loop per thread is two.
12024
12025 @item max-ssa-name-query-depth
12026 Maximum depth of recursion when querying properties of SSA names in things
12027 like fold routines. One level of recursion corresponds to following a
12028 use-def chain.
12029
12030 @item hsa-gen-debug-stores
12031 Enable emission of special debug stores within HSA kernels which are
12032 then read and reported by libgomp plugin. Generation of these stores
12033 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12034 enable it.
12035
12036 @item max-speculative-devirt-maydefs
12037 The maximum number of may-defs we analyze when looking for a must-def
12038 specifying the dynamic type of an object that invokes a virtual call
12039 we may be able to devirtualize speculatively.
12040
12041 @item max-vrp-switch-assertions
12042 The maximum number of assertions to add along the default edge of a switch
12043 statement during VRP.
12044
12045 @item unroll-jam-min-percent
12046 The minimum percentage of memory references that must be optimized
12047 away for the unroll-and-jam transformation to be considered profitable.
12048
12049 @item unroll-jam-max-unroll
12050 The maximum number of times the outer loop should be unrolled by
12051 the unroll-and-jam transformation.
12052
12053 @item max-rtl-if-conversion-unpredictable-cost
12054 Maximum permissible cost for the sequence that would be generated
12055 by the RTL if-conversion pass for a branch that is considered unpredictable.
12056
12057 @item max-variable-expansions-in-unroller
12058 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12059 of times that an individual variable will be expanded during loop unrolling.
12060
12061 @item tracer-min-branch-probability-feedback
12062 Stop forward growth if the probability of best edge is less than
12063 this threshold (in percent). Used when profile feedback is available.
12064
12065 @item partial-inlining-entry-probability
12066 Maximum probability of the entry BB of split region
12067 (in percent relative to entry BB of the function)
12068 to make partial inlining happen.
12069
12070 @item max-tracked-strlens
12071 Maximum number of strings for which strlen optimization pass will
12072 track string lengths.
12073
12074 @item gcse-after-reload-partial-fraction
12075 The threshold ratio for performing partial redundancy
12076 elimination after reload.
12077
12078 @item gcse-after-reload-critical-fraction
12079 The threshold ratio of critical edges execution count that
12080 permit performing redundancy elimination after reload.
12081
12082 @item max-loop-header-insns
12083 The maximum number of insns in loop header duplicated
12084 by the copy loop headers pass.
12085
12086 @item vect-epilogues-nomask
12087 Enable loop epilogue vectorization using smaller vector size.
12088
12089 @item slp-max-insns-in-bb
12090 Maximum number of instructions in basic block to be
12091 considered for SLP vectorization.
12092
12093 @item avoid-fma-max-bits
12094 Maximum number of bits for which we avoid creating FMAs.
12095
12096 @item sms-loop-average-count-threshold
12097 A threshold on the average loop count considered by the swing modulo scheduler.
12098
12099 @item sms-dfa-history
12100 The number of cycles the swing modulo scheduler considers when checking
12101 conflicts using DFA.
12102
12103 @item hot-bb-count-fraction
12104 Select fraction of the maximal count of repetitions of basic block
12105 in program given basic block needs
12106 to have to be considered hot (used in non-LTO mode)
12107
12108 @item max-inline-insns-recursive-auto
12109 The maximum number of instructions non-inline function
12110 can grow to via recursive inlining.
12111
12112 @item graphite-allow-codegen-errors
12113 Whether codegen errors should be ICEs when @option{-fchecking}.
12114
12115 @item sms-max-ii-factor
12116 A factor for tuning the upper bound that swing modulo scheduler
12117 uses for scheduling a loop.
12118
12119 @item lra-max-considered-reload-pseudos
12120 The max number of reload pseudos which are considered during
12121 spilling a non-reload pseudo.
12122
12123 @item max-pow-sqrt-depth
12124 Maximum depth of sqrt chains to use when synthesizing exponentiation
12125 by a real constant.
12126
12127 @item max-dse-active-local-stores
12128 Maximum number of active local stores in RTL dead store elimination.
12129
12130 @item asan-instrument-allocas
12131 Enable asan allocas/VLAs protection.
12132
12133 @item max-iterations-computation-cost
12134 Bound on the cost of an expression to compute the number of iterations.
12135
12136 @item max-isl-operations
12137 Maximum number of isl operations, 0 means unlimited.
12138
12139 @item graphite-max-arrays-per-scop
12140 Maximum number of arrays per scop.
12141
12142 @item max-vartrack-reverse-op-size
12143 Max. size of loc list for which reverse ops should be added.
12144
12145 @item unlikely-bb-count-fraction
12146 The minimum fraction of profile runs a given basic block execution count
12147 must be not to be considered unlikely.
12148
12149 @item tracer-dynamic-coverage-feedback
12150 The percentage of function, weighted by execution frequency,
12151 that must be covered by trace formation.
12152 Used when profile feedback is available.
12153
12154 @item max-inline-recursive-depth-auto
12155 The maximum depth of recursive inlining for non-inline functions.
12156
12157 @item fsm-scale-path-stmts
12158 Scale factor to apply to the number of statements in a threading path
12159 when comparing to the number of (scaled) blocks.
12160
12161 @item fsm-maximum-phi-arguments
12162 Maximum number of arguments a PHI may have before the FSM threader
12163 will not try to thread through its block.
12164
12165 @item uninit-control-dep-attempts
12166 Maximum number of nested calls to search for control dependencies
12167 during uninitialized variable analysis.
12168
12169 @item max-once-peeled-insns
12170 The maximum number of insns of a peeled loop that rolls only once.
12171
12172 @item sra-max-scalarization-size-Osize
12173 Maximum size, in storage units, of an aggregate
12174 which should be considered for scalarization when compiling for size.
12175
12176 @item fsm-scale-path-blocks
12177 Scale factor to apply to the number of blocks in a threading path
12178 when comparing to the number of (scaled) statements.
12179
12180 @item sched-autopref-queue-depth
12181 Hardware autoprefetcher scheduler model control flag.
12182 Number of lookahead cycles the model looks into; at '
12183 ' only enable instruction sorting heuristic.
12184
12185 @item loop-versioning-max-inner-insns
12186 The maximum number of instructions that an inner loop can have
12187 before the loop versioning pass considers it too big to copy.
12188
12189 @item loop-versioning-max-outer-insns
12190 The maximum number of instructions that an outer loop can have
12191 before the loop versioning pass considers it too big to copy,
12192 discounting any instructions in inner loops that directly benefit
12193 from versioning.
12194
12195 @end table
12196 @end table
12197
12198 @node Instrumentation Options
12199 @section Program Instrumentation Options
12200 @cindex instrumentation options
12201 @cindex program instrumentation options
12202 @cindex run-time error checking options
12203 @cindex profiling options
12204 @cindex options, program instrumentation
12205 @cindex options, run-time error checking
12206 @cindex options, profiling
12207
12208 GCC supports a number of command-line options that control adding
12209 run-time instrumentation to the code it normally generates.
12210 For example, one purpose of instrumentation is collect profiling
12211 statistics for use in finding program hot spots, code coverage
12212 analysis, or profile-guided optimizations.
12213 Another class of program instrumentation is adding run-time checking
12214 to detect programming errors like invalid pointer
12215 dereferences or out-of-bounds array accesses, as well as deliberately
12216 hostile attacks such as stack smashing or C++ vtable hijacking.
12217 There is also a general hook which can be used to implement other
12218 forms of tracing or function-level instrumentation for debug or
12219 program analysis purposes.
12220
12221 @table @gcctabopt
12222 @cindex @command{prof}
12223 @cindex @command{gprof}
12224 @item -p
12225 @itemx -pg
12226 @opindex p
12227 @opindex pg
12228 Generate extra code to write profile information suitable for the
12229 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12230 (for @option{-pg}). You must use this option when compiling
12231 the source files you want data about, and you must also use it when
12232 linking.
12233
12234 You can use the function attribute @code{no_instrument_function} to
12235 suppress profiling of individual functions when compiling with these options.
12236 @xref{Common Function Attributes}.
12237
12238 @item -fprofile-arcs
12239 @opindex fprofile-arcs
12240 Add code so that program flow @dfn{arcs} are instrumented. During
12241 execution the program records how many times each branch and call is
12242 executed and how many times it is taken or returns. On targets that support
12243 constructors with priority support, profiling properly handles constructors,
12244 destructors and C++ constructors (and destructors) of classes which are used
12245 as a type of a global variable.
12246
12247 When the compiled
12248 program exits it saves this data to a file called
12249 @file{@var{auxname}.gcda} for each source file. The data may be used for
12250 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12251 test coverage analysis (@option{-ftest-coverage}). Each object file's
12252 @var{auxname} is generated from the name of the output file, if
12253 explicitly specified and it is not the final executable, otherwise it is
12254 the basename of the source file. In both cases any suffix is removed
12255 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12256 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12257 @xref{Cross-profiling}.
12258
12259 @cindex @command{gcov}
12260 @item --coverage
12261 @opindex coverage
12262
12263 This option is used to compile and link code instrumented for coverage
12264 analysis. The option is a synonym for @option{-fprofile-arcs}
12265 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12266 linking). See the documentation for those options for more details.
12267
12268 @itemize
12269
12270 @item
12271 Compile the source files with @option{-fprofile-arcs} plus optimization
12272 and code generation options. For test coverage analysis, use the
12273 additional @option{-ftest-coverage} option. You do not need to profile
12274 every source file in a program.
12275
12276 @item
12277 Compile the source files additionally with @option{-fprofile-abs-path}
12278 to create absolute path names in the @file{.gcno} files. This allows
12279 @command{gcov} to find the correct sources in projects where compilations
12280 occur with different working directories.
12281
12282 @item
12283 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12284 (the latter implies the former).
12285
12286 @item
12287 Run the program on a representative workload to generate the arc profile
12288 information. This may be repeated any number of times. You can run
12289 concurrent instances of your program, and provided that the file system
12290 supports locking, the data files will be correctly updated. Unless
12291 a strict ISO C dialect option is in effect, @code{fork} calls are
12292 detected and correctly handled without double counting.
12293
12294 @item
12295 For profile-directed optimizations, compile the source files again with
12296 the same optimization and code generation options plus
12297 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12298 Control Optimization}).
12299
12300 @item
12301 For test coverage analysis, use @command{gcov} to produce human readable
12302 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12303 @command{gcov} documentation for further information.
12304
12305 @end itemize
12306
12307 With @option{-fprofile-arcs}, for each function of your program GCC
12308 creates a program flow graph, then finds a spanning tree for the graph.
12309 Only arcs that are not on the spanning tree have to be instrumented: the
12310 compiler adds code to count the number of times that these arcs are
12311 executed. When an arc is the only exit or only entrance to a block, the
12312 instrumentation code can be added to the block; otherwise, a new basic
12313 block must be created to hold the instrumentation code.
12314
12315 @need 2000
12316 @item -ftest-coverage
12317 @opindex ftest-coverage
12318 Produce a notes file that the @command{gcov} code-coverage utility
12319 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12320 show program coverage. Each source file's note file is called
12321 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12322 above for a description of @var{auxname} and instructions on how to
12323 generate test coverage data. Coverage data matches the source files
12324 more closely if you do not optimize.
12325
12326 @item -fprofile-abs-path
12327 @opindex fprofile-abs-path
12328 Automatically convert relative source file names to absolute path names
12329 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12330 sources in projects where compilations occur with different working
12331 directories.
12332
12333 @item -fprofile-dir=@var{path}
12334 @opindex fprofile-dir
12335
12336 Set the directory to search for the profile data files in to @var{path}.
12337 This option affects only the profile data generated by
12338 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12339 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12340 and its related options. Both absolute and relative paths can be used.
12341 By default, GCC uses the current directory as @var{path}, thus the
12342 profile data file appears in the same directory as the object file.
12343 In order to prevent the file name clashing, if the object file name is
12344 not an absolute path, we mangle the absolute path of the
12345 @file{@var{sourcename}.gcda} file and use it as the file name of a
12346 @file{.gcda} file.
12347
12348 When an executable is run in a massive parallel environment, it is recommended
12349 to save profile to different folders. That can be done with variables
12350 in @var{path} that are exported during run-time:
12351
12352 @table @gcctabopt
12353
12354 @item %p
12355 process ID.
12356
12357 @item %q@{VAR@}
12358 value of environment variable @var{VAR}
12359
12360 @end table
12361
12362 @item -fprofile-generate
12363 @itemx -fprofile-generate=@var{path}
12364 @opindex fprofile-generate
12365
12366 Enable options usually used for instrumenting application to produce
12367 profile useful for later recompilation with profile feedback based
12368 optimization. You must use @option{-fprofile-generate} both when
12369 compiling and when linking your program.
12370
12371 The following options are enabled:
12372 @option{-fprofile-arcs}, @option{-fprofile-values},
12373 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12374
12375 If @var{path} is specified, GCC looks at the @var{path} to find
12376 the profile feedback data files. See @option{-fprofile-dir}.
12377
12378 To optimize the program based on the collected profile information, use
12379 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12380
12381 @item -fprofile-update=@var{method}
12382 @opindex fprofile-update
12383
12384 Alter the update method for an application instrumented for profile
12385 feedback based optimization. The @var{method} argument should be one of
12386 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12387 The first one is useful for single-threaded applications,
12388 while the second one prevents profile corruption by emitting thread-safe code.
12389
12390 @strong{Warning:} When an application does not properly join all threads
12391 (or creates an detached thread), a profile file can be still corrupted.
12392
12393 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12394 when supported by a target, or to @samp{single} otherwise. The GCC driver
12395 automatically selects @samp{prefer-atomic} when @option{-pthread}
12396 is present in the command line.
12397
12398 @item -fprofile-filter-files=@var{regex}
12399 @opindex fprofile-filter-files
12400
12401 Instrument only functions from files where names match
12402 any regular expression (separated by a semi-colon).
12403
12404 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12405 only @file{main.c} and all C files starting with 'module'.
12406
12407 @item -fprofile-exclude-files=@var{regex}
12408 @opindex fprofile-exclude-files
12409
12410 Instrument only functions from files where names do not match
12411 all the regular expressions (separated by a semi-colon).
12412
12413 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12414 of all files that are located in @file{/usr/} folder.
12415
12416 @item -fsanitize=address
12417 @opindex fsanitize=address
12418 Enable AddressSanitizer, a fast memory error detector.
12419 Memory access instructions are instrumented to detect
12420 out-of-bounds and use-after-free bugs.
12421 The option enables @option{-fsanitize-address-use-after-scope}.
12422 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12423 more details. The run-time behavior can be influenced using the
12424 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12425 the available options are shown at startup of the instrumented program. See
12426 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12427 for a list of supported options.
12428 The option cannot be combined with @option{-fsanitize=thread}.
12429
12430 @item -fsanitize=kernel-address
12431 @opindex fsanitize=kernel-address
12432 Enable AddressSanitizer for Linux kernel.
12433 See @uref{https://github.com/google/kasan/wiki} for more details.
12434
12435 @item -fsanitize=pointer-compare
12436 @opindex fsanitize=pointer-compare
12437 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12438 The option must be combined with either @option{-fsanitize=kernel-address} or
12439 @option{-fsanitize=address}
12440 The option cannot be combined with @option{-fsanitize=thread}.
12441 Note: By default the check is disabled at run time. To enable it,
12442 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12443 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12444 invalid operation only when both pointers are non-null.
12445
12446 @item -fsanitize=pointer-subtract
12447 @opindex fsanitize=pointer-subtract
12448 Instrument subtraction with pointer operands.
12449 The option must be combined with either @option{-fsanitize=kernel-address} or
12450 @option{-fsanitize=address}
12451 The option cannot be combined with @option{-fsanitize=thread}.
12452 Note: By default the check is disabled at run time. To enable it,
12453 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12454 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12455 invalid operation only when both pointers are non-null.
12456
12457 @item -fsanitize=thread
12458 @opindex fsanitize=thread
12459 Enable ThreadSanitizer, a fast data race detector.
12460 Memory access instructions are instrumented to detect
12461 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12462 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12463 environment variable; see
12464 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12465 supported options.
12466 The option cannot be combined with @option{-fsanitize=address},
12467 @option{-fsanitize=leak}.
12468
12469 Note that sanitized atomic builtins cannot throw exceptions when
12470 operating on invalid memory addresses with non-call exceptions
12471 (@option{-fnon-call-exceptions}).
12472
12473 @item -fsanitize=leak
12474 @opindex fsanitize=leak
12475 Enable LeakSanitizer, a memory leak detector.
12476 This option only matters for linking of executables and
12477 the executable is linked against a library that overrides @code{malloc}
12478 and other allocator functions. See
12479 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12480 details. The run-time behavior can be influenced using the
12481 @env{LSAN_OPTIONS} environment variable.
12482 The option cannot be combined with @option{-fsanitize=thread}.
12483
12484 @item -fsanitize=undefined
12485 @opindex fsanitize=undefined
12486 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12487 Various computations are instrumented to detect undefined behavior
12488 at runtime. Current suboptions are:
12489
12490 @table @gcctabopt
12491
12492 @item -fsanitize=shift
12493 @opindex fsanitize=shift
12494 This option enables checking that the result of a shift operation is
12495 not undefined. Note that what exactly is considered undefined differs
12496 slightly between C and C++, as well as between ISO C90 and C99, etc.
12497 This option has two suboptions, @option{-fsanitize=shift-base} and
12498 @option{-fsanitize=shift-exponent}.
12499
12500 @item -fsanitize=shift-exponent
12501 @opindex fsanitize=shift-exponent
12502 This option enables checking that the second argument of a shift operation
12503 is not negative and is smaller than the precision of the promoted first
12504 argument.
12505
12506 @item -fsanitize=shift-base
12507 @opindex fsanitize=shift-base
12508 If the second argument of a shift operation is within range, check that the
12509 result of a shift operation is not undefined. Note that what exactly is
12510 considered undefined differs slightly between C and C++, as well as between
12511 ISO C90 and C99, etc.
12512
12513 @item -fsanitize=integer-divide-by-zero
12514 @opindex fsanitize=integer-divide-by-zero
12515 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12516
12517 @item -fsanitize=unreachable
12518 @opindex fsanitize=unreachable
12519 With this option, the compiler turns the @code{__builtin_unreachable}
12520 call into a diagnostics message call instead. When reaching the
12521 @code{__builtin_unreachable} call, the behavior is undefined.
12522
12523 @item -fsanitize=vla-bound
12524 @opindex fsanitize=vla-bound
12525 This option instructs the compiler to check that the size of a variable
12526 length array is positive.
12527
12528 @item -fsanitize=null
12529 @opindex fsanitize=null
12530 This option enables pointer checking. Particularly, the application
12531 built with this option turned on will issue an error message when it
12532 tries to dereference a NULL pointer, or if a reference (possibly an
12533 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12534 on an object pointed by a NULL pointer.
12535
12536 @item -fsanitize=return
12537 @opindex fsanitize=return
12538 This option enables return statement checking. Programs
12539 built with this option turned on will issue an error message
12540 when the end of a non-void function is reached without actually
12541 returning a value. This option works in C++ only.
12542
12543 @item -fsanitize=signed-integer-overflow
12544 @opindex fsanitize=signed-integer-overflow
12545 This option enables signed integer overflow checking. We check that
12546 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12547 does not overflow in the signed arithmetics. Note, integer promotion
12548 rules must be taken into account. That is, the following is not an
12549 overflow:
12550 @smallexample
12551 signed char a = SCHAR_MAX;
12552 a++;
12553 @end smallexample
12554
12555 @item -fsanitize=bounds
12556 @opindex fsanitize=bounds
12557 This option enables instrumentation of array bounds. Various out of bounds
12558 accesses are detected. Flexible array members, flexible array member-like
12559 arrays, and initializers of variables with static storage are not instrumented.
12560
12561 @item -fsanitize=bounds-strict
12562 @opindex fsanitize=bounds-strict
12563 This option enables strict instrumentation of array bounds. Most out of bounds
12564 accesses are detected, including flexible array members and flexible array
12565 member-like arrays. Initializers of variables with static storage are not
12566 instrumented.
12567
12568 @item -fsanitize=alignment
12569 @opindex fsanitize=alignment
12570
12571 This option enables checking of alignment of pointers when they are
12572 dereferenced, or when a reference is bound to insufficiently aligned target,
12573 or when a method or constructor is invoked on insufficiently aligned object.
12574
12575 @item -fsanitize=object-size
12576 @opindex fsanitize=object-size
12577 This option enables instrumentation of memory references using the
12578 @code{__builtin_object_size} function. Various out of bounds pointer
12579 accesses are detected.
12580
12581 @item -fsanitize=float-divide-by-zero
12582 @opindex fsanitize=float-divide-by-zero
12583 Detect floating-point division by zero. Unlike other similar options,
12584 @option{-fsanitize=float-divide-by-zero} is not enabled by
12585 @option{-fsanitize=undefined}, since floating-point division by zero can
12586 be a legitimate way of obtaining infinities and NaNs.
12587
12588 @item -fsanitize=float-cast-overflow
12589 @opindex fsanitize=float-cast-overflow
12590 This option enables floating-point type to integer conversion checking.
12591 We check that the result of the conversion does not overflow.
12592 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12593 not enabled by @option{-fsanitize=undefined}.
12594 This option does not work well with @code{FE_INVALID} exceptions enabled.
12595
12596 @item -fsanitize=nonnull-attribute
12597 @opindex fsanitize=nonnull-attribute
12598
12599 This option enables instrumentation of calls, checking whether null values
12600 are not passed to arguments marked as requiring a non-null value by the
12601 @code{nonnull} function attribute.
12602
12603 @item -fsanitize=returns-nonnull-attribute
12604 @opindex fsanitize=returns-nonnull-attribute
12605
12606 This option enables instrumentation of return statements in functions
12607 marked with @code{returns_nonnull} function attribute, to detect returning
12608 of null values from such functions.
12609
12610 @item -fsanitize=bool
12611 @opindex fsanitize=bool
12612
12613 This option enables instrumentation of loads from bool. If a value other
12614 than 0/1 is loaded, a run-time error is issued.
12615
12616 @item -fsanitize=enum
12617 @opindex fsanitize=enum
12618
12619 This option enables instrumentation of loads from an enum type. If
12620 a value outside the range of values for the enum type is loaded,
12621 a run-time error is issued.
12622
12623 @item -fsanitize=vptr
12624 @opindex fsanitize=vptr
12625
12626 This option enables instrumentation of C++ member function calls, member
12627 accesses and some conversions between pointers to base and derived classes,
12628 to verify the referenced object has the correct dynamic type.
12629
12630 @item -fsanitize=pointer-overflow
12631 @opindex fsanitize=pointer-overflow
12632
12633 This option enables instrumentation of pointer arithmetics. If the pointer
12634 arithmetics overflows, a run-time error is issued.
12635
12636 @item -fsanitize=builtin
12637 @opindex fsanitize=builtin
12638
12639 This option enables instrumentation of arguments to selected builtin
12640 functions. If an invalid value is passed to such arguments, a run-time
12641 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12642 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12643 by this option.
12644
12645 @end table
12646
12647 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12648 @option{-fsanitize=undefined} gives a diagnostic message.
12649 This currently works only for the C family of languages.
12650
12651 @item -fno-sanitize=all
12652 @opindex fno-sanitize=all
12653
12654 This option disables all previously enabled sanitizers.
12655 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12656 together.
12657
12658 @item -fasan-shadow-offset=@var{number}
12659 @opindex fasan-shadow-offset
12660 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12661 It is useful for experimenting with different shadow memory layouts in
12662 Kernel AddressSanitizer.
12663
12664 @item -fsanitize-sections=@var{s1},@var{s2},...
12665 @opindex fsanitize-sections
12666 Sanitize global variables in selected user-defined sections. @var{si} may
12667 contain wildcards.
12668
12669 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12670 @opindex fsanitize-recover
12671 @opindex fno-sanitize-recover
12672 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12673 mentioned in comma-separated list of @var{opts}. Enabling this option
12674 for a sanitizer component causes it to attempt to continue
12675 running the program as if no error happened. This means multiple
12676 runtime errors can be reported in a single program run, and the exit
12677 code of the program may indicate success even when errors
12678 have been reported. The @option{-fno-sanitize-recover=} option
12679 can be used to alter
12680 this behavior: only the first detected error is reported
12681 and program then exits with a non-zero exit code.
12682
12683 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12684 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12685 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12686 @option{-fsanitize=bounds-strict},
12687 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12688 For these sanitizers error recovery is turned on by default,
12689 except @option{-fsanitize=address}, for which this feature is experimental.
12690 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12691 accepted, the former enables recovery for all sanitizers that support it,
12692 the latter disables recovery for all sanitizers that support it.
12693
12694 Even if a recovery mode is turned on the compiler side, it needs to be also
12695 enabled on the runtime library side, otherwise the failures are still fatal.
12696 The runtime library defaults to @code{halt_on_error=0} for
12697 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12698 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12699 setting the @code{halt_on_error} flag in the corresponding environment variable.
12700
12701 Syntax without an explicit @var{opts} parameter is deprecated. It is
12702 equivalent to specifying an @var{opts} list of:
12703
12704 @smallexample
12705 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12706 @end smallexample
12707
12708 @item -fsanitize-address-use-after-scope
12709 @opindex fsanitize-address-use-after-scope
12710 Enable sanitization of local variables to detect use-after-scope bugs.
12711 The option sets @option{-fstack-reuse} to @samp{none}.
12712
12713 @item -fsanitize-undefined-trap-on-error
12714 @opindex fsanitize-undefined-trap-on-error
12715 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12716 report undefined behavior using @code{__builtin_trap} rather than
12717 a @code{libubsan} library routine. The advantage of this is that the
12718 @code{libubsan} library is not needed and is not linked in, so this
12719 is usable even in freestanding environments.
12720
12721 @item -fsanitize-coverage=trace-pc
12722 @opindex fsanitize-coverage=trace-pc
12723 Enable coverage-guided fuzzing code instrumentation.
12724 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12725
12726 @item -fsanitize-coverage=trace-cmp
12727 @opindex fsanitize-coverage=trace-cmp
12728 Enable dataflow guided fuzzing code instrumentation.
12729 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12730 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12731 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12732 variable or @code{__sanitizer_cov_trace_const_cmp1},
12733 @code{__sanitizer_cov_trace_const_cmp2},
12734 @code{__sanitizer_cov_trace_const_cmp4} or
12735 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12736 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12737 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12738 @code{__sanitizer_cov_trace_switch} for switch statements.
12739
12740 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12741 @opindex fcf-protection
12742 Enable code instrumentation of control-flow transfers to increase
12743 program security by checking that target addresses of control-flow
12744 transfer instructions (such as indirect function call, function return,
12745 indirect jump) are valid. This prevents diverting the flow of control
12746 to an unexpected target. This is intended to protect against such
12747 threats as Return-oriented Programming (ROP), and similarly
12748 call/jmp-oriented programming (COP/JOP).
12749
12750 The value @code{branch} tells the compiler to implement checking of
12751 validity of control-flow transfer at the point of indirect branch
12752 instructions, i.e.@: call/jmp instructions. The value @code{return}
12753 implements checking of validity at the point of returning from a
12754 function. The value @code{full} is an alias for specifying both
12755 @code{branch} and @code{return}. The value @code{none} turns off
12756 instrumentation.
12757
12758 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12759 used. The first bit of @code{__CET__} is set to 1 for the value
12760 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12761 the @code{return}.
12762
12763 You can also use the @code{nocf_check} attribute to identify
12764 which functions and calls should be skipped from instrumentation
12765 (@pxref{Function Attributes}).
12766
12767 Currently the x86 GNU/Linux target provides an implementation based
12768 on Intel Control-flow Enforcement Technology (CET).
12769
12770 @item -fstack-protector
12771 @opindex fstack-protector
12772 Emit extra code to check for buffer overflows, such as stack smashing
12773 attacks. This is done by adding a guard variable to functions with
12774 vulnerable objects. This includes functions that call @code{alloca}, and
12775 functions with buffers larger than 8 bytes. The guards are initialized
12776 when a function is entered and then checked when the function exits.
12777 If a guard check fails, an error message is printed and the program exits.
12778
12779 @item -fstack-protector-all
12780 @opindex fstack-protector-all
12781 Like @option{-fstack-protector} except that all functions are protected.
12782
12783 @item -fstack-protector-strong
12784 @opindex fstack-protector-strong
12785 Like @option{-fstack-protector} but includes additional functions to
12786 be protected --- those that have local array definitions, or have
12787 references to local frame addresses.
12788
12789 @item -fstack-protector-explicit
12790 @opindex fstack-protector-explicit
12791 Like @option{-fstack-protector} but only protects those functions which
12792 have the @code{stack_protect} attribute.
12793
12794 @item -fstack-check
12795 @opindex fstack-check
12796 Generate code to verify that you do not go beyond the boundary of the
12797 stack. You should specify this flag if you are running in an
12798 environment with multiple threads, but you only rarely need to specify it in
12799 a single-threaded environment since stack overflow is automatically
12800 detected on nearly all systems if there is only one stack.
12801
12802 Note that this switch does not actually cause checking to be done; the
12803 operating system or the language runtime must do that. The switch causes
12804 generation of code to ensure that they see the stack being extended.
12805
12806 You can additionally specify a string parameter: @samp{no} means no
12807 checking, @samp{generic} means force the use of old-style checking,
12808 @samp{specific} means use the best checking method and is equivalent
12809 to bare @option{-fstack-check}.
12810
12811 Old-style checking is a generic mechanism that requires no specific
12812 target support in the compiler but comes with the following drawbacks:
12813
12814 @enumerate
12815 @item
12816 Modified allocation strategy for large objects: they are always
12817 allocated dynamically if their size exceeds a fixed threshold. Note this
12818 may change the semantics of some code.
12819
12820 @item
12821 Fixed limit on the size of the static frame of functions: when it is
12822 topped by a particular function, stack checking is not reliable and
12823 a warning is issued by the compiler.
12824
12825 @item
12826 Inefficiency: because of both the modified allocation strategy and the
12827 generic implementation, code performance is hampered.
12828 @end enumerate
12829
12830 Note that old-style stack checking is also the fallback method for
12831 @samp{specific} if no target support has been added in the compiler.
12832
12833 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12834 and stack overflows. @samp{specific} is an excellent choice when compiling
12835 Ada code. It is not generally sufficient to protect against stack-clash
12836 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12837
12838 @item -fstack-clash-protection
12839 @opindex fstack-clash-protection
12840 Generate code to prevent stack clash style attacks. When this option is
12841 enabled, the compiler will only allocate one page of stack space at a time
12842 and each page is accessed immediately after allocation. Thus, it prevents
12843 allocations from jumping over any stack guard page provided by the
12844 operating system.
12845
12846 Most targets do not fully support stack clash protection. However, on
12847 those targets @option{-fstack-clash-protection} will protect dynamic stack
12848 allocations. @option{-fstack-clash-protection} may also provide limited
12849 protection for static stack allocations if the target supports
12850 @option{-fstack-check=specific}.
12851
12852 @item -fstack-limit-register=@var{reg}
12853 @itemx -fstack-limit-symbol=@var{sym}
12854 @itemx -fno-stack-limit
12855 @opindex fstack-limit-register
12856 @opindex fstack-limit-symbol
12857 @opindex fno-stack-limit
12858 Generate code to ensure that the stack does not grow beyond a certain value,
12859 either the value of a register or the address of a symbol. If a larger
12860 stack is required, a signal is raised at run time. For most targets,
12861 the signal is raised before the stack overruns the boundary, so
12862 it is possible to catch the signal without taking special precautions.
12863
12864 For instance, if the stack starts at absolute address @samp{0x80000000}
12865 and grows downwards, you can use the flags
12866 @option{-fstack-limit-symbol=__stack_limit} and
12867 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12868 of 128KB@. Note that this may only work with the GNU linker.
12869
12870 You can locally override stack limit checking by using the
12871 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12872
12873 @item -fsplit-stack
12874 @opindex fsplit-stack
12875 Generate code to automatically split the stack before it overflows.
12876 The resulting program has a discontiguous stack which can only
12877 overflow if the program is unable to allocate any more memory. This
12878 is most useful when running threaded programs, as it is no longer
12879 necessary to calculate a good stack size to use for each thread. This
12880 is currently only implemented for the x86 targets running
12881 GNU/Linux.
12882
12883 When code compiled with @option{-fsplit-stack} calls code compiled
12884 without @option{-fsplit-stack}, there may not be much stack space
12885 available for the latter code to run. If compiling all code,
12886 including library code, with @option{-fsplit-stack} is not an option,
12887 then the linker can fix up these calls so that the code compiled
12888 without @option{-fsplit-stack} always has a large stack. Support for
12889 this is implemented in the gold linker in GNU binutils release 2.21
12890 and later.
12891
12892 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12893 @opindex fvtable-verify
12894 This option is only available when compiling C++ code.
12895 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12896 feature that verifies at run time, for every virtual call, that
12897 the vtable pointer through which the call is made is valid for the type of
12898 the object, and has not been corrupted or overwritten. If an invalid vtable
12899 pointer is detected at run time, an error is reported and execution of the
12900 program is immediately halted.
12901
12902 This option causes run-time data structures to be built at program startup,
12903 which are used for verifying the vtable pointers.
12904 The options @samp{std} and @samp{preinit}
12905 control the timing of when these data structures are built. In both cases the
12906 data structures are built before execution reaches @code{main}. Using
12907 @option{-fvtable-verify=std} causes the data structures to be built after
12908 shared libraries have been loaded and initialized.
12909 @option{-fvtable-verify=preinit} causes them to be built before shared
12910 libraries have been loaded and initialized.
12911
12912 If this option appears multiple times in the command line with different
12913 values specified, @samp{none} takes highest priority over both @samp{std} and
12914 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12915
12916 @item -fvtv-debug
12917 @opindex fvtv-debug
12918 When used in conjunction with @option{-fvtable-verify=std} or
12919 @option{-fvtable-verify=preinit}, causes debug versions of the
12920 runtime functions for the vtable verification feature to be called.
12921 This flag also causes the compiler to log information about which
12922 vtable pointers it finds for each class.
12923 This information is written to a file named @file{vtv_set_ptr_data.log}
12924 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12925 if that is defined or the current working directory otherwise.
12926
12927 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12928 file, be sure to delete any existing one.
12929
12930 @item -fvtv-counts
12931 @opindex fvtv-counts
12932 This is a debugging flag. When used in conjunction with
12933 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12934 causes the compiler to keep track of the total number of virtual calls
12935 it encounters and the number of verifications it inserts. It also
12936 counts the number of calls to certain run-time library functions
12937 that it inserts and logs this information for each compilation unit.
12938 The compiler writes this information to a file named
12939 @file{vtv_count_data.log} in the directory named by the environment
12940 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12941 directory otherwise. It also counts the size of the vtable pointer sets
12942 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12943 in the same directory.
12944
12945 Note: This feature @emph{appends} data to the log files. To get fresh log
12946 files, be sure to delete any existing ones.
12947
12948 @item -finstrument-functions
12949 @opindex finstrument-functions
12950 Generate instrumentation calls for entry and exit to functions. Just
12951 after function entry and just before function exit, the following
12952 profiling functions are called with the address of the current
12953 function and its call site. (On some platforms,
12954 @code{__builtin_return_address} does not work beyond the current
12955 function, so the call site information may not be available to the
12956 profiling functions otherwise.)
12957
12958 @smallexample
12959 void __cyg_profile_func_enter (void *this_fn,
12960 void *call_site);
12961 void __cyg_profile_func_exit (void *this_fn,
12962 void *call_site);
12963 @end smallexample
12964
12965 The first argument is the address of the start of the current function,
12966 which may be looked up exactly in the symbol table.
12967
12968 This instrumentation is also done for functions expanded inline in other
12969 functions. The profiling calls indicate where, conceptually, the
12970 inline function is entered and exited. This means that addressable
12971 versions of such functions must be available. If all your uses of a
12972 function are expanded inline, this may mean an additional expansion of
12973 code size. If you use @code{extern inline} in your C code, an
12974 addressable version of such functions must be provided. (This is
12975 normally the case anyway, but if you get lucky and the optimizer always
12976 expands the functions inline, you might have gotten away without
12977 providing static copies.)
12978
12979 A function may be given the attribute @code{no_instrument_function}, in
12980 which case this instrumentation is not done. This can be used, for
12981 example, for the profiling functions listed above, high-priority
12982 interrupt routines, and any functions from which the profiling functions
12983 cannot safely be called (perhaps signal handlers, if the profiling
12984 routines generate output or allocate memory).
12985 @xref{Common Function Attributes}.
12986
12987 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12988 @opindex finstrument-functions-exclude-file-list
12989
12990 Set the list of functions that are excluded from instrumentation (see
12991 the description of @option{-finstrument-functions}). If the file that
12992 contains a function definition matches with one of @var{file}, then
12993 that function is not instrumented. The match is done on substrings:
12994 if the @var{file} parameter is a substring of the file name, it is
12995 considered to be a match.
12996
12997 For example:
12998
12999 @smallexample
13000 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13001 @end smallexample
13002
13003 @noindent
13004 excludes any inline function defined in files whose pathnames
13005 contain @file{/bits/stl} or @file{include/sys}.
13006
13007 If, for some reason, you want to include letter @samp{,} in one of
13008 @var{sym}, write @samp{\,}. For example,
13009 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13010 (note the single quote surrounding the option).
13011
13012 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13013 @opindex finstrument-functions-exclude-function-list
13014
13015 This is similar to @option{-finstrument-functions-exclude-file-list},
13016 but this option sets the list of function names to be excluded from
13017 instrumentation. The function name to be matched is its user-visible
13018 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13019 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
13020 match is done on substrings: if the @var{sym} parameter is a substring
13021 of the function name, it is considered to be a match. For C99 and C++
13022 extended identifiers, the function name must be given in UTF-8, not
13023 using universal character names.
13024
13025 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13026 @opindex fpatchable-function-entry
13027 Generate @var{N} NOPs right at the beginning
13028 of each function, with the function entry point before the @var{M}th NOP.
13029 If @var{M} is omitted, it defaults to @code{0} so the
13030 function entry points to the address just at the first NOP.
13031 The NOP instructions reserve extra space which can be used to patch in
13032 any desired instrumentation at run time, provided that the code segment
13033 is writable. The amount of space is controllable indirectly via
13034 the number of NOPs; the NOP instruction used corresponds to the instruction
13035 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13036 is target-specific and may also depend on the architecture variant and/or
13037 other compilation options.
13038
13039 For run-time identification, the starting addresses of these areas,
13040 which correspond to their respective function entries minus @var{M},
13041 are additionally collected in the @code{__patchable_function_entries}
13042 section of the resulting binary.
13043
13044 Note that the value of @code{__attribute__ ((patchable_function_entry
13045 (N,M)))} takes precedence over command-line option
13046 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13047 the area size or to remove it completely on a single function.
13048 If @code{N=0}, no pad location is recorded.
13049
13050 The NOP instructions are inserted at---and maybe before, depending on
13051 @var{M}---the function entry address, even before the prologue.
13052
13053 @end table
13054
13055
13056 @node Preprocessor Options
13057 @section Options Controlling the Preprocessor
13058 @cindex preprocessor options
13059 @cindex options, preprocessor
13060
13061 These options control the C preprocessor, which is run on each C source
13062 file before actual compilation.
13063
13064 If you use the @option{-E} option, nothing is done except preprocessing.
13065 Some of these options make sense only together with @option{-E} because
13066 they cause the preprocessor output to be unsuitable for actual
13067 compilation.
13068
13069 In addition to the options listed here, there are a number of options
13070 to control search paths for include files documented in
13071 @ref{Directory Options}.
13072 Options to control preprocessor diagnostics are listed in
13073 @ref{Warning Options}.
13074
13075 @table @gcctabopt
13076 @include cppopts.texi
13077
13078 @item -Wp,@var{option}
13079 @opindex Wp
13080 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13081 and pass @var{option} directly through to the preprocessor. If
13082 @var{option} contains commas, it is split into multiple options at the
13083 commas. However, many options are modified, translated or interpreted
13084 by the compiler driver before being passed to the preprocessor, and
13085 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13086 interface is undocumented and subject to change, so whenever possible
13087 you should avoid using @option{-Wp} and let the driver handle the
13088 options instead.
13089
13090 @item -Xpreprocessor @var{option}
13091 @opindex Xpreprocessor
13092 Pass @var{option} as an option to the preprocessor. You can use this to
13093 supply system-specific preprocessor options that GCC does not
13094 recognize.
13095
13096 If you want to pass an option that takes an argument, you must use
13097 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13098
13099 @item -no-integrated-cpp
13100 @opindex no-integrated-cpp
13101 Perform preprocessing as a separate pass before compilation.
13102 By default, GCC performs preprocessing as an integrated part of
13103 input tokenization and parsing.
13104 If this option is provided, the appropriate language front end
13105 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13106 and Objective-C, respectively) is instead invoked twice,
13107 once for preprocessing only and once for actual compilation
13108 of the preprocessed input.
13109 This option may be useful in conjunction with the @option{-B} or
13110 @option{-wrapper} options to specify an alternate preprocessor or
13111 perform additional processing of the program source between
13112 normal preprocessing and compilation.
13113
13114 @end table
13115
13116 @node Assembler Options
13117 @section Passing Options to the Assembler
13118
13119 @c prevent bad page break with this line
13120 You can pass options to the assembler.
13121
13122 @table @gcctabopt
13123 @item -Wa,@var{option}
13124 @opindex Wa
13125 Pass @var{option} as an option to the assembler. If @var{option}
13126 contains commas, it is split into multiple options at the commas.
13127
13128 @item -Xassembler @var{option}
13129 @opindex Xassembler
13130 Pass @var{option} as an option to the assembler. You can use this to
13131 supply system-specific assembler options that GCC does not
13132 recognize.
13133
13134 If you want to pass an option that takes an argument, you must use
13135 @option{-Xassembler} twice, once for the option and once for the argument.
13136
13137 @end table
13138
13139 @node Link Options
13140 @section Options for Linking
13141 @cindex link options
13142 @cindex options, linking
13143
13144 These options come into play when the compiler links object files into
13145 an executable output file. They are meaningless if the compiler is
13146 not doing a link step.
13147
13148 @table @gcctabopt
13149 @cindex file names
13150 @item @var{object-file-name}
13151 A file name that does not end in a special recognized suffix is
13152 considered to name an object file or library. (Object files are
13153 distinguished from libraries by the linker according to the file
13154 contents.) If linking is done, these object files are used as input
13155 to the linker.
13156
13157 @item -c
13158 @itemx -S
13159 @itemx -E
13160 @opindex c
13161 @opindex S
13162 @opindex E
13163 If any of these options is used, then the linker is not run, and
13164 object file names should not be used as arguments. @xref{Overall
13165 Options}.
13166
13167 @item -flinker-output=@var{type}
13168 @opindex flinker-output
13169 This option controls code generation of the link time optimizer. By
13170 default the linker output is automatically determined by the linker
13171 plugin. For debugging the compiler and if incremental linking with a
13172 non-LTO object file is desired, it may be useful to control the type
13173 manually.
13174
13175 If @var{type} is @samp{exec} code generation produces a static
13176 binary. In this case @option{-fpic} and @option{-fpie} are both
13177 disabled.
13178
13179 If @var{type} is @samp{dyn} code generation produces a shared
13180 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13181 but not enabled automatically. This allows to build shared libraries
13182 without position independent code on architectures where this is
13183 possible, i.e.@: on x86.
13184
13185 If @var{type} is @samp{pie} code generation produces an @option{-fpie}
13186 executable. This results in similar optimizations as @samp{exec}
13187 except that @option{-fpie} is not disabled if specified at compilation
13188 time.
13189
13190 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
13191 done. The sections containing intermediate code for link-time optimization are
13192 merged, pre-optimized, and output to the resulting object file. In addition, if
13193 @option{-ffat-lto-objects} is specified the binary code is produced for future
13194 non-LTO linking. The object file produced by incremental linking will be smaller
13195 than a static library produced from the same object files. At link time the
13196 result of incremental linking will also load faster to compiler than a static
13197 library assuming that the majority of objects in the library are used.
13198
13199 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13200 code generation is forced, a final binary is produced and the intermediate
13201 code for later link-time optimization is stripped. When multiple object files
13202 are linked together the resulting code will be optimized better than with
13203 link-time optimizations disabled (for example, cross-module inlining will
13204 happen), most of benefits of whole program optimizations are however lost.
13205
13206 During the incremental link (by @option{-r}) the linker plugin will default to
13207 @option{rel}. With current interfaces to GNU Binutils it is however not
13208 possible to incrementally link LTO objects and non-LTO objects into a single
13209 mixed object file. In the case any of object files in incremental link cannot
13210 be used for link-time optimization the linker plugin will issue a warning and
13211 use @samp{nolto-rel}. To maintain the whole program optimization it is
13212 recommended to link such objects into static library instead. Alternatively it
13213 is possible to use H.J. Lu's binutils with support for mixed objects.
13214
13215 @item -fuse-ld=bfd
13216 @opindex fuse-ld=bfd
13217 Use the @command{bfd} linker instead of the default linker.
13218
13219 @item -fuse-ld=gold
13220 @opindex fuse-ld=gold
13221 Use the @command{gold} linker instead of the default linker.
13222
13223 @item -fuse-ld=lld
13224 @opindex fuse-ld=lld
13225 Use the LLVM @command{lld} linker instead of the default linker.
13226
13227 @cindex Libraries
13228 @item -l@var{library}
13229 @itemx -l @var{library}
13230 @opindex l
13231 Search the library named @var{library} when linking. (The second
13232 alternative with the library as a separate argument is only for
13233 POSIX compliance and is not recommended.)
13234
13235 The @option{-l} option is passed directly to the linker by GCC. Refer
13236 to your linker documentation for exact details. The general
13237 description below applies to the GNU linker.
13238
13239 The linker searches a standard list of directories for the library.
13240 The directories searched include several standard system directories
13241 plus any that you specify with @option{-L}.
13242
13243 Static libraries are archives of object files, and have file names
13244 like @file{lib@var{library}.a}. Some targets also support shared
13245 libraries, which typically have names like @file{lib@var{library}.so}.
13246 If both static and shared libraries are found, the linker gives
13247 preference to linking with the shared library unless the
13248 @option{-static} option is used.
13249
13250 It makes a difference where in the command you write this option; the
13251 linker searches and processes libraries and object files in the order they
13252 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13253 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13254 to functions in @samp{z}, those functions may not be loaded.
13255
13256 @item -lobjc
13257 @opindex lobjc
13258 You need this special case of the @option{-l} option in order to
13259 link an Objective-C or Objective-C++ program.
13260
13261 @item -nostartfiles
13262 @opindex nostartfiles
13263 Do not use the standard system startup files when linking.
13264 The standard system libraries are used normally, unless @option{-nostdlib},
13265 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13266
13267 @item -nodefaultlibs
13268 @opindex nodefaultlibs
13269 Do not use the standard system libraries when linking.
13270 Only the libraries you specify are passed to the linker, and options
13271 specifying linkage of the system libraries, such as @option{-static-libgcc}
13272 or @option{-shared-libgcc}, are ignored.
13273 The standard startup files are used normally, unless @option{-nostartfiles}
13274 is used.
13275
13276 The compiler may generate calls to @code{memcmp},
13277 @code{memset}, @code{memcpy} and @code{memmove}.
13278 These entries are usually resolved by entries in
13279 libc. These entry points should be supplied through some other
13280 mechanism when this option is specified.
13281
13282 @item -nolibc
13283 @opindex nolibc
13284 Do not use the C library or system libraries tightly coupled with it when
13285 linking. Still link with the startup files, @file{libgcc} or toolchain
13286 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13287 or @file{libstdc++} unless options preventing their inclusion are used as
13288 well. This typically removes @option{-lc} from the link command line, as well
13289 as system libraries that normally go with it and become meaningless when
13290 absence of a C library is assumed, for example @option{-lpthread} or
13291 @option{-lm} in some configurations. This is intended for bare-board
13292 targets when there is indeed no C library available.
13293
13294 @item -nostdlib
13295 @opindex nostdlib
13296 Do not use the standard system startup files or libraries when linking.
13297 No startup files and only the libraries you specify are passed to
13298 the linker, and options specifying linkage of the system libraries, such as
13299 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13300
13301 The compiler may generate calls to @code{memcmp}, @code{memset},
13302 @code{memcpy} and @code{memmove}.
13303 These entries are usually resolved by entries in
13304 libc. These entry points should be supplied through some other
13305 mechanism when this option is specified.
13306
13307 @cindex @option{-lgcc}, use with @option{-nostdlib}
13308 @cindex @option{-nostdlib} and unresolved references
13309 @cindex unresolved references and @option{-nostdlib}
13310 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13311 @cindex @option{-nodefaultlibs} and unresolved references
13312 @cindex unresolved references and @option{-nodefaultlibs}
13313 One of the standard libraries bypassed by @option{-nostdlib} and
13314 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13315 which GCC uses to overcome shortcomings of particular machines, or special
13316 needs for some languages.
13317 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13318 Collection (GCC) Internals},
13319 for more discussion of @file{libgcc.a}.)
13320 In most cases, you need @file{libgcc.a} even when you want to avoid
13321 other standard libraries. In other words, when you specify @option{-nostdlib}
13322 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13323 This ensures that you have no unresolved references to internal GCC
13324 library subroutines.
13325 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13326 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13327 GNU Compiler Collection (GCC) Internals}.)
13328
13329 @item -e @var{entry}
13330 @itemx --entry=@var{entry}
13331 @opindex e
13332 @opindex entry
13333
13334 Specify that the program entry point is @var{entry}. The argument is
13335 interpreted by the linker; the GNU linker accepts either a symbol name
13336 or an address.
13337
13338 @item -pie
13339 @opindex pie
13340 Produce a dynamically linked position independent executable on targets
13341 that support it. For predictable results, you must also specify the same
13342 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13343 or model suboptions) when you specify this linker option.
13344
13345 @item -no-pie
13346 @opindex no-pie
13347 Don't produce a dynamically linked position independent executable.
13348
13349 @item -static-pie
13350 @opindex static-pie
13351 Produce a static position independent executable on targets that support
13352 it. A static position independent executable is similar to a static
13353 executable, but can be loaded at any address without a dynamic linker.
13354 For predictable results, you must also specify the same set of options
13355 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13356 suboptions) when you specify this linker option.
13357
13358 @item -pthread
13359 @opindex pthread
13360 Link with the POSIX threads library. This option is supported on
13361 GNU/Linux targets, most other Unix derivatives, and also on
13362 x86 Cygwin and MinGW targets. On some targets this option also sets
13363 flags for the preprocessor, so it should be used consistently for both
13364 compilation and linking.
13365
13366 @item -r
13367 @opindex r
13368 Produce a relocatable object as output. This is also known as partial
13369 linking.
13370
13371 @item -rdynamic
13372 @opindex rdynamic
13373 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13374 that support it. This instructs the linker to add all symbols, not
13375 only used ones, to the dynamic symbol table. This option is needed
13376 for some uses of @code{dlopen} or to allow obtaining backtraces
13377 from within a program.
13378
13379 @item -s
13380 @opindex s
13381 Remove all symbol table and relocation information from the executable.
13382
13383 @item -static
13384 @opindex static
13385 On systems that support dynamic linking, this overrides @option{-pie}
13386 and prevents linking with the shared libraries. On other systems, this
13387 option has no effect.
13388
13389 @item -shared
13390 @opindex shared
13391 Produce a shared object which can then be linked with other objects to
13392 form an executable. Not all systems support this option. For predictable
13393 results, you must also specify the same set of options used for compilation
13394 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13395 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13396 needs to build supplementary stub code for constructors to work. On
13397 multi-libbed systems, @samp{gcc -shared} must select the correct support
13398 libraries to link against. Failing to supply the correct flags may lead
13399 to subtle defects. Supplying them in cases where they are not necessary
13400 is innocuous.}
13401
13402 @item -shared-libgcc
13403 @itemx -static-libgcc
13404 @opindex shared-libgcc
13405 @opindex static-libgcc
13406 On systems that provide @file{libgcc} as a shared library, these options
13407 force the use of either the shared or static version, respectively.
13408 If no shared version of @file{libgcc} was built when the compiler was
13409 configured, these options have no effect.
13410
13411 There are several situations in which an application should use the
13412 shared @file{libgcc} instead of the static version. The most common
13413 of these is when the application wishes to throw and catch exceptions
13414 across different shared libraries. In that case, each of the libraries
13415 as well as the application itself should use the shared @file{libgcc}.
13416
13417 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13418 whenever you build a shared library or a main executable, because C++
13419 programs typically use exceptions, so this is the right thing to do.
13420
13421 If, instead, you use the GCC driver to create shared libraries, you may
13422 find that they are not always linked with the shared @file{libgcc}.
13423 If GCC finds, at its configuration time, that you have a non-GNU linker
13424 or a GNU linker that does not support option @option{--eh-frame-hdr},
13425 it links the shared version of @file{libgcc} into shared libraries
13426 by default. Otherwise, it takes advantage of the linker and optimizes
13427 away the linking with the shared version of @file{libgcc}, linking with
13428 the static version of libgcc by default. This allows exceptions to
13429 propagate through such shared libraries, without incurring relocation
13430 costs at library load time.
13431
13432 However, if a library or main executable is supposed to throw or catch
13433 exceptions, you must link it using the G++ driver, or using the option
13434 @option{-shared-libgcc}, such that it is linked with the shared
13435 @file{libgcc}.
13436
13437 @item -static-libasan
13438 @opindex static-libasan
13439 When the @option{-fsanitize=address} option is used to link a program,
13440 the GCC driver automatically links against @option{libasan}. If
13441 @file{libasan} is available as a shared library, and the @option{-static}
13442 option is not used, then this links against the shared version of
13443 @file{libasan}. The @option{-static-libasan} option directs the GCC
13444 driver to link @file{libasan} statically, without necessarily linking
13445 other libraries statically.
13446
13447 @item -static-libtsan
13448 @opindex static-libtsan
13449 When the @option{-fsanitize=thread} option is used to link a program,
13450 the GCC driver automatically links against @option{libtsan}. If
13451 @file{libtsan} is available as a shared library, and the @option{-static}
13452 option is not used, then this links against the shared version of
13453 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13454 driver to link @file{libtsan} statically, without necessarily linking
13455 other libraries statically.
13456
13457 @item -static-liblsan
13458 @opindex static-liblsan
13459 When the @option{-fsanitize=leak} option is used to link a program,
13460 the GCC driver automatically links against @option{liblsan}. If
13461 @file{liblsan} is available as a shared library, and the @option{-static}
13462 option is not used, then this links against the shared version of
13463 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13464 driver to link @file{liblsan} statically, without necessarily linking
13465 other libraries statically.
13466
13467 @item -static-libubsan
13468 @opindex static-libubsan
13469 When the @option{-fsanitize=undefined} option is used to link a program,
13470 the GCC driver automatically links against @option{libubsan}. If
13471 @file{libubsan} is available as a shared library, and the @option{-static}
13472 option is not used, then this links against the shared version of
13473 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13474 driver to link @file{libubsan} statically, without necessarily linking
13475 other libraries statically.
13476
13477 @item -static-libstdc++
13478 @opindex static-libstdc++
13479 When the @command{g++} program is used to link a C++ program, it
13480 normally automatically links against @option{libstdc++}. If
13481 @file{libstdc++} is available as a shared library, and the
13482 @option{-static} option is not used, then this links against the
13483 shared version of @file{libstdc++}. That is normally fine. However, it
13484 is sometimes useful to freeze the version of @file{libstdc++} used by
13485 the program without going all the way to a fully static link. The
13486 @option{-static-libstdc++} option directs the @command{g++} driver to
13487 link @file{libstdc++} statically, without necessarily linking other
13488 libraries statically.
13489
13490 @item -symbolic
13491 @opindex symbolic
13492 Bind references to global symbols when building a shared object. Warn
13493 about any unresolved references (unless overridden by the link editor
13494 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13495 this option.
13496
13497 @item -T @var{script}
13498 @opindex T
13499 @cindex linker script
13500 Use @var{script} as the linker script. This option is supported by most
13501 systems using the GNU linker. On some targets, such as bare-board
13502 targets without an operating system, the @option{-T} option may be required
13503 when linking to avoid references to undefined symbols.
13504
13505 @item -Xlinker @var{option}
13506 @opindex Xlinker
13507 Pass @var{option} as an option to the linker. You can use this to
13508 supply system-specific linker options that GCC does not recognize.
13509
13510 If you want to pass an option that takes a separate argument, you must use
13511 @option{-Xlinker} twice, once for the option and once for the argument.
13512 For example, to pass @option{-assert definitions}, you must write
13513 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13514 @option{-Xlinker "-assert definitions"}, because this passes the entire
13515 string as a single argument, which is not what the linker expects.
13516
13517 When using the GNU linker, it is usually more convenient to pass
13518 arguments to linker options using the @option{@var{option}=@var{value}}
13519 syntax than as separate arguments. For example, you can specify
13520 @option{-Xlinker -Map=output.map} rather than
13521 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13522 this syntax for command-line options.
13523
13524 @item -Wl,@var{option}
13525 @opindex Wl
13526 Pass @var{option} as an option to the linker. If @var{option} contains
13527 commas, it is split into multiple options at the commas. You can use this
13528 syntax to pass an argument to the option.
13529 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13530 linker. When using the GNU linker, you can also get the same effect with
13531 @option{-Wl,-Map=output.map}.
13532
13533 @item -u @var{symbol}
13534 @opindex u
13535 Pretend the symbol @var{symbol} is undefined, to force linking of
13536 library modules to define it. You can use @option{-u} multiple times with
13537 different symbols to force loading of additional library modules.
13538
13539 @item -z @var{keyword}
13540 @opindex z
13541 @option{-z} is passed directly on to the linker along with the keyword
13542 @var{keyword}. See the section in the documentation of your linker for
13543 permitted values and their meanings.
13544 @end table
13545
13546 @node Directory Options
13547 @section Options for Directory Search
13548 @cindex directory options
13549 @cindex options, directory search
13550 @cindex search path
13551
13552 These options specify directories to search for header files, for
13553 libraries and for parts of the compiler:
13554
13555 @table @gcctabopt
13556 @include cppdiropts.texi
13557
13558 @item -iplugindir=@var{dir}
13559 @opindex iplugindir=
13560 Set the directory to search for plugins that are passed
13561 by @option{-fplugin=@var{name}} instead of
13562 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13563 to be used by the user, but only passed by the driver.
13564
13565 @item -L@var{dir}
13566 @opindex L
13567 Add directory @var{dir} to the list of directories to be searched
13568 for @option{-l}.
13569
13570 @item -B@var{prefix}
13571 @opindex B
13572 This option specifies where to find the executables, libraries,
13573 include files, and data files of the compiler itself.
13574
13575 The compiler driver program runs one or more of the subprograms
13576 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13577 @var{prefix} as a prefix for each program it tries to run, both with and
13578 without @samp{@var{machine}/@var{version}/} for the corresponding target
13579 machine and compiler version.
13580
13581 For each subprogram to be run, the compiler driver first tries the
13582 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13583 is not specified, the driver tries two standard prefixes,
13584 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13585 those results in a file name that is found, the unmodified program
13586 name is searched for using the directories specified in your
13587 @env{PATH} environment variable.
13588
13589 The compiler checks to see if the path provided by @option{-B}
13590 refers to a directory, and if necessary it adds a directory
13591 separator character at the end of the path.
13592
13593 @option{-B} prefixes that effectively specify directory names also apply
13594 to libraries in the linker, because the compiler translates these
13595 options into @option{-L} options for the linker. They also apply to
13596 include files in the preprocessor, because the compiler translates these
13597 options into @option{-isystem} options for the preprocessor. In this case,
13598 the compiler appends @samp{include} to the prefix.
13599
13600 The runtime support file @file{libgcc.a} can also be searched for using
13601 the @option{-B} prefix, if needed. If it is not found there, the two
13602 standard prefixes above are tried, and that is all. The file is left
13603 out of the link if it is not found by those means.
13604
13605 Another way to specify a prefix much like the @option{-B} prefix is to use
13606 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13607 Variables}.
13608
13609 As a special kludge, if the path provided by @option{-B} is
13610 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13611 9, then it is replaced by @file{[dir/]include}. This is to help
13612 with boot-strapping the compiler.
13613
13614 @item -no-canonical-prefixes
13615 @opindex no-canonical-prefixes
13616 Do not expand any symbolic links, resolve references to @samp{/../}
13617 or @samp{/./}, or make the path absolute when generating a relative
13618 prefix.
13619
13620 @item --sysroot=@var{dir}
13621 @opindex sysroot
13622 Use @var{dir} as the logical root directory for headers and libraries.
13623 For example, if the compiler normally searches for headers in
13624 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13625 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13626
13627 If you use both this option and the @option{-isysroot} option, then
13628 the @option{--sysroot} option applies to libraries, but the
13629 @option{-isysroot} option applies to header files.
13630
13631 The GNU linker (beginning with version 2.16) has the necessary support
13632 for this option. If your linker does not support this option, the
13633 header file aspect of @option{--sysroot} still works, but the
13634 library aspect does not.
13635
13636 @item --no-sysroot-suffix
13637 @opindex no-sysroot-suffix
13638 For some targets, a suffix is added to the root directory specified
13639 with @option{--sysroot}, depending on the other options used, so that
13640 headers may for example be found in
13641 @file{@var{dir}/@var{suffix}/usr/include} instead of
13642 @file{@var{dir}/usr/include}. This option disables the addition of
13643 such a suffix.
13644
13645 @end table
13646
13647 @node Code Gen Options
13648 @section Options for Code Generation Conventions
13649 @cindex code generation conventions
13650 @cindex options, code generation
13651 @cindex run-time options
13652
13653 These machine-independent options control the interface conventions
13654 used in code generation.
13655
13656 Most of them have both positive and negative forms; the negative form
13657 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13658 one of the forms is listed---the one that is not the default. You
13659 can figure out the other form by either removing @samp{no-} or adding
13660 it.
13661
13662 @table @gcctabopt
13663 @item -fstack-reuse=@var{reuse-level}
13664 @opindex fstack_reuse
13665 This option controls stack space reuse for user declared local/auto variables
13666 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13667 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13668 local variables and temporaries, @samp{named_vars} enables the reuse only for
13669 user defined local variables with names, and @samp{none} disables stack reuse
13670 completely. The default value is @samp{all}. The option is needed when the
13671 program extends the lifetime of a scoped local variable or a compiler generated
13672 temporary beyond the end point defined by the language. When a lifetime of
13673 a variable ends, and if the variable lives in memory, the optimizing compiler
13674 has the freedom to reuse its stack space with other temporaries or scoped
13675 local variables whose live range does not overlap with it. Legacy code extending
13676 local lifetime is likely to break with the stack reuse optimization.
13677
13678 For example,
13679
13680 @smallexample
13681 int *p;
13682 @{
13683 int local1;
13684
13685 p = &local1;
13686 local1 = 10;
13687 ....
13688 @}
13689 @{
13690 int local2;
13691 local2 = 20;
13692 ...
13693 @}
13694
13695 if (*p == 10) // out of scope use of local1
13696 @{
13697
13698 @}
13699 @end smallexample
13700
13701 Another example:
13702 @smallexample
13703
13704 struct A
13705 @{
13706 A(int k) : i(k), j(k) @{ @}
13707 int i;
13708 int j;
13709 @};
13710
13711 A *ap;
13712
13713 void foo(const A& ar)
13714 @{
13715 ap = &ar;
13716 @}
13717
13718 void bar()
13719 @{
13720 foo(A(10)); // temp object's lifetime ends when foo returns
13721
13722 @{
13723 A a(20);
13724 ....
13725 @}
13726 ap->i+= 10; // ap references out of scope temp whose space
13727 // is reused with a. What is the value of ap->i?
13728 @}
13729
13730 @end smallexample
13731
13732 The lifetime of a compiler generated temporary is well defined by the C++
13733 standard. When a lifetime of a temporary ends, and if the temporary lives
13734 in memory, the optimizing compiler has the freedom to reuse its stack
13735 space with other temporaries or scoped local variables whose live range
13736 does not overlap with it. However some of the legacy code relies on
13737 the behavior of older compilers in which temporaries' stack space is
13738 not reused, the aggressive stack reuse can lead to runtime errors. This
13739 option is used to control the temporary stack reuse optimization.
13740
13741 @item -ftrapv
13742 @opindex ftrapv
13743 This option generates traps for signed overflow on addition, subtraction,
13744 multiplication operations.
13745 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13746 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13747 @option{-fwrapv} being effective. Note that only active options override, so
13748 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13749 results in @option{-ftrapv} being effective.
13750
13751 @item -fwrapv
13752 @opindex fwrapv
13753 This option instructs the compiler to assume that signed arithmetic
13754 overflow of addition, subtraction and multiplication wraps around
13755 using twos-complement representation. This flag enables some optimizations
13756 and disables others.
13757 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13758 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13759 @option{-fwrapv} being effective. Note that only active options override, so
13760 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13761 results in @option{-ftrapv} being effective.
13762
13763 @item -fwrapv-pointer
13764 @opindex fwrapv-pointer
13765 This option instructs the compiler to assume that pointer arithmetic
13766 overflow on addition and subtraction wraps around using twos-complement
13767 representation. This flag disables some optimizations which assume
13768 pointer overflow is invalid.
13769
13770 @item -fstrict-overflow
13771 @opindex fstrict-overflow
13772 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13773 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13774
13775 @item -fexceptions
13776 @opindex fexceptions
13777 Enable exception handling. Generates extra code needed to propagate
13778 exceptions. For some targets, this implies GCC generates frame
13779 unwind information for all functions, which can produce significant data
13780 size overhead, although it does not affect execution. If you do not
13781 specify this option, GCC enables it by default for languages like
13782 C++ that normally require exception handling, and disables it for
13783 languages like C that do not normally require it. However, you may need
13784 to enable this option when compiling C code that needs to interoperate
13785 properly with exception handlers written in C++. You may also wish to
13786 disable this option if you are compiling older C++ programs that don't
13787 use exception handling.
13788
13789 @item -fnon-call-exceptions
13790 @opindex fnon-call-exceptions
13791 Generate code that allows trapping instructions to throw exceptions.
13792 Note that this requires platform-specific runtime support that does
13793 not exist everywhere. Moreover, it only allows @emph{trapping}
13794 instructions to throw exceptions, i.e.@: memory references or floating-point
13795 instructions. It does not allow exceptions to be thrown from
13796 arbitrary signal handlers such as @code{SIGALRM}.
13797
13798 @item -fdelete-dead-exceptions
13799 @opindex fdelete-dead-exceptions
13800 Consider that instructions that may throw exceptions but don't otherwise
13801 contribute to the execution of the program can be optimized away.
13802 This option is enabled by default for the Ada front end, as permitted by
13803 the Ada language specification.
13804 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13805
13806 @item -funwind-tables
13807 @opindex funwind-tables
13808 Similar to @option{-fexceptions}, except that it just generates any needed
13809 static data, but does not affect the generated code in any other way.
13810 You normally do not need to enable this option; instead, a language processor
13811 that needs this handling enables it on your behalf.
13812
13813 @item -fasynchronous-unwind-tables
13814 @opindex fasynchronous-unwind-tables
13815 Generate unwind table in DWARF format, if supported by target machine. The
13816 table is exact at each instruction boundary, so it can be used for stack
13817 unwinding from asynchronous events (such as debugger or garbage collector).
13818
13819 @item -fno-gnu-unique
13820 @opindex fno-gnu-unique
13821 @opindex fgnu-unique
13822 On systems with recent GNU assembler and C library, the C++ compiler
13823 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13824 of template static data members and static local variables in inline
13825 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13826 is necessary to avoid problems with a library used by two different
13827 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13828 therefore disagreeing with the other one about the binding of the
13829 symbol. But this causes @code{dlclose} to be ignored for affected
13830 DSOs; if your program relies on reinitialization of a DSO via
13831 @code{dlclose} and @code{dlopen}, you can use
13832 @option{-fno-gnu-unique}.
13833
13834 @item -fpcc-struct-return
13835 @opindex fpcc-struct-return
13836 Return ``short'' @code{struct} and @code{union} values in memory like
13837 longer ones, rather than in registers. This convention is less
13838 efficient, but it has the advantage of allowing intercallability between
13839 GCC-compiled files and files compiled with other compilers, particularly
13840 the Portable C Compiler (pcc).
13841
13842 The precise convention for returning structures in memory depends
13843 on the target configuration macros.
13844
13845 Short structures and unions are those whose size and alignment match
13846 that of some integer type.
13847
13848 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13849 switch is not binary compatible with code compiled with the
13850 @option{-freg-struct-return} switch.
13851 Use it to conform to a non-default application binary interface.
13852
13853 @item -freg-struct-return
13854 @opindex freg-struct-return
13855 Return @code{struct} and @code{union} values in registers when possible.
13856 This is more efficient for small structures than
13857 @option{-fpcc-struct-return}.
13858
13859 If you specify neither @option{-fpcc-struct-return} nor
13860 @option{-freg-struct-return}, GCC defaults to whichever convention is
13861 standard for the target. If there is no standard convention, GCC
13862 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13863 the principal compiler. In those cases, we can choose the standard, and
13864 we chose the more efficient register return alternative.
13865
13866 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13867 switch is not binary compatible with code compiled with the
13868 @option{-fpcc-struct-return} switch.
13869 Use it to conform to a non-default application binary interface.
13870
13871 @item -fshort-enums
13872 @opindex fshort-enums
13873 Allocate to an @code{enum} type only as many bytes as it needs for the
13874 declared range of possible values. Specifically, the @code{enum} type
13875 is equivalent to the smallest integer type that has enough room.
13876
13877 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13878 code that is not binary compatible with code generated without that switch.
13879 Use it to conform to a non-default application binary interface.
13880
13881 @item -fshort-wchar
13882 @opindex fshort-wchar
13883 Override the underlying type for @code{wchar_t} to be @code{short
13884 unsigned int} instead of the default for the target. This option is
13885 useful for building programs to run under WINE@.
13886
13887 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13888 code that is not binary compatible with code generated without that switch.
13889 Use it to conform to a non-default application binary interface.
13890
13891 @item -fno-common
13892 @opindex fno-common
13893 @opindex fcommon
13894 @cindex tentative definitions
13895 In C code, this option controls the placement of global variables
13896 defined without an initializer, known as @dfn{tentative definitions}
13897 in the C standard. Tentative definitions are distinct from declarations
13898 of a variable with the @code{extern} keyword, which do not allocate storage.
13899
13900 Unix C compilers have traditionally allocated storage for
13901 uninitialized global variables in a common block. This allows the
13902 linker to resolve all tentative definitions of the same variable
13903 in different compilation units to the same object, or to a non-tentative
13904 definition.
13905 This is the behavior specified by @option{-fcommon}, and is the default for
13906 GCC on most targets.
13907 On the other hand, this behavior is not required by ISO
13908 C, and on some targets may carry a speed or code size penalty on
13909 variable references.
13910
13911 The @option{-fno-common} option specifies that the compiler should instead
13912 place uninitialized global variables in the BSS section of the object file.
13913 This inhibits the merging of tentative definitions by the linker so
13914 you get a multiple-definition error if the same
13915 variable is defined in more than one compilation unit.
13916 Compiling with @option{-fno-common} is useful on targets for which
13917 it provides better performance, or if you wish to verify that the
13918 program will work on other systems that always treat uninitialized
13919 variable definitions this way.
13920
13921 @item -fno-ident
13922 @opindex fno-ident
13923 @opindex fident
13924 Ignore the @code{#ident} directive.
13925
13926 @item -finhibit-size-directive
13927 @opindex finhibit-size-directive
13928 Don't output a @code{.size} assembler directive, or anything else that
13929 would cause trouble if the function is split in the middle, and the
13930 two halves are placed at locations far apart in memory. This option is
13931 used when compiling @file{crtstuff.c}; you should not need to use it
13932 for anything else.
13933
13934 @item -fverbose-asm
13935 @opindex fverbose-asm
13936 Put extra commentary information in the generated assembly code to
13937 make it more readable. This option is generally only of use to those
13938 who actually need to read the generated assembly code (perhaps while
13939 debugging the compiler itself).
13940
13941 @option{-fno-verbose-asm}, the default, causes the
13942 extra information to be omitted and is useful when comparing two assembler
13943 files.
13944
13945 The added comments include:
13946
13947 @itemize @bullet
13948
13949 @item
13950 information on the compiler version and command-line options,
13951
13952 @item
13953 the source code lines associated with the assembly instructions,
13954 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13955
13956 @item
13957 hints on which high-level expressions correspond to
13958 the various assembly instruction operands.
13959
13960 @end itemize
13961
13962 For example, given this C source file:
13963
13964 @smallexample
13965 int test (int n)
13966 @{
13967 int i;
13968 int total = 0;
13969
13970 for (i = 0; i < n; i++)
13971 total += i * i;
13972
13973 return total;
13974 @}
13975 @end smallexample
13976
13977 compiling to (x86_64) assembly via @option{-S} and emitting the result
13978 direct to stdout via @option{-o} @option{-}
13979
13980 @smallexample
13981 gcc -S test.c -fverbose-asm -Os -o -
13982 @end smallexample
13983
13984 gives output similar to this:
13985
13986 @smallexample
13987 .file "test.c"
13988 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13989 [...snip...]
13990 # options passed:
13991 [...snip...]
13992
13993 .text
13994 .globl test
13995 .type test, @@function
13996 test:
13997 .LFB0:
13998 .cfi_startproc
13999 # test.c:4: int total = 0;
14000 xorl %eax, %eax # <retval>
14001 # test.c:6: for (i = 0; i < n; i++)
14002 xorl %edx, %edx # i
14003 .L2:
14004 # test.c:6: for (i = 0; i < n; i++)
14005 cmpl %edi, %edx # n, i
14006 jge .L5 #,
14007 # test.c:7: total += i * i;
14008 movl %edx, %ecx # i, tmp92
14009 imull %edx, %ecx # i, tmp92
14010 # test.c:6: for (i = 0; i < n; i++)
14011 incl %edx # i
14012 # test.c:7: total += i * i;
14013 addl %ecx, %eax # tmp92, <retval>
14014 jmp .L2 #
14015 .L5:
14016 # test.c:10: @}
14017 ret
14018 .cfi_endproc
14019 .LFE0:
14020 .size test, .-test
14021 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14022 .section .note.GNU-stack,"",@@progbits
14023 @end smallexample
14024
14025 The comments are intended for humans rather than machines and hence the
14026 precise format of the comments is subject to change.
14027
14028 @item -frecord-gcc-switches
14029 @opindex frecord-gcc-switches
14030 This switch causes the command line used to invoke the
14031 compiler to be recorded into the object file that is being created.
14032 This switch is only implemented on some targets and the exact format
14033 of the recording is target and binary file format dependent, but it
14034 usually takes the form of a section containing ASCII text. This
14035 switch is related to the @option{-fverbose-asm} switch, but that
14036 switch only records information in the assembler output file as
14037 comments, so it never reaches the object file.
14038 See also @option{-grecord-gcc-switches} for another
14039 way of storing compiler options into the object file.
14040
14041 @item -fpic
14042 @opindex fpic
14043 @cindex global offset table
14044 @cindex PIC
14045 Generate position-independent code (PIC) suitable for use in a shared
14046 library, if supported for the target machine. Such code accesses all
14047 constant addresses through a global offset table (GOT)@. The dynamic
14048 loader resolves the GOT entries when the program starts (the dynamic
14049 loader is not part of GCC; it is part of the operating system). If
14050 the GOT size for the linked executable exceeds a machine-specific
14051 maximum size, you get an error message from the linker indicating that
14052 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14053 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14054 on the m68k and RS/6000. The x86 has no such limit.)
14055
14056 Position-independent code requires special support, and therefore works
14057 only on certain machines. For the x86, GCC supports PIC for System V
14058 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14059 position-independent.
14060
14061 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14062 are defined to 1.
14063
14064 @item -fPIC
14065 @opindex fPIC
14066 If supported for the target machine, emit position-independent code,
14067 suitable for dynamic linking and avoiding any limit on the size of the
14068 global offset table. This option makes a difference on AArch64, m68k,
14069 PowerPC and SPARC@.
14070
14071 Position-independent code requires special support, and therefore works
14072 only on certain machines.
14073
14074 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14075 are defined to 2.
14076
14077 @item -fpie
14078 @itemx -fPIE
14079 @opindex fpie
14080 @opindex fPIE
14081 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14082 generated position-independent code can be only linked into executables.
14083 Usually these options are used to compile code that will be linked using
14084 the @option{-pie} GCC option.
14085
14086 @option{-fpie} and @option{-fPIE} both define the macros
14087 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14088 for @option{-fpie} and 2 for @option{-fPIE}.
14089
14090 @item -fno-plt
14091 @opindex fno-plt
14092 @opindex fplt
14093 Do not use the PLT for external function calls in position-independent code.
14094 Instead, load the callee address at call sites from the GOT and branch to it.
14095 This leads to more efficient code by eliminating PLT stubs and exposing
14096 GOT loads to optimizations. On architectures such as 32-bit x86 where
14097 PLT stubs expect the GOT pointer in a specific register, this gives more
14098 register allocation freedom to the compiler.
14099 Lazy binding requires use of the PLT;
14100 with @option{-fno-plt} all external symbols are resolved at load time.
14101
14102 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14103 through the PLT for specific external functions.
14104
14105 In position-dependent code, a few targets also convert calls to
14106 functions that are marked to not use the PLT to use the GOT instead.
14107
14108 @item -fno-jump-tables
14109 @opindex fno-jump-tables
14110 @opindex fjump-tables
14111 Do not use jump tables for switch statements even where it would be
14112 more efficient than other code generation strategies. This option is
14113 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14114 building code that forms part of a dynamic linker and cannot
14115 reference the address of a jump table. On some targets, jump tables
14116 do not require a GOT and this option is not needed.
14117
14118 @item -ffixed-@var{reg}
14119 @opindex ffixed
14120 Treat the register named @var{reg} as a fixed register; generated code
14121 should never refer to it (except perhaps as a stack pointer, frame
14122 pointer or in some other fixed role).
14123
14124 @var{reg} must be the name of a register. The register names accepted
14125 are machine-specific and are defined in the @code{REGISTER_NAMES}
14126 macro in the machine description macro file.
14127
14128 This flag does not have a negative form, because it specifies a
14129 three-way choice.
14130
14131 @item -fcall-used-@var{reg}
14132 @opindex fcall-used
14133 Treat the register named @var{reg} as an allocable register that is
14134 clobbered by function calls. It may be allocated for temporaries or
14135 variables that do not live across a call. Functions compiled this way
14136 do not save and restore the register @var{reg}.
14137
14138 It is an error to use this flag with the frame pointer or stack pointer.
14139 Use of this flag for other registers that have fixed pervasive roles in
14140 the machine's execution model produces disastrous results.
14141
14142 This flag does not have a negative form, because it specifies a
14143 three-way choice.
14144
14145 @item -fcall-saved-@var{reg}
14146 @opindex fcall-saved
14147 Treat the register named @var{reg} as an allocable register saved by
14148 functions. It may be allocated even for temporaries or variables that
14149 live across a call. Functions compiled this way save and restore
14150 the register @var{reg} if they use it.
14151
14152 It is an error to use this flag with the frame pointer or stack pointer.
14153 Use of this flag for other registers that have fixed pervasive roles in
14154 the machine's execution model produces disastrous results.
14155
14156 A different sort of disaster results from the use of this flag for
14157 a register in which function values may be returned.
14158
14159 This flag does not have a negative form, because it specifies a
14160 three-way choice.
14161
14162 @item -fpack-struct[=@var{n}]
14163 @opindex fpack-struct
14164 Without a value specified, pack all structure members together without
14165 holes. When a value is specified (which must be a small power of two), pack
14166 structure members according to this value, representing the maximum
14167 alignment (that is, objects with default alignment requirements larger than
14168 this are output potentially unaligned at the next fitting location.
14169
14170 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14171 code that is not binary compatible with code generated without that switch.
14172 Additionally, it makes the code suboptimal.
14173 Use it to conform to a non-default application binary interface.
14174
14175 @item -fleading-underscore
14176 @opindex fleading-underscore
14177 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14178 change the way C symbols are represented in the object file. One use
14179 is to help link with legacy assembly code.
14180
14181 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14182 generate code that is not binary compatible with code generated without that
14183 switch. Use it to conform to a non-default application binary interface.
14184 Not all targets provide complete support for this switch.
14185
14186 @item -ftls-model=@var{model}
14187 @opindex ftls-model
14188 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14189 The @var{model} argument should be one of @samp{global-dynamic},
14190 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14191 Note that the choice is subject to optimization: the compiler may use
14192 a more efficient model for symbols not visible outside of the translation
14193 unit, or if @option{-fpic} is not given on the command line.
14194
14195 The default without @option{-fpic} is @samp{initial-exec}; with
14196 @option{-fpic} the default is @samp{global-dynamic}.
14197
14198 @item -ftrampolines
14199 @opindex ftrampolines
14200 For targets that normally need trampolines for nested functions, always
14201 generate them instead of using descriptors. Otherwise, for targets that
14202 do not need them, like for example HP-PA or IA-64, do nothing.
14203
14204 A trampoline is a small piece of code that is created at run time on the
14205 stack when the address of a nested function is taken, and is used to call
14206 the nested function indirectly. Therefore, it requires the stack to be
14207 made executable in order for the program to work properly.
14208
14209 @option{-fno-trampolines} is enabled by default on a language by language
14210 basis to let the compiler avoid generating them, if it computes that this
14211 is safe, and replace them with descriptors. Descriptors are made up of data
14212 only, but the generated code must be prepared to deal with them. As of this
14213 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14214
14215 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14216 @option{-fno-trampolines} are not binary compatible if nested functions are
14217 present. This option must therefore be used on a program-wide basis and be
14218 manipulated with extreme care.
14219
14220 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14221 @opindex fvisibility
14222 Set the default ELF image symbol visibility to the specified option---all
14223 symbols are marked with this unless overridden within the code.
14224 Using this feature can very substantially improve linking and
14225 load times of shared object libraries, produce more optimized
14226 code, provide near-perfect API export and prevent symbol clashes.
14227 It is @strong{strongly} recommended that you use this in any shared objects
14228 you distribute.
14229
14230 Despite the nomenclature, @samp{default} always means public; i.e.,
14231 available to be linked against from outside the shared object.
14232 @samp{protected} and @samp{internal} are pretty useless in real-world
14233 usage so the only other commonly used option is @samp{hidden}.
14234 The default if @option{-fvisibility} isn't specified is
14235 @samp{default}, i.e., make every symbol public.
14236
14237 A good explanation of the benefits offered by ensuring ELF
14238 symbols have the correct visibility is given by ``How To Write
14239 Shared Libraries'' by Ulrich Drepper (which can be found at
14240 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14241 solution made possible by this option to marking things hidden when
14242 the default is public is to make the default hidden and mark things
14243 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14244 and @code{__attribute__ ((visibility("default")))} instead of
14245 @code{__declspec(dllexport)} you get almost identical semantics with
14246 identical syntax. This is a great boon to those working with
14247 cross-platform projects.
14248
14249 For those adding visibility support to existing code, you may find
14250 @code{#pragma GCC visibility} of use. This works by you enclosing
14251 the declarations you wish to set visibility for with (for example)
14252 @code{#pragma GCC visibility push(hidden)} and
14253 @code{#pragma GCC visibility pop}.
14254 Bear in mind that symbol visibility should be viewed @strong{as
14255 part of the API interface contract} and thus all new code should
14256 always specify visibility when it is not the default; i.e., declarations
14257 only for use within the local DSO should @strong{always} be marked explicitly
14258 as hidden as so to avoid PLT indirection overheads---making this
14259 abundantly clear also aids readability and self-documentation of the code.
14260 Note that due to ISO C++ specification requirements, @code{operator new} and
14261 @code{operator delete} must always be of default visibility.
14262
14263 Be aware that headers from outside your project, in particular system
14264 headers and headers from any other library you use, may not be
14265 expecting to be compiled with visibility other than the default. You
14266 may need to explicitly say @code{#pragma GCC visibility push(default)}
14267 before including any such headers.
14268
14269 @code{extern} declarations are not affected by @option{-fvisibility}, so
14270 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14271 no modifications. However, this means that calls to @code{extern}
14272 functions with no explicit visibility use the PLT, so it is more
14273 effective to use @code{__attribute ((visibility))} and/or
14274 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14275 declarations should be treated as hidden.
14276
14277 Note that @option{-fvisibility} does affect C++ vague linkage
14278 entities. This means that, for instance, an exception class that is
14279 be thrown between DSOs must be explicitly marked with default
14280 visibility so that the @samp{type_info} nodes are unified between
14281 the DSOs.
14282
14283 An overview of these techniques, their benefits and how to use them
14284 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14285
14286 @item -fstrict-volatile-bitfields
14287 @opindex fstrict-volatile-bitfields
14288 This option should be used if accesses to volatile bit-fields (or other
14289 structure fields, although the compiler usually honors those types
14290 anyway) should use a single access of the width of the
14291 field's type, aligned to a natural alignment if possible. For
14292 example, targets with memory-mapped peripheral registers might require
14293 all such accesses to be 16 bits wide; with this flag you can
14294 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14295 is 16 bits on these targets) to force GCC to use 16-bit accesses
14296 instead of, perhaps, a more efficient 32-bit access.
14297
14298 If this option is disabled, the compiler uses the most efficient
14299 instruction. In the previous example, that might be a 32-bit load
14300 instruction, even though that accesses bytes that do not contain
14301 any portion of the bit-field, or memory-mapped registers unrelated to
14302 the one being updated.
14303
14304 In some cases, such as when the @code{packed} attribute is applied to a
14305 structure field, it may not be possible to access the field with a single
14306 read or write that is correctly aligned for the target machine. In this
14307 case GCC falls back to generating multiple accesses rather than code that
14308 will fault or truncate the result at run time.
14309
14310 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14311 not allowed to touch non bit-field members. It is therefore recommended
14312 to define all bits of the field's type as bit-field members.
14313
14314 The default value of this option is determined by the application binary
14315 interface for the target processor.
14316
14317 @item -fsync-libcalls
14318 @opindex fsync-libcalls
14319 This option controls whether any out-of-line instance of the @code{__sync}
14320 family of functions may be used to implement the C++11 @code{__atomic}
14321 family of functions.
14322
14323 The default value of this option is enabled, thus the only useful form
14324 of the option is @option{-fno-sync-libcalls}. This option is used in
14325 the implementation of the @file{libatomic} runtime library.
14326
14327 @end table
14328
14329 @node Developer Options
14330 @section GCC Developer Options
14331 @cindex developer options
14332 @cindex debugging GCC
14333 @cindex debug dump options
14334 @cindex dump options
14335 @cindex compilation statistics
14336
14337 This section describes command-line options that are primarily of
14338 interest to GCC developers, including options to support compiler
14339 testing and investigation of compiler bugs and compile-time
14340 performance problems. This includes options that produce debug dumps
14341 at various points in the compilation; that print statistics such as
14342 memory use and execution time; and that print information about GCC's
14343 configuration, such as where it searches for libraries. You should
14344 rarely need to use any of these options for ordinary compilation and
14345 linking tasks.
14346
14347 Many developer options that cause GCC to dump output to a file take an
14348 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14349 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14350 error.
14351
14352 If @samp{=@var{filename}} is omitted, a default dump file name is
14353 constructed by concatenating the base dump file name, a pass number,
14354 phase letter, and pass name. The base dump file name is the name of
14355 output file produced by the compiler if explicitly specified and not
14356 an executable; otherwise it is the source file name.
14357 The pass number is determined by the order passes are registered with
14358 the compiler's pass manager.
14359 This is generally the same as the order of execution, but passes
14360 registered by plugins, target-specific passes, or passes that are
14361 otherwise registered late are numbered higher than the pass named
14362 @samp{final}, even if they are executed earlier. The phase letter is
14363 one of @samp{i} (inter-procedural analysis), @samp{l}
14364 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14365 The files are created in the directory of the output file.
14366
14367 @table @gcctabopt
14368
14369 @item -d@var{letters}
14370 @itemx -fdump-rtl-@var{pass}
14371 @itemx -fdump-rtl-@var{pass}=@var{filename}
14372 @opindex d
14373 @opindex fdump-rtl-@var{pass}
14374 Says to make debugging dumps during compilation at times specified by
14375 @var{letters}. This is used for debugging the RTL-based passes of the
14376 compiler.
14377
14378 Some @option{-d@var{letters}} switches have different meaning when
14379 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14380 for information about preprocessor-specific dump options.
14381
14382 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14383 @option{-d} option @var{letters}. Here are the possible
14384 letters for use in @var{pass} and @var{letters}, and their meanings:
14385
14386 @table @gcctabopt
14387
14388 @item -fdump-rtl-alignments
14389 @opindex fdump-rtl-alignments
14390 Dump after branch alignments have been computed.
14391
14392 @item -fdump-rtl-asmcons
14393 @opindex fdump-rtl-asmcons
14394 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14395
14396 @item -fdump-rtl-auto_inc_dec
14397 @opindex fdump-rtl-auto_inc_dec
14398 Dump after auto-inc-dec discovery. This pass is only run on
14399 architectures that have auto inc or auto dec instructions.
14400
14401 @item -fdump-rtl-barriers
14402 @opindex fdump-rtl-barriers
14403 Dump after cleaning up the barrier instructions.
14404
14405 @item -fdump-rtl-bbpart
14406 @opindex fdump-rtl-bbpart
14407 Dump after partitioning hot and cold basic blocks.
14408
14409 @item -fdump-rtl-bbro
14410 @opindex fdump-rtl-bbro
14411 Dump after block reordering.
14412
14413 @item -fdump-rtl-btl1
14414 @itemx -fdump-rtl-btl2
14415 @opindex fdump-rtl-btl2
14416 @opindex fdump-rtl-btl2
14417 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14418 after the two branch
14419 target load optimization passes.
14420
14421 @item -fdump-rtl-bypass
14422 @opindex fdump-rtl-bypass
14423 Dump after jump bypassing and control flow optimizations.
14424
14425 @item -fdump-rtl-combine
14426 @opindex fdump-rtl-combine
14427 Dump after the RTL instruction combination pass.
14428
14429 @item -fdump-rtl-compgotos
14430 @opindex fdump-rtl-compgotos
14431 Dump after duplicating the computed gotos.
14432
14433 @item -fdump-rtl-ce1
14434 @itemx -fdump-rtl-ce2
14435 @itemx -fdump-rtl-ce3
14436 @opindex fdump-rtl-ce1
14437 @opindex fdump-rtl-ce2
14438 @opindex fdump-rtl-ce3
14439 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14440 @option{-fdump-rtl-ce3} enable dumping after the three
14441 if conversion passes.
14442
14443 @item -fdump-rtl-cprop_hardreg
14444 @opindex fdump-rtl-cprop_hardreg
14445 Dump after hard register copy propagation.
14446
14447 @item -fdump-rtl-csa
14448 @opindex fdump-rtl-csa
14449 Dump after combining stack adjustments.
14450
14451 @item -fdump-rtl-cse1
14452 @itemx -fdump-rtl-cse2
14453 @opindex fdump-rtl-cse1
14454 @opindex fdump-rtl-cse2
14455 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14456 the two common subexpression elimination passes.
14457
14458 @item -fdump-rtl-dce
14459 @opindex fdump-rtl-dce
14460 Dump after the standalone dead code elimination passes.
14461
14462 @item -fdump-rtl-dbr
14463 @opindex fdump-rtl-dbr
14464 Dump after delayed branch scheduling.
14465
14466 @item -fdump-rtl-dce1
14467 @itemx -fdump-rtl-dce2
14468 @opindex fdump-rtl-dce1
14469 @opindex fdump-rtl-dce2
14470 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14471 the two dead store elimination passes.
14472
14473 @item -fdump-rtl-eh
14474 @opindex fdump-rtl-eh
14475 Dump after finalization of EH handling code.
14476
14477 @item -fdump-rtl-eh_ranges
14478 @opindex fdump-rtl-eh_ranges
14479 Dump after conversion of EH handling range regions.
14480
14481 @item -fdump-rtl-expand
14482 @opindex fdump-rtl-expand
14483 Dump after RTL generation.
14484
14485 @item -fdump-rtl-fwprop1
14486 @itemx -fdump-rtl-fwprop2
14487 @opindex fdump-rtl-fwprop1
14488 @opindex fdump-rtl-fwprop2
14489 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14490 dumping after the two forward propagation passes.
14491
14492 @item -fdump-rtl-gcse1
14493 @itemx -fdump-rtl-gcse2
14494 @opindex fdump-rtl-gcse1
14495 @opindex fdump-rtl-gcse2
14496 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14497 after global common subexpression elimination.
14498
14499 @item -fdump-rtl-init-regs
14500 @opindex fdump-rtl-init-regs
14501 Dump after the initialization of the registers.
14502
14503 @item -fdump-rtl-initvals
14504 @opindex fdump-rtl-initvals
14505 Dump after the computation of the initial value sets.
14506
14507 @item -fdump-rtl-into_cfglayout
14508 @opindex fdump-rtl-into_cfglayout
14509 Dump after converting to cfglayout mode.
14510
14511 @item -fdump-rtl-ira
14512 @opindex fdump-rtl-ira
14513 Dump after iterated register allocation.
14514
14515 @item -fdump-rtl-jump
14516 @opindex fdump-rtl-jump
14517 Dump after the second jump optimization.
14518
14519 @item -fdump-rtl-loop2
14520 @opindex fdump-rtl-loop2
14521 @option{-fdump-rtl-loop2} enables dumping after the rtl
14522 loop optimization passes.
14523
14524 @item -fdump-rtl-mach
14525 @opindex fdump-rtl-mach
14526 Dump after performing the machine dependent reorganization pass, if that
14527 pass exists.
14528
14529 @item -fdump-rtl-mode_sw
14530 @opindex fdump-rtl-mode_sw
14531 Dump after removing redundant mode switches.
14532
14533 @item -fdump-rtl-rnreg
14534 @opindex fdump-rtl-rnreg
14535 Dump after register renumbering.
14536
14537 @item -fdump-rtl-outof_cfglayout
14538 @opindex fdump-rtl-outof_cfglayout
14539 Dump after converting from cfglayout mode.
14540
14541 @item -fdump-rtl-peephole2
14542 @opindex fdump-rtl-peephole2
14543 Dump after the peephole pass.
14544
14545 @item -fdump-rtl-postreload
14546 @opindex fdump-rtl-postreload
14547 Dump after post-reload optimizations.
14548
14549 @item -fdump-rtl-pro_and_epilogue
14550 @opindex fdump-rtl-pro_and_epilogue
14551 Dump after generating the function prologues and epilogues.
14552
14553 @item -fdump-rtl-sched1
14554 @itemx -fdump-rtl-sched2
14555 @opindex fdump-rtl-sched1
14556 @opindex fdump-rtl-sched2
14557 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14558 after the basic block scheduling passes.
14559
14560 @item -fdump-rtl-ree
14561 @opindex fdump-rtl-ree
14562 Dump after sign/zero extension elimination.
14563
14564 @item -fdump-rtl-seqabstr
14565 @opindex fdump-rtl-seqabstr
14566 Dump after common sequence discovery.
14567
14568 @item -fdump-rtl-shorten
14569 @opindex fdump-rtl-shorten
14570 Dump after shortening branches.
14571
14572 @item -fdump-rtl-sibling
14573 @opindex fdump-rtl-sibling
14574 Dump after sibling call optimizations.
14575
14576 @item -fdump-rtl-split1
14577 @itemx -fdump-rtl-split2
14578 @itemx -fdump-rtl-split3
14579 @itemx -fdump-rtl-split4
14580 @itemx -fdump-rtl-split5
14581 @opindex fdump-rtl-split1
14582 @opindex fdump-rtl-split2
14583 @opindex fdump-rtl-split3
14584 @opindex fdump-rtl-split4
14585 @opindex fdump-rtl-split5
14586 These options enable dumping after five rounds of
14587 instruction splitting.
14588
14589 @item -fdump-rtl-sms
14590 @opindex fdump-rtl-sms
14591 Dump after modulo scheduling. This pass is only run on some
14592 architectures.
14593
14594 @item -fdump-rtl-stack
14595 @opindex fdump-rtl-stack
14596 Dump after conversion from GCC's ``flat register file'' registers to the
14597 x87's stack-like registers. This pass is only run on x86 variants.
14598
14599 @item -fdump-rtl-subreg1
14600 @itemx -fdump-rtl-subreg2
14601 @opindex fdump-rtl-subreg1
14602 @opindex fdump-rtl-subreg2
14603 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14604 the two subreg expansion passes.
14605
14606 @item -fdump-rtl-unshare
14607 @opindex fdump-rtl-unshare
14608 Dump after all rtl has been unshared.
14609
14610 @item -fdump-rtl-vartrack
14611 @opindex fdump-rtl-vartrack
14612 Dump after variable tracking.
14613
14614 @item -fdump-rtl-vregs
14615 @opindex fdump-rtl-vregs
14616 Dump after converting virtual registers to hard registers.
14617
14618 @item -fdump-rtl-web
14619 @opindex fdump-rtl-web
14620 Dump after live range splitting.
14621
14622 @item -fdump-rtl-regclass
14623 @itemx -fdump-rtl-subregs_of_mode_init
14624 @itemx -fdump-rtl-subregs_of_mode_finish
14625 @itemx -fdump-rtl-dfinit
14626 @itemx -fdump-rtl-dfinish
14627 @opindex fdump-rtl-regclass
14628 @opindex fdump-rtl-subregs_of_mode_init
14629 @opindex fdump-rtl-subregs_of_mode_finish
14630 @opindex fdump-rtl-dfinit
14631 @opindex fdump-rtl-dfinish
14632 These dumps are defined but always produce empty files.
14633
14634 @item -da
14635 @itemx -fdump-rtl-all
14636 @opindex da
14637 @opindex fdump-rtl-all
14638 Produce all the dumps listed above.
14639
14640 @item -dA
14641 @opindex dA
14642 Annotate the assembler output with miscellaneous debugging information.
14643
14644 @item -dD
14645 @opindex dD
14646 Dump all macro definitions, at the end of preprocessing, in addition to
14647 normal output.
14648
14649 @item -dH
14650 @opindex dH
14651 Produce a core dump whenever an error occurs.
14652
14653 @item -dp
14654 @opindex dp
14655 Annotate the assembler output with a comment indicating which
14656 pattern and alternative is used. The length and cost of each instruction are
14657 also printed.
14658
14659 @item -dP
14660 @opindex dP
14661 Dump the RTL in the assembler output as a comment before each instruction.
14662 Also turns on @option{-dp} annotation.
14663
14664 @item -dx
14665 @opindex dx
14666 Just generate RTL for a function instead of compiling it. Usually used
14667 with @option{-fdump-rtl-expand}.
14668 @end table
14669
14670 @item -fdump-debug
14671 @opindex fdump-debug
14672 Dump debugging information generated during the debug
14673 generation phase.
14674
14675 @item -fdump-earlydebug
14676 @opindex fdump-earlydebug
14677 Dump debugging information generated during the early debug
14678 generation phase.
14679
14680 @item -fdump-noaddr
14681 @opindex fdump-noaddr
14682 When doing debugging dumps, suppress address output. This makes it more
14683 feasible to use diff on debugging dumps for compiler invocations with
14684 different compiler binaries and/or different
14685 text / bss / data / heap / stack / dso start locations.
14686
14687 @item -freport-bug
14688 @opindex freport-bug
14689 Collect and dump debug information into a temporary file if an
14690 internal compiler error (ICE) occurs.
14691
14692 @item -fdump-unnumbered
14693 @opindex fdump-unnumbered
14694 When doing debugging dumps, suppress instruction numbers and address output.
14695 This makes it more feasible to use diff on debugging dumps for compiler
14696 invocations with different options, in particular with and without
14697 @option{-g}.
14698
14699 @item -fdump-unnumbered-links
14700 @opindex fdump-unnumbered-links
14701 When doing debugging dumps (see @option{-d} option above), suppress
14702 instruction numbers for the links to the previous and next instructions
14703 in a sequence.
14704
14705 @item -fdump-ipa-@var{switch}
14706 @itemx -fdump-ipa-@var{switch}-@var{options}
14707 @opindex fdump-ipa
14708 Control the dumping at various stages of inter-procedural analysis
14709 language tree to a file. The file name is generated by appending a
14710 switch specific suffix to the source file name, and the file is created
14711 in the same directory as the output file. The following dumps are
14712 possible:
14713
14714 @table @samp
14715 @item all
14716 Enables all inter-procedural analysis dumps.
14717
14718 @item cgraph
14719 Dumps information about call-graph optimization, unused function removal,
14720 and inlining decisions.
14721
14722 @item inline
14723 Dump after function inlining.
14724
14725 @end table
14726
14727 Additionally, the options @option{-optimized}, @option{-missed},
14728 @option{-note}, and @option{-all} can be provided, with the same meaning
14729 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14730
14731 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14732 information on callsites that were inlined, along with callsites
14733 that were not inlined.
14734
14735 By default, the dump will contain messages about successful
14736 optimizations (equivalent to @option{-optimized}) together with
14737 low-level details about the analysis.
14738
14739 @item -fdump-lang-all
14740 @itemx -fdump-lang-@var{switch}
14741 @itemx -fdump-lang-@var{switch}-@var{options}
14742 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14743 @opindex fdump-lang-all
14744 @opindex fdump-lang
14745 Control the dumping of language-specific information. The @var{options}
14746 and @var{filename} portions behave as described in the
14747 @option{-fdump-tree} option. The following @var{switch} values are
14748 accepted:
14749
14750 @table @samp
14751 @item all
14752
14753 Enable all language-specific dumps.
14754
14755 @item class
14756 Dump class hierarchy information. Virtual table information is emitted
14757 unless '@option{slim}' is specified. This option is applicable to C++ only.
14758
14759 @item raw
14760 Dump the raw internal tree data. This option is applicable to C++ only.
14761
14762 @end table
14763
14764 @item -fdump-passes
14765 @opindex fdump-passes
14766 Print on @file{stderr} the list of optimization passes that are turned
14767 on and off by the current command-line options.
14768
14769 @item -fdump-statistics-@var{option}
14770 @opindex fdump-statistics
14771 Enable and control dumping of pass statistics in a separate file. The
14772 file name is generated by appending a suffix ending in
14773 @samp{.statistics} to the source file name, and the file is created in
14774 the same directory as the output file. If the @samp{-@var{option}}
14775 form is used, @samp{-stats} causes counters to be summed over the
14776 whole compilation unit while @samp{-details} dumps every event as
14777 the passes generate them. The default with no option is to sum
14778 counters for each function compiled.
14779
14780 @item -fdump-tree-all
14781 @itemx -fdump-tree-@var{switch}
14782 @itemx -fdump-tree-@var{switch}-@var{options}
14783 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14784 @opindex fdump-tree-all
14785 @opindex fdump-tree
14786 Control the dumping at various stages of processing the intermediate
14787 language tree to a file. If the @samp{-@var{options}}
14788 form is used, @var{options} is a list of @samp{-} separated options
14789 which control the details of the dump. Not all options are applicable
14790 to all dumps; those that are not meaningful are ignored. The
14791 following options are available
14792
14793 @table @samp
14794 @item address
14795 Print the address of each node. Usually this is not meaningful as it
14796 changes according to the environment and source file. Its primary use
14797 is for tying up a dump file with a debug environment.
14798 @item asmname
14799 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14800 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14801 use working backward from mangled names in the assembly file.
14802 @item slim
14803 When dumping front-end intermediate representations, inhibit dumping
14804 of members of a scope or body of a function merely because that scope
14805 has been reached. Only dump such items when they are directly reachable
14806 by some other path.
14807
14808 When dumping pretty-printed trees, this option inhibits dumping the
14809 bodies of control structures.
14810
14811 When dumping RTL, print the RTL in slim (condensed) form instead of
14812 the default LISP-like representation.
14813 @item raw
14814 Print a raw representation of the tree. By default, trees are
14815 pretty-printed into a C-like representation.
14816 @item details
14817 Enable more detailed dumps (not honored by every dump option). Also
14818 include information from the optimization passes.
14819 @item stats
14820 Enable dumping various statistics about the pass (not honored by every dump
14821 option).
14822 @item blocks
14823 Enable showing basic block boundaries (disabled in raw dumps).
14824 @item graph
14825 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14826 dump a representation of the control flow graph suitable for viewing with
14827 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14828 the file is pretty-printed as a subgraph, so that GraphViz can render them
14829 all in a single plot.
14830
14831 This option currently only works for RTL dumps, and the RTL is always
14832 dumped in slim form.
14833 @item vops
14834 Enable showing virtual operands for every statement.
14835 @item lineno
14836 Enable showing line numbers for statements.
14837 @item uid
14838 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14839 @item verbose
14840 Enable showing the tree dump for each statement.
14841 @item eh
14842 Enable showing the EH region number holding each statement.
14843 @item scev
14844 Enable showing scalar evolution analysis details.
14845 @item optimized
14846 Enable showing optimization information (only available in certain
14847 passes).
14848 @item missed
14849 Enable showing missed optimization information (only available in certain
14850 passes).
14851 @item note
14852 Enable other detailed optimization information (only available in
14853 certain passes).
14854 @item all
14855 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14856 and @option{lineno}.
14857 @item optall
14858 Turn on all optimization options, i.e., @option{optimized},
14859 @option{missed}, and @option{note}.
14860 @end table
14861
14862 To determine what tree dumps are available or find the dump for a pass
14863 of interest follow the steps below.
14864
14865 @enumerate
14866 @item
14867 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14868 look for a code that corresponds to the pass you are interested in.
14869 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14870 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14871 The number at the end distinguishes distinct invocations of the same pass.
14872 @item
14873 To enable the creation of the dump file, append the pass code to
14874 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14875 to enable the dump from the Early Value Range Propagation pass, invoke
14876 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14877 specify the name of the dump file. If you don't specify one, GCC
14878 creates as described below.
14879 @item
14880 Find the pass dump in a file whose name is composed of three components
14881 separated by a period: the name of the source file GCC was invoked to
14882 compile, a numeric suffix indicating the pass number followed by the
14883 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14884 and finally the pass code. For example, the Early VRP pass dump might
14885 be in a file named @file{myfile.c.038t.evrp} in the current working
14886 directory. Note that the numeric codes are not stable and may change
14887 from one version of GCC to another.
14888 @end enumerate
14889
14890 @item -fopt-info
14891 @itemx -fopt-info-@var{options}
14892 @itemx -fopt-info-@var{options}=@var{filename}
14893 @opindex fopt-info
14894 Controls optimization dumps from various optimization passes. If the
14895 @samp{-@var{options}} form is used, @var{options} is a list of
14896 @samp{-} separated option keywords to select the dump details and
14897 optimizations.
14898
14899 The @var{options} can be divided into three groups:
14900 @enumerate
14901 @item
14902 options describing what kinds of messages should be emitted,
14903 @item
14904 options describing the verbosity of the dump, and
14905 @item
14906 options describing which optimizations should be included.
14907 @end enumerate
14908 The options from each group can be freely mixed as they are
14909 non-overlapping. However, in case of any conflicts,
14910 the later options override the earlier options on the command
14911 line.
14912
14913 The following options control which kinds of messages should be emitted:
14914
14915 @table @samp
14916 @item optimized
14917 Print information when an optimization is successfully applied. It is
14918 up to a pass to decide which information is relevant. For example, the
14919 vectorizer passes print the source location of loops which are
14920 successfully vectorized.
14921 @item missed
14922 Print information about missed optimizations. Individual passes
14923 control which information to include in the output.
14924 @item note
14925 Print verbose information about optimizations, such as certain
14926 transformations, more detailed messages about decisions etc.
14927 @item all
14928 Print detailed optimization information. This includes
14929 @samp{optimized}, @samp{missed}, and @samp{note}.
14930 @end table
14931
14932 The following option controls the dump verbosity:
14933
14934 @table @samp
14935 @item internals
14936 By default, only ``high-level'' messages are emitted. This option enables
14937 additional, more detailed, messages, which are likely to only be of interest
14938 to GCC developers.
14939 @end table
14940
14941 One or more of the following option keywords can be used to describe a
14942 group of optimizations:
14943
14944 @table @samp
14945 @item ipa
14946 Enable dumps from all interprocedural optimizations.
14947 @item loop
14948 Enable dumps from all loop optimizations.
14949 @item inline
14950 Enable dumps from all inlining optimizations.
14951 @item omp
14952 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14953 @item vec
14954 Enable dumps from all vectorization optimizations.
14955 @item optall
14956 Enable dumps from all optimizations. This is a superset of
14957 the optimization groups listed above.
14958 @end table
14959
14960 If @var{options} is
14961 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
14962 about successful optimizations from all the passes, omitting messages
14963 that are treated as ``internals''.
14964
14965 If the @var{filename} is provided, then the dumps from all the
14966 applicable optimizations are concatenated into the @var{filename}.
14967 Otherwise the dump is output onto @file{stderr}. Though multiple
14968 @option{-fopt-info} options are accepted, only one of them can include
14969 a @var{filename}. If other filenames are provided then all but the
14970 first such option are ignored.
14971
14972 Note that the output @var{filename} is overwritten
14973 in case of multiple translation units. If a combined output from
14974 multiple translation units is desired, @file{stderr} should be used
14975 instead.
14976
14977 In the following example, the optimization info is output to
14978 @file{stderr}:
14979
14980 @smallexample
14981 gcc -O3 -fopt-info
14982 @end smallexample
14983
14984 This example:
14985 @smallexample
14986 gcc -O3 -fopt-info-missed=missed.all
14987 @end smallexample
14988
14989 @noindent
14990 outputs missed optimization report from all the passes into
14991 @file{missed.all}, and this one:
14992
14993 @smallexample
14994 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14995 @end smallexample
14996
14997 @noindent
14998 prints information about missed optimization opportunities from
14999 vectorization passes on @file{stderr}.
15000 Note that @option{-fopt-info-vec-missed} is equivalent to
15001 @option{-fopt-info-missed-vec}. The order of the optimization group
15002 names and message types listed after @option{-fopt-info} does not matter.
15003
15004 As another example,
15005 @smallexample
15006 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15007 @end smallexample
15008
15009 @noindent
15010 outputs information about missed optimizations as well as
15011 optimized locations from all the inlining passes into
15012 @file{inline.txt}.
15013
15014 Finally, consider:
15015
15016 @smallexample
15017 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15018 @end smallexample
15019
15020 @noindent
15021 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15022 in conflict since only one output file is allowed. In this case, only
15023 the first option takes effect and the subsequent options are
15024 ignored. Thus only @file{vec.miss} is produced which contains
15025 dumps from the vectorizer about missed opportunities.
15026
15027 @item -fsave-optimization-record
15028 @opindex fsave-optimization-record
15029 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15030 were performed, for those optimizations that support @option{-fopt-info}.
15031
15032 This option is experimental and the format of the data within the
15033 compressed JSON file is subject to change.
15034
15035 It is roughly equivalent to a machine-readable version of
15036 @option{-fopt-info-all}, as a collection of messages with source file,
15037 line number and column number, with the following additional data for
15038 each message:
15039
15040 @itemize @bullet
15041
15042 @item
15043 the execution count of the code being optimized, along with metadata about
15044 whether this was from actual profile data, or just an estimate, allowing
15045 consumers to prioritize messages by code hotness,
15046
15047 @item
15048 the function name of the code being optimized, where applicable,
15049
15050 @item
15051 the ``inlining chain'' for the code being optimized, so that when
15052 a function is inlined into several different places (which might
15053 themselves be inlined), the reader can distinguish between the copies,
15054
15055 @item
15056 objects identifying those parts of the message that refer to expressions,
15057 statements or symbol-table nodes, which of these categories they are, and,
15058 when available, their source code location,
15059
15060 @item
15061 the GCC pass that emitted the message, and
15062
15063 @item
15064 the location in GCC's own code from which the message was emitted
15065
15066 @end itemize
15067
15068 Additionally, some messages are logically nested within other
15069 messages, reflecting implementation details of the optimization
15070 passes.
15071
15072 @item -fsched-verbose=@var{n}
15073 @opindex fsched-verbose
15074 On targets that use instruction scheduling, this option controls the
15075 amount of debugging output the scheduler prints to the dump files.
15076
15077 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15078 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15079 For @var{n} greater than one, it also output basic block probabilities,
15080 detailed ready list information and unit/insn info. For @var{n} greater
15081 than two, it includes RTL at abort point, control-flow and regions info.
15082 And for @var{n} over four, @option{-fsched-verbose} also includes
15083 dependence info.
15084
15085
15086
15087 @item -fenable-@var{kind}-@var{pass}
15088 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15089 @opindex fdisable-
15090 @opindex fenable-
15091
15092 This is a set of options that are used to explicitly disable/enable
15093 optimization passes. These options are intended for use for debugging GCC.
15094 Compiler users should use regular options for enabling/disabling
15095 passes instead.
15096
15097 @table @gcctabopt
15098
15099 @item -fdisable-ipa-@var{pass}
15100 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15101 statically invoked in the compiler multiple times, the pass name should be
15102 appended with a sequential number starting from 1.
15103
15104 @item -fdisable-rtl-@var{pass}
15105 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15106 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15107 statically invoked in the compiler multiple times, the pass name should be
15108 appended with a sequential number starting from 1. @var{range-list} is a
15109 comma-separated list of function ranges or assembler names. Each range is a number
15110 pair separated by a colon. The range is inclusive in both ends. If the range
15111 is trivial, the number pair can be simplified as a single number. If the
15112 function's call graph node's @var{uid} falls within one of the specified ranges,
15113 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15114 function header of a dump file, and the pass names can be dumped by using
15115 option @option{-fdump-passes}.
15116
15117 @item -fdisable-tree-@var{pass}
15118 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15119 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15120 option arguments.
15121
15122 @item -fenable-ipa-@var{pass}
15123 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15124 statically invoked in the compiler multiple times, the pass name should be
15125 appended with a sequential number starting from 1.
15126
15127 @item -fenable-rtl-@var{pass}
15128 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15129 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15130 description and examples.
15131
15132 @item -fenable-tree-@var{pass}
15133 @itemx -fenable-tree-@var{pass}=@var{range-list}
15134 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15135 of option arguments.
15136
15137 @end table
15138
15139 Here are some examples showing uses of these options.
15140
15141 @smallexample
15142
15143 # disable ccp1 for all functions
15144 -fdisable-tree-ccp1
15145 # disable complete unroll for function whose cgraph node uid is 1
15146 -fenable-tree-cunroll=1
15147 # disable gcse2 for functions at the following ranges [1,1],
15148 # [300,400], and [400,1000]
15149 # disable gcse2 for functions foo and foo2
15150 -fdisable-rtl-gcse2=foo,foo2
15151 # disable early inlining
15152 -fdisable-tree-einline
15153 # disable ipa inlining
15154 -fdisable-ipa-inline
15155 # enable tree full unroll
15156 -fenable-tree-unroll
15157
15158 @end smallexample
15159
15160 @item -fchecking
15161 @itemx -fchecking=@var{n}
15162 @opindex fchecking
15163 @opindex fno-checking
15164 Enable internal consistency checking. The default depends on
15165 the compiler configuration. @option{-fchecking=2} enables further
15166 internal consistency checking that might affect code generation.
15167
15168 @item -frandom-seed=@var{string}
15169 @opindex frandom-seed
15170 This option provides a seed that GCC uses in place of
15171 random numbers in generating certain symbol names
15172 that have to be different in every compiled file. It is also used to
15173 place unique stamps in coverage data files and the object files that
15174 produce them. You can use the @option{-frandom-seed} option to produce
15175 reproducibly identical object files.
15176
15177 The @var{string} can either be a number (decimal, octal or hex) or an
15178 arbitrary string (in which case it's converted to a number by
15179 computing CRC32).
15180
15181 The @var{string} should be different for every file you compile.
15182
15183 @item -save-temps
15184 @itemx -save-temps=cwd
15185 @opindex save-temps
15186 Store the usual ``temporary'' intermediate files permanently; place them
15187 in the current directory and name them based on the source file. Thus,
15188 compiling @file{foo.c} with @option{-c -save-temps} produces files
15189 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15190 preprocessed @file{foo.i} output file even though the compiler now
15191 normally uses an integrated preprocessor.
15192
15193 When used in combination with the @option{-x} command-line option,
15194 @option{-save-temps} is sensible enough to avoid over writing an
15195 input source file with the same extension as an intermediate file.
15196 The corresponding intermediate file may be obtained by renaming the
15197 source file before using @option{-save-temps}.
15198
15199 If you invoke GCC in parallel, compiling several different source
15200 files that share a common base name in different subdirectories or the
15201 same source file compiled for multiple output destinations, it is
15202 likely that the different parallel compilers will interfere with each
15203 other, and overwrite the temporary files. For instance:
15204
15205 @smallexample
15206 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15207 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15208 @end smallexample
15209
15210 may result in @file{foo.i} and @file{foo.o} being written to
15211 simultaneously by both compilers.
15212
15213 @item -save-temps=obj
15214 @opindex save-temps=obj
15215 Store the usual ``temporary'' intermediate files permanently. If the
15216 @option{-o} option is used, the temporary files are based on the
15217 object file. If the @option{-o} option is not used, the
15218 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15219
15220 For example:
15221
15222 @smallexample
15223 gcc -save-temps=obj -c foo.c
15224 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15225 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15226 @end smallexample
15227
15228 @noindent
15229 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15230 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15231 @file{dir2/yfoobar.o}.
15232
15233 @item -time@r{[}=@var{file}@r{]}
15234 @opindex time
15235 Report the CPU time taken by each subprocess in the compilation
15236 sequence. For C source files, this is the compiler proper and assembler
15237 (plus the linker if linking is done).
15238
15239 Without the specification of an output file, the output looks like this:
15240
15241 @smallexample
15242 # cc1 0.12 0.01
15243 # as 0.00 0.01
15244 @end smallexample
15245
15246 The first number on each line is the ``user time'', that is time spent
15247 executing the program itself. The second number is ``system time'',
15248 time spent executing operating system routines on behalf of the program.
15249 Both numbers are in seconds.
15250
15251 With the specification of an output file, the output is appended to the
15252 named file, and it looks like this:
15253
15254 @smallexample
15255 0.12 0.01 cc1 @var{options}
15256 0.00 0.01 as @var{options}
15257 @end smallexample
15258
15259 The ``user time'' and the ``system time'' are moved before the program
15260 name, and the options passed to the program are displayed, so that one
15261 can later tell what file was being compiled, and with which options.
15262
15263 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15264 @opindex fdump-final-insns
15265 Dump the final internal representation (RTL) to @var{file}. If the
15266 optional argument is omitted (or if @var{file} is @code{.}), the name
15267 of the dump file is determined by appending @code{.gkd} to the
15268 compilation output file name.
15269
15270 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15271 @opindex fcompare-debug
15272 @opindex fno-compare-debug
15273 If no error occurs during compilation, run the compiler a second time,
15274 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15275 passed to the second compilation. Dump the final internal
15276 representation in both compilations, and print an error if they differ.
15277
15278 If the equal sign is omitted, the default @option{-gtoggle} is used.
15279
15280 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15281 and nonzero, implicitly enables @option{-fcompare-debug}. If
15282 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15283 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15284 is used.
15285
15286 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15287 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15288 of the final representation and the second compilation, preventing even
15289 @env{GCC_COMPARE_DEBUG} from taking effect.
15290
15291 To verify full coverage during @option{-fcompare-debug} testing, set
15292 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15293 which GCC rejects as an invalid option in any actual compilation
15294 (rather than preprocessing, assembly or linking). To get just a
15295 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15296 not overridden} will do.
15297
15298 @item -fcompare-debug-second
15299 @opindex fcompare-debug-second
15300 This option is implicitly passed to the compiler for the second
15301 compilation requested by @option{-fcompare-debug}, along with options to
15302 silence warnings, and omitting other options that would cause the compiler
15303 to produce output to files or to standard output as a side effect. Dump
15304 files and preserved temporary files are renamed so as to contain the
15305 @code{.gk} additional extension during the second compilation, to avoid
15306 overwriting those generated by the first.
15307
15308 When this option is passed to the compiler driver, it causes the
15309 @emph{first} compilation to be skipped, which makes it useful for little
15310 other than debugging the compiler proper.
15311
15312 @item -gtoggle
15313 @opindex gtoggle
15314 Turn off generation of debug info, if leaving out this option
15315 generates it, or turn it on at level 2 otherwise. The position of this
15316 argument in the command line does not matter; it takes effect after all
15317 other options are processed, and it does so only once, no matter how
15318 many times it is given. This is mainly intended to be used with
15319 @option{-fcompare-debug}.
15320
15321 @item -fvar-tracking-assignments-toggle
15322 @opindex fvar-tracking-assignments-toggle
15323 @opindex fno-var-tracking-assignments-toggle
15324 Toggle @option{-fvar-tracking-assignments}, in the same way that
15325 @option{-gtoggle} toggles @option{-g}.
15326
15327 @item -Q
15328 @opindex Q
15329 Makes the compiler print out each function name as it is compiled, and
15330 print some statistics about each pass when it finishes.
15331
15332 @item -ftime-report
15333 @opindex ftime-report
15334 Makes the compiler print some statistics about the time consumed by each
15335 pass when it finishes.
15336
15337 @item -ftime-report-details
15338 @opindex ftime-report-details
15339 Record the time consumed by infrastructure parts separately for each pass.
15340
15341 @item -fira-verbose=@var{n}
15342 @opindex fira-verbose
15343 Control the verbosity of the dump file for the integrated register allocator.
15344 The default value is 5. If the value @var{n} is greater or equal to 10,
15345 the dump output is sent to stderr using the same format as @var{n} minus 10.
15346
15347 @item -flto-report
15348 @opindex flto-report
15349 Prints a report with internal details on the workings of the link-time
15350 optimizer. The contents of this report vary from version to version.
15351 It is meant to be useful to GCC developers when processing object
15352 files in LTO mode (via @option{-flto}).
15353
15354 Disabled by default.
15355
15356 @item -flto-report-wpa
15357 @opindex flto-report-wpa
15358 Like @option{-flto-report}, but only print for the WPA phase of Link
15359 Time Optimization.
15360
15361 @item -fmem-report
15362 @opindex fmem-report
15363 Makes the compiler print some statistics about permanent memory
15364 allocation when it finishes.
15365
15366 @item -fmem-report-wpa
15367 @opindex fmem-report-wpa
15368 Makes the compiler print some statistics about permanent memory
15369 allocation for the WPA phase only.
15370
15371 @item -fpre-ipa-mem-report
15372 @opindex fpre-ipa-mem-report
15373 @item -fpost-ipa-mem-report
15374 @opindex fpost-ipa-mem-report
15375 Makes the compiler print some statistics about permanent memory
15376 allocation before or after interprocedural optimization.
15377
15378 @item -fprofile-report
15379 @opindex fprofile-report
15380 Makes the compiler print some statistics about consistency of the
15381 (estimated) profile and effect of individual passes.
15382
15383 @item -fstack-usage
15384 @opindex fstack-usage
15385 Makes the compiler output stack usage information for the program, on a
15386 per-function basis. The filename for the dump is made by appending
15387 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15388 the output file, if explicitly specified and it is not an executable,
15389 otherwise it is the basename of the source file. An entry is made up
15390 of three fields:
15391
15392 @itemize
15393 @item
15394 The name of the function.
15395 @item
15396 A number of bytes.
15397 @item
15398 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15399 @end itemize
15400
15401 The qualifier @code{static} means that the function manipulates the stack
15402 statically: a fixed number of bytes are allocated for the frame on function
15403 entry and released on function exit; no stack adjustments are otherwise made
15404 in the function. The second field is this fixed number of bytes.
15405
15406 The qualifier @code{dynamic} means that the function manipulates the stack
15407 dynamically: in addition to the static allocation described above, stack
15408 adjustments are made in the body of the function, for example to push/pop
15409 arguments around function calls. If the qualifier @code{bounded} is also
15410 present, the amount of these adjustments is bounded at compile time and
15411 the second field is an upper bound of the total amount of stack used by
15412 the function. If it is not present, the amount of these adjustments is
15413 not bounded at compile time and the second field only represents the
15414 bounded part.
15415
15416 @item -fstats
15417 @opindex fstats
15418 Emit statistics about front-end processing at the end of the compilation.
15419 This option is supported only by the C++ front end, and
15420 the information is generally only useful to the G++ development team.
15421
15422 @item -fdbg-cnt-list
15423 @opindex fdbg-cnt-list
15424 Print the name and the counter upper bound for all debug counters.
15425
15426
15427 @item -fdbg-cnt=@var{counter-value-list}
15428 @opindex fdbg-cnt
15429 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15430 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15431 tuples which sets the lower and the upper bound of each debug
15432 counter @var{name}. The @var{lower_bound} is optional and is zero
15433 initialized if not set.
15434 All debug counters have the initial upper bound of @code{UINT_MAX};
15435 thus @code{dbg_cnt} returns true always unless the upper bound
15436 is set by this option.
15437 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15438 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15439 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15440
15441 @item -print-file-name=@var{library}
15442 @opindex print-file-name
15443 Print the full absolute name of the library file @var{library} that
15444 would be used when linking---and don't do anything else. With this
15445 option, GCC does not compile or link anything; it just prints the
15446 file name.
15447
15448 @item -print-multi-directory
15449 @opindex print-multi-directory
15450 Print the directory name corresponding to the multilib selected by any
15451 other switches present in the command line. This directory is supposed
15452 to exist in @env{GCC_EXEC_PREFIX}.
15453
15454 @item -print-multi-lib
15455 @opindex print-multi-lib
15456 Print the mapping from multilib directory names to compiler switches
15457 that enable them. The directory name is separated from the switches by
15458 @samp{;}, and each switch starts with an @samp{@@} instead of the
15459 @samp{-}, without spaces between multiple switches. This is supposed to
15460 ease shell processing.
15461
15462 @item -print-multi-os-directory
15463 @opindex print-multi-os-directory
15464 Print the path to OS libraries for the selected
15465 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15466 present in the @file{lib} subdirectory and no multilibs are used, this is
15467 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15468 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15469 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15470 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15471
15472 @item -print-multiarch
15473 @opindex print-multiarch
15474 Print the path to OS libraries for the selected multiarch,
15475 relative to some @file{lib} subdirectory.
15476
15477 @item -print-prog-name=@var{program}
15478 @opindex print-prog-name
15479 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15480
15481 @item -print-libgcc-file-name
15482 @opindex print-libgcc-file-name
15483 Same as @option{-print-file-name=libgcc.a}.
15484
15485 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15486 but you do want to link with @file{libgcc.a}. You can do:
15487
15488 @smallexample
15489 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15490 @end smallexample
15491
15492 @item -print-search-dirs
15493 @opindex print-search-dirs
15494 Print the name of the configured installation directory and a list of
15495 program and library directories @command{gcc} searches---and don't do anything else.
15496
15497 This is useful when @command{gcc} prints the error message
15498 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15499 To resolve this you either need to put @file{cpp0} and the other compiler
15500 components where @command{gcc} expects to find them, or you can set the environment
15501 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15502 Don't forget the trailing @samp{/}.
15503 @xref{Environment Variables}.
15504
15505 @item -print-sysroot
15506 @opindex print-sysroot
15507 Print the target sysroot directory that is used during
15508 compilation. This is the target sysroot specified either at configure
15509 time or using the @option{--sysroot} option, possibly with an extra
15510 suffix that depends on compilation options. If no target sysroot is
15511 specified, the option prints nothing.
15512
15513 @item -print-sysroot-headers-suffix
15514 @opindex print-sysroot-headers-suffix
15515 Print the suffix added to the target sysroot when searching for
15516 headers, or give an error if the compiler is not configured with such
15517 a suffix---and don't do anything else.
15518
15519 @item -dumpmachine
15520 @opindex dumpmachine
15521 Print the compiler's target machine (for example,
15522 @samp{i686-pc-linux-gnu})---and don't do anything else.
15523
15524 @item -dumpversion
15525 @opindex dumpversion
15526 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15527 anything else. This is the compiler version used in filesystem paths and
15528 specs. Depending on how the compiler has been configured it can be just
15529 a single number (major version), two numbers separated by a dot (major and
15530 minor version) or three numbers separated by dots (major, minor and patchlevel
15531 version).
15532
15533 @item -dumpfullversion
15534 @opindex dumpfullversion
15535 Print the full compiler version---and don't do anything else. The output is
15536 always three numbers separated by dots, major, minor and patchlevel version.
15537
15538 @item -dumpspecs
15539 @opindex dumpspecs
15540 Print the compiler's built-in specs---and don't do anything else. (This
15541 is used when GCC itself is being built.) @xref{Spec Files}.
15542 @end table
15543
15544 @node Submodel Options
15545 @section Machine-Dependent Options
15546 @cindex submodel options
15547 @cindex specifying hardware config
15548 @cindex hardware models and configurations, specifying
15549 @cindex target-dependent options
15550 @cindex machine-dependent options
15551
15552 Each target machine supported by GCC can have its own options---for
15553 example, to allow you to compile for a particular processor variant or
15554 ABI, or to control optimizations specific to that machine. By
15555 convention, the names of machine-specific options start with
15556 @samp{-m}.
15557
15558 Some configurations of the compiler also support additional target-specific
15559 options, usually for compatibility with other compilers on the same
15560 platform.
15561
15562 @c This list is ordered alphanumerically by subsection name.
15563 @c It should be the same order and spelling as these options are listed
15564 @c in Machine Dependent Options
15565
15566 @menu
15567 * AArch64 Options::
15568 * Adapteva Epiphany Options::
15569 * AMD GCN Options::
15570 * ARC Options::
15571 * ARM Options::
15572 * AVR Options::
15573 * Blackfin Options::
15574 * C6X Options::
15575 * CRIS Options::
15576 * CR16 Options::
15577 * C-SKY Options::
15578 * Darwin Options::
15579 * DEC Alpha Options::
15580 * FR30 Options::
15581 * FT32 Options::
15582 * FRV Options::
15583 * GNU/Linux Options::
15584 * H8/300 Options::
15585 * HPPA Options::
15586 * IA-64 Options::
15587 * LM32 Options::
15588 * M32C Options::
15589 * M32R/D Options::
15590 * M680x0 Options::
15591 * MCore Options::
15592 * MeP Options::
15593 * MicroBlaze Options::
15594 * MIPS Options::
15595 * MMIX Options::
15596 * MN10300 Options::
15597 * Moxie Options::
15598 * MSP430 Options::
15599 * NDS32 Options::
15600 * Nios II Options::
15601 * Nvidia PTX Options::
15602 * OpenRISC Options::
15603 * PDP-11 Options::
15604 * picoChip Options::
15605 * PowerPC Options::
15606 * PRU Options::
15607 * RISC-V Options::
15608 * RL78 Options::
15609 * RS/6000 and PowerPC Options::
15610 * RX Options::
15611 * S/390 and zSeries Options::
15612 * Score Options::
15613 * SH Options::
15614 * Solaris 2 Options::
15615 * SPARC Options::
15616 * SPU Options::
15617 * System V Options::
15618 * TILE-Gx Options::
15619 * TILEPro Options::
15620 * V850 Options::
15621 * VAX Options::
15622 * Visium Options::
15623 * VMS Options::
15624 * VxWorks Options::
15625 * x86 Options::
15626 * x86 Windows Options::
15627 * Xstormy16 Options::
15628 * Xtensa Options::
15629 * zSeries Options::
15630 @end menu
15631
15632 @node AArch64 Options
15633 @subsection AArch64 Options
15634 @cindex AArch64 Options
15635
15636 These options are defined for AArch64 implementations:
15637
15638 @table @gcctabopt
15639
15640 @item -mabi=@var{name}
15641 @opindex mabi
15642 Generate code for the specified data model. Permissible values
15643 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15644 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15645 but long int and pointers are 64 bits.
15646
15647 The default depends on the specific target configuration. Note that
15648 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15649 entire program with the same ABI, and link with a compatible set of libraries.
15650
15651 @item -mbig-endian
15652 @opindex mbig-endian
15653 Generate big-endian code. This is the default when GCC is configured for an
15654 @samp{aarch64_be-*-*} target.
15655
15656 @item -mgeneral-regs-only
15657 @opindex mgeneral-regs-only
15658 Generate code which uses only the general-purpose registers. This will prevent
15659 the compiler from using floating-point and Advanced SIMD registers but will not
15660 impose any restrictions on the assembler.
15661
15662 @item -mlittle-endian
15663 @opindex mlittle-endian
15664 Generate little-endian code. This is the default when GCC is configured for an
15665 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15666
15667 @item -mcmodel=tiny
15668 @opindex mcmodel=tiny
15669 Generate code for the tiny code model. The program and its statically defined
15670 symbols must be within 1MB of each other. Programs can be statically or
15671 dynamically linked.
15672
15673 @item -mcmodel=small
15674 @opindex mcmodel=small
15675 Generate code for the small code model. The program and its statically defined
15676 symbols must be within 4GB of each other. Programs can be statically or
15677 dynamically linked. This is the default code model.
15678
15679 @item -mcmodel=large
15680 @opindex mcmodel=large
15681 Generate code for the large code model. This makes no assumptions about
15682 addresses and sizes of sections. Programs can be statically linked only.
15683
15684 @item -mstrict-align
15685 @itemx -mno-strict-align
15686 @opindex mstrict-align
15687 @opindex mno-strict-align
15688 Avoid or allow generating memory accesses that may not be aligned on a natural
15689 object boundary as described in the architecture specification.
15690
15691 @item -momit-leaf-frame-pointer
15692 @itemx -mno-omit-leaf-frame-pointer
15693 @opindex momit-leaf-frame-pointer
15694 @opindex mno-omit-leaf-frame-pointer
15695 Omit or keep the frame pointer in leaf functions. The former behavior is the
15696 default.
15697
15698 @item -mstack-protector-guard=@var{guard}
15699 @itemx -mstack-protector-guard-reg=@var{reg}
15700 @itemx -mstack-protector-guard-offset=@var{offset}
15701 @opindex mstack-protector-guard
15702 @opindex mstack-protector-guard-reg
15703 @opindex mstack-protector-guard-offset
15704 Generate stack protection code using canary at @var{guard}. Supported
15705 locations are @samp{global} for a global canary or @samp{sysreg} for a
15706 canary in an appropriate system register.
15707
15708 With the latter choice the options
15709 @option{-mstack-protector-guard-reg=@var{reg}} and
15710 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15711 which system register to use as base register for reading the canary,
15712 and from what offset from that base register. There is no default
15713 register or offset as this is entirely for use within the Linux
15714 kernel.
15715
15716 @item -mstack-protector-guard=@var{guard}
15717 @itemx -mstack-protector-guard-reg=@var{reg}
15718 @itemx -mstack-protector-guard-offset=@var{offset}
15719 @opindex mstack-protector-guard
15720 @opindex mstack-protector-guard-reg
15721 @opindex mstack-protector-guard-offset
15722 Generate stack protection code using canary at @var{guard}. Supported
15723 locations are @samp{global} for a global canary or @samp{sysreg} for a
15724 canary in an appropriate system register.
15725
15726 With the latter choice the options
15727 @option{-mstack-protector-guard-reg=@var{reg}} and
15728 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15729 which system register to use as base register for reading the canary,
15730 and from what offset from that base register. There is no default
15731 register or offset as this is entirely for use within the Linux
15732 kernel.
15733
15734 @item -mtls-dialect=desc
15735 @opindex mtls-dialect=desc
15736 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15737 of TLS variables. This is the default.
15738
15739 @item -mtls-dialect=traditional
15740 @opindex mtls-dialect=traditional
15741 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15742 of TLS variables.
15743
15744 @item -mtls-size=@var{size}
15745 @opindex mtls-size
15746 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15747 This option requires binutils 2.26 or newer.
15748
15749 @item -mfix-cortex-a53-835769
15750 @itemx -mno-fix-cortex-a53-835769
15751 @opindex mfix-cortex-a53-835769
15752 @opindex mno-fix-cortex-a53-835769
15753 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15754 This involves inserting a NOP instruction between memory instructions and
15755 64-bit integer multiply-accumulate instructions.
15756
15757 @item -mfix-cortex-a53-843419
15758 @itemx -mno-fix-cortex-a53-843419
15759 @opindex mfix-cortex-a53-843419
15760 @opindex mno-fix-cortex-a53-843419
15761 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15762 This erratum workaround is made at link time and this will only pass the
15763 corresponding flag to the linker.
15764
15765 @item -mlow-precision-recip-sqrt
15766 @itemx -mno-low-precision-recip-sqrt
15767 @opindex mlow-precision-recip-sqrt
15768 @opindex mno-low-precision-recip-sqrt
15769 Enable or disable the reciprocal square root approximation.
15770 This option only has an effect if @option{-ffast-math} or
15771 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15772 precision of reciprocal square root results to about 16 bits for
15773 single precision and to 32 bits for double precision.
15774
15775 @item -mlow-precision-sqrt
15776 @itemx -mno-low-precision-sqrt
15777 @opindex mlow-precision-sqrt
15778 @opindex mno-low-precision-sqrt
15779 Enable or disable the square root approximation.
15780 This option only has an effect if @option{-ffast-math} or
15781 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15782 precision of square root results to about 16 bits for
15783 single precision and to 32 bits for double precision.
15784 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15785
15786 @item -mlow-precision-div
15787 @itemx -mno-low-precision-div
15788 @opindex mlow-precision-div
15789 @opindex mno-low-precision-div
15790 Enable or disable the division approximation.
15791 This option only has an effect if @option{-ffast-math} or
15792 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15793 precision of division results to about 16 bits for
15794 single precision and to 32 bits for double precision.
15795
15796 @item -mtrack-speculation
15797 @itemx -mno-track-speculation
15798 Enable or disable generation of additional code to track speculative
15799 execution through conditional branches. The tracking state can then
15800 be used by the compiler when expanding calls to
15801 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15802 sequence to be generated.
15803
15804 @item -march=@var{name}
15805 @opindex march
15806 Specify the name of the target architecture and, optionally, one or
15807 more feature modifiers. This option has the form
15808 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15809
15810 The permissible values for @var{arch} are @samp{armv8-a},
15811 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15812 @samp{armv8.5-a} or @var{native}.
15813
15814 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15815 support for the ARMv8.5-A architecture extensions.
15816
15817 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15818 support for the ARMv8.4-A architecture extensions.
15819
15820 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15821 support for the ARMv8.3-A architecture extensions.
15822
15823 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15824 support for the ARMv8.2-A architecture extensions.
15825
15826 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15827 support for the ARMv8.1-A architecture extension. In particular, it
15828 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15829
15830 The value @samp{native} is available on native AArch64 GNU/Linux and
15831 causes the compiler to pick the architecture of the host system. This
15832 option has no effect if the compiler is unable to recognize the
15833 architecture of the host system,
15834
15835 The permissible values for @var{feature} are listed in the sub-section
15836 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15837 Feature Modifiers}. Where conflicting feature modifiers are
15838 specified, the right-most feature is used.
15839
15840 GCC uses @var{name} to determine what kind of instructions it can emit
15841 when generating assembly code. If @option{-march} is specified
15842 without either of @option{-mtune} or @option{-mcpu} also being
15843 specified, the code is tuned to perform well across a range of target
15844 processors implementing the target architecture.
15845
15846 @item -mtune=@var{name}
15847 @opindex mtune
15848 Specify the name of the target processor for which GCC should tune the
15849 performance of the code. Permissible values for this option are:
15850 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15851 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15852 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15853 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
15854 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
15855 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
15856 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
15857 @samp{thunderxt83}, @samp{thunderx2t99},
15858 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15859 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15860 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15861 @samp{native}.
15862
15863 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15864 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15865 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15866 should tune for a big.LITTLE system.
15867
15868 Additionally on native AArch64 GNU/Linux systems the value
15869 @samp{native} tunes performance to the host system. This option has no effect
15870 if the compiler is unable to recognize the processor of the host system.
15871
15872 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15873 are specified, the code is tuned to perform well across a range
15874 of target processors.
15875
15876 This option cannot be suffixed by feature modifiers.
15877
15878 @item -mcpu=@var{name}
15879 @opindex mcpu
15880 Specify the name of the target processor, optionally suffixed by one
15881 or more feature modifiers. This option has the form
15882 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15883 the permissible values for @var{cpu} are the same as those available
15884 for @option{-mtune}. The permissible values for @var{feature} are
15885 documented in the sub-section on
15886 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15887 Feature Modifiers}. Where conflicting feature modifiers are
15888 specified, the right-most feature is used.
15889
15890 GCC uses @var{name} to determine what kind of instructions it can emit when
15891 generating assembly code (as if by @option{-march}) and to determine
15892 the target processor for which to tune for performance (as if
15893 by @option{-mtune}). Where this option is used in conjunction
15894 with @option{-march} or @option{-mtune}, those options take precedence
15895 over the appropriate part of this option.
15896
15897 @item -moverride=@var{string}
15898 @opindex moverride
15899 Override tuning decisions made by the back-end in response to a
15900 @option{-mtune=} switch. The syntax, semantics, and accepted values
15901 for @var{string} in this option are not guaranteed to be consistent
15902 across releases.
15903
15904 This option is only intended to be useful when developing GCC.
15905
15906 @item -mverbose-cost-dump
15907 @opindex mverbose-cost-dump
15908 Enable verbose cost model dumping in the debug dump files. This option is
15909 provided for use in debugging the compiler.
15910
15911 @item -mpc-relative-literal-loads
15912 @itemx -mno-pc-relative-literal-loads
15913 @opindex mpc-relative-literal-loads
15914 @opindex mno-pc-relative-literal-loads
15915 Enable or disable PC-relative literal loads. With this option literal pools are
15916 accessed using a single instruction and emitted after each function. This
15917 limits the maximum size of functions to 1MB. This is enabled by default for
15918 @option{-mcmodel=tiny}.
15919
15920 @item -msign-return-address=@var{scope}
15921 @opindex msign-return-address
15922 Select the function scope on which return address signing will be applied.
15923 Permissible values are @samp{none}, which disables return address signing,
15924 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15925 functions, and @samp{all}, which enables pointer signing for all functions. The
15926 default value is @samp{none}. This option has been deprecated by
15927 -mbranch-protection.
15928
15929 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
15930 @opindex mbranch-protection
15931 Select the branch protection features to use.
15932 @samp{none} is the default and turns off all types of branch protection.
15933 @samp{standard} turns on all types of branch protection features. If a feature
15934 has additional tuning options, then @samp{standard} sets it to its standard
15935 level.
15936 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
15937 level: signing functions that save the return address to memory (non-leaf
15938 functions will practically always do this) using the a-key. The optional
15939 argument @samp{leaf} can be used to extend the signing to include leaf
15940 functions. The optional argument @samp{b-key} can be used to sign the functions
15941 with the B-key instead of the A-key.
15942 @samp{bti} turns on branch target identification mechanism.
15943
15944 @item -msve-vector-bits=@var{bits}
15945 @opindex msve-vector-bits
15946 Specify the number of bits in an SVE vector register. This option only has
15947 an effect when SVE is enabled.
15948
15949 GCC supports two forms of SVE code generation: ``vector-length
15950 agnostic'' output that works with any size of vector register and
15951 ``vector-length specific'' output that allows GCC to make assumptions
15952 about the vector length when it is useful for optimization reasons.
15953 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
15954 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
15955 Specifying @samp{scalable} selects vector-length agnostic
15956 output. At present @samp{-msve-vector-bits=128} also generates vector-length
15957 agnostic output. All other values generate vector-length specific code.
15958 The behavior of these values may change in future releases and no value except
15959 @samp{scalable} should be relied on for producing code that is portable across
15960 different hardware SVE vector lengths.
15961
15962 The default is @samp{-msve-vector-bits=scalable}, which produces
15963 vector-length agnostic code.
15964 @end table
15965
15966 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
15967 @anchor{aarch64-feature-modifiers}
15968 @cindex @option{-march} feature modifiers
15969 @cindex @option{-mcpu} feature modifiers
15970 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
15971 the following and their inverses @option{no@var{feature}}:
15972
15973 @table @samp
15974 @item crc
15975 Enable CRC extension. This is on by default for
15976 @option{-march=armv8.1-a}.
15977 @item crypto
15978 Enable Crypto extension. This also enables Advanced SIMD and floating-point
15979 instructions.
15980 @item fp
15981 Enable floating-point instructions. This is on by default for all possible
15982 values for options @option{-march} and @option{-mcpu}.
15983 @item simd
15984 Enable Advanced SIMD instructions. This also enables floating-point
15985 instructions. This is on by default for all possible values for options
15986 @option{-march} and @option{-mcpu}.
15987 @item sve
15988 Enable Scalable Vector Extension instructions. This also enables Advanced
15989 SIMD and floating-point instructions.
15990 @item lse
15991 Enable Large System Extension instructions. This is on by default for
15992 @option{-march=armv8.1-a}.
15993 @item rdma
15994 Enable Round Double Multiply Accumulate instructions. This is on by default
15995 for @option{-march=armv8.1-a}.
15996 @item fp16
15997 Enable FP16 extension. This also enables floating-point instructions.
15998 @item fp16fml
15999 Enable FP16 fmla extension. This also enables FP16 extensions and
16000 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.
16001
16002 @item rcpc
16003 Enable the RcPc extension. This does not change code generation from GCC,
16004 but is passed on to the assembler, enabling inline asm statements to use
16005 instructions from the RcPc extension.
16006 @item dotprod
16007 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16008 @item aes
16009 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
16010 SIMD instructions.
16011 @item sha2
16012 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
16013 @item sha3
16014 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
16015 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16016 @item sm4
16017 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
16018 Use of this option with architectures prior to Armv8.2-A is not supported.
16019 @item profile
16020 Enable the Statistical Profiling extension. This option is only to enable the
16021 extension at the assembler level and does not affect code generation.
16022 @item rng
16023 Enable the Armv8.5-a Random Number instructions. This option is only to
16024 enable the extension at the assembler level and does not affect code
16025 generation.
16026 @item memtag
16027 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16028 enable the extension at the assembler level and does not affect code
16029 generation.
16030 @item sb
16031 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16032 enable the extension at the assembler level and does not affect code
16033 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16034 @item ssbs
16035 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16036 is only to enable the extension at the assembler level and does not affect code
16037 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16038 @item predres
16039 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16040 This option is only to enable the extension at the assembler level and does
16041 not affect code generation. This option is enabled by default for
16042 @item sve2
16043 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16044 instructions.
16045 @item bitperm
16046 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16047 @item sve2-sm4
16048 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16049 @item sve2-aes
16050 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16051 @item sve2-sha3
16052 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16053 @option{-march=armv8.5-a}.
16054
16055 @end table
16056
16057 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16058 which implies @option{fp}.
16059 Conversely, @option{nofp} implies @option{nosimd}, which implies
16060 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16061
16062 @node Adapteva Epiphany Options
16063 @subsection Adapteva Epiphany Options
16064
16065 These @samp{-m} options are defined for Adapteva Epiphany:
16066
16067 @table @gcctabopt
16068 @item -mhalf-reg-file
16069 @opindex mhalf-reg-file
16070 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16071 That allows code to run on hardware variants that lack these registers.
16072
16073 @item -mprefer-short-insn-regs
16074 @opindex mprefer-short-insn-regs
16075 Preferentially allocate registers that allow short instruction generation.
16076 This can result in increased instruction count, so this may either reduce or
16077 increase overall code size.
16078
16079 @item -mbranch-cost=@var{num}
16080 @opindex mbranch-cost
16081 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16082 This cost is only a heuristic and is not guaranteed to produce
16083 consistent results across releases.
16084
16085 @item -mcmove
16086 @opindex mcmove
16087 Enable the generation of conditional moves.
16088
16089 @item -mnops=@var{num}
16090 @opindex mnops
16091 Emit @var{num} NOPs before every other generated instruction.
16092
16093 @item -mno-soft-cmpsf
16094 @opindex mno-soft-cmpsf
16095 @opindex msoft-cmpsf
16096 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16097 and test the flags. This is faster than a software comparison, but can
16098 get incorrect results in the presence of NaNs, or when two different small
16099 numbers are compared such that their difference is calculated as zero.
16100 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16101 software comparisons.
16102
16103 @item -mstack-offset=@var{num}
16104 @opindex mstack-offset
16105 Set the offset between the top of the stack and the stack pointer.
16106 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16107 can be used by leaf functions without stack allocation.
16108 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16109 Note also that this option changes the ABI; compiling a program with a
16110 different stack offset than the libraries have been compiled with
16111 generally does not work.
16112 This option can be useful if you want to evaluate if a different stack
16113 offset would give you better code, but to actually use a different stack
16114 offset to build working programs, it is recommended to configure the
16115 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16116
16117 @item -mno-round-nearest
16118 @opindex mno-round-nearest
16119 @opindex mround-nearest
16120 Make the scheduler assume that the rounding mode has been set to
16121 truncating. The default is @option{-mround-nearest}.
16122
16123 @item -mlong-calls
16124 @opindex mlong-calls
16125 If not otherwise specified by an attribute, assume all calls might be beyond
16126 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16127 function address into a register before performing a (otherwise direct) call.
16128 This is the default.
16129
16130 @item -mshort-calls
16131 @opindex short-calls
16132 If not otherwise specified by an attribute, assume all direct calls are
16133 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16134 for direct calls. The default is @option{-mlong-calls}.
16135
16136 @item -msmall16
16137 @opindex msmall16
16138 Assume addresses can be loaded as 16-bit unsigned values. This does not
16139 apply to function addresses for which @option{-mlong-calls} semantics
16140 are in effect.
16141
16142 @item -mfp-mode=@var{mode}
16143 @opindex mfp-mode
16144 Set the prevailing mode of the floating-point unit.
16145 This determines the floating-point mode that is provided and expected
16146 at function call and return time. Making this mode match the mode you
16147 predominantly need at function start can make your programs smaller and
16148 faster by avoiding unnecessary mode switches.
16149
16150 @var{mode} can be set to one the following values:
16151
16152 @table @samp
16153 @item caller
16154 Any mode at function entry is valid, and retained or restored when
16155 the function returns, and when it calls other functions.
16156 This mode is useful for compiling libraries or other compilation units
16157 you might want to incorporate into different programs with different
16158 prevailing FPU modes, and the convenience of being able to use a single
16159 object file outweighs the size and speed overhead for any extra
16160 mode switching that might be needed, compared with what would be needed
16161 with a more specific choice of prevailing FPU mode.
16162
16163 @item truncate
16164 This is the mode used for floating-point calculations with
16165 truncating (i.e.@: round towards zero) rounding mode. That includes
16166 conversion from floating point to integer.
16167
16168 @item round-nearest
16169 This is the mode used for floating-point calculations with
16170 round-to-nearest-or-even rounding mode.
16171
16172 @item int
16173 This is the mode used to perform integer calculations in the FPU, e.g.@:
16174 integer multiply, or integer multiply-and-accumulate.
16175 @end table
16176
16177 The default is @option{-mfp-mode=caller}
16178
16179 @item -mno-split-lohi
16180 @itemx -mno-postinc
16181 @itemx -mno-postmodify
16182 @opindex mno-split-lohi
16183 @opindex msplit-lohi
16184 @opindex mno-postinc
16185 @opindex mpostinc
16186 @opindex mno-postmodify
16187 @opindex mpostmodify
16188 Code generation tweaks that disable, respectively, splitting of 32-bit
16189 loads, generation of post-increment addresses, and generation of
16190 post-modify addresses. The defaults are @option{msplit-lohi},
16191 @option{-mpost-inc}, and @option{-mpost-modify}.
16192
16193 @item -mnovect-double
16194 @opindex mno-vect-double
16195 @opindex mvect-double
16196 Change the preferred SIMD mode to SImode. The default is
16197 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16198
16199 @item -max-vect-align=@var{num}
16200 @opindex max-vect-align
16201 The maximum alignment for SIMD vector mode types.
16202 @var{num} may be 4 or 8. The default is 8.
16203 Note that this is an ABI change, even though many library function
16204 interfaces are unaffected if they don't use SIMD vector modes
16205 in places that affect size and/or alignment of relevant types.
16206
16207 @item -msplit-vecmove-early
16208 @opindex msplit-vecmove-early
16209 Split vector moves into single word moves before reload. In theory this
16210 can give better register allocation, but so far the reverse seems to be
16211 generally the case.
16212
16213 @item -m1reg-@var{reg}
16214 @opindex m1reg-
16215 Specify a register to hold the constant @minus{}1, which makes loading small negative
16216 constants and certain bitmasks faster.
16217 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16218 which specify use of that register as a fixed register,
16219 and @samp{none}, which means that no register is used for this
16220 purpose. The default is @option{-m1reg-none}.
16221
16222 @end table
16223
16224 @node AMD GCN Options
16225 @subsection AMD GCN Options
16226 @cindex AMD GCN Options
16227
16228 These options are defined specifically for the AMD GCN port.
16229
16230 @table @gcctabopt
16231
16232 @item -march=@var{gpu}
16233 @opindex march
16234 @itemx -mtune=@var{gpu}
16235 @opindex mtune
16236 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16237 are
16238
16239 @table @samp
16240 @opindex fiji
16241 @item fiji
16242 Compile for GCN3 Fiji devices (gfx803).
16243
16244 @item gfx900
16245 Compile for GCN5 Vega 10 devices (gfx900).
16246
16247 @item gfx906
16248 Compile for GCN5 Vega 20 devices (gfx906).
16249
16250 @end table
16251
16252 @item -mstack-size=@var{bytes}
16253 @opindex mstack-size
16254 Specify how many @var{bytes} of stack space will be requested for each GPU
16255 thread (wave-front). Beware that there may be many threads and limited memory
16256 available. The size of the stack allocation may also have an impact on
16257 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16258 1MB otherwise.
16259
16260 @end table
16261
16262 @node ARC Options
16263 @subsection ARC Options
16264 @cindex ARC options
16265
16266 The following options control the architecture variant for which code
16267 is being compiled:
16268
16269 @c architecture variants
16270 @table @gcctabopt
16271
16272 @item -mbarrel-shifter
16273 @opindex mbarrel-shifter
16274 Generate instructions supported by barrel shifter. This is the default
16275 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16276
16277 @item -mjli-always
16278 @opindex mjli-alawys
16279 Force to call a function using jli_s instruction. This option is
16280 valid only for ARCv2 architecture.
16281
16282 @item -mcpu=@var{cpu}
16283 @opindex mcpu
16284 Set architecture type, register usage, and instruction scheduling
16285 parameters for @var{cpu}. There are also shortcut alias options
16286 available for backward compatibility and convenience. Supported
16287 values for @var{cpu} are
16288
16289 @table @samp
16290 @opindex mA6
16291 @opindex mARC600
16292 @item arc600
16293 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16294
16295 @item arc601
16296 @opindex mARC601
16297 Compile for ARC601. Alias: @option{-mARC601}.
16298
16299 @item arc700
16300 @opindex mA7
16301 @opindex mARC700
16302 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16303 This is the default when configured with @option{--with-cpu=arc700}@.
16304
16305 @item arcem
16306 Compile for ARC EM.
16307
16308 @item archs
16309 Compile for ARC HS.
16310
16311 @item em
16312 Compile for ARC EM CPU with no hardware extensions.
16313
16314 @item em4
16315 Compile for ARC EM4 CPU.
16316
16317 @item em4_dmips
16318 Compile for ARC EM4 DMIPS CPU.
16319
16320 @item em4_fpus
16321 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16322 extension.
16323
16324 @item em4_fpuda
16325 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16326 double assist instructions.
16327
16328 @item hs
16329 Compile for ARC HS CPU with no hardware extensions except the atomic
16330 instructions.
16331
16332 @item hs34
16333 Compile for ARC HS34 CPU.
16334
16335 @item hs38
16336 Compile for ARC HS38 CPU.
16337
16338 @item hs38_linux
16339 Compile for ARC HS38 CPU with all hardware extensions on.
16340
16341 @item arc600_norm
16342 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16343
16344 @item arc600_mul32x16
16345 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16346 instructions enabled.
16347
16348 @item arc600_mul64
16349 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16350 instructions enabled.
16351
16352 @item arc601_norm
16353 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16354
16355 @item arc601_mul32x16
16356 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16357 instructions enabled.
16358
16359 @item arc601_mul64
16360 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16361 instructions enabled.
16362
16363 @item nps400
16364 Compile for ARC 700 on NPS400 chip.
16365
16366 @item em_mini
16367 Compile for ARC EM minimalist configuration featuring reduced register
16368 set.
16369
16370 @end table
16371
16372 @item -mdpfp
16373 @opindex mdpfp
16374 @itemx -mdpfp-compact
16375 @opindex mdpfp-compact
16376 Generate double-precision FPX instructions, tuned for the compact
16377 implementation.
16378
16379 @item -mdpfp-fast
16380 @opindex mdpfp-fast
16381 Generate double-precision FPX instructions, tuned for the fast
16382 implementation.
16383
16384 @item -mno-dpfp-lrsr
16385 @opindex mno-dpfp-lrsr
16386 Disable @code{lr} and @code{sr} instructions from using FPX extension
16387 aux registers.
16388
16389 @item -mea
16390 @opindex mea
16391 Generate extended arithmetic instructions. Currently only
16392 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16393 supported. This is always enabled for @option{-mcpu=ARC700}.
16394
16395 @item -mno-mpy
16396 @opindex mno-mpy
16397 @opindex mmpy
16398 Do not generate @code{mpy}-family instructions for ARC700. This option is
16399 deprecated.
16400
16401 @item -mmul32x16
16402 @opindex mmul32x16
16403 Generate 32x16-bit multiply and multiply-accumulate instructions.
16404
16405 @item -mmul64
16406 @opindex mmul64
16407 Generate @code{mul64} and @code{mulu64} instructions.
16408 Only valid for @option{-mcpu=ARC600}.
16409
16410 @item -mnorm
16411 @opindex mnorm
16412 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16413 is in effect.
16414
16415 @item -mspfp
16416 @opindex mspfp
16417 @itemx -mspfp-compact
16418 @opindex mspfp-compact
16419 Generate single-precision FPX instructions, tuned for the compact
16420 implementation.
16421
16422 @item -mspfp-fast
16423 @opindex mspfp-fast
16424 Generate single-precision FPX instructions, tuned for the fast
16425 implementation.
16426
16427 @item -msimd
16428 @opindex msimd
16429 Enable generation of ARC SIMD instructions via target-specific
16430 builtins. Only valid for @option{-mcpu=ARC700}.
16431
16432 @item -msoft-float
16433 @opindex msoft-float
16434 This option ignored; it is provided for compatibility purposes only.
16435 Software floating-point code is emitted by default, and this default
16436 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16437 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16438 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16439
16440 @item -mswap
16441 @opindex mswap
16442 Generate @code{swap} instructions.
16443
16444 @item -matomic
16445 @opindex matomic
16446 This enables use of the locked load/store conditional extension to implement
16447 atomic memory built-in functions. Not available for ARC 6xx or ARC
16448 EM cores.
16449
16450 @item -mdiv-rem
16451 @opindex mdiv-rem
16452 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16453
16454 @item -mcode-density
16455 @opindex mcode-density
16456 Enable code density instructions for ARC EM.
16457 This option is on by default for ARC HS.
16458
16459 @item -mll64
16460 @opindex mll64
16461 Enable double load/store operations for ARC HS cores.
16462
16463 @item -mtp-regno=@var{regno}
16464 @opindex mtp-regno
16465 Specify thread pointer register number.
16466
16467 @item -mmpy-option=@var{multo}
16468 @opindex mmpy-option
16469 Compile ARCv2 code with a multiplier design option. You can specify
16470 the option using either a string or numeric value for @var{multo}.
16471 @samp{wlh1} is the default value. The recognized values are:
16472
16473 @table @samp
16474 @item 0
16475 @itemx none
16476 No multiplier available.
16477
16478 @item 1
16479 @itemx w
16480 16x16 multiplier, fully pipelined.
16481 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16482
16483 @item 2
16484 @itemx wlh1
16485 32x32 multiplier, fully
16486 pipelined (1 stage). The following instructions are additionally
16487 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16488
16489 @item 3
16490 @itemx wlh2
16491 32x32 multiplier, fully pipelined
16492 (2 stages). The following instructions are additionally enabled: @code{mpy},
16493 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16494
16495 @item 4
16496 @itemx wlh3
16497 Two 16x16 multipliers, blocking,
16498 sequential. The following instructions are additionally enabled: @code{mpy},
16499 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16500
16501 @item 5
16502 @itemx wlh4
16503 One 16x16 multiplier, blocking,
16504 sequential. The following instructions are additionally enabled: @code{mpy},
16505 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16506
16507 @item 6
16508 @itemx wlh5
16509 One 32x4 multiplier, blocking,
16510 sequential. The following instructions are additionally enabled: @code{mpy},
16511 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16512
16513 @item 7
16514 @itemx plus_dmpy
16515 ARC HS SIMD support.
16516
16517 @item 8
16518 @itemx plus_macd
16519 ARC HS SIMD support.
16520
16521 @item 9
16522 @itemx plus_qmacw
16523 ARC HS SIMD support.
16524
16525 @end table
16526
16527 This option is only available for ARCv2 cores@.
16528
16529 @item -mfpu=@var{fpu}
16530 @opindex mfpu
16531 Enables support for specific floating-point hardware extensions for ARCv2
16532 cores. Supported values for @var{fpu} are:
16533
16534 @table @samp
16535
16536 @item fpus
16537 Enables support for single-precision floating-point hardware
16538 extensions@.
16539
16540 @item fpud
16541 Enables support for double-precision floating-point hardware
16542 extensions. The single-precision floating-point extension is also
16543 enabled. Not available for ARC EM@.
16544
16545 @item fpuda
16546 Enables support for double-precision floating-point hardware
16547 extensions using double-precision assist instructions. The single-precision
16548 floating-point extension is also enabled. This option is
16549 only available for ARC EM@.
16550
16551 @item fpuda_div
16552 Enables support for double-precision floating-point hardware
16553 extensions using double-precision assist instructions.
16554 The single-precision floating-point, square-root, and divide
16555 extensions are also enabled. This option is
16556 only available for ARC EM@.
16557
16558 @item fpuda_fma
16559 Enables support for double-precision floating-point hardware
16560 extensions using double-precision assist instructions.
16561 The single-precision floating-point and fused multiply and add
16562 hardware extensions are also enabled. This option is
16563 only available for ARC EM@.
16564
16565 @item fpuda_all
16566 Enables support for double-precision floating-point hardware
16567 extensions using double-precision assist instructions.
16568 All single-precision floating-point hardware extensions are also
16569 enabled. This option is only available for ARC EM@.
16570
16571 @item fpus_div
16572 Enables support for single-precision floating-point, square-root and divide
16573 hardware extensions@.
16574
16575 @item fpud_div
16576 Enables support for double-precision floating-point, square-root and divide
16577 hardware extensions. This option
16578 includes option @samp{fpus_div}. Not available for ARC EM@.
16579
16580 @item fpus_fma
16581 Enables support for single-precision floating-point and
16582 fused multiply and add hardware extensions@.
16583
16584 @item fpud_fma
16585 Enables support for double-precision floating-point and
16586 fused multiply and add hardware extensions. This option
16587 includes option @samp{fpus_fma}. Not available for ARC EM@.
16588
16589 @item fpus_all
16590 Enables support for all single-precision floating-point hardware
16591 extensions@.
16592
16593 @item fpud_all
16594 Enables support for all single- and double-precision floating-point
16595 hardware extensions. Not available for ARC EM@.
16596
16597 @end table
16598
16599 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16600 @opindex mirq-ctrl-saved
16601 Specifies general-purposes registers that the processor automatically
16602 saves/restores on interrupt entry and exit. @var{register-range} is
16603 specified as two registers separated by a dash. The register range
16604 always starts with @code{r0}, the upper limit is @code{fp} register.
16605 @var{blink} and @var{lp_count} are optional. This option is only
16606 valid for ARC EM and ARC HS cores.
16607
16608 @item -mrgf-banked-regs=@var{number}
16609 @opindex mrgf-banked-regs
16610 Specifies the number of registers replicated in second register bank
16611 on entry to fast interrupt. Fast interrupts are interrupts with the
16612 highest priority level P0. These interrupts save only PC and STATUS32
16613 registers to avoid memory transactions during interrupt entry and exit
16614 sequences. Use this option when you are using fast interrupts in an
16615 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16616
16617 @item -mlpc-width=@var{width}
16618 @opindex mlpc-width
16619 Specify the width of the @code{lp_count} register. Valid values for
16620 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16621 fixed to 32 bits. If the width is less than 32, the compiler does not
16622 attempt to transform loops in your program to use the zero-delay loop
16623 mechanism unless it is known that the @code{lp_count} register can
16624 hold the required loop-counter value. Depending on the width
16625 specified, the compiler and run-time library might continue to use the
16626 loop mechanism for various needs. This option defines macro
16627 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16628
16629 @item -mrf16
16630 @opindex mrf16
16631 This option instructs the compiler to generate code for a 16-entry
16632 register file. This option defines the @code{__ARC_RF16__}
16633 preprocessor macro.
16634
16635 @item -mbranch-index
16636 @opindex mbranch-index
16637 Enable use of @code{bi} or @code{bih} instructions to implement jump
16638 tables.
16639
16640 @end table
16641
16642 The following options are passed through to the assembler, and also
16643 define preprocessor macro symbols.
16644
16645 @c Flags used by the assembler, but for which we define preprocessor
16646 @c macro symbols as well.
16647 @table @gcctabopt
16648 @item -mdsp-packa
16649 @opindex mdsp-packa
16650 Passed down to the assembler to enable the DSP Pack A extensions.
16651 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16652 deprecated.
16653
16654 @item -mdvbf
16655 @opindex mdvbf
16656 Passed down to the assembler to enable the dual Viterbi butterfly
16657 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16658 option is deprecated.
16659
16660 @c ARC700 4.10 extension instruction
16661 @item -mlock
16662 @opindex mlock
16663 Passed down to the assembler to enable the locked load/store
16664 conditional extension. Also sets the preprocessor symbol
16665 @code{__Xlock}.
16666
16667 @item -mmac-d16
16668 @opindex mmac-d16
16669 Passed down to the assembler. Also sets the preprocessor symbol
16670 @code{__Xxmac_d16}. This option is deprecated.
16671
16672 @item -mmac-24
16673 @opindex mmac-24
16674 Passed down to the assembler. Also sets the preprocessor symbol
16675 @code{__Xxmac_24}. This option is deprecated.
16676
16677 @c ARC700 4.10 extension instruction
16678 @item -mrtsc
16679 @opindex mrtsc
16680 Passed down to the assembler to enable the 64-bit time-stamp counter
16681 extension instruction. Also sets the preprocessor symbol
16682 @code{__Xrtsc}. This option is deprecated.
16683
16684 @c ARC700 4.10 extension instruction
16685 @item -mswape
16686 @opindex mswape
16687 Passed down to the assembler to enable the swap byte ordering
16688 extension instruction. Also sets the preprocessor symbol
16689 @code{__Xswape}.
16690
16691 @item -mtelephony
16692 @opindex mtelephony
16693 Passed down to the assembler to enable dual- and single-operand
16694 instructions for telephony. Also sets the preprocessor symbol
16695 @code{__Xtelephony}. This option is deprecated.
16696
16697 @item -mxy
16698 @opindex mxy
16699 Passed down to the assembler to enable the XY memory extension. Also
16700 sets the preprocessor symbol @code{__Xxy}.
16701
16702 @end table
16703
16704 The following options control how the assembly code is annotated:
16705
16706 @c Assembly annotation options
16707 @table @gcctabopt
16708 @item -misize
16709 @opindex misize
16710 Annotate assembler instructions with estimated addresses.
16711
16712 @item -mannotate-align
16713 @opindex mannotate-align
16714 Explain what alignment considerations lead to the decision to make an
16715 instruction short or long.
16716
16717 @end table
16718
16719 The following options are passed through to the linker:
16720
16721 @c options passed through to the linker
16722 @table @gcctabopt
16723 @item -marclinux
16724 @opindex marclinux
16725 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16726 This option is enabled by default in tool chains built for
16727 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16728 when profiling is not requested.
16729
16730 @item -marclinux_prof
16731 @opindex marclinux_prof
16732 Passed through to the linker, to specify use of the
16733 @code{arclinux_prof} emulation. This option is enabled by default in
16734 tool chains built for @w{@code{arc-linux-uclibc}} and
16735 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16736
16737 @end table
16738
16739 The following options control the semantics of generated code:
16740
16741 @c semantically relevant code generation options
16742 @table @gcctabopt
16743 @item -mlong-calls
16744 @opindex mlong-calls
16745 Generate calls as register indirect calls, thus providing access
16746 to the full 32-bit address range.
16747
16748 @item -mmedium-calls
16749 @opindex mmedium-calls
16750 Don't use less than 25-bit addressing range for calls, which is the
16751 offset available for an unconditional branch-and-link
16752 instruction. Conditional execution of function calls is suppressed, to
16753 allow use of the 25-bit range, rather than the 21-bit range with
16754 conditional branch-and-link. This is the default for tool chains built
16755 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16756
16757 @item -G @var{num}
16758 @opindex G
16759 Put definitions of externally-visible data in a small data section if
16760 that data is no bigger than @var{num} bytes. The default value of
16761 @var{num} is 4 for any ARC configuration, or 8 when we have double
16762 load/store operations.
16763
16764 @item -mno-sdata
16765 @opindex mno-sdata
16766 @opindex msdata
16767 Do not generate sdata references. This is the default for tool chains
16768 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16769 targets.
16770
16771 @item -mvolatile-cache
16772 @opindex mvolatile-cache
16773 Use ordinarily cached memory accesses for volatile references. This is the
16774 default.
16775
16776 @item -mno-volatile-cache
16777 @opindex mno-volatile-cache
16778 @opindex mvolatile-cache
16779 Enable cache bypass for volatile references.
16780
16781 @end table
16782
16783 The following options fine tune code generation:
16784 @c code generation tuning options
16785 @table @gcctabopt
16786 @item -malign-call
16787 @opindex malign-call
16788 Do alignment optimizations for call instructions.
16789
16790 @item -mauto-modify-reg
16791 @opindex mauto-modify-reg
16792 Enable the use of pre/post modify with register displacement.
16793
16794 @item -mbbit-peephole
16795 @opindex mbbit-peephole
16796 Enable bbit peephole2.
16797
16798 @item -mno-brcc
16799 @opindex mno-brcc
16800 This option disables a target-specific pass in @file{arc_reorg} to
16801 generate compare-and-branch (@code{br@var{cc}}) instructions.
16802 It has no effect on
16803 generation of these instructions driven by the combiner pass.
16804
16805 @item -mcase-vector-pcrel
16806 @opindex mcase-vector-pcrel
16807 Use PC-relative switch case tables to enable case table shortening.
16808 This is the default for @option{-Os}.
16809
16810 @item -mcompact-casesi
16811 @opindex mcompact-casesi
16812 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16813 and only available for ARCv1 cores. This option is deprecated.
16814
16815 @item -mno-cond-exec
16816 @opindex mno-cond-exec
16817 Disable the ARCompact-specific pass to generate conditional
16818 execution instructions.
16819
16820 Due to delay slot scheduling and interactions between operand numbers,
16821 literal sizes, instruction lengths, and the support for conditional execution,
16822 the target-independent pass to generate conditional execution is often lacking,
16823 so the ARC port has kept a special pass around that tries to find more
16824 conditional execution generation opportunities after register allocation,
16825 branch shortening, and delay slot scheduling have been done. This pass
16826 generally, but not always, improves performance and code size, at the cost of
16827 extra compilation time, which is why there is an option to switch it off.
16828 If you have a problem with call instructions exceeding their allowable
16829 offset range because they are conditionalized, you should consider using
16830 @option{-mmedium-calls} instead.
16831
16832 @item -mearly-cbranchsi
16833 @opindex mearly-cbranchsi
16834 Enable pre-reload use of the @code{cbranchsi} pattern.
16835
16836 @item -mexpand-adddi
16837 @opindex mexpand-adddi
16838 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16839 @code{add.f}, @code{adc} etc. This option is deprecated.
16840
16841 @item -mindexed-loads
16842 @opindex mindexed-loads
16843 Enable the use of indexed loads. This can be problematic because some
16844 optimizers then assume that indexed stores exist, which is not
16845 the case.
16846
16847 @item -mlra
16848 @opindex mlra
16849 Enable Local Register Allocation. This is still experimental for ARC,
16850 so by default the compiler uses standard reload
16851 (i.e.@: @option{-mno-lra}).
16852
16853 @item -mlra-priority-none
16854 @opindex mlra-priority-none
16855 Don't indicate any priority for target registers.
16856
16857 @item -mlra-priority-compact
16858 @opindex mlra-priority-compact
16859 Indicate target register priority for r0..r3 / r12..r15.
16860
16861 @item -mlra-priority-noncompact
16862 @opindex mlra-priority-noncompact
16863 Reduce target register priority for r0..r3 / r12..r15.
16864
16865 @item -mmillicode
16866 @opindex mmillicode
16867 When optimizing for size (using @option{-Os}), prologues and epilogues
16868 that have to save or restore a large number of registers are often
16869 shortened by using call to a special function in libgcc; this is
16870 referred to as a @emph{millicode} call. As these calls can pose
16871 performance issues, and/or cause linking issues when linking in a
16872 nonstandard way, this option is provided to turn on or off millicode
16873 call generation.
16874
16875 @item -mcode-density-frame
16876 @opindex mcode-density-frame
16877 This option enable the compiler to emit @code{enter} and @code{leave}
16878 instructions. These instructions are only valid for CPUs with
16879 code-density feature.
16880
16881 @item -mmixed-code
16882 @opindex mmixed-code
16883 Tweak register allocation to help 16-bit instruction generation.
16884 This generally has the effect of decreasing the average instruction size
16885 while increasing the instruction count.
16886
16887 @item -mq-class
16888 @opindex mq-class
16889 Enable @samp{q} instruction alternatives.
16890 This is the default for @option{-Os}.
16891
16892 @item -mRcq
16893 @opindex mRcq
16894 Enable @samp{Rcq} constraint handling.
16895 Most short code generation depends on this.
16896 This is the default.
16897
16898 @item -mRcw
16899 @opindex mRcw
16900 Enable @samp{Rcw} constraint handling.
16901 Most ccfsm condexec mostly depends on this.
16902 This is the default.
16903
16904 @item -msize-level=@var{level}
16905 @opindex msize-level
16906 Fine-tune size optimization with regards to instruction lengths and alignment.
16907 The recognized values for @var{level} are:
16908 @table @samp
16909 @item 0
16910 No size optimization. This level is deprecated and treated like @samp{1}.
16911
16912 @item 1
16913 Short instructions are used opportunistically.
16914
16915 @item 2
16916 In addition, alignment of loops and of code after barriers are dropped.
16917
16918 @item 3
16919 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16920
16921 @end table
16922
16923 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16924 the behavior when this is not set is equivalent to level @samp{1}.
16925
16926 @item -mtune=@var{cpu}
16927 @opindex mtune
16928 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16929 by @option{-mcpu=}.
16930
16931 Supported values for @var{cpu} are
16932
16933 @table @samp
16934 @item ARC600
16935 Tune for ARC600 CPU.
16936
16937 @item ARC601
16938 Tune for ARC601 CPU.
16939
16940 @item ARC700
16941 Tune for ARC700 CPU with standard multiplier block.
16942
16943 @item ARC700-xmac
16944 Tune for ARC700 CPU with XMAC block.
16945
16946 @item ARC725D
16947 Tune for ARC725D CPU.
16948
16949 @item ARC750D
16950 Tune for ARC750D CPU.
16951
16952 @end table
16953
16954 @item -mmultcost=@var{num}
16955 @opindex mmultcost
16956 Cost to assume for a multiply instruction, with @samp{4} being equal to a
16957 normal instruction.
16958
16959 @item -munalign-prob-threshold=@var{probability}
16960 @opindex munalign-prob-threshold
16961 Set probability threshold for unaligning branches.
16962 When tuning for @samp{ARC700} and optimizing for speed, branches without
16963 filled delay slot are preferably emitted unaligned and long, unless
16964 profiling indicates that the probability for the branch to be taken
16965 is below @var{probability}. @xref{Cross-profiling}.
16966 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
16967
16968 @end table
16969
16970 The following options are maintained for backward compatibility, but
16971 are now deprecated and will be removed in a future release:
16972
16973 @c Deprecated options
16974 @table @gcctabopt
16975
16976 @item -margonaut
16977 @opindex margonaut
16978 Obsolete FPX.
16979
16980 @item -mbig-endian
16981 @opindex mbig-endian
16982 @itemx -EB
16983 @opindex EB
16984 Compile code for big-endian targets. Use of these options is now
16985 deprecated. Big-endian code is supported by configuring GCC to build
16986 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
16987 for which big endian is the default.
16988
16989 @item -mlittle-endian
16990 @opindex mlittle-endian
16991 @itemx -EL
16992 @opindex EL
16993 Compile code for little-endian targets. Use of these options is now
16994 deprecated. Little-endian code is supported by configuring GCC to build
16995 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
16996 for which little endian is the default.
16997
16998 @item -mbarrel_shifter
16999 @opindex mbarrel_shifter
17000 Replaced by @option{-mbarrel-shifter}.
17001
17002 @item -mdpfp_compact
17003 @opindex mdpfp_compact
17004 Replaced by @option{-mdpfp-compact}.
17005
17006 @item -mdpfp_fast
17007 @opindex mdpfp_fast
17008 Replaced by @option{-mdpfp-fast}.
17009
17010 @item -mdsp_packa
17011 @opindex mdsp_packa
17012 Replaced by @option{-mdsp-packa}.
17013
17014 @item -mEA
17015 @opindex mEA
17016 Replaced by @option{-mea}.
17017
17018 @item -mmac_24
17019 @opindex mmac_24
17020 Replaced by @option{-mmac-24}.
17021
17022 @item -mmac_d16
17023 @opindex mmac_d16
17024 Replaced by @option{-mmac-d16}.
17025
17026 @item -mspfp_compact
17027 @opindex mspfp_compact
17028 Replaced by @option{-mspfp-compact}.
17029
17030 @item -mspfp_fast
17031 @opindex mspfp_fast
17032 Replaced by @option{-mspfp-fast}.
17033
17034 @item -mtune=@var{cpu}
17035 @opindex mtune
17036 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17037 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17038 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17039
17040 @item -multcost=@var{num}
17041 @opindex multcost
17042 Replaced by @option{-mmultcost}.
17043
17044 @end table
17045
17046 @node ARM Options
17047 @subsection ARM Options
17048 @cindex ARM options
17049
17050 These @samp{-m} options are defined for the ARM port:
17051
17052 @table @gcctabopt
17053 @item -mabi=@var{name}
17054 @opindex mabi
17055 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17056 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17057
17058 @item -mapcs-frame
17059 @opindex mapcs-frame
17060 Generate a stack frame that is compliant with the ARM Procedure Call
17061 Standard for all functions, even if this is not strictly necessary for
17062 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17063 with this option causes the stack frames not to be generated for
17064 leaf functions. The default is @option{-mno-apcs-frame}.
17065 This option is deprecated.
17066
17067 @item -mapcs
17068 @opindex mapcs
17069 This is a synonym for @option{-mapcs-frame} and is deprecated.
17070
17071 @ignore
17072 @c not currently implemented
17073 @item -mapcs-stack-check
17074 @opindex mapcs-stack-check
17075 Generate code to check the amount of stack space available upon entry to
17076 every function (that actually uses some stack space). If there is
17077 insufficient space available then either the function
17078 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17079 called, depending upon the amount of stack space required. The runtime
17080 system is required to provide these functions. The default is
17081 @option{-mno-apcs-stack-check}, since this produces smaller code.
17082
17083 @c not currently implemented
17084 @item -mapcs-reentrant
17085 @opindex mapcs-reentrant
17086 Generate reentrant, position-independent code. The default is
17087 @option{-mno-apcs-reentrant}.
17088 @end ignore
17089
17090 @item -mthumb-interwork
17091 @opindex mthumb-interwork
17092 Generate code that supports calling between the ARM and Thumb
17093 instruction sets. Without this option, on pre-v5 architectures, the
17094 two instruction sets cannot be reliably used inside one program. The
17095 default is @option{-mno-thumb-interwork}, since slightly larger code
17096 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17097 configurations this option is meaningless.
17098
17099 @item -mno-sched-prolog
17100 @opindex mno-sched-prolog
17101 @opindex msched-prolog
17102 Prevent the reordering of instructions in the function prologue, or the
17103 merging of those instruction with the instructions in the function's
17104 body. This means that all functions start with a recognizable set
17105 of instructions (or in fact one of a choice from a small set of
17106 different function prologues), and this information can be used to
17107 locate the start of functions inside an executable piece of code. The
17108 default is @option{-msched-prolog}.
17109
17110 @item -mfloat-abi=@var{name}
17111 @opindex mfloat-abi
17112 Specifies which floating-point ABI to use. Permissible values
17113 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17114
17115 Specifying @samp{soft} causes GCC to generate output containing
17116 library calls for floating-point operations.
17117 @samp{softfp} allows the generation of code using hardware floating-point
17118 instructions, but still uses the soft-float calling conventions.
17119 @samp{hard} allows generation of floating-point instructions
17120 and uses FPU-specific calling conventions.
17121
17122 The default depends on the specific target configuration. Note that
17123 the hard-float and soft-float ABIs are not link-compatible; you must
17124 compile your entire program with the same ABI, and link with a
17125 compatible set of libraries.
17126
17127 @item -mgeneral-regs-only
17128 @opindex mgeneral-regs-only
17129 Generate code which uses only the general-purpose registers. This will prevent
17130 the compiler from using floating-point and Advanced SIMD registers but will not
17131 impose any restrictions on the assembler.
17132
17133 @item -mlittle-endian
17134 @opindex mlittle-endian
17135 Generate code for a processor running in little-endian mode. This is
17136 the default for all standard configurations.
17137
17138 @item -mbig-endian
17139 @opindex mbig-endian
17140 Generate code for a processor running in big-endian mode; the default is
17141 to compile code for a little-endian processor.
17142
17143 @item -mbe8
17144 @itemx -mbe32
17145 @opindex mbe8
17146 When linking a big-endian image select between BE8 and BE32 formats.
17147 The option has no effect for little-endian images and is ignored. The
17148 default is dependent on the selected target architecture. For ARMv6
17149 and later architectures the default is BE8, for older architectures
17150 the default is BE32. BE32 format has been deprecated by ARM.
17151
17152 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17153 @opindex march
17154 This specifies the name of the target ARM architecture. GCC uses this
17155 name to determine what kind of instructions it can emit when generating
17156 assembly code. This option can be used in conjunction with or instead
17157 of the @option{-mcpu=} option.
17158
17159 Permissible names are:
17160 @samp{armv4t},
17161 @samp{armv5t}, @samp{armv5te},
17162 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17163 @samp{armv6z}, @samp{armv6zk},
17164 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17165 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17166 @samp{armv8.4-a},
17167 @samp{armv8.5-a},
17168 @samp{armv7-r},
17169 @samp{armv8-r},
17170 @samp{armv6-m}, @samp{armv6s-m},
17171 @samp{armv7-m}, @samp{armv7e-m},
17172 @samp{armv8-m.base}, @samp{armv8-m.main},
17173 @samp{iwmmxt} and @samp{iwmmxt2}.
17174
17175 Additionally, the following architectures, which lack support for the
17176 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17177
17178 Many of the architectures support extensions. These can be added by
17179 appending @samp{+@var{extension}} to the architecture name. Extension
17180 options are processed in order and capabilities accumulate. An extension
17181 will also enable any necessary base extensions
17182 upon which it depends. For example, the @samp{+crypto} extension
17183 will always enable the @samp{+simd} extension. The exception to the
17184 additive construction is for extensions that are prefixed with
17185 @samp{+no@dots{}}: these extensions disable the specified option and
17186 any other extensions that may depend on the presence of that
17187 extension.
17188
17189 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17190 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17191 entirely disabled by the @samp{+nofp} option that follows it.
17192
17193 Most extension names are generically named, but have an effect that is
17194 dependent upon the architecture to which it is applied. For example,
17195 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17196 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17197 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17198 variant for @samp{armv8-a}.
17199
17200 The table below lists the supported extensions for each architecture.
17201 Architectures not mentioned do not support any extensions.
17202
17203 @table @samp
17204 @item armv5te
17205 @itemx armv6
17206 @itemx armv6j
17207 @itemx armv6k
17208 @itemx armv6kz
17209 @itemx armv6t2
17210 @itemx armv6z
17211 @itemx armv6zk
17212 @table @samp
17213 @item +fp
17214 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17215 used as an alias for this extension.
17216
17217 @item +nofp
17218 Disable the floating-point instructions.
17219 @end table
17220
17221 @item armv7
17222 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17223 @table @samp
17224 @item +fp
17225 The VFPv3 floating-point instructions, with 16 double-precision
17226 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17227 for this extension. Note that floating-point is not supported by the
17228 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17229 ARMv7-R architectures.
17230
17231 @item +nofp
17232 Disable the floating-point instructions.
17233 @end table
17234
17235 @item armv7-a
17236 @table @samp
17237 @item +mp
17238 The multiprocessing extension.
17239
17240 @item +sec
17241 The security extension.
17242
17243 @item +fp
17244 The VFPv3 floating-point instructions, with 16 double-precision
17245 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17246 for this extension.
17247
17248 @item +simd
17249 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17250 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17251 for this extension.
17252
17253 @item +vfpv3
17254 The VFPv3 floating-point instructions, with 32 double-precision
17255 registers.
17256
17257 @item +vfpv3-d16-fp16
17258 The VFPv3 floating-point instructions, with 16 double-precision
17259 registers and the half-precision floating-point conversion operations.
17260
17261 @item +vfpv3-fp16
17262 The VFPv3 floating-point instructions, with 32 double-precision
17263 registers and the half-precision floating-point conversion operations.
17264
17265 @item +vfpv4-d16
17266 The VFPv4 floating-point instructions, with 16 double-precision
17267 registers.
17268
17269 @item +vfpv4
17270 The VFPv4 floating-point instructions, with 32 double-precision
17271 registers.
17272
17273 @item +neon-fp16
17274 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17275 the half-precision floating-point conversion operations.
17276
17277 @item +neon-vfpv4
17278 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17279
17280 @item +nosimd
17281 Disable the Advanced SIMD instructions (does not disable floating point).
17282
17283 @item +nofp
17284 Disable the floating-point and Advanced SIMD instructions.
17285 @end table
17286
17287 @item armv7ve
17288 The extended version of the ARMv7-A architecture with support for
17289 virtualization.
17290 @table @samp
17291 @item +fp
17292 The VFPv4 floating-point instructions, with 16 double-precision registers.
17293 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17294
17295 @item +simd
17296 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17297 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17298
17299 @item +vfpv3-d16
17300 The VFPv3 floating-point instructions, with 16 double-precision
17301 registers.
17302
17303 @item +vfpv3
17304 The VFPv3 floating-point instructions, with 32 double-precision
17305 registers.
17306
17307 @item +vfpv3-d16-fp16
17308 The VFPv3 floating-point instructions, with 16 double-precision
17309 registers and the half-precision floating-point conversion operations.
17310
17311 @item +vfpv3-fp16
17312 The VFPv3 floating-point instructions, with 32 double-precision
17313 registers and the half-precision floating-point conversion operations.
17314
17315 @item +vfpv4-d16
17316 The VFPv4 floating-point instructions, with 16 double-precision
17317 registers.
17318
17319 @item +vfpv4
17320 The VFPv4 floating-point instructions, with 32 double-precision
17321 registers.
17322
17323 @item +neon
17324 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17325 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17326
17327 @item +neon-fp16
17328 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17329 the half-precision floating-point conversion operations.
17330
17331 @item +nosimd
17332 Disable the Advanced SIMD instructions (does not disable floating point).
17333
17334 @item +nofp
17335 Disable the floating-point and Advanced SIMD instructions.
17336 @end table
17337
17338 @item armv8-a
17339 @table @samp
17340 @item +crc
17341 The Cyclic Redundancy Check (CRC) instructions.
17342 @item +simd
17343 The ARMv8-A Advanced SIMD and floating-point instructions.
17344 @item +crypto
17345 The cryptographic instructions.
17346 @item +nocrypto
17347 Disable the cryptographic instructions.
17348 @item +nofp
17349 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17350 @item +sb
17351 Speculation Barrier Instruction.
17352 @item +predres
17353 Execution and Data Prediction Restriction Instructions.
17354 @end table
17355
17356 @item armv8.1-a
17357 @table @samp
17358 @item +simd
17359 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17360
17361 @item +crypto
17362 The cryptographic instructions. This also enables the Advanced SIMD and
17363 floating-point instructions.
17364
17365 @item +nocrypto
17366 Disable the cryptographic instructions.
17367
17368 @item +nofp
17369 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17370
17371 @item +sb
17372 Speculation Barrier Instruction.
17373
17374 @item +predres
17375 Execution and Data Prediction Restriction Instructions.
17376 @end table
17377
17378 @item armv8.2-a
17379 @itemx armv8.3-a
17380 @table @samp
17381 @item +fp16
17382 The half-precision floating-point data processing instructions.
17383 This also enables the Advanced SIMD and floating-point instructions.
17384
17385 @item +fp16fml
17386 The half-precision floating-point fmla extension. This also enables
17387 the half-precision floating-point extension and Advanced SIMD and
17388 floating-point instructions.
17389
17390 @item +simd
17391 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17392
17393 @item +crypto
17394 The cryptographic instructions. This also enables the Advanced SIMD and
17395 floating-point instructions.
17396
17397 @item +dotprod
17398 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17399
17400 @item +nocrypto
17401 Disable the cryptographic extension.
17402
17403 @item +nofp
17404 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17405
17406 @item +sb
17407 Speculation Barrier Instruction.
17408
17409 @item +predres
17410 Execution and Data Prediction Restriction Instructions.
17411 @end table
17412
17413 @item armv8.4-a
17414 @table @samp
17415 @item +fp16
17416 The half-precision floating-point data processing instructions.
17417 This also enables the Advanced SIMD and floating-point instructions as well
17418 as the Dot Product extension and the half-precision floating-point fmla
17419 extension.
17420
17421 @item +simd
17422 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17423 Dot Product extension.
17424
17425 @item +crypto
17426 The cryptographic instructions. This also enables the Advanced SIMD and
17427 floating-point instructions as well as the Dot Product extension.
17428
17429 @item +nocrypto
17430 Disable the cryptographic extension.
17431
17432 @item +nofp
17433 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17434
17435 @item +sb
17436 Speculation Barrier Instruction.
17437
17438 @item +predres
17439 Execution and Data Prediction Restriction Instructions.
17440 @end table
17441
17442 @item armv8.5-a
17443 @table @samp
17444 @item +fp16
17445 The half-precision floating-point data processing instructions.
17446 This also enables the Advanced SIMD and floating-point instructions as well
17447 as the Dot Product extension and the half-precision floating-point fmla
17448 extension.
17449
17450 @item +simd
17451 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17452 Dot Product extension.
17453
17454 @item +crypto
17455 The cryptographic instructions. This also enables the Advanced SIMD and
17456 floating-point instructions as well as the Dot Product extension.
17457
17458 @item +nocrypto
17459 Disable the cryptographic extension.
17460
17461 @item +nofp
17462 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17463 @end table
17464
17465 @item armv7-r
17466 @table @samp
17467 @item +fp.sp
17468 The single-precision VFPv3 floating-point instructions. The extension
17469 @samp{+vfpv3xd} can be used as an alias for this extension.
17470
17471 @item +fp
17472 The VFPv3 floating-point instructions with 16 double-precision registers.
17473 The extension +vfpv3-d16 can be used as an alias for this extension.
17474
17475 @item +vfpv3xd-d16-fp16
17476 The single-precision VFPv3 floating-point instructions with 16 double-precision
17477 registers and the half-precision floating-point conversion operations.
17478
17479 @item +vfpv3-d16-fp16
17480 The VFPv3 floating-point instructions with 16 double-precision
17481 registers and the half-precision floating-point conversion operations.
17482
17483 @item +nofp
17484 Disable the floating-point extension.
17485
17486 @item +idiv
17487 The ARM-state integer division instructions.
17488
17489 @item +noidiv
17490 Disable the ARM-state integer division extension.
17491 @end table
17492
17493 @item armv7e-m
17494 @table @samp
17495 @item +fp
17496 The single-precision VFPv4 floating-point instructions.
17497
17498 @item +fpv5
17499 The single-precision FPv5 floating-point instructions.
17500
17501 @item +fp.dp
17502 The single- and double-precision FPv5 floating-point instructions.
17503
17504 @item +nofp
17505 Disable the floating-point extensions.
17506 @end table
17507
17508 @item armv8-m.main
17509 @table @samp
17510 @item +dsp
17511 The DSP instructions.
17512
17513 @item +nodsp
17514 Disable the DSP extension.
17515
17516 @item +fp
17517 The single-precision floating-point instructions.
17518
17519 @item +fp.dp
17520 The single- and double-precision floating-point instructions.
17521
17522 @item +nofp
17523 Disable the floating-point extension.
17524 @end table
17525
17526 @item armv8-r
17527 @table @samp
17528 @item +crc
17529 The Cyclic Redundancy Check (CRC) instructions.
17530 @item +fp.sp
17531 The single-precision FPv5 floating-point instructions.
17532 @item +simd
17533 The ARMv8-A Advanced SIMD and floating-point instructions.
17534 @item +crypto
17535 The cryptographic instructions.
17536 @item +nocrypto
17537 Disable the cryptographic instructions.
17538 @item +nofp
17539 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17540 @end table
17541
17542 @end table
17543
17544 @option{-march=native} causes the compiler to auto-detect the architecture
17545 of the build computer. At present, this feature is only supported on
17546 GNU/Linux, and not all architectures are recognized. If the auto-detect
17547 is unsuccessful the option has no effect.
17548
17549 @item -mtune=@var{name}
17550 @opindex mtune
17551 This option specifies the name of the target ARM processor for
17552 which GCC should tune the performance of the code.
17553 For some ARM implementations better performance can be obtained by using
17554 this option.
17555 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17556 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17557 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17558 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17559 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17560 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17561 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17562 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17563 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17564 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17565 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17566 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17567 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17568 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17569 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17570 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17571 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17572 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17573 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17574 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17575 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17576 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17577
17578 Additionally, this option can specify that GCC should tune the performance
17579 of the code for a big.LITTLE system. Permissible names are:
17580 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17581 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17582 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17583 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17584
17585 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17586 performance for a blend of processors within architecture @var{arch}.
17587 The aim is to generate code that run well on the current most popular
17588 processors, balancing between optimizations that benefit some CPUs in the
17589 range, and avoiding performance pitfalls of other CPUs. The effects of
17590 this option may change in future GCC versions as CPU models come and go.
17591
17592 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17593 the extension options do not affect the tuning of the generated code.
17594
17595 @option{-mtune=native} causes the compiler to auto-detect the CPU
17596 of the build computer. At present, this feature is only supported on
17597 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17598 unsuccessful the option has no effect.
17599
17600 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17601 @opindex mcpu
17602 This specifies the name of the target ARM processor. GCC uses this name
17603 to derive the name of the target ARM architecture (as if specified
17604 by @option{-march}) and the ARM processor type for which to tune for
17605 performance (as if specified by @option{-mtune}). Where this option
17606 is used in conjunction with @option{-march} or @option{-mtune},
17607 those options take precedence over the appropriate part of this option.
17608
17609 Many of the supported CPUs implement optional architectural
17610 extensions. Where this is so the architectural extensions are
17611 normally enabled by default. If implementations that lack the
17612 extension exist, then the extension syntax can be used to disable
17613 those extensions that have been omitted. For floating-point and
17614 Advanced SIMD (Neon) instructions, the settings of the options
17615 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17616 floating-point and Advanced SIMD instructions will only be used if
17617 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17618 @option{-mfpu} other than @samp{auto} will override the available
17619 floating-point and SIMD extension instructions.
17620
17621 For example, @samp{cortex-a9} can be found in three major
17622 configurations: integer only, with just a floating-point unit or with
17623 floating-point and Advanced SIMD. The default is to enable all the
17624 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17625 be used to disable just the SIMD or both the SIMD and floating-point
17626 instructions respectively.
17627
17628 Permissible names for this option are the same as those for
17629 @option{-mtune}.
17630
17631 The following extension options are common to the listed CPUs:
17632
17633 @table @samp
17634 @item +nodsp
17635 Disable the DSP instructions on @samp{cortex-m33}.
17636
17637 @item +nofp
17638 Disables the floating-point instructions on @samp{arm9e},
17639 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17640 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17641 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17642 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17643 Disables the floating-point and SIMD instructions on
17644 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17645 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17646 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17647 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17648 @samp{cortex-a53} and @samp{cortex-a55}.
17649
17650 @item +nofp.dp
17651 Disables the double-precision component of the floating-point instructions
17652 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17653 @samp{cortex-m7}.
17654
17655 @item +nosimd
17656 Disables the SIMD (but not floating-point) instructions on
17657 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17658 and @samp{cortex-a9}.
17659
17660 @item +crypto
17661 Enables the cryptographic instructions on @samp{cortex-a32},
17662 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17663 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17664 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17665 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17666 @samp{cortex-a75.cortex-a55}.
17667 @end table
17668
17669 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17670 VFPv3 with 16 double-precision registers. It supports the following
17671 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17672 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17673 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17674 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17675 the extensions to @option{-march=armv7-a}.
17676
17677 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17678 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17679 See @option{-mtune} for more information.
17680
17681 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17682 of the build computer. At present, this feature is only supported on
17683 GNU/Linux, and not all architectures are recognized. If the auto-detect
17684 is unsuccessful the option has no effect.
17685
17686 @item -mfpu=@var{name}
17687 @opindex mfpu
17688 This specifies what floating-point hardware (or hardware emulation) is
17689 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17690 @samp{vfpv3},
17691 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17692 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17693 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17694 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17695 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17696 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17697 is an alias for @samp{vfpv2}.
17698
17699 The setting @samp{auto} is the default and is special. It causes the
17700 compiler to select the floating-point and Advanced SIMD instructions
17701 based on the settings of @option{-mcpu} and @option{-march}.
17702
17703 If the selected floating-point hardware includes the NEON extension
17704 (e.g.@: @option{-mfpu=neon}), note that floating-point
17705 operations are not generated by GCC's auto-vectorization pass unless
17706 @option{-funsafe-math-optimizations} is also specified. This is
17707 because NEON hardware does not fully implement the IEEE 754 standard for
17708 floating-point arithmetic (in particular denormal values are treated as
17709 zero), so the use of NEON instructions may lead to a loss of precision.
17710
17711 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}).
17712
17713 @item -mfp16-format=@var{name}
17714 @opindex mfp16-format
17715 Specify the format of the @code{__fp16} half-precision floating-point type.
17716 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17717 the default is @samp{none}, in which case the @code{__fp16} type is not
17718 defined. @xref{Half-Precision}, for more information.
17719
17720 @item -mstructure-size-boundary=@var{n}
17721 @opindex mstructure-size-boundary
17722 The sizes of all structures and unions are rounded up to a multiple
17723 of the number of bits set by this option. Permissible values are 8, 32
17724 and 64. The default value varies for different toolchains. For the COFF
17725 targeted toolchain the default value is 8. A value of 64 is only allowed
17726 if the underlying ABI supports it.
17727
17728 Specifying a larger number can produce faster, more efficient code, but
17729 can also increase the size of the program. Different values are potentially
17730 incompatible. Code compiled with one value cannot necessarily expect to
17731 work with code or libraries compiled with another value, if they exchange
17732 information using structures or unions.
17733
17734 This option is deprecated.
17735
17736 @item -mabort-on-noreturn
17737 @opindex mabort-on-noreturn
17738 Generate a call to the function @code{abort} at the end of a
17739 @code{noreturn} function. It is executed if the function tries to
17740 return.
17741
17742 @item -mlong-calls
17743 @itemx -mno-long-calls
17744 @opindex mlong-calls
17745 @opindex mno-long-calls
17746 Tells the compiler to perform function calls by first loading the
17747 address of the function into a register and then performing a subroutine
17748 call on this register. This switch is needed if the target function
17749 lies outside of the 64-megabyte addressing range of the offset-based
17750 version of subroutine call instruction.
17751
17752 Even if this switch is enabled, not all function calls are turned
17753 into long calls. The heuristic is that static functions, functions
17754 that have the @code{short_call} attribute, functions that are inside
17755 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17756 definitions have already been compiled within the current compilation
17757 unit are not turned into long calls. The exceptions to this rule are
17758 that weak function definitions, functions with the @code{long_call}
17759 attribute or the @code{section} attribute, and functions that are within
17760 the scope of a @code{#pragma long_calls} directive are always
17761 turned into long calls.
17762
17763 This feature is not enabled by default. Specifying
17764 @option{-mno-long-calls} restores the default behavior, as does
17765 placing the function calls within the scope of a @code{#pragma
17766 long_calls_off} directive. Note these switches have no effect on how
17767 the compiler generates code to handle function calls via function
17768 pointers.
17769
17770 @item -msingle-pic-base
17771 @opindex msingle-pic-base
17772 Treat the register used for PIC addressing as read-only, rather than
17773 loading it in the prologue for each function. The runtime system is
17774 responsible for initializing this register with an appropriate value
17775 before execution begins.
17776
17777 @item -mpic-register=@var{reg}
17778 @opindex mpic-register
17779 Specify the register to be used for PIC addressing.
17780 For standard PIC base case, the default is any suitable register
17781 determined by compiler. For single PIC base case, the default is
17782 @samp{R9} if target is EABI based or stack-checking is enabled,
17783 otherwise the default is @samp{R10}.
17784
17785 @item -mpic-data-is-text-relative
17786 @opindex mpic-data-is-text-relative
17787 Assume that the displacement between the text and data segments is fixed
17788 at static link time. This permits using PC-relative addressing
17789 operations to access data known to be in the data segment. For
17790 non-VxWorks RTP targets, this option is enabled by default. When
17791 disabled on such targets, it will enable @option{-msingle-pic-base} by
17792 default.
17793
17794 @item -mpoke-function-name
17795 @opindex mpoke-function-name
17796 Write the name of each function into the text section, directly
17797 preceding the function prologue. The generated code is similar to this:
17798
17799 @smallexample
17800 t0
17801 .ascii "arm_poke_function_name", 0
17802 .align
17803 t1
17804 .word 0xff000000 + (t1 - t0)
17805 arm_poke_function_name
17806 mov ip, sp
17807 stmfd sp!, @{fp, ip, lr, pc@}
17808 sub fp, ip, #4
17809 @end smallexample
17810
17811 When performing a stack backtrace, code can inspect the value of
17812 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17813 location @code{pc - 12} and the top 8 bits are set, then we know that
17814 there is a function name embedded immediately preceding this location
17815 and has length @code{((pc[-3]) & 0xff000000)}.
17816
17817 @item -mthumb
17818 @itemx -marm
17819 @opindex marm
17820 @opindex mthumb
17821
17822 Select between generating code that executes in ARM and Thumb
17823 states. The default for most configurations is to generate code
17824 that executes in ARM state, but the default can be changed by
17825 configuring GCC with the @option{--with-mode=}@var{state}
17826 configure option.
17827
17828 You can also override the ARM and Thumb mode for each function
17829 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17830 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17831
17832 @item -mflip-thumb
17833 @opindex mflip-thumb
17834 Switch ARM/Thumb modes on alternating functions.
17835 This option is provided for regression testing of mixed Thumb/ARM code
17836 generation, and is not intended for ordinary use in compiling code.
17837
17838 @item -mtpcs-frame
17839 @opindex mtpcs-frame
17840 Generate a stack frame that is compliant with the Thumb Procedure Call
17841 Standard for all non-leaf functions. (A leaf function is one that does
17842 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17843
17844 @item -mtpcs-leaf-frame
17845 @opindex mtpcs-leaf-frame
17846 Generate a stack frame that is compliant with the Thumb Procedure Call
17847 Standard for all leaf functions. (A leaf function is one that does
17848 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17849
17850 @item -mcallee-super-interworking
17851 @opindex mcallee-super-interworking
17852 Gives all externally visible functions in the file being compiled an ARM
17853 instruction set header which switches to Thumb mode before executing the
17854 rest of the function. This allows these functions to be called from
17855 non-interworking code. This option is not valid in AAPCS configurations
17856 because interworking is enabled by default.
17857
17858 @item -mcaller-super-interworking
17859 @opindex mcaller-super-interworking
17860 Allows calls via function pointers (including virtual functions) to
17861 execute correctly regardless of whether the target code has been
17862 compiled for interworking or not. There is a small overhead in the cost
17863 of executing a function pointer if this option is enabled. This option
17864 is not valid in AAPCS configurations because interworking is enabled
17865 by default.
17866
17867 @item -mtp=@var{name}
17868 @opindex mtp
17869 Specify the access model for the thread local storage pointer. The valid
17870 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17871 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17872 (supported in the arm6k architecture), and @samp{auto}, which uses the
17873 best available method for the selected processor. The default setting is
17874 @samp{auto}.
17875
17876 @item -mtls-dialect=@var{dialect}
17877 @opindex mtls-dialect
17878 Specify the dialect to use for accessing thread local storage. Two
17879 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17880 @samp{gnu} dialect selects the original GNU scheme for supporting
17881 local and global dynamic TLS models. The @samp{gnu2} dialect
17882 selects the GNU descriptor scheme, which provides better performance
17883 for shared libraries. The GNU descriptor scheme is compatible with
17884 the original scheme, but does require new assembler, linker and
17885 library support. Initial and local exec TLS models are unaffected by
17886 this option and always use the original scheme.
17887
17888 @item -mword-relocations
17889 @opindex mword-relocations
17890 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17891 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17892 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17893 is specified. This option conflicts with @option{-mslow-flash-data}.
17894
17895 @item -mfix-cortex-m3-ldrd
17896 @opindex mfix-cortex-m3-ldrd
17897 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17898 with overlapping destination and base registers are used. This option avoids
17899 generating these instructions. This option is enabled by default when
17900 @option{-mcpu=cortex-m3} is specified.
17901
17902 @item -munaligned-access
17903 @itemx -mno-unaligned-access
17904 @opindex munaligned-access
17905 @opindex mno-unaligned-access
17906 Enables (or disables) reading and writing of 16- and 32- bit values
17907 from addresses that are not 16- or 32- bit aligned. By default
17908 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17909 ARMv8-M Baseline architectures, and enabled for all other
17910 architectures. If unaligned access is not enabled then words in packed
17911 data structures are accessed a byte at a time.
17912
17913 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17914 generated object file to either true or false, depending upon the
17915 setting of this option. If unaligned access is enabled then the
17916 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17917 defined.
17918
17919 @item -mneon-for-64bits
17920 @opindex mneon-for-64bits
17921 Enables using Neon to handle scalar 64-bits operations. This is
17922 disabled by default since the cost of moving data from core registers
17923 to Neon is high.
17924
17925 @item -mslow-flash-data
17926 @opindex mslow-flash-data
17927 Assume loading data from flash is slower than fetching instruction.
17928 Therefore literal load is minimized for better performance.
17929 This option is only supported when compiling for ARMv7 M-profile and
17930 off by default. It conflicts with @option{-mword-relocations}.
17931
17932 @item -masm-syntax-unified
17933 @opindex masm-syntax-unified
17934 Assume inline assembler is using unified asm syntax. The default is
17935 currently off which implies divided syntax. This option has no impact
17936 on Thumb2. However, this may change in future releases of GCC.
17937 Divided syntax should be considered deprecated.
17938
17939 @item -mrestrict-it
17940 @opindex mrestrict-it
17941 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17942 IT blocks can only contain a single 16-bit instruction from a select
17943 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17944
17945 @item -mprint-tune-info
17946 @opindex mprint-tune-info
17947 Print CPU tuning information as comment in assembler file. This is
17948 an option used only for regression testing of the compiler and not
17949 intended for ordinary use in compiling code. This option is disabled
17950 by default.
17951
17952 @item -mverbose-cost-dump
17953 @opindex mverbose-cost-dump
17954 Enable verbose cost model dumping in the debug dump files. This option is
17955 provided for use in debugging the compiler.
17956
17957 @item -mpure-code
17958 @opindex mpure-code
17959 Do not allow constant data to be placed in code sections.
17960 Additionally, when compiling for ELF object format give all text sections the
17961 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
17962 is only available when generating non-pic code for M-profile targets with the
17963 MOVT instruction.
17964
17965 @item -mcmse
17966 @opindex mcmse
17967 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
17968 Development Tools Engineering Specification", which can be found on
17969 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
17970 @end table
17971
17972 @node AVR Options
17973 @subsection AVR Options
17974 @cindex AVR Options
17975
17976 These options are defined for AVR implementations:
17977
17978 @table @gcctabopt
17979 @item -mmcu=@var{mcu}
17980 @opindex mmcu
17981 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17982
17983 The default for this option is@tie{}@samp{avr2}.
17984
17985 GCC supports the following AVR devices and ISAs:
17986
17987 @include avr-mmcu.texi
17988
17989 @item -mabsdata
17990 @opindex mabsdata
17991
17992 Assume that all data in static storage can be accessed by LDS / STS
17993 instructions. This option has only an effect on reduced Tiny devices like
17994 ATtiny40. See also the @code{absdata}
17995 @ref{AVR Variable Attributes,variable attribute}.
17996
17997 @item -maccumulate-args
17998 @opindex maccumulate-args
17999 Accumulate outgoing function arguments and acquire/release the needed
18000 stack space for outgoing function arguments once in function
18001 prologue/epilogue. Without this option, outgoing arguments are pushed
18002 before calling a function and popped afterwards.
18003
18004 Popping the arguments after the function call can be expensive on
18005 AVR so that accumulating the stack space might lead to smaller
18006 executables because arguments need not be removed from the
18007 stack after such a function call.
18008
18009 This option can lead to reduced code size for functions that perform
18010 several calls to functions that get their arguments on the stack like
18011 calls to printf-like functions.
18012
18013 @item -mbranch-cost=@var{cost}
18014 @opindex mbranch-cost
18015 Set the branch costs for conditional branch instructions to
18016 @var{cost}. Reasonable values for @var{cost} are small, non-negative
18017 integers. The default branch cost is 0.
18018
18019 @item -mcall-prologues
18020 @opindex mcall-prologues
18021 Functions prologues/epilogues are expanded as calls to appropriate
18022 subroutines. Code size is smaller.
18023
18024 @item -mgas-isr-prologues
18025 @opindex mgas-isr-prologues
18026 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18027 instruction supported by GNU Binutils.
18028 If this option is on, the feature can still be disabled for individual
18029 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18030 function attribute. This feature is activated per default
18031 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18032 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18033
18034 @item -mint8
18035 @opindex mint8
18036 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18037 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18038 and @code{long long} is 4 bytes. Please note that this option does not
18039 conform to the C standards, but it results in smaller code
18040 size.
18041
18042 @item -mmain-is-OS_task
18043 @opindex mmain-is-OS_task
18044 Do not save registers in @code{main}. The effect is the same like
18045 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18046 to @code{main}. It is activated per default if optimization is on.
18047
18048 @item -mn-flash=@var{num}
18049 @opindex mn-flash
18050 Assume that the flash memory has a size of
18051 @var{num} times 64@tie{}KiB.
18052
18053 @item -mno-interrupts
18054 @opindex mno-interrupts
18055 Generated code is not compatible with hardware interrupts.
18056 Code size is smaller.
18057
18058 @item -mrelax
18059 @opindex mrelax
18060 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18061 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18062 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18063 the assembler's command line and the @option{--relax} option to the
18064 linker's command line.
18065
18066 Jump relaxing is performed by the linker because jump offsets are not
18067 known before code is located. Therefore, the assembler code generated by the
18068 compiler is the same, but the instructions in the executable may
18069 differ from instructions in the assembler code.
18070
18071 Relaxing must be turned on if linker stubs are needed, see the
18072 section on @code{EIND} and linker stubs below.
18073
18074 @item -mrmw
18075 @opindex mrmw
18076 Assume that the device supports the Read-Modify-Write
18077 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18078
18079 @item -mshort-calls
18080 @opindex mshort-calls
18081
18082 Assume that @code{RJMP} and @code{RCALL} can target the whole
18083 program memory.
18084
18085 This option is used internally for multilib selection. It is
18086 not an optimization option, and you don't need to set it by hand.
18087
18088 @item -msp8
18089 @opindex msp8
18090 Treat the stack pointer register as an 8-bit register,
18091 i.e.@: assume the high byte of the stack pointer is zero.
18092 In general, you don't need to set this option by hand.
18093
18094 This option is used internally by the compiler to select and
18095 build multilibs for architectures @code{avr2} and @code{avr25}.
18096 These architectures mix devices with and without @code{SPH}.
18097 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18098 the compiler driver adds or removes this option from the compiler
18099 proper's command line, because the compiler then knows if the device
18100 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18101 register or not.
18102
18103 @item -mstrict-X
18104 @opindex mstrict-X
18105 Use address register @code{X} in a way proposed by the hardware. This means
18106 that @code{X} is only used in indirect, post-increment or
18107 pre-decrement addressing.
18108
18109 Without this option, the @code{X} register may be used in the same way
18110 as @code{Y} or @code{Z} which then is emulated by additional
18111 instructions.
18112 For example, loading a value with @code{X+const} addressing with a
18113 small non-negative @code{const < 64} to a register @var{Rn} is
18114 performed as
18115
18116 @example
18117 adiw r26, const ; X += const
18118 ld @var{Rn}, X ; @var{Rn} = *X
18119 sbiw r26, const ; X -= const
18120 @end example
18121
18122 @item -mtiny-stack
18123 @opindex mtiny-stack
18124 Only change the lower 8@tie{}bits of the stack pointer.
18125
18126 @item -mfract-convert-truncate
18127 @opindex mfract-convert-truncate
18128 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18129
18130 @item -nodevicelib
18131 @opindex nodevicelib
18132 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18133
18134 @item -Waddr-space-convert
18135 @opindex Waddr-space-convert
18136 @opindex Wno-addr-space-convert
18137 Warn about conversions between address spaces in the case where the
18138 resulting address space is not contained in the incoming address space.
18139
18140 @item -Wmisspelled-isr
18141 @opindex Wmisspelled-isr
18142 @opindex Wno-misspelled-isr
18143 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18144 Enabled by default.
18145 @end table
18146
18147 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18148 @cindex @code{EIND}
18149 Pointers in the implementation are 16@tie{}bits wide.
18150 The address of a function or label is represented as word address so
18151 that indirect jumps and calls can target any code address in the
18152 range of 64@tie{}Ki words.
18153
18154 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18155 bytes of program memory space, there is a special function register called
18156 @code{EIND} that serves as most significant part of the target address
18157 when @code{EICALL} or @code{EIJMP} instructions are used.
18158
18159 Indirect jumps and calls on these devices are handled as follows by
18160 the compiler and are subject to some limitations:
18161
18162 @itemize @bullet
18163
18164 @item
18165 The compiler never sets @code{EIND}.
18166
18167 @item
18168 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18169 instructions or might read @code{EIND} directly in order to emulate an
18170 indirect call/jump by means of a @code{RET} instruction.
18171
18172 @item
18173 The compiler assumes that @code{EIND} never changes during the startup
18174 code or during the application. In particular, @code{EIND} is not
18175 saved/restored in function or interrupt service routine
18176 prologue/epilogue.
18177
18178 @item
18179 For indirect calls to functions and computed goto, the linker
18180 generates @emph{stubs}. Stubs are jump pads sometimes also called
18181 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18182 The stub contains a direct jump to the desired address.
18183
18184 @item
18185 Linker relaxation must be turned on so that the linker generates
18186 the stubs correctly in all situations. See the compiler option
18187 @option{-mrelax} and the linker option @option{--relax}.
18188 There are corner cases where the linker is supposed to generate stubs
18189 but aborts without relaxation and without a helpful error message.
18190
18191 @item
18192 The default linker script is arranged for code with @code{EIND = 0}.
18193 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18194 linker script has to be used in order to place the sections whose
18195 name start with @code{.trampolines} into the segment where @code{EIND}
18196 points to.
18197
18198 @item
18199 The startup code from libgcc never sets @code{EIND}.
18200 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18201 For the impact of AVR-LibC on @code{EIND}, see the
18202 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18203
18204 @item
18205 It is legitimate for user-specific startup code to set up @code{EIND}
18206 early, for example by means of initialization code located in
18207 section @code{.init3}. Such code runs prior to general startup code
18208 that initializes RAM and calls constructors, but after the bit
18209 of startup code from AVR-LibC that sets @code{EIND} to the segment
18210 where the vector table is located.
18211 @example
18212 #include <avr/io.h>
18213
18214 static void
18215 __attribute__((section(".init3"),naked,used,no_instrument_function))
18216 init3_set_eind (void)
18217 @{
18218 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18219 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18220 @}
18221 @end example
18222
18223 @noindent
18224 The @code{__trampolines_start} symbol is defined in the linker script.
18225
18226 @item
18227 Stubs are generated automatically by the linker if
18228 the following two conditions are met:
18229 @itemize @minus
18230
18231 @item The address of a label is taken by means of the @code{gs} modifier
18232 (short for @emph{generate stubs}) like so:
18233 @example
18234 LDI r24, lo8(gs(@var{func}))
18235 LDI r25, hi8(gs(@var{func}))
18236 @end example
18237 @item The final location of that label is in a code segment
18238 @emph{outside} the segment where the stubs are located.
18239 @end itemize
18240
18241 @item
18242 The compiler emits such @code{gs} modifiers for code labels in the
18243 following situations:
18244 @itemize @minus
18245 @item Taking address of a function or code label.
18246 @item Computed goto.
18247 @item If prologue-save function is used, see @option{-mcall-prologues}
18248 command-line option.
18249 @item Switch/case dispatch tables. If you do not want such dispatch
18250 tables you can specify the @option{-fno-jump-tables} command-line option.
18251 @item C and C++ constructors/destructors called during startup/shutdown.
18252 @item If the tools hit a @code{gs()} modifier explained above.
18253 @end itemize
18254
18255 @item
18256 Jumping to non-symbolic addresses like so is @emph{not} supported:
18257
18258 @example
18259 int main (void)
18260 @{
18261 /* Call function at word address 0x2 */
18262 return ((int(*)(void)) 0x2)();
18263 @}
18264 @end example
18265
18266 Instead, a stub has to be set up, i.e.@: the function has to be called
18267 through a symbol (@code{func_4} in the example):
18268
18269 @example
18270 int main (void)
18271 @{
18272 extern int func_4 (void);
18273
18274 /* Call function at byte address 0x4 */
18275 return func_4();
18276 @}
18277 @end example
18278
18279 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18280 Alternatively, @code{func_4} can be defined in the linker script.
18281 @end itemize
18282
18283 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18284 @cindex @code{RAMPD}
18285 @cindex @code{RAMPX}
18286 @cindex @code{RAMPY}
18287 @cindex @code{RAMPZ}
18288 Some AVR devices support memories larger than the 64@tie{}KiB range
18289 that can be accessed with 16-bit pointers. To access memory locations
18290 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18291 register is used as high part of the address:
18292 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18293 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18294 register, respectively, to get a wide address. Similarly,
18295 @code{RAMPD} is used together with direct addressing.
18296
18297 @itemize
18298 @item
18299 The startup code initializes the @code{RAMP} special function
18300 registers with zero.
18301
18302 @item
18303 If a @ref{AVR Named Address Spaces,named address space} other than
18304 generic or @code{__flash} is used, then @code{RAMPZ} is set
18305 as needed before the operation.
18306
18307 @item
18308 If the device supports RAM larger than 64@tie{}KiB and the compiler
18309 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18310 is reset to zero after the operation.
18311
18312 @item
18313 If the device comes with a specific @code{RAMP} register, the ISR
18314 prologue/epilogue saves/restores that SFR and initializes it with
18315 zero in case the ISR code might (implicitly) use it.
18316
18317 @item
18318 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18319 If you use inline assembler to read from locations outside the
18320 16-bit address range and change one of the @code{RAMP} registers,
18321 you must reset it to zero after the access.
18322
18323 @end itemize
18324
18325 @subsubsection AVR Built-in Macros
18326
18327 GCC defines several built-in macros so that the user code can test
18328 for the presence or absence of features. Almost any of the following
18329 built-in macros are deduced from device capabilities and thus
18330 triggered by the @option{-mmcu=} command-line option.
18331
18332 For even more AVR-specific built-in macros see
18333 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18334
18335 @table @code
18336
18337 @item __AVR_ARCH__
18338 Build-in macro that resolves to a decimal number that identifies the
18339 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18340 Possible values are:
18341
18342 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18343 @code{4}, @code{5}, @code{51}, @code{6}
18344
18345 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18346 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18347
18348 respectively and
18349
18350 @code{100},
18351 @code{102}, @code{103}, @code{104},
18352 @code{105}, @code{106}, @code{107}
18353
18354 for @var{mcu}=@code{avrtiny},
18355 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18356 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18357 If @var{mcu} specifies a device, this built-in macro is set
18358 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18359 defined to @code{4}.
18360
18361 @item __AVR_@var{Device}__
18362 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18363 the device's name. For example, @option{-mmcu=atmega8} defines the
18364 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18365 @code{__AVR_ATtiny261A__}, etc.
18366
18367 The built-in macros' names follow
18368 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18369 the device name as from the AVR user manual. The difference between
18370 @var{Device} in the built-in macro and @var{device} in
18371 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18372
18373 If @var{device} is not a device but only a core architecture like
18374 @samp{avr51}, this macro is not defined.
18375
18376 @item __AVR_DEVICE_NAME__
18377 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18378 the device's name. For example, with @option{-mmcu=atmega8} the macro
18379 is defined to @code{atmega8}.
18380
18381 If @var{device} is not a device but only a core architecture like
18382 @samp{avr51}, this macro is not defined.
18383
18384 @item __AVR_XMEGA__
18385 The device / architecture belongs to the XMEGA family of devices.
18386
18387 @item __AVR_HAVE_ELPM__
18388 The device has the @code{ELPM} instruction.
18389
18390 @item __AVR_HAVE_ELPMX__
18391 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18392 R@var{n},Z+} instructions.
18393
18394 @item __AVR_HAVE_MOVW__
18395 The device has the @code{MOVW} instruction to perform 16-bit
18396 register-register moves.
18397
18398 @item __AVR_HAVE_LPMX__
18399 The device has the @code{LPM R@var{n},Z} and
18400 @code{LPM R@var{n},Z+} instructions.
18401
18402 @item __AVR_HAVE_MUL__
18403 The device has a hardware multiplier.
18404
18405 @item __AVR_HAVE_JMP_CALL__
18406 The device has the @code{JMP} and @code{CALL} instructions.
18407 This is the case for devices with more than 8@tie{}KiB of program
18408 memory.
18409
18410 @item __AVR_HAVE_EIJMP_EICALL__
18411 @itemx __AVR_3_BYTE_PC__
18412 The device has the @code{EIJMP} and @code{EICALL} instructions.
18413 This is the case for devices with more than 128@tie{}KiB of program memory.
18414 This also means that the program counter
18415 (PC) is 3@tie{}bytes wide.
18416
18417 @item __AVR_2_BYTE_PC__
18418 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18419 with up to 128@tie{}KiB of program memory.
18420
18421 @item __AVR_HAVE_8BIT_SP__
18422 @itemx __AVR_HAVE_16BIT_SP__
18423 The stack pointer (SP) register is treated as 8-bit respectively
18424 16-bit register by the compiler.
18425 The definition of these macros is affected by @option{-mtiny-stack}.
18426
18427 @item __AVR_HAVE_SPH__
18428 @itemx __AVR_SP8__
18429 The device has the SPH (high part of stack pointer) special function
18430 register or has an 8-bit stack pointer, respectively.
18431 The definition of these macros is affected by @option{-mmcu=} and
18432 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18433 by @option{-msp8}.
18434
18435 @item __AVR_HAVE_RAMPD__
18436 @itemx __AVR_HAVE_RAMPX__
18437 @itemx __AVR_HAVE_RAMPY__
18438 @itemx __AVR_HAVE_RAMPZ__
18439 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18440 @code{RAMPZ} special function register, respectively.
18441
18442 @item __NO_INTERRUPTS__
18443 This macro reflects the @option{-mno-interrupts} command-line option.
18444
18445 @item __AVR_ERRATA_SKIP__
18446 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18447 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18448 instructions because of a hardware erratum. Skip instructions are
18449 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18450 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18451 set.
18452
18453 @item __AVR_ISA_RMW__
18454 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18455
18456 @item __AVR_SFR_OFFSET__=@var{offset}
18457 Instructions that can address I/O special function registers directly
18458 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18459 address as if addressed by an instruction to access RAM like @code{LD}
18460 or @code{STS}. This offset depends on the device architecture and has
18461 to be subtracted from the RAM address in order to get the
18462 respective I/O@tie{}address.
18463
18464 @item __AVR_SHORT_CALLS__
18465 The @option{-mshort-calls} command line option is set.
18466
18467 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18468 Some devices support reading from flash memory by means of @code{LD*}
18469 instructions. The flash memory is seen in the data address space
18470 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18471 is not defined, this feature is not available. If defined,
18472 the address space is linear and there is no need to put
18473 @code{.rodata} into RAM. This is handled by the default linker
18474 description file, and is currently available for
18475 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18476 there is no need to use address spaces like @code{__flash} or
18477 features like attribute @code{progmem} and @code{pgm_read_*}.
18478
18479 @item __WITH_AVRLIBC__
18480 The compiler is configured to be used together with AVR-Libc.
18481 See the @option{--with-avrlibc} configure option.
18482
18483 @end table
18484
18485 @node Blackfin Options
18486 @subsection Blackfin Options
18487 @cindex Blackfin Options
18488
18489 @table @gcctabopt
18490 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18491 @opindex mcpu=
18492 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18493 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18494 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18495 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18496 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18497 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18498 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18499 @samp{bf561}, @samp{bf592}.
18500
18501 The optional @var{sirevision} specifies the silicon revision of the target
18502 Blackfin processor. Any workarounds available for the targeted silicon revision
18503 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18504 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18505 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18506 hexadecimal digits representing the major and minor numbers in the silicon
18507 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18508 is not defined. If @var{sirevision} is @samp{any}, the
18509 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18510 If this optional @var{sirevision} is not used, GCC assumes the latest known
18511 silicon revision of the targeted Blackfin processor.
18512
18513 GCC defines a preprocessor macro for the specified @var{cpu}.
18514 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18515 provided by libgloss to be linked in if @option{-msim} is not given.
18516
18517 Without this option, @samp{bf532} is used as the processor by default.
18518
18519 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18520 only the preprocessor macro is defined.
18521
18522 @item -msim
18523 @opindex msim
18524 Specifies that the program will be run on the simulator. This causes
18525 the simulator BSP provided by libgloss to be linked in. This option
18526 has effect only for @samp{bfin-elf} toolchain.
18527 Certain other options, such as @option{-mid-shared-library} and
18528 @option{-mfdpic}, imply @option{-msim}.
18529
18530 @item -momit-leaf-frame-pointer
18531 @opindex momit-leaf-frame-pointer
18532 Don't keep the frame pointer in a register for leaf functions. This
18533 avoids the instructions to save, set up and restore frame pointers and
18534 makes an extra register available in leaf functions.
18535
18536 @item -mspecld-anomaly
18537 @opindex mspecld-anomaly
18538 When enabled, the compiler ensures that the generated code does not
18539 contain speculative loads after jump instructions. If this option is used,
18540 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18541
18542 @item -mno-specld-anomaly
18543 @opindex mno-specld-anomaly
18544 @opindex mspecld-anomaly
18545 Don't generate extra code to prevent speculative loads from occurring.
18546
18547 @item -mcsync-anomaly
18548 @opindex mcsync-anomaly
18549 When enabled, the compiler ensures that the generated code does not
18550 contain CSYNC or SSYNC instructions too soon after conditional branches.
18551 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18552
18553 @item -mno-csync-anomaly
18554 @opindex mno-csync-anomaly
18555 @opindex mcsync-anomaly
18556 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18557 occurring too soon after a conditional branch.
18558
18559 @item -mlow64k
18560 @opindex mlow64k
18561 When enabled, the compiler is free to take advantage of the knowledge that
18562 the entire program fits into the low 64k of memory.
18563
18564 @item -mno-low64k
18565 @opindex mno-low64k
18566 Assume that the program is arbitrarily large. This is the default.
18567
18568 @item -mstack-check-l1
18569 @opindex mstack-check-l1
18570 Do stack checking using information placed into L1 scratchpad memory by the
18571 uClinux kernel.
18572
18573 @item -mid-shared-library
18574 @opindex mid-shared-library
18575 Generate code that supports shared libraries via the library ID method.
18576 This allows for execute in place and shared libraries in an environment
18577 without virtual memory management. This option implies @option{-fPIC}.
18578 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18579
18580 @item -mno-id-shared-library
18581 @opindex mno-id-shared-library
18582 @opindex mid-shared-library
18583 Generate code that doesn't assume ID-based shared libraries are being used.
18584 This is the default.
18585
18586 @item -mleaf-id-shared-library
18587 @opindex mleaf-id-shared-library
18588 Generate code that supports shared libraries via the library ID method,
18589 but assumes that this library or executable won't link against any other
18590 ID shared libraries. That allows the compiler to use faster code for jumps
18591 and calls.
18592
18593 @item -mno-leaf-id-shared-library
18594 @opindex mno-leaf-id-shared-library
18595 @opindex mleaf-id-shared-library
18596 Do not assume that the code being compiled won't link against any ID shared
18597 libraries. Slower code is generated for jump and call insns.
18598
18599 @item -mshared-library-id=n
18600 @opindex mshared-library-id
18601 Specifies the identification number of the ID-based shared library being
18602 compiled. Specifying a value of 0 generates more compact code; specifying
18603 other values forces the allocation of that number to the current
18604 library but is no more space- or time-efficient than omitting this option.
18605
18606 @item -msep-data
18607 @opindex msep-data
18608 Generate code that allows the data segment to be located in a different
18609 area of memory from the text segment. This allows for execute in place in
18610 an environment without virtual memory management by eliminating relocations
18611 against the text section.
18612
18613 @item -mno-sep-data
18614 @opindex mno-sep-data
18615 @opindex msep-data
18616 Generate code that assumes that the data segment follows the text segment.
18617 This is the default.
18618
18619 @item -mlong-calls
18620 @itemx -mno-long-calls
18621 @opindex mlong-calls
18622 @opindex mno-long-calls
18623 Tells the compiler to perform function calls by first loading the
18624 address of the function into a register and then performing a subroutine
18625 call on this register. This switch is needed if the target function
18626 lies outside of the 24-bit addressing range of the offset-based
18627 version of subroutine call instruction.
18628
18629 This feature is not enabled by default. Specifying
18630 @option{-mno-long-calls} restores the default behavior. Note these
18631 switches have no effect on how the compiler generates code to handle
18632 function calls via function pointers.
18633
18634 @item -mfast-fp
18635 @opindex mfast-fp
18636 Link with the fast floating-point library. This library relaxes some of
18637 the IEEE floating-point standard's rules for checking inputs against
18638 Not-a-Number (NAN), in the interest of performance.
18639
18640 @item -minline-plt
18641 @opindex minline-plt
18642 Enable inlining of PLT entries in function calls to functions that are
18643 not known to bind locally. It has no effect without @option{-mfdpic}.
18644
18645 @item -mmulticore
18646 @opindex mmulticore
18647 Build a standalone application for multicore Blackfin processors.
18648 This option causes proper start files and link scripts supporting
18649 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18650 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18651
18652 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18653 selects the one-application-per-core programming model. Without
18654 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18655 programming model is used. In this model, the main function of Core B
18656 should be named as @code{coreb_main}.
18657
18658 If this option is not used, the single-core application programming
18659 model is used.
18660
18661 @item -mcorea
18662 @opindex mcorea
18663 Build a standalone application for Core A of BF561 when using
18664 the one-application-per-core programming model. Proper start files
18665 and link scripts are used to support Core A, and the macro
18666 @code{__BFIN_COREA} is defined.
18667 This option can only be used in conjunction with @option{-mmulticore}.
18668
18669 @item -mcoreb
18670 @opindex mcoreb
18671 Build a standalone application for Core B of BF561 when using
18672 the one-application-per-core programming model. Proper start files
18673 and link scripts are used to support Core B, and the macro
18674 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18675 should be used instead of @code{main}.
18676 This option can only be used in conjunction with @option{-mmulticore}.
18677
18678 @item -msdram
18679 @opindex msdram
18680 Build a standalone application for SDRAM. Proper start files and
18681 link scripts are used to put the application into SDRAM, and the macro
18682 @code{__BFIN_SDRAM} is defined.
18683 The loader should initialize SDRAM before loading the application.
18684
18685 @item -micplb
18686 @opindex micplb
18687 Assume that ICPLBs are enabled at run time. This has an effect on certain
18688 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18689 are enabled; for standalone applications the default is off.
18690 @end table
18691
18692 @node C6X Options
18693 @subsection C6X Options
18694 @cindex C6X Options
18695
18696 @table @gcctabopt
18697 @item -march=@var{name}
18698 @opindex march
18699 This specifies the name of the target architecture. GCC uses this
18700 name to determine what kind of instructions it can emit when generating
18701 assembly code. Permissible names are: @samp{c62x},
18702 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18703
18704 @item -mbig-endian
18705 @opindex mbig-endian
18706 Generate code for a big-endian target.
18707
18708 @item -mlittle-endian
18709 @opindex mlittle-endian
18710 Generate code for a little-endian target. This is the default.
18711
18712 @item -msim
18713 @opindex msim
18714 Choose startup files and linker script suitable for the simulator.
18715
18716 @item -msdata=default
18717 @opindex msdata=default
18718 Put small global and static data in the @code{.neardata} section,
18719 which is pointed to by register @code{B14}. Put small uninitialized
18720 global and static data in the @code{.bss} section, which is adjacent
18721 to the @code{.neardata} section. Put small read-only data into the
18722 @code{.rodata} section. The corresponding sections used for large
18723 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18724
18725 @item -msdata=all
18726 @opindex msdata=all
18727 Put all data, not just small objects, into the sections reserved for
18728 small data, and use addressing relative to the @code{B14} register to
18729 access them.
18730
18731 @item -msdata=none
18732 @opindex msdata=none
18733 Make no use of the sections reserved for small data, and use absolute
18734 addresses to access all data. Put all initialized global and static
18735 data in the @code{.fardata} section, and all uninitialized data in the
18736 @code{.far} section. Put all constant data into the @code{.const}
18737 section.
18738 @end table
18739
18740 @node CRIS Options
18741 @subsection CRIS Options
18742 @cindex CRIS Options
18743
18744 These options are defined specifically for the CRIS ports.
18745
18746 @table @gcctabopt
18747 @item -march=@var{architecture-type}
18748 @itemx -mcpu=@var{architecture-type}
18749 @opindex march
18750 @opindex mcpu
18751 Generate code for the specified architecture. The choices for
18752 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18753 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18754 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18755 @samp{v10}.
18756
18757 @item -mtune=@var{architecture-type}
18758 @opindex mtune
18759 Tune to @var{architecture-type} everything applicable about the generated
18760 code, except for the ABI and the set of available instructions. The
18761 choices for @var{architecture-type} are the same as for
18762 @option{-march=@var{architecture-type}}.
18763
18764 @item -mmax-stack-frame=@var{n}
18765 @opindex mmax-stack-frame
18766 Warn when the stack frame of a function exceeds @var{n} bytes.
18767
18768 @item -metrax4
18769 @itemx -metrax100
18770 @opindex metrax4
18771 @opindex metrax100
18772 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18773 @option{-march=v3} and @option{-march=v8} respectively.
18774
18775 @item -mmul-bug-workaround
18776 @itemx -mno-mul-bug-workaround
18777 @opindex mmul-bug-workaround
18778 @opindex mno-mul-bug-workaround
18779 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18780 models where it applies. This option is active by default.
18781
18782 @item -mpdebug
18783 @opindex mpdebug
18784 Enable CRIS-specific verbose debug-related information in the assembly
18785 code. This option also has the effect of turning off the @samp{#NO_APP}
18786 formatted-code indicator to the assembler at the beginning of the
18787 assembly file.
18788
18789 @item -mcc-init
18790 @opindex mcc-init
18791 Do not use condition-code results from previous instruction; always emit
18792 compare and test instructions before use of condition codes.
18793
18794 @item -mno-side-effects
18795 @opindex mno-side-effects
18796 @opindex mside-effects
18797 Do not emit instructions with side effects in addressing modes other than
18798 post-increment.
18799
18800 @item -mstack-align
18801 @itemx -mno-stack-align
18802 @itemx -mdata-align
18803 @itemx -mno-data-align
18804 @itemx -mconst-align
18805 @itemx -mno-const-align
18806 @opindex mstack-align
18807 @opindex mno-stack-align
18808 @opindex mdata-align
18809 @opindex mno-data-align
18810 @opindex mconst-align
18811 @opindex mno-const-align
18812 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18813 stack frame, individual data and constants to be aligned for the maximum
18814 single data access size for the chosen CPU model. The default is to
18815 arrange for 32-bit alignment. ABI details such as structure layout are
18816 not affected by these options.
18817
18818 @item -m32-bit
18819 @itemx -m16-bit
18820 @itemx -m8-bit
18821 @opindex m32-bit
18822 @opindex m16-bit
18823 @opindex m8-bit
18824 Similar to the stack- data- and const-align options above, these options
18825 arrange for stack frame, writable data and constants to all be 32-bit,
18826 16-bit or 8-bit aligned. The default is 32-bit alignment.
18827
18828 @item -mno-prologue-epilogue
18829 @itemx -mprologue-epilogue
18830 @opindex mno-prologue-epilogue
18831 @opindex mprologue-epilogue
18832 With @option{-mno-prologue-epilogue}, the normal function prologue and
18833 epilogue which set up the stack frame are omitted and no return
18834 instructions or return sequences are generated in the code. Use this
18835 option only together with visual inspection of the compiled code: no
18836 warnings or errors are generated when call-saved registers must be saved,
18837 or storage for local variables needs to be allocated.
18838
18839 @item -mno-gotplt
18840 @itemx -mgotplt
18841 @opindex mno-gotplt
18842 @opindex mgotplt
18843 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18844 instruction sequences that load addresses for functions from the PLT part
18845 of the GOT rather than (traditional on other architectures) calls to the
18846 PLT@. The default is @option{-mgotplt}.
18847
18848 @item -melf
18849 @opindex melf
18850 Legacy no-op option only recognized with the cris-axis-elf and
18851 cris-axis-linux-gnu targets.
18852
18853 @item -mlinux
18854 @opindex mlinux
18855 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18856
18857 @item -sim
18858 @opindex sim
18859 This option, recognized for the cris-axis-elf, arranges
18860 to link with input-output functions from a simulator library. Code,
18861 initialized data and zero-initialized data are allocated consecutively.
18862
18863 @item -sim2
18864 @opindex sim2
18865 Like @option{-sim}, but pass linker options to locate initialized data at
18866 0x40000000 and zero-initialized data at 0x80000000.
18867 @end table
18868
18869 @node CR16 Options
18870 @subsection CR16 Options
18871 @cindex CR16 Options
18872
18873 These options are defined specifically for the CR16 ports.
18874
18875 @table @gcctabopt
18876
18877 @item -mmac
18878 @opindex mmac
18879 Enable the use of multiply-accumulate instructions. Disabled by default.
18880
18881 @item -mcr16cplus
18882 @itemx -mcr16c
18883 @opindex mcr16cplus
18884 @opindex mcr16c
18885 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18886 is default.
18887
18888 @item -msim
18889 @opindex msim
18890 Links the library libsim.a which is in compatible with simulator. Applicable
18891 to ELF compiler only.
18892
18893 @item -mint32
18894 @opindex mint32
18895 Choose integer type as 32-bit wide.
18896
18897 @item -mbit-ops
18898 @opindex mbit-ops
18899 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18900
18901 @item -mdata-model=@var{model}
18902 @opindex mdata-model
18903 Choose a data model. The choices for @var{model} are @samp{near},
18904 @samp{far} or @samp{medium}. @samp{medium} is default.
18905 However, @samp{far} is not valid with @option{-mcr16c}, as the
18906 CR16C architecture does not support the far data model.
18907 @end table
18908
18909 @node C-SKY Options
18910 @subsection C-SKY Options
18911 @cindex C-SKY Options
18912
18913 GCC supports these options when compiling for C-SKY V2 processors.
18914
18915 @table @gcctabopt
18916
18917 @item -march=@var{arch}
18918 @opindex march=
18919 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18920 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18921 The default is @samp{ck810}.
18922
18923 @item -mcpu=@var{cpu}
18924 @opindex mcpu=
18925 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18926 @samp{ck801}, @samp{ck801t},
18927 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18928 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18929 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18930 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18931 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18932 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18933 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18934 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18935 @samp{ck803eftr1}, @samp{ck803efhtr1},
18936 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18937 @samp{ck803sef}, @samp{ck803seft},
18938 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18939 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18940 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18941 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18942
18943 @item -mbig-endian
18944 @opindex mbig-endian
18945 @itemx -EB
18946 @opindex EB
18947 @itemx -mlittle-endian
18948 @opindex mlittle-endian
18949 @itemx -EL
18950 @opindex EL
18951
18952 Select big- or little-endian code. The default is little-endian.
18953
18954 @item -mhard-float
18955 @opindex mhard-float
18956 @itemx -msoft-float
18957 @opindex msoft-float
18958
18959 Select hardware or software floating-point implementations.
18960 The default is soft float.
18961
18962 @item -mdouble-float
18963 @itemx -mno-double-float
18964 @opindex mdouble-float
18965 When @option{-mhard-float} is in effect, enable generation of
18966 double-precision float instructions. This is the default except
18967 when compiling for CK803.
18968
18969 @item -mfdivdu
18970 @itemx -mno-fdivdu
18971 @opindex mfdivdu
18972 When @option{-mhard-float} is in effect, enable generation of
18973 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
18974 This is the default except when compiling for CK803.
18975
18976 @item -mfpu=@var{fpu}
18977 @opindex mfpu=
18978 Select the floating-point processor. This option can only be used with
18979 @option{-mhard-float}.
18980 Values for @var{fpu} are
18981 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
18982 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
18983 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
18984
18985 @item -melrw
18986 @itemx -mno-elrw
18987 @opindex melrw
18988 Enable the extended @code{lrw} instruction. This option defaults to on
18989 for CK801 and off otherwise.
18990
18991 @item -mistack
18992 @itemx -mno-istack
18993 @opindex mistack
18994 Enable interrupt stack instructions; the default is off.
18995
18996 The @option{-mistack} option is required to handle the
18997 @code{interrupt} and @code{isr} function attributes
18998 (@pxref{C-SKY Function Attributes}).
18999
19000 @item -mmp
19001 @opindex mmp
19002 Enable multiprocessor instructions; the default is off.
19003
19004 @item -mcp
19005 @opindex mcp
19006 Enable coprocessor instructions; the default is off.
19007
19008 @item -mcache
19009 @opindex mcache
19010 Enable coprocessor instructions; the default is off.
19011
19012 @item -msecurity
19013 @opindex msecurity
19014 Enable C-SKY security instructions; the default is off.
19015
19016 @item -mtrust
19017 @opindex mtrust
19018 Enable C-SKY trust instructions; the default is off.
19019
19020 @item -mdsp
19021 @opindex mdsp
19022 @itemx -medsp
19023 @opindex medsp
19024 @itemx -mvdsp
19025 @opindex mvdsp
19026 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19027 All of these options default to off.
19028
19029 @item -mdiv
19030 @itemx -mno-div
19031 @opindex mdiv
19032 Generate divide instructions. Default is off.
19033
19034 @item -msmart
19035 @itemx -mno-smart
19036 @opindex msmart
19037 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19038 use of 16-bit instructions. This option is ignored for CK801 where this
19039 is the required behavior, and it defaults to on for CK802.
19040 For other targets, the default is off.
19041
19042 @item -mhigh-registers
19043 @itemx -mno-high-registers
19044 @opindex mhigh-registers
19045 Generate code using the high registers numbered 16-31. This option
19046 is not supported on CK801, CK802, or CK803, and is enabled by default
19047 for other processors.
19048
19049 @item -manchor
19050 @itemx -mno-anchor
19051 @opindex manchor
19052 Generate code using global anchor symbol addresses.
19053
19054 @item -mpushpop
19055 @itemx -mno-pushpop
19056 @opindex mpushpop
19057 Generate code using @code{push} and @code{pop} instructions. This option
19058 defaults to on.
19059
19060 @item -mmultiple-stld
19061 @itemx -mstm
19062 @itemx -mno-multiple-stld
19063 @itemx -mno-stm
19064 @opindex mmultiple-stld
19065 Generate code using @code{stm} and @code{ldm} instructions. This option
19066 isn't supported on CK801 but is enabled by default on other processors.
19067
19068 @item -mconstpool
19069 @itemx -mno-constpool
19070 @opindex mconstpool
19071 Create constant pools in the compiler instead of deferring it to the
19072 assembler. This option is the default and required for correct code
19073 generation on CK801 and CK802, and is optional on other processors.
19074
19075 @item -mstack-size
19076 @item -mno-stack-size
19077 @opindex mstack-size
19078 Emit @code{.stack_size} directives for each function in the assembly
19079 output. This option defaults to off.
19080
19081 @item -mccrt
19082 @itemx -mno-ccrt
19083 @opindex mccrt
19084 Generate code for the C-SKY compiler runtime instead of libgcc. This
19085 option defaults to off.
19086
19087 @item -mbranch-cost=@var{n}
19088 @opindex mbranch-cost=
19089 Set the branch costs to roughly @code{n} instructions. The default is 1.
19090
19091 @item -msched-prolog
19092 @itemx -mno-sched-prolog
19093 @opindex msched-prolog
19094 Permit scheduling of function prologue and epilogue sequences. Using
19095 this option can result in code that is not compliant with the C-SKY V2 ABI
19096 prologue requirements and that cannot be debugged or backtraced.
19097 It is disabled by default.
19098
19099 @end table
19100
19101 @node Darwin Options
19102 @subsection Darwin Options
19103 @cindex Darwin options
19104
19105 These options are defined for all architectures running the Darwin operating
19106 system.
19107
19108 FSF GCC on Darwin does not create ``fat'' object files; it creates
19109 an object file for the single architecture that GCC was built to
19110 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19111 @option{-arch} options are used; it does so by running the compiler or
19112 linker multiple times and joining the results together with
19113 @file{lipo}.
19114
19115 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19116 @samp{i686}) is determined by the flags that specify the ISA
19117 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19118 @option{-force_cpusubtype_ALL} option can be used to override this.
19119
19120 The Darwin tools vary in their behavior when presented with an ISA
19121 mismatch. The assembler, @file{as}, only permits instructions to
19122 be used that are valid for the subtype of the file it is generating,
19123 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19124 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19125 and prints an error if asked to create a shared library with a less
19126 restrictive subtype than its input files (for instance, trying to put
19127 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19128 for executables, @command{ld}, quietly gives the executable the most
19129 restrictive subtype of any of its input files.
19130
19131 @table @gcctabopt
19132 @item -F@var{dir}
19133 @opindex F
19134 Add the framework directory @var{dir} to the head of the list of
19135 directories to be searched for header files. These directories are
19136 interleaved with those specified by @option{-I} options and are
19137 scanned in a left-to-right order.
19138
19139 A framework directory is a directory with frameworks in it. A
19140 framework is a directory with a @file{Headers} and/or
19141 @file{PrivateHeaders} directory contained directly in it that ends
19142 in @file{.framework}. The name of a framework is the name of this
19143 directory excluding the @file{.framework}. Headers associated with
19144 the framework are found in one of those two directories, with
19145 @file{Headers} being searched first. A subframework is a framework
19146 directory that is in a framework's @file{Frameworks} directory.
19147 Includes of subframework headers can only appear in a header of a
19148 framework that contains the subframework, or in a sibling subframework
19149 header. Two subframeworks are siblings if they occur in the same
19150 framework. A subframework should not have the same name as a
19151 framework; a warning is issued if this is violated. Currently a
19152 subframework cannot have subframeworks; in the future, the mechanism
19153 may be extended to support this. The standard frameworks can be found
19154 in @file{/System/Library/Frameworks} and
19155 @file{/Library/Frameworks}. An example include looks like
19156 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19157 the name of the framework and @file{header.h} is found in the
19158 @file{PrivateHeaders} or @file{Headers} directory.
19159
19160 @item -iframework@var{dir}
19161 @opindex iframework
19162 Like @option{-F} except the directory is a treated as a system
19163 directory. The main difference between this @option{-iframework} and
19164 @option{-F} is that with @option{-iframework} the compiler does not
19165 warn about constructs contained within header files found via
19166 @var{dir}. This option is valid only for the C family of languages.
19167
19168 @item -gused
19169 @opindex gused
19170 Emit debugging information for symbols that are used. For stabs
19171 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19172 This is by default ON@.
19173
19174 @item -gfull
19175 @opindex gfull
19176 Emit debugging information for all symbols and types.
19177
19178 @item -mmacosx-version-min=@var{version}
19179 The earliest version of MacOS X that this executable will run on
19180 is @var{version}. Typical values of @var{version} include @code{10.1},
19181 @code{10.2}, and @code{10.3.9}.
19182
19183 If the compiler was built to use the system's headers by default,
19184 then the default for this option is the system version on which the
19185 compiler is running, otherwise the default is to make choices that
19186 are compatible with as many systems and code bases as possible.
19187
19188 @item -mkernel
19189 @opindex mkernel
19190 Enable kernel development mode. The @option{-mkernel} option sets
19191 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19192 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19193 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19194 applicable. This mode also sets @option{-mno-altivec},
19195 @option{-msoft-float}, @option{-fno-builtin} and
19196 @option{-mlong-branch} for PowerPC targets.
19197
19198 @item -mone-byte-bool
19199 @opindex mone-byte-bool
19200 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19201 By default @code{sizeof(bool)} is @code{4} when compiling for
19202 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19203 option has no effect on x86.
19204
19205 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19206 to generate code that is not binary compatible with code generated
19207 without that switch. Using this switch may require recompiling all
19208 other modules in a program, including system libraries. Use this
19209 switch to conform to a non-default data model.
19210
19211 @item -mfix-and-continue
19212 @itemx -ffix-and-continue
19213 @itemx -findirect-data
19214 @opindex mfix-and-continue
19215 @opindex ffix-and-continue
19216 @opindex findirect-data
19217 Generate code suitable for fast turnaround development, such as to
19218 allow GDB to dynamically load @file{.o} files into already-running
19219 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19220 are provided for backwards compatibility.
19221
19222 @item -all_load
19223 @opindex all_load
19224 Loads all members of static archive libraries.
19225 See man ld(1) for more information.
19226
19227 @item -arch_errors_fatal
19228 @opindex arch_errors_fatal
19229 Cause the errors having to do with files that have the wrong architecture
19230 to be fatal.
19231
19232 @item -bind_at_load
19233 @opindex bind_at_load
19234 Causes the output file to be marked such that the dynamic linker will
19235 bind all undefined references when the file is loaded or launched.
19236
19237 @item -bundle
19238 @opindex bundle
19239 Produce a Mach-o bundle format file.
19240 See man ld(1) for more information.
19241
19242 @item -bundle_loader @var{executable}
19243 @opindex bundle_loader
19244 This option specifies the @var{executable} that will load the build
19245 output file being linked. See man ld(1) for more information.
19246
19247 @item -dynamiclib
19248 @opindex dynamiclib
19249 When passed this option, GCC produces a dynamic library instead of
19250 an executable when linking, using the Darwin @file{libtool} command.
19251
19252 @item -force_cpusubtype_ALL
19253 @opindex force_cpusubtype_ALL
19254 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19255 one controlled by the @option{-mcpu} or @option{-march} option.
19256
19257 @item -allowable_client @var{client_name}
19258 @itemx -client_name
19259 @itemx -compatibility_version
19260 @itemx -current_version
19261 @itemx -dead_strip
19262 @itemx -dependency-file
19263 @itemx -dylib_file
19264 @itemx -dylinker_install_name
19265 @itemx -dynamic
19266 @itemx -exported_symbols_list
19267 @itemx -filelist
19268 @need 800
19269 @itemx -flat_namespace
19270 @itemx -force_flat_namespace
19271 @itemx -headerpad_max_install_names
19272 @itemx -image_base
19273 @itemx -init
19274 @itemx -install_name
19275 @itemx -keep_private_externs
19276 @itemx -multi_module
19277 @itemx -multiply_defined
19278 @itemx -multiply_defined_unused
19279 @need 800
19280 @itemx -noall_load
19281 @itemx -no_dead_strip_inits_and_terms
19282 @itemx -nofixprebinding
19283 @itemx -nomultidefs
19284 @itemx -noprebind
19285 @itemx -noseglinkedit
19286 @itemx -pagezero_size
19287 @itemx -prebind
19288 @itemx -prebind_all_twolevel_modules
19289 @itemx -private_bundle
19290 @need 800
19291 @itemx -read_only_relocs
19292 @itemx -sectalign
19293 @itemx -sectobjectsymbols
19294 @itemx -whyload
19295 @itemx -seg1addr
19296 @itemx -sectcreate
19297 @itemx -sectobjectsymbols
19298 @itemx -sectorder
19299 @itemx -segaddr
19300 @itemx -segs_read_only_addr
19301 @need 800
19302 @itemx -segs_read_write_addr
19303 @itemx -seg_addr_table
19304 @itemx -seg_addr_table_filename
19305 @itemx -seglinkedit
19306 @itemx -segprot
19307 @itemx -segs_read_only_addr
19308 @itemx -segs_read_write_addr
19309 @itemx -single_module
19310 @itemx -static
19311 @itemx -sub_library
19312 @need 800
19313 @itemx -sub_umbrella
19314 @itemx -twolevel_namespace
19315 @itemx -umbrella
19316 @itemx -undefined
19317 @itemx -unexported_symbols_list
19318 @itemx -weak_reference_mismatches
19319 @itemx -whatsloaded
19320 @opindex allowable_client
19321 @opindex client_name
19322 @opindex compatibility_version
19323 @opindex current_version
19324 @opindex dead_strip
19325 @opindex dependency-file
19326 @opindex dylib_file
19327 @opindex dylinker_install_name
19328 @opindex dynamic
19329 @opindex exported_symbols_list
19330 @opindex filelist
19331 @opindex flat_namespace
19332 @opindex force_flat_namespace
19333 @opindex headerpad_max_install_names
19334 @opindex image_base
19335 @opindex init
19336 @opindex install_name
19337 @opindex keep_private_externs
19338 @opindex multi_module
19339 @opindex multiply_defined
19340 @opindex multiply_defined_unused
19341 @opindex noall_load
19342 @opindex no_dead_strip_inits_and_terms
19343 @opindex nofixprebinding
19344 @opindex nomultidefs
19345 @opindex noprebind
19346 @opindex noseglinkedit
19347 @opindex pagezero_size
19348 @opindex prebind
19349 @opindex prebind_all_twolevel_modules
19350 @opindex private_bundle
19351 @opindex read_only_relocs
19352 @opindex sectalign
19353 @opindex sectobjectsymbols
19354 @opindex whyload
19355 @opindex seg1addr
19356 @opindex sectcreate
19357 @opindex sectobjectsymbols
19358 @opindex sectorder
19359 @opindex segaddr
19360 @opindex segs_read_only_addr
19361 @opindex segs_read_write_addr
19362 @opindex seg_addr_table
19363 @opindex seg_addr_table_filename
19364 @opindex seglinkedit
19365 @opindex segprot
19366 @opindex segs_read_only_addr
19367 @opindex segs_read_write_addr
19368 @opindex single_module
19369 @opindex static
19370 @opindex sub_library
19371 @opindex sub_umbrella
19372 @opindex twolevel_namespace
19373 @opindex umbrella
19374 @opindex undefined
19375 @opindex unexported_symbols_list
19376 @opindex weak_reference_mismatches
19377 @opindex whatsloaded
19378 These options are passed to the Darwin linker. The Darwin linker man page
19379 describes them in detail.
19380 @end table
19381
19382 @node DEC Alpha Options
19383 @subsection DEC Alpha Options
19384
19385 These @samp{-m} options are defined for the DEC Alpha implementations:
19386
19387 @table @gcctabopt
19388 @item -mno-soft-float
19389 @itemx -msoft-float
19390 @opindex mno-soft-float
19391 @opindex msoft-float
19392 Use (do not use) the hardware floating-point instructions for
19393 floating-point operations. When @option{-msoft-float} is specified,
19394 functions in @file{libgcc.a} are used to perform floating-point
19395 operations. Unless they are replaced by routines that emulate the
19396 floating-point operations, or compiled in such a way as to call such
19397 emulations routines, these routines issue floating-point
19398 operations. If you are compiling for an Alpha without floating-point
19399 operations, you must ensure that the library is built so as not to call
19400 them.
19401
19402 Note that Alpha implementations without floating-point operations are
19403 required to have floating-point registers.
19404
19405 @item -mfp-reg
19406 @itemx -mno-fp-regs
19407 @opindex mfp-reg
19408 @opindex mno-fp-regs
19409 Generate code that uses (does not use) the floating-point register set.
19410 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19411 register set is not used, floating-point operands are passed in integer
19412 registers as if they were integers and floating-point results are passed
19413 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19414 so any function with a floating-point argument or return value called by code
19415 compiled with @option{-mno-fp-regs} must also be compiled with that
19416 option.
19417
19418 A typical use of this option is building a kernel that does not use,
19419 and hence need not save and restore, any floating-point registers.
19420
19421 @item -mieee
19422 @opindex mieee
19423 The Alpha architecture implements floating-point hardware optimized for
19424 maximum performance. It is mostly compliant with the IEEE floating-point
19425 standard. However, for full compliance, software assistance is
19426 required. This option generates code fully IEEE-compliant code
19427 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19428 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19429 defined during compilation. The resulting code is less efficient but is
19430 able to correctly support denormalized numbers and exceptional IEEE
19431 values such as not-a-number and plus/minus infinity. Other Alpha
19432 compilers call this option @option{-ieee_with_no_inexact}.
19433
19434 @item -mieee-with-inexact
19435 @opindex mieee-with-inexact
19436 This is like @option{-mieee} except the generated code also maintains
19437 the IEEE @var{inexact-flag}. Turning on this option causes the
19438 generated code to implement fully-compliant IEEE math. In addition to
19439 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19440 macro. On some Alpha implementations the resulting code may execute
19441 significantly slower than the code generated by default. Since there is
19442 very little code that depends on the @var{inexact-flag}, you should
19443 normally not specify this option. Other Alpha compilers call this
19444 option @option{-ieee_with_inexact}.
19445
19446 @item -mfp-trap-mode=@var{trap-mode}
19447 @opindex mfp-trap-mode
19448 This option controls what floating-point related traps are enabled.
19449 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19450 The trap mode can be set to one of four values:
19451
19452 @table @samp
19453 @item n
19454 This is the default (normal) setting. The only traps that are enabled
19455 are the ones that cannot be disabled in software (e.g., division by zero
19456 trap).
19457
19458 @item u
19459 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19460 as well.
19461
19462 @item su
19463 Like @samp{u}, but the instructions are marked to be safe for software
19464 completion (see Alpha architecture manual for details).
19465
19466 @item sui
19467 Like @samp{su}, but inexact traps are enabled as well.
19468 @end table
19469
19470 @item -mfp-rounding-mode=@var{rounding-mode}
19471 @opindex mfp-rounding-mode
19472 Selects the IEEE rounding mode. Other Alpha compilers call this option
19473 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19474 of:
19475
19476 @table @samp
19477 @item n
19478 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19479 the nearest machine number or towards the even machine number in case
19480 of a tie.
19481
19482 @item m
19483 Round towards minus infinity.
19484
19485 @item c
19486 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19487
19488 @item d
19489 Dynamic rounding mode. A field in the floating-point control register
19490 (@var{fpcr}, see Alpha architecture reference manual) controls the
19491 rounding mode in effect. The C library initializes this register for
19492 rounding towards plus infinity. Thus, unless your program modifies the
19493 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19494 @end table
19495
19496 @item -mtrap-precision=@var{trap-precision}
19497 @opindex mtrap-precision
19498 In the Alpha architecture, floating-point traps are imprecise. This
19499 means without software assistance it is impossible to recover from a
19500 floating trap and program execution normally needs to be terminated.
19501 GCC can generate code that can assist operating system trap handlers
19502 in determining the exact location that caused a floating-point trap.
19503 Depending on the requirements of an application, different levels of
19504 precisions can be selected:
19505
19506 @table @samp
19507 @item p
19508 Program precision. This option is the default and means a trap handler
19509 can only identify which program caused a floating-point exception.
19510
19511 @item f
19512 Function precision. The trap handler can determine the function that
19513 caused a floating-point exception.
19514
19515 @item i
19516 Instruction precision. The trap handler can determine the exact
19517 instruction that caused a floating-point exception.
19518 @end table
19519
19520 Other Alpha compilers provide the equivalent options called
19521 @option{-scope_safe} and @option{-resumption_safe}.
19522
19523 @item -mieee-conformant
19524 @opindex mieee-conformant
19525 This option marks the generated code as IEEE conformant. You must not
19526 use this option unless you also specify @option{-mtrap-precision=i} and either
19527 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19528 is to emit the line @samp{.eflag 48} in the function prologue of the
19529 generated assembly file.
19530
19531 @item -mbuild-constants
19532 @opindex mbuild-constants
19533 Normally GCC examines a 32- or 64-bit integer constant to
19534 see if it can construct it from smaller constants in two or three
19535 instructions. If it cannot, it outputs the constant as a literal and
19536 generates code to load it from the data segment at run time.
19537
19538 Use this option to require GCC to construct @emph{all} integer constants
19539 using code, even if it takes more instructions (the maximum is six).
19540
19541 You typically use this option to build a shared library dynamic
19542 loader. Itself a shared library, it must relocate itself in memory
19543 before it can find the variables and constants in its own data segment.
19544
19545 @item -mbwx
19546 @itemx -mno-bwx
19547 @itemx -mcix
19548 @itemx -mno-cix
19549 @itemx -mfix
19550 @itemx -mno-fix
19551 @itemx -mmax
19552 @itemx -mno-max
19553 @opindex mbwx
19554 @opindex mno-bwx
19555 @opindex mcix
19556 @opindex mno-cix
19557 @opindex mfix
19558 @opindex mno-fix
19559 @opindex mmax
19560 @opindex mno-max
19561 Indicate whether GCC should generate code to use the optional BWX,
19562 CIX, FIX and MAX instruction sets. The default is to use the instruction
19563 sets supported by the CPU type specified via @option{-mcpu=} option or that
19564 of the CPU on which GCC was built if none is specified.
19565
19566 @item -mfloat-vax
19567 @itemx -mfloat-ieee
19568 @opindex mfloat-vax
19569 @opindex mfloat-ieee
19570 Generate code that uses (does not use) VAX F and G floating-point
19571 arithmetic instead of IEEE single and double precision.
19572
19573 @item -mexplicit-relocs
19574 @itemx -mno-explicit-relocs
19575 @opindex mexplicit-relocs
19576 @opindex mno-explicit-relocs
19577 Older Alpha assemblers provided no way to generate symbol relocations
19578 except via assembler macros. Use of these macros does not allow
19579 optimal instruction scheduling. GNU binutils as of version 2.12
19580 supports a new syntax that allows the compiler to explicitly mark
19581 which relocations should apply to which instructions. This option
19582 is mostly useful for debugging, as GCC detects the capabilities of
19583 the assembler when it is built and sets the default accordingly.
19584
19585 @item -msmall-data
19586 @itemx -mlarge-data
19587 @opindex msmall-data
19588 @opindex mlarge-data
19589 When @option{-mexplicit-relocs} is in effect, static data is
19590 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19591 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19592 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19593 16-bit relocations off of the @code{$gp} register. This limits the
19594 size of the small data area to 64KB, but allows the variables to be
19595 directly accessed via a single instruction.
19596
19597 The default is @option{-mlarge-data}. With this option the data area
19598 is limited to just below 2GB@. Programs that require more than 2GB of
19599 data must use @code{malloc} or @code{mmap} to allocate the data in the
19600 heap instead of in the program's data segment.
19601
19602 When generating code for shared libraries, @option{-fpic} implies
19603 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19604
19605 @item -msmall-text
19606 @itemx -mlarge-text
19607 @opindex msmall-text
19608 @opindex mlarge-text
19609 When @option{-msmall-text} is used, the compiler assumes that the
19610 code of the entire program (or shared library) fits in 4MB, and is
19611 thus reachable with a branch instruction. When @option{-msmall-data}
19612 is used, the compiler can assume that all local symbols share the
19613 same @code{$gp} value, and thus reduce the number of instructions
19614 required for a function call from 4 to 1.
19615
19616 The default is @option{-mlarge-text}.
19617
19618 @item -mcpu=@var{cpu_type}
19619 @opindex mcpu
19620 Set the instruction set and instruction scheduling parameters for
19621 machine type @var{cpu_type}. You can specify either the @samp{EV}
19622 style name or the corresponding chip number. GCC supports scheduling
19623 parameters for the EV4, EV5 and EV6 family of processors and
19624 chooses the default values for the instruction set from the processor
19625 you specify. If you do not specify a processor type, GCC defaults
19626 to the processor on which the compiler was built.
19627
19628 Supported values for @var{cpu_type} are
19629
19630 @table @samp
19631 @item ev4
19632 @itemx ev45
19633 @itemx 21064
19634 Schedules as an EV4 and has no instruction set extensions.
19635
19636 @item ev5
19637 @itemx 21164
19638 Schedules as an EV5 and has no instruction set extensions.
19639
19640 @item ev56
19641 @itemx 21164a
19642 Schedules as an EV5 and supports the BWX extension.
19643
19644 @item pca56
19645 @itemx 21164pc
19646 @itemx 21164PC
19647 Schedules as an EV5 and supports the BWX and MAX extensions.
19648
19649 @item ev6
19650 @itemx 21264
19651 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19652
19653 @item ev67
19654 @itemx 21264a
19655 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19656 @end table
19657
19658 Native toolchains also support the value @samp{native},
19659 which selects the best architecture option for the host processor.
19660 @option{-mcpu=native} has no effect if GCC does not recognize
19661 the processor.
19662
19663 @item -mtune=@var{cpu_type}
19664 @opindex mtune
19665 Set only the instruction scheduling parameters for machine type
19666 @var{cpu_type}. The instruction set is not changed.
19667
19668 Native toolchains also support the value @samp{native},
19669 which selects the best architecture option for the host processor.
19670 @option{-mtune=native} has no effect if GCC does not recognize
19671 the processor.
19672
19673 @item -mmemory-latency=@var{time}
19674 @opindex mmemory-latency
19675 Sets the latency the scheduler should assume for typical memory
19676 references as seen by the application. This number is highly
19677 dependent on the memory access patterns used by the application
19678 and the size of the external cache on the machine.
19679
19680 Valid options for @var{time} are
19681
19682 @table @samp
19683 @item @var{number}
19684 A decimal number representing clock cycles.
19685
19686 @item L1
19687 @itemx L2
19688 @itemx L3
19689 @itemx main
19690 The compiler contains estimates of the number of clock cycles for
19691 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19692 (also called Dcache, Scache, and Bcache), as well as to main memory.
19693 Note that L3 is only valid for EV5.
19694
19695 @end table
19696 @end table
19697
19698 @node FR30 Options
19699 @subsection FR30 Options
19700 @cindex FR30 Options
19701
19702 These options are defined specifically for the FR30 port.
19703
19704 @table @gcctabopt
19705
19706 @item -msmall-model
19707 @opindex msmall-model
19708 Use the small address space model. This can produce smaller code, but
19709 it does assume that all symbolic values and addresses fit into a
19710 20-bit range.
19711
19712 @item -mno-lsim
19713 @opindex mno-lsim
19714 Assume that runtime support has been provided and so there is no need
19715 to include the simulator library (@file{libsim.a}) on the linker
19716 command line.
19717
19718 @end table
19719
19720 @node FT32 Options
19721 @subsection FT32 Options
19722 @cindex FT32 Options
19723
19724 These options are defined specifically for the FT32 port.
19725
19726 @table @gcctabopt
19727
19728 @item -msim
19729 @opindex msim
19730 Specifies that the program will be run on the simulator. This causes
19731 an alternate runtime startup and library to be linked.
19732 You must not use this option when generating programs that will run on
19733 real hardware; you must provide your own runtime library for whatever
19734 I/O functions are needed.
19735
19736 @item -mlra
19737 @opindex mlra
19738 Enable Local Register Allocation. This is still experimental for FT32,
19739 so by default the compiler uses standard reload.
19740
19741 @item -mnodiv
19742 @opindex mnodiv
19743 Do not use div and mod instructions.
19744
19745 @item -mft32b
19746 @opindex mft32b
19747 Enable use of the extended instructions of the FT32B processor.
19748
19749 @item -mcompress
19750 @opindex mcompress
19751 Compress all code using the Ft32B code compression scheme.
19752
19753 @item -mnopm
19754 @opindex mnopm
19755 Do not generate code that reads program memory.
19756
19757 @end table
19758
19759 @node FRV Options
19760 @subsection FRV Options
19761 @cindex FRV Options
19762
19763 @table @gcctabopt
19764 @item -mgpr-32
19765 @opindex mgpr-32
19766
19767 Only use the first 32 general-purpose registers.
19768
19769 @item -mgpr-64
19770 @opindex mgpr-64
19771
19772 Use all 64 general-purpose registers.
19773
19774 @item -mfpr-32
19775 @opindex mfpr-32
19776
19777 Use only the first 32 floating-point registers.
19778
19779 @item -mfpr-64
19780 @opindex mfpr-64
19781
19782 Use all 64 floating-point registers.
19783
19784 @item -mhard-float
19785 @opindex mhard-float
19786
19787 Use hardware instructions for floating-point operations.
19788
19789 @item -msoft-float
19790 @opindex msoft-float
19791
19792 Use library routines for floating-point operations.
19793
19794 @item -malloc-cc
19795 @opindex malloc-cc
19796
19797 Dynamically allocate condition code registers.
19798
19799 @item -mfixed-cc
19800 @opindex mfixed-cc
19801
19802 Do not try to dynamically allocate condition code registers, only
19803 use @code{icc0} and @code{fcc0}.
19804
19805 @item -mdword
19806 @opindex mdword
19807
19808 Change ABI to use double word insns.
19809
19810 @item -mno-dword
19811 @opindex mno-dword
19812 @opindex mdword
19813
19814 Do not use double word instructions.
19815
19816 @item -mdouble
19817 @opindex mdouble
19818
19819 Use floating-point double instructions.
19820
19821 @item -mno-double
19822 @opindex mno-double
19823
19824 Do not use floating-point double instructions.
19825
19826 @item -mmedia
19827 @opindex mmedia
19828
19829 Use media instructions.
19830
19831 @item -mno-media
19832 @opindex mno-media
19833
19834 Do not use media instructions.
19835
19836 @item -mmuladd
19837 @opindex mmuladd
19838
19839 Use multiply and add/subtract instructions.
19840
19841 @item -mno-muladd
19842 @opindex mno-muladd
19843
19844 Do not use multiply and add/subtract instructions.
19845
19846 @item -mfdpic
19847 @opindex mfdpic
19848
19849 Select the FDPIC ABI, which uses function descriptors to represent
19850 pointers to functions. Without any PIC/PIE-related options, it
19851 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19852 assumes GOT entries and small data are within a 12-bit range from the
19853 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19854 are computed with 32 bits.
19855 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19856
19857 @item -minline-plt
19858 @opindex minline-plt
19859
19860 Enable inlining of PLT entries in function calls to functions that are
19861 not known to bind locally. It has no effect without @option{-mfdpic}.
19862 It's enabled by default if optimizing for speed and compiling for
19863 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19864 optimization option such as @option{-O3} or above is present in the
19865 command line.
19866
19867 @item -mTLS
19868 @opindex mTLS
19869
19870 Assume a large TLS segment when generating thread-local code.
19871
19872 @item -mtls
19873 @opindex mtls
19874
19875 Do not assume a large TLS segment when generating thread-local code.
19876
19877 @item -mgprel-ro
19878 @opindex mgprel-ro
19879
19880 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19881 that is known to be in read-only sections. It's enabled by default,
19882 except for @option{-fpic} or @option{-fpie}: even though it may help
19883 make the global offset table smaller, it trades 1 instruction for 4.
19884 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19885 one of which may be shared by multiple symbols, and it avoids the need
19886 for a GOT entry for the referenced symbol, so it's more likely to be a
19887 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19888
19889 @item -multilib-library-pic
19890 @opindex multilib-library-pic
19891
19892 Link with the (library, not FD) pic libraries. It's implied by
19893 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19894 @option{-fpic} without @option{-mfdpic}. You should never have to use
19895 it explicitly.
19896
19897 @item -mlinked-fp
19898 @opindex mlinked-fp
19899
19900 Follow the EABI requirement of always creating a frame pointer whenever
19901 a stack frame is allocated. This option is enabled by default and can
19902 be disabled with @option{-mno-linked-fp}.
19903
19904 @item -mlong-calls
19905 @opindex mlong-calls
19906
19907 Use indirect addressing to call functions outside the current
19908 compilation unit. This allows the functions to be placed anywhere
19909 within the 32-bit address space.
19910
19911 @item -malign-labels
19912 @opindex malign-labels
19913
19914 Try to align labels to an 8-byte boundary by inserting NOPs into the
19915 previous packet. This option only has an effect when VLIW packing
19916 is enabled. It doesn't create new packets; it merely adds NOPs to
19917 existing ones.
19918
19919 @item -mlibrary-pic
19920 @opindex mlibrary-pic
19921
19922 Generate position-independent EABI code.
19923
19924 @item -macc-4
19925 @opindex macc-4
19926
19927 Use only the first four media accumulator registers.
19928
19929 @item -macc-8
19930 @opindex macc-8
19931
19932 Use all eight media accumulator registers.
19933
19934 @item -mpack
19935 @opindex mpack
19936
19937 Pack VLIW instructions.
19938
19939 @item -mno-pack
19940 @opindex mno-pack
19941
19942 Do not pack VLIW instructions.
19943
19944 @item -mno-eflags
19945 @opindex mno-eflags
19946
19947 Do not mark ABI switches in e_flags.
19948
19949 @item -mcond-move
19950 @opindex mcond-move
19951
19952 Enable the use of conditional-move instructions (default).
19953
19954 This switch is mainly for debugging the compiler and will likely be removed
19955 in a future version.
19956
19957 @item -mno-cond-move
19958 @opindex mno-cond-move
19959
19960 Disable the use of conditional-move instructions.
19961
19962 This switch is mainly for debugging the compiler and will likely be removed
19963 in a future version.
19964
19965 @item -mscc
19966 @opindex mscc
19967
19968 Enable the use of conditional set instructions (default).
19969
19970 This switch is mainly for debugging the compiler and will likely be removed
19971 in a future version.
19972
19973 @item -mno-scc
19974 @opindex mno-scc
19975
19976 Disable the use of conditional set instructions.
19977
19978 This switch is mainly for debugging the compiler and will likely be removed
19979 in a future version.
19980
19981 @item -mcond-exec
19982 @opindex mcond-exec
19983
19984 Enable the use of conditional execution (default).
19985
19986 This switch is mainly for debugging the compiler and will likely be removed
19987 in a future version.
19988
19989 @item -mno-cond-exec
19990 @opindex mno-cond-exec
19991
19992 Disable the use of conditional execution.
19993
19994 This switch is mainly for debugging the compiler and will likely be removed
19995 in a future version.
19996
19997 @item -mvliw-branch
19998 @opindex mvliw-branch
19999
20000 Run a pass to pack branches into VLIW instructions (default).
20001
20002 This switch is mainly for debugging the compiler and will likely be removed
20003 in a future version.
20004
20005 @item -mno-vliw-branch
20006 @opindex mno-vliw-branch
20007
20008 Do not run a pass to pack branches into VLIW instructions.
20009
20010 This switch is mainly for debugging the compiler and will likely be removed
20011 in a future version.
20012
20013 @item -mmulti-cond-exec
20014 @opindex mmulti-cond-exec
20015
20016 Enable optimization of @code{&&} and @code{||} in conditional execution
20017 (default).
20018
20019 This switch is mainly for debugging the compiler and will likely be removed
20020 in a future version.
20021
20022 @item -mno-multi-cond-exec
20023 @opindex mno-multi-cond-exec
20024
20025 Disable optimization of @code{&&} and @code{||} in conditional execution.
20026
20027 This switch is mainly for debugging the compiler and will likely be removed
20028 in a future version.
20029
20030 @item -mnested-cond-exec
20031 @opindex mnested-cond-exec
20032
20033 Enable nested conditional execution optimizations (default).
20034
20035 This switch is mainly for debugging the compiler and will likely be removed
20036 in a future version.
20037
20038 @item -mno-nested-cond-exec
20039 @opindex mno-nested-cond-exec
20040
20041 Disable nested conditional execution optimizations.
20042
20043 This switch is mainly for debugging the compiler and will likely be removed
20044 in a future version.
20045
20046 @item -moptimize-membar
20047 @opindex moptimize-membar
20048
20049 This switch removes redundant @code{membar} instructions from the
20050 compiler-generated code. It is enabled by default.
20051
20052 @item -mno-optimize-membar
20053 @opindex mno-optimize-membar
20054 @opindex moptimize-membar
20055
20056 This switch disables the automatic removal of redundant @code{membar}
20057 instructions from the generated code.
20058
20059 @item -mtomcat-stats
20060 @opindex mtomcat-stats
20061
20062 Cause gas to print out tomcat statistics.
20063
20064 @item -mcpu=@var{cpu}
20065 @opindex mcpu
20066
20067 Select the processor type for which to generate code. Possible values are
20068 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20069 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20070
20071 @end table
20072
20073 @node GNU/Linux Options
20074 @subsection GNU/Linux Options
20075
20076 These @samp{-m} options are defined for GNU/Linux targets:
20077
20078 @table @gcctabopt
20079 @item -mglibc
20080 @opindex mglibc
20081 Use the GNU C library. This is the default except
20082 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20083 @samp{*-*-linux-*android*} targets.
20084
20085 @item -muclibc
20086 @opindex muclibc
20087 Use uClibc C library. This is the default on
20088 @samp{*-*-linux-*uclibc*} targets.
20089
20090 @item -mmusl
20091 @opindex mmusl
20092 Use the musl C library. This is the default on
20093 @samp{*-*-linux-*musl*} targets.
20094
20095 @item -mbionic
20096 @opindex mbionic
20097 Use Bionic C library. This is the default on
20098 @samp{*-*-linux-*android*} targets.
20099
20100 @item -mandroid
20101 @opindex mandroid
20102 Compile code compatible with Android platform. This is the default on
20103 @samp{*-*-linux-*android*} targets.
20104
20105 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20106 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20107 this option makes the GCC driver pass Android-specific options to the linker.
20108 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20109 to be defined.
20110
20111 @item -tno-android-cc
20112 @opindex tno-android-cc
20113 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20114 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20115 @option{-fno-rtti} by default.
20116
20117 @item -tno-android-ld
20118 @opindex tno-android-ld
20119 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20120 linking options to the linker.
20121
20122 @end table
20123
20124 @node H8/300 Options
20125 @subsection H8/300 Options
20126
20127 These @samp{-m} options are defined for the H8/300 implementations:
20128
20129 @table @gcctabopt
20130 @item -mrelax
20131 @opindex mrelax
20132 Shorten some address references at link time, when possible; uses the
20133 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20134 ld, Using ld}, for a fuller description.
20135
20136 @item -mh
20137 @opindex mh
20138 Generate code for the H8/300H@.
20139
20140 @item -ms
20141 @opindex ms
20142 Generate code for the H8S@.
20143
20144 @item -mn
20145 @opindex mn
20146 Generate code for the H8S and H8/300H in the normal mode. This switch
20147 must be used either with @option{-mh} or @option{-ms}.
20148
20149 @item -ms2600
20150 @opindex ms2600
20151 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20152
20153 @item -mexr
20154 @opindex mexr
20155 Extended registers are stored on stack before execution of function
20156 with monitor attribute. Default option is @option{-mexr}.
20157 This option is valid only for H8S targets.
20158
20159 @item -mno-exr
20160 @opindex mno-exr
20161 @opindex mexr
20162 Extended registers are not stored on stack before execution of function
20163 with monitor attribute. Default option is @option{-mno-exr}.
20164 This option is valid only for H8S targets.
20165
20166 @item -mint32
20167 @opindex mint32
20168 Make @code{int} data 32 bits by default.
20169
20170 @item -malign-300
20171 @opindex malign-300
20172 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20173 The default for the H8/300H and H8S is to align longs and floats on
20174 4-byte boundaries.
20175 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20176 This option has no effect on the H8/300.
20177 @end table
20178
20179 @node HPPA Options
20180 @subsection HPPA Options
20181 @cindex HPPA Options
20182
20183 These @samp{-m} options are defined for the HPPA family of computers:
20184
20185 @table @gcctabopt
20186 @item -march=@var{architecture-type}
20187 @opindex march
20188 Generate code for the specified architecture. The choices for
20189 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20190 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20191 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20192 architecture option for your machine. Code compiled for lower numbered
20193 architectures runs on higher numbered architectures, but not the
20194 other way around.
20195
20196 @item -mpa-risc-1-0
20197 @itemx -mpa-risc-1-1
20198 @itemx -mpa-risc-2-0
20199 @opindex mpa-risc-1-0
20200 @opindex mpa-risc-1-1
20201 @opindex mpa-risc-2-0
20202 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20203
20204 @item -mcaller-copies
20205 @opindex mcaller-copies
20206 The caller copies function arguments passed by hidden reference. This
20207 option should be used with care as it is not compatible with the default
20208 32-bit runtime. However, only aggregates larger than eight bytes are
20209 passed by hidden reference and the option provides better compatibility
20210 with OpenMP.
20211
20212 @item -mjump-in-delay
20213 @opindex mjump-in-delay
20214 This option is ignored and provided for compatibility purposes only.
20215
20216 @item -mdisable-fpregs
20217 @opindex mdisable-fpregs
20218 Prevent floating-point registers from being used in any manner. This is
20219 necessary for compiling kernels that perform lazy context switching of
20220 floating-point registers. If you use this option and attempt to perform
20221 floating-point operations, the compiler aborts.
20222
20223 @item -mdisable-indexing
20224 @opindex mdisable-indexing
20225 Prevent the compiler from using indexing address modes. This avoids some
20226 rather obscure problems when compiling MIG generated code under MACH@.
20227
20228 @item -mno-space-regs
20229 @opindex mno-space-regs
20230 @opindex mspace-regs
20231 Generate code that assumes the target has no space registers. This allows
20232 GCC to generate faster indirect calls and use unscaled index address modes.
20233
20234 Such code is suitable for level 0 PA systems and kernels.
20235
20236 @item -mfast-indirect-calls
20237 @opindex mfast-indirect-calls
20238 Generate code that assumes calls never cross space boundaries. This
20239 allows GCC to emit code that performs faster indirect calls.
20240
20241 This option does not work in the presence of shared libraries or nested
20242 functions.
20243
20244 @item -mfixed-range=@var{register-range}
20245 @opindex mfixed-range
20246 Generate code treating the given register range as fixed registers.
20247 A fixed register is one that the register allocator cannot use. This is
20248 useful when compiling kernel code. A register range is specified as
20249 two registers separated by a dash. Multiple register ranges can be
20250 specified separated by a comma.
20251
20252 @item -mlong-load-store
20253 @opindex mlong-load-store
20254 Generate 3-instruction load and store sequences as sometimes required by
20255 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20256 the HP compilers.
20257
20258 @item -mportable-runtime
20259 @opindex mportable-runtime
20260 Use the portable calling conventions proposed by HP for ELF systems.
20261
20262 @item -mgas
20263 @opindex mgas
20264 Enable the use of assembler directives only GAS understands.
20265
20266 @item -mschedule=@var{cpu-type}
20267 @opindex mschedule
20268 Schedule code according to the constraints for the machine type
20269 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20270 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20271 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20272 proper scheduling option for your machine. The default scheduling is
20273 @samp{8000}.
20274
20275 @item -mlinker-opt
20276 @opindex mlinker-opt
20277 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20278 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20279 linkers in which they give bogus error messages when linking some programs.
20280
20281 @item -msoft-float
20282 @opindex msoft-float
20283 Generate output containing library calls for floating point.
20284 @strong{Warning:} the requisite libraries are not available for all HPPA
20285 targets. Normally the facilities of the machine's usual C compiler are
20286 used, but this cannot be done directly in cross-compilation. You must make
20287 your own arrangements to provide suitable library functions for
20288 cross-compilation.
20289
20290 @option{-msoft-float} changes the calling convention in the output file;
20291 therefore, it is only useful if you compile @emph{all} of a program with
20292 this option. In particular, you need to compile @file{libgcc.a}, the
20293 library that comes with GCC, with @option{-msoft-float} in order for
20294 this to work.
20295
20296 @item -msio
20297 @opindex msio
20298 Generate the predefine, @code{_SIO}, for server IO@. The default is
20299 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20300 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20301 options are available under HP-UX and HI-UX@.
20302
20303 @item -mgnu-ld
20304 @opindex mgnu-ld
20305 Use options specific to GNU @command{ld}.
20306 This passes @option{-shared} to @command{ld} when
20307 building a shared library. It is the default when GCC is configured,
20308 explicitly or implicitly, with the GNU linker. This option does not
20309 affect which @command{ld} is called; it only changes what parameters
20310 are passed to that @command{ld}.
20311 The @command{ld} that is called is determined by the
20312 @option{--with-ld} configure option, GCC's program search path, and
20313 finally by the user's @env{PATH}. The linker used by GCC can be printed
20314 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20315 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20316
20317 @item -mhp-ld
20318 @opindex mhp-ld
20319 Use options specific to HP @command{ld}.
20320 This passes @option{-b} to @command{ld} when building
20321 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20322 links. It is the default when GCC is configured, explicitly or
20323 implicitly, with the HP linker. This option does not affect
20324 which @command{ld} is called; it only changes what parameters are passed to that
20325 @command{ld}.
20326 The @command{ld} that is called is determined by the @option{--with-ld}
20327 configure option, GCC's program search path, and finally by the user's
20328 @env{PATH}. The linker used by GCC can be printed using @samp{which
20329 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20330 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20331
20332 @item -mlong-calls
20333 @opindex mno-long-calls
20334 @opindex mlong-calls
20335 Generate code that uses long call sequences. This ensures that a call
20336 is always able to reach linker generated stubs. The default is to generate
20337 long calls only when the distance from the call site to the beginning
20338 of the function or translation unit, as the case may be, exceeds a
20339 predefined limit set by the branch type being used. The limits for
20340 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20341 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20342 240,000 bytes.
20343
20344 Distances are measured from the beginning of functions when using the
20345 @option{-ffunction-sections} option, or when using the @option{-mgas}
20346 and @option{-mno-portable-runtime} options together under HP-UX with
20347 the SOM linker.
20348
20349 It is normally not desirable to use this option as it degrades
20350 performance. However, it may be useful in large applications,
20351 particularly when partial linking is used to build the application.
20352
20353 The types of long calls used depends on the capabilities of the
20354 assembler and linker, and the type of code being generated. The
20355 impact on systems that support long absolute calls, and long pic
20356 symbol-difference or pc-relative calls should be relatively small.
20357 However, an indirect call is used on 32-bit ELF systems in pic code
20358 and it is quite long.
20359
20360 @item -munix=@var{unix-std}
20361 @opindex march
20362 Generate compiler predefines and select a startfile for the specified
20363 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20364 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20365 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20366 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20367 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20368 and later.
20369
20370 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20371 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20372 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20373 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20374 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20375 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20376
20377 It is @emph{important} to note that this option changes the interfaces
20378 for various library routines. It also affects the operational behavior
20379 of the C library. Thus, @emph{extreme} care is needed in using this
20380 option.
20381
20382 Library code that is intended to operate with more than one UNIX
20383 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20384 as appropriate. Most GNU software doesn't provide this capability.
20385
20386 @item -nolibdld
20387 @opindex nolibdld
20388 Suppress the generation of link options to search libdld.sl when the
20389 @option{-static} option is specified on HP-UX 10 and later.
20390
20391 @item -static
20392 @opindex static
20393 The HP-UX implementation of setlocale in libc has a dependency on
20394 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20395 when the @option{-static} option is specified, special link options
20396 are needed to resolve this dependency.
20397
20398 On HP-UX 10 and later, the GCC driver adds the necessary options to
20399 link with libdld.sl when the @option{-static} option is specified.
20400 This causes the resulting binary to be dynamic. On the 64-bit port,
20401 the linkers generate dynamic binaries by default in any case. The
20402 @option{-nolibdld} option can be used to prevent the GCC driver from
20403 adding these link options.
20404
20405 @item -threads
20406 @opindex threads
20407 Add support for multithreading with the @dfn{dce thread} library
20408 under HP-UX@. This option sets flags for both the preprocessor and
20409 linker.
20410 @end table
20411
20412 @node IA-64 Options
20413 @subsection IA-64 Options
20414 @cindex IA-64 Options
20415
20416 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20417
20418 @table @gcctabopt
20419 @item -mbig-endian
20420 @opindex mbig-endian
20421 Generate code for a big-endian target. This is the default for HP-UX@.
20422
20423 @item -mlittle-endian
20424 @opindex mlittle-endian
20425 Generate code for a little-endian target. This is the default for AIX5
20426 and GNU/Linux.
20427
20428 @item -mgnu-as
20429 @itemx -mno-gnu-as
20430 @opindex mgnu-as
20431 @opindex mno-gnu-as
20432 Generate (or don't) code for the GNU assembler. This is the default.
20433 @c Also, this is the default if the configure option @option{--with-gnu-as}
20434 @c is used.
20435
20436 @item -mgnu-ld
20437 @itemx -mno-gnu-ld
20438 @opindex mgnu-ld
20439 @opindex mno-gnu-ld
20440 Generate (or don't) code for the GNU linker. This is the default.
20441 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20442 @c is used.
20443
20444 @item -mno-pic
20445 @opindex mno-pic
20446 Generate code that does not use a global pointer register. The result
20447 is not position independent code, and violates the IA-64 ABI@.
20448
20449 @item -mvolatile-asm-stop
20450 @itemx -mno-volatile-asm-stop
20451 @opindex mvolatile-asm-stop
20452 @opindex mno-volatile-asm-stop
20453 Generate (or don't) a stop bit immediately before and after volatile asm
20454 statements.
20455
20456 @item -mregister-names
20457 @itemx -mno-register-names
20458 @opindex mregister-names
20459 @opindex mno-register-names
20460 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20461 the stacked registers. This may make assembler output more readable.
20462
20463 @item -mno-sdata
20464 @itemx -msdata
20465 @opindex mno-sdata
20466 @opindex msdata
20467 Disable (or enable) optimizations that use the small data section. This may
20468 be useful for working around optimizer bugs.
20469
20470 @item -mconstant-gp
20471 @opindex mconstant-gp
20472 Generate code that uses a single constant global pointer value. This is
20473 useful when compiling kernel code.
20474
20475 @item -mauto-pic
20476 @opindex mauto-pic
20477 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20478 This is useful when compiling firmware code.
20479
20480 @item -minline-float-divide-min-latency
20481 @opindex minline-float-divide-min-latency
20482 Generate code for inline divides of floating-point values
20483 using the minimum latency algorithm.
20484
20485 @item -minline-float-divide-max-throughput
20486 @opindex minline-float-divide-max-throughput
20487 Generate code for inline divides of floating-point values
20488 using the maximum throughput algorithm.
20489
20490 @item -mno-inline-float-divide
20491 @opindex mno-inline-float-divide
20492 Do not generate inline code for divides of floating-point values.
20493
20494 @item -minline-int-divide-min-latency
20495 @opindex minline-int-divide-min-latency
20496 Generate code for inline divides of integer values
20497 using the minimum latency algorithm.
20498
20499 @item -minline-int-divide-max-throughput
20500 @opindex minline-int-divide-max-throughput
20501 Generate code for inline divides of integer values
20502 using the maximum throughput algorithm.
20503
20504 @item -mno-inline-int-divide
20505 @opindex mno-inline-int-divide
20506 @opindex minline-int-divide
20507 Do not generate inline code for divides of integer values.
20508
20509 @item -minline-sqrt-min-latency
20510 @opindex minline-sqrt-min-latency
20511 Generate code for inline square roots
20512 using the minimum latency algorithm.
20513
20514 @item -minline-sqrt-max-throughput
20515 @opindex minline-sqrt-max-throughput
20516 Generate code for inline square roots
20517 using the maximum throughput algorithm.
20518
20519 @item -mno-inline-sqrt
20520 @opindex mno-inline-sqrt
20521 Do not generate inline code for @code{sqrt}.
20522
20523 @item -mfused-madd
20524 @itemx -mno-fused-madd
20525 @opindex mfused-madd
20526 @opindex mno-fused-madd
20527 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20528 instructions. The default is to use these instructions.
20529
20530 @item -mno-dwarf2-asm
20531 @itemx -mdwarf2-asm
20532 @opindex mno-dwarf2-asm
20533 @opindex mdwarf2-asm
20534 Don't (or do) generate assembler code for the DWARF line number debugging
20535 info. This may be useful when not using the GNU assembler.
20536
20537 @item -mearly-stop-bits
20538 @itemx -mno-early-stop-bits
20539 @opindex mearly-stop-bits
20540 @opindex mno-early-stop-bits
20541 Allow stop bits to be placed earlier than immediately preceding the
20542 instruction that triggered the stop bit. This can improve instruction
20543 scheduling, but does not always do so.
20544
20545 @item -mfixed-range=@var{register-range}
20546 @opindex mfixed-range
20547 Generate code treating the given register range as fixed registers.
20548 A fixed register is one that the register allocator cannot use. This is
20549 useful when compiling kernel code. A register range is specified as
20550 two registers separated by a dash. Multiple register ranges can be
20551 specified separated by a comma.
20552
20553 @item -mtls-size=@var{tls-size}
20554 @opindex mtls-size
20555 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20556 64.
20557
20558 @item -mtune=@var{cpu-type}
20559 @opindex mtune
20560 Tune the instruction scheduling for a particular CPU, Valid values are
20561 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20562 and @samp{mckinley}.
20563
20564 @item -milp32
20565 @itemx -mlp64
20566 @opindex milp32
20567 @opindex mlp64
20568 Generate code for a 32-bit or 64-bit environment.
20569 The 32-bit environment sets int, long and pointer to 32 bits.
20570 The 64-bit environment sets int to 32 bits and long and pointer
20571 to 64 bits. These are HP-UX specific flags.
20572
20573 @item -mno-sched-br-data-spec
20574 @itemx -msched-br-data-spec
20575 @opindex mno-sched-br-data-spec
20576 @opindex msched-br-data-spec
20577 (Dis/En)able data speculative scheduling before reload.
20578 This results in generation of @code{ld.a} instructions and
20579 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20580 The default setting is disabled.
20581
20582 @item -msched-ar-data-spec
20583 @itemx -mno-sched-ar-data-spec
20584 @opindex msched-ar-data-spec
20585 @opindex mno-sched-ar-data-spec
20586 (En/Dis)able data speculative scheduling after reload.
20587 This results in generation of @code{ld.a} instructions and
20588 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20589 The default setting is enabled.
20590
20591 @item -mno-sched-control-spec
20592 @itemx -msched-control-spec
20593 @opindex mno-sched-control-spec
20594 @opindex msched-control-spec
20595 (Dis/En)able control speculative scheduling. This feature is
20596 available only during region scheduling (i.e.@: before reload).
20597 This results in generation of the @code{ld.s} instructions and
20598 the corresponding check instructions @code{chk.s}.
20599 The default setting is disabled.
20600
20601 @item -msched-br-in-data-spec
20602 @itemx -mno-sched-br-in-data-spec
20603 @opindex msched-br-in-data-spec
20604 @opindex mno-sched-br-in-data-spec
20605 (En/Dis)able speculative scheduling of the instructions that
20606 are dependent on the data speculative loads before reload.
20607 This is effective only with @option{-msched-br-data-spec} enabled.
20608 The default setting is enabled.
20609
20610 @item -msched-ar-in-data-spec
20611 @itemx -mno-sched-ar-in-data-spec
20612 @opindex msched-ar-in-data-spec
20613 @opindex mno-sched-ar-in-data-spec
20614 (En/Dis)able speculative scheduling of the instructions that
20615 are dependent on the data speculative loads after reload.
20616 This is effective only with @option{-msched-ar-data-spec} enabled.
20617 The default setting is enabled.
20618
20619 @item -msched-in-control-spec
20620 @itemx -mno-sched-in-control-spec
20621 @opindex msched-in-control-spec
20622 @opindex mno-sched-in-control-spec
20623 (En/Dis)able speculative scheduling of the instructions that
20624 are dependent on the control speculative loads.
20625 This is effective only with @option{-msched-control-spec} enabled.
20626 The default setting is enabled.
20627
20628 @item -mno-sched-prefer-non-data-spec-insns
20629 @itemx -msched-prefer-non-data-spec-insns
20630 @opindex mno-sched-prefer-non-data-spec-insns
20631 @opindex msched-prefer-non-data-spec-insns
20632 If enabled, data-speculative instructions are chosen for schedule
20633 only if there are no other choices at the moment. This makes
20634 the use of the data speculation much more conservative.
20635 The default setting is disabled.
20636
20637 @item -mno-sched-prefer-non-control-spec-insns
20638 @itemx -msched-prefer-non-control-spec-insns
20639 @opindex mno-sched-prefer-non-control-spec-insns
20640 @opindex msched-prefer-non-control-spec-insns
20641 If enabled, control-speculative instructions are chosen for schedule
20642 only if there are no other choices at the moment. This makes
20643 the use of the control speculation much more conservative.
20644 The default setting is disabled.
20645
20646 @item -mno-sched-count-spec-in-critical-path
20647 @itemx -msched-count-spec-in-critical-path
20648 @opindex mno-sched-count-spec-in-critical-path
20649 @opindex msched-count-spec-in-critical-path
20650 If enabled, speculative dependencies are considered during
20651 computation of the instructions priorities. This makes the use of the
20652 speculation a bit more conservative.
20653 The default setting is disabled.
20654
20655 @item -msched-spec-ldc
20656 @opindex msched-spec-ldc
20657 Use a simple data speculation check. This option is on by default.
20658
20659 @item -msched-control-spec-ldc
20660 @opindex msched-spec-ldc
20661 Use a simple check for control speculation. This option is on by default.
20662
20663 @item -msched-stop-bits-after-every-cycle
20664 @opindex msched-stop-bits-after-every-cycle
20665 Place a stop bit after every cycle when scheduling. This option is on
20666 by default.
20667
20668 @item -msched-fp-mem-deps-zero-cost
20669 @opindex msched-fp-mem-deps-zero-cost
20670 Assume that floating-point stores and loads are not likely to cause a conflict
20671 when placed into the same instruction group. This option is disabled by
20672 default.
20673
20674 @item -msel-sched-dont-check-control-spec
20675 @opindex msel-sched-dont-check-control-spec
20676 Generate checks for control speculation in selective scheduling.
20677 This flag is disabled by default.
20678
20679 @item -msched-max-memory-insns=@var{max-insns}
20680 @opindex msched-max-memory-insns
20681 Limit on the number of memory insns per instruction group, giving lower
20682 priority to subsequent memory insns attempting to schedule in the same
20683 instruction group. Frequently useful to prevent cache bank conflicts.
20684 The default value is 1.
20685
20686 @item -msched-max-memory-insns-hard-limit
20687 @opindex msched-max-memory-insns-hard-limit
20688 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20689 disallowing more than that number in an instruction group.
20690 Otherwise, the limit is ``soft'', meaning that non-memory operations
20691 are preferred when the limit is reached, but memory operations may still
20692 be scheduled.
20693
20694 @end table
20695
20696 @node LM32 Options
20697 @subsection LM32 Options
20698 @cindex LM32 options
20699
20700 These @option{-m} options are defined for the LatticeMico32 architecture:
20701
20702 @table @gcctabopt
20703 @item -mbarrel-shift-enabled
20704 @opindex mbarrel-shift-enabled
20705 Enable barrel-shift instructions.
20706
20707 @item -mdivide-enabled
20708 @opindex mdivide-enabled
20709 Enable divide and modulus instructions.
20710
20711 @item -mmultiply-enabled
20712 @opindex multiply-enabled
20713 Enable multiply instructions.
20714
20715 @item -msign-extend-enabled
20716 @opindex msign-extend-enabled
20717 Enable sign extend instructions.
20718
20719 @item -muser-enabled
20720 @opindex muser-enabled
20721 Enable user-defined instructions.
20722
20723 @end table
20724
20725 @node M32C Options
20726 @subsection M32C Options
20727 @cindex M32C options
20728
20729 @table @gcctabopt
20730 @item -mcpu=@var{name}
20731 @opindex mcpu=
20732 Select the CPU for which code is generated. @var{name} may be one of
20733 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20734 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20735 the M32C/80 series.
20736
20737 @item -msim
20738 @opindex msim
20739 Specifies that the program will be run on the simulator. This causes
20740 an alternate runtime library to be linked in which supports, for
20741 example, file I/O@. You must not use this option when generating
20742 programs that will run on real hardware; you must provide your own
20743 runtime library for whatever I/O functions are needed.
20744
20745 @item -memregs=@var{number}
20746 @opindex memregs=
20747 Specifies the number of memory-based pseudo-registers GCC uses
20748 during code generation. These pseudo-registers are used like real
20749 registers, so there is a tradeoff between GCC's ability to fit the
20750 code into available registers, and the performance penalty of using
20751 memory instead of registers. Note that all modules in a program must
20752 be compiled with the same value for this option. Because of that, you
20753 must not use this option with GCC's default runtime libraries.
20754
20755 @end table
20756
20757 @node M32R/D Options
20758 @subsection M32R/D Options
20759 @cindex M32R/D options
20760
20761 These @option{-m} options are defined for Renesas M32R/D architectures:
20762
20763 @table @gcctabopt
20764 @item -m32r2
20765 @opindex m32r2
20766 Generate code for the M32R/2@.
20767
20768 @item -m32rx
20769 @opindex m32rx
20770 Generate code for the M32R/X@.
20771
20772 @item -m32r
20773 @opindex m32r
20774 Generate code for the M32R@. This is the default.
20775
20776 @item -mmodel=small
20777 @opindex mmodel=small
20778 Assume all objects live in the lower 16MB of memory (so that their addresses
20779 can be loaded with the @code{ld24} instruction), and assume all subroutines
20780 are reachable with the @code{bl} instruction.
20781 This is the default.
20782
20783 The addressability of a particular object can be set with the
20784 @code{model} attribute.
20785
20786 @item -mmodel=medium
20787 @opindex mmodel=medium
20788 Assume objects may be anywhere in the 32-bit address space (the compiler
20789 generates @code{seth/add3} instructions to load their addresses), and
20790 assume all subroutines are reachable with the @code{bl} instruction.
20791
20792 @item -mmodel=large
20793 @opindex mmodel=large
20794 Assume objects may be anywhere in the 32-bit address space (the compiler
20795 generates @code{seth/add3} instructions to load their addresses), and
20796 assume subroutines may not be reachable with the @code{bl} instruction
20797 (the compiler generates the much slower @code{seth/add3/jl}
20798 instruction sequence).
20799
20800 @item -msdata=none
20801 @opindex msdata=none
20802 Disable use of the small data area. Variables are put into
20803 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20804 @code{section} attribute has been specified).
20805 This is the default.
20806
20807 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20808 Objects may be explicitly put in the small data area with the
20809 @code{section} attribute using one of these sections.
20810
20811 @item -msdata=sdata
20812 @opindex msdata=sdata
20813 Put small global and static data in the small data area, but do not
20814 generate special code to reference them.
20815
20816 @item -msdata=use
20817 @opindex msdata=use
20818 Put small global and static data in the small data area, and generate
20819 special instructions to reference them.
20820
20821 @item -G @var{num}
20822 @opindex G
20823 @cindex smaller data references
20824 Put global and static objects less than or equal to @var{num} bytes
20825 into the small data or BSS sections instead of the normal data or BSS
20826 sections. The default value of @var{num} is 8.
20827 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20828 for this option to have any effect.
20829
20830 All modules should be compiled with the same @option{-G @var{num}} value.
20831 Compiling with different values of @var{num} may or may not work; if it
20832 doesn't the linker gives an error message---incorrect code is not
20833 generated.
20834
20835 @item -mdebug
20836 @opindex mdebug
20837 Makes the M32R-specific code in the compiler display some statistics
20838 that might help in debugging programs.
20839
20840 @item -malign-loops
20841 @opindex malign-loops
20842 Align all loops to a 32-byte boundary.
20843
20844 @item -mno-align-loops
20845 @opindex mno-align-loops
20846 Do not enforce a 32-byte alignment for loops. This is the default.
20847
20848 @item -missue-rate=@var{number}
20849 @opindex missue-rate=@var{number}
20850 Issue @var{number} instructions per cycle. @var{number} can only be 1
20851 or 2.
20852
20853 @item -mbranch-cost=@var{number}
20854 @opindex mbranch-cost=@var{number}
20855 @var{number} can only be 1 or 2. If it is 1 then branches are
20856 preferred over conditional code, if it is 2, then the opposite applies.
20857
20858 @item -mflush-trap=@var{number}
20859 @opindex mflush-trap=@var{number}
20860 Specifies the trap number to use to flush the cache. The default is
20861 12. Valid numbers are between 0 and 15 inclusive.
20862
20863 @item -mno-flush-trap
20864 @opindex mno-flush-trap
20865 Specifies that the cache cannot be flushed by using a trap.
20866
20867 @item -mflush-func=@var{name}
20868 @opindex mflush-func=@var{name}
20869 Specifies the name of the operating system function to call to flush
20870 the cache. The default is @samp{_flush_cache}, but a function call
20871 is only used if a trap is not available.
20872
20873 @item -mno-flush-func
20874 @opindex mno-flush-func
20875 Indicates that there is no OS function for flushing the cache.
20876
20877 @end table
20878
20879 @node M680x0 Options
20880 @subsection M680x0 Options
20881 @cindex M680x0 options
20882
20883 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20884 The default settings depend on which architecture was selected when
20885 the compiler was configured; the defaults for the most common choices
20886 are given below.
20887
20888 @table @gcctabopt
20889 @item -march=@var{arch}
20890 @opindex march
20891 Generate code for a specific M680x0 or ColdFire instruction set
20892 architecture. Permissible values of @var{arch} for M680x0
20893 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20894 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20895 architectures are selected according to Freescale's ISA classification
20896 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20897 @samp{isab} and @samp{isac}.
20898
20899 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20900 code for a ColdFire target. The @var{arch} in this macro is one of the
20901 @option{-march} arguments given above.
20902
20903 When used together, @option{-march} and @option{-mtune} select code
20904 that runs on a family of similar processors but that is optimized
20905 for a particular microarchitecture.
20906
20907 @item -mcpu=@var{cpu}
20908 @opindex mcpu
20909 Generate code for a specific M680x0 or ColdFire processor.
20910 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20911 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20912 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20913 below, which also classifies the CPUs into families:
20914
20915 @multitable @columnfractions 0.20 0.80
20916 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20917 @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}
20918 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20919 @item @samp{5206e} @tab @samp{5206e}
20920 @item @samp{5208} @tab @samp{5207} @samp{5208}
20921 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20922 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20923 @item @samp{5216} @tab @samp{5214} @samp{5216}
20924 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20925 @item @samp{5225} @tab @samp{5224} @samp{5225}
20926 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20927 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20928 @item @samp{5249} @tab @samp{5249}
20929 @item @samp{5250} @tab @samp{5250}
20930 @item @samp{5271} @tab @samp{5270} @samp{5271}
20931 @item @samp{5272} @tab @samp{5272}
20932 @item @samp{5275} @tab @samp{5274} @samp{5275}
20933 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20934 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20935 @item @samp{5307} @tab @samp{5307}
20936 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20937 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20938 @item @samp{5407} @tab @samp{5407}
20939 @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}
20940 @end multitable
20941
20942 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20943 @var{arch} is compatible with @var{cpu}. Other combinations of
20944 @option{-mcpu} and @option{-march} are rejected.
20945
20946 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20947 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20948 where the value of @var{family} is given by the table above.
20949
20950 @item -mtune=@var{tune}
20951 @opindex mtune
20952 Tune the code for a particular microarchitecture within the
20953 constraints set by @option{-march} and @option{-mcpu}.
20954 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20955 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20956 and @samp{cpu32}. The ColdFire microarchitectures
20957 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
20958
20959 You can also use @option{-mtune=68020-40} for code that needs
20960 to run relatively well on 68020, 68030 and 68040 targets.
20961 @option{-mtune=68020-60} is similar but includes 68060 targets
20962 as well. These two options select the same tuning decisions as
20963 @option{-m68020-40} and @option{-m68020-60} respectively.
20964
20965 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
20966 when tuning for 680x0 architecture @var{arch}. It also defines
20967 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
20968 option is used. If GCC is tuning for a range of architectures,
20969 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
20970 it defines the macros for every architecture in the range.
20971
20972 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
20973 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
20974 of the arguments given above.
20975
20976 @item -m68000
20977 @itemx -mc68000
20978 @opindex m68000
20979 @opindex mc68000
20980 Generate output for a 68000. This is the default
20981 when the compiler is configured for 68000-based systems.
20982 It is equivalent to @option{-march=68000}.
20983
20984 Use this option for microcontrollers with a 68000 or EC000 core,
20985 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20986
20987 @item -m68010
20988 @opindex m68010
20989 Generate output for a 68010. This is the default
20990 when the compiler is configured for 68010-based systems.
20991 It is equivalent to @option{-march=68010}.
20992
20993 @item -m68020
20994 @itemx -mc68020
20995 @opindex m68020
20996 @opindex mc68020
20997 Generate output for a 68020. This is the default
20998 when the compiler is configured for 68020-based systems.
20999 It is equivalent to @option{-march=68020}.
21000
21001 @item -m68030
21002 @opindex m68030
21003 Generate output for a 68030. This is the default when the compiler is
21004 configured for 68030-based systems. It is equivalent to
21005 @option{-march=68030}.
21006
21007 @item -m68040
21008 @opindex m68040
21009 Generate output for a 68040. This is the default when the compiler is
21010 configured for 68040-based systems. It is equivalent to
21011 @option{-march=68040}.
21012
21013 This option inhibits the use of 68881/68882 instructions that have to be
21014 emulated by software on the 68040. Use this option if your 68040 does not
21015 have code to emulate those instructions.
21016
21017 @item -m68060
21018 @opindex m68060
21019 Generate output for a 68060. This is the default when the compiler is
21020 configured for 68060-based systems. It is equivalent to
21021 @option{-march=68060}.
21022
21023 This option inhibits the use of 68020 and 68881/68882 instructions that
21024 have to be emulated by software on the 68060. Use this option if your 68060
21025 does not have code to emulate those instructions.
21026
21027 @item -mcpu32
21028 @opindex mcpu32
21029 Generate output for a CPU32. This is the default
21030 when the compiler is configured for CPU32-based systems.
21031 It is equivalent to @option{-march=cpu32}.
21032
21033 Use this option for microcontrollers with a
21034 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21035 68336, 68340, 68341, 68349 and 68360.
21036
21037 @item -m5200
21038 @opindex m5200
21039 Generate output for a 520X ColdFire CPU@. This is the default
21040 when the compiler is configured for 520X-based systems.
21041 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21042 in favor of that option.
21043
21044 Use this option for microcontroller with a 5200 core, including
21045 the MCF5202, MCF5203, MCF5204 and MCF5206.
21046
21047 @item -m5206e
21048 @opindex m5206e
21049 Generate output for a 5206e ColdFire CPU@. The option is now
21050 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21051
21052 @item -m528x
21053 @opindex m528x
21054 Generate output for a member of the ColdFire 528X family.
21055 The option is now deprecated in favor of the equivalent
21056 @option{-mcpu=528x}.
21057
21058 @item -m5307
21059 @opindex m5307
21060 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21061 in favor of the equivalent @option{-mcpu=5307}.
21062
21063 @item -m5407
21064 @opindex m5407
21065 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21066 in favor of the equivalent @option{-mcpu=5407}.
21067
21068 @item -mcfv4e
21069 @opindex mcfv4e
21070 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21071 This includes use of hardware floating-point instructions.
21072 The option is equivalent to @option{-mcpu=547x}, and is now
21073 deprecated in favor of that option.
21074
21075 @item -m68020-40
21076 @opindex m68020-40
21077 Generate output for a 68040, without using any of the new instructions.
21078 This results in code that can run relatively efficiently on either a
21079 68020/68881 or a 68030 or a 68040. The generated code does use the
21080 68881 instructions that are emulated on the 68040.
21081
21082 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21083
21084 @item -m68020-60
21085 @opindex m68020-60
21086 Generate output for a 68060, without using any of the new instructions.
21087 This results in code that can run relatively efficiently on either a
21088 68020/68881 or a 68030 or a 68040. The generated code does use the
21089 68881 instructions that are emulated on the 68060.
21090
21091 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21092
21093 @item -mhard-float
21094 @itemx -m68881
21095 @opindex mhard-float
21096 @opindex m68881
21097 Generate floating-point instructions. This is the default for 68020
21098 and above, and for ColdFire devices that have an FPU@. It defines the
21099 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21100 on ColdFire targets.
21101
21102 @item -msoft-float
21103 @opindex msoft-float
21104 Do not generate floating-point instructions; use library calls instead.
21105 This is the default for 68000, 68010, and 68832 targets. It is also
21106 the default for ColdFire devices that have no FPU.
21107
21108 @item -mdiv
21109 @itemx -mno-div
21110 @opindex mdiv
21111 @opindex mno-div
21112 Generate (do not generate) ColdFire hardware divide and remainder
21113 instructions. If @option{-march} is used without @option{-mcpu},
21114 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21115 architectures. Otherwise, the default is taken from the target CPU
21116 (either the default CPU, or the one specified by @option{-mcpu}). For
21117 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21118 @option{-mcpu=5206e}.
21119
21120 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21121
21122 @item -mshort
21123 @opindex mshort
21124 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21125 Additionally, parameters passed on the stack are also aligned to a
21126 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21127
21128 @item -mno-short
21129 @opindex mno-short
21130 Do not consider type @code{int} to be 16 bits wide. This is the default.
21131
21132 @item -mnobitfield
21133 @itemx -mno-bitfield
21134 @opindex mnobitfield
21135 @opindex mno-bitfield
21136 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21137 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21138
21139 @item -mbitfield
21140 @opindex mbitfield
21141 Do use the bit-field instructions. The @option{-m68020} option implies
21142 @option{-mbitfield}. This is the default if you use a configuration
21143 designed for a 68020.
21144
21145 @item -mrtd
21146 @opindex mrtd
21147 Use a different function-calling convention, in which functions
21148 that take a fixed number of arguments return with the @code{rtd}
21149 instruction, which pops their arguments while returning. This
21150 saves one instruction in the caller since there is no need to pop
21151 the arguments there.
21152
21153 This calling convention is incompatible with the one normally
21154 used on Unix, so you cannot use it if you need to call libraries
21155 compiled with the Unix compiler.
21156
21157 Also, you must provide function prototypes for all functions that
21158 take variable numbers of arguments (including @code{printf});
21159 otherwise incorrect code is generated for calls to those
21160 functions.
21161
21162 In addition, seriously incorrect code results if you call a
21163 function with too many arguments. (Normally, extra arguments are
21164 harmlessly ignored.)
21165
21166 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21167 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21168
21169 The default is @option{-mno-rtd}.
21170
21171 @item -malign-int
21172 @itemx -mno-align-int
21173 @opindex malign-int
21174 @opindex mno-align-int
21175 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21176 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21177 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21178 Aligning variables on 32-bit boundaries produces code that runs somewhat
21179 faster on processors with 32-bit busses at the expense of more memory.
21180
21181 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21182 aligns structures containing the above types differently than
21183 most published application binary interface specifications for the m68k.
21184
21185 @item -mpcrel
21186 @opindex mpcrel
21187 Use the pc-relative addressing mode of the 68000 directly, instead of
21188 using a global offset table. At present, this option implies @option{-fpic},
21189 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21190 not presently supported with @option{-mpcrel}, though this could be supported for
21191 68020 and higher processors.
21192
21193 @item -mno-strict-align
21194 @itemx -mstrict-align
21195 @opindex mno-strict-align
21196 @opindex mstrict-align
21197 Do not (do) assume that unaligned memory references are handled by
21198 the system.
21199
21200 @item -msep-data
21201 Generate code that allows the data segment to be located in a different
21202 area of memory from the text segment. This allows for execute-in-place in
21203 an environment without virtual memory management. This option implies
21204 @option{-fPIC}.
21205
21206 @item -mno-sep-data
21207 Generate code that assumes that the data segment follows the text segment.
21208 This is the default.
21209
21210 @item -mid-shared-library
21211 Generate code that supports shared libraries via the library ID method.
21212 This allows for execute-in-place and shared libraries in an environment
21213 without virtual memory management. This option implies @option{-fPIC}.
21214
21215 @item -mno-id-shared-library
21216 Generate code that doesn't assume ID-based shared libraries are being used.
21217 This is the default.
21218
21219 @item -mshared-library-id=n
21220 Specifies the identification number of the ID-based shared library being
21221 compiled. Specifying a value of 0 generates more compact code; specifying
21222 other values forces the allocation of that number to the current
21223 library, but is no more space- or time-efficient than omitting this option.
21224
21225 @item -mxgot
21226 @itemx -mno-xgot
21227 @opindex mxgot
21228 @opindex mno-xgot
21229 When generating position-independent code for ColdFire, generate code
21230 that works if the GOT has more than 8192 entries. This code is
21231 larger and slower than code generated without this option. On M680x0
21232 processors, this option is not needed; @option{-fPIC} suffices.
21233
21234 GCC normally uses a single instruction to load values from the GOT@.
21235 While this is relatively efficient, it only works if the GOT
21236 is smaller than about 64k. Anything larger causes the linker
21237 to report an error such as:
21238
21239 @cindex relocation truncated to fit (ColdFire)
21240 @smallexample
21241 relocation truncated to fit: R_68K_GOT16O foobar
21242 @end smallexample
21243
21244 If this happens, you should recompile your code with @option{-mxgot}.
21245 It should then work with very large GOTs. However, code generated with
21246 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21247 the value of a global symbol.
21248
21249 Note that some linkers, including newer versions of the GNU linker,
21250 can create multiple GOTs and sort GOT entries. If you have such a linker,
21251 you should only need to use @option{-mxgot} when compiling a single
21252 object file that accesses more than 8192 GOT entries. Very few do.
21253
21254 These options have no effect unless GCC is generating
21255 position-independent code.
21256
21257 @item -mlong-jump-table-offsets
21258 @opindex mlong-jump-table-offsets
21259 Use 32-bit offsets in @code{switch} tables. The default is to use
21260 16-bit offsets.
21261
21262 @end table
21263
21264 @node MCore Options
21265 @subsection MCore Options
21266 @cindex MCore options
21267
21268 These are the @samp{-m} options defined for the Motorola M*Core
21269 processors.
21270
21271 @table @gcctabopt
21272
21273 @item -mhardlit
21274 @itemx -mno-hardlit
21275 @opindex mhardlit
21276 @opindex mno-hardlit
21277 Inline constants into the code stream if it can be done in two
21278 instructions or less.
21279
21280 @item -mdiv
21281 @itemx -mno-div
21282 @opindex mdiv
21283 @opindex mno-div
21284 Use the divide instruction. (Enabled by default).
21285
21286 @item -mrelax-immediate
21287 @itemx -mno-relax-immediate
21288 @opindex mrelax-immediate
21289 @opindex mno-relax-immediate
21290 Allow arbitrary-sized immediates in bit operations.
21291
21292 @item -mwide-bitfields
21293 @itemx -mno-wide-bitfields
21294 @opindex mwide-bitfields
21295 @opindex mno-wide-bitfields
21296 Always treat bit-fields as @code{int}-sized.
21297
21298 @item -m4byte-functions
21299 @itemx -mno-4byte-functions
21300 @opindex m4byte-functions
21301 @opindex mno-4byte-functions
21302 Force all functions to be aligned to a 4-byte boundary.
21303
21304 @item -mcallgraph-data
21305 @itemx -mno-callgraph-data
21306 @opindex mcallgraph-data
21307 @opindex mno-callgraph-data
21308 Emit callgraph information.
21309
21310 @item -mslow-bytes
21311 @itemx -mno-slow-bytes
21312 @opindex mslow-bytes
21313 @opindex mno-slow-bytes
21314 Prefer word access when reading byte quantities.
21315
21316 @item -mlittle-endian
21317 @itemx -mbig-endian
21318 @opindex mlittle-endian
21319 @opindex mbig-endian
21320 Generate code for a little-endian target.
21321
21322 @item -m210
21323 @itemx -m340
21324 @opindex m210
21325 @opindex m340
21326 Generate code for the 210 processor.
21327
21328 @item -mno-lsim
21329 @opindex mno-lsim
21330 Assume that runtime support has been provided and so omit the
21331 simulator library (@file{libsim.a)} from the linker command line.
21332
21333 @item -mstack-increment=@var{size}
21334 @opindex mstack-increment
21335 Set the maximum amount for a single stack increment operation. Large
21336 values can increase the speed of programs that contain functions
21337 that need a large amount of stack space, but they can also trigger a
21338 segmentation fault if the stack is extended too much. The default
21339 value is 0x1000.
21340
21341 @end table
21342
21343 @node MeP Options
21344 @subsection MeP Options
21345 @cindex MeP options
21346
21347 @table @gcctabopt
21348
21349 @item -mabsdiff
21350 @opindex mabsdiff
21351 Enables the @code{abs} instruction, which is the absolute difference
21352 between two registers.
21353
21354 @item -mall-opts
21355 @opindex mall-opts
21356 Enables all the optional instructions---average, multiply, divide, bit
21357 operations, leading zero, absolute difference, min/max, clip, and
21358 saturation.
21359
21360
21361 @item -maverage
21362 @opindex maverage
21363 Enables the @code{ave} instruction, which computes the average of two
21364 registers.
21365
21366 @item -mbased=@var{n}
21367 @opindex mbased=
21368 Variables of size @var{n} bytes or smaller are placed in the
21369 @code{.based} section by default. Based variables use the @code{$tp}
21370 register as a base register, and there is a 128-byte limit to the
21371 @code{.based} section.
21372
21373 @item -mbitops
21374 @opindex mbitops
21375 Enables the bit operation instructions---bit test (@code{btstm}), set
21376 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21377 test-and-set (@code{tas}).
21378
21379 @item -mc=@var{name}
21380 @opindex mc=
21381 Selects which section constant data is placed in. @var{name} may
21382 be @samp{tiny}, @samp{near}, or @samp{far}.
21383
21384 @item -mclip
21385 @opindex mclip
21386 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21387 useful unless you also provide @option{-mminmax}.
21388
21389 @item -mconfig=@var{name}
21390 @opindex mconfig=
21391 Selects one of the built-in core configurations. Each MeP chip has
21392 one or more modules in it; each module has a core CPU and a variety of
21393 coprocessors, optional instructions, and peripherals. The
21394 @code{MeP-Integrator} tool, not part of GCC, provides these
21395 configurations through this option; using this option is the same as
21396 using all the corresponding command-line options. The default
21397 configuration is @samp{default}.
21398
21399 @item -mcop
21400 @opindex mcop
21401 Enables the coprocessor instructions. By default, this is a 32-bit
21402 coprocessor. Note that the coprocessor is normally enabled via the
21403 @option{-mconfig=} option.
21404
21405 @item -mcop32
21406 @opindex mcop32
21407 Enables the 32-bit coprocessor's instructions.
21408
21409 @item -mcop64
21410 @opindex mcop64
21411 Enables the 64-bit coprocessor's instructions.
21412
21413 @item -mivc2
21414 @opindex mivc2
21415 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21416
21417 @item -mdc
21418 @opindex mdc
21419 Causes constant variables to be placed in the @code{.near} section.
21420
21421 @item -mdiv
21422 @opindex mdiv
21423 Enables the @code{div} and @code{divu} instructions.
21424
21425 @item -meb
21426 @opindex meb
21427 Generate big-endian code.
21428
21429 @item -mel
21430 @opindex mel
21431 Generate little-endian code.
21432
21433 @item -mio-volatile
21434 @opindex mio-volatile
21435 Tells the compiler that any variable marked with the @code{io}
21436 attribute is to be considered volatile.
21437
21438 @item -ml
21439 @opindex ml
21440 Causes variables to be assigned to the @code{.far} section by default.
21441
21442 @item -mleadz
21443 @opindex mleadz
21444 Enables the @code{leadz} (leading zero) instruction.
21445
21446 @item -mm
21447 @opindex mm
21448 Causes variables to be assigned to the @code{.near} section by default.
21449
21450 @item -mminmax
21451 @opindex mminmax
21452 Enables the @code{min} and @code{max} instructions.
21453
21454 @item -mmult
21455 @opindex mmult
21456 Enables the multiplication and multiply-accumulate instructions.
21457
21458 @item -mno-opts
21459 @opindex mno-opts
21460 Disables all the optional instructions enabled by @option{-mall-opts}.
21461
21462 @item -mrepeat
21463 @opindex mrepeat
21464 Enables the @code{repeat} and @code{erepeat} instructions, used for
21465 low-overhead looping.
21466
21467 @item -ms
21468 @opindex ms
21469 Causes all variables to default to the @code{.tiny} section. Note
21470 that there is a 65536-byte limit to this section. Accesses to these
21471 variables use the @code{%gp} base register.
21472
21473 @item -msatur
21474 @opindex msatur
21475 Enables the saturation instructions. Note that the compiler does not
21476 currently generate these itself, but this option is included for
21477 compatibility with other tools, like @code{as}.
21478
21479 @item -msdram
21480 @opindex msdram
21481 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21482
21483 @item -msim
21484 @opindex msim
21485 Link the simulator run-time libraries.
21486
21487 @item -msimnovec
21488 @opindex msimnovec
21489 Link the simulator runtime libraries, excluding built-in support
21490 for reset and exception vectors and tables.
21491
21492 @item -mtf
21493 @opindex mtf
21494 Causes all functions to default to the @code{.far} section. Without
21495 this option, functions default to the @code{.near} section.
21496
21497 @item -mtiny=@var{n}
21498 @opindex mtiny=
21499 Variables that are @var{n} bytes or smaller are allocated to the
21500 @code{.tiny} section. These variables use the @code{$gp} base
21501 register. The default for this option is 4, but note that there's a
21502 65536-byte limit to the @code{.tiny} section.
21503
21504 @end table
21505
21506 @node MicroBlaze Options
21507 @subsection MicroBlaze Options
21508 @cindex MicroBlaze Options
21509
21510 @table @gcctabopt
21511
21512 @item -msoft-float
21513 @opindex msoft-float
21514 Use software emulation for floating point (default).
21515
21516 @item -mhard-float
21517 @opindex mhard-float
21518 Use hardware floating-point instructions.
21519
21520 @item -mmemcpy
21521 @opindex mmemcpy
21522 Do not optimize block moves, use @code{memcpy}.
21523
21524 @item -mno-clearbss
21525 @opindex mno-clearbss
21526 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21527
21528 @item -mcpu=@var{cpu-type}
21529 @opindex mcpu=
21530 Use features of, and schedule code for, the given CPU.
21531 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21532 where @var{X} is a major version, @var{YY} is the minor version, and
21533 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21534 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21535
21536 @item -mxl-soft-mul
21537 @opindex mxl-soft-mul
21538 Use software multiply emulation (default).
21539
21540 @item -mxl-soft-div
21541 @opindex mxl-soft-div
21542 Use software emulation for divides (default).
21543
21544 @item -mxl-barrel-shift
21545 @opindex mxl-barrel-shift
21546 Use the hardware barrel shifter.
21547
21548 @item -mxl-pattern-compare
21549 @opindex mxl-pattern-compare
21550 Use pattern compare instructions.
21551
21552 @item -msmall-divides
21553 @opindex msmall-divides
21554 Use table lookup optimization for small signed integer divisions.
21555
21556 @item -mxl-stack-check
21557 @opindex mxl-stack-check
21558 This option is deprecated. Use @option{-fstack-check} instead.
21559
21560 @item -mxl-gp-opt
21561 @opindex mxl-gp-opt
21562 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21563
21564 @item -mxl-multiply-high
21565 @opindex mxl-multiply-high
21566 Use multiply high instructions for high part of 32x32 multiply.
21567
21568 @item -mxl-float-convert
21569 @opindex mxl-float-convert
21570 Use hardware floating-point conversion instructions.
21571
21572 @item -mxl-float-sqrt
21573 @opindex mxl-float-sqrt
21574 Use hardware floating-point square root instruction.
21575
21576 @item -mbig-endian
21577 @opindex mbig-endian
21578 Generate code for a big-endian target.
21579
21580 @item -mlittle-endian
21581 @opindex mlittle-endian
21582 Generate code for a little-endian target.
21583
21584 @item -mxl-reorder
21585 @opindex mxl-reorder
21586 Use reorder instructions (swap and byte reversed load/store).
21587
21588 @item -mxl-mode-@var{app-model}
21589 Select application model @var{app-model}. Valid models are
21590 @table @samp
21591 @item executable
21592 normal executable (default), uses startup code @file{crt0.o}.
21593
21594 @item -mpic-data-is-text-relative
21595 @opindex mpic-data-is-text-relative
21596 Assume that the displacement between the text and data segments is fixed
21597 at static link time. This allows data to be referenced by offset from start of
21598 text address instead of GOT since PC-relative addressing is not supported.
21599
21600 @item xmdstub
21601 for use with Xilinx Microprocessor Debugger (XMD) based
21602 software intrusive debug agent called xmdstub. This uses startup file
21603 @file{crt1.o} and sets the start address of the program to 0x800.
21604
21605 @item bootstrap
21606 for applications that are loaded using a bootloader.
21607 This model uses startup file @file{crt2.o} which does not contain a processor
21608 reset vector handler. This is suitable for transferring control on a
21609 processor reset to the bootloader rather than the application.
21610
21611 @item novectors
21612 for applications that do not require any of the
21613 MicroBlaze vectors. This option may be useful for applications running
21614 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21615 @end table
21616
21617 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21618 @option{-mxl-mode-@var{app-model}}.
21619
21620 @end table
21621
21622 @node MIPS Options
21623 @subsection MIPS Options
21624 @cindex MIPS options
21625
21626 @table @gcctabopt
21627
21628 @item -EB
21629 @opindex EB
21630 Generate big-endian code.
21631
21632 @item -EL
21633 @opindex EL
21634 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21635 configurations.
21636
21637 @item -march=@var{arch}
21638 @opindex march
21639 Generate code that runs on @var{arch}, which can be the name of a
21640 generic MIPS ISA, or the name of a particular processor.
21641 The ISA names are:
21642 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21643 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21644 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21645 @samp{mips64r5} and @samp{mips64r6}.
21646 The processor names are:
21647 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21648 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21649 @samp{5kc}, @samp{5kf},
21650 @samp{20kc},
21651 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21652 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21653 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21654 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21655 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21656 @samp{i6400}, @samp{i6500},
21657 @samp{interaptiv},
21658 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21659 @samp{gs464e}, @samp{gs264e},
21660 @samp{m4k},
21661 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21662 @samp{m5100}, @samp{m5101},
21663 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21664 @samp{orion},
21665 @samp{p5600}, @samp{p6600},
21666 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21667 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21668 @samp{r6000}, @samp{r8000},
21669 @samp{rm7000}, @samp{rm9000},
21670 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21671 @samp{sb1},
21672 @samp{sr71000},
21673 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21674 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21675 @samp{xlr} and @samp{xlp}.
21676 The special value @samp{from-abi} selects the
21677 most compatible architecture for the selected ABI (that is,
21678 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21679
21680 The native Linux/GNU toolchain also supports the value @samp{native},
21681 which selects the best architecture option for the host processor.
21682 @option{-march=native} has no effect if GCC does not recognize
21683 the processor.
21684
21685 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21686 (for example, @option{-march=r2k}). Prefixes are optional, and
21687 @samp{vr} may be written @samp{r}.
21688
21689 Names of the form @samp{@var{n}f2_1} refer to processors with
21690 FPUs clocked at half the rate of the core, names of the form
21691 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21692 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21693 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21694 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21695 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21696 accepted as synonyms for @samp{@var{n}f1_1}.
21697
21698 GCC defines two macros based on the value of this option. The first
21699 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21700 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21701 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21702 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21703 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21704
21705 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21706 above. In other words, it has the full prefix and does not
21707 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21708 the macro names the resolved architecture (either @code{"mips1"} or
21709 @code{"mips3"}). It names the default architecture when no
21710 @option{-march} option is given.
21711
21712 @item -mtune=@var{arch}
21713 @opindex mtune
21714 Optimize for @var{arch}. Among other things, this option controls
21715 the way instructions are scheduled, and the perceived cost of arithmetic
21716 operations. The list of @var{arch} values is the same as for
21717 @option{-march}.
21718
21719 When this option is not used, GCC optimizes for the processor
21720 specified by @option{-march}. By using @option{-march} and
21721 @option{-mtune} together, it is possible to generate code that
21722 runs on a family of processors, but optimize the code for one
21723 particular member of that family.
21724
21725 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21726 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21727 @option{-march} ones described above.
21728
21729 @item -mips1
21730 @opindex mips1
21731 Equivalent to @option{-march=mips1}.
21732
21733 @item -mips2
21734 @opindex mips2
21735 Equivalent to @option{-march=mips2}.
21736
21737 @item -mips3
21738 @opindex mips3
21739 Equivalent to @option{-march=mips3}.
21740
21741 @item -mips4
21742 @opindex mips4
21743 Equivalent to @option{-march=mips4}.
21744
21745 @item -mips32
21746 @opindex mips32
21747 Equivalent to @option{-march=mips32}.
21748
21749 @item -mips32r3
21750 @opindex mips32r3
21751 Equivalent to @option{-march=mips32r3}.
21752
21753 @item -mips32r5
21754 @opindex mips32r5
21755 Equivalent to @option{-march=mips32r5}.
21756
21757 @item -mips32r6
21758 @opindex mips32r6
21759 Equivalent to @option{-march=mips32r6}.
21760
21761 @item -mips64
21762 @opindex mips64
21763 Equivalent to @option{-march=mips64}.
21764
21765 @item -mips64r2
21766 @opindex mips64r2
21767 Equivalent to @option{-march=mips64r2}.
21768
21769 @item -mips64r3
21770 @opindex mips64r3
21771 Equivalent to @option{-march=mips64r3}.
21772
21773 @item -mips64r5
21774 @opindex mips64r5
21775 Equivalent to @option{-march=mips64r5}.
21776
21777 @item -mips64r6
21778 @opindex mips64r6
21779 Equivalent to @option{-march=mips64r6}.
21780
21781 @item -mips16
21782 @itemx -mno-mips16
21783 @opindex mips16
21784 @opindex mno-mips16
21785 Generate (do not generate) MIPS16 code. If GCC is targeting a
21786 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21787
21788 MIPS16 code generation can also be controlled on a per-function basis
21789 by means of @code{mips16} and @code{nomips16} attributes.
21790 @xref{Function Attributes}, for more information.
21791
21792 @item -mflip-mips16
21793 @opindex mflip-mips16
21794 Generate MIPS16 code on alternating functions. This option is provided
21795 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21796 not intended for ordinary use in compiling user code.
21797
21798 @item -minterlink-compressed
21799 @itemx -mno-interlink-compressed
21800 @opindex minterlink-compressed
21801 @opindex mno-interlink-compressed
21802 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21803 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21804
21805 For example, code using the standard ISA encoding cannot jump directly
21806 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21807 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21808 knows that the target of the jump is not compressed.
21809
21810 @item -minterlink-mips16
21811 @itemx -mno-interlink-mips16
21812 @opindex minterlink-mips16
21813 @opindex mno-interlink-mips16
21814 Aliases of @option{-minterlink-compressed} and
21815 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21816 and are retained for backwards compatibility.
21817
21818 @item -mabi=32
21819 @itemx -mabi=o64
21820 @itemx -mabi=n32
21821 @itemx -mabi=64
21822 @itemx -mabi=eabi
21823 @opindex mabi=32
21824 @opindex mabi=o64
21825 @opindex mabi=n32
21826 @opindex mabi=64
21827 @opindex mabi=eabi
21828 Generate code for the given ABI@.
21829
21830 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21831 generates 64-bit code when you select a 64-bit architecture, but you
21832 can use @option{-mgp32} to get 32-bit code instead.
21833
21834 For information about the O64 ABI, see
21835 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21836
21837 GCC supports a variant of the o32 ABI in which floating-point registers
21838 are 64 rather than 32 bits wide. You can select this combination with
21839 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21840 and @code{mfhc1} instructions and is therefore only supported for
21841 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21842
21843 The register assignments for arguments and return values remain the
21844 same, but each scalar value is passed in a single 64-bit register
21845 rather than a pair of 32-bit registers. For example, scalar
21846 floating-point values are returned in @samp{$f0} only, not a
21847 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21848 remains the same in that the even-numbered double-precision registers
21849 are saved.
21850
21851 Two additional variants of the o32 ABI are supported to enable
21852 a transition from 32-bit to 64-bit registers. These are FPXX
21853 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21854 The FPXX extension mandates that all code must execute correctly
21855 when run using 32-bit or 64-bit registers. The code can be interlinked
21856 with either FP32 or FP64, but not both.
21857 The FP64A extension is similar to the FP64 extension but forbids the
21858 use of odd-numbered single-precision registers. This can be used
21859 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21860 processors and allows both FP32 and FP64A code to interlink and
21861 run in the same process without changing FPU modes.
21862
21863 @item -mabicalls
21864 @itemx -mno-abicalls
21865 @opindex mabicalls
21866 @opindex mno-abicalls
21867 Generate (do not generate) code that is suitable for SVR4-style
21868 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21869 systems.
21870
21871 @item -mshared
21872 @itemx -mno-shared
21873 Generate (do not generate) code that is fully position-independent,
21874 and that can therefore be linked into shared libraries. This option
21875 only affects @option{-mabicalls}.
21876
21877 All @option{-mabicalls} code has traditionally been position-independent,
21878 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21879 as an extension, the GNU toolchain allows executables to use absolute
21880 accesses for locally-binding symbols. It can also use shorter GP
21881 initialization sequences and generate direct calls to locally-defined
21882 functions. This mode is selected by @option{-mno-shared}.
21883
21884 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21885 objects that can only be linked by the GNU linker. However, the option
21886 does not affect the ABI of the final executable; it only affects the ABI
21887 of relocatable objects. Using @option{-mno-shared} generally makes
21888 executables both smaller and quicker.
21889
21890 @option{-mshared} is the default.
21891
21892 @item -mplt
21893 @itemx -mno-plt
21894 @opindex mplt
21895 @opindex mno-plt
21896 Assume (do not assume) that the static and dynamic linkers
21897 support PLTs and copy relocations. This option only affects
21898 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21899 has no effect without @option{-msym32}.
21900
21901 You can make @option{-mplt} the default by configuring
21902 GCC with @option{--with-mips-plt}. The default is
21903 @option{-mno-plt} otherwise.
21904
21905 @item -mxgot
21906 @itemx -mno-xgot
21907 @opindex mxgot
21908 @opindex mno-xgot
21909 Lift (do not lift) the usual restrictions on the size of the global
21910 offset table.
21911
21912 GCC normally uses a single instruction to load values from the GOT@.
21913 While this is relatively efficient, it only works if the GOT
21914 is smaller than about 64k. Anything larger causes the linker
21915 to report an error such as:
21916
21917 @cindex relocation truncated to fit (MIPS)
21918 @smallexample
21919 relocation truncated to fit: R_MIPS_GOT16 foobar
21920 @end smallexample
21921
21922 If this happens, you should recompile your code with @option{-mxgot}.
21923 This works with very large GOTs, although the code is also
21924 less efficient, since it takes three instructions to fetch the
21925 value of a global symbol.
21926
21927 Note that some linkers can create multiple GOTs. If you have such a
21928 linker, you should only need to use @option{-mxgot} when a single object
21929 file accesses more than 64k's worth of GOT entries. Very few do.
21930
21931 These options have no effect unless GCC is generating position
21932 independent code.
21933
21934 @item -mgp32
21935 @opindex mgp32
21936 Assume that general-purpose registers are 32 bits wide.
21937
21938 @item -mgp64
21939 @opindex mgp64
21940 Assume that general-purpose registers are 64 bits wide.
21941
21942 @item -mfp32
21943 @opindex mfp32
21944 Assume that floating-point registers are 32 bits wide.
21945
21946 @item -mfp64
21947 @opindex mfp64
21948 Assume that floating-point registers are 64 bits wide.
21949
21950 @item -mfpxx
21951 @opindex mfpxx
21952 Do not assume the width of floating-point registers.
21953
21954 @item -mhard-float
21955 @opindex mhard-float
21956 Use floating-point coprocessor instructions.
21957
21958 @item -msoft-float
21959 @opindex msoft-float
21960 Do not use floating-point coprocessor instructions. Implement
21961 floating-point calculations using library calls instead.
21962
21963 @item -mno-float
21964 @opindex mno-float
21965 Equivalent to @option{-msoft-float}, but additionally asserts that the
21966 program being compiled does not perform any floating-point operations.
21967 This option is presently supported only by some bare-metal MIPS
21968 configurations, where it may select a special set of libraries
21969 that lack all floating-point support (including, for example, the
21970 floating-point @code{printf} formats).
21971 If code compiled with @option{-mno-float} accidentally contains
21972 floating-point operations, it is likely to suffer a link-time
21973 or run-time failure.
21974
21975 @item -msingle-float
21976 @opindex msingle-float
21977 Assume that the floating-point coprocessor only supports single-precision
21978 operations.
21979
21980 @item -mdouble-float
21981 @opindex mdouble-float
21982 Assume that the floating-point coprocessor supports double-precision
21983 operations. This is the default.
21984
21985 @item -modd-spreg
21986 @itemx -mno-odd-spreg
21987 @opindex modd-spreg
21988 @opindex mno-odd-spreg
21989 Enable the use of odd-numbered single-precision floating-point registers
21990 for the o32 ABI. This is the default for processors that are known to
21991 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
21992 is set by default.
21993
21994 @item -mabs=2008
21995 @itemx -mabs=legacy
21996 @opindex mabs=2008
21997 @opindex mabs=legacy
21998 These options control the treatment of the special not-a-number (NaN)
21999 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22000 @code{neg.@i{fmt}} machine instructions.
22001
22002 By default or when @option{-mabs=legacy} is used the legacy
22003 treatment is selected. In this case these instructions are considered
22004 arithmetic and avoided where correct operation is required and the
22005 input operand might be a NaN. A longer sequence of instructions that
22006 manipulate the sign bit of floating-point datum manually is used
22007 instead unless the @option{-ffinite-math-only} option has also been
22008 specified.
22009
22010 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
22011 this case these instructions are considered non-arithmetic and therefore
22012 operating correctly in all cases, including in particular where the
22013 input operand is a NaN. These instructions are therefore always used
22014 for the respective operations.
22015
22016 @item -mnan=2008
22017 @itemx -mnan=legacy
22018 @opindex mnan=2008
22019 @opindex mnan=legacy
22020 These options control the encoding of the special not-a-number (NaN)
22021 IEEE 754 floating-point data.
22022
22023 The @option{-mnan=legacy} option selects the legacy encoding. In this
22024 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22025 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22026 by the first bit of their trailing significand field being 1.
22027
22028 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
22029 this case qNaNs are denoted by the first bit of their trailing
22030 significand field being 1, whereas sNaNs are denoted by the first bit of
22031 their trailing significand field being 0.
22032
22033 The default is @option{-mnan=legacy} unless GCC has been configured with
22034 @option{--with-nan=2008}.
22035
22036 @item -mllsc
22037 @itemx -mno-llsc
22038 @opindex mllsc
22039 @opindex mno-llsc
22040 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22041 implement atomic memory built-in functions. When neither option is
22042 specified, GCC uses the instructions if the target architecture
22043 supports them.
22044
22045 @option{-mllsc} is useful if the runtime environment can emulate the
22046 instructions and @option{-mno-llsc} can be useful when compiling for
22047 nonstandard ISAs. You can make either option the default by
22048 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22049 respectively. @option{--with-llsc} is the default for some
22050 configurations; see the installation documentation for details.
22051
22052 @item -mdsp
22053 @itemx -mno-dsp
22054 @opindex mdsp
22055 @opindex mno-dsp
22056 Use (do not use) revision 1 of the MIPS DSP ASE@.
22057 @xref{MIPS DSP Built-in Functions}. This option defines the
22058 preprocessor macro @code{__mips_dsp}. It also defines
22059 @code{__mips_dsp_rev} to 1.
22060
22061 @item -mdspr2
22062 @itemx -mno-dspr2
22063 @opindex mdspr2
22064 @opindex mno-dspr2
22065 Use (do not use) revision 2 of the MIPS DSP ASE@.
22066 @xref{MIPS DSP Built-in Functions}. This option defines the
22067 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22068 It also defines @code{__mips_dsp_rev} to 2.
22069
22070 @item -msmartmips
22071 @itemx -mno-smartmips
22072 @opindex msmartmips
22073 @opindex mno-smartmips
22074 Use (do not use) the MIPS SmartMIPS ASE.
22075
22076 @item -mpaired-single
22077 @itemx -mno-paired-single
22078 @opindex mpaired-single
22079 @opindex mno-paired-single
22080 Use (do not use) paired-single floating-point instructions.
22081 @xref{MIPS Paired-Single Support}. This option requires
22082 hardware floating-point support to be enabled.
22083
22084 @item -mdmx
22085 @itemx -mno-mdmx
22086 @opindex mdmx
22087 @opindex mno-mdmx
22088 Use (do not use) MIPS Digital Media Extension instructions.
22089 This option can only be used when generating 64-bit code and requires
22090 hardware floating-point support to be enabled.
22091
22092 @item -mips3d
22093 @itemx -mno-mips3d
22094 @opindex mips3d
22095 @opindex mno-mips3d
22096 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22097 The option @option{-mips3d} implies @option{-mpaired-single}.
22098
22099 @item -mmicromips
22100 @itemx -mno-micromips
22101 @opindex mmicromips
22102 @opindex mno-mmicromips
22103 Generate (do not generate) microMIPS code.
22104
22105 MicroMIPS code generation can also be controlled on a per-function basis
22106 by means of @code{micromips} and @code{nomicromips} attributes.
22107 @xref{Function Attributes}, for more information.
22108
22109 @item -mmt
22110 @itemx -mno-mt
22111 @opindex mmt
22112 @opindex mno-mt
22113 Use (do not use) MT Multithreading instructions.
22114
22115 @item -mmcu
22116 @itemx -mno-mcu
22117 @opindex mmcu
22118 @opindex mno-mcu
22119 Use (do not use) the MIPS MCU ASE instructions.
22120
22121 @item -meva
22122 @itemx -mno-eva
22123 @opindex meva
22124 @opindex mno-eva
22125 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22126
22127 @item -mvirt
22128 @itemx -mno-virt
22129 @opindex mvirt
22130 @opindex mno-virt
22131 Use (do not use) the MIPS Virtualization (VZ) instructions.
22132
22133 @item -mxpa
22134 @itemx -mno-xpa
22135 @opindex mxpa
22136 @opindex mno-xpa
22137 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22138
22139 @item -mcrc
22140 @itemx -mno-crc
22141 @opindex mcrc
22142 @opindex mno-crc
22143 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22144
22145 @item -mginv
22146 @itemx -mno-ginv
22147 @opindex mginv
22148 @opindex mno-ginv
22149 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22150
22151 @item -mloongson-mmi
22152 @itemx -mno-loongson-mmi
22153 @opindex mloongson-mmi
22154 @opindex mno-loongson-mmi
22155 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22156
22157 @item -mloongson-ext
22158 @itemx -mno-loongson-ext
22159 @opindex mloongson-ext
22160 @opindex mno-loongson-ext
22161 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22162
22163 @item -mloongson-ext2
22164 @itemx -mno-loongson-ext2
22165 @opindex mloongson-ext2
22166 @opindex mno-loongson-ext2
22167 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22168
22169 @item -mlong64
22170 @opindex mlong64
22171 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22172 an explanation of the default and the way that the pointer size is
22173 determined.
22174
22175 @item -mlong32
22176 @opindex mlong32
22177 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22178
22179 The default size of @code{int}s, @code{long}s and pointers depends on
22180 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22181 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22182 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22183 or the same size as integer registers, whichever is smaller.
22184
22185 @item -msym32
22186 @itemx -mno-sym32
22187 @opindex msym32
22188 @opindex mno-sym32
22189 Assume (do not assume) that all symbols have 32-bit values, regardless
22190 of the selected ABI@. This option is useful in combination with
22191 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22192 to generate shorter and faster references to symbolic addresses.
22193
22194 @item -G @var{num}
22195 @opindex G
22196 Put definitions of externally-visible data in a small data section
22197 if that data is no bigger than @var{num} bytes. GCC can then generate
22198 more efficient accesses to the data; see @option{-mgpopt} for details.
22199
22200 The default @option{-G} option depends on the configuration.
22201
22202 @item -mlocal-sdata
22203 @itemx -mno-local-sdata
22204 @opindex mlocal-sdata
22205 @opindex mno-local-sdata
22206 Extend (do not extend) the @option{-G} behavior to local data too,
22207 such as to static variables in C@. @option{-mlocal-sdata} is the
22208 default for all configurations.
22209
22210 If the linker complains that an application is using too much small data,
22211 you might want to try rebuilding the less performance-critical parts with
22212 @option{-mno-local-sdata}. You might also want to build large
22213 libraries with @option{-mno-local-sdata}, so that the libraries leave
22214 more room for the main program.
22215
22216 @item -mextern-sdata
22217 @itemx -mno-extern-sdata
22218 @opindex mextern-sdata
22219 @opindex mno-extern-sdata
22220 Assume (do not assume) that externally-defined data is in
22221 a small data section if the size of that data is within the @option{-G} limit.
22222 @option{-mextern-sdata} is the default for all configurations.
22223
22224 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22225 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22226 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22227 is placed in a small data section. If @var{Var} is defined by another
22228 module, you must either compile that module with a high-enough
22229 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22230 definition. If @var{Var} is common, you must link the application
22231 with a high-enough @option{-G} setting.
22232
22233 The easiest way of satisfying these restrictions is to compile
22234 and link every module with the same @option{-G} option. However,
22235 you may wish to build a library that supports several different
22236 small data limits. You can do this by compiling the library with
22237 the highest supported @option{-G} setting and additionally using
22238 @option{-mno-extern-sdata} to stop the library from making assumptions
22239 about externally-defined data.
22240
22241 @item -mgpopt
22242 @itemx -mno-gpopt
22243 @opindex mgpopt
22244 @opindex mno-gpopt
22245 Use (do not use) GP-relative accesses for symbols that are known to be
22246 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22247 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22248 configurations.
22249
22250 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22251 might not hold the value of @code{_gp}. For example, if the code is
22252 part of a library that might be used in a boot monitor, programs that
22253 call boot monitor routines pass an unknown value in @code{$gp}.
22254 (In such situations, the boot monitor itself is usually compiled
22255 with @option{-G0}.)
22256
22257 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22258 @option{-mno-extern-sdata}.
22259
22260 @item -membedded-data
22261 @itemx -mno-embedded-data
22262 @opindex membedded-data
22263 @opindex mno-embedded-data
22264 Allocate variables to the read-only data section first if possible, then
22265 next in the small data section if possible, otherwise in data. This gives
22266 slightly slower code than the default, but reduces the amount of RAM required
22267 when executing, and thus may be preferred for some embedded systems.
22268
22269 @item -muninit-const-in-rodata
22270 @itemx -mno-uninit-const-in-rodata
22271 @opindex muninit-const-in-rodata
22272 @opindex mno-uninit-const-in-rodata
22273 Put uninitialized @code{const} variables in the read-only data section.
22274 This option is only meaningful in conjunction with @option{-membedded-data}.
22275
22276 @item -mcode-readable=@var{setting}
22277 @opindex mcode-readable
22278 Specify whether GCC may generate code that reads from executable sections.
22279 There are three possible settings:
22280
22281 @table @gcctabopt
22282 @item -mcode-readable=yes
22283 Instructions may freely access executable sections. This is the
22284 default setting.
22285
22286 @item -mcode-readable=pcrel
22287 MIPS16 PC-relative load instructions can access executable sections,
22288 but other instructions must not do so. This option is useful on 4KSc
22289 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22290 It is also useful on processors that can be configured to have a dual
22291 instruction/data SRAM interface and that, like the M4K, automatically
22292 redirect PC-relative loads to the instruction RAM.
22293
22294 @item -mcode-readable=no
22295 Instructions must not access executable sections. This option can be
22296 useful on targets that are configured to have a dual instruction/data
22297 SRAM interface but that (unlike the M4K) do not automatically redirect
22298 PC-relative loads to the instruction RAM.
22299 @end table
22300
22301 @item -msplit-addresses
22302 @itemx -mno-split-addresses
22303 @opindex msplit-addresses
22304 @opindex mno-split-addresses
22305 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22306 relocation operators. This option has been superseded by
22307 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22308
22309 @item -mexplicit-relocs
22310 @itemx -mno-explicit-relocs
22311 @opindex mexplicit-relocs
22312 @opindex mno-explicit-relocs
22313 Use (do not use) assembler relocation operators when dealing with symbolic
22314 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22315 is to use assembler macros instead.
22316
22317 @option{-mexplicit-relocs} is the default if GCC was configured
22318 to use an assembler that supports relocation operators.
22319
22320 @item -mcheck-zero-division
22321 @itemx -mno-check-zero-division
22322 @opindex mcheck-zero-division
22323 @opindex mno-check-zero-division
22324 Trap (do not trap) on integer division by zero.
22325
22326 The default is @option{-mcheck-zero-division}.
22327
22328 @item -mdivide-traps
22329 @itemx -mdivide-breaks
22330 @opindex mdivide-traps
22331 @opindex mdivide-breaks
22332 MIPS systems check for division by zero by generating either a
22333 conditional trap or a break instruction. Using traps results in
22334 smaller code, but is only supported on MIPS II and later. Also, some
22335 versions of the Linux kernel have a bug that prevents trap from
22336 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22337 allow conditional traps on architectures that support them and
22338 @option{-mdivide-breaks} to force the use of breaks.
22339
22340 The default is usually @option{-mdivide-traps}, but this can be
22341 overridden at configure time using @option{--with-divide=breaks}.
22342 Divide-by-zero checks can be completely disabled using
22343 @option{-mno-check-zero-division}.
22344
22345 @item -mload-store-pairs
22346 @itemx -mno-load-store-pairs
22347 @opindex mload-store-pairs
22348 @opindex mno-load-store-pairs
22349 Enable (disable) an optimization that pairs consecutive load or store
22350 instructions to enable load/store bonding. This option is enabled by
22351 default but only takes effect when the selected architecture is known
22352 to support bonding.
22353
22354 @item -mmemcpy
22355 @itemx -mno-memcpy
22356 @opindex mmemcpy
22357 @opindex mno-memcpy
22358 Force (do not force) the use of @code{memcpy} for non-trivial block
22359 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22360 most constant-sized copies.
22361
22362 @item -mlong-calls
22363 @itemx -mno-long-calls
22364 @opindex mlong-calls
22365 @opindex mno-long-calls
22366 Disable (do not disable) use of the @code{jal} instruction. Calling
22367 functions using @code{jal} is more efficient but requires the caller
22368 and callee to be in the same 256 megabyte segment.
22369
22370 This option has no effect on abicalls code. The default is
22371 @option{-mno-long-calls}.
22372
22373 @item -mmad
22374 @itemx -mno-mad
22375 @opindex mmad
22376 @opindex mno-mad
22377 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22378 instructions, as provided by the R4650 ISA@.
22379
22380 @item -mimadd
22381 @itemx -mno-imadd
22382 @opindex mimadd
22383 @opindex mno-imadd
22384 Enable (disable) use of the @code{madd} and @code{msub} integer
22385 instructions. The default is @option{-mimadd} on architectures
22386 that support @code{madd} and @code{msub} except for the 74k
22387 architecture where it was found to generate slower code.
22388
22389 @item -mfused-madd
22390 @itemx -mno-fused-madd
22391 @opindex mfused-madd
22392 @opindex mno-fused-madd
22393 Enable (disable) use of the floating-point multiply-accumulate
22394 instructions, when they are available. The default is
22395 @option{-mfused-madd}.
22396
22397 On the R8000 CPU when multiply-accumulate instructions are used,
22398 the intermediate product is calculated to infinite precision
22399 and is not subject to the FCSR Flush to Zero bit. This may be
22400 undesirable in some circumstances. On other processors the result
22401 is numerically identical to the equivalent computation using
22402 separate multiply, add, subtract and negate instructions.
22403
22404 @item -nocpp
22405 @opindex nocpp
22406 Tell the MIPS assembler to not run its preprocessor over user
22407 assembler files (with a @samp{.s} suffix) when assembling them.
22408
22409 @item -mfix-24k
22410 @itemx -mno-fix-24k
22411 @opindex mfix-24k
22412 @opindex mno-fix-24k
22413 Work around the 24K E48 (lost data on stores during refill) errata.
22414 The workarounds are implemented by the assembler rather than by GCC@.
22415
22416 @item -mfix-r4000
22417 @itemx -mno-fix-r4000
22418 @opindex mfix-r4000
22419 @opindex mno-fix-r4000
22420 Work around certain R4000 CPU errata:
22421 @itemize @minus
22422 @item
22423 A double-word or a variable shift may give an incorrect result if executed
22424 immediately after starting an integer division.
22425 @item
22426 A double-word or a variable shift may give an incorrect result if executed
22427 while an integer multiplication is in progress.
22428 @item
22429 An integer division may give an incorrect result if started in a delay slot
22430 of a taken branch or a jump.
22431 @end itemize
22432
22433 @item -mfix-r4400
22434 @itemx -mno-fix-r4400
22435 @opindex mfix-r4400
22436 @opindex mno-fix-r4400
22437 Work around certain R4400 CPU errata:
22438 @itemize @minus
22439 @item
22440 A double-word or a variable shift may give an incorrect result if executed
22441 immediately after starting an integer division.
22442 @end itemize
22443
22444 @item -mfix-r10000
22445 @itemx -mno-fix-r10000
22446 @opindex mfix-r10000
22447 @opindex mno-fix-r10000
22448 Work around certain R10000 errata:
22449 @itemize @minus
22450 @item
22451 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22452 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22453 @end itemize
22454
22455 This option can only be used if the target architecture supports
22456 branch-likely instructions. @option{-mfix-r10000} is the default when
22457 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22458 otherwise.
22459
22460 @item -mfix-r5900
22461 @itemx -mno-fix-r5900
22462 @opindex mfix-r5900
22463 Do not attempt to schedule the preceding instruction into the delay slot
22464 of a branch instruction placed at the end of a short loop of six
22465 instructions or fewer and always schedule a @code{nop} instruction there
22466 instead. The short loop bug under certain conditions causes loops to
22467 execute only once or twice, due to a hardware bug in the R5900 chip. The
22468 workaround is implemented by the assembler rather than by GCC@.
22469
22470 @item -mfix-rm7000
22471 @itemx -mno-fix-rm7000
22472 @opindex mfix-rm7000
22473 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22474 workarounds are implemented by the assembler rather than by GCC@.
22475
22476 @item -mfix-vr4120
22477 @itemx -mno-fix-vr4120
22478 @opindex mfix-vr4120
22479 Work around certain VR4120 errata:
22480 @itemize @minus
22481 @item
22482 @code{dmultu} does not always produce the correct result.
22483 @item
22484 @code{div} and @code{ddiv} do not always produce the correct result if one
22485 of the operands is negative.
22486 @end itemize
22487 The workarounds for the division errata rely on special functions in
22488 @file{libgcc.a}. At present, these functions are only provided by
22489 the @code{mips64vr*-elf} configurations.
22490
22491 Other VR4120 errata require a NOP to be inserted between certain pairs of
22492 instructions. These errata are handled by the assembler, not by GCC itself.
22493
22494 @item -mfix-vr4130
22495 @opindex mfix-vr4130
22496 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22497 workarounds are implemented by the assembler rather than by GCC,
22498 although GCC avoids using @code{mflo} and @code{mfhi} if the
22499 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22500 instructions are available instead.
22501
22502 @item -mfix-sb1
22503 @itemx -mno-fix-sb1
22504 @opindex mfix-sb1
22505 Work around certain SB-1 CPU core errata.
22506 (This flag currently works around the SB-1 revision 2
22507 ``F1'' and ``F2'' floating-point errata.)
22508
22509 @item -mr10k-cache-barrier=@var{setting}
22510 @opindex mr10k-cache-barrier
22511 Specify whether GCC should insert cache barriers to avoid the
22512 side effects of speculation on R10K processors.
22513
22514 In common with many processors, the R10K tries to predict the outcome
22515 of a conditional branch and speculatively executes instructions from
22516 the ``taken'' branch. It later aborts these instructions if the
22517 predicted outcome is wrong. However, on the R10K, even aborted
22518 instructions can have side effects.
22519
22520 This problem only affects kernel stores and, depending on the system,
22521 kernel loads. As an example, a speculatively-executed store may load
22522 the target memory into cache and mark the cache line as dirty, even if
22523 the store itself is later aborted. If a DMA operation writes to the
22524 same area of memory before the ``dirty'' line is flushed, the cached
22525 data overwrites the DMA-ed data. See the R10K processor manual
22526 for a full description, including other potential problems.
22527
22528 One workaround is to insert cache barrier instructions before every memory
22529 access that might be speculatively executed and that might have side
22530 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22531 controls GCC's implementation of this workaround. It assumes that
22532 aborted accesses to any byte in the following regions does not have
22533 side effects:
22534
22535 @enumerate
22536 @item
22537 the memory occupied by the current function's stack frame;
22538
22539 @item
22540 the memory occupied by an incoming stack argument;
22541
22542 @item
22543 the memory occupied by an object with a link-time-constant address.
22544 @end enumerate
22545
22546 It is the kernel's responsibility to ensure that speculative
22547 accesses to these regions are indeed safe.
22548
22549 If the input program contains a function declaration such as:
22550
22551 @smallexample
22552 void foo (void);
22553 @end smallexample
22554
22555 then the implementation of @code{foo} must allow @code{j foo} and
22556 @code{jal foo} to be executed speculatively. GCC honors this
22557 restriction for functions it compiles itself. It expects non-GCC
22558 functions (such as hand-written assembly code) to do the same.
22559
22560 The option has three forms:
22561
22562 @table @gcctabopt
22563 @item -mr10k-cache-barrier=load-store
22564 Insert a cache barrier before a load or store that might be
22565 speculatively executed and that might have side effects even
22566 if aborted.
22567
22568 @item -mr10k-cache-barrier=store
22569 Insert a cache barrier before a store that might be speculatively
22570 executed and that might have side effects even if aborted.
22571
22572 @item -mr10k-cache-barrier=none
22573 Disable the insertion of cache barriers. This is the default setting.
22574 @end table
22575
22576 @item -mflush-func=@var{func}
22577 @itemx -mno-flush-func
22578 @opindex mflush-func
22579 Specifies the function to call to flush the I and D caches, or to not
22580 call any such function. If called, the function must take the same
22581 arguments as the common @code{_flush_func}, that is, the address of the
22582 memory range for which the cache is being flushed, the size of the
22583 memory range, and the number 3 (to flush both caches). The default
22584 depends on the target GCC was configured for, but commonly is either
22585 @code{_flush_func} or @code{__cpu_flush}.
22586
22587 @item mbranch-cost=@var{num}
22588 @opindex mbranch-cost
22589 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22590 This cost is only a heuristic and is not guaranteed to produce
22591 consistent results across releases. A zero cost redundantly selects
22592 the default, which is based on the @option{-mtune} setting.
22593
22594 @item -mbranch-likely
22595 @itemx -mno-branch-likely
22596 @opindex mbranch-likely
22597 @opindex mno-branch-likely
22598 Enable or disable use of Branch Likely instructions, regardless of the
22599 default for the selected architecture. By default, Branch Likely
22600 instructions may be generated if they are supported by the selected
22601 architecture. An exception is for the MIPS32 and MIPS64 architectures
22602 and processors that implement those architectures; for those, Branch
22603 Likely instructions are not be generated by default because the MIPS32
22604 and MIPS64 architectures specifically deprecate their use.
22605
22606 @item -mcompact-branches=never
22607 @itemx -mcompact-branches=optimal
22608 @itemx -mcompact-branches=always
22609 @opindex mcompact-branches=never
22610 @opindex mcompact-branches=optimal
22611 @opindex mcompact-branches=always
22612 These options control which form of branches will be generated. The
22613 default is @option{-mcompact-branches=optimal}.
22614
22615 The @option{-mcompact-branches=never} option ensures that compact branch
22616 instructions will never be generated.
22617
22618 The @option{-mcompact-branches=always} option ensures that a compact
22619 branch instruction will be generated if available. If a compact branch
22620 instruction is not available, a delay slot form of the branch will be
22621 used instead.
22622
22623 This option is supported from MIPS Release 6 onwards.
22624
22625 The @option{-mcompact-branches=optimal} option will cause a delay slot
22626 branch to be used if one is available in the current ISA and the delay
22627 slot is successfully filled. If the delay slot is not filled, a compact
22628 branch will be chosen if one is available.
22629
22630 @item -mfp-exceptions
22631 @itemx -mno-fp-exceptions
22632 @opindex mfp-exceptions
22633 Specifies whether FP exceptions are enabled. This affects how
22634 FP instructions are scheduled for some processors.
22635 The default is that FP exceptions are
22636 enabled.
22637
22638 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22639 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22640 FP pipe.
22641
22642 @item -mvr4130-align
22643 @itemx -mno-vr4130-align
22644 @opindex mvr4130-align
22645 The VR4130 pipeline is two-way superscalar, but can only issue two
22646 instructions together if the first one is 8-byte aligned. When this
22647 option is enabled, GCC aligns pairs of instructions that it
22648 thinks should execute in parallel.
22649
22650 This option only has an effect when optimizing for the VR4130.
22651 It normally makes code faster, but at the expense of making it bigger.
22652 It is enabled by default at optimization level @option{-O3}.
22653
22654 @item -msynci
22655 @itemx -mno-synci
22656 @opindex msynci
22657 Enable (disable) generation of @code{synci} instructions on
22658 architectures that support it. The @code{synci} instructions (if
22659 enabled) are generated when @code{__builtin___clear_cache} is
22660 compiled.
22661
22662 This option defaults to @option{-mno-synci}, but the default can be
22663 overridden by configuring GCC with @option{--with-synci}.
22664
22665 When compiling code for single processor systems, it is generally safe
22666 to use @code{synci}. However, on many multi-core (SMP) systems, it
22667 does not invalidate the instruction caches on all cores and may lead
22668 to undefined behavior.
22669
22670 @item -mrelax-pic-calls
22671 @itemx -mno-relax-pic-calls
22672 @opindex mrelax-pic-calls
22673 Try to turn PIC calls that are normally dispatched via register
22674 @code{$25} into direct calls. This is only possible if the linker can
22675 resolve the destination at link time and if the destination is within
22676 range for a direct call.
22677
22678 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22679 an assembler and a linker that support the @code{.reloc} assembly
22680 directive and @option{-mexplicit-relocs} is in effect. With
22681 @option{-mno-explicit-relocs}, this optimization can be performed by the
22682 assembler and the linker alone without help from the compiler.
22683
22684 @item -mmcount-ra-address
22685 @itemx -mno-mcount-ra-address
22686 @opindex mmcount-ra-address
22687 @opindex mno-mcount-ra-address
22688 Emit (do not emit) code that allows @code{_mcount} to modify the
22689 calling function's return address. When enabled, this option extends
22690 the usual @code{_mcount} interface with a new @var{ra-address}
22691 parameter, which has type @code{intptr_t *} and is passed in register
22692 @code{$12}. @code{_mcount} can then modify the return address by
22693 doing both of the following:
22694 @itemize
22695 @item
22696 Returning the new address in register @code{$31}.
22697 @item
22698 Storing the new address in @code{*@var{ra-address}},
22699 if @var{ra-address} is nonnull.
22700 @end itemize
22701
22702 The default is @option{-mno-mcount-ra-address}.
22703
22704 @item -mframe-header-opt
22705 @itemx -mno-frame-header-opt
22706 @opindex mframe-header-opt
22707 Enable (disable) frame header optimization in the o32 ABI. When using the
22708 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22709 function to write out register arguments. When enabled, this optimization
22710 will suppress the allocation of the frame header if it can be determined that
22711 it is unused.
22712
22713 This optimization is off by default at all optimization levels.
22714
22715 @item -mlxc1-sxc1
22716 @itemx -mno-lxc1-sxc1
22717 @opindex mlxc1-sxc1
22718 When applicable, enable (disable) the generation of @code{lwxc1},
22719 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22720
22721 @item -mmadd4
22722 @itemx -mno-madd4
22723 @opindex mmadd4
22724 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22725 @code{madd.d} and related instructions. Enabled by default.
22726
22727 @end table
22728
22729 @node MMIX Options
22730 @subsection MMIX Options
22731 @cindex MMIX Options
22732
22733 These options are defined for the MMIX:
22734
22735 @table @gcctabopt
22736 @item -mlibfuncs
22737 @itemx -mno-libfuncs
22738 @opindex mlibfuncs
22739 @opindex mno-libfuncs
22740 Specify that intrinsic library functions are being compiled, passing all
22741 values in registers, no matter the size.
22742
22743 @item -mepsilon
22744 @itemx -mno-epsilon
22745 @opindex mepsilon
22746 @opindex mno-epsilon
22747 Generate floating-point comparison instructions that compare with respect
22748 to the @code{rE} epsilon register.
22749
22750 @item -mabi=mmixware
22751 @itemx -mabi=gnu
22752 @opindex mabi=mmixware
22753 @opindex mabi=gnu
22754 Generate code that passes function parameters and return values that (in
22755 the called function) are seen as registers @code{$0} and up, as opposed to
22756 the GNU ABI which uses global registers @code{$231} and up.
22757
22758 @item -mzero-extend
22759 @itemx -mno-zero-extend
22760 @opindex mzero-extend
22761 @opindex mno-zero-extend
22762 When reading data from memory in sizes shorter than 64 bits, use (do not
22763 use) zero-extending load instructions by default, rather than
22764 sign-extending ones.
22765
22766 @item -mknuthdiv
22767 @itemx -mno-knuthdiv
22768 @opindex mknuthdiv
22769 @opindex mno-knuthdiv
22770 Make the result of a division yielding a remainder have the same sign as
22771 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22772 remainder follows the sign of the dividend. Both methods are
22773 arithmetically valid, the latter being almost exclusively used.
22774
22775 @item -mtoplevel-symbols
22776 @itemx -mno-toplevel-symbols
22777 @opindex mtoplevel-symbols
22778 @opindex mno-toplevel-symbols
22779 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22780 code can be used with the @code{PREFIX} assembly directive.
22781
22782 @item -melf
22783 @opindex melf
22784 Generate an executable in the ELF format, rather than the default
22785 @samp{mmo} format used by the @command{mmix} simulator.
22786
22787 @item -mbranch-predict
22788 @itemx -mno-branch-predict
22789 @opindex mbranch-predict
22790 @opindex mno-branch-predict
22791 Use (do not use) the probable-branch instructions, when static branch
22792 prediction indicates a probable branch.
22793
22794 @item -mbase-addresses
22795 @itemx -mno-base-addresses
22796 @opindex mbase-addresses
22797 @opindex mno-base-addresses
22798 Generate (do not generate) code that uses @emph{base addresses}. Using a
22799 base address automatically generates a request (handled by the assembler
22800 and the linker) for a constant to be set up in a global register. The
22801 register is used for one or more base address requests within the range 0
22802 to 255 from the value held in the register. The generally leads to short
22803 and fast code, but the number of different data items that can be
22804 addressed is limited. This means that a program that uses lots of static
22805 data may require @option{-mno-base-addresses}.
22806
22807 @item -msingle-exit
22808 @itemx -mno-single-exit
22809 @opindex msingle-exit
22810 @opindex mno-single-exit
22811 Force (do not force) generated code to have a single exit point in each
22812 function.
22813 @end table
22814
22815 @node MN10300 Options
22816 @subsection MN10300 Options
22817 @cindex MN10300 options
22818
22819 These @option{-m} options are defined for Matsushita MN10300 architectures:
22820
22821 @table @gcctabopt
22822 @item -mmult-bug
22823 @opindex mmult-bug
22824 Generate code to avoid bugs in the multiply instructions for the MN10300
22825 processors. This is the default.
22826
22827 @item -mno-mult-bug
22828 @opindex mno-mult-bug
22829 Do not generate code to avoid bugs in the multiply instructions for the
22830 MN10300 processors.
22831
22832 @item -mam33
22833 @opindex mam33
22834 Generate code using features specific to the AM33 processor.
22835
22836 @item -mno-am33
22837 @opindex mno-am33
22838 Do not generate code using features specific to the AM33 processor. This
22839 is the default.
22840
22841 @item -mam33-2
22842 @opindex mam33-2
22843 Generate code using features specific to the AM33/2.0 processor.
22844
22845 @item -mam34
22846 @opindex mam34
22847 Generate code using features specific to the AM34 processor.
22848
22849 @item -mtune=@var{cpu-type}
22850 @opindex mtune
22851 Use the timing characteristics of the indicated CPU type when
22852 scheduling instructions. This does not change the targeted processor
22853 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22854 @samp{am33-2} or @samp{am34}.
22855
22856 @item -mreturn-pointer-on-d0
22857 @opindex mreturn-pointer-on-d0
22858 When generating a function that returns a pointer, return the pointer
22859 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22860 only in @code{a0}, and attempts to call such functions without a prototype
22861 result in errors. Note that this option is on by default; use
22862 @option{-mno-return-pointer-on-d0} to disable it.
22863
22864 @item -mno-crt0
22865 @opindex mno-crt0
22866 Do not link in the C run-time initialization object file.
22867
22868 @item -mrelax
22869 @opindex mrelax
22870 Indicate to the linker that it should perform a relaxation optimization pass
22871 to shorten branches, calls and absolute memory addresses. This option only
22872 has an effect when used on the command line for the final link step.
22873
22874 This option makes symbolic debugging impossible.
22875
22876 @item -mliw
22877 @opindex mliw
22878 Allow the compiler to generate @emph{Long Instruction Word}
22879 instructions if the target is the @samp{AM33} or later. This is the
22880 default. This option defines the preprocessor macro @code{__LIW__}.
22881
22882 @item -mno-liw
22883 @opindex mno-liw
22884 Do not allow the compiler to generate @emph{Long Instruction Word}
22885 instructions. This option defines the preprocessor macro
22886 @code{__NO_LIW__}.
22887
22888 @item -msetlb
22889 @opindex msetlb
22890 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22891 instructions if the target is the @samp{AM33} or later. This is the
22892 default. This option defines the preprocessor macro @code{__SETLB__}.
22893
22894 @item -mno-setlb
22895 @opindex mno-setlb
22896 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22897 instructions. This option defines the preprocessor macro
22898 @code{__NO_SETLB__}.
22899
22900 @end table
22901
22902 @node Moxie Options
22903 @subsection Moxie Options
22904 @cindex Moxie Options
22905
22906 @table @gcctabopt
22907
22908 @item -meb
22909 @opindex meb
22910 Generate big-endian code. This is the default for @samp{moxie-*-*}
22911 configurations.
22912
22913 @item -mel
22914 @opindex mel
22915 Generate little-endian code.
22916
22917 @item -mmul.x
22918 @opindex mmul.x
22919 Generate mul.x and umul.x instructions. This is the default for
22920 @samp{moxiebox-*-*} configurations.
22921
22922 @item -mno-crt0
22923 @opindex mno-crt0
22924 Do not link in the C run-time initialization object file.
22925
22926 @end table
22927
22928 @node MSP430 Options
22929 @subsection MSP430 Options
22930 @cindex MSP430 Options
22931
22932 These options are defined for the MSP430:
22933
22934 @table @gcctabopt
22935
22936 @item -masm-hex
22937 @opindex masm-hex
22938 Force assembly output to always use hex constants. Normally such
22939 constants are signed decimals, but this option is available for
22940 testsuite and/or aesthetic purposes.
22941
22942 @item -mmcu=
22943 @opindex mmcu=
22944 Select the MCU to target. This is used to create a C preprocessor
22945 symbol based upon the MCU name, converted to upper case and pre- and
22946 post-fixed with @samp{__}. This in turn is used by the
22947 @file{msp430.h} header file to select an MCU-specific supplementary
22948 header file.
22949
22950 The option also sets the ISA to use. If the MCU name is one that is
22951 known to only support the 430 ISA then that is selected, otherwise the
22952 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22953 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22954 name selects the 430X ISA.
22955
22956 In addition an MCU-specific linker script is added to the linker
22957 command line. The script's name is the name of the MCU with
22958 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
22959 command line defines the C preprocessor symbol @code{__XXX__} and
22960 cause the linker to search for a script called @file{xxx.ld}.
22961
22962 This option is also passed on to the assembler.
22963
22964 @item -mwarn-mcu
22965 @itemx -mno-warn-mcu
22966 @opindex mwarn-mcu
22967 @opindex mno-warn-mcu
22968 This option enables or disables warnings about conflicts between the
22969 MCU name specified by the @option{-mmcu} option and the ISA set by the
22970 @option{-mcpu} option and/or the hardware multiply support set by the
22971 @option{-mhwmult} option. It also toggles warnings about unrecognized
22972 MCU names. This option is on by default.
22973
22974 @item -mcpu=
22975 @opindex mcpu=
22976 Specifies the ISA to use. Accepted values are @samp{msp430},
22977 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
22978 @option{-mmcu=} option should be used to select the ISA.
22979
22980 @item -msim
22981 @opindex msim
22982 Link to the simulator runtime libraries and linker script. Overrides
22983 any scripts that would be selected by the @option{-mmcu=} option.
22984
22985 @item -mlarge
22986 @opindex mlarge
22987 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
22988
22989 @item -msmall
22990 @opindex msmall
22991 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
22992
22993 @item -mrelax
22994 @opindex mrelax
22995 This option is passed to the assembler and linker, and allows the
22996 linker to perform certain optimizations that cannot be done until
22997 the final link.
22998
22999 @item mhwmult=
23000 @opindex mhwmult=
23001 Describes the type of hardware multiply supported by the target.
23002 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23003 for the original 16-bit-only multiply supported by early MCUs.
23004 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23005 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23006 A value of @samp{auto} can also be given. This tells GCC to deduce
23007 the hardware multiply support based upon the MCU name provided by the
23008 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
23009 the MCU name is not recognized then no hardware multiply support is
23010 assumed. @code{auto} is the default setting.
23011
23012 Hardware multiplies are normally performed by calling a library
23013 routine. This saves space in the generated code. When compiling at
23014 @option{-O3} or higher however the hardware multiplier is invoked
23015 inline. This makes for bigger, but faster code.
23016
23017 The hardware multiply routines disable interrupts whilst running and
23018 restore the previous interrupt state when they finish. This makes
23019 them safe to use inside interrupt handlers as well as in normal code.
23020
23021 @item -minrt
23022 @opindex minrt
23023 Enable the use of a minimum runtime environment - no static
23024 initializers or constructors. This is intended for memory-constrained
23025 devices. The compiler includes special symbols in some objects
23026 that tell the linker and runtime which code fragments are required.
23027
23028 @item -mcode-region=
23029 @itemx -mdata-region=
23030 @opindex mcode-region
23031 @opindex mdata-region
23032 These options tell the compiler where to place functions and data that
23033 do not have one of the @code{lower}, @code{upper}, @code{either} or
23034 @code{section} attributes. Possible values are @code{lower},
23035 @code{upper}, @code{either} or @code{any}. The first three behave
23036 like the corresponding attribute. The fourth possible value -
23037 @code{any} - is the default. It leaves placement entirely up to the
23038 linker script and how it assigns the standard sections
23039 (@code{.text}, @code{.data}, etc) to the memory regions.
23040
23041 @item -msilicon-errata=
23042 @opindex msilicon-errata
23043 This option passes on a request to assembler to enable the fixes for
23044 the named silicon errata.
23045
23046 @item -msilicon-errata-warn=
23047 @opindex msilicon-errata-warn
23048 This option passes on a request to the assembler to enable warning
23049 messages when a silicon errata might need to be applied.
23050
23051 @end table
23052
23053 @node NDS32 Options
23054 @subsection NDS32 Options
23055 @cindex NDS32 Options
23056
23057 These options are defined for NDS32 implementations:
23058
23059 @table @gcctabopt
23060
23061 @item -mbig-endian
23062 @opindex mbig-endian
23063 Generate code in big-endian mode.
23064
23065 @item -mlittle-endian
23066 @opindex mlittle-endian
23067 Generate code in little-endian mode.
23068
23069 @item -mreduced-regs
23070 @opindex mreduced-regs
23071 Use reduced-set registers for register allocation.
23072
23073 @item -mfull-regs
23074 @opindex mfull-regs
23075 Use full-set registers for register allocation.
23076
23077 @item -mcmov
23078 @opindex mcmov
23079 Generate conditional move instructions.
23080
23081 @item -mno-cmov
23082 @opindex mno-cmov
23083 Do not generate conditional move instructions.
23084
23085 @item -mext-perf
23086 @opindex mext-perf
23087 Generate performance extension instructions.
23088
23089 @item -mno-ext-perf
23090 @opindex mno-ext-perf
23091 Do not generate performance extension instructions.
23092
23093 @item -mext-perf2
23094 @opindex mext-perf2
23095 Generate performance extension 2 instructions.
23096
23097 @item -mno-ext-perf2
23098 @opindex mno-ext-perf2
23099 Do not generate performance extension 2 instructions.
23100
23101 @item -mext-string
23102 @opindex mext-string
23103 Generate string extension instructions.
23104
23105 @item -mno-ext-string
23106 @opindex mno-ext-string
23107 Do not generate string extension instructions.
23108
23109 @item -mv3push
23110 @opindex mv3push
23111 Generate v3 push25/pop25 instructions.
23112
23113 @item -mno-v3push
23114 @opindex mno-v3push
23115 Do not generate v3 push25/pop25 instructions.
23116
23117 @item -m16-bit
23118 @opindex m16-bit
23119 Generate 16-bit instructions.
23120
23121 @item -mno-16-bit
23122 @opindex mno-16-bit
23123 Do not generate 16-bit instructions.
23124
23125 @item -misr-vector-size=@var{num}
23126 @opindex misr-vector-size
23127 Specify the size of each interrupt vector, which must be 4 or 16.
23128
23129 @item -mcache-block-size=@var{num}
23130 @opindex mcache-block-size
23131 Specify the size of each cache block,
23132 which must be a power of 2 between 4 and 512.
23133
23134 @item -march=@var{arch}
23135 @opindex march
23136 Specify the name of the target architecture.
23137
23138 @item -mcmodel=@var{code-model}
23139 @opindex mcmodel
23140 Set the code model to one of
23141 @table @asis
23142 @item @samp{small}
23143 All the data and read-only data segments must be within 512KB addressing space.
23144 The text segment must be within 16MB addressing space.
23145 @item @samp{medium}
23146 The data segment must be within 512KB while the read-only data segment can be
23147 within 4GB addressing space. The text segment should be still within 16MB
23148 addressing space.
23149 @item @samp{large}
23150 All the text and data segments can be within 4GB addressing space.
23151 @end table
23152
23153 @item -mctor-dtor
23154 @opindex mctor-dtor
23155 Enable constructor/destructor feature.
23156
23157 @item -mrelax
23158 @opindex mrelax
23159 Guide linker to relax instructions.
23160
23161 @end table
23162
23163 @node Nios II Options
23164 @subsection Nios II Options
23165 @cindex Nios II options
23166 @cindex Altera Nios II options
23167
23168 These are the options defined for the Altera Nios II processor.
23169
23170 @table @gcctabopt
23171
23172 @item -G @var{num}
23173 @opindex G
23174 @cindex smaller data references
23175 Put global and static objects less than or equal to @var{num} bytes
23176 into the small data or BSS sections instead of the normal data or BSS
23177 sections. The default value of @var{num} is 8.
23178
23179 @item -mgpopt=@var{option}
23180 @itemx -mgpopt
23181 @itemx -mno-gpopt
23182 @opindex mgpopt
23183 @opindex mno-gpopt
23184 Generate (do not generate) GP-relative accesses. The following
23185 @var{option} names are recognized:
23186
23187 @table @samp
23188
23189 @item none
23190 Do not generate GP-relative accesses.
23191
23192 @item local
23193 Generate GP-relative accesses for small data objects that are not
23194 external, weak, or uninitialized common symbols.
23195 Also use GP-relative addressing for objects that
23196 have been explicitly placed in a small data section via a @code{section}
23197 attribute.
23198
23199 @item global
23200 As for @samp{local}, but also generate GP-relative accesses for
23201 small data objects that are external, weak, or common. If you use this option,
23202 you must ensure that all parts of your program (including libraries) are
23203 compiled with the same @option{-G} setting.
23204
23205 @item data
23206 Generate GP-relative accesses for all data objects in the program. If you
23207 use this option, the entire data and BSS segments
23208 of your program must fit in 64K of memory and you must use an appropriate
23209 linker script to allocate them within the addressable range of the
23210 global pointer.
23211
23212 @item all
23213 Generate GP-relative addresses for function pointers as well as data
23214 pointers. If you use this option, the entire text, data, and BSS segments
23215 of your program must fit in 64K of memory and you must use an appropriate
23216 linker script to allocate them within the addressable range of the
23217 global pointer.
23218
23219 @end table
23220
23221 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23222 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23223
23224 The default is @option{-mgpopt} except when @option{-fpic} or
23225 @option{-fPIC} is specified to generate position-independent code.
23226 Note that the Nios II ABI does not permit GP-relative accesses from
23227 shared libraries.
23228
23229 You may need to specify @option{-mno-gpopt} explicitly when building
23230 programs that include large amounts of small data, including large
23231 GOT data sections. In this case, the 16-bit offset for GP-relative
23232 addressing may not be large enough to allow access to the entire
23233 small data section.
23234
23235 @item -mgprel-sec=@var{regexp}
23236 @opindex mgprel-sec
23237 This option specifies additional section names that can be accessed via
23238 GP-relative addressing. It is most useful in conjunction with
23239 @code{section} attributes on variable declarations
23240 (@pxref{Common Variable Attributes}) and a custom linker script.
23241 The @var{regexp} is a POSIX Extended Regular Expression.
23242
23243 This option does not affect the behavior of the @option{-G} option, and
23244 the specified sections are in addition to the standard @code{.sdata}
23245 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23246
23247 @item -mr0rel-sec=@var{regexp}
23248 @opindex mr0rel-sec
23249 This option specifies names of sections that can be accessed via a
23250 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23251 of the 32-bit address space. It is most useful in conjunction with
23252 @code{section} attributes on variable declarations
23253 (@pxref{Common Variable Attributes}) and a custom linker script.
23254 The @var{regexp} is a POSIX Extended Regular Expression.
23255
23256 In contrast to the use of GP-relative addressing for small data,
23257 zero-based addressing is never generated by default and there are no
23258 conventional section names used in standard linker scripts for sections
23259 in the low or high areas of memory.
23260
23261 @item -mel
23262 @itemx -meb
23263 @opindex mel
23264 @opindex meb
23265 Generate little-endian (default) or big-endian (experimental) code,
23266 respectively.
23267
23268 @item -march=@var{arch}
23269 @opindex march
23270 This specifies the name of the target Nios II architecture. GCC uses this
23271 name to determine what kind of instructions it can emit when generating
23272 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23273
23274 The preprocessor macro @code{__nios2_arch__} is available to programs,
23275 with value 1 or 2, indicating the targeted ISA level.
23276
23277 @item -mbypass-cache
23278 @itemx -mno-bypass-cache
23279 @opindex mno-bypass-cache
23280 @opindex mbypass-cache
23281 Force all load and store instructions to always bypass cache by
23282 using I/O variants of the instructions. The default is not to
23283 bypass the cache.
23284
23285 @item -mno-cache-volatile
23286 @itemx -mcache-volatile
23287 @opindex mcache-volatile
23288 @opindex mno-cache-volatile
23289 Volatile memory access bypass the cache using the I/O variants of
23290 the load and store instructions. The default is not to bypass the cache.
23291
23292 @item -mno-fast-sw-div
23293 @itemx -mfast-sw-div
23294 @opindex mno-fast-sw-div
23295 @opindex mfast-sw-div
23296 Do not use table-based fast divide for small numbers. The default
23297 is to use the fast divide at @option{-O3} and above.
23298
23299 @item -mno-hw-mul
23300 @itemx -mhw-mul
23301 @itemx -mno-hw-mulx
23302 @itemx -mhw-mulx
23303 @itemx -mno-hw-div
23304 @itemx -mhw-div
23305 @opindex mno-hw-mul
23306 @opindex mhw-mul
23307 @opindex mno-hw-mulx
23308 @opindex mhw-mulx
23309 @opindex mno-hw-div
23310 @opindex mhw-div
23311 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23312 instructions by the compiler. The default is to emit @code{mul}
23313 and not emit @code{div} and @code{mulx}.
23314
23315 @item -mbmx
23316 @itemx -mno-bmx
23317 @itemx -mcdx
23318 @itemx -mno-cdx
23319 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23320 CDX (code density) instructions. Enabling these instructions also
23321 requires @option{-march=r2}. Since these instructions are optional
23322 extensions to the R2 architecture, the default is not to emit them.
23323
23324 @item -mcustom-@var{insn}=@var{N}
23325 @itemx -mno-custom-@var{insn}
23326 @opindex mcustom-@var{insn}
23327 @opindex mno-custom-@var{insn}
23328 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23329 custom instruction with encoding @var{N} when generating code that uses
23330 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23331 instruction 253 for single-precision floating-point add operations instead
23332 of the default behavior of using a library call.
23333
23334 The following values of @var{insn} are supported. Except as otherwise
23335 noted, floating-point operations are expected to be implemented with
23336 normal IEEE 754 semantics and correspond directly to the C operators or the
23337 equivalent GCC built-in functions (@pxref{Other Builtins}).
23338
23339 Single-precision floating point:
23340 @table @asis
23341
23342 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23343 Binary arithmetic operations.
23344
23345 @item @samp{fnegs}
23346 Unary negation.
23347
23348 @item @samp{fabss}
23349 Unary absolute value.
23350
23351 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23352 Comparison operations.
23353
23354 @item @samp{fmins}, @samp{fmaxs}
23355 Floating-point minimum and maximum. These instructions are only
23356 generated if @option{-ffinite-math-only} is specified.
23357
23358 @item @samp{fsqrts}
23359 Unary square root operation.
23360
23361 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23362 Floating-point trigonometric and exponential functions. These instructions
23363 are only generated if @option{-funsafe-math-optimizations} is also specified.
23364
23365 @end table
23366
23367 Double-precision floating point:
23368 @table @asis
23369
23370 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23371 Binary arithmetic operations.
23372
23373 @item @samp{fnegd}
23374 Unary negation.
23375
23376 @item @samp{fabsd}
23377 Unary absolute value.
23378
23379 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23380 Comparison operations.
23381
23382 @item @samp{fmind}, @samp{fmaxd}
23383 Double-precision minimum and maximum. These instructions are only
23384 generated if @option{-ffinite-math-only} is specified.
23385
23386 @item @samp{fsqrtd}
23387 Unary square root operation.
23388
23389 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23390 Double-precision trigonometric and exponential functions. These instructions
23391 are only generated if @option{-funsafe-math-optimizations} is also specified.
23392
23393 @end table
23394
23395 Conversions:
23396 @table @asis
23397 @item @samp{fextsd}
23398 Conversion from single precision to double precision.
23399
23400 @item @samp{ftruncds}
23401 Conversion from double precision to single precision.
23402
23403 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23404 Conversion from floating point to signed or unsigned integer types, with
23405 truncation towards zero.
23406
23407 @item @samp{round}
23408 Conversion from single-precision floating point to signed integer,
23409 rounding to the nearest integer and ties away from zero.
23410 This corresponds to the @code{__builtin_lroundf} function when
23411 @option{-fno-math-errno} is used.
23412
23413 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23414 Conversion from signed or unsigned integer types to floating-point types.
23415
23416 @end table
23417
23418 In addition, all of the following transfer instructions for internal
23419 registers X and Y must be provided to use any of the double-precision
23420 floating-point instructions. Custom instructions taking two
23421 double-precision source operands expect the first operand in the
23422 64-bit register X. The other operand (or only operand of a unary
23423 operation) is given to the custom arithmetic instruction with the
23424 least significant half in source register @var{src1} and the most
23425 significant half in @var{src2}. A custom instruction that returns a
23426 double-precision result returns the most significant 32 bits in the
23427 destination register and the other half in 32-bit register Y.
23428 GCC automatically generates the necessary code sequences to write
23429 register X and/or read register Y when double-precision floating-point
23430 instructions are used.
23431
23432 @table @asis
23433
23434 @item @samp{fwrx}
23435 Write @var{src1} into the least significant half of X and @var{src2} into
23436 the most significant half of X.
23437
23438 @item @samp{fwry}
23439 Write @var{src1} into Y.
23440
23441 @item @samp{frdxhi}, @samp{frdxlo}
23442 Read the most or least (respectively) significant half of X and store it in
23443 @var{dest}.
23444
23445 @item @samp{frdy}
23446 Read the value of Y and store it into @var{dest}.
23447 @end table
23448
23449 Note that you can gain more local control over generation of Nios II custom
23450 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23451 and @code{target("no-custom-@var{insn}")} function attributes
23452 (@pxref{Function Attributes})
23453 or pragmas (@pxref{Function Specific Option Pragmas}).
23454
23455 @item -mcustom-fpu-cfg=@var{name}
23456 @opindex mcustom-fpu-cfg
23457
23458 This option enables a predefined, named set of custom instruction encodings
23459 (see @option{-mcustom-@var{insn}} above).
23460 Currently, the following sets are defined:
23461
23462 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23463 @gccoptlist{-mcustom-fmuls=252 @gol
23464 -mcustom-fadds=253 @gol
23465 -mcustom-fsubs=254 @gol
23466 -fsingle-precision-constant}
23467
23468 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23469 @gccoptlist{-mcustom-fmuls=252 @gol
23470 -mcustom-fadds=253 @gol
23471 -mcustom-fsubs=254 @gol
23472 -mcustom-fdivs=255 @gol
23473 -fsingle-precision-constant}
23474
23475 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23476 @gccoptlist{-mcustom-floatus=243 @gol
23477 -mcustom-fixsi=244 @gol
23478 -mcustom-floatis=245 @gol
23479 -mcustom-fcmpgts=246 @gol
23480 -mcustom-fcmples=249 @gol
23481 -mcustom-fcmpeqs=250 @gol
23482 -mcustom-fcmpnes=251 @gol
23483 -mcustom-fmuls=252 @gol
23484 -mcustom-fadds=253 @gol
23485 -mcustom-fsubs=254 @gol
23486 -mcustom-fdivs=255 @gol
23487 -fsingle-precision-constant}
23488
23489 Custom instruction assignments given by individual
23490 @option{-mcustom-@var{insn}=} options override those given by
23491 @option{-mcustom-fpu-cfg=}, regardless of the
23492 order of the options on the command line.
23493
23494 Note that you can gain more local control over selection of a FPU
23495 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23496 function attribute (@pxref{Function Attributes})
23497 or pragma (@pxref{Function Specific Option Pragmas}).
23498
23499 @end table
23500
23501 These additional @samp{-m} options are available for the Altera Nios II
23502 ELF (bare-metal) target:
23503
23504 @table @gcctabopt
23505
23506 @item -mhal
23507 @opindex mhal
23508 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23509 startup and termination code, and is typically used in conjunction with
23510 @option{-msys-crt0=} to specify the location of the alternate startup code
23511 provided by the HAL BSP.
23512
23513 @item -msmallc
23514 @opindex msmallc
23515 Link with a limited version of the C library, @option{-lsmallc}, rather than
23516 Newlib.
23517
23518 @item -msys-crt0=@var{startfile}
23519 @opindex msys-crt0
23520 @var{startfile} is the file name of the startfile (crt0) to use
23521 when linking. This option is only useful in conjunction with @option{-mhal}.
23522
23523 @item -msys-lib=@var{systemlib}
23524 @opindex msys-lib
23525 @var{systemlib} is the library name of the library that provides
23526 low-level system calls required by the C library,
23527 e.g.@: @code{read} and @code{write}.
23528 This option is typically used to link with a library provided by a HAL BSP.
23529
23530 @end table
23531
23532 @node Nvidia PTX Options
23533 @subsection Nvidia PTX Options
23534 @cindex Nvidia PTX options
23535 @cindex nvptx options
23536
23537 These options are defined for Nvidia PTX:
23538
23539 @table @gcctabopt
23540
23541 @item -m32
23542 @itemx -m64
23543 @opindex m32
23544 @opindex m64
23545 Generate code for 32-bit or 64-bit ABI.
23546
23547 @item -misa=@var{ISA-string}
23548 @opindex march
23549 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23550 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23551 @samp{sm_35}. The default ISA is sm_30.
23552
23553 @item -mmainkernel
23554 @opindex mmainkernel
23555 Link in code for a __main kernel. This is for stand-alone instead of
23556 offloading execution.
23557
23558 @item -moptimize
23559 @opindex moptimize
23560 Apply partitioned execution optimizations. This is the default when any
23561 level of optimization is selected.
23562
23563 @item -msoft-stack
23564 @opindex msoft-stack
23565 Generate code that does not use @code{.local} memory
23566 directly for stack storage. Instead, a per-warp stack pointer is
23567 maintained explicitly. This enables variable-length stack allocation (with
23568 variable-length arrays or @code{alloca}), and when global memory is used for
23569 underlying storage, makes it possible to access automatic variables from other
23570 threads, or with atomic instructions. This code generation variant is used
23571 for OpenMP offloading, but the option is exposed on its own for the purpose
23572 of testing the compiler; to generate code suitable for linking into programs
23573 using OpenMP offloading, use option @option{-mgomp}.
23574
23575 @item -muniform-simt
23576 @opindex muniform-simt
23577 Switch to code generation variant that allows to execute all threads in each
23578 warp, while maintaining memory state and side effects as if only one thread
23579 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23580 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23581 current lane index equals the master lane index), and the register being
23582 assigned is copied via a shuffle instruction from the master lane. Outside of
23583 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23584 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23585 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23586 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23587 with current lane index to compute the master lane index.
23588
23589 @item -mgomp
23590 @opindex mgomp
23591 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23592 @option{-muniform-simt} options, and selects corresponding multilib variant.
23593
23594 @end table
23595
23596 @node OpenRISC Options
23597 @subsection OpenRISC Options
23598 @cindex OpenRISC Options
23599
23600 These options are defined for OpenRISC:
23601
23602 @table @gcctabopt
23603
23604 @item -mboard=@var{name}
23605 @opindex mboard
23606 Configure a board specific runtime. This will be passed to the linker for
23607 newlib board library linking. The default is @code{or1ksim}.
23608
23609 @item -mnewlib
23610 @opindex mnewlib
23611 For compatibility, it's always newlib for elf now.
23612
23613 @item -mhard-div
23614 @opindex mhard-div
23615 Generate code for hardware which supports divide instructions. This is the
23616 default.
23617
23618 @item -mhard-mul
23619 @opindex mhard-mul
23620 Generate code for hardware which supports multiply instructions. This is the
23621 default.
23622
23623 @item -mcmov
23624 @opindex mcmov
23625 Generate code for hardware which supports the conditional move (@code{l.cmov})
23626 instruction.
23627
23628 @item -mror
23629 @opindex mror
23630 Generate code for hardware which supports rotate right instructions.
23631
23632 @item -msext
23633 @opindex msext
23634 Generate code for hardware which supports sign-extension instructions.
23635
23636 @item -msfimm
23637 @opindex msfimm
23638 Generate code for hardware which supports set flag immediate (@code{l.sf*i})
23639 instructions.
23640
23641 @item -mshftimm
23642 @opindex mshftimm
23643 Generate code for hardware which supports shift immediate related instructions
23644 (i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}). Note, to
23645 enable generation of the @code{l.rori} instruction the @option{-mror} flag must
23646 also be specified.
23647
23648 @item -msoft-div
23649 @opindex msoft-div
23650 Generate code for hardware which requires divide instruction emulation.
23651
23652 @item -msoft-mul
23653 @opindex msoft-mul
23654 Generate code for hardware which requires multiply instruction emulation.
23655
23656 @end table
23657
23658 @node PDP-11 Options
23659 @subsection PDP-11 Options
23660 @cindex PDP-11 Options
23661
23662 These options are defined for the PDP-11:
23663
23664 @table @gcctabopt
23665 @item -mfpu
23666 @opindex mfpu
23667 Use hardware FPP floating point. This is the default. (FIS floating
23668 point on the PDP-11/40 is not supported.) Implies -m45.
23669
23670 @item -msoft-float
23671 @opindex msoft-float
23672 Do not use hardware floating point.
23673
23674 @item -mac0
23675 @opindex mac0
23676 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23677
23678 @item -mno-ac0
23679 @opindex mno-ac0
23680 Return floating-point results in memory. This is the default.
23681
23682 @item -m40
23683 @opindex m40
23684 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23685
23686 @item -m45
23687 @opindex m45
23688 Generate code for a PDP-11/45. This is the default.
23689
23690 @item -m10
23691 @opindex m10
23692 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23693
23694 @item -mint16
23695 @itemx -mno-int32
23696 @opindex mint16
23697 @opindex mno-int32
23698 Use 16-bit @code{int}. This is the default.
23699
23700 @item -mint32
23701 @itemx -mno-int16
23702 @opindex mint32
23703 @opindex mno-int16
23704 Use 32-bit @code{int}.
23705
23706 @item -msplit
23707 @opindex msplit
23708 Target has split instruction and data space. Implies -m45.
23709
23710 @item -munix-asm
23711 @opindex munix-asm
23712 Use Unix assembler syntax.
23713
23714 @item -mdec-asm
23715 @opindex mdec-asm
23716 Use DEC assembler syntax.
23717
23718 @item -mgnu-asm
23719 @opindex mgnu-asm
23720 Use GNU assembler syntax. This is the default.
23721
23722 @item -mlra
23723 @opindex mlra
23724 Use the new LRA register allocator. By default, the old ``reload''
23725 allocator is used.
23726 @end table
23727
23728 @node picoChip Options
23729 @subsection picoChip Options
23730 @cindex picoChip options
23731
23732 These @samp{-m} options are defined for picoChip implementations:
23733
23734 @table @gcctabopt
23735
23736 @item -mae=@var{ae_type}
23737 @opindex mcpu
23738 Set the instruction set, register set, and instruction scheduling
23739 parameters for array element type @var{ae_type}. Supported values
23740 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23741
23742 @option{-mae=ANY} selects a completely generic AE type. Code
23743 generated with this option runs on any of the other AE types. The
23744 code is not as efficient as it would be if compiled for a specific
23745 AE type, and some types of operation (e.g., multiplication) do not
23746 work properly on all types of AE.
23747
23748 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23749 for compiled code, and is the default.
23750
23751 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23752 option may suffer from poor performance of byte (char) manipulation,
23753 since the DSP AE does not provide hardware support for byte load/stores.
23754
23755 @item -msymbol-as-address
23756 Enable the compiler to directly use a symbol name as an address in a
23757 load/store instruction, without first loading it into a
23758 register. Typically, the use of this option generates larger
23759 programs, which run faster than when the option isn't used. However, the
23760 results vary from program to program, so it is left as a user option,
23761 rather than being permanently enabled.
23762
23763 @item -mno-inefficient-warnings
23764 Disables warnings about the generation of inefficient code. These
23765 warnings can be generated, for example, when compiling code that
23766 performs byte-level memory operations on the MAC AE type. The MAC AE has
23767 no hardware support for byte-level memory operations, so all byte
23768 load/stores must be synthesized from word load/store operations. This is
23769 inefficient and a warning is generated to indicate
23770 that you should rewrite the code to avoid byte operations, or to target
23771 an AE type that has the necessary hardware support. This option disables
23772 these warnings.
23773
23774 @end table
23775
23776 @node PowerPC Options
23777 @subsection PowerPC Options
23778 @cindex PowerPC options
23779
23780 These are listed under @xref{RS/6000 and PowerPC Options}.
23781
23782 @node PRU Options
23783 @subsection PRU Options
23784 @cindex PRU Options
23785
23786 These command-line options are defined for PRU target:
23787
23788 @table @gcctabopt
23789 @item -minrt
23790 @opindex minrt
23791 Link with a minimum runtime environment, with no support for static
23792 initializers and constructors. Using this option can significantly reduce
23793 the size of the final ELF binary. Beware that the compiler could still
23794 generate code with static initializers and constructors. It is up to the
23795 programmer to ensure that the source program will not use those features.
23796
23797 @item -mmcu=@var{mcu}
23798 @opindex mmcu
23799 Specify the PRU MCU variant to use. Check Newlib for the exact list of
23800 supported MCUs.
23801
23802 @item -mno-relax
23803 @opindex mno-relax
23804 Make GCC pass the @option{--no-relax} command-line option to the linker
23805 instead of the @option{--relax} option.
23806
23807 @item -mloop
23808 @opindex mloop
23809 Allow (or do not allow) GCC to use the LOOP instruction.
23810
23811 @item -mabi=@var{variant}
23812 @opindex mabi
23813 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
23814 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
23815 more naturally with certain GCC assumptions. These are the differences:
23816
23817 @table @samp
23818 @item Function Pointer Size
23819 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
23820 supports only 32-bit data and code pointers.
23821
23822 @item Optional Return Value Pointer
23823 Function return values larger than 64 bits are passed by using a hidden
23824 pointer as the first argument of the function. TI ABI, though, mandates that
23825 the pointer can be NULL in case the caller is not using the returned value.
23826 GNU always passes and expects a valid return value pointer.
23827
23828 @end table
23829
23830 The current @option{-mabi=ti} implementation simply raises a compile error
23831 when any of the above code constructs is detected. As a consequence
23832 the standard C library cannot be built and it is omitted when linking with
23833 @option{-mabi=ti}.
23834
23835 Relaxation is a GNU feature and for safety reasons is disabled when using
23836 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
23837 instructions, so the GNU linker cannot adjust them when shortening adjacent
23838 LDI32 pseudo instructions.
23839
23840 @end table
23841
23842 @node RISC-V Options
23843 @subsection RISC-V Options
23844 @cindex RISC-V Options
23845
23846 These command-line options are defined for RISC-V targets:
23847
23848 @table @gcctabopt
23849 @item -mbranch-cost=@var{n}
23850 @opindex mbranch-cost
23851 Set the cost of branches to roughly @var{n} instructions.
23852
23853 @item -mplt
23854 @itemx -mno-plt
23855 @opindex plt
23856 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23857 non-PIC. The default is @option{-mplt}.
23858
23859 @item -mabi=@var{ABI-string}
23860 @opindex mabi
23861 Specify integer and floating-point calling convention. @var{ABI-string}
23862 contains two parts: the size of integer types and the registers used for
23863 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23864 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23865 32-bit), and that floating-point values up to 64 bits wide are passed in F
23866 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23867 allows the compiler to generate code that uses the F and D extensions but only
23868 allows floating-point values up to 32 bits long to be passed in registers; or
23869 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23870 passed in registers.
23871
23872 The default for this argument is system dependent, users who want a specific
23873 calling convention should specify one explicitly. The valid calling
23874 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23875 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23876 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23877 invalid because the ABI requires 64-bit values be passed in F registers, but F
23878 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23879 only be used with the @samp{rv32e} architecture. This ABI is not well
23880 specified at present, and is subject to change.
23881
23882 @item -mfdiv
23883 @itemx -mno-fdiv
23884 @opindex mfdiv
23885 Do or don't use hardware floating-point divide and square root instructions.
23886 This requires the F or D extensions for floating-point registers. The default
23887 is to use them if the specified architecture has these instructions.
23888
23889 @item -mdiv
23890 @itemx -mno-div
23891 @opindex mdiv
23892 Do or don't use hardware instructions for integer division. This requires the
23893 M extension. The default is to use them if the specified architecture has
23894 these instructions.
23895
23896 @item -march=@var{ISA-string}
23897 @opindex march
23898 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
23899 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23900 @samp{rv32imaf}.
23901
23902 @item -mtune=@var{processor-string}
23903 @opindex mtune
23904 Optimize the output for the given processor, specified by microarchitecture
23905 name. Permissible values for this option are: @samp{rocket},
23906 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
23907 and @samp{size}.
23908
23909 When @option{-mtune=} is not specified, the default is @samp{rocket}.
23910
23911 The @samp{size} choice is not intended for use by end-users. This is used
23912 when @option{-Os} is specified. It overrides the instruction cost info
23913 provided by @option{-mtune=}, but does not override the pipeline info. This
23914 helps reduce code size while still giving good performance.
23915
23916 @item -mpreferred-stack-boundary=@var{num}
23917 @opindex mpreferred-stack-boundary
23918 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23919 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23920 the default is 4 (16 bytes or 128-bits).
23921
23922 @strong{Warning:} If you use this switch, then you must build all modules with
23923 the same value, including any libraries. This includes the system libraries
23924 and startup modules.
23925
23926 @item -msmall-data-limit=@var{n}
23927 @opindex msmall-data-limit
23928 Put global and static data smaller than @var{n} bytes into a special section
23929 (on some targets).
23930
23931 @item -msave-restore
23932 @itemx -mno-save-restore
23933 @opindex msave-restore
23934 Do or don't use smaller but slower prologue and epilogue code that uses
23935 library function calls. The default is to use fast inline prologues and
23936 epilogues.
23937
23938 @item -mstrict-align
23939 @itemx -mno-strict-align
23940 @opindex mstrict-align
23941 Do not or do generate unaligned memory accesses. The default is set depending
23942 on whether the processor we are optimizing for supports fast unaligned access
23943 or not.
23944
23945 @item -mcmodel=medlow
23946 @opindex mcmodel=medlow
23947 Generate code for the medium-low code model. The program and its statically
23948 defined symbols must lie within a single 2 GiB address range and must lie
23949 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23950 statically or dynamically linked. This is the default code model.
23951
23952 @item -mcmodel=medany
23953 @opindex mcmodel=medany
23954 Generate code for the medium-any code model. The program and its statically
23955 defined symbols must be within any single 2 GiB address range. Programs can be
23956 statically or dynamically linked.
23957
23958 @item -mexplicit-relocs
23959 @itemx -mno-exlicit-relocs
23960 Use or do not use assembler relocation operators when dealing with symbolic
23961 addresses. The alternative is to use assembler macros instead, which may
23962 limit optimization.
23963
23964 @item -mrelax
23965 @itemx -mno-relax
23966 Take advantage of linker relaxations to reduce the number of instructions
23967 required to materialize symbol addresses. The default is to take advantage of
23968 linker relaxations.
23969
23970 @item -memit-attribute
23971 @itemx -mno-emit-attribute
23972 Emit (do not emit) RISC-V attribute to record extra information into ELF
23973 objects. This feature requires at least binutils 2.32.
23974 @end table
23975
23976 @node RL78 Options
23977 @subsection RL78 Options
23978 @cindex RL78 Options
23979
23980 @table @gcctabopt
23981
23982 @item -msim
23983 @opindex msim
23984 Links in additional target libraries to support operation within a
23985 simulator.
23986
23987 @item -mmul=none
23988 @itemx -mmul=g10
23989 @itemx -mmul=g13
23990 @itemx -mmul=g14
23991 @itemx -mmul=rl78
23992 @opindex mmul
23993 Specifies the type of hardware multiplication and division support to
23994 be used. The simplest is @code{none}, which uses software for both
23995 multiplication and division. This is the default. The @code{g13}
23996 value is for the hardware multiply/divide peripheral found on the
23997 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
23998 the multiplication and division instructions supported by the RL78/G14
23999 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24000 the value @code{mg10} is an alias for @code{none}.
24001
24002 In addition a C preprocessor macro is defined, based upon the setting
24003 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24004 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24005
24006 @item -mcpu=g10
24007 @itemx -mcpu=g13
24008 @itemx -mcpu=g14
24009 @itemx -mcpu=rl78
24010 @opindex mcpu
24011 Specifies the RL78 core to target. The default is the G14 core, also
24012 known as an S3 core or just RL78. The G13 or S2 core does not have
24013 multiply or divide instructions, instead it uses a hardware peripheral
24014 for these operations. The G10 or S1 core does not have register
24015 banks, so it uses a different calling convention.
24016
24017 If this option is set it also selects the type of hardware multiply
24018 support to use, unless this is overridden by an explicit
24019 @option{-mmul=none} option on the command line. Thus specifying
24020 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24021 peripheral and specifying @option{-mcpu=g10} disables the use of
24022 hardware multiplications altogether.
24023
24024 Note, although the RL78/G14 core is the default target, specifying
24025 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24026 change the behavior of the toolchain since it also enables G14
24027 hardware multiply support. If these options are not specified on the
24028 command line then software multiplication routines will be used even
24029 though the code targets the RL78 core. This is for backwards
24030 compatibility with older toolchains which did not have hardware
24031 multiply and divide support.
24032
24033 In addition a C preprocessor macro is defined, based upon the setting
24034 of this option. Possible values are: @code{__RL78_G10__},
24035 @code{__RL78_G13__} or @code{__RL78_G14__}.
24036
24037 @item -mg10
24038 @itemx -mg13
24039 @itemx -mg14
24040 @itemx -mrl78
24041 @opindex mg10
24042 @opindex mg13
24043 @opindex mg14
24044 @opindex mrl78
24045 These are aliases for the corresponding @option{-mcpu=} option. They
24046 are provided for backwards compatibility.
24047
24048 @item -mallregs
24049 @opindex mallregs
24050 Allow the compiler to use all of the available registers. By default
24051 registers @code{r24..r31} are reserved for use in interrupt handlers.
24052 With this option enabled these registers can be used in ordinary
24053 functions as well.
24054
24055 @item -m64bit-doubles
24056 @itemx -m32bit-doubles
24057 @opindex m64bit-doubles
24058 @opindex m32bit-doubles
24059 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24060 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24061 @option{-m32bit-doubles}.
24062
24063 @item -msave-mduc-in-interrupts
24064 @itemx -mno-save-mduc-in-interrupts
24065 @opindex msave-mduc-in-interrupts
24066 @opindex mno-save-mduc-in-interrupts
24067 Specifies that interrupt handler functions should preserve the
24068 MDUC registers. This is only necessary if normal code might use
24069 the MDUC registers, for example because it performs multiplication
24070 and division operations. The default is to ignore the MDUC registers
24071 as this makes the interrupt handlers faster. The target option -mg13
24072 needs to be passed for this to work as this feature is only available
24073 on the G13 target (S2 core). The MDUC registers will only be saved
24074 if the interrupt handler performs a multiplication or division
24075 operation or it calls another function.
24076
24077 @end table
24078
24079 @node RS/6000 and PowerPC Options
24080 @subsection IBM RS/6000 and PowerPC Options
24081 @cindex RS/6000 and PowerPC Options
24082 @cindex IBM RS/6000 and PowerPC Options
24083
24084 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24085 @table @gcctabopt
24086 @item -mpowerpc-gpopt
24087 @itemx -mno-powerpc-gpopt
24088 @itemx -mpowerpc-gfxopt
24089 @itemx -mno-powerpc-gfxopt
24090 @need 800
24091 @itemx -mpowerpc64
24092 @itemx -mno-powerpc64
24093 @itemx -mmfcrf
24094 @itemx -mno-mfcrf
24095 @itemx -mpopcntb
24096 @itemx -mno-popcntb
24097 @itemx -mpopcntd
24098 @itemx -mno-popcntd
24099 @itemx -mfprnd
24100 @itemx -mno-fprnd
24101 @need 800
24102 @itemx -mcmpb
24103 @itemx -mno-cmpb
24104 @itemx -mhard-dfp
24105 @itemx -mno-hard-dfp
24106 @opindex mpowerpc-gpopt
24107 @opindex mno-powerpc-gpopt
24108 @opindex mpowerpc-gfxopt
24109 @opindex mno-powerpc-gfxopt
24110 @opindex mpowerpc64
24111 @opindex mno-powerpc64
24112 @opindex mmfcrf
24113 @opindex mno-mfcrf
24114 @opindex mpopcntb
24115 @opindex mno-popcntb
24116 @opindex mpopcntd
24117 @opindex mno-popcntd
24118 @opindex mfprnd
24119 @opindex mno-fprnd
24120 @opindex mcmpb
24121 @opindex mno-cmpb
24122 @opindex mhard-dfp
24123 @opindex mno-hard-dfp
24124 You use these options to specify which instructions are available on the
24125 processor you are using. The default value of these options is
24126 determined when configuring GCC@. Specifying the
24127 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24128 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24129 rather than the options listed above.
24130
24131 Specifying @option{-mpowerpc-gpopt} allows
24132 GCC to use the optional PowerPC architecture instructions in the
24133 General Purpose group, including floating-point square root. Specifying
24134 @option{-mpowerpc-gfxopt} allows GCC to
24135 use the optional PowerPC architecture instructions in the Graphics
24136 group, including floating-point select.
24137
24138 The @option{-mmfcrf} option allows GCC to generate the move from
24139 condition register field instruction implemented on the POWER4
24140 processor and other processors that support the PowerPC V2.01
24141 architecture.
24142 The @option{-mpopcntb} option allows GCC to generate the popcount and
24143 double-precision FP reciprocal estimate instruction implemented on the
24144 POWER5 processor and other processors that support the PowerPC V2.02
24145 architecture.
24146 The @option{-mpopcntd} option allows GCC to generate the popcount
24147 instruction implemented on the POWER7 processor and other processors
24148 that support the PowerPC V2.06 architecture.
24149 The @option{-mfprnd} option allows GCC to generate the FP round to
24150 integer instructions implemented on the POWER5+ processor and other
24151 processors that support the PowerPC V2.03 architecture.
24152 The @option{-mcmpb} option allows GCC to generate the compare bytes
24153 instruction implemented on the POWER6 processor and other processors
24154 that support the PowerPC V2.05 architecture.
24155 The @option{-mhard-dfp} option allows GCC to generate the decimal
24156 floating-point instructions implemented on some POWER processors.
24157
24158 The @option{-mpowerpc64} option allows GCC to generate the additional
24159 64-bit instructions that are found in the full PowerPC64 architecture
24160 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24161 @option{-mno-powerpc64}.
24162
24163 @item -mcpu=@var{cpu_type}
24164 @opindex mcpu
24165 Set architecture type, register usage, and
24166 instruction scheduling parameters for machine type @var{cpu_type}.
24167 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24168 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24169 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24170 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24171 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24172 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24173 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24174 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24175 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24176 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24177 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24178 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24179
24180 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24181 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24182 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24183 architecture machine types, with an appropriate, generic processor
24184 model assumed for scheduling purposes.
24185
24186 Specifying @samp{native} as cpu type detects and selects the
24187 architecture option that corresponds to the host processor of the
24188 system performing the compilation.
24189 @option{-mcpu=native} has no effect if GCC does not recognize the
24190 processor.
24191
24192 The other options specify a specific processor. Code generated under
24193 those options runs best on that processor, and may not run at all on
24194 others.
24195
24196 The @option{-mcpu} options automatically enable or disable the
24197 following options:
24198
24199 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24200 -mpopcntb -mpopcntd -mpowerpc64 @gol
24201 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24202 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24203 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24204 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24205
24206 The particular options set for any particular CPU varies between
24207 compiler versions, depending on what setting seems to produce optimal
24208 code for that CPU; it doesn't necessarily reflect the actual hardware's
24209 capabilities. If you wish to set an individual option to a particular
24210 value, you may specify it after the @option{-mcpu} option, like
24211 @option{-mcpu=970 -mno-altivec}.
24212
24213 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24214 not enabled or disabled by the @option{-mcpu} option at present because
24215 AIX does not have full support for these options. You may still
24216 enable or disable them individually if you're sure it'll work in your
24217 environment.
24218
24219 @item -mtune=@var{cpu_type}
24220 @opindex mtune
24221 Set the instruction scheduling parameters for machine type
24222 @var{cpu_type}, but do not set the architecture type or register usage,
24223 as @option{-mcpu=@var{cpu_type}} does. The same
24224 values for @var{cpu_type} are used for @option{-mtune} as for
24225 @option{-mcpu}. If both are specified, the code generated uses the
24226 architecture and registers set by @option{-mcpu}, but the
24227 scheduling parameters set by @option{-mtune}.
24228
24229 @item -mcmodel=small
24230 @opindex mcmodel=small
24231 Generate PowerPC64 code for the small model: The TOC is limited to
24232 64k.
24233
24234 @item -mcmodel=medium
24235 @opindex mcmodel=medium
24236 Generate PowerPC64 code for the medium model: The TOC and other static
24237 data may be up to a total of 4G in size. This is the default for 64-bit
24238 Linux.
24239
24240 @item -mcmodel=large
24241 @opindex mcmodel=large
24242 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24243 in size. Other data and code is only limited by the 64-bit address
24244 space.
24245
24246 @item -maltivec
24247 @itemx -mno-altivec
24248 @opindex maltivec
24249 @opindex mno-altivec
24250 Generate code that uses (does not use) AltiVec instructions, and also
24251 enable the use of built-in functions that allow more direct access to
24252 the AltiVec instruction set. You may also need to set
24253 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24254 enhancements.
24255
24256 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24257 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24258 match array element order corresponding to the endianness of the
24259 target. That is, element zero identifies the leftmost element in a
24260 vector register when targeting a big-endian platform, and identifies
24261 the rightmost element in a vector register when targeting a
24262 little-endian platform.
24263
24264 @item -mvrsave
24265 @itemx -mno-vrsave
24266 @opindex mvrsave
24267 @opindex mno-vrsave
24268 Generate VRSAVE instructions when generating AltiVec code.
24269
24270 @item -msecure-plt
24271 @opindex msecure-plt
24272 Generate code that allows @command{ld} and @command{ld.so}
24273 to build executables and shared
24274 libraries with non-executable @code{.plt} and @code{.got} sections.
24275 This is a PowerPC
24276 32-bit SYSV ABI option.
24277
24278 @item -mbss-plt
24279 @opindex mbss-plt
24280 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24281 fills in, and
24282 requires @code{.plt} and @code{.got}
24283 sections that are both writable and executable.
24284 This is a PowerPC 32-bit SYSV ABI option.
24285
24286 @item -misel
24287 @itemx -mno-isel
24288 @opindex misel
24289 @opindex mno-isel
24290 This switch enables or disables the generation of ISEL instructions.
24291
24292 @item -mvsx
24293 @itemx -mno-vsx
24294 @opindex mvsx
24295 @opindex mno-vsx
24296 Generate code that uses (does not use) vector/scalar (VSX)
24297 instructions, and also enable the use of built-in functions that allow
24298 more direct access to the VSX instruction set.
24299
24300 @item -mcrypto
24301 @itemx -mno-crypto
24302 @opindex mcrypto
24303 @opindex mno-crypto
24304 Enable the use (disable) of the built-in functions that allow direct
24305 access to the cryptographic instructions that were added in version
24306 2.07 of the PowerPC ISA.
24307
24308 @item -mhtm
24309 @itemx -mno-htm
24310 @opindex mhtm
24311 @opindex mno-htm
24312 Enable (disable) the use of the built-in functions that allow direct
24313 access to the Hardware Transactional Memory (HTM) instructions that
24314 were added in version 2.07 of the PowerPC ISA.
24315
24316 @item -mpower8-fusion
24317 @itemx -mno-power8-fusion
24318 @opindex mpower8-fusion
24319 @opindex mno-power8-fusion
24320 Generate code that keeps (does not keeps) some integer operations
24321 adjacent so that the instructions can be fused together on power8 and
24322 later processors.
24323
24324 @item -mpower8-vector
24325 @itemx -mno-power8-vector
24326 @opindex mpower8-vector
24327 @opindex mno-power8-vector
24328 Generate code that uses (does not use) the vector and scalar
24329 instructions that were added in version 2.07 of the PowerPC ISA. Also
24330 enable the use of built-in functions that allow more direct access to
24331 the vector instructions.
24332
24333 @item -mquad-memory
24334 @itemx -mno-quad-memory
24335 @opindex mquad-memory
24336 @opindex mno-quad-memory
24337 Generate code that uses (does not use) the non-atomic quad word memory
24338 instructions. The @option{-mquad-memory} option requires use of
24339 64-bit mode.
24340
24341 @item -mquad-memory-atomic
24342 @itemx -mno-quad-memory-atomic
24343 @opindex mquad-memory-atomic
24344 @opindex mno-quad-memory-atomic
24345 Generate code that uses (does not use) the atomic quad word memory
24346 instructions. The @option{-mquad-memory-atomic} option requires use of
24347 64-bit mode.
24348
24349 @item -mfloat128
24350 @itemx -mno-float128
24351 @opindex mfloat128
24352 @opindex mno-float128
24353 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24354 and use either software emulation for IEEE 128-bit floating point or
24355 hardware instructions.
24356
24357 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24358 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24359 use the IEEE 128-bit floating point support. The IEEE 128-bit
24360 floating point support only works on PowerPC Linux systems.
24361
24362 The default for @option{-mfloat128} is enabled on PowerPC Linux
24363 systems using the VSX instruction set, and disabled on other systems.
24364
24365 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24366 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24367 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24368 floating point instructions. Otherwise, if you do not specify to
24369 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24370 system, IEEE 128-bit floating point will be done with software
24371 emulation.
24372
24373 @item -mfloat128-hardware
24374 @itemx -mno-float128-hardware
24375 @opindex mfloat128-hardware
24376 @opindex mno-float128-hardware
24377 Enable/disable using ISA 3.0 hardware instructions to support the
24378 @var{__float128} data type.
24379
24380 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24381 Linux systems using the ISA 3.0 instruction set, and disabled on other
24382 systems.
24383
24384 @item -m32
24385 @itemx -m64
24386 @opindex m32
24387 @opindex m64
24388 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24389 targets (including GNU/Linux). The 32-bit environment sets int, long
24390 and pointer to 32 bits and generates code that runs on any PowerPC
24391 variant. The 64-bit environment sets int to 32 bits and long and
24392 pointer to 64 bits, and generates code for PowerPC64, as for
24393 @option{-mpowerpc64}.
24394
24395 @item -mfull-toc
24396 @itemx -mno-fp-in-toc
24397 @itemx -mno-sum-in-toc
24398 @itemx -mminimal-toc
24399 @opindex mfull-toc
24400 @opindex mno-fp-in-toc
24401 @opindex mno-sum-in-toc
24402 @opindex mminimal-toc
24403 Modify generation of the TOC (Table Of Contents), which is created for
24404 every executable file. The @option{-mfull-toc} option is selected by
24405 default. In that case, GCC allocates at least one TOC entry for
24406 each unique non-automatic variable reference in your program. GCC
24407 also places floating-point constants in the TOC@. However, only
24408 16,384 entries are available in the TOC@.
24409
24410 If you receive a linker error message that saying you have overflowed
24411 the available TOC space, you can reduce the amount of TOC space used
24412 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24413 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24414 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24415 generate code to calculate the sum of an address and a constant at
24416 run time instead of putting that sum into the TOC@. You may specify one
24417 or both of these options. Each causes GCC to produce very slightly
24418 slower and larger code at the expense of conserving TOC space.
24419
24420 If you still run out of space in the TOC even when you specify both of
24421 these options, specify @option{-mminimal-toc} instead. This option causes
24422 GCC to make only one TOC entry for every file. When you specify this
24423 option, GCC produces code that is slower and larger but which
24424 uses extremely little TOC space. You may wish to use this option
24425 only on files that contain less frequently-executed code.
24426
24427 @item -maix64
24428 @itemx -maix32
24429 @opindex maix64
24430 @opindex maix32
24431 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24432 @code{long} type, and the infrastructure needed to support them.
24433 Specifying @option{-maix64} implies @option{-mpowerpc64},
24434 while @option{-maix32} disables the 64-bit ABI and
24435 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24436
24437 @item -mxl-compat
24438 @itemx -mno-xl-compat
24439 @opindex mxl-compat
24440 @opindex mno-xl-compat
24441 Produce code that conforms more closely to IBM XL compiler semantics
24442 when using AIX-compatible ABI@. Pass floating-point arguments to
24443 prototyped functions beyond the register save area (RSA) on the stack
24444 in addition to argument FPRs. Do not assume that most significant
24445 double in 128-bit long double value is properly rounded when comparing
24446 values and converting to double. Use XL symbol names for long double
24447 support routines.
24448
24449 The AIX calling convention was extended but not initially documented to
24450 handle an obscure K&R C case of calling a function that takes the
24451 address of its arguments with fewer arguments than declared. IBM XL
24452 compilers access floating-point arguments that do not fit in the
24453 RSA from the stack when a subroutine is compiled without
24454 optimization. Because always storing floating-point arguments on the
24455 stack is inefficient and rarely needed, this option is not enabled by
24456 default and only is necessary when calling subroutines compiled by IBM
24457 XL compilers without optimization.
24458
24459 @item -mpe
24460 @opindex mpe
24461 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24462 application written to use message passing with special startup code to
24463 enable the application to run. The system must have PE installed in the
24464 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24465 must be overridden with the @option{-specs=} option to specify the
24466 appropriate directory location. The Parallel Environment does not
24467 support threads, so the @option{-mpe} option and the @option{-pthread}
24468 option are incompatible.
24469
24470 @item -malign-natural
24471 @itemx -malign-power
24472 @opindex malign-natural
24473 @opindex malign-power
24474 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24475 @option{-malign-natural} overrides the ABI-defined alignment of larger
24476 types, such as floating-point doubles, on their natural size-based boundary.
24477 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24478 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24479
24480 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24481 is not supported.
24482
24483 @item -msoft-float
24484 @itemx -mhard-float
24485 @opindex msoft-float
24486 @opindex mhard-float
24487 Generate code that does not use (uses) the floating-point register set.
24488 Software floating-point emulation is provided if you use the
24489 @option{-msoft-float} option, and pass the option to GCC when linking.
24490
24491 @item -mmultiple
24492 @itemx -mno-multiple
24493 @opindex mmultiple
24494 @opindex mno-multiple
24495 Generate code that uses (does not use) the load multiple word
24496 instructions and the store multiple word instructions. These
24497 instructions are generated by default on POWER systems, and not
24498 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24499 PowerPC systems, since those instructions do not work when the
24500 processor is in little-endian mode. The exceptions are PPC740 and
24501 PPC750 which permit these instructions in little-endian mode.
24502
24503 @item -mupdate
24504 @itemx -mno-update
24505 @opindex mupdate
24506 @opindex mno-update
24507 Generate code that uses (does not use) the load or store instructions
24508 that update the base register to the address of the calculated memory
24509 location. These instructions are generated by default. If you use
24510 @option{-mno-update}, there is a small window between the time that the
24511 stack pointer is updated and the address of the previous frame is
24512 stored, which means code that walks the stack frame across interrupts or
24513 signals may get corrupted data.
24514
24515 @item -mavoid-indexed-addresses
24516 @itemx -mno-avoid-indexed-addresses
24517 @opindex mavoid-indexed-addresses
24518 @opindex mno-avoid-indexed-addresses
24519 Generate code that tries to avoid (not avoid) the use of indexed load
24520 or store instructions. These instructions can incur a performance
24521 penalty on Power6 processors in certain situations, such as when
24522 stepping through large arrays that cross a 16M boundary. This option
24523 is enabled by default when targeting Power6 and disabled otherwise.
24524
24525 @item -mfused-madd
24526 @itemx -mno-fused-madd
24527 @opindex mfused-madd
24528 @opindex mno-fused-madd
24529 Generate code that uses (does not use) the floating-point multiply and
24530 accumulate instructions. These instructions are generated by default
24531 if hardware floating point is used. The machine-dependent
24532 @option{-mfused-madd} option is now mapped to the machine-independent
24533 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24534 mapped to @option{-ffp-contract=off}.
24535
24536 @item -mmulhw
24537 @itemx -mno-mulhw
24538 @opindex mmulhw
24539 @opindex mno-mulhw
24540 Generate code that uses (does not use) the half-word multiply and
24541 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24542 These instructions are generated by default when targeting those
24543 processors.
24544
24545 @item -mdlmzb
24546 @itemx -mno-dlmzb
24547 @opindex mdlmzb
24548 @opindex mno-dlmzb
24549 Generate code that uses (does not use) the string-search @samp{dlmzb}
24550 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24551 generated by default when targeting those processors.
24552
24553 @item -mno-bit-align
24554 @itemx -mbit-align
24555 @opindex mno-bit-align
24556 @opindex mbit-align
24557 On System V.4 and embedded PowerPC systems do not (do) force structures
24558 and unions that contain bit-fields to be aligned to the base type of the
24559 bit-field.
24560
24561 For example, by default a structure containing nothing but 8
24562 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24563 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24564 the structure is aligned to a 1-byte boundary and is 1 byte in
24565 size.
24566
24567 @item -mno-strict-align
24568 @itemx -mstrict-align
24569 @opindex mno-strict-align
24570 @opindex mstrict-align
24571 On System V.4 and embedded PowerPC systems do not (do) assume that
24572 unaligned memory references are handled by the system.
24573
24574 @item -mrelocatable
24575 @itemx -mno-relocatable
24576 @opindex mrelocatable
24577 @opindex mno-relocatable
24578 Generate code that allows (does not allow) a static executable to be
24579 relocated to a different address at run time. A simple embedded
24580 PowerPC system loader should relocate the entire contents of
24581 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24582 a table of 32-bit addresses generated by this option. For this to
24583 work, all objects linked together must be compiled with
24584 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24585 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24586
24587 @item -mrelocatable-lib
24588 @itemx -mno-relocatable-lib
24589 @opindex mrelocatable-lib
24590 @opindex mno-relocatable-lib
24591 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24592 @code{.fixup} section to allow static executables to be relocated at
24593 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24594 alignment of @option{-mrelocatable}. Objects compiled with
24595 @option{-mrelocatable-lib} may be linked with objects compiled with
24596 any combination of the @option{-mrelocatable} options.
24597
24598 @item -mno-toc
24599 @itemx -mtoc
24600 @opindex mno-toc
24601 @opindex mtoc
24602 On System V.4 and embedded PowerPC systems do not (do) assume that
24603 register 2 contains a pointer to a global area pointing to the addresses
24604 used in the program.
24605
24606 @item -mlittle
24607 @itemx -mlittle-endian
24608 @opindex mlittle
24609 @opindex mlittle-endian
24610 On System V.4 and embedded PowerPC systems compile code for the
24611 processor in little-endian mode. The @option{-mlittle-endian} option is
24612 the same as @option{-mlittle}.
24613
24614 @item -mbig
24615 @itemx -mbig-endian
24616 @opindex mbig
24617 @opindex mbig-endian
24618 On System V.4 and embedded PowerPC systems compile code for the
24619 processor in big-endian mode. The @option{-mbig-endian} option is
24620 the same as @option{-mbig}.
24621
24622 @item -mdynamic-no-pic
24623 @opindex mdynamic-no-pic
24624 On Darwin and Mac OS X systems, compile code so that it is not
24625 relocatable, but that its external references are relocatable. The
24626 resulting code is suitable for applications, but not shared
24627 libraries.
24628
24629 @item -msingle-pic-base
24630 @opindex msingle-pic-base
24631 Treat the register used for PIC addressing as read-only, rather than
24632 loading it in the prologue for each function. The runtime system is
24633 responsible for initializing this register with an appropriate value
24634 before execution begins.
24635
24636 @item -mprioritize-restricted-insns=@var{priority}
24637 @opindex mprioritize-restricted-insns
24638 This option controls the priority that is assigned to
24639 dispatch-slot restricted instructions during the second scheduling
24640 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24641 or @samp{2} to assign no, highest, or second-highest (respectively)
24642 priority to dispatch-slot restricted
24643 instructions.
24644
24645 @item -msched-costly-dep=@var{dependence_type}
24646 @opindex msched-costly-dep
24647 This option controls which dependences are considered costly
24648 by the target during instruction scheduling. The argument
24649 @var{dependence_type} takes one of the following values:
24650
24651 @table @asis
24652 @item @samp{no}
24653 No dependence is costly.
24654
24655 @item @samp{all}
24656 All dependences are costly.
24657
24658 @item @samp{true_store_to_load}
24659 A true dependence from store to load is costly.
24660
24661 @item @samp{store_to_load}
24662 Any dependence from store to load is costly.
24663
24664 @item @var{number}
24665 Any dependence for which the latency is greater than or equal to
24666 @var{number} is costly.
24667 @end table
24668
24669 @item -minsert-sched-nops=@var{scheme}
24670 @opindex minsert-sched-nops
24671 This option controls which NOP insertion scheme is used during
24672 the second scheduling pass. The argument @var{scheme} takes one of the
24673 following values:
24674
24675 @table @asis
24676 @item @samp{no}
24677 Don't insert NOPs.
24678
24679 @item @samp{pad}
24680 Pad with NOPs any dispatch group that has vacant issue slots,
24681 according to the scheduler's grouping.
24682
24683 @item @samp{regroup_exact}
24684 Insert NOPs to force costly dependent insns into
24685 separate groups. Insert exactly as many NOPs as needed to force an insn
24686 to a new group, according to the estimated processor grouping.
24687
24688 @item @var{number}
24689 Insert NOPs to force costly dependent insns into
24690 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24691 @end table
24692
24693 @item -mcall-sysv
24694 @opindex mcall-sysv
24695 On System V.4 and embedded PowerPC systems compile code using calling
24696 conventions that adhere to the March 1995 draft of the System V
24697 Application Binary Interface, PowerPC processor supplement. This is the
24698 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24699
24700 @item -mcall-sysv-eabi
24701 @itemx -mcall-eabi
24702 @opindex mcall-sysv-eabi
24703 @opindex mcall-eabi
24704 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24705
24706 @item -mcall-sysv-noeabi
24707 @opindex mcall-sysv-noeabi
24708 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24709
24710 @item -mcall-aixdesc
24711 @opindex m
24712 On System V.4 and embedded PowerPC systems compile code for the AIX
24713 operating system.
24714
24715 @item -mcall-linux
24716 @opindex mcall-linux
24717 On System V.4 and embedded PowerPC systems compile code for the
24718 Linux-based GNU system.
24719
24720 @item -mcall-freebsd
24721 @opindex mcall-freebsd
24722 On System V.4 and embedded PowerPC systems compile code for the
24723 FreeBSD operating system.
24724
24725 @item -mcall-netbsd
24726 @opindex mcall-netbsd
24727 On System V.4 and embedded PowerPC systems compile code for the
24728 NetBSD operating system.
24729
24730 @item -mcall-openbsd
24731 @opindex mcall-netbsd
24732 On System V.4 and embedded PowerPC systems compile code for the
24733 OpenBSD operating system.
24734
24735 @item -mtraceback=@var{traceback_type}
24736 @opindex mtraceback
24737 Select the type of traceback table. Valid values for @var{traceback_type}
24738 are @samp{full}, @samp{part}, and @samp{no}.
24739
24740 @item -maix-struct-return
24741 @opindex maix-struct-return
24742 Return all structures in memory (as specified by the AIX ABI)@.
24743
24744 @item -msvr4-struct-return
24745 @opindex msvr4-struct-return
24746 Return structures smaller than 8 bytes in registers (as specified by the
24747 SVR4 ABI)@.
24748
24749 @item -mabi=@var{abi-type}
24750 @opindex mabi
24751 Extend the current ABI with a particular extension, or remove such extension.
24752 Valid values are @samp{altivec}, @samp{no-altivec},
24753 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24754 @samp{elfv1}, @samp{elfv2}@.
24755
24756 @item -mabi=ibmlongdouble
24757 @opindex mabi=ibmlongdouble
24758 Change the current ABI to use IBM extended-precision long double.
24759 This is not likely to work if your system defaults to using IEEE
24760 extended-precision long double. If you change the long double type
24761 from IEEE extended-precision, the compiler will issue a warning unless
24762 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24763 to be enabled.
24764
24765 @item -mabi=ieeelongdouble
24766 @opindex mabi=ieeelongdouble
24767 Change the current ABI to use IEEE extended-precision long double.
24768 This is not likely to work if your system defaults to using IBM
24769 extended-precision long double. If you change the long double type
24770 from IBM extended-precision, the compiler will issue a warning unless
24771 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24772 to be enabled.
24773
24774 @item -mabi=elfv1
24775 @opindex mabi=elfv1
24776 Change the current ABI to use the ELFv1 ABI.
24777 This is the default ABI for big-endian PowerPC 64-bit Linux.
24778 Overriding the default ABI requires special system support and is
24779 likely to fail in spectacular ways.
24780
24781 @item -mabi=elfv2
24782 @opindex mabi=elfv2
24783 Change the current ABI to use the ELFv2 ABI.
24784 This is the default ABI for little-endian PowerPC 64-bit Linux.
24785 Overriding the default ABI requires special system support and is
24786 likely to fail in spectacular ways.
24787
24788 @item -mgnu-attribute
24789 @itemx -mno-gnu-attribute
24790 @opindex mgnu-attribute
24791 @opindex mno-gnu-attribute
24792 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24793 .gnu.attributes section that specify ABI variations in function
24794 parameters or return values.
24795
24796 @item -mprototype
24797 @itemx -mno-prototype
24798 @opindex mprototype
24799 @opindex mno-prototype
24800 On System V.4 and embedded PowerPC systems assume that all calls to
24801 variable argument functions are properly prototyped. Otherwise, the
24802 compiler must insert an instruction before every non-prototyped call to
24803 set or clear bit 6 of the condition code register (@code{CR}) to
24804 indicate whether floating-point values are passed in the floating-point
24805 registers in case the function takes variable arguments. With
24806 @option{-mprototype}, only calls to prototyped variable argument functions
24807 set or clear the bit.
24808
24809 @item -msim
24810 @opindex msim
24811 On embedded PowerPC systems, assume that the startup module is called
24812 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24813 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24814 configurations.
24815
24816 @item -mmvme
24817 @opindex mmvme
24818 On embedded PowerPC systems, assume that the startup module is called
24819 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24820 @file{libc.a}.
24821
24822 @item -mads
24823 @opindex mads
24824 On embedded PowerPC systems, assume that the startup module is called
24825 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24826 @file{libc.a}.
24827
24828 @item -myellowknife
24829 @opindex myellowknife
24830 On embedded PowerPC systems, assume that the startup module is called
24831 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24832 @file{libc.a}.
24833
24834 @item -mvxworks
24835 @opindex mvxworks
24836 On System V.4 and embedded PowerPC systems, specify that you are
24837 compiling for a VxWorks system.
24838
24839 @item -memb
24840 @opindex memb
24841 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24842 header to indicate that @samp{eabi} extended relocations are used.
24843
24844 @item -meabi
24845 @itemx -mno-eabi
24846 @opindex meabi
24847 @opindex mno-eabi
24848 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24849 Embedded Applications Binary Interface (EABI), which is a set of
24850 modifications to the System V.4 specifications. Selecting @option{-meabi}
24851 means that the stack is aligned to an 8-byte boundary, a function
24852 @code{__eabi} is called from @code{main} to set up the EABI
24853 environment, and the @option{-msdata} option can use both @code{r2} and
24854 @code{r13} to point to two separate small data areas. Selecting
24855 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24856 no EABI initialization function is called from @code{main}, and the
24857 @option{-msdata} option only uses @code{r13} to point to a single
24858 small data area. The @option{-meabi} option is on by default if you
24859 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24860
24861 @item -msdata=eabi
24862 @opindex msdata=eabi
24863 On System V.4 and embedded PowerPC systems, put small initialized
24864 @code{const} global and static data in the @code{.sdata2} section, which
24865 is pointed to by register @code{r2}. Put small initialized
24866 non-@code{const} global and static data in the @code{.sdata} section,
24867 which is pointed to by register @code{r13}. Put small uninitialized
24868 global and static data in the @code{.sbss} section, which is adjacent to
24869 the @code{.sdata} section. The @option{-msdata=eabi} option is
24870 incompatible with the @option{-mrelocatable} option. The
24871 @option{-msdata=eabi} option also sets the @option{-memb} option.
24872
24873 @item -msdata=sysv
24874 @opindex msdata=sysv
24875 On System V.4 and embedded PowerPC systems, put small global and static
24876 data in the @code{.sdata} section, which is pointed to by register
24877 @code{r13}. Put small uninitialized global and static data in the
24878 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24879 The @option{-msdata=sysv} option is incompatible with the
24880 @option{-mrelocatable} option.
24881
24882 @item -msdata=default
24883 @itemx -msdata
24884 @opindex msdata=default
24885 @opindex msdata
24886 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24887 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24888 same as @option{-msdata=sysv}.
24889
24890 @item -msdata=data
24891 @opindex msdata=data
24892 On System V.4 and embedded PowerPC systems, put small global
24893 data in the @code{.sdata} section. Put small uninitialized global
24894 data in the @code{.sbss} section. Do not use register @code{r13}
24895 to address small data however. This is the default behavior unless
24896 other @option{-msdata} options are used.
24897
24898 @item -msdata=none
24899 @itemx -mno-sdata
24900 @opindex msdata=none
24901 @opindex mno-sdata
24902 On embedded PowerPC systems, put all initialized global and static data
24903 in the @code{.data} section, and all uninitialized data in the
24904 @code{.bss} section.
24905
24906 @item -mreadonly-in-sdata
24907 @opindex mreadonly-in-sdata
24908 @opindex mno-readonly-in-sdata
24909 Put read-only objects in the @code{.sdata} section as well. This is the
24910 default.
24911
24912 @item -mblock-move-inline-limit=@var{num}
24913 @opindex mblock-move-inline-limit
24914 Inline all block moves (such as calls to @code{memcpy} or structure
24915 copies) less than or equal to @var{num} bytes. The minimum value for
24916 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24917 targets. The default value is target-specific.
24918
24919 @item -mblock-compare-inline-limit=@var{num}
24920 @opindex mblock-compare-inline-limit
24921 Generate non-looping inline code for all block compares (such as calls
24922 to @code{memcmp} or structure compares) less than or equal to @var{num}
24923 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24924 block compare is disabled. The default value is target-specific.
24925
24926 @item -mblock-compare-inline-loop-limit=@var{num}
24927 @opindex mblock-compare-inline-loop-limit
24928 Generate an inline expansion using loop code for all block compares that
24929 are less than or equal to @var{num} bytes, but greater than the limit
24930 for non-loop inline block compare expansion. If the block length is not
24931 constant, at most @var{num} bytes will be compared before @code{memcmp}
24932 is called to compare the remainder of the block. The default value is
24933 target-specific.
24934
24935 @item -mstring-compare-inline-limit=@var{num}
24936 @opindex mstring-compare-inline-limit
24937 Compare at most @var{num} string bytes with inline code.
24938 If the difference or end of string is not found at the
24939 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24940 take care of the rest of the comparison. The default is 64 bytes.
24941
24942 @item -G @var{num}
24943 @opindex G
24944 @cindex smaller data references (PowerPC)
24945 @cindex .sdata/.sdata2 references (PowerPC)
24946 On embedded PowerPC systems, put global and static items less than or
24947 equal to @var{num} bytes into the small data or BSS sections instead of
24948 the normal data or BSS section. By default, @var{num} is 8. The
24949 @option{-G @var{num}} switch is also passed to the linker.
24950 All modules should be compiled with the same @option{-G @var{num}} value.
24951
24952 @item -mregnames
24953 @itemx -mno-regnames
24954 @opindex mregnames
24955 @opindex mno-regnames
24956 On System V.4 and embedded PowerPC systems do (do not) emit register
24957 names in the assembly language output using symbolic forms.
24958
24959 @item -mlongcall
24960 @itemx -mno-longcall
24961 @opindex mlongcall
24962 @opindex mno-longcall
24963 By default assume that all calls are far away so that a longer and more
24964 expensive calling sequence is required. This is required for calls
24965 farther than 32 megabytes (33,554,432 bytes) from the current location.
24966 A short call is generated if the compiler knows
24967 the call cannot be that far away. This setting can be overridden by
24968 the @code{shortcall} function attribute, or by @code{#pragma
24969 longcall(0)}.
24970
24971 Some linkers are capable of detecting out-of-range calls and generating
24972 glue code on the fly. On these systems, long calls are unnecessary and
24973 generate slower code. As of this writing, the AIX linker can do this,
24974 as can the GNU linker for PowerPC/64. It is planned to add this feature
24975 to the GNU linker for 32-bit PowerPC systems as well.
24976
24977 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
24978 GCC can generate long calls using an inline PLT call sequence (see
24979 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
24980 ELFv1 (big-endian) do not support inline PLT calls.
24981
24982 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
24983 callee, L42}, plus a @dfn{branch island} (glue code). The two target
24984 addresses represent the callee and the branch island. The
24985 Darwin/PPC linker prefers the first address and generates a @code{bl
24986 callee} if the PPC @code{bl} instruction reaches the callee directly;
24987 otherwise, the linker generates @code{bl L42} to call the branch
24988 island. The branch island is appended to the body of the
24989 calling function; it computes the full 32-bit address of the callee
24990 and jumps to it.
24991
24992 On Mach-O (Darwin) systems, this option directs the compiler emit to
24993 the glue for every direct call, and the Darwin linker decides whether
24994 to use or discard it.
24995
24996 In the future, GCC may ignore all longcall specifications
24997 when the linker is known to generate glue.
24998
24999 @item -mpltseq
25000 @itemx -mno-pltseq
25001 @opindex mpltseq
25002 @opindex mno-pltseq
25003 Implement (do not implement) -fno-plt and long calls using an inline
25004 PLT call sequence that supports lazy linking and long calls to
25005 functions in dlopen'd shared libraries. Inline PLT calls are only
25006 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25007 linkers, and are enabled by default if the support is detected when
25008 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25009 configured with @option{--enable-secureplt}. @option{-mpltseq} code
25010 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25011 linked together.
25012
25013 @item -mtls-markers
25014 @itemx -mno-tls-markers
25015 @opindex mtls-markers
25016 @opindex mno-tls-markers
25017 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25018 specifying the function argument. The relocation allows the linker to
25019 reliably associate function call with argument setup instructions for
25020 TLS optimization, which in turn allows GCC to better schedule the
25021 sequence.
25022
25023 @item -mrecip
25024 @itemx -mno-recip
25025 @opindex mrecip
25026 This option enables use of the reciprocal estimate and
25027 reciprocal square root estimate instructions with additional
25028 Newton-Raphson steps to increase precision instead of doing a divide or
25029 square root and divide for floating-point arguments. You should use
25030 the @option{-ffast-math} option when using @option{-mrecip} (or at
25031 least @option{-funsafe-math-optimizations},
25032 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25033 @option{-fno-trapping-math}). Note that while the throughput of the
25034 sequence is generally higher than the throughput of the non-reciprocal
25035 instruction, the precision of the sequence can be decreased by up to 2
25036 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25037 roots.
25038
25039 @item -mrecip=@var{opt}
25040 @opindex mrecip=opt
25041 This option controls which reciprocal estimate instructions
25042 may be used. @var{opt} is a comma-separated list of options, which may
25043 be preceded by a @code{!} to invert the option:
25044
25045 @table @samp
25046
25047 @item all
25048 Enable all estimate instructions.
25049
25050 @item default
25051 Enable the default instructions, equivalent to @option{-mrecip}.
25052
25053 @item none
25054 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25055
25056 @item div
25057 Enable the reciprocal approximation instructions for both
25058 single and double precision.
25059
25060 @item divf
25061 Enable the single-precision reciprocal approximation instructions.
25062
25063 @item divd
25064 Enable the double-precision reciprocal approximation instructions.
25065
25066 @item rsqrt
25067 Enable the reciprocal square root approximation instructions for both
25068 single and double precision.
25069
25070 @item rsqrtf
25071 Enable the single-precision reciprocal square root approximation instructions.
25072
25073 @item rsqrtd
25074 Enable the double-precision reciprocal square root approximation instructions.
25075
25076 @end table
25077
25078 So, for example, @option{-mrecip=all,!rsqrtd} enables
25079 all of the reciprocal estimate instructions, except for the
25080 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25081 which handle the double-precision reciprocal square root calculations.
25082
25083 @item -mrecip-precision
25084 @itemx -mno-recip-precision
25085 @opindex mrecip-precision
25086 Assume (do not assume) that the reciprocal estimate instructions
25087 provide higher-precision estimates than is mandated by the PowerPC
25088 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25089 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25090 The double-precision square root estimate instructions are not generated by
25091 default on low-precision machines, since they do not provide an
25092 estimate that converges after three steps.
25093
25094 @item -mveclibabi=@var{type}
25095 @opindex mveclibabi
25096 Specifies the ABI type to use for vectorizing intrinsics using an
25097 external library. The only type supported at present is @samp{mass},
25098 which specifies to use IBM's Mathematical Acceleration Subsystem
25099 (MASS) libraries for vectorizing intrinsics using external libraries.
25100 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25101 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25102 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25103 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25104 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25105 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25106 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25107 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25108 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25109 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25110 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25111 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25112 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25113 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25114 for power7. Both @option{-ftree-vectorize} and
25115 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25116 libraries must be specified at link time.
25117
25118 @item -mfriz
25119 @itemx -mno-friz
25120 @opindex mfriz
25121 Generate (do not generate) the @code{friz} instruction when the
25122 @option{-funsafe-math-optimizations} option is used to optimize
25123 rounding of floating-point values to 64-bit integer and back to floating
25124 point. The @code{friz} instruction does not return the same value if
25125 the floating-point number is too large to fit in an integer.
25126
25127 @item -mpointers-to-nested-functions
25128 @itemx -mno-pointers-to-nested-functions
25129 @opindex mpointers-to-nested-functions
25130 Generate (do not generate) code to load up the static chain register
25131 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25132 systems where a function pointer points to a 3-word descriptor giving
25133 the function address, TOC value to be loaded in register @code{r2}, and
25134 static chain value to be loaded in register @code{r11}. The
25135 @option{-mpointers-to-nested-functions} is on by default. You cannot
25136 call through pointers to nested functions or pointers
25137 to functions compiled in other languages that use the static chain if
25138 you use @option{-mno-pointers-to-nested-functions}.
25139
25140 @item -msave-toc-indirect
25141 @itemx -mno-save-toc-indirect
25142 @opindex msave-toc-indirect
25143 Generate (do not generate) code to save the TOC value in the reserved
25144 stack location in the function prologue if the function calls through
25145 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25146 saved in the prologue, it is saved just before the call through the
25147 pointer. The @option{-mno-save-toc-indirect} option is the default.
25148
25149 @item -mcompat-align-parm
25150 @itemx -mno-compat-align-parm
25151 @opindex mcompat-align-parm
25152 Generate (do not generate) code to pass structure parameters with a
25153 maximum alignment of 64 bits, for compatibility with older versions
25154 of GCC.
25155
25156 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25157 structure parameter on a 128-bit boundary when that structure contained
25158 a member requiring 128-bit alignment. This is corrected in more
25159 recent versions of GCC. This option may be used to generate code
25160 that is compatible with functions compiled with older versions of
25161 GCC.
25162
25163 The @option{-mno-compat-align-parm} option is the default.
25164
25165 @item -mstack-protector-guard=@var{guard}
25166 @itemx -mstack-protector-guard-reg=@var{reg}
25167 @itemx -mstack-protector-guard-offset=@var{offset}
25168 @itemx -mstack-protector-guard-symbol=@var{symbol}
25169 @opindex mstack-protector-guard
25170 @opindex mstack-protector-guard-reg
25171 @opindex mstack-protector-guard-offset
25172 @opindex mstack-protector-guard-symbol
25173 Generate stack protection code using canary at @var{guard}. Supported
25174 locations are @samp{global} for global canary or @samp{tls} for per-thread
25175 canary in the TLS block (the default with GNU libc version 2.4 or later).
25176
25177 With the latter choice the options
25178 @option{-mstack-protector-guard-reg=@var{reg}} and
25179 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25180 which register to use as base register for reading the canary, and from what
25181 offset from that base register. The default for those is as specified in the
25182 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25183 the offset with a symbol reference to a canary in the TLS block.
25184
25185 @item -mpcrel
25186 @itemx -mno-pcrel
25187 @opindex mpcrel
25188 @opindex mno-pcrel
25189 Generate (do not generate) pc-relative addressing when the option
25190 @option{-mcpu=future} is used.
25191 @end table
25192
25193 @node RX Options
25194 @subsection RX Options
25195 @cindex RX Options
25196
25197 These command-line options are defined for RX targets:
25198
25199 @table @gcctabopt
25200 @item -m64bit-doubles
25201 @itemx -m32bit-doubles
25202 @opindex m64bit-doubles
25203 @opindex m32bit-doubles
25204 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25205 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25206 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25207 works on 32-bit values, which is why the default is
25208 @option{-m32bit-doubles}.
25209
25210 @item -fpu
25211 @itemx -nofpu
25212 @opindex fpu
25213 @opindex nofpu
25214 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25215 floating-point hardware. The default is enabled for the RX600
25216 series and disabled for the RX200 series.
25217
25218 Floating-point instructions are only generated for 32-bit floating-point
25219 values, however, so the FPU hardware is not used for doubles if the
25220 @option{-m64bit-doubles} option is used.
25221
25222 @emph{Note} If the @option{-fpu} option is enabled then
25223 @option{-funsafe-math-optimizations} is also enabled automatically.
25224 This is because the RX FPU instructions are themselves unsafe.
25225
25226 @item -mcpu=@var{name}
25227 @opindex mcpu
25228 Selects the type of RX CPU to be targeted. Currently three types are
25229 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25230 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25231
25232 The only difference between @samp{RX600} and @samp{RX610} is that the
25233 @samp{RX610} does not support the @code{MVTIPL} instruction.
25234
25235 The @samp{RX200} series does not have a hardware floating-point unit
25236 and so @option{-nofpu} is enabled by default when this type is
25237 selected.
25238
25239 @item -mbig-endian-data
25240 @itemx -mlittle-endian-data
25241 @opindex mbig-endian-data
25242 @opindex mlittle-endian-data
25243 Store data (but not code) in the big-endian format. The default is
25244 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25245 format.
25246
25247 @item -msmall-data-limit=@var{N}
25248 @opindex msmall-data-limit
25249 Specifies the maximum size in bytes of global and static variables
25250 which can be placed into the small data area. Using the small data
25251 area can lead to smaller and faster code, but the size of area is
25252 limited and it is up to the programmer to ensure that the area does
25253 not overflow. Also when the small data area is used one of the RX's
25254 registers (usually @code{r13}) is reserved for use pointing to this
25255 area, so it is no longer available for use by the compiler. This
25256 could result in slower and/or larger code if variables are pushed onto
25257 the stack instead of being held in this register.
25258
25259 Note, common variables (variables that have not been initialized) and
25260 constants are not placed into the small data area as they are assigned
25261 to other sections in the output executable.
25262
25263 The default value is zero, which disables this feature. Note, this
25264 feature is not enabled by default with higher optimization levels
25265 (@option{-O2} etc) because of the potentially detrimental effects of
25266 reserving a register. It is up to the programmer to experiment and
25267 discover whether this feature is of benefit to their program. See the
25268 description of the @option{-mpid} option for a description of how the
25269 actual register to hold the small data area pointer is chosen.
25270
25271 @item -msim
25272 @itemx -mno-sim
25273 @opindex msim
25274 @opindex mno-sim
25275 Use the simulator runtime. The default is to use the libgloss
25276 board-specific runtime.
25277
25278 @item -mas100-syntax
25279 @itemx -mno-as100-syntax
25280 @opindex mas100-syntax
25281 @opindex mno-as100-syntax
25282 When generating assembler output use a syntax that is compatible with
25283 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25284 assembler, but it has some restrictions so it is not generated by default.
25285
25286 @item -mmax-constant-size=@var{N}
25287 @opindex mmax-constant-size
25288 Specifies the maximum size, in bytes, of a constant that can be used as
25289 an operand in a RX instruction. Although the RX instruction set does
25290 allow constants of up to 4 bytes in length to be used in instructions,
25291 a longer value equates to a longer instruction. Thus in some
25292 circumstances it can be beneficial to restrict the size of constants
25293 that are used in instructions. Constants that are too big are instead
25294 placed into a constant pool and referenced via register indirection.
25295
25296 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25297 or 4 means that constants of any size are allowed.
25298
25299 @item -mrelax
25300 @opindex mrelax
25301 Enable linker relaxation. Linker relaxation is a process whereby the
25302 linker attempts to reduce the size of a program by finding shorter
25303 versions of various instructions. Disabled by default.
25304
25305 @item -mint-register=@var{N}
25306 @opindex mint-register
25307 Specify the number of registers to reserve for fast interrupt handler
25308 functions. The value @var{N} can be between 0 and 4. A value of 1
25309 means that register @code{r13} is reserved for the exclusive use
25310 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25311 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25312 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25313 A value of 0, the default, does not reserve any registers.
25314
25315 @item -msave-acc-in-interrupts
25316 @opindex msave-acc-in-interrupts
25317 Specifies that interrupt handler functions should preserve the
25318 accumulator register. This is only necessary if normal code might use
25319 the accumulator register, for example because it performs 64-bit
25320 multiplications. The default is to ignore the accumulator as this
25321 makes the interrupt handlers faster.
25322
25323 @item -mpid
25324 @itemx -mno-pid
25325 @opindex mpid
25326 @opindex mno-pid
25327 Enables the generation of position independent data. When enabled any
25328 access to constant data is done via an offset from a base address
25329 held in a register. This allows the location of constant data to be
25330 determined at run time without requiring the executable to be
25331 relocated, which is a benefit to embedded applications with tight
25332 memory constraints. Data that can be modified is not affected by this
25333 option.
25334
25335 Note, using this feature reserves a register, usually @code{r13}, for
25336 the constant data base address. This can result in slower and/or
25337 larger code, especially in complicated functions.
25338
25339 The actual register chosen to hold the constant data base address
25340 depends upon whether the @option{-msmall-data-limit} and/or the
25341 @option{-mint-register} command-line options are enabled. Starting
25342 with register @code{r13} and proceeding downwards, registers are
25343 allocated first to satisfy the requirements of @option{-mint-register},
25344 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25345 is possible for the small data area register to be @code{r8} if both
25346 @option{-mint-register=4} and @option{-mpid} are specified on the
25347 command line.
25348
25349 By default this feature is not enabled. The default can be restored
25350 via the @option{-mno-pid} command-line option.
25351
25352 @item -mno-warn-multiple-fast-interrupts
25353 @itemx -mwarn-multiple-fast-interrupts
25354 @opindex mno-warn-multiple-fast-interrupts
25355 @opindex mwarn-multiple-fast-interrupts
25356 Prevents GCC from issuing a warning message if it finds more than one
25357 fast interrupt handler when it is compiling a file. The default is to
25358 issue a warning for each extra fast interrupt handler found, as the RX
25359 only supports one such interrupt.
25360
25361 @item -mallow-string-insns
25362 @itemx -mno-allow-string-insns
25363 @opindex mallow-string-insns
25364 @opindex mno-allow-string-insns
25365 Enables or disables the use of the string manipulation instructions
25366 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25367 @code{SWHILE} and also the @code{RMPA} instruction. These
25368 instructions may prefetch data, which is not safe to do if accessing
25369 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25370 for more information).
25371
25372 The default is to allow these instructions, but it is not possible for
25373 GCC to reliably detect all circumstances where a string instruction
25374 might be used to access an I/O register, so their use cannot be
25375 disabled automatically. Instead it is reliant upon the programmer to
25376 use the @option{-mno-allow-string-insns} option if their program
25377 accesses I/O space.
25378
25379 When the instructions are enabled GCC defines the C preprocessor
25380 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25381 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25382
25383 @item -mjsr
25384 @itemx -mno-jsr
25385 @opindex mjsr
25386 @opindex mno-jsr
25387 Use only (or not only) @code{JSR} instructions to access functions.
25388 This option can be used when code size exceeds the range of @code{BSR}
25389 instructions. Note that @option{-mno-jsr} does not mean to not use
25390 @code{JSR} but instead means that any type of branch may be used.
25391 @end table
25392
25393 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25394 has special significance to the RX port when used with the
25395 @code{interrupt} function attribute. This attribute indicates a
25396 function intended to process fast interrupts. GCC ensures
25397 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25398 and/or @code{r13} and only provided that the normal use of the
25399 corresponding registers have been restricted via the
25400 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25401 options.
25402
25403 @node S/390 and zSeries Options
25404 @subsection S/390 and zSeries Options
25405 @cindex S/390 and zSeries Options
25406
25407 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25408
25409 @table @gcctabopt
25410 @item -mhard-float
25411 @itemx -msoft-float
25412 @opindex mhard-float
25413 @opindex msoft-float
25414 Use (do not use) the hardware floating-point instructions and registers
25415 for floating-point operations. When @option{-msoft-float} is specified,
25416 functions in @file{libgcc.a} are used to perform floating-point
25417 operations. When @option{-mhard-float} is specified, the compiler
25418 generates IEEE floating-point instructions. This is the default.
25419
25420 @item -mhard-dfp
25421 @itemx -mno-hard-dfp
25422 @opindex mhard-dfp
25423 @opindex mno-hard-dfp
25424 Use (do not use) the hardware decimal-floating-point instructions for
25425 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25426 specified, functions in @file{libgcc.a} are used to perform
25427 decimal-floating-point operations. When @option{-mhard-dfp} is
25428 specified, the compiler generates decimal-floating-point hardware
25429 instructions. This is the default for @option{-march=z9-ec} or higher.
25430
25431 @item -mlong-double-64
25432 @itemx -mlong-double-128
25433 @opindex mlong-double-64
25434 @opindex mlong-double-128
25435 These switches control the size of @code{long double} type. A size
25436 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25437 type. This is the default.
25438
25439 @item -mbackchain
25440 @itemx -mno-backchain
25441 @opindex mbackchain
25442 @opindex mno-backchain
25443 Store (do not store) the address of the caller's frame as backchain pointer
25444 into the callee's stack frame.
25445 A backchain may be needed to allow debugging using tools that do not understand
25446 DWARF call frame information.
25447 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25448 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25449 the backchain is placed into the topmost word of the 96/160 byte register
25450 save area.
25451
25452 In general, code compiled with @option{-mbackchain} is call-compatible with
25453 code compiled with @option{-mmo-backchain}; however, use of the backchain
25454 for debugging purposes usually requires that the whole binary is built with
25455 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25456 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25457 to build a linux kernel use @option{-msoft-float}.
25458
25459 The default is to not maintain the backchain.
25460
25461 @item -mpacked-stack
25462 @itemx -mno-packed-stack
25463 @opindex mpacked-stack
25464 @opindex mno-packed-stack
25465 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25466 specified, the compiler uses the all fields of the 96/160 byte register save
25467 area only for their default purpose; unused fields still take up stack space.
25468 When @option{-mpacked-stack} is specified, register save slots are densely
25469 packed at the top of the register save area; unused space is reused for other
25470 purposes, allowing for more efficient use of the available stack space.
25471 However, when @option{-mbackchain} is also in effect, the topmost word of
25472 the save area is always used to store the backchain, and the return address
25473 register is always saved two words below the backchain.
25474
25475 As long as the stack frame backchain is not used, code generated with
25476 @option{-mpacked-stack} is call-compatible with code generated with
25477 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25478 S/390 or zSeries generated code that uses the stack frame backchain at run
25479 time, not just for debugging purposes. Such code is not call-compatible
25480 with code compiled with @option{-mpacked-stack}. Also, note that the
25481 combination of @option{-mbackchain},
25482 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25483 to build a linux kernel use @option{-msoft-float}.
25484
25485 The default is to not use the packed stack layout.
25486
25487 @item -msmall-exec
25488 @itemx -mno-small-exec
25489 @opindex msmall-exec
25490 @opindex mno-small-exec
25491 Generate (or do not generate) code using the @code{bras} instruction
25492 to do subroutine calls.
25493 This only works reliably if the total executable size does not
25494 exceed 64k. The default is to use the @code{basr} instruction instead,
25495 which does not have this limitation.
25496
25497 @item -m64
25498 @itemx -m31
25499 @opindex m64
25500 @opindex m31
25501 When @option{-m31} is specified, generate code compliant to the
25502 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25503 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25504 particular to generate 64-bit instructions. For the @samp{s390}
25505 targets, the default is @option{-m31}, while the @samp{s390x}
25506 targets default to @option{-m64}.
25507
25508 @item -mzarch
25509 @itemx -mesa
25510 @opindex mzarch
25511 @opindex mesa
25512 When @option{-mzarch} is specified, generate code using the
25513 instructions available on z/Architecture.
25514 When @option{-mesa} is specified, generate code using the
25515 instructions available on ESA/390. Note that @option{-mesa} is
25516 not possible with @option{-m64}.
25517 When generating code compliant to the GNU/Linux for S/390 ABI,
25518 the default is @option{-mesa}. When generating code compliant
25519 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25520
25521 @item -mhtm
25522 @itemx -mno-htm
25523 @opindex mhtm
25524 @opindex mno-htm
25525 The @option{-mhtm} option enables a set of builtins making use of
25526 instructions available with the transactional execution facility
25527 introduced with the IBM zEnterprise EC12 machine generation
25528 @ref{S/390 System z Built-in Functions}.
25529 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25530
25531 @item -mvx
25532 @itemx -mno-vx
25533 @opindex mvx
25534 @opindex mno-vx
25535 When @option{-mvx} is specified, generate code using the instructions
25536 available with the vector extension facility introduced with the IBM
25537 z13 machine generation.
25538 This option changes the ABI for some vector type values with regard to
25539 alignment and calling conventions. In case vector type values are
25540 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25541 command will be added to mark the resulting binary with the ABI used.
25542 @option{-mvx} is enabled by default when using @option{-march=z13}.
25543
25544 @item -mzvector
25545 @itemx -mno-zvector
25546 @opindex mzvector
25547 @opindex mno-zvector
25548 The @option{-mzvector} option enables vector language extensions and
25549 builtins using instructions available with the vector extension
25550 facility introduced with the IBM z13 machine generation.
25551 This option adds support for @samp{vector} to be used as a keyword to
25552 define vector type variables and arguments. @samp{vector} is only
25553 available when GNU extensions are enabled. It will not be expanded
25554 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25555 In addition to the GCC low-level builtins @option{-mzvector} enables
25556 a set of builtins added for compatibility with AltiVec-style
25557 implementations like Power and Cell. In order to make use of these
25558 builtins the header file @file{vecintrin.h} needs to be included.
25559 @option{-mzvector} is disabled by default.
25560
25561 @item -mmvcle
25562 @itemx -mno-mvcle
25563 @opindex mmvcle
25564 @opindex mno-mvcle
25565 Generate (or do not generate) code using the @code{mvcle} instruction
25566 to perform block moves. When @option{-mno-mvcle} is specified,
25567 use a @code{mvc} loop instead. This is the default unless optimizing for
25568 size.
25569
25570 @item -mdebug
25571 @itemx -mno-debug
25572 @opindex mdebug
25573 @opindex mno-debug
25574 Print (or do not print) additional debug information when compiling.
25575 The default is to not print debug information.
25576
25577 @item -march=@var{cpu-type}
25578 @opindex march
25579 Generate code that runs on @var{cpu-type}, which is the name of a
25580 system representing a certain processor type. Possible values for
25581 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25582 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25583 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25584 @samp{z14}/@samp{arch12}, and @samp{native}.
25585
25586 The default is @option{-march=z900}.
25587
25588 Specifying @samp{native} as cpu type can be used to select the best
25589 architecture option for the host processor.
25590 @option{-march=native} has no effect if GCC does not recognize the
25591 processor.
25592
25593 @item -mtune=@var{cpu-type}
25594 @opindex mtune
25595 Tune to @var{cpu-type} everything applicable about the generated code,
25596 except for the ABI and the set of available instructions.
25597 The list of @var{cpu-type} values is the same as for @option{-march}.
25598 The default is the value used for @option{-march}.
25599
25600 @item -mtpf-trace
25601 @itemx -mno-tpf-trace
25602 @opindex mtpf-trace
25603 @opindex mno-tpf-trace
25604 Generate code that adds (does not add) in TPF OS specific branches to trace
25605 routines in the operating system. This option is off by default, even
25606 when compiling for the TPF OS@.
25607
25608 @item -mfused-madd
25609 @itemx -mno-fused-madd
25610 @opindex mfused-madd
25611 @opindex mno-fused-madd
25612 Generate code that uses (does not use) the floating-point multiply and
25613 accumulate instructions. These instructions are generated by default if
25614 hardware floating point is used.
25615
25616 @item -mwarn-framesize=@var{framesize}
25617 @opindex mwarn-framesize
25618 Emit a warning if the current function exceeds the given frame size. Because
25619 this is a compile-time check it doesn't need to be a real problem when the program
25620 runs. It is intended to identify functions that most probably cause
25621 a stack overflow. It is useful to be used in an environment with limited stack
25622 size e.g.@: the linux kernel.
25623
25624 @item -mwarn-dynamicstack
25625 @opindex mwarn-dynamicstack
25626 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25627 arrays. This is generally a bad idea with a limited stack size.
25628
25629 @item -mstack-guard=@var{stack-guard}
25630 @itemx -mstack-size=@var{stack-size}
25631 @opindex mstack-guard
25632 @opindex mstack-size
25633 If these options are provided the S/390 back end emits additional instructions in
25634 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25635 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25636 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25637 the frame size of the compiled function is chosen.
25638 These options are intended to be used to help debugging stack overflow problems.
25639 The additionally emitted code causes only little overhead and hence can also be
25640 used in production-like systems without greater performance degradation. The given
25641 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25642 @var{stack-guard} without exceeding 64k.
25643 In order to be efficient the extra code makes the assumption that the stack starts
25644 at an address aligned to the value given by @var{stack-size}.
25645 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25646
25647 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25648 @opindex mhotpatch
25649 If the hotpatch option is enabled, a ``hot-patching'' function
25650 prologue is generated for all functions in the compilation unit.
25651 The funtion label is prepended with the given number of two-byte
25652 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25653 the label, 2 * @var{post-halfwords} bytes are appended, using the
25654 largest NOP like instructions the architecture allows (maximum
25655 1000000).
25656
25657 If both arguments are zero, hotpatching is disabled.
25658
25659 This option can be overridden for individual functions with the
25660 @code{hotpatch} attribute.
25661 @end table
25662
25663 @node Score Options
25664 @subsection Score Options
25665 @cindex Score Options
25666
25667 These options are defined for Score implementations:
25668
25669 @table @gcctabopt
25670 @item -meb
25671 @opindex meb
25672 Compile code for big-endian mode. This is the default.
25673
25674 @item -mel
25675 @opindex mel
25676 Compile code for little-endian mode.
25677
25678 @item -mnhwloop
25679 @opindex mnhwloop
25680 Disable generation of @code{bcnz} instructions.
25681
25682 @item -muls
25683 @opindex muls
25684 Enable generation of unaligned load and store instructions.
25685
25686 @item -mmac
25687 @opindex mmac
25688 Enable the use of multiply-accumulate instructions. Disabled by default.
25689
25690 @item -mscore5
25691 @opindex mscore5
25692 Specify the SCORE5 as the target architecture.
25693
25694 @item -mscore5u
25695 @opindex mscore5u
25696 Specify the SCORE5U of the target architecture.
25697
25698 @item -mscore7
25699 @opindex mscore7
25700 Specify the SCORE7 as the target architecture. This is the default.
25701
25702 @item -mscore7d
25703 @opindex mscore7d
25704 Specify the SCORE7D as the target architecture.
25705 @end table
25706
25707 @node SH Options
25708 @subsection SH Options
25709
25710 These @samp{-m} options are defined for the SH implementations:
25711
25712 @table @gcctabopt
25713 @item -m1
25714 @opindex m1
25715 Generate code for the SH1.
25716
25717 @item -m2
25718 @opindex m2
25719 Generate code for the SH2.
25720
25721 @item -m2e
25722 Generate code for the SH2e.
25723
25724 @item -m2a-nofpu
25725 @opindex m2a-nofpu
25726 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25727 that the floating-point unit is not used.
25728
25729 @item -m2a-single-only
25730 @opindex m2a-single-only
25731 Generate code for the SH2a-FPU, in such a way that no double-precision
25732 floating-point operations are used.
25733
25734 @item -m2a-single
25735 @opindex m2a-single
25736 Generate code for the SH2a-FPU assuming the floating-point unit is in
25737 single-precision mode by default.
25738
25739 @item -m2a
25740 @opindex m2a
25741 Generate code for the SH2a-FPU assuming the floating-point unit is in
25742 double-precision mode by default.
25743
25744 @item -m3
25745 @opindex m3
25746 Generate code for the SH3.
25747
25748 @item -m3e
25749 @opindex m3e
25750 Generate code for the SH3e.
25751
25752 @item -m4-nofpu
25753 @opindex m4-nofpu
25754 Generate code for the SH4 without a floating-point unit.
25755
25756 @item -m4-single-only
25757 @opindex m4-single-only
25758 Generate code for the SH4 with a floating-point unit that only
25759 supports single-precision arithmetic.
25760
25761 @item -m4-single
25762 @opindex m4-single
25763 Generate code for the SH4 assuming the floating-point unit is in
25764 single-precision mode by default.
25765
25766 @item -m4
25767 @opindex m4
25768 Generate code for the SH4.
25769
25770 @item -m4-100
25771 @opindex m4-100
25772 Generate code for SH4-100.
25773
25774 @item -m4-100-nofpu
25775 @opindex m4-100-nofpu
25776 Generate code for SH4-100 in such a way that the
25777 floating-point unit is not used.
25778
25779 @item -m4-100-single
25780 @opindex m4-100-single
25781 Generate code for SH4-100 assuming the floating-point unit is in
25782 single-precision mode by default.
25783
25784 @item -m4-100-single-only
25785 @opindex m4-100-single-only
25786 Generate code for SH4-100 in such a way that no double-precision
25787 floating-point operations are used.
25788
25789 @item -m4-200
25790 @opindex m4-200
25791 Generate code for SH4-200.
25792
25793 @item -m4-200-nofpu
25794 @opindex m4-200-nofpu
25795 Generate code for SH4-200 without in such a way that the
25796 floating-point unit is not used.
25797
25798 @item -m4-200-single
25799 @opindex m4-200-single
25800 Generate code for SH4-200 assuming the floating-point unit is in
25801 single-precision mode by default.
25802
25803 @item -m4-200-single-only
25804 @opindex m4-200-single-only
25805 Generate code for SH4-200 in such a way that no double-precision
25806 floating-point operations are used.
25807
25808 @item -m4-300
25809 @opindex m4-300
25810 Generate code for SH4-300.
25811
25812 @item -m4-300-nofpu
25813 @opindex m4-300-nofpu
25814 Generate code for SH4-300 without in such a way that the
25815 floating-point unit is not used.
25816
25817 @item -m4-300-single
25818 @opindex m4-300-single
25819 Generate code for SH4-300 in such a way that no double-precision
25820 floating-point operations are used.
25821
25822 @item -m4-300-single-only
25823 @opindex m4-300-single-only
25824 Generate code for SH4-300 in such a way that no double-precision
25825 floating-point operations are used.
25826
25827 @item -m4-340
25828 @opindex m4-340
25829 Generate code for SH4-340 (no MMU, no FPU).
25830
25831 @item -m4-500
25832 @opindex m4-500
25833 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25834 assembler.
25835
25836 @item -m4a-nofpu
25837 @opindex m4a-nofpu
25838 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25839 floating-point unit is not used.
25840
25841 @item -m4a-single-only
25842 @opindex m4a-single-only
25843 Generate code for the SH4a, in such a way that no double-precision
25844 floating-point operations are used.
25845
25846 @item -m4a-single
25847 @opindex m4a-single
25848 Generate code for the SH4a assuming the floating-point unit is in
25849 single-precision mode by default.
25850
25851 @item -m4a
25852 @opindex m4a
25853 Generate code for the SH4a.
25854
25855 @item -m4al
25856 @opindex m4al
25857 Same as @option{-m4a-nofpu}, except that it implicitly passes
25858 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25859 instructions at the moment.
25860
25861 @item -mb
25862 @opindex mb
25863 Compile code for the processor in big-endian mode.
25864
25865 @item -ml
25866 @opindex ml
25867 Compile code for the processor in little-endian mode.
25868
25869 @item -mdalign
25870 @opindex mdalign
25871 Align doubles at 64-bit boundaries. Note that this changes the calling
25872 conventions, and thus some functions from the standard C library do
25873 not work unless you recompile it first with @option{-mdalign}.
25874
25875 @item -mrelax
25876 @opindex mrelax
25877 Shorten some address references at link time, when possible; uses the
25878 linker option @option{-relax}.
25879
25880 @item -mbigtable
25881 @opindex mbigtable
25882 Use 32-bit offsets in @code{switch} tables. The default is to use
25883 16-bit offsets.
25884
25885 @item -mbitops
25886 @opindex mbitops
25887 Enable the use of bit manipulation instructions on SH2A.
25888
25889 @item -mfmovd
25890 @opindex mfmovd
25891 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25892 alignment constraints.
25893
25894 @item -mrenesas
25895 @opindex mrenesas
25896 Comply with the calling conventions defined by Renesas.
25897
25898 @item -mno-renesas
25899 @opindex mno-renesas
25900 Comply with the calling conventions defined for GCC before the Renesas
25901 conventions were available. This option is the default for all
25902 targets of the SH toolchain.
25903
25904 @item -mnomacsave
25905 @opindex mnomacsave
25906 Mark the @code{MAC} register as call-clobbered, even if
25907 @option{-mrenesas} is given.
25908
25909 @item -mieee
25910 @itemx -mno-ieee
25911 @opindex mieee
25912 @opindex mno-ieee
25913 Control the IEEE compliance of floating-point comparisons, which affects the
25914 handling of cases where the result of a comparison is unordered. By default
25915 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25916 enabled @option{-mno-ieee} is implicitly set, which results in faster
25917 floating-point greater-equal and less-equal comparisons. The implicit settings
25918 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25919
25920 @item -minline-ic_invalidate
25921 @opindex minline-ic_invalidate
25922 Inline code to invalidate instruction cache entries after setting up
25923 nested function trampolines.
25924 This option has no effect if @option{-musermode} is in effect and the selected
25925 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
25926 instruction.
25927 If the selected code generation option does not allow the use of the @code{icbi}
25928 instruction, and @option{-musermode} is not in effect, the inlined code
25929 manipulates the instruction cache address array directly with an associative
25930 write. This not only requires privileged mode at run time, but it also
25931 fails if the cache line had been mapped via the TLB and has become unmapped.
25932
25933 @item -misize
25934 @opindex misize
25935 Dump instruction size and location in the assembly code.
25936
25937 @item -mpadstruct
25938 @opindex mpadstruct
25939 This option is deprecated. It pads structures to multiple of 4 bytes,
25940 which is incompatible with the SH ABI@.
25941
25942 @item -matomic-model=@var{model}
25943 @opindex matomic-model=@var{model}
25944 Sets the model of atomic operations and additional parameters as a comma
25945 separated list. For details on the atomic built-in functions see
25946 @ref{__atomic Builtins}. The following models and parameters are supported:
25947
25948 @table @samp
25949
25950 @item none
25951 Disable compiler generated atomic sequences and emit library calls for atomic
25952 operations. This is the default if the target is not @code{sh*-*-linux*}.
25953
25954 @item soft-gusa
25955 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25956 built-in functions. The generated atomic sequences require additional support
25957 from the interrupt/exception handling code of the system and are only suitable
25958 for SH3* and SH4* single-core systems. This option is enabled by default when
25959 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
25960 this option also partially utilizes the hardware atomic instructions
25961 @code{movli.l} and @code{movco.l} to create more efficient code, unless
25962 @samp{strict} is specified.
25963
25964 @item soft-tcb
25965 Generate software atomic sequences that use a variable in the thread control
25966 block. This is a variation of the gUSA sequences which can also be used on
25967 SH1* and SH2* targets. The generated atomic sequences require additional
25968 support from the interrupt/exception handling code of the system and are only
25969 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
25970 parameter has to be specified as well.
25971
25972 @item soft-imask
25973 Generate software atomic sequences that temporarily disable interrupts by
25974 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25975 in privileged mode and is only suitable for single-core systems. Additional
25976 support from the interrupt/exception handling code of the system is not
25977 required. This model is enabled by default when the target is
25978 @code{sh*-*-linux*} and SH1* or SH2*.
25979
25980 @item hard-llcs
25981 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25982 instructions only. This is only available on SH4A and is suitable for
25983 multi-core systems. Since the hardware instructions support only 32 bit atomic
25984 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25985 Code compiled with this option is also compatible with other software
25986 atomic model interrupt/exception handling systems if executed on an SH4A
25987 system. Additional support from the interrupt/exception handling code of the
25988 system is not required for this model.
25989
25990 @item gbr-offset=
25991 This parameter specifies the offset in bytes of the variable in the thread
25992 control block structure that should be used by the generated atomic sequences
25993 when the @samp{soft-tcb} model has been selected. For other models this
25994 parameter is ignored. The specified value must be an integer multiple of four
25995 and in the range 0-1020.
25996
25997 @item strict
25998 This parameter prevents mixed usage of multiple atomic models, even if they
25999 are compatible, and makes the compiler generate atomic sequences of the
26000 specified model only.
26001
26002 @end table
26003
26004 @item -mtas
26005 @opindex mtas
26006 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26007 Notice that depending on the particular hardware and software configuration
26008 this can degrade overall performance due to the operand cache line flushes
26009 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26010 processors the @code{tas.b} instruction must be used with caution since it
26011 can result in data corruption for certain cache configurations.
26012
26013 @item -mprefergot
26014 @opindex mprefergot
26015 When generating position-independent code, emit function calls using
26016 the Global Offset Table instead of the Procedure Linkage Table.
26017
26018 @item -musermode
26019 @itemx -mno-usermode
26020 @opindex musermode
26021 @opindex mno-usermode
26022 Don't allow (allow) the compiler generating privileged mode code. Specifying
26023 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26024 inlined code would not work in user mode. @option{-musermode} is the default
26025 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26026 @option{-musermode} has no effect, since there is no user mode.
26027
26028 @item -multcost=@var{number}
26029 @opindex multcost=@var{number}
26030 Set the cost to assume for a multiply insn.
26031
26032 @item -mdiv=@var{strategy}
26033 @opindex mdiv=@var{strategy}
26034 Set the division strategy to be used for integer division operations.
26035 @var{strategy} can be one of:
26036
26037 @table @samp
26038
26039 @item call-div1
26040 Calls a library function that uses the single-step division instruction
26041 @code{div1} to perform the operation. Division by zero calculates an
26042 unspecified result and does not trap. This is the default except for SH4,
26043 SH2A and SHcompact.
26044
26045 @item call-fp
26046 Calls a library function that performs the operation in double precision
26047 floating point. Division by zero causes a floating-point exception. This is
26048 the default for SHcompact with FPU. Specifying this for targets that do not
26049 have a double precision FPU defaults to @code{call-div1}.
26050
26051 @item call-table
26052 Calls a library function that uses a lookup table for small divisors and
26053 the @code{div1} instruction with case distinction for larger divisors. Division
26054 by zero calculates an unspecified result and does not trap. This is the default
26055 for SH4. Specifying this for targets that do not have dynamic shift
26056 instructions defaults to @code{call-div1}.
26057
26058 @end table
26059
26060 When a division strategy has not been specified the default strategy is
26061 selected based on the current target. For SH2A the default strategy is to
26062 use the @code{divs} and @code{divu} instructions instead of library function
26063 calls.
26064
26065 @item -maccumulate-outgoing-args
26066 @opindex maccumulate-outgoing-args
26067 Reserve space once for outgoing arguments in the function prologue rather
26068 than around each call. Generally beneficial for performance and size. Also
26069 needed for unwinding to avoid changing the stack frame around conditional code.
26070
26071 @item -mdivsi3_libfunc=@var{name}
26072 @opindex mdivsi3_libfunc=@var{name}
26073 Set the name of the library function used for 32-bit signed division to
26074 @var{name}.
26075 This only affects the name used in the @samp{call} division strategies, and
26076 the compiler still expects the same sets of input/output/clobbered registers as
26077 if this option were not present.
26078
26079 @item -mfixed-range=@var{register-range}
26080 @opindex mfixed-range
26081 Generate code treating the given register range as fixed registers.
26082 A fixed register is one that the register allocator cannot use. This is
26083 useful when compiling kernel code. A register range is specified as
26084 two registers separated by a dash. Multiple register ranges can be
26085 specified separated by a comma.
26086
26087 @item -mbranch-cost=@var{num}
26088 @opindex mbranch-cost=@var{num}
26089 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26090 make the compiler try to generate more branch-free code if possible.
26091 If not specified the value is selected depending on the processor type that
26092 is being compiled for.
26093
26094 @item -mzdcbranch
26095 @itemx -mno-zdcbranch
26096 @opindex mzdcbranch
26097 @opindex mno-zdcbranch
26098 Assume (do not assume) that zero displacement conditional branch instructions
26099 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26100 compiler prefers zero displacement branch code sequences. This is
26101 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26102 disabled by specifying @option{-mno-zdcbranch}.
26103
26104 @item -mcbranch-force-delay-slot
26105 @opindex mcbranch-force-delay-slot
26106 Force the usage of delay slots for conditional branches, which stuffs the delay
26107 slot with a @code{nop} if a suitable instruction cannot be found. By default
26108 this option is disabled. It can be enabled to work around hardware bugs as
26109 found in the original SH7055.
26110
26111 @item -mfused-madd
26112 @itemx -mno-fused-madd
26113 @opindex mfused-madd
26114 @opindex mno-fused-madd
26115 Generate code that uses (does not use) the floating-point multiply and
26116 accumulate instructions. These instructions are generated by default
26117 if hardware floating point is used. The machine-dependent
26118 @option{-mfused-madd} option is now mapped to the machine-independent
26119 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26120 mapped to @option{-ffp-contract=off}.
26121
26122 @item -mfsca
26123 @itemx -mno-fsca
26124 @opindex mfsca
26125 @opindex mno-fsca
26126 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26127 and cosine approximations. The option @option{-mfsca} must be used in
26128 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26129 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26130 approximations even if @option{-funsafe-math-optimizations} is in effect.
26131
26132 @item -mfsrra
26133 @itemx -mno-fsrra
26134 @opindex mfsrra
26135 @opindex mno-fsrra
26136 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26137 reciprocal square root approximations. The option @option{-mfsrra} must be used
26138 in combination with @option{-funsafe-math-optimizations} and
26139 @option{-ffinite-math-only}. It is enabled by default when generating code for
26140 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26141 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26142 in effect.
26143
26144 @item -mpretend-cmove
26145 @opindex mpretend-cmove
26146 Prefer zero-displacement conditional branches for conditional move instruction
26147 patterns. This can result in faster code on the SH4 processor.
26148
26149 @item -mfdpic
26150 @opindex fdpic
26151 Generate code using the FDPIC ABI.
26152
26153 @end table
26154
26155 @node Solaris 2 Options
26156 @subsection Solaris 2 Options
26157 @cindex Solaris 2 options
26158
26159 These @samp{-m} options are supported on Solaris 2:
26160
26161 @table @gcctabopt
26162 @item -mclear-hwcap
26163 @opindex mclear-hwcap
26164 @option{-mclear-hwcap} tells the compiler to remove the hardware
26165 capabilities generated by the Solaris assembler. This is only necessary
26166 when object files use ISA extensions not supported by the current
26167 machine, but check at runtime whether or not to use them.
26168
26169 @item -mimpure-text
26170 @opindex mimpure-text
26171 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26172 the compiler to not pass @option{-z text} to the linker when linking a
26173 shared object. Using this option, you can link position-dependent
26174 code into a shared object.
26175
26176 @option{-mimpure-text} suppresses the ``relocations remain against
26177 allocatable but non-writable sections'' linker error message.
26178 However, the necessary relocations trigger copy-on-write, and the
26179 shared object is not actually shared across processes. Instead of
26180 using @option{-mimpure-text}, you should compile all source code with
26181 @option{-fpic} or @option{-fPIC}.
26182
26183 @end table
26184
26185 These switches are supported in addition to the above on Solaris 2:
26186
26187 @table @gcctabopt
26188 @item -pthreads
26189 @opindex pthreads
26190 This is a synonym for @option{-pthread}.
26191 @end table
26192
26193 @node SPARC Options
26194 @subsection SPARC Options
26195 @cindex SPARC options
26196
26197 These @samp{-m} options are supported on the SPARC:
26198
26199 @table @gcctabopt
26200 @item -mno-app-regs
26201 @itemx -mapp-regs
26202 @opindex mno-app-regs
26203 @opindex mapp-regs
26204 Specify @option{-mapp-regs} to generate output using the global registers
26205 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26206 global register 1, each global register 2 through 4 is then treated as an
26207 allocable register that is clobbered by function calls. This is the default.
26208
26209 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26210 specify @option{-mno-app-regs}. You should compile libraries and system
26211 software with this option.
26212
26213 @item -mflat
26214 @itemx -mno-flat
26215 @opindex mflat
26216 @opindex mno-flat
26217 With @option{-mflat}, the compiler does not generate save/restore instructions
26218 and uses a ``flat'' or single register window model. This model is compatible
26219 with the regular register window model. The local registers and the input
26220 registers (0--5) are still treated as ``call-saved'' registers and are
26221 saved on the stack as needed.
26222
26223 With @option{-mno-flat} (the default), the compiler generates save/restore
26224 instructions (except for leaf functions). This is the normal operating mode.
26225
26226 @item -mfpu
26227 @itemx -mhard-float
26228 @opindex mfpu
26229 @opindex mhard-float
26230 Generate output containing floating-point instructions. This is the
26231 default.
26232
26233 @item -mno-fpu
26234 @itemx -msoft-float
26235 @opindex mno-fpu
26236 @opindex msoft-float
26237 Generate output containing library calls for floating point.
26238 @strong{Warning:} the requisite libraries are not available for all SPARC
26239 targets. Normally the facilities of the machine's usual C compiler are
26240 used, but this cannot be done directly in cross-compilation. You must make
26241 your own arrangements to provide suitable library functions for
26242 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26243 @samp{sparclite-*-*} do provide software floating-point support.
26244
26245 @option{-msoft-float} changes the calling convention in the output file;
26246 therefore, it is only useful if you compile @emph{all} of a program with
26247 this option. In particular, you need to compile @file{libgcc.a}, the
26248 library that comes with GCC, with @option{-msoft-float} in order for
26249 this to work.
26250
26251 @item -mhard-quad-float
26252 @opindex mhard-quad-float
26253 Generate output containing quad-word (long double) floating-point
26254 instructions.
26255
26256 @item -msoft-quad-float
26257 @opindex msoft-quad-float
26258 Generate output containing library calls for quad-word (long double)
26259 floating-point instructions. The functions called are those specified
26260 in the SPARC ABI@. This is the default.
26261
26262 As of this writing, there are no SPARC implementations that have hardware
26263 support for the quad-word floating-point instructions. They all invoke
26264 a trap handler for one of these instructions, and then the trap handler
26265 emulates the effect of the instruction. Because of the trap handler overhead,
26266 this is much slower than calling the ABI library routines. Thus the
26267 @option{-msoft-quad-float} option is the default.
26268
26269 @item -mno-unaligned-doubles
26270 @itemx -munaligned-doubles
26271 @opindex mno-unaligned-doubles
26272 @opindex munaligned-doubles
26273 Assume that doubles have 8-byte alignment. This is the default.
26274
26275 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26276 alignment only if they are contained in another type, or if they have an
26277 absolute address. Otherwise, it assumes they have 4-byte alignment.
26278 Specifying this option avoids some rare compatibility problems with code
26279 generated by other compilers. It is not the default because it results
26280 in a performance loss, especially for floating-point code.
26281
26282 @item -muser-mode
26283 @itemx -mno-user-mode
26284 @opindex muser-mode
26285 @opindex mno-user-mode
26286 Do not generate code that can only run in supervisor mode. This is relevant
26287 only for the @code{casa} instruction emitted for the LEON3 processor. This
26288 is the default.
26289
26290 @item -mfaster-structs
26291 @itemx -mno-faster-structs
26292 @opindex mfaster-structs
26293 @opindex mno-faster-structs
26294 With @option{-mfaster-structs}, the compiler assumes that structures
26295 should have 8-byte alignment. This enables the use of pairs of
26296 @code{ldd} and @code{std} instructions for copies in structure
26297 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26298 However, the use of this changed alignment directly violates the SPARC
26299 ABI@. Thus, it's intended only for use on targets where the developer
26300 acknowledges that their resulting code is not directly in line with
26301 the rules of the ABI@.
26302
26303 @item -mstd-struct-return
26304 @itemx -mno-std-struct-return
26305 @opindex mstd-struct-return
26306 @opindex mno-std-struct-return
26307 With @option{-mstd-struct-return}, the compiler generates checking code
26308 in functions returning structures or unions to detect size mismatches
26309 between the two sides of function calls, as per the 32-bit ABI@.
26310
26311 The default is @option{-mno-std-struct-return}. This option has no effect
26312 in 64-bit mode.
26313
26314 @item -mlra
26315 @itemx -mno-lra
26316 @opindex mlra
26317 @opindex mno-lra
26318 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26319 so @option{-mno-lra} needs to be passed to get old Reload.
26320
26321 @item -mcpu=@var{cpu_type}
26322 @opindex mcpu
26323 Set the instruction set, register set, and instruction scheduling parameters
26324 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26325 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26326 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26327 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26328 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26329 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26330
26331 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26332 which selects the best architecture option for the host processor.
26333 @option{-mcpu=native} has no effect if GCC does not recognize
26334 the processor.
26335
26336 Default instruction scheduling parameters are used for values that select
26337 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26338 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26339
26340 Here is a list of each supported architecture and their supported
26341 implementations.
26342
26343 @table @asis
26344 @item v7
26345 cypress, leon3v7
26346
26347 @item v8
26348 supersparc, hypersparc, leon, leon3
26349
26350 @item sparclite
26351 f930, f934, sparclite86x
26352
26353 @item sparclet
26354 tsc701
26355
26356 @item v9
26357 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26358 niagara7, m8
26359 @end table
26360
26361 By default (unless configured otherwise), GCC generates code for the V7
26362 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26363 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26364 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26365 SPARCStation 1, 2, IPX etc.
26366
26367 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26368 architecture. The only difference from V7 code is that the compiler emits
26369 the integer multiply and integer divide instructions which exist in SPARC-V8
26370 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26371 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26372 2000 series.
26373
26374 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26375 the SPARC architecture. This adds the integer multiply, integer divide step
26376 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26377 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26378 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26379 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26380 MB86934 chip, which is the more recent SPARClite with FPU@.
26381
26382 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26383 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26384 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26385 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26386 optimizes it for the TEMIC SPARClet chip.
26387
26388 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26389 architecture. This adds 64-bit integer and floating-point move instructions,
26390 3 additional floating-point condition code registers and conditional move
26391 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26392 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26393 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26394 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26395 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26396 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26397 additionally optimizes it for Sun UltraSPARC T2 chips. With
26398 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26399 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26400 additionally optimizes it for Sun UltraSPARC T4 chips. With
26401 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26402 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26403 additionally optimizes it for Oracle M8 chips.
26404
26405 @item -mtune=@var{cpu_type}
26406 @opindex mtune
26407 Set the instruction scheduling parameters for machine type
26408 @var{cpu_type}, but do not set the instruction set or register set that the
26409 option @option{-mcpu=@var{cpu_type}} does.
26410
26411 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26412 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26413 that select a particular CPU implementation. Those are
26414 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26415 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26416 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26417 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26418 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26419 and GNU/Linux toolchains, @samp{native} can also be used.
26420
26421 @item -mv8plus
26422 @itemx -mno-v8plus
26423 @opindex mv8plus
26424 @opindex mno-v8plus
26425 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26426 difference from the V8 ABI is that the global and out registers are
26427 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26428 mode for all SPARC-V9 processors.
26429
26430 @item -mvis
26431 @itemx -mno-vis
26432 @opindex mvis
26433 @opindex mno-vis
26434 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26435 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26436
26437 @item -mvis2
26438 @itemx -mno-vis2
26439 @opindex mvis2
26440 @opindex mno-vis2
26441 With @option{-mvis2}, GCC generates code that takes advantage of
26442 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26443 default is @option{-mvis2} when targeting a cpu that supports such
26444 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26445 also sets @option{-mvis}.
26446
26447 @item -mvis3
26448 @itemx -mno-vis3
26449 @opindex mvis3
26450 @opindex mno-vis3
26451 With @option{-mvis3}, GCC generates code that takes advantage of
26452 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26453 default is @option{-mvis3} when targeting a cpu that supports such
26454 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26455 also sets @option{-mvis2} and @option{-mvis}.
26456
26457 @item -mvis4
26458 @itemx -mno-vis4
26459 @opindex mvis4
26460 @opindex mno-vis4
26461 With @option{-mvis4}, GCC generates code that takes advantage of
26462 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26463 default is @option{-mvis4} when targeting a cpu that supports such
26464 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26465 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26466
26467 @item -mvis4b
26468 @itemx -mno-vis4b
26469 @opindex mvis4b
26470 @opindex mno-vis4b
26471 With @option{-mvis4b}, GCC generates code that takes advantage of
26472 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26473 the additional VIS instructions introduced in the Oracle SPARC
26474 Architecture 2017. The default is @option{-mvis4b} when targeting a
26475 cpu that supports such instructions, such as m8 and later. Setting
26476 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26477 @option{-mvis2} and @option{-mvis}.
26478
26479 @item -mcbcond
26480 @itemx -mno-cbcond
26481 @opindex mcbcond
26482 @opindex mno-cbcond
26483 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26484 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26485 when targeting a CPU that supports such instructions, such as Niagara-4 and
26486 later.
26487
26488 @item -mfmaf
26489 @itemx -mno-fmaf
26490 @opindex mfmaf
26491 @opindex mno-fmaf
26492 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26493 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26494 when targeting a CPU that supports such instructions, such as Niagara-3 and
26495 later.
26496
26497 @item -mfsmuld
26498 @itemx -mno-fsmuld
26499 @opindex mfsmuld
26500 @opindex mno-fsmuld
26501 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26502 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26503 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26504 or V9 with FPU except @option{-mcpu=leon}.
26505
26506 @item -mpopc
26507 @itemx -mno-popc
26508 @opindex mpopc
26509 @opindex mno-popc
26510 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26511 Population Count instruction. The default is @option{-mpopc}
26512 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26513 later.
26514
26515 @item -msubxc
26516 @itemx -mno-subxc
26517 @opindex msubxc
26518 @opindex mno-subxc
26519 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26520 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26521 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26522 later.
26523
26524 @item -mfix-at697f
26525 @opindex mfix-at697f
26526 Enable the documented workaround for the single erratum of the Atmel AT697F
26527 processor (which corresponds to erratum #13 of the AT697E processor).
26528
26529 @item -mfix-ut699
26530 @opindex mfix-ut699
26531 Enable the documented workarounds for the floating-point errata and the data
26532 cache nullify errata of the UT699 processor.
26533
26534 @item -mfix-ut700
26535 @opindex mfix-ut700
26536 Enable the documented workaround for the back-to-back store errata of
26537 the UT699E/UT700 processor.
26538
26539 @item -mfix-gr712rc
26540 @opindex mfix-gr712rc
26541 Enable the documented workaround for the back-to-back store errata of
26542 the GR712RC processor.
26543 @end table
26544
26545 These @samp{-m} options are supported in addition to the above
26546 on SPARC-V9 processors in 64-bit environments:
26547
26548 @table @gcctabopt
26549 @item -m32
26550 @itemx -m64
26551 @opindex m32
26552 @opindex m64
26553 Generate code for a 32-bit or 64-bit environment.
26554 The 32-bit environment sets int, long and pointer to 32 bits.
26555 The 64-bit environment sets int to 32 bits and long and pointer
26556 to 64 bits.
26557
26558 @item -mcmodel=@var{which}
26559 @opindex mcmodel
26560 Set the code model to one of
26561
26562 @table @samp
26563 @item medlow
26564 The Medium/Low code model: 64-bit addresses, programs
26565 must be linked in the low 32 bits of memory. Programs can be statically
26566 or dynamically linked.
26567
26568 @item medmid
26569 The Medium/Middle code model: 64-bit addresses, programs
26570 must be linked in the low 44 bits of memory, the text and data segments must
26571 be less than 2GB in size and the data segment must be located within 2GB of
26572 the text segment.
26573
26574 @item medany
26575 The Medium/Anywhere code model: 64-bit addresses, programs
26576 may be linked anywhere in memory, the text and data segments must be less
26577 than 2GB in size and the data segment must be located within 2GB of the
26578 text segment.
26579
26580 @item embmedany
26581 The Medium/Anywhere code model for embedded systems:
26582 64-bit addresses, the text and data segments must be less than 2GB in
26583 size, both starting anywhere in memory (determined at link time). The
26584 global register %g4 points to the base of the data segment. Programs
26585 are statically linked and PIC is not supported.
26586 @end table
26587
26588 @item -mmemory-model=@var{mem-model}
26589 @opindex mmemory-model
26590 Set the memory model in force on the processor to one of
26591
26592 @table @samp
26593 @item default
26594 The default memory model for the processor and operating system.
26595
26596 @item rmo
26597 Relaxed Memory Order
26598
26599 @item pso
26600 Partial Store Order
26601
26602 @item tso
26603 Total Store Order
26604
26605 @item sc
26606 Sequential Consistency
26607 @end table
26608
26609 These memory models are formally defined in Appendix D of the SPARC-V9
26610 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26611
26612 @item -mstack-bias
26613 @itemx -mno-stack-bias
26614 @opindex mstack-bias
26615 @opindex mno-stack-bias
26616 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26617 frame pointer if present, are offset by @minus{}2047 which must be added back
26618 when making stack frame references. This is the default in 64-bit mode.
26619 Otherwise, assume no such offset is present.
26620 @end table
26621
26622 @node SPU Options
26623 @subsection SPU Options
26624 @cindex SPU options
26625
26626 These @samp{-m} options are supported on the SPU:
26627
26628 @table @gcctabopt
26629 @item -mwarn-reloc
26630 @itemx -merror-reloc
26631 @opindex mwarn-reloc
26632 @opindex merror-reloc
26633
26634 The loader for SPU does not handle dynamic relocations. By default, GCC
26635 gives an error when it generates code that requires a dynamic
26636 relocation. @option{-mno-error-reloc} disables the error,
26637 @option{-mwarn-reloc} generates a warning instead.
26638
26639 @item -msafe-dma
26640 @itemx -munsafe-dma
26641 @opindex msafe-dma
26642 @opindex munsafe-dma
26643
26644 Instructions that initiate or test completion of DMA must not be
26645 reordered with respect to loads and stores of the memory that is being
26646 accessed.
26647 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26648 memory accesses, but that can lead to inefficient code in places where the
26649 memory is known to not change. Rather than mark the memory as volatile,
26650 you can use @option{-msafe-dma} to tell the compiler to treat
26651 the DMA instructions as potentially affecting all memory.
26652
26653 @item -mbranch-hints
26654 @opindex mbranch-hints
26655
26656 By default, GCC generates a branch hint instruction to avoid
26657 pipeline stalls for always-taken or probably-taken branches. A hint
26658 is not generated closer than 8 instructions away from its branch.
26659 There is little reason to disable them, except for debugging purposes,
26660 or to make an object a little bit smaller.
26661
26662 @item -msmall-mem
26663 @itemx -mlarge-mem
26664 @opindex msmall-mem
26665 @opindex mlarge-mem
26666
26667 By default, GCC generates code assuming that addresses are never larger
26668 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
26669 a full 32-bit address.
26670
26671 @item -mstdmain
26672 @opindex mstdmain
26673
26674 By default, GCC links against startup code that assumes the SPU-style
26675 main function interface (which has an unconventional parameter list).
26676 With @option{-mstdmain}, GCC links your program against startup
26677 code that assumes a C99-style interface to @code{main}, including a
26678 local copy of @code{argv} strings.
26679
26680 @item -mfixed-range=@var{register-range}
26681 @opindex mfixed-range
26682 Generate code treating the given register range as fixed registers.
26683 A fixed register is one that the register allocator cannot use. This is
26684 useful when compiling kernel code. A register range is specified as
26685 two registers separated by a dash. Multiple register ranges can be
26686 specified separated by a comma.
26687
26688 @item -mea32
26689 @itemx -mea64
26690 @opindex mea32
26691 @opindex mea64
26692 Compile code assuming that pointers to the PPU address space accessed
26693 via the @code{__ea} named address space qualifier are either 32 or 64
26694 bits wide. The default is 32 bits. As this is an ABI-changing option,
26695 all object code in an executable must be compiled with the same setting.
26696
26697 @item -maddress-space-conversion
26698 @itemx -mno-address-space-conversion
26699 @opindex maddress-space-conversion
26700 @opindex mno-address-space-conversion
26701 Allow/disallow treating the @code{__ea} address space as superset
26702 of the generic address space. This enables explicit type casts
26703 between @code{__ea} and generic pointer as well as implicit
26704 conversions of generic pointers to @code{__ea} pointers. The
26705 default is to allow address space pointer conversions.
26706
26707 @item -mcache-size=@var{cache-size}
26708 @opindex mcache-size
26709 This option controls the version of libgcc that the compiler links to an
26710 executable and selects a software-managed cache for accessing variables
26711 in the @code{__ea} address space with a particular cache size. Possible
26712 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26713 and @samp{128}. The default cache size is 64KB.
26714
26715 @item -matomic-updates
26716 @itemx -mno-atomic-updates
26717 @opindex matomic-updates
26718 @opindex mno-atomic-updates
26719 This option controls the version of libgcc that the compiler links to an
26720 executable and selects whether atomic updates to the software-managed
26721 cache of PPU-side variables are used. If you use atomic updates, changes
26722 to a PPU variable from SPU code using the @code{__ea} named address space
26723 qualifier do not interfere with changes to other PPU variables residing
26724 in the same cache line from PPU code. If you do not use atomic updates,
26725 such interference may occur; however, writing back cache lines is
26726 more efficient. The default behavior is to use atomic updates.
26727
26728 @item -mdual-nops
26729 @itemx -mdual-nops=@var{n}
26730 @opindex mdual-nops
26731 By default, GCC inserts NOPs to increase dual issue when it expects
26732 it to increase performance. @var{n} can be a value from 0 to 10. A
26733 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26734 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26735
26736 @item -mhint-max-nops=@var{n}
26737 @opindex mhint-max-nops
26738 Maximum number of NOPs to insert for a branch hint. A branch hint must
26739 be at least 8 instructions away from the branch it is affecting. GCC
26740 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26741 generate the branch hint.
26742
26743 @item -mhint-max-distance=@var{n}
26744 @opindex mhint-max-distance
26745 The encoding of the branch hint instruction limits the hint to be within
26746 256 instructions of the branch it is affecting. By default, GCC makes
26747 sure it is within 125.
26748
26749 @item -msafe-hints
26750 @opindex msafe-hints
26751 Work around a hardware bug that causes the SPU to stall indefinitely.
26752 By default, GCC inserts the @code{hbrp} instruction to make sure
26753 this stall won't happen.
26754
26755 @end table
26756
26757 @node System V Options
26758 @subsection Options for System V
26759
26760 These additional options are available on System V Release 4 for
26761 compatibility with other compilers on those systems:
26762
26763 @table @gcctabopt
26764 @item -G
26765 @opindex G
26766 Create a shared object.
26767 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26768
26769 @item -Qy
26770 @opindex Qy
26771 Identify the versions of each tool used by the compiler, in a
26772 @code{.ident} assembler directive in the output.
26773
26774 @item -Qn
26775 @opindex Qn
26776 Refrain from adding @code{.ident} directives to the output file (this is
26777 the default).
26778
26779 @item -YP,@var{dirs}
26780 @opindex YP
26781 Search the directories @var{dirs}, and no others, for libraries
26782 specified with @option{-l}.
26783
26784 @item -Ym,@var{dir}
26785 @opindex Ym
26786 Look in the directory @var{dir} to find the M4 preprocessor.
26787 The assembler uses this option.
26788 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26789 @c the generic assembler that comes with Solaris takes just -Ym.
26790 @end table
26791
26792 @node TILE-Gx Options
26793 @subsection TILE-Gx Options
26794 @cindex TILE-Gx options
26795
26796 These @samp{-m} options are supported on the TILE-Gx:
26797
26798 @table @gcctabopt
26799 @item -mcmodel=small
26800 @opindex mcmodel=small
26801 Generate code for the small model. The distance for direct calls is
26802 limited to 500M in either direction. PC-relative addresses are 32
26803 bits. Absolute addresses support the full address range.
26804
26805 @item -mcmodel=large
26806 @opindex mcmodel=large
26807 Generate code for the large model. There is no limitation on call
26808 distance, pc-relative addresses, or absolute addresses.
26809
26810 @item -mcpu=@var{name}
26811 @opindex mcpu
26812 Selects the type of CPU to be targeted. Currently the only supported
26813 type is @samp{tilegx}.
26814
26815 @item -m32
26816 @itemx -m64
26817 @opindex m32
26818 @opindex m64
26819 Generate code for a 32-bit or 64-bit environment. The 32-bit
26820 environment sets int, long, and pointer to 32 bits. The 64-bit
26821 environment sets int to 32 bits and long and pointer to 64 bits.
26822
26823 @item -mbig-endian
26824 @itemx -mlittle-endian
26825 @opindex mbig-endian
26826 @opindex mlittle-endian
26827 Generate code in big/little endian mode, respectively.
26828 @end table
26829
26830 @node TILEPro Options
26831 @subsection TILEPro Options
26832 @cindex TILEPro options
26833
26834 These @samp{-m} options are supported on the TILEPro:
26835
26836 @table @gcctabopt
26837 @item -mcpu=@var{name}
26838 @opindex mcpu
26839 Selects the type of CPU to be targeted. Currently the only supported
26840 type is @samp{tilepro}.
26841
26842 @item -m32
26843 @opindex m32
26844 Generate code for a 32-bit environment, which sets int, long, and
26845 pointer to 32 bits. This is the only supported behavior so the flag
26846 is essentially ignored.
26847 @end table
26848
26849 @node V850 Options
26850 @subsection V850 Options
26851 @cindex V850 Options
26852
26853 These @samp{-m} options are defined for V850 implementations:
26854
26855 @table @gcctabopt
26856 @item -mlong-calls
26857 @itemx -mno-long-calls
26858 @opindex mlong-calls
26859 @opindex mno-long-calls
26860 Treat all calls as being far away (near). If calls are assumed to be
26861 far away, the compiler always loads the function's address into a
26862 register, and calls indirect through the pointer.
26863
26864 @item -mno-ep
26865 @itemx -mep
26866 @opindex mno-ep
26867 @opindex mep
26868 Do not optimize (do optimize) basic blocks that use the same index
26869 pointer 4 or more times to copy pointer into the @code{ep} register, and
26870 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26871 option is on by default if you optimize.
26872
26873 @item -mno-prolog-function
26874 @itemx -mprolog-function
26875 @opindex mno-prolog-function
26876 @opindex mprolog-function
26877 Do not use (do use) external functions to save and restore registers
26878 at the prologue and epilogue of a function. The external functions
26879 are slower, but use less code space if more than one function saves
26880 the same number of registers. The @option{-mprolog-function} option
26881 is on by default if you optimize.
26882
26883 @item -mspace
26884 @opindex mspace
26885 Try to make the code as small as possible. At present, this just turns
26886 on the @option{-mep} and @option{-mprolog-function} options.
26887
26888 @item -mtda=@var{n}
26889 @opindex mtda
26890 Put static or global variables whose size is @var{n} bytes or less into
26891 the tiny data area that register @code{ep} points to. The tiny data
26892 area can hold up to 256 bytes in total (128 bytes for byte references).
26893
26894 @item -msda=@var{n}
26895 @opindex msda
26896 Put static or global variables whose size is @var{n} bytes or less into
26897 the small data area that register @code{gp} points to. The small data
26898 area can hold up to 64 kilobytes.
26899
26900 @item -mzda=@var{n}
26901 @opindex mzda
26902 Put static or global variables whose size is @var{n} bytes or less into
26903 the first 32 kilobytes of memory.
26904
26905 @item -mv850
26906 @opindex mv850
26907 Specify that the target processor is the V850.
26908
26909 @item -mv850e3v5
26910 @opindex mv850e3v5
26911 Specify that the target processor is the V850E3V5. The preprocessor
26912 constant @code{__v850e3v5__} is defined if this option is used.
26913
26914 @item -mv850e2v4
26915 @opindex mv850e2v4
26916 Specify that the target processor is the V850E3V5. This is an alias for
26917 the @option{-mv850e3v5} option.
26918
26919 @item -mv850e2v3
26920 @opindex mv850e2v3
26921 Specify that the target processor is the V850E2V3. The preprocessor
26922 constant @code{__v850e2v3__} is defined if this option is used.
26923
26924 @item -mv850e2
26925 @opindex mv850e2
26926 Specify that the target processor is the V850E2. The preprocessor
26927 constant @code{__v850e2__} is defined if this option is used.
26928
26929 @item -mv850e1
26930 @opindex mv850e1
26931 Specify that the target processor is the V850E1. The preprocessor
26932 constants @code{__v850e1__} and @code{__v850e__} are defined if
26933 this option is used.
26934
26935 @item -mv850es
26936 @opindex mv850es
26937 Specify that the target processor is the V850ES. This is an alias for
26938 the @option{-mv850e1} option.
26939
26940 @item -mv850e
26941 @opindex mv850e
26942 Specify that the target processor is the V850E@. The preprocessor
26943 constant @code{__v850e__} is defined if this option is used.
26944
26945 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26946 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26947 are defined then a default target processor is chosen and the
26948 relevant @samp{__v850*__} preprocessor constant is defined.
26949
26950 The preprocessor constants @code{__v850} and @code{__v851__} are always
26951 defined, regardless of which processor variant is the target.
26952
26953 @item -mdisable-callt
26954 @itemx -mno-disable-callt
26955 @opindex mdisable-callt
26956 @opindex mno-disable-callt
26957 This option suppresses generation of the @code{CALLT} instruction for the
26958 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26959 architecture.
26960
26961 This option is enabled by default when the RH850 ABI is
26962 in use (see @option{-mrh850-abi}), and disabled by default when the
26963 GCC ABI is in use. If @code{CALLT} instructions are being generated
26964 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26965
26966 @item -mrelax
26967 @itemx -mno-relax
26968 @opindex mrelax
26969 @opindex mno-relax
26970 Pass on (or do not pass on) the @option{-mrelax} command-line option
26971 to the assembler.
26972
26973 @item -mlong-jumps
26974 @itemx -mno-long-jumps
26975 @opindex mlong-jumps
26976 @opindex mno-long-jumps
26977 Disable (or re-enable) the generation of PC-relative jump instructions.
26978
26979 @item -msoft-float
26980 @itemx -mhard-float
26981 @opindex msoft-float
26982 @opindex mhard-float
26983 Disable (or re-enable) the generation of hardware floating point
26984 instructions. This option is only significant when the target
26985 architecture is @samp{V850E2V3} or higher. If hardware floating point
26986 instructions are being generated then the C preprocessor symbol
26987 @code{__FPU_OK__} is defined, otherwise the symbol
26988 @code{__NO_FPU__} is defined.
26989
26990 @item -mloop
26991 @opindex mloop
26992 Enables the use of the e3v5 LOOP instruction. The use of this
26993 instruction is not enabled by default when the e3v5 architecture is
26994 selected because its use is still experimental.
26995
26996 @item -mrh850-abi
26997 @itemx -mghs
26998 @opindex mrh850-abi
26999 @opindex mghs
27000 Enables support for the RH850 version of the V850 ABI. This is the
27001 default. With this version of the ABI the following rules apply:
27002
27003 @itemize
27004 @item
27005 Integer sized structures and unions are returned via a memory pointer
27006 rather than a register.
27007
27008 @item
27009 Large structures and unions (more than 8 bytes in size) are passed by
27010 value.
27011
27012 @item
27013 Functions are aligned to 16-bit boundaries.
27014
27015 @item
27016 The @option{-m8byte-align} command-line option is supported.
27017
27018 @item
27019 The @option{-mdisable-callt} command-line option is enabled by
27020 default. The @option{-mno-disable-callt} command-line option is not
27021 supported.
27022 @end itemize
27023
27024 When this version of the ABI is enabled the C preprocessor symbol
27025 @code{__V850_RH850_ABI__} is defined.
27026
27027 @item -mgcc-abi
27028 @opindex mgcc-abi
27029 Enables support for the old GCC version of the V850 ABI. With this
27030 version of the ABI the following rules apply:
27031
27032 @itemize
27033 @item
27034 Integer sized structures and unions are returned in register @code{r10}.
27035
27036 @item
27037 Large structures and unions (more than 8 bytes in size) are passed by
27038 reference.
27039
27040 @item
27041 Functions are aligned to 32-bit boundaries, unless optimizing for
27042 size.
27043
27044 @item
27045 The @option{-m8byte-align} command-line option is not supported.
27046
27047 @item
27048 The @option{-mdisable-callt} command-line option is supported but not
27049 enabled by default.
27050 @end itemize
27051
27052 When this version of the ABI is enabled the C preprocessor symbol
27053 @code{__V850_GCC_ABI__} is defined.
27054
27055 @item -m8byte-align
27056 @itemx -mno-8byte-align
27057 @opindex m8byte-align
27058 @opindex mno-8byte-align
27059 Enables support for @code{double} and @code{long long} types to be
27060 aligned on 8-byte boundaries. The default is to restrict the
27061 alignment of all objects to at most 4-bytes. When
27062 @option{-m8byte-align} is in effect the C preprocessor symbol
27063 @code{__V850_8BYTE_ALIGN__} is defined.
27064
27065 @item -mbig-switch
27066 @opindex mbig-switch
27067 Generate code suitable for big switch tables. Use this option only if
27068 the assembler/linker complain about out of range branches within a switch
27069 table.
27070
27071 @item -mapp-regs
27072 @opindex mapp-regs
27073 This option causes r2 and r5 to be used in the code generated by
27074 the compiler. This setting is the default.
27075
27076 @item -mno-app-regs
27077 @opindex mno-app-regs
27078 This option causes r2 and r5 to be treated as fixed registers.
27079
27080 @end table
27081
27082 @node VAX Options
27083 @subsection VAX Options
27084 @cindex VAX options
27085
27086 These @samp{-m} options are defined for the VAX:
27087
27088 @table @gcctabopt
27089 @item -munix
27090 @opindex munix
27091 Do not output certain jump instructions (@code{aobleq} and so on)
27092 that the Unix assembler for the VAX cannot handle across long
27093 ranges.
27094
27095 @item -mgnu
27096 @opindex mgnu
27097 Do output those jump instructions, on the assumption that the
27098 GNU assembler is being used.
27099
27100 @item -mg
27101 @opindex mg
27102 Output code for G-format floating-point numbers instead of D-format.
27103 @end table
27104
27105 @node Visium Options
27106 @subsection Visium Options
27107 @cindex Visium options
27108
27109 @table @gcctabopt
27110
27111 @item -mdebug
27112 @opindex mdebug
27113 A program which performs file I/O and is destined to run on an MCM target
27114 should be linked with this option. It causes the libraries libc.a and
27115 libdebug.a to be linked. The program should be run on the target under
27116 the control of the GDB remote debugging stub.
27117
27118 @item -msim
27119 @opindex msim
27120 A program which performs file I/O and is destined to run on the simulator
27121 should be linked with option. This causes libraries libc.a and libsim.a to
27122 be linked.
27123
27124 @item -mfpu
27125 @itemx -mhard-float
27126 @opindex mfpu
27127 @opindex mhard-float
27128 Generate code containing floating-point instructions. This is the
27129 default.
27130
27131 @item -mno-fpu
27132 @itemx -msoft-float
27133 @opindex mno-fpu
27134 @opindex msoft-float
27135 Generate code containing library calls for floating-point.
27136
27137 @option{-msoft-float} changes the calling convention in the output file;
27138 therefore, it is only useful if you compile @emph{all} of a program with
27139 this option. In particular, you need to compile @file{libgcc.a}, the
27140 library that comes with GCC, with @option{-msoft-float} in order for
27141 this to work.
27142
27143 @item -mcpu=@var{cpu_type}
27144 @opindex mcpu
27145 Set the instruction set, register set, and instruction scheduling parameters
27146 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27147 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27148
27149 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27150
27151 By default (unless configured otherwise), GCC generates code for the GR5
27152 variant of the Visium architecture.
27153
27154 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27155 architecture. The only difference from GR5 code is that the compiler will
27156 generate block move instructions.
27157
27158 @item -mtune=@var{cpu_type}
27159 @opindex mtune
27160 Set the instruction scheduling parameters for machine type @var{cpu_type},
27161 but do not set the instruction set or register set that the option
27162 @option{-mcpu=@var{cpu_type}} would.
27163
27164 @item -msv-mode
27165 @opindex msv-mode
27166 Generate code for the supervisor mode, where there are no restrictions on
27167 the access to general registers. This is the default.
27168
27169 @item -muser-mode
27170 @opindex muser-mode
27171 Generate code for the user mode, where the access to some general registers
27172 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27173 mode; on the GR6, only registers r29 to r31 are affected.
27174 @end table
27175
27176 @node VMS Options
27177 @subsection VMS Options
27178
27179 These @samp{-m} options are defined for the VMS implementations:
27180
27181 @table @gcctabopt
27182 @item -mvms-return-codes
27183 @opindex mvms-return-codes
27184 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27185 condition (e.g.@: error) codes.
27186
27187 @item -mdebug-main=@var{prefix}
27188 @opindex mdebug-main=@var{prefix}
27189 Flag the first routine whose name starts with @var{prefix} as the main
27190 routine for the debugger.
27191
27192 @item -mmalloc64
27193 @opindex mmalloc64
27194 Default to 64-bit memory allocation routines.
27195
27196 @item -mpointer-size=@var{size}
27197 @opindex mpointer-size=@var{size}
27198 Set the default size of pointers. Possible options for @var{size} are
27199 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27200 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27201 The later option disables @code{pragma pointer_size}.
27202 @end table
27203
27204 @node VxWorks Options
27205 @subsection VxWorks Options
27206 @cindex VxWorks Options
27207
27208 The options in this section are defined for all VxWorks targets.
27209 Options specific to the target hardware are listed with the other
27210 options for that target.
27211
27212 @table @gcctabopt
27213 @item -mrtp
27214 @opindex mrtp
27215 GCC can generate code for both VxWorks kernels and real time processes
27216 (RTPs). This option switches from the former to the latter. It also
27217 defines the preprocessor macro @code{__RTP__}.
27218
27219 @item -non-static
27220 @opindex non-static
27221 Link an RTP executable against shared libraries rather than static
27222 libraries. The options @option{-static} and @option{-shared} can
27223 also be used for RTPs (@pxref{Link Options}); @option{-static}
27224 is the default.
27225
27226 @item -Bstatic
27227 @itemx -Bdynamic
27228 @opindex Bstatic
27229 @opindex Bdynamic
27230 These options are passed down to the linker. They are defined for
27231 compatibility with Diab.
27232
27233 @item -Xbind-lazy
27234 @opindex Xbind-lazy
27235 Enable lazy binding of function calls. This option is equivalent to
27236 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27237
27238 @item -Xbind-now
27239 @opindex Xbind-now
27240 Disable lazy binding of function calls. This option is the default and
27241 is defined for compatibility with Diab.
27242 @end table
27243
27244 @node x86 Options
27245 @subsection x86 Options
27246 @cindex x86 Options
27247
27248 These @samp{-m} options are defined for the x86 family of computers.
27249
27250 @table @gcctabopt
27251
27252 @item -march=@var{cpu-type}
27253 @opindex march
27254 Generate instructions for the machine type @var{cpu-type}. In contrast to
27255 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27256 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27257 to generate code that may not run at all on processors other than the one
27258 indicated. Specifying @option{-march=@var{cpu-type}} implies
27259 @option{-mtune=@var{cpu-type}}.
27260
27261 The choices for @var{cpu-type} are:
27262
27263 @table @samp
27264 @item native
27265 This selects the CPU to generate code for at compilation time by determining
27266 the processor type of the compiling machine. Using @option{-march=native}
27267 enables all instruction subsets supported by the local machine (hence
27268 the result might not run on different machines). Using @option{-mtune=native}
27269 produces code optimized for the local machine under the constraints
27270 of the selected instruction set.
27271
27272 @item x86-64
27273 A generic CPU with 64-bit extensions.
27274
27275 @item i386
27276 Original Intel i386 CPU@.
27277
27278 @item i486
27279 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27280
27281 @item i586
27282 @itemx pentium
27283 Intel Pentium CPU with no MMX support.
27284
27285 @item lakemont
27286 Intel Lakemont MCU, based on Intel Pentium CPU.
27287
27288 @item pentium-mmx
27289 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27290
27291 @item pentiumpro
27292 Intel Pentium Pro CPU@.
27293
27294 @item i686
27295 When used with @option{-march}, the Pentium Pro
27296 instruction set is used, so the code runs on all i686 family chips.
27297 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27298
27299 @item pentium2
27300 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27301 support.
27302
27303 @item pentium3
27304 @itemx pentium3m
27305 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27306 set support.
27307
27308 @item pentium-m
27309 Intel Pentium M; low-power version of Intel Pentium III CPU
27310 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27311
27312 @item pentium4
27313 @itemx pentium4m
27314 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27315
27316 @item prescott
27317 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27318 set support.
27319
27320 @item nocona
27321 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27322 SSE2 and SSE3 instruction set support.
27323
27324 @item core2
27325 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27326 instruction set support.
27327
27328 @item nehalem
27329 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27330 SSE4.1, SSE4.2 and POPCNT instruction set support.
27331
27332 @item westmere
27333 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27334 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27335
27336 @item sandybridge
27337 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27338 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27339
27340 @item ivybridge
27341 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27342 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27343 instruction set support.
27344
27345 @item haswell
27346 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27347 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27348 BMI, BMI2 and F16C instruction set support.
27349
27350 @item broadwell
27351 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27352 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27353 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27354
27355 @item skylake
27356 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27357 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27358 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27359 XSAVES instruction set support.
27360
27361 @item bonnell
27362 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27363 instruction set support.
27364
27365 @item silvermont
27366 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27367 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27368
27369 @item goldmont
27370 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27371 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27372 instruction set support.
27373
27374 @item goldmont-plus
27375 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27376 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27377 PTWRITE, RDPID, SGX and UMIP instruction set support.
27378
27379 @item tremont
27380 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27381 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27382 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27383
27384 @item knl
27385 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27386 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27387 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27388 AVX512CD instruction set support.
27389
27390 @item knm
27391 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27392 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27393 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27394 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27395
27396 @item skylake-avx512
27397 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27398 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27399 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27400 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27401
27402 @item cannonlake
27403 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27404 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27405 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27406 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27407 AVX512IFMA, SHA and UMIP instruction set support.
27408
27409 @item icelake-client
27410 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27411 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27412 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27413 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27414 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27415 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27416
27417 @item icelake-server
27418 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27419 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27420 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27421 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27422 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27423 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27424 set support.
27425
27426 @item cascadelake
27427 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27428 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27429 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27430 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27431
27432 @item k6
27433 AMD K6 CPU with MMX instruction set support.
27434
27435 @item k6-2
27436 @itemx k6-3
27437 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27438
27439 @item athlon
27440 @itemx athlon-tbird
27441 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27442 support.
27443
27444 @item athlon-4
27445 @itemx athlon-xp
27446 @itemx athlon-mp
27447 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27448 instruction set support.
27449
27450 @item k8
27451 @itemx opteron
27452 @itemx athlon64
27453 @itemx athlon-fx
27454 Processors based on the AMD K8 core with x86-64 instruction set support,
27455 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27456 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27457 instruction set extensions.)
27458
27459 @item k8-sse3
27460 @itemx opteron-sse3
27461 @itemx athlon64-sse3
27462 Improved versions of AMD K8 cores with SSE3 instruction set support.
27463
27464 @item amdfam10
27465 @itemx barcelona
27466 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27467 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27468 instruction set extensions.)
27469
27470 @item bdver1
27471 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27472 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27473 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27474 @item bdver2
27475 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27476 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27477 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27478 extensions.)
27479 @item bdver3
27480 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27481 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27482 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27483 64-bit instruction set extensions.
27484 @item bdver4
27485 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27486 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27487 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27488 SSE4.2, ABM and 64-bit instruction set extensions.
27489
27490 @item znver1
27491 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27492 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27493 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27494 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27495 instruction set extensions.
27496 @item znver2
27497 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27498 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27499 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27500 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27501 instruction set extensions.)
27502
27503
27504 @item btver1
27505 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27506 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27507 instruction set extensions.)
27508
27509 @item btver2
27510 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27511 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27512 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27513
27514 @item winchip-c6
27515 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27516 set support.
27517
27518 @item winchip2
27519 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27520 instruction set support.
27521
27522 @item c3
27523 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27524 (No scheduling is implemented for this chip.)
27525
27526 @item c3-2
27527 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27528 (No scheduling is implemented for this chip.)
27529
27530 @item c7
27531 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27532 (No scheduling is implemented for this chip.)
27533
27534 @item samuel-2
27535 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27536 (No scheduling is implemented for this chip.)
27537
27538 @item nehemiah
27539 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27540 (No scheduling is implemented for this chip.)
27541
27542 @item esther
27543 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27544 (No scheduling is implemented for this chip.)
27545
27546 @item eden-x2
27547 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27548 (No scheduling is implemented for this chip.)
27549
27550 @item eden-x4
27551 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27552 AVX and AVX2 instruction set support.
27553 (No scheduling is implemented for this chip.)
27554
27555 @item nano
27556 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27557 instruction set support.
27558 (No scheduling is implemented for this chip.)
27559
27560 @item nano-1000
27561 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27562 instruction set support.
27563 (No scheduling is implemented for this chip.)
27564
27565 @item nano-2000
27566 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27567 instruction set support.
27568 (No scheduling is implemented for this chip.)
27569
27570 @item nano-3000
27571 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27572 instruction set support.
27573 (No scheduling is implemented for this chip.)
27574
27575 @item nano-x2
27576 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27577 instruction set support.
27578 (No scheduling is implemented for this chip.)
27579
27580 @item nano-x4
27581 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27582 instruction set support.
27583 (No scheduling is implemented for this chip.)
27584
27585 @item geode
27586 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27587 @end table
27588
27589 @item -mtune=@var{cpu-type}
27590 @opindex mtune
27591 Tune to @var{cpu-type} everything applicable about the generated code, except
27592 for the ABI and the set of available instructions.
27593 While picking a specific @var{cpu-type} schedules things appropriately
27594 for that particular chip, the compiler does not generate any code that
27595 cannot run on the default machine type unless you use a
27596 @option{-march=@var{cpu-type}} option.
27597 For example, if GCC is configured for i686-pc-linux-gnu
27598 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27599 but still runs on i686 machines.
27600
27601 The choices for @var{cpu-type} are the same as for @option{-march}.
27602 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27603
27604 @table @samp
27605 @item generic
27606 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27607 If you know the CPU on which your code will run, then you should use
27608 the corresponding @option{-mtune} or @option{-march} option instead of
27609 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27610 of your application will have, then you should use this option.
27611
27612 As new processors are deployed in the marketplace, the behavior of this
27613 option will change. Therefore, if you upgrade to a newer version of
27614 GCC, code generation controlled by this option will change to reflect
27615 the processors
27616 that are most common at the time that version of GCC is released.
27617
27618 There is no @option{-march=generic} option because @option{-march}
27619 indicates the instruction set the compiler can use, and there is no
27620 generic instruction set applicable to all processors. In contrast,
27621 @option{-mtune} indicates the processor (or, in this case, collection of
27622 processors) for which the code is optimized.
27623
27624 @item intel
27625 Produce code optimized for the most current Intel processors, which are
27626 Haswell and Silvermont for this version of GCC. If you know the CPU
27627 on which your code will run, then you should use the corresponding
27628 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27629 But, if you want your application performs better on both Haswell and
27630 Silvermont, then you should use this option.
27631
27632 As new Intel processors are deployed in the marketplace, the behavior of
27633 this option will change. Therefore, if you upgrade to a newer version of
27634 GCC, code generation controlled by this option will change to reflect
27635 the most current Intel processors at the time that version of GCC is
27636 released.
27637
27638 There is no @option{-march=intel} option because @option{-march} indicates
27639 the instruction set the compiler can use, and there is no common
27640 instruction set applicable to all processors. In contrast,
27641 @option{-mtune} indicates the processor (or, in this case, collection of
27642 processors) for which the code is optimized.
27643 @end table
27644
27645 @item -mcpu=@var{cpu-type}
27646 @opindex mcpu
27647 A deprecated synonym for @option{-mtune}.
27648
27649 @item -mfpmath=@var{unit}
27650 @opindex mfpmath
27651 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27652 for @var{unit} are:
27653
27654 @table @samp
27655 @item 387
27656 Use the standard 387 floating-point coprocessor present on the majority of chips and
27657 emulated otherwise. Code compiled with this option runs almost everywhere.
27658 The temporary results are computed in 80-bit precision instead of the precision
27659 specified by the type, resulting in slightly different results compared to most
27660 of other chips. See @option{-ffloat-store} for more detailed description.
27661
27662 This is the default choice for non-Darwin x86-32 targets.
27663
27664 @item sse
27665 Use scalar floating-point instructions present in the SSE instruction set.
27666 This instruction set is supported by Pentium III and newer chips,
27667 and in the AMD line
27668 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27669 instruction set supports only single-precision arithmetic, thus the double and
27670 extended-precision arithmetic are still done using 387. A later version, present
27671 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27672 arithmetic too.
27673
27674 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27675 or @option{-msse2} switches to enable SSE extensions and make this option
27676 effective. For the x86-64 compiler, these extensions are enabled by default.
27677
27678 The resulting code should be considerably faster in the majority of cases and avoid
27679 the numerical instability problems of 387 code, but may break some existing
27680 code that expects temporaries to be 80 bits.
27681
27682 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27683 and the default choice for x86-32 targets with the SSE2 instruction set
27684 when @option{-ffast-math} is enabled.
27685
27686 @item sse,387
27687 @itemx sse+387
27688 @itemx both
27689 Attempt to utilize both instruction sets at once. This effectively doubles the
27690 amount of available registers, and on chips with separate execution units for
27691 387 and SSE the execution resources too. Use this option with care, as it is
27692 still experimental, because the GCC register allocator does not model separate
27693 functional units well, resulting in unstable performance.
27694 @end table
27695
27696 @item -masm=@var{dialect}
27697 @opindex masm=@var{dialect}
27698 Output assembly instructions using selected @var{dialect}. Also affects
27699 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27700 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27701 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27702 not support @samp{intel}.
27703
27704 @item -mieee-fp
27705 @itemx -mno-ieee-fp
27706 @opindex mieee-fp
27707 @opindex mno-ieee-fp
27708 Control whether or not the compiler uses IEEE floating-point
27709 comparisons. These correctly handle the case where the result of a
27710 comparison is unordered.
27711
27712 @item -m80387
27713 @itemx -mhard-float
27714 @opindex 80387
27715 @opindex mhard-float
27716 Generate output containing 80387 instructions for floating point.
27717
27718 @item -mno-80387
27719 @itemx -msoft-float
27720 @opindex no-80387
27721 @opindex msoft-float
27722 Generate output containing library calls for floating point.
27723
27724 @strong{Warning:} the requisite libraries are not part of GCC@.
27725 Normally the facilities of the machine's usual C compiler are used, but
27726 this cannot be done directly in cross-compilation. You must make your
27727 own arrangements to provide suitable library functions for
27728 cross-compilation.
27729
27730 On machines where a function returns floating-point results in the 80387
27731 register stack, some floating-point opcodes may be emitted even if
27732 @option{-msoft-float} is used.
27733
27734 @item -mno-fp-ret-in-387
27735 @opindex mno-fp-ret-in-387
27736 @opindex mfp-ret-in-387
27737 Do not use the FPU registers for return values of functions.
27738
27739 The usual calling convention has functions return values of types
27740 @code{float} and @code{double} in an FPU register, even if there
27741 is no FPU@. The idea is that the operating system should emulate
27742 an FPU@.
27743
27744 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27745 in ordinary CPU registers instead.
27746
27747 @item -mno-fancy-math-387
27748 @opindex mno-fancy-math-387
27749 @opindex mfancy-math-387
27750 Some 387 emulators do not support the @code{sin}, @code{cos} and
27751 @code{sqrt} instructions for the 387. Specify this option to avoid
27752 generating those instructions.
27753 This option is overridden when @option{-march}
27754 indicates that the target CPU always has an FPU and so the
27755 instruction does not need emulation. These
27756 instructions are not generated unless you also use the
27757 @option{-funsafe-math-optimizations} switch.
27758
27759 @item -malign-double
27760 @itemx -mno-align-double
27761 @opindex malign-double
27762 @opindex mno-align-double
27763 Control whether GCC aligns @code{double}, @code{long double}, and
27764 @code{long long} variables on a two-word boundary or a one-word
27765 boundary. Aligning @code{double} variables on a two-word boundary
27766 produces code that runs somewhat faster on a Pentium at the
27767 expense of more memory.
27768
27769 On x86-64, @option{-malign-double} is enabled by default.
27770
27771 @strong{Warning:} if you use the @option{-malign-double} switch,
27772 structures containing the above types are aligned differently than
27773 the published application binary interface specifications for the x86-32
27774 and are not binary compatible with structures in code compiled
27775 without that switch.
27776
27777 @item -m96bit-long-double
27778 @itemx -m128bit-long-double
27779 @opindex m96bit-long-double
27780 @opindex m128bit-long-double
27781 These switches control the size of @code{long double} type. The x86-32
27782 application binary interface specifies the size to be 96 bits,
27783 so @option{-m96bit-long-double} is the default in 32-bit mode.
27784
27785 Modern architectures (Pentium and newer) prefer @code{long double}
27786 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27787 conforming to the ABI, this is not possible. So specifying
27788 @option{-m128bit-long-double} aligns @code{long double}
27789 to a 16-byte boundary by padding the @code{long double} with an additional
27790 32-bit zero.
27791
27792 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27793 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27794
27795 Notice that neither of these options enable any extra precision over the x87
27796 standard of 80 bits for a @code{long double}.
27797
27798 @strong{Warning:} if you override the default value for your target ABI, this
27799 changes the size of
27800 structures and arrays containing @code{long double} variables,
27801 as well as modifying the function calling convention for functions taking
27802 @code{long double}. Hence they are not binary-compatible
27803 with code compiled without that switch.
27804
27805 @item -mlong-double-64
27806 @itemx -mlong-double-80
27807 @itemx -mlong-double-128
27808 @opindex mlong-double-64
27809 @opindex mlong-double-80
27810 @opindex mlong-double-128
27811 These switches control the size of @code{long double} type. A size
27812 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27813 type. This is the default for 32-bit Bionic C library. A size
27814 of 128 bits makes the @code{long double} type equivalent to the
27815 @code{__float128} type. This is the default for 64-bit Bionic C library.
27816
27817 @strong{Warning:} if you override the default value for your target ABI, this
27818 changes the size of
27819 structures and arrays containing @code{long double} variables,
27820 as well as modifying the function calling convention for functions taking
27821 @code{long double}. Hence they are not binary-compatible
27822 with code compiled without that switch.
27823
27824 @item -malign-data=@var{type}
27825 @opindex malign-data
27826 Control how GCC aligns variables. Supported values for @var{type} are
27827 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27828 and earlier, @samp{abi} uses alignment value as specified by the
27829 psABI, and @samp{cacheline} uses increased alignment value to match
27830 the cache line size. @samp{compat} is the default.
27831
27832 @item -mlarge-data-threshold=@var{threshold}
27833 @opindex mlarge-data-threshold
27834 When @option{-mcmodel=medium} is specified, data objects larger than
27835 @var{threshold} are placed in the large data section. This value must be the
27836 same across all objects linked into the binary, and defaults to 65535.
27837
27838 @item -mrtd
27839 @opindex mrtd
27840 Use a different function-calling convention, in which functions that
27841 take a fixed number of arguments return with the @code{ret @var{num}}
27842 instruction, which pops their arguments while returning. This saves one
27843 instruction in the caller since there is no need to pop the arguments
27844 there.
27845
27846 You can specify that an individual function is called with this calling
27847 sequence with the function attribute @code{stdcall}. You can also
27848 override the @option{-mrtd} option by using the function attribute
27849 @code{cdecl}. @xref{Function Attributes}.
27850
27851 @strong{Warning:} this calling convention is incompatible with the one
27852 normally used on Unix, so you cannot use it if you need to call
27853 libraries compiled with the Unix compiler.
27854
27855 Also, you must provide function prototypes for all functions that
27856 take variable numbers of arguments (including @code{printf});
27857 otherwise incorrect code is generated for calls to those
27858 functions.
27859
27860 In addition, seriously incorrect code results if you call a
27861 function with too many arguments. (Normally, extra arguments are
27862 harmlessly ignored.)
27863
27864 @item -mregparm=@var{num}
27865 @opindex mregparm
27866 Control how many registers are used to pass integer arguments. By
27867 default, no registers are used to pass arguments, and at most 3
27868 registers can be used. You can control this behavior for a specific
27869 function by using the function attribute @code{regparm}.
27870 @xref{Function Attributes}.
27871
27872 @strong{Warning:} if you use this switch, and
27873 @var{num} is nonzero, then you must build all modules with the same
27874 value, including any libraries. This includes the system libraries and
27875 startup modules.
27876
27877 @item -msseregparm
27878 @opindex msseregparm
27879 Use SSE register passing conventions for float and double arguments
27880 and return values. You can control this behavior for a specific
27881 function by using the function attribute @code{sseregparm}.
27882 @xref{Function Attributes}.
27883
27884 @strong{Warning:} if you use this switch then you must build all
27885 modules with the same value, including any libraries. This includes
27886 the system libraries and startup modules.
27887
27888 @item -mvect8-ret-in-mem
27889 @opindex mvect8-ret-in-mem
27890 Return 8-byte vectors in memory instead of MMX registers. This is the
27891 default on VxWorks to match the ABI of the Sun Studio compilers until
27892 version 12. @emph{Only} use this option if you need to remain
27893 compatible with existing code produced by those previous compiler
27894 versions or older versions of GCC@.
27895
27896 @item -mpc32
27897 @itemx -mpc64
27898 @itemx -mpc80
27899 @opindex mpc32
27900 @opindex mpc64
27901 @opindex mpc80
27902
27903 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27904 is specified, the significands of results of floating-point operations are
27905 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27906 significands of results of floating-point operations to 53 bits (double
27907 precision) and @option{-mpc80} rounds the significands of results of
27908 floating-point operations to 64 bits (extended double precision), which is
27909 the default. When this option is used, floating-point operations in higher
27910 precisions are not available to the programmer without setting the FPU
27911 control word explicitly.
27912
27913 Setting the rounding of floating-point operations to less than the default
27914 80 bits can speed some programs by 2% or more. Note that some mathematical
27915 libraries assume that extended-precision (80-bit) floating-point operations
27916 are enabled by default; routines in such libraries could suffer significant
27917 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27918 when this option is used to set the precision to less than extended precision.
27919
27920 @item -mstackrealign
27921 @opindex mstackrealign
27922 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27923 option generates an alternate prologue and epilogue that realigns the
27924 run-time stack if necessary. This supports mixing legacy codes that keep
27925 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27926 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27927 applicable to individual functions.
27928
27929 @item -mpreferred-stack-boundary=@var{num}
27930 @opindex mpreferred-stack-boundary
27931 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27932 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27933 the default is 4 (16 bytes or 128 bits).
27934
27935 @strong{Warning:} When generating code for the x86-64 architecture with
27936 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27937 used to keep the stack boundary aligned to 8 byte boundary. Since
27938 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27939 intended to be used in controlled environment where stack space is
27940 important limitation. This option leads to wrong code when functions
27941 compiled with 16 byte stack alignment (such as functions from a standard
27942 library) are called with misaligned stack. In this case, SSE
27943 instructions may lead to misaligned memory access traps. In addition,
27944 variable arguments are handled incorrectly for 16 byte aligned
27945 objects (including x87 long double and __int128), leading to wrong
27946 results. You must build all modules with
27947 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27948 includes the system libraries and startup modules.
27949
27950 @item -mincoming-stack-boundary=@var{num}
27951 @opindex mincoming-stack-boundary
27952 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27953 boundary. If @option{-mincoming-stack-boundary} is not specified,
27954 the one specified by @option{-mpreferred-stack-boundary} is used.
27955
27956 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27957 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27958 suffer significant run time performance penalties. On Pentium III, the
27959 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27960 properly if it is not 16-byte aligned.
27961
27962 To ensure proper alignment of this values on the stack, the stack boundary
27963 must be as aligned as that required by any value stored on the stack.
27964 Further, every function must be generated such that it keeps the stack
27965 aligned. Thus calling a function compiled with a higher preferred
27966 stack boundary from a function compiled with a lower preferred stack
27967 boundary most likely misaligns the stack. It is recommended that
27968 libraries that use callbacks always use the default setting.
27969
27970 This extra alignment does consume extra stack space, and generally
27971 increases code size. Code that is sensitive to stack space usage, such
27972 as embedded systems and operating system kernels, may want to reduce the
27973 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27974
27975 @need 200
27976 @item -mmmx
27977 @opindex mmmx
27978 @need 200
27979 @itemx -msse
27980 @opindex msse
27981 @need 200
27982 @itemx -msse2
27983 @opindex msse2
27984 @need 200
27985 @itemx -msse3
27986 @opindex msse3
27987 @need 200
27988 @itemx -mssse3
27989 @opindex mssse3
27990 @need 200
27991 @itemx -msse4
27992 @opindex msse4
27993 @need 200
27994 @itemx -msse4a
27995 @opindex msse4a
27996 @need 200
27997 @itemx -msse4.1
27998 @opindex msse4.1
27999 @need 200
28000 @itemx -msse4.2
28001 @opindex msse4.2
28002 @need 200
28003 @itemx -mavx
28004 @opindex mavx
28005 @need 200
28006 @itemx -mavx2
28007 @opindex mavx2
28008 @need 200
28009 @itemx -mavx512f
28010 @opindex mavx512f
28011 @need 200
28012 @itemx -mavx512pf
28013 @opindex mavx512pf
28014 @need 200
28015 @itemx -mavx512er
28016 @opindex mavx512er
28017 @need 200
28018 @itemx -mavx512cd
28019 @opindex mavx512cd
28020 @need 200
28021 @itemx -mavx512vl
28022 @opindex mavx512vl
28023 @need 200
28024 @itemx -mavx512bw
28025 @opindex mavx512bw
28026 @need 200
28027 @itemx -mavx512dq
28028 @opindex mavx512dq
28029 @need 200
28030 @itemx -mavx512ifma
28031 @opindex mavx512ifma
28032 @need 200
28033 @itemx -mavx512vbmi
28034 @opindex mavx512vbmi
28035 @need 200
28036 @itemx -msha
28037 @opindex msha
28038 @need 200
28039 @itemx -maes
28040 @opindex maes
28041 @need 200
28042 @itemx -mpclmul
28043 @opindex mpclmul
28044 @need 200
28045 @itemx -mclflushopt
28046 @opindex mclflushopt
28047 @need 200
28048 @itemx -mclwb
28049 @opindex mclwb
28050 @need 200
28051 @itemx -mfsgsbase
28052 @opindex mfsgsbase
28053 @need 200
28054 @itemx -mptwrite
28055 @opindex mptwrite
28056 @need 200
28057 @itemx -mrdrnd
28058 @opindex mrdrnd
28059 @need 200
28060 @itemx -mf16c
28061 @opindex mf16c
28062 @need 200
28063 @itemx -mfma
28064 @opindex mfma
28065 @need 200
28066 @itemx -mpconfig
28067 @opindex mpconfig
28068 @need 200
28069 @itemx -mwbnoinvd
28070 @opindex mwbnoinvd
28071 @need 200
28072 @itemx -mfma4
28073 @opindex mfma4
28074 @need 200
28075 @itemx -mprfchw
28076 @opindex mprfchw
28077 @need 200
28078 @itemx -mrdpid
28079 @opindex mrdpid
28080 @need 200
28081 @itemx -mprefetchwt1
28082 @opindex mprefetchwt1
28083 @need 200
28084 @itemx -mrdseed
28085 @opindex mrdseed
28086 @need 200
28087 @itemx -msgx
28088 @opindex msgx
28089 @need 200
28090 @itemx -mxop
28091 @opindex mxop
28092 @need 200
28093 @itemx -mlwp
28094 @opindex mlwp
28095 @need 200
28096 @itemx -m3dnow
28097 @opindex m3dnow
28098 @need 200
28099 @itemx -m3dnowa
28100 @opindex m3dnowa
28101 @need 200
28102 @itemx -mpopcnt
28103 @opindex mpopcnt
28104 @need 200
28105 @itemx -mabm
28106 @opindex mabm
28107 @need 200
28108 @itemx -madx
28109 @opindex madx
28110 @need 200
28111 @itemx -mbmi
28112 @opindex mbmi
28113 @need 200
28114 @itemx -mbmi2
28115 @opindex mbmi2
28116 @need 200
28117 @itemx -mlzcnt
28118 @opindex mlzcnt
28119 @need 200
28120 @itemx -mfxsr
28121 @opindex mfxsr
28122 @need 200
28123 @itemx -mxsave
28124 @opindex mxsave
28125 @need 200
28126 @itemx -mxsaveopt
28127 @opindex mxsaveopt
28128 @need 200
28129 @itemx -mxsavec
28130 @opindex mxsavec
28131 @need 200
28132 @itemx -mxsaves
28133 @opindex mxsaves
28134 @need 200
28135 @itemx -mrtm
28136 @opindex mrtm
28137 @need 200
28138 @itemx -mhle
28139 @opindex mhle
28140 @need 200
28141 @itemx -mtbm
28142 @opindex mtbm
28143 @need 200
28144 @itemx -mmwaitx
28145 @opindex mmwaitx
28146 @need 200
28147 @itemx -mclzero
28148 @opindex mclzero
28149 @need 200
28150 @itemx -mpku
28151 @opindex mpku
28152 @need 200
28153 @itemx -mavx512vbmi2
28154 @opindex mavx512vbmi2
28155 @need 200
28156 @itemx -mavx512bf16
28157 @opindex mavx512bf16
28158 @need 200
28159 @itemx -mgfni
28160 @opindex mgfni
28161 @need 200
28162 @itemx -mvaes
28163 @opindex mvaes
28164 @need 200
28165 @itemx -mwaitpkg
28166 @opindex mwaitpkg
28167 @need 200
28168 @itemx -mvpclmulqdq
28169 @opindex mvpclmulqdq
28170 @need 200
28171 @itemx -mavx512bitalg
28172 @opindex mavx512bitalg
28173 @need 200
28174 @itemx -mmovdiri
28175 @opindex mmovdiri
28176 @need 200
28177 @itemx -mmovdir64b
28178 @opindex mmovdir64b
28179 @need 200
28180 @itemx -menqcmd
28181 @opindex menqcmd
28182 @need 200
28183 @itemx -mavx512vpopcntdq
28184 @opindex mavx512vpopcntdq
28185 @need 200
28186 @itemx -mavx5124fmaps
28187 @opindex mavx5124fmaps
28188 @need 200
28189 @itemx -mavx512vnni
28190 @opindex mavx512vnni
28191 @need 200
28192 @itemx -mavx5124vnniw
28193 @opindex mavx5124vnniw
28194 @need 200
28195 @itemx -mcldemote
28196 @opindex mcldemote
28197 These switches enable the use of instructions in the MMX, SSE,
28198 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28199 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28200 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28201 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28202 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28203 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28204 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28205 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28206 extended instruction sets. Each has a corresponding @option{-mno-} option to
28207 disable use of these instructions.
28208
28209 These extensions are also available as built-in functions: see
28210 @ref{x86 Built-in Functions}, for details of the functions enabled and
28211 disabled by these switches.
28212
28213 To generate SSE/SSE2 instructions automatically from floating-point
28214 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28215
28216 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28217 generates new AVX instructions or AVX equivalence for all SSEx instructions
28218 when needed.
28219
28220 These options enable GCC to use these extended instructions in
28221 generated code, even without @option{-mfpmath=sse}. Applications that
28222 perform run-time CPU detection must compile separate files for each
28223 supported architecture, using the appropriate flags. In particular,
28224 the file containing the CPU detection code should be compiled without
28225 these options.
28226
28227 @item -mdump-tune-features
28228 @opindex mdump-tune-features
28229 This option instructs GCC to dump the names of the x86 performance
28230 tuning features and default settings. The names can be used in
28231 @option{-mtune-ctrl=@var{feature-list}}.
28232
28233 @item -mtune-ctrl=@var{feature-list}
28234 @opindex mtune-ctrl=@var{feature-list}
28235 This option is used to do fine grain control of x86 code generation features.
28236 @var{feature-list} is a comma separated list of @var{feature} names. See also
28237 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28238 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28239 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28240 developers. Using it may lead to code paths not covered by testing and can
28241 potentially result in compiler ICEs or runtime errors.
28242
28243 @item -mno-default
28244 @opindex mno-default
28245 This option instructs GCC to turn off all tunable features. See also
28246 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28247
28248 @item -mcld
28249 @opindex mcld
28250 This option instructs GCC to emit a @code{cld} instruction in the prologue
28251 of functions that use string instructions. String instructions depend on
28252 the DF flag to select between autoincrement or autodecrement mode. While the
28253 ABI specifies the DF flag to be cleared on function entry, some operating
28254 systems violate this specification by not clearing the DF flag in their
28255 exception dispatchers. The exception handler can be invoked with the DF flag
28256 set, which leads to wrong direction mode when string instructions are used.
28257 This option can be enabled by default on 32-bit x86 targets by configuring
28258 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28259 instructions can be suppressed with the @option{-mno-cld} compiler option
28260 in this case.
28261
28262 @item -mvzeroupper
28263 @opindex mvzeroupper
28264 This option instructs GCC to emit a @code{vzeroupper} instruction
28265 before a transfer of control flow out of the function to minimize
28266 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28267 intrinsics.
28268
28269 @item -mprefer-avx128
28270 @opindex mprefer-avx128
28271 This option instructs GCC to use 128-bit AVX instructions instead of
28272 256-bit AVX instructions in the auto-vectorizer.
28273
28274 @item -mprefer-vector-width=@var{opt}
28275 @opindex mprefer-vector-width
28276 This option instructs GCC to use @var{opt}-bit vector width in instructions
28277 instead of default on the selected platform.
28278
28279 @table @samp
28280 @item none
28281 No extra limitations applied to GCC other than defined by the selected platform.
28282
28283 @item 128
28284 Prefer 128-bit vector width for instructions.
28285
28286 @item 256
28287 Prefer 256-bit vector width for instructions.
28288
28289 @item 512
28290 Prefer 512-bit vector width for instructions.
28291 @end table
28292
28293 @item -mcx16
28294 @opindex mcx16
28295 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28296 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28297 objects. This is useful for atomic updates of data structures exceeding one
28298 machine word in size. The compiler uses this instruction to implement
28299 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28300 128-bit integers, a library call is always used.
28301
28302 @item -msahf
28303 @opindex msahf
28304 This option enables generation of @code{SAHF} instructions in 64-bit code.
28305 Early Intel Pentium 4 CPUs with Intel 64 support,
28306 prior to the introduction of Pentium 4 G1 step in December 2005,
28307 lacked the @code{LAHF} and @code{SAHF} instructions
28308 which are supported by AMD64.
28309 These are load and store instructions, respectively, for certain status flags.
28310 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28311 @code{drem}, and @code{remainder} built-in functions;
28312 see @ref{Other Builtins} for details.
28313
28314 @item -mmovbe
28315 @opindex mmovbe
28316 This option enables use of the @code{movbe} instruction to implement
28317 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28318
28319 @item -mshstk
28320 @opindex mshstk
28321 The @option{-mshstk} option enables shadow stack built-in functions
28322 from x86 Control-flow Enforcement Technology (CET).
28323
28324 @item -mcrc32
28325 @opindex mcrc32
28326 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28327 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28328 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28329
28330 @item -mrecip
28331 @opindex mrecip
28332 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28333 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28334 with an additional Newton-Raphson step
28335 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28336 (and their vectorized
28337 variants) for single-precision floating-point arguments. These instructions
28338 are generated only when @option{-funsafe-math-optimizations} is enabled
28339 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28340 Note that while the throughput of the sequence is higher than the throughput
28341 of the non-reciprocal instruction, the precision of the sequence can be
28342 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28343
28344 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28345 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28346 combination), and doesn't need @option{-mrecip}.
28347
28348 Also note that GCC emits the above sequence with additional Newton-Raphson step
28349 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28350 already with @option{-ffast-math} (or the above option combination), and
28351 doesn't need @option{-mrecip}.
28352
28353 @item -mrecip=@var{opt}
28354 @opindex mrecip=opt
28355 This option controls which reciprocal estimate instructions
28356 may be used. @var{opt} is a comma-separated list of options, which may
28357 be preceded by a @samp{!} to invert the option:
28358
28359 @table @samp
28360 @item all
28361 Enable all estimate instructions.
28362
28363 @item default
28364 Enable the default instructions, equivalent to @option{-mrecip}.
28365
28366 @item none
28367 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28368
28369 @item div
28370 Enable the approximation for scalar division.
28371
28372 @item vec-div
28373 Enable the approximation for vectorized division.
28374
28375 @item sqrt
28376 Enable the approximation for scalar square root.
28377
28378 @item vec-sqrt
28379 Enable the approximation for vectorized square root.
28380 @end table
28381
28382 So, for example, @option{-mrecip=all,!sqrt} enables
28383 all of the reciprocal approximations, except for square root.
28384
28385 @item -mveclibabi=@var{type}
28386 @opindex mveclibabi
28387 Specifies the ABI type to use for vectorizing intrinsics using an
28388 external library. Supported values for @var{type} are @samp{svml}
28389 for the Intel short
28390 vector math library and @samp{acml} for the AMD math core library.
28391 To use this option, both @option{-ftree-vectorize} and
28392 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28393 ABI-compatible library must be specified at link time.
28394
28395 GCC currently emits calls to @code{vmldExp2},
28396 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28397 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28398 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28399 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28400 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28401 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28402 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28403 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28404 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28405 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28406 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28407 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28408 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28409 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28410 when @option{-mveclibabi=acml} is used.
28411
28412 @item -mabi=@var{name}
28413 @opindex mabi
28414 Generate code for the specified calling convention. Permissible values
28415 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28416 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28417 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28418 You can control this behavior for specific functions by
28419 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28420 @xref{Function Attributes}.
28421
28422 @item -mforce-indirect-call
28423 @opindex mforce-indirect-call
28424 Force all calls to functions to be indirect. This is useful
28425 when using Intel Processor Trace where it generates more precise timing
28426 information for function calls.
28427
28428 @item -mmanual-endbr
28429 @opindex mmanual-endbr
28430 Insert ENDBR instruction at function entry only via the @code{cf_check}
28431 function attribute. This is useful when used with the option
28432 @option{-fcf-protection=branch} to control ENDBR insertion at the
28433 function entry.
28434
28435 @item -mcall-ms2sysv-xlogues
28436 @opindex mcall-ms2sysv-xlogues
28437 @opindex mno-call-ms2sysv-xlogues
28438 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28439 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28440 default, the code for saving and restoring these registers is emitted inline,
28441 resulting in fairly lengthy prologues and epilogues. Using
28442 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28443 use stubs in the static portion of libgcc to perform these saves and restores,
28444 thus reducing function size at the cost of a few extra instructions.
28445
28446 @item -mtls-dialect=@var{type}
28447 @opindex mtls-dialect
28448 Generate code to access thread-local storage using the @samp{gnu} or
28449 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28450 @samp{gnu2} is more efficient, but it may add compile- and run-time
28451 requirements that cannot be satisfied on all systems.
28452
28453 @item -mpush-args
28454 @itemx -mno-push-args
28455 @opindex mpush-args
28456 @opindex mno-push-args
28457 Use PUSH operations to store outgoing parameters. This method is shorter
28458 and usually equally fast as method using SUB/MOV operations and is enabled
28459 by default. In some cases disabling it may improve performance because of
28460 improved scheduling and reduced dependencies.
28461
28462 @item -maccumulate-outgoing-args
28463 @opindex maccumulate-outgoing-args
28464 If enabled, the maximum amount of space required for outgoing arguments is
28465 computed in the function prologue. This is faster on most modern CPUs
28466 because of reduced dependencies, improved scheduling and reduced stack usage
28467 when the preferred stack boundary is not equal to 2. The drawback is a notable
28468 increase in code size. This switch implies @option{-mno-push-args}.
28469
28470 @item -mthreads
28471 @opindex mthreads
28472 Support thread-safe exception handling on MinGW. Programs that rely
28473 on thread-safe exception handling must compile and link all code with the
28474 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28475 @option{-D_MT}; when linking, it links in a special thread helper library
28476 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28477
28478 @item -mms-bitfields
28479 @itemx -mno-ms-bitfields
28480 @opindex mms-bitfields
28481 @opindex mno-ms-bitfields
28482
28483 Enable/disable bit-field layout compatible with the native Microsoft
28484 Windows compiler.
28485
28486 If @code{packed} is used on a structure, or if bit-fields are used,
28487 it may be that the Microsoft ABI lays out the structure differently
28488 than the way GCC normally does. Particularly when moving packed
28489 data between functions compiled with GCC and the native Microsoft compiler
28490 (either via function call or as data in a file), it may be necessary to access
28491 either format.
28492
28493 This option is enabled by default for Microsoft Windows
28494 targets. This behavior can also be controlled locally by use of variable
28495 or type attributes. For more information, see @ref{x86 Variable Attributes}
28496 and @ref{x86 Type Attributes}.
28497
28498 The Microsoft structure layout algorithm is fairly simple with the exception
28499 of the bit-field packing.
28500 The padding and alignment of members of structures and whether a bit-field
28501 can straddle a storage-unit boundary are determine by these rules:
28502
28503 @enumerate
28504 @item Structure members are stored sequentially in the order in which they are
28505 declared: the first member has the lowest memory address and the last member
28506 the highest.
28507
28508 @item Every data object has an alignment requirement. The alignment requirement
28509 for all data except structures, unions, and arrays is either the size of the
28510 object or the current packing size (specified with either the
28511 @code{aligned} attribute or the @code{pack} pragma),
28512 whichever is less. For structures, unions, and arrays,
28513 the alignment requirement is the largest alignment requirement of its members.
28514 Every object is allocated an offset so that:
28515
28516 @smallexample
28517 offset % alignment_requirement == 0
28518 @end smallexample
28519
28520 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28521 unit if the integral types are the same size and if the next bit-field fits
28522 into the current allocation unit without crossing the boundary imposed by the
28523 common alignment requirements of the bit-fields.
28524 @end enumerate
28525
28526 MSVC interprets zero-length bit-fields in the following ways:
28527
28528 @enumerate
28529 @item If a zero-length bit-field is inserted between two bit-fields that
28530 are normally coalesced, the bit-fields are not coalesced.
28531
28532 For example:
28533
28534 @smallexample
28535 struct
28536 @{
28537 unsigned long bf_1 : 12;
28538 unsigned long : 0;
28539 unsigned long bf_2 : 12;
28540 @} t1;
28541 @end smallexample
28542
28543 @noindent
28544 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28545 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28546
28547 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28548 alignment of the zero-length bit-field is greater than the member that follows it,
28549 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28550
28551 For example:
28552
28553 @smallexample
28554 struct
28555 @{
28556 char foo : 4;
28557 short : 0;
28558 char bar;
28559 @} t2;
28560
28561 struct
28562 @{
28563 char foo : 4;
28564 short : 0;
28565 double bar;
28566 @} t3;
28567 @end smallexample
28568
28569 @noindent
28570 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28571 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28572 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28573 of the structure.
28574
28575 Taking this into account, it is important to note the following:
28576
28577 @enumerate
28578 @item If a zero-length bit-field follows a normal bit-field, the type of the
28579 zero-length bit-field may affect the alignment of the structure as whole. For
28580 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28581 normal bit-field, and is of type short.
28582
28583 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28584 still affect the alignment of the structure:
28585
28586 @smallexample
28587 struct
28588 @{
28589 char foo : 6;
28590 long : 0;
28591 @} t4;
28592 @end smallexample
28593
28594 @noindent
28595 Here, @code{t4} takes up 4 bytes.
28596 @end enumerate
28597
28598 @item Zero-length bit-fields following non-bit-field members are ignored:
28599
28600 @smallexample
28601 struct
28602 @{
28603 char foo;
28604 long : 0;
28605 char bar;
28606 @} t5;
28607 @end smallexample
28608
28609 @noindent
28610 Here, @code{t5} takes up 2 bytes.
28611 @end enumerate
28612
28613
28614 @item -mno-align-stringops
28615 @opindex mno-align-stringops
28616 @opindex malign-stringops
28617 Do not align the destination of inlined string operations. This switch reduces
28618 code size and improves performance in case the destination is already aligned,
28619 but GCC doesn't know about it.
28620
28621 @item -minline-all-stringops
28622 @opindex minline-all-stringops
28623 By default GCC inlines string operations only when the destination is
28624 known to be aligned to least a 4-byte boundary.
28625 This enables more inlining and increases code
28626 size, but may improve performance of code that depends on fast
28627 @code{memcpy} and @code{memset} for short lengths.
28628 The option enables inline expansion of @code{strlen} for all
28629 pointer alignments.
28630
28631 @item -minline-stringops-dynamically
28632 @opindex minline-stringops-dynamically
28633 For string operations of unknown size, use run-time checks with
28634 inline code for small blocks and a library call for large blocks.
28635
28636 @item -mstringop-strategy=@var{alg}
28637 @opindex mstringop-strategy=@var{alg}
28638 Override the internal decision heuristic for the particular algorithm to use
28639 for inlining string operations. The allowed values for @var{alg} are:
28640
28641 @table @samp
28642 @item rep_byte
28643 @itemx rep_4byte
28644 @itemx rep_8byte
28645 Expand using i386 @code{rep} prefix of the specified size.
28646
28647 @item byte_loop
28648 @itemx loop
28649 @itemx unrolled_loop
28650 Expand into an inline loop.
28651
28652 @item libcall
28653 Always use a library call.
28654 @end table
28655
28656 @item -mmemcpy-strategy=@var{strategy}
28657 @opindex mmemcpy-strategy=@var{strategy}
28658 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28659 should be inlined and what inline algorithm to use when the expected size
28660 of the copy operation is known. @var{strategy}
28661 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28662 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28663 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28664 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28665 in the list must be specified in increasing order. The minimal byte size for
28666 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28667 preceding range.
28668
28669 @item -mmemset-strategy=@var{strategy}
28670 @opindex mmemset-strategy=@var{strategy}
28671 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28672 @code{__builtin_memset} expansion.
28673
28674 @item -momit-leaf-frame-pointer
28675 @opindex momit-leaf-frame-pointer
28676 Don't keep the frame pointer in a register for leaf functions. This
28677 avoids the instructions to save, set up, and restore frame pointers and
28678 makes an extra register available in leaf functions. The option
28679 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28680 which might make debugging harder.
28681
28682 @item -mtls-direct-seg-refs
28683 @itemx -mno-tls-direct-seg-refs
28684 @opindex mtls-direct-seg-refs
28685 Controls whether TLS variables may be accessed with offsets from the
28686 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28687 or whether the thread base pointer must be added. Whether or not this
28688 is valid depends on the operating system, and whether it maps the
28689 segment to cover the entire TLS area.
28690
28691 For systems that use the GNU C Library, the default is on.
28692
28693 @item -msse2avx
28694 @itemx -mno-sse2avx
28695 @opindex msse2avx
28696 Specify that the assembler should encode SSE instructions with VEX
28697 prefix. The option @option{-mavx} turns this on by default.
28698
28699 @item -mfentry
28700 @itemx -mno-fentry
28701 @opindex mfentry
28702 If profiling is active (@option{-pg}), put the profiling
28703 counter call before the prologue.
28704 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28705 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28706
28707 @item -mrecord-mcount
28708 @itemx -mno-record-mcount
28709 @opindex mrecord-mcount
28710 If profiling is active (@option{-pg}), generate a __mcount_loc section
28711 that contains pointers to each profiling call. This is useful for
28712 automatically patching and out calls.
28713
28714 @item -mnop-mcount
28715 @itemx -mno-nop-mcount
28716 @opindex mnop-mcount
28717 If profiling is active (@option{-pg}), generate the calls to
28718 the profiling functions as NOPs. This is useful when they
28719 should be patched in later dynamically. This is likely only
28720 useful together with @option{-mrecord-mcount}.
28721
28722 @item -minstrument-return=@var{type}
28723 @opindex minstrument-return
28724 Instrument function exit in -pg -mfentry instrumented functions with
28725 call to specified function. This only instruments true returns ending
28726 with ret, but not sibling calls ending with jump. Valid types
28727 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28728 or @var{nop5} to generate a 5 byte nop.
28729
28730 @item -mrecord-return
28731 @itemx -mno-record-return
28732 @opindex mrecord-return
28733 Generate a __return_loc section pointing to all return instrumentation code.
28734
28735 @item -mfentry-name=@var{name}
28736 @opindex mfentry-name
28737 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28738
28739 @item -mfentry-section=@var{name}
28740 @opindex mfentry-section
28741 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28742
28743 @item -mskip-rax-setup
28744 @itemx -mno-skip-rax-setup
28745 @opindex mskip-rax-setup
28746 When generating code for the x86-64 architecture with SSE extensions
28747 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28748 register when there are no variable arguments passed in vector registers.
28749
28750 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28751 saving vector registers on stack when passing variable arguments, the
28752 impacts of this option are callees may waste some stack space,
28753 misbehave or jump to a random location. GCC 4.4 or newer don't have
28754 those issues, regardless the RAX register value.
28755
28756 @item -m8bit-idiv
28757 @itemx -mno-8bit-idiv
28758 @opindex m8bit-idiv
28759 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28760 much faster than 32-bit/64-bit integer divide. This option generates a
28761 run-time check. If both dividend and divisor are within range of 0
28762 to 255, 8-bit unsigned integer divide is used instead of
28763 32-bit/64-bit integer divide.
28764
28765 @item -mavx256-split-unaligned-load
28766 @itemx -mavx256-split-unaligned-store
28767 @opindex mavx256-split-unaligned-load
28768 @opindex mavx256-split-unaligned-store
28769 Split 32-byte AVX unaligned load and store.
28770
28771 @item -mstack-protector-guard=@var{guard}
28772 @itemx -mstack-protector-guard-reg=@var{reg}
28773 @itemx -mstack-protector-guard-offset=@var{offset}
28774 @opindex mstack-protector-guard
28775 @opindex mstack-protector-guard-reg
28776 @opindex mstack-protector-guard-offset
28777 Generate stack protection code using canary at @var{guard}. Supported
28778 locations are @samp{global} for global canary or @samp{tls} for per-thread
28779 canary in the TLS block (the default). This option has effect only when
28780 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28781
28782 With the latter choice the options
28783 @option{-mstack-protector-guard-reg=@var{reg}} and
28784 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28785 which segment register (@code{%fs} or @code{%gs}) to use as base register
28786 for reading the canary, and from what offset from that base register.
28787 The default for those is as specified in the relevant ABI.
28788
28789 @item -mgeneral-regs-only
28790 @opindex mgeneral-regs-only
28791 Generate code that uses only the general-purpose registers. This
28792 prevents the compiler from using floating-point, vector, mask and bound
28793 registers.
28794
28795 @item -mindirect-branch=@var{choice}
28796 @opindex mindirect-branch
28797 Convert indirect call and jump with @var{choice}. The default is
28798 @samp{keep}, which keeps indirect call and jump unmodified.
28799 @samp{thunk} converts indirect call and jump to call and return thunk.
28800 @samp{thunk-inline} converts indirect call and jump to inlined call
28801 and return thunk. @samp{thunk-extern} converts indirect call and jump
28802 to external call and return thunk provided in a separate object file.
28803 You can control this behavior for a specific function by using the
28804 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28805
28806 Note that @option{-mcmodel=large} is incompatible with
28807 @option{-mindirect-branch=thunk} and
28808 @option{-mindirect-branch=thunk-extern} since the thunk function may
28809 not be reachable in the large code model.
28810
28811 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28812 @option{-fcf-protection=branch} since the external thunk cannot be modified
28813 to disable control-flow check.
28814
28815 @item -mfunction-return=@var{choice}
28816 @opindex mfunction-return
28817 Convert function return with @var{choice}. The default is @samp{keep},
28818 which keeps function return unmodified. @samp{thunk} converts function
28819 return to call and return thunk. @samp{thunk-inline} converts function
28820 return to inlined call and return thunk. @samp{thunk-extern} converts
28821 function return to external call and return thunk provided in a separate
28822 object file. You can control this behavior for a specific function by
28823 using the function attribute @code{function_return}.
28824 @xref{Function Attributes}.
28825
28826 Note that @option{-mcmodel=large} is incompatible with
28827 @option{-mfunction-return=thunk} and
28828 @option{-mfunction-return=thunk-extern} since the thunk function may
28829 not be reachable in the large code model.
28830
28831
28832 @item -mindirect-branch-register
28833 @opindex mindirect-branch-register
28834 Force indirect call and jump via register.
28835
28836 @end table
28837
28838 These @samp{-m} switches are supported in addition to the above
28839 on x86-64 processors in 64-bit environments.
28840
28841 @table @gcctabopt
28842 @item -m32
28843 @itemx -m64
28844 @itemx -mx32
28845 @itemx -m16
28846 @itemx -miamcu
28847 @opindex m32
28848 @opindex m64
28849 @opindex mx32
28850 @opindex m16
28851 @opindex miamcu
28852 Generate code for a 16-bit, 32-bit or 64-bit environment.
28853 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28854 to 32 bits, and
28855 generates code that runs on any i386 system.
28856
28857 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28858 types to 64 bits, and generates code for the x86-64 architecture.
28859 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28860 and @option{-mdynamic-no-pic} options.
28861
28862 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28863 to 32 bits, and
28864 generates code for the x86-64 architecture.
28865
28866 The @option{-m16} option is the same as @option{-m32}, except for that
28867 it outputs the @code{.code16gcc} assembly directive at the beginning of
28868 the assembly output so that the binary can run in 16-bit mode.
28869
28870 The @option{-miamcu} option generates code which conforms to Intel MCU
28871 psABI. It requires the @option{-m32} option to be turned on.
28872
28873 @item -mno-red-zone
28874 @opindex mno-red-zone
28875 @opindex mred-zone
28876 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28877 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28878 stack pointer that is not modified by signal or interrupt handlers
28879 and therefore can be used for temporary data without adjusting the stack
28880 pointer. The flag @option{-mno-red-zone} disables this red zone.
28881
28882 @item -mcmodel=small
28883 @opindex mcmodel=small
28884 Generate code for the small code model: the program and its symbols must
28885 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28886 Programs can be statically or dynamically linked. This is the default
28887 code model.
28888
28889 @item -mcmodel=kernel
28890 @opindex mcmodel=kernel
28891 Generate code for the kernel code model. The kernel runs in the
28892 negative 2 GB of the address space.
28893 This model has to be used for Linux kernel code.
28894
28895 @item -mcmodel=medium
28896 @opindex mcmodel=medium
28897 Generate code for the medium model: the program is linked in the lower 2
28898 GB of the address space. Small symbols are also placed there. Symbols
28899 with sizes larger than @option{-mlarge-data-threshold} are put into
28900 large data or BSS sections and can be located above 2GB. Programs can
28901 be statically or dynamically linked.
28902
28903 @item -mcmodel=large
28904 @opindex mcmodel=large
28905 Generate code for the large model. This model makes no assumptions
28906 about addresses and sizes of sections.
28907
28908 @item -maddress-mode=long
28909 @opindex maddress-mode=long
28910 Generate code for long address mode. This is only supported for 64-bit
28911 and x32 environments. It is the default address mode for 64-bit
28912 environments.
28913
28914 @item -maddress-mode=short
28915 @opindex maddress-mode=short
28916 Generate code for short address mode. This is only supported for 32-bit
28917 and x32 environments. It is the default address mode for 32-bit and
28918 x32 environments.
28919 @end table
28920
28921 @node x86 Windows Options
28922 @subsection x86 Windows Options
28923 @cindex x86 Windows Options
28924 @cindex Windows Options for x86
28925
28926 These additional options are available for Microsoft Windows targets:
28927
28928 @table @gcctabopt
28929 @item -mconsole
28930 @opindex mconsole
28931 This option
28932 specifies that a console application is to be generated, by
28933 instructing the linker to set the PE header subsystem type
28934 required for console applications.
28935 This option is available for Cygwin and MinGW targets and is
28936 enabled by default on those targets.
28937
28938 @item -mdll
28939 @opindex mdll
28940 This option is available for Cygwin and MinGW targets. It
28941 specifies that a DLL---a dynamic link library---is to be
28942 generated, enabling the selection of the required runtime
28943 startup object and entry point.
28944
28945 @item -mnop-fun-dllimport
28946 @opindex mnop-fun-dllimport
28947 This option is available for Cygwin and MinGW targets. It
28948 specifies that the @code{dllimport} attribute should be ignored.
28949
28950 @item -mthread
28951 @opindex mthread
28952 This option is available for MinGW targets. It specifies
28953 that MinGW-specific thread support is to be used.
28954
28955 @item -municode
28956 @opindex municode
28957 This option is available for MinGW-w64 targets. It causes
28958 the @code{UNICODE} preprocessor macro to be predefined, and
28959 chooses Unicode-capable runtime startup code.
28960
28961 @item -mwin32
28962 @opindex mwin32
28963 This option is available for Cygwin and MinGW targets. It
28964 specifies that the typical Microsoft Windows predefined macros are to
28965 be set in the pre-processor, but does not influence the choice
28966 of runtime library/startup code.
28967
28968 @item -mwindows
28969 @opindex mwindows
28970 This option is available for Cygwin and MinGW targets. It
28971 specifies that a GUI application is to be generated by
28972 instructing the linker to set the PE header subsystem type
28973 appropriately.
28974
28975 @item -fno-set-stack-executable
28976 @opindex fno-set-stack-executable
28977 @opindex fset-stack-executable
28978 This option is available for MinGW targets. It specifies that
28979 the executable flag for the stack used by nested functions isn't
28980 set. This is necessary for binaries running in kernel mode of
28981 Microsoft Windows, as there the User32 API, which is used to set executable
28982 privileges, isn't available.
28983
28984 @item -fwritable-relocated-rdata
28985 @opindex fno-writable-relocated-rdata
28986 @opindex fwritable-relocated-rdata
28987 This option is available for MinGW and Cygwin targets. It specifies
28988 that relocated-data in read-only section is put into the @code{.data}
28989 section. This is a necessary for older runtimes not supporting
28990 modification of @code{.rdata} sections for pseudo-relocation.
28991
28992 @item -mpe-aligned-commons
28993 @opindex mpe-aligned-commons
28994 This option is available for Cygwin and MinGW targets. It
28995 specifies that the GNU extension to the PE file format that
28996 permits the correct alignment of COMMON variables should be
28997 used when generating code. It is enabled by default if
28998 GCC detects that the target assembler found during configuration
28999 supports the feature.
29000 @end table
29001
29002 See also under @ref{x86 Options} for standard options.
29003
29004 @node Xstormy16 Options
29005 @subsection Xstormy16 Options
29006 @cindex Xstormy16 Options
29007
29008 These options are defined for Xstormy16:
29009
29010 @table @gcctabopt
29011 @item -msim
29012 @opindex msim
29013 Choose startup files and linker script suitable for the simulator.
29014 @end table
29015
29016 @node Xtensa Options
29017 @subsection Xtensa Options
29018 @cindex Xtensa Options
29019
29020 These options are supported for Xtensa targets:
29021
29022 @table @gcctabopt
29023 @item -mconst16
29024 @itemx -mno-const16
29025 @opindex mconst16
29026 @opindex mno-const16
29027 Enable or disable use of @code{CONST16} instructions for loading
29028 constant values. The @code{CONST16} instruction is currently not a
29029 standard option from Tensilica. When enabled, @code{CONST16}
29030 instructions are always used in place of the standard @code{L32R}
29031 instructions. The use of @code{CONST16} is enabled by default only if
29032 the @code{L32R} instruction is not available.
29033
29034 @item -mfused-madd
29035 @itemx -mno-fused-madd
29036 @opindex mfused-madd
29037 @opindex mno-fused-madd
29038 Enable or disable use of fused multiply/add and multiply/subtract
29039 instructions in the floating-point option. This has no effect if the
29040 floating-point option is not also enabled. Disabling fused multiply/add
29041 and multiply/subtract instructions forces the compiler to use separate
29042 instructions for the multiply and add/subtract operations. This may be
29043 desirable in some cases where strict IEEE 754-compliant results are
29044 required: the fused multiply add/subtract instructions do not round the
29045 intermediate result, thereby producing results with @emph{more} bits of
29046 precision than specified by the IEEE standard. Disabling fused multiply
29047 add/subtract instructions also ensures that the program output is not
29048 sensitive to the compiler's ability to combine multiply and add/subtract
29049 operations.
29050
29051 @item -mserialize-volatile
29052 @itemx -mno-serialize-volatile
29053 @opindex mserialize-volatile
29054 @opindex mno-serialize-volatile
29055 When this option is enabled, GCC inserts @code{MEMW} instructions before
29056 @code{volatile} memory references to guarantee sequential consistency.
29057 The default is @option{-mserialize-volatile}. Use
29058 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29059
29060 @item -mforce-no-pic
29061 @opindex mforce-no-pic
29062 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29063 position-independent code (PIC), this option disables PIC for compiling
29064 kernel code.
29065
29066 @item -mtext-section-literals
29067 @itemx -mno-text-section-literals
29068 @opindex mtext-section-literals
29069 @opindex mno-text-section-literals
29070 These options control the treatment of literal pools. The default is
29071 @option{-mno-text-section-literals}, which places literals in a separate
29072 section in the output file. This allows the literal pool to be placed
29073 in a data RAM/ROM, and it also allows the linker to combine literal
29074 pools from separate object files to remove redundant literals and
29075 improve code size. With @option{-mtext-section-literals}, the literals
29076 are interspersed in the text section in order to keep them as close as
29077 possible to their references. This may be necessary for large assembly
29078 files. Literals for each function are placed right before that function.
29079
29080 @item -mauto-litpools
29081 @itemx -mno-auto-litpools
29082 @opindex mauto-litpools
29083 @opindex mno-auto-litpools
29084 These options control the treatment of literal pools. The default is
29085 @option{-mno-auto-litpools}, which places literals in a separate
29086 section in the output file unless @option{-mtext-section-literals} is
29087 used. With @option{-mauto-litpools} the literals are interspersed in
29088 the text section by the assembler. Compiler does not produce explicit
29089 @code{.literal} directives and loads literals into registers with
29090 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29091 do relaxation and place literals as necessary. This option allows
29092 assembler to create several literal pools per function and assemble
29093 very big functions, which may not be possible with
29094 @option{-mtext-section-literals}.
29095
29096 @item -mtarget-align
29097 @itemx -mno-target-align
29098 @opindex mtarget-align
29099 @opindex mno-target-align
29100 When this option is enabled, GCC instructs the assembler to
29101 automatically align instructions to reduce branch penalties at the
29102 expense of some code density. The assembler attempts to widen density
29103 instructions to align branch targets and the instructions following call
29104 instructions. If there are not enough preceding safe density
29105 instructions to align a target, no widening is performed. The
29106 default is @option{-mtarget-align}. These options do not affect the
29107 treatment of auto-aligned instructions like @code{LOOP}, which the
29108 assembler always aligns, either by widening density instructions or
29109 by inserting NOP instructions.
29110
29111 @item -mlongcalls
29112 @itemx -mno-longcalls
29113 @opindex mlongcalls
29114 @opindex mno-longcalls
29115 When this option is enabled, GCC instructs the assembler to translate
29116 direct calls to indirect calls unless it can determine that the target
29117 of a direct call is in the range allowed by the call instruction. This
29118 translation typically occurs for calls to functions in other source
29119 files. Specifically, the assembler translates a direct @code{CALL}
29120 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29121 The default is @option{-mno-longcalls}. This option should be used in
29122 programs where the call target can potentially be out of range. This
29123 option is implemented in the assembler, not the compiler, so the
29124 assembly code generated by GCC still shows direct call
29125 instructions---look at the disassembled object code to see the actual
29126 instructions. Note that the assembler uses an indirect call for
29127 every cross-file call, not just those that really are out of range.
29128 @end table
29129
29130 @node zSeries Options
29131 @subsection zSeries Options
29132 @cindex zSeries options
29133
29134 These are listed under @xref{S/390 and zSeries Options}.
29135
29136
29137 @c man end
29138
29139 @node Spec Files
29140 @section Specifying Subprocesses and the Switches to Pass to Them
29141 @cindex Spec Files
29142
29143 @command{gcc} is a driver program. It performs its job by invoking a
29144 sequence of other programs to do the work of compiling, assembling and
29145 linking. GCC interprets its command-line parameters and uses these to
29146 deduce which programs it should invoke, and which command-line options
29147 it ought to place on their command lines. This behavior is controlled
29148 by @dfn{spec strings}. In most cases there is one spec string for each
29149 program that GCC can invoke, but a few programs have multiple spec
29150 strings to control their behavior. The spec strings built into GCC can
29151 be overridden by using the @option{-specs=} command-line switch to specify
29152 a spec file.
29153
29154 @dfn{Spec files} are plain-text files that are used to construct spec
29155 strings. They consist of a sequence of directives separated by blank
29156 lines. The type of directive is determined by the first non-whitespace
29157 character on the line, which can be one of the following:
29158
29159 @table @code
29160 @item %@var{command}
29161 Issues a @var{command} to the spec file processor. The commands that can
29162 appear here are:
29163
29164 @table @code
29165 @item %include <@var{file}>
29166 @cindex @code{%include}
29167 Search for @var{file} and insert its text at the current point in the
29168 specs file.
29169
29170 @item %include_noerr <@var{file}>
29171 @cindex @code{%include_noerr}
29172 Just like @samp{%include}, but do not generate an error message if the include
29173 file cannot be found.
29174
29175 @item %rename @var{old_name} @var{new_name}
29176 @cindex @code{%rename}
29177 Rename the spec string @var{old_name} to @var{new_name}.
29178
29179 @end table
29180
29181 @item *[@var{spec_name}]:
29182 This tells the compiler to create, override or delete the named spec
29183 string. All lines after this directive up to the next directive or
29184 blank line are considered to be the text for the spec string. If this
29185 results in an empty string then the spec is deleted. (Or, if the
29186 spec did not exist, then nothing happens.) Otherwise, if the spec
29187 does not currently exist a new spec is created. If the spec does
29188 exist then its contents are overridden by the text of this
29189 directive, unless the first character of that text is the @samp{+}
29190 character, in which case the text is appended to the spec.
29191
29192 @item [@var{suffix}]:
29193 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29194 and up to the next directive or blank line are considered to make up the
29195 spec string for the indicated suffix. When the compiler encounters an
29196 input file with the named suffix, it processes the spec string in
29197 order to work out how to compile that file. For example:
29198
29199 @smallexample
29200 .ZZ:
29201 z-compile -input %i
29202 @end smallexample
29203
29204 This says that any input file whose name ends in @samp{.ZZ} should be
29205 passed to the program @samp{z-compile}, which should be invoked with the
29206 command-line switch @option{-input} and with the result of performing the
29207 @samp{%i} substitution. (See below.)
29208
29209 As an alternative to providing a spec string, the text following a
29210 suffix directive can be one of the following:
29211
29212 @table @code
29213 @item @@@var{language}
29214 This says that the suffix is an alias for a known @var{language}. This is
29215 similar to using the @option{-x} command-line switch to GCC to specify a
29216 language explicitly. For example:
29217
29218 @smallexample
29219 .ZZ:
29220 @@c++
29221 @end smallexample
29222
29223 Says that .ZZ files are, in fact, C++ source files.
29224
29225 @item #@var{name}
29226 This causes an error messages saying:
29227
29228 @smallexample
29229 @var{name} compiler not installed on this system.
29230 @end smallexample
29231 @end table
29232
29233 GCC already has an extensive list of suffixes built into it.
29234 This directive adds an entry to the end of the list of suffixes, but
29235 since the list is searched from the end backwards, it is effectively
29236 possible to override earlier entries using this technique.
29237
29238 @end table
29239
29240 GCC has the following spec strings built into it. Spec files can
29241 override these strings or create their own. Note that individual
29242 targets can also add their own spec strings to this list.
29243
29244 @smallexample
29245 asm Options to pass to the assembler
29246 asm_final Options to pass to the assembler post-processor
29247 cpp Options to pass to the C preprocessor
29248 cc1 Options to pass to the C compiler
29249 cc1plus Options to pass to the C++ compiler
29250 endfile Object files to include at the end of the link
29251 link Options to pass to the linker
29252 lib Libraries to include on the command line to the linker
29253 libgcc Decides which GCC support library to pass to the linker
29254 linker Sets the name of the linker
29255 predefines Defines to be passed to the C preprocessor
29256 signed_char Defines to pass to CPP to say whether @code{char} is signed
29257 by default
29258 startfile Object files to include at the start of the link
29259 @end smallexample
29260
29261 Here is a small example of a spec file:
29262
29263 @smallexample
29264 %rename lib old_lib
29265
29266 *lib:
29267 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29268 @end smallexample
29269
29270 This example renames the spec called @samp{lib} to @samp{old_lib} and
29271 then overrides the previous definition of @samp{lib} with a new one.
29272 The new definition adds in some extra command-line options before
29273 including the text of the old definition.
29274
29275 @dfn{Spec strings} are a list of command-line options to be passed to their
29276 corresponding program. In addition, the spec strings can contain
29277 @samp{%}-prefixed sequences to substitute variable text or to
29278 conditionally insert text into the command line. Using these constructs
29279 it is possible to generate quite complex command lines.
29280
29281 Here is a table of all defined @samp{%}-sequences for spec
29282 strings. Note that spaces are not generated automatically around the
29283 results of expanding these sequences. Therefore you can concatenate them
29284 together or combine them with constant text in a single argument.
29285
29286 @table @code
29287 @item %%
29288 Substitute one @samp{%} into the program name or argument.
29289
29290 @item %i
29291 Substitute the name of the input file being processed.
29292
29293 @item %b
29294 Substitute the basename of the input file being processed.
29295 This is the substring up to (and not including) the last period
29296 and not including the directory.
29297
29298 @item %B
29299 This is the same as @samp{%b}, but include the file suffix (text after
29300 the last period).
29301
29302 @item %d
29303 Marks the argument containing or following the @samp{%d} as a
29304 temporary file name, so that that file is deleted if GCC exits
29305 successfully. Unlike @samp{%g}, this contributes no text to the
29306 argument.
29307
29308 @item %g@var{suffix}
29309 Substitute a file name that has suffix @var{suffix} and is chosen
29310 once per compilation, and mark the argument in the same way as
29311 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29312 name is now chosen in a way that is hard to predict even when previously
29313 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29314 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29315 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29316 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29317 was simply substituted with a file name chosen once per compilation,
29318 without regard to any appended suffix (which was therefore treated
29319 just like ordinary text), making such attacks more likely to succeed.
29320
29321 @item %u@var{suffix}
29322 Like @samp{%g}, but generates a new temporary file name
29323 each time it appears instead of once per compilation.
29324
29325 @item %U@var{suffix}
29326 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29327 new one if there is no such last file name. In the absence of any
29328 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29329 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29330 involves the generation of two distinct file names, one
29331 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29332 simply substituted with a file name chosen for the previous @samp{%u},
29333 without regard to any appended suffix.
29334
29335 @item %j@var{suffix}
29336 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29337 writable, and if @option{-save-temps} is not used;
29338 otherwise, substitute the name
29339 of a temporary file, just like @samp{%u}. This temporary file is not
29340 meant for communication between processes, but rather as a junk
29341 disposal mechanism.
29342
29343 @item %|@var{suffix}
29344 @itemx %m@var{suffix}
29345 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29346 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29347 all. These are the two most common ways to instruct a program that it
29348 should read from standard input or write to standard output. If you
29349 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29350 construct: see for example @file{gcc/fortran/lang-specs.h}.
29351
29352 @item %.@var{SUFFIX}
29353 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29354 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29355 terminated by the next space or %.
29356
29357 @item %w
29358 Marks the argument containing or following the @samp{%w} as the
29359 designated output file of this compilation. This puts the argument
29360 into the sequence of arguments that @samp{%o} substitutes.
29361
29362 @item %o
29363 Substitutes the names of all the output files, with spaces
29364 automatically placed around them. You should write spaces
29365 around the @samp{%o} as well or the results are undefined.
29366 @samp{%o} is for use in the specs for running the linker.
29367 Input files whose names have no recognized suffix are not compiled
29368 at all, but they are included among the output files, so they are
29369 linked.
29370
29371 @item %O
29372 Substitutes the suffix for object files. Note that this is
29373 handled specially when it immediately follows @samp{%g, %u, or %U},
29374 because of the need for those to form complete file names. The
29375 handling is such that @samp{%O} is treated exactly as if it had already
29376 been substituted, except that @samp{%g, %u, and %U} do not currently
29377 support additional @var{suffix} characters following @samp{%O} as they do
29378 following, for example, @samp{.o}.
29379
29380 @item %p
29381 Substitutes the standard macro predefinitions for the
29382 current target machine. Use this when running @command{cpp}.
29383
29384 @item %P
29385 Like @samp{%p}, but puts @samp{__} before and after the name of each
29386 predefined macro, except for macros that start with @samp{__} or with
29387 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29388 C@.
29389
29390 @item %I
29391 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29392 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29393 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29394 and @option{-imultilib} as necessary.
29395
29396 @item %s
29397 Current argument is the name of a library or startup file of some sort.
29398 Search for that file in a standard list of directories and substitute
29399 the full name found. The current working directory is included in the
29400 list of directories scanned.
29401
29402 @item %T
29403 Current argument is the name of a linker script. Search for that file
29404 in the current list of directories to scan for libraries. If the file
29405 is located insert a @option{--script} option into the command line
29406 followed by the full path name found. If the file is not found then
29407 generate an error message. Note: the current working directory is not
29408 searched.
29409
29410 @item %e@var{str}
29411 Print @var{str} as an error message. @var{str} is terminated by a newline.
29412 Use this when inconsistent options are detected.
29413
29414 @item %(@var{name})
29415 Substitute the contents of spec string @var{name} at this point.
29416
29417 @item %x@{@var{option}@}
29418 Accumulate an option for @samp{%X}.
29419
29420 @item %X
29421 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29422 spec string.
29423
29424 @item %Y
29425 Output the accumulated assembler options specified by @option{-Wa}.
29426
29427 @item %Z
29428 Output the accumulated preprocessor options specified by @option{-Wp}.
29429
29430 @item %a
29431 Process the @code{asm} spec. This is used to compute the
29432 switches to be passed to the assembler.
29433
29434 @item %A
29435 Process the @code{asm_final} spec. This is a spec string for
29436 passing switches to an assembler post-processor, if such a program is
29437 needed.
29438
29439 @item %l
29440 Process the @code{link} spec. This is the spec for computing the
29441 command line passed to the linker. Typically it makes use of the
29442 @samp{%L %G %S %D and %E} sequences.
29443
29444 @item %D
29445 Dump out a @option{-L} option for each directory that GCC believes might
29446 contain startup files. If the target supports multilibs then the
29447 current multilib directory is prepended to each of these paths.
29448
29449 @item %L
29450 Process the @code{lib} spec. This is a spec string for deciding which
29451 libraries are included on the command line to the linker.
29452
29453 @item %G
29454 Process the @code{libgcc} spec. This is a spec string for deciding
29455 which GCC support library is included on the command line to the linker.
29456
29457 @item %S
29458 Process the @code{startfile} spec. This is a spec for deciding which
29459 object files are the first ones passed to the linker. Typically
29460 this might be a file named @file{crt0.o}.
29461
29462 @item %E
29463 Process the @code{endfile} spec. This is a spec string that specifies
29464 the last object files that are passed to the linker.
29465
29466 @item %C
29467 Process the @code{cpp} spec. This is used to construct the arguments
29468 to be passed to the C preprocessor.
29469
29470 @item %1
29471 Process the @code{cc1} spec. This is used to construct the options to be
29472 passed to the actual C compiler (@command{cc1}).
29473
29474 @item %2
29475 Process the @code{cc1plus} spec. This is used to construct the options to be
29476 passed to the actual C++ compiler (@command{cc1plus}).
29477
29478 @item %*
29479 Substitute the variable part of a matched option. See below.
29480 Note that each comma in the substituted string is replaced by
29481 a single space.
29482
29483 @item %<S
29484 Remove all occurrences of @code{-S} from the command line. Note---this
29485 command is position dependent. @samp{%} commands in the spec string
29486 before this one see @code{-S}, @samp{%} commands in the spec string
29487 after this one do not.
29488
29489 @item %:@var{function}(@var{args})
29490 Call the named function @var{function}, passing it @var{args}.
29491 @var{args} is first processed as a nested spec string, then split
29492 into an argument vector in the usual fashion. The function returns
29493 a string which is processed as if it had appeared literally as part
29494 of the current spec.
29495
29496 The following built-in spec functions are provided:
29497
29498 @table @code
29499 @item @code{getenv}
29500 The @code{getenv} spec function takes two arguments: an environment
29501 variable name and a string. If the environment variable is not
29502 defined, a fatal error is issued. Otherwise, the return value is the
29503 value of the environment variable concatenated with the string. For
29504 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29505
29506 @smallexample
29507 %:getenv(TOPDIR /include)
29508 @end smallexample
29509
29510 expands to @file{/path/to/top/include}.
29511
29512 @item @code{if-exists}
29513 The @code{if-exists} spec function takes one argument, an absolute
29514 pathname to a file. If the file exists, @code{if-exists} returns the
29515 pathname. Here is a small example of its usage:
29516
29517 @smallexample
29518 *startfile:
29519 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29520 @end smallexample
29521
29522 @item @code{if-exists-else}
29523 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29524 spec function, except that it takes two arguments. The first argument is
29525 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29526 returns the pathname. If it does not exist, it returns the second argument.
29527 This way, @code{if-exists-else} can be used to select one file or another,
29528 based on the existence of the first. Here is a small example of its usage:
29529
29530 @smallexample
29531 *startfile:
29532 crt0%O%s %:if-exists(crti%O%s) \
29533 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29534 @end smallexample
29535
29536 @item @code{replace-outfile}
29537 The @code{replace-outfile} spec function takes two arguments. It looks for the
29538 first argument in the outfiles array and replaces it with the second argument. Here
29539 is a small example of its usage:
29540
29541 @smallexample
29542 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29543 @end smallexample
29544
29545 @item @code{remove-outfile}
29546 The @code{remove-outfile} spec function takes one argument. It looks for the
29547 first argument in the outfiles array and removes it. Here is a small example
29548 its usage:
29549
29550 @smallexample
29551 %:remove-outfile(-lm)
29552 @end smallexample
29553
29554 @item @code{pass-through-libs}
29555 The @code{pass-through-libs} spec function takes any number of arguments. It
29556 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29557 assumes are the names of linker input library archive files) and returns a
29558 result containing all the found arguments each prepended by
29559 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29560 intended to be passed to the LTO linker plugin.
29561
29562 @smallexample
29563 %:pass-through-libs(%G %L %G)
29564 @end smallexample
29565
29566 @item @code{print-asm-header}
29567 The @code{print-asm-header} function takes no arguments and simply
29568 prints a banner like:
29569
29570 @smallexample
29571 Assembler options
29572 =================
29573
29574 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29575 @end smallexample
29576
29577 It is used to separate compiler options from assembler options
29578 in the @option{--target-help} output.
29579 @end table
29580
29581 @item %@{S@}
29582 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29583 If that switch is not specified, this substitutes nothing. Note that
29584 the leading dash is omitted when specifying this option, and it is
29585 automatically inserted if the substitution is performed. Thus the spec
29586 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29587 and outputs the command-line option @option{-foo}.
29588
29589 @item %W@{S@}
29590 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29591 deleted on failure.
29592
29593 @item %@{S*@}
29594 Substitutes all the switches specified to GCC whose names start
29595 with @code{-S}, but which also take an argument. This is used for
29596 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29597 GCC considers @option{-o foo} as being
29598 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29599 text, including the space. Thus two arguments are generated.
29600
29601 @item %@{S*&T*@}
29602 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29603 (the order of @code{S} and @code{T} in the spec is not significant).
29604 There can be any number of ampersand-separated variables; for each the
29605 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29606
29607 @item %@{S:X@}
29608 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29609
29610 @item %@{!S:X@}
29611 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29612
29613 @item %@{S*:X@}
29614 Substitutes @code{X} if one or more switches whose names start with
29615 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29616 once, no matter how many such switches appeared. However, if @code{%*}
29617 appears somewhere in @code{X}, then @code{X} is substituted once
29618 for each matching switch, with the @code{%*} replaced by the part of
29619 that switch matching the @code{*}.
29620
29621 If @code{%*} appears as the last part of a spec sequence then a space
29622 is added after the end of the last substitution. If there is more
29623 text in the sequence, however, then a space is not generated. This
29624 allows the @code{%*} substitution to be used as part of a larger
29625 string. For example, a spec string like this:
29626
29627 @smallexample
29628 %@{mcu=*:--script=%*/memory.ld@}
29629 @end smallexample
29630
29631 @noindent
29632 when matching an option like @option{-mcu=newchip} produces:
29633
29634 @smallexample
29635 --script=newchip/memory.ld
29636 @end smallexample
29637
29638 @item %@{.S:X@}
29639 Substitutes @code{X}, if processing a file with suffix @code{S}.
29640
29641 @item %@{!.S:X@}
29642 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29643
29644 @item %@{,S:X@}
29645 Substitutes @code{X}, if processing a file for language @code{S}.
29646
29647 @item %@{!,S:X@}
29648 Substitutes @code{X}, if not processing a file for language @code{S}.
29649
29650 @item %@{S|P:X@}
29651 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29652 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29653 @code{*} sequences as well, although they have a stronger binding than
29654 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29655 alternatives must be starred, and only the first matching alternative
29656 is substituted.
29657
29658 For example, a spec string like this:
29659
29660 @smallexample
29661 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29662 @end smallexample
29663
29664 @noindent
29665 outputs the following command-line options from the following input
29666 command-line options:
29667
29668 @smallexample
29669 fred.c -foo -baz
29670 jim.d -bar -boggle
29671 -d fred.c -foo -baz -boggle
29672 -d jim.d -bar -baz -boggle
29673 @end smallexample
29674
29675 @item %@{S:X; T:Y; :D@}
29676
29677 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29678 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29679 be as many clauses as you need. This may be combined with @code{.},
29680 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29681
29682
29683 @end table
29684
29685 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29686 or similar construct can use a backslash to ignore the special meaning
29687 of the character following it, thus allowing literal matching of a
29688 character that is otherwise specially treated. For example,
29689 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29690 @option{-std=iso9899:1999} option is given.
29691
29692 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29693 construct may contain other nested @samp{%} constructs or spaces, or
29694 even newlines. They are processed as usual, as described above.
29695 Trailing white space in @code{X} is ignored. White space may also
29696 appear anywhere on the left side of the colon in these constructs,
29697 except between @code{.} or @code{*} and the corresponding word.
29698
29699 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29700 handled specifically in these constructs. If another value of
29701 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29702 @option{-W} switch is found later in the command line, the earlier
29703 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29704 just one letter, which passes all matching options.
29705
29706 The character @samp{|} at the beginning of the predicate text is used to
29707 indicate that a command should be piped to the following command, but
29708 only if @option{-pipe} is specified.
29709
29710 It is built into GCC which switches take arguments and which do not.
29711 (You might think it would be useful to generalize this to allow each
29712 compiler's spec to say which switches take arguments. But this cannot
29713 be done in a consistent fashion. GCC cannot even decide which input
29714 files have been specified without knowing which switches take arguments,
29715 and it must know which input files to compile in order to tell which
29716 compilers to run).
29717
29718 GCC also knows implicitly that arguments starting in @option{-l} are to be
29719 treated as compiler output files, and passed to the linker in their
29720 proper position among the other output files.
29721
29722 @node Environment Variables
29723 @section Environment Variables Affecting GCC
29724 @cindex environment variables
29725
29726 @c man begin ENVIRONMENT
29727 This section describes several environment variables that affect how GCC
29728 operates. Some of them work by specifying directories or prefixes to use
29729 when searching for various kinds of files. Some are used to specify other
29730 aspects of the compilation environment.
29731
29732 Note that you can also specify places to search using options such as
29733 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29734 take precedence over places specified using environment variables, which
29735 in turn take precedence over those specified by the configuration of GCC@.
29736 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29737 GNU Compiler Collection (GCC) Internals}.
29738
29739 @table @env
29740 @item LANG
29741 @itemx LC_CTYPE
29742 @c @itemx LC_COLLATE
29743 @itemx LC_MESSAGES
29744 @c @itemx LC_MONETARY
29745 @c @itemx LC_NUMERIC
29746 @c @itemx LC_TIME
29747 @itemx LC_ALL
29748 @findex LANG
29749 @findex LC_CTYPE
29750 @c @findex LC_COLLATE
29751 @findex LC_MESSAGES
29752 @c @findex LC_MONETARY
29753 @c @findex LC_NUMERIC
29754 @c @findex LC_TIME
29755 @findex LC_ALL
29756 @cindex locale
29757 These environment variables control the way that GCC uses
29758 localization information which allows GCC to work with different
29759 national conventions. GCC inspects the locale categories
29760 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29761 so. These locale categories can be set to any value supported by your
29762 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29763 Kingdom encoded in UTF-8.
29764
29765 The @env{LC_CTYPE} environment variable specifies character
29766 classification. GCC uses it to determine the character boundaries in
29767 a string; this is needed for some multibyte encodings that contain quote
29768 and escape characters that are otherwise interpreted as a string
29769 end or escape.
29770
29771 The @env{LC_MESSAGES} environment variable specifies the language to
29772 use in diagnostic messages.
29773
29774 If the @env{LC_ALL} environment variable is set, it overrides the value
29775 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29776 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29777 environment variable. If none of these variables are set, GCC
29778 defaults to traditional C English behavior.
29779
29780 @item TMPDIR
29781 @findex TMPDIR
29782 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29783 files. GCC uses temporary files to hold the output of one stage of
29784 compilation which is to be used as input to the next stage: for example,
29785 the output of the preprocessor, which is the input to the compiler
29786 proper.
29787
29788 @item GCC_COMPARE_DEBUG
29789 @findex GCC_COMPARE_DEBUG
29790 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29791 @option{-fcompare-debug} to the compiler driver. See the documentation
29792 of this option for more details.
29793
29794 @item GCC_EXEC_PREFIX
29795 @findex GCC_EXEC_PREFIX
29796 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29797 names of the subprograms executed by the compiler. No slash is added
29798 when this prefix is combined with the name of a subprogram, but you can
29799 specify a prefix that ends with a slash if you wish.
29800
29801 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29802 an appropriate prefix to use based on the pathname it is invoked with.
29803
29804 If GCC cannot find the subprogram using the specified prefix, it
29805 tries looking in the usual places for the subprogram.
29806
29807 The default value of @env{GCC_EXEC_PREFIX} is
29808 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29809 the installed compiler. In many cases @var{prefix} is the value
29810 of @code{prefix} when you ran the @file{configure} script.
29811
29812 Other prefixes specified with @option{-B} take precedence over this prefix.
29813
29814 This prefix is also used for finding files such as @file{crt0.o} that are
29815 used for linking.
29816
29817 In addition, the prefix is used in an unusual way in finding the
29818 directories to search for header files. For each of the standard
29819 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29820 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29821 replacing that beginning with the specified prefix to produce an
29822 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29823 @file{foo/bar} just before it searches the standard directory
29824 @file{/usr/local/lib/bar}.
29825 If a standard directory begins with the configured
29826 @var{prefix} then the value of @var{prefix} is replaced by
29827 @env{GCC_EXEC_PREFIX} when looking for header files.
29828
29829 @item COMPILER_PATH
29830 @findex COMPILER_PATH
29831 The value of @env{COMPILER_PATH} is a colon-separated list of
29832 directories, much like @env{PATH}. GCC tries the directories thus
29833 specified when searching for subprograms, if it cannot find the
29834 subprograms using @env{GCC_EXEC_PREFIX}.
29835
29836 @item LIBRARY_PATH
29837 @findex LIBRARY_PATH
29838 The value of @env{LIBRARY_PATH} is a colon-separated list of
29839 directories, much like @env{PATH}. When configured as a native compiler,
29840 GCC tries the directories thus specified when searching for special
29841 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29842 using GCC also uses these directories when searching for ordinary
29843 libraries for the @option{-l} option (but directories specified with
29844 @option{-L} come first).
29845
29846 @item LANG
29847 @findex LANG
29848 @cindex locale definition
29849 This variable is used to pass locale information to the compiler. One way in
29850 which this information is used is to determine the character set to be used
29851 when character literals, string literals and comments are parsed in C and C++.
29852 When the compiler is configured to allow multibyte characters,
29853 the following values for @env{LANG} are recognized:
29854
29855 @table @samp
29856 @item C-JIS
29857 Recognize JIS characters.
29858 @item C-SJIS
29859 Recognize SJIS characters.
29860 @item C-EUCJP
29861 Recognize EUCJP characters.
29862 @end table
29863
29864 If @env{LANG} is not defined, or if it has some other value, then the
29865 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29866 recognize and translate multibyte characters.
29867 @end table
29868
29869 @noindent
29870 Some additional environment variables affect the behavior of the
29871 preprocessor.
29872
29873 @include cppenv.texi
29874
29875 @c man end
29876
29877 @node Precompiled Headers
29878 @section Using Precompiled Headers
29879 @cindex precompiled headers
29880 @cindex speed of compilation
29881
29882 Often large projects have many header files that are included in every
29883 source file. The time the compiler takes to process these header files
29884 over and over again can account for nearly all of the time required to
29885 build the project. To make builds faster, GCC allows you to
29886 @dfn{precompile} a header file.
29887
29888 To create a precompiled header file, simply compile it as you would any
29889 other file, if necessary using the @option{-x} option to make the driver
29890 treat it as a C or C++ header file. You may want to use a
29891 tool like @command{make} to keep the precompiled header up-to-date when
29892 the headers it contains change.
29893
29894 A precompiled header file is searched for when @code{#include} is
29895 seen in the compilation. As it searches for the included file
29896 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29897 compiler looks for a precompiled header in each directory just before it
29898 looks for the include file in that directory. The name searched for is
29899 the name specified in the @code{#include} with @samp{.gch} appended. If
29900 the precompiled header file cannot be used, it is ignored.
29901
29902 For instance, if you have @code{#include "all.h"}, and you have
29903 @file{all.h.gch} in the same directory as @file{all.h}, then the
29904 precompiled header file is used if possible, and the original
29905 header is used otherwise.
29906
29907 Alternatively, you might decide to put the precompiled header file in a
29908 directory and use @option{-I} to ensure that directory is searched
29909 before (or instead of) the directory containing the original header.
29910 Then, if you want to check that the precompiled header file is always
29911 used, you can put a file of the same name as the original header in this
29912 directory containing an @code{#error} command.
29913
29914 This also works with @option{-include}. So yet another way to use
29915 precompiled headers, good for projects not designed with precompiled
29916 header files in mind, is to simply take most of the header files used by
29917 a project, include them from another header file, precompile that header
29918 file, and @option{-include} the precompiled header. If the header files
29919 have guards against multiple inclusion, they are skipped because
29920 they've already been included (in the precompiled header).
29921
29922 If you need to precompile the same header file for different
29923 languages, targets, or compiler options, you can instead make a
29924 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29925 header in the directory, perhaps using @option{-o}. It doesn't matter
29926 what you call the files in the directory; every precompiled header in
29927 the directory is considered. The first precompiled header
29928 encountered in the directory that is valid for this compilation is
29929 used; they're searched in no particular order.
29930
29931 There are many other possibilities, limited only by your imagination,
29932 good sense, and the constraints of your build system.
29933
29934 A precompiled header file can be used only when these conditions apply:
29935
29936 @itemize
29937 @item
29938 Only one precompiled header can be used in a particular compilation.
29939
29940 @item
29941 A precompiled header cannot be used once the first C token is seen. You
29942 can have preprocessor directives before a precompiled header; you cannot
29943 include a precompiled header from inside another header.
29944
29945 @item
29946 The precompiled header file must be produced for the same language as
29947 the current compilation. You cannot use a C precompiled header for a C++
29948 compilation.
29949
29950 @item
29951 The precompiled header file must have been produced by the same compiler
29952 binary as the current compilation is using.
29953
29954 @item
29955 Any macros defined before the precompiled header is included must
29956 either be defined in the same way as when the precompiled header was
29957 generated, or must not affect the precompiled header, which usually
29958 means that they don't appear in the precompiled header at all.
29959
29960 The @option{-D} option is one way to define a macro before a
29961 precompiled header is included; using a @code{#define} can also do it.
29962 There are also some options that define macros implicitly, like
29963 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29964 defined this way.
29965
29966 @item If debugging information is output when using the precompiled
29967 header, using @option{-g} or similar, the same kind of debugging information
29968 must have been output when building the precompiled header. However,
29969 a precompiled header built using @option{-g} can be used in a compilation
29970 when no debugging information is being output.
29971
29972 @item The same @option{-m} options must generally be used when building
29973 and using the precompiled header. @xref{Submodel Options},
29974 for any cases where this rule is relaxed.
29975
29976 @item Each of the following options must be the same when building and using
29977 the precompiled header:
29978
29979 @gccoptlist{-fexceptions}
29980
29981 @item
29982 Some other command-line options starting with @option{-f},
29983 @option{-p}, or @option{-O} must be defined in the same way as when
29984 the precompiled header was generated. At present, it's not clear
29985 which options are safe to change and which are not; the safest choice
29986 is to use exactly the same options when generating and using the
29987 precompiled header. The following are known to be safe:
29988
29989 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
29990 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
29991 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
29992 -pedantic-errors}
29993
29994 @end itemize
29995
29996 For all of these except the last, the compiler automatically
29997 ignores the precompiled header if the conditions aren't met. If you
29998 find an option combination that doesn't work and doesn't cause the
29999 precompiled header to be ignored, please consider filing a bug report,
30000 see @ref{Bugs}.
30001
30002 If you do use differing options when generating and using the
30003 precompiled header, the actual behavior is a mixture of the
30004 behavior for the options. For instance, if you use @option{-g} to
30005 generate the precompiled header but not when using it, you may or may
30006 not get debugging information for routines in the precompiled header.