]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
[AArch64] Rename +bitperm to +sve2-bitperm
[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-cache-depth=@var{n} @gol
213 -fconstexpr-loop-limit=@var{n} -fconstexpr-ops-limit=@var{n} @gol
214 -fno-elide-constructors @gol
215 -fno-enforce-eh-specs @gol
216 -fno-gnu-keywords @gol
217 -fno-implicit-templates @gol
218 -fno-implicit-inline-templates @gol
219 -fno-implement-inlines -fms-extensions @gol
220 -fnew-inheriting-ctors @gol
221 -fnew-ttp-matching @gol
222 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
223 -fno-optional-diags -fpermissive @gol
224 -fno-pretty-templates @gol
225 -frepo -fno-rtti -fsized-deallocation @gol
226 -ftemplate-backtrace-limit=@var{n} @gol
227 -ftemplate-depth=@var{n} @gol
228 -fno-threadsafe-statics -fuse-cxa-atexit @gol
229 -fno-weak -nostdinc++ @gol
230 -fvisibility-inlines-hidden @gol
231 -fvisibility-ms-compat @gol
232 -fext-numeric-literals @gol
233 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
234 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
235 -Wliteral-suffix @gol
236 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
237 -Wnamespaces -Wnarrowing @gol
238 -Wpessimizing-move -Wredundant-move @gol
239 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
240 -Wnon-virtual-dtor -Wreorder -Wregister @gol
241 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
242 -Wno-non-template-friend -Wold-style-cast @gol
243 -Woverloaded-virtual -Wno-pmf-conversions @gol
244 -Wno-class-conversion -Wno-terminate @gol
245 -Wsign-promo -Wvirtual-inheritance}
246
247 @item Objective-C and Objective-C++ Language Options
248 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
249 Objective-C and Objective-C++ Dialects}.
250 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
251 -fgnu-runtime -fnext-runtime @gol
252 -fno-nil-receivers @gol
253 -fobjc-abi-version=@var{n} @gol
254 -fobjc-call-cxx-cdtors @gol
255 -fobjc-direct-dispatch @gol
256 -fobjc-exceptions @gol
257 -fobjc-gc @gol
258 -fobjc-nilcheck @gol
259 -fobjc-std=objc1 @gol
260 -fno-local-ivars @gol
261 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
262 -freplace-objc-classes @gol
263 -fzero-link @gol
264 -gen-decls @gol
265 -Wassign-intercept @gol
266 -Wno-protocol -Wselector @gol
267 -Wstrict-selector-match @gol
268 -Wundeclared-selector}
269
270 @item Diagnostic Message Formatting Options
271 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
272 @gccoptlist{-fmessage-length=@var{n} @gol
273 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
274 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
275 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
276 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
277 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
278 -fdiagnostics-minimum-margin-width=@var{width} @gol
279 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
280 -fdiagnostics-show-template-tree -fno-elide-type @gol
281 -fno-show-column}
282
283 @item Warning Options
284 @xref{Warning Options,,Options to Request or Suppress Warnings}.
285 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
286 -pedantic-errors @gol
287 -w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol
288 -Waggregate-return -Waligned-new @gol
289 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
290 -Walloca -Walloca-larger-than=@var{byte-size} @gol
291 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
292 -Wno-attributes -Wattribute-alias=@var{n} @gol
293 -Wbool-compare -Wbool-operation @gol
294 -Wno-builtin-declaration-mismatch @gol
295 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
296 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
297 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
298 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
299 -Wclobbered -Wcomment -Wconditionally-supported @gol
300 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
301 -Wdelete-incomplete @gol
302 -Wno-attribute-warning @gol
303 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
304 -Wdisabled-optimization @gol
305 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
306 -Wno-div-by-zero -Wdouble-promotion @gol
307 -Wduplicated-branches -Wduplicated-cond @gol
308 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
309 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
310 -Wfloat-equal -Wformat -Wformat=2 @gol
311 -Wno-format-contains-nul -Wno-format-extra-args @gol
312 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
313 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
314 -Wformat-y2k -Wframe-address @gol
315 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
316 -Wjump-misses-init @gol
317 -Whsa -Wif-not-aligned @gol
318 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
319 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
320 -Wimplicit-function-declaration -Wimplicit-int @gol
321 -Winaccessible-base @gol
322 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
323 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
324 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
325 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
326 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
327 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
328 -Wmissing-field-initializers -Wmissing-format-attribute @gol
329 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
330 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
331 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
332 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
333 -Woverride-init-side-effects -Woverlength-strings @gol
334 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
335 -Wparentheses -Wno-pedantic-ms-format @gol
336 -Wplacement-new -Wplacement-new=@var{n} @gol
337 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
338 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
339 -Wrestrict -Wno-return-local-addr @gol
340 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
341 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
342 -Wshift-overflow -Wshift-overflow=@var{n} @gol
343 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
344 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
345 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
346 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
347 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
348 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
349 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
350 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
351 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
352 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
353 -Wswitch-unreachable -Wsync-nand @gol
354 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
355 -Wtype-limits -Wundef @gol
356 -Wuninitialized -Wunknown-pragmas @gol
357 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
358 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
359 -Wunused-parameter -Wno-unused-result @gol
360 -Wunused-value -Wunused-variable @gol
361 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
362 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
363 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
364 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
365 -Wwrite-strings @gol
366 -Wzero-as-null-pointer-constant}
367
368 @item C and Objective-C-only Warning Options
369 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
370 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
371 -Wold-style-declaration -Wold-style-definition @gol
372 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
373 -Wdeclaration-after-statement -Wpointer-sign}
374
375 @item Debugging Options
376 @xref{Debugging Options,,Options for Debugging Your Program}.
377 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
378 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
379 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
380 -gas-loc-support -gno-as-loc-support @gol
381 -gas-locview-support -gno-as-locview-support @gol
382 -gcolumn-info -gno-column-info @gol
383 -gstatement-frontiers -gno-statement-frontiers @gol
384 -gvariable-location-views -gno-variable-location-views @gol
385 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
386 -ginline-points -gno-inline-points @gol
387 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
388 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
389 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
390 -fno-eliminate-unused-debug-types @gol
391 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
392 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
393 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
394 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
395 -fvar-tracking -fvar-tracking-assignments}
396
397 @item Optimization Options
398 @xref{Optimize Options,,Options that Control Optimization}.
399 @gccoptlist{-faggressive-loop-optimizations @gol
400 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
401 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
402 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
403 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
404 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
405 -fauto-inc-dec -fbranch-probabilities @gol
406 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
407 -fbtr-bb-exclusive -fcaller-saves @gol
408 -fcombine-stack-adjustments -fconserve-stack @gol
409 -fcompare-elim -fcprop-registers -fcrossjumping @gol
410 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
411 -fcx-limited-range @gol
412 -fdata-sections -fdce -fdelayed-branch @gol
413 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
414 -fdevirtualize-at-ltrans -fdse @gol
415 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
416 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
417 -ffinite-loops @gol
418 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
419 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
420 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
421 -fif-conversion2 -findirect-inlining @gol
422 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
423 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
424 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
425 -fipa-reference -fipa-reference-addressable @gol
426 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
427 -flive-patching=@var{level} @gol
428 -fira-region=@var{region} -fira-hoist-pressure @gol
429 -fira-loop-pressure -fno-ira-share-save-slots @gol
430 -fno-ira-share-spill-slots @gol
431 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
432 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
433 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
434 -floop-block -floop-interchange -floop-strip-mine @gol
435 -floop-unroll-and-jam -floop-nest-optimize @gol
436 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
437 -flto-partition=@var{alg} -fmerge-all-constants @gol
438 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
439 -fmove-loop-invariants -fno-branch-count-reg @gol
440 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
441 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
442 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
443 -fno-sched-spec -fno-signed-zeros @gol
444 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
445 -fomit-frame-pointer -foptimize-sibling-calls @gol
446 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
447 -fprefetch-loop-arrays @gol
448 -fprofile-correction @gol
449 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
450 -fprofile-reorder-functions @gol
451 -freciprocal-math -free -frename-registers -freorder-blocks @gol
452 -freorder-blocks-algorithm=@var{algorithm} @gol
453 -freorder-blocks-and-partition -freorder-functions @gol
454 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
455 -frounding-math -fsave-optimization-record @gol
456 -fsched2-use-superblocks -fsched-pressure @gol
457 -fsched-spec-load -fsched-spec-load-dangerous @gol
458 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
459 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
460 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
461 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
462 -fschedule-fusion @gol
463 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
464 -fselective-scheduling -fselective-scheduling2 @gol
465 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
466 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
467 -fsignaling-nans @gol
468 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
469 -fsplit-paths @gol
470 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
471 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
472 -fthread-jumps -ftracer -ftree-bit-ccp @gol
473 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
474 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
475 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
476 -ftree-loop-if-convert -ftree-loop-im @gol
477 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
478 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
479 -ftree-loop-vectorize @gol
480 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
481 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
482 -ftree-switch-conversion -ftree-tail-merge @gol
483 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
484 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
485 -funsafe-math-optimizations -funswitch-loops @gol
486 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
487 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
488 --param @var{name}=@var{value}
489 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
490
491 @item Program Instrumentation Options
492 @xref{Instrumentation Options,,Program Instrumentation Options}.
493 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
494 -fprofile-abs-path @gol
495 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
496 -fprofile-note=@var{path} -fprofile-update=@var{method} @gol
497 -fprofile-filter-files=@var{regex} -fprofile-exclude-files=@var{regex} @gol
498 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
499 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
500 -fsanitize-undefined-trap-on-error -fbounds-check @gol
501 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
502 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
503 -fstack-protector-explicit -fstack-check @gol
504 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
505 -fno-stack-limit -fsplit-stack @gol
506 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
507 -fvtv-counts -fvtv-debug @gol
508 -finstrument-functions @gol
509 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
510 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
511
512 @item Preprocessor Options
513 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
514 @gccoptlist{-A@var{question}=@var{answer} @gol
515 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
516 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
517 -dD -dI -dM -dN -dU @gol
518 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
519 -fexec-charset=@var{charset} -fextended-identifiers @gol
520 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
521 -fmax-include-depth=@var{depth} @gol
522 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
523 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
524 -fwide-exec-charset=@var{charset} -fworking-directory @gol
525 -H -imacros @var{file} -include @var{file} @gol
526 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
527 -no-integrated-cpp -P -pthread -remap @gol
528 -traditional -traditional-cpp -trigraphs @gol
529 -U@var{macro} -undef @gol
530 -Wp,@var{option} -Xpreprocessor @var{option}}
531
532 @item Assembler Options
533 @xref{Assembler Options,,Passing Options to the Assembler}.
534 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
535
536 @item Linker Options
537 @xref{Link Options,,Options for Linking}.
538 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
539 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
540 -e @var{entry} --entry=@var{entry} @gol
541 -pie -pthread -r -rdynamic @gol
542 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
543 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
544 -shared -shared-libgcc -symbolic @gol
545 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
546 -u @var{symbol} -z @var{keyword}}
547
548 @item Directory Options
549 @xref{Directory Options,,Options for Directory Search}.
550 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
551 -idirafter @var{dir} @gol
552 -imacros @var{file} -imultilib @var{dir} @gol
553 -iplugindir=@var{dir} -iprefix @var{file} @gol
554 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
555 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
556 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
557 -nostdinc -nostdinc++ --sysroot=@var{dir}}
558
559 @item Code Generation Options
560 @xref{Code Gen Options,,Options for Code Generation Conventions}.
561 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
562 -ffixed-@var{reg} -fexceptions @gol
563 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
564 -fasynchronous-unwind-tables @gol
565 -fno-gnu-unique @gol
566 -finhibit-size-directive -fno-common -fno-ident @gol
567 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
568 -fno-jump-tables @gol
569 -frecord-gcc-switches @gol
570 -freg-struct-return -fshort-enums -fshort-wchar @gol
571 -fverbose-asm -fpack-struct[=@var{n}] @gol
572 -fleading-underscore -ftls-model=@var{model} @gol
573 -fstack-reuse=@var{reuse_level} @gol
574 -ftrampolines -ftrapv -fwrapv @gol
575 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
576 -fstrict-volatile-bitfields -fsync-libcalls}
577
578 @item Developer Options
579 @xref{Developer Options,,GCC Developer Options}.
580 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
581 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
582 -fdbg-cnt=@var{counter-value-list} @gol
583 -fdisable-ipa-@var{pass_name} @gol
584 -fdisable-rtl-@var{pass_name} @gol
585 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
586 -fdisable-tree-@var{pass_name} @gol
587 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
588 -fdump-debug -fdump-earlydebug @gol
589 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
590 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
591 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
592 -fdump-lang-all @gol
593 -fdump-lang-@var{switch} @gol
594 -fdump-lang-@var{switch}-@var{options} @gol
595 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
596 -fdump-passes @gol
597 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
598 -fdump-statistics @gol
599 -fdump-tree-all @gol
600 -fdump-tree-@var{switch} @gol
601 -fdump-tree-@var{switch}-@var{options} @gol
602 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
603 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
604 -fenable-@var{kind}-@var{pass} @gol
605 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
606 -fira-verbose=@var{n} @gol
607 -flto-report -flto-report-wpa -fmem-report-wpa @gol
608 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
609 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
610 -fprofile-report @gol
611 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
612 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
613 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
614 -fvar-tracking-assignments-toggle -gtoggle @gol
615 -print-file-name=@var{library} -print-libgcc-file-name @gol
616 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
617 -print-prog-name=@var{program} -print-search-dirs -Q @gol
618 -print-sysroot -print-sysroot-headers-suffix @gol
619 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
620
621 @item Machine-Dependent Options
622 @xref{Submodel Options,,Machine-Dependent Options}.
623 @c This list is ordered alphanumerically by subsection name.
624 @c Try and put the significant identifier (CPU or system) first,
625 @c so users have a clue at guessing where the ones they want will be.
626
627 @emph{AArch64 Options}
628 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
629 -mgeneral-regs-only @gol
630 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
631 -mstrict-align -mno-strict-align @gol
632 -momit-leaf-frame-pointer @gol
633 -mtls-dialect=desc -mtls-dialect=traditional @gol
634 -mtls-size=@var{size} @gol
635 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
636 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
637 -mpc-relative-literal-loads @gol
638 -msign-return-address=@var{scope} @gol
639 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
640 +@var{b-key}]|@var{bti} @gol
641 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
642 -moverride=@var{string} -mverbose-cost-dump @gol
643 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
644 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation }
645
646 @emph{Adapteva Epiphany Options}
647 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
648 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
649 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
650 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
651 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
652 -msplit-vecmove-early -m1reg-@var{reg}}
653
654 @emph{AMD GCN Options}
655 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
656
657 @emph{ARC Options}
658 @gccoptlist{-mbarrel-shifter -mjli-always @gol
659 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
660 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
661 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
662 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
663 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
664 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
665 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
666 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
667 -mvolatile-cache -mtp-regno=@var{regno} @gol
668 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
669 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
670 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
671 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
672 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
673 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
674 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
675 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
676
677 @emph{ARM Options}
678 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
679 -mabi=@var{name} @gol
680 -mapcs-stack-check -mno-apcs-stack-check @gol
681 -mapcs-reentrant -mno-apcs-reentrant @gol
682 -mgeneral-regs-only @gol
683 -msched-prolog -mno-sched-prolog @gol
684 -mlittle-endian -mbig-endian @gol
685 -mbe8 -mbe32 @gol
686 -mfloat-abi=@var{name} @gol
687 -mfp16-format=@var{name}
688 -mthumb-interwork -mno-thumb-interwork @gol
689 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
690 -mtune=@var{name} -mprint-tune-info @gol
691 -mstructure-size-boundary=@var{n} @gol
692 -mabort-on-noreturn @gol
693 -mlong-calls -mno-long-calls @gol
694 -msingle-pic-base -mno-single-pic-base @gol
695 -mpic-register=@var{reg} @gol
696 -mnop-fun-dllimport @gol
697 -mpoke-function-name @gol
698 -mthumb -marm -mflip-thumb @gol
699 -mtpcs-frame -mtpcs-leaf-frame @gol
700 -mcaller-super-interworking -mcallee-super-interworking @gol
701 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
702 -mword-relocations @gol
703 -mfix-cortex-m3-ldrd @gol
704 -munaligned-access @gol
705 -mneon-for-64bits @gol
706 -mslow-flash-data @gol
707 -masm-syntax-unified @gol
708 -mrestrict-it @gol
709 -mverbose-cost-dump @gol
710 -mpure-code @gol
711 -mcmse}
712
713 @emph{AVR Options}
714 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
715 -mbranch-cost=@var{cost} @gol
716 -mcall-prologues -mgas-isr-prologues -mint8 @gol
717 -mn_flash=@var{size} -mno-interrupts @gol
718 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
719 -mfract-convert-truncate @gol
720 -mshort-calls -nodevicelib @gol
721 -Waddr-space-convert -Wmisspelled-isr}
722
723 @emph{Blackfin Options}
724 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
725 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
726 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
727 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
728 -mno-id-shared-library -mshared-library-id=@var{n} @gol
729 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
730 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
731 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
732 -micplb}
733
734 @emph{C6X Options}
735 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
736 -msim -msdata=@var{sdata-type}}
737
738 @emph{CRIS Options}
739 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
740 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
741 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
742 -mstack-align -mdata-align -mconst-align @gol
743 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
744 -melf -maout -melinux -mlinux -sim -sim2 @gol
745 -mmul-bug-workaround -mno-mul-bug-workaround}
746
747 @emph{CR16 Options}
748 @gccoptlist{-mmac @gol
749 -mcr16cplus -mcr16c @gol
750 -msim -mint32 -mbit-ops
751 -mdata-model=@var{model}}
752
753 @emph{C-SKY Options}
754 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
755 -mbig-endian -EB -mlittle-endian -EL @gol
756 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
757 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
758 -mdsp -medsp -mvdsp @gol
759 -mdiv -msmart -mhigh-registers -manchor @gol
760 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
761 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
762
763 @emph{Darwin Options}
764 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
765 -arch_only -bind_at_load -bundle -bundle_loader @gol
766 -client_name -compatibility_version -current_version @gol
767 -dead_strip @gol
768 -dependency-file -dylib_file -dylinker_install_name @gol
769 -dynamic -dynamiclib -exported_symbols_list @gol
770 -filelist -flat_namespace -force_cpusubtype_ALL @gol
771 -force_flat_namespace -headerpad_max_install_names @gol
772 -iframework @gol
773 -image_base -init -install_name -keep_private_externs @gol
774 -multi_module -multiply_defined -multiply_defined_unused @gol
775 -noall_load -no_dead_strip_inits_and_terms @gol
776 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
777 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
778 -private_bundle -read_only_relocs -sectalign @gol
779 -sectobjectsymbols -whyload -seg1addr @gol
780 -sectcreate -sectobjectsymbols -sectorder @gol
781 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
782 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
783 -segprot -segs_read_only_addr -segs_read_write_addr @gol
784 -single_module -static -sub_library -sub_umbrella @gol
785 -twolevel_namespace -umbrella -undefined @gol
786 -unexported_symbols_list -weak_reference_mismatches @gol
787 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
788 -mkernel -mone-byte-bool}
789
790 @emph{DEC Alpha Options}
791 @gccoptlist{-mno-fp-regs -msoft-float @gol
792 -mieee -mieee-with-inexact -mieee-conformant @gol
793 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
794 -mtrap-precision=@var{mode} -mbuild-constants @gol
795 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
796 -mbwx -mmax -mfix -mcix @gol
797 -mfloat-vax -mfloat-ieee @gol
798 -mexplicit-relocs -msmall-data -mlarge-data @gol
799 -msmall-text -mlarge-text @gol
800 -mmemory-latency=@var{time}}
801
802 @emph{FR30 Options}
803 @gccoptlist{-msmall-model -mno-lsim}
804
805 @emph{FT32 Options}
806 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
807
808 @emph{FRV Options}
809 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
810 -mhard-float -msoft-float @gol
811 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
812 -mdouble -mno-double @gol
813 -mmedia -mno-media -mmuladd -mno-muladd @gol
814 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
815 -mlinked-fp -mlong-calls -malign-labels @gol
816 -mlibrary-pic -macc-4 -macc-8 @gol
817 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
818 -moptimize-membar -mno-optimize-membar @gol
819 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
820 -mvliw-branch -mno-vliw-branch @gol
821 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
822 -mno-nested-cond-exec -mtomcat-stats @gol
823 -mTLS -mtls @gol
824 -mcpu=@var{cpu}}
825
826 @emph{GNU/Linux Options}
827 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
828 -tno-android-cc -tno-android-ld}
829
830 @emph{H8/300 Options}
831 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
832
833 @emph{HPPA Options}
834 @gccoptlist{-march=@var{architecture-type} @gol
835 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
836 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
837 -mfixed-range=@var{register-range} @gol
838 -mjump-in-delay -mlinker-opt -mlong-calls @gol
839 -mlong-load-store -mno-disable-fpregs @gol
840 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
841 -mno-jump-in-delay -mno-long-load-store @gol
842 -mno-portable-runtime -mno-soft-float @gol
843 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
844 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
845 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
846 -munix=@var{unix-std} -nolibdld -static -threads}
847
848 @emph{IA-64 Options}
849 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
850 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
851 -mconstant-gp -mauto-pic -mfused-madd @gol
852 -minline-float-divide-min-latency @gol
853 -minline-float-divide-max-throughput @gol
854 -mno-inline-float-divide @gol
855 -minline-int-divide-min-latency @gol
856 -minline-int-divide-max-throughput @gol
857 -mno-inline-int-divide @gol
858 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
859 -mno-inline-sqrt @gol
860 -mdwarf2-asm -mearly-stop-bits @gol
861 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
862 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
863 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
864 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
865 -msched-spec-ldc -msched-spec-control-ldc @gol
866 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
867 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
868 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
869 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
870
871 @emph{LM32 Options}
872 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
873 -msign-extend-enabled -muser-enabled}
874
875 @emph{M32R/D Options}
876 @gccoptlist{-m32r2 -m32rx -m32r @gol
877 -mdebug @gol
878 -malign-loops -mno-align-loops @gol
879 -missue-rate=@var{number} @gol
880 -mbranch-cost=@var{number} @gol
881 -mmodel=@var{code-size-model-type} @gol
882 -msdata=@var{sdata-type} @gol
883 -mno-flush-func -mflush-func=@var{name} @gol
884 -mno-flush-trap -mflush-trap=@var{number} @gol
885 -G @var{num}}
886
887 @emph{M32C Options}
888 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
889
890 @emph{M680x0 Options}
891 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
892 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
893 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
894 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
895 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
896 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
897 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
898 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
899 -mxgot -mno-xgot -mlong-jump-table-offsets}
900
901 @emph{MCore Options}
902 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
903 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
904 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
905 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
906 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
907
908 @emph{MeP Options}
909 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
910 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
911 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
912 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
913 -mtiny=@var{n}}
914
915 @emph{MicroBlaze Options}
916 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
917 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
918 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
919 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
920 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
921 -mpic-data-is-text-relative}
922
923 @emph{MIPS Options}
924 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
925 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
926 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
927 -mips16 -mno-mips16 -mflip-mips16 @gol
928 -minterlink-compressed -mno-interlink-compressed @gol
929 -minterlink-mips16 -mno-interlink-mips16 @gol
930 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
931 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
932 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
933 -mno-float -msingle-float -mdouble-float @gol
934 -modd-spreg -mno-odd-spreg @gol
935 -mabs=@var{mode} -mnan=@var{encoding} @gol
936 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
937 -mmcu -mmno-mcu @gol
938 -meva -mno-eva @gol
939 -mvirt -mno-virt @gol
940 -mxpa -mno-xpa @gol
941 -mcrc -mno-crc @gol
942 -mginv -mno-ginv @gol
943 -mmicromips -mno-micromips @gol
944 -mmsa -mno-msa @gol
945 -mloongson-mmi -mno-loongson-mmi @gol
946 -mloongson-ext -mno-loongson-ext @gol
947 -mloongson-ext2 -mno-loongson-ext2 @gol
948 -mfpu=@var{fpu-type} @gol
949 -msmartmips -mno-smartmips @gol
950 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
951 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
952 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
953 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
954 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
955 -membedded-data -mno-embedded-data @gol
956 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
957 -mcode-readable=@var{setting} @gol
958 -msplit-addresses -mno-split-addresses @gol
959 -mexplicit-relocs -mno-explicit-relocs @gol
960 -mcheck-zero-division -mno-check-zero-division @gol
961 -mdivide-traps -mdivide-breaks @gol
962 -mload-store-pairs -mno-load-store-pairs @gol
963 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
964 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
965 -mfix-24k -mno-fix-24k @gol
966 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
967 -mfix-r5900 -mno-fix-r5900 @gol
968 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
969 -mfix-vr4120 -mno-fix-vr4120 @gol
970 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
971 -mflush-func=@var{func} -mno-flush-func @gol
972 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
973 -mcompact-branches=@var{policy} @gol
974 -mfp-exceptions -mno-fp-exceptions @gol
975 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
976 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
977 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
978 -mframe-header-opt -mno-frame-header-opt}
979
980 @emph{MMIX Options}
981 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
982 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
983 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
984 -mno-base-addresses -msingle-exit -mno-single-exit}
985
986 @emph{MN10300 Options}
987 @gccoptlist{-mmult-bug -mno-mult-bug @gol
988 -mno-am33 -mam33 -mam33-2 -mam34 @gol
989 -mtune=@var{cpu-type} @gol
990 -mreturn-pointer-on-d0 @gol
991 -mno-crt0 -mrelax -mliw -msetlb}
992
993 @emph{Moxie Options}
994 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
995
996 @emph{MSP430 Options}
997 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
998 -mwarn-mcu @gol
999 -mcode-region= -mdata-region= @gol
1000 -msilicon-errata= -msilicon-errata-warn= @gol
1001 -mhwmult= -minrt}
1002
1003 @emph{NDS32 Options}
1004 @gccoptlist{-mbig-endian -mlittle-endian @gol
1005 -mreduced-regs -mfull-regs @gol
1006 -mcmov -mno-cmov @gol
1007 -mext-perf -mno-ext-perf @gol
1008 -mext-perf2 -mno-ext-perf2 @gol
1009 -mext-string -mno-ext-string @gol
1010 -mv3push -mno-v3push @gol
1011 -m16bit -mno-16bit @gol
1012 -misr-vector-size=@var{num} @gol
1013 -mcache-block-size=@var{num} @gol
1014 -march=@var{arch} @gol
1015 -mcmodel=@var{code-model} @gol
1016 -mctor-dtor -mrelax}
1017
1018 @emph{Nios II Options}
1019 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1020 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1021 -mel -meb @gol
1022 -mno-bypass-cache -mbypass-cache @gol
1023 -mno-cache-volatile -mcache-volatile @gol
1024 -mno-fast-sw-div -mfast-sw-div @gol
1025 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1026 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1027 -mcustom-fpu-cfg=@var{name} @gol
1028 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1029 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1030
1031 @emph{Nvidia PTX Options}
1032 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1033
1034 @emph{OpenRISC Options}
1035 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1036 -msoft-mul -msoft-div @gol
1037 -mcmov -mror -msext -msfimm -mshftimm}
1038
1039 @emph{PDP-11 Options}
1040 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1041 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1042 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1043
1044 @emph{picoChip Options}
1045 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1046 -msymbol-as-address -mno-inefficient-warnings}
1047
1048 @emph{PowerPC Options}
1049 See RS/6000 and PowerPC Options.
1050
1051 @emph{PRU Options}
1052 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1053 -mabi=@var{variant} @gol}
1054
1055 @emph{RISC-V Options}
1056 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1057 -mplt -mno-plt @gol
1058 -mabi=@var{ABI-string} @gol
1059 -mfdiv -mno-fdiv @gol
1060 -mdiv -mno-div @gol
1061 -march=@var{ISA-string} @gol
1062 -mtune=@var{processor-string} @gol
1063 -mpreferred-stack-boundary=@var{num} @gol
1064 -msmall-data-limit=@var{N-bytes} @gol
1065 -msave-restore -mno-save-restore @gol
1066 -mstrict-align -mno-strict-align @gol
1067 -mcmodel=medlow -mcmodel=medany @gol
1068 -mexplicit-relocs -mno-explicit-relocs @gol
1069 -mrelax -mno-relax @gol
1070 -mriscv-attribute -mmo-riscv-attribute}
1071
1072 @emph{RL78 Options}
1073 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1074 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1075 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1076
1077 @emph{RS/6000 and PowerPC Options}
1078 @gccoptlist{-mcpu=@var{cpu-type} @gol
1079 -mtune=@var{cpu-type} @gol
1080 -mcmodel=@var{code-model} @gol
1081 -mpowerpc64 @gol
1082 -maltivec -mno-altivec @gol
1083 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1084 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1085 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1086 -mfprnd -mno-fprnd @gol
1087 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1088 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1089 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1090 -malign-power -malign-natural @gol
1091 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1092 -mupdate -mno-update @gol
1093 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1094 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1095 -mstrict-align -mno-strict-align -mrelocatable @gol
1096 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1097 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1098 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1099 -mprioritize-restricted-insns=@var{priority} @gol
1100 -msched-costly-dep=@var{dependence_type} @gol
1101 -minsert-sched-nops=@var{scheme} @gol
1102 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1103 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1104 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1105 -mtraceback=@var{traceback_type} @gol
1106 -maix-struct-return -msvr4-struct-return @gol
1107 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1108 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1109 -mblock-move-inline-limit=@var{num} @gol
1110 -mblock-compare-inline-limit=@var{num} @gol
1111 -mblock-compare-inline-loop-limit=@var{num} @gol
1112 -mstring-compare-inline-limit=@var{num} @gol
1113 -misel -mno-isel @gol
1114 -mvrsave -mno-vrsave @gol
1115 -mmulhw -mno-mulhw @gol
1116 -mdlmzb -mno-dlmzb @gol
1117 -mprototype -mno-prototype @gol
1118 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1119 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1120 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1121 -mno-recip-precision @gol
1122 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1123 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1124 -msave-toc-indirect -mno-save-toc-indirect @gol
1125 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1126 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1127 -mquad-memory -mno-quad-memory @gol
1128 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1129 -mcompat-align-parm -mno-compat-align-parm @gol
1130 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1131 -mgnu-attribute -mno-gnu-attribute @gol
1132 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1133 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1134
1135 @emph{RX Options}
1136 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1137 -mcpu=@gol
1138 -mbig-endian-data -mlittle-endian-data @gol
1139 -msmall-data @gol
1140 -msim -mno-sim@gol
1141 -mas100-syntax -mno-as100-syntax@gol
1142 -mrelax@gol
1143 -mmax-constant-size=@gol
1144 -mint-register=@gol
1145 -mpid@gol
1146 -mallow-string-insns -mno-allow-string-insns@gol
1147 -mjsr@gol
1148 -mno-warn-multiple-fast-interrupts@gol
1149 -msave-acc-in-interrupts}
1150
1151 @emph{S/390 and zSeries Options}
1152 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1153 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1154 -mlong-double-64 -mlong-double-128 @gol
1155 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1156 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1157 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1158 -mhtm -mvx -mzvector @gol
1159 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1160 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1161 -mhotpatch=@var{halfwords},@var{halfwords}}
1162
1163 @emph{Score Options}
1164 @gccoptlist{-meb -mel @gol
1165 -mnhwloop @gol
1166 -muls @gol
1167 -mmac @gol
1168 -mscore5 -mscore5u -mscore7 -mscore7d}
1169
1170 @emph{SH Options}
1171 @gccoptlist{-m1 -m2 -m2e @gol
1172 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1173 -m3 -m3e @gol
1174 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1175 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1176 -mb -ml -mdalign -mrelax @gol
1177 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1178 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1179 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1180 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1181 -maccumulate-outgoing-args @gol
1182 -matomic-model=@var{atomic-model} @gol
1183 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1184 -mcbranch-force-delay-slot @gol
1185 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1186 -mpretend-cmove -mtas}
1187
1188 @emph{Solaris 2 Options}
1189 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1190 -pthreads}
1191
1192 @emph{SPARC Options}
1193 @gccoptlist{-mcpu=@var{cpu-type} @gol
1194 -mtune=@var{cpu-type} @gol
1195 -mcmodel=@var{code-model} @gol
1196 -mmemory-model=@var{mem-model} @gol
1197 -m32 -m64 -mapp-regs -mno-app-regs @gol
1198 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1199 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1200 -mhard-quad-float -msoft-quad-float @gol
1201 -mstack-bias -mno-stack-bias @gol
1202 -mstd-struct-return -mno-std-struct-return @gol
1203 -munaligned-doubles -mno-unaligned-doubles @gol
1204 -muser-mode -mno-user-mode @gol
1205 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1206 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1207 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1208 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1209 -mpopc -mno-popc -msubxc -mno-subxc @gol
1210 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1211 -mlra -mno-lra}
1212
1213 @emph{SPU Options}
1214 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1215 -msafe-dma -munsafe-dma @gol
1216 -mbranch-hints @gol
1217 -msmall-mem -mlarge-mem -mstdmain @gol
1218 -mfixed-range=@var{register-range} @gol
1219 -mea32 -mea64 @gol
1220 -maddress-space-conversion -mno-address-space-conversion @gol
1221 -mcache-size=@var{cache-size} @gol
1222 -matomic-updates -mno-atomic-updates}
1223
1224 @emph{System V Options}
1225 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1226
1227 @emph{TILE-Gx Options}
1228 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1229 -mcmodel=@var{code-model}}
1230
1231 @emph{TILEPro Options}
1232 @gccoptlist{-mcpu=@var{cpu} -m32}
1233
1234 @emph{V850 Options}
1235 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1236 -mprolog-function -mno-prolog-function -mspace @gol
1237 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1238 -mapp-regs -mno-app-regs @gol
1239 -mdisable-callt -mno-disable-callt @gol
1240 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1241 -mv850e -mv850 -mv850e3v5 @gol
1242 -mloop @gol
1243 -mrelax @gol
1244 -mlong-jumps @gol
1245 -msoft-float @gol
1246 -mhard-float @gol
1247 -mgcc-abi @gol
1248 -mrh850-abi @gol
1249 -mbig-switch}
1250
1251 @emph{VAX Options}
1252 @gccoptlist{-mg -mgnu -munix}
1253
1254 @emph{Visium Options}
1255 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1256 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1257
1258 @emph{VMS Options}
1259 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1260 -mpointer-size=@var{size}}
1261
1262 @emph{VxWorks Options}
1263 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1264 -Xbind-lazy -Xbind-now}
1265
1266 @emph{x86 Options}
1267 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1268 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1269 -mfpmath=@var{unit} @gol
1270 -masm=@var{dialect} -mno-fancy-math-387 @gol
1271 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1272 -mno-wide-multiply -mrtd -malign-double @gol
1273 -mpreferred-stack-boundary=@var{num} @gol
1274 -mincoming-stack-boundary=@var{num} @gol
1275 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1276 -mrecip -mrecip=@var{opt} @gol
1277 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1278 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1279 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1280 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1281 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1282 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1283 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1284 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1285 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1286 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1287 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1288 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1289 -mrdseed -msgx -mavx512vp2intersect@gol
1290 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1291 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1292 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1293 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1294 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1295 -mregparm=@var{num} -msseregparm @gol
1296 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1297 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1298 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1299 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1300 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1301 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1302 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1303 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1304 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1305 -mstack-protector-guard-reg=@var{reg} @gol
1306 -mstack-protector-guard-offset=@var{offset} @gol
1307 -mstack-protector-guard-symbol=@var{symbol} @gol
1308 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1309 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1310 -mindirect-branch-register}
1311
1312 @emph{x86 Windows Options}
1313 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1314 -mnop-fun-dllimport -mthread @gol
1315 -municode -mwin32 -mwindows -fno-set-stack-executable}
1316
1317 @emph{Xstormy16 Options}
1318 @gccoptlist{-msim}
1319
1320 @emph{Xtensa Options}
1321 @gccoptlist{-mconst16 -mno-const16 @gol
1322 -mfused-madd -mno-fused-madd @gol
1323 -mforce-no-pic @gol
1324 -mserialize-volatile -mno-serialize-volatile @gol
1325 -mtext-section-literals -mno-text-section-literals @gol
1326 -mauto-litpools -mno-auto-litpools @gol
1327 -mtarget-align -mno-target-align @gol
1328 -mlongcalls -mno-longcalls}
1329
1330 @emph{zSeries Options}
1331 See S/390 and zSeries Options.
1332 @end table
1333
1334
1335 @node Overall Options
1336 @section Options Controlling the Kind of Output
1337
1338 Compilation can involve up to four stages: preprocessing, compilation
1339 proper, assembly and linking, always in that order. GCC is capable of
1340 preprocessing and compiling several files either into several
1341 assembler input files, or into one assembler input file; then each
1342 assembler input file produces an object file, and linking combines all
1343 the object files (those newly compiled, and those specified as input)
1344 into an executable file.
1345
1346 @cindex file name suffix
1347 For any given input file, the file name suffix determines what kind of
1348 compilation is done:
1349
1350 @table @gcctabopt
1351 @item @var{file}.c
1352 C source code that must be preprocessed.
1353
1354 @item @var{file}.i
1355 C source code that should not be preprocessed.
1356
1357 @item @var{file}.ii
1358 C++ source code that should not be preprocessed.
1359
1360 @item @var{file}.m
1361 Objective-C source code. Note that you must link with the @file{libobjc}
1362 library to make an Objective-C program work.
1363
1364 @item @var{file}.mi
1365 Objective-C source code that should not be preprocessed.
1366
1367 @item @var{file}.mm
1368 @itemx @var{file}.M
1369 Objective-C++ source code. Note that you must link with the @file{libobjc}
1370 library to make an Objective-C++ program work. Note that @samp{.M} refers
1371 to a literal capital M@.
1372
1373 @item @var{file}.mii
1374 Objective-C++ source code that should not be preprocessed.
1375
1376 @item @var{file}.h
1377 C, C++, Objective-C or Objective-C++ header file to be turned into a
1378 precompiled header (default), or C, C++ header file to be turned into an
1379 Ada spec (via the @option{-fdump-ada-spec} switch).
1380
1381 @item @var{file}.cc
1382 @itemx @var{file}.cp
1383 @itemx @var{file}.cxx
1384 @itemx @var{file}.cpp
1385 @itemx @var{file}.CPP
1386 @itemx @var{file}.c++
1387 @itemx @var{file}.C
1388 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1389 the last two letters must both be literally @samp{x}. Likewise,
1390 @samp{.C} refers to a literal capital C@.
1391
1392 @item @var{file}.mm
1393 @itemx @var{file}.M
1394 Objective-C++ source code that must be preprocessed.
1395
1396 @item @var{file}.mii
1397 Objective-C++ source code that should not be preprocessed.
1398
1399 @item @var{file}.hh
1400 @itemx @var{file}.H
1401 @itemx @var{file}.hp
1402 @itemx @var{file}.hxx
1403 @itemx @var{file}.hpp
1404 @itemx @var{file}.HPP
1405 @itemx @var{file}.h++
1406 @itemx @var{file}.tcc
1407 C++ header file to be turned into a precompiled header or Ada spec.
1408
1409 @item @var{file}.f
1410 @itemx @var{file}.for
1411 @itemx @var{file}.ftn
1412 Fixed form Fortran source code that should not be preprocessed.
1413
1414 @item @var{file}.F
1415 @itemx @var{file}.FOR
1416 @itemx @var{file}.fpp
1417 @itemx @var{file}.FPP
1418 @itemx @var{file}.FTN
1419 Fixed form Fortran source code that must be preprocessed (with the traditional
1420 preprocessor).
1421
1422 @item @var{file}.f90
1423 @itemx @var{file}.f95
1424 @itemx @var{file}.f03
1425 @itemx @var{file}.f08
1426 Free form Fortran source code that should not be preprocessed.
1427
1428 @item @var{file}.F90
1429 @itemx @var{file}.F95
1430 @itemx @var{file}.F03
1431 @itemx @var{file}.F08
1432 Free form Fortran source code that must be preprocessed (with the
1433 traditional preprocessor).
1434
1435 @item @var{file}.go
1436 Go source code.
1437
1438 @item @var{file}.brig
1439 BRIG files (binary representation of HSAIL).
1440
1441 @item @var{file}.d
1442 D source code.
1443
1444 @item @var{file}.di
1445 D interface file.
1446
1447 @item @var{file}.dd
1448 D documentation code (Ddoc).
1449
1450 @item @var{file}.ads
1451 Ada source code file that contains a library unit declaration (a
1452 declaration of a package, subprogram, or generic, or a generic
1453 instantiation), or a library unit renaming declaration (a package,
1454 generic, or subprogram renaming declaration). Such files are also
1455 called @dfn{specs}.
1456
1457 @item @var{file}.adb
1458 Ada source code file containing a library unit body (a subprogram or
1459 package body). Such files are also called @dfn{bodies}.
1460
1461 @c GCC also knows about some suffixes for languages not yet included:
1462 @c Ratfor:
1463 @c @var{file}.r
1464
1465 @item @var{file}.s
1466 Assembler code.
1467
1468 @item @var{file}.S
1469 @itemx @var{file}.sx
1470 Assembler code that must be preprocessed.
1471
1472 @item @var{other}
1473 An object file to be fed straight into linking.
1474 Any file name with no recognized suffix is treated this way.
1475 @end table
1476
1477 @opindex x
1478 You can specify the input language explicitly with the @option{-x} option:
1479
1480 @table @gcctabopt
1481 @item -x @var{language}
1482 Specify explicitly the @var{language} for the following input files
1483 (rather than letting the compiler choose a default based on the file
1484 name suffix). This option applies to all following input files until
1485 the next @option{-x} option. Possible values for @var{language} are:
1486 @smallexample
1487 c c-header cpp-output
1488 c++ c++-header c++-cpp-output
1489 objective-c objective-c-header objective-c-cpp-output
1490 objective-c++ objective-c++-header objective-c++-cpp-output
1491 assembler assembler-with-cpp
1492 ada
1493 d
1494 f77 f77-cpp-input f95 f95-cpp-input
1495 go
1496 brig
1497 @end smallexample
1498
1499 @item -x none
1500 Turn off any specification of a language, so that subsequent files are
1501 handled according to their file name suffixes (as they are if @option{-x}
1502 has not been used at all).
1503 @end table
1504
1505 If you only want some of the stages of compilation, you can use
1506 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1507 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1508 @command{gcc} is to stop. Note that some combinations (for example,
1509 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1510
1511 @table @gcctabopt
1512 @item -c
1513 @opindex c
1514 Compile or assemble the source files, but do not link. The linking
1515 stage simply is not done. The ultimate output is in the form of an
1516 object file for each source file.
1517
1518 By default, the object file name for a source file is made by replacing
1519 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1520
1521 Unrecognized input files, not requiring compilation or assembly, are
1522 ignored.
1523
1524 @item -S
1525 @opindex S
1526 Stop after the stage of compilation proper; do not assemble. The output
1527 is in the form of an assembler code file for each non-assembler input
1528 file specified.
1529
1530 By default, the assembler file name for a source file is made by
1531 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1532
1533 Input files that don't require compilation are ignored.
1534
1535 @item -E
1536 @opindex E
1537 Stop after the preprocessing stage; do not run the compiler proper. The
1538 output is in the form of preprocessed source code, which is sent to the
1539 standard output.
1540
1541 Input files that don't require preprocessing are ignored.
1542
1543 @cindex output file option
1544 @item -o @var{file}
1545 @opindex o
1546 Place output in file @var{file}. This applies to whatever
1547 sort of output is being produced, whether it be an executable file,
1548 an object file, an assembler file or preprocessed C code.
1549
1550 If @option{-o} is not specified, the default is to put an executable
1551 file in @file{a.out}, the object file for
1552 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1553 assembler file in @file{@var{source}.s}, a precompiled header file in
1554 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1555 standard output.
1556
1557 @item -v
1558 @opindex v
1559 Print (on standard error output) the commands executed to run the stages
1560 of compilation. Also print the version number of the compiler driver
1561 program and of the preprocessor and the compiler proper.
1562
1563 @item -###
1564 @opindex ###
1565 Like @option{-v} except the commands are not executed and arguments
1566 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1567 This is useful for shell scripts to capture the driver-generated command lines.
1568
1569 @item --help
1570 @opindex help
1571 Print (on the standard output) a description of the command-line options
1572 understood by @command{gcc}. If the @option{-v} option is also specified
1573 then @option{--help} is also passed on to the various processes
1574 invoked by @command{gcc}, so that they can display the command-line options
1575 they accept. If the @option{-Wextra} option has also been specified
1576 (prior to the @option{--help} option), then command-line options that
1577 have no documentation associated with them are also displayed.
1578
1579 @item --target-help
1580 @opindex target-help
1581 Print (on the standard output) a description of target-specific command-line
1582 options for each tool. For some targets extra target-specific
1583 information may also be printed.
1584
1585 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1586 Print (on the standard output) a description of the command-line
1587 options understood by the compiler that fit into all specified classes
1588 and qualifiers. These are the supported classes:
1589
1590 @table @asis
1591 @item @samp{optimizers}
1592 Display all of the optimization options supported by the
1593 compiler.
1594
1595 @item @samp{warnings}
1596 Display all of the options controlling warning messages
1597 produced by the compiler.
1598
1599 @item @samp{target}
1600 Display target-specific options. Unlike the
1601 @option{--target-help} option however, target-specific options of the
1602 linker and assembler are not displayed. This is because those
1603 tools do not currently support the extended @option{--help=} syntax.
1604
1605 @item @samp{params}
1606 Display the values recognized by the @option{--param}
1607 option.
1608
1609 @item @var{language}
1610 Display the options supported for @var{language}, where
1611 @var{language} is the name of one of the languages supported in this
1612 version of GCC@.
1613
1614 @item @samp{common}
1615 Display the options that are common to all languages.
1616 @end table
1617
1618 These are the supported qualifiers:
1619
1620 @table @asis
1621 @item @samp{undocumented}
1622 Display only those options that are undocumented.
1623
1624 @item @samp{joined}
1625 Display options taking an argument that appears after an equal
1626 sign in the same continuous piece of text, such as:
1627 @samp{--help=target}.
1628
1629 @item @samp{separate}
1630 Display options taking an argument that appears as a separate word
1631 following the original option, such as: @samp{-o output-file}.
1632 @end table
1633
1634 Thus for example to display all the undocumented target-specific
1635 switches supported by the compiler, use:
1636
1637 @smallexample
1638 --help=target,undocumented
1639 @end smallexample
1640
1641 The sense of a qualifier can be inverted by prefixing it with the
1642 @samp{^} character, so for example to display all binary warning
1643 options (i.e., ones that are either on or off and that do not take an
1644 argument) that have a description, use:
1645
1646 @smallexample
1647 --help=warnings,^joined,^undocumented
1648 @end smallexample
1649
1650 The argument to @option{--help=} should not consist solely of inverted
1651 qualifiers.
1652
1653 Combining several classes is possible, although this usually
1654 restricts the output so much that there is nothing to display. One
1655 case where it does work, however, is when one of the classes is
1656 @var{target}. For example, to display all the target-specific
1657 optimization options, use:
1658
1659 @smallexample
1660 --help=target,optimizers
1661 @end smallexample
1662
1663 The @option{--help=} option can be repeated on the command line. Each
1664 successive use displays its requested class of options, skipping
1665 those that have already been displayed. If @option{--help} is also
1666 specified anywhere on the command line then this takes precedence
1667 over any @option{--help=} option.
1668
1669 If the @option{-Q} option appears on the command line before the
1670 @option{--help=} option, then the descriptive text displayed by
1671 @option{--help=} is changed. Instead of describing the displayed
1672 options, an indication is given as to whether the option is enabled,
1673 disabled or set to a specific value (assuming that the compiler
1674 knows this at the point where the @option{--help=} option is used).
1675
1676 Here is a truncated example from the ARM port of @command{gcc}:
1677
1678 @smallexample
1679 % gcc -Q -mabi=2 --help=target -c
1680 The following options are target specific:
1681 -mabi= 2
1682 -mabort-on-noreturn [disabled]
1683 -mapcs [disabled]
1684 @end smallexample
1685
1686 The output is sensitive to the effects of previous command-line
1687 options, so for example it is possible to find out which optimizations
1688 are enabled at @option{-O2} by using:
1689
1690 @smallexample
1691 -Q -O2 --help=optimizers
1692 @end smallexample
1693
1694 Alternatively you can discover which binary optimizations are enabled
1695 by @option{-O3} by using:
1696
1697 @smallexample
1698 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1699 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1700 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1701 @end smallexample
1702
1703 @item --version
1704 @opindex version
1705 Display the version number and copyrights of the invoked GCC@.
1706
1707 @item -pass-exit-codes
1708 @opindex pass-exit-codes
1709 Normally the @command{gcc} program exits with the code of 1 if any
1710 phase of the compiler returns a non-success return code. If you specify
1711 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1712 the numerically highest error produced by any phase returning an error
1713 indication. The C, C++, and Fortran front ends return 4 if an internal
1714 compiler error is encountered.
1715
1716 @item -pipe
1717 @opindex pipe
1718 Use pipes rather than temporary files for communication between the
1719 various stages of compilation. This fails to work on some systems where
1720 the assembler is unable to read from a pipe; but the GNU assembler has
1721 no trouble.
1722
1723 @item -specs=@var{file}
1724 @opindex specs
1725 Process @var{file} after the compiler reads in the standard @file{specs}
1726 file, in order to override the defaults which the @command{gcc} driver
1727 program uses when determining what switches to pass to @command{cc1},
1728 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1729 @option{-specs=@var{file}} can be specified on the command line, and they
1730 are processed in order, from left to right. @xref{Spec Files}, for
1731 information about the format of the @var{file}.
1732
1733 @item -wrapper
1734 @opindex wrapper
1735 Invoke all subcommands under a wrapper program. The name of the
1736 wrapper program and its parameters are passed as a comma separated
1737 list.
1738
1739 @smallexample
1740 gcc -c t.c -wrapper gdb,--args
1741 @end smallexample
1742
1743 @noindent
1744 This invokes all subprograms of @command{gcc} under
1745 @samp{gdb --args}, thus the invocation of @command{cc1} is
1746 @samp{gdb --args cc1 @dots{}}.
1747
1748 @item -ffile-prefix-map=@var{old}=@var{new}
1749 @opindex ffile-prefix-map
1750 When compiling files residing in directory @file{@var{old}}, record
1751 any references to them in the result of the compilation as if the
1752 files resided in directory @file{@var{new}} instead. Specifying this
1753 option is equivalent to specifying all the individual
1754 @option{-f*-prefix-map} options. This can be used to make reproducible
1755 builds that are location independent. See also
1756 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1757
1758 @item -fplugin=@var{name}.so
1759 @opindex fplugin
1760 Load the plugin code in file @var{name}.so, assumed to be a
1761 shared object to be dlopen'd by the compiler. The base name of
1762 the shared object file is used to identify the plugin for the
1763 purposes of argument parsing (See
1764 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1765 Each plugin should define the callback functions specified in the
1766 Plugins API.
1767
1768 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1769 @opindex fplugin-arg
1770 Define an argument called @var{key} with a value of @var{value}
1771 for the plugin called @var{name}.
1772
1773 @item -fdump-ada-spec@r{[}-slim@r{]}
1774 @opindex fdump-ada-spec
1775 For C and C++ source and include files, generate corresponding Ada specs.
1776 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1777 GNAT User's Guide}, which provides detailed documentation on this feature.
1778
1779 @item -fada-spec-parent=@var{unit}
1780 @opindex fada-spec-parent
1781 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1782 Ada specs as child units of parent @var{unit}.
1783
1784 @item -fdump-go-spec=@var{file}
1785 @opindex fdump-go-spec
1786 For input files in any language, generate corresponding Go
1787 declarations in @var{file}. This generates Go @code{const},
1788 @code{type}, @code{var}, and @code{func} declarations which may be a
1789 useful way to start writing a Go interface to code written in some
1790 other language.
1791
1792 @include @value{srcdir}/../libiberty/at-file.texi
1793 @end table
1794
1795 @node Invoking G++
1796 @section Compiling C++ Programs
1797
1798 @cindex suffixes for C++ source
1799 @cindex C++ source file suffixes
1800 C++ source files conventionally use one of the suffixes @samp{.C},
1801 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1802 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1803 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1804 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1805 files with these names and compiles them as C++ programs even if you
1806 call the compiler the same way as for compiling C programs (usually
1807 with the name @command{gcc}).
1808
1809 @findex g++
1810 @findex c++
1811 However, the use of @command{gcc} does not add the C++ library.
1812 @command{g++} is a program that calls GCC and automatically specifies linking
1813 against the C++ library. It treats @samp{.c},
1814 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1815 files unless @option{-x} is used. This program is also useful when
1816 precompiling a C header file with a @samp{.h} extension for use in C++
1817 compilations. On many systems, @command{g++} is also installed with
1818 the name @command{c++}.
1819
1820 @cindex invoking @command{g++}
1821 When you compile C++ programs, you may specify many of the same
1822 command-line options that you use for compiling programs in any
1823 language; or command-line options meaningful for C and related
1824 languages; or options that are meaningful only for C++ programs.
1825 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1826 explanations of options for languages related to C@.
1827 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1828 explanations of options that are meaningful only for C++ programs.
1829
1830 @node C Dialect Options
1831 @section Options Controlling C Dialect
1832 @cindex dialect options
1833 @cindex language dialect options
1834 @cindex options, dialect
1835
1836 The following options control the dialect of C (or languages derived
1837 from C, such as C++, Objective-C and Objective-C++) that the compiler
1838 accepts:
1839
1840 @table @gcctabopt
1841 @cindex ANSI support
1842 @cindex ISO support
1843 @item -ansi
1844 @opindex ansi
1845 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1846 equivalent to @option{-std=c++98}.
1847
1848 This turns off certain features of GCC that are incompatible with ISO
1849 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1850 such as the @code{asm} and @code{typeof} keywords, and
1851 predefined macros such as @code{unix} and @code{vax} that identify the
1852 type of system you are using. It also enables the undesirable and
1853 rarely used ISO trigraph feature. For the C compiler,
1854 it disables recognition of C++ style @samp{//} comments as well as
1855 the @code{inline} keyword.
1856
1857 The alternate keywords @code{__asm__}, @code{__extension__},
1858 @code{__inline__} and @code{__typeof__} continue to work despite
1859 @option{-ansi}. You would not want to use them in an ISO C program, of
1860 course, but it is useful to put them in header files that might be included
1861 in compilations done with @option{-ansi}. Alternate predefined macros
1862 such as @code{__unix__} and @code{__vax__} are also available, with or
1863 without @option{-ansi}.
1864
1865 The @option{-ansi} option does not cause non-ISO programs to be
1866 rejected gratuitously. For that, @option{-Wpedantic} is required in
1867 addition to @option{-ansi}. @xref{Warning Options}.
1868
1869 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1870 option is used. Some header files may notice this macro and refrain
1871 from declaring certain functions or defining certain macros that the
1872 ISO standard doesn't call for; this is to avoid interfering with any
1873 programs that might use these names for other things.
1874
1875 Functions that are normally built in but do not have semantics
1876 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1877 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1878 built-in functions provided by GCC}, for details of the functions
1879 affected.
1880
1881 @item -std=
1882 @opindex std
1883 Determine the language standard. @xref{Standards,,Language Standards
1884 Supported by GCC}, for details of these standard versions. This option
1885 is currently only supported when compiling C or C++.
1886
1887 The compiler can accept several base standards, such as @samp{c90} or
1888 @samp{c++98}, and GNU dialects of those standards, such as
1889 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1890 compiler accepts all programs following that standard plus those
1891 using GNU extensions that do not contradict it. For example,
1892 @option{-std=c90} turns off certain features of GCC that are
1893 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1894 keywords, but not other GNU extensions that do not have a meaning in
1895 ISO C90, such as omitting the middle term of a @code{?:}
1896 expression. On the other hand, when a GNU dialect of a standard is
1897 specified, all features supported by the compiler are enabled, even when
1898 those features change the meaning of the base standard. As a result, some
1899 strict-conforming programs may be rejected. The particular standard
1900 is used by @option{-Wpedantic} to identify which features are GNU
1901 extensions given that version of the standard. For example
1902 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1903 comments, while @option{-std=gnu99 -Wpedantic} does not.
1904
1905 A value for this option must be provided; possible values are
1906
1907 @table @samp
1908 @item c90
1909 @itemx c89
1910 @itemx iso9899:1990
1911 Support all ISO C90 programs (certain GNU extensions that conflict
1912 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1913
1914 @item iso9899:199409
1915 ISO C90 as modified in amendment 1.
1916
1917 @item c99
1918 @itemx c9x
1919 @itemx iso9899:1999
1920 @itemx iso9899:199x
1921 ISO C99. This standard is substantially completely supported, modulo
1922 bugs and floating-point issues
1923 (mainly but not entirely relating to optional C99 features from
1924 Annexes F and G). See
1925 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1926 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1927
1928 @item c11
1929 @itemx c1x
1930 @itemx iso9899:2011
1931 ISO C11, the 2011 revision of the ISO C standard. This standard is
1932 substantially completely supported, modulo bugs, floating-point issues
1933 (mainly but not entirely relating to optional C11 features from
1934 Annexes F and G) and the optional Annexes K (Bounds-checking
1935 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1936
1937 @item c17
1938 @itemx c18
1939 @itemx iso9899:2017
1940 @itemx iso9899:2018
1941 ISO C17, the 2017 revision of the ISO C standard
1942 (published in 2018). This standard is
1943 same as C11 except for corrections of defects (all of which are also
1944 applied with @option{-std=c11}) and a new value of
1945 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1946
1947 @item c2x
1948 The next version of the ISO C standard, still under development. The
1949 support for this version is experimental and incomplete.
1950
1951 @item gnu90
1952 @itemx gnu89
1953 GNU dialect of ISO C90 (including some C99 features).
1954
1955 @item gnu99
1956 @itemx gnu9x
1957 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1958
1959 @item gnu11
1960 @itemx gnu1x
1961 GNU dialect of ISO C11.
1962 The name @samp{gnu1x} is deprecated.
1963
1964 @item gnu17
1965 @itemx gnu18
1966 GNU dialect of ISO C17. This is the default for C code.
1967
1968 @item gnu2x
1969 The next version of the ISO C standard, still under development, plus
1970 GNU extensions. The support for this version is experimental and
1971 incomplete.
1972
1973 @item c++98
1974 @itemx c++03
1975 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1976 additional defect reports. Same as @option{-ansi} for C++ code.
1977
1978 @item gnu++98
1979 @itemx gnu++03
1980 GNU dialect of @option{-std=c++98}.
1981
1982 @item c++11
1983 @itemx c++0x
1984 The 2011 ISO C++ standard plus amendments.
1985 The name @samp{c++0x} is deprecated.
1986
1987 @item gnu++11
1988 @itemx gnu++0x
1989 GNU dialect of @option{-std=c++11}.
1990 The name @samp{gnu++0x} is deprecated.
1991
1992 @item c++14
1993 @itemx c++1y
1994 The 2014 ISO C++ standard plus amendments.
1995 The name @samp{c++1y} is deprecated.
1996
1997 @item gnu++14
1998 @itemx gnu++1y
1999 GNU dialect of @option{-std=c++14}.
2000 This is the default for C++ code.
2001 The name @samp{gnu++1y} is deprecated.
2002
2003 @item c++17
2004 @itemx c++1z
2005 The 2017 ISO C++ standard plus amendments.
2006 The name @samp{c++1z} is deprecated.
2007
2008 @item gnu++17
2009 @itemx gnu++1z
2010 GNU dialect of @option{-std=c++17}.
2011 The name @samp{gnu++1z} is deprecated.
2012
2013 @item c++2a
2014 The next revision of the ISO C++ standard, tentatively planned for
2015 2020. Support is highly experimental, and will almost certainly
2016 change in incompatible ways in future releases.
2017
2018 @item gnu++2a
2019 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2020 and will almost certainly change in incompatible ways in future
2021 releases.
2022 @end table
2023
2024 @item -fgnu89-inline
2025 @opindex fgnu89-inline
2026 The option @option{-fgnu89-inline} tells GCC to use the traditional
2027 GNU semantics for @code{inline} functions when in C99 mode.
2028 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2029 Using this option is roughly equivalent to adding the
2030 @code{gnu_inline} function attribute to all inline functions
2031 (@pxref{Function Attributes}).
2032
2033 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2034 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2035 specifies the default behavior).
2036 This option is not supported in @option{-std=c90} or
2037 @option{-std=gnu90} mode.
2038
2039 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2040 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2041 in effect for @code{inline} functions. @xref{Common Predefined
2042 Macros,,,cpp,The C Preprocessor}.
2043
2044 @item -fpermitted-flt-eval-methods=@var{style}
2045 @opindex fpermitted-flt-eval-methods
2046 @opindex fpermitted-flt-eval-methods=c11
2047 @opindex fpermitted-flt-eval-methods=ts-18661-3
2048 ISO/IEC TS 18661-3 defines new permissible values for
2049 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2050 a semantic type that is an interchange or extended format should be
2051 evaluated to the precision and range of that type. These new values are
2052 a superset of those permitted under C99/C11, which does not specify the
2053 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2054 conforming to C11 may not have been written expecting the possibility of
2055 the new values.
2056
2057 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2058 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2059 or the extended set of values specified in ISO/IEC TS 18661-3.
2060
2061 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2062
2063 The default when in a standards compliant mode (@option{-std=c11} or similar)
2064 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2065 dialect (@option{-std=gnu11} or similar) is
2066 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2067
2068 @item -aux-info @var{filename}
2069 @opindex aux-info
2070 Output to the given filename prototyped declarations for all functions
2071 declared and/or defined in a translation unit, including those in header
2072 files. This option is silently ignored in any language other than C@.
2073
2074 Besides declarations, the file indicates, in comments, the origin of
2075 each declaration (source file and line), whether the declaration was
2076 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2077 @samp{O} for old, respectively, in the first character after the line
2078 number and the colon), and whether it came from a declaration or a
2079 definition (@samp{C} or @samp{F}, respectively, in the following
2080 character). In the case of function definitions, a K&R-style list of
2081 arguments followed by their declarations is also provided, inside
2082 comments, after the declaration.
2083
2084 @item -fallow-parameterless-variadic-functions
2085 @opindex fallow-parameterless-variadic-functions
2086 Accept variadic functions without named parameters.
2087
2088 Although it is possible to define such a function, this is not very
2089 useful as it is not possible to read the arguments. This is only
2090 supported for C as this construct is allowed by C++.
2091
2092 @item -fno-asm
2093 @opindex fno-asm
2094 @opindex fasm
2095 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2096 keyword, so that code can use these words as identifiers. You can use
2097 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2098 instead. @option{-ansi} implies @option{-fno-asm}.
2099
2100 In C++, this switch only affects the @code{typeof} keyword, since
2101 @code{asm} and @code{inline} are standard keywords. You may want to
2102 use the @option{-fno-gnu-keywords} flag instead, which has the same
2103 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2104 switch only affects the @code{asm} and @code{typeof} keywords, since
2105 @code{inline} is a standard keyword in ISO C99.
2106
2107 @item -fno-builtin
2108 @itemx -fno-builtin-@var{function}
2109 @opindex fno-builtin
2110 @opindex fbuiltin
2111 @cindex built-in functions
2112 Don't recognize built-in functions that do not begin with
2113 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2114 functions provided by GCC}, for details of the functions affected,
2115 including those which are not built-in functions when @option{-ansi} or
2116 @option{-std} options for strict ISO C conformance are used because they
2117 do not have an ISO standard meaning.
2118
2119 GCC normally generates special code to handle certain built-in functions
2120 more efficiently; for instance, calls to @code{alloca} may become single
2121 instructions which adjust the stack directly, and calls to @code{memcpy}
2122 may become inline copy loops. The resulting code is often both smaller
2123 and faster, but since the function calls no longer appear as such, you
2124 cannot set a breakpoint on those calls, nor can you change the behavior
2125 of the functions by linking with a different library. In addition,
2126 when a function is recognized as a built-in function, GCC may use
2127 information about that function to warn about problems with calls to
2128 that function, or to generate more efficient code, even if the
2129 resulting code still contains calls to that function. For example,
2130 warnings are given with @option{-Wformat} for bad calls to
2131 @code{printf} when @code{printf} is built in and @code{strlen} is
2132 known not to modify global memory.
2133
2134 With the @option{-fno-builtin-@var{function}} option
2135 only the built-in function @var{function} is
2136 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2137 function is named that is not built-in in this version of GCC, this
2138 option is ignored. There is no corresponding
2139 @option{-fbuiltin-@var{function}} option; if you wish to enable
2140 built-in functions selectively when using @option{-fno-builtin} or
2141 @option{-ffreestanding}, you may define macros such as:
2142
2143 @smallexample
2144 #define abs(n) __builtin_abs ((n))
2145 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2146 @end smallexample
2147
2148 @item -fgimple
2149 @opindex fgimple
2150
2151 Enable parsing of function definitions marked with @code{__GIMPLE}.
2152 This is an experimental feature that allows unit testing of GIMPLE
2153 passes.
2154
2155 @item -fhosted
2156 @opindex fhosted
2157 @cindex hosted environment
2158
2159 Assert that compilation targets a hosted environment. This implies
2160 @option{-fbuiltin}. A hosted environment is one in which the
2161 entire standard library is available, and in which @code{main} has a return
2162 type of @code{int}. Examples are nearly everything except a kernel.
2163 This is equivalent to @option{-fno-freestanding}.
2164
2165 @item -ffreestanding
2166 @opindex ffreestanding
2167 @cindex hosted environment
2168
2169 Assert that compilation targets a freestanding environment. This
2170 implies @option{-fno-builtin}. A freestanding environment
2171 is one in which the standard library may not exist, and program startup may
2172 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2173 This is equivalent to @option{-fno-hosted}.
2174
2175 @xref{Standards,,Language Standards Supported by GCC}, for details of
2176 freestanding and hosted environments.
2177
2178 @item -fopenacc
2179 @opindex fopenacc
2180 @cindex OpenACC accelerator programming
2181 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2182 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2183 compiler generates accelerated code according to the OpenACC Application
2184 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2185 implies @option{-pthread}, and thus is only supported on targets that
2186 have support for @option{-pthread}.
2187
2188 @item -fopenacc-dim=@var{geom}
2189 @opindex fopenacc-dim
2190 @cindex OpenACC accelerator programming
2191 Specify default compute dimensions for parallel offload regions that do
2192 not explicitly specify. The @var{geom} value is a triple of
2193 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2194 can be omitted, to use a target-specific default value.
2195
2196 @item -fopenmp
2197 @opindex fopenmp
2198 @cindex OpenMP parallel
2199 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2200 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2201 compiler generates parallel code according to the OpenMP Application
2202 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2203 implies @option{-pthread}, and thus is only supported on targets that
2204 have support for @option{-pthread}. @option{-fopenmp} implies
2205 @option{-fopenmp-simd}.
2206
2207 @item -fopenmp-simd
2208 @opindex fopenmp-simd
2209 @cindex OpenMP SIMD
2210 @cindex SIMD
2211 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2212 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2213 are ignored.
2214
2215 @item -fgnu-tm
2216 @opindex fgnu-tm
2217 When the option @option{-fgnu-tm} is specified, the compiler
2218 generates code for the Linux variant of Intel's current Transactional
2219 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2220 an experimental feature whose interface may change in future versions
2221 of GCC, as the official specification changes. Please note that not
2222 all architectures are supported for this feature.
2223
2224 For more information on GCC's support for transactional memory,
2225 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2226 Transactional Memory Library}.
2227
2228 Note that the transactional memory feature is not supported with
2229 non-call exceptions (@option{-fnon-call-exceptions}).
2230
2231 @item -fms-extensions
2232 @opindex fms-extensions
2233 Accept some non-standard constructs used in Microsoft header files.
2234
2235 In C++ code, this allows member names in structures to be similar
2236 to previous types declarations.
2237
2238 @smallexample
2239 typedef int UOW;
2240 struct ABC @{
2241 UOW UOW;
2242 @};
2243 @end smallexample
2244
2245 Some cases of unnamed fields in structures and unions are only
2246 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2247 fields within structs/unions}, for details.
2248
2249 Note that this option is off for all targets except for x86
2250 targets using ms-abi.
2251
2252 @item -fplan9-extensions
2253 @opindex fplan9-extensions
2254 Accept some non-standard constructs used in Plan 9 code.
2255
2256 This enables @option{-fms-extensions}, permits passing pointers to
2257 structures with anonymous fields to functions that expect pointers to
2258 elements of the type of the field, and permits referring to anonymous
2259 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2260 struct/union fields within structs/unions}, for details. This is only
2261 supported for C, not C++.
2262
2263 @item -fcond-mismatch
2264 @opindex fcond-mismatch
2265 Allow conditional expressions with mismatched types in the second and
2266 third arguments. The value of such an expression is void. This option
2267 is not supported for C++.
2268
2269 @item -flax-vector-conversions
2270 @opindex flax-vector-conversions
2271 Allow implicit conversions between vectors with differing numbers of
2272 elements and/or incompatible element types. This option should not be
2273 used for new code.
2274
2275 @item -funsigned-char
2276 @opindex funsigned-char
2277 Let the type @code{char} be unsigned, like @code{unsigned char}.
2278
2279 Each kind of machine has a default for what @code{char} should
2280 be. It is either like @code{unsigned char} by default or like
2281 @code{signed char} by default.
2282
2283 Ideally, a portable program should always use @code{signed char} or
2284 @code{unsigned char} when it depends on the signedness of an object.
2285 But many programs have been written to use plain @code{char} and
2286 expect it to be signed, or expect it to be unsigned, depending on the
2287 machines they were written for. This option, and its inverse, let you
2288 make such a program work with the opposite default.
2289
2290 The type @code{char} is always a distinct type from each of
2291 @code{signed char} or @code{unsigned char}, even though its behavior
2292 is always just like one of those two.
2293
2294 @item -fsigned-char
2295 @opindex fsigned-char
2296 Let the type @code{char} be signed, like @code{signed char}.
2297
2298 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2299 the negative form of @option{-funsigned-char}. Likewise, the option
2300 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2301
2302 @item -fsigned-bitfields
2303 @itemx -funsigned-bitfields
2304 @itemx -fno-signed-bitfields
2305 @itemx -fno-unsigned-bitfields
2306 @opindex fsigned-bitfields
2307 @opindex funsigned-bitfields
2308 @opindex fno-signed-bitfields
2309 @opindex fno-unsigned-bitfields
2310 These options control whether a bit-field is signed or unsigned, when the
2311 declaration does not use either @code{signed} or @code{unsigned}. By
2312 default, such a bit-field is signed, because this is consistent: the
2313 basic integer types such as @code{int} are signed types.
2314
2315 @item -fsso-struct=@var{endianness}
2316 @opindex fsso-struct
2317 Set the default scalar storage order of structures and unions to the
2318 specified endianness. The accepted values are @samp{big-endian},
2319 @samp{little-endian} and @samp{native} for the native endianness of
2320 the target (the default). This option is not supported for C++.
2321
2322 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2323 code that is not binary compatible with code generated without it if the
2324 specified endianness is not the native endianness of the target.
2325 @end table
2326
2327 @node C++ Dialect Options
2328 @section Options Controlling C++ Dialect
2329
2330 @cindex compiler options, C++
2331 @cindex C++ options, command-line
2332 @cindex options, C++
2333 This section describes the command-line options that are only meaningful
2334 for C++ programs. You can also use most of the GNU compiler options
2335 regardless of what language your program is in. For example, you
2336 might compile a file @file{firstClass.C} like this:
2337
2338 @smallexample
2339 g++ -g -fstrict-enums -O -c firstClass.C
2340 @end smallexample
2341
2342 @noindent
2343 In this example, only @option{-fstrict-enums} is an option meant
2344 only for C++ programs; you can use the other options with any
2345 language supported by GCC@.
2346
2347 Some options for compiling C programs, such as @option{-std}, are also
2348 relevant for C++ programs.
2349 @xref{C Dialect Options,,Options Controlling C Dialect}.
2350
2351 Here is a list of options that are @emph{only} for compiling C++ programs:
2352
2353 @table @gcctabopt
2354
2355 @item -fabi-version=@var{n}
2356 @opindex fabi-version
2357 Use version @var{n} of the C++ ABI@. The default is version 0.
2358
2359 Version 0 refers to the version conforming most closely to
2360 the C++ ABI specification. Therefore, the ABI obtained using version 0
2361 will change in different versions of G++ as ABI bugs are fixed.
2362
2363 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2364
2365 Version 2 is the version of the C++ ABI that first appeared in G++
2366 3.4, and was the default through G++ 4.9.
2367
2368 Version 3 corrects an error in mangling a constant address as a
2369 template argument.
2370
2371 Version 4, which first appeared in G++ 4.5, implements a standard
2372 mangling for vector types.
2373
2374 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2375 attribute const/volatile on function pointer types, decltype of a
2376 plain decl, and use of a function parameter in the declaration of
2377 another parameter.
2378
2379 Version 6, which first appeared in G++ 4.7, corrects the promotion
2380 behavior of C++11 scoped enums and the mangling of template argument
2381 packs, const/static_cast, prefix ++ and --, and a class scope function
2382 used as a template argument.
2383
2384 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2385 builtin type and corrects the mangling of lambdas in default argument
2386 scope.
2387
2388 Version 8, which first appeared in G++ 4.9, corrects the substitution
2389 behavior of function types with function-cv-qualifiers.
2390
2391 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2392 @code{nullptr_t}.
2393
2394 Version 10, which first appeared in G++ 6.1, adds mangling of
2395 attributes that affect type identity, such as ia32 calling convention
2396 attributes (e.g.@: @samp{stdcall}).
2397
2398 Version 11, which first appeared in G++ 7, corrects the mangling of
2399 sizeof... expressions and operator names. For multiple entities with
2400 the same name within a function, that are declared in different scopes,
2401 the mangling now changes starting with the twelfth occurrence. It also
2402 implies @option{-fnew-inheriting-ctors}.
2403
2404 Version 12, which first appeared in G++ 8, corrects the calling
2405 conventions for empty classes on the x86_64 target and for classes
2406 with only deleted copy/move constructors. It accidentally changes the
2407 calling convention for classes with a deleted copy constructor and a
2408 trivial move constructor.
2409
2410 Version 13, which first appeared in G++ 8.2, fixes the accidental
2411 change in version 12.
2412
2413 See also @option{-Wabi}.
2414
2415 @item -fabi-compat-version=@var{n}
2416 @opindex fabi-compat-version
2417 On targets that support strong aliases, G++
2418 works around mangling changes by creating an alias with the correct
2419 mangled name when defining a symbol with an incorrect mangled name.
2420 This switch specifies which ABI version to use for the alias.
2421
2422 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2423 compatibility). If another ABI version is explicitly selected, this
2424 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2425 use @option{-fabi-compat-version=2}.
2426
2427 If this option is not provided but @option{-Wabi=@var{n}} is, that
2428 version is used for compatibility aliases. If this option is provided
2429 along with @option{-Wabi} (without the version), the version from this
2430 option is used for the warning.
2431
2432 @item -fno-access-control
2433 @opindex fno-access-control
2434 @opindex faccess-control
2435 Turn off all access checking. This switch is mainly useful for working
2436 around bugs in the access control code.
2437
2438 @item -faligned-new
2439 @opindex faligned-new
2440 Enable support for C++17 @code{new} of types that require more
2441 alignment than @code{void* ::operator new(std::size_t)} provides. A
2442 numeric argument such as @code{-faligned-new=32} can be used to
2443 specify how much alignment (in bytes) is provided by that function,
2444 but few users will need to override the default of
2445 @code{alignof(std::max_align_t)}.
2446
2447 This flag is enabled by default for @option{-std=c++17}.
2448
2449 @item -fchar8_t
2450 @itemx -fno-char8_t
2451 @opindex fchar8_t
2452 @opindex fno-char8_t
2453 Enable support for @code{char8_t} as adopted for C++2a. This includes
2454 the addition of a new @code{char8_t} fundamental type, changes to the
2455 types of UTF-8 string and character literals, new signatures for
2456 user-defined literals, associated standard library updates, and new
2457 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2458
2459 This option enables functions to be overloaded for ordinary and UTF-8
2460 strings:
2461
2462 @smallexample
2463 int f(const char *); // #1
2464 int f(const char8_t *); // #2
2465 int v1 = f("text"); // Calls #1
2466 int v2 = f(u8"text"); // Calls #2
2467 @end smallexample
2468
2469 @noindent
2470 and introduces new signatures for user-defined literals:
2471
2472 @smallexample
2473 int operator""_udl1(char8_t);
2474 int v3 = u8'x'_udl1;
2475 int operator""_udl2(const char8_t*, std::size_t);
2476 int v4 = u8"text"_udl2;
2477 template<typename T, T...> int operator""_udl3();
2478 int v5 = u8"text"_udl3;
2479 @end smallexample
2480
2481 @noindent
2482 The change to the types of UTF-8 string and character literals introduces
2483 incompatibilities with ISO C++11 and later standards. For example, the
2484 following code is well-formed under ISO C++11, but is ill-formed when
2485 @option{-fchar8_t} is specified.
2486
2487 @smallexample
2488 char ca[] = u8"xx"; // error: char-array initialized from wide
2489 // string
2490 const char *cp = u8"xx";// error: invalid conversion from
2491 // `const char8_t*' to `const char*'
2492 int f(const char*);
2493 auto v = f(u8"xx"); // error: invalid conversion from
2494 // `const char8_t*' to `const char*'
2495 std::string s@{u8"xx"@}; // error: no matching function for call to
2496 // `std::basic_string<char>::basic_string()'
2497 using namespace std::literals;
2498 s = u8"xx"s; // error: conversion from
2499 // `basic_string<char8_t>' to non-scalar
2500 // type `basic_string<char>' requested
2501 @end smallexample
2502
2503 @item -fcheck-new
2504 @opindex fcheck-new
2505 Check that the pointer returned by @code{operator new} is non-null
2506 before attempting to modify the storage allocated. This check is
2507 normally unnecessary because the C++ standard specifies that
2508 @code{operator new} only returns @code{0} if it is declared
2509 @code{throw()}, in which case the compiler always checks the
2510 return value even without this option. In all other cases, when
2511 @code{operator new} has a non-empty exception specification, memory
2512 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2513 @samp{new (nothrow)}.
2514
2515 @item -fconcepts
2516 @opindex fconcepts
2517 Enable support for the C++ Extensions for Concepts Technical
2518 Specification, ISO 19217 (2015), which allows code like
2519
2520 @smallexample
2521 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2522 template <Addable T> T add (T a, T b) @{ return a + b; @}
2523 @end smallexample
2524
2525 @item -fconstexpr-depth=@var{n}
2526 @opindex fconstexpr-depth
2527 Set the maximum nested evaluation depth for C++11 constexpr functions
2528 to @var{n}. A limit is needed to detect endless recursion during
2529 constant expression evaluation. The minimum specified by the standard
2530 is 512.
2531
2532 @item -fconstexpr-cache-depth=@var{n}
2533 @opindex fconstexpr-cache-depth
2534 Set the maximum level of nested evaluation depth for C++11 constexpr
2535 functions that will be cached to @var{n}. This is a heuristic that
2536 trades off compilation speed (when the cache avoids repeated
2537 calculations) against memory consumption (when the cache grows very
2538 large from highly recursive evaluations). The default is 8. Very few
2539 users are likely to want to adjust it, but if your code does heavy
2540 constexpr calculations you might want to experiment to find which
2541 value works best for you.
2542
2543 @item -fconstexpr-loop-limit=@var{n}
2544 @opindex fconstexpr-loop-limit
2545 Set the maximum number of iterations for a loop in C++14 constexpr functions
2546 to @var{n}. A limit is needed to detect infinite loops during
2547 constant expression evaluation. The default is 262144 (1<<18).
2548
2549 @item -fconstexpr-ops-limit=@var{n}
2550 @opindex fconstexpr-ops-limit
2551 Set the maximum number of operations during a single constexpr evaluation.
2552 Even when number of iterations of a single loop is limited with the above limit,
2553 if there are several nested loops and each of them has many iterations but still
2554 smaller than the above limit, or if in a body of some loop or even outside
2555 of a loop too many expressions need to be evaluated, the resulting constexpr
2556 evaluation might take too long.
2557 The default is 33554432 (1<<25).
2558
2559 @item -fdeduce-init-list
2560 @opindex fdeduce-init-list
2561 Enable deduction of a template type parameter as
2562 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2563
2564 @smallexample
2565 template <class T> auto forward(T t) -> decltype (realfn (t))
2566 @{
2567 return realfn (t);
2568 @}
2569
2570 void f()
2571 @{
2572 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2573 @}
2574 @end smallexample
2575
2576 This deduction was implemented as a possible extension to the
2577 originally proposed semantics for the C++11 standard, but was not part
2578 of the final standard, so it is disabled by default. This option is
2579 deprecated, and may be removed in a future version of G++.
2580
2581 @item -fno-elide-constructors
2582 @opindex fno-elide-constructors
2583 @opindex felide-constructors
2584 The C++ standard allows an implementation to omit creating a temporary
2585 that is only used to initialize another object of the same type.
2586 Specifying this option disables that optimization, and forces G++ to
2587 call the copy constructor in all cases. This option also causes G++
2588 to call trivial member functions which otherwise would be expanded inline.
2589
2590 In C++17, the compiler is required to omit these temporaries, but this
2591 option still affects trivial member functions.
2592
2593 @item -fno-enforce-eh-specs
2594 @opindex fno-enforce-eh-specs
2595 @opindex fenforce-eh-specs
2596 Don't generate code to check for violation of exception specifications
2597 at run time. This option violates the C++ standard, but may be useful
2598 for reducing code size in production builds, much like defining
2599 @code{NDEBUG}. This does not give user code permission to throw
2600 exceptions in violation of the exception specifications; the compiler
2601 still optimizes based on the specifications, so throwing an
2602 unexpected exception results in undefined behavior at run time.
2603
2604 @item -fextern-tls-init
2605 @itemx -fno-extern-tls-init
2606 @opindex fextern-tls-init
2607 @opindex fno-extern-tls-init
2608 The C++11 and OpenMP standards allow @code{thread_local} and
2609 @code{threadprivate} variables to have dynamic (runtime)
2610 initialization. To support this, any use of such a variable goes
2611 through a wrapper function that performs any necessary initialization.
2612 When the use and definition of the variable are in the same
2613 translation unit, this overhead can be optimized away, but when the
2614 use is in a different translation unit there is significant overhead
2615 even if the variable doesn't actually need dynamic initialization. If
2616 the programmer can be sure that no use of the variable in a
2617 non-defining TU needs to trigger dynamic initialization (either
2618 because the variable is statically initialized, or a use of the
2619 variable in the defining TU will be executed before any uses in
2620 another TU), they can avoid this overhead with the
2621 @option{-fno-extern-tls-init} option.
2622
2623 On targets that support symbol aliases, the default is
2624 @option{-fextern-tls-init}. On targets that do not support symbol
2625 aliases, the default is @option{-fno-extern-tls-init}.
2626
2627 @item -fno-gnu-keywords
2628 @opindex fno-gnu-keywords
2629 @opindex fgnu-keywords
2630 Do not recognize @code{typeof} as a keyword, so that code can use this
2631 word as an identifier. You can use the keyword @code{__typeof__} instead.
2632 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2633 @option{-std=c++98}, @option{-std=c++11}, etc.
2634
2635 @item -fno-implicit-templates
2636 @opindex fno-implicit-templates
2637 @opindex fimplicit-templates
2638 Never emit code for non-inline templates that are instantiated
2639 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2640 If you use this option, you must take care to structure your code to
2641 include all the necessary explicit instantiations to avoid getting
2642 undefined symbols at link time.
2643 @xref{Template Instantiation}, for more information.
2644
2645 @item -fno-implicit-inline-templates
2646 @opindex fno-implicit-inline-templates
2647 @opindex fimplicit-inline-templates
2648 Don't emit code for implicit instantiations of inline templates, either.
2649 The default is to handle inlines differently so that compiles with and
2650 without optimization need the same set of explicit instantiations.
2651
2652 @item -fno-implement-inlines
2653 @opindex fno-implement-inlines
2654 @opindex fimplement-inlines
2655 To save space, do not emit out-of-line copies of inline functions
2656 controlled by @code{#pragma implementation}. This causes linker
2657 errors if these functions are not inlined everywhere they are called.
2658
2659 @item -fms-extensions
2660 @opindex fms-extensions
2661 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2662 int and getting a pointer to member function via non-standard syntax.
2663
2664 @item -fnew-inheriting-ctors
2665 @opindex fnew-inheriting-ctors
2666 Enable the P0136 adjustment to the semantics of C++11 constructor
2667 inheritance. This is part of C++17 but also considered to be a Defect
2668 Report against C++11 and C++14. This flag is enabled by default
2669 unless @option{-fabi-version=10} or lower is specified.
2670
2671 @item -fnew-ttp-matching
2672 @opindex fnew-ttp-matching
2673 Enable the P0522 resolution to Core issue 150, template template
2674 parameters and default arguments: this allows a template with default
2675 template arguments as an argument for a template template parameter
2676 with fewer template parameters. This flag is enabled by default for
2677 @option{-std=c++17}.
2678
2679 @item -fno-nonansi-builtins
2680 @opindex fno-nonansi-builtins
2681 @opindex fnonansi-builtins
2682 Disable built-in declarations of functions that are not mandated by
2683 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2684 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2685
2686 @item -fnothrow-opt
2687 @opindex fnothrow-opt
2688 Treat a @code{throw()} exception specification as if it were a
2689 @code{noexcept} specification to reduce or eliminate the text size
2690 overhead relative to a function with no exception specification. If
2691 the function has local variables of types with non-trivial
2692 destructors, the exception specification actually makes the
2693 function smaller because the EH cleanups for those variables can be
2694 optimized away. The semantic effect is that an exception thrown out of
2695 a function with such an exception specification results in a call
2696 to @code{terminate} rather than @code{unexpected}.
2697
2698 @item -fno-operator-names
2699 @opindex fno-operator-names
2700 @opindex foperator-names
2701 Do not treat the operator name keywords @code{and}, @code{bitand},
2702 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2703 synonyms as keywords.
2704
2705 @item -fno-optional-diags
2706 @opindex fno-optional-diags
2707 @opindex foptional-diags
2708 Disable diagnostics that the standard says a compiler does not need to
2709 issue. Currently, the only such diagnostic issued by G++ is the one for
2710 a name having multiple meanings within a class.
2711
2712 @item -fpermissive
2713 @opindex fpermissive
2714 Downgrade some diagnostics about nonconformant code from errors to
2715 warnings. Thus, using @option{-fpermissive} allows some
2716 nonconforming code to compile.
2717
2718 @item -fno-pretty-templates
2719 @opindex fno-pretty-templates
2720 @opindex fpretty-templates
2721 When an error message refers to a specialization of a function
2722 template, the compiler normally prints the signature of the
2723 template followed by the template arguments and any typedefs or
2724 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2725 rather than @code{void f(int)}) so that it's clear which template is
2726 involved. When an error message refers to a specialization of a class
2727 template, the compiler omits any template arguments that match
2728 the default template arguments for that template. If either of these
2729 behaviors make it harder to understand the error message rather than
2730 easier, you can use @option{-fno-pretty-templates} to disable them.
2731
2732 @item -frepo
2733 @opindex frepo
2734 Enable automatic template instantiation at link time. This option also
2735 implies @option{-fno-implicit-templates}. @xref{Template
2736 Instantiation}, for more information.
2737
2738 @item -fno-rtti
2739 @opindex fno-rtti
2740 @opindex frtti
2741 Disable generation of information about every class with virtual
2742 functions for use by the C++ run-time type identification features
2743 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2744 of the language, you can save some space by using this flag. Note that
2745 exception handling uses the same information, but G++ generates it as
2746 needed. The @code{dynamic_cast} operator can still be used for casts that
2747 do not require run-time type information, i.e.@: casts to @code{void *} or to
2748 unambiguous base classes.
2749
2750 Mixing code compiled with @option{-frtti} with that compiled with
2751 @option{-fno-rtti} may not work. For example, programs may
2752 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2753 for a class compiled with @option{-frtti}.
2754
2755 @item -fsized-deallocation
2756 @opindex fsized-deallocation
2757 Enable the built-in global declarations
2758 @smallexample
2759 void operator delete (void *, std::size_t) noexcept;
2760 void operator delete[] (void *, std::size_t) noexcept;
2761 @end smallexample
2762 as introduced in C++14. This is useful for user-defined replacement
2763 deallocation functions that, for example, use the size of the object
2764 to make deallocation faster. Enabled by default under
2765 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2766 warns about places that might want to add a definition.
2767
2768 @item -fstrict-enums
2769 @opindex fstrict-enums
2770 Allow the compiler to optimize using the assumption that a value of
2771 enumerated type can only be one of the values of the enumeration (as
2772 defined in the C++ standard; basically, a value that can be
2773 represented in the minimum number of bits needed to represent all the
2774 enumerators). This assumption may not be valid if the program uses a
2775 cast to convert an arbitrary integer value to the enumerated type.
2776
2777 @item -fstrong-eval-order
2778 @opindex fstrong-eval-order
2779 Evaluate member access, array subscripting, and shift expressions in
2780 left-to-right order, and evaluate assignment in right-to-left order,
2781 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2782 @option{-fstrong-eval-order=some} enables just the ordering of member
2783 access and shift expressions, and is the default without
2784 @option{-std=c++17}.
2785
2786 @item -ftemplate-backtrace-limit=@var{n}
2787 @opindex ftemplate-backtrace-limit
2788 Set the maximum number of template instantiation notes for a single
2789 warning or error to @var{n}. The default value is 10.
2790
2791 @item -ftemplate-depth=@var{n}
2792 @opindex ftemplate-depth
2793 Set the maximum instantiation depth for template classes to @var{n}.
2794 A limit on the template instantiation depth is needed to detect
2795 endless recursions during template class instantiation. ANSI/ISO C++
2796 conforming programs must not rely on a maximum depth greater than 17
2797 (changed to 1024 in C++11). The default value is 900, as the compiler
2798 can run out of stack space before hitting 1024 in some situations.
2799
2800 @item -fno-threadsafe-statics
2801 @opindex fno-threadsafe-statics
2802 @opindex fthreadsafe-statics
2803 Do not emit the extra code to use the routines specified in the C++
2804 ABI for thread-safe initialization of local statics. You can use this
2805 option to reduce code size slightly in code that doesn't need to be
2806 thread-safe.
2807
2808 @item -fuse-cxa-atexit
2809 @opindex fuse-cxa-atexit
2810 Register destructors for objects with static storage duration with the
2811 @code{__cxa_atexit} function rather than the @code{atexit} function.
2812 This option is required for fully standards-compliant handling of static
2813 destructors, but only works if your C library supports
2814 @code{__cxa_atexit}.
2815
2816 @item -fno-use-cxa-get-exception-ptr
2817 @opindex fno-use-cxa-get-exception-ptr
2818 @opindex fuse-cxa-get-exception-ptr
2819 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2820 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2821 if the runtime routine is not available.
2822
2823 @item -fvisibility-inlines-hidden
2824 @opindex fvisibility-inlines-hidden
2825 This switch declares that the user does not attempt to compare
2826 pointers to inline functions or methods where the addresses of the two functions
2827 are taken in different shared objects.
2828
2829 The effect of this is that GCC may, effectively, mark inline methods with
2830 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2831 appear in the export table of a DSO and do not require a PLT indirection
2832 when used within the DSO@. Enabling this option can have a dramatic effect
2833 on load and link times of a DSO as it massively reduces the size of the
2834 dynamic export table when the library makes heavy use of templates.
2835
2836 The behavior of this switch is not quite the same as marking the
2837 methods as hidden directly, because it does not affect static variables
2838 local to the function or cause the compiler to deduce that
2839 the function is defined in only one shared object.
2840
2841 You may mark a method as having a visibility explicitly to negate the
2842 effect of the switch for that method. For example, if you do want to
2843 compare pointers to a particular inline method, you might mark it as
2844 having default visibility. Marking the enclosing class with explicit
2845 visibility has no effect.
2846
2847 Explicitly instantiated inline methods are unaffected by this option
2848 as their linkage might otherwise cross a shared library boundary.
2849 @xref{Template Instantiation}.
2850
2851 @item -fvisibility-ms-compat
2852 @opindex fvisibility-ms-compat
2853 This flag attempts to use visibility settings to make GCC's C++
2854 linkage model compatible with that of Microsoft Visual Studio.
2855
2856 The flag makes these changes to GCC's linkage model:
2857
2858 @enumerate
2859 @item
2860 It sets the default visibility to @code{hidden}, like
2861 @option{-fvisibility=hidden}.
2862
2863 @item
2864 Types, but not their members, are not hidden by default.
2865
2866 @item
2867 The One Definition Rule is relaxed for types without explicit
2868 visibility specifications that are defined in more than one
2869 shared object: those declarations are permitted if they are
2870 permitted when this option is not used.
2871 @end enumerate
2872
2873 In new code it is better to use @option{-fvisibility=hidden} and
2874 export those classes that are intended to be externally visible.
2875 Unfortunately it is possible for code to rely, perhaps accidentally,
2876 on the Visual Studio behavior.
2877
2878 Among the consequences of these changes are that static data members
2879 of the same type with the same name but defined in different shared
2880 objects are different, so changing one does not change the other;
2881 and that pointers to function members defined in different shared
2882 objects may not compare equal. When this flag is given, it is a
2883 violation of the ODR to define types with the same name differently.
2884
2885 @item -fno-weak
2886 @opindex fno-weak
2887 @opindex fweak
2888 Do not use weak symbol support, even if it is provided by the linker.
2889 By default, G++ uses weak symbols if they are available. This
2890 option exists only for testing, and should not be used by end-users;
2891 it results in inferior code and has no benefits. This option may
2892 be removed in a future release of G++.
2893
2894 @item -nostdinc++
2895 @opindex nostdinc++
2896 Do not search for header files in the standard directories specific to
2897 C++, but do still search the other standard directories. (This option
2898 is used when building the C++ library.)
2899 @end table
2900
2901 In addition, these optimization, warning, and code generation options
2902 have meanings only for C++ programs:
2903
2904 @table @gcctabopt
2905 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2906 @opindex Wabi
2907 @opindex Wno-abi
2908 Warn when G++ it generates code that is probably not compatible with
2909 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2910 ABI with each major release, normally @option{-Wabi} will warn only if
2911 there is a check added later in a release series for an ABI issue
2912 discovered since the initial release. @option{-Wabi} will warn about
2913 more things if an older ABI version is selected (with
2914 @option{-fabi-version=@var{n}}).
2915
2916 @option{-Wabi} can also be used with an explicit version number to
2917 warn about compatibility with a particular @option{-fabi-version}
2918 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2919 @option{-fabi-version=2}.
2920
2921 If an explicit version number is provided and
2922 @option{-fabi-compat-version} is not specified, the version number
2923 from this option is used for compatibility aliases. If no explicit
2924 version number is provided with this option, but
2925 @option{-fabi-compat-version} is specified, that version number is
2926 used for ABI warnings.
2927
2928 Although an effort has been made to warn about
2929 all such cases, there are probably some cases that are not warned about,
2930 even though G++ is generating incompatible code. There may also be
2931 cases where warnings are emitted even though the code that is generated
2932 is compatible.
2933
2934 You should rewrite your code to avoid these warnings if you are
2935 concerned about the fact that code generated by G++ may not be binary
2936 compatible with code generated by other compilers.
2937
2938 Known incompatibilities in @option{-fabi-version=2} (which was the
2939 default from GCC 3.4 to 4.9) include:
2940
2941 @itemize @bullet
2942
2943 @item
2944 A template with a non-type template parameter of reference type was
2945 mangled incorrectly:
2946 @smallexample
2947 extern int N;
2948 template <int &> struct S @{@};
2949 void n (S<N>) @{2@}
2950 @end smallexample
2951
2952 This was fixed in @option{-fabi-version=3}.
2953
2954 @item
2955 SIMD vector types declared using @code{__attribute ((vector_size))} were
2956 mangled in a non-standard way that does not allow for overloading of
2957 functions taking vectors of different sizes.
2958
2959 The mangling was changed in @option{-fabi-version=4}.
2960
2961 @item
2962 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2963 qualifiers, and @code{decltype} of a plain declaration was folded away.
2964
2965 These mangling issues were fixed in @option{-fabi-version=5}.
2966
2967 @item
2968 Scoped enumerators passed as arguments to a variadic function are
2969 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2970 On most targets this does not actually affect the parameter passing
2971 ABI, as there is no way to pass an argument smaller than @code{int}.
2972
2973 Also, the ABI changed the mangling of template argument packs,
2974 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2975 a class scope function used as a template argument.
2976
2977 These issues were corrected in @option{-fabi-version=6}.
2978
2979 @item
2980 Lambdas in default argument scope were mangled incorrectly, and the
2981 ABI changed the mangling of @code{nullptr_t}.
2982
2983 These issues were corrected in @option{-fabi-version=7}.
2984
2985 @item
2986 When mangling a function type with function-cv-qualifiers, the
2987 un-qualified function type was incorrectly treated as a substitution
2988 candidate.
2989
2990 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2991
2992 @item
2993 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2994 unaligned accesses. Note that this did not affect the ABI of a
2995 function with a @code{nullptr_t} parameter, as parameters have a
2996 minimum alignment.
2997
2998 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2999
3000 @item
3001 Target-specific attributes that affect the identity of a type, such as
3002 ia32 calling conventions on a function type (stdcall, regparm, etc.),
3003 did not affect the mangled name, leading to name collisions when
3004 function pointers were used as template arguments.
3005
3006 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
3007
3008 @end itemize
3009
3010 It also warns about psABI-related changes. The known psABI changes at this
3011 point include:
3012
3013 @itemize @bullet
3014
3015 @item
3016 For SysV/x86-64, unions with @code{long double} members are
3017 passed in memory as specified in psABI. For example:
3018
3019 @smallexample
3020 union U @{
3021 long double ld;
3022 int i;
3023 @};
3024 @end smallexample
3025
3026 @noindent
3027 @code{union U} is always passed in memory.
3028
3029 @end itemize
3030
3031 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3032 @opindex Wabi-tag
3033 @opindex Wabi-tag
3034 Warn when a type with an ABI tag is used in a context that does not
3035 have that ABI tag. See @ref{C++ Attributes} for more information
3036 about ABI tags.
3037
3038 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3039 @opindex Wctor-dtor-privacy
3040 @opindex Wno-ctor-dtor-privacy
3041 Warn when a class seems unusable because all the constructors or
3042 destructors in that class are private, and it has neither friends nor
3043 public static member functions. Also warn if there are no non-private
3044 methods, and there's at least one private member function that isn't
3045 a constructor or destructor.
3046
3047 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3048 @opindex Wdelete-non-virtual-dtor
3049 @opindex Wno-delete-non-virtual-dtor
3050 Warn when @code{delete} is used to destroy an instance of a class that
3051 has virtual functions and non-virtual destructor. It is unsafe to delete
3052 an instance of a derived class through a pointer to a base class if the
3053 base class does not have a virtual destructor. This warning is enabled
3054 by @option{-Wall}.
3055
3056 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3057 @opindex Wdeprecated-copy
3058 @opindex Wno-deprecated-copy
3059 Warn that the implicit declaration of a copy constructor or copy
3060 assignment operator is deprecated if the class has a user-provided
3061 copy constructor or copy assignment operator, in C++11 and up. This
3062 warning is enabled by @option{-Wextra}. With
3063 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3064 user-provided destructor.
3065
3066 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3067 @opindex Winit-list-lifetime
3068 @opindex Wno-init-list-lifetime
3069 Do not warn about uses of @code{std::initializer_list} that are likely
3070 to result in dangling pointers. Since the underlying array for an
3071 @code{initializer_list} is handled like a normal C++ temporary object,
3072 it is easy to inadvertently keep a pointer to the array past the end
3073 of the array's lifetime. For example:
3074
3075 @itemize @bullet
3076 @item
3077 If a function returns a temporary @code{initializer_list}, or a local
3078 @code{initializer_list} variable, the array's lifetime ends at the end
3079 of the return statement, so the value returned has a dangling pointer.
3080
3081 @item
3082 If a new-expression creates an @code{initializer_list}, the array only
3083 lives until the end of the enclosing full-expression, so the
3084 @code{initializer_list} in the heap has a dangling pointer.
3085
3086 @item
3087 When an @code{initializer_list} variable is assigned from a
3088 brace-enclosed initializer list, the temporary array created for the
3089 right side of the assignment only lives until the end of the
3090 full-expression, so at the next statement the @code{initializer_list}
3091 variable has a dangling pointer.
3092
3093 @smallexample
3094 // li's initial underlying array lives as long as li
3095 std::initializer_list<int> li = @{ 1,2,3 @};
3096 // assignment changes li to point to a temporary array
3097 li = @{ 4, 5 @};
3098 // now the temporary is gone and li has a dangling pointer
3099 int i = li.begin()[0] // undefined behavior
3100 @end smallexample
3101
3102 @item
3103 When a list constructor stores the @code{begin} pointer from the
3104 @code{initializer_list} argument, this doesn't extend the lifetime of
3105 the array, so if a class variable is constructed from a temporary
3106 @code{initializer_list}, the pointer is left dangling by the end of
3107 the variable declaration statement.
3108
3109 @end itemize
3110
3111 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3112 @opindex Wliteral-suffix
3113 @opindex Wno-literal-suffix
3114 Warn when a string or character literal is followed by a ud-suffix which does
3115 not begin with an underscore. As a conforming extension, GCC treats such
3116 suffixes as separate preprocessing tokens in order to maintain backwards
3117 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3118 For example:
3119
3120 @smallexample
3121 #define __STDC_FORMAT_MACROS
3122 #include <inttypes.h>
3123 #include <stdio.h>
3124
3125 int main() @{
3126 int64_t i64 = 123;
3127 printf("My int64: %" PRId64"\n", i64);
3128 @}
3129 @end smallexample
3130
3131 In this case, @code{PRId64} is treated as a separate preprocessing token.
3132
3133 Additionally, warn when a user-defined literal operator is declared with
3134 a literal suffix identifier that doesn't begin with an underscore. Literal
3135 suffix identifiers that don't begin with an underscore are reserved for
3136 future standardization.
3137
3138 This warning is enabled by default.
3139
3140 @item -Wlto-type-mismatch
3141 @opindex Wlto-type-mismatch
3142 @opindex Wno-lto-type-mismatch
3143
3144 During the link-time optimization warn about type mismatches in
3145 global declarations from different compilation units.
3146 Requires @option{-flto} to be enabled. Enabled by default.
3147
3148 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3149 @opindex Wnarrowing
3150 @opindex Wno-narrowing
3151 For C++11 and later standards, narrowing conversions are diagnosed by default,
3152 as required by the standard. A narrowing conversion from a constant produces
3153 an error, and a narrowing conversion from a non-constant produces a warning,
3154 but @option{-Wno-narrowing} suppresses the diagnostic.
3155 Note that this does not affect the meaning of well-formed code;
3156 narrowing conversions are still considered ill-formed in SFINAE contexts.
3157
3158 With @option{-Wnarrowing} in C++98, warn when a narrowing
3159 conversion prohibited by C++11 occurs within
3160 @samp{@{ @}}, e.g.
3161
3162 @smallexample
3163 int i = @{ 2.2 @}; // error: narrowing from double to int
3164 @end smallexample
3165
3166 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3167
3168 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3169 @opindex Wnoexcept
3170 @opindex Wno-noexcept
3171 Warn when a noexcept-expression evaluates to false because of a call
3172 to a function that does not have a non-throwing exception
3173 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3174 the compiler to never throw an exception.
3175
3176 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3177 @opindex Wnoexcept-type
3178 @opindex Wno-noexcept-type
3179 Warn if the C++17 feature making @code{noexcept} part of a function
3180 type changes the mangled name of a symbol relative to C++14. Enabled
3181 by @option{-Wabi} and @option{-Wc++17-compat}.
3182
3183 As an example:
3184
3185 @smallexample
3186 template <class T> void f(T t) @{ t(); @};
3187 void g() noexcept;
3188 void h() @{ f(g); @}
3189 @end smallexample
3190
3191 @noindent
3192 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3193 C++17 it calls @code{f<void(*)()noexcept>}.
3194
3195 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3196 @opindex Wclass-memaccess
3197 @opindex Wno-class-memaccess
3198 Warn when the destination of a call to a raw memory function such as
3199 @code{memset} or @code{memcpy} is an object of class type, and when writing
3200 into such an object might bypass the class non-trivial or deleted constructor
3201 or copy assignment, violate const-correctness or encapsulation, or corrupt
3202 virtual table pointers. Modifying the representation of such objects may
3203 violate invariants maintained by member functions of the class. For example,
3204 the call to @code{memset} below is undefined because it modifies a non-trivial
3205 class object and is, therefore, diagnosed. The safe way to either initialize
3206 or clear the storage of objects of such types is by using the appropriate
3207 constructor or assignment operator, if one is available.
3208 @smallexample
3209 std::string str = "abc";
3210 memset (&str, 0, sizeof str);
3211 @end smallexample
3212 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3213 Explicitly casting the pointer to the class object to @code{void *} or
3214 to a type that can be safely accessed by the raw memory function suppresses
3215 the warning.
3216
3217 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3218 @opindex Wnon-virtual-dtor
3219 @opindex Wno-non-virtual-dtor
3220 Warn when a class has virtual functions and an accessible non-virtual
3221 destructor itself or in an accessible polymorphic base class, in which
3222 case it is possible but unsafe to delete an instance of a derived
3223 class through a pointer to the class itself or base class. This
3224 warning is automatically enabled if @option{-Weffc++} is specified.
3225
3226 @item -Wregister @r{(C++ and Objective-C++ only)}
3227 @opindex Wregister
3228 @opindex Wno-register
3229 Warn on uses of the @code{register} storage class specifier, except
3230 when it is part of the GNU @ref{Explicit Register Variables} extension.
3231 The use of the @code{register} keyword as storage class specifier has
3232 been deprecated in C++11 and removed in C++17.
3233 Enabled by default with @option{-std=c++17}.
3234
3235 @item -Wreorder @r{(C++ and Objective-C++ only)}
3236 @opindex Wreorder
3237 @opindex Wno-reorder
3238 @cindex reordering, warning
3239 @cindex warning for reordering of member initializers
3240 Warn when the order of member initializers given in the code does not
3241 match the order in which they must be executed. For instance:
3242
3243 @smallexample
3244 struct A @{
3245 int i;
3246 int j;
3247 A(): j (0), i (1) @{ @}
3248 @};
3249 @end smallexample
3250
3251 @noindent
3252 The compiler rearranges the member initializers for @code{i}
3253 and @code{j} to match the declaration order of the members, emitting
3254 a warning to that effect. This warning is enabled by @option{-Wall}.
3255
3256 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3257 @opindex Wpessimizing-move
3258 @opindex Wno-pessimizing-move
3259 This warning warns when a call to @code{std::move} prevents copy
3260 elision. A typical scenario when copy elision can occur is when returning in
3261 a function with a class return type, when the expression being returned is the
3262 name of a non-volatile automatic object, and is not a function parameter, and
3263 has the same type as the function return type.
3264
3265 @smallexample
3266 struct T @{
3267 @dots{}
3268 @};
3269 T fn()
3270 @{
3271 T t;
3272 @dots{}
3273 return std::move (t);
3274 @}
3275 @end smallexample
3276
3277 But in this example, the @code{std::move} call prevents copy elision.
3278
3279 This warning is enabled by @option{-Wall}.
3280
3281 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3282 @opindex Wredundant-move
3283 @opindex Wno-redundant-move
3284 This warning warns about redundant calls to @code{std::move}; that is, when
3285 a move operation would have been performed even without the @code{std::move}
3286 call. This happens because the compiler is forced to treat the object as if
3287 it were an rvalue in certain situations such as returning a local variable,
3288 where copy elision isn't applicable. Consider:
3289
3290 @smallexample
3291 struct T @{
3292 @dots{}
3293 @};
3294 T fn(T t)
3295 @{
3296 @dots{}
3297 return std::move (t);
3298 @}
3299 @end smallexample
3300
3301 Here, the @code{std::move} call is redundant. Because G++ implements Core
3302 Issue 1579, another example is:
3303
3304 @smallexample
3305 struct T @{ // convertible to U
3306 @dots{}
3307 @};
3308 struct U @{
3309 @dots{}
3310 @};
3311 U fn()
3312 @{
3313 T t;
3314 @dots{}
3315 return std::move (t);
3316 @}
3317 @end smallexample
3318 In this example, copy elision isn't applicable because the type of the
3319 expression being returned and the function return type differ, yet G++
3320 treats the return value as if it were designated by an rvalue.
3321
3322 This warning is enabled by @option{-Wextra}.
3323
3324 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3325 @opindex fext-numeric-literals
3326 @opindex fno-ext-numeric-literals
3327 Accept imaginary, fixed-point, or machine-defined
3328 literal number suffixes as GNU extensions.
3329 When this option is turned off these suffixes are treated
3330 as C++11 user-defined literal numeric suffixes.
3331 This is on by default for all pre-C++11 dialects and all GNU dialects:
3332 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3333 @option{-std=gnu++14}.
3334 This option is off by default
3335 for ISO C++11 onwards (@option{-std=c++11}, ...).
3336 @end table
3337
3338 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3339
3340 @table @gcctabopt
3341 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3342 @opindex Weffc++
3343 @opindex Wno-effc++
3344 Warn about violations of the following style guidelines from Scott Meyers'
3345 @cite{Effective C++} series of books:
3346
3347 @itemize @bullet
3348 @item
3349 Define a copy constructor and an assignment operator for classes
3350 with dynamically-allocated memory.
3351
3352 @item
3353 Prefer initialization to assignment in constructors.
3354
3355 @item
3356 Have @code{operator=} return a reference to @code{*this}.
3357
3358 @item
3359 Don't try to return a reference when you must return an object.
3360
3361 @item
3362 Distinguish between prefix and postfix forms of increment and
3363 decrement operators.
3364
3365 @item
3366 Never overload @code{&&}, @code{||}, or @code{,}.
3367
3368 @end itemize
3369
3370 This option also enables @option{-Wnon-virtual-dtor}, which is also
3371 one of the effective C++ recommendations. However, the check is
3372 extended to warn about the lack of virtual destructor in accessible
3373 non-polymorphic bases classes too.
3374
3375 When selecting this option, be aware that the standard library
3376 headers do not obey all of these guidelines; use @samp{grep -v}
3377 to filter out those warnings.
3378
3379 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3380 @opindex Wstrict-null-sentinel
3381 @opindex Wno-strict-null-sentinel
3382 Warn about the use of an uncasted @code{NULL} as sentinel. When
3383 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3384 to @code{__null}. Although it is a null pointer constant rather than a
3385 null pointer, it is guaranteed to be of the same size as a pointer.
3386 But this use is not portable across different compilers.
3387
3388 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3389 @opindex Wno-non-template-friend
3390 @opindex Wnon-template-friend
3391 Disable warnings when non-template friend functions are declared
3392 within a template. In very old versions of GCC that predate implementation
3393 of the ISO standard, declarations such as
3394 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3395 could be interpreted as a particular specialization of a template
3396 function; the warning exists to diagnose compatibility problems,
3397 and is enabled by default.
3398
3399 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3400 @opindex Wold-style-cast
3401 @opindex Wno-old-style-cast
3402 Warn if an old-style (C-style) cast to a non-void type is used within
3403 a C++ program. The new-style casts (@code{dynamic_cast},
3404 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3405 less vulnerable to unintended effects and much easier to search for.
3406
3407 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3408 @opindex Woverloaded-virtual
3409 @opindex Wno-overloaded-virtual
3410 @cindex overloaded virtual function, warning
3411 @cindex warning for overloaded virtual function
3412 Warn when a function declaration hides virtual functions from a
3413 base class. For example, in:
3414
3415 @smallexample
3416 struct A @{
3417 virtual void f();
3418 @};
3419
3420 struct B: public A @{
3421 void f(int);
3422 @};
3423 @end smallexample
3424
3425 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3426 like:
3427
3428 @smallexample
3429 B* b;
3430 b->f();
3431 @end smallexample
3432
3433 @noindent
3434 fails to compile.
3435
3436 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3437 @opindex Wno-pmf-conversions
3438 @opindex Wpmf-conversions
3439 Disable the diagnostic for converting a bound pointer to member function
3440 to a plain pointer.
3441
3442 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3443 @opindex Wsign-promo
3444 @opindex Wno-sign-promo
3445 Warn when overload resolution chooses a promotion from unsigned or
3446 enumerated type to a signed type, over a conversion to an unsigned type of
3447 the same size. Previous versions of G++ tried to preserve
3448 unsignedness, but the standard mandates the current behavior.
3449
3450 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3451 @opindex Wtemplates
3452 @opindex Wno-templates
3453 Warn when a primary template declaration is encountered. Some coding
3454 rules disallow templates, and this may be used to enforce that rule.
3455 The warning is inactive inside a system header file, such as the STL, so
3456 one can still use the STL. One may also instantiate or specialize
3457 templates.
3458
3459 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3460 @opindex Wmultiple-inheritance
3461 @opindex Wno-multiple-inheritance
3462 Warn when a class is defined with multiple direct base classes. Some
3463 coding rules disallow multiple inheritance, and this may be used to
3464 enforce that rule. The warning is inactive inside a system header file,
3465 such as the STL, so one can still use the STL. One may also define
3466 classes that indirectly use multiple inheritance.
3467
3468 @item -Wvirtual-inheritance
3469 @opindex Wvirtual-inheritance
3470 @opindex Wno-virtual-inheritance
3471 Warn when a class is defined with a virtual direct base class. Some
3472 coding rules disallow multiple inheritance, and this may be used to
3473 enforce that rule. The warning is inactive inside a system header file,
3474 such as the STL, so one can still use the STL. One may also define
3475 classes that indirectly use virtual inheritance.
3476
3477 @item -Wnamespaces
3478 @opindex Wnamespaces
3479 @opindex Wno-namespaces
3480 Warn when a namespace definition is opened. Some coding rules disallow
3481 namespaces, and this may be used to enforce that rule. The warning is
3482 inactive inside a system header file, such as the STL, so one can still
3483 use the STL. One may also use using directives and qualified names.
3484
3485 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3486 @opindex Wterminate
3487 @opindex Wno-terminate
3488 Disable the warning about a throw-expression that will immediately
3489 result in a call to @code{terminate}.
3490
3491 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3492 @opindex Wno-class-conversion
3493 @opindex Wclass-conversion
3494 Disable the warning about the case when a conversion function converts an
3495 object to the same type, to a base class of that type, or to void; such
3496 a conversion function will never be called.
3497 @end table
3498
3499 @node Objective-C and Objective-C++ Dialect Options
3500 @section Options Controlling Objective-C and Objective-C++ Dialects
3501
3502 @cindex compiler options, Objective-C and Objective-C++
3503 @cindex Objective-C and Objective-C++ options, command-line
3504 @cindex options, Objective-C and Objective-C++
3505 (NOTE: This manual does not describe the Objective-C and Objective-C++
3506 languages themselves. @xref{Standards,,Language Standards
3507 Supported by GCC}, for references.)
3508
3509 This section describes the command-line options that are only meaningful
3510 for Objective-C and Objective-C++ programs. You can also use most of
3511 the language-independent GNU compiler options.
3512 For example, you might compile a file @file{some_class.m} like this:
3513
3514 @smallexample
3515 gcc -g -fgnu-runtime -O -c some_class.m
3516 @end smallexample
3517
3518 @noindent
3519 In this example, @option{-fgnu-runtime} is an option meant only for
3520 Objective-C and Objective-C++ programs; you can use the other options with
3521 any language supported by GCC@.
3522
3523 Note that since Objective-C is an extension of the C language, Objective-C
3524 compilations may also use options specific to the C front-end (e.g.,
3525 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3526 C++-specific options (e.g., @option{-Wabi}).
3527
3528 Here is a list of options that are @emph{only} for compiling Objective-C
3529 and Objective-C++ programs:
3530
3531 @table @gcctabopt
3532 @item -fconstant-string-class=@var{class-name}
3533 @opindex fconstant-string-class
3534 Use @var{class-name} as the name of the class to instantiate for each
3535 literal string specified with the syntax @code{@@"@dots{}"}. The default
3536 class name is @code{NXConstantString} if the GNU runtime is being used, and
3537 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3538 @option{-fconstant-cfstrings} option, if also present, overrides the
3539 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3540 to be laid out as constant CoreFoundation strings.
3541
3542 @item -fgnu-runtime
3543 @opindex fgnu-runtime
3544 Generate object code compatible with the standard GNU Objective-C
3545 runtime. This is the default for most types of systems.
3546
3547 @item -fnext-runtime
3548 @opindex fnext-runtime
3549 Generate output compatible with the NeXT runtime. This is the default
3550 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3551 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3552 used.
3553
3554 @item -fno-nil-receivers
3555 @opindex fno-nil-receivers
3556 @opindex fnil-receivers
3557 Assume that all Objective-C message dispatches (@code{[receiver
3558 message:arg]}) in this translation unit ensure that the receiver is
3559 not @code{nil}. This allows for more efficient entry points in the
3560 runtime to be used. This option is only available in conjunction with
3561 the NeXT runtime and ABI version 0 or 1.
3562
3563 @item -fobjc-abi-version=@var{n}
3564 @opindex fobjc-abi-version
3565 Use version @var{n} of the Objective-C ABI for the selected runtime.
3566 This option is currently supported only for the NeXT runtime. In that
3567 case, Version 0 is the traditional (32-bit) ABI without support for
3568 properties and other Objective-C 2.0 additions. Version 1 is the
3569 traditional (32-bit) ABI with support for properties and other
3570 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3571 nothing is specified, the default is Version 0 on 32-bit target
3572 machines, and Version 2 on 64-bit target machines.
3573
3574 @item -fobjc-call-cxx-cdtors
3575 @opindex fobjc-call-cxx-cdtors
3576 For each Objective-C class, check if any of its instance variables is a
3577 C++ object with a non-trivial default constructor. If so, synthesize a
3578 special @code{- (id) .cxx_construct} instance method which runs
3579 non-trivial default constructors on any such instance variables, in order,
3580 and then return @code{self}. Similarly, check if any instance variable
3581 is a C++ object with a non-trivial destructor, and if so, synthesize a
3582 special @code{- (void) .cxx_destruct} method which runs
3583 all such default destructors, in reverse order.
3584
3585 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3586 methods thusly generated only operate on instance variables
3587 declared in the current Objective-C class, and not those inherited
3588 from superclasses. It is the responsibility of the Objective-C
3589 runtime to invoke all such methods in an object's inheritance
3590 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3591 by the runtime immediately after a new object instance is allocated;
3592 the @code{- (void) .cxx_destruct} methods are invoked immediately
3593 before the runtime deallocates an object instance.
3594
3595 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3596 support for invoking the @code{- (id) .cxx_construct} and
3597 @code{- (void) .cxx_destruct} methods.
3598
3599 @item -fobjc-direct-dispatch
3600 @opindex fobjc-direct-dispatch
3601 Allow fast jumps to the message dispatcher. On Darwin this is
3602 accomplished via the comm page.
3603
3604 @item -fobjc-exceptions
3605 @opindex fobjc-exceptions
3606 Enable syntactic support for structured exception handling in
3607 Objective-C, similar to what is offered by C++. This option
3608 is required to use the Objective-C keywords @code{@@try},
3609 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3610 @code{@@synchronized}. This option is available with both the GNU
3611 runtime and the NeXT runtime (but not available in conjunction with
3612 the NeXT runtime on Mac OS X 10.2 and earlier).
3613
3614 @item -fobjc-gc
3615 @opindex fobjc-gc
3616 Enable garbage collection (GC) in Objective-C and Objective-C++
3617 programs. This option is only available with the NeXT runtime; the
3618 GNU runtime has a different garbage collection implementation that
3619 does not require special compiler flags.
3620
3621 @item -fobjc-nilcheck
3622 @opindex fobjc-nilcheck
3623 For the NeXT runtime with version 2 of the ABI, check for a nil
3624 receiver in method invocations before doing the actual method call.
3625 This is the default and can be disabled using
3626 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3627 checked for nil in this way no matter what this flag is set to.
3628 Currently this flag does nothing when the GNU runtime, or an older
3629 version of the NeXT runtime ABI, is used.
3630
3631 @item -fobjc-std=objc1
3632 @opindex fobjc-std
3633 Conform to the language syntax of Objective-C 1.0, the language
3634 recognized by GCC 4.0. This only affects the Objective-C additions to
3635 the C/C++ language; it does not affect conformance to C/C++ standards,
3636 which is controlled by the separate C/C++ dialect option flags. When
3637 this option is used with the Objective-C or Objective-C++ compiler,
3638 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3639 This is useful if you need to make sure that your Objective-C code can
3640 be compiled with older versions of GCC@.
3641
3642 @item -freplace-objc-classes
3643 @opindex freplace-objc-classes
3644 Emit a special marker instructing @command{ld(1)} not to statically link in
3645 the resulting object file, and allow @command{dyld(1)} to load it in at
3646 run time instead. This is used in conjunction with the Fix-and-Continue
3647 debugging mode, where the object file in question may be recompiled and
3648 dynamically reloaded in the course of program execution, without the need
3649 to restart the program itself. Currently, Fix-and-Continue functionality
3650 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3651 and later.
3652
3653 @item -fzero-link
3654 @opindex fzero-link
3655 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3656 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3657 compile time) with static class references that get initialized at load time,
3658 which improves run-time performance. Specifying the @option{-fzero-link} flag
3659 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3660 to be retained. This is useful in Zero-Link debugging mode, since it allows
3661 for individual class implementations to be modified during program execution.
3662 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3663 regardless of command-line options.
3664
3665 @item -fno-local-ivars
3666 @opindex fno-local-ivars
3667 @opindex flocal-ivars
3668 By default instance variables in Objective-C can be accessed as if
3669 they were local variables from within the methods of the class they're
3670 declared in. This can lead to shadowing between instance variables
3671 and other variables declared either locally inside a class method or
3672 globally with the same name. Specifying the @option{-fno-local-ivars}
3673 flag disables this behavior thus avoiding variable shadowing issues.
3674
3675 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3676 @opindex fivar-visibility
3677 Set the default instance variable visibility to the specified option
3678 so that instance variables declared outside the scope of any access
3679 modifier directives default to the specified visibility.
3680
3681 @item -gen-decls
3682 @opindex gen-decls
3683 Dump interface declarations for all classes seen in the source file to a
3684 file named @file{@var{sourcename}.decl}.
3685
3686 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3687 @opindex Wassign-intercept
3688 @opindex Wno-assign-intercept
3689 Warn whenever an Objective-C assignment is being intercepted by the
3690 garbage collector.
3691
3692 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3693 @opindex Wno-protocol
3694 @opindex Wprotocol
3695 If a class is declared to implement a protocol, a warning is issued for
3696 every method in the protocol that is not implemented by the class. The
3697 default behavior is to issue a warning for every method not explicitly
3698 implemented in the class, even if a method implementation is inherited
3699 from the superclass. If you use the @option{-Wno-protocol} option, then
3700 methods inherited from the superclass are considered to be implemented,
3701 and no warning is issued for them.
3702
3703 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3704 @opindex Wselector
3705 @opindex Wno-selector
3706 Warn if multiple methods of different types for the same selector are
3707 found during compilation. The check is performed on the list of methods
3708 in the final stage of compilation. Additionally, a check is performed
3709 for each selector appearing in a @code{@@selector(@dots{})}
3710 expression, and a corresponding method for that selector has been found
3711 during compilation. Because these checks scan the method table only at
3712 the end of compilation, these warnings are not produced if the final
3713 stage of compilation is not reached, for example because an error is
3714 found during compilation, or because the @option{-fsyntax-only} option is
3715 being used.
3716
3717 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3718 @opindex Wstrict-selector-match
3719 @opindex Wno-strict-selector-match
3720 Warn if multiple methods with differing argument and/or return types are
3721 found for a given selector when attempting to send a message using this
3722 selector to a receiver of type @code{id} or @code{Class}. When this flag
3723 is off (which is the default behavior), the compiler omits such warnings
3724 if any differences found are confined to types that share the same size
3725 and alignment.
3726
3727 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3728 @opindex Wundeclared-selector
3729 @opindex Wno-undeclared-selector
3730 Warn if a @code{@@selector(@dots{})} expression referring to an
3731 undeclared selector is found. A selector is considered undeclared if no
3732 method with that name has been declared before the
3733 @code{@@selector(@dots{})} expression, either explicitly in an
3734 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3735 an @code{@@implementation} section. This option always performs its
3736 checks as soon as a @code{@@selector(@dots{})} expression is found,
3737 while @option{-Wselector} only performs its checks in the final stage of
3738 compilation. This also enforces the coding style convention
3739 that methods and selectors must be declared before being used.
3740
3741 @item -print-objc-runtime-info
3742 @opindex print-objc-runtime-info
3743 Generate C header describing the largest structure that is passed by
3744 value, if any.
3745
3746 @end table
3747
3748 @node Diagnostic Message Formatting Options
3749 @section Options to Control Diagnostic Messages Formatting
3750 @cindex options to control diagnostics formatting
3751 @cindex diagnostic messages
3752 @cindex message formatting
3753
3754 Traditionally, diagnostic messages have been formatted irrespective of
3755 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3756 options described below
3757 to control the formatting algorithm for diagnostic messages,
3758 e.g.@: how many characters per line, how often source location
3759 information should be reported. Note that some language front ends may not
3760 honor these options.
3761
3762 @table @gcctabopt
3763 @item -fmessage-length=@var{n}
3764 @opindex fmessage-length
3765 Try to format error messages so that they fit on lines of about
3766 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3767 done; each error message appears on a single line. This is the
3768 default for all front ends.
3769
3770 Note - this option also affects the display of the @samp{#error} and
3771 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3772 function/type/variable attribute. It does not however affect the
3773 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3774
3775 @item -fdiagnostics-show-location=once
3776 @opindex fdiagnostics-show-location
3777 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3778 reporter to emit source location information @emph{once}; that is, in
3779 case the message is too long to fit on a single physical line and has to
3780 be wrapped, the source location won't be emitted (as prefix) again,
3781 over and over, in subsequent continuation lines. This is the default
3782 behavior.
3783
3784 @item -fdiagnostics-show-location=every-line
3785 Only meaningful in line-wrapping mode. Instructs the diagnostic
3786 messages reporter to emit the same source location information (as
3787 prefix) for physical lines that result from the process of breaking
3788 a message which is too long to fit on a single line.
3789
3790 @item -fdiagnostics-color[=@var{WHEN}]
3791 @itemx -fno-diagnostics-color
3792 @opindex fdiagnostics-color
3793 @cindex highlight, color
3794 @vindex GCC_COLORS @r{environment variable}
3795 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3796 or @samp{auto}. The default depends on how the compiler has been configured,
3797 it can be any of the above @var{WHEN} options or also @samp{never}
3798 if @env{GCC_COLORS} environment variable isn't present in the environment,
3799 and @samp{auto} otherwise.
3800 @samp{auto} means to use color only when the standard error is a terminal.
3801 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3802 aliases for @option{-fdiagnostics-color=always} and
3803 @option{-fdiagnostics-color=never}, respectively.
3804
3805 The colors are defined by the environment variable @env{GCC_COLORS}.
3806 Its value is a colon-separated list of capabilities and Select Graphic
3807 Rendition (SGR) substrings. SGR commands are interpreted by the
3808 terminal or terminal emulator. (See the section in the documentation
3809 of your text terminal for permitted values and their meanings as
3810 character attributes.) These substring values are integers in decimal
3811 representation and can be concatenated with semicolons.
3812 Common values to concatenate include
3813 @samp{1} for bold,
3814 @samp{4} for underline,
3815 @samp{5} for blink,
3816 @samp{7} for inverse,
3817 @samp{39} for default foreground color,
3818 @samp{30} to @samp{37} for foreground colors,
3819 @samp{90} to @samp{97} for 16-color mode foreground colors,
3820 @samp{38;5;0} to @samp{38;5;255}
3821 for 88-color and 256-color modes foreground colors,
3822 @samp{49} for default background color,
3823 @samp{40} to @samp{47} for background colors,
3824 @samp{100} to @samp{107} for 16-color mode background colors,
3825 and @samp{48;5;0} to @samp{48;5;255}
3826 for 88-color and 256-color modes background colors.
3827
3828 The default @env{GCC_COLORS} is
3829 @smallexample
3830 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3831 quote=01:fixit-insert=32:fixit-delete=31:\
3832 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3833 type-diff=01;32
3834 @end smallexample
3835 @noindent
3836 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3837 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3838 @samp{01} is bold, and @samp{31} is red.
3839 Setting @env{GCC_COLORS} to the empty string disables colors.
3840 Supported capabilities are as follows.
3841
3842 @table @code
3843 @item error=
3844 @vindex error GCC_COLORS @r{capability}
3845 SGR substring for error: markers.
3846
3847 @item warning=
3848 @vindex warning GCC_COLORS @r{capability}
3849 SGR substring for warning: markers.
3850
3851 @item note=
3852 @vindex note GCC_COLORS @r{capability}
3853 SGR substring for note: markers.
3854
3855 @item range1=
3856 @vindex range1 GCC_COLORS @r{capability}
3857 SGR substring for first additional range.
3858
3859 @item range2=
3860 @vindex range2 GCC_COLORS @r{capability}
3861 SGR substring for second additional range.
3862
3863 @item locus=
3864 @vindex locus GCC_COLORS @r{capability}
3865 SGR substring for location information, @samp{file:line} or
3866 @samp{file:line:column} etc.
3867
3868 @item quote=
3869 @vindex quote GCC_COLORS @r{capability}
3870 SGR substring for information printed within quotes.
3871
3872 @item fixit-insert=
3873 @vindex fixit-insert GCC_COLORS @r{capability}
3874 SGR substring for fix-it hints suggesting text to
3875 be inserted or replaced.
3876
3877 @item fixit-delete=
3878 @vindex fixit-delete GCC_COLORS @r{capability}
3879 SGR substring for fix-it hints suggesting text to
3880 be deleted.
3881
3882 @item diff-filename=
3883 @vindex diff-filename GCC_COLORS @r{capability}
3884 SGR substring for filename headers within generated patches.
3885
3886 @item diff-hunk=
3887 @vindex diff-hunk GCC_COLORS @r{capability}
3888 SGR substring for the starts of hunks within generated patches.
3889
3890 @item diff-delete=
3891 @vindex diff-delete GCC_COLORS @r{capability}
3892 SGR substring for deleted lines within generated patches.
3893
3894 @item diff-insert=
3895 @vindex diff-insert GCC_COLORS @r{capability}
3896 SGR substring for inserted lines within generated patches.
3897
3898 @item type-diff=
3899 @vindex type-diff GCC_COLORS @r{capability}
3900 SGR substring for highlighting mismatching types within template
3901 arguments in the C++ frontend.
3902 @end table
3903
3904 @item -fno-diagnostics-show-option
3905 @opindex fno-diagnostics-show-option
3906 @opindex fdiagnostics-show-option
3907 By default, each diagnostic emitted includes text indicating the
3908 command-line option that directly controls the diagnostic (if such an
3909 option is known to the diagnostic machinery). Specifying the
3910 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3911
3912 @item -fno-diagnostics-show-caret
3913 @opindex fno-diagnostics-show-caret
3914 @opindex fdiagnostics-show-caret
3915 By default, each diagnostic emitted includes the original source line
3916 and a caret @samp{^} indicating the column. This option suppresses this
3917 information. The source line is truncated to @var{n} characters, if
3918 the @option{-fmessage-length=n} option is given. When the output is done
3919 to the terminal, the width is limited to the width given by the
3920 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3921
3922 @item -fno-diagnostics-show-labels
3923 @opindex fno-diagnostics-show-labels
3924 @opindex fdiagnostics-show-labels
3925 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3926 diagnostics can label ranges of source code with pertinent information, such
3927 as the types of expressions:
3928
3929 @smallexample
3930 printf ("foo %s bar", long_i + long_j);
3931 ~^ ~~~~~~~~~~~~~~~
3932 | |
3933 char * long int
3934 @end smallexample
3935
3936 This option suppresses the printing of these labels (in the example above,
3937 the vertical bars and the ``char *'' and ``long int'' text).
3938
3939 @item -fno-diagnostics-show-line-numbers
3940 @opindex fno-diagnostics-show-line-numbers
3941 @opindex fdiagnostics-show-line-numbers
3942 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3943 a left margin is printed, showing line numbers. This option suppresses this
3944 left margin.
3945
3946 @item -fdiagnostics-minimum-margin-width=@var{width}
3947 @opindex fdiagnostics-minimum-margin-width
3948 This option controls the minimum width of the left margin printed by
3949 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3950
3951 @item -fdiagnostics-parseable-fixits
3952 @opindex fdiagnostics-parseable-fixits
3953 Emit fix-it hints in a machine-parseable format, suitable for consumption
3954 by IDEs. For each fix-it, a line will be printed after the relevant
3955 diagnostic, starting with the string ``fix-it:''. For example:
3956
3957 @smallexample
3958 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3959 @end smallexample
3960
3961 The location is expressed as a half-open range, expressed as a count of
3962 bytes, starting at byte 1 for the initial column. In the above example,
3963 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3964 given string:
3965
3966 @smallexample
3967 00000000011111111112222222222
3968 12345678901234567890123456789
3969 gtk_widget_showall (dlg);
3970 ^^^^^^^^^^^^^^^^^^
3971 gtk_widget_show_all
3972 @end smallexample
3973
3974 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3975 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3976 (e.g. vertical tab as ``\013'').
3977
3978 An empty replacement string indicates that the given range is to be removed.
3979 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3980 be inserted at the given position.
3981
3982 @item -fdiagnostics-generate-patch
3983 @opindex fdiagnostics-generate-patch
3984 Print fix-it hints to stderr in unified diff format, after any diagnostics
3985 are printed. For example:
3986
3987 @smallexample
3988 --- test.c
3989 +++ test.c
3990 @@ -42,5 +42,5 @@
3991
3992 void show_cb(GtkDialog *dlg)
3993 @{
3994 - gtk_widget_showall(dlg);
3995 + gtk_widget_show_all(dlg);
3996 @}
3997
3998 @end smallexample
3999
4000 The diff may or may not be colorized, following the same rules
4001 as for diagnostics (see @option{-fdiagnostics-color}).
4002
4003 @item -fdiagnostics-show-template-tree
4004 @opindex fdiagnostics-show-template-tree
4005
4006 In the C++ frontend, when printing diagnostics showing mismatching
4007 template types, such as:
4008
4009 @smallexample
4010 could not convert 'std::map<int, std::vector<double> >()'
4011 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4012 @end smallexample
4013
4014 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4015 tree-like structure showing the common and differing parts of the types,
4016 such as:
4017
4018 @smallexample
4019 map<
4020 [...],
4021 vector<
4022 [double != float]>>
4023 @end smallexample
4024
4025 The parts that differ are highlighted with color (``double'' and
4026 ``float'' in this case).
4027
4028 @item -fno-elide-type
4029 @opindex fno-elide-type
4030 @opindex felide-type
4031 By default when the C++ frontend prints diagnostics showing mismatching
4032 template types, common parts of the types are printed as ``[...]'' to
4033 simplify the error message. For example:
4034
4035 @smallexample
4036 could not convert 'std::map<int, std::vector<double> >()'
4037 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4038 @end smallexample
4039
4040 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4041 This flag also affects the output of the
4042 @option{-fdiagnostics-show-template-tree} flag.
4043
4044 @item -fno-show-column
4045 @opindex fno-show-column
4046 @opindex fshow-column
4047 Do not print column numbers in diagnostics. This may be necessary if
4048 diagnostics are being scanned by a program that does not understand the
4049 column numbers, such as @command{dejagnu}.
4050
4051 @item -fdiagnostics-format=@var{FORMAT}
4052 @opindex fdiagnostics-format
4053 Select a different format for printing diagnostics.
4054 @var{FORMAT} is @samp{text} or @samp{json}.
4055 The default is @samp{text}.
4056
4057 The @samp{json} format consists of a top-level JSON array containing JSON
4058 objects representing the diagnostics.
4059
4060 The JSON is emitted as one line, without formatting; the examples below
4061 have been formatted for clarity.
4062
4063 Diagnostics can have child diagnostics. For example, this error and note:
4064
4065 @smallexample
4066 misleading-indentation.c:15:3: warning: this 'if' clause does not
4067 guard... [-Wmisleading-indentation]
4068 15 | if (flag)
4069 | ^~
4070 misleading-indentation.c:17:5: note: ...this statement, but the latter
4071 is misleadingly indented as if it were guarded by the 'if'
4072 17 | y = 2;
4073 | ^
4074 @end smallexample
4075
4076 @noindent
4077 might be printed in JSON form (after formatting) like this:
4078
4079 @smallexample
4080 [
4081 @{
4082 "kind": "warning",
4083 "locations": [
4084 @{
4085 "caret": @{
4086 "column": 3,
4087 "file": "misleading-indentation.c",
4088 "line": 15
4089 @},
4090 "finish": @{
4091 "column": 4,
4092 "file": "misleading-indentation.c",
4093 "line": 15
4094 @}
4095 @}
4096 ],
4097 "message": "this \u2018if\u2019 clause does not guard...",
4098 "option": "-Wmisleading-indentation",
4099 "children": [
4100 @{
4101 "kind": "note",
4102 "locations": [
4103 @{
4104 "caret": @{
4105 "column": 5,
4106 "file": "misleading-indentation.c",
4107 "line": 17
4108 @}
4109 @}
4110 ],
4111 "message": "...this statement, but the latter is @dots{}"
4112 @}
4113 ]
4114 @},
4115 @dots{}
4116 ]
4117 @end smallexample
4118
4119 @noindent
4120 where the @code{note} is a child of the @code{warning}.
4121
4122 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4123 an @code{option} key describing the command-line option controlling the
4124 warning.
4125
4126 A diagnostic can contain zero or more locations. Each location has up
4127 to three positions within it: a @code{caret} position and optional
4128 @code{start} and @code{finish} positions. A location can also have
4129 an optional @code{label} string. For example, this error:
4130
4131 @smallexample
4132 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4133 'struct s'@} and 'T' @{aka 'struct t'@})
4134 64 | return callee_4a () + callee_4b ();
4135 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4136 | | |
4137 | | T @{aka struct t@}
4138 | S @{aka struct s@}
4139 @end smallexample
4140
4141 @noindent
4142 has three locations. Its primary location is at the ``+'' token at column
4143 23. It has two secondary locations, describing the left and right-hand sides
4144 of the expression, which have labels. It might be printed in JSON form as:
4145
4146 @smallexample
4147 @{
4148 "children": [],
4149 "kind": "error",
4150 "locations": [
4151 @{
4152 "caret": @{
4153 "column": 23, "file": "bad-binary-ops.c", "line": 64
4154 @}
4155 @},
4156 @{
4157 "caret": @{
4158 "column": 10, "file": "bad-binary-ops.c", "line": 64
4159 @},
4160 "finish": @{
4161 "column": 21, "file": "bad-binary-ops.c", "line": 64
4162 @},
4163 "label": "S @{aka struct s@}"
4164 @},
4165 @{
4166 "caret": @{
4167 "column": 25, "file": "bad-binary-ops.c", "line": 64
4168 @},
4169 "finish": @{
4170 "column": 36, "file": "bad-binary-ops.c", "line": 64
4171 @},
4172 "label": "T @{aka struct t@}"
4173 @}
4174 ],
4175 "message": "invalid operands to binary + @dots{}"
4176 @}
4177 @end smallexample
4178
4179 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4180 consisting of half-open intervals, similar to the output of
4181 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4182 with a replacement fix-it hint:
4183
4184 @smallexample
4185 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4186 mean 'color'?
4187 8 | return ptr->colour;
4188 | ^~~~~~
4189 | color
4190 @end smallexample
4191
4192 @noindent
4193 might be printed in JSON form as:
4194
4195 @smallexample
4196 @{
4197 "children": [],
4198 "fixits": [
4199 @{
4200 "next": @{
4201 "column": 21,
4202 "file": "demo.c",
4203 "line": 8
4204 @},
4205 "start": @{
4206 "column": 15,
4207 "file": "demo.c",
4208 "line": 8
4209 @},
4210 "string": "color"
4211 @}
4212 ],
4213 "kind": "error",
4214 "locations": [
4215 @{
4216 "caret": @{
4217 "column": 15,
4218 "file": "demo.c",
4219 "line": 8
4220 @},
4221 "finish": @{
4222 "column": 20,
4223 "file": "demo.c",
4224 "line": 8
4225 @}
4226 @}
4227 ],
4228 "message": "\u2018struct s\u2019 has no member named @dots{}"
4229 @}
4230 @end smallexample
4231
4232 @noindent
4233 where the fix-it hint suggests replacing the text from @code{start} up
4234 to but not including @code{next} with @code{string}'s value. Deletions
4235 are expressed via an empty value for @code{string}, insertions by
4236 having @code{start} equal @code{next}.
4237
4238 @end table
4239
4240 @node Warning Options
4241 @section Options to Request or Suppress Warnings
4242 @cindex options to control warnings
4243 @cindex warning messages
4244 @cindex messages, warning
4245 @cindex suppressing warnings
4246
4247 Warnings are diagnostic messages that report constructions that
4248 are not inherently erroneous but that are risky or suggest there
4249 may have been an error.
4250
4251 The following language-independent options do not enable specific
4252 warnings but control the kinds of diagnostics produced by GCC@.
4253
4254 @table @gcctabopt
4255 @cindex syntax checking
4256 @item -fsyntax-only
4257 @opindex fsyntax-only
4258 Check the code for syntax errors, but don't do anything beyond that.
4259
4260 @item -fmax-errors=@var{n}
4261 @opindex fmax-errors
4262 Limits the maximum number of error messages to @var{n}, at which point
4263 GCC bails out rather than attempting to continue processing the source
4264 code. If @var{n} is 0 (the default), there is no limit on the number
4265 of error messages produced. If @option{-Wfatal-errors} is also
4266 specified, then @option{-Wfatal-errors} takes precedence over this
4267 option.
4268
4269 @item -w
4270 @opindex w
4271 Inhibit all warning messages.
4272
4273 @item -Werror
4274 @opindex Werror
4275 @opindex Wno-error
4276 Make all warnings into errors.
4277
4278 @item -Werror=
4279 @opindex Werror=
4280 @opindex Wno-error=
4281 Make the specified warning into an error. The specifier for a warning
4282 is appended; for example @option{-Werror=switch} turns the warnings
4283 controlled by @option{-Wswitch} into errors. This switch takes a
4284 negative form, to be used to negate @option{-Werror} for specific
4285 warnings; for example @option{-Wno-error=switch} makes
4286 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4287 is in effect.
4288
4289 The warning message for each controllable warning includes the
4290 option that controls the warning. That option can then be used with
4291 @option{-Werror=} and @option{-Wno-error=} as described above.
4292 (Printing of the option in the warning message can be disabled using the
4293 @option{-fno-diagnostics-show-option} flag.)
4294
4295 Note that specifying @option{-Werror=}@var{foo} automatically implies
4296 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4297 imply anything.
4298
4299 @item -Wfatal-errors
4300 @opindex Wfatal-errors
4301 @opindex Wno-fatal-errors
4302 This option causes the compiler to abort compilation on the first error
4303 occurred rather than trying to keep going and printing further error
4304 messages.
4305
4306 @end table
4307
4308 You can request many specific warnings with options beginning with
4309 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4310 implicit declarations. Each of these specific warning options also
4311 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4312 example, @option{-Wno-implicit}. This manual lists only one of the
4313 two forms, whichever is not the default. For further
4314 language-specific options also refer to @ref{C++ Dialect Options} and
4315 @ref{Objective-C and Objective-C++ Dialect Options}.
4316
4317 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4318 options, such as @option{-Wunused}, which may turn on further options,
4319 such as @option{-Wunused-value}. The combined effect of positive and
4320 negative forms is that more specific options have priority over less
4321 specific ones, independently of their position in the command-line. For
4322 options of the same specificity, the last one takes effect. Options
4323 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4324 as if they appeared at the end of the command-line.
4325
4326 When an unrecognized warning option is requested (e.g.,
4327 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4328 that the option is not recognized. However, if the @option{-Wno-} form
4329 is used, the behavior is slightly different: no diagnostic is
4330 produced for @option{-Wno-unknown-warning} unless other diagnostics
4331 are being produced. This allows the use of new @option{-Wno-} options
4332 with old compilers, but if something goes wrong, the compiler
4333 warns that an unrecognized option is present.
4334
4335 @table @gcctabopt
4336 @item -Wpedantic
4337 @itemx -pedantic
4338 @opindex pedantic
4339 @opindex Wpedantic
4340 @opindex Wno-pedantic
4341 Issue all the warnings demanded by strict ISO C and ISO C++;
4342 reject all programs that use forbidden extensions, and some other
4343 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4344 version of the ISO C standard specified by any @option{-std} option used.
4345
4346 Valid ISO C and ISO C++ programs should compile properly with or without
4347 this option (though a rare few require @option{-ansi} or a
4348 @option{-std} option specifying the required version of ISO C)@. However,
4349 without this option, certain GNU extensions and traditional C and C++
4350 features are supported as well. With this option, they are rejected.
4351
4352 @option{-Wpedantic} does not cause warning messages for use of the
4353 alternate keywords whose names begin and end with @samp{__}. This alternate
4354 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4355 i.e. @samp{__intN__}.
4356 Pedantic warnings are also disabled in the expression that follows
4357 @code{__extension__}. However, only system header files should use
4358 these escape routes; application programs should avoid them.
4359 @xref{Alternate Keywords}.
4360
4361 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4362 C conformance. They soon find that it does not do quite what they want:
4363 it finds some non-ISO practices, but not all---only those for which
4364 ISO C @emph{requires} a diagnostic, and some others for which
4365 diagnostics have been added.
4366
4367 A feature to report any failure to conform to ISO C might be useful in
4368 some instances, but would require considerable additional work and would
4369 be quite different from @option{-Wpedantic}. We don't have plans to
4370 support such a feature in the near future.
4371
4372 Where the standard specified with @option{-std} represents a GNU
4373 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4374 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4375 extended dialect is based. Warnings from @option{-Wpedantic} are given
4376 where they are required by the base standard. (It does not make sense
4377 for such warnings to be given only for features not in the specified GNU
4378 C dialect, since by definition the GNU dialects of C include all
4379 features the compiler supports with the given option, and there would be
4380 nothing to warn about.)
4381
4382 @item -pedantic-errors
4383 @opindex pedantic-errors
4384 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4385 requires a diagnostic, in some cases where there is undefined behavior
4386 at compile-time and in some other cases that do not prevent compilation
4387 of programs that are valid according to the standard. This is not
4388 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4389 by this option and not enabled by the latter and vice versa.
4390
4391 @item -Wall
4392 @opindex Wall
4393 @opindex Wno-all
4394 This enables all the warnings about constructions that some users
4395 consider questionable, and that are easy to avoid (or modify to
4396 prevent the warning), even in conjunction with macros. This also
4397 enables some language-specific warnings described in @ref{C++ Dialect
4398 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4399
4400 @option{-Wall} turns on the following warning flags:
4401
4402 @gccoptlist{-Waddress @gol
4403 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4404 -Wbool-compare @gol
4405 -Wbool-operation @gol
4406 -Wc++11-compat -Wc++14-compat @gol
4407 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4408 -Wchar-subscripts @gol
4409 -Wcomment @gol
4410 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4411 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4412 -Wformat @gol
4413 -Wint-in-bool-context @gol
4414 -Wimplicit @r{(C and Objective-C only)} @gol
4415 -Wimplicit-int @r{(C and Objective-C only)} @gol
4416 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4417 -Winit-self @r{(only for C++)} @gol
4418 -Wlogical-not-parentheses @gol
4419 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4420 -Wmaybe-uninitialized @gol
4421 -Wmemset-elt-size @gol
4422 -Wmemset-transposed-args @gol
4423 -Wmisleading-indentation @r{(only for C/C++)} @gol
4424 -Wmissing-attributes @gol
4425 -Wmissing-braces @r{(only for C/ObjC)} @gol
4426 -Wmultistatement-macros @gol
4427 -Wnarrowing @r{(only for C++)} @gol
4428 -Wnonnull @gol
4429 -Wnonnull-compare @gol
4430 -Wopenmp-simd @gol
4431 -Wparentheses @gol
4432 -Wpessimizing-move @r{(only for C++)} @gol
4433 -Wpointer-sign @gol
4434 -Wreorder @gol
4435 -Wrestrict @gol
4436 -Wreturn-type @gol
4437 -Wsequence-point @gol
4438 -Wsign-compare @r{(only in C++)} @gol
4439 -Wsizeof-pointer-div @gol
4440 -Wsizeof-pointer-memaccess @gol
4441 -Wstrict-aliasing @gol
4442 -Wstrict-overflow=1 @gol
4443 -Wswitch @gol
4444 -Wtautological-compare @gol
4445 -Wtrigraphs @gol
4446 -Wuninitialized @gol
4447 -Wunknown-pragmas @gol
4448 -Wunused-function @gol
4449 -Wunused-label @gol
4450 -Wunused-value @gol
4451 -Wunused-variable @gol
4452 -Wvolatile-register-var}
4453
4454 Note that some warning flags are not implied by @option{-Wall}. Some of
4455 them warn about constructions that users generally do not consider
4456 questionable, but which occasionally you might wish to check for;
4457 others warn about constructions that are necessary or hard to avoid in
4458 some cases, and there is no simple way to modify the code to suppress
4459 the warning. Some of them are enabled by @option{-Wextra} but many of
4460 them must be enabled individually.
4461
4462 @item -Wextra
4463 @opindex W
4464 @opindex Wextra
4465 @opindex Wno-extra
4466 This enables some extra warning flags that are not enabled by
4467 @option{-Wall}. (This option used to be called @option{-W}. The older
4468 name is still supported, but the newer name is more descriptive.)
4469
4470 @gccoptlist{-Wclobbered @gol
4471 -Wcast-function-type @gol
4472 -Wdeprecated-copy @r{(C++ only)} @gol
4473 -Wempty-body @gol
4474 -Wignored-qualifiers @gol
4475 -Wimplicit-fallthrough=3 @gol
4476 -Wmissing-field-initializers @gol
4477 -Wmissing-parameter-type @r{(C only)} @gol
4478 -Wold-style-declaration @r{(C only)} @gol
4479 -Woverride-init @gol
4480 -Wsign-compare @r{(C only)} @gol
4481 -Wredundant-move @r{(only for C++)} @gol
4482 -Wtype-limits @gol
4483 -Wuninitialized @gol
4484 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4485 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4486 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4487
4488
4489 The option @option{-Wextra} also prints warning messages for the
4490 following cases:
4491
4492 @itemize @bullet
4493
4494 @item
4495 A pointer is compared against integer zero with @code{<}, @code{<=},
4496 @code{>}, or @code{>=}.
4497
4498 @item
4499 (C++ only) An enumerator and a non-enumerator both appear in a
4500 conditional expression.
4501
4502 @item
4503 (C++ only) Ambiguous virtual bases.
4504
4505 @item
4506 (C++ only) Subscripting an array that has been declared @code{register}.
4507
4508 @item
4509 (C++ only) Taking the address of a variable that has been declared
4510 @code{register}.
4511
4512 @item
4513 (C++ only) A base class is not initialized in the copy constructor
4514 of a derived class.
4515
4516 @end itemize
4517
4518 @item -Wchar-subscripts
4519 @opindex Wchar-subscripts
4520 @opindex Wno-char-subscripts
4521 Warn if an array subscript has type @code{char}. This is a common cause
4522 of error, as programmers often forget that this type is signed on some
4523 machines.
4524 This warning is enabled by @option{-Wall}.
4525
4526 @item -Wno-coverage-mismatch
4527 @opindex Wno-coverage-mismatch
4528 @opindex Wcoverage-mismatch
4529 Warn if feedback profiles do not match when using the
4530 @option{-fprofile-use} option.
4531 If a source file is changed between compiling with @option{-fprofile-generate}
4532 and with @option{-fprofile-use}, the files with the profile feedback can fail
4533 to match the source file and GCC cannot use the profile feedback
4534 information. By default, this warning is enabled and is treated as an
4535 error. @option{-Wno-coverage-mismatch} can be used to disable the
4536 warning or @option{-Wno-error=coverage-mismatch} can be used to
4537 disable the error. Disabling the error for this warning can result in
4538 poorly optimized code and is useful only in the
4539 case of very minor changes such as bug fixes to an existing code-base.
4540 Completely disabling the warning is not recommended.
4541
4542 @item -Wno-cpp
4543 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4544
4545 Suppress warning messages emitted by @code{#warning} directives.
4546
4547 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4548 @opindex Wdouble-promotion
4549 @opindex Wno-double-promotion
4550 Give a warning when a value of type @code{float} is implicitly
4551 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4552 floating-point unit implement @code{float} in hardware, but emulate
4553 @code{double} in software. On such a machine, doing computations
4554 using @code{double} values is much more expensive because of the
4555 overhead required for software emulation.
4556
4557 It is easy to accidentally do computations with @code{double} because
4558 floating-point literals are implicitly of type @code{double}. For
4559 example, in:
4560 @smallexample
4561 @group
4562 float area(float radius)
4563 @{
4564 return 3.14159 * radius * radius;
4565 @}
4566 @end group
4567 @end smallexample
4568 the compiler performs the entire computation with @code{double}
4569 because the floating-point literal is a @code{double}.
4570
4571 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4572 @opindex Wduplicate-decl-specifier
4573 @opindex Wno-duplicate-decl-specifier
4574 Warn if a declaration has duplicate @code{const}, @code{volatile},
4575 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4576 @option{-Wall}.
4577
4578 @item -Wformat
4579 @itemx -Wformat=@var{n}
4580 @opindex Wformat
4581 @opindex Wno-format
4582 @opindex ffreestanding
4583 @opindex fno-builtin
4584 @opindex Wformat=
4585 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4586 the arguments supplied have types appropriate to the format string
4587 specified, and that the conversions specified in the format string make
4588 sense. This includes standard functions, and others specified by format
4589 attributes (@pxref{Function Attributes}), in the @code{printf},
4590 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4591 not in the C standard) families (or other target-specific families).
4592 Which functions are checked without format attributes having been
4593 specified depends on the standard version selected, and such checks of
4594 functions without the attribute specified are disabled by
4595 @option{-ffreestanding} or @option{-fno-builtin}.
4596
4597 The formats are checked against the format features supported by GNU
4598 libc version 2.2. These include all ISO C90 and C99 features, as well
4599 as features from the Single Unix Specification and some BSD and GNU
4600 extensions. Other library implementations may not support all these
4601 features; GCC does not support warning about features that go beyond a
4602 particular library's limitations. However, if @option{-Wpedantic} is used
4603 with @option{-Wformat}, warnings are given about format features not
4604 in the selected standard version (but not for @code{strfmon} formats,
4605 since those are not in any version of the C standard). @xref{C Dialect
4606 Options,,Options Controlling C Dialect}.
4607
4608 @table @gcctabopt
4609 @item -Wformat=1
4610 @itemx -Wformat
4611 @opindex Wformat
4612 @opindex Wformat=1
4613 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4614 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4615 @option{-Wformat} also checks for null format arguments for several
4616 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4617 aspects of this level of format checking can be disabled by the
4618 options: @option{-Wno-format-contains-nul},
4619 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4620 @option{-Wformat} is enabled by @option{-Wall}.
4621
4622 @item -Wno-format-contains-nul
4623 @opindex Wno-format-contains-nul
4624 @opindex Wformat-contains-nul
4625 If @option{-Wformat} is specified, do not warn about format strings that
4626 contain NUL bytes.
4627
4628 @item -Wno-format-extra-args
4629 @opindex Wno-format-extra-args
4630 @opindex Wformat-extra-args
4631 If @option{-Wformat} is specified, do not warn about excess arguments to a
4632 @code{printf} or @code{scanf} format function. The C standard specifies
4633 that such arguments are ignored.
4634
4635 Where the unused arguments lie between used arguments that are
4636 specified with @samp{$} operand number specifications, normally
4637 warnings are still given, since the implementation could not know what
4638 type to pass to @code{va_arg} to skip the unused arguments. However,
4639 in the case of @code{scanf} formats, this option suppresses the
4640 warning if the unused arguments are all pointers, since the Single
4641 Unix Specification says that such unused arguments are allowed.
4642
4643 @item -Wformat-overflow
4644 @itemx -Wformat-overflow=@var{level}
4645 @opindex Wformat-overflow
4646 @opindex Wno-format-overflow
4647 Warn about calls to formatted input/output functions such as @code{sprintf}
4648 and @code{vsprintf} that might overflow the destination buffer. When the
4649 exact number of bytes written by a format directive cannot be determined
4650 at compile-time it is estimated based on heuristics that depend on the
4651 @var{level} argument and on optimization. While enabling optimization
4652 will in most cases improve the accuracy of the warning, it may also
4653 result in false positives.
4654
4655 @table @gcctabopt
4656 @item -Wformat-overflow
4657 @itemx -Wformat-overflow=1
4658 @opindex Wformat-overflow
4659 @opindex Wno-format-overflow
4660 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4661 employs a conservative approach that warns only about calls that most
4662 likely overflow the buffer. At this level, numeric arguments to format
4663 directives with unknown values are assumed to have the value of one, and
4664 strings of unknown length to be empty. Numeric arguments that are known
4665 to be bounded to a subrange of their type, or string arguments whose output
4666 is bounded either by their directive's precision or by a finite set of
4667 string literals, are assumed to take on the value within the range that
4668 results in the most bytes on output. For example, the call to @code{sprintf}
4669 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4670 the terminating NUL character (@code{'\0'}) appended by the function
4671 to the destination buffer will be written past its end. Increasing
4672 the size of the buffer by a single byte is sufficient to avoid the
4673 warning, though it may not be sufficient to avoid the overflow.
4674
4675 @smallexample
4676 void f (int a, int b)
4677 @{
4678 char buf [13];
4679 sprintf (buf, "a = %i, b = %i\n", a, b);
4680 @}
4681 @end smallexample
4682
4683 @item -Wformat-overflow=2
4684 Level @var{2} warns also about calls that might overflow the destination
4685 buffer given an argument of sufficient length or magnitude. At level
4686 @var{2}, unknown numeric arguments are assumed to have the minimum
4687 representable value for signed types with a precision greater than 1, and
4688 the maximum representable value otherwise. Unknown string arguments whose
4689 length cannot be assumed to be bounded either by the directive's precision,
4690 or by a finite set of string literals they may evaluate to, or the character
4691 array they may point to, are assumed to be 1 character long.
4692
4693 At level @var{2}, the call in the example above is again diagnosed, but
4694 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4695 @code{%i} directive will write some of its digits beyond the end of
4696 the destination buffer. To make the call safe regardless of the values
4697 of the two variables, the size of the destination buffer must be increased
4698 to at least 34 bytes. GCC includes the minimum size of the buffer in
4699 an informational note following the warning.
4700
4701 An alternative to increasing the size of the destination buffer is to
4702 constrain the range of formatted values. The maximum length of string
4703 arguments can be bounded by specifying the precision in the format
4704 directive. When numeric arguments of format directives can be assumed
4705 to be bounded by less than the precision of their type, choosing
4706 an appropriate length modifier to the format specifier will reduce
4707 the required buffer size. For example, if @var{a} and @var{b} in the
4708 example above can be assumed to be within the precision of
4709 the @code{short int} type then using either the @code{%hi} format
4710 directive or casting the argument to @code{short} reduces the maximum
4711 required size of the buffer to 24 bytes.
4712
4713 @smallexample
4714 void f (int a, int b)
4715 @{
4716 char buf [23];
4717 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4718 @}
4719 @end smallexample
4720 @end table
4721
4722 @item -Wno-format-zero-length
4723 @opindex Wno-format-zero-length
4724 @opindex Wformat-zero-length
4725 If @option{-Wformat} is specified, do not warn about zero-length formats.
4726 The C standard specifies that zero-length formats are allowed.
4727
4728
4729 @item -Wformat=2
4730 @opindex Wformat=2
4731 Enable @option{-Wformat} plus additional format checks. Currently
4732 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4733 -Wformat-y2k}.
4734
4735 @item -Wformat-nonliteral
4736 @opindex Wformat-nonliteral
4737 @opindex Wno-format-nonliteral
4738 If @option{-Wformat} is specified, also warn if the format string is not a
4739 string literal and so cannot be checked, unless the format function
4740 takes its format arguments as a @code{va_list}.
4741
4742 @item -Wformat-security
4743 @opindex Wformat-security
4744 @opindex Wno-format-security
4745 If @option{-Wformat} is specified, also warn about uses of format
4746 functions that represent possible security problems. At present, this
4747 warns about calls to @code{printf} and @code{scanf} functions where the
4748 format string is not a string literal and there are no format arguments,
4749 as in @code{printf (foo);}. This may be a security hole if the format
4750 string came from untrusted input and contains @samp{%n}. (This is
4751 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4752 in future warnings may be added to @option{-Wformat-security} that are not
4753 included in @option{-Wformat-nonliteral}.)
4754
4755 @item -Wformat-signedness
4756 @opindex Wformat-signedness
4757 @opindex Wno-format-signedness
4758 If @option{-Wformat} is specified, also warn if the format string
4759 requires an unsigned argument and the argument is signed and vice versa.
4760
4761 @item -Wformat-truncation
4762 @itemx -Wformat-truncation=@var{level}
4763 @opindex Wformat-truncation
4764 @opindex Wno-format-truncation
4765 Warn about calls to formatted input/output functions such as @code{snprintf}
4766 and @code{vsnprintf} that might result in output truncation. When the exact
4767 number of bytes written by a format directive cannot be determined at
4768 compile-time it is estimated based on heuristics that depend on
4769 the @var{level} argument and on optimization. While enabling optimization
4770 will in most cases improve the accuracy of the warning, it may also result
4771 in false positives. Except as noted otherwise, the option uses the same
4772 logic @option{-Wformat-overflow}.
4773
4774 @table @gcctabopt
4775 @item -Wformat-truncation
4776 @itemx -Wformat-truncation=1
4777 @opindex Wformat-truncation
4778 @opindex Wno-format-truncation
4779 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4780 employs a conservative approach that warns only about calls to bounded
4781 functions whose return value is unused and that will most likely result
4782 in output truncation.
4783
4784 @item -Wformat-truncation=2
4785 Level @var{2} warns also about calls to bounded functions whose return
4786 value is used and that might result in truncation given an argument of
4787 sufficient length or magnitude.
4788 @end table
4789
4790 @item -Wformat-y2k
4791 @opindex Wformat-y2k
4792 @opindex Wno-format-y2k
4793 If @option{-Wformat} is specified, also warn about @code{strftime}
4794 formats that may yield only a two-digit year.
4795 @end table
4796
4797 @item -Wnonnull
4798 @opindex Wnonnull
4799 @opindex Wno-nonnull
4800 Warn about passing a null pointer for arguments marked as
4801 requiring a non-null value by the @code{nonnull} function attribute.
4802
4803 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4804 can be disabled with the @option{-Wno-nonnull} option.
4805
4806 @item -Wnonnull-compare
4807 @opindex Wnonnull-compare
4808 @opindex Wno-nonnull-compare
4809 Warn when comparing an argument marked with the @code{nonnull}
4810 function attribute against null inside the function.
4811
4812 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4813 can be disabled with the @option{-Wno-nonnull-compare} option.
4814
4815 @item -Wnull-dereference
4816 @opindex Wnull-dereference
4817 @opindex Wno-null-dereference
4818 Warn if the compiler detects paths that trigger erroneous or
4819 undefined behavior due to dereferencing a null pointer. This option
4820 is only active when @option{-fdelete-null-pointer-checks} is active,
4821 which is enabled by optimizations in most targets. The precision of
4822 the warnings depends on the optimization options used.
4823
4824 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4825 @opindex Winaccessible-base
4826 @opindex Wno-inaccessible-base
4827 Warn when a base class is inaccessible in a class derived from it due to
4828 ambiguity. The warning is enabled by default. Note the warning for virtual
4829 bases is enabled by the @option{-Wextra} option.
4830 @smallexample
4831 @group
4832 struct A @{ int a; @};
4833
4834 struct B : A @{ @};
4835
4836 struct C : B, A @{ @};
4837 @end group
4838 @end smallexample
4839
4840 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4841 @opindex Winit-self
4842 @opindex Wno-init-self
4843 Warn about uninitialized variables that are initialized with themselves.
4844 Note this option can only be used with the @option{-Wuninitialized} option.
4845
4846 For example, GCC warns about @code{i} being uninitialized in the
4847 following snippet only when @option{-Winit-self} has been specified:
4848 @smallexample
4849 @group
4850 int f()
4851 @{
4852 int i = i;
4853 return i;
4854 @}
4855 @end group
4856 @end smallexample
4857
4858 This warning is enabled by @option{-Wall} in C++.
4859
4860 @item -Wimplicit-int @r{(C and Objective-C only)}
4861 @opindex Wimplicit-int
4862 @opindex Wno-implicit-int
4863 Warn when a declaration does not specify a type.
4864 This warning is enabled by @option{-Wall}.
4865
4866 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4867 @opindex Wimplicit-function-declaration
4868 @opindex Wno-implicit-function-declaration
4869 Give a warning whenever a function is used before being declared. In
4870 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4871 enabled by default and it is made into an error by
4872 @option{-pedantic-errors}. This warning is also enabled by
4873 @option{-Wall}.
4874
4875 @item -Wimplicit @r{(C and Objective-C only)}
4876 @opindex Wimplicit
4877 @opindex Wno-implicit
4878 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4879 This warning is enabled by @option{-Wall}.
4880
4881 @item -Wimplicit-fallthrough
4882 @opindex Wimplicit-fallthrough
4883 @opindex Wno-implicit-fallthrough
4884 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4885 and @option{-Wno-implicit-fallthrough} is the same as
4886 @option{-Wimplicit-fallthrough=0}.
4887
4888 @item -Wimplicit-fallthrough=@var{n}
4889 @opindex Wimplicit-fallthrough=
4890 Warn when a switch case falls through. For example:
4891
4892 @smallexample
4893 @group
4894 switch (cond)
4895 @{
4896 case 1:
4897 a = 1;
4898 break;
4899 case 2:
4900 a = 2;
4901 case 3:
4902 a = 3;
4903 break;
4904 @}
4905 @end group
4906 @end smallexample
4907
4908 This warning does not warn when the last statement of a case cannot
4909 fall through, e.g. when there is a return statement or a call to function
4910 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4911 also takes into account control flow statements, such as ifs, and only
4912 warns when appropriate. E.g.@:
4913
4914 @smallexample
4915 @group
4916 switch (cond)
4917 @{
4918 case 1:
4919 if (i > 3) @{
4920 bar (5);
4921 break;
4922 @} else if (i < 1) @{
4923 bar (0);
4924 @} else
4925 return;
4926 default:
4927 @dots{}
4928 @}
4929 @end group
4930 @end smallexample
4931
4932 Since there are occasions where a switch case fall through is desirable,
4933 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4934 to be used along with a null statement to suppress this warning that
4935 would normally occur:
4936
4937 @smallexample
4938 @group
4939 switch (cond)
4940 @{
4941 case 1:
4942 bar (0);
4943 __attribute__ ((fallthrough));
4944 default:
4945 @dots{}
4946 @}
4947 @end group
4948 @end smallexample
4949
4950 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4951 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4952 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4953 Instead of these attributes, it is also possible to add a fallthrough comment
4954 to silence the warning. The whole body of the C or C++ style comment should
4955 match the given regular expressions listed below. The option argument @var{n}
4956 specifies what kind of comments are accepted:
4957
4958 @itemize @bullet
4959
4960 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4961
4962 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4963 expression, any comment is used as fallthrough comment.
4964
4965 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4966 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4967
4968 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4969 following regular expressions:
4970
4971 @itemize @bullet
4972
4973 @item @code{-fallthrough}
4974
4975 @item @code{@@fallthrough@@}
4976
4977 @item @code{lint -fallthrough[ \t]*}
4978
4979 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4980
4981 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4982
4983 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4984
4985 @end itemize
4986
4987 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4988 following regular expressions:
4989
4990 @itemize @bullet
4991
4992 @item @code{-fallthrough}
4993
4994 @item @code{@@fallthrough@@}
4995
4996 @item @code{lint -fallthrough[ \t]*}
4997
4998 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4999
5000 @end itemize
5001
5002 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5003 fallthrough comments, only attributes disable the warning.
5004
5005 @end itemize
5006
5007 The comment needs to be followed after optional whitespace and other comments
5008 by @code{case} or @code{default} keywords or by a user label that precedes some
5009 @code{case} or @code{default} label.
5010
5011 @smallexample
5012 @group
5013 switch (cond)
5014 @{
5015 case 1:
5016 bar (0);
5017 /* FALLTHRU */
5018 default:
5019 @dots{}
5020 @}
5021 @end group
5022 @end smallexample
5023
5024 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5025
5026 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5027 @opindex Wif-not-aligned
5028 @opindex Wno-if-not-aligned
5029 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5030 should be issued. This is enabled by default.
5031 Use @option{-Wno-if-not-aligned} to disable it.
5032
5033 @item -Wignored-qualifiers @r{(C and C++ only)}
5034 @opindex Wignored-qualifiers
5035 @opindex Wno-ignored-qualifiers
5036 Warn if the return type of a function has a type qualifier
5037 such as @code{const}. For ISO C such a type qualifier has no effect,
5038 since the value returned by a function is not an lvalue.
5039 For C++, the warning is only emitted for scalar types or @code{void}.
5040 ISO C prohibits qualified @code{void} return types on function
5041 definitions, so such return types always receive a warning
5042 even without this option.
5043
5044 This warning is also enabled by @option{-Wextra}.
5045
5046 @item -Wignored-attributes @r{(C and C++ only)}
5047 @opindex Wignored-attributes
5048 @opindex Wno-ignored-attributes
5049 Warn when an attribute is ignored. This is different from the
5050 @option{-Wattributes} option in that it warns whenever the compiler decides
5051 to drop an attribute, not that the attribute is either unknown, used in a
5052 wrong place, etc. This warning is enabled by default.
5053
5054 @item -Wmain
5055 @opindex Wmain
5056 @opindex Wno-main
5057 Warn if the type of @code{main} is suspicious. @code{main} should be
5058 a function with external linkage, returning int, taking either zero
5059 arguments, two, or three arguments of appropriate types. This warning
5060 is enabled by default in C++ and is enabled by either @option{-Wall}
5061 or @option{-Wpedantic}.
5062
5063 @item -Wmisleading-indentation @r{(C and C++ only)}
5064 @opindex Wmisleading-indentation
5065 @opindex Wno-misleading-indentation
5066 Warn when the indentation of the code does not reflect the block structure.
5067 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5068 @code{for} clauses with a guarded statement that does not use braces,
5069 followed by an unguarded statement with the same indentation.
5070
5071 In the following example, the call to ``bar'' is misleadingly indented as
5072 if it were guarded by the ``if'' conditional.
5073
5074 @smallexample
5075 if (some_condition ())
5076 foo ();
5077 bar (); /* Gotcha: this is not guarded by the "if". */
5078 @end smallexample
5079
5080 In the case of mixed tabs and spaces, the warning uses the
5081 @option{-ftabstop=} option to determine if the statements line up
5082 (defaulting to 8).
5083
5084 The warning is not issued for code involving multiline preprocessor logic
5085 such as the following example.
5086
5087 @smallexample
5088 if (flagA)
5089 foo (0);
5090 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5091 if (flagB)
5092 #endif
5093 foo (1);
5094 @end smallexample
5095
5096 The warning is not issued after a @code{#line} directive, since this
5097 typically indicates autogenerated code, and no assumptions can be made
5098 about the layout of the file that the directive references.
5099
5100 This warning is enabled by @option{-Wall} in C and C++.
5101
5102 @item -Wmissing-attributes
5103 @opindex Wmissing-attributes
5104 @opindex Wno-missing-attributes
5105 Warn when a declaration of a function is missing one or more attributes
5106 that a related function is declared with and whose absence may adversely
5107 affect the correctness or efficiency of generated code. For example,
5108 the warning is issued for declarations of aliases that use attributes
5109 to specify less restrictive requirements than those of their targets.
5110 This typically represents a potential optimization opportunity.
5111 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5112 issued when the alias is more restrictive than the target, which could
5113 lead to incorrect code generation.
5114 Attributes considered include @code{alloc_align}, @code{alloc_size},
5115 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5116 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5117 @code{returns_nonnull}, and @code{returns_twice}.
5118
5119 In C++, the warning is issued when an explicit specialization of a primary
5120 template declared with attribute @code{alloc_align}, @code{alloc_size},
5121 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5122 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5123 @code{error}, and @code{warning} suppress the warning.
5124 (@pxref{Function Attributes}).
5125
5126 You can use the @code{copy} attribute to apply the same
5127 set of attributes to a declaration as that on another declaration without
5128 explicitly enumerating the attributes. This attribute can be applied
5129 to declarations of functions (@pxref{Common Function Attributes}),
5130 variables (@pxref{Common Variable Attributes}), or types
5131 (@pxref{Common Type Attributes}).
5132
5133 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5134
5135 For example, since the declaration of the primary function template
5136 below makes use of both attribute @code{malloc} and @code{alloc_size}
5137 the declaration of the explicit specialization of the template is
5138 diagnosed because it is missing one of the attributes.
5139
5140 @smallexample
5141 template <class T>
5142 T* __attribute__ ((malloc, alloc_size (1)))
5143 allocate (size_t);
5144
5145 template <>
5146 void* __attribute__ ((malloc)) // missing alloc_size
5147 allocate<void> (size_t);
5148 @end smallexample
5149
5150 @item -Wmissing-braces
5151 @opindex Wmissing-braces
5152 @opindex Wno-missing-braces
5153 Warn if an aggregate or union initializer is not fully bracketed. In
5154 the following example, the initializer for @code{a} is not fully
5155 bracketed, but that for @code{b} is fully bracketed. This warning is
5156 enabled by @option{-Wall} in C.
5157
5158 @smallexample
5159 int a[2][2] = @{ 0, 1, 2, 3 @};
5160 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5161 @end smallexample
5162
5163 This warning is enabled by @option{-Wall}.
5164
5165 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5166 @opindex Wmissing-include-dirs
5167 @opindex Wno-missing-include-dirs
5168 Warn if a user-supplied include directory does not exist.
5169
5170 @item -Wmissing-profile
5171 @opindex Wmissing-profile
5172 @opindex Wno-missing-profile
5173 Warn if feedback profiles are missing when using the
5174 @option{-fprofile-use} option.
5175 This option diagnoses those cases where a new function or a new file is added
5176 to the user code between compiling with @option{-fprofile-generate} and with
5177 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5178 profile feedback data files do not contain any profile feedback information for
5179 the newly added function or file respectively. Also, in the case when profile
5180 count data (.gcda) files are removed, GCC cannot use any profile feedback
5181 information. In all these cases, warnings are issued to inform the user that a
5182 profile generation step is due. @option{-Wno-missing-profile} can be used to
5183 disable the warning. Ignoring the warning can result in poorly optimized code.
5184 Completely disabling the warning is not recommended and should be done only
5185 when non-existent profile data is justified.
5186
5187 @item -Wmultistatement-macros
5188 @opindex Wmultistatement-macros
5189 @opindex Wno-multistatement-macros
5190 Warn about unsafe multiple statement macros that appear to be guarded
5191 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5192 @code{while}, in which only the first statement is actually guarded after
5193 the macro is expanded.
5194
5195 For example:
5196
5197 @smallexample
5198 #define DOIT x++; y++
5199 if (c)
5200 DOIT;
5201 @end smallexample
5202
5203 will increment @code{y} unconditionally, not just when @code{c} holds.
5204 The can usually be fixed by wrapping the macro in a do-while loop:
5205 @smallexample
5206 #define DOIT do @{ x++; y++; @} while (0)
5207 if (c)
5208 DOIT;
5209 @end smallexample
5210
5211 This warning is enabled by @option{-Wall} in C and C++.
5212
5213 @item -Wparentheses
5214 @opindex Wparentheses
5215 @opindex Wno-parentheses
5216 Warn if parentheses are omitted in certain contexts, such
5217 as when there is an assignment in a context where a truth value
5218 is expected, or when operators are nested whose precedence people
5219 often get confused about.
5220
5221 Also warn if a comparison like @code{x<=y<=z} appears; this is
5222 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5223 interpretation from that of ordinary mathematical notation.
5224
5225 Also warn for dangerous uses of the GNU extension to
5226 @code{?:} with omitted middle operand. When the condition
5227 in the @code{?}: operator is a boolean expression, the omitted value is
5228 always 1. Often programmers expect it to be a value computed
5229 inside the conditional expression instead.
5230
5231 For C++ this also warns for some cases of unnecessary parentheses in
5232 declarations, which can indicate an attempt at a function call instead
5233 of a declaration:
5234 @smallexample
5235 @{
5236 // Declares a local variable called mymutex.
5237 std::unique_lock<std::mutex> (mymutex);
5238 // User meant std::unique_lock<std::mutex> lock (mymutex);
5239 @}
5240 @end smallexample
5241
5242 This warning is enabled by @option{-Wall}.
5243
5244 @item -Wsequence-point
5245 @opindex Wsequence-point
5246 @opindex Wno-sequence-point
5247 Warn about code that may have undefined semantics because of violations
5248 of sequence point rules in the C and C++ standards.
5249
5250 The C and C++ standards define the order in which expressions in a C/C++
5251 program are evaluated in terms of @dfn{sequence points}, which represent
5252 a partial ordering between the execution of parts of the program: those
5253 executed before the sequence point, and those executed after it. These
5254 occur after the evaluation of a full expression (one which is not part
5255 of a larger expression), after the evaluation of the first operand of a
5256 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5257 function is called (but after the evaluation of its arguments and the
5258 expression denoting the called function), and in certain other places.
5259 Other than as expressed by the sequence point rules, the order of
5260 evaluation of subexpressions of an expression is not specified. All
5261 these rules describe only a partial order rather than a total order,
5262 since, for example, if two functions are called within one expression
5263 with no sequence point between them, the order in which the functions
5264 are called is not specified. However, the standards committee have
5265 ruled that function calls do not overlap.
5266
5267 It is not specified when between sequence points modifications to the
5268 values of objects take effect. Programs whose behavior depends on this
5269 have undefined behavior; the C and C++ standards specify that ``Between
5270 the previous and next sequence point an object shall have its stored
5271 value modified at most once by the evaluation of an expression.
5272 Furthermore, the prior value shall be read only to determine the value
5273 to be stored.''. If a program breaks these rules, the results on any
5274 particular implementation are entirely unpredictable.
5275
5276 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5277 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5278 diagnosed by this option, and it may give an occasional false positive
5279 result, but in general it has been found fairly effective at detecting
5280 this sort of problem in programs.
5281
5282 The C++17 standard will define the order of evaluation of operands in
5283 more cases: in particular it requires that the right-hand side of an
5284 assignment be evaluated before the left-hand side, so the above
5285 examples are no longer undefined. But this warning will still warn
5286 about them, to help people avoid writing code that is undefined in C
5287 and earlier revisions of C++.
5288
5289 The standard is worded confusingly, therefore there is some debate
5290 over the precise meaning of the sequence point rules in subtle cases.
5291 Links to discussions of the problem, including proposed formal
5292 definitions, may be found on the GCC readings page, at
5293 @uref{http://gcc.gnu.org/@/readings.html}.
5294
5295 This warning is enabled by @option{-Wall} for C and C++.
5296
5297 @item -Wno-return-local-addr
5298 @opindex Wno-return-local-addr
5299 @opindex Wreturn-local-addr
5300 Do not warn about returning a pointer (or in C++, a reference) to a
5301 variable that goes out of scope after the function returns.
5302
5303 @item -Wreturn-type
5304 @opindex Wreturn-type
5305 @opindex Wno-return-type
5306 Warn whenever a function is defined with a return type that defaults
5307 to @code{int}. Also warn about any @code{return} statement with no
5308 return value in a function whose return type is not @code{void}
5309 (falling off the end of the function body is considered returning
5310 without a value).
5311
5312 For C only, warn about a @code{return} statement with an expression in a
5313 function whose return type is @code{void}, unless the expression type is
5314 also @code{void}. As a GNU extension, the latter case is accepted
5315 without a warning unless @option{-Wpedantic} is used. Attempting
5316 to use the return value of a non-@code{void} function other than @code{main}
5317 that flows off the end by reaching the closing curly brace that terminates
5318 the function is undefined.
5319
5320 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5321 than @code{main} results in undefined behavior even when the value of
5322 the function is not used.
5323
5324 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5325
5326 @item -Wshift-count-negative
5327 @opindex Wshift-count-negative
5328 @opindex Wno-shift-count-negative
5329 Warn if shift count is negative. This warning is enabled by default.
5330
5331 @item -Wshift-count-overflow
5332 @opindex Wshift-count-overflow
5333 @opindex Wno-shift-count-overflow
5334 Warn if shift count >= width of type. This warning is enabled by default.
5335
5336 @item -Wshift-negative-value
5337 @opindex Wshift-negative-value
5338 @opindex Wno-shift-negative-value
5339 Warn if left shifting a negative value. This warning is enabled by
5340 @option{-Wextra} in C99 and C++11 modes (and newer).
5341
5342 @item -Wshift-overflow
5343 @itemx -Wshift-overflow=@var{n}
5344 @opindex Wshift-overflow
5345 @opindex Wno-shift-overflow
5346 Warn about left shift overflows. This warning is enabled by
5347 default in C99 and C++11 modes (and newer).
5348
5349 @table @gcctabopt
5350 @item -Wshift-overflow=1
5351 This is the warning level of @option{-Wshift-overflow} and is enabled
5352 by default in C99 and C++11 modes (and newer). This warning level does
5353 not warn about left-shifting 1 into the sign bit. (However, in C, such
5354 an overflow is still rejected in contexts where an integer constant expression
5355 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5356 shifts always wrap.
5357
5358 @item -Wshift-overflow=2
5359 This warning level also warns about left-shifting 1 into the sign bit,
5360 unless C++14 mode (or newer) is active.
5361 @end table
5362
5363 @item -Wswitch
5364 @opindex Wswitch
5365 @opindex Wno-switch
5366 Warn whenever a @code{switch} statement has an index of enumerated type
5367 and lacks a @code{case} for one or more of the named codes of that
5368 enumeration. (The presence of a @code{default} label prevents this
5369 warning.) @code{case} labels outside the enumeration range also
5370 provoke warnings when this option is used (even if there is a
5371 @code{default} label).
5372 This warning is enabled by @option{-Wall}.
5373
5374 @item -Wswitch-default
5375 @opindex Wswitch-default
5376 @opindex Wno-switch-default
5377 Warn whenever a @code{switch} statement does not have a @code{default}
5378 case.
5379
5380 @item -Wswitch-enum
5381 @opindex Wswitch-enum
5382 @opindex Wno-switch-enum
5383 Warn whenever a @code{switch} statement has an index of enumerated type
5384 and lacks a @code{case} for one or more of the named codes of that
5385 enumeration. @code{case} labels outside the enumeration range also
5386 provoke warnings when this option is used. The only difference
5387 between @option{-Wswitch} and this option is that this option gives a
5388 warning about an omitted enumeration code even if there is a
5389 @code{default} label.
5390
5391 @item -Wswitch-bool
5392 @opindex Wswitch-bool
5393 @opindex Wno-switch-bool
5394 Warn whenever a @code{switch} statement has an index of boolean type
5395 and the case values are outside the range of a boolean type.
5396 It is possible to suppress this warning by casting the controlling
5397 expression to a type other than @code{bool}. For example:
5398 @smallexample
5399 @group
5400 switch ((int) (a == 4))
5401 @{
5402 @dots{}
5403 @}
5404 @end group
5405 @end smallexample
5406 This warning is enabled by default for C and C++ programs.
5407
5408 @item -Wswitch-outside-range
5409 @opindex Wswitch-outside-range
5410 @opindex Wno-switch-outside-range
5411 Warn whenever a @code{switch} case has a value that is outside of its
5412 respective type range. This warning is enabled by default for
5413 C and C++ programs.
5414
5415 @item -Wswitch-unreachable
5416 @opindex Wswitch-unreachable
5417 @opindex Wno-switch-unreachable
5418 Warn whenever a @code{switch} statement contains statements between the
5419 controlling expression and the first case label, which will never be
5420 executed. For example:
5421 @smallexample
5422 @group
5423 switch (cond)
5424 @{
5425 i = 15;
5426 @dots{}
5427 case 5:
5428 @dots{}
5429 @}
5430 @end group
5431 @end smallexample
5432 @option{-Wswitch-unreachable} does not warn if the statement between the
5433 controlling expression and the first case label is just a declaration:
5434 @smallexample
5435 @group
5436 switch (cond)
5437 @{
5438 int i;
5439 @dots{}
5440 case 5:
5441 i = 5;
5442 @dots{}
5443 @}
5444 @end group
5445 @end smallexample
5446 This warning is enabled by default for C and C++ programs.
5447
5448 @item -Wsync-nand @r{(C and C++ only)}
5449 @opindex Wsync-nand
5450 @opindex Wno-sync-nand
5451 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5452 built-in functions are used. These functions changed semantics in GCC 4.4.
5453
5454 @item -Wunused-but-set-parameter
5455 @opindex Wunused-but-set-parameter
5456 @opindex Wno-unused-but-set-parameter
5457 Warn whenever a function parameter is assigned to, but otherwise unused
5458 (aside from its declaration).
5459
5460 To suppress this warning use the @code{unused} attribute
5461 (@pxref{Variable Attributes}).
5462
5463 This warning is also enabled by @option{-Wunused} together with
5464 @option{-Wextra}.
5465
5466 @item -Wunused-but-set-variable
5467 @opindex Wunused-but-set-variable
5468 @opindex Wno-unused-but-set-variable
5469 Warn whenever a local variable is assigned to, but otherwise unused
5470 (aside from its declaration).
5471 This warning is enabled by @option{-Wall}.
5472
5473 To suppress this warning use the @code{unused} attribute
5474 (@pxref{Variable Attributes}).
5475
5476 This warning is also enabled by @option{-Wunused}, which is enabled
5477 by @option{-Wall}.
5478
5479 @item -Wunused-function
5480 @opindex Wunused-function
5481 @opindex Wno-unused-function
5482 Warn whenever a static function is declared but not defined or a
5483 non-inline static function is unused.
5484 This warning is enabled by @option{-Wall}.
5485
5486 @item -Wunused-label
5487 @opindex Wunused-label
5488 @opindex Wno-unused-label
5489 Warn whenever a label is declared but not used.
5490 This warning is enabled by @option{-Wall}.
5491
5492 To suppress this warning use the @code{unused} attribute
5493 (@pxref{Variable Attributes}).
5494
5495 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5496 @opindex Wunused-local-typedefs
5497 @opindex Wno-unused-local-typedefs
5498 Warn when a typedef locally defined in a function is not used.
5499 This warning is enabled by @option{-Wall}.
5500
5501 @item -Wunused-parameter
5502 @opindex Wunused-parameter
5503 @opindex Wno-unused-parameter
5504 Warn whenever a function parameter is unused aside from its declaration.
5505
5506 To suppress this warning use the @code{unused} attribute
5507 (@pxref{Variable Attributes}).
5508
5509 @item -Wno-unused-result
5510 @opindex Wunused-result
5511 @opindex Wno-unused-result
5512 Do not warn if a caller of a function marked with attribute
5513 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5514 its return value. The default is @option{-Wunused-result}.
5515
5516 @item -Wunused-variable
5517 @opindex Wunused-variable
5518 @opindex Wno-unused-variable
5519 Warn whenever a local or static variable is unused aside from its
5520 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5521 but not for C++. This warning is enabled by @option{-Wall}.
5522
5523 To suppress this warning use the @code{unused} attribute
5524 (@pxref{Variable Attributes}).
5525
5526 @item -Wunused-const-variable
5527 @itemx -Wunused-const-variable=@var{n}
5528 @opindex Wunused-const-variable
5529 @opindex Wno-unused-const-variable
5530 Warn whenever a constant static variable is unused aside from its declaration.
5531 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5532 for C, but not for C++. In C this declares variable storage, but in C++ this
5533 is not an error since const variables take the place of @code{#define}s.
5534
5535 To suppress this warning use the @code{unused} attribute
5536 (@pxref{Variable Attributes}).
5537
5538 @table @gcctabopt
5539 @item -Wunused-const-variable=1
5540 This is the warning level that is enabled by @option{-Wunused-variable} for
5541 C. It warns only about unused static const variables defined in the main
5542 compilation unit, but not about static const variables declared in any
5543 header included.
5544
5545 @item -Wunused-const-variable=2
5546 This warning level also warns for unused constant static variables in
5547 headers (excluding system headers). This is the warning level of
5548 @option{-Wunused-const-variable} and must be explicitly requested since
5549 in C++ this isn't an error and in C it might be harder to clean up all
5550 headers included.
5551 @end table
5552
5553 @item -Wunused-value
5554 @opindex Wunused-value
5555 @opindex Wno-unused-value
5556 Warn whenever a statement computes a result that is explicitly not
5557 used. To suppress this warning cast the unused expression to
5558 @code{void}. This includes an expression-statement or the left-hand
5559 side of a comma expression that contains no side effects. For example,
5560 an expression such as @code{x[i,j]} causes a warning, while
5561 @code{x[(void)i,j]} does not.
5562
5563 This warning is enabled by @option{-Wall}.
5564
5565 @item -Wunused
5566 @opindex Wunused
5567 @opindex Wno-unused
5568 All the above @option{-Wunused} options combined.
5569
5570 In order to get a warning about an unused function parameter, you must
5571 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5572 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5573
5574 @item -Wuninitialized
5575 @opindex Wuninitialized
5576 @opindex Wno-uninitialized
5577 Warn if an automatic variable is used without first being initialized
5578 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5579 warn if a non-static reference or non-static @code{const} member
5580 appears in a class without constructors.
5581
5582 If you want to warn about code that uses the uninitialized value of the
5583 variable in its own initializer, use the @option{-Winit-self} option.
5584
5585 These warnings occur for individual uninitialized or clobbered
5586 elements of structure, union or array variables as well as for
5587 variables that are uninitialized or clobbered as a whole. They do
5588 not occur for variables or elements declared @code{volatile}. Because
5589 these warnings depend on optimization, the exact variables or elements
5590 for which there are warnings depends on the precise optimization
5591 options and version of GCC used.
5592
5593 Note that there may be no warning about a variable that is used only
5594 to compute a value that itself is never used, because such
5595 computations may be deleted by data flow analysis before the warnings
5596 are printed.
5597
5598 @item -Winvalid-memory-model
5599 @opindex Winvalid-memory-model
5600 @opindex Wno-invalid-memory-model
5601 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5602 and the C11 atomic generic functions with a memory consistency argument
5603 that is either invalid for the operation or outside the range of values
5604 of the @code{memory_order} enumeration. For example, since the
5605 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5606 defined for the relaxed, release, and sequentially consistent memory
5607 orders the following code is diagnosed:
5608
5609 @smallexample
5610 void store (int *i)
5611 @{
5612 __atomic_store_n (i, 0, memory_order_consume);
5613 @}
5614 @end smallexample
5615
5616 @option{-Winvalid-memory-model} is enabled by default.
5617
5618 @item -Wmaybe-uninitialized
5619 @opindex Wmaybe-uninitialized
5620 @opindex Wno-maybe-uninitialized
5621 For an automatic (i.e.@: local) variable, if there exists a path from the
5622 function entry to a use of the variable that is initialized, but there exist
5623 some other paths for which the variable is not initialized, the compiler
5624 emits a warning if it cannot prove the uninitialized paths are not
5625 executed at run time.
5626
5627 These warnings are only possible in optimizing compilation, because otherwise
5628 GCC does not keep track of the state of variables.
5629
5630 These warnings are made optional because GCC may not be able to determine when
5631 the code is correct in spite of appearing to have an error. Here is one
5632 example of how this can happen:
5633
5634 @smallexample
5635 @group
5636 @{
5637 int x;
5638 switch (y)
5639 @{
5640 case 1: x = 1;
5641 break;
5642 case 2: x = 4;
5643 break;
5644 case 3: x = 5;
5645 @}
5646 foo (x);
5647 @}
5648 @end group
5649 @end smallexample
5650
5651 @noindent
5652 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5653 always initialized, but GCC doesn't know this. To suppress the
5654 warning, you need to provide a default case with assert(0) or
5655 similar code.
5656
5657 @cindex @code{longjmp} warnings
5658 This option also warns when a non-volatile automatic variable might be
5659 changed by a call to @code{longjmp}.
5660 The compiler sees only the calls to @code{setjmp}. It cannot know
5661 where @code{longjmp} will be called; in fact, a signal handler could
5662 call it at any point in the code. As a result, you may get a warning
5663 even when there is in fact no problem because @code{longjmp} cannot
5664 in fact be called at the place that would cause a problem.
5665
5666 Some spurious warnings can be avoided if you declare all the functions
5667 you use that never return as @code{noreturn}. @xref{Function
5668 Attributes}.
5669
5670 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5671
5672 @item -Wunknown-pragmas
5673 @opindex Wunknown-pragmas
5674 @opindex Wno-unknown-pragmas
5675 @cindex warning for unknown pragmas
5676 @cindex unknown pragmas, warning
5677 @cindex pragmas, warning of unknown
5678 Warn when a @code{#pragma} directive is encountered that is not understood by
5679 GCC@. If this command-line option is used, warnings are even issued
5680 for unknown pragmas in system header files. This is not the case if
5681 the warnings are only enabled by the @option{-Wall} command-line option.
5682
5683 @item -Wno-pragmas
5684 @opindex Wno-pragmas
5685 @opindex Wpragmas
5686 Do not warn about misuses of pragmas, such as incorrect parameters,
5687 invalid syntax, or conflicts between pragmas. See also
5688 @option{-Wunknown-pragmas}.
5689
5690 @item -Wno-prio-ctor-dtor
5691 @opindex Wno-prio-ctor-dtor
5692 @opindex Wprio-ctor-dtor
5693 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5694 The use of constructor and destructor attributes allow you to assign a
5695 priority to the constructor/destructor to control its order of execution
5696 before @code{main} is called or after it returns. The priority values must be
5697 greater than 100 as the compiler reserves priority values between 0--100 for
5698 the implementation.
5699
5700 @item -Wstrict-aliasing
5701 @opindex Wstrict-aliasing
5702 @opindex Wno-strict-aliasing
5703 This option is only active when @option{-fstrict-aliasing} is active.
5704 It warns about code that might break the strict aliasing rules that the
5705 compiler is using for optimization. The warning does not catch all
5706 cases, but does attempt to catch the more common pitfalls. It is
5707 included in @option{-Wall}.
5708 It is equivalent to @option{-Wstrict-aliasing=3}
5709
5710 @item -Wstrict-aliasing=n
5711 @opindex Wstrict-aliasing=n
5712 This option is only active when @option{-fstrict-aliasing} is active.
5713 It warns about code that might break the strict aliasing rules that the
5714 compiler is using for optimization.
5715 Higher levels correspond to higher accuracy (fewer false positives).
5716 Higher levels also correspond to more effort, similar to the way @option{-O}
5717 works.
5718 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5719
5720 Level 1: Most aggressive, quick, least accurate.
5721 Possibly useful when higher levels
5722 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5723 false negatives. However, it has many false positives.
5724 Warns for all pointer conversions between possibly incompatible types,
5725 even if never dereferenced. Runs in the front end only.
5726
5727 Level 2: Aggressive, quick, not too precise.
5728 May still have many false positives (not as many as level 1 though),
5729 and few false negatives (but possibly more than level 1).
5730 Unlike level 1, it only warns when an address is taken. Warns about
5731 incomplete types. Runs in the front end only.
5732
5733 Level 3 (default for @option{-Wstrict-aliasing}):
5734 Should have very few false positives and few false
5735 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5736 Takes care of the common pun+dereference pattern in the front end:
5737 @code{*(int*)&some_float}.
5738 If optimization is enabled, it also runs in the back end, where it deals
5739 with multiple statement cases using flow-sensitive points-to information.
5740 Only warns when the converted pointer is dereferenced.
5741 Does not warn about incomplete types.
5742
5743 @item -Wstrict-overflow
5744 @itemx -Wstrict-overflow=@var{n}
5745 @opindex Wstrict-overflow
5746 @opindex Wno-strict-overflow
5747 This option is only active when signed overflow is undefined.
5748 It warns about cases where the compiler optimizes based on the
5749 assumption that signed overflow does not occur. Note that it does not
5750 warn about all cases where the code might overflow: it only warns
5751 about cases where the compiler implements some optimization. Thus
5752 this warning depends on the optimization level.
5753
5754 An optimization that assumes that signed overflow does not occur is
5755 perfectly safe if the values of the variables involved are such that
5756 overflow never does, in fact, occur. Therefore this warning can
5757 easily give a false positive: a warning about code that is not
5758 actually a problem. To help focus on important issues, several
5759 warning levels are defined. No warnings are issued for the use of
5760 undefined signed overflow when estimating how many iterations a loop
5761 requires, in particular when determining whether a loop will be
5762 executed at all.
5763
5764 @table @gcctabopt
5765 @item -Wstrict-overflow=1
5766 Warn about cases that are both questionable and easy to avoid. For
5767 example the compiler simplifies
5768 @code{x + 1 > x} to @code{1}. This level of
5769 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5770 are not, and must be explicitly requested.
5771
5772 @item -Wstrict-overflow=2
5773 Also warn about other cases where a comparison is simplified to a
5774 constant. For example: @code{abs (x) >= 0}. This can only be
5775 simplified when signed integer overflow is undefined, because
5776 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5777 zero. @option{-Wstrict-overflow} (with no level) is the same as
5778 @option{-Wstrict-overflow=2}.
5779
5780 @item -Wstrict-overflow=3
5781 Also warn about other cases where a comparison is simplified. For
5782 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5783
5784 @item -Wstrict-overflow=4
5785 Also warn about other simplifications not covered by the above cases.
5786 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5787
5788 @item -Wstrict-overflow=5
5789 Also warn about cases where the compiler reduces the magnitude of a
5790 constant involved in a comparison. For example: @code{x + 2 > y} is
5791 simplified to @code{x + 1 >= y}. This is reported only at the
5792 highest warning level because this simplification applies to many
5793 comparisons, so this warning level gives a very large number of
5794 false positives.
5795 @end table
5796
5797 @item -Wstringop-overflow
5798 @itemx -Wstringop-overflow=@var{type}
5799 @opindex Wstringop-overflow
5800 @opindex Wno-stringop-overflow
5801 Warn for calls to string manipulation functions such as @code{memcpy} and
5802 @code{strcpy} that are determined to overflow the destination buffer. The
5803 optional argument is one greater than the type of Object Size Checking to
5804 perform to determine the size of the destination. @xref{Object Size Checking}.
5805 The argument is meaningful only for functions that operate on character arrays
5806 but not for raw memory functions like @code{memcpy} which always make use
5807 of Object Size type-0. The option also warns for calls that specify a size
5808 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5809 The option produces the best results with optimization enabled but can detect
5810 a small subset of simple buffer overflows even without optimization in
5811 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5812 correspond to the standard functions. In any case, the option warns about
5813 just a subset of buffer overflows detected by the corresponding overflow
5814 checking built-ins. For example, the option will issue a warning for
5815 the @code{strcpy} call below because it copies at least 5 characters
5816 (the string @code{"blue"} including the terminating NUL) into the buffer
5817 of size 4.
5818
5819 @smallexample
5820 enum Color @{ blue, purple, yellow @};
5821 const char* f (enum Color clr)
5822 @{
5823 static char buf [4];
5824 const char *str;
5825 switch (clr)
5826 @{
5827 case blue: str = "blue"; break;
5828 case purple: str = "purple"; break;
5829 case yellow: str = "yellow"; break;
5830 @}
5831
5832 return strcpy (buf, str); // warning here
5833 @}
5834 @end smallexample
5835
5836 Option @option{-Wstringop-overflow=2} is enabled by default.
5837
5838 @table @gcctabopt
5839 @item -Wstringop-overflow
5840 @itemx -Wstringop-overflow=1
5841 @opindex Wstringop-overflow
5842 @opindex Wno-stringop-overflow
5843 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5844 to determine the sizes of destination objects. This is the default setting
5845 of the option. At this setting the option will not warn for writes past
5846 the end of subobjects of larger objects accessed by pointers unless the
5847 size of the largest surrounding object is known. When the destination may
5848 be one of several objects it is assumed to be the largest one of them. On
5849 Linux systems, when optimization is enabled at this setting the option warns
5850 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5851 a non-zero value.
5852
5853 @item -Wstringop-overflow=2
5854 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5855 to determine the sizes of destination objects. At this setting the option
5856 will warn about overflows when writing to members of the largest complete
5857 objects whose exact size is known. It will, however, not warn for excessive
5858 writes to the same members of unknown objects referenced by pointers since
5859 they may point to arrays containing unknown numbers of elements.
5860
5861 @item -Wstringop-overflow=3
5862 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5863 to determine the sizes of destination objects. At this setting the option
5864 warns about overflowing the smallest object or data member. This is the
5865 most restrictive setting of the option that may result in warnings for safe
5866 code.
5867
5868 @item -Wstringop-overflow=4
5869 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5870 to determine the sizes of destination objects. At this setting the option
5871 will warn about overflowing any data members, and when the destination is
5872 one of several objects it uses the size of the largest of them to decide
5873 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5874 setting of the option may result in warnings for benign code.
5875 @end table
5876
5877 @item -Wstringop-truncation
5878 @opindex Wstringop-truncation
5879 @opindex Wno-stringop-truncation
5880 Warn for calls to bounded string manipulation functions such as @code{strncat},
5881 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5882 or leave the destination unchanged.
5883
5884 In the following example, the call to @code{strncat} specifies a bound that
5885 is less than the length of the source string. As a result, the copy of
5886 the source will be truncated and so the call is diagnosed. To avoid the
5887 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5888
5889 @smallexample
5890 void append (char *buf, size_t bufsize)
5891 @{
5892 strncat (buf, ".txt", 3);
5893 @}
5894 @end smallexample
5895
5896 As another example, the following call to @code{strncpy} results in copying
5897 to @code{d} just the characters preceding the terminating NUL, without
5898 appending the NUL to the end. Assuming the result of @code{strncpy} is
5899 necessarily a NUL-terminated string is a common mistake, and so the call
5900 is diagnosed. To avoid the warning when the result is not expected to be
5901 NUL-terminated, call @code{memcpy} instead.
5902
5903 @smallexample
5904 void copy (char *d, const char *s)
5905 @{
5906 strncpy (d, s, strlen (s));
5907 @}
5908 @end smallexample
5909
5910 In the following example, the call to @code{strncpy} specifies the size
5911 of the destination buffer as the bound. If the length of the source
5912 string is equal to or greater than this size the result of the copy will
5913 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5914 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5915 element of the buffer to @code{NUL}.
5916
5917 @smallexample
5918 void copy (const char *s)
5919 @{
5920 char buf[80];
5921 strncpy (buf, s, sizeof buf);
5922 @dots{}
5923 @}
5924 @end smallexample
5925
5926 In situations where a character array is intended to store a sequence
5927 of bytes with no terminating @code{NUL} such an array may be annotated
5928 with attribute @code{nonstring} to avoid this warning. Such arrays,
5929 however, are not suitable arguments to functions that expect
5930 @code{NUL}-terminated strings. To help detect accidental misuses of
5931 such arrays GCC issues warnings unless it can prove that the use is
5932 safe. @xref{Common Variable Attributes}.
5933
5934 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5935 @opindex Wsuggest-attribute=
5936 @opindex Wno-suggest-attribute=
5937 Warn for cases where adding an attribute may be beneficial. The
5938 attributes currently supported are listed below.
5939
5940 @table @gcctabopt
5941 @item -Wsuggest-attribute=pure
5942 @itemx -Wsuggest-attribute=const
5943 @itemx -Wsuggest-attribute=noreturn
5944 @itemx -Wmissing-noreturn
5945 @itemx -Wsuggest-attribute=malloc
5946 @opindex Wsuggest-attribute=pure
5947 @opindex Wno-suggest-attribute=pure
5948 @opindex Wsuggest-attribute=const
5949 @opindex Wno-suggest-attribute=const
5950 @opindex Wsuggest-attribute=noreturn
5951 @opindex Wno-suggest-attribute=noreturn
5952 @opindex Wmissing-noreturn
5953 @opindex Wno-missing-noreturn
5954 @opindex Wsuggest-attribute=malloc
5955 @opindex Wno-suggest-attribute=malloc
5956
5957 Warn about functions that might be candidates for attributes
5958 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5959 only warns for functions visible in other compilation units or (in the case of
5960 @code{pure} and @code{const}) if it cannot prove that the function returns
5961 normally. A function returns normally if it doesn't contain an infinite loop or
5962 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5963 requires option @option{-fipa-pure-const}, which is enabled by default at
5964 @option{-O} and higher. Higher optimization levels improve the accuracy
5965 of the analysis.
5966
5967 @item -Wsuggest-attribute=format
5968 @itemx -Wmissing-format-attribute
5969 @opindex Wsuggest-attribute=format
5970 @opindex Wmissing-format-attribute
5971 @opindex Wno-suggest-attribute=format
5972 @opindex Wno-missing-format-attribute
5973 @opindex Wformat
5974 @opindex Wno-format
5975
5976 Warn about function pointers that might be candidates for @code{format}
5977 attributes. Note these are only possible candidates, not absolute ones.
5978 GCC guesses that function pointers with @code{format} attributes that
5979 are used in assignment, initialization, parameter passing or return
5980 statements should have a corresponding @code{format} attribute in the
5981 resulting type. I.e.@: the left-hand side of the assignment or
5982 initialization, the type of the parameter variable, or the return type
5983 of the containing function respectively should also have a @code{format}
5984 attribute to avoid the warning.
5985
5986 GCC also warns about function definitions that might be
5987 candidates for @code{format} attributes. Again, these are only
5988 possible candidates. GCC guesses that @code{format} attributes
5989 might be appropriate for any function that calls a function like
5990 @code{vprintf} or @code{vscanf}, but this might not always be the
5991 case, and some functions for which @code{format} attributes are
5992 appropriate may not be detected.
5993
5994 @item -Wsuggest-attribute=cold
5995 @opindex Wsuggest-attribute=cold
5996 @opindex Wno-suggest-attribute=cold
5997
5998 Warn about functions that might be candidates for @code{cold} attribute. This
5999 is based on static detection and generally will only warn about functions which
6000 always leads to a call to another @code{cold} function such as wrappers of
6001 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6002 @end table
6003
6004 @item -Wsuggest-final-types
6005 @opindex Wno-suggest-final-types
6006 @opindex Wsuggest-final-types
6007 Warn about types with virtual methods where code quality would be improved
6008 if the type were declared with the C++11 @code{final} specifier,
6009 or, if possible,
6010 declared in an anonymous namespace. This allows GCC to more aggressively
6011 devirtualize the polymorphic calls. This warning is more effective with
6012 link-time optimization,
6013 where the information about the class hierarchy graph is
6014 more complete.
6015
6016 @item -Wsuggest-final-methods
6017 @opindex Wno-suggest-final-methods
6018 @opindex Wsuggest-final-methods
6019 Warn about virtual methods where code quality would be improved if the method
6020 were declared with the C++11 @code{final} specifier,
6021 or, if possible, its type were
6022 declared in an anonymous namespace or with the @code{final} specifier.
6023 This warning is
6024 more effective with link-time optimization, where the information about the
6025 class hierarchy graph is more complete. It is recommended to first consider
6026 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6027 annotations.
6028
6029 @item -Wsuggest-override
6030 Warn about overriding virtual functions that are not marked with the override
6031 keyword.
6032
6033 @item -Walloc-zero
6034 @opindex Wno-alloc-zero
6035 @opindex Walloc-zero
6036 Warn about calls to allocation functions decorated with attribute
6037 @code{alloc_size} that specify zero bytes, including those to the built-in
6038 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6039 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6040 when called with a zero size differs among implementations (and in the case
6041 of @code{realloc} has been deprecated) relying on it may result in subtle
6042 portability bugs and should be avoided.
6043
6044 @item -Walloc-size-larger-than=@var{byte-size}
6045 @opindex Walloc-size-larger-than=
6046 @opindex Wno-alloc-size-larger-than
6047 Warn about calls to functions decorated with attribute @code{alloc_size}
6048 that attempt to allocate objects larger than the specified number of bytes,
6049 or where the result of the size computation in an integer type with infinite
6050 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6051 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6052 Warnings controlled by the option can be disabled either by specifying
6053 @var{byte-size} of @samp{SIZE_MAX} or more or by
6054 @option{-Wno-alloc-size-larger-than}.
6055 @xref{Function Attributes}.
6056
6057 @item -Wno-alloc-size-larger-than
6058 @opindex Wno-alloc-size-larger-than
6059 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6060 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6061 larger.
6062
6063 @item -Walloca
6064 @opindex Wno-alloca
6065 @opindex Walloca
6066 This option warns on all uses of @code{alloca} in the source.
6067
6068 @item -Walloca-larger-than=@var{byte-size}
6069 @opindex Walloca-larger-than=
6070 @opindex Wno-alloca-larger-than
6071 This option warns on calls to @code{alloca} with an integer argument whose
6072 value is either zero, or that is not bounded by a controlling predicate
6073 that limits its value to at most @var{byte-size}. It also warns for calls
6074 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6075 types are considered unbounded even if they appear to be constrained to
6076 the expected range.
6077
6078 For example, a bounded case of @code{alloca} could be:
6079
6080 @smallexample
6081 void func (size_t n)
6082 @{
6083 void *p;
6084 if (n <= 1000)
6085 p = alloca (n);
6086 else
6087 p = malloc (n);
6088 f (p);
6089 @}
6090 @end smallexample
6091
6092 In the above example, passing @code{-Walloca-larger-than=1000} would not
6093 issue a warning because the call to @code{alloca} is known to be at most
6094 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6095 the compiler would emit a warning.
6096
6097 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6098 controlling predicate constraining its integer argument. For example:
6099
6100 @smallexample
6101 void func ()
6102 @{
6103 void *p = alloca (n);
6104 f (p);
6105 @}
6106 @end smallexample
6107
6108 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6109 a warning, but this time because of the lack of bounds checking.
6110
6111 Note, that even seemingly correct code involving signed integers could
6112 cause a warning:
6113
6114 @smallexample
6115 void func (signed int n)
6116 @{
6117 if (n < 500)
6118 @{
6119 p = alloca (n);
6120 f (p);
6121 @}
6122 @}
6123 @end smallexample
6124
6125 In the above example, @var{n} could be negative, causing a larger than
6126 expected argument to be implicitly cast into the @code{alloca} call.
6127
6128 This option also warns when @code{alloca} is used in a loop.
6129
6130 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6131 but is usually only effective when @option{-ftree-vrp} is active (default
6132 for @option{-O2} and above).
6133
6134 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6135
6136 @item -Wno-alloca-larger-than
6137 @opindex Wno-alloca-larger-than
6138 Disable @option{-Walloca-larger-than=} warnings. The option is
6139 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6140
6141 @item -Warray-bounds
6142 @itemx -Warray-bounds=@var{n}
6143 @opindex Wno-array-bounds
6144 @opindex Warray-bounds
6145 This option is only active when @option{-ftree-vrp} is active
6146 (default for @option{-O2} and above). It warns about subscripts to arrays
6147 that are always out of bounds. This warning is enabled by @option{-Wall}.
6148
6149 @table @gcctabopt
6150 @item -Warray-bounds=1
6151 This is the warning level of @option{-Warray-bounds} and is enabled
6152 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6153
6154 @item -Warray-bounds=2
6155 This warning level also warns about out of bounds access for
6156 arrays at the end of a struct and for arrays accessed through
6157 pointers. This warning level may give a larger number of
6158 false positives and is deactivated by default.
6159 @end table
6160
6161 @item -Wattribute-alias=@var{n}
6162 @itemx -Wno-attribute-alias
6163 @opindex Wattribute-alias
6164 @opindex Wno-attribute-alias
6165 Warn about declarations using the @code{alias} and similar attributes whose
6166 target is incompatible with the type of the alias.
6167 @xref{Function Attributes,,Declaring Attributes of Functions}.
6168
6169 @table @gcctabopt
6170 @item -Wattribute-alias=1
6171 The default warning level of the @option{-Wattribute-alias} option diagnoses
6172 incompatibilities between the type of the alias declaration and that of its
6173 target. Such incompatibilities are typically indicative of bugs.
6174
6175 @item -Wattribute-alias=2
6176
6177 At this level @option{-Wattribute-alias} also diagnoses cases where
6178 the attributes of the alias declaration are more restrictive than the
6179 attributes applied to its target. These mismatches can potentially
6180 result in incorrect code generation. In other cases they may be
6181 benign and could be resolved simply by adding the missing attribute to
6182 the target. For comparison, see the @option{-Wmissing-attributes}
6183 option, which controls diagnostics when the alias declaration is less
6184 restrictive than the target, rather than more restrictive.
6185
6186 Attributes considered include @code{alloc_align}, @code{alloc_size},
6187 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6188 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6189 @code{returns_nonnull}, and @code{returns_twice}.
6190 @end table
6191
6192 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6193 This is the default. You can disable these warnings with either
6194 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6195
6196 @item -Wbool-compare
6197 @opindex Wno-bool-compare
6198 @opindex Wbool-compare
6199 Warn about boolean expression compared with an integer value different from
6200 @code{true}/@code{false}. For instance, the following comparison is
6201 always false:
6202 @smallexample
6203 int n = 5;
6204 @dots{}
6205 if ((n > 1) == 2) @{ @dots{} @}
6206 @end smallexample
6207 This warning is enabled by @option{-Wall}.
6208
6209 @item -Wbool-operation
6210 @opindex Wno-bool-operation
6211 @opindex Wbool-operation
6212 Warn about suspicious operations on expressions of a boolean type. For
6213 instance, bitwise negation of a boolean is very likely a bug in the program.
6214 For C, this warning also warns about incrementing or decrementing a boolean,
6215 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6216 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6217
6218 This warning is enabled by @option{-Wall}.
6219
6220 @item -Wduplicated-branches
6221 @opindex Wno-duplicated-branches
6222 @opindex Wduplicated-branches
6223 Warn when an if-else has identical branches. This warning detects cases like
6224 @smallexample
6225 if (p != NULL)
6226 return 0;
6227 else
6228 return 0;
6229 @end smallexample
6230 It doesn't warn when both branches contain just a null statement. This warning
6231 also warn for conditional operators:
6232 @smallexample
6233 int i = x ? *p : *p;
6234 @end smallexample
6235
6236 @item -Wduplicated-cond
6237 @opindex Wno-duplicated-cond
6238 @opindex Wduplicated-cond
6239 Warn about duplicated conditions in an if-else-if chain. For instance,
6240 warn for the following code:
6241 @smallexample
6242 if (p->q != NULL) @{ @dots{} @}
6243 else if (p->q != NULL) @{ @dots{} @}
6244 @end smallexample
6245
6246 @item -Wframe-address
6247 @opindex Wno-frame-address
6248 @opindex Wframe-address
6249 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6250 is called with an argument greater than 0. Such calls may return indeterminate
6251 values or crash the program. The warning is included in @option{-Wall}.
6252
6253 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6254 @opindex Wno-discarded-qualifiers
6255 @opindex Wdiscarded-qualifiers
6256 Do not warn if type qualifiers on pointers are being discarded.
6257 Typically, the compiler warns if a @code{const char *} variable is
6258 passed to a function that takes a @code{char *} parameter. This option
6259 can be used to suppress such a warning.
6260
6261 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6262 @opindex Wno-discarded-array-qualifiers
6263 @opindex Wdiscarded-array-qualifiers
6264 Do not warn if type qualifiers on arrays which are pointer targets
6265 are being discarded. Typically, the compiler warns if a
6266 @code{const int (*)[]} variable is passed to a function that
6267 takes a @code{int (*)[]} parameter. This option can be used to
6268 suppress such a warning.
6269
6270 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6271 @opindex Wno-incompatible-pointer-types
6272 @opindex Wincompatible-pointer-types
6273 Do not warn when there is a conversion between pointers that have incompatible
6274 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6275 which warns for pointer argument passing or assignment with different
6276 signedness.
6277
6278 @item -Wno-int-conversion @r{(C and Objective-C only)}
6279 @opindex Wno-int-conversion
6280 @opindex Wint-conversion
6281 Do not warn about incompatible integer to pointer and pointer to integer
6282 conversions. This warning is about implicit conversions; for explicit
6283 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6284 @option{-Wno-pointer-to-int-cast} may be used.
6285
6286 @item -Wno-div-by-zero
6287 @opindex Wno-div-by-zero
6288 @opindex Wdiv-by-zero
6289 Do not warn about compile-time integer division by zero. Floating-point
6290 division by zero is not warned about, as it can be a legitimate way of
6291 obtaining infinities and NaNs.
6292
6293 @item -Wsystem-headers
6294 @opindex Wsystem-headers
6295 @opindex Wno-system-headers
6296 @cindex warnings from system headers
6297 @cindex system headers, warnings from
6298 Print warning messages for constructs found in system header files.
6299 Warnings from system headers are normally suppressed, on the assumption
6300 that they usually do not indicate real problems and would only make the
6301 compiler output harder to read. Using this command-line option tells
6302 GCC to emit warnings from system headers as if they occurred in user
6303 code. However, note that using @option{-Wall} in conjunction with this
6304 option does @emph{not} warn about unknown pragmas in system
6305 headers---for that, @option{-Wunknown-pragmas} must also be used.
6306
6307 @item -Wtautological-compare
6308 @opindex Wtautological-compare
6309 @opindex Wno-tautological-compare
6310 Warn if a self-comparison always evaluates to true or false. This
6311 warning detects various mistakes such as:
6312 @smallexample
6313 int i = 1;
6314 @dots{}
6315 if (i > i) @{ @dots{} @}
6316 @end smallexample
6317
6318 This warning also warns about bitwise comparisons that always evaluate
6319 to true or false, for instance:
6320 @smallexample
6321 if ((a & 16) == 10) @{ @dots{} @}
6322 @end smallexample
6323 will always be false.
6324
6325 This warning is enabled by @option{-Wall}.
6326
6327 @item -Wtrampolines
6328 @opindex Wtrampolines
6329 @opindex Wno-trampolines
6330 Warn about trampolines generated for pointers to nested functions.
6331 A trampoline is a small piece of data or code that is created at run
6332 time on the stack when the address of a nested function is taken, and is
6333 used to call the nested function indirectly. For some targets, it is
6334 made up of data only and thus requires no special treatment. But, for
6335 most targets, it is made up of code and thus requires the stack to be
6336 made executable in order for the program to work properly.
6337
6338 @item -Wfloat-equal
6339 @opindex Wfloat-equal
6340 @opindex Wno-float-equal
6341 Warn if floating-point values are used in equality comparisons.
6342
6343 The idea behind this is that sometimes it is convenient (for the
6344 programmer) to consider floating-point values as approximations to
6345 infinitely precise real numbers. If you are doing this, then you need
6346 to compute (by analyzing the code, or in some other way) the maximum or
6347 likely maximum error that the computation introduces, and allow for it
6348 when performing comparisons (and when producing output, but that's a
6349 different problem). In particular, instead of testing for equality, you
6350 should check to see whether the two values have ranges that overlap; and
6351 this is done with the relational operators, so equality comparisons are
6352 probably mistaken.
6353
6354 @item -Wtraditional @r{(C and Objective-C only)}
6355 @opindex Wtraditional
6356 @opindex Wno-traditional
6357 Warn about certain constructs that behave differently in traditional and
6358 ISO C@. Also warn about ISO C constructs that have no traditional C
6359 equivalent, and/or problematic constructs that should be avoided.
6360
6361 @itemize @bullet
6362 @item
6363 Macro parameters that appear within string literals in the macro body.
6364 In traditional C macro replacement takes place within string literals,
6365 but in ISO C it does not.
6366
6367 @item
6368 In traditional C, some preprocessor directives did not exist.
6369 Traditional preprocessors only considered a line to be a directive
6370 if the @samp{#} appeared in column 1 on the line. Therefore
6371 @option{-Wtraditional} warns about directives that traditional C
6372 understands but ignores because the @samp{#} does not appear as the
6373 first character on the line. It also suggests you hide directives like
6374 @code{#pragma} not understood by traditional C by indenting them. Some
6375 traditional implementations do not recognize @code{#elif}, so this option
6376 suggests avoiding it altogether.
6377
6378 @item
6379 A function-like macro that appears without arguments.
6380
6381 @item
6382 The unary plus operator.
6383
6384 @item
6385 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6386 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6387 constants.) Note, these suffixes appear in macros defined in the system
6388 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6389 Use of these macros in user code might normally lead to spurious
6390 warnings, however GCC's integrated preprocessor has enough context to
6391 avoid warning in these cases.
6392
6393 @item
6394 A function declared external in one block and then used after the end of
6395 the block.
6396
6397 @item
6398 A @code{switch} statement has an operand of type @code{long}.
6399
6400 @item
6401 A non-@code{static} function declaration follows a @code{static} one.
6402 This construct is not accepted by some traditional C compilers.
6403
6404 @item
6405 The ISO type of an integer constant has a different width or
6406 signedness from its traditional type. This warning is only issued if
6407 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6408 typically represent bit patterns, are not warned about.
6409
6410 @item
6411 Usage of ISO string concatenation is detected.
6412
6413 @item
6414 Initialization of automatic aggregates.
6415
6416 @item
6417 Identifier conflicts with labels. Traditional C lacks a separate
6418 namespace for labels.
6419
6420 @item
6421 Initialization of unions. If the initializer is zero, the warning is
6422 omitted. This is done under the assumption that the zero initializer in
6423 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6424 initializer warnings and relies on default initialization to zero in the
6425 traditional C case.
6426
6427 @item
6428 Conversions by prototypes between fixed/floating-point values and vice
6429 versa. The absence of these prototypes when compiling with traditional
6430 C causes serious problems. This is a subset of the possible
6431 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6432
6433 @item
6434 Use of ISO C style function definitions. This warning intentionally is
6435 @emph{not} issued for prototype declarations or variadic functions
6436 because these ISO C features appear in your code when using
6437 libiberty's traditional C compatibility macros, @code{PARAMS} and
6438 @code{VPARAMS}. This warning is also bypassed for nested functions
6439 because that feature is already a GCC extension and thus not relevant to
6440 traditional C compatibility.
6441 @end itemize
6442
6443 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6444 @opindex Wtraditional-conversion
6445 @opindex Wno-traditional-conversion
6446 Warn if a prototype causes a type conversion that is different from what
6447 would happen to the same argument in the absence of a prototype. This
6448 includes conversions of fixed point to floating and vice versa, and
6449 conversions changing the width or signedness of a fixed-point argument
6450 except when the same as the default promotion.
6451
6452 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6453 @opindex Wdeclaration-after-statement
6454 @opindex Wno-declaration-after-statement
6455 Warn when a declaration is found after a statement in a block. This
6456 construct, known from C++, was introduced with ISO C99 and is by default
6457 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6458
6459 @item -Wshadow
6460 @opindex Wshadow
6461 @opindex Wno-shadow
6462 Warn whenever a local variable or type declaration shadows another
6463 variable, parameter, type, class member (in C++), or instance variable
6464 (in Objective-C) or whenever a built-in function is shadowed. Note
6465 that in C++, the compiler warns if a local variable shadows an
6466 explicit typedef, but not if it shadows a struct/class/enum.
6467 Same as @option{-Wshadow=global}.
6468
6469 @item -Wno-shadow-ivar @r{(Objective-C only)}
6470 @opindex Wno-shadow-ivar
6471 @opindex Wshadow-ivar
6472 Do not warn whenever a local variable shadows an instance variable in an
6473 Objective-C method.
6474
6475 @item -Wshadow=global
6476 @opindex Wshadow=local
6477 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6478
6479 @item -Wshadow=local
6480 @opindex Wshadow=local
6481 Warn when a local variable shadows another local variable or parameter.
6482 This warning is enabled by @option{-Wshadow=global}.
6483
6484 @item -Wshadow=compatible-local
6485 @opindex Wshadow=compatible-local
6486 Warn when a local variable shadows another local variable or parameter
6487 whose type is compatible with that of the shadowing variable. In C++,
6488 type compatibility here means the type of the shadowing variable can be
6489 converted to that of the shadowed variable. The creation of this flag
6490 (in addition to @option{-Wshadow=local}) is based on the idea that when
6491 a local variable shadows another one of incompatible type, it is most
6492 likely intentional, not a bug or typo, as shown in the following example:
6493
6494 @smallexample
6495 @group
6496 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6497 @{
6498 for (int i = 0; i < N; ++i)
6499 @{
6500 ...
6501 @}
6502 ...
6503 @}
6504 @end group
6505 @end smallexample
6506
6507 Since the two variable @code{i} in the example above have incompatible types,
6508 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6509 Because their types are incompatible, if a programmer accidentally uses one
6510 in place of the other, type checking will catch that and emit an error or
6511 warning. So not warning (about shadowing) in this case will not lead to
6512 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6513 possibly reduce the number of warnings triggered by intentional shadowing.
6514
6515 This warning is enabled by @option{-Wshadow=local}.
6516
6517 @item -Wlarger-than=@var{byte-size}
6518 @opindex Wlarger-than=
6519 @opindex Wlarger-than-@var{byte-size}
6520 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6521 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6522 Warnings controlled by the option can be disabled either by specifying
6523 @var{byte-size} of @samp{SIZE_MAX} or more or by
6524 @option{-Wno-larger-than}.
6525
6526 @item -Wno-larger-than
6527 @opindex Wno-larger-than
6528 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6529 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6530
6531 @item -Wframe-larger-than=@var{byte-size}
6532 @opindex Wframe-larger-than=
6533 @opindex Wno-frame-larger-than
6534 Warn if the size of a function frame exceeds @var{byte-size}.
6535 The computation done to determine the stack frame size is approximate
6536 and not conservative.
6537 The actual requirements may be somewhat greater than @var{byte-size}
6538 even if you do not get a warning. In addition, any space allocated
6539 via @code{alloca}, variable-length arrays, or related constructs
6540 is not included by the compiler when determining
6541 whether or not to issue a warning.
6542 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6543 Warnings controlled by the option can be disabled either by specifying
6544 @var{byte-size} of @samp{SIZE_MAX} or more or by
6545 @option{-Wno-frame-larger-than}.
6546
6547 @item -Wno-frame-larger-than
6548 @opindex Wno-frame-larger-than
6549 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6550 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6551
6552 @item -Wno-free-nonheap-object
6553 @opindex Wno-free-nonheap-object
6554 @opindex Wfree-nonheap-object
6555 Do not warn when attempting to free an object that was not allocated
6556 on the heap.
6557
6558 @item -Wstack-usage=@var{byte-size}
6559 @opindex Wstack-usage
6560 @opindex Wno-stack-usage
6561 Warn if the stack usage of a function might exceed @var{byte-size}.
6562 The computation done to determine the stack usage is conservative.
6563 Any space allocated via @code{alloca}, variable-length arrays, or related
6564 constructs is included by the compiler when determining whether or not to
6565 issue a warning.
6566
6567 The message is in keeping with the output of @option{-fstack-usage}.
6568
6569 @itemize
6570 @item
6571 If the stack usage is fully static but exceeds the specified amount, it's:
6572
6573 @smallexample
6574 warning: stack usage is 1120 bytes
6575 @end smallexample
6576 @item
6577 If the stack usage is (partly) dynamic but bounded, it's:
6578
6579 @smallexample
6580 warning: stack usage might be 1648 bytes
6581 @end smallexample
6582 @item
6583 If the stack usage is (partly) dynamic and not bounded, it's:
6584
6585 @smallexample
6586 warning: stack usage might be unbounded
6587 @end smallexample
6588 @end itemize
6589
6590 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6591 Warnings controlled by the option can be disabled either by specifying
6592 @var{byte-size} of @samp{SIZE_MAX} or more or by
6593 @option{-Wno-stack-usage}.
6594
6595 @item -Wno-stack-usage
6596 @opindex Wno-stack-usage
6597 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6598 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6599
6600 @item -Wunsafe-loop-optimizations
6601 @opindex Wunsafe-loop-optimizations
6602 @opindex Wno-unsafe-loop-optimizations
6603 Warn if the loop cannot be optimized because the compiler cannot
6604 assume anything on the bounds of the loop indices. With
6605 @option{-funsafe-loop-optimizations} warn if the compiler makes
6606 such assumptions.
6607
6608 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6609 @opindex Wno-pedantic-ms-format
6610 @opindex Wpedantic-ms-format
6611 When used in combination with @option{-Wformat}
6612 and @option{-pedantic} without GNU extensions, this option
6613 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6614 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6615 which depend on the MS runtime.
6616
6617 @item -Waligned-new
6618 @opindex Waligned-new
6619 @opindex Wno-aligned-new
6620 Warn about a new-expression of a type that requires greater alignment
6621 than the @code{alignof(std::max_align_t)} but uses an allocation
6622 function without an explicit alignment parameter. This option is
6623 enabled by @option{-Wall}.
6624
6625 Normally this only warns about global allocation functions, but
6626 @option{-Waligned-new=all} also warns about class member allocation
6627 functions.
6628
6629 @item -Wplacement-new
6630 @itemx -Wplacement-new=@var{n}
6631 @opindex Wplacement-new
6632 @opindex Wno-placement-new
6633 Warn about placement new expressions with undefined behavior, such as
6634 constructing an object in a buffer that is smaller than the type of
6635 the object. For example, the placement new expression below is diagnosed
6636 because it attempts to construct an array of 64 integers in a buffer only
6637 64 bytes large.
6638 @smallexample
6639 char buf [64];
6640 new (buf) int[64];
6641 @end smallexample
6642 This warning is enabled by default.
6643
6644 @table @gcctabopt
6645 @item -Wplacement-new=1
6646 This is the default warning level of @option{-Wplacement-new}. At this
6647 level the warning is not issued for some strictly undefined constructs that
6648 GCC allows as extensions for compatibility with legacy code. For example,
6649 the following @code{new} expression is not diagnosed at this level even
6650 though it has undefined behavior according to the C++ standard because
6651 it writes past the end of the one-element array.
6652 @smallexample
6653 struct S @{ int n, a[1]; @};
6654 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6655 new (s->a)int [32]();
6656 @end smallexample
6657
6658 @item -Wplacement-new=2
6659 At this level, in addition to diagnosing all the same constructs as at level
6660 1, a diagnostic is also issued for placement new expressions that construct
6661 an object in the last member of structure whose type is an array of a single
6662 element and whose size is less than the size of the object being constructed.
6663 While the previous example would be diagnosed, the following construct makes
6664 use of the flexible member array extension to avoid the warning at level 2.
6665 @smallexample
6666 struct S @{ int n, a[]; @};
6667 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6668 new (s->a)int [32]();
6669 @end smallexample
6670
6671 @end table
6672
6673 @item -Wpointer-arith
6674 @opindex Wpointer-arith
6675 @opindex Wno-pointer-arith
6676 Warn about anything that depends on the ``size of'' a function type or
6677 of @code{void}. GNU C assigns these types a size of 1, for
6678 convenience in calculations with @code{void *} pointers and pointers
6679 to functions. In C++, warn also when an arithmetic operation involves
6680 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6681
6682 @item -Wpointer-compare
6683 @opindex Wpointer-compare
6684 @opindex Wno-pointer-compare
6685 Warn if a pointer is compared with a zero character constant. This usually
6686 means that the pointer was meant to be dereferenced. For example:
6687
6688 @smallexample
6689 const char *p = foo ();
6690 if (p == '\0')
6691 return 42;
6692 @end smallexample
6693
6694 Note that the code above is invalid in C++11.
6695
6696 This warning is enabled by default.
6697
6698 @item -Wtype-limits
6699 @opindex Wtype-limits
6700 @opindex Wno-type-limits
6701 Warn if a comparison is always true or always false due to the limited
6702 range of the data type, but do not warn for constant expressions. For
6703 example, warn if an unsigned variable is compared against zero with
6704 @code{<} or @code{>=}. This warning is also enabled by
6705 @option{-Wextra}.
6706
6707 @item -Wabsolute-value @r{(C and Objective-C only)}
6708 @opindex Wabsolute-value
6709 @opindex Wno-absolute-value
6710 Warn for calls to standard functions that compute the absolute value
6711 of an argument when a more appropriate standard function is available.
6712 For example, calling @code{abs(3.14)} triggers the warning because the
6713 appropriate function to call to compute the absolute value of a double
6714 argument is @code{fabs}. The option also triggers warnings when the
6715 argument in a call to such a function has an unsigned type. This
6716 warning can be suppressed with an explicit type cast and it is also
6717 enabled by @option{-Wextra}.
6718
6719 @include cppwarnopts.texi
6720
6721 @item -Wbad-function-cast @r{(C and Objective-C only)}
6722 @opindex Wbad-function-cast
6723 @opindex Wno-bad-function-cast
6724 Warn when a function call is cast to a non-matching type.
6725 For example, warn if a call to a function returning an integer type
6726 is cast to a pointer type.
6727
6728 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6729 @opindex Wc90-c99-compat
6730 @opindex Wno-c90-c99-compat
6731 Warn about features not present in ISO C90, but present in ISO C99.
6732 For instance, warn about use of variable length arrays, @code{long long}
6733 type, @code{bool} type, compound literals, designated initializers, and so
6734 on. This option is independent of the standards mode. Warnings are disabled
6735 in the expression that follows @code{__extension__}.
6736
6737 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6738 @opindex Wc99-c11-compat
6739 @opindex Wno-c99-c11-compat
6740 Warn about features not present in ISO C99, but present in ISO C11.
6741 For instance, warn about use of anonymous structures and unions,
6742 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6743 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6744 and so on. This option is independent of the standards mode. Warnings are
6745 disabled in the expression that follows @code{__extension__}.
6746
6747 @item -Wc++-compat @r{(C and Objective-C only)}
6748 @opindex Wc++-compat
6749 @opindex Wno-c++-compat
6750 Warn about ISO C constructs that are outside of the common subset of
6751 ISO C and ISO C++, e.g.@: request for implicit conversion from
6752 @code{void *} to a pointer to non-@code{void} type.
6753
6754 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6755 @opindex Wc++11-compat
6756 @opindex Wno-c++11-compat
6757 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6758 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6759 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6760 enabled by @option{-Wall}.
6761
6762 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6763 @opindex Wc++14-compat
6764 @opindex Wno-c++14-compat
6765 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6766 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6767
6768 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6769 @opindex Wc++17-compat
6770 @opindex Wno-c++17-compat
6771 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6772 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6773
6774 @item -Wcast-qual
6775 @opindex Wcast-qual
6776 @opindex Wno-cast-qual
6777 Warn whenever a pointer is cast so as to remove a type qualifier from
6778 the target type. For example, warn if a @code{const char *} is cast
6779 to an ordinary @code{char *}.
6780
6781 Also warn when making a cast that introduces a type qualifier in an
6782 unsafe way. For example, casting @code{char **} to @code{const char **}
6783 is unsafe, as in this example:
6784
6785 @smallexample
6786 /* p is char ** value. */
6787 const char **q = (const char **) p;
6788 /* Assignment of readonly string to const char * is OK. */
6789 *q = "string";
6790 /* Now char** pointer points to read-only memory. */
6791 **p = 'b';
6792 @end smallexample
6793
6794 @item -Wcast-align
6795 @opindex Wcast-align
6796 @opindex Wno-cast-align
6797 Warn whenever a pointer is cast such that the required alignment of the
6798 target is increased. For example, warn if a @code{char *} is cast to
6799 an @code{int *} on machines where integers can only be accessed at
6800 two- or four-byte boundaries.
6801
6802 @item -Wcast-align=strict
6803 @opindex Wcast-align=strict
6804 Warn whenever a pointer is cast such that the required alignment of the
6805 target is increased. For example, warn if a @code{char *} is cast to
6806 an @code{int *} regardless of the target machine.
6807
6808 @item -Wcast-function-type
6809 @opindex Wcast-function-type
6810 @opindex Wno-cast-function-type
6811 Warn when a function pointer is cast to an incompatible function pointer.
6812 In a cast involving function types with a variable argument list only
6813 the types of initial arguments that are provided are considered.
6814 Any parameter of pointer-type matches any other pointer-type. Any benign
6815 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6816 on ILP32 targets. Likewise type qualifiers are ignored. The function
6817 type @code{void (*) (void)} is special and matches everything, which can
6818 be used to suppress this warning.
6819 In a cast involving pointer to member types this warning warns whenever
6820 the type cast is changing the pointer to member type.
6821 This warning is enabled by @option{-Wextra}.
6822
6823 @item -Wwrite-strings
6824 @opindex Wwrite-strings
6825 @opindex Wno-write-strings
6826 When compiling C, give string constants the type @code{const
6827 char[@var{length}]} so that copying the address of one into a
6828 non-@code{const} @code{char *} pointer produces a warning. These
6829 warnings help you find at compile time code that can try to write
6830 into a string constant, but only if you have been very careful about
6831 using @code{const} in declarations and prototypes. Otherwise, it is
6832 just a nuisance. This is why we did not make @option{-Wall} request
6833 these warnings.
6834
6835 When compiling C++, warn about the deprecated conversion from string
6836 literals to @code{char *}. This warning is enabled by default for C++
6837 programs.
6838
6839 @item -Wcatch-value
6840 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6841 @opindex Wcatch-value
6842 @opindex Wno-catch-value
6843 Warn about catch handlers that do not catch via reference.
6844 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6845 warn about polymorphic class types that are caught by value.
6846 With @option{-Wcatch-value=2} warn about all class types that are caught
6847 by value. With @option{-Wcatch-value=3} warn about all types that are
6848 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6849
6850 @item -Wclobbered
6851 @opindex Wclobbered
6852 @opindex Wno-clobbered
6853 Warn for variables that might be changed by @code{longjmp} or
6854 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6855
6856 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6857 @opindex Wconditionally-supported
6858 @opindex Wno-conditionally-supported
6859 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6860
6861 @item -Wconversion
6862 @opindex Wconversion
6863 @opindex Wno-conversion
6864 Warn for implicit conversions that may alter a value. This includes
6865 conversions between real and integer, like @code{abs (x)} when
6866 @code{x} is @code{double}; conversions between signed and unsigned,
6867 like @code{unsigned ui = -1}; and conversions to smaller types, like
6868 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6869 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6870 changed by the conversion like in @code{abs (2.0)}. Warnings about
6871 conversions between signed and unsigned integers can be disabled by
6872 using @option{-Wno-sign-conversion}.
6873
6874 For C++, also warn for confusing overload resolution for user-defined
6875 conversions; and conversions that never use a type conversion
6876 operator: conversions to @code{void}, the same type, a base class or a
6877 reference to them. Warnings about conversions between signed and
6878 unsigned integers are disabled by default in C++ unless
6879 @option{-Wsign-conversion} is explicitly enabled.
6880
6881 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6882 @opindex Wconversion-null
6883 @opindex Wno-conversion-null
6884 Do not warn for conversions between @code{NULL} and non-pointer
6885 types. @option{-Wconversion-null} is enabled by default.
6886
6887 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6888 @opindex Wzero-as-null-pointer-constant
6889 @opindex Wno-zero-as-null-pointer-constant
6890 Warn when a literal @samp{0} is used as null pointer constant. This can
6891 be useful to facilitate the conversion to @code{nullptr} in C++11.
6892
6893 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6894 @opindex Wsubobject-linkage
6895 @opindex Wno-subobject-linkage
6896 Warn if a class type has a base or a field whose type uses the anonymous
6897 namespace or depends on a type with no linkage. If a type A depends on
6898 a type B with no or internal linkage, defining it in multiple
6899 translation units would be an ODR violation because the meaning of B
6900 is different in each translation unit. If A only appears in a single
6901 translation unit, the best way to silence the warning is to give it
6902 internal linkage by putting it in an anonymous namespace as well. The
6903 compiler doesn't give this warning for types defined in the main .C
6904 file, as those are unlikely to have multiple definitions.
6905 @option{-Wsubobject-linkage} is enabled by default.
6906
6907 @item -Wdangling-else
6908 @opindex Wdangling-else
6909 @opindex Wno-dangling-else
6910 Warn about constructions where there may be confusion to which
6911 @code{if} statement an @code{else} branch belongs. Here is an example of
6912 such a case:
6913
6914 @smallexample
6915 @group
6916 @{
6917 if (a)
6918 if (b)
6919 foo ();
6920 else
6921 bar ();
6922 @}
6923 @end group
6924 @end smallexample
6925
6926 In C/C++, every @code{else} branch belongs to the innermost possible
6927 @code{if} statement, which in this example is @code{if (b)}. This is
6928 often not what the programmer expected, as illustrated in the above
6929 example by indentation the programmer chose. When there is the
6930 potential for this confusion, GCC issues a warning when this flag
6931 is specified. To eliminate the warning, add explicit braces around
6932 the innermost @code{if} statement so there is no way the @code{else}
6933 can belong to the enclosing @code{if}. The resulting code
6934 looks like this:
6935
6936 @smallexample
6937 @group
6938 @{
6939 if (a)
6940 @{
6941 if (b)
6942 foo ();
6943 else
6944 bar ();
6945 @}
6946 @}
6947 @end group
6948 @end smallexample
6949
6950 This warning is enabled by @option{-Wparentheses}.
6951
6952 @item -Wdate-time
6953 @opindex Wdate-time
6954 @opindex Wno-date-time
6955 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6956 are encountered as they might prevent bit-wise-identical reproducible
6957 compilations.
6958
6959 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6960 @opindex Wdelete-incomplete
6961 @opindex Wno-delete-incomplete
6962 Warn when deleting a pointer to incomplete type, which may cause
6963 undefined behavior at runtime. This warning is enabled by default.
6964
6965 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6966 @opindex Wuseless-cast
6967 @opindex Wno-useless-cast
6968 Warn when an expression is casted to its own type.
6969
6970 @item -Wempty-body
6971 @opindex Wempty-body
6972 @opindex Wno-empty-body
6973 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6974 while} statement. This warning is also enabled by @option{-Wextra}.
6975
6976 @item -Wenum-compare
6977 @opindex Wenum-compare
6978 @opindex Wno-enum-compare
6979 Warn about a comparison between values of different enumerated types.
6980 In C++ enumerated type mismatches in conditional expressions are also
6981 diagnosed and the warning is enabled by default. In C this warning is
6982 enabled by @option{-Wall}.
6983
6984 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6985 @opindex Wextra-semi
6986 @opindex Wno-extra-semi
6987 Warn about redundant semicolon after in-class function definition.
6988
6989 @item -Wjump-misses-init @r{(C, Objective-C only)}
6990 @opindex Wjump-misses-init
6991 @opindex Wno-jump-misses-init
6992 Warn if a @code{goto} statement or a @code{switch} statement jumps
6993 forward across the initialization of a variable, or jumps backward to a
6994 label after the variable has been initialized. This only warns about
6995 variables that are initialized when they are declared. This warning is
6996 only supported for C and Objective-C; in C++ this sort of branch is an
6997 error in any case.
6998
6999 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7000 can be disabled with the @option{-Wno-jump-misses-init} option.
7001
7002 @item -Wsign-compare
7003 @opindex Wsign-compare
7004 @opindex Wno-sign-compare
7005 @cindex warning for comparison of signed and unsigned values
7006 @cindex comparison of signed and unsigned values, warning
7007 @cindex signed and unsigned values, comparison warning
7008 Warn when a comparison between signed and unsigned values could produce
7009 an incorrect result when the signed value is converted to unsigned.
7010 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7011 also enabled by @option{-Wextra}.
7012
7013 @item -Wsign-conversion
7014 @opindex Wsign-conversion
7015 @opindex Wno-sign-conversion
7016 Warn for implicit conversions that may change the sign of an integer
7017 value, like assigning a signed integer expression to an unsigned
7018 integer variable. An explicit cast silences the warning. In C, this
7019 option is enabled also by @option{-Wconversion}.
7020
7021 @item -Wfloat-conversion
7022 @opindex Wfloat-conversion
7023 @opindex Wno-float-conversion
7024 Warn for implicit conversions that reduce the precision of a real value.
7025 This includes conversions from real to integer, and from higher precision
7026 real to lower precision real values. This option is also enabled by
7027 @option{-Wconversion}.
7028
7029 @item -Wno-scalar-storage-order
7030 @opindex Wno-scalar-storage-order
7031 @opindex Wscalar-storage-order
7032 Do not warn on suspicious constructs involving reverse scalar storage order.
7033
7034 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7035 @opindex Wsized-deallocation
7036 @opindex Wno-sized-deallocation
7037 Warn about a definition of an unsized deallocation function
7038 @smallexample
7039 void operator delete (void *) noexcept;
7040 void operator delete[] (void *) noexcept;
7041 @end smallexample
7042 without a definition of the corresponding sized deallocation function
7043 @smallexample
7044 void operator delete (void *, std::size_t) noexcept;
7045 void operator delete[] (void *, std::size_t) noexcept;
7046 @end smallexample
7047 or vice versa. Enabled by @option{-Wextra} along with
7048 @option{-fsized-deallocation}.
7049
7050 @item -Wsizeof-pointer-div
7051 @opindex Wsizeof-pointer-div
7052 @opindex Wno-sizeof-pointer-div
7053 Warn for suspicious divisions of two sizeof expressions that divide
7054 the pointer size by the element size, which is the usual way to compute
7055 the array size but won't work out correctly with pointers. This warning
7056 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7057 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7058
7059 @item -Wsizeof-pointer-memaccess
7060 @opindex Wsizeof-pointer-memaccess
7061 @opindex Wno-sizeof-pointer-memaccess
7062 Warn for suspicious length parameters to certain string and memory built-in
7063 functions if the argument uses @code{sizeof}. This warning triggers for
7064 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7065 an array, but a pointer, and suggests a possible fix, or about
7066 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7067 also warns about calls to bounded string copy functions like @code{strncat}
7068 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7069 the source array. For example, in the following function the call to
7070 @code{strncat} specifies the size of the source string as the bound. That
7071 is almost certainly a mistake and so the call is diagnosed.
7072 @smallexample
7073 void make_file (const char *name)
7074 @{
7075 char path[PATH_MAX];
7076 strncpy (path, name, sizeof path - 1);
7077 strncat (path, ".text", sizeof ".text");
7078 @dots{}
7079 @}
7080 @end smallexample
7081
7082 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7083
7084 @item -Wsizeof-array-argument
7085 @opindex Wsizeof-array-argument
7086 @opindex Wno-sizeof-array-argument
7087 Warn when the @code{sizeof} operator is applied to a parameter that is
7088 declared as an array in a function definition. This warning is enabled by
7089 default for C and C++ programs.
7090
7091 @item -Wmemset-elt-size
7092 @opindex Wmemset-elt-size
7093 @opindex Wno-memset-elt-size
7094 Warn for suspicious calls to the @code{memset} built-in function, if the
7095 first argument references an array, and the third argument is a number
7096 equal to the number of elements, but not equal to the size of the array
7097 in memory. This indicates that the user has omitted a multiplication by
7098 the element size. This warning is enabled by @option{-Wall}.
7099
7100 @item -Wmemset-transposed-args
7101 @opindex Wmemset-transposed-args
7102 @opindex Wno-memset-transposed-args
7103 Warn for suspicious calls to the @code{memset} built-in function where
7104 the second argument is not zero and the third argument is zero. For
7105 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7106 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7107 is only emitted if the third argument is a literal zero. Otherwise, if
7108 it is an expression that is folded to zero, or a cast of zero to some
7109 type, it is far less likely that the arguments have been mistakenly
7110 transposed and no warning is emitted. This warning is enabled
7111 by @option{-Wall}.
7112
7113 @item -Waddress
7114 @opindex Waddress
7115 @opindex Wno-address
7116 Warn about suspicious uses of memory addresses. These include using
7117 the address of a function in a conditional expression, such as
7118 @code{void func(void); if (func)}, and comparisons against the memory
7119 address of a string literal, such as @code{if (x == "abc")}. Such
7120 uses typically indicate a programmer error: the address of a function
7121 always evaluates to true, so their use in a conditional usually
7122 indicate that the programmer forgot the parentheses in a function
7123 call; and comparisons against string literals result in unspecified
7124 behavior and are not portable in C, so they usually indicate that the
7125 programmer intended to use @code{strcmp}. This warning is enabled by
7126 @option{-Wall}.
7127
7128 @item -Waddress-of-packed-member
7129 @opindex Waddress-of-packed-member
7130 @opindex Wno-address-of-packed-member
7131 Warn when the address of packed member of struct or union is taken,
7132 which usually results in an unaligned pointer value. This is
7133 enabled by default.
7134
7135 @item -Wlogical-op
7136 @opindex Wlogical-op
7137 @opindex Wno-logical-op
7138 Warn about suspicious uses of logical operators in expressions.
7139 This includes using logical operators in contexts where a
7140 bit-wise operator is likely to be expected. Also warns when
7141 the operands of a logical operator are the same:
7142 @smallexample
7143 extern int a;
7144 if (a < 0 && a < 0) @{ @dots{} @}
7145 @end smallexample
7146
7147 @item -Wlogical-not-parentheses
7148 @opindex Wlogical-not-parentheses
7149 @opindex Wno-logical-not-parentheses
7150 Warn about logical not used on the left hand side operand of a comparison.
7151 This option does not warn if the right operand is considered to be a boolean
7152 expression. Its purpose is to detect suspicious code like the following:
7153 @smallexample
7154 int a;
7155 @dots{}
7156 if (!a > 1) @{ @dots{} @}
7157 @end smallexample
7158
7159 It is possible to suppress the warning by wrapping the LHS into
7160 parentheses:
7161 @smallexample
7162 if ((!a) > 1) @{ @dots{} @}
7163 @end smallexample
7164
7165 This warning is enabled by @option{-Wall}.
7166
7167 @item -Waggregate-return
7168 @opindex Waggregate-return
7169 @opindex Wno-aggregate-return
7170 Warn if any functions that return structures or unions are defined or
7171 called. (In languages where you can return an array, this also elicits
7172 a warning.)
7173
7174 @item -Wno-aggressive-loop-optimizations
7175 @opindex Wno-aggressive-loop-optimizations
7176 @opindex Waggressive-loop-optimizations
7177 Warn if in a loop with constant number of iterations the compiler detects
7178 undefined behavior in some statement during one or more of the iterations.
7179
7180 @item -Wno-attributes
7181 @opindex Wno-attributes
7182 @opindex Wattributes
7183 Do not warn if an unexpected @code{__attribute__} is used, such as
7184 unrecognized attributes, function attributes applied to variables,
7185 etc. This does not stop errors for incorrect use of supported
7186 attributes.
7187
7188 @item -Wno-builtin-declaration-mismatch
7189 @opindex Wno-builtin-declaration-mismatch
7190 @opindex Wbuiltin-declaration-mismatch
7191 Warn if a built-in function is declared with an incompatible signature
7192 or as a non-function, or when a built-in function declared with a type
7193 that does not include a prototype is called with arguments whose promoted
7194 types do not match those expected by the function. When @option{-Wextra}
7195 is specified, also warn when a built-in function that takes arguments is
7196 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7197 warning is enabled by default. To avoid the warning include the appropriate
7198 header to bring the prototypes of built-in functions into scope.
7199
7200 For example, the call to @code{memset} below is diagnosed by the warning
7201 because the function expects a value of type @code{size_t} as its argument
7202 but the type of @code{32} is @code{int}. With @option{-Wextra},
7203 the declaration of the function is diagnosed as well.
7204 @smallexample
7205 extern void* memset ();
7206 void f (void *d)
7207 @{
7208 memset (d, '\0', 32);
7209 @}
7210 @end smallexample
7211
7212 @item -Wno-builtin-macro-redefined
7213 @opindex Wno-builtin-macro-redefined
7214 @opindex Wbuiltin-macro-redefined
7215 Do not warn if certain built-in macros are redefined. This suppresses
7216 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7217 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7218
7219 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7220 @opindex Wstrict-prototypes
7221 @opindex Wno-strict-prototypes
7222 Warn if a function is declared or defined without specifying the
7223 argument types. (An old-style function definition is permitted without
7224 a warning if preceded by a declaration that specifies the argument
7225 types.)
7226
7227 @item -Wold-style-declaration @r{(C and Objective-C only)}
7228 @opindex Wold-style-declaration
7229 @opindex Wno-old-style-declaration
7230 Warn for obsolescent usages, according to the C Standard, in a
7231 declaration. For example, warn if storage-class specifiers like
7232 @code{static} are not the first things in a declaration. This warning
7233 is also enabled by @option{-Wextra}.
7234
7235 @item -Wold-style-definition @r{(C and Objective-C only)}
7236 @opindex Wold-style-definition
7237 @opindex Wno-old-style-definition
7238 Warn if an old-style function definition is used. A warning is given
7239 even if there is a previous prototype.
7240
7241 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7242 @opindex Wmissing-parameter-type
7243 @opindex Wno-missing-parameter-type
7244 A function parameter is declared without a type specifier in K&R-style
7245 functions:
7246
7247 @smallexample
7248 void foo(bar) @{ @}
7249 @end smallexample
7250
7251 This warning is also enabled by @option{-Wextra}.
7252
7253 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7254 @opindex Wmissing-prototypes
7255 @opindex Wno-missing-prototypes
7256 Warn if a global function is defined without a previous prototype
7257 declaration. This warning is issued even if the definition itself
7258 provides a prototype. Use this option to detect global functions
7259 that do not have a matching prototype declaration in a header file.
7260 This option is not valid for C++ because all function declarations
7261 provide prototypes and a non-matching declaration declares an
7262 overload rather than conflict with an earlier declaration.
7263 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7264
7265 @item -Wmissing-declarations
7266 @opindex Wmissing-declarations
7267 @opindex Wno-missing-declarations
7268 Warn if a global function is defined without a previous declaration.
7269 Do so even if the definition itself provides a prototype.
7270 Use this option to detect global functions that are not declared in
7271 header files. In C, no warnings are issued for functions with previous
7272 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7273 missing prototypes. In C++, no warnings are issued for function templates,
7274 or for inline functions, or for functions in anonymous namespaces.
7275
7276 @item -Wmissing-field-initializers
7277 @opindex Wmissing-field-initializers
7278 @opindex Wno-missing-field-initializers
7279 @opindex W
7280 @opindex Wextra
7281 @opindex Wno-extra
7282 Warn if a structure's initializer has some fields missing. For
7283 example, the following code causes such a warning, because
7284 @code{x.h} is implicitly zero:
7285
7286 @smallexample
7287 struct s @{ int f, g, h; @};
7288 struct s x = @{ 3, 4 @};
7289 @end smallexample
7290
7291 This option does not warn about designated initializers, so the following
7292 modification does not trigger a warning:
7293
7294 @smallexample
7295 struct s @{ int f, g, h; @};
7296 struct s x = @{ .f = 3, .g = 4 @};
7297 @end smallexample
7298
7299 In C this option does not warn about the universal zero initializer
7300 @samp{@{ 0 @}}:
7301
7302 @smallexample
7303 struct s @{ int f, g, h; @};
7304 struct s x = @{ 0 @};
7305 @end smallexample
7306
7307 Likewise, in C++ this option does not warn about the empty @{ @}
7308 initializer, for example:
7309
7310 @smallexample
7311 struct s @{ int f, g, h; @};
7312 s x = @{ @};
7313 @end smallexample
7314
7315 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7316 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7317
7318 @item -Wno-multichar
7319 @opindex Wno-multichar
7320 @opindex Wmultichar
7321 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7322 Usually they indicate a typo in the user's code, as they have
7323 implementation-defined values, and should not be used in portable code.
7324
7325 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7326 @opindex Wnormalized=
7327 @opindex Wnormalized
7328 @opindex Wno-normalized
7329 @cindex NFC
7330 @cindex NFKC
7331 @cindex character set, input normalization
7332 In ISO C and ISO C++, two identifiers are different if they are
7333 different sequences of characters. However, sometimes when characters
7334 outside the basic ASCII character set are used, you can have two
7335 different character sequences that look the same. To avoid confusion,
7336 the ISO 10646 standard sets out some @dfn{normalization rules} which
7337 when applied ensure that two sequences that look the same are turned into
7338 the same sequence. GCC can warn you if you are using identifiers that
7339 have not been normalized; this option controls that warning.
7340
7341 There are four levels of warning supported by GCC@. The default is
7342 @option{-Wnormalized=nfc}, which warns about any identifier that is
7343 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7344 recommended form for most uses. It is equivalent to
7345 @option{-Wnormalized}.
7346
7347 Unfortunately, there are some characters allowed in identifiers by
7348 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7349 identifiers. That is, there's no way to use these symbols in portable
7350 ISO C or C++ and have all your identifiers in NFC@.
7351 @option{-Wnormalized=id} suppresses the warning for these characters.
7352 It is hoped that future versions of the standards involved will correct
7353 this, which is why this option is not the default.
7354
7355 You can switch the warning off for all characters by writing
7356 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7357 only do this if you are using some other normalization scheme (like
7358 ``D''), because otherwise you can easily create bugs that are
7359 literally impossible to see.
7360
7361 Some characters in ISO 10646 have distinct meanings but look identical
7362 in some fonts or display methodologies, especially once formatting has
7363 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7364 LETTER N'', displays just like a regular @code{n} that has been
7365 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7366 normalization scheme to convert all these into a standard form as
7367 well, and GCC warns if your code is not in NFKC if you use
7368 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7369 about every identifier that contains the letter O because it might be
7370 confused with the digit 0, and so is not the default, but may be
7371 useful as a local coding convention if the programming environment
7372 cannot be fixed to display these characters distinctly.
7373
7374 @item -Wno-attribute-warning
7375 @opindex Wno-attribute-warning
7376 @opindex Wattribute-warning
7377 Do not warn about usage of functions (@pxref{Function Attributes})
7378 declared with @code{warning} attribute. By default, this warning is
7379 enabled. @option{-Wno-attribute-warning} can be used to disable the
7380 warning or @option{-Wno-error=attribute-warning} can be used to
7381 disable the error when compiled with @option{-Werror} flag.
7382
7383 @item -Wno-deprecated
7384 @opindex Wno-deprecated
7385 @opindex Wdeprecated
7386 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7387
7388 @item -Wno-deprecated-declarations
7389 @opindex Wno-deprecated-declarations
7390 @opindex Wdeprecated-declarations
7391 Do not warn about uses of functions (@pxref{Function Attributes}),
7392 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7393 Attributes}) marked as deprecated by using the @code{deprecated}
7394 attribute.
7395
7396 @item -Wno-overflow
7397 @opindex Wno-overflow
7398 @opindex Woverflow
7399 Do not warn about compile-time overflow in constant expressions.
7400
7401 @item -Wno-odr
7402 @opindex Wno-odr
7403 @opindex Wodr
7404 Warn about One Definition Rule violations during link-time optimization.
7405 Enabled by default.
7406
7407 @item -Wopenmp-simd
7408 @opindex Wopenmp-simd
7409 @opindex Wno-openmp-simd
7410 Warn if the vectorizer cost model overrides the OpenMP
7411 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7412 option can be used to relax the cost model.
7413
7414 @item -Woverride-init @r{(C and Objective-C only)}
7415 @opindex Woverride-init
7416 @opindex Wno-override-init
7417 @opindex W
7418 @opindex Wextra
7419 @opindex Wno-extra
7420 Warn if an initialized field without side effects is overridden when
7421 using designated initializers (@pxref{Designated Inits, , Designated
7422 Initializers}).
7423
7424 This warning is included in @option{-Wextra}. To get other
7425 @option{-Wextra} warnings without this one, use @option{-Wextra
7426 -Wno-override-init}.
7427
7428 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7429 @opindex Woverride-init-side-effects
7430 @opindex Wno-override-init-side-effects
7431 Warn if an initialized field with side effects is overridden when
7432 using designated initializers (@pxref{Designated Inits, , Designated
7433 Initializers}). This warning is enabled by default.
7434
7435 @item -Wpacked
7436 @opindex Wpacked
7437 @opindex Wno-packed
7438 Warn if a structure is given the packed attribute, but the packed
7439 attribute has no effect on the layout or size of the structure.
7440 Such structures may be mis-aligned for little benefit. For
7441 instance, in this code, the variable @code{f.x} in @code{struct bar}
7442 is misaligned even though @code{struct bar} does not itself
7443 have the packed attribute:
7444
7445 @smallexample
7446 @group
7447 struct foo @{
7448 int x;
7449 char a, b, c, d;
7450 @} __attribute__((packed));
7451 struct bar @{
7452 char z;
7453 struct foo f;
7454 @};
7455 @end group
7456 @end smallexample
7457
7458 @item -Wpacked-bitfield-compat
7459 @opindex Wpacked-bitfield-compat
7460 @opindex Wno-packed-bitfield-compat
7461 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7462 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7463 the change can lead to differences in the structure layout. GCC
7464 informs you when the offset of such a field has changed in GCC 4.4.
7465 For example there is no longer a 4-bit padding between field @code{a}
7466 and @code{b} in this structure:
7467
7468 @smallexample
7469 struct foo
7470 @{
7471 char a:4;
7472 char b:8;
7473 @} __attribute__ ((packed));
7474 @end smallexample
7475
7476 This warning is enabled by default. Use
7477 @option{-Wno-packed-bitfield-compat} to disable this warning.
7478
7479 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7480 @opindex Wpacked-not-aligned
7481 @opindex Wno-packed-not-aligned
7482 Warn if a structure field with explicitly specified alignment in a
7483 packed struct or union is misaligned. For example, a warning will
7484 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7485 'struct S' is less than 8}, in this code:
7486
7487 @smallexample
7488 @group
7489 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7490 struct __attribute__ ((packed)) S @{
7491 struct S8 s8;
7492 @};
7493 @end group
7494 @end smallexample
7495
7496 This warning is enabled by @option{-Wall}.
7497
7498 @item -Wpadded
7499 @opindex Wpadded
7500 @opindex Wno-padded
7501 Warn if padding is included in a structure, either to align an element
7502 of the structure or to align the whole structure. Sometimes when this
7503 happens it is possible to rearrange the fields of the structure to
7504 reduce the padding and so make the structure smaller.
7505
7506 @item -Wredundant-decls
7507 @opindex Wredundant-decls
7508 @opindex Wno-redundant-decls
7509 Warn if anything is declared more than once in the same scope, even in
7510 cases where multiple declaration is valid and changes nothing.
7511
7512 @item -Wno-restrict
7513 @opindex Wrestrict
7514 @opindex Wno-restrict
7515 Warn when an object referenced by a @code{restrict}-qualified parameter
7516 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7517 argument, or when copies between such objects overlap. For example,
7518 the call to the @code{strcpy} function below attempts to truncate the string
7519 by replacing its initial characters with the last four. However, because
7520 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7521 the call is diagnosed.
7522
7523 @smallexample
7524 void foo (void)
7525 @{
7526 char a[] = "abcd1234";
7527 strcpy (a, a + 4);
7528 @dots{}
7529 @}
7530 @end smallexample
7531 The @option{-Wrestrict} option detects some instances of simple overlap
7532 even without optimization but works best at @option{-O2} and above. It
7533 is included in @option{-Wall}.
7534
7535 @item -Wnested-externs @r{(C and Objective-C only)}
7536 @opindex Wnested-externs
7537 @opindex Wno-nested-externs
7538 Warn if an @code{extern} declaration is encountered within a function.
7539
7540 @item -Wno-inherited-variadic-ctor
7541 @opindex Winherited-variadic-ctor
7542 @opindex Wno-inherited-variadic-ctor
7543 Suppress warnings about use of C++11 inheriting constructors when the
7544 base class inherited from has a C variadic constructor; the warning is
7545 on by default because the ellipsis is not inherited.
7546
7547 @item -Winline
7548 @opindex Winline
7549 @opindex Wno-inline
7550 Warn if a function that is declared as inline cannot be inlined.
7551 Even with this option, the compiler does not warn about failures to
7552 inline functions declared in system headers.
7553
7554 The compiler uses a variety of heuristics to determine whether or not
7555 to inline a function. For example, the compiler takes into account
7556 the size of the function being inlined and the amount of inlining
7557 that has already been done in the current function. Therefore,
7558 seemingly insignificant changes in the source program can cause the
7559 warnings produced by @option{-Winline} to appear or disappear.
7560
7561 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7562 @opindex Wno-invalid-offsetof
7563 @opindex Winvalid-offsetof
7564 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7565 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7566 to a non-standard-layout type is undefined. In existing C++ implementations,
7567 however, @code{offsetof} typically gives meaningful results.
7568 This flag is for users who are aware that they are
7569 writing nonportable code and who have deliberately chosen to ignore the
7570 warning about it.
7571
7572 The restrictions on @code{offsetof} may be relaxed in a future version
7573 of the C++ standard.
7574
7575 @item -Wint-in-bool-context
7576 @opindex Wint-in-bool-context
7577 @opindex Wno-int-in-bool-context
7578 Warn for suspicious use of integer values where boolean values are expected,
7579 such as conditional expressions (?:) using non-boolean integer constants in
7580 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7581 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7582 for all kinds of multiplications regardless of the data type.
7583 This warning is enabled by @option{-Wall}.
7584
7585 @item -Wno-int-to-pointer-cast
7586 @opindex Wno-int-to-pointer-cast
7587 @opindex Wint-to-pointer-cast
7588 Suppress warnings from casts to pointer type of an integer of a
7589 different size. In C++, casting to a pointer type of smaller size is
7590 an error. @option{Wint-to-pointer-cast} is enabled by default.
7591
7592
7593 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7594 @opindex Wno-pointer-to-int-cast
7595 @opindex Wpointer-to-int-cast
7596 Suppress warnings from casts from a pointer to an integer type of a
7597 different size.
7598
7599 @item -Winvalid-pch
7600 @opindex Winvalid-pch
7601 @opindex Wno-invalid-pch
7602 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7603 the search path but cannot be used.
7604
7605 @item -Wlong-long
7606 @opindex Wlong-long
7607 @opindex Wno-long-long
7608 Warn if @code{long long} type is used. This is enabled by either
7609 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7610 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7611
7612 @item -Wvariadic-macros
7613 @opindex Wvariadic-macros
7614 @opindex Wno-variadic-macros
7615 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7616 alternate syntax is used in ISO C99 mode. This is enabled by either
7617 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7618 messages, use @option{-Wno-variadic-macros}.
7619
7620 @item -Wvarargs
7621 @opindex Wvarargs
7622 @opindex Wno-varargs
7623 Warn upon questionable usage of the macros used to handle variable
7624 arguments like @code{va_start}. This is default. To inhibit the
7625 warning messages, use @option{-Wno-varargs}.
7626
7627 @item -Wvector-operation-performance
7628 @opindex Wvector-operation-performance
7629 @opindex Wno-vector-operation-performance
7630 Warn if vector operation is not implemented via SIMD capabilities of the
7631 architecture. Mainly useful for the performance tuning.
7632 Vector operation can be implemented @code{piecewise}, which means that the
7633 scalar operation is performed on every vector element;
7634 @code{in parallel}, which means that the vector operation is implemented
7635 using scalars of wider type, which normally is more performance efficient;
7636 and @code{as a single scalar}, which means that vector fits into a
7637 scalar type.
7638
7639 @item -Wno-virtual-move-assign
7640 @opindex Wvirtual-move-assign
7641 @opindex Wno-virtual-move-assign
7642 Suppress warnings about inheriting from a virtual base with a
7643 non-trivial C++11 move assignment operator. This is dangerous because
7644 if the virtual base is reachable along more than one path, it is
7645 moved multiple times, which can mean both objects end up in the
7646 moved-from state. If the move assignment operator is written to avoid
7647 moving from a moved-from object, this warning can be disabled.
7648
7649 @item -Wvla
7650 @opindex Wvla
7651 @opindex Wno-vla
7652 Warn if a variable-length array is used in the code.
7653 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7654 the variable-length array.
7655
7656 @item -Wvla-larger-than=@var{byte-size}
7657 @opindex Wvla-larger-than=
7658 @opindex Wno-vla-larger-than
7659 If this option is used, the compiler will warn for declarations of
7660 variable-length arrays whose size is either unbounded, or bounded
7661 by an argument that allows the array size to exceed @var{byte-size}
7662 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7663 works, but with variable-length arrays.
7664
7665 Note that GCC may optimize small variable-length arrays of a known
7666 value into plain arrays, so this warning may not get triggered for
7667 such arrays.
7668
7669 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7670 is typically only effective when @option{-ftree-vrp} is active (default
7671 for @option{-O2} and above).
7672
7673 See also @option{-Walloca-larger-than=@var{byte-size}}.
7674
7675 @item -Wno-vla-larger-than
7676 @opindex Wno-vla-larger-than
7677 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7678 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7679
7680 @item -Wvolatile-register-var
7681 @opindex Wvolatile-register-var
7682 @opindex Wno-volatile-register-var
7683 Warn if a register variable is declared volatile. The volatile
7684 modifier does not inhibit all optimizations that may eliminate reads
7685 and/or writes to register variables. This warning is enabled by
7686 @option{-Wall}.
7687
7688 @item -Wdisabled-optimization
7689 @opindex Wdisabled-optimization
7690 @opindex Wno-disabled-optimization
7691 Warn if a requested optimization pass is disabled. This warning does
7692 not generally indicate that there is anything wrong with your code; it
7693 merely indicates that GCC's optimizers are unable to handle the code
7694 effectively. Often, the problem is that your code is too big or too
7695 complex; GCC refuses to optimize programs when the optimization
7696 itself is likely to take inordinate amounts of time.
7697
7698 @item -Wpointer-sign @r{(C and Objective-C only)}
7699 @opindex Wpointer-sign
7700 @opindex Wno-pointer-sign
7701 Warn for pointer argument passing or assignment with different signedness.
7702 This option is only supported for C and Objective-C@. It is implied by
7703 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7704 @option{-Wno-pointer-sign}.
7705
7706 @item -Wstack-protector
7707 @opindex Wstack-protector
7708 @opindex Wno-stack-protector
7709 This option is only active when @option{-fstack-protector} is active. It
7710 warns about functions that are not protected against stack smashing.
7711
7712 @item -Woverlength-strings
7713 @opindex Woverlength-strings
7714 @opindex Wno-overlength-strings
7715 Warn about string constants that are longer than the ``minimum
7716 maximum'' length specified in the C standard. Modern compilers
7717 generally allow string constants that are much longer than the
7718 standard's minimum limit, but very portable programs should avoid
7719 using longer strings.
7720
7721 The limit applies @emph{after} string constant concatenation, and does
7722 not count the trailing NUL@. In C90, the limit was 509 characters; in
7723 C99, it was raised to 4095. C++98 does not specify a normative
7724 minimum maximum, so we do not diagnose overlength strings in C++@.
7725
7726 This option is implied by @option{-Wpedantic}, and can be disabled with
7727 @option{-Wno-overlength-strings}.
7728
7729 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7730 @opindex Wunsuffixed-float-constants
7731 @opindex Wno-unsuffixed-float-constants
7732
7733 Issue a warning for any floating constant that does not have
7734 a suffix. When used together with @option{-Wsystem-headers} it
7735 warns about such constants in system header files. This can be useful
7736 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7737 from the decimal floating-point extension to C99.
7738
7739 @item -Wno-designated-init @r{(C and Objective-C only)}
7740 Suppress warnings when a positional initializer is used to initialize
7741 a structure that has been marked with the @code{designated_init}
7742 attribute.
7743
7744 @item -Whsa
7745 Issue a warning when HSAIL cannot be emitted for the compiled function or
7746 OpenMP construct.
7747
7748 @end table
7749
7750 @node Debugging Options
7751 @section Options for Debugging Your Program
7752 @cindex options, debugging
7753 @cindex debugging information options
7754
7755 To tell GCC to emit extra information for use by a debugger, in almost
7756 all cases you need only to add @option{-g} to your other options.
7757
7758 GCC allows you to use @option{-g} with
7759 @option{-O}. The shortcuts taken by optimized code may occasionally
7760 be surprising: some variables you declared may not exist
7761 at all; flow of control may briefly move where you did not expect it;
7762 some statements may not be executed because they compute constant
7763 results or their values are already at hand; some statements may
7764 execute in different places because they have been moved out of loops.
7765 Nevertheless it is possible to debug optimized output. This makes
7766 it reasonable to use the optimizer for programs that might have bugs.
7767
7768 If you are not using some other optimization option, consider
7769 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7770 With no @option{-O} option at all, some compiler passes that collect
7771 information useful for debugging do not run at all, so that
7772 @option{-Og} may result in a better debugging experience.
7773
7774 @table @gcctabopt
7775 @item -g
7776 @opindex g
7777 Produce debugging information in the operating system's native format
7778 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7779 information.
7780
7781 On most systems that use stabs format, @option{-g} enables use of extra
7782 debugging information that only GDB can use; this extra information
7783 makes debugging work better in GDB but probably makes other debuggers
7784 crash or
7785 refuse to read the program. If you want to control for certain whether
7786 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7787 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7788
7789 @item -ggdb
7790 @opindex ggdb
7791 Produce debugging information for use by GDB@. This means to use the
7792 most expressive format available (DWARF, stabs, or the native format
7793 if neither of those are supported), including GDB extensions if at all
7794 possible.
7795
7796 @item -gdwarf
7797 @itemx -gdwarf-@var{version}
7798 @opindex gdwarf
7799 Produce debugging information in DWARF format (if that is supported).
7800 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7801 for most targets is 4. DWARF Version 5 is only experimental.
7802
7803 Note that with DWARF Version 2, some ports require and always
7804 use some non-conflicting DWARF 3 extensions in the unwind tables.
7805
7806 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7807 for maximum benefit.
7808
7809 GCC no longer supports DWARF Version 1, which is substantially
7810 different than Version 2 and later. For historical reasons, some
7811 other DWARF-related options such as
7812 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7813 in their names, but apply to all currently-supported versions of DWARF.
7814
7815 @item -gstabs
7816 @opindex gstabs
7817 Produce debugging information in stabs format (if that is supported),
7818 without GDB extensions. This is the format used by DBX on most BSD
7819 systems. On MIPS, Alpha and System V Release 4 systems this option
7820 produces stabs debugging output that is not understood by DBX@.
7821 On System V Release 4 systems this option requires the GNU assembler.
7822
7823 @item -gstabs+
7824 @opindex gstabs+
7825 Produce debugging information in stabs format (if that is supported),
7826 using GNU extensions understood only by the GNU debugger (GDB)@. The
7827 use of these extensions is likely to make other debuggers crash or
7828 refuse to read the program.
7829
7830 @item -gxcoff
7831 @opindex gxcoff
7832 Produce debugging information in XCOFF format (if that is supported).
7833 This is the format used by the DBX debugger on IBM RS/6000 systems.
7834
7835 @item -gxcoff+
7836 @opindex gxcoff+
7837 Produce debugging information in XCOFF format (if that is supported),
7838 using GNU extensions understood only by the GNU debugger (GDB)@. The
7839 use of these extensions is likely to make other debuggers crash or
7840 refuse to read the program, and may cause assemblers other than the GNU
7841 assembler (GAS) to fail with an error.
7842
7843 @item -gvms
7844 @opindex gvms
7845 Produce debugging information in Alpha/VMS debug format (if that is
7846 supported). This is the format used by DEBUG on Alpha/VMS systems.
7847
7848 @item -g@var{level}
7849 @itemx -ggdb@var{level}
7850 @itemx -gstabs@var{level}
7851 @itemx -gxcoff@var{level}
7852 @itemx -gvms@var{level}
7853 Request debugging information and also use @var{level} to specify how
7854 much information. The default level is 2.
7855
7856 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7857 @option{-g}.
7858
7859 Level 1 produces minimal information, enough for making backtraces in
7860 parts of the program that you don't plan to debug. This includes
7861 descriptions of functions and external variables, and line number
7862 tables, but no information about local variables.
7863
7864 Level 3 includes extra information, such as all the macro definitions
7865 present in the program. Some debuggers support macro expansion when
7866 you use @option{-g3}.
7867
7868 If you use multiple @option{-g} options, with or without level numbers,
7869 the last such option is the one that is effective.
7870
7871 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7872 confusion with @option{-gdwarf-@var{level}}.
7873 Instead use an additional @option{-g@var{level}} option to change the
7874 debug level for DWARF.
7875
7876 @item -fno-eliminate-unused-debug-symbols
7877 @opindex feliminate-unused-debug-symbols
7878 @opindex fno-eliminate-unused-debug-symbols
7879 By default, no debug information is produced for symbols that are not actually
7880 used. Use this option if you want debug information for all symbols.
7881
7882 @item -femit-class-debug-always
7883 @opindex femit-class-debug-always
7884 Instead of emitting debugging information for a C++ class in only one
7885 object file, emit it in all object files using the class. This option
7886 should be used only with debuggers that are unable to handle the way GCC
7887 normally emits debugging information for classes because using this
7888 option increases the size of debugging information by as much as a
7889 factor of two.
7890
7891 @item -fno-merge-debug-strings
7892 @opindex fmerge-debug-strings
7893 @opindex fno-merge-debug-strings
7894 Direct the linker to not merge together strings in the debugging
7895 information that are identical in different object files. Merging is
7896 not supported by all assemblers or linkers. Merging decreases the size
7897 of the debug information in the output file at the cost of increasing
7898 link processing time. Merging is enabled by default.
7899
7900 @item -fdebug-prefix-map=@var{old}=@var{new}
7901 @opindex fdebug-prefix-map
7902 When compiling files residing in directory @file{@var{old}}, record
7903 debugging information describing them as if the files resided in
7904 directory @file{@var{new}} instead. This can be used to replace a
7905 build-time path with an install-time path in the debug info. It can
7906 also be used to change an absolute path to a relative path by using
7907 @file{.} for @var{new}. This can give more reproducible builds, which
7908 are location independent, but may require an extra command to tell GDB
7909 where to find the source files. See also @option{-ffile-prefix-map}.
7910
7911 @item -fvar-tracking
7912 @opindex fvar-tracking
7913 Run variable tracking pass. It computes where variables are stored at each
7914 position in code. Better debugging information is then generated
7915 (if the debugging information format supports this information).
7916
7917 It is enabled by default when compiling with optimization (@option{-Os},
7918 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7919 the debug info format supports it.
7920
7921 @item -fvar-tracking-assignments
7922 @opindex fvar-tracking-assignments
7923 @opindex fno-var-tracking-assignments
7924 Annotate assignments to user variables early in the compilation and
7925 attempt to carry the annotations over throughout the compilation all the
7926 way to the end, in an attempt to improve debug information while
7927 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7928
7929 It can be enabled even if var-tracking is disabled, in which case
7930 annotations are created and maintained, but discarded at the end.
7931 By default, this flag is enabled together with @option{-fvar-tracking},
7932 except when selective scheduling is enabled.
7933
7934 @item -gsplit-dwarf
7935 @opindex gsplit-dwarf
7936 Separate as much DWARF debugging information as possible into a
7937 separate output file with the extension @file{.dwo}. This option allows
7938 the build system to avoid linking files with debug information. To
7939 be useful, this option requires a debugger capable of reading @file{.dwo}
7940 files.
7941
7942 @item -gdescribe-dies
7943 @opindex gdescribe-dies
7944 Add description attributes to some DWARF DIEs that have no name attribute,
7945 such as artificial variables, external references and call site
7946 parameter DIEs.
7947
7948 @item -gpubnames
7949 @opindex gpubnames
7950 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7951
7952 @item -ggnu-pubnames
7953 @opindex ggnu-pubnames
7954 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7955 suitable for conversion into a GDB@ index. This option is only useful
7956 with a linker that can produce GDB@ index version 7.
7957
7958 @item -fdebug-types-section
7959 @opindex fdebug-types-section
7960 @opindex fno-debug-types-section
7961 When using DWARF Version 4 or higher, type DIEs can be put into
7962 their own @code{.debug_types} section instead of making them part of the
7963 @code{.debug_info} section. It is more efficient to put them in a separate
7964 comdat section since the linker can then remove duplicates.
7965 But not all DWARF consumers support @code{.debug_types} sections yet
7966 and on some objects @code{.debug_types} produces larger instead of smaller
7967 debugging information.
7968
7969 @item -grecord-gcc-switches
7970 @itemx -gno-record-gcc-switches
7971 @opindex grecord-gcc-switches
7972 @opindex gno-record-gcc-switches
7973 This switch causes the command-line options used to invoke the
7974 compiler that may affect code generation to be appended to the
7975 DW_AT_producer attribute in DWARF debugging information. The options
7976 are concatenated with spaces separating them from each other and from
7977 the compiler version.
7978 It is enabled by default.
7979 See also @option{-frecord-gcc-switches} for another
7980 way of storing compiler options into the object file.
7981
7982 @item -gstrict-dwarf
7983 @opindex gstrict-dwarf
7984 Disallow using extensions of later DWARF standard version than selected
7985 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7986 DWARF extensions from later standard versions is allowed.
7987
7988 @item -gno-strict-dwarf
7989 @opindex gno-strict-dwarf
7990 Allow using extensions of later DWARF standard version than selected with
7991 @option{-gdwarf-@var{version}}.
7992
7993 @item -gas-loc-support
7994 @opindex gas-loc-support
7995 Inform the compiler that the assembler supports @code{.loc} directives.
7996 It may then use them for the assembler to generate DWARF2+ line number
7997 tables.
7998
7999 This is generally desirable, because assembler-generated line-number
8000 tables are a lot more compact than those the compiler can generate
8001 itself.
8002
8003 This option will be enabled by default if, at GCC configure time, the
8004 assembler was found to support such directives.
8005
8006 @item -gno-as-loc-support
8007 @opindex gno-as-loc-support
8008 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8009 line number tables are to be generated.
8010
8011 @item -gas-locview-support
8012 @opindex gas-locview-support
8013 Inform the compiler that the assembler supports @code{view} assignment
8014 and reset assertion checking in @code{.loc} directives.
8015
8016 This option will be enabled by default if, at GCC configure time, the
8017 assembler was found to support them.
8018
8019 @item -gno-as-locview-support
8020 Force GCC to assign view numbers internally, if
8021 @option{-gvariable-location-views} are explicitly requested.
8022
8023 @item -gcolumn-info
8024 @itemx -gno-column-info
8025 @opindex gcolumn-info
8026 @opindex gno-column-info
8027 Emit location column information into DWARF debugging information, rather
8028 than just file and line.
8029 This option is enabled by default.
8030
8031 @item -gstatement-frontiers
8032 @itemx -gno-statement-frontiers
8033 @opindex gstatement-frontiers
8034 @opindex gno-statement-frontiers
8035 This option causes GCC to create markers in the internal representation
8036 at the beginning of statements, and to keep them roughly in place
8037 throughout compilation, using them to guide the output of @code{is_stmt}
8038 markers in the line number table. This is enabled by default when
8039 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8040 @dots{}), and outputting DWARF 2 debug information at the normal level.
8041
8042 @item -gvariable-location-views
8043 @itemx -gvariable-location-views=incompat5
8044 @itemx -gno-variable-location-views
8045 @opindex gvariable-location-views
8046 @opindex gvariable-location-views=incompat5
8047 @opindex gno-variable-location-views
8048 Augment variable location lists with progressive view numbers implied
8049 from the line number table. This enables debug information consumers to
8050 inspect state at certain points of the program, even if no instructions
8051 associated with the corresponding source locations are present at that
8052 point. If the assembler lacks support for view numbers in line number
8053 tables, this will cause the compiler to emit the line number table,
8054 which generally makes them somewhat less compact. The augmented line
8055 number tables and location lists are fully backward-compatible, so they
8056 can be consumed by debug information consumers that are not aware of
8057 these augmentations, but they won't derive any benefit from them either.
8058
8059 This is enabled by default when outputting DWARF 2 debug information at
8060 the normal level, as long as there is assembler support,
8061 @option{-fvar-tracking-assignments} is enabled and
8062 @option{-gstrict-dwarf} is not. When assembler support is not
8063 available, this may still be enabled, but it will force GCC to output
8064 internal line number tables, and if
8065 @option{-ginternal-reset-location-views} is not enabled, that will most
8066 certainly lead to silently mismatching location views.
8067
8068 There is a proposed representation for view numbers that is not backward
8069 compatible with the location list format introduced in DWARF 5, that can
8070 be enabled with @option{-gvariable-location-views=incompat5}. This
8071 option may be removed in the future, is only provided as a reference
8072 implementation of the proposed representation. Debug information
8073 consumers are not expected to support this extended format, and they
8074 would be rendered unable to decode location lists using it.
8075
8076 @item -ginternal-reset-location-views
8077 @itemx -gnointernal-reset-location-views
8078 @opindex ginternal-reset-location-views
8079 @opindex gno-internal-reset-location-views
8080 Attempt to determine location views that can be omitted from location
8081 view lists. This requires the compiler to have very accurate insn
8082 length estimates, which isn't always the case, and it may cause
8083 incorrect view lists to be generated silently when using an assembler
8084 that does not support location view lists. The GNU assembler will flag
8085 any such error as a @code{view number mismatch}. This is only enabled
8086 on ports that define a reliable estimation function.
8087
8088 @item -ginline-points
8089 @itemx -gno-inline-points
8090 @opindex ginline-points
8091 @opindex gno-inline-points
8092 Generate extended debug information for inlined functions. Location
8093 view tracking markers are inserted at inlined entry points, so that
8094 address and view numbers can be computed and output in debug
8095 information. This can be enabled independently of location views, in
8096 which case the view numbers won't be output, but it can only be enabled
8097 along with statement frontiers, and it is only enabled by default if
8098 location views are enabled.
8099
8100 @item -gz@r{[}=@var{type}@r{]}
8101 @opindex gz
8102 Produce compressed debug sections in DWARF format, if that is supported.
8103 If @var{type} is not given, the default type depends on the capabilities
8104 of the assembler and linker used. @var{type} may be one of
8105 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8106 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8107 compression in traditional GNU format). If the linker doesn't support
8108 writing compressed debug sections, the option is rejected. Otherwise,
8109 if the assembler does not support them, @option{-gz} is silently ignored
8110 when producing object files.
8111
8112 @item -femit-struct-debug-baseonly
8113 @opindex femit-struct-debug-baseonly
8114 Emit debug information for struct-like types
8115 only when the base name of the compilation source file
8116 matches the base name of file in which the struct is defined.
8117
8118 This option substantially reduces the size of debugging information,
8119 but at significant potential loss in type information to the debugger.
8120 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8121 See @option{-femit-struct-debug-detailed} for more detailed control.
8122
8123 This option works only with DWARF debug output.
8124
8125 @item -femit-struct-debug-reduced
8126 @opindex femit-struct-debug-reduced
8127 Emit debug information for struct-like types
8128 only when the base name of the compilation source file
8129 matches the base name of file in which the type is defined,
8130 unless the struct is a template or defined in a system header.
8131
8132 This option significantly reduces the size of debugging information,
8133 with some potential loss in type information to the debugger.
8134 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8135 See @option{-femit-struct-debug-detailed} for more detailed control.
8136
8137 This option works only with DWARF debug output.
8138
8139 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8140 @opindex femit-struct-debug-detailed
8141 Specify the struct-like types
8142 for which the compiler generates debug information.
8143 The intent is to reduce duplicate struct debug information
8144 between different object files within the same program.
8145
8146 This option is a detailed version of
8147 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8148 which serves for most needs.
8149
8150 A specification has the syntax@*
8151 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8152
8153 The optional first word limits the specification to
8154 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8155 A struct type is used directly when it is the type of a variable, member.
8156 Indirect uses arise through pointers to structs.
8157 That is, when use of an incomplete struct is valid, the use is indirect.
8158 An example is
8159 @samp{struct one direct; struct two * indirect;}.
8160
8161 The optional second word limits the specification to
8162 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8163 Generic structs are a bit complicated to explain.
8164 For C++, these are non-explicit specializations of template classes,
8165 or non-template classes within the above.
8166 Other programming languages have generics,
8167 but @option{-femit-struct-debug-detailed} does not yet implement them.
8168
8169 The third word specifies the source files for those
8170 structs for which the compiler should emit debug information.
8171 The values @samp{none} and @samp{any} have the normal meaning.
8172 The value @samp{base} means that
8173 the base of name of the file in which the type declaration appears
8174 must match the base of the name of the main compilation file.
8175 In practice, this means that when compiling @file{foo.c}, debug information
8176 is generated for types declared in that file and @file{foo.h},
8177 but not other header files.
8178 The value @samp{sys} means those types satisfying @samp{base}
8179 or declared in system or compiler headers.
8180
8181 You may need to experiment to determine the best settings for your application.
8182
8183 The default is @option{-femit-struct-debug-detailed=all}.
8184
8185 This option works only with DWARF debug output.
8186
8187 @item -fno-dwarf2-cfi-asm
8188 @opindex fdwarf2-cfi-asm
8189 @opindex fno-dwarf2-cfi-asm
8190 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8191 instead of using GAS @code{.cfi_*} directives.
8192
8193 @item -fno-eliminate-unused-debug-types
8194 @opindex feliminate-unused-debug-types
8195 @opindex fno-eliminate-unused-debug-types
8196 Normally, when producing DWARF output, GCC avoids producing debug symbol
8197 output for types that are nowhere used in the source file being compiled.
8198 Sometimes it is useful to have GCC emit debugging
8199 information for all types declared in a compilation
8200 unit, regardless of whether or not they are actually used
8201 in that compilation unit, for example
8202 if, in the debugger, you want to cast a value to a type that is
8203 not actually used in your program (but is declared). More often,
8204 however, this results in a significant amount of wasted space.
8205 @end table
8206
8207 @node Optimize Options
8208 @section Options That Control Optimization
8209 @cindex optimize options
8210 @cindex options, optimization
8211
8212 These options control various sorts of optimizations.
8213
8214 Without any optimization option, the compiler's goal is to reduce the
8215 cost of compilation and to make debugging produce the expected
8216 results. Statements are independent: if you stop the program with a
8217 breakpoint between statements, you can then assign a new value to any
8218 variable or change the program counter to any other statement in the
8219 function and get exactly the results you expect from the source
8220 code.
8221
8222 Turning on optimization flags makes the compiler attempt to improve
8223 the performance and/or code size at the expense of compilation time
8224 and possibly the ability to debug the program.
8225
8226 The compiler performs optimization based on the knowledge it has of the
8227 program. Compiling multiple files at once to a single output file mode allows
8228 the compiler to use information gained from all of the files when compiling
8229 each of them.
8230
8231 Not all optimizations are controlled directly by a flag. Only
8232 optimizations that have a flag are listed in this section.
8233
8234 Most optimizations are completely disabled at @option{-O0} or if an
8235 @option{-O} level is not set on the command line, even if individual
8236 optimization flags are specified. Similarly, @option{-Og} suppresses
8237 many optimization passes.
8238
8239 Depending on the target and how GCC was configured, a slightly different
8240 set of optimizations may be enabled at each @option{-O} level than
8241 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8242 to find out the exact set of optimizations that are enabled at each level.
8243 @xref{Overall Options}, for examples.
8244
8245 @table @gcctabopt
8246 @item -O
8247 @itemx -O1
8248 @opindex O
8249 @opindex O1
8250 Optimize. Optimizing compilation takes somewhat more time, and a lot
8251 more memory for a large function.
8252
8253 With @option{-O}, the compiler tries to reduce code size and execution
8254 time, without performing any optimizations that take a great deal of
8255 compilation time.
8256
8257 @c Note that in addition to the default_options_table list in opts.c,
8258 @c several optimization flags default to true but control optimization
8259 @c passes that are explicitly disabled at -O0.
8260
8261 @option{-O} turns on the following optimization flags:
8262
8263 @c Please keep the following list alphabetized.
8264 @gccoptlist{-fauto-inc-dec @gol
8265 -fbranch-count-reg @gol
8266 -fcombine-stack-adjustments @gol
8267 -fcompare-elim @gol
8268 -fcprop-registers @gol
8269 -fdce @gol
8270 -fdefer-pop @gol
8271 -fdelayed-branch @gol
8272 -fdse @gol
8273 -fforward-propagate @gol
8274 -fguess-branch-probability @gol
8275 -fif-conversion @gol
8276 -fif-conversion2 @gol
8277 -finline-functions-called-once @gol
8278 -fipa-profile @gol
8279 -fipa-pure-const @gol
8280 -fipa-reference @gol
8281 -fipa-reference-addressable @gol
8282 -fmerge-constants @gol
8283 -fmove-loop-invariants @gol
8284 -fomit-frame-pointer @gol
8285 -freorder-blocks @gol
8286 -fshrink-wrap @gol
8287 -fshrink-wrap-separate @gol
8288 -fsplit-wide-types @gol
8289 -fssa-backprop @gol
8290 -fssa-phiopt @gol
8291 -ftree-bit-ccp @gol
8292 -ftree-ccp @gol
8293 -ftree-ch @gol
8294 -ftree-coalesce-vars @gol
8295 -ftree-copy-prop @gol
8296 -ftree-dce @gol
8297 -ftree-dominator-opts @gol
8298 -ftree-dse @gol
8299 -ftree-forwprop @gol
8300 -ftree-fre @gol
8301 -ftree-phiprop @gol
8302 -ftree-pta @gol
8303 -ftree-scev-cprop @gol
8304 -ftree-sink @gol
8305 -ftree-slsr @gol
8306 -ftree-sra @gol
8307 -ftree-ter @gol
8308 -funit-at-a-time}
8309
8310 @item -O2
8311 @opindex O2
8312 Optimize even more. GCC performs nearly all supported optimizations
8313 that do not involve a space-speed tradeoff.
8314 As compared to @option{-O}, this option increases both compilation time
8315 and the performance of the generated code.
8316
8317 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8318 also turns on the following optimization flags:
8319
8320 @c Please keep the following list alphabetized!
8321 @gccoptlist{-falign-functions -falign-jumps @gol
8322 -falign-labels -falign-loops @gol
8323 -fcaller-saves @gol
8324 -fcode-hoisting @gol
8325 -fcrossjumping @gol
8326 -fcse-follow-jumps -fcse-skip-blocks @gol
8327 -fdelete-null-pointer-checks @gol
8328 -fdevirtualize -fdevirtualize-speculatively @gol
8329 -fexpensive-optimizations @gol
8330 -ffinite-loops @gol
8331 -fgcse -fgcse-lm @gol
8332 -fhoist-adjacent-loads @gol
8333 -finline-small-functions @gol
8334 -findirect-inlining @gol
8335 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8336 -fipa-ra -fipa-sra -fipa-vrp @gol
8337 -fisolate-erroneous-paths-dereference @gol
8338 -flra-remat @gol
8339 -foptimize-sibling-calls @gol
8340 -foptimize-strlen @gol
8341 -fpartial-inlining @gol
8342 -fpeephole2 @gol
8343 -freorder-blocks-algorithm=stc @gol
8344 -freorder-blocks-and-partition -freorder-functions @gol
8345 -frerun-cse-after-loop @gol
8346 -fschedule-insns -fschedule-insns2 @gol
8347 -fsched-interblock -fsched-spec @gol
8348 -fstore-merging @gol
8349 -fstrict-aliasing @gol
8350 -fthread-jumps @gol
8351 -ftree-builtin-call-dce @gol
8352 -ftree-pre @gol
8353 -ftree-switch-conversion -ftree-tail-merge @gol
8354 -ftree-vrp}
8355
8356 Please note the warning under @option{-fgcse} about
8357 invoking @option{-O2} on programs that use computed gotos.
8358
8359 @item -O3
8360 @opindex O3
8361 Optimize yet more. @option{-O3} turns on all optimizations specified
8362 by @option{-O2} and also turns on the following optimization flags:
8363
8364 @c Please keep the following list alphabetized!
8365 @gccoptlist{-fgcse-after-reload @gol
8366 -finline-functions @gol
8367 -fipa-cp-clone
8368 -floop-interchange @gol
8369 -floop-unroll-and-jam @gol
8370 -fpeel-loops @gol
8371 -fpredictive-commoning @gol
8372 -fsplit-paths @gol
8373 -ftree-loop-distribute-patterns @gol
8374 -ftree-loop-distribution @gol
8375 -ftree-loop-vectorize @gol
8376 -ftree-partial-pre @gol
8377 -ftree-slp-vectorize @gol
8378 -funswitch-loops @gol
8379 -fvect-cost-model @gol
8380 -fversion-loops-for-strides}
8381
8382 @item -O0
8383 @opindex O0
8384 Reduce compilation time and make debugging produce the expected
8385 results. This is the default.
8386
8387 @item -Os
8388 @opindex Os
8389 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8390 except those that often increase code size:
8391
8392 @gccoptlist{-falign-functions -falign-jumps @gol
8393 -falign-labels -falign-loops @gol
8394 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8395
8396 It also enables @option{-finline-functions}, causes the compiler to tune for
8397 code size rather than execution speed, and performs further optimizations
8398 designed to reduce code size.
8399
8400 @item -Ofast
8401 @opindex Ofast
8402 Disregard strict standards compliance. @option{-Ofast} enables all
8403 @option{-O3} optimizations. It also enables optimizations that are not
8404 valid for all standard-compliant programs.
8405 It turns on @option{-ffast-math} and the Fortran-specific
8406 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8407 specified, and @option{-fno-protect-parens}.
8408
8409 @item -Og
8410 @opindex Og
8411 Optimize debugging experience. @option{-Og} should be the optimization
8412 level of choice for the standard edit-compile-debug cycle, offering
8413 a reasonable level of optimization while maintaining fast compilation
8414 and a good debugging experience. It is a better choice than @option{-O0}
8415 for producing debuggable code because some compiler passes
8416 that collect debug information are disabled at @option{-O0}.
8417
8418 Like @option{-O0}, @option{-Og} completely disables a number of
8419 optimization passes so that individual options controlling them have
8420 no effect. Otherwise @option{-Og} enables all @option{-O1}
8421 optimization flags except for those that may interfere with debugging:
8422
8423 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8424 -fif-conversion -fif-conversion2 @gol
8425 -finline-functions-called-once @gol
8426 -fmove-loop-invariants -fssa-phiopt @gol
8427 -ftree-bit-ccp -ftree-pta -ftree-sra}
8428
8429 @end table
8430
8431 If you use multiple @option{-O} options, with or without level numbers,
8432 the last such option is the one that is effective.
8433
8434 Options of the form @option{-f@var{flag}} specify machine-independent
8435 flags. Most flags have both positive and negative forms; the negative
8436 form of @option{-ffoo} is @option{-fno-foo}. In the table
8437 below, only one of the forms is listed---the one you typically
8438 use. You can figure out the other form by either removing @samp{no-}
8439 or adding it.
8440
8441 The following options control specific optimizations. They are either
8442 activated by @option{-O} options or are related to ones that are. You
8443 can use the following flags in the rare cases when ``fine-tuning'' of
8444 optimizations to be performed is desired.
8445
8446 @table @gcctabopt
8447 @item -fno-defer-pop
8448 @opindex fno-defer-pop
8449 @opindex fdefer-pop
8450 For machines that must pop arguments after a function call, always pop
8451 the arguments as soon as each function returns.
8452 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8453 this allows the compiler to let arguments accumulate on the stack for several
8454 function calls and pop them all at once.
8455
8456 @item -fforward-propagate
8457 @opindex fforward-propagate
8458 Perform a forward propagation pass on RTL@. The pass tries to combine two
8459 instructions and checks if the result can be simplified. If loop unrolling
8460 is active, two passes are performed and the second is scheduled after
8461 loop unrolling.
8462
8463 This option is enabled by default at optimization levels @option{-O},
8464 @option{-O2}, @option{-O3}, @option{-Os}.
8465
8466 @item -ffp-contract=@var{style}
8467 @opindex ffp-contract
8468 @option{-ffp-contract=off} disables floating-point expression contraction.
8469 @option{-ffp-contract=fast} enables floating-point expression contraction
8470 such as forming of fused multiply-add operations if the target has
8471 native support for them.
8472 @option{-ffp-contract=on} enables floating-point expression contraction
8473 if allowed by the language standard. This is currently not implemented
8474 and treated equal to @option{-ffp-contract=off}.
8475
8476 The default is @option{-ffp-contract=fast}.
8477
8478 @item -fomit-frame-pointer
8479 @opindex fomit-frame-pointer
8480 Omit the frame pointer in functions that don't need one. This avoids the
8481 instructions to save, set up and restore the frame pointer; on many targets
8482 it also makes an extra register available.
8483
8484 On some targets this flag has no effect because the standard calling sequence
8485 always uses a frame pointer, so it cannot be omitted.
8486
8487 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8488 is used in all functions. Several targets always omit the frame pointer in
8489 leaf functions.
8490
8491 Enabled by default at @option{-O} and higher.
8492
8493 @item -foptimize-sibling-calls
8494 @opindex foptimize-sibling-calls
8495 Optimize sibling and tail recursive calls.
8496
8497 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8498
8499 @item -foptimize-strlen
8500 @opindex foptimize-strlen
8501 Optimize various standard C string functions (e.g.@: @code{strlen},
8502 @code{strchr} or @code{strcpy}) and
8503 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8504
8505 Enabled at levels @option{-O2}, @option{-O3}.
8506
8507 @item -fno-inline
8508 @opindex fno-inline
8509 @opindex finline
8510 Do not expand any functions inline apart from those marked with
8511 the @code{always_inline} attribute. This is the default when not
8512 optimizing.
8513
8514 Single functions can be exempted from inlining by marking them
8515 with the @code{noinline} attribute.
8516
8517 @item -finline-small-functions
8518 @opindex finline-small-functions
8519 Integrate functions into their callers when their body is smaller than expected
8520 function call code (so overall size of program gets smaller). The compiler
8521 heuristically decides which functions are simple enough to be worth integrating
8522 in this way. This inlining applies to all functions, even those not declared
8523 inline.
8524
8525 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8526
8527 @item -findirect-inlining
8528 @opindex findirect-inlining
8529 Inline also indirect calls that are discovered to be known at compile
8530 time thanks to previous inlining. This option has any effect only
8531 when inlining itself is turned on by the @option{-finline-functions}
8532 or @option{-finline-small-functions} options.
8533
8534 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8535
8536 @item -finline-functions
8537 @opindex finline-functions
8538 Consider all functions for inlining, even if they are not declared inline.
8539 The compiler heuristically decides which functions are worth integrating
8540 in this way.
8541
8542 If all calls to a given function are integrated, and the function is
8543 declared @code{static}, then the function is normally not output as
8544 assembler code in its own right.
8545
8546 Enabled at levels @option{-O3}, @option{-Os}. Also enabled
8547 by @option{-fprofile-use} and @option{-fauto-profile}.
8548
8549 @item -finline-functions-called-once
8550 @opindex finline-functions-called-once
8551 Consider all @code{static} functions called once for inlining into their
8552 caller even if they are not marked @code{inline}. If a call to a given
8553 function is integrated, then the function is not output as assembler code
8554 in its own right.
8555
8556 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8557 but not @option{-Og}.
8558
8559 @item -fearly-inlining
8560 @opindex fearly-inlining
8561 Inline functions marked by @code{always_inline} and functions whose body seems
8562 smaller than the function call overhead early before doing
8563 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8564 makes profiling significantly cheaper and usually inlining faster on programs
8565 having large chains of nested wrapper functions.
8566
8567 Enabled by default.
8568
8569 @item -fipa-sra
8570 @opindex fipa-sra
8571 Perform interprocedural scalar replacement of aggregates, removal of
8572 unused parameters and replacement of parameters passed by reference
8573 by parameters passed by value.
8574
8575 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8576
8577 @item -finline-limit=@var{n}
8578 @opindex finline-limit
8579 By default, GCC limits the size of functions that can be inlined. This flag
8580 allows coarse control of this limit. @var{n} is the size of functions that
8581 can be inlined in number of pseudo instructions.
8582
8583 Inlining is actually controlled by a number of parameters, which may be
8584 specified individually by using @option{--param @var{name}=@var{value}}.
8585 The @option{-finline-limit=@var{n}} option sets some of these parameters
8586 as follows:
8587
8588 @table @gcctabopt
8589 @item max-inline-insns-single
8590 is set to @var{n}/2.
8591 @item max-inline-insns-auto
8592 is set to @var{n}/2.
8593 @end table
8594
8595 See below for a documentation of the individual
8596 parameters controlling inlining and for the defaults of these parameters.
8597
8598 @emph{Note:} there may be no value to @option{-finline-limit} that results
8599 in default behavior.
8600
8601 @emph{Note:} pseudo instruction represents, in this particular context, an
8602 abstract measurement of function's size. In no way does it represent a count
8603 of assembly instructions and as such its exact meaning might change from one
8604 release to an another.
8605
8606 @item -fno-keep-inline-dllexport
8607 @opindex fno-keep-inline-dllexport
8608 @opindex fkeep-inline-dllexport
8609 This is a more fine-grained version of @option{-fkeep-inline-functions},
8610 which applies only to functions that are declared using the @code{dllexport}
8611 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8612 Functions}.
8613
8614 @item -fkeep-inline-functions
8615 @opindex fkeep-inline-functions
8616 In C, emit @code{static} functions that are declared @code{inline}
8617 into the object file, even if the function has been inlined into all
8618 of its callers. This switch does not affect functions using the
8619 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8620 inline functions into the object file.
8621
8622 @item -fkeep-static-functions
8623 @opindex fkeep-static-functions
8624 Emit @code{static} functions into the object file, even if the function
8625 is never used.
8626
8627 @item -fkeep-static-consts
8628 @opindex fkeep-static-consts
8629 Emit variables declared @code{static const} when optimization isn't turned
8630 on, even if the variables aren't referenced.
8631
8632 GCC enables this option by default. If you want to force the compiler to
8633 check if a variable is referenced, regardless of whether or not
8634 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8635
8636 @item -fmerge-constants
8637 @opindex fmerge-constants
8638 Attempt to merge identical constants (string constants and floating-point
8639 constants) across compilation units.
8640
8641 This option is the default for optimized compilation if the assembler and
8642 linker support it. Use @option{-fno-merge-constants} to inhibit this
8643 behavior.
8644
8645 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8646
8647 @item -fmerge-all-constants
8648 @opindex fmerge-all-constants
8649 Attempt to merge identical constants and identical variables.
8650
8651 This option implies @option{-fmerge-constants}. In addition to
8652 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8653 arrays or initialized constant variables with integral or floating-point
8654 types. Languages like C or C++ require each variable, including multiple
8655 instances of the same variable in recursive calls, to have distinct locations,
8656 so using this option results in non-conforming
8657 behavior.
8658
8659 @item -fmodulo-sched
8660 @opindex fmodulo-sched
8661 Perform swing modulo scheduling immediately before the first scheduling
8662 pass. This pass looks at innermost loops and reorders their
8663 instructions by overlapping different iterations.
8664
8665 @item -fmodulo-sched-allow-regmoves
8666 @opindex fmodulo-sched-allow-regmoves
8667 Perform more aggressive SMS-based modulo scheduling with register moves
8668 allowed. By setting this flag certain anti-dependences edges are
8669 deleted, which triggers the generation of reg-moves based on the
8670 life-range analysis. This option is effective only with
8671 @option{-fmodulo-sched} enabled.
8672
8673 @item -fno-branch-count-reg
8674 @opindex fno-branch-count-reg
8675 @opindex fbranch-count-reg
8676 Disable the optimization pass that scans for opportunities to use
8677 ``decrement and branch'' instructions on a count register instead of
8678 instruction sequences that decrement a register, compare it against zero, and
8679 then branch based upon the result. This option is only meaningful on
8680 architectures that support such instructions, which include x86, PowerPC,
8681 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8682 doesn't remove the decrement and branch instructions from the generated
8683 instruction stream introduced by other optimization passes.
8684
8685 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8686 except for @option{-Og}.
8687
8688 @item -fno-function-cse
8689 @opindex fno-function-cse
8690 @opindex ffunction-cse
8691 Do not put function addresses in registers; make each instruction that
8692 calls a constant function contain the function's address explicitly.
8693
8694 This option results in less efficient code, but some strange hacks
8695 that alter the assembler output may be confused by the optimizations
8696 performed when this option is not used.
8697
8698 The default is @option{-ffunction-cse}
8699
8700 @item -fno-zero-initialized-in-bss
8701 @opindex fno-zero-initialized-in-bss
8702 @opindex fzero-initialized-in-bss
8703 If the target supports a BSS section, GCC by default puts variables that
8704 are initialized to zero into BSS@. This can save space in the resulting
8705 code.
8706
8707 This option turns off this behavior because some programs explicitly
8708 rely on variables going to the data section---e.g., so that the
8709 resulting executable can find the beginning of that section and/or make
8710 assumptions based on that.
8711
8712 The default is @option{-fzero-initialized-in-bss}.
8713
8714 @item -fthread-jumps
8715 @opindex fthread-jumps
8716 Perform optimizations that check to see if a jump branches to a
8717 location where another comparison subsumed by the first is found. If
8718 so, the first branch is redirected to either the destination of the
8719 second branch or a point immediately following it, depending on whether
8720 the condition is known to be true or false.
8721
8722 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8723
8724 @item -fsplit-wide-types
8725 @opindex fsplit-wide-types
8726 When using a type that occupies multiple registers, such as @code{long
8727 long} on a 32-bit system, split the registers apart and allocate them
8728 independently. This normally generates better code for those types,
8729 but may make debugging more difficult.
8730
8731 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8732 @option{-Os}.
8733
8734 @item -fsplit-wide-types-early
8735 @opindex fsplit-wide-types-early
8736 Fully split wide types early, instead of very late.
8737 This option has no effect unless @option{-fsplit-wide-types} is turned on.
8738
8739 This is the default on some targets.
8740
8741 @item -fcse-follow-jumps
8742 @opindex fcse-follow-jumps
8743 In common subexpression elimination (CSE), scan through jump instructions
8744 when the target of the jump is not reached by any other path. For
8745 example, when CSE encounters an @code{if} statement with an
8746 @code{else} clause, CSE follows the jump when the condition
8747 tested is false.
8748
8749 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8750
8751 @item -fcse-skip-blocks
8752 @opindex fcse-skip-blocks
8753 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8754 follow jumps that conditionally skip over blocks. When CSE
8755 encounters a simple @code{if} statement with no else clause,
8756 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8757 body of the @code{if}.
8758
8759 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8760
8761 @item -frerun-cse-after-loop
8762 @opindex frerun-cse-after-loop
8763 Re-run common subexpression elimination after loop optimizations are
8764 performed.
8765
8766 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8767
8768 @item -fgcse
8769 @opindex fgcse
8770 Perform a global common subexpression elimination pass.
8771 This pass also performs global constant and copy propagation.
8772
8773 @emph{Note:} When compiling a program using computed gotos, a GCC
8774 extension, you may get better run-time performance if you disable
8775 the global common subexpression elimination pass by adding
8776 @option{-fno-gcse} to the command line.
8777
8778 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8779
8780 @item -fgcse-lm
8781 @opindex fgcse-lm
8782 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8783 attempts to move loads that are only killed by stores into themselves. This
8784 allows a loop containing a load/store sequence to be changed to a load outside
8785 the loop, and a copy/store within the loop.
8786
8787 Enabled by default when @option{-fgcse} is enabled.
8788
8789 @item -fgcse-sm
8790 @opindex fgcse-sm
8791 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8792 global common subexpression elimination. This pass attempts to move
8793 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8794 loops containing a load/store sequence can be changed to a load before
8795 the loop and a store after the loop.
8796
8797 Not enabled at any optimization level.
8798
8799 @item -fgcse-las
8800 @opindex fgcse-las
8801 When @option{-fgcse-las} is enabled, the global common subexpression
8802 elimination pass eliminates redundant loads that come after stores to the
8803 same memory location (both partial and full redundancies).
8804
8805 Not enabled at any optimization level.
8806
8807 @item -fgcse-after-reload
8808 @opindex fgcse-after-reload
8809 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8810 pass is performed after reload. The purpose of this pass is to clean up
8811 redundant spilling.
8812
8813 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8814
8815 @item -faggressive-loop-optimizations
8816 @opindex faggressive-loop-optimizations
8817 This option tells the loop optimizer to use language constraints to
8818 derive bounds for the number of iterations of a loop. This assumes that
8819 loop code does not invoke undefined behavior by for example causing signed
8820 integer overflows or out-of-bound array accesses. The bounds for the
8821 number of iterations of a loop are used to guide loop unrolling and peeling
8822 and loop exit test optimizations.
8823 This option is enabled by default.
8824
8825 @item -funconstrained-commons
8826 @opindex funconstrained-commons
8827 This option tells the compiler that variables declared in common blocks
8828 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8829 prevents certain optimizations that depend on knowing the array bounds.
8830
8831 @item -fcrossjumping
8832 @opindex fcrossjumping
8833 Perform cross-jumping transformation.
8834 This transformation unifies equivalent code and saves code size. The
8835 resulting code may or may not perform better than without cross-jumping.
8836
8837 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8838
8839 @item -fauto-inc-dec
8840 @opindex fauto-inc-dec
8841 Combine increments or decrements of addresses with memory accesses.
8842 This pass is always skipped on architectures that do not have
8843 instructions to support this. Enabled by default at @option{-O} and
8844 higher on architectures that support this.
8845
8846 @item -fdce
8847 @opindex fdce
8848 Perform dead code elimination (DCE) on RTL@.
8849 Enabled by default at @option{-O} and higher.
8850
8851 @item -fdse
8852 @opindex fdse
8853 Perform dead store elimination (DSE) on RTL@.
8854 Enabled by default at @option{-O} and higher.
8855
8856 @item -fif-conversion
8857 @opindex fif-conversion
8858 Attempt to transform conditional jumps into branch-less equivalents. This
8859 includes use of conditional moves, min, max, set flags and abs instructions, and
8860 some tricks doable by standard arithmetics. The use of conditional execution
8861 on chips where it is available is controlled by @option{-fif-conversion2}.
8862
8863 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8864 not with @option{-Og}.
8865
8866 @item -fif-conversion2
8867 @opindex fif-conversion2
8868 Use conditional execution (where available) to transform conditional jumps into
8869 branch-less equivalents.
8870
8871 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8872 not with @option{-Og}.
8873
8874 @item -fdeclone-ctor-dtor
8875 @opindex fdeclone-ctor-dtor
8876 The C++ ABI requires multiple entry points for constructors and
8877 destructors: one for a base subobject, one for a complete object, and
8878 one for a virtual destructor that calls operator delete afterwards.
8879 For a hierarchy with virtual bases, the base and complete variants are
8880 clones, which means two copies of the function. With this option, the
8881 base and complete variants are changed to be thunks that call a common
8882 implementation.
8883
8884 Enabled by @option{-Os}.
8885
8886 @item -fdelete-null-pointer-checks
8887 @opindex fdelete-null-pointer-checks
8888 Assume that programs cannot safely dereference null pointers, and that
8889 no code or data element resides at address zero.
8890 This option enables simple constant
8891 folding optimizations at all optimization levels. In addition, other
8892 optimization passes in GCC use this flag to control global dataflow
8893 analyses that eliminate useless checks for null pointers; these assume
8894 that a memory access to address zero always results in a trap, so
8895 that if a pointer is checked after it has already been dereferenced,
8896 it cannot be null.
8897
8898 Note however that in some environments this assumption is not true.
8899 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8900 for programs that depend on that behavior.
8901
8902 This option is enabled by default on most targets. On Nios II ELF, it
8903 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8904
8905 Passes that use the dataflow information
8906 are enabled independently at different optimization levels.
8907
8908 @item -fdevirtualize
8909 @opindex fdevirtualize
8910 Attempt to convert calls to virtual functions to direct calls. This
8911 is done both within a procedure and interprocedurally as part of
8912 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8913 propagation (@option{-fipa-cp}).
8914 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8915
8916 @item -fdevirtualize-speculatively
8917 @opindex fdevirtualize-speculatively
8918 Attempt to convert calls to virtual functions to speculative direct calls.
8919 Based on the analysis of the type inheritance graph, determine for a given call
8920 the set of likely targets. If the set is small, preferably of size 1, change
8921 the call into a conditional deciding between direct and indirect calls. The
8922 speculative calls enable more optimizations, such as inlining. When they seem
8923 useless after further optimization, they are converted back into original form.
8924
8925 @item -fdevirtualize-at-ltrans
8926 @opindex fdevirtualize-at-ltrans
8927 Stream extra information needed for aggressive devirtualization when running
8928 the link-time optimizer in local transformation mode.
8929 This option enables more devirtualization but
8930 significantly increases the size of streamed data. For this reason it is
8931 disabled by default.
8932
8933 @item -fexpensive-optimizations
8934 @opindex fexpensive-optimizations
8935 Perform a number of minor optimizations that are relatively expensive.
8936
8937 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8938
8939 @item -free
8940 @opindex free
8941 Attempt to remove redundant extension instructions. This is especially
8942 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8943 registers after writing to their lower 32-bit half.
8944
8945 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8946 @option{-O3}, @option{-Os}.
8947
8948 @item -fno-lifetime-dse
8949 @opindex fno-lifetime-dse
8950 @opindex flifetime-dse
8951 In C++ the value of an object is only affected by changes within its
8952 lifetime: when the constructor begins, the object has an indeterminate
8953 value, and any changes during the lifetime of the object are dead when
8954 the object is destroyed. Normally dead store elimination will take
8955 advantage of this; if your code relies on the value of the object
8956 storage persisting beyond the lifetime of the object, you can use this
8957 flag to disable this optimization. To preserve stores before the
8958 constructor starts (e.g.@: because your operator new clears the object
8959 storage) but still treat the object as dead after the destructor you,
8960 can use @option{-flifetime-dse=1}. The default behavior can be
8961 explicitly selected with @option{-flifetime-dse=2}.
8962 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8963
8964 @item -flive-range-shrinkage
8965 @opindex flive-range-shrinkage
8966 Attempt to decrease register pressure through register live range
8967 shrinkage. This is helpful for fast processors with small or moderate
8968 size register sets.
8969
8970 @item -fira-algorithm=@var{algorithm}
8971 @opindex fira-algorithm
8972 Use the specified coloring algorithm for the integrated register
8973 allocator. The @var{algorithm} argument can be @samp{priority}, which
8974 specifies Chow's priority coloring, or @samp{CB}, which specifies
8975 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8976 for all architectures, but for those targets that do support it, it is
8977 the default because it generates better code.
8978
8979 @item -fira-region=@var{region}
8980 @opindex fira-region
8981 Use specified regions for the integrated register allocator. The
8982 @var{region} argument should be one of the following:
8983
8984 @table @samp
8985
8986 @item all
8987 Use all loops as register allocation regions.
8988 This can give the best results for machines with a small and/or
8989 irregular register set.
8990
8991 @item mixed
8992 Use all loops except for loops with small register pressure
8993 as the regions. This value usually gives
8994 the best results in most cases and for most architectures,
8995 and is enabled by default when compiling with optimization for speed
8996 (@option{-O}, @option{-O2}, @dots{}).
8997
8998 @item one
8999 Use all functions as a single region.
9000 This typically results in the smallest code size, and is enabled by default for
9001 @option{-Os} or @option{-O0}.
9002
9003 @end table
9004
9005 @item -fira-hoist-pressure
9006 @opindex fira-hoist-pressure
9007 Use IRA to evaluate register pressure in the code hoisting pass for
9008 decisions to hoist expressions. This option usually results in smaller
9009 code, but it can slow the compiler down.
9010
9011 This option is enabled at level @option{-Os} for all targets.
9012
9013 @item -fira-loop-pressure
9014 @opindex fira-loop-pressure
9015 Use IRA to evaluate register pressure in loops for decisions to move
9016 loop invariants. This option usually results in generation
9017 of faster and smaller code on machines with large register files (>= 32
9018 registers), but it can slow the compiler down.
9019
9020 This option is enabled at level @option{-O3} for some targets.
9021
9022 @item -fno-ira-share-save-slots
9023 @opindex fno-ira-share-save-slots
9024 @opindex fira-share-save-slots
9025 Disable sharing of stack slots used for saving call-used hard
9026 registers living through a call. Each hard register gets a
9027 separate stack slot, and as a result function stack frames are
9028 larger.
9029
9030 @item -fno-ira-share-spill-slots
9031 @opindex fno-ira-share-spill-slots
9032 @opindex fira-share-spill-slots
9033 Disable sharing of stack slots allocated for pseudo-registers. Each
9034 pseudo-register that does not get a hard register gets a separate
9035 stack slot, and as a result function stack frames are larger.
9036
9037 @item -flra-remat
9038 @opindex flra-remat
9039 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9040 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9041 values if it is profitable.
9042
9043 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9044
9045 @item -fdelayed-branch
9046 @opindex fdelayed-branch
9047 If supported for the target machine, attempt to reorder instructions
9048 to exploit instruction slots available after delayed branch
9049 instructions.
9050
9051 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9052 but not at @option{-Og}.
9053
9054 @item -fschedule-insns
9055 @opindex fschedule-insns
9056 If supported for the target machine, attempt to reorder instructions to
9057 eliminate execution stalls due to required data being unavailable. This
9058 helps machines that have slow floating point or memory load instructions
9059 by allowing other instructions to be issued until the result of the load
9060 or floating-point instruction is required.
9061
9062 Enabled at levels @option{-O2}, @option{-O3}.
9063
9064 @item -fschedule-insns2
9065 @opindex fschedule-insns2
9066 Similar to @option{-fschedule-insns}, but requests an additional pass of
9067 instruction scheduling after register allocation has been done. This is
9068 especially useful on machines with a relatively small number of
9069 registers and where memory load instructions take more than one cycle.
9070
9071 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9072
9073 @item -fno-sched-interblock
9074 @opindex fno-sched-interblock
9075 @opindex fsched-interblock
9076 Disable instruction scheduling across basic blocks, which
9077 is normally enabled when scheduling before register allocation, i.e.@:
9078 with @option{-fschedule-insns} or at @option{-O2} or higher.
9079
9080 @item -fno-sched-spec
9081 @opindex fno-sched-spec
9082 @opindex fsched-spec
9083 Disable speculative motion of non-load instructions, which
9084 is normally enabled when scheduling before register allocation, i.e.@:
9085 with @option{-fschedule-insns} or at @option{-O2} or higher.
9086
9087 @item -fsched-pressure
9088 @opindex fsched-pressure
9089 Enable register pressure sensitive insn scheduling before register
9090 allocation. This only makes sense when scheduling before register
9091 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9092 @option{-O2} or higher. Usage of this option can improve the
9093 generated code and decrease its size by preventing register pressure
9094 increase above the number of available hard registers and subsequent
9095 spills in register allocation.
9096
9097 @item -fsched-spec-load
9098 @opindex fsched-spec-load
9099 Allow speculative motion of some load instructions. This only makes
9100 sense when scheduling before register allocation, i.e.@: with
9101 @option{-fschedule-insns} or at @option{-O2} or higher.
9102
9103 @item -fsched-spec-load-dangerous
9104 @opindex fsched-spec-load-dangerous
9105 Allow speculative motion of more load instructions. This only makes
9106 sense when scheduling before register allocation, i.e.@: with
9107 @option{-fschedule-insns} or at @option{-O2} or higher.
9108
9109 @item -fsched-stalled-insns
9110 @itemx -fsched-stalled-insns=@var{n}
9111 @opindex fsched-stalled-insns
9112 Define how many insns (if any) can be moved prematurely from the queue
9113 of stalled insns into the ready list during the second scheduling pass.
9114 @option{-fno-sched-stalled-insns} means that no insns are moved
9115 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9116 on how many queued insns can be moved prematurely.
9117 @option{-fsched-stalled-insns} without a value is equivalent to
9118 @option{-fsched-stalled-insns=1}.
9119
9120 @item -fsched-stalled-insns-dep
9121 @itemx -fsched-stalled-insns-dep=@var{n}
9122 @opindex fsched-stalled-insns-dep
9123 Define how many insn groups (cycles) are examined for a dependency
9124 on a stalled insn that is a candidate for premature removal from the queue
9125 of stalled insns. This has an effect only during the second scheduling pass,
9126 and only if @option{-fsched-stalled-insns} is used.
9127 @option{-fno-sched-stalled-insns-dep} is equivalent to
9128 @option{-fsched-stalled-insns-dep=0}.
9129 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9130 @option{-fsched-stalled-insns-dep=1}.
9131
9132 @item -fsched2-use-superblocks
9133 @opindex fsched2-use-superblocks
9134 When scheduling after register allocation, use superblock scheduling.
9135 This allows motion across basic block boundaries,
9136 resulting in faster schedules. This option is experimental, as not all machine
9137 descriptions used by GCC model the CPU closely enough to avoid unreliable
9138 results from the algorithm.
9139
9140 This only makes sense when scheduling after register allocation, i.e.@: with
9141 @option{-fschedule-insns2} or at @option{-O2} or higher.
9142
9143 @item -fsched-group-heuristic
9144 @opindex fsched-group-heuristic
9145 Enable the group heuristic in the scheduler. This heuristic favors
9146 the instruction that belongs to a schedule group. This is enabled
9147 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9148 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9149
9150 @item -fsched-critical-path-heuristic
9151 @opindex fsched-critical-path-heuristic
9152 Enable the critical-path heuristic in the scheduler. This heuristic favors
9153 instructions on the critical path. This is enabled by default when
9154 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9155 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9156
9157 @item -fsched-spec-insn-heuristic
9158 @opindex fsched-spec-insn-heuristic
9159 Enable the speculative instruction heuristic in the scheduler. This
9160 heuristic favors speculative instructions with greater dependency weakness.
9161 This is enabled by default when scheduling is enabled, i.e.@:
9162 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9163 or at @option{-O2} or higher.
9164
9165 @item -fsched-rank-heuristic
9166 @opindex fsched-rank-heuristic
9167 Enable the rank heuristic in the scheduler. This heuristic favors
9168 the instruction belonging to a basic block with greater size or frequency.
9169 This is enabled by default when scheduling is enabled, i.e.@:
9170 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9171 at @option{-O2} or higher.
9172
9173 @item -fsched-last-insn-heuristic
9174 @opindex fsched-last-insn-heuristic
9175 Enable the last-instruction heuristic in the scheduler. This heuristic
9176 favors the instruction that is less dependent on the last instruction
9177 scheduled. This is enabled by default when scheduling is enabled,
9178 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9179 at @option{-O2} or higher.
9180
9181 @item -fsched-dep-count-heuristic
9182 @opindex fsched-dep-count-heuristic
9183 Enable the dependent-count heuristic in the scheduler. This heuristic
9184 favors the instruction that has more instructions depending on it.
9185 This is enabled by default when scheduling is enabled, i.e.@:
9186 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9187 at @option{-O2} or higher.
9188
9189 @item -freschedule-modulo-scheduled-loops
9190 @opindex freschedule-modulo-scheduled-loops
9191 Modulo scheduling is performed before traditional scheduling. If a loop
9192 is modulo scheduled, later scheduling passes may change its schedule.
9193 Use this option to control that behavior.
9194
9195 @item -fselective-scheduling
9196 @opindex fselective-scheduling
9197 Schedule instructions using selective scheduling algorithm. Selective
9198 scheduling runs instead of the first scheduler pass.
9199
9200 @item -fselective-scheduling2
9201 @opindex fselective-scheduling2
9202 Schedule instructions using selective scheduling algorithm. Selective
9203 scheduling runs instead of the second scheduler pass.
9204
9205 @item -fsel-sched-pipelining
9206 @opindex fsel-sched-pipelining
9207 Enable software pipelining of innermost loops during selective scheduling.
9208 This option has no effect unless one of @option{-fselective-scheduling} or
9209 @option{-fselective-scheduling2} is turned on.
9210
9211 @item -fsel-sched-pipelining-outer-loops
9212 @opindex fsel-sched-pipelining-outer-loops
9213 When pipelining loops during selective scheduling, also pipeline outer loops.
9214 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9215
9216 @item -fsemantic-interposition
9217 @opindex fsemantic-interposition
9218 Some object formats, like ELF, allow interposing of symbols by the
9219 dynamic linker.
9220 This means that for symbols exported from the DSO, the compiler cannot perform
9221 interprocedural propagation, inlining and other optimizations in anticipation
9222 that the function or variable in question may change. While this feature is
9223 useful, for example, to rewrite memory allocation functions by a debugging
9224 implementation, it is expensive in the terms of code quality.
9225 With @option{-fno-semantic-interposition} the compiler assumes that
9226 if interposition happens for functions the overwriting function will have
9227 precisely the same semantics (and side effects).
9228 Similarly if interposition happens
9229 for variables, the constructor of the variable will be the same. The flag
9230 has no effect for functions explicitly declared inline
9231 (where it is never allowed for interposition to change semantics)
9232 and for symbols explicitly declared weak.
9233
9234 @item -fshrink-wrap
9235 @opindex fshrink-wrap
9236 Emit function prologues only before parts of the function that need it,
9237 rather than at the top of the function. This flag is enabled by default at
9238 @option{-O} and higher.
9239
9240 @item -fshrink-wrap-separate
9241 @opindex fshrink-wrap-separate
9242 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9243 those parts are only executed when needed.
9244 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9245 is also turned on and the target supports this.
9246
9247 @item -fcaller-saves
9248 @opindex fcaller-saves
9249 Enable allocation of values to registers that are clobbered by
9250 function calls, by emitting extra instructions to save and restore the
9251 registers around such calls. Such allocation is done only when it
9252 seems to result in better code.
9253
9254 This option is always enabled by default on certain machines, usually
9255 those which have no call-preserved registers to use instead.
9256
9257 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9258
9259 @item -fcombine-stack-adjustments
9260 @opindex fcombine-stack-adjustments
9261 Tracks stack adjustments (pushes and pops) and stack memory references
9262 and then tries to find ways to combine them.
9263
9264 Enabled by default at @option{-O1} and higher.
9265
9266 @item -fipa-ra
9267 @opindex fipa-ra
9268 Use caller save registers for allocation if those registers are not used by
9269 any called function. In that case it is not necessary to save and restore
9270 them around calls. This is only possible if called functions are part of
9271 same compilation unit as current function and they are compiled before it.
9272
9273 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9274 is disabled if generated code will be instrumented for profiling
9275 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9276 exactly (this happens on targets that do not expose prologues
9277 and epilogues in RTL).
9278
9279 @item -fconserve-stack
9280 @opindex fconserve-stack
9281 Attempt to minimize stack usage. The compiler attempts to use less
9282 stack space, even if that makes the program slower. This option
9283 implies setting the @option{large-stack-frame} parameter to 100
9284 and the @option{large-stack-frame-growth} parameter to 400.
9285
9286 @item -ftree-reassoc
9287 @opindex ftree-reassoc
9288 Perform reassociation on trees. This flag is enabled by default
9289 at @option{-O} and higher.
9290
9291 @item -fcode-hoisting
9292 @opindex fcode-hoisting
9293 Perform code hoisting. Code hoisting tries to move the
9294 evaluation of expressions executed on all paths to the function exit
9295 as early as possible. This is especially useful as a code size
9296 optimization, but it often helps for code speed as well.
9297 This flag is enabled by default at @option{-O2} and higher.
9298
9299 @item -ftree-pre
9300 @opindex ftree-pre
9301 Perform partial redundancy elimination (PRE) on trees. This flag is
9302 enabled by default at @option{-O2} and @option{-O3}.
9303
9304 @item -ftree-partial-pre
9305 @opindex ftree-partial-pre
9306 Make partial redundancy elimination (PRE) more aggressive. This flag is
9307 enabled by default at @option{-O3}.
9308
9309 @item -ftree-forwprop
9310 @opindex ftree-forwprop
9311 Perform forward propagation on trees. This flag is enabled by default
9312 at @option{-O} and higher.
9313
9314 @item -ftree-fre
9315 @opindex ftree-fre
9316 Perform full redundancy elimination (FRE) on trees. The difference
9317 between FRE and PRE is that FRE only considers expressions
9318 that are computed on all paths leading to the redundant computation.
9319 This analysis is faster than PRE, though it exposes fewer redundancies.
9320 This flag is enabled by default at @option{-O} and higher.
9321
9322 @item -ftree-phiprop
9323 @opindex ftree-phiprop
9324 Perform hoisting of loads from conditional pointers on trees. This
9325 pass is enabled by default at @option{-O} and higher.
9326
9327 @item -fhoist-adjacent-loads
9328 @opindex fhoist-adjacent-loads
9329 Speculatively hoist loads from both branches of an if-then-else if the
9330 loads are from adjacent locations in the same structure and the target
9331 architecture has a conditional move instruction. This flag is enabled
9332 by default at @option{-O2} and higher.
9333
9334 @item -ftree-copy-prop
9335 @opindex ftree-copy-prop
9336 Perform copy propagation on trees. This pass eliminates unnecessary
9337 copy operations. This flag is enabled by default at @option{-O} and
9338 higher.
9339
9340 @item -fipa-pure-const
9341 @opindex fipa-pure-const
9342 Discover which functions are pure or constant.
9343 Enabled by default at @option{-O} and higher.
9344
9345 @item -fipa-reference
9346 @opindex fipa-reference
9347 Discover which static variables do not escape the
9348 compilation unit.
9349 Enabled by default at @option{-O} and higher.
9350
9351 @item -fipa-reference-addressable
9352 @opindex fipa-reference-addressable
9353 Discover read-only, write-only and non-addressable static variables.
9354 Enabled by default at @option{-O} and higher.
9355
9356 @item -fipa-stack-alignment
9357 @opindex fipa-stack-alignment
9358 Reduce stack alignment on call sites if possible.
9359 Enabled by default.
9360
9361 @item -fipa-pta
9362 @opindex fipa-pta
9363 Perform interprocedural pointer analysis and interprocedural modification
9364 and reference analysis. This option can cause excessive memory and
9365 compile-time usage on large compilation units. It is not enabled by
9366 default at any optimization level.
9367
9368 @item -fipa-profile
9369 @opindex fipa-profile
9370 Perform interprocedural profile propagation. The functions called only from
9371 cold functions are marked as cold. Also functions executed once (such as
9372 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9373 functions and loop less parts of functions executed once are then optimized for
9374 size.
9375 Enabled by default at @option{-O} and higher.
9376
9377 @item -fipa-cp
9378 @opindex fipa-cp
9379 Perform interprocedural constant propagation.
9380 This optimization analyzes the program to determine when values passed
9381 to functions are constants and then optimizes accordingly.
9382 This optimization can substantially increase performance
9383 if the application has constants passed to functions.
9384 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9385 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9386
9387 @item -fipa-cp-clone
9388 @opindex fipa-cp-clone
9389 Perform function cloning to make interprocedural constant propagation stronger.
9390 When enabled, interprocedural constant propagation performs function cloning
9391 when externally visible function can be called with constant arguments.
9392 Because this optimization can create multiple copies of functions,
9393 it may significantly increase code size
9394 (see @option{--param ipcp-unit-growth=@var{value}}).
9395 This flag is enabled by default at @option{-O3}.
9396 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9397
9398 @item -fipa-bit-cp
9399 @opindex fipa-bit-cp
9400 When enabled, perform interprocedural bitwise constant
9401 propagation. This flag is enabled by default at @option{-O2} and
9402 by @option{-fprofile-use} and @option{-fauto-profile}.
9403 It requires that @option{-fipa-cp} is enabled.
9404
9405 @item -fipa-vrp
9406 @opindex fipa-vrp
9407 When enabled, perform interprocedural propagation of value
9408 ranges. This flag is enabled by default at @option{-O2}. It requires
9409 that @option{-fipa-cp} is enabled.
9410
9411 @item -fipa-icf
9412 @opindex fipa-icf
9413 Perform Identical Code Folding for functions and read-only variables.
9414 The optimization reduces code size and may disturb unwind stacks by replacing
9415 a function by equivalent one with a different name. The optimization works
9416 more effectively with link-time optimization enabled.
9417
9418 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9419 works on different levels and thus the optimizations are not same - there are
9420 equivalences that are found only by GCC and equivalences found only by Gold.
9421
9422 This flag is enabled by default at @option{-O2} and @option{-Os}.
9423
9424 @item -flive-patching=@var{level}
9425 @opindex flive-patching
9426 Control GCC's optimizations to produce output suitable for live-patching.
9427
9428 If the compiler's optimization uses a function's body or information extracted
9429 from its body to optimize/change another function, the latter is called an
9430 impacted function of the former. If a function is patched, its impacted
9431 functions should be patched too.
9432
9433 The impacted functions are determined by the compiler's interprocedural
9434 optimizations. For example, a caller is impacted when inlining a function
9435 into its caller,
9436 cloning a function and changing its caller to call this new clone,
9437 or extracting a function's pureness/constness information to optimize
9438 its direct or indirect callers, etc.
9439
9440 Usually, the more IPA optimizations enabled, the larger the number of
9441 impacted functions for each function. In order to control the number of
9442 impacted functions and more easily compute the list of impacted function,
9443 IPA optimizations can be partially enabled at two different levels.
9444
9445 The @var{level} argument should be one of the following:
9446
9447 @table @samp
9448
9449 @item inline-clone
9450
9451 Only enable inlining and cloning optimizations, which includes inlining,
9452 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9453 As a result, when patching a function, all its callers and its clones'
9454 callers are impacted, therefore need to be patched as well.
9455
9456 @option{-flive-patching=inline-clone} disables the following optimization flags:
9457 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9458 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9459 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9460 -fipa-stack-alignment}
9461
9462 @item inline-only-static
9463
9464 Only enable inlining of static functions.
9465 As a result, when patching a static function, all its callers are impacted
9466 and so need to be patched as well.
9467
9468 In addition to all the flags that @option{-flive-patching=inline-clone}
9469 disables,
9470 @option{-flive-patching=inline-only-static} disables the following additional
9471 optimization flags:
9472 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9473
9474 @end table
9475
9476 When @option{-flive-patching} is specified without any value, the default value
9477 is @var{inline-clone}.
9478
9479 This flag is disabled by default.
9480
9481 Note that @option{-flive-patching} is not supported with link-time optimization
9482 (@option{-flto}).
9483
9484 @item -fisolate-erroneous-paths-dereference
9485 @opindex fisolate-erroneous-paths-dereference
9486 Detect paths that trigger erroneous or undefined behavior due to
9487 dereferencing a null pointer. Isolate those paths from the main control
9488 flow and turn the statement with erroneous or undefined behavior into a trap.
9489 This flag is enabled by default at @option{-O2} and higher and depends on
9490 @option{-fdelete-null-pointer-checks} also being enabled.
9491
9492 @item -fisolate-erroneous-paths-attribute
9493 @opindex fisolate-erroneous-paths-attribute
9494 Detect paths that trigger erroneous or undefined behavior due to a null value
9495 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9496 attribute. Isolate those paths from the main control flow and turn the
9497 statement with erroneous or undefined behavior into a trap. This is not
9498 currently enabled, but may be enabled by @option{-O2} in the future.
9499
9500 @item -ftree-sink
9501 @opindex ftree-sink
9502 Perform forward store motion on trees. This flag is
9503 enabled by default at @option{-O} and higher.
9504
9505 @item -ftree-bit-ccp
9506 @opindex ftree-bit-ccp
9507 Perform sparse conditional bit constant propagation on trees and propagate
9508 pointer alignment information.
9509 This pass only operates on local scalar variables and is enabled by default
9510 at @option{-O1} and higher, except for @option{-Og}.
9511 It requires that @option{-ftree-ccp} is enabled.
9512
9513 @item -ftree-ccp
9514 @opindex ftree-ccp
9515 Perform sparse conditional constant propagation (CCP) on trees. This
9516 pass only operates on local scalar variables and is enabled by default
9517 at @option{-O} and higher.
9518
9519 @item -fssa-backprop
9520 @opindex fssa-backprop
9521 Propagate information about uses of a value up the definition chain
9522 in order to simplify the definitions. For example, this pass strips
9523 sign operations if the sign of a value never matters. The flag is
9524 enabled by default at @option{-O} and higher.
9525
9526 @item -fssa-phiopt
9527 @opindex fssa-phiopt
9528 Perform pattern matching on SSA PHI nodes to optimize conditional
9529 code. This pass is enabled by default at @option{-O1} and higher,
9530 except for @option{-Og}.
9531
9532 @item -ftree-switch-conversion
9533 @opindex ftree-switch-conversion
9534 Perform conversion of simple initializations in a switch to
9535 initializations from a scalar array. This flag is enabled by default
9536 at @option{-O2} and higher.
9537
9538 @item -ftree-tail-merge
9539 @opindex ftree-tail-merge
9540 Look for identical code sequences. When found, replace one with a jump to the
9541 other. This optimization is known as tail merging or cross jumping. This flag
9542 is enabled by default at @option{-O2} and higher. The compilation time
9543 in this pass can
9544 be limited using @option{max-tail-merge-comparisons} parameter and
9545 @option{max-tail-merge-iterations} parameter.
9546
9547 @item -ftree-dce
9548 @opindex ftree-dce
9549 Perform dead code elimination (DCE) on trees. This flag is enabled by
9550 default at @option{-O} and higher.
9551
9552 @item -ftree-builtin-call-dce
9553 @opindex ftree-builtin-call-dce
9554 Perform conditional dead code elimination (DCE) for calls to built-in functions
9555 that may set @code{errno} but are otherwise free of side effects. This flag is
9556 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9557 specified.
9558
9559 @item -ffinite-loops
9560 @opindex ffinite-loops
9561 @opindex fno-finite-loops
9562 Assume that a loop with an exit will eventually take the exit and not loop
9563 indefinitely. This allows the compiler to remove loops that otherwise have
9564 no side-effects, not considering eventual endless looping as such.
9565
9566 This option is enabled by default at @option{-O2}.
9567
9568 @item -ftree-dominator-opts
9569 @opindex ftree-dominator-opts
9570 Perform a variety of simple scalar cleanups (constant/copy
9571 propagation, redundancy elimination, range propagation and expression
9572 simplification) based on a dominator tree traversal. This also
9573 performs jump threading (to reduce jumps to jumps). This flag is
9574 enabled by default at @option{-O} and higher.
9575
9576 @item -ftree-dse
9577 @opindex ftree-dse
9578 Perform dead store elimination (DSE) on trees. A dead store is a store into
9579 a memory location that is later overwritten by another store without
9580 any intervening loads. In this case the earlier store can be deleted. This
9581 flag is enabled by default at @option{-O} and higher.
9582
9583 @item -ftree-ch
9584 @opindex ftree-ch
9585 Perform loop header copying on trees. This is beneficial since it increases
9586 effectiveness of code motion optimizations. It also saves one jump. This flag
9587 is enabled by default at @option{-O} and higher. It is not enabled
9588 for @option{-Os}, since it usually increases code size.
9589
9590 @item -ftree-loop-optimize
9591 @opindex ftree-loop-optimize
9592 Perform loop optimizations on trees. This flag is enabled by default
9593 at @option{-O} and higher.
9594
9595 @item -ftree-loop-linear
9596 @itemx -floop-strip-mine
9597 @itemx -floop-block
9598 @opindex ftree-loop-linear
9599 @opindex floop-strip-mine
9600 @opindex floop-block
9601 Perform loop nest optimizations. Same as
9602 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9603 to be configured with @option{--with-isl} to enable the Graphite loop
9604 transformation infrastructure.
9605
9606 @item -fgraphite-identity
9607 @opindex fgraphite-identity
9608 Enable the identity transformation for graphite. For every SCoP we generate
9609 the polyhedral representation and transform it back to gimple. Using
9610 @option{-fgraphite-identity} we can check the costs or benefits of the
9611 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9612 are also performed by the code generator isl, like index splitting and
9613 dead code elimination in loops.
9614
9615 @item -floop-nest-optimize
9616 @opindex floop-nest-optimize
9617 Enable the isl based loop nest optimizer. This is a generic loop nest
9618 optimizer based on the Pluto optimization algorithms. It calculates a loop
9619 structure optimized for data-locality and parallelism. This option
9620 is experimental.
9621
9622 @item -floop-parallelize-all
9623 @opindex floop-parallelize-all
9624 Use the Graphite data dependence analysis to identify loops that can
9625 be parallelized. Parallelize all the loops that can be analyzed to
9626 not contain loop carried dependences without checking that it is
9627 profitable to parallelize the loops.
9628
9629 @item -ftree-coalesce-vars
9630 @opindex ftree-coalesce-vars
9631 While transforming the program out of the SSA representation, attempt to
9632 reduce copying by coalescing versions of different user-defined
9633 variables, instead of just compiler temporaries. This may severely
9634 limit the ability to debug an optimized program compiled with
9635 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9636 prevents SSA coalescing of user variables. This option is enabled by
9637 default if optimization is enabled, and it does very little otherwise.
9638
9639 @item -ftree-loop-if-convert
9640 @opindex ftree-loop-if-convert
9641 Attempt to transform conditional jumps in the innermost loops to
9642 branch-less equivalents. The intent is to remove control-flow from
9643 the innermost loops in order to improve the ability of the
9644 vectorization pass to handle these loops. This is enabled by default
9645 if vectorization is enabled.
9646
9647 @item -ftree-loop-distribution
9648 @opindex ftree-loop-distribution
9649 Perform loop distribution. This flag can improve cache performance on
9650 big loop bodies and allow further loop optimizations, like
9651 parallelization or vectorization, to take place. For example, the loop
9652 @smallexample
9653 DO I = 1, N
9654 A(I) = B(I) + C
9655 D(I) = E(I) * F
9656 ENDDO
9657 @end smallexample
9658 is transformed to
9659 @smallexample
9660 DO I = 1, N
9661 A(I) = B(I) + C
9662 ENDDO
9663 DO I = 1, N
9664 D(I) = E(I) * F
9665 ENDDO
9666 @end smallexample
9667 This flag is enabled by default at @option{-O3}.
9668 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9669
9670 @item -ftree-loop-distribute-patterns
9671 @opindex ftree-loop-distribute-patterns
9672 Perform loop distribution of patterns that can be code generated with
9673 calls to a library. This flag is enabled by default at @option{-O3}, and
9674 by @option{-fprofile-use} and @option{-fauto-profile}.
9675
9676 This pass distributes the initialization loops and generates a call to
9677 memset zero. For example, the loop
9678 @smallexample
9679 DO I = 1, N
9680 A(I) = 0
9681 B(I) = A(I) + I
9682 ENDDO
9683 @end smallexample
9684 is transformed to
9685 @smallexample
9686 DO I = 1, N
9687 A(I) = 0
9688 ENDDO
9689 DO I = 1, N
9690 B(I) = A(I) + I
9691 ENDDO
9692 @end smallexample
9693 and the initialization loop is transformed into a call to memset zero.
9694 This flag is enabled by default at @option{-O3}.
9695 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9696
9697 @item -floop-interchange
9698 @opindex floop-interchange
9699 Perform loop interchange outside of graphite. This flag can improve cache
9700 performance on loop nest and allow further loop optimizations, like
9701 vectorization, to take place. For example, the loop
9702 @smallexample
9703 for (int i = 0; i < N; i++)
9704 for (int j = 0; j < N; j++)
9705 for (int k = 0; k < N; k++)
9706 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9707 @end smallexample
9708 is transformed to
9709 @smallexample
9710 for (int i = 0; i < N; i++)
9711 for (int k = 0; k < N; k++)
9712 for (int j = 0; j < N; j++)
9713 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9714 @end smallexample
9715 This flag is enabled by default at @option{-O3}.
9716 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9717
9718 @item -floop-unroll-and-jam
9719 @opindex floop-unroll-and-jam
9720 Apply unroll and jam transformations on feasible loops. In a loop
9721 nest this unrolls the outer loop by some factor and fuses the resulting
9722 multiple inner loops. This flag is enabled by default at @option{-O3}.
9723 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9724
9725 @item -ftree-loop-im
9726 @opindex ftree-loop-im
9727 Perform loop invariant motion on trees. This pass moves only invariants that
9728 are hard to handle at RTL level (function calls, operations that expand to
9729 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9730 operands of conditions that are invariant out of the loop, so that we can use
9731 just trivial invariantness analysis in loop unswitching. The pass also includes
9732 store motion.
9733
9734 @item -ftree-loop-ivcanon
9735 @opindex ftree-loop-ivcanon
9736 Create a canonical counter for number of iterations in loops for which
9737 determining number of iterations requires complicated analysis. Later
9738 optimizations then may determine the number easily. Useful especially
9739 in connection with unrolling.
9740
9741 @item -ftree-scev-cprop
9742 @opindex ftree-scev-cprop
9743 Perform final value replacement. If a variable is modified in a loop
9744 in such a way that its value when exiting the loop can be determined using
9745 only its initial value and the number of loop iterations, replace uses of
9746 the final value by such a computation, provided it is sufficiently cheap.
9747 This reduces data dependencies and may allow further simplifications.
9748 Enabled by default at @option{-O} and higher.
9749
9750 @item -fivopts
9751 @opindex fivopts
9752 Perform induction variable optimizations (strength reduction, induction
9753 variable merging and induction variable elimination) on trees.
9754
9755 @item -ftree-parallelize-loops=n
9756 @opindex ftree-parallelize-loops
9757 Parallelize loops, i.e., split their iteration space to run in n threads.
9758 This is only possible for loops whose iterations are independent
9759 and can be arbitrarily reordered. The optimization is only
9760 profitable on multiprocessor machines, for loops that are CPU-intensive,
9761 rather than constrained e.g.@: by memory bandwidth. This option
9762 implies @option{-pthread}, and thus is only supported on targets
9763 that have support for @option{-pthread}.
9764
9765 @item -ftree-pta
9766 @opindex ftree-pta
9767 Perform function-local points-to analysis on trees. This flag is
9768 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9769
9770 @item -ftree-sra
9771 @opindex ftree-sra
9772 Perform scalar replacement of aggregates. This pass replaces structure
9773 references with scalars to prevent committing structures to memory too
9774 early. This flag is enabled by default at @option{-O1} and higher,
9775 except for @option{-Og}.
9776
9777 @item -fstore-merging
9778 @opindex fstore-merging
9779 Perform merging of narrow stores to consecutive memory addresses. This pass
9780 merges contiguous stores of immediate values narrower than a word into fewer
9781 wider stores to reduce the number of instructions. This is enabled by default
9782 at @option{-O2} and higher as well as @option{-Os}.
9783
9784 @item -ftree-ter
9785 @opindex ftree-ter
9786 Perform temporary expression replacement during the SSA->normal phase. Single
9787 use/single def temporaries are replaced at their use location with their
9788 defining expression. This results in non-GIMPLE code, but gives the expanders
9789 much more complex trees to work on resulting in better RTL generation. This is
9790 enabled by default at @option{-O} and higher.
9791
9792 @item -ftree-slsr
9793 @opindex ftree-slsr
9794 Perform straight-line strength reduction on trees. This recognizes related
9795 expressions involving multiplications and replaces them by less expensive
9796 calculations when possible. This is enabled by default at @option{-O} and
9797 higher.
9798
9799 @item -ftree-vectorize
9800 @opindex ftree-vectorize
9801 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9802 and @option{-ftree-slp-vectorize} if not explicitly specified.
9803
9804 @item -ftree-loop-vectorize
9805 @opindex ftree-loop-vectorize
9806 Perform loop vectorization on trees. This flag is enabled by default at
9807 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9808 and @option{-fauto-profile}.
9809
9810 @item -ftree-slp-vectorize
9811 @opindex ftree-slp-vectorize
9812 Perform basic block vectorization on trees. This flag is enabled by default at
9813 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9814 and @option{-fauto-profile}.
9815
9816 @item -fvect-cost-model=@var{model}
9817 @opindex fvect-cost-model
9818 Alter the cost model used for vectorization. The @var{model} argument
9819 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9820 With the @samp{unlimited} model the vectorized code-path is assumed
9821 to be profitable while with the @samp{dynamic} model a runtime check
9822 guards the vectorized code-path to enable it only for iteration
9823 counts that will likely execute faster than when executing the original
9824 scalar loop. The @samp{cheap} model disables vectorization of
9825 loops where doing so would be cost prohibitive for example due to
9826 required runtime checks for data dependence or alignment but otherwise
9827 is equal to the @samp{dynamic} model.
9828 The default cost model depends on other optimization flags and is
9829 either @samp{dynamic} or @samp{cheap}.
9830
9831 @item -fsimd-cost-model=@var{model}
9832 @opindex fsimd-cost-model
9833 Alter the cost model used for vectorization of loops marked with the OpenMP
9834 simd directive. The @var{model} argument should be one of
9835 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9836 have the same meaning as described in @option{-fvect-cost-model} and by
9837 default a cost model defined with @option{-fvect-cost-model} is used.
9838
9839 @item -ftree-vrp
9840 @opindex ftree-vrp
9841 Perform Value Range Propagation on trees. This is similar to the
9842 constant propagation pass, but instead of values, ranges of values are
9843 propagated. This allows the optimizers to remove unnecessary range
9844 checks like array bound checks and null pointer checks. This is
9845 enabled by default at @option{-O2} and higher. Null pointer check
9846 elimination is only done if @option{-fdelete-null-pointer-checks} is
9847 enabled.
9848
9849 @item -fsplit-paths
9850 @opindex fsplit-paths
9851 Split paths leading to loop backedges. This can improve dead code
9852 elimination and common subexpression elimination. This is enabled by
9853 default at @option{-O3} and above.
9854
9855 @item -fsplit-ivs-in-unroller
9856 @opindex fsplit-ivs-in-unroller
9857 Enables expression of values of induction variables in later iterations
9858 of the unrolled loop using the value in the first iteration. This breaks
9859 long dependency chains, thus improving efficiency of the scheduling passes.
9860
9861 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9862 same effect. However, that is not reliable in cases where the loop body
9863 is more complicated than a single basic block. It also does not work at all
9864 on some architectures due to restrictions in the CSE pass.
9865
9866 This optimization is enabled by default.
9867
9868 @item -fvariable-expansion-in-unroller
9869 @opindex fvariable-expansion-in-unroller
9870 With this option, the compiler creates multiple copies of some
9871 local variables when unrolling a loop, which can result in superior code.
9872
9873 This optimization is enabled by default for PowerPC targets, but disabled
9874 by default otherwise.
9875
9876 @item -fpartial-inlining
9877 @opindex fpartial-inlining
9878 Inline parts of functions. This option has any effect only
9879 when inlining itself is turned on by the @option{-finline-functions}
9880 or @option{-finline-small-functions} options.
9881
9882 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9883
9884 @item -fpredictive-commoning
9885 @opindex fpredictive-commoning
9886 Perform predictive commoning optimization, i.e., reusing computations
9887 (especially memory loads and stores) performed in previous
9888 iterations of loops.
9889
9890 This option is enabled at level @option{-O3}.
9891 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9892
9893 @item -fprefetch-loop-arrays
9894 @opindex fprefetch-loop-arrays
9895 If supported by the target machine, generate instructions to prefetch
9896 memory to improve the performance of loops that access large arrays.
9897
9898 This option may generate better or worse code; results are highly
9899 dependent on the structure of loops within the source code.
9900
9901 Disabled at level @option{-Os}.
9902
9903 @item -fno-printf-return-value
9904 @opindex fno-printf-return-value
9905 @opindex fprintf-return-value
9906 Do not substitute constants for known return value of formatted output
9907 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9908 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9909 transformation allows GCC to optimize or even eliminate branches based
9910 on the known return value of these functions called with arguments that
9911 are either constant, or whose values are known to be in a range that
9912 makes determining the exact return value possible. For example, when
9913 @option{-fprintf-return-value} is in effect, both the branch and the
9914 body of the @code{if} statement (but not the call to @code{snprint})
9915 can be optimized away when @code{i} is a 32-bit or smaller integer
9916 because the return value is guaranteed to be at most 8.
9917
9918 @smallexample
9919 char buf[9];
9920 if (snprintf (buf, "%08x", i) >= sizeof buf)
9921 @dots{}
9922 @end smallexample
9923
9924 The @option{-fprintf-return-value} option relies on other optimizations
9925 and yields best results with @option{-O2} and above. It works in tandem
9926 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9927 options. The @option{-fprintf-return-value} option is enabled by default.
9928
9929 @item -fno-peephole
9930 @itemx -fno-peephole2
9931 @opindex fno-peephole
9932 @opindex fpeephole
9933 @opindex fno-peephole2
9934 @opindex fpeephole2
9935 Disable any machine-specific peephole optimizations. The difference
9936 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9937 are implemented in the compiler; some targets use one, some use the
9938 other, a few use both.
9939
9940 @option{-fpeephole} is enabled by default.
9941 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9942
9943 @item -fno-guess-branch-probability
9944 @opindex fno-guess-branch-probability
9945 @opindex fguess-branch-probability
9946 Do not guess branch probabilities using heuristics.
9947
9948 GCC uses heuristics to guess branch probabilities if they are
9949 not provided by profiling feedback (@option{-fprofile-arcs}). These
9950 heuristics are based on the control flow graph. If some branch probabilities
9951 are specified by @code{__builtin_expect}, then the heuristics are
9952 used to guess branch probabilities for the rest of the control flow graph,
9953 taking the @code{__builtin_expect} info into account. The interactions
9954 between the heuristics and @code{__builtin_expect} can be complex, and in
9955 some cases, it may be useful to disable the heuristics so that the effects
9956 of @code{__builtin_expect} are easier to understand.
9957
9958 It is also possible to specify expected probability of the expression
9959 with @code{__builtin_expect_with_probability} built-in function.
9960
9961 The default is @option{-fguess-branch-probability} at levels
9962 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9963
9964 @item -freorder-blocks
9965 @opindex freorder-blocks
9966 Reorder basic blocks in the compiled function in order to reduce number of
9967 taken branches and improve code locality.
9968
9969 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9970
9971 @item -freorder-blocks-algorithm=@var{algorithm}
9972 @opindex freorder-blocks-algorithm
9973 Use the specified algorithm for basic block reordering. The
9974 @var{algorithm} argument can be @samp{simple}, which does not increase
9975 code size (except sometimes due to secondary effects like alignment),
9976 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9977 put all often executed code together, minimizing the number of branches
9978 executed by making extra copies of code.
9979
9980 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9981 @samp{stc} at levels @option{-O2}, @option{-O3}.
9982
9983 @item -freorder-blocks-and-partition
9984 @opindex freorder-blocks-and-partition
9985 In addition to reordering basic blocks in the compiled function, in order
9986 to reduce number of taken branches, partitions hot and cold basic blocks
9987 into separate sections of the assembly and @file{.o} files, to improve
9988 paging and cache locality performance.
9989
9990 This optimization is automatically turned off in the presence of
9991 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9992 section attribute and on any architecture that does not support named
9993 sections. When @option{-fsplit-stack} is used this option is not
9994 enabled by default (to avoid linker errors), but may be enabled
9995 explicitly (if using a working linker).
9996
9997 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9998
9999 @item -freorder-functions
10000 @opindex freorder-functions
10001 Reorder functions in the object file in order to
10002 improve code locality. This is implemented by using special
10003 subsections @code{.text.hot} for most frequently executed functions and
10004 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
10005 the linker so object file format must support named sections and linker must
10006 place them in a reasonable way.
10007
10008 This option isn't effective unless you either provide profile feedback
10009 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10010 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10011
10012 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10013
10014 @item -fstrict-aliasing
10015 @opindex fstrict-aliasing
10016 Allow the compiler to assume the strictest aliasing rules applicable to
10017 the language being compiled. For C (and C++), this activates
10018 optimizations based on the type of expressions. In particular, an
10019 object of one type is assumed never to reside at the same address as an
10020 object of a different type, unless the types are almost the same. For
10021 example, an @code{unsigned int} can alias an @code{int}, but not a
10022 @code{void*} or a @code{double}. A character type may alias any other
10023 type.
10024
10025 @anchor{Type-punning}Pay special attention to code like this:
10026 @smallexample
10027 union a_union @{
10028 int i;
10029 double d;
10030 @};
10031
10032 int f() @{
10033 union a_union t;
10034 t.d = 3.0;
10035 return t.i;
10036 @}
10037 @end smallexample
10038 The practice of reading from a different union member than the one most
10039 recently written to (called ``type-punning'') is common. Even with
10040 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10041 is accessed through the union type. So, the code above works as
10042 expected. @xref{Structures unions enumerations and bit-fields
10043 implementation}. However, this code might not:
10044 @smallexample
10045 int f() @{
10046 union a_union t;
10047 int* ip;
10048 t.d = 3.0;
10049 ip = &t.i;
10050 return *ip;
10051 @}
10052 @end smallexample
10053
10054 Similarly, access by taking the address, casting the resulting pointer
10055 and dereferencing the result has undefined behavior, even if the cast
10056 uses a union type, e.g.:
10057 @smallexample
10058 int f() @{
10059 double d = 3.0;
10060 return ((union a_union *) &d)->i;
10061 @}
10062 @end smallexample
10063
10064 The @option{-fstrict-aliasing} option is enabled at levels
10065 @option{-O2}, @option{-O3}, @option{-Os}.
10066
10067 @item -falign-functions
10068 @itemx -falign-functions=@var{n}
10069 @itemx -falign-functions=@var{n}:@var{m}
10070 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10071 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10072 @opindex falign-functions
10073 Align the start of functions to the next power-of-two greater than
10074 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10075 the first @var{m} bytes of the function can be fetched by the CPU
10076 without crossing an @var{n}-byte alignment boundary.
10077
10078 If @var{m} is not specified, it defaults to @var{n}.
10079
10080 Examples: @option{-falign-functions=32} aligns functions to the next
10081 32-byte boundary, @option{-falign-functions=24} aligns to the next
10082 32-byte boundary only if this can be done by skipping 23 bytes or less,
10083 @option{-falign-functions=32:7} aligns to the next
10084 32-byte boundary only if this can be done by skipping 6 bytes or less.
10085
10086 The second pair of @var{n2}:@var{m2} values allows you to specify
10087 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10088 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10089 otherwise aligns to the next 32-byte boundary if this can be done
10090 by skipping 2 bytes or less.
10091 If @var{m2} is not specified, it defaults to @var{n2}.
10092
10093 Some assemblers only support this flag when @var{n} is a power of two;
10094 in that case, it is rounded up.
10095
10096 @option{-fno-align-functions} and @option{-falign-functions=1} are
10097 equivalent and mean that functions are not aligned.
10098
10099 If @var{n} is not specified or is zero, use a machine-dependent default.
10100 The maximum allowed @var{n} option value is 65536.
10101
10102 Enabled at levels @option{-O2}, @option{-O3}.
10103
10104 @item -flimit-function-alignment
10105 If this option is enabled, the compiler tries to avoid unnecessarily
10106 overaligning functions. It attempts to instruct the assembler to align
10107 by the amount specified by @option{-falign-functions}, but not to
10108 skip more bytes than the size of the function.
10109
10110 @item -falign-labels
10111 @itemx -falign-labels=@var{n}
10112 @itemx -falign-labels=@var{n}:@var{m}
10113 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10114 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10115 @opindex falign-labels
10116 Align all branch targets to a power-of-two boundary.
10117
10118 Parameters of this option are analogous to the @option{-falign-functions} option.
10119 @option{-fno-align-labels} and @option{-falign-labels=1} are
10120 equivalent and mean that labels are not aligned.
10121
10122 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10123 are greater than this value, then their values are used instead.
10124
10125 If @var{n} is not specified or is zero, use a machine-dependent default
10126 which is very likely to be @samp{1}, meaning no alignment.
10127 The maximum allowed @var{n} option value is 65536.
10128
10129 Enabled at levels @option{-O2}, @option{-O3}.
10130
10131 @item -falign-loops
10132 @itemx -falign-loops=@var{n}
10133 @itemx -falign-loops=@var{n}:@var{m}
10134 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10135 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10136 @opindex falign-loops
10137 Align loops to a power-of-two boundary. If the loops are executed
10138 many times, this makes up for any execution of the dummy padding
10139 instructions.
10140
10141 Parameters of this option are analogous to the @option{-falign-functions} option.
10142 @option{-fno-align-loops} and @option{-falign-loops=1} are
10143 equivalent and mean that loops are not aligned.
10144 The maximum allowed @var{n} option value is 65536.
10145
10146 If @var{n} is not specified or is zero, use a machine-dependent default.
10147
10148 Enabled at levels @option{-O2}, @option{-O3}.
10149
10150 @item -falign-jumps
10151 @itemx -falign-jumps=@var{n}
10152 @itemx -falign-jumps=@var{n}:@var{m}
10153 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10154 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10155 @opindex falign-jumps
10156 Align branch targets to a power-of-two boundary, for branch targets
10157 where the targets can only be reached by jumping. In this case,
10158 no dummy operations need be executed.
10159
10160 Parameters of this option are analogous to the @option{-falign-functions} option.
10161 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10162 equivalent and mean that loops are not aligned.
10163
10164 If @var{n} is not specified or is zero, use a machine-dependent default.
10165 The maximum allowed @var{n} option value is 65536.
10166
10167 Enabled at levels @option{-O2}, @option{-O3}.
10168
10169 @item -funit-at-a-time
10170 @opindex funit-at-a-time
10171 This option is left for compatibility reasons. @option{-funit-at-a-time}
10172 has no effect, while @option{-fno-unit-at-a-time} implies
10173 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10174
10175 Enabled by default.
10176
10177 @item -fno-toplevel-reorder
10178 @opindex fno-toplevel-reorder
10179 @opindex ftoplevel-reorder
10180 Do not reorder top-level functions, variables, and @code{asm}
10181 statements. Output them in the same order that they appear in the
10182 input file. When this option is used, unreferenced static variables
10183 are not removed. This option is intended to support existing code
10184 that relies on a particular ordering. For new code, it is better to
10185 use attributes when possible.
10186
10187 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10188 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10189 Additionally @option{-fno-toplevel-reorder} implies
10190 @option{-fno-section-anchors}.
10191
10192 @item -fweb
10193 @opindex fweb
10194 Constructs webs as commonly used for register allocation purposes and assign
10195 each web individual pseudo register. This allows the register allocation pass
10196 to operate on pseudos directly, but also strengthens several other optimization
10197 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10198 however, make debugging impossible, since variables no longer stay in a
10199 ``home register''.
10200
10201 Enabled by default with @option{-funroll-loops}.
10202
10203 @item -fwhole-program
10204 @opindex fwhole-program
10205 Assume that the current compilation unit represents the whole program being
10206 compiled. All public functions and variables with the exception of @code{main}
10207 and those merged by attribute @code{externally_visible} become static functions
10208 and in effect are optimized more aggressively by interprocedural optimizers.
10209
10210 This option should not be used in combination with @option{-flto}.
10211 Instead relying on a linker plugin should provide safer and more precise
10212 information.
10213
10214 @item -flto[=@var{n}]
10215 @opindex flto
10216 This option runs the standard link-time optimizer. When invoked
10217 with source code, it generates GIMPLE (one of GCC's internal
10218 representations) and writes it to special ELF sections in the object
10219 file. When the object files are linked together, all the function
10220 bodies are read from these ELF sections and instantiated as if they
10221 had been part of the same translation unit.
10222
10223 To use the link-time optimizer, @option{-flto} and optimization
10224 options should be specified at compile time and during the final link.
10225 It is recommended that you compile all the files participating in the
10226 same link with the same options and also specify those options at
10227 link time.
10228 For example:
10229
10230 @smallexample
10231 gcc -c -O2 -flto foo.c
10232 gcc -c -O2 -flto bar.c
10233 gcc -o myprog -flto -O2 foo.o bar.o
10234 @end smallexample
10235
10236 The first two invocations to GCC save a bytecode representation
10237 of GIMPLE into special ELF sections inside @file{foo.o} and
10238 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10239 @file{foo.o} and @file{bar.o}, merges the two files into a single
10240 internal image, and compiles the result as usual. Since both
10241 @file{foo.o} and @file{bar.o} are merged into a single image, this
10242 causes all the interprocedural analyses and optimizations in GCC to
10243 work across the two files as if they were a single one. This means,
10244 for example, that the inliner is able to inline functions in
10245 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10246
10247 Another (simpler) way to enable link-time optimization is:
10248
10249 @smallexample
10250 gcc -o myprog -flto -O2 foo.c bar.c
10251 @end smallexample
10252
10253 The above generates bytecode for @file{foo.c} and @file{bar.c},
10254 merges them together into a single GIMPLE representation and optimizes
10255 them as usual to produce @file{myprog}.
10256
10257 The important thing to keep in mind is that to enable link-time
10258 optimizations you need to use the GCC driver to perform the link step.
10259 GCC automatically performs link-time optimization if any of the
10260 objects involved were compiled with the @option{-flto} command-line option.
10261 You can always override
10262 the automatic decision to do link-time optimization
10263 by passing @option{-fno-lto} to the link command.
10264
10265 To make whole program optimization effective, it is necessary to make
10266 certain whole program assumptions. The compiler needs to know
10267 what functions and variables can be accessed by libraries and runtime
10268 outside of the link-time optimized unit. When supported by the linker,
10269 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10270 to the compiler about used and externally visible symbols. When
10271 the linker plugin is not available, @option{-fwhole-program} should be
10272 used to allow the compiler to make these assumptions, which leads
10273 to more aggressive optimization decisions.
10274
10275 When a file is compiled with @option{-flto} without
10276 @option{-fuse-linker-plugin}, the generated object file is larger than
10277 a regular object file because it contains GIMPLE bytecodes and the usual
10278 final code (see @option{-ffat-lto-objects}. This means that
10279 object files with LTO information can be linked as normal object
10280 files; if @option{-fno-lto} is passed to the linker, no
10281 interprocedural optimizations are applied. Note that when
10282 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10283 but you cannot perform a regular, non-LTO link on them.
10284
10285 When producing the final binary, GCC only
10286 applies link-time optimizations to those files that contain bytecode.
10287 Therefore, you can mix and match object files and libraries with
10288 GIMPLE bytecodes and final object code. GCC automatically selects
10289 which files to optimize in LTO mode and which files to link without
10290 further processing.
10291
10292 Generally, options specified at link time override those
10293 specified at compile time, although in some cases GCC attempts to infer
10294 link-time options from the settings used to compile the input files.
10295
10296 If you do not specify an optimization level option @option{-O} at
10297 link time, then GCC uses the highest optimization level
10298 used when compiling the object files. Note that it is generally
10299 ineffective to specify an optimization level option only at link time and
10300 not at compile time, for two reasons. First, compiling without
10301 optimization suppresses compiler passes that gather information
10302 needed for effective optimization at link time. Second, some early
10303 optimization passes can be performed only at compile time and
10304 not at link time.
10305
10306 There are some code generation flags preserved by GCC when
10307 generating bytecodes, as they need to be used during the final link.
10308 Currently, the following options and their settings are taken from
10309 the first object file that explicitly specifies them:
10310 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10311 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10312 and all the @option{-m} target flags.
10313
10314 Certain ABI-changing flags are required to match in all compilation units,
10315 and trying to override this at link time with a conflicting value
10316 is ignored. This includes options such as @option{-freg-struct-return}
10317 and @option{-fpcc-struct-return}.
10318
10319 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10320 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10321 are passed through to the link stage and merged conservatively for
10322 conflicting translation units. Specifically
10323 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10324 precedence; and for example @option{-ffp-contract=off} takes precedence
10325 over @option{-ffp-contract=fast}. You can override them at link time.
10326
10327 If LTO encounters objects with C linkage declared with incompatible
10328 types in separate translation units to be linked together (undefined
10329 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10330 issued. The behavior is still undefined at run time. Similar
10331 diagnostics may be raised for other languages.
10332
10333 Another feature of LTO is that it is possible to apply interprocedural
10334 optimizations on files written in different languages:
10335
10336 @smallexample
10337 gcc -c -flto foo.c
10338 g++ -c -flto bar.cc
10339 gfortran -c -flto baz.f90
10340 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10341 @end smallexample
10342
10343 Notice that the final link is done with @command{g++} to get the C++
10344 runtime libraries and @option{-lgfortran} is added to get the Fortran
10345 runtime libraries. In general, when mixing languages in LTO mode, you
10346 should use the same link command options as when mixing languages in a
10347 regular (non-LTO) compilation.
10348
10349 If object files containing GIMPLE bytecode are stored in a library archive, say
10350 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10351 are using a linker with plugin support. To create static libraries suitable
10352 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10353 and @command{ranlib};
10354 to show the symbols of object files with GIMPLE bytecode, use
10355 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10356 and @command{nm} have been compiled with plugin support. At link time, use the
10357 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10358 the LTO optimization process:
10359
10360 @smallexample
10361 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10362 @end smallexample
10363
10364 With the linker plugin enabled, the linker extracts the needed
10365 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10366 to make them part of the aggregated GIMPLE image to be optimized.
10367
10368 If you are not using a linker with plugin support and/or do not
10369 enable the linker plugin, then the objects inside @file{libfoo.a}
10370 are extracted and linked as usual, but they do not participate
10371 in the LTO optimization process. In order to make a static library suitable
10372 for both LTO optimization and usual linkage, compile its object files with
10373 @option{-flto} @option{-ffat-lto-objects}.
10374
10375 Link-time optimizations do not require the presence of the whole program to
10376 operate. If the program does not require any symbols to be exported, it is
10377 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10378 the interprocedural optimizers to use more aggressive assumptions which may
10379 lead to improved optimization opportunities.
10380 Use of @option{-fwhole-program} is not needed when linker plugin is
10381 active (see @option{-fuse-linker-plugin}).
10382
10383 The current implementation of LTO makes no
10384 attempt to generate bytecode that is portable between different
10385 types of hosts. The bytecode files are versioned and there is a
10386 strict version check, so bytecode files generated in one version of
10387 GCC do not work with an older or newer version of GCC.
10388
10389 Link-time optimization does not work well with generation of debugging
10390 information on systems other than those using a combination of ELF and
10391 DWARF.
10392
10393 If you specify the optional @var{n}, the optimization and code
10394 generation done at link time is executed in parallel using @var{n}
10395 parallel jobs by utilizing an installed @command{make} program. The
10396 environment variable @env{MAKE} may be used to override the program
10397 used. The default value for @var{n} is 1.
10398
10399 You can also specify @option{-flto=jobserver} to use GNU make's
10400 job server mode to determine the number of parallel jobs. This
10401 is useful when the Makefile calling GCC is already executing in parallel.
10402 You must prepend a @samp{+} to the command recipe in the parent Makefile
10403 for this to work. This option likely only works if @env{MAKE} is
10404 GNU make.
10405
10406 @item -flto-partition=@var{alg}
10407 @opindex flto-partition
10408 Specify the partitioning algorithm used by the link-time optimizer.
10409 The value is either @samp{1to1} to specify a partitioning mirroring
10410 the original source files or @samp{balanced} to specify partitioning
10411 into equally sized chunks (whenever possible) or @samp{max} to create
10412 new partition for every symbol where possible. Specifying @samp{none}
10413 as an algorithm disables partitioning and streaming completely.
10414 The default value is @samp{balanced}. While @samp{1to1} can be used
10415 as an workaround for various code ordering issues, the @samp{max}
10416 partitioning is intended for internal testing only.
10417 The value @samp{one} specifies that exactly one partition should be
10418 used while the value @samp{none} bypasses partitioning and executes
10419 the link-time optimization step directly from the WPA phase.
10420
10421 @item -flto-compression-level=@var{n}
10422 @opindex flto-compression-level
10423 This option specifies the level of compression used for intermediate
10424 language written to LTO object files, and is only meaningful in
10425 conjunction with LTO mode (@option{-flto}). Valid
10426 values are 0 (no compression) to 9 (maximum compression). Values
10427 outside this range are clamped to either 0 or 9. If the option is not
10428 given, a default balanced compression setting is used.
10429
10430 @item -fuse-linker-plugin
10431 @opindex fuse-linker-plugin
10432 Enables the use of a linker plugin during link-time optimization. This
10433 option relies on plugin support in the linker, which is available in gold
10434 or in GNU ld 2.21 or newer.
10435
10436 This option enables the extraction of object files with GIMPLE bytecode out
10437 of library archives. This improves the quality of optimization by exposing
10438 more code to the link-time optimizer. This information specifies what
10439 symbols can be accessed externally (by non-LTO object or during dynamic
10440 linking). Resulting code quality improvements on binaries (and shared
10441 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10442 See @option{-flto} for a description of the effect of this flag and how to
10443 use it.
10444
10445 This option is enabled by default when LTO support in GCC is enabled
10446 and GCC was configured for use with
10447 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10448
10449 @item -ffat-lto-objects
10450 @opindex ffat-lto-objects
10451 Fat LTO objects are object files that contain both the intermediate language
10452 and the object code. This makes them usable for both LTO linking and normal
10453 linking. This option is effective only when compiling with @option{-flto}
10454 and is ignored at link time.
10455
10456 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10457 requires the complete toolchain to be aware of LTO. It requires a linker with
10458 linker plugin support for basic functionality. Additionally,
10459 @command{nm}, @command{ar} and @command{ranlib}
10460 need to support linker plugins to allow a full-featured build environment
10461 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10462 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10463 to these tools. With non fat LTO makefiles need to be modified to use them.
10464
10465 Note that modern binutils provide plugin auto-load mechanism.
10466 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10467 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10468 @command{gcc-ranlib}).
10469
10470 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10471 support.
10472
10473 @item -fcompare-elim
10474 @opindex fcompare-elim
10475 After register allocation and post-register allocation instruction splitting,
10476 identify arithmetic instructions that compute processor flags similar to a
10477 comparison operation based on that arithmetic. If possible, eliminate the
10478 explicit comparison operation.
10479
10480 This pass only applies to certain targets that cannot explicitly represent
10481 the comparison operation before register allocation is complete.
10482
10483 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10484
10485 @item -fcprop-registers
10486 @opindex fcprop-registers
10487 After register allocation and post-register allocation instruction splitting,
10488 perform a copy-propagation pass to try to reduce scheduling dependencies
10489 and occasionally eliminate the copy.
10490
10491 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10492
10493 @item -fprofile-correction
10494 @opindex fprofile-correction
10495 Profiles collected using an instrumented binary for multi-threaded programs may
10496 be inconsistent due to missed counter updates. When this option is specified,
10497 GCC uses heuristics to correct or smooth out such inconsistencies. By
10498 default, GCC emits an error message when an inconsistent profile is detected.
10499
10500 This option is enabled by @option{-fauto-profile}.
10501
10502 @item -fprofile-use
10503 @itemx -fprofile-use=@var{path}
10504 @opindex fprofile-use
10505 Enable profile feedback-directed optimizations,
10506 and the following optimizations, many of which
10507 are generally profitable only with profile feedback available:
10508
10509 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10510 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10511 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10512 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10513 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10514 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10515 -fprofile-reorder-functions}
10516
10517 Before you can use this option, you must first generate profiling information.
10518 @xref{Instrumentation Options}, for information about the
10519 @option{-fprofile-generate} option.
10520
10521 By default, GCC emits an error message if the feedback profiles do not
10522 match the source code. This error can be turned into a warning by using
10523 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10524 optimized code. Additionally, by default, GCC also emits a warning message if
10525 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10526
10527 If @var{path} is specified, GCC looks at the @var{path} to find
10528 the profile feedback data files. See @option{-fprofile-dir}.
10529
10530 @item -fauto-profile
10531 @itemx -fauto-profile=@var{path}
10532 @opindex fauto-profile
10533 Enable sampling-based feedback-directed optimizations,
10534 and the following optimizations,
10535 many of which are generally profitable only with profile feedback available:
10536
10537 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10538 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10539 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10540 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10541 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10542 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10543 -fprofile-correction}
10544
10545 @var{path} is the name of a file containing AutoFDO profile information.
10546 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10547
10548 Producing an AutoFDO profile data file requires running your program
10549 with the @command{perf} utility on a supported GNU/Linux target system.
10550 For more information, see @uref{https://perf.wiki.kernel.org/}.
10551
10552 E.g.
10553 @smallexample
10554 perf record -e br_inst_retired:near_taken -b -o perf.data \
10555 -- your_program
10556 @end smallexample
10557
10558 Then use the @command{create_gcov} tool to convert the raw profile data
10559 to a format that can be used by GCC.@ You must also supply the
10560 unstripped binary for your program to this tool.
10561 See @uref{https://github.com/google/autofdo}.
10562
10563 E.g.
10564 @smallexample
10565 create_gcov --binary=your_program.unstripped --profile=perf.data \
10566 --gcov=profile.afdo
10567 @end smallexample
10568 @end table
10569
10570 The following options control compiler behavior regarding floating-point
10571 arithmetic. These options trade off between speed and
10572 correctness. All must be specifically enabled.
10573
10574 @table @gcctabopt
10575 @item -ffloat-store
10576 @opindex ffloat-store
10577 Do not store floating-point variables in registers, and inhibit other
10578 options that might change whether a floating-point value is taken from a
10579 register or memory.
10580
10581 @cindex floating-point precision
10582 This option prevents undesirable excess precision on machines such as
10583 the 68000 where the floating registers (of the 68881) keep more
10584 precision than a @code{double} is supposed to have. Similarly for the
10585 x86 architecture. For most programs, the excess precision does only
10586 good, but a few programs rely on the precise definition of IEEE floating
10587 point. Use @option{-ffloat-store} for such programs, after modifying
10588 them to store all pertinent intermediate computations into variables.
10589
10590 @item -fexcess-precision=@var{style}
10591 @opindex fexcess-precision
10592 This option allows further control over excess precision on machines
10593 where floating-point operations occur in a format with more precision or
10594 range than the IEEE standard and interchange floating-point types. By
10595 default, @option{-fexcess-precision=fast} is in effect; this means that
10596 operations may be carried out in a wider precision than the types specified
10597 in the source if that would result in faster code, and it is unpredictable
10598 when rounding to the types specified in the source code takes place.
10599 When compiling C, if @option{-fexcess-precision=standard} is specified then
10600 excess precision follows the rules specified in ISO C99; in particular,
10601 both casts and assignments cause values to be rounded to their
10602 semantic types (whereas @option{-ffloat-store} only affects
10603 assignments). This option is enabled by default for C if a strict
10604 conformance option such as @option{-std=c99} is used.
10605 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10606 regardless of whether a strict conformance option is used.
10607
10608 @opindex mfpmath
10609 @option{-fexcess-precision=standard} is not implemented for languages
10610 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10611 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10612 semantics apply without excess precision, and in the latter, rounding
10613 is unpredictable.
10614
10615 @item -ffast-math
10616 @opindex ffast-math
10617 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10618 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10619 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10620 @option{-fexcess-precision=fast}.
10621
10622 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10623
10624 This option is not turned on by any @option{-O} option besides
10625 @option{-Ofast} since it can result in incorrect output for programs
10626 that depend on an exact implementation of IEEE or ISO rules/specifications
10627 for math functions. It may, however, yield faster code for programs
10628 that do not require the guarantees of these specifications.
10629
10630 @item -fno-math-errno
10631 @opindex fno-math-errno
10632 @opindex fmath-errno
10633 Do not set @code{errno} after calling math functions that are executed
10634 with a single instruction, e.g., @code{sqrt}. A program that relies on
10635 IEEE exceptions for math error handling may want to use this flag
10636 for speed while maintaining IEEE arithmetic compatibility.
10637
10638 This option is not turned on by any @option{-O} option since
10639 it can result in incorrect output for programs that depend on
10640 an exact implementation of IEEE or ISO rules/specifications for
10641 math functions. It may, however, yield faster code for programs
10642 that do not require the guarantees of these specifications.
10643
10644 The default is @option{-fmath-errno}.
10645
10646 On Darwin systems, the math library never sets @code{errno}. There is
10647 therefore no reason for the compiler to consider the possibility that
10648 it might, and @option{-fno-math-errno} is the default.
10649
10650 @item -funsafe-math-optimizations
10651 @opindex funsafe-math-optimizations
10652
10653 Allow optimizations for floating-point arithmetic that (a) assume
10654 that arguments and results are valid and (b) may violate IEEE or
10655 ANSI standards. When used at link time, it may include libraries
10656 or startup files that change the default FPU control word or other
10657 similar optimizations.
10658
10659 This option is not turned on by any @option{-O} option since
10660 it can result in incorrect output for programs that depend on
10661 an exact implementation of IEEE or ISO rules/specifications for
10662 math functions. It may, however, yield faster code for programs
10663 that do not require the guarantees of these specifications.
10664 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10665 @option{-fassociative-math} and @option{-freciprocal-math}.
10666
10667 The default is @option{-fno-unsafe-math-optimizations}.
10668
10669 @item -fassociative-math
10670 @opindex fassociative-math
10671
10672 Allow re-association of operands in series of floating-point operations.
10673 This violates the ISO C and C++ language standard by possibly changing
10674 computation result. NOTE: re-ordering may change the sign of zero as
10675 well as ignore NaNs and inhibit or create underflow or overflow (and
10676 thus cannot be used on code that relies on rounding behavior like
10677 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10678 and thus may not be used when ordered comparisons are required.
10679 This option requires that both @option{-fno-signed-zeros} and
10680 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10681 much sense with @option{-frounding-math}. For Fortran the option
10682 is automatically enabled when both @option{-fno-signed-zeros} and
10683 @option{-fno-trapping-math} are in effect.
10684
10685 The default is @option{-fno-associative-math}.
10686
10687 @item -freciprocal-math
10688 @opindex freciprocal-math
10689
10690 Allow the reciprocal of a value to be used instead of dividing by
10691 the value if this enables optimizations. For example @code{x / y}
10692 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10693 is subject to common subexpression elimination. Note that this loses
10694 precision and increases the number of flops operating on the value.
10695
10696 The default is @option{-fno-reciprocal-math}.
10697
10698 @item -ffinite-math-only
10699 @opindex ffinite-math-only
10700 Allow optimizations for floating-point arithmetic that assume
10701 that arguments and results are not NaNs or +-Infs.
10702
10703 This option is not turned on by any @option{-O} option since
10704 it can result in incorrect output for programs that depend on
10705 an exact implementation of IEEE or ISO rules/specifications for
10706 math functions. It may, however, yield faster code for programs
10707 that do not require the guarantees of these specifications.
10708
10709 The default is @option{-fno-finite-math-only}.
10710
10711 @item -fno-signed-zeros
10712 @opindex fno-signed-zeros
10713 @opindex fsigned-zeros
10714 Allow optimizations for floating-point arithmetic that ignore the
10715 signedness of zero. IEEE arithmetic specifies the behavior of
10716 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10717 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10718 This option implies that the sign of a zero result isn't significant.
10719
10720 The default is @option{-fsigned-zeros}.
10721
10722 @item -fno-trapping-math
10723 @opindex fno-trapping-math
10724 @opindex ftrapping-math
10725 Compile code assuming that floating-point operations cannot generate
10726 user-visible traps. These traps include division by zero, overflow,
10727 underflow, inexact result and invalid operation. This option requires
10728 that @option{-fno-signaling-nans} be in effect. Setting this option may
10729 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10730
10731 This option should never be turned on by any @option{-O} option since
10732 it can result in incorrect output for programs that depend on
10733 an exact implementation of IEEE or ISO rules/specifications for
10734 math functions.
10735
10736 The default is @option{-ftrapping-math}.
10737
10738 @item -frounding-math
10739 @opindex frounding-math
10740 Disable transformations and optimizations that assume default floating-point
10741 rounding behavior. This is round-to-zero for all floating point
10742 to integer conversions, and round-to-nearest for all other arithmetic
10743 truncations. This option should be specified for programs that change
10744 the FP rounding mode dynamically, or that may be executed with a
10745 non-default rounding mode. This option disables constant folding of
10746 floating-point expressions at compile time (which may be affected by
10747 rounding mode) and arithmetic transformations that are unsafe in the
10748 presence of sign-dependent rounding modes.
10749
10750 The default is @option{-fno-rounding-math}.
10751
10752 This option is experimental and does not currently guarantee to
10753 disable all GCC optimizations that are affected by rounding mode.
10754 Future versions of GCC may provide finer control of this setting
10755 using C99's @code{FENV_ACCESS} pragma. This command-line option
10756 will be used to specify the default state for @code{FENV_ACCESS}.
10757
10758 @item -fsignaling-nans
10759 @opindex fsignaling-nans
10760 Compile code assuming that IEEE signaling NaNs may generate user-visible
10761 traps during floating-point operations. Setting this option disables
10762 optimizations that may change the number of exceptions visible with
10763 signaling NaNs. This option implies @option{-ftrapping-math}.
10764
10765 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10766 be defined.
10767
10768 The default is @option{-fno-signaling-nans}.
10769
10770 This option is experimental and does not currently guarantee to
10771 disable all GCC optimizations that affect signaling NaN behavior.
10772
10773 @item -fno-fp-int-builtin-inexact
10774 @opindex fno-fp-int-builtin-inexact
10775 @opindex ffp-int-builtin-inexact
10776 Do not allow the built-in functions @code{ceil}, @code{floor},
10777 @code{round} and @code{trunc}, and their @code{float} and @code{long
10778 double} variants, to generate code that raises the ``inexact''
10779 floating-point exception for noninteger arguments. ISO C99 and C11
10780 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10781 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10782 functions to do so.
10783
10784 The default is @option{-ffp-int-builtin-inexact}, allowing the
10785 exception to be raised. This option does nothing unless
10786 @option{-ftrapping-math} is in effect.
10787
10788 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10789 generate a call to a library function then the ``inexact'' exception
10790 may be raised if the library implementation does not follow TS 18661.
10791
10792 @item -fsingle-precision-constant
10793 @opindex fsingle-precision-constant
10794 Treat floating-point constants as single precision instead of
10795 implicitly converting them to double-precision constants.
10796
10797 @item -fcx-limited-range
10798 @opindex fcx-limited-range
10799 When enabled, this option states that a range reduction step is not
10800 needed when performing complex division. Also, there is no checking
10801 whether the result of a complex multiplication or division is @code{NaN
10802 + I*NaN}, with an attempt to rescue the situation in that case. The
10803 default is @option{-fno-cx-limited-range}, but is enabled by
10804 @option{-ffast-math}.
10805
10806 This option controls the default setting of the ISO C99
10807 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10808 all languages.
10809
10810 @item -fcx-fortran-rules
10811 @opindex fcx-fortran-rules
10812 Complex multiplication and division follow Fortran rules. Range
10813 reduction is done as part of complex division, but there is no checking
10814 whether the result of a complex multiplication or division is @code{NaN
10815 + I*NaN}, with an attempt to rescue the situation in that case.
10816
10817 The default is @option{-fno-cx-fortran-rules}.
10818
10819 @end table
10820
10821 The following options control optimizations that may improve
10822 performance, but are not enabled by any @option{-O} options. This
10823 section includes experimental options that may produce broken code.
10824
10825 @table @gcctabopt
10826 @item -fbranch-probabilities
10827 @opindex fbranch-probabilities
10828 After running a program compiled with @option{-fprofile-arcs}
10829 (@pxref{Instrumentation Options}),
10830 you can compile it a second time using
10831 @option{-fbranch-probabilities}, to improve optimizations based on
10832 the number of times each branch was taken. When a program
10833 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10834 counts to a file called @file{@var{sourcename}.gcda} for each source
10835 file. The information in this data file is very dependent on the
10836 structure of the generated code, so you must use the same source code
10837 and the same optimization options for both compilations.
10838
10839 With @option{-fbranch-probabilities}, GCC puts a
10840 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10841 These can be used to improve optimization. Currently, they are only
10842 used in one place: in @file{reorg.c}, instead of guessing which path a
10843 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10844 exactly determine which path is taken more often.
10845
10846 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10847
10848 @item -fprofile-values
10849 @opindex fprofile-values
10850 If combined with @option{-fprofile-arcs}, it adds code so that some
10851 data about values of expressions in the program is gathered.
10852
10853 With @option{-fbranch-probabilities}, it reads back the data gathered
10854 from profiling values of expressions for usage in optimizations.
10855
10856 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10857 @option{-fauto-profile}.
10858
10859 @item -fprofile-reorder-functions
10860 @opindex fprofile-reorder-functions
10861 Function reordering based on profile instrumentation collects
10862 first time of execution of a function and orders these functions
10863 in ascending order.
10864
10865 Enabled with @option{-fprofile-use}.
10866
10867 @item -fvpt
10868 @opindex fvpt
10869 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10870 to add code to gather information about values of expressions.
10871
10872 With @option{-fbranch-probabilities}, it reads back the data gathered
10873 and actually performs the optimizations based on them.
10874 Currently the optimizations include specialization of division operations
10875 using the knowledge about the value of the denominator.
10876
10877 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10878
10879 @item -frename-registers
10880 @opindex frename-registers
10881 Attempt to avoid false dependencies in scheduled code by making use
10882 of registers left over after register allocation. This optimization
10883 most benefits processors with lots of registers. Depending on the
10884 debug information format adopted by the target, however, it can
10885 make debugging impossible, since variables no longer stay in
10886 a ``home register''.
10887
10888 Enabled by default with @option{-funroll-loops}.
10889
10890 @item -fschedule-fusion
10891 @opindex fschedule-fusion
10892 Performs a target dependent pass over the instruction stream to schedule
10893 instructions of same type together because target machine can execute them
10894 more efficiently if they are adjacent to each other in the instruction flow.
10895
10896 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10897
10898 @item -ftracer
10899 @opindex ftracer
10900 Perform tail duplication to enlarge superblock size. This transformation
10901 simplifies the control flow of the function allowing other optimizations to do
10902 a better job.
10903
10904 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10905
10906 @item -funroll-loops
10907 @opindex funroll-loops
10908 Unroll loops whose number of iterations can be determined at compile time or
10909 upon entry to the loop. @option{-funroll-loops} implies
10910 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10911 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10912 a small constant number of iterations). This option makes code larger, and may
10913 or may not make it run faster.
10914
10915 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10916
10917 @item -funroll-all-loops
10918 @opindex funroll-all-loops
10919 Unroll all loops, even if their number of iterations is uncertain when
10920 the loop is entered. This usually makes programs run more slowly.
10921 @option{-funroll-all-loops} implies the same options as
10922 @option{-funroll-loops}.
10923
10924 @item -fpeel-loops
10925 @opindex fpeel-loops
10926 Peels loops for which there is enough information that they do not
10927 roll much (from profile feedback or static analysis). It also turns on
10928 complete loop peeling (i.e.@: complete removal of loops with small constant
10929 number of iterations).
10930
10931 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10932
10933 @item -fmove-loop-invariants
10934 @opindex fmove-loop-invariants
10935 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10936 at level @option{-O1} and higher, except for @option{-Og}.
10937
10938 @item -fsplit-loops
10939 @opindex fsplit-loops
10940 Split a loop into two if it contains a condition that's always true
10941 for one side of the iteration space and false for the other.
10942
10943 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10944
10945 @item -funswitch-loops
10946 @opindex funswitch-loops
10947 Move branches with loop invariant conditions out of the loop, with duplicates
10948 of the loop on both branches (modified according to result of the condition).
10949
10950 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10951
10952 @item -fversion-loops-for-strides
10953 @opindex fversion-loops-for-strides
10954 If a loop iterates over an array with a variable stride, create another
10955 version of the loop that assumes the stride is always one. For example:
10956
10957 @smallexample
10958 for (int i = 0; i < n; ++i)
10959 x[i * stride] = @dots{};
10960 @end smallexample
10961
10962 becomes:
10963
10964 @smallexample
10965 if (stride == 1)
10966 for (int i = 0; i < n; ++i)
10967 x[i] = @dots{};
10968 else
10969 for (int i = 0; i < n; ++i)
10970 x[i * stride] = @dots{};
10971 @end smallexample
10972
10973 This is particularly useful for assumed-shape arrays in Fortran where
10974 (for example) it allows better vectorization assuming contiguous accesses.
10975 This flag is enabled by default at @option{-O3}.
10976 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10977
10978 @item -ffunction-sections
10979 @itemx -fdata-sections
10980 @opindex ffunction-sections
10981 @opindex fdata-sections
10982 Place each function or data item into its own section in the output
10983 file if the target supports arbitrary sections. The name of the
10984 function or the name of the data item determines the section's name
10985 in the output file.
10986
10987 Use these options on systems where the linker can perform optimizations to
10988 improve locality of reference in the instruction space. Most systems using the
10989 ELF object format have linkers with such optimizations. On AIX, the linker
10990 rearranges sections (CSECTs) based on the call graph. The performance impact
10991 varies.
10992
10993 Together with a linker garbage collection (linker @option{--gc-sections}
10994 option) these options may lead to smaller statically-linked executables (after
10995 stripping).
10996
10997 On ELF/DWARF systems these options do not degenerate the quality of the debug
10998 information. There could be issues with other object files/debug info formats.
10999
11000 Only use these options when there are significant benefits from doing so. When
11001 you specify these options, the assembler and linker create larger object and
11002 executable files and are also slower. These options affect code generation.
11003 They prevent optimizations by the compiler and assembler using relative
11004 locations inside a translation unit since the locations are unknown until
11005 link time. An example of such an optimization is relaxing calls to short call
11006 instructions.
11007
11008 @item -fbranch-target-load-optimize
11009 @opindex fbranch-target-load-optimize
11010 Perform branch target register load optimization before prologue / epilogue
11011 threading.
11012 The use of target registers can typically be exposed only during reload,
11013 thus hoisting loads out of loops and doing inter-block scheduling needs
11014 a separate optimization pass.
11015
11016 @item -fbranch-target-load-optimize2
11017 @opindex fbranch-target-load-optimize2
11018 Perform branch target register load optimization after prologue / epilogue
11019 threading.
11020
11021 @item -fbtr-bb-exclusive
11022 @opindex fbtr-bb-exclusive
11023 When performing branch target register load optimization, don't reuse
11024 branch target registers within any basic block.
11025
11026 @item -fstdarg-opt
11027 @opindex fstdarg-opt
11028 Optimize the prologue of variadic argument functions with respect to usage of
11029 those arguments.
11030
11031 @item -fsection-anchors
11032 @opindex fsection-anchors
11033 Try to reduce the number of symbolic address calculations by using
11034 shared ``anchor'' symbols to address nearby objects. This transformation
11035 can help to reduce the number of GOT entries and GOT accesses on some
11036 targets.
11037
11038 For example, the implementation of the following function @code{foo}:
11039
11040 @smallexample
11041 static int a, b, c;
11042 int foo (void) @{ return a + b + c; @}
11043 @end smallexample
11044
11045 @noindent
11046 usually calculates the addresses of all three variables, but if you
11047 compile it with @option{-fsection-anchors}, it accesses the variables
11048 from a common anchor point instead. The effect is similar to the
11049 following pseudocode (which isn't valid C):
11050
11051 @smallexample
11052 int foo (void)
11053 @{
11054 register int *xr = &x;
11055 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11056 @}
11057 @end smallexample
11058
11059 Not all targets support this option.
11060
11061 @item --param @var{name}=@var{value}
11062 @opindex param
11063 In some places, GCC uses various constants to control the amount of
11064 optimization that is done. For example, GCC does not inline functions
11065 that contain more than a certain number of instructions. You can
11066 control some of these constants on the command line using the
11067 @option{--param} option.
11068
11069 The names of specific parameters, and the meaning of the values, are
11070 tied to the internals of the compiler, and are subject to change
11071 without notice in future releases.
11072
11073 In order to get minimal, maximal and default value of a parameter,
11074 one can use @option{--help=param -Q} options.
11075
11076 In each case, the @var{value} is an integer. The allowable choices for
11077 @var{name} are:
11078
11079 @table @gcctabopt
11080 @item predictable-branch-outcome
11081 When branch is predicted to be taken with probability lower than this threshold
11082 (in percent), then it is considered well predictable.
11083
11084 @item max-rtl-if-conversion-insns
11085 RTL if-conversion tries to remove conditional branches around a block and
11086 replace them with conditionally executed instructions. This parameter
11087 gives the maximum number of instructions in a block which should be
11088 considered for if-conversion. The compiler will
11089 also use other heuristics to decide whether if-conversion is likely to be
11090 profitable.
11091
11092 @item max-rtl-if-conversion-predictable-cost
11093 @itemx max-rtl-if-conversion-unpredictable-cost
11094 RTL if-conversion will try to remove conditional branches around a block
11095 and replace them with conditionally executed instructions. These parameters
11096 give the maximum permissible cost for the sequence that would be generated
11097 by if-conversion depending on whether the branch is statically determined
11098 to be predictable or not. The units for this parameter are the same as
11099 those for the GCC internal seq_cost metric. The compiler will try to
11100 provide a reasonable default for this parameter using the BRANCH_COST
11101 target macro.
11102
11103 @item max-crossjump-edges
11104 The maximum number of incoming edges to consider for cross-jumping.
11105 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11106 the number of edges incoming to each block. Increasing values mean
11107 more aggressive optimization, making the compilation time increase with
11108 probably small improvement in executable size.
11109
11110 @item min-crossjump-insns
11111 The minimum number of instructions that must be matched at the end
11112 of two blocks before cross-jumping is performed on them. This
11113 value is ignored in the case where all instructions in the block being
11114 cross-jumped from are matched.
11115
11116 @item max-grow-copy-bb-insns
11117 The maximum code size expansion factor when copying basic blocks
11118 instead of jumping. The expansion is relative to a jump instruction.
11119
11120 @item max-goto-duplication-insns
11121 The maximum number of instructions to duplicate to a block that jumps
11122 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11123 passes, GCC factors computed gotos early in the compilation process,
11124 and unfactors them as late as possible. Only computed jumps at the
11125 end of a basic blocks with no more than max-goto-duplication-insns are
11126 unfactored.
11127
11128 @item max-delay-slot-insn-search
11129 The maximum number of instructions to consider when looking for an
11130 instruction to fill a delay slot. If more than this arbitrary number of
11131 instructions are searched, the time savings from filling the delay slot
11132 are minimal, so stop searching. Increasing values mean more
11133 aggressive optimization, making the compilation time increase with probably
11134 small improvement in execution time.
11135
11136 @item max-delay-slot-live-search
11137 When trying to fill delay slots, the maximum number of instructions to
11138 consider when searching for a block with valid live register
11139 information. Increasing this arbitrarily chosen value means more
11140 aggressive optimization, increasing the compilation time. This parameter
11141 should be removed when the delay slot code is rewritten to maintain the
11142 control-flow graph.
11143
11144 @item max-gcse-memory
11145 The approximate maximum amount of memory that can be allocated in
11146 order to perform the global common subexpression elimination
11147 optimization. If more memory than specified is required, the
11148 optimization is not done.
11149
11150 @item max-gcse-insertion-ratio
11151 If the ratio of expression insertions to deletions is larger than this value
11152 for any expression, then RTL PRE inserts or removes the expression and thus
11153 leaves partially redundant computations in the instruction stream.
11154
11155 @item max-pending-list-length
11156 The maximum number of pending dependencies scheduling allows
11157 before flushing the current state and starting over. Large functions
11158 with few branches or calls can create excessively large lists which
11159 needlessly consume memory and resources.
11160
11161 @item max-modulo-backtrack-attempts
11162 The maximum number of backtrack attempts the scheduler should make
11163 when modulo scheduling a loop. Larger values can exponentially increase
11164 compilation time.
11165
11166 @item max-inline-insns-single
11167 Several parameters control the tree inliner used in GCC@.
11168 This number sets the maximum number of instructions (counted in GCC's
11169 internal representation) in a single function that the tree inliner
11170 considers for inlining. This only affects functions declared
11171 inline and methods implemented in a class declaration (C++).
11172
11173 @item max-inline-insns-auto
11174 When you use @option{-finline-functions} (included in @option{-O3}),
11175 a lot of functions that would otherwise not be considered for inlining
11176 by the compiler are investigated. To those functions, a different
11177 (more restrictive) limit compared to functions declared inline can
11178 be applied.
11179
11180 @item max-inline-insns-small
11181 This is bound applied to calls which are considered relevant with
11182 @option{-finline-small-functions}.
11183
11184 @item max-inline-insns-size
11185 This is bound applied to calls which are optimized for size. Small growth
11186 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11187
11188 @item uninlined-function-insns
11189 Number of instructions accounted by inliner for function overhead such as
11190 function prologue and epilogue.
11191
11192 @item uninlined-function-time
11193 Extra time accounted by inliner for function overhead such as time needed to
11194 execute function prologue and epilogue
11195
11196 @item uninlined-thunk-insns
11197 @item uninlined-thunk-time
11198 Same as @option{--param uninlined-function-insns} and
11199 @option{--param uninlined-function-time} but applied to function thunks
11200
11201 @item inline-min-speedup
11202 When estimated performance improvement of caller + callee runtime exceeds this
11203 threshold (in percent), the function can be inlined regardless of the limit on
11204 @option{--param max-inline-insns-single} and @option{--param
11205 max-inline-insns-auto}.
11206
11207 @item large-function-insns
11208 The limit specifying really large functions. For functions larger than this
11209 limit after inlining, inlining is constrained by
11210 @option{--param large-function-growth}. This parameter is useful primarily
11211 to avoid extreme compilation time caused by non-linear algorithms used by the
11212 back end.
11213
11214 @item large-function-growth
11215 Specifies maximal growth of large function caused by inlining in percents.
11216 For example, parameter value 100 limits large function growth to 2.0 times
11217 the original size.
11218
11219 @item large-unit-insns
11220 The limit specifying large translation unit. Growth caused by inlining of
11221 units larger than this limit is limited by @option{--param inline-unit-growth}.
11222 For small units this might be too tight.
11223 For example, consider a unit consisting of function A
11224 that is inline and B that just calls A three times. If B is small relative to
11225 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11226 large units consisting of small inlineable functions, however, the overall unit
11227 growth limit is needed to avoid exponential explosion of code size. Thus for
11228 smaller units, the size is increased to @option{--param large-unit-insns}
11229 before applying @option{--param inline-unit-growth}.
11230
11231 @item inline-unit-growth
11232 Specifies maximal overall growth of the compilation unit caused by inlining.
11233 For example, parameter value 20 limits unit growth to 1.2 times the original
11234 size. Cold functions (either marked cold via an attribute or by profile
11235 feedback) are not accounted into the unit size.
11236
11237 @item ipcp-unit-growth
11238 Specifies maximal overall growth of the compilation unit caused by
11239 interprocedural constant propagation. For example, parameter value 10 limits
11240 unit growth to 1.1 times the original size.
11241
11242 @item large-stack-frame
11243 The limit specifying large stack frames. While inlining the algorithm is trying
11244 to not grow past this limit too much.
11245
11246 @item large-stack-frame-growth
11247 Specifies maximal growth of large stack frames caused by inlining in percents.
11248 For example, parameter value 1000 limits large stack frame growth to 11 times
11249 the original size.
11250
11251 @item max-inline-insns-recursive
11252 @itemx max-inline-insns-recursive-auto
11253 Specifies the maximum number of instructions an out-of-line copy of a
11254 self-recursive inline
11255 function can grow into by performing recursive inlining.
11256
11257 @option{--param max-inline-insns-recursive} applies to functions
11258 declared inline.
11259 For functions not declared inline, recursive inlining
11260 happens only when @option{-finline-functions} (included in @option{-O3}) is
11261 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11262
11263 @item max-inline-recursive-depth
11264 @itemx max-inline-recursive-depth-auto
11265 Specifies the maximum recursion depth used for recursive inlining.
11266
11267 @option{--param max-inline-recursive-depth} applies to functions
11268 declared inline. For functions not declared inline, recursive inlining
11269 happens only when @option{-finline-functions} (included in @option{-O3}) is
11270 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11271
11272 @item min-inline-recursive-probability
11273 Recursive inlining is profitable only for function having deep recursion
11274 in average and can hurt for function having little recursion depth by
11275 increasing the prologue size or complexity of function body to other
11276 optimizers.
11277
11278 When profile feedback is available (see @option{-fprofile-generate}) the actual
11279 recursion depth can be guessed from the probability that function recurses
11280 via a given call expression. This parameter limits inlining only to call
11281 expressions whose probability exceeds the given threshold (in percents).
11282
11283 @item early-inlining-insns
11284 Specify growth that the early inliner can make. In effect it increases
11285 the amount of inlining for code having a large abstraction penalty.
11286
11287 @item max-early-inliner-iterations
11288 Limit of iterations of the early inliner. This basically bounds
11289 the number of nested indirect calls the early inliner can resolve.
11290 Deeper chains are still handled by late inlining.
11291
11292 @item comdat-sharing-probability
11293 Probability (in percent) that C++ inline function with comdat visibility
11294 are shared across multiple compilation units.
11295
11296 @item profile-func-internal-id
11297 A parameter to control whether to use function internal id in profile
11298 database lookup. If the value is 0, the compiler uses an id that
11299 is based on function assembler name and filename, which makes old profile
11300 data more tolerant to source changes such as function reordering etc.
11301
11302 @item min-vect-loop-bound
11303 The minimum number of iterations under which loops are not vectorized
11304 when @option{-ftree-vectorize} is used. The number of iterations after
11305 vectorization needs to be greater than the value specified by this option
11306 to allow vectorization.
11307
11308 @item gcse-cost-distance-ratio
11309 Scaling factor in calculation of maximum distance an expression
11310 can be moved by GCSE optimizations. This is currently supported only in the
11311 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11312 is with simple expressions, i.e., the expressions that have cost
11313 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11314 hoisting of simple expressions.
11315
11316 @item gcse-unrestricted-cost
11317 Cost, roughly measured as the cost of a single typical machine
11318 instruction, at which GCSE optimizations do not constrain
11319 the distance an expression can travel. This is currently
11320 supported only in the code hoisting pass. The lesser the cost,
11321 the more aggressive code hoisting is. Specifying 0
11322 allows all expressions to travel unrestricted distances.
11323
11324 @item max-hoist-depth
11325 The depth of search in the dominator tree for expressions to hoist.
11326 This is used to avoid quadratic behavior in hoisting algorithm.
11327 The value of 0 does not limit on the search, but may slow down compilation
11328 of huge functions.
11329
11330 @item max-tail-merge-comparisons
11331 The maximum amount of similar bbs to compare a bb with. This is used to
11332 avoid quadratic behavior in tree tail merging.
11333
11334 @item max-tail-merge-iterations
11335 The maximum amount of iterations of the pass over the function. This is used to
11336 limit compilation time in tree tail merging.
11337
11338 @item store-merging-allow-unaligned
11339 Allow the store merging pass to introduce unaligned stores if it is legal to
11340 do so.
11341
11342 @item max-stores-to-merge
11343 The maximum number of stores to attempt to merge into wider stores in the store
11344 merging pass.
11345
11346 @item max-unrolled-insns
11347 The maximum number of instructions that a loop may have to be unrolled.
11348 If a loop is unrolled, this parameter also determines how many times
11349 the loop code is unrolled.
11350
11351 @item max-average-unrolled-insns
11352 The maximum number of instructions biased by probabilities of their execution
11353 that a loop may have to be unrolled. If a loop is unrolled,
11354 this parameter also determines how many times the loop code is unrolled.
11355
11356 @item max-unroll-times
11357 The maximum number of unrollings of a single loop.
11358
11359 @item max-peeled-insns
11360 The maximum number of instructions that a loop may have to be peeled.
11361 If a loop is peeled, this parameter also determines how many times
11362 the loop code is peeled.
11363
11364 @item max-peel-times
11365 The maximum number of peelings of a single loop.
11366
11367 @item max-peel-branches
11368 The maximum number of branches on the hot path through the peeled sequence.
11369
11370 @item max-completely-peeled-insns
11371 The maximum number of insns of a completely peeled loop.
11372
11373 @item max-completely-peel-times
11374 The maximum number of iterations of a loop to be suitable for complete peeling.
11375
11376 @item max-completely-peel-loop-nest-depth
11377 The maximum depth of a loop nest suitable for complete peeling.
11378
11379 @item max-unswitch-insns
11380 The maximum number of insns of an unswitched loop.
11381
11382 @item max-unswitch-level
11383 The maximum number of branches unswitched in a single loop.
11384
11385 @item lim-expensive
11386 The minimum cost of an expensive expression in the loop invariant motion.
11387
11388 @item iv-consider-all-candidates-bound
11389 Bound on number of candidates for induction variables, below which
11390 all candidates are considered for each use in induction variable
11391 optimizations. If there are more candidates than this,
11392 only the most relevant ones are considered to avoid quadratic time complexity.
11393
11394 @item iv-max-considered-uses
11395 The induction variable optimizations give up on loops that contain more
11396 induction variable uses.
11397
11398 @item iv-always-prune-cand-set-bound
11399 If the number of candidates in the set is smaller than this value,
11400 always try to remove unnecessary ivs from the set
11401 when adding a new one.
11402
11403 @item avg-loop-niter
11404 Average number of iterations of a loop.
11405
11406 @item dse-max-object-size
11407 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11408 Larger values may result in larger compilation times.
11409
11410 @item dse-max-alias-queries-per-store
11411 Maximum number of queries into the alias oracle per store.
11412 Larger values result in larger compilation times and may result in more
11413 removed dead stores.
11414
11415 @item scev-max-expr-size
11416 Bound on size of expressions used in the scalar evolutions analyzer.
11417 Large expressions slow the analyzer.
11418
11419 @item scev-max-expr-complexity
11420 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11421 Complex expressions slow the analyzer.
11422
11423 @item max-tree-if-conversion-phi-args
11424 Maximum number of arguments in a PHI supported by TREE if conversion
11425 unless the loop is marked with simd pragma.
11426
11427 @item vect-max-version-for-alignment-checks
11428 The maximum number of run-time checks that can be performed when
11429 doing loop versioning for alignment in the vectorizer.
11430
11431 @item vect-max-version-for-alias-checks
11432 The maximum number of run-time checks that can be performed when
11433 doing loop versioning for alias in the vectorizer.
11434
11435 @item vect-max-peeling-for-alignment
11436 The maximum number of loop peels to enhance access alignment
11437 for vectorizer. Value -1 means no limit.
11438
11439 @item max-iterations-to-track
11440 The maximum number of iterations of a loop the brute-force algorithm
11441 for analysis of the number of iterations of the loop tries to evaluate.
11442
11443 @item hot-bb-count-ws-permille
11444 A basic block profile count is considered hot if it contributes to
11445 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
11446
11447 @item hot-bb-frequency-fraction
11448 Select fraction of the entry block frequency of executions of basic block in
11449 function given basic block needs to have to be considered hot.
11450
11451 @item max-predicted-iterations
11452 The maximum number of loop iterations we predict statically. This is useful
11453 in cases where a function contains a single loop with known bound and
11454 another loop with unknown bound.
11455 The known number of iterations is predicted correctly, while
11456 the unknown number of iterations average to roughly 10. This means that the
11457 loop without bounds appears artificially cold relative to the other one.
11458
11459 @item builtin-expect-probability
11460 Control the probability of the expression having the specified value. This
11461 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11462
11463 @item builtin-string-cmp-inline-length
11464 The maximum length of a constant string for a builtin string cmp call
11465 eligible for inlining.
11466
11467 @item align-threshold
11468
11469 Select fraction of the maximal frequency of executions of a basic block in
11470 a function to align the basic block.
11471
11472 @item align-loop-iterations
11473
11474 A loop expected to iterate at least the selected number of iterations is
11475 aligned.
11476
11477 @item tracer-dynamic-coverage
11478 @itemx tracer-dynamic-coverage-feedback
11479
11480 This value is used to limit superblock formation once the given percentage of
11481 executed instructions is covered. This limits unnecessary code size
11482 expansion.
11483
11484 The @option{tracer-dynamic-coverage-feedback} parameter
11485 is used only when profile
11486 feedback is available. The real profiles (as opposed to statically estimated
11487 ones) are much less balanced allowing the threshold to be larger value.
11488
11489 @item tracer-max-code-growth
11490 Stop tail duplication once code growth has reached given percentage. This is
11491 a rather artificial limit, as most of the duplicates are eliminated later in
11492 cross jumping, so it may be set to much higher values than is the desired code
11493 growth.
11494
11495 @item tracer-min-branch-ratio
11496
11497 Stop reverse growth when the reverse probability of best edge is less than this
11498 threshold (in percent).
11499
11500 @item tracer-min-branch-probability
11501 @itemx tracer-min-branch-probability-feedback
11502
11503 Stop forward growth if the best edge has probability lower than this
11504 threshold.
11505
11506 Similarly to @option{tracer-dynamic-coverage} two parameters are
11507 provided. @option{tracer-min-branch-probability-feedback} is used for
11508 compilation with profile feedback and @option{tracer-min-branch-probability}
11509 compilation without. The value for compilation with profile feedback
11510 needs to be more conservative (higher) in order to make tracer
11511 effective.
11512
11513 @item stack-clash-protection-guard-size
11514 Specify the size of the operating system provided stack guard as
11515 2 raised to @var{num} bytes. Higher values may reduce the
11516 number of explicit probes, but a value larger than the operating system
11517 provided guard will leave code vulnerable to stack clash style attacks.
11518
11519 @item stack-clash-protection-probe-interval
11520 Stack clash protection involves probing stack space as it is allocated. This
11521 param controls the maximum distance between probes into the stack as 2 raised
11522 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11523 larger than the operating system provided guard will leave code vulnerable to
11524 stack clash style attacks.
11525
11526 @item max-cse-path-length
11527
11528 The maximum number of basic blocks on path that CSE considers.
11529
11530 @item max-cse-insns
11531 The maximum number of instructions CSE processes before flushing.
11532
11533 @item ggc-min-expand
11534
11535 GCC uses a garbage collector to manage its own memory allocation. This
11536 parameter specifies the minimum percentage by which the garbage
11537 collector's heap should be allowed to expand between collections.
11538 Tuning this may improve compilation speed; it has no effect on code
11539 generation.
11540
11541 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11542 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11543 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11544 GCC is not able to calculate RAM on a particular platform, the lower
11545 bound of 30% is used. Setting this parameter and
11546 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11547 every opportunity. This is extremely slow, but can be useful for
11548 debugging.
11549
11550 @item ggc-min-heapsize
11551
11552 Minimum size of the garbage collector's heap before it begins bothering
11553 to collect garbage. The first collection occurs after the heap expands
11554 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11555 tuning this may improve compilation speed, and has no effect on code
11556 generation.
11557
11558 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11559 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11560 with a lower bound of 4096 (four megabytes) and an upper bound of
11561 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11562 particular platform, the lower bound is used. Setting this parameter
11563 very large effectively disables garbage collection. Setting this
11564 parameter and @option{ggc-min-expand} to zero causes a full collection
11565 to occur at every opportunity.
11566
11567 @item max-reload-search-insns
11568 The maximum number of instruction reload should look backward for equivalent
11569 register. Increasing values mean more aggressive optimization, making the
11570 compilation time increase with probably slightly better performance.
11571
11572 @item max-cselib-memory-locations
11573 The maximum number of memory locations cselib should take into account.
11574 Increasing values mean more aggressive optimization, making the compilation time
11575 increase with probably slightly better performance.
11576
11577 @item max-sched-ready-insns
11578 The maximum number of instructions ready to be issued the scheduler should
11579 consider at any given time during the first scheduling pass. Increasing
11580 values mean more thorough searches, making the compilation time increase
11581 with probably little benefit.
11582
11583 @item max-sched-region-blocks
11584 The maximum number of blocks in a region to be considered for
11585 interblock scheduling.
11586
11587 @item max-pipeline-region-blocks
11588 The maximum number of blocks in a region to be considered for
11589 pipelining in the selective scheduler.
11590
11591 @item max-sched-region-insns
11592 The maximum number of insns in a region to be considered for
11593 interblock scheduling.
11594
11595 @item max-pipeline-region-insns
11596 The maximum number of insns in a region to be considered for
11597 pipelining in the selective scheduler.
11598
11599 @item min-spec-prob
11600 The minimum probability (in percents) of reaching a source block
11601 for interblock speculative scheduling.
11602
11603 @item max-sched-extend-regions-iters
11604 The maximum number of iterations through CFG to extend regions.
11605 A value of 0 disables region extensions.
11606
11607 @item max-sched-insn-conflict-delay
11608 The maximum conflict delay for an insn to be considered for speculative motion.
11609
11610 @item sched-spec-prob-cutoff
11611 The minimal probability of speculation success (in percents), so that
11612 speculative insns are scheduled.
11613
11614 @item sched-state-edge-prob-cutoff
11615 The minimum probability an edge must have for the scheduler to save its
11616 state across it.
11617
11618 @item sched-mem-true-dep-cost
11619 Minimal distance (in CPU cycles) between store and load targeting same
11620 memory locations.
11621
11622 @item selsched-max-lookahead
11623 The maximum size of the lookahead window of selective scheduling. It is a
11624 depth of search for available instructions.
11625
11626 @item selsched-max-sched-times
11627 The maximum number of times that an instruction is scheduled during
11628 selective scheduling. This is the limit on the number of iterations
11629 through which the instruction may be pipelined.
11630
11631 @item selsched-insns-to-rename
11632 The maximum number of best instructions in the ready list that are considered
11633 for renaming in the selective scheduler.
11634
11635 @item sms-min-sc
11636 The minimum value of stage count that swing modulo scheduler
11637 generates.
11638
11639 @item max-last-value-rtl
11640 The maximum size measured as number of RTLs that can be recorded in an expression
11641 in combiner for a pseudo register as last known value of that register.
11642
11643 @item max-combine-insns
11644 The maximum number of instructions the RTL combiner tries to combine.
11645
11646 @item integer-share-limit
11647 Small integer constants can use a shared data structure, reducing the
11648 compiler's memory usage and increasing its speed. This sets the maximum
11649 value of a shared integer constant.
11650
11651 @item ssp-buffer-size
11652 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11653 protection when @option{-fstack-protection} is used.
11654
11655 @item min-size-for-stack-sharing
11656 The minimum size of variables taking part in stack slot sharing when not
11657 optimizing.
11658
11659 @item max-jump-thread-duplication-stmts
11660 Maximum number of statements allowed in a block that needs to be
11661 duplicated when threading jumps.
11662
11663 @item max-fields-for-field-sensitive
11664 Maximum number of fields in a structure treated in
11665 a field sensitive manner during pointer analysis.
11666
11667 @item prefetch-latency
11668 Estimate on average number of instructions that are executed before
11669 prefetch finishes. The distance prefetched ahead is proportional
11670 to this constant. Increasing this number may also lead to less
11671 streams being prefetched (see @option{simultaneous-prefetches}).
11672
11673 @item simultaneous-prefetches
11674 Maximum number of prefetches that can run at the same time.
11675
11676 @item l1-cache-line-size
11677 The size of cache line in L1 data cache, in bytes.
11678
11679 @item l1-cache-size
11680 The size of L1 data cache, in kilobytes.
11681
11682 @item l2-cache-size
11683 The size of L2 data cache, in kilobytes.
11684
11685 @item prefetch-dynamic-strides
11686 Whether the loop array prefetch pass should issue software prefetch hints
11687 for strides that are non-constant. In some cases this may be
11688 beneficial, though the fact the stride is non-constant may make it
11689 hard to predict when there is clear benefit to issuing these hints.
11690
11691 Set to 1 if the prefetch hints should be issued for non-constant
11692 strides. Set to 0 if prefetch hints should be issued only for strides that
11693 are known to be constant and below @option{prefetch-minimum-stride}.
11694
11695 @item prefetch-minimum-stride
11696 Minimum constant stride, in bytes, to start using prefetch hints for. If
11697 the stride is less than this threshold, prefetch hints will not be issued.
11698
11699 This setting is useful for processors that have hardware prefetchers, in
11700 which case there may be conflicts between the hardware prefetchers and
11701 the software prefetchers. If the hardware prefetchers have a maximum
11702 stride they can handle, it should be used here to improve the use of
11703 software prefetchers.
11704
11705 A value of -1 means we don't have a threshold and therefore
11706 prefetch hints can be issued for any constant stride.
11707
11708 This setting is only useful for strides that are known and constant.
11709
11710 @item loop-interchange-max-num-stmts
11711 The maximum number of stmts in a loop to be interchanged.
11712
11713 @item loop-interchange-stride-ratio
11714 The minimum ratio between stride of two loops for interchange to be profitable.
11715
11716 @item min-insn-to-prefetch-ratio
11717 The minimum ratio between the number of instructions and the
11718 number of prefetches to enable prefetching in a loop.
11719
11720 @item prefetch-min-insn-to-mem-ratio
11721 The minimum ratio between the number of instructions and the
11722 number of memory references to enable prefetching in a loop.
11723
11724 @item use-canonical-types
11725 Whether the compiler should use the ``canonical'' type system.
11726 Should always be 1, which uses a more efficient internal
11727 mechanism for comparing types in C++ and Objective-C++. However, if
11728 bugs in the canonical type system are causing compilation failures,
11729 set this value to 0 to disable canonical types.
11730
11731 @item switch-conversion-max-branch-ratio
11732 Switch initialization conversion refuses to create arrays that are
11733 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11734 branches in the switch.
11735
11736 @item max-partial-antic-length
11737 Maximum length of the partial antic set computed during the tree
11738 partial redundancy elimination optimization (@option{-ftree-pre}) when
11739 optimizing at @option{-O3} and above. For some sorts of source code
11740 the enhanced partial redundancy elimination optimization can run away,
11741 consuming all of the memory available on the host machine. This
11742 parameter sets a limit on the length of the sets that are computed,
11743 which prevents the runaway behavior. Setting a value of 0 for
11744 this parameter allows an unlimited set length.
11745
11746 @item rpo-vn-max-loop-depth
11747 Maximum loop depth that is value-numbered optimistically.
11748 When the limit hits the innermost
11749 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11750 loop nest are value-numbered optimistically and the remaining ones not.
11751
11752 @item sccvn-max-alias-queries-per-access
11753 Maximum number of alias-oracle queries we perform when looking for
11754 redundancies for loads and stores. If this limit is hit the search
11755 is aborted and the load or store is not considered redundant. The
11756 number of queries is algorithmically limited to the number of
11757 stores on all paths from the load to the function entry.
11758
11759 @item ira-max-loops-num
11760 IRA uses regional register allocation by default. If a function
11761 contains more loops than the number given by this parameter, only at most
11762 the given number of the most frequently-executed loops form regions
11763 for regional register allocation.
11764
11765 @item ira-max-conflict-table-size
11766 Although IRA uses a sophisticated algorithm to compress the conflict
11767 table, the table can still require excessive amounts of memory for
11768 huge functions. If the conflict table for a function could be more
11769 than the size in MB given by this parameter, the register allocator
11770 instead uses a faster, simpler, and lower-quality
11771 algorithm that does not require building a pseudo-register conflict table.
11772
11773 @item ira-loop-reserved-regs
11774 IRA can be used to evaluate more accurate register pressure in loops
11775 for decisions to move loop invariants (see @option{-O3}). The number
11776 of available registers reserved for some other purposes is given
11777 by this parameter. Default of the parameter
11778 is the best found from numerous experiments.
11779
11780 @item lra-inheritance-ebb-probability-cutoff
11781 LRA tries to reuse values reloaded in registers in subsequent insns.
11782 This optimization is called inheritance. EBB is used as a region to
11783 do this optimization. The parameter defines a minimal fall-through
11784 edge probability in percentage used to add BB to inheritance EBB in
11785 LRA. The default value was chosen
11786 from numerous runs of SPEC2000 on x86-64.
11787
11788 @item loop-invariant-max-bbs-in-loop
11789 Loop invariant motion can be very expensive, both in compilation time and
11790 in amount of needed compile-time memory, with very large loops. Loops
11791 with more basic blocks than this parameter won't have loop invariant
11792 motion optimization performed on them.
11793
11794 @item loop-max-datarefs-for-datadeps
11795 Building data dependencies is expensive for very large loops. This
11796 parameter limits the number of data references in loops that are
11797 considered for data dependence analysis. These large loops are no
11798 handled by the optimizations using loop data dependencies.
11799
11800 @item max-vartrack-size
11801 Sets a maximum number of hash table slots to use during variable
11802 tracking dataflow analysis of any function. If this limit is exceeded
11803 with variable tracking at assignments enabled, analysis for that
11804 function is retried without it, after removing all debug insns from
11805 the function. If the limit is exceeded even without debug insns, var
11806 tracking analysis is completely disabled for the function. Setting
11807 the parameter to zero makes it unlimited.
11808
11809 @item max-vartrack-expr-depth
11810 Sets a maximum number of recursion levels when attempting to map
11811 variable names or debug temporaries to value expressions. This trades
11812 compilation time for more complete debug information. If this is set too
11813 low, value expressions that are available and could be represented in
11814 debug information may end up not being used; setting this higher may
11815 enable the compiler to find more complex debug expressions, but compile
11816 time and memory use may grow.
11817
11818 @item max-debug-marker-count
11819 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11820 markers) to avoid complexity explosion at inlining or expanding to RTL.
11821 If a function has more such gimple stmts than the set limit, such stmts
11822 will be dropped from the inlined copy of a function, and from its RTL
11823 expansion.
11824
11825 @item min-nondebug-insn-uid
11826 Use uids starting at this parameter for nondebug insns. The range below
11827 the parameter is reserved exclusively for debug insns created by
11828 @option{-fvar-tracking-assignments}, but debug insns may get
11829 (non-overlapping) uids above it if the reserved range is exhausted.
11830
11831 @item ipa-sra-ptr-growth-factor
11832 IPA-SRA replaces a pointer to an aggregate with one or more new
11833 parameters only when their cumulative size is less or equal to
11834 @option{ipa-sra-ptr-growth-factor} times the size of the original
11835 pointer parameter.
11836
11837 @item sra-max-scalarization-size-Ospeed
11838 @itemx sra-max-scalarization-size-Osize
11839 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11840 replace scalar parts of aggregates with uses of independent scalar
11841 variables. These parameters control the maximum size, in storage units,
11842 of aggregate which is considered for replacement when compiling for
11843 speed
11844 (@option{sra-max-scalarization-size-Ospeed}) or size
11845 (@option{sra-max-scalarization-size-Osize}) respectively.
11846
11847 @item tm-max-aggregate-size
11848 When making copies of thread-local variables in a transaction, this
11849 parameter specifies the size in bytes after which variables are
11850 saved with the logging functions as opposed to save/restore code
11851 sequence pairs. This option only applies when using
11852 @option{-fgnu-tm}.
11853
11854 @item graphite-max-nb-scop-params
11855 To avoid exponential effects in the Graphite loop transforms, the
11856 number of parameters in a Static Control Part (SCoP) is bounded.
11857 A value of zero can be used to lift
11858 the bound. A variable whose value is unknown at compilation time and
11859 defined outside a SCoP is a parameter of the SCoP.
11860
11861 @item loop-block-tile-size
11862 Loop blocking or strip mining transforms, enabled with
11863 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11864 loop in the loop nest by a given number of iterations. The strip
11865 length can be changed using the @option{loop-block-tile-size}
11866 parameter.
11867
11868 @item ipa-cp-value-list-size
11869 IPA-CP attempts to track all possible values and types passed to a function's
11870 parameter in order to propagate them and perform devirtualization.
11871 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11872 stores per one formal parameter of a function.
11873
11874 @item ipa-cp-eval-threshold
11875 IPA-CP calculates its own score of cloning profitability heuristics
11876 and performs those cloning opportunities with scores that exceed
11877 @option{ipa-cp-eval-threshold}.
11878
11879 @item ipa-cp-recursion-penalty
11880 Percentage penalty the recursive functions will receive when they
11881 are evaluated for cloning.
11882
11883 @item ipa-cp-single-call-penalty
11884 Percentage penalty functions containing a single call to another
11885 function will receive when they are evaluated for cloning.
11886
11887 @item ipa-max-agg-items
11888 IPA-CP is also capable to propagate a number of scalar values passed
11889 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11890 number of such values per one parameter.
11891
11892 @item ipa-cp-loop-hint-bonus
11893 When IPA-CP determines that a cloning candidate would make the number
11894 of iterations of a loop known, it adds a bonus of
11895 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11896 the candidate.
11897
11898 @item ipa-max-aa-steps
11899 During its analysis of function bodies, IPA-CP employs alias analysis
11900 in order to track values pointed to by function parameters. In order
11901 not spend too much time analyzing huge functions, it gives up and
11902 consider all memory clobbered after examining
11903 @option{ipa-max-aa-steps} statements modifying memory.
11904
11905 @item lto-partitions
11906 Specify desired number of partitions produced during WHOPR compilation.
11907 The number of partitions should exceed the number of CPUs used for compilation.
11908
11909 @item lto-min-partition
11910 Size of minimal partition for WHOPR (in estimated instructions).
11911 This prevents expenses of splitting very small programs into too many
11912 partitions.
11913
11914 @item lto-max-partition
11915 Size of max partition for WHOPR (in estimated instructions).
11916 to provide an upper bound for individual size of partition.
11917 Meant to be used only with balanced partitioning.
11918
11919 @item lto-max-streaming-parallelism
11920 Maximal number of parallel processes used for LTO streaming.
11921
11922 @item cxx-max-namespaces-for-diagnostic-help
11923 The maximum number of namespaces to consult for suggestions when C++
11924 name lookup fails for an identifier.
11925
11926 @item sink-frequency-threshold
11927 The maximum relative execution frequency (in percents) of the target block
11928 relative to a statement's original block to allow statement sinking of a
11929 statement. Larger numbers result in more aggressive statement sinking.
11930 A small positive adjustment is applied for
11931 statements with memory operands as those are even more profitable so sink.
11932
11933 @item max-stores-to-sink
11934 The maximum number of conditional store pairs that can be sunk. Set to 0
11935 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11936 (@option{-ftree-loop-if-convert}) is disabled.
11937
11938 @item allow-store-data-races
11939 Allow optimizers to introduce new data races on stores.
11940 Set to 1 to allow, otherwise to 0.
11941
11942 @item case-values-threshold
11943 The smallest number of different values for which it is best to use a
11944 jump-table instead of a tree of conditional branches. If the value is
11945 0, use the default for the machine.
11946
11947 @item jump-table-max-growth-ratio-for-size
11948 The maximum code size growth ratio when expanding
11949 into a jump table (in percent). The parameter is used when
11950 optimizing for size.
11951
11952 @item jump-table-max-growth-ratio-for-speed
11953 The maximum code size growth ratio when expanding
11954 into a jump table (in percent). The parameter is used when
11955 optimizing for speed.
11956
11957 @item tree-reassoc-width
11958 Set the maximum number of instructions executed in parallel in
11959 reassociated tree. This parameter overrides target dependent
11960 heuristics used by default if has non zero value.
11961
11962 @item sched-pressure-algorithm
11963 Choose between the two available implementations of
11964 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11965 and is the more likely to prevent instructions from being reordered.
11966 Algorithm 2 was designed to be a compromise between the relatively
11967 conservative approach taken by algorithm 1 and the rather aggressive
11968 approach taken by the default scheduler. It relies more heavily on
11969 having a regular register file and accurate register pressure classes.
11970 See @file{haifa-sched.c} in the GCC sources for more details.
11971
11972 The default choice depends on the target.
11973
11974 @item max-slsr-cand-scan
11975 Set the maximum number of existing candidates that are considered when
11976 seeking a basis for a new straight-line strength reduction candidate.
11977
11978 @item asan-globals
11979 Enable buffer overflow detection for global objects. This kind
11980 of protection is enabled by default if you are using
11981 @option{-fsanitize=address} option.
11982 To disable global objects protection use @option{--param asan-globals=0}.
11983
11984 @item asan-stack
11985 Enable buffer overflow detection for stack objects. This kind of
11986 protection is enabled by default when using @option{-fsanitize=address}.
11987 To disable stack protection use @option{--param asan-stack=0} option.
11988
11989 @item asan-instrument-reads
11990 Enable buffer overflow detection for memory reads. This kind of
11991 protection is enabled by default when using @option{-fsanitize=address}.
11992 To disable memory reads protection use
11993 @option{--param asan-instrument-reads=0}.
11994
11995 @item asan-instrument-writes
11996 Enable buffer overflow detection for memory writes. This kind of
11997 protection is enabled by default when using @option{-fsanitize=address}.
11998 To disable memory writes protection use
11999 @option{--param asan-instrument-writes=0} option.
12000
12001 @item asan-memintrin
12002 Enable detection for built-in functions. This kind of protection
12003 is enabled by default when using @option{-fsanitize=address}.
12004 To disable built-in functions protection use
12005 @option{--param asan-memintrin=0}.
12006
12007 @item asan-use-after-return
12008 Enable detection of use-after-return. This kind of protection
12009 is enabled by default when using the @option{-fsanitize=address} option.
12010 To disable it use @option{--param asan-use-after-return=0}.
12011
12012 Note: By default the check is disabled at run time. To enable it,
12013 add @code{detect_stack_use_after_return=1} to the environment variable
12014 @env{ASAN_OPTIONS}.
12015
12016 @item asan-instrumentation-with-call-threshold
12017 If number of memory accesses in function being instrumented
12018 is greater or equal to this number, use callbacks instead of inline checks.
12019 E.g. to disable inline code use
12020 @option{--param asan-instrumentation-with-call-threshold=0}.
12021
12022 @item use-after-scope-direct-emission-threshold
12023 If the size of a local variable in bytes is smaller or equal to this
12024 number, directly poison (or unpoison) shadow memory instead of using
12025 run-time callbacks.
12026
12027 @item max-fsm-thread-path-insns
12028 Maximum number of instructions to copy when duplicating blocks on a
12029 finite state automaton jump thread path.
12030
12031 @item max-fsm-thread-length
12032 Maximum number of basic blocks on a finite state automaton jump thread
12033 path.
12034
12035 @item max-fsm-thread-paths
12036 Maximum number of new jump thread paths to create for a finite state
12037 automaton.
12038
12039 @item parloops-chunk-size
12040 Chunk size of omp schedule for loops parallelized by parloops.
12041
12042 @item parloops-schedule
12043 Schedule type of omp schedule for loops parallelized by parloops (static,
12044 dynamic, guided, auto, runtime).
12045
12046 @item parloops-min-per-thread
12047 The minimum number of iterations per thread of an innermost parallelized
12048 loop for which the parallelized variant is preferred over the single threaded
12049 one. Note that for a parallelized loop nest the
12050 minimum number of iterations of the outermost loop per thread is two.
12051
12052 @item max-ssa-name-query-depth
12053 Maximum depth of recursion when querying properties of SSA names in things
12054 like fold routines. One level of recursion corresponds to following a
12055 use-def chain.
12056
12057 @item hsa-gen-debug-stores
12058 Enable emission of special debug stores within HSA kernels which are
12059 then read and reported by libgomp plugin. Generation of these stores
12060 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12061 enable it.
12062
12063 @item max-speculative-devirt-maydefs
12064 The maximum number of may-defs we analyze when looking for a must-def
12065 specifying the dynamic type of an object that invokes a virtual call
12066 we may be able to devirtualize speculatively.
12067
12068 @item max-vrp-switch-assertions
12069 The maximum number of assertions to add along the default edge of a switch
12070 statement during VRP.
12071
12072 @item unroll-jam-min-percent
12073 The minimum percentage of memory references that must be optimized
12074 away for the unroll-and-jam transformation to be considered profitable.
12075
12076 @item unroll-jam-max-unroll
12077 The maximum number of times the outer loop should be unrolled by
12078 the unroll-and-jam transformation.
12079
12080 @item max-rtl-if-conversion-unpredictable-cost
12081 Maximum permissible cost for the sequence that would be generated
12082 by the RTL if-conversion pass for a branch that is considered unpredictable.
12083
12084 @item max-variable-expansions-in-unroller
12085 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12086 of times that an individual variable will be expanded during loop unrolling.
12087
12088 @item tracer-min-branch-probability-feedback
12089 Stop forward growth if the probability of best edge is less than
12090 this threshold (in percent). Used when profile feedback is available.
12091
12092 @item partial-inlining-entry-probability
12093 Maximum probability of the entry BB of split region
12094 (in percent relative to entry BB of the function)
12095 to make partial inlining happen.
12096
12097 @item max-tracked-strlens
12098 Maximum number of strings for which strlen optimization pass will
12099 track string lengths.
12100
12101 @item gcse-after-reload-partial-fraction
12102 The threshold ratio for performing partial redundancy
12103 elimination after reload.
12104
12105 @item gcse-after-reload-critical-fraction
12106 The threshold ratio of critical edges execution count that
12107 permit performing redundancy elimination after reload.
12108
12109 @item max-loop-header-insns
12110 The maximum number of insns in loop header duplicated
12111 by the copy loop headers pass.
12112
12113 @item vect-epilogues-nomask
12114 Enable loop epilogue vectorization using smaller vector size.
12115
12116 @item slp-max-insns-in-bb
12117 Maximum number of instructions in basic block to be
12118 considered for SLP vectorization.
12119
12120 @item avoid-fma-max-bits
12121 Maximum number of bits for which we avoid creating FMAs.
12122
12123 @item sms-loop-average-count-threshold
12124 A threshold on the average loop count considered by the swing modulo scheduler.
12125
12126 @item sms-dfa-history
12127 The number of cycles the swing modulo scheduler considers when checking
12128 conflicts using DFA.
12129
12130 @item hot-bb-count-fraction
12131 Select fraction of the maximal count of repetitions of basic block
12132 in program given basic block needs
12133 to have to be considered hot (used in non-LTO mode)
12134
12135 @item max-inline-insns-recursive-auto
12136 The maximum number of instructions non-inline function
12137 can grow to via recursive inlining.
12138
12139 @item graphite-allow-codegen-errors
12140 Whether codegen errors should be ICEs when @option{-fchecking}.
12141
12142 @item sms-max-ii-factor
12143 A factor for tuning the upper bound that swing modulo scheduler
12144 uses for scheduling a loop.
12145
12146 @item lra-max-considered-reload-pseudos
12147 The max number of reload pseudos which are considered during
12148 spilling a non-reload pseudo.
12149
12150 @item max-pow-sqrt-depth
12151 Maximum depth of sqrt chains to use when synthesizing exponentiation
12152 by a real constant.
12153
12154 @item max-dse-active-local-stores
12155 Maximum number of active local stores in RTL dead store elimination.
12156
12157 @item asan-instrument-allocas
12158 Enable asan allocas/VLAs protection.
12159
12160 @item max-iterations-computation-cost
12161 Bound on the cost of an expression to compute the number of iterations.
12162
12163 @item max-isl-operations
12164 Maximum number of isl operations, 0 means unlimited.
12165
12166 @item graphite-max-arrays-per-scop
12167 Maximum number of arrays per scop.
12168
12169 @item max-vartrack-reverse-op-size
12170 Max. size of loc list for which reverse ops should be added.
12171
12172 @item unlikely-bb-count-fraction
12173 The minimum fraction of profile runs a given basic block execution count
12174 must be not to be considered unlikely.
12175
12176 @item tracer-dynamic-coverage-feedback
12177 The percentage of function, weighted by execution frequency,
12178 that must be covered by trace formation.
12179 Used when profile feedback is available.
12180
12181 @item max-inline-recursive-depth-auto
12182 The maximum depth of recursive inlining for non-inline functions.
12183
12184 @item fsm-scale-path-stmts
12185 Scale factor to apply to the number of statements in a threading path
12186 when comparing to the number of (scaled) blocks.
12187
12188 @item fsm-maximum-phi-arguments
12189 Maximum number of arguments a PHI may have before the FSM threader
12190 will not try to thread through its block.
12191
12192 @item uninit-control-dep-attempts
12193 Maximum number of nested calls to search for control dependencies
12194 during uninitialized variable analysis.
12195
12196 @item max-once-peeled-insns
12197 The maximum number of insns of a peeled loop that rolls only once.
12198
12199 @item sra-max-scalarization-size-Osize
12200 Maximum size, in storage units, of an aggregate
12201 which should be considered for scalarization when compiling for size.
12202
12203 @item fsm-scale-path-blocks
12204 Scale factor to apply to the number of blocks in a threading path
12205 when comparing to the number of (scaled) statements.
12206
12207 @item sched-autopref-queue-depth
12208 Hardware autoprefetcher scheduler model control flag.
12209 Number of lookahead cycles the model looks into; at '
12210 ' only enable instruction sorting heuristic.
12211
12212 @item loop-versioning-max-inner-insns
12213 The maximum number of instructions that an inner loop can have
12214 before the loop versioning pass considers it too big to copy.
12215
12216 @item loop-versioning-max-outer-insns
12217 The maximum number of instructions that an outer loop can have
12218 before the loop versioning pass considers it too big to copy,
12219 discounting any instructions in inner loops that directly benefit
12220 from versioning.
12221
12222 @item ssa-name-def-chain-limit
12223 The maximum number of SSA_NAME assignments to follow in determining
12224 a property of a variable such as its value. This limits the number
12225 of iterations or recursive calls GCC performs when optimizing certain
12226 statements or when determining their validity prior to issuing
12227 diagnostics.
12228
12229 @end table
12230 @end table
12231
12232 @node Instrumentation Options
12233 @section Program Instrumentation Options
12234 @cindex instrumentation options
12235 @cindex program instrumentation options
12236 @cindex run-time error checking options
12237 @cindex profiling options
12238 @cindex options, program instrumentation
12239 @cindex options, run-time error checking
12240 @cindex options, profiling
12241
12242 GCC supports a number of command-line options that control adding
12243 run-time instrumentation to the code it normally generates.
12244 For example, one purpose of instrumentation is collect profiling
12245 statistics for use in finding program hot spots, code coverage
12246 analysis, or profile-guided optimizations.
12247 Another class of program instrumentation is adding run-time checking
12248 to detect programming errors like invalid pointer
12249 dereferences or out-of-bounds array accesses, as well as deliberately
12250 hostile attacks such as stack smashing or C++ vtable hijacking.
12251 There is also a general hook which can be used to implement other
12252 forms of tracing or function-level instrumentation for debug or
12253 program analysis purposes.
12254
12255 @table @gcctabopt
12256 @cindex @command{prof}
12257 @cindex @command{gprof}
12258 @item -p
12259 @itemx -pg
12260 @opindex p
12261 @opindex pg
12262 Generate extra code to write profile information suitable for the
12263 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12264 (for @option{-pg}). You must use this option when compiling
12265 the source files you want data about, and you must also use it when
12266 linking.
12267
12268 You can use the function attribute @code{no_instrument_function} to
12269 suppress profiling of individual functions when compiling with these options.
12270 @xref{Common Function Attributes}.
12271
12272 @item -fprofile-arcs
12273 @opindex fprofile-arcs
12274 Add code so that program flow @dfn{arcs} are instrumented. During
12275 execution the program records how many times each branch and call is
12276 executed and how many times it is taken or returns. On targets that support
12277 constructors with priority support, profiling properly handles constructors,
12278 destructors and C++ constructors (and destructors) of classes which are used
12279 as a type of a global variable.
12280
12281 When the compiled
12282 program exits it saves this data to a file called
12283 @file{@var{auxname}.gcda} for each source file. The data may be used for
12284 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12285 test coverage analysis (@option{-ftest-coverage}). Each object file's
12286 @var{auxname} is generated from the name of the output file, if
12287 explicitly specified and it is not the final executable, otherwise it is
12288 the basename of the source file. In both cases any suffix is removed
12289 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12290 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12291 @xref{Cross-profiling}.
12292
12293 @cindex @command{gcov}
12294 @item --coverage
12295 @opindex coverage
12296
12297 This option is used to compile and link code instrumented for coverage
12298 analysis. The option is a synonym for @option{-fprofile-arcs}
12299 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12300 linking). See the documentation for those options for more details.
12301
12302 @itemize
12303
12304 @item
12305 Compile the source files with @option{-fprofile-arcs} plus optimization
12306 and code generation options. For test coverage analysis, use the
12307 additional @option{-ftest-coverage} option. You do not need to profile
12308 every source file in a program.
12309
12310 @item
12311 Compile the source files additionally with @option{-fprofile-abs-path}
12312 to create absolute path names in the @file{.gcno} files. This allows
12313 @command{gcov} to find the correct sources in projects where compilations
12314 occur with different working directories.
12315
12316 @item
12317 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12318 (the latter implies the former).
12319
12320 @item
12321 Run the program on a representative workload to generate the arc profile
12322 information. This may be repeated any number of times. You can run
12323 concurrent instances of your program, and provided that the file system
12324 supports locking, the data files will be correctly updated. Unless
12325 a strict ISO C dialect option is in effect, @code{fork} calls are
12326 detected and correctly handled without double counting.
12327
12328 @item
12329 For profile-directed optimizations, compile the source files again with
12330 the same optimization and code generation options plus
12331 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12332 Control Optimization}).
12333
12334 @item
12335 For test coverage analysis, use @command{gcov} to produce human readable
12336 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12337 @command{gcov} documentation for further information.
12338
12339 @end itemize
12340
12341 With @option{-fprofile-arcs}, for each function of your program GCC
12342 creates a program flow graph, then finds a spanning tree for the graph.
12343 Only arcs that are not on the spanning tree have to be instrumented: the
12344 compiler adds code to count the number of times that these arcs are
12345 executed. When an arc is the only exit or only entrance to a block, the
12346 instrumentation code can be added to the block; otherwise, a new basic
12347 block must be created to hold the instrumentation code.
12348
12349 @need 2000
12350 @item -ftest-coverage
12351 @opindex ftest-coverage
12352 Produce a notes file that the @command{gcov} code-coverage utility
12353 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12354 show program coverage. Each source file's note file is called
12355 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12356 above for a description of @var{auxname} and instructions on how to
12357 generate test coverage data. Coverage data matches the source files
12358 more closely if you do not optimize.
12359
12360 @item -fprofile-abs-path
12361 @opindex fprofile-abs-path
12362 Automatically convert relative source file names to absolute path names
12363 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12364 sources in projects where compilations occur with different working
12365 directories.
12366
12367 @item -fprofile-dir=@var{path}
12368 @opindex fprofile-dir
12369
12370 Set the directory to search for the profile data files in to @var{path}.
12371 This option affects only the profile data generated by
12372 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12373 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12374 and its related options. Both absolute and relative paths can be used.
12375 By default, GCC uses the current directory as @var{path}, thus the
12376 profile data file appears in the same directory as the object file.
12377 In order to prevent the file name clashing, if the object file name is
12378 not an absolute path, we mangle the absolute path of the
12379 @file{@var{sourcename}.gcda} file and use it as the file name of a
12380 @file{.gcda} file. See similar option @option{-fprofile-note}.
12381
12382 When an executable is run in a massive parallel environment, it is recommended
12383 to save profile to different folders. That can be done with variables
12384 in @var{path} that are exported during run-time:
12385
12386 @table @gcctabopt
12387
12388 @item %p
12389 process ID.
12390
12391 @item %q@{VAR@}
12392 value of environment variable @var{VAR}
12393
12394 @end table
12395
12396 @item -fprofile-generate
12397 @itemx -fprofile-generate=@var{path}
12398 @opindex fprofile-generate
12399
12400 Enable options usually used for instrumenting application to produce
12401 profile useful for later recompilation with profile feedback based
12402 optimization. You must use @option{-fprofile-generate} both when
12403 compiling and when linking your program.
12404
12405 The following options are enabled:
12406 @option{-fprofile-arcs}, @option{-fprofile-values},
12407 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12408
12409 If @var{path} is specified, GCC looks at the @var{path} to find
12410 the profile feedback data files. See @option{-fprofile-dir}.
12411
12412 To optimize the program based on the collected profile information, use
12413 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12414
12415 @item -fprofile-note=@var{path}
12416 @opindex fprofile-note
12417
12418 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
12419 location. If you combine the option with multiple source files,
12420 the @file{.gcno} file will be overwritten.
12421
12422 @item -fprofile-update=@var{method}
12423 @opindex fprofile-update
12424
12425 Alter the update method for an application instrumented for profile
12426 feedback based optimization. The @var{method} argument should be one of
12427 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12428 The first one is useful for single-threaded applications,
12429 while the second one prevents profile corruption by emitting thread-safe code.
12430
12431 @strong{Warning:} When an application does not properly join all threads
12432 (or creates an detached thread), a profile file can be still corrupted.
12433
12434 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12435 when supported by a target, or to @samp{single} otherwise. The GCC driver
12436 automatically selects @samp{prefer-atomic} when @option{-pthread}
12437 is present in the command line.
12438
12439 @item -fprofile-filter-files=@var{regex}
12440 @opindex fprofile-filter-files
12441
12442 Instrument only functions from files where names match
12443 any regular expression (separated by a semi-colon).
12444
12445 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12446 only @file{main.c} and all C files starting with 'module'.
12447
12448 @item -fprofile-exclude-files=@var{regex}
12449 @opindex fprofile-exclude-files
12450
12451 Instrument only functions from files where names do not match
12452 all the regular expressions (separated by a semi-colon).
12453
12454 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12455 of all files that are located in @file{/usr/} folder.
12456
12457 @item -fsanitize=address
12458 @opindex fsanitize=address
12459 Enable AddressSanitizer, a fast memory error detector.
12460 Memory access instructions are instrumented to detect
12461 out-of-bounds and use-after-free bugs.
12462 The option enables @option{-fsanitize-address-use-after-scope}.
12463 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12464 more details. The run-time behavior can be influenced using the
12465 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12466 the available options are shown at startup of the instrumented program. See
12467 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12468 for a list of supported options.
12469 The option cannot be combined with @option{-fsanitize=thread}.
12470
12471 @item -fsanitize=kernel-address
12472 @opindex fsanitize=kernel-address
12473 Enable AddressSanitizer for Linux kernel.
12474 See @uref{https://github.com/google/kasan/wiki} for more details.
12475
12476 @item -fsanitize=pointer-compare
12477 @opindex fsanitize=pointer-compare
12478 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12479 The option must be combined with either @option{-fsanitize=kernel-address} or
12480 @option{-fsanitize=address}
12481 The option cannot be combined with @option{-fsanitize=thread}.
12482 Note: By default the check is disabled at run time. To enable it,
12483 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12484 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12485 invalid operation only when both pointers are non-null.
12486
12487 @item -fsanitize=pointer-subtract
12488 @opindex fsanitize=pointer-subtract
12489 Instrument subtraction with pointer operands.
12490 The option must be combined with either @option{-fsanitize=kernel-address} or
12491 @option{-fsanitize=address}
12492 The option cannot be combined with @option{-fsanitize=thread}.
12493 Note: By default the check is disabled at run time. To enable it,
12494 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12495 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12496 invalid operation only when both pointers are non-null.
12497
12498 @item -fsanitize=thread
12499 @opindex fsanitize=thread
12500 Enable ThreadSanitizer, a fast data race detector.
12501 Memory access instructions are instrumented to detect
12502 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12503 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12504 environment variable; see
12505 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12506 supported options.
12507 The option cannot be combined with @option{-fsanitize=address},
12508 @option{-fsanitize=leak}.
12509
12510 Note that sanitized atomic builtins cannot throw exceptions when
12511 operating on invalid memory addresses with non-call exceptions
12512 (@option{-fnon-call-exceptions}).
12513
12514 @item -fsanitize=leak
12515 @opindex fsanitize=leak
12516 Enable LeakSanitizer, a memory leak detector.
12517 This option only matters for linking of executables and
12518 the executable is linked against a library that overrides @code{malloc}
12519 and other allocator functions. See
12520 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12521 details. The run-time behavior can be influenced using the
12522 @env{LSAN_OPTIONS} environment variable.
12523 The option cannot be combined with @option{-fsanitize=thread}.
12524
12525 @item -fsanitize=undefined
12526 @opindex fsanitize=undefined
12527 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12528 Various computations are instrumented to detect undefined behavior
12529 at runtime. Current suboptions are:
12530
12531 @table @gcctabopt
12532
12533 @item -fsanitize=shift
12534 @opindex fsanitize=shift
12535 This option enables checking that the result of a shift operation is
12536 not undefined. Note that what exactly is considered undefined differs
12537 slightly between C and C++, as well as between ISO C90 and C99, etc.
12538 This option has two suboptions, @option{-fsanitize=shift-base} and
12539 @option{-fsanitize=shift-exponent}.
12540
12541 @item -fsanitize=shift-exponent
12542 @opindex fsanitize=shift-exponent
12543 This option enables checking that the second argument of a shift operation
12544 is not negative and is smaller than the precision of the promoted first
12545 argument.
12546
12547 @item -fsanitize=shift-base
12548 @opindex fsanitize=shift-base
12549 If the second argument of a shift operation is within range, check that the
12550 result of a shift operation is not undefined. Note that what exactly is
12551 considered undefined differs slightly between C and C++, as well as between
12552 ISO C90 and C99, etc.
12553
12554 @item -fsanitize=integer-divide-by-zero
12555 @opindex fsanitize=integer-divide-by-zero
12556 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12557
12558 @item -fsanitize=unreachable
12559 @opindex fsanitize=unreachable
12560 With this option, the compiler turns the @code{__builtin_unreachable}
12561 call into a diagnostics message call instead. When reaching the
12562 @code{__builtin_unreachable} call, the behavior is undefined.
12563
12564 @item -fsanitize=vla-bound
12565 @opindex fsanitize=vla-bound
12566 This option instructs the compiler to check that the size of a variable
12567 length array is positive.
12568
12569 @item -fsanitize=null
12570 @opindex fsanitize=null
12571 This option enables pointer checking. Particularly, the application
12572 built with this option turned on will issue an error message when it
12573 tries to dereference a NULL pointer, or if a reference (possibly an
12574 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12575 on an object pointed by a NULL pointer.
12576
12577 @item -fsanitize=return
12578 @opindex fsanitize=return
12579 This option enables return statement checking. Programs
12580 built with this option turned on will issue an error message
12581 when the end of a non-void function is reached without actually
12582 returning a value. This option works in C++ only.
12583
12584 @item -fsanitize=signed-integer-overflow
12585 @opindex fsanitize=signed-integer-overflow
12586 This option enables signed integer overflow checking. We check that
12587 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12588 does not overflow in the signed arithmetics. Note, integer promotion
12589 rules must be taken into account. That is, the following is not an
12590 overflow:
12591 @smallexample
12592 signed char a = SCHAR_MAX;
12593 a++;
12594 @end smallexample
12595
12596 @item -fsanitize=bounds
12597 @opindex fsanitize=bounds
12598 This option enables instrumentation of array bounds. Various out of bounds
12599 accesses are detected. Flexible array members, flexible array member-like
12600 arrays, and initializers of variables with static storage are not instrumented.
12601
12602 @item -fsanitize=bounds-strict
12603 @opindex fsanitize=bounds-strict
12604 This option enables strict instrumentation of array bounds. Most out of bounds
12605 accesses are detected, including flexible array members and flexible array
12606 member-like arrays. Initializers of variables with static storage are not
12607 instrumented.
12608
12609 @item -fsanitize=alignment
12610 @opindex fsanitize=alignment
12611
12612 This option enables checking of alignment of pointers when they are
12613 dereferenced, or when a reference is bound to insufficiently aligned target,
12614 or when a method or constructor is invoked on insufficiently aligned object.
12615
12616 @item -fsanitize=object-size
12617 @opindex fsanitize=object-size
12618 This option enables instrumentation of memory references using the
12619 @code{__builtin_object_size} function. Various out of bounds pointer
12620 accesses are detected.
12621
12622 @item -fsanitize=float-divide-by-zero
12623 @opindex fsanitize=float-divide-by-zero
12624 Detect floating-point division by zero. Unlike other similar options,
12625 @option{-fsanitize=float-divide-by-zero} is not enabled by
12626 @option{-fsanitize=undefined}, since floating-point division by zero can
12627 be a legitimate way of obtaining infinities and NaNs.
12628
12629 @item -fsanitize=float-cast-overflow
12630 @opindex fsanitize=float-cast-overflow
12631 This option enables floating-point type to integer conversion checking.
12632 We check that the result of the conversion does not overflow.
12633 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12634 not enabled by @option{-fsanitize=undefined}.
12635 This option does not work well with @code{FE_INVALID} exceptions enabled.
12636
12637 @item -fsanitize=nonnull-attribute
12638 @opindex fsanitize=nonnull-attribute
12639
12640 This option enables instrumentation of calls, checking whether null values
12641 are not passed to arguments marked as requiring a non-null value by the
12642 @code{nonnull} function attribute.
12643
12644 @item -fsanitize=returns-nonnull-attribute
12645 @opindex fsanitize=returns-nonnull-attribute
12646
12647 This option enables instrumentation of return statements in functions
12648 marked with @code{returns_nonnull} function attribute, to detect returning
12649 of null values from such functions.
12650
12651 @item -fsanitize=bool
12652 @opindex fsanitize=bool
12653
12654 This option enables instrumentation of loads from bool. If a value other
12655 than 0/1 is loaded, a run-time error is issued.
12656
12657 @item -fsanitize=enum
12658 @opindex fsanitize=enum
12659
12660 This option enables instrumentation of loads from an enum type. If
12661 a value outside the range of values for the enum type is loaded,
12662 a run-time error is issued.
12663
12664 @item -fsanitize=vptr
12665 @opindex fsanitize=vptr
12666
12667 This option enables instrumentation of C++ member function calls, member
12668 accesses and some conversions between pointers to base and derived classes,
12669 to verify the referenced object has the correct dynamic type.
12670
12671 @item -fsanitize=pointer-overflow
12672 @opindex fsanitize=pointer-overflow
12673
12674 This option enables instrumentation of pointer arithmetics. If the pointer
12675 arithmetics overflows, a run-time error is issued.
12676
12677 @item -fsanitize=builtin
12678 @opindex fsanitize=builtin
12679
12680 This option enables instrumentation of arguments to selected builtin
12681 functions. If an invalid value is passed to such arguments, a run-time
12682 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12683 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12684 by this option.
12685
12686 @end table
12687
12688 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12689 @option{-fsanitize=undefined} gives a diagnostic message.
12690 This currently works only for the C family of languages.
12691
12692 @item -fno-sanitize=all
12693 @opindex fno-sanitize=all
12694
12695 This option disables all previously enabled sanitizers.
12696 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12697 together.
12698
12699 @item -fasan-shadow-offset=@var{number}
12700 @opindex fasan-shadow-offset
12701 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12702 It is useful for experimenting with different shadow memory layouts in
12703 Kernel AddressSanitizer.
12704
12705 @item -fsanitize-sections=@var{s1},@var{s2},...
12706 @opindex fsanitize-sections
12707 Sanitize global variables in selected user-defined sections. @var{si} may
12708 contain wildcards.
12709
12710 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12711 @opindex fsanitize-recover
12712 @opindex fno-sanitize-recover
12713 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12714 mentioned in comma-separated list of @var{opts}. Enabling this option
12715 for a sanitizer component causes it to attempt to continue
12716 running the program as if no error happened. This means multiple
12717 runtime errors can be reported in a single program run, and the exit
12718 code of the program may indicate success even when errors
12719 have been reported. The @option{-fno-sanitize-recover=} option
12720 can be used to alter
12721 this behavior: only the first detected error is reported
12722 and program then exits with a non-zero exit code.
12723
12724 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12725 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12726 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12727 @option{-fsanitize=bounds-strict},
12728 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12729 For these sanitizers error recovery is turned on by default,
12730 except @option{-fsanitize=address}, for which this feature is experimental.
12731 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12732 accepted, the former enables recovery for all sanitizers that support it,
12733 the latter disables recovery for all sanitizers that support it.
12734
12735 Even if a recovery mode is turned on the compiler side, it needs to be also
12736 enabled on the runtime library side, otherwise the failures are still fatal.
12737 The runtime library defaults to @code{halt_on_error=0} for
12738 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12739 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12740 setting the @code{halt_on_error} flag in the corresponding environment variable.
12741
12742 Syntax without an explicit @var{opts} parameter is deprecated. It is
12743 equivalent to specifying an @var{opts} list of:
12744
12745 @smallexample
12746 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12747 @end smallexample
12748
12749 @item -fsanitize-address-use-after-scope
12750 @opindex fsanitize-address-use-after-scope
12751 Enable sanitization of local variables to detect use-after-scope bugs.
12752 The option sets @option{-fstack-reuse} to @samp{none}.
12753
12754 @item -fsanitize-undefined-trap-on-error
12755 @opindex fsanitize-undefined-trap-on-error
12756 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12757 report undefined behavior using @code{__builtin_trap} rather than
12758 a @code{libubsan} library routine. The advantage of this is that the
12759 @code{libubsan} library is not needed and is not linked in, so this
12760 is usable even in freestanding environments.
12761
12762 @item -fsanitize-coverage=trace-pc
12763 @opindex fsanitize-coverage=trace-pc
12764 Enable coverage-guided fuzzing code instrumentation.
12765 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12766
12767 @item -fsanitize-coverage=trace-cmp
12768 @opindex fsanitize-coverage=trace-cmp
12769 Enable dataflow guided fuzzing code instrumentation.
12770 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12771 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12772 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12773 variable or @code{__sanitizer_cov_trace_const_cmp1},
12774 @code{__sanitizer_cov_trace_const_cmp2},
12775 @code{__sanitizer_cov_trace_const_cmp4} or
12776 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12777 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12778 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12779 @code{__sanitizer_cov_trace_switch} for switch statements.
12780
12781 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12782 @opindex fcf-protection
12783 Enable code instrumentation of control-flow transfers to increase
12784 program security by checking that target addresses of control-flow
12785 transfer instructions (such as indirect function call, function return,
12786 indirect jump) are valid. This prevents diverting the flow of control
12787 to an unexpected target. This is intended to protect against such
12788 threats as Return-oriented Programming (ROP), and similarly
12789 call/jmp-oriented programming (COP/JOP).
12790
12791 The value @code{branch} tells the compiler to implement checking of
12792 validity of control-flow transfer at the point of indirect branch
12793 instructions, i.e.@: call/jmp instructions. The value @code{return}
12794 implements checking of validity at the point of returning from a
12795 function. The value @code{full} is an alias for specifying both
12796 @code{branch} and @code{return}. The value @code{none} turns off
12797 instrumentation.
12798
12799 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12800 used. The first bit of @code{__CET__} is set to 1 for the value
12801 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12802 the @code{return}.
12803
12804 You can also use the @code{nocf_check} attribute to identify
12805 which functions and calls should be skipped from instrumentation
12806 (@pxref{Function Attributes}).
12807
12808 Currently the x86 GNU/Linux target provides an implementation based
12809 on Intel Control-flow Enforcement Technology (CET).
12810
12811 @item -fstack-protector
12812 @opindex fstack-protector
12813 Emit extra code to check for buffer overflows, such as stack smashing
12814 attacks. This is done by adding a guard variable to functions with
12815 vulnerable objects. This includes functions that call @code{alloca}, and
12816 functions with buffers larger than 8 bytes. The guards are initialized
12817 when a function is entered and then checked when the function exits.
12818 If a guard check fails, an error message is printed and the program exits.
12819
12820 @item -fstack-protector-all
12821 @opindex fstack-protector-all
12822 Like @option{-fstack-protector} except that all functions are protected.
12823
12824 @item -fstack-protector-strong
12825 @opindex fstack-protector-strong
12826 Like @option{-fstack-protector} but includes additional functions to
12827 be protected --- those that have local array definitions, or have
12828 references to local frame addresses.
12829
12830 @item -fstack-protector-explicit
12831 @opindex fstack-protector-explicit
12832 Like @option{-fstack-protector} but only protects those functions which
12833 have the @code{stack_protect} attribute.
12834
12835 @item -fstack-check
12836 @opindex fstack-check
12837 Generate code to verify that you do not go beyond the boundary of the
12838 stack. You should specify this flag if you are running in an
12839 environment with multiple threads, but you only rarely need to specify it in
12840 a single-threaded environment since stack overflow is automatically
12841 detected on nearly all systems if there is only one stack.
12842
12843 Note that this switch does not actually cause checking to be done; the
12844 operating system or the language runtime must do that. The switch causes
12845 generation of code to ensure that they see the stack being extended.
12846
12847 You can additionally specify a string parameter: @samp{no} means no
12848 checking, @samp{generic} means force the use of old-style checking,
12849 @samp{specific} means use the best checking method and is equivalent
12850 to bare @option{-fstack-check}.
12851
12852 Old-style checking is a generic mechanism that requires no specific
12853 target support in the compiler but comes with the following drawbacks:
12854
12855 @enumerate
12856 @item
12857 Modified allocation strategy for large objects: they are always
12858 allocated dynamically if their size exceeds a fixed threshold. Note this
12859 may change the semantics of some code.
12860
12861 @item
12862 Fixed limit on the size of the static frame of functions: when it is
12863 topped by a particular function, stack checking is not reliable and
12864 a warning is issued by the compiler.
12865
12866 @item
12867 Inefficiency: because of both the modified allocation strategy and the
12868 generic implementation, code performance is hampered.
12869 @end enumerate
12870
12871 Note that old-style stack checking is also the fallback method for
12872 @samp{specific} if no target support has been added in the compiler.
12873
12874 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12875 and stack overflows. @samp{specific} is an excellent choice when compiling
12876 Ada code. It is not generally sufficient to protect against stack-clash
12877 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12878
12879 @item -fstack-clash-protection
12880 @opindex fstack-clash-protection
12881 Generate code to prevent stack clash style attacks. When this option is
12882 enabled, the compiler will only allocate one page of stack space at a time
12883 and each page is accessed immediately after allocation. Thus, it prevents
12884 allocations from jumping over any stack guard page provided by the
12885 operating system.
12886
12887 Most targets do not fully support stack clash protection. However, on
12888 those targets @option{-fstack-clash-protection} will protect dynamic stack
12889 allocations. @option{-fstack-clash-protection} may also provide limited
12890 protection for static stack allocations if the target supports
12891 @option{-fstack-check=specific}.
12892
12893 @item -fstack-limit-register=@var{reg}
12894 @itemx -fstack-limit-symbol=@var{sym}
12895 @itemx -fno-stack-limit
12896 @opindex fstack-limit-register
12897 @opindex fstack-limit-symbol
12898 @opindex fno-stack-limit
12899 Generate code to ensure that the stack does not grow beyond a certain value,
12900 either the value of a register or the address of a symbol. If a larger
12901 stack is required, a signal is raised at run time. For most targets,
12902 the signal is raised before the stack overruns the boundary, so
12903 it is possible to catch the signal without taking special precautions.
12904
12905 For instance, if the stack starts at absolute address @samp{0x80000000}
12906 and grows downwards, you can use the flags
12907 @option{-fstack-limit-symbol=__stack_limit} and
12908 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12909 of 128KB@. Note that this may only work with the GNU linker.
12910
12911 You can locally override stack limit checking by using the
12912 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12913
12914 @item -fsplit-stack
12915 @opindex fsplit-stack
12916 Generate code to automatically split the stack before it overflows.
12917 The resulting program has a discontiguous stack which can only
12918 overflow if the program is unable to allocate any more memory. This
12919 is most useful when running threaded programs, as it is no longer
12920 necessary to calculate a good stack size to use for each thread. This
12921 is currently only implemented for the x86 targets running
12922 GNU/Linux.
12923
12924 When code compiled with @option{-fsplit-stack} calls code compiled
12925 without @option{-fsplit-stack}, there may not be much stack space
12926 available for the latter code to run. If compiling all code,
12927 including library code, with @option{-fsplit-stack} is not an option,
12928 then the linker can fix up these calls so that the code compiled
12929 without @option{-fsplit-stack} always has a large stack. Support for
12930 this is implemented in the gold linker in GNU binutils release 2.21
12931 and later.
12932
12933 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12934 @opindex fvtable-verify
12935 This option is only available when compiling C++ code.
12936 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12937 feature that verifies at run time, for every virtual call, that
12938 the vtable pointer through which the call is made is valid for the type of
12939 the object, and has not been corrupted or overwritten. If an invalid vtable
12940 pointer is detected at run time, an error is reported and execution of the
12941 program is immediately halted.
12942
12943 This option causes run-time data structures to be built at program startup,
12944 which are used for verifying the vtable pointers.
12945 The options @samp{std} and @samp{preinit}
12946 control the timing of when these data structures are built. In both cases the
12947 data structures are built before execution reaches @code{main}. Using
12948 @option{-fvtable-verify=std} causes the data structures to be built after
12949 shared libraries have been loaded and initialized.
12950 @option{-fvtable-verify=preinit} causes them to be built before shared
12951 libraries have been loaded and initialized.
12952
12953 If this option appears multiple times in the command line with different
12954 values specified, @samp{none} takes highest priority over both @samp{std} and
12955 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12956
12957 @item -fvtv-debug
12958 @opindex fvtv-debug
12959 When used in conjunction with @option{-fvtable-verify=std} or
12960 @option{-fvtable-verify=preinit}, causes debug versions of the
12961 runtime functions for the vtable verification feature to be called.
12962 This flag also causes the compiler to log information about which
12963 vtable pointers it finds for each class.
12964 This information is written to a file named @file{vtv_set_ptr_data.log}
12965 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12966 if that is defined or the current working directory otherwise.
12967
12968 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12969 file, be sure to delete any existing one.
12970
12971 @item -fvtv-counts
12972 @opindex fvtv-counts
12973 This is a debugging flag. When used in conjunction with
12974 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12975 causes the compiler to keep track of the total number of virtual calls
12976 it encounters and the number of verifications it inserts. It also
12977 counts the number of calls to certain run-time library functions
12978 that it inserts and logs this information for each compilation unit.
12979 The compiler writes this information to a file named
12980 @file{vtv_count_data.log} in the directory named by the environment
12981 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12982 directory otherwise. It also counts the size of the vtable pointer sets
12983 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12984 in the same directory.
12985
12986 Note: This feature @emph{appends} data to the log files. To get fresh log
12987 files, be sure to delete any existing ones.
12988
12989 @item -finstrument-functions
12990 @opindex finstrument-functions
12991 Generate instrumentation calls for entry and exit to functions. Just
12992 after function entry and just before function exit, the following
12993 profiling functions are called with the address of the current
12994 function and its call site. (On some platforms,
12995 @code{__builtin_return_address} does not work beyond the current
12996 function, so the call site information may not be available to the
12997 profiling functions otherwise.)
12998
12999 @smallexample
13000 void __cyg_profile_func_enter (void *this_fn,
13001 void *call_site);
13002 void __cyg_profile_func_exit (void *this_fn,
13003 void *call_site);
13004 @end smallexample
13005
13006 The first argument is the address of the start of the current function,
13007 which may be looked up exactly in the symbol table.
13008
13009 This instrumentation is also done for functions expanded inline in other
13010 functions. The profiling calls indicate where, conceptually, the
13011 inline function is entered and exited. This means that addressable
13012 versions of such functions must be available. If all your uses of a
13013 function are expanded inline, this may mean an additional expansion of
13014 code size. If you use @code{extern inline} in your C code, an
13015 addressable version of such functions must be provided. (This is
13016 normally the case anyway, but if you get lucky and the optimizer always
13017 expands the functions inline, you might have gotten away without
13018 providing static copies.)
13019
13020 A function may be given the attribute @code{no_instrument_function}, in
13021 which case this instrumentation is not done. This can be used, for
13022 example, for the profiling functions listed above, high-priority
13023 interrupt routines, and any functions from which the profiling functions
13024 cannot safely be called (perhaps signal handlers, if the profiling
13025 routines generate output or allocate memory).
13026 @xref{Common Function Attributes}.
13027
13028 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13029 @opindex finstrument-functions-exclude-file-list
13030
13031 Set the list of functions that are excluded from instrumentation (see
13032 the description of @option{-finstrument-functions}). If the file that
13033 contains a function definition matches with one of @var{file}, then
13034 that function is not instrumented. The match is done on substrings:
13035 if the @var{file} parameter is a substring of the file name, it is
13036 considered to be a match.
13037
13038 For example:
13039
13040 @smallexample
13041 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13042 @end smallexample
13043
13044 @noindent
13045 excludes any inline function defined in files whose pathnames
13046 contain @file{/bits/stl} or @file{include/sys}.
13047
13048 If, for some reason, you want to include letter @samp{,} in one of
13049 @var{sym}, write @samp{\,}. For example,
13050 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13051 (note the single quote surrounding the option).
13052
13053 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13054 @opindex finstrument-functions-exclude-function-list
13055
13056 This is similar to @option{-finstrument-functions-exclude-file-list},
13057 but this option sets the list of function names to be excluded from
13058 instrumentation. The function name to be matched is its user-visible
13059 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13060 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
13061 match is done on substrings: if the @var{sym} parameter is a substring
13062 of the function name, it is considered to be a match. For C99 and C++
13063 extended identifiers, the function name must be given in UTF-8, not
13064 using universal character names.
13065
13066 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13067 @opindex fpatchable-function-entry
13068 Generate @var{N} NOPs right at the beginning
13069 of each function, with the function entry point before the @var{M}th NOP.
13070 If @var{M} is omitted, it defaults to @code{0} so the
13071 function entry points to the address just at the first NOP.
13072 The NOP instructions reserve extra space which can be used to patch in
13073 any desired instrumentation at run time, provided that the code segment
13074 is writable. The amount of space is controllable indirectly via
13075 the number of NOPs; the NOP instruction used corresponds to the instruction
13076 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13077 is target-specific and may also depend on the architecture variant and/or
13078 other compilation options.
13079
13080 For run-time identification, the starting addresses of these areas,
13081 which correspond to their respective function entries minus @var{M},
13082 are additionally collected in the @code{__patchable_function_entries}
13083 section of the resulting binary.
13084
13085 Note that the value of @code{__attribute__ ((patchable_function_entry
13086 (N,M)))} takes precedence over command-line option
13087 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13088 the area size or to remove it completely on a single function.
13089 If @code{N=0}, no pad location is recorded.
13090
13091 The NOP instructions are inserted at---and maybe before, depending on
13092 @var{M}---the function entry address, even before the prologue.
13093
13094 @end table
13095
13096
13097 @node Preprocessor Options
13098 @section Options Controlling the Preprocessor
13099 @cindex preprocessor options
13100 @cindex options, preprocessor
13101
13102 These options control the C preprocessor, which is run on each C source
13103 file before actual compilation.
13104
13105 If you use the @option{-E} option, nothing is done except preprocessing.
13106 Some of these options make sense only together with @option{-E} because
13107 they cause the preprocessor output to be unsuitable for actual
13108 compilation.
13109
13110 In addition to the options listed here, there are a number of options
13111 to control search paths for include files documented in
13112 @ref{Directory Options}.
13113 Options to control preprocessor diagnostics are listed in
13114 @ref{Warning Options}.
13115
13116 @table @gcctabopt
13117 @include cppopts.texi
13118
13119 @item -Wp,@var{option}
13120 @opindex Wp
13121 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13122 and pass @var{option} directly through to the preprocessor. If
13123 @var{option} contains commas, it is split into multiple options at the
13124 commas. However, many options are modified, translated or interpreted
13125 by the compiler driver before being passed to the preprocessor, and
13126 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13127 interface is undocumented and subject to change, so whenever possible
13128 you should avoid using @option{-Wp} and let the driver handle the
13129 options instead.
13130
13131 @item -Xpreprocessor @var{option}
13132 @opindex Xpreprocessor
13133 Pass @var{option} as an option to the preprocessor. You can use this to
13134 supply system-specific preprocessor options that GCC does not
13135 recognize.
13136
13137 If you want to pass an option that takes an argument, you must use
13138 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13139
13140 @item -no-integrated-cpp
13141 @opindex no-integrated-cpp
13142 Perform preprocessing as a separate pass before compilation.
13143 By default, GCC performs preprocessing as an integrated part of
13144 input tokenization and parsing.
13145 If this option is provided, the appropriate language front end
13146 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13147 and Objective-C, respectively) is instead invoked twice,
13148 once for preprocessing only and once for actual compilation
13149 of the preprocessed input.
13150 This option may be useful in conjunction with the @option{-B} or
13151 @option{-wrapper} options to specify an alternate preprocessor or
13152 perform additional processing of the program source between
13153 normal preprocessing and compilation.
13154
13155 @end table
13156
13157 @node Assembler Options
13158 @section Passing Options to the Assembler
13159
13160 @c prevent bad page break with this line
13161 You can pass options to the assembler.
13162
13163 @table @gcctabopt
13164 @item -Wa,@var{option}
13165 @opindex Wa
13166 Pass @var{option} as an option to the assembler. If @var{option}
13167 contains commas, it is split into multiple options at the commas.
13168
13169 @item -Xassembler @var{option}
13170 @opindex Xassembler
13171 Pass @var{option} as an option to the assembler. You can use this to
13172 supply system-specific assembler options that GCC does not
13173 recognize.
13174
13175 If you want to pass an option that takes an argument, you must use
13176 @option{-Xassembler} twice, once for the option and once for the argument.
13177
13178 @end table
13179
13180 @node Link Options
13181 @section Options for Linking
13182 @cindex link options
13183 @cindex options, linking
13184
13185 These options come into play when the compiler links object files into
13186 an executable output file. They are meaningless if the compiler is
13187 not doing a link step.
13188
13189 @table @gcctabopt
13190 @cindex file names
13191 @item @var{object-file-name}
13192 A file name that does not end in a special recognized suffix is
13193 considered to name an object file or library. (Object files are
13194 distinguished from libraries by the linker according to the file
13195 contents.) If linking is done, these object files are used as input
13196 to the linker.
13197
13198 @item -c
13199 @itemx -S
13200 @itemx -E
13201 @opindex c
13202 @opindex S
13203 @opindex E
13204 If any of these options is used, then the linker is not run, and
13205 object file names should not be used as arguments. @xref{Overall
13206 Options}.
13207
13208 @item -flinker-output=@var{type}
13209 @opindex flinker-output
13210 This option controls code generation of the link-time optimizer. By
13211 default the linker output is automatically determined by the linker
13212 plugin. For debugging the compiler and if incremental linking with a
13213 non-LTO object file is desired, it may be useful to control the type
13214 manually.
13215
13216 If @var{type} is @samp{exec}, code generation produces a static
13217 binary. In this case @option{-fpic} and @option{-fpie} are both
13218 disabled.
13219
13220 If @var{type} is @samp{dyn}, code generation produces a shared
13221 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13222 but not enabled automatically. This allows to build shared libraries
13223 without position-independent code on architectures where this is
13224 possible, i.e.@: on x86.
13225
13226 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
13227 executable. This results in similar optimizations as @samp{exec}
13228 except that @option{-fpie} is not disabled if specified at compilation
13229 time.
13230
13231 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
13232 done. The sections containing intermediate code for link-time optimization are
13233 merged, pre-optimized, and output to the resulting object file. In addition, if
13234 @option{-ffat-lto-objects} is specified, binary code is produced for future
13235 non-LTO linking. The object file produced by incremental linking is smaller
13236 than a static library produced from the same object files. At link time the
13237 result of incremental linking also loads faster than a static
13238 library assuming that the majority of objects in the library are used.
13239
13240 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13241 code generation is forced, a final binary is produced, and the intermediate
13242 code for later link-time optimization is stripped. When multiple object files
13243 are linked together the resulting code is better optimized than with
13244 link-time optimizations disabled (for example, cross-module inlining
13245 happens), but most of benefits of whole program optimizations are lost.
13246
13247 During the incremental link (by @option{-r}) the linker plugin defaults to
13248 @option{rel}. With current interfaces to GNU Binutils it is however not
13249 possible to incrementally link LTO objects and non-LTO objects into a single
13250 mixed object file. If any of object files in incremental link cannot
13251 be used for link-time optimization, the linker plugin issues a warning and
13252 uses @samp{nolto-rel}. To maintain whole program optimization, it is
13253 recommended to link such objects into static library instead. Alternatively it
13254 is possible to use H.J. Lu's binutils with support for mixed objects.
13255
13256 @item -fuse-ld=bfd
13257 @opindex fuse-ld=bfd
13258 Use the @command{bfd} linker instead of the default linker.
13259
13260 @item -fuse-ld=gold
13261 @opindex fuse-ld=gold
13262 Use the @command{gold} linker instead of the default linker.
13263
13264 @item -fuse-ld=lld
13265 @opindex fuse-ld=lld
13266 Use the LLVM @command{lld} linker instead of the default linker.
13267
13268 @cindex Libraries
13269 @item -l@var{library}
13270 @itemx -l @var{library}
13271 @opindex l
13272 Search the library named @var{library} when linking. (The second
13273 alternative with the library as a separate argument is only for
13274 POSIX compliance and is not recommended.)
13275
13276 The @option{-l} option is passed directly to the linker by GCC. Refer
13277 to your linker documentation for exact details. The general
13278 description below applies to the GNU linker.
13279
13280 The linker searches a standard list of directories for the library.
13281 The directories searched include several standard system directories
13282 plus any that you specify with @option{-L}.
13283
13284 Static libraries are archives of object files, and have file names
13285 like @file{lib@var{library}.a}. Some targets also support shared
13286 libraries, which typically have names like @file{lib@var{library}.so}.
13287 If both static and shared libraries are found, the linker gives
13288 preference to linking with the shared library unless the
13289 @option{-static} option is used.
13290
13291 It makes a difference where in the command you write this option; the
13292 linker searches and processes libraries and object files in the order they
13293 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13294 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13295 to functions in @samp{z}, those functions may not be loaded.
13296
13297 @item -lobjc
13298 @opindex lobjc
13299 You need this special case of the @option{-l} option in order to
13300 link an Objective-C or Objective-C++ program.
13301
13302 @item -nostartfiles
13303 @opindex nostartfiles
13304 Do not use the standard system startup files when linking.
13305 The standard system libraries are used normally, unless @option{-nostdlib},
13306 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13307
13308 @item -nodefaultlibs
13309 @opindex nodefaultlibs
13310 Do not use the standard system libraries when linking.
13311 Only the libraries you specify are passed to the linker, and options
13312 specifying linkage of the system libraries, such as @option{-static-libgcc}
13313 or @option{-shared-libgcc}, are ignored.
13314 The standard startup files are used normally, unless @option{-nostartfiles}
13315 is used.
13316
13317 The compiler may generate calls to @code{memcmp},
13318 @code{memset}, @code{memcpy} and @code{memmove}.
13319 These entries are usually resolved by entries in
13320 libc. These entry points should be supplied through some other
13321 mechanism when this option is specified.
13322
13323 @item -nolibc
13324 @opindex nolibc
13325 Do not use the C library or system libraries tightly coupled with it when
13326 linking. Still link with the startup files, @file{libgcc} or toolchain
13327 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13328 or @file{libstdc++} unless options preventing their inclusion are used as
13329 well. This typically removes @option{-lc} from the link command line, as well
13330 as system libraries that normally go with it and become meaningless when
13331 absence of a C library is assumed, for example @option{-lpthread} or
13332 @option{-lm} in some configurations. This is intended for bare-board
13333 targets when there is indeed no C library available.
13334
13335 @item -nostdlib
13336 @opindex nostdlib
13337 Do not use the standard system startup files or libraries when linking.
13338 No startup files and only the libraries you specify are passed to
13339 the linker, and options specifying linkage of the system libraries, such as
13340 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13341
13342 The compiler may generate calls to @code{memcmp}, @code{memset},
13343 @code{memcpy} and @code{memmove}.
13344 These entries are usually resolved by entries in
13345 libc. These entry points should be supplied through some other
13346 mechanism when this option is specified.
13347
13348 @cindex @option{-lgcc}, use with @option{-nostdlib}
13349 @cindex @option{-nostdlib} and unresolved references
13350 @cindex unresolved references and @option{-nostdlib}
13351 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13352 @cindex @option{-nodefaultlibs} and unresolved references
13353 @cindex unresolved references and @option{-nodefaultlibs}
13354 One of the standard libraries bypassed by @option{-nostdlib} and
13355 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13356 which GCC uses to overcome shortcomings of particular machines, or special
13357 needs for some languages.
13358 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13359 Collection (GCC) Internals},
13360 for more discussion of @file{libgcc.a}.)
13361 In most cases, you need @file{libgcc.a} even when you want to avoid
13362 other standard libraries. In other words, when you specify @option{-nostdlib}
13363 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13364 This ensures that you have no unresolved references to internal GCC
13365 library subroutines.
13366 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13367 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13368 GNU Compiler Collection (GCC) Internals}.)
13369
13370 @item -e @var{entry}
13371 @itemx --entry=@var{entry}
13372 @opindex e
13373 @opindex entry
13374
13375 Specify that the program entry point is @var{entry}. The argument is
13376 interpreted by the linker; the GNU linker accepts either a symbol name
13377 or an address.
13378
13379 @item -pie
13380 @opindex pie
13381 Produce a dynamically linked position independent executable on targets
13382 that support it. For predictable results, you must also specify the same
13383 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13384 or model suboptions) when you specify this linker option.
13385
13386 @item -no-pie
13387 @opindex no-pie
13388 Don't produce a dynamically linked position independent executable.
13389
13390 @item -static-pie
13391 @opindex static-pie
13392 Produce a static position independent executable on targets that support
13393 it. A static position independent executable is similar to a static
13394 executable, but can be loaded at any address without a dynamic linker.
13395 For predictable results, you must also specify the same set of options
13396 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13397 suboptions) when you specify this linker option.
13398
13399 @item -pthread
13400 @opindex pthread
13401 Link with the POSIX threads library. This option is supported on
13402 GNU/Linux targets, most other Unix derivatives, and also on
13403 x86 Cygwin and MinGW targets. On some targets this option also sets
13404 flags for the preprocessor, so it should be used consistently for both
13405 compilation and linking.
13406
13407 @item -r
13408 @opindex r
13409 Produce a relocatable object as output. This is also known as partial
13410 linking.
13411
13412 @item -rdynamic
13413 @opindex rdynamic
13414 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13415 that support it. This instructs the linker to add all symbols, not
13416 only used ones, to the dynamic symbol table. This option is needed
13417 for some uses of @code{dlopen} or to allow obtaining backtraces
13418 from within a program.
13419
13420 @item -s
13421 @opindex s
13422 Remove all symbol table and relocation information from the executable.
13423
13424 @item -static
13425 @opindex static
13426 On systems that support dynamic linking, this overrides @option{-pie}
13427 and prevents linking with the shared libraries. On other systems, this
13428 option has no effect.
13429
13430 @item -shared
13431 @opindex shared
13432 Produce a shared object which can then be linked with other objects to
13433 form an executable. Not all systems support this option. For predictable
13434 results, you must also specify the same set of options used for compilation
13435 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13436 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13437 needs to build supplementary stub code for constructors to work. On
13438 multi-libbed systems, @samp{gcc -shared} must select the correct support
13439 libraries to link against. Failing to supply the correct flags may lead
13440 to subtle defects. Supplying them in cases where they are not necessary
13441 is innocuous.}
13442
13443 @item -shared-libgcc
13444 @itemx -static-libgcc
13445 @opindex shared-libgcc
13446 @opindex static-libgcc
13447 On systems that provide @file{libgcc} as a shared library, these options
13448 force the use of either the shared or static version, respectively.
13449 If no shared version of @file{libgcc} was built when the compiler was
13450 configured, these options have no effect.
13451
13452 There are several situations in which an application should use the
13453 shared @file{libgcc} instead of the static version. The most common
13454 of these is when the application wishes to throw and catch exceptions
13455 across different shared libraries. In that case, each of the libraries
13456 as well as the application itself should use the shared @file{libgcc}.
13457
13458 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13459 whenever you build a shared library or a main executable, because C++
13460 programs typically use exceptions, so this is the right thing to do.
13461
13462 If, instead, you use the GCC driver to create shared libraries, you may
13463 find that they are not always linked with the shared @file{libgcc}.
13464 If GCC finds, at its configuration time, that you have a non-GNU linker
13465 or a GNU linker that does not support option @option{--eh-frame-hdr},
13466 it links the shared version of @file{libgcc} into shared libraries
13467 by default. Otherwise, it takes advantage of the linker and optimizes
13468 away the linking with the shared version of @file{libgcc}, linking with
13469 the static version of libgcc by default. This allows exceptions to
13470 propagate through such shared libraries, without incurring relocation
13471 costs at library load time.
13472
13473 However, if a library or main executable is supposed to throw or catch
13474 exceptions, you must link it using the G++ driver, or using the option
13475 @option{-shared-libgcc}, such that it is linked with the shared
13476 @file{libgcc}.
13477
13478 @item -static-libasan
13479 @opindex static-libasan
13480 When the @option{-fsanitize=address} option is used to link a program,
13481 the GCC driver automatically links against @option{libasan}. If
13482 @file{libasan} is available as a shared library, and the @option{-static}
13483 option is not used, then this links against the shared version of
13484 @file{libasan}. The @option{-static-libasan} option directs the GCC
13485 driver to link @file{libasan} statically, without necessarily linking
13486 other libraries statically.
13487
13488 @item -static-libtsan
13489 @opindex static-libtsan
13490 When the @option{-fsanitize=thread} option is used to link a program,
13491 the GCC driver automatically links against @option{libtsan}. If
13492 @file{libtsan} is available as a shared library, and the @option{-static}
13493 option is not used, then this links against the shared version of
13494 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13495 driver to link @file{libtsan} statically, without necessarily linking
13496 other libraries statically.
13497
13498 @item -static-liblsan
13499 @opindex static-liblsan
13500 When the @option{-fsanitize=leak} option is used to link a program,
13501 the GCC driver automatically links against @option{liblsan}. If
13502 @file{liblsan} is available as a shared library, and the @option{-static}
13503 option is not used, then this links against the shared version of
13504 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13505 driver to link @file{liblsan} statically, without necessarily linking
13506 other libraries statically.
13507
13508 @item -static-libubsan
13509 @opindex static-libubsan
13510 When the @option{-fsanitize=undefined} option is used to link a program,
13511 the GCC driver automatically links against @option{libubsan}. If
13512 @file{libubsan} is available as a shared library, and the @option{-static}
13513 option is not used, then this links against the shared version of
13514 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13515 driver to link @file{libubsan} statically, without necessarily linking
13516 other libraries statically.
13517
13518 @item -static-libstdc++
13519 @opindex static-libstdc++
13520 When the @command{g++} program is used to link a C++ program, it
13521 normally automatically links against @option{libstdc++}. If
13522 @file{libstdc++} is available as a shared library, and the
13523 @option{-static} option is not used, then this links against the
13524 shared version of @file{libstdc++}. That is normally fine. However, it
13525 is sometimes useful to freeze the version of @file{libstdc++} used by
13526 the program without going all the way to a fully static link. The
13527 @option{-static-libstdc++} option directs the @command{g++} driver to
13528 link @file{libstdc++} statically, without necessarily linking other
13529 libraries statically.
13530
13531 @item -symbolic
13532 @opindex symbolic
13533 Bind references to global symbols when building a shared object. Warn
13534 about any unresolved references (unless overridden by the link editor
13535 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13536 this option.
13537
13538 @item -T @var{script}
13539 @opindex T
13540 @cindex linker script
13541 Use @var{script} as the linker script. This option is supported by most
13542 systems using the GNU linker. On some targets, such as bare-board
13543 targets without an operating system, the @option{-T} option may be required
13544 when linking to avoid references to undefined symbols.
13545
13546 @item -Xlinker @var{option}
13547 @opindex Xlinker
13548 Pass @var{option} as an option to the linker. You can use this to
13549 supply system-specific linker options that GCC does not recognize.
13550
13551 If you want to pass an option that takes a separate argument, you must use
13552 @option{-Xlinker} twice, once for the option and once for the argument.
13553 For example, to pass @option{-assert definitions}, you must write
13554 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13555 @option{-Xlinker "-assert definitions"}, because this passes the entire
13556 string as a single argument, which is not what the linker expects.
13557
13558 When using the GNU linker, it is usually more convenient to pass
13559 arguments to linker options using the @option{@var{option}=@var{value}}
13560 syntax than as separate arguments. For example, you can specify
13561 @option{-Xlinker -Map=output.map} rather than
13562 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13563 this syntax for command-line options.
13564
13565 @item -Wl,@var{option}
13566 @opindex Wl
13567 Pass @var{option} as an option to the linker. If @var{option} contains
13568 commas, it is split into multiple options at the commas. You can use this
13569 syntax to pass an argument to the option.
13570 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13571 linker. When using the GNU linker, you can also get the same effect with
13572 @option{-Wl,-Map=output.map}.
13573
13574 @item -u @var{symbol}
13575 @opindex u
13576 Pretend the symbol @var{symbol} is undefined, to force linking of
13577 library modules to define it. You can use @option{-u} multiple times with
13578 different symbols to force loading of additional library modules.
13579
13580 @item -z @var{keyword}
13581 @opindex z
13582 @option{-z} is passed directly on to the linker along with the keyword
13583 @var{keyword}. See the section in the documentation of your linker for
13584 permitted values and their meanings.
13585 @end table
13586
13587 @node Directory Options
13588 @section Options for Directory Search
13589 @cindex directory options
13590 @cindex options, directory search
13591 @cindex search path
13592
13593 These options specify directories to search for header files, for
13594 libraries and for parts of the compiler:
13595
13596 @table @gcctabopt
13597 @include cppdiropts.texi
13598
13599 @item -iplugindir=@var{dir}
13600 @opindex iplugindir=
13601 Set the directory to search for plugins that are passed
13602 by @option{-fplugin=@var{name}} instead of
13603 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13604 to be used by the user, but only passed by the driver.
13605
13606 @item -L@var{dir}
13607 @opindex L
13608 Add directory @var{dir} to the list of directories to be searched
13609 for @option{-l}.
13610
13611 @item -B@var{prefix}
13612 @opindex B
13613 This option specifies where to find the executables, libraries,
13614 include files, and data files of the compiler itself.
13615
13616 The compiler driver program runs one or more of the subprograms
13617 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13618 @var{prefix} as a prefix for each program it tries to run, both with and
13619 without @samp{@var{machine}/@var{version}/} for the corresponding target
13620 machine and compiler version.
13621
13622 For each subprogram to be run, the compiler driver first tries the
13623 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13624 is not specified, the driver tries two standard prefixes,
13625 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13626 those results in a file name that is found, the unmodified program
13627 name is searched for using the directories specified in your
13628 @env{PATH} environment variable.
13629
13630 The compiler checks to see if the path provided by @option{-B}
13631 refers to a directory, and if necessary it adds a directory
13632 separator character at the end of the path.
13633
13634 @option{-B} prefixes that effectively specify directory names also apply
13635 to libraries in the linker, because the compiler translates these
13636 options into @option{-L} options for the linker. They also apply to
13637 include files in the preprocessor, because the compiler translates these
13638 options into @option{-isystem} options for the preprocessor. In this case,
13639 the compiler appends @samp{include} to the prefix.
13640
13641 The runtime support file @file{libgcc.a} can also be searched for using
13642 the @option{-B} prefix, if needed. If it is not found there, the two
13643 standard prefixes above are tried, and that is all. The file is left
13644 out of the link if it is not found by those means.
13645
13646 Another way to specify a prefix much like the @option{-B} prefix is to use
13647 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13648 Variables}.
13649
13650 As a special kludge, if the path provided by @option{-B} is
13651 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13652 9, then it is replaced by @file{[dir/]include}. This is to help
13653 with boot-strapping the compiler.
13654
13655 @item -no-canonical-prefixes
13656 @opindex no-canonical-prefixes
13657 Do not expand any symbolic links, resolve references to @samp{/../}
13658 or @samp{/./}, or make the path absolute when generating a relative
13659 prefix.
13660
13661 @item --sysroot=@var{dir}
13662 @opindex sysroot
13663 Use @var{dir} as the logical root directory for headers and libraries.
13664 For example, if the compiler normally searches for headers in
13665 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13666 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13667
13668 If you use both this option and the @option{-isysroot} option, then
13669 the @option{--sysroot} option applies to libraries, but the
13670 @option{-isysroot} option applies to header files.
13671
13672 The GNU linker (beginning with version 2.16) has the necessary support
13673 for this option. If your linker does not support this option, the
13674 header file aspect of @option{--sysroot} still works, but the
13675 library aspect does not.
13676
13677 @item --no-sysroot-suffix
13678 @opindex no-sysroot-suffix
13679 For some targets, a suffix is added to the root directory specified
13680 with @option{--sysroot}, depending on the other options used, so that
13681 headers may for example be found in
13682 @file{@var{dir}/@var{suffix}/usr/include} instead of
13683 @file{@var{dir}/usr/include}. This option disables the addition of
13684 such a suffix.
13685
13686 @end table
13687
13688 @node Code Gen Options
13689 @section Options for Code Generation Conventions
13690 @cindex code generation conventions
13691 @cindex options, code generation
13692 @cindex run-time options
13693
13694 These machine-independent options control the interface conventions
13695 used in code generation.
13696
13697 Most of them have both positive and negative forms; the negative form
13698 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13699 one of the forms is listed---the one that is not the default. You
13700 can figure out the other form by either removing @samp{no-} or adding
13701 it.
13702
13703 @table @gcctabopt
13704 @item -fstack-reuse=@var{reuse-level}
13705 @opindex fstack_reuse
13706 This option controls stack space reuse for user declared local/auto variables
13707 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13708 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13709 local variables and temporaries, @samp{named_vars} enables the reuse only for
13710 user defined local variables with names, and @samp{none} disables stack reuse
13711 completely. The default value is @samp{all}. The option is needed when the
13712 program extends the lifetime of a scoped local variable or a compiler generated
13713 temporary beyond the end point defined by the language. When a lifetime of
13714 a variable ends, and if the variable lives in memory, the optimizing compiler
13715 has the freedom to reuse its stack space with other temporaries or scoped
13716 local variables whose live range does not overlap with it. Legacy code extending
13717 local lifetime is likely to break with the stack reuse optimization.
13718
13719 For example,
13720
13721 @smallexample
13722 int *p;
13723 @{
13724 int local1;
13725
13726 p = &local1;
13727 local1 = 10;
13728 ....
13729 @}
13730 @{
13731 int local2;
13732 local2 = 20;
13733 ...
13734 @}
13735
13736 if (*p == 10) // out of scope use of local1
13737 @{
13738
13739 @}
13740 @end smallexample
13741
13742 Another example:
13743 @smallexample
13744
13745 struct A
13746 @{
13747 A(int k) : i(k), j(k) @{ @}
13748 int i;
13749 int j;
13750 @};
13751
13752 A *ap;
13753
13754 void foo(const A& ar)
13755 @{
13756 ap = &ar;
13757 @}
13758
13759 void bar()
13760 @{
13761 foo(A(10)); // temp object's lifetime ends when foo returns
13762
13763 @{
13764 A a(20);
13765 ....
13766 @}
13767 ap->i+= 10; // ap references out of scope temp whose space
13768 // is reused with a. What is the value of ap->i?
13769 @}
13770
13771 @end smallexample
13772
13773 The lifetime of a compiler generated temporary is well defined by the C++
13774 standard. When a lifetime of a temporary ends, and if the temporary lives
13775 in memory, the optimizing compiler has the freedom to reuse its stack
13776 space with other temporaries or scoped local variables whose live range
13777 does not overlap with it. However some of the legacy code relies on
13778 the behavior of older compilers in which temporaries' stack space is
13779 not reused, the aggressive stack reuse can lead to runtime errors. This
13780 option is used to control the temporary stack reuse optimization.
13781
13782 @item -ftrapv
13783 @opindex ftrapv
13784 This option generates traps for signed overflow on addition, subtraction,
13785 multiplication operations.
13786 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13787 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13788 @option{-fwrapv} being effective. Note that only active options override, so
13789 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13790 results in @option{-ftrapv} being effective.
13791
13792 @item -fwrapv
13793 @opindex fwrapv
13794 This option instructs the compiler to assume that signed arithmetic
13795 overflow of addition, subtraction and multiplication wraps around
13796 using twos-complement representation. This flag enables some optimizations
13797 and disables others.
13798 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13799 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13800 @option{-fwrapv} being effective. Note that only active options override, so
13801 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13802 results in @option{-ftrapv} being effective.
13803
13804 @item -fwrapv-pointer
13805 @opindex fwrapv-pointer
13806 This option instructs the compiler to assume that pointer arithmetic
13807 overflow on addition and subtraction wraps around using twos-complement
13808 representation. This flag disables some optimizations which assume
13809 pointer overflow is invalid.
13810
13811 @item -fstrict-overflow
13812 @opindex fstrict-overflow
13813 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13814 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13815
13816 @item -fexceptions
13817 @opindex fexceptions
13818 Enable exception handling. Generates extra code needed to propagate
13819 exceptions. For some targets, this implies GCC generates frame
13820 unwind information for all functions, which can produce significant data
13821 size overhead, although it does not affect execution. If you do not
13822 specify this option, GCC enables it by default for languages like
13823 C++ that normally require exception handling, and disables it for
13824 languages like C that do not normally require it. However, you may need
13825 to enable this option when compiling C code that needs to interoperate
13826 properly with exception handlers written in C++. You may also wish to
13827 disable this option if you are compiling older C++ programs that don't
13828 use exception handling.
13829
13830 @item -fnon-call-exceptions
13831 @opindex fnon-call-exceptions
13832 Generate code that allows trapping instructions to throw exceptions.
13833 Note that this requires platform-specific runtime support that does
13834 not exist everywhere. Moreover, it only allows @emph{trapping}
13835 instructions to throw exceptions, i.e.@: memory references or floating-point
13836 instructions. It does not allow exceptions to be thrown from
13837 arbitrary signal handlers such as @code{SIGALRM}.
13838
13839 @item -fdelete-dead-exceptions
13840 @opindex fdelete-dead-exceptions
13841 Consider that instructions that may throw exceptions but don't otherwise
13842 contribute to the execution of the program can be optimized away.
13843 This option is enabled by default for the Ada front end, as permitted by
13844 the Ada language specification.
13845 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13846
13847 @item -funwind-tables
13848 @opindex funwind-tables
13849 Similar to @option{-fexceptions}, except that it just generates any needed
13850 static data, but does not affect the generated code in any other way.
13851 You normally do not need to enable this option; instead, a language processor
13852 that needs this handling enables it on your behalf.
13853
13854 @item -fasynchronous-unwind-tables
13855 @opindex fasynchronous-unwind-tables
13856 Generate unwind table in DWARF format, if supported by target machine. The
13857 table is exact at each instruction boundary, so it can be used for stack
13858 unwinding from asynchronous events (such as debugger or garbage collector).
13859
13860 @item -fno-gnu-unique
13861 @opindex fno-gnu-unique
13862 @opindex fgnu-unique
13863 On systems with recent GNU assembler and C library, the C++ compiler
13864 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13865 of template static data members and static local variables in inline
13866 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13867 is necessary to avoid problems with a library used by two different
13868 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13869 therefore disagreeing with the other one about the binding of the
13870 symbol. But this causes @code{dlclose} to be ignored for affected
13871 DSOs; if your program relies on reinitialization of a DSO via
13872 @code{dlclose} and @code{dlopen}, you can use
13873 @option{-fno-gnu-unique}.
13874
13875 @item -fpcc-struct-return
13876 @opindex fpcc-struct-return
13877 Return ``short'' @code{struct} and @code{union} values in memory like
13878 longer ones, rather than in registers. This convention is less
13879 efficient, but it has the advantage of allowing intercallability between
13880 GCC-compiled files and files compiled with other compilers, particularly
13881 the Portable C Compiler (pcc).
13882
13883 The precise convention for returning structures in memory depends
13884 on the target configuration macros.
13885
13886 Short structures and unions are those whose size and alignment match
13887 that of some integer type.
13888
13889 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13890 switch is not binary compatible with code compiled with the
13891 @option{-freg-struct-return} switch.
13892 Use it to conform to a non-default application binary interface.
13893
13894 @item -freg-struct-return
13895 @opindex freg-struct-return
13896 Return @code{struct} and @code{union} values in registers when possible.
13897 This is more efficient for small structures than
13898 @option{-fpcc-struct-return}.
13899
13900 If you specify neither @option{-fpcc-struct-return} nor
13901 @option{-freg-struct-return}, GCC defaults to whichever convention is
13902 standard for the target. If there is no standard convention, GCC
13903 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13904 the principal compiler. In those cases, we can choose the standard, and
13905 we chose the more efficient register return alternative.
13906
13907 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13908 switch is not binary compatible with code compiled with the
13909 @option{-fpcc-struct-return} switch.
13910 Use it to conform to a non-default application binary interface.
13911
13912 @item -fshort-enums
13913 @opindex fshort-enums
13914 Allocate to an @code{enum} type only as many bytes as it needs for the
13915 declared range of possible values. Specifically, the @code{enum} type
13916 is equivalent to the smallest integer type that has enough room.
13917
13918 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13919 code that is not binary compatible with code generated without that switch.
13920 Use it to conform to a non-default application binary interface.
13921
13922 @item -fshort-wchar
13923 @opindex fshort-wchar
13924 Override the underlying type for @code{wchar_t} to be @code{short
13925 unsigned int} instead of the default for the target. This option is
13926 useful for building programs to run under WINE@.
13927
13928 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13929 code that is not binary compatible with code generated without that switch.
13930 Use it to conform to a non-default application binary interface.
13931
13932 @item -fno-common
13933 @opindex fno-common
13934 @opindex fcommon
13935 @cindex tentative definitions
13936 In C code, this option controls the placement of global variables
13937 defined without an initializer, known as @dfn{tentative definitions}
13938 in the C standard. Tentative definitions are distinct from declarations
13939 of a variable with the @code{extern} keyword, which do not allocate storage.
13940
13941 Unix C compilers have traditionally allocated storage for
13942 uninitialized global variables in a common block. This allows the
13943 linker to resolve all tentative definitions of the same variable
13944 in different compilation units to the same object, or to a non-tentative
13945 definition.
13946 This is the behavior specified by @option{-fcommon}, and is the default for
13947 GCC on most targets.
13948 On the other hand, this behavior is not required by ISO
13949 C, and on some targets may carry a speed or code size penalty on
13950 variable references.
13951
13952 The @option{-fno-common} option specifies that the compiler should instead
13953 place uninitialized global variables in the BSS section of the object file.
13954 This inhibits the merging of tentative definitions by the linker so
13955 you get a multiple-definition error if the same
13956 variable is defined in more than one compilation unit.
13957 Compiling with @option{-fno-common} is useful on targets for which
13958 it provides better performance, or if you wish to verify that the
13959 program will work on other systems that always treat uninitialized
13960 variable definitions this way.
13961
13962 @item -fno-ident
13963 @opindex fno-ident
13964 @opindex fident
13965 Ignore the @code{#ident} directive.
13966
13967 @item -finhibit-size-directive
13968 @opindex finhibit-size-directive
13969 Don't output a @code{.size} assembler directive, or anything else that
13970 would cause trouble if the function is split in the middle, and the
13971 two halves are placed at locations far apart in memory. This option is
13972 used when compiling @file{crtstuff.c}; you should not need to use it
13973 for anything else.
13974
13975 @item -fverbose-asm
13976 @opindex fverbose-asm
13977 Put extra commentary information in the generated assembly code to
13978 make it more readable. This option is generally only of use to those
13979 who actually need to read the generated assembly code (perhaps while
13980 debugging the compiler itself).
13981
13982 @option{-fno-verbose-asm}, the default, causes the
13983 extra information to be omitted and is useful when comparing two assembler
13984 files.
13985
13986 The added comments include:
13987
13988 @itemize @bullet
13989
13990 @item
13991 information on the compiler version and command-line options,
13992
13993 @item
13994 the source code lines associated with the assembly instructions,
13995 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13996
13997 @item
13998 hints on which high-level expressions correspond to
13999 the various assembly instruction operands.
14000
14001 @end itemize
14002
14003 For example, given this C source file:
14004
14005 @smallexample
14006 int test (int n)
14007 @{
14008 int i;
14009 int total = 0;
14010
14011 for (i = 0; i < n; i++)
14012 total += i * i;
14013
14014 return total;
14015 @}
14016 @end smallexample
14017
14018 compiling to (x86_64) assembly via @option{-S} and emitting the result
14019 direct to stdout via @option{-o} @option{-}
14020
14021 @smallexample
14022 gcc -S test.c -fverbose-asm -Os -o -
14023 @end smallexample
14024
14025 gives output similar to this:
14026
14027 @smallexample
14028 .file "test.c"
14029 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14030 [...snip...]
14031 # options passed:
14032 [...snip...]
14033
14034 .text
14035 .globl test
14036 .type test, @@function
14037 test:
14038 .LFB0:
14039 .cfi_startproc
14040 # test.c:4: int total = 0;
14041 xorl %eax, %eax # <retval>
14042 # test.c:6: for (i = 0; i < n; i++)
14043 xorl %edx, %edx # i
14044 .L2:
14045 # test.c:6: for (i = 0; i < n; i++)
14046 cmpl %edi, %edx # n, i
14047 jge .L5 #,
14048 # test.c:7: total += i * i;
14049 movl %edx, %ecx # i, tmp92
14050 imull %edx, %ecx # i, tmp92
14051 # test.c:6: for (i = 0; i < n; i++)
14052 incl %edx # i
14053 # test.c:7: total += i * i;
14054 addl %ecx, %eax # tmp92, <retval>
14055 jmp .L2 #
14056 .L5:
14057 # test.c:10: @}
14058 ret
14059 .cfi_endproc
14060 .LFE0:
14061 .size test, .-test
14062 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14063 .section .note.GNU-stack,"",@@progbits
14064 @end smallexample
14065
14066 The comments are intended for humans rather than machines and hence the
14067 precise format of the comments is subject to change.
14068
14069 @item -frecord-gcc-switches
14070 @opindex frecord-gcc-switches
14071 This switch causes the command line used to invoke the
14072 compiler to be recorded into the object file that is being created.
14073 This switch is only implemented on some targets and the exact format
14074 of the recording is target and binary file format dependent, but it
14075 usually takes the form of a section containing ASCII text. This
14076 switch is related to the @option{-fverbose-asm} switch, but that
14077 switch only records information in the assembler output file as
14078 comments, so it never reaches the object file.
14079 See also @option{-grecord-gcc-switches} for another
14080 way of storing compiler options into the object file.
14081
14082 @item -fpic
14083 @opindex fpic
14084 @cindex global offset table
14085 @cindex PIC
14086 Generate position-independent code (PIC) suitable for use in a shared
14087 library, if supported for the target machine. Such code accesses all
14088 constant addresses through a global offset table (GOT)@. The dynamic
14089 loader resolves the GOT entries when the program starts (the dynamic
14090 loader is not part of GCC; it is part of the operating system). If
14091 the GOT size for the linked executable exceeds a machine-specific
14092 maximum size, you get an error message from the linker indicating that
14093 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14094 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14095 on the m68k and RS/6000. The x86 has no such limit.)
14096
14097 Position-independent code requires special support, and therefore works
14098 only on certain machines. For the x86, GCC supports PIC for System V
14099 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14100 position-independent.
14101
14102 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14103 are defined to 1.
14104
14105 @item -fPIC
14106 @opindex fPIC
14107 If supported for the target machine, emit position-independent code,
14108 suitable for dynamic linking and avoiding any limit on the size of the
14109 global offset table. This option makes a difference on AArch64, m68k,
14110 PowerPC and SPARC@.
14111
14112 Position-independent code requires special support, and therefore works
14113 only on certain machines.
14114
14115 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14116 are defined to 2.
14117
14118 @item -fpie
14119 @itemx -fPIE
14120 @opindex fpie
14121 @opindex fPIE
14122 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14123 generated position-independent code can be only linked into executables.
14124 Usually these options are used to compile code that will be linked using
14125 the @option{-pie} GCC option.
14126
14127 @option{-fpie} and @option{-fPIE} both define the macros
14128 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14129 for @option{-fpie} and 2 for @option{-fPIE}.
14130
14131 @item -fno-plt
14132 @opindex fno-plt
14133 @opindex fplt
14134 Do not use the PLT for external function calls in position-independent code.
14135 Instead, load the callee address at call sites from the GOT and branch to it.
14136 This leads to more efficient code by eliminating PLT stubs and exposing
14137 GOT loads to optimizations. On architectures such as 32-bit x86 where
14138 PLT stubs expect the GOT pointer in a specific register, this gives more
14139 register allocation freedom to the compiler.
14140 Lazy binding requires use of the PLT;
14141 with @option{-fno-plt} all external symbols are resolved at load time.
14142
14143 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14144 through the PLT for specific external functions.
14145
14146 In position-dependent code, a few targets also convert calls to
14147 functions that are marked to not use the PLT to use the GOT instead.
14148
14149 @item -fno-jump-tables
14150 @opindex fno-jump-tables
14151 @opindex fjump-tables
14152 Do not use jump tables for switch statements even where it would be
14153 more efficient than other code generation strategies. This option is
14154 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14155 building code that forms part of a dynamic linker and cannot
14156 reference the address of a jump table. On some targets, jump tables
14157 do not require a GOT and this option is not needed.
14158
14159 @item -ffixed-@var{reg}
14160 @opindex ffixed
14161 Treat the register named @var{reg} as a fixed register; generated code
14162 should never refer to it (except perhaps as a stack pointer, frame
14163 pointer or in some other fixed role).
14164
14165 @var{reg} must be the name of a register. The register names accepted
14166 are machine-specific and are defined in the @code{REGISTER_NAMES}
14167 macro in the machine description macro file.
14168
14169 This flag does not have a negative form, because it specifies a
14170 three-way choice.
14171
14172 @item -fcall-used-@var{reg}
14173 @opindex fcall-used
14174 Treat the register named @var{reg} as an allocable register that is
14175 clobbered by function calls. It may be allocated for temporaries or
14176 variables that do not live across a call. Functions compiled this way
14177 do not save and restore the register @var{reg}.
14178
14179 It is an error to use this flag with the frame pointer or stack pointer.
14180 Use of this flag for other registers that have fixed pervasive roles in
14181 the machine's execution model produces disastrous results.
14182
14183 This flag does not have a negative form, because it specifies a
14184 three-way choice.
14185
14186 @item -fcall-saved-@var{reg}
14187 @opindex fcall-saved
14188 Treat the register named @var{reg} as an allocable register saved by
14189 functions. It may be allocated even for temporaries or variables that
14190 live across a call. Functions compiled this way save and restore
14191 the register @var{reg} if they use it.
14192
14193 It is an error to use this flag with the frame pointer or stack pointer.
14194 Use of this flag for other registers that have fixed pervasive roles in
14195 the machine's execution model produces disastrous results.
14196
14197 A different sort of disaster results from the use of this flag for
14198 a register in which function values may be returned.
14199
14200 This flag does not have a negative form, because it specifies a
14201 three-way choice.
14202
14203 @item -fpack-struct[=@var{n}]
14204 @opindex fpack-struct
14205 Without a value specified, pack all structure members together without
14206 holes. When a value is specified (which must be a small power of two), pack
14207 structure members according to this value, representing the maximum
14208 alignment (that is, objects with default alignment requirements larger than
14209 this are output potentially unaligned at the next fitting location.
14210
14211 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14212 code that is not binary compatible with code generated without that switch.
14213 Additionally, it makes the code suboptimal.
14214 Use it to conform to a non-default application binary interface.
14215
14216 @item -fleading-underscore
14217 @opindex fleading-underscore
14218 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14219 change the way C symbols are represented in the object file. One use
14220 is to help link with legacy assembly code.
14221
14222 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14223 generate code that is not binary compatible with code generated without that
14224 switch. Use it to conform to a non-default application binary interface.
14225 Not all targets provide complete support for this switch.
14226
14227 @item -ftls-model=@var{model}
14228 @opindex ftls-model
14229 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14230 The @var{model} argument should be one of @samp{global-dynamic},
14231 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14232 Note that the choice is subject to optimization: the compiler may use
14233 a more efficient model for symbols not visible outside of the translation
14234 unit, or if @option{-fpic} is not given on the command line.
14235
14236 The default without @option{-fpic} is @samp{initial-exec}; with
14237 @option{-fpic} the default is @samp{global-dynamic}.
14238
14239 @item -ftrampolines
14240 @opindex ftrampolines
14241 For targets that normally need trampolines for nested functions, always
14242 generate them instead of using descriptors. Otherwise, for targets that
14243 do not need them, like for example HP-PA or IA-64, do nothing.
14244
14245 A trampoline is a small piece of code that is created at run time on the
14246 stack when the address of a nested function is taken, and is used to call
14247 the nested function indirectly. Therefore, it requires the stack to be
14248 made executable in order for the program to work properly.
14249
14250 @option{-fno-trampolines} is enabled by default on a language by language
14251 basis to let the compiler avoid generating them, if it computes that this
14252 is safe, and replace them with descriptors. Descriptors are made up of data
14253 only, but the generated code must be prepared to deal with them. As of this
14254 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14255
14256 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14257 @option{-fno-trampolines} are not binary compatible if nested functions are
14258 present. This option must therefore be used on a program-wide basis and be
14259 manipulated with extreme care.
14260
14261 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14262 @opindex fvisibility
14263 Set the default ELF image symbol visibility to the specified option---all
14264 symbols are marked with this unless overridden within the code.
14265 Using this feature can very substantially improve linking and
14266 load times of shared object libraries, produce more optimized
14267 code, provide near-perfect API export and prevent symbol clashes.
14268 It is @strong{strongly} recommended that you use this in any shared objects
14269 you distribute.
14270
14271 Despite the nomenclature, @samp{default} always means public; i.e.,
14272 available to be linked against from outside the shared object.
14273 @samp{protected} and @samp{internal} are pretty useless in real-world
14274 usage so the only other commonly used option is @samp{hidden}.
14275 The default if @option{-fvisibility} isn't specified is
14276 @samp{default}, i.e., make every symbol public.
14277
14278 A good explanation of the benefits offered by ensuring ELF
14279 symbols have the correct visibility is given by ``How To Write
14280 Shared Libraries'' by Ulrich Drepper (which can be found at
14281 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14282 solution made possible by this option to marking things hidden when
14283 the default is public is to make the default hidden and mark things
14284 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14285 and @code{__attribute__ ((visibility("default")))} instead of
14286 @code{__declspec(dllexport)} you get almost identical semantics with
14287 identical syntax. This is a great boon to those working with
14288 cross-platform projects.
14289
14290 For those adding visibility support to existing code, you may find
14291 @code{#pragma GCC visibility} of use. This works by you enclosing
14292 the declarations you wish to set visibility for with (for example)
14293 @code{#pragma GCC visibility push(hidden)} and
14294 @code{#pragma GCC visibility pop}.
14295 Bear in mind that symbol visibility should be viewed @strong{as
14296 part of the API interface contract} and thus all new code should
14297 always specify visibility when it is not the default; i.e., declarations
14298 only for use within the local DSO should @strong{always} be marked explicitly
14299 as hidden as so to avoid PLT indirection overheads---making this
14300 abundantly clear also aids readability and self-documentation of the code.
14301 Note that due to ISO C++ specification requirements, @code{operator new} and
14302 @code{operator delete} must always be of default visibility.
14303
14304 Be aware that headers from outside your project, in particular system
14305 headers and headers from any other library you use, may not be
14306 expecting to be compiled with visibility other than the default. You
14307 may need to explicitly say @code{#pragma GCC visibility push(default)}
14308 before including any such headers.
14309
14310 @code{extern} declarations are not affected by @option{-fvisibility}, so
14311 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14312 no modifications. However, this means that calls to @code{extern}
14313 functions with no explicit visibility use the PLT, so it is more
14314 effective to use @code{__attribute ((visibility))} and/or
14315 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14316 declarations should be treated as hidden.
14317
14318 Note that @option{-fvisibility} does affect C++ vague linkage
14319 entities. This means that, for instance, an exception class that is
14320 be thrown between DSOs must be explicitly marked with default
14321 visibility so that the @samp{type_info} nodes are unified between
14322 the DSOs.
14323
14324 An overview of these techniques, their benefits and how to use them
14325 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14326
14327 @item -fstrict-volatile-bitfields
14328 @opindex fstrict-volatile-bitfields
14329 This option should be used if accesses to volatile bit-fields (or other
14330 structure fields, although the compiler usually honors those types
14331 anyway) should use a single access of the width of the
14332 field's type, aligned to a natural alignment if possible. For
14333 example, targets with memory-mapped peripheral registers might require
14334 all such accesses to be 16 bits wide; with this flag you can
14335 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14336 is 16 bits on these targets) to force GCC to use 16-bit accesses
14337 instead of, perhaps, a more efficient 32-bit access.
14338
14339 If this option is disabled, the compiler uses the most efficient
14340 instruction. In the previous example, that might be a 32-bit load
14341 instruction, even though that accesses bytes that do not contain
14342 any portion of the bit-field, or memory-mapped registers unrelated to
14343 the one being updated.
14344
14345 In some cases, such as when the @code{packed} attribute is applied to a
14346 structure field, it may not be possible to access the field with a single
14347 read or write that is correctly aligned for the target machine. In this
14348 case GCC falls back to generating multiple accesses rather than code that
14349 will fault or truncate the result at run time.
14350
14351 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14352 not allowed to touch non bit-field members. It is therefore recommended
14353 to define all bits of the field's type as bit-field members.
14354
14355 The default value of this option is determined by the application binary
14356 interface for the target processor.
14357
14358 @item -fsync-libcalls
14359 @opindex fsync-libcalls
14360 This option controls whether any out-of-line instance of the @code{__sync}
14361 family of functions may be used to implement the C++11 @code{__atomic}
14362 family of functions.
14363
14364 The default value of this option is enabled, thus the only useful form
14365 of the option is @option{-fno-sync-libcalls}. This option is used in
14366 the implementation of the @file{libatomic} runtime library.
14367
14368 @end table
14369
14370 @node Developer Options
14371 @section GCC Developer Options
14372 @cindex developer options
14373 @cindex debugging GCC
14374 @cindex debug dump options
14375 @cindex dump options
14376 @cindex compilation statistics
14377
14378 This section describes command-line options that are primarily of
14379 interest to GCC developers, including options to support compiler
14380 testing and investigation of compiler bugs and compile-time
14381 performance problems. This includes options that produce debug dumps
14382 at various points in the compilation; that print statistics such as
14383 memory use and execution time; and that print information about GCC's
14384 configuration, such as where it searches for libraries. You should
14385 rarely need to use any of these options for ordinary compilation and
14386 linking tasks.
14387
14388 Many developer options that cause GCC to dump output to a file take an
14389 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14390 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14391 error.
14392
14393 If @samp{=@var{filename}} is omitted, a default dump file name is
14394 constructed by concatenating the base dump file name, a pass number,
14395 phase letter, and pass name. The base dump file name is the name of
14396 output file produced by the compiler if explicitly specified and not
14397 an executable; otherwise it is the source file name.
14398 The pass number is determined by the order passes are registered with
14399 the compiler's pass manager.
14400 This is generally the same as the order of execution, but passes
14401 registered by plugins, target-specific passes, or passes that are
14402 otherwise registered late are numbered higher than the pass named
14403 @samp{final}, even if they are executed earlier. The phase letter is
14404 one of @samp{i} (inter-procedural analysis), @samp{l}
14405 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14406 The files are created in the directory of the output file.
14407
14408 @table @gcctabopt
14409
14410 @item -d@var{letters}
14411 @itemx -fdump-rtl-@var{pass}
14412 @itemx -fdump-rtl-@var{pass}=@var{filename}
14413 @opindex d
14414 @opindex fdump-rtl-@var{pass}
14415 Says to make debugging dumps during compilation at times specified by
14416 @var{letters}. This is used for debugging the RTL-based passes of the
14417 compiler.
14418
14419 Some @option{-d@var{letters}} switches have different meaning when
14420 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14421 for information about preprocessor-specific dump options.
14422
14423 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14424 @option{-d} option @var{letters}. Here are the possible
14425 letters for use in @var{pass} and @var{letters}, and their meanings:
14426
14427 @table @gcctabopt
14428
14429 @item -fdump-rtl-alignments
14430 @opindex fdump-rtl-alignments
14431 Dump after branch alignments have been computed.
14432
14433 @item -fdump-rtl-asmcons
14434 @opindex fdump-rtl-asmcons
14435 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14436
14437 @item -fdump-rtl-auto_inc_dec
14438 @opindex fdump-rtl-auto_inc_dec
14439 Dump after auto-inc-dec discovery. This pass is only run on
14440 architectures that have auto inc or auto dec instructions.
14441
14442 @item -fdump-rtl-barriers
14443 @opindex fdump-rtl-barriers
14444 Dump after cleaning up the barrier instructions.
14445
14446 @item -fdump-rtl-bbpart
14447 @opindex fdump-rtl-bbpart
14448 Dump after partitioning hot and cold basic blocks.
14449
14450 @item -fdump-rtl-bbro
14451 @opindex fdump-rtl-bbro
14452 Dump after block reordering.
14453
14454 @item -fdump-rtl-btl1
14455 @itemx -fdump-rtl-btl2
14456 @opindex fdump-rtl-btl2
14457 @opindex fdump-rtl-btl2
14458 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14459 after the two branch
14460 target load optimization passes.
14461
14462 @item -fdump-rtl-bypass
14463 @opindex fdump-rtl-bypass
14464 Dump after jump bypassing and control flow optimizations.
14465
14466 @item -fdump-rtl-combine
14467 @opindex fdump-rtl-combine
14468 Dump after the RTL instruction combination pass.
14469
14470 @item -fdump-rtl-compgotos
14471 @opindex fdump-rtl-compgotos
14472 Dump after duplicating the computed gotos.
14473
14474 @item -fdump-rtl-ce1
14475 @itemx -fdump-rtl-ce2
14476 @itemx -fdump-rtl-ce3
14477 @opindex fdump-rtl-ce1
14478 @opindex fdump-rtl-ce2
14479 @opindex fdump-rtl-ce3
14480 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14481 @option{-fdump-rtl-ce3} enable dumping after the three
14482 if conversion passes.
14483
14484 @item -fdump-rtl-cprop_hardreg
14485 @opindex fdump-rtl-cprop_hardreg
14486 Dump after hard register copy propagation.
14487
14488 @item -fdump-rtl-csa
14489 @opindex fdump-rtl-csa
14490 Dump after combining stack adjustments.
14491
14492 @item -fdump-rtl-cse1
14493 @itemx -fdump-rtl-cse2
14494 @opindex fdump-rtl-cse1
14495 @opindex fdump-rtl-cse2
14496 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14497 the two common subexpression elimination passes.
14498
14499 @item -fdump-rtl-dce
14500 @opindex fdump-rtl-dce
14501 Dump after the standalone dead code elimination passes.
14502
14503 @item -fdump-rtl-dbr
14504 @opindex fdump-rtl-dbr
14505 Dump after delayed branch scheduling.
14506
14507 @item -fdump-rtl-dce1
14508 @itemx -fdump-rtl-dce2
14509 @opindex fdump-rtl-dce1
14510 @opindex fdump-rtl-dce2
14511 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14512 the two dead store elimination passes.
14513
14514 @item -fdump-rtl-eh
14515 @opindex fdump-rtl-eh
14516 Dump after finalization of EH handling code.
14517
14518 @item -fdump-rtl-eh_ranges
14519 @opindex fdump-rtl-eh_ranges
14520 Dump after conversion of EH handling range regions.
14521
14522 @item -fdump-rtl-expand
14523 @opindex fdump-rtl-expand
14524 Dump after RTL generation.
14525
14526 @item -fdump-rtl-fwprop1
14527 @itemx -fdump-rtl-fwprop2
14528 @opindex fdump-rtl-fwprop1
14529 @opindex fdump-rtl-fwprop2
14530 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14531 dumping after the two forward propagation passes.
14532
14533 @item -fdump-rtl-gcse1
14534 @itemx -fdump-rtl-gcse2
14535 @opindex fdump-rtl-gcse1
14536 @opindex fdump-rtl-gcse2
14537 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14538 after global common subexpression elimination.
14539
14540 @item -fdump-rtl-init-regs
14541 @opindex fdump-rtl-init-regs
14542 Dump after the initialization of the registers.
14543
14544 @item -fdump-rtl-initvals
14545 @opindex fdump-rtl-initvals
14546 Dump after the computation of the initial value sets.
14547
14548 @item -fdump-rtl-into_cfglayout
14549 @opindex fdump-rtl-into_cfglayout
14550 Dump after converting to cfglayout mode.
14551
14552 @item -fdump-rtl-ira
14553 @opindex fdump-rtl-ira
14554 Dump after iterated register allocation.
14555
14556 @item -fdump-rtl-jump
14557 @opindex fdump-rtl-jump
14558 Dump after the second jump optimization.
14559
14560 @item -fdump-rtl-loop2
14561 @opindex fdump-rtl-loop2
14562 @option{-fdump-rtl-loop2} enables dumping after the rtl
14563 loop optimization passes.
14564
14565 @item -fdump-rtl-mach
14566 @opindex fdump-rtl-mach
14567 Dump after performing the machine dependent reorganization pass, if that
14568 pass exists.
14569
14570 @item -fdump-rtl-mode_sw
14571 @opindex fdump-rtl-mode_sw
14572 Dump after removing redundant mode switches.
14573
14574 @item -fdump-rtl-rnreg
14575 @opindex fdump-rtl-rnreg
14576 Dump after register renumbering.
14577
14578 @item -fdump-rtl-outof_cfglayout
14579 @opindex fdump-rtl-outof_cfglayout
14580 Dump after converting from cfglayout mode.
14581
14582 @item -fdump-rtl-peephole2
14583 @opindex fdump-rtl-peephole2
14584 Dump after the peephole pass.
14585
14586 @item -fdump-rtl-postreload
14587 @opindex fdump-rtl-postreload
14588 Dump after post-reload optimizations.
14589
14590 @item -fdump-rtl-pro_and_epilogue
14591 @opindex fdump-rtl-pro_and_epilogue
14592 Dump after generating the function prologues and epilogues.
14593
14594 @item -fdump-rtl-sched1
14595 @itemx -fdump-rtl-sched2
14596 @opindex fdump-rtl-sched1
14597 @opindex fdump-rtl-sched2
14598 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14599 after the basic block scheduling passes.
14600
14601 @item -fdump-rtl-ree
14602 @opindex fdump-rtl-ree
14603 Dump after sign/zero extension elimination.
14604
14605 @item -fdump-rtl-seqabstr
14606 @opindex fdump-rtl-seqabstr
14607 Dump after common sequence discovery.
14608
14609 @item -fdump-rtl-shorten
14610 @opindex fdump-rtl-shorten
14611 Dump after shortening branches.
14612
14613 @item -fdump-rtl-sibling
14614 @opindex fdump-rtl-sibling
14615 Dump after sibling call optimizations.
14616
14617 @item -fdump-rtl-split1
14618 @itemx -fdump-rtl-split2
14619 @itemx -fdump-rtl-split3
14620 @itemx -fdump-rtl-split4
14621 @itemx -fdump-rtl-split5
14622 @opindex fdump-rtl-split1
14623 @opindex fdump-rtl-split2
14624 @opindex fdump-rtl-split3
14625 @opindex fdump-rtl-split4
14626 @opindex fdump-rtl-split5
14627 These options enable dumping after five rounds of
14628 instruction splitting.
14629
14630 @item -fdump-rtl-sms
14631 @opindex fdump-rtl-sms
14632 Dump after modulo scheduling. This pass is only run on some
14633 architectures.
14634
14635 @item -fdump-rtl-stack
14636 @opindex fdump-rtl-stack
14637 Dump after conversion from GCC's ``flat register file'' registers to the
14638 x87's stack-like registers. This pass is only run on x86 variants.
14639
14640 @item -fdump-rtl-subreg1
14641 @itemx -fdump-rtl-subreg2
14642 @opindex fdump-rtl-subreg1
14643 @opindex fdump-rtl-subreg2
14644 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14645 the two subreg expansion passes.
14646
14647 @item -fdump-rtl-unshare
14648 @opindex fdump-rtl-unshare
14649 Dump after all rtl has been unshared.
14650
14651 @item -fdump-rtl-vartrack
14652 @opindex fdump-rtl-vartrack
14653 Dump after variable tracking.
14654
14655 @item -fdump-rtl-vregs
14656 @opindex fdump-rtl-vregs
14657 Dump after converting virtual registers to hard registers.
14658
14659 @item -fdump-rtl-web
14660 @opindex fdump-rtl-web
14661 Dump after live range splitting.
14662
14663 @item -fdump-rtl-regclass
14664 @itemx -fdump-rtl-subregs_of_mode_init
14665 @itemx -fdump-rtl-subregs_of_mode_finish
14666 @itemx -fdump-rtl-dfinit
14667 @itemx -fdump-rtl-dfinish
14668 @opindex fdump-rtl-regclass
14669 @opindex fdump-rtl-subregs_of_mode_init
14670 @opindex fdump-rtl-subregs_of_mode_finish
14671 @opindex fdump-rtl-dfinit
14672 @opindex fdump-rtl-dfinish
14673 These dumps are defined but always produce empty files.
14674
14675 @item -da
14676 @itemx -fdump-rtl-all
14677 @opindex da
14678 @opindex fdump-rtl-all
14679 Produce all the dumps listed above.
14680
14681 @item -dA
14682 @opindex dA
14683 Annotate the assembler output with miscellaneous debugging information.
14684
14685 @item -dD
14686 @opindex dD
14687 Dump all macro definitions, at the end of preprocessing, in addition to
14688 normal output.
14689
14690 @item -dH
14691 @opindex dH
14692 Produce a core dump whenever an error occurs.
14693
14694 @item -dp
14695 @opindex dp
14696 Annotate the assembler output with a comment indicating which
14697 pattern and alternative is used. The length and cost of each instruction are
14698 also printed.
14699
14700 @item -dP
14701 @opindex dP
14702 Dump the RTL in the assembler output as a comment before each instruction.
14703 Also turns on @option{-dp} annotation.
14704
14705 @item -dx
14706 @opindex dx
14707 Just generate RTL for a function instead of compiling it. Usually used
14708 with @option{-fdump-rtl-expand}.
14709 @end table
14710
14711 @item -fdump-debug
14712 @opindex fdump-debug
14713 Dump debugging information generated during the debug
14714 generation phase.
14715
14716 @item -fdump-earlydebug
14717 @opindex fdump-earlydebug
14718 Dump debugging information generated during the early debug
14719 generation phase.
14720
14721 @item -fdump-noaddr
14722 @opindex fdump-noaddr
14723 When doing debugging dumps, suppress address output. This makes it more
14724 feasible to use diff on debugging dumps for compiler invocations with
14725 different compiler binaries and/or different
14726 text / bss / data / heap / stack / dso start locations.
14727
14728 @item -freport-bug
14729 @opindex freport-bug
14730 Collect and dump debug information into a temporary file if an
14731 internal compiler error (ICE) occurs.
14732
14733 @item -fdump-unnumbered
14734 @opindex fdump-unnumbered
14735 When doing debugging dumps, suppress instruction numbers and address output.
14736 This makes it more feasible to use diff on debugging dumps for compiler
14737 invocations with different options, in particular with and without
14738 @option{-g}.
14739
14740 @item -fdump-unnumbered-links
14741 @opindex fdump-unnumbered-links
14742 When doing debugging dumps (see @option{-d} option above), suppress
14743 instruction numbers for the links to the previous and next instructions
14744 in a sequence.
14745
14746 @item -fdump-ipa-@var{switch}
14747 @itemx -fdump-ipa-@var{switch}-@var{options}
14748 @opindex fdump-ipa
14749 Control the dumping at various stages of inter-procedural analysis
14750 language tree to a file. The file name is generated by appending a
14751 switch specific suffix to the source file name, and the file is created
14752 in the same directory as the output file. The following dumps are
14753 possible:
14754
14755 @table @samp
14756 @item all
14757 Enables all inter-procedural analysis dumps.
14758
14759 @item cgraph
14760 Dumps information about call-graph optimization, unused function removal,
14761 and inlining decisions.
14762
14763 @item inline
14764 Dump after function inlining.
14765
14766 @end table
14767
14768 Additionally, the options @option{-optimized}, @option{-missed},
14769 @option{-note}, and @option{-all} can be provided, with the same meaning
14770 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14771
14772 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14773 information on callsites that were inlined, along with callsites
14774 that were not inlined.
14775
14776 By default, the dump will contain messages about successful
14777 optimizations (equivalent to @option{-optimized}) together with
14778 low-level details about the analysis.
14779
14780 @item -fdump-lang-all
14781 @itemx -fdump-lang-@var{switch}
14782 @itemx -fdump-lang-@var{switch}-@var{options}
14783 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14784 @opindex fdump-lang-all
14785 @opindex fdump-lang
14786 Control the dumping of language-specific information. The @var{options}
14787 and @var{filename} portions behave as described in the
14788 @option{-fdump-tree} option. The following @var{switch} values are
14789 accepted:
14790
14791 @table @samp
14792 @item all
14793
14794 Enable all language-specific dumps.
14795
14796 @item class
14797 Dump class hierarchy information. Virtual table information is emitted
14798 unless '@option{slim}' is specified. This option is applicable to C++ only.
14799
14800 @item raw
14801 Dump the raw internal tree data. This option is applicable to C++ only.
14802
14803 @end table
14804
14805 @item -fdump-passes
14806 @opindex fdump-passes
14807 Print on @file{stderr} the list of optimization passes that are turned
14808 on and off by the current command-line options.
14809
14810 @item -fdump-statistics-@var{option}
14811 @opindex fdump-statistics
14812 Enable and control dumping of pass statistics in a separate file. The
14813 file name is generated by appending a suffix ending in
14814 @samp{.statistics} to the source file name, and the file is created in
14815 the same directory as the output file. If the @samp{-@var{option}}
14816 form is used, @samp{-stats} causes counters to be summed over the
14817 whole compilation unit while @samp{-details} dumps every event as
14818 the passes generate them. The default with no option is to sum
14819 counters for each function compiled.
14820
14821 @item -fdump-tree-all
14822 @itemx -fdump-tree-@var{switch}
14823 @itemx -fdump-tree-@var{switch}-@var{options}
14824 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14825 @opindex fdump-tree-all
14826 @opindex fdump-tree
14827 Control the dumping at various stages of processing the intermediate
14828 language tree to a file. If the @samp{-@var{options}}
14829 form is used, @var{options} is a list of @samp{-} separated options
14830 which control the details of the dump. Not all options are applicable
14831 to all dumps; those that are not meaningful are ignored. The
14832 following options are available
14833
14834 @table @samp
14835 @item address
14836 Print the address of each node. Usually this is not meaningful as it
14837 changes according to the environment and source file. Its primary use
14838 is for tying up a dump file with a debug environment.
14839 @item asmname
14840 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14841 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14842 use working backward from mangled names in the assembly file.
14843 @item slim
14844 When dumping front-end intermediate representations, inhibit dumping
14845 of members of a scope or body of a function merely because that scope
14846 has been reached. Only dump such items when they are directly reachable
14847 by some other path.
14848
14849 When dumping pretty-printed trees, this option inhibits dumping the
14850 bodies of control structures.
14851
14852 When dumping RTL, print the RTL in slim (condensed) form instead of
14853 the default LISP-like representation.
14854 @item raw
14855 Print a raw representation of the tree. By default, trees are
14856 pretty-printed into a C-like representation.
14857 @item details
14858 Enable more detailed dumps (not honored by every dump option). Also
14859 include information from the optimization passes.
14860 @item stats
14861 Enable dumping various statistics about the pass (not honored by every dump
14862 option).
14863 @item blocks
14864 Enable showing basic block boundaries (disabled in raw dumps).
14865 @item graph
14866 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14867 dump a representation of the control flow graph suitable for viewing with
14868 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14869 the file is pretty-printed as a subgraph, so that GraphViz can render them
14870 all in a single plot.
14871
14872 This option currently only works for RTL dumps, and the RTL is always
14873 dumped in slim form.
14874 @item vops
14875 Enable showing virtual operands for every statement.
14876 @item lineno
14877 Enable showing line numbers for statements.
14878 @item uid
14879 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14880 @item verbose
14881 Enable showing the tree dump for each statement.
14882 @item eh
14883 Enable showing the EH region number holding each statement.
14884 @item scev
14885 Enable showing scalar evolution analysis details.
14886 @item optimized
14887 Enable showing optimization information (only available in certain
14888 passes).
14889 @item missed
14890 Enable showing missed optimization information (only available in certain
14891 passes).
14892 @item note
14893 Enable other detailed optimization information (only available in
14894 certain passes).
14895 @item all
14896 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14897 and @option{lineno}.
14898 @item optall
14899 Turn on all optimization options, i.e., @option{optimized},
14900 @option{missed}, and @option{note}.
14901 @end table
14902
14903 To determine what tree dumps are available or find the dump for a pass
14904 of interest follow the steps below.
14905
14906 @enumerate
14907 @item
14908 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14909 look for a code that corresponds to the pass you are interested in.
14910 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14911 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14912 The number at the end distinguishes distinct invocations of the same pass.
14913 @item
14914 To enable the creation of the dump file, append the pass code to
14915 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14916 to enable the dump from the Early Value Range Propagation pass, invoke
14917 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14918 specify the name of the dump file. If you don't specify one, GCC
14919 creates as described below.
14920 @item
14921 Find the pass dump in a file whose name is composed of three components
14922 separated by a period: the name of the source file GCC was invoked to
14923 compile, a numeric suffix indicating the pass number followed by the
14924 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14925 and finally the pass code. For example, the Early VRP pass dump might
14926 be in a file named @file{myfile.c.038t.evrp} in the current working
14927 directory. Note that the numeric codes are not stable and may change
14928 from one version of GCC to another.
14929 @end enumerate
14930
14931 @item -fopt-info
14932 @itemx -fopt-info-@var{options}
14933 @itemx -fopt-info-@var{options}=@var{filename}
14934 @opindex fopt-info
14935 Controls optimization dumps from various optimization passes. If the
14936 @samp{-@var{options}} form is used, @var{options} is a list of
14937 @samp{-} separated option keywords to select the dump details and
14938 optimizations.
14939
14940 The @var{options} can be divided into three groups:
14941 @enumerate
14942 @item
14943 options describing what kinds of messages should be emitted,
14944 @item
14945 options describing the verbosity of the dump, and
14946 @item
14947 options describing which optimizations should be included.
14948 @end enumerate
14949 The options from each group can be freely mixed as they are
14950 non-overlapping. However, in case of any conflicts,
14951 the later options override the earlier options on the command
14952 line.
14953
14954 The following options control which kinds of messages should be emitted:
14955
14956 @table @samp
14957 @item optimized
14958 Print information when an optimization is successfully applied. It is
14959 up to a pass to decide which information is relevant. For example, the
14960 vectorizer passes print the source location of loops which are
14961 successfully vectorized.
14962 @item missed
14963 Print information about missed optimizations. Individual passes
14964 control which information to include in the output.
14965 @item note
14966 Print verbose information about optimizations, such as certain
14967 transformations, more detailed messages about decisions etc.
14968 @item all
14969 Print detailed optimization information. This includes
14970 @samp{optimized}, @samp{missed}, and @samp{note}.
14971 @end table
14972
14973 The following option controls the dump verbosity:
14974
14975 @table @samp
14976 @item internals
14977 By default, only ``high-level'' messages are emitted. This option enables
14978 additional, more detailed, messages, which are likely to only be of interest
14979 to GCC developers.
14980 @end table
14981
14982 One or more of the following option keywords can be used to describe a
14983 group of optimizations:
14984
14985 @table @samp
14986 @item ipa
14987 Enable dumps from all interprocedural optimizations.
14988 @item loop
14989 Enable dumps from all loop optimizations.
14990 @item inline
14991 Enable dumps from all inlining optimizations.
14992 @item omp
14993 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14994 @item vec
14995 Enable dumps from all vectorization optimizations.
14996 @item optall
14997 Enable dumps from all optimizations. This is a superset of
14998 the optimization groups listed above.
14999 @end table
15000
15001 If @var{options} is
15002 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
15003 about successful optimizations from all the passes, omitting messages
15004 that are treated as ``internals''.
15005
15006 If the @var{filename} is provided, then the dumps from all the
15007 applicable optimizations are concatenated into the @var{filename}.
15008 Otherwise the dump is output onto @file{stderr}. Though multiple
15009 @option{-fopt-info} options are accepted, only one of them can include
15010 a @var{filename}. If other filenames are provided then all but the
15011 first such option are ignored.
15012
15013 Note that the output @var{filename} is overwritten
15014 in case of multiple translation units. If a combined output from
15015 multiple translation units is desired, @file{stderr} should be used
15016 instead.
15017
15018 In the following example, the optimization info is output to
15019 @file{stderr}:
15020
15021 @smallexample
15022 gcc -O3 -fopt-info
15023 @end smallexample
15024
15025 This example:
15026 @smallexample
15027 gcc -O3 -fopt-info-missed=missed.all
15028 @end smallexample
15029
15030 @noindent
15031 outputs missed optimization report from all the passes into
15032 @file{missed.all}, and this one:
15033
15034 @smallexample
15035 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15036 @end smallexample
15037
15038 @noindent
15039 prints information about missed optimization opportunities from
15040 vectorization passes on @file{stderr}.
15041 Note that @option{-fopt-info-vec-missed} is equivalent to
15042 @option{-fopt-info-missed-vec}. The order of the optimization group
15043 names and message types listed after @option{-fopt-info} does not matter.
15044
15045 As another example,
15046 @smallexample
15047 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15048 @end smallexample
15049
15050 @noindent
15051 outputs information about missed optimizations as well as
15052 optimized locations from all the inlining passes into
15053 @file{inline.txt}.
15054
15055 Finally, consider:
15056
15057 @smallexample
15058 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15059 @end smallexample
15060
15061 @noindent
15062 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15063 in conflict since only one output file is allowed. In this case, only
15064 the first option takes effect and the subsequent options are
15065 ignored. Thus only @file{vec.miss} is produced which contains
15066 dumps from the vectorizer about missed opportunities.
15067
15068 @item -fsave-optimization-record
15069 @opindex fsave-optimization-record
15070 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15071 were performed, for those optimizations that support @option{-fopt-info}.
15072
15073 This option is experimental and the format of the data within the
15074 compressed JSON file is subject to change.
15075
15076 It is roughly equivalent to a machine-readable version of
15077 @option{-fopt-info-all}, as a collection of messages with source file,
15078 line number and column number, with the following additional data for
15079 each message:
15080
15081 @itemize @bullet
15082
15083 @item
15084 the execution count of the code being optimized, along with metadata about
15085 whether this was from actual profile data, or just an estimate, allowing
15086 consumers to prioritize messages by code hotness,
15087
15088 @item
15089 the function name of the code being optimized, where applicable,
15090
15091 @item
15092 the ``inlining chain'' for the code being optimized, so that when
15093 a function is inlined into several different places (which might
15094 themselves be inlined), the reader can distinguish between the copies,
15095
15096 @item
15097 objects identifying those parts of the message that refer to expressions,
15098 statements or symbol-table nodes, which of these categories they are, and,
15099 when available, their source code location,
15100
15101 @item
15102 the GCC pass that emitted the message, and
15103
15104 @item
15105 the location in GCC's own code from which the message was emitted
15106
15107 @end itemize
15108
15109 Additionally, some messages are logically nested within other
15110 messages, reflecting implementation details of the optimization
15111 passes.
15112
15113 @item -fsched-verbose=@var{n}
15114 @opindex fsched-verbose
15115 On targets that use instruction scheduling, this option controls the
15116 amount of debugging output the scheduler prints to the dump files.
15117
15118 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15119 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15120 For @var{n} greater than one, it also output basic block probabilities,
15121 detailed ready list information and unit/insn info. For @var{n} greater
15122 than two, it includes RTL at abort point, control-flow and regions info.
15123 And for @var{n} over four, @option{-fsched-verbose} also includes
15124 dependence info.
15125
15126
15127
15128 @item -fenable-@var{kind}-@var{pass}
15129 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15130 @opindex fdisable-
15131 @opindex fenable-
15132
15133 This is a set of options that are used to explicitly disable/enable
15134 optimization passes. These options are intended for use for debugging GCC.
15135 Compiler users should use regular options for enabling/disabling
15136 passes instead.
15137
15138 @table @gcctabopt
15139
15140 @item -fdisable-ipa-@var{pass}
15141 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15142 statically invoked in the compiler multiple times, the pass name should be
15143 appended with a sequential number starting from 1.
15144
15145 @item -fdisable-rtl-@var{pass}
15146 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15147 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15148 statically invoked in the compiler multiple times, the pass name should be
15149 appended with a sequential number starting from 1. @var{range-list} is a
15150 comma-separated list of function ranges or assembler names. Each range is a number
15151 pair separated by a colon. The range is inclusive in both ends. If the range
15152 is trivial, the number pair can be simplified as a single number. If the
15153 function's call graph node's @var{uid} falls within one of the specified ranges,
15154 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15155 function header of a dump file, and the pass names can be dumped by using
15156 option @option{-fdump-passes}.
15157
15158 @item -fdisable-tree-@var{pass}
15159 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15160 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15161 option arguments.
15162
15163 @item -fenable-ipa-@var{pass}
15164 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15165 statically invoked in the compiler multiple times, the pass name should be
15166 appended with a sequential number starting from 1.
15167
15168 @item -fenable-rtl-@var{pass}
15169 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15170 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15171 description and examples.
15172
15173 @item -fenable-tree-@var{pass}
15174 @itemx -fenable-tree-@var{pass}=@var{range-list}
15175 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15176 of option arguments.
15177
15178 @end table
15179
15180 Here are some examples showing uses of these options.
15181
15182 @smallexample
15183
15184 # disable ccp1 for all functions
15185 -fdisable-tree-ccp1
15186 # disable complete unroll for function whose cgraph node uid is 1
15187 -fenable-tree-cunroll=1
15188 # disable gcse2 for functions at the following ranges [1,1],
15189 # [300,400], and [400,1000]
15190 # disable gcse2 for functions foo and foo2
15191 -fdisable-rtl-gcse2=foo,foo2
15192 # disable early inlining
15193 -fdisable-tree-einline
15194 # disable ipa inlining
15195 -fdisable-ipa-inline
15196 # enable tree full unroll
15197 -fenable-tree-unroll
15198
15199 @end smallexample
15200
15201 @item -fchecking
15202 @itemx -fchecking=@var{n}
15203 @opindex fchecking
15204 @opindex fno-checking
15205 Enable internal consistency checking. The default depends on
15206 the compiler configuration. @option{-fchecking=2} enables further
15207 internal consistency checking that might affect code generation.
15208
15209 @item -frandom-seed=@var{string}
15210 @opindex frandom-seed
15211 This option provides a seed that GCC uses in place of
15212 random numbers in generating certain symbol names
15213 that have to be different in every compiled file. It is also used to
15214 place unique stamps in coverage data files and the object files that
15215 produce them. You can use the @option{-frandom-seed} option to produce
15216 reproducibly identical object files.
15217
15218 The @var{string} can either be a number (decimal, octal or hex) or an
15219 arbitrary string (in which case it's converted to a number by
15220 computing CRC32).
15221
15222 The @var{string} should be different for every file you compile.
15223
15224 @item -save-temps
15225 @itemx -save-temps=cwd
15226 @opindex save-temps
15227 Store the usual ``temporary'' intermediate files permanently; place them
15228 in the current directory and name them based on the source file. Thus,
15229 compiling @file{foo.c} with @option{-c -save-temps} produces files
15230 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15231 preprocessed @file{foo.i} output file even though the compiler now
15232 normally uses an integrated preprocessor.
15233
15234 When used in combination with the @option{-x} command-line option,
15235 @option{-save-temps} is sensible enough to avoid over writing an
15236 input source file with the same extension as an intermediate file.
15237 The corresponding intermediate file may be obtained by renaming the
15238 source file before using @option{-save-temps}.
15239
15240 If you invoke GCC in parallel, compiling several different source
15241 files that share a common base name in different subdirectories or the
15242 same source file compiled for multiple output destinations, it is
15243 likely that the different parallel compilers will interfere with each
15244 other, and overwrite the temporary files. For instance:
15245
15246 @smallexample
15247 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15248 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15249 @end smallexample
15250
15251 may result in @file{foo.i} and @file{foo.o} being written to
15252 simultaneously by both compilers.
15253
15254 @item -save-temps=obj
15255 @opindex save-temps=obj
15256 Store the usual ``temporary'' intermediate files permanently. If the
15257 @option{-o} option is used, the temporary files are based on the
15258 object file. If the @option{-o} option is not used, the
15259 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15260
15261 For example:
15262
15263 @smallexample
15264 gcc -save-temps=obj -c foo.c
15265 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15266 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15267 @end smallexample
15268
15269 @noindent
15270 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15271 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15272 @file{dir2/yfoobar.o}.
15273
15274 @item -time@r{[}=@var{file}@r{]}
15275 @opindex time
15276 Report the CPU time taken by each subprocess in the compilation
15277 sequence. For C source files, this is the compiler proper and assembler
15278 (plus the linker if linking is done).
15279
15280 Without the specification of an output file, the output looks like this:
15281
15282 @smallexample
15283 # cc1 0.12 0.01
15284 # as 0.00 0.01
15285 @end smallexample
15286
15287 The first number on each line is the ``user time'', that is time spent
15288 executing the program itself. The second number is ``system time'',
15289 time spent executing operating system routines on behalf of the program.
15290 Both numbers are in seconds.
15291
15292 With the specification of an output file, the output is appended to the
15293 named file, and it looks like this:
15294
15295 @smallexample
15296 0.12 0.01 cc1 @var{options}
15297 0.00 0.01 as @var{options}
15298 @end smallexample
15299
15300 The ``user time'' and the ``system time'' are moved before the program
15301 name, and the options passed to the program are displayed, so that one
15302 can later tell what file was being compiled, and with which options.
15303
15304 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15305 @opindex fdump-final-insns
15306 Dump the final internal representation (RTL) to @var{file}. If the
15307 optional argument is omitted (or if @var{file} is @code{.}), the name
15308 of the dump file is determined by appending @code{.gkd} to the
15309 compilation output file name.
15310
15311 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15312 @opindex fcompare-debug
15313 @opindex fno-compare-debug
15314 If no error occurs during compilation, run the compiler a second time,
15315 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15316 passed to the second compilation. Dump the final internal
15317 representation in both compilations, and print an error if they differ.
15318
15319 If the equal sign is omitted, the default @option{-gtoggle} is used.
15320
15321 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15322 and nonzero, implicitly enables @option{-fcompare-debug}. If
15323 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15324 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15325 is used.
15326
15327 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15328 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15329 of the final representation and the second compilation, preventing even
15330 @env{GCC_COMPARE_DEBUG} from taking effect.
15331
15332 To verify full coverage during @option{-fcompare-debug} testing, set
15333 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15334 which GCC rejects as an invalid option in any actual compilation
15335 (rather than preprocessing, assembly or linking). To get just a
15336 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15337 not overridden} will do.
15338
15339 @item -fcompare-debug-second
15340 @opindex fcompare-debug-second
15341 This option is implicitly passed to the compiler for the second
15342 compilation requested by @option{-fcompare-debug}, along with options to
15343 silence warnings, and omitting other options that would cause the compiler
15344 to produce output to files or to standard output as a side effect. Dump
15345 files and preserved temporary files are renamed so as to contain the
15346 @code{.gk} additional extension during the second compilation, to avoid
15347 overwriting those generated by the first.
15348
15349 When this option is passed to the compiler driver, it causes the
15350 @emph{first} compilation to be skipped, which makes it useful for little
15351 other than debugging the compiler proper.
15352
15353 @item -gtoggle
15354 @opindex gtoggle
15355 Turn off generation of debug info, if leaving out this option
15356 generates it, or turn it on at level 2 otherwise. The position of this
15357 argument in the command line does not matter; it takes effect after all
15358 other options are processed, and it does so only once, no matter how
15359 many times it is given. This is mainly intended to be used with
15360 @option{-fcompare-debug}.
15361
15362 @item -fvar-tracking-assignments-toggle
15363 @opindex fvar-tracking-assignments-toggle
15364 @opindex fno-var-tracking-assignments-toggle
15365 Toggle @option{-fvar-tracking-assignments}, in the same way that
15366 @option{-gtoggle} toggles @option{-g}.
15367
15368 @item -Q
15369 @opindex Q
15370 Makes the compiler print out each function name as it is compiled, and
15371 print some statistics about each pass when it finishes.
15372
15373 @item -ftime-report
15374 @opindex ftime-report
15375 Makes the compiler print some statistics about the time consumed by each
15376 pass when it finishes.
15377
15378 @item -ftime-report-details
15379 @opindex ftime-report-details
15380 Record the time consumed by infrastructure parts separately for each pass.
15381
15382 @item -fira-verbose=@var{n}
15383 @opindex fira-verbose
15384 Control the verbosity of the dump file for the integrated register allocator.
15385 The default value is 5. If the value @var{n} is greater or equal to 10,
15386 the dump output is sent to stderr using the same format as @var{n} minus 10.
15387
15388 @item -flto-report
15389 @opindex flto-report
15390 Prints a report with internal details on the workings of the link-time
15391 optimizer. The contents of this report vary from version to version.
15392 It is meant to be useful to GCC developers when processing object
15393 files in LTO mode (via @option{-flto}).
15394
15395 Disabled by default.
15396
15397 @item -flto-report-wpa
15398 @opindex flto-report-wpa
15399 Like @option{-flto-report}, but only print for the WPA phase of link-time
15400 optimization.
15401
15402 @item -fmem-report
15403 @opindex fmem-report
15404 Makes the compiler print some statistics about permanent memory
15405 allocation when it finishes.
15406
15407 @item -fmem-report-wpa
15408 @opindex fmem-report-wpa
15409 Makes the compiler print some statistics about permanent memory
15410 allocation for the WPA phase only.
15411
15412 @item -fpre-ipa-mem-report
15413 @opindex fpre-ipa-mem-report
15414 @item -fpost-ipa-mem-report
15415 @opindex fpost-ipa-mem-report
15416 Makes the compiler print some statistics about permanent memory
15417 allocation before or after interprocedural optimization.
15418
15419 @item -fprofile-report
15420 @opindex fprofile-report
15421 Makes the compiler print some statistics about consistency of the
15422 (estimated) profile and effect of individual passes.
15423
15424 @item -fstack-usage
15425 @opindex fstack-usage
15426 Makes the compiler output stack usage information for the program, on a
15427 per-function basis. The filename for the dump is made by appending
15428 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15429 the output file, if explicitly specified and it is not an executable,
15430 otherwise it is the basename of the source file. An entry is made up
15431 of three fields:
15432
15433 @itemize
15434 @item
15435 The name of the function.
15436 @item
15437 A number of bytes.
15438 @item
15439 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15440 @end itemize
15441
15442 The qualifier @code{static} means that the function manipulates the stack
15443 statically: a fixed number of bytes are allocated for the frame on function
15444 entry and released on function exit; no stack adjustments are otherwise made
15445 in the function. The second field is this fixed number of bytes.
15446
15447 The qualifier @code{dynamic} means that the function manipulates the stack
15448 dynamically: in addition to the static allocation described above, stack
15449 adjustments are made in the body of the function, for example to push/pop
15450 arguments around function calls. If the qualifier @code{bounded} is also
15451 present, the amount of these adjustments is bounded at compile time and
15452 the second field is an upper bound of the total amount of stack used by
15453 the function. If it is not present, the amount of these adjustments is
15454 not bounded at compile time and the second field only represents the
15455 bounded part.
15456
15457 @item -fstats
15458 @opindex fstats
15459 Emit statistics about front-end processing at the end of the compilation.
15460 This option is supported only by the C++ front end, and
15461 the information is generally only useful to the G++ development team.
15462
15463 @item -fdbg-cnt-list
15464 @opindex fdbg-cnt-list
15465 Print the name and the counter upper bound for all debug counters.
15466
15467
15468 @item -fdbg-cnt=@var{counter-value-list}
15469 @opindex fdbg-cnt
15470 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15471 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15472 tuples which sets the lower and the upper bound of each debug
15473 counter @var{name}. The @var{lower_bound} is optional and is zero
15474 initialized if not set.
15475 All debug counters have the initial upper bound of @code{UINT_MAX};
15476 thus @code{dbg_cnt} returns true always unless the upper bound
15477 is set by this option.
15478 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15479 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15480 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15481
15482 @item -print-file-name=@var{library}
15483 @opindex print-file-name
15484 Print the full absolute name of the library file @var{library} that
15485 would be used when linking---and don't do anything else. With this
15486 option, GCC does not compile or link anything; it just prints the
15487 file name.
15488
15489 @item -print-multi-directory
15490 @opindex print-multi-directory
15491 Print the directory name corresponding to the multilib selected by any
15492 other switches present in the command line. This directory is supposed
15493 to exist in @env{GCC_EXEC_PREFIX}.
15494
15495 @item -print-multi-lib
15496 @opindex print-multi-lib
15497 Print the mapping from multilib directory names to compiler switches
15498 that enable them. The directory name is separated from the switches by
15499 @samp{;}, and each switch starts with an @samp{@@} instead of the
15500 @samp{-}, without spaces between multiple switches. This is supposed to
15501 ease shell processing.
15502
15503 @item -print-multi-os-directory
15504 @opindex print-multi-os-directory
15505 Print the path to OS libraries for the selected
15506 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15507 present in the @file{lib} subdirectory and no multilibs are used, this is
15508 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15509 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15510 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15511 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15512
15513 @item -print-multiarch
15514 @opindex print-multiarch
15515 Print the path to OS libraries for the selected multiarch,
15516 relative to some @file{lib} subdirectory.
15517
15518 @item -print-prog-name=@var{program}
15519 @opindex print-prog-name
15520 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15521
15522 @item -print-libgcc-file-name
15523 @opindex print-libgcc-file-name
15524 Same as @option{-print-file-name=libgcc.a}.
15525
15526 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15527 but you do want to link with @file{libgcc.a}. You can do:
15528
15529 @smallexample
15530 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15531 @end smallexample
15532
15533 @item -print-search-dirs
15534 @opindex print-search-dirs
15535 Print the name of the configured installation directory and a list of
15536 program and library directories @command{gcc} searches---and don't do anything else.
15537
15538 This is useful when @command{gcc} prints the error message
15539 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15540 To resolve this you either need to put @file{cpp0} and the other compiler
15541 components where @command{gcc} expects to find them, or you can set the environment
15542 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15543 Don't forget the trailing @samp{/}.
15544 @xref{Environment Variables}.
15545
15546 @item -print-sysroot
15547 @opindex print-sysroot
15548 Print the target sysroot directory that is used during
15549 compilation. This is the target sysroot specified either at configure
15550 time or using the @option{--sysroot} option, possibly with an extra
15551 suffix that depends on compilation options. If no target sysroot is
15552 specified, the option prints nothing.
15553
15554 @item -print-sysroot-headers-suffix
15555 @opindex print-sysroot-headers-suffix
15556 Print the suffix added to the target sysroot when searching for
15557 headers, or give an error if the compiler is not configured with such
15558 a suffix---and don't do anything else.
15559
15560 @item -dumpmachine
15561 @opindex dumpmachine
15562 Print the compiler's target machine (for example,
15563 @samp{i686-pc-linux-gnu})---and don't do anything else.
15564
15565 @item -dumpversion
15566 @opindex dumpversion
15567 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15568 anything else. This is the compiler version used in filesystem paths and
15569 specs. Depending on how the compiler has been configured it can be just
15570 a single number (major version), two numbers separated by a dot (major and
15571 minor version) or three numbers separated by dots (major, minor and patchlevel
15572 version).
15573
15574 @item -dumpfullversion
15575 @opindex dumpfullversion
15576 Print the full compiler version---and don't do anything else. The output is
15577 always three numbers separated by dots, major, minor and patchlevel version.
15578
15579 @item -dumpspecs
15580 @opindex dumpspecs
15581 Print the compiler's built-in specs---and don't do anything else. (This
15582 is used when GCC itself is being built.) @xref{Spec Files}.
15583 @end table
15584
15585 @node Submodel Options
15586 @section Machine-Dependent Options
15587 @cindex submodel options
15588 @cindex specifying hardware config
15589 @cindex hardware models and configurations, specifying
15590 @cindex target-dependent options
15591 @cindex machine-dependent options
15592
15593 Each target machine supported by GCC can have its own options---for
15594 example, to allow you to compile for a particular processor variant or
15595 ABI, or to control optimizations specific to that machine. By
15596 convention, the names of machine-specific options start with
15597 @samp{-m}.
15598
15599 Some configurations of the compiler also support additional target-specific
15600 options, usually for compatibility with other compilers on the same
15601 platform.
15602
15603 @c This list is ordered alphanumerically by subsection name.
15604 @c It should be the same order and spelling as these options are listed
15605 @c in Machine Dependent Options
15606
15607 @menu
15608 * AArch64 Options::
15609 * Adapteva Epiphany Options::
15610 * AMD GCN Options::
15611 * ARC Options::
15612 * ARM Options::
15613 * AVR Options::
15614 * Blackfin Options::
15615 * C6X Options::
15616 * CRIS Options::
15617 * CR16 Options::
15618 * C-SKY Options::
15619 * Darwin Options::
15620 * DEC Alpha Options::
15621 * FR30 Options::
15622 * FT32 Options::
15623 * FRV Options::
15624 * GNU/Linux Options::
15625 * H8/300 Options::
15626 * HPPA Options::
15627 * IA-64 Options::
15628 * LM32 Options::
15629 * M32C Options::
15630 * M32R/D Options::
15631 * M680x0 Options::
15632 * MCore Options::
15633 * MeP Options::
15634 * MicroBlaze Options::
15635 * MIPS Options::
15636 * MMIX Options::
15637 * MN10300 Options::
15638 * Moxie Options::
15639 * MSP430 Options::
15640 * NDS32 Options::
15641 * Nios II Options::
15642 * Nvidia PTX Options::
15643 * OpenRISC Options::
15644 * PDP-11 Options::
15645 * picoChip Options::
15646 * PowerPC Options::
15647 * PRU Options::
15648 * RISC-V Options::
15649 * RL78 Options::
15650 * RS/6000 and PowerPC Options::
15651 * RX Options::
15652 * S/390 and zSeries Options::
15653 * Score Options::
15654 * SH Options::
15655 * Solaris 2 Options::
15656 * SPARC Options::
15657 * SPU Options::
15658 * System V Options::
15659 * TILE-Gx Options::
15660 * TILEPro Options::
15661 * V850 Options::
15662 * VAX Options::
15663 * Visium Options::
15664 * VMS Options::
15665 * VxWorks Options::
15666 * x86 Options::
15667 * x86 Windows Options::
15668 * Xstormy16 Options::
15669 * Xtensa Options::
15670 * zSeries Options::
15671 @end menu
15672
15673 @node AArch64 Options
15674 @subsection AArch64 Options
15675 @cindex AArch64 Options
15676
15677 These options are defined for AArch64 implementations:
15678
15679 @table @gcctabopt
15680
15681 @item -mabi=@var{name}
15682 @opindex mabi
15683 Generate code for the specified data model. Permissible values
15684 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15685 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15686 but long int and pointers are 64 bits.
15687
15688 The default depends on the specific target configuration. Note that
15689 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15690 entire program with the same ABI, and link with a compatible set of libraries.
15691
15692 @item -mbig-endian
15693 @opindex mbig-endian
15694 Generate big-endian code. This is the default when GCC is configured for an
15695 @samp{aarch64_be-*-*} target.
15696
15697 @item -mgeneral-regs-only
15698 @opindex mgeneral-regs-only
15699 Generate code which uses only the general-purpose registers. This will prevent
15700 the compiler from using floating-point and Advanced SIMD registers but will not
15701 impose any restrictions on the assembler.
15702
15703 @item -mlittle-endian
15704 @opindex mlittle-endian
15705 Generate little-endian code. This is the default when GCC is configured for an
15706 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15707
15708 @item -mcmodel=tiny
15709 @opindex mcmodel=tiny
15710 Generate code for the tiny code model. The program and its statically defined
15711 symbols must be within 1MB of each other. Programs can be statically or
15712 dynamically linked.
15713
15714 @item -mcmodel=small
15715 @opindex mcmodel=small
15716 Generate code for the small code model. The program and its statically defined
15717 symbols must be within 4GB of each other. Programs can be statically or
15718 dynamically linked. This is the default code model.
15719
15720 @item -mcmodel=large
15721 @opindex mcmodel=large
15722 Generate code for the large code model. This makes no assumptions about
15723 addresses and sizes of sections. Programs can be statically linked only.
15724
15725 @item -mstrict-align
15726 @itemx -mno-strict-align
15727 @opindex mstrict-align
15728 @opindex mno-strict-align
15729 Avoid or allow generating memory accesses that may not be aligned on a natural
15730 object boundary as described in the architecture specification.
15731
15732 @item -momit-leaf-frame-pointer
15733 @itemx -mno-omit-leaf-frame-pointer
15734 @opindex momit-leaf-frame-pointer
15735 @opindex mno-omit-leaf-frame-pointer
15736 Omit or keep the frame pointer in leaf functions. The former behavior is the
15737 default.
15738
15739 @item -mstack-protector-guard=@var{guard}
15740 @itemx -mstack-protector-guard-reg=@var{reg}
15741 @itemx -mstack-protector-guard-offset=@var{offset}
15742 @opindex mstack-protector-guard
15743 @opindex mstack-protector-guard-reg
15744 @opindex mstack-protector-guard-offset
15745 Generate stack protection code using canary at @var{guard}. Supported
15746 locations are @samp{global} for a global canary or @samp{sysreg} for a
15747 canary in an appropriate system register.
15748
15749 With the latter choice the options
15750 @option{-mstack-protector-guard-reg=@var{reg}} and
15751 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15752 which system register to use as base register for reading the canary,
15753 and from what offset from that base register. There is no default
15754 register or offset as this is entirely for use within the Linux
15755 kernel.
15756
15757 @item -mstack-protector-guard=@var{guard}
15758 @itemx -mstack-protector-guard-reg=@var{reg}
15759 @itemx -mstack-protector-guard-offset=@var{offset}
15760 @opindex mstack-protector-guard
15761 @opindex mstack-protector-guard-reg
15762 @opindex mstack-protector-guard-offset
15763 Generate stack protection code using canary at @var{guard}. Supported
15764 locations are @samp{global} for a global canary or @samp{sysreg} for a
15765 canary in an appropriate system register.
15766
15767 With the latter choice the options
15768 @option{-mstack-protector-guard-reg=@var{reg}} and
15769 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15770 which system register to use as base register for reading the canary,
15771 and from what offset from that base register. There is no default
15772 register or offset as this is entirely for use within the Linux
15773 kernel.
15774
15775 @item -mtls-dialect=desc
15776 @opindex mtls-dialect=desc
15777 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15778 of TLS variables. This is the default.
15779
15780 @item -mtls-dialect=traditional
15781 @opindex mtls-dialect=traditional
15782 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15783 of TLS variables.
15784
15785 @item -mtls-size=@var{size}
15786 @opindex mtls-size
15787 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15788 This option requires binutils 2.26 or newer.
15789
15790 @item -mfix-cortex-a53-835769
15791 @itemx -mno-fix-cortex-a53-835769
15792 @opindex mfix-cortex-a53-835769
15793 @opindex mno-fix-cortex-a53-835769
15794 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15795 This involves inserting a NOP instruction between memory instructions and
15796 64-bit integer multiply-accumulate instructions.
15797
15798 @item -mfix-cortex-a53-843419
15799 @itemx -mno-fix-cortex-a53-843419
15800 @opindex mfix-cortex-a53-843419
15801 @opindex mno-fix-cortex-a53-843419
15802 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15803 This erratum workaround is made at link time and this will only pass the
15804 corresponding flag to the linker.
15805
15806 @item -mlow-precision-recip-sqrt
15807 @itemx -mno-low-precision-recip-sqrt
15808 @opindex mlow-precision-recip-sqrt
15809 @opindex mno-low-precision-recip-sqrt
15810 Enable or disable the reciprocal square root approximation.
15811 This option only has an effect if @option{-ffast-math} or
15812 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15813 precision of reciprocal square root results to about 16 bits for
15814 single precision and to 32 bits for double precision.
15815
15816 @item -mlow-precision-sqrt
15817 @itemx -mno-low-precision-sqrt
15818 @opindex mlow-precision-sqrt
15819 @opindex mno-low-precision-sqrt
15820 Enable or disable the square root approximation.
15821 This option only has an effect if @option{-ffast-math} or
15822 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15823 precision of square root results to about 16 bits for
15824 single precision and to 32 bits for double precision.
15825 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15826
15827 @item -mlow-precision-div
15828 @itemx -mno-low-precision-div
15829 @opindex mlow-precision-div
15830 @opindex mno-low-precision-div
15831 Enable or disable the division approximation.
15832 This option only has an effect if @option{-ffast-math} or
15833 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15834 precision of division results to about 16 bits for
15835 single precision and to 32 bits for double precision.
15836
15837 @item -mtrack-speculation
15838 @itemx -mno-track-speculation
15839 Enable or disable generation of additional code to track speculative
15840 execution through conditional branches. The tracking state can then
15841 be used by the compiler when expanding calls to
15842 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15843 sequence to be generated.
15844
15845 @item -march=@var{name}
15846 @opindex march
15847 Specify the name of the target architecture and, optionally, one or
15848 more feature modifiers. This option has the form
15849 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15850
15851 The permissible values for @var{arch} are @samp{armv8-a},
15852 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15853 @samp{armv8.5-a} or @var{native}.
15854
15855 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15856 support for the ARMv8.5-A architecture extensions.
15857
15858 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15859 support for the ARMv8.4-A architecture extensions.
15860
15861 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15862 support for the ARMv8.3-A architecture extensions.
15863
15864 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15865 support for the ARMv8.2-A architecture extensions.
15866
15867 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15868 support for the ARMv8.1-A architecture extension. In particular, it
15869 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15870
15871 The value @samp{native} is available on native AArch64 GNU/Linux and
15872 causes the compiler to pick the architecture of the host system. This
15873 option has no effect if the compiler is unable to recognize the
15874 architecture of the host system,
15875
15876 The permissible values for @var{feature} are listed in the sub-section
15877 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15878 Feature Modifiers}. Where conflicting feature modifiers are
15879 specified, the right-most feature is used.
15880
15881 GCC uses @var{name} to determine what kind of instructions it can emit
15882 when generating assembly code. If @option{-march} is specified
15883 without either of @option{-mtune} or @option{-mcpu} also being
15884 specified, the code is tuned to perform well across a range of target
15885 processors implementing the target architecture.
15886
15887 @item -mtune=@var{name}
15888 @opindex mtune
15889 Specify the name of the target processor for which GCC should tune the
15890 performance of the code. Permissible values for this option are:
15891 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15892 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15893 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15894 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
15895 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
15896 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
15897 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
15898 @samp{thunderxt83}, @samp{thunderx2t99},
15899 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15900 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15901 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15902 @samp{native}.
15903
15904 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15905 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15906 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15907 should tune for a big.LITTLE system.
15908
15909 Additionally on native AArch64 GNU/Linux systems the value
15910 @samp{native} tunes performance to the host system. This option has no effect
15911 if the compiler is unable to recognize the processor of the host system.
15912
15913 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15914 are specified, the code is tuned to perform well across a range
15915 of target processors.
15916
15917 This option cannot be suffixed by feature modifiers.
15918
15919 @item -mcpu=@var{name}
15920 @opindex mcpu
15921 Specify the name of the target processor, optionally suffixed by one
15922 or more feature modifiers. This option has the form
15923 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15924 the permissible values for @var{cpu} are the same as those available
15925 for @option{-mtune}. The permissible values for @var{feature} are
15926 documented in the sub-section on
15927 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15928 Feature Modifiers}. Where conflicting feature modifiers are
15929 specified, the right-most feature is used.
15930
15931 GCC uses @var{name} to determine what kind of instructions it can emit when
15932 generating assembly code (as if by @option{-march}) and to determine
15933 the target processor for which to tune for performance (as if
15934 by @option{-mtune}). Where this option is used in conjunction
15935 with @option{-march} or @option{-mtune}, those options take precedence
15936 over the appropriate part of this option.
15937
15938 @item -moverride=@var{string}
15939 @opindex moverride
15940 Override tuning decisions made by the back-end in response to a
15941 @option{-mtune=} switch. The syntax, semantics, and accepted values
15942 for @var{string} in this option are not guaranteed to be consistent
15943 across releases.
15944
15945 This option is only intended to be useful when developing GCC.
15946
15947 @item -mverbose-cost-dump
15948 @opindex mverbose-cost-dump
15949 Enable verbose cost model dumping in the debug dump files. This option is
15950 provided for use in debugging the compiler.
15951
15952 @item -mpc-relative-literal-loads
15953 @itemx -mno-pc-relative-literal-loads
15954 @opindex mpc-relative-literal-loads
15955 @opindex mno-pc-relative-literal-loads
15956 Enable or disable PC-relative literal loads. With this option literal pools are
15957 accessed using a single instruction and emitted after each function. This
15958 limits the maximum size of functions to 1MB. This is enabled by default for
15959 @option{-mcmodel=tiny}.
15960
15961 @item -msign-return-address=@var{scope}
15962 @opindex msign-return-address
15963 Select the function scope on which return address signing will be applied.
15964 Permissible values are @samp{none}, which disables return address signing,
15965 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15966 functions, and @samp{all}, which enables pointer signing for all functions. The
15967 default value is @samp{none}. This option has been deprecated by
15968 -mbranch-protection.
15969
15970 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
15971 @opindex mbranch-protection
15972 Select the branch protection features to use.
15973 @samp{none} is the default and turns off all types of branch protection.
15974 @samp{standard} turns on all types of branch protection features. If a feature
15975 has additional tuning options, then @samp{standard} sets it to its standard
15976 level.
15977 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
15978 level: signing functions that save the return address to memory (non-leaf
15979 functions will practically always do this) using the a-key. The optional
15980 argument @samp{leaf} can be used to extend the signing to include leaf
15981 functions. The optional argument @samp{b-key} can be used to sign the functions
15982 with the B-key instead of the A-key.
15983 @samp{bti} turns on branch target identification mechanism.
15984
15985 @item -msve-vector-bits=@var{bits}
15986 @opindex msve-vector-bits
15987 Specify the number of bits in an SVE vector register. This option only has
15988 an effect when SVE is enabled.
15989
15990 GCC supports two forms of SVE code generation: ``vector-length
15991 agnostic'' output that works with any size of vector register and
15992 ``vector-length specific'' output that allows GCC to make assumptions
15993 about the vector length when it is useful for optimization reasons.
15994 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
15995 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
15996 Specifying @samp{scalable} selects vector-length agnostic
15997 output. At present @samp{-msve-vector-bits=128} also generates vector-length
15998 agnostic output. All other values generate vector-length specific code.
15999 The behavior of these values may change in future releases and no value except
16000 @samp{scalable} should be relied on for producing code that is portable across
16001 different hardware SVE vector lengths.
16002
16003 The default is @samp{-msve-vector-bits=scalable}, which produces
16004 vector-length agnostic code.
16005 @end table
16006
16007 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16008 @anchor{aarch64-feature-modifiers}
16009 @cindex @option{-march} feature modifiers
16010 @cindex @option{-mcpu} feature modifiers
16011 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16012 the following and their inverses @option{no@var{feature}}:
16013
16014 @table @samp
16015 @item crc
16016 Enable CRC extension. This is on by default for
16017 @option{-march=armv8.1-a}.
16018 @item crypto
16019 Enable Crypto extension. This also enables Advanced SIMD and floating-point
16020 instructions.
16021 @item fp
16022 Enable floating-point instructions. This is on by default for all possible
16023 values for options @option{-march} and @option{-mcpu}.
16024 @item simd
16025 Enable Advanced SIMD instructions. This also enables floating-point
16026 instructions. This is on by default for all possible values for options
16027 @option{-march} and @option{-mcpu}.
16028 @item sve
16029 Enable Scalable Vector Extension instructions. This also enables Advanced
16030 SIMD and floating-point instructions.
16031 @item lse
16032 Enable Large System Extension instructions. This is on by default for
16033 @option{-march=armv8.1-a}.
16034 @item rdma
16035 Enable Round Double Multiply Accumulate instructions. This is on by default
16036 for @option{-march=armv8.1-a}.
16037 @item fp16
16038 Enable FP16 extension. This also enables floating-point instructions.
16039 @item fp16fml
16040 Enable FP16 fmla extension. This also enables FP16 extensions and
16041 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.
16042
16043 @item rcpc
16044 Enable the RcPc extension. This does not change code generation from GCC,
16045 but is passed on to the assembler, enabling inline asm statements to use
16046 instructions from the RcPc extension.
16047 @item dotprod
16048 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16049 @item aes
16050 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
16051 SIMD instructions.
16052 @item sha2
16053 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
16054 @item sha3
16055 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
16056 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16057 @item sm4
16058 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
16059 Use of this option with architectures prior to Armv8.2-A is not supported.
16060 @item profile
16061 Enable the Statistical Profiling extension. This option is only to enable the
16062 extension at the assembler level and does not affect code generation.
16063 @item rng
16064 Enable the Armv8.5-a Random Number instructions. This option is only to
16065 enable the extension at the assembler level and does not affect code
16066 generation.
16067 @item memtag
16068 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16069 enable the extension at the assembler level and does not affect code
16070 generation.
16071 @item sb
16072 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16073 enable the extension at the assembler level and does not affect code
16074 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16075 @item ssbs
16076 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16077 is only to enable the extension at the assembler level and does not affect code
16078 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16079 @item predres
16080 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16081 This option is only to enable the extension at the assembler level and does
16082 not affect code generation. This option is enabled by default for
16083 @item sve2
16084 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16085 instructions.
16086 @item sve2-bitperm
16087 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16088 @item sve2-sm4
16089 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16090 @item sve2-aes
16091 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16092 @item sve2-sha3
16093 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16094 @option{-march=armv8.5-a}.
16095
16096 @end table
16097
16098 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16099 which implies @option{fp}.
16100 Conversely, @option{nofp} implies @option{nosimd}, which implies
16101 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16102
16103 @node Adapteva Epiphany Options
16104 @subsection Adapteva Epiphany Options
16105
16106 These @samp{-m} options are defined for Adapteva Epiphany:
16107
16108 @table @gcctabopt
16109 @item -mhalf-reg-file
16110 @opindex mhalf-reg-file
16111 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16112 That allows code to run on hardware variants that lack these registers.
16113
16114 @item -mprefer-short-insn-regs
16115 @opindex mprefer-short-insn-regs
16116 Preferentially allocate registers that allow short instruction generation.
16117 This can result in increased instruction count, so this may either reduce or
16118 increase overall code size.
16119
16120 @item -mbranch-cost=@var{num}
16121 @opindex mbranch-cost
16122 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16123 This cost is only a heuristic and is not guaranteed to produce
16124 consistent results across releases.
16125
16126 @item -mcmove
16127 @opindex mcmove
16128 Enable the generation of conditional moves.
16129
16130 @item -mnops=@var{num}
16131 @opindex mnops
16132 Emit @var{num} NOPs before every other generated instruction.
16133
16134 @item -mno-soft-cmpsf
16135 @opindex mno-soft-cmpsf
16136 @opindex msoft-cmpsf
16137 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16138 and test the flags. This is faster than a software comparison, but can
16139 get incorrect results in the presence of NaNs, or when two different small
16140 numbers are compared such that their difference is calculated as zero.
16141 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16142 software comparisons.
16143
16144 @item -mstack-offset=@var{num}
16145 @opindex mstack-offset
16146 Set the offset between the top of the stack and the stack pointer.
16147 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16148 can be used by leaf functions without stack allocation.
16149 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16150 Note also that this option changes the ABI; compiling a program with a
16151 different stack offset than the libraries have been compiled with
16152 generally does not work.
16153 This option can be useful if you want to evaluate if a different stack
16154 offset would give you better code, but to actually use a different stack
16155 offset to build working programs, it is recommended to configure the
16156 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16157
16158 @item -mno-round-nearest
16159 @opindex mno-round-nearest
16160 @opindex mround-nearest
16161 Make the scheduler assume that the rounding mode has been set to
16162 truncating. The default is @option{-mround-nearest}.
16163
16164 @item -mlong-calls
16165 @opindex mlong-calls
16166 If not otherwise specified by an attribute, assume all calls might be beyond
16167 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16168 function address into a register before performing a (otherwise direct) call.
16169 This is the default.
16170
16171 @item -mshort-calls
16172 @opindex short-calls
16173 If not otherwise specified by an attribute, assume all direct calls are
16174 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16175 for direct calls. The default is @option{-mlong-calls}.
16176
16177 @item -msmall16
16178 @opindex msmall16
16179 Assume addresses can be loaded as 16-bit unsigned values. This does not
16180 apply to function addresses for which @option{-mlong-calls} semantics
16181 are in effect.
16182
16183 @item -mfp-mode=@var{mode}
16184 @opindex mfp-mode
16185 Set the prevailing mode of the floating-point unit.
16186 This determines the floating-point mode that is provided and expected
16187 at function call and return time. Making this mode match the mode you
16188 predominantly need at function start can make your programs smaller and
16189 faster by avoiding unnecessary mode switches.
16190
16191 @var{mode} can be set to one the following values:
16192
16193 @table @samp
16194 @item caller
16195 Any mode at function entry is valid, and retained or restored when
16196 the function returns, and when it calls other functions.
16197 This mode is useful for compiling libraries or other compilation units
16198 you might want to incorporate into different programs with different
16199 prevailing FPU modes, and the convenience of being able to use a single
16200 object file outweighs the size and speed overhead for any extra
16201 mode switching that might be needed, compared with what would be needed
16202 with a more specific choice of prevailing FPU mode.
16203
16204 @item truncate
16205 This is the mode used for floating-point calculations with
16206 truncating (i.e.@: round towards zero) rounding mode. That includes
16207 conversion from floating point to integer.
16208
16209 @item round-nearest
16210 This is the mode used for floating-point calculations with
16211 round-to-nearest-or-even rounding mode.
16212
16213 @item int
16214 This is the mode used to perform integer calculations in the FPU, e.g.@:
16215 integer multiply, or integer multiply-and-accumulate.
16216 @end table
16217
16218 The default is @option{-mfp-mode=caller}
16219
16220 @item -mno-split-lohi
16221 @itemx -mno-postinc
16222 @itemx -mno-postmodify
16223 @opindex mno-split-lohi
16224 @opindex msplit-lohi
16225 @opindex mno-postinc
16226 @opindex mpostinc
16227 @opindex mno-postmodify
16228 @opindex mpostmodify
16229 Code generation tweaks that disable, respectively, splitting of 32-bit
16230 loads, generation of post-increment addresses, and generation of
16231 post-modify addresses. The defaults are @option{msplit-lohi},
16232 @option{-mpost-inc}, and @option{-mpost-modify}.
16233
16234 @item -mnovect-double
16235 @opindex mno-vect-double
16236 @opindex mvect-double
16237 Change the preferred SIMD mode to SImode. The default is
16238 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16239
16240 @item -max-vect-align=@var{num}
16241 @opindex max-vect-align
16242 The maximum alignment for SIMD vector mode types.
16243 @var{num} may be 4 or 8. The default is 8.
16244 Note that this is an ABI change, even though many library function
16245 interfaces are unaffected if they don't use SIMD vector modes
16246 in places that affect size and/or alignment of relevant types.
16247
16248 @item -msplit-vecmove-early
16249 @opindex msplit-vecmove-early
16250 Split vector moves into single word moves before reload. In theory this
16251 can give better register allocation, but so far the reverse seems to be
16252 generally the case.
16253
16254 @item -m1reg-@var{reg}
16255 @opindex m1reg-
16256 Specify a register to hold the constant @minus{}1, which makes loading small negative
16257 constants and certain bitmasks faster.
16258 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16259 which specify use of that register as a fixed register,
16260 and @samp{none}, which means that no register is used for this
16261 purpose. The default is @option{-m1reg-none}.
16262
16263 @end table
16264
16265 @node AMD GCN Options
16266 @subsection AMD GCN Options
16267 @cindex AMD GCN Options
16268
16269 These options are defined specifically for the AMD GCN port.
16270
16271 @table @gcctabopt
16272
16273 @item -march=@var{gpu}
16274 @opindex march
16275 @itemx -mtune=@var{gpu}
16276 @opindex mtune
16277 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16278 are
16279
16280 @table @samp
16281 @opindex fiji
16282 @item fiji
16283 Compile for GCN3 Fiji devices (gfx803).
16284
16285 @item gfx900
16286 Compile for GCN5 Vega 10 devices (gfx900).
16287
16288 @item gfx906
16289 Compile for GCN5 Vega 20 devices (gfx906).
16290
16291 @end table
16292
16293 @item -mstack-size=@var{bytes}
16294 @opindex mstack-size
16295 Specify how many @var{bytes} of stack space will be requested for each GPU
16296 thread (wave-front). Beware that there may be many threads and limited memory
16297 available. The size of the stack allocation may also have an impact on
16298 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16299 1MB otherwise.
16300
16301 @end table
16302
16303 @node ARC Options
16304 @subsection ARC Options
16305 @cindex ARC options
16306
16307 The following options control the architecture variant for which code
16308 is being compiled:
16309
16310 @c architecture variants
16311 @table @gcctabopt
16312
16313 @item -mbarrel-shifter
16314 @opindex mbarrel-shifter
16315 Generate instructions supported by barrel shifter. This is the default
16316 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16317
16318 @item -mjli-always
16319 @opindex mjli-alawys
16320 Force to call a function using jli_s instruction. This option is
16321 valid only for ARCv2 architecture.
16322
16323 @item -mcpu=@var{cpu}
16324 @opindex mcpu
16325 Set architecture type, register usage, and instruction scheduling
16326 parameters for @var{cpu}. There are also shortcut alias options
16327 available for backward compatibility and convenience. Supported
16328 values for @var{cpu} are
16329
16330 @table @samp
16331 @opindex mA6
16332 @opindex mARC600
16333 @item arc600
16334 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16335
16336 @item arc601
16337 @opindex mARC601
16338 Compile for ARC601. Alias: @option{-mARC601}.
16339
16340 @item arc700
16341 @opindex mA7
16342 @opindex mARC700
16343 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16344 This is the default when configured with @option{--with-cpu=arc700}@.
16345
16346 @item arcem
16347 Compile for ARC EM.
16348
16349 @item archs
16350 Compile for ARC HS.
16351
16352 @item em
16353 Compile for ARC EM CPU with no hardware extensions.
16354
16355 @item em4
16356 Compile for ARC EM4 CPU.
16357
16358 @item em4_dmips
16359 Compile for ARC EM4 DMIPS CPU.
16360
16361 @item em4_fpus
16362 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16363 extension.
16364
16365 @item em4_fpuda
16366 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16367 double assist instructions.
16368
16369 @item hs
16370 Compile for ARC HS CPU with no hardware extensions except the atomic
16371 instructions.
16372
16373 @item hs34
16374 Compile for ARC HS34 CPU.
16375
16376 @item hs38
16377 Compile for ARC HS38 CPU.
16378
16379 @item hs38_linux
16380 Compile for ARC HS38 CPU with all hardware extensions on.
16381
16382 @item arc600_norm
16383 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16384
16385 @item arc600_mul32x16
16386 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16387 instructions enabled.
16388
16389 @item arc600_mul64
16390 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16391 instructions enabled.
16392
16393 @item arc601_norm
16394 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16395
16396 @item arc601_mul32x16
16397 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16398 instructions enabled.
16399
16400 @item arc601_mul64
16401 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16402 instructions enabled.
16403
16404 @item nps400
16405 Compile for ARC 700 on NPS400 chip.
16406
16407 @item em_mini
16408 Compile for ARC EM minimalist configuration featuring reduced register
16409 set.
16410
16411 @end table
16412
16413 @item -mdpfp
16414 @opindex mdpfp
16415 @itemx -mdpfp-compact
16416 @opindex mdpfp-compact
16417 Generate double-precision FPX instructions, tuned for the compact
16418 implementation.
16419
16420 @item -mdpfp-fast
16421 @opindex mdpfp-fast
16422 Generate double-precision FPX instructions, tuned for the fast
16423 implementation.
16424
16425 @item -mno-dpfp-lrsr
16426 @opindex mno-dpfp-lrsr
16427 Disable @code{lr} and @code{sr} instructions from using FPX extension
16428 aux registers.
16429
16430 @item -mea
16431 @opindex mea
16432 Generate extended arithmetic instructions. Currently only
16433 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16434 supported. This is always enabled for @option{-mcpu=ARC700}.
16435
16436 @item -mno-mpy
16437 @opindex mno-mpy
16438 @opindex mmpy
16439 Do not generate @code{mpy}-family instructions for ARC700. This option is
16440 deprecated.
16441
16442 @item -mmul32x16
16443 @opindex mmul32x16
16444 Generate 32x16-bit multiply and multiply-accumulate instructions.
16445
16446 @item -mmul64
16447 @opindex mmul64
16448 Generate @code{mul64} and @code{mulu64} instructions.
16449 Only valid for @option{-mcpu=ARC600}.
16450
16451 @item -mnorm
16452 @opindex mnorm
16453 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16454 is in effect.
16455
16456 @item -mspfp
16457 @opindex mspfp
16458 @itemx -mspfp-compact
16459 @opindex mspfp-compact
16460 Generate single-precision FPX instructions, tuned for the compact
16461 implementation.
16462
16463 @item -mspfp-fast
16464 @opindex mspfp-fast
16465 Generate single-precision FPX instructions, tuned for the fast
16466 implementation.
16467
16468 @item -msimd
16469 @opindex msimd
16470 Enable generation of ARC SIMD instructions via target-specific
16471 builtins. Only valid for @option{-mcpu=ARC700}.
16472
16473 @item -msoft-float
16474 @opindex msoft-float
16475 This option ignored; it is provided for compatibility purposes only.
16476 Software floating-point code is emitted by default, and this default
16477 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16478 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16479 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16480
16481 @item -mswap
16482 @opindex mswap
16483 Generate @code{swap} instructions.
16484
16485 @item -matomic
16486 @opindex matomic
16487 This enables use of the locked load/store conditional extension to implement
16488 atomic memory built-in functions. Not available for ARC 6xx or ARC
16489 EM cores.
16490
16491 @item -mdiv-rem
16492 @opindex mdiv-rem
16493 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16494
16495 @item -mcode-density
16496 @opindex mcode-density
16497 Enable code density instructions for ARC EM.
16498 This option is on by default for ARC HS.
16499
16500 @item -mll64
16501 @opindex mll64
16502 Enable double load/store operations for ARC HS cores.
16503
16504 @item -mtp-regno=@var{regno}
16505 @opindex mtp-regno
16506 Specify thread pointer register number.
16507
16508 @item -mmpy-option=@var{multo}
16509 @opindex mmpy-option
16510 Compile ARCv2 code with a multiplier design option. You can specify
16511 the option using either a string or numeric value for @var{multo}.
16512 @samp{wlh1} is the default value. The recognized values are:
16513
16514 @table @samp
16515 @item 0
16516 @itemx none
16517 No multiplier available.
16518
16519 @item 1
16520 @itemx w
16521 16x16 multiplier, fully pipelined.
16522 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16523
16524 @item 2
16525 @itemx wlh1
16526 32x32 multiplier, fully
16527 pipelined (1 stage). The following instructions are additionally
16528 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16529
16530 @item 3
16531 @itemx wlh2
16532 32x32 multiplier, fully pipelined
16533 (2 stages). The following instructions are additionally enabled: @code{mpy},
16534 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16535
16536 @item 4
16537 @itemx wlh3
16538 Two 16x16 multipliers, blocking,
16539 sequential. The following instructions are additionally enabled: @code{mpy},
16540 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16541
16542 @item 5
16543 @itemx wlh4
16544 One 16x16 multiplier, blocking,
16545 sequential. The following instructions are additionally enabled: @code{mpy},
16546 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16547
16548 @item 6
16549 @itemx wlh5
16550 One 32x4 multiplier, blocking,
16551 sequential. The following instructions are additionally enabled: @code{mpy},
16552 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16553
16554 @item 7
16555 @itemx plus_dmpy
16556 ARC HS SIMD support.
16557
16558 @item 8
16559 @itemx plus_macd
16560 ARC HS SIMD support.
16561
16562 @item 9
16563 @itemx plus_qmacw
16564 ARC HS SIMD support.
16565
16566 @end table
16567
16568 This option is only available for ARCv2 cores@.
16569
16570 @item -mfpu=@var{fpu}
16571 @opindex mfpu
16572 Enables support for specific floating-point hardware extensions for ARCv2
16573 cores. Supported values for @var{fpu} are:
16574
16575 @table @samp
16576
16577 @item fpus
16578 Enables support for single-precision floating-point hardware
16579 extensions@.
16580
16581 @item fpud
16582 Enables support for double-precision floating-point hardware
16583 extensions. The single-precision floating-point extension is also
16584 enabled. Not available for ARC EM@.
16585
16586 @item fpuda
16587 Enables support for double-precision floating-point hardware
16588 extensions using double-precision assist instructions. The single-precision
16589 floating-point extension is also enabled. This option is
16590 only available for ARC EM@.
16591
16592 @item fpuda_div
16593 Enables support for double-precision floating-point hardware
16594 extensions using double-precision assist instructions.
16595 The single-precision floating-point, square-root, and divide
16596 extensions are also enabled. This option is
16597 only available for ARC EM@.
16598
16599 @item fpuda_fma
16600 Enables support for double-precision floating-point hardware
16601 extensions using double-precision assist instructions.
16602 The single-precision floating-point and fused multiply and add
16603 hardware extensions are also enabled. This option is
16604 only available for ARC EM@.
16605
16606 @item fpuda_all
16607 Enables support for double-precision floating-point hardware
16608 extensions using double-precision assist instructions.
16609 All single-precision floating-point hardware extensions are also
16610 enabled. This option is only available for ARC EM@.
16611
16612 @item fpus_div
16613 Enables support for single-precision floating-point, square-root and divide
16614 hardware extensions@.
16615
16616 @item fpud_div
16617 Enables support for double-precision floating-point, square-root and divide
16618 hardware extensions. This option
16619 includes option @samp{fpus_div}. Not available for ARC EM@.
16620
16621 @item fpus_fma
16622 Enables support for single-precision floating-point and
16623 fused multiply and add hardware extensions@.
16624
16625 @item fpud_fma
16626 Enables support for double-precision floating-point and
16627 fused multiply and add hardware extensions. This option
16628 includes option @samp{fpus_fma}. Not available for ARC EM@.
16629
16630 @item fpus_all
16631 Enables support for all single-precision floating-point hardware
16632 extensions@.
16633
16634 @item fpud_all
16635 Enables support for all single- and double-precision floating-point
16636 hardware extensions. Not available for ARC EM@.
16637
16638 @end table
16639
16640 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16641 @opindex mirq-ctrl-saved
16642 Specifies general-purposes registers that the processor automatically
16643 saves/restores on interrupt entry and exit. @var{register-range} is
16644 specified as two registers separated by a dash. The register range
16645 always starts with @code{r0}, the upper limit is @code{fp} register.
16646 @var{blink} and @var{lp_count} are optional. This option is only
16647 valid for ARC EM and ARC HS cores.
16648
16649 @item -mrgf-banked-regs=@var{number}
16650 @opindex mrgf-banked-regs
16651 Specifies the number of registers replicated in second register bank
16652 on entry to fast interrupt. Fast interrupts are interrupts with the
16653 highest priority level P0. These interrupts save only PC and STATUS32
16654 registers to avoid memory transactions during interrupt entry and exit
16655 sequences. Use this option when you are using fast interrupts in an
16656 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16657
16658 @item -mlpc-width=@var{width}
16659 @opindex mlpc-width
16660 Specify the width of the @code{lp_count} register. Valid values for
16661 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16662 fixed to 32 bits. If the width is less than 32, the compiler does not
16663 attempt to transform loops in your program to use the zero-delay loop
16664 mechanism unless it is known that the @code{lp_count} register can
16665 hold the required loop-counter value. Depending on the width
16666 specified, the compiler and run-time library might continue to use the
16667 loop mechanism for various needs. This option defines macro
16668 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16669
16670 @item -mrf16
16671 @opindex mrf16
16672 This option instructs the compiler to generate code for a 16-entry
16673 register file. This option defines the @code{__ARC_RF16__}
16674 preprocessor macro.
16675
16676 @item -mbranch-index
16677 @opindex mbranch-index
16678 Enable use of @code{bi} or @code{bih} instructions to implement jump
16679 tables.
16680
16681 @end table
16682
16683 The following options are passed through to the assembler, and also
16684 define preprocessor macro symbols.
16685
16686 @c Flags used by the assembler, but for which we define preprocessor
16687 @c macro symbols as well.
16688 @table @gcctabopt
16689 @item -mdsp-packa
16690 @opindex mdsp-packa
16691 Passed down to the assembler to enable the DSP Pack A extensions.
16692 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16693 deprecated.
16694
16695 @item -mdvbf
16696 @opindex mdvbf
16697 Passed down to the assembler to enable the dual Viterbi butterfly
16698 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16699 option is deprecated.
16700
16701 @c ARC700 4.10 extension instruction
16702 @item -mlock
16703 @opindex mlock
16704 Passed down to the assembler to enable the locked load/store
16705 conditional extension. Also sets the preprocessor symbol
16706 @code{__Xlock}.
16707
16708 @item -mmac-d16
16709 @opindex mmac-d16
16710 Passed down to the assembler. Also sets the preprocessor symbol
16711 @code{__Xxmac_d16}. This option is deprecated.
16712
16713 @item -mmac-24
16714 @opindex mmac-24
16715 Passed down to the assembler. Also sets the preprocessor symbol
16716 @code{__Xxmac_24}. This option is deprecated.
16717
16718 @c ARC700 4.10 extension instruction
16719 @item -mrtsc
16720 @opindex mrtsc
16721 Passed down to the assembler to enable the 64-bit time-stamp counter
16722 extension instruction. Also sets the preprocessor symbol
16723 @code{__Xrtsc}. This option is deprecated.
16724
16725 @c ARC700 4.10 extension instruction
16726 @item -mswape
16727 @opindex mswape
16728 Passed down to the assembler to enable the swap byte ordering
16729 extension instruction. Also sets the preprocessor symbol
16730 @code{__Xswape}.
16731
16732 @item -mtelephony
16733 @opindex mtelephony
16734 Passed down to the assembler to enable dual- and single-operand
16735 instructions for telephony. Also sets the preprocessor symbol
16736 @code{__Xtelephony}. This option is deprecated.
16737
16738 @item -mxy
16739 @opindex mxy
16740 Passed down to the assembler to enable the XY memory extension. Also
16741 sets the preprocessor symbol @code{__Xxy}.
16742
16743 @end table
16744
16745 The following options control how the assembly code is annotated:
16746
16747 @c Assembly annotation options
16748 @table @gcctabopt
16749 @item -misize
16750 @opindex misize
16751 Annotate assembler instructions with estimated addresses.
16752
16753 @item -mannotate-align
16754 @opindex mannotate-align
16755 Explain what alignment considerations lead to the decision to make an
16756 instruction short or long.
16757
16758 @end table
16759
16760 The following options are passed through to the linker:
16761
16762 @c options passed through to the linker
16763 @table @gcctabopt
16764 @item -marclinux
16765 @opindex marclinux
16766 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16767 This option is enabled by default in tool chains built for
16768 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16769 when profiling is not requested.
16770
16771 @item -marclinux_prof
16772 @opindex marclinux_prof
16773 Passed through to the linker, to specify use of the
16774 @code{arclinux_prof} emulation. This option is enabled by default in
16775 tool chains built for @w{@code{arc-linux-uclibc}} and
16776 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16777
16778 @end table
16779
16780 The following options control the semantics of generated code:
16781
16782 @c semantically relevant code generation options
16783 @table @gcctabopt
16784 @item -mlong-calls
16785 @opindex mlong-calls
16786 Generate calls as register indirect calls, thus providing access
16787 to the full 32-bit address range.
16788
16789 @item -mmedium-calls
16790 @opindex mmedium-calls
16791 Don't use less than 25-bit addressing range for calls, which is the
16792 offset available for an unconditional branch-and-link
16793 instruction. Conditional execution of function calls is suppressed, to
16794 allow use of the 25-bit range, rather than the 21-bit range with
16795 conditional branch-and-link. This is the default for tool chains built
16796 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16797
16798 @item -G @var{num}
16799 @opindex G
16800 Put definitions of externally-visible data in a small data section if
16801 that data is no bigger than @var{num} bytes. The default value of
16802 @var{num} is 4 for any ARC configuration, or 8 when we have double
16803 load/store operations.
16804
16805 @item -mno-sdata
16806 @opindex mno-sdata
16807 @opindex msdata
16808 Do not generate sdata references. This is the default for tool chains
16809 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16810 targets.
16811
16812 @item -mvolatile-cache
16813 @opindex mvolatile-cache
16814 Use ordinarily cached memory accesses for volatile references. This is the
16815 default.
16816
16817 @item -mno-volatile-cache
16818 @opindex mno-volatile-cache
16819 @opindex mvolatile-cache
16820 Enable cache bypass for volatile references.
16821
16822 @end table
16823
16824 The following options fine tune code generation:
16825 @c code generation tuning options
16826 @table @gcctabopt
16827 @item -malign-call
16828 @opindex malign-call
16829 Do alignment optimizations for call instructions.
16830
16831 @item -mauto-modify-reg
16832 @opindex mauto-modify-reg
16833 Enable the use of pre/post modify with register displacement.
16834
16835 @item -mbbit-peephole
16836 @opindex mbbit-peephole
16837 Enable bbit peephole2.
16838
16839 @item -mno-brcc
16840 @opindex mno-brcc
16841 This option disables a target-specific pass in @file{arc_reorg} to
16842 generate compare-and-branch (@code{br@var{cc}}) instructions.
16843 It has no effect on
16844 generation of these instructions driven by the combiner pass.
16845
16846 @item -mcase-vector-pcrel
16847 @opindex mcase-vector-pcrel
16848 Use PC-relative switch case tables to enable case table shortening.
16849 This is the default for @option{-Os}.
16850
16851 @item -mcompact-casesi
16852 @opindex mcompact-casesi
16853 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16854 and only available for ARCv1 cores. This option is deprecated.
16855
16856 @item -mno-cond-exec
16857 @opindex mno-cond-exec
16858 Disable the ARCompact-specific pass to generate conditional
16859 execution instructions.
16860
16861 Due to delay slot scheduling and interactions between operand numbers,
16862 literal sizes, instruction lengths, and the support for conditional execution,
16863 the target-independent pass to generate conditional execution is often lacking,
16864 so the ARC port has kept a special pass around that tries to find more
16865 conditional execution generation opportunities after register allocation,
16866 branch shortening, and delay slot scheduling have been done. This pass
16867 generally, but not always, improves performance and code size, at the cost of
16868 extra compilation time, which is why there is an option to switch it off.
16869 If you have a problem with call instructions exceeding their allowable
16870 offset range because they are conditionalized, you should consider using
16871 @option{-mmedium-calls} instead.
16872
16873 @item -mearly-cbranchsi
16874 @opindex mearly-cbranchsi
16875 Enable pre-reload use of the @code{cbranchsi} pattern.
16876
16877 @item -mexpand-adddi
16878 @opindex mexpand-adddi
16879 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16880 @code{add.f}, @code{adc} etc. This option is deprecated.
16881
16882 @item -mindexed-loads
16883 @opindex mindexed-loads
16884 Enable the use of indexed loads. This can be problematic because some
16885 optimizers then assume that indexed stores exist, which is not
16886 the case.
16887
16888 @item -mlra
16889 @opindex mlra
16890 Enable Local Register Allocation. This is still experimental for ARC,
16891 so by default the compiler uses standard reload
16892 (i.e.@: @option{-mno-lra}).
16893
16894 @item -mlra-priority-none
16895 @opindex mlra-priority-none
16896 Don't indicate any priority for target registers.
16897
16898 @item -mlra-priority-compact
16899 @opindex mlra-priority-compact
16900 Indicate target register priority for r0..r3 / r12..r15.
16901
16902 @item -mlra-priority-noncompact
16903 @opindex mlra-priority-noncompact
16904 Reduce target register priority for r0..r3 / r12..r15.
16905
16906 @item -mmillicode
16907 @opindex mmillicode
16908 When optimizing for size (using @option{-Os}), prologues and epilogues
16909 that have to save or restore a large number of registers are often
16910 shortened by using call to a special function in libgcc; this is
16911 referred to as a @emph{millicode} call. As these calls can pose
16912 performance issues, and/or cause linking issues when linking in a
16913 nonstandard way, this option is provided to turn on or off millicode
16914 call generation.
16915
16916 @item -mcode-density-frame
16917 @opindex mcode-density-frame
16918 This option enable the compiler to emit @code{enter} and @code{leave}
16919 instructions. These instructions are only valid for CPUs with
16920 code-density feature.
16921
16922 @item -mmixed-code
16923 @opindex mmixed-code
16924 Tweak register allocation to help 16-bit instruction generation.
16925 This generally has the effect of decreasing the average instruction size
16926 while increasing the instruction count.
16927
16928 @item -mq-class
16929 @opindex mq-class
16930 Enable @samp{q} instruction alternatives.
16931 This is the default for @option{-Os}.
16932
16933 @item -mRcq
16934 @opindex mRcq
16935 Enable @samp{Rcq} constraint handling.
16936 Most short code generation depends on this.
16937 This is the default.
16938
16939 @item -mRcw
16940 @opindex mRcw
16941 Enable @samp{Rcw} constraint handling.
16942 Most ccfsm condexec mostly depends on this.
16943 This is the default.
16944
16945 @item -msize-level=@var{level}
16946 @opindex msize-level
16947 Fine-tune size optimization with regards to instruction lengths and alignment.
16948 The recognized values for @var{level} are:
16949 @table @samp
16950 @item 0
16951 No size optimization. This level is deprecated and treated like @samp{1}.
16952
16953 @item 1
16954 Short instructions are used opportunistically.
16955
16956 @item 2
16957 In addition, alignment of loops and of code after barriers are dropped.
16958
16959 @item 3
16960 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16961
16962 @end table
16963
16964 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16965 the behavior when this is not set is equivalent to level @samp{1}.
16966
16967 @item -mtune=@var{cpu}
16968 @opindex mtune
16969 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16970 by @option{-mcpu=}.
16971
16972 Supported values for @var{cpu} are
16973
16974 @table @samp
16975 @item ARC600
16976 Tune for ARC600 CPU.
16977
16978 @item ARC601
16979 Tune for ARC601 CPU.
16980
16981 @item ARC700
16982 Tune for ARC700 CPU with standard multiplier block.
16983
16984 @item ARC700-xmac
16985 Tune for ARC700 CPU with XMAC block.
16986
16987 @item ARC725D
16988 Tune for ARC725D CPU.
16989
16990 @item ARC750D
16991 Tune for ARC750D CPU.
16992
16993 @end table
16994
16995 @item -mmultcost=@var{num}
16996 @opindex mmultcost
16997 Cost to assume for a multiply instruction, with @samp{4} being equal to a
16998 normal instruction.
16999
17000 @item -munalign-prob-threshold=@var{probability}
17001 @opindex munalign-prob-threshold
17002 Set probability threshold for unaligning branches.
17003 When tuning for @samp{ARC700} and optimizing for speed, branches without
17004 filled delay slot are preferably emitted unaligned and long, unless
17005 profiling indicates that the probability for the branch to be taken
17006 is below @var{probability}. @xref{Cross-profiling}.
17007 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
17008
17009 @end table
17010
17011 The following options are maintained for backward compatibility, but
17012 are now deprecated and will be removed in a future release:
17013
17014 @c Deprecated options
17015 @table @gcctabopt
17016
17017 @item -margonaut
17018 @opindex margonaut
17019 Obsolete FPX.
17020
17021 @item -mbig-endian
17022 @opindex mbig-endian
17023 @itemx -EB
17024 @opindex EB
17025 Compile code for big-endian targets. Use of these options is now
17026 deprecated. Big-endian code is supported by configuring GCC to build
17027 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17028 for which big endian is the default.
17029
17030 @item -mlittle-endian
17031 @opindex mlittle-endian
17032 @itemx -EL
17033 @opindex EL
17034 Compile code for little-endian targets. Use of these options is now
17035 deprecated. Little-endian code is supported by configuring GCC to build
17036 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17037 for which little endian is the default.
17038
17039 @item -mbarrel_shifter
17040 @opindex mbarrel_shifter
17041 Replaced by @option{-mbarrel-shifter}.
17042
17043 @item -mdpfp_compact
17044 @opindex mdpfp_compact
17045 Replaced by @option{-mdpfp-compact}.
17046
17047 @item -mdpfp_fast
17048 @opindex mdpfp_fast
17049 Replaced by @option{-mdpfp-fast}.
17050
17051 @item -mdsp_packa
17052 @opindex mdsp_packa
17053 Replaced by @option{-mdsp-packa}.
17054
17055 @item -mEA
17056 @opindex mEA
17057 Replaced by @option{-mea}.
17058
17059 @item -mmac_24
17060 @opindex mmac_24
17061 Replaced by @option{-mmac-24}.
17062
17063 @item -mmac_d16
17064 @opindex mmac_d16
17065 Replaced by @option{-mmac-d16}.
17066
17067 @item -mspfp_compact
17068 @opindex mspfp_compact
17069 Replaced by @option{-mspfp-compact}.
17070
17071 @item -mspfp_fast
17072 @opindex mspfp_fast
17073 Replaced by @option{-mspfp-fast}.
17074
17075 @item -mtune=@var{cpu}
17076 @opindex mtune
17077 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17078 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17079 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17080
17081 @item -multcost=@var{num}
17082 @opindex multcost
17083 Replaced by @option{-mmultcost}.
17084
17085 @end table
17086
17087 @node ARM Options
17088 @subsection ARM Options
17089 @cindex ARM options
17090
17091 These @samp{-m} options are defined for the ARM port:
17092
17093 @table @gcctabopt
17094 @item -mabi=@var{name}
17095 @opindex mabi
17096 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17097 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17098
17099 @item -mapcs-frame
17100 @opindex mapcs-frame
17101 Generate a stack frame that is compliant with the ARM Procedure Call
17102 Standard for all functions, even if this is not strictly necessary for
17103 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17104 with this option causes the stack frames not to be generated for
17105 leaf functions. The default is @option{-mno-apcs-frame}.
17106 This option is deprecated.
17107
17108 @item -mapcs
17109 @opindex mapcs
17110 This is a synonym for @option{-mapcs-frame} and is deprecated.
17111
17112 @ignore
17113 @c not currently implemented
17114 @item -mapcs-stack-check
17115 @opindex mapcs-stack-check
17116 Generate code to check the amount of stack space available upon entry to
17117 every function (that actually uses some stack space). If there is
17118 insufficient space available then either the function
17119 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17120 called, depending upon the amount of stack space required. The runtime
17121 system is required to provide these functions. The default is
17122 @option{-mno-apcs-stack-check}, since this produces smaller code.
17123
17124 @c not currently implemented
17125 @item -mapcs-reentrant
17126 @opindex mapcs-reentrant
17127 Generate reentrant, position-independent code. The default is
17128 @option{-mno-apcs-reentrant}.
17129 @end ignore
17130
17131 @item -mthumb-interwork
17132 @opindex mthumb-interwork
17133 Generate code that supports calling between the ARM and Thumb
17134 instruction sets. Without this option, on pre-v5 architectures, the
17135 two instruction sets cannot be reliably used inside one program. The
17136 default is @option{-mno-thumb-interwork}, since slightly larger code
17137 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17138 configurations this option is meaningless.
17139
17140 @item -mno-sched-prolog
17141 @opindex mno-sched-prolog
17142 @opindex msched-prolog
17143 Prevent the reordering of instructions in the function prologue, or the
17144 merging of those instruction with the instructions in the function's
17145 body. This means that all functions start with a recognizable set
17146 of instructions (or in fact one of a choice from a small set of
17147 different function prologues), and this information can be used to
17148 locate the start of functions inside an executable piece of code. The
17149 default is @option{-msched-prolog}.
17150
17151 @item -mfloat-abi=@var{name}
17152 @opindex mfloat-abi
17153 Specifies which floating-point ABI to use. Permissible values
17154 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17155
17156 Specifying @samp{soft} causes GCC to generate output containing
17157 library calls for floating-point operations.
17158 @samp{softfp} allows the generation of code using hardware floating-point
17159 instructions, but still uses the soft-float calling conventions.
17160 @samp{hard} allows generation of floating-point instructions
17161 and uses FPU-specific calling conventions.
17162
17163 The default depends on the specific target configuration. Note that
17164 the hard-float and soft-float ABIs are not link-compatible; you must
17165 compile your entire program with the same ABI, and link with a
17166 compatible set of libraries.
17167
17168 @item -mgeneral-regs-only
17169 @opindex mgeneral-regs-only
17170 Generate code which uses only the general-purpose registers. This will prevent
17171 the compiler from using floating-point and Advanced SIMD registers but will not
17172 impose any restrictions on the assembler.
17173
17174 @item -mlittle-endian
17175 @opindex mlittle-endian
17176 Generate code for a processor running in little-endian mode. This is
17177 the default for all standard configurations.
17178
17179 @item -mbig-endian
17180 @opindex mbig-endian
17181 Generate code for a processor running in big-endian mode; the default is
17182 to compile code for a little-endian processor.
17183
17184 @item -mbe8
17185 @itemx -mbe32
17186 @opindex mbe8
17187 When linking a big-endian image select between BE8 and BE32 formats.
17188 The option has no effect for little-endian images and is ignored. The
17189 default is dependent on the selected target architecture. For ARMv6
17190 and later architectures the default is BE8, for older architectures
17191 the default is BE32. BE32 format has been deprecated by ARM.
17192
17193 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17194 @opindex march
17195 This specifies the name of the target ARM architecture. GCC uses this
17196 name to determine what kind of instructions it can emit when generating
17197 assembly code. This option can be used in conjunction with or instead
17198 of the @option{-mcpu=} option.
17199
17200 Permissible names are:
17201 @samp{armv4t},
17202 @samp{armv5t}, @samp{armv5te},
17203 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17204 @samp{armv6z}, @samp{armv6zk},
17205 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17206 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17207 @samp{armv8.4-a},
17208 @samp{armv8.5-a},
17209 @samp{armv7-r},
17210 @samp{armv8-r},
17211 @samp{armv6-m}, @samp{armv6s-m},
17212 @samp{armv7-m}, @samp{armv7e-m},
17213 @samp{armv8-m.base}, @samp{armv8-m.main},
17214 @samp{iwmmxt} and @samp{iwmmxt2}.
17215
17216 Additionally, the following architectures, which lack support for the
17217 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17218
17219 Many of the architectures support extensions. These can be added by
17220 appending @samp{+@var{extension}} to the architecture name. Extension
17221 options are processed in order and capabilities accumulate. An extension
17222 will also enable any necessary base extensions
17223 upon which it depends. For example, the @samp{+crypto} extension
17224 will always enable the @samp{+simd} extension. The exception to the
17225 additive construction is for extensions that are prefixed with
17226 @samp{+no@dots{}}: these extensions disable the specified option and
17227 any other extensions that may depend on the presence of that
17228 extension.
17229
17230 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17231 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17232 entirely disabled by the @samp{+nofp} option that follows it.
17233
17234 Most extension names are generically named, but have an effect that is
17235 dependent upon the architecture to which it is applied. For example,
17236 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17237 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17238 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17239 variant for @samp{armv8-a}.
17240
17241 The table below lists the supported extensions for each architecture.
17242 Architectures not mentioned do not support any extensions.
17243
17244 @table @samp
17245 @item armv5te
17246 @itemx armv6
17247 @itemx armv6j
17248 @itemx armv6k
17249 @itemx armv6kz
17250 @itemx armv6t2
17251 @itemx armv6z
17252 @itemx armv6zk
17253 @table @samp
17254 @item +fp
17255 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17256 used as an alias for this extension.
17257
17258 @item +nofp
17259 Disable the floating-point instructions.
17260 @end table
17261
17262 @item armv7
17263 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17264 @table @samp
17265 @item +fp
17266 The VFPv3 floating-point instructions, with 16 double-precision
17267 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17268 for this extension. Note that floating-point is not supported by the
17269 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17270 ARMv7-R architectures.
17271
17272 @item +nofp
17273 Disable the floating-point instructions.
17274 @end table
17275
17276 @item armv7-a
17277 @table @samp
17278 @item +mp
17279 The multiprocessing extension.
17280
17281 @item +sec
17282 The security extension.
17283
17284 @item +fp
17285 The VFPv3 floating-point instructions, with 16 double-precision
17286 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17287 for this extension.
17288
17289 @item +simd
17290 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17291 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17292 for this extension.
17293
17294 @item +vfpv3
17295 The VFPv3 floating-point instructions, with 32 double-precision
17296 registers.
17297
17298 @item +vfpv3-d16-fp16
17299 The VFPv3 floating-point instructions, with 16 double-precision
17300 registers and the half-precision floating-point conversion operations.
17301
17302 @item +vfpv3-fp16
17303 The VFPv3 floating-point instructions, with 32 double-precision
17304 registers and the half-precision floating-point conversion operations.
17305
17306 @item +vfpv4-d16
17307 The VFPv4 floating-point instructions, with 16 double-precision
17308 registers.
17309
17310 @item +vfpv4
17311 The VFPv4 floating-point instructions, with 32 double-precision
17312 registers.
17313
17314 @item +neon-fp16
17315 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17316 the half-precision floating-point conversion operations.
17317
17318 @item +neon-vfpv4
17319 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17320
17321 @item +nosimd
17322 Disable the Advanced SIMD instructions (does not disable floating point).
17323
17324 @item +nofp
17325 Disable the floating-point and Advanced SIMD instructions.
17326 @end table
17327
17328 @item armv7ve
17329 The extended version of the ARMv7-A architecture with support for
17330 virtualization.
17331 @table @samp
17332 @item +fp
17333 The VFPv4 floating-point instructions, with 16 double-precision registers.
17334 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17335
17336 @item +simd
17337 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17338 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17339
17340 @item +vfpv3-d16
17341 The VFPv3 floating-point instructions, with 16 double-precision
17342 registers.
17343
17344 @item +vfpv3
17345 The VFPv3 floating-point instructions, with 32 double-precision
17346 registers.
17347
17348 @item +vfpv3-d16-fp16
17349 The VFPv3 floating-point instructions, with 16 double-precision
17350 registers and the half-precision floating-point conversion operations.
17351
17352 @item +vfpv3-fp16
17353 The VFPv3 floating-point instructions, with 32 double-precision
17354 registers and the half-precision floating-point conversion operations.
17355
17356 @item +vfpv4-d16
17357 The VFPv4 floating-point instructions, with 16 double-precision
17358 registers.
17359
17360 @item +vfpv4
17361 The VFPv4 floating-point instructions, with 32 double-precision
17362 registers.
17363
17364 @item +neon
17365 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17366 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17367
17368 @item +neon-fp16
17369 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17370 the half-precision floating-point conversion operations.
17371
17372 @item +nosimd
17373 Disable the Advanced SIMD instructions (does not disable floating point).
17374
17375 @item +nofp
17376 Disable the floating-point and Advanced SIMD instructions.
17377 @end table
17378
17379 @item armv8-a
17380 @table @samp
17381 @item +crc
17382 The Cyclic Redundancy Check (CRC) instructions.
17383 @item +simd
17384 The ARMv8-A Advanced SIMD and floating-point instructions.
17385 @item +crypto
17386 The cryptographic instructions.
17387 @item +nocrypto
17388 Disable the cryptographic instructions.
17389 @item +nofp
17390 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17391 @item +sb
17392 Speculation Barrier Instruction.
17393 @item +predres
17394 Execution and Data Prediction Restriction Instructions.
17395 @end table
17396
17397 @item armv8.1-a
17398 @table @samp
17399 @item +simd
17400 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17401
17402 @item +crypto
17403 The cryptographic instructions. This also enables the Advanced SIMD and
17404 floating-point instructions.
17405
17406 @item +nocrypto
17407 Disable the cryptographic instructions.
17408
17409 @item +nofp
17410 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17411
17412 @item +sb
17413 Speculation Barrier Instruction.
17414
17415 @item +predres
17416 Execution and Data Prediction Restriction Instructions.
17417 @end table
17418
17419 @item armv8.2-a
17420 @itemx armv8.3-a
17421 @table @samp
17422 @item +fp16
17423 The half-precision floating-point data processing instructions.
17424 This also enables the Advanced SIMD and floating-point instructions.
17425
17426 @item +fp16fml
17427 The half-precision floating-point fmla extension. This also enables
17428 the half-precision floating-point extension and Advanced SIMD and
17429 floating-point instructions.
17430
17431 @item +simd
17432 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17433
17434 @item +crypto
17435 The cryptographic instructions. This also enables the Advanced SIMD and
17436 floating-point instructions.
17437
17438 @item +dotprod
17439 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17440
17441 @item +nocrypto
17442 Disable the cryptographic extension.
17443
17444 @item +nofp
17445 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17446
17447 @item +sb
17448 Speculation Barrier Instruction.
17449
17450 @item +predres
17451 Execution and Data Prediction Restriction Instructions.
17452 @end table
17453
17454 @item armv8.4-a
17455 @table @samp
17456 @item +fp16
17457 The half-precision floating-point data processing instructions.
17458 This also enables the Advanced SIMD and floating-point instructions as well
17459 as the Dot Product extension and the half-precision floating-point fmla
17460 extension.
17461
17462 @item +simd
17463 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17464 Dot Product extension.
17465
17466 @item +crypto
17467 The cryptographic instructions. This also enables the Advanced SIMD and
17468 floating-point instructions as well as the Dot Product extension.
17469
17470 @item +nocrypto
17471 Disable the cryptographic extension.
17472
17473 @item +nofp
17474 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17475
17476 @item +sb
17477 Speculation Barrier Instruction.
17478
17479 @item +predres
17480 Execution and Data Prediction Restriction Instructions.
17481 @end table
17482
17483 @item armv8.5-a
17484 @table @samp
17485 @item +fp16
17486 The half-precision floating-point data processing instructions.
17487 This also enables the Advanced SIMD and floating-point instructions as well
17488 as the Dot Product extension and the half-precision floating-point fmla
17489 extension.
17490
17491 @item +simd
17492 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17493 Dot Product extension.
17494
17495 @item +crypto
17496 The cryptographic instructions. This also enables the Advanced SIMD and
17497 floating-point instructions as well as the Dot Product extension.
17498
17499 @item +nocrypto
17500 Disable the cryptographic extension.
17501
17502 @item +nofp
17503 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17504 @end table
17505
17506 @item armv7-r
17507 @table @samp
17508 @item +fp.sp
17509 The single-precision VFPv3 floating-point instructions. The extension
17510 @samp{+vfpv3xd} can be used as an alias for this extension.
17511
17512 @item +fp
17513 The VFPv3 floating-point instructions with 16 double-precision registers.
17514 The extension +vfpv3-d16 can be used as an alias for this extension.
17515
17516 @item +vfpv3xd-d16-fp16
17517 The single-precision VFPv3 floating-point instructions with 16 double-precision
17518 registers and the half-precision floating-point conversion operations.
17519
17520 @item +vfpv3-d16-fp16
17521 The VFPv3 floating-point instructions with 16 double-precision
17522 registers and the half-precision floating-point conversion operations.
17523
17524 @item +nofp
17525 Disable the floating-point extension.
17526
17527 @item +idiv
17528 The ARM-state integer division instructions.
17529
17530 @item +noidiv
17531 Disable the ARM-state integer division extension.
17532 @end table
17533
17534 @item armv7e-m
17535 @table @samp
17536 @item +fp
17537 The single-precision VFPv4 floating-point instructions.
17538
17539 @item +fpv5
17540 The single-precision FPv5 floating-point instructions.
17541
17542 @item +fp.dp
17543 The single- and double-precision FPv5 floating-point instructions.
17544
17545 @item +nofp
17546 Disable the floating-point extensions.
17547 @end table
17548
17549 @item armv8-m.main
17550 @table @samp
17551 @item +dsp
17552 The DSP instructions.
17553
17554 @item +nodsp
17555 Disable the DSP extension.
17556
17557 @item +fp
17558 The single-precision floating-point instructions.
17559
17560 @item +fp.dp
17561 The single- and double-precision floating-point instructions.
17562
17563 @item +nofp
17564 Disable the floating-point extension.
17565 @end table
17566
17567 @item armv8-r
17568 @table @samp
17569 @item +crc
17570 The Cyclic Redundancy Check (CRC) instructions.
17571 @item +fp.sp
17572 The single-precision FPv5 floating-point instructions.
17573 @item +simd
17574 The ARMv8-A Advanced SIMD and floating-point instructions.
17575 @item +crypto
17576 The cryptographic instructions.
17577 @item +nocrypto
17578 Disable the cryptographic instructions.
17579 @item +nofp
17580 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17581 @end table
17582
17583 @end table
17584
17585 @option{-march=native} causes the compiler to auto-detect the architecture
17586 of the build computer. At present, this feature is only supported on
17587 GNU/Linux, and not all architectures are recognized. If the auto-detect
17588 is unsuccessful the option has no effect.
17589
17590 @item -mtune=@var{name}
17591 @opindex mtune
17592 This option specifies the name of the target ARM processor for
17593 which GCC should tune the performance of the code.
17594 For some ARM implementations better performance can be obtained by using
17595 this option.
17596 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17597 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17598 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17599 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17600 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17601 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17602 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17603 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17604 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17605 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17606 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17607 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17608 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17609 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17610 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17611 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17612 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17613 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17614 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17615 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17616 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17617 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17618
17619 Additionally, this option can specify that GCC should tune the performance
17620 of the code for a big.LITTLE system. Permissible names are:
17621 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17622 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17623 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17624 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17625
17626 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17627 performance for a blend of processors within architecture @var{arch}.
17628 The aim is to generate code that run well on the current most popular
17629 processors, balancing between optimizations that benefit some CPUs in the
17630 range, and avoiding performance pitfalls of other CPUs. The effects of
17631 this option may change in future GCC versions as CPU models come and go.
17632
17633 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17634 the extension options do not affect the tuning of the generated code.
17635
17636 @option{-mtune=native} causes the compiler to auto-detect the CPU
17637 of the build computer. At present, this feature is only supported on
17638 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17639 unsuccessful the option has no effect.
17640
17641 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17642 @opindex mcpu
17643 This specifies the name of the target ARM processor. GCC uses this name
17644 to derive the name of the target ARM architecture (as if specified
17645 by @option{-march}) and the ARM processor type for which to tune for
17646 performance (as if specified by @option{-mtune}). Where this option
17647 is used in conjunction with @option{-march} or @option{-mtune},
17648 those options take precedence over the appropriate part of this option.
17649
17650 Many of the supported CPUs implement optional architectural
17651 extensions. Where this is so the architectural extensions are
17652 normally enabled by default. If implementations that lack the
17653 extension exist, then the extension syntax can be used to disable
17654 those extensions that have been omitted. For floating-point and
17655 Advanced SIMD (Neon) instructions, the settings of the options
17656 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17657 floating-point and Advanced SIMD instructions will only be used if
17658 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17659 @option{-mfpu} other than @samp{auto} will override the available
17660 floating-point and SIMD extension instructions.
17661
17662 For example, @samp{cortex-a9} can be found in three major
17663 configurations: integer only, with just a floating-point unit or with
17664 floating-point and Advanced SIMD. The default is to enable all the
17665 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17666 be used to disable just the SIMD or both the SIMD and floating-point
17667 instructions respectively.
17668
17669 Permissible names for this option are the same as those for
17670 @option{-mtune}.
17671
17672 The following extension options are common to the listed CPUs:
17673
17674 @table @samp
17675 @item +nodsp
17676 Disable the DSP instructions on @samp{cortex-m33}.
17677
17678 @item +nofp
17679 Disables the floating-point instructions on @samp{arm9e},
17680 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17681 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17682 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17683 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17684 Disables the floating-point and SIMD instructions on
17685 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17686 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17687 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17688 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17689 @samp{cortex-a53} and @samp{cortex-a55}.
17690
17691 @item +nofp.dp
17692 Disables the double-precision component of the floating-point instructions
17693 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17694 @samp{cortex-m7}.
17695
17696 @item +nosimd
17697 Disables the SIMD (but not floating-point) instructions on
17698 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17699 and @samp{cortex-a9}.
17700
17701 @item +crypto
17702 Enables the cryptographic instructions on @samp{cortex-a32},
17703 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17704 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17705 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17706 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17707 @samp{cortex-a75.cortex-a55}.
17708 @end table
17709
17710 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17711 VFPv3 with 16 double-precision registers. It supports the following
17712 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17713 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17714 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17715 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17716 the extensions to @option{-march=armv7-a}.
17717
17718 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17719 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17720 See @option{-mtune} for more information.
17721
17722 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17723 of the build computer. At present, this feature is only supported on
17724 GNU/Linux, and not all architectures are recognized. If the auto-detect
17725 is unsuccessful the option has no effect.
17726
17727 @item -mfpu=@var{name}
17728 @opindex mfpu
17729 This specifies what floating-point hardware (or hardware emulation) is
17730 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17731 @samp{vfpv3},
17732 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17733 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17734 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17735 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17736 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17737 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17738 is an alias for @samp{vfpv2}.
17739
17740 The setting @samp{auto} is the default and is special. It causes the
17741 compiler to select the floating-point and Advanced SIMD instructions
17742 based on the settings of @option{-mcpu} and @option{-march}.
17743
17744 If the selected floating-point hardware includes the NEON extension
17745 (e.g.@: @option{-mfpu=neon}), note that floating-point
17746 operations are not generated by GCC's auto-vectorization pass unless
17747 @option{-funsafe-math-optimizations} is also specified. This is
17748 because NEON hardware does not fully implement the IEEE 754 standard for
17749 floating-point arithmetic (in particular denormal values are treated as
17750 zero), so the use of NEON instructions may lead to a loss of precision.
17751
17752 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}).
17753
17754 @item -mfp16-format=@var{name}
17755 @opindex mfp16-format
17756 Specify the format of the @code{__fp16} half-precision floating-point type.
17757 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17758 the default is @samp{none}, in which case the @code{__fp16} type is not
17759 defined. @xref{Half-Precision}, for more information.
17760
17761 @item -mstructure-size-boundary=@var{n}
17762 @opindex mstructure-size-boundary
17763 The sizes of all structures and unions are rounded up to a multiple
17764 of the number of bits set by this option. Permissible values are 8, 32
17765 and 64. The default value varies for different toolchains. For the COFF
17766 targeted toolchain the default value is 8. A value of 64 is only allowed
17767 if the underlying ABI supports it.
17768
17769 Specifying a larger number can produce faster, more efficient code, but
17770 can also increase the size of the program. Different values are potentially
17771 incompatible. Code compiled with one value cannot necessarily expect to
17772 work with code or libraries compiled with another value, if they exchange
17773 information using structures or unions.
17774
17775 This option is deprecated.
17776
17777 @item -mabort-on-noreturn
17778 @opindex mabort-on-noreturn
17779 Generate a call to the function @code{abort} at the end of a
17780 @code{noreturn} function. It is executed if the function tries to
17781 return.
17782
17783 @item -mlong-calls
17784 @itemx -mno-long-calls
17785 @opindex mlong-calls
17786 @opindex mno-long-calls
17787 Tells the compiler to perform function calls by first loading the
17788 address of the function into a register and then performing a subroutine
17789 call on this register. This switch is needed if the target function
17790 lies outside of the 64-megabyte addressing range of the offset-based
17791 version of subroutine call instruction.
17792
17793 Even if this switch is enabled, not all function calls are turned
17794 into long calls. The heuristic is that static functions, functions
17795 that have the @code{short_call} attribute, functions that are inside
17796 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17797 definitions have already been compiled within the current compilation
17798 unit are not turned into long calls. The exceptions to this rule are
17799 that weak function definitions, functions with the @code{long_call}
17800 attribute or the @code{section} attribute, and functions that are within
17801 the scope of a @code{#pragma long_calls} directive are always
17802 turned into long calls.
17803
17804 This feature is not enabled by default. Specifying
17805 @option{-mno-long-calls} restores the default behavior, as does
17806 placing the function calls within the scope of a @code{#pragma
17807 long_calls_off} directive. Note these switches have no effect on how
17808 the compiler generates code to handle function calls via function
17809 pointers.
17810
17811 @item -msingle-pic-base
17812 @opindex msingle-pic-base
17813 Treat the register used for PIC addressing as read-only, rather than
17814 loading it in the prologue for each function. The runtime system is
17815 responsible for initializing this register with an appropriate value
17816 before execution begins.
17817
17818 @item -mpic-register=@var{reg}
17819 @opindex mpic-register
17820 Specify the register to be used for PIC addressing.
17821 For standard PIC base case, the default is any suitable register
17822 determined by compiler. For single PIC base case, the default is
17823 @samp{R9} if target is EABI based or stack-checking is enabled,
17824 otherwise the default is @samp{R10}.
17825
17826 @item -mpic-data-is-text-relative
17827 @opindex mpic-data-is-text-relative
17828 Assume that the displacement between the text and data segments is fixed
17829 at static link time. This permits using PC-relative addressing
17830 operations to access data known to be in the data segment. For
17831 non-VxWorks RTP targets, this option is enabled by default. When
17832 disabled on such targets, it will enable @option{-msingle-pic-base} by
17833 default.
17834
17835 @item -mpoke-function-name
17836 @opindex mpoke-function-name
17837 Write the name of each function into the text section, directly
17838 preceding the function prologue. The generated code is similar to this:
17839
17840 @smallexample
17841 t0
17842 .ascii "arm_poke_function_name", 0
17843 .align
17844 t1
17845 .word 0xff000000 + (t1 - t0)
17846 arm_poke_function_name
17847 mov ip, sp
17848 stmfd sp!, @{fp, ip, lr, pc@}
17849 sub fp, ip, #4
17850 @end smallexample
17851
17852 When performing a stack backtrace, code can inspect the value of
17853 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17854 location @code{pc - 12} and the top 8 bits are set, then we know that
17855 there is a function name embedded immediately preceding this location
17856 and has length @code{((pc[-3]) & 0xff000000)}.
17857
17858 @item -mthumb
17859 @itemx -marm
17860 @opindex marm
17861 @opindex mthumb
17862
17863 Select between generating code that executes in ARM and Thumb
17864 states. The default for most configurations is to generate code
17865 that executes in ARM state, but the default can be changed by
17866 configuring GCC with the @option{--with-mode=}@var{state}
17867 configure option.
17868
17869 You can also override the ARM and Thumb mode for each function
17870 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17871 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17872
17873 @item -mflip-thumb
17874 @opindex mflip-thumb
17875 Switch ARM/Thumb modes on alternating functions.
17876 This option is provided for regression testing of mixed Thumb/ARM code
17877 generation, and is not intended for ordinary use in compiling code.
17878
17879 @item -mtpcs-frame
17880 @opindex mtpcs-frame
17881 Generate a stack frame that is compliant with the Thumb Procedure Call
17882 Standard for all non-leaf functions. (A leaf function is one that does
17883 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17884
17885 @item -mtpcs-leaf-frame
17886 @opindex mtpcs-leaf-frame
17887 Generate a stack frame that is compliant with the Thumb Procedure Call
17888 Standard for all leaf functions. (A leaf function is one that does
17889 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17890
17891 @item -mcallee-super-interworking
17892 @opindex mcallee-super-interworking
17893 Gives all externally visible functions in the file being compiled an ARM
17894 instruction set header which switches to Thumb mode before executing the
17895 rest of the function. This allows these functions to be called from
17896 non-interworking code. This option is not valid in AAPCS configurations
17897 because interworking is enabled by default.
17898
17899 @item -mcaller-super-interworking
17900 @opindex mcaller-super-interworking
17901 Allows calls via function pointers (including virtual functions) to
17902 execute correctly regardless of whether the target code has been
17903 compiled for interworking or not. There is a small overhead in the cost
17904 of executing a function pointer if this option is enabled. This option
17905 is not valid in AAPCS configurations because interworking is enabled
17906 by default.
17907
17908 @item -mtp=@var{name}
17909 @opindex mtp
17910 Specify the access model for the thread local storage pointer. The valid
17911 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17912 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17913 (supported in the arm6k architecture), and @samp{auto}, which uses the
17914 best available method for the selected processor. The default setting is
17915 @samp{auto}.
17916
17917 @item -mtls-dialect=@var{dialect}
17918 @opindex mtls-dialect
17919 Specify the dialect to use for accessing thread local storage. Two
17920 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17921 @samp{gnu} dialect selects the original GNU scheme for supporting
17922 local and global dynamic TLS models. The @samp{gnu2} dialect
17923 selects the GNU descriptor scheme, which provides better performance
17924 for shared libraries. The GNU descriptor scheme is compatible with
17925 the original scheme, but does require new assembler, linker and
17926 library support. Initial and local exec TLS models are unaffected by
17927 this option and always use the original scheme.
17928
17929 @item -mword-relocations
17930 @opindex mword-relocations
17931 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17932 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17933 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17934 is specified. This option conflicts with @option{-mslow-flash-data}.
17935
17936 @item -mfix-cortex-m3-ldrd
17937 @opindex mfix-cortex-m3-ldrd
17938 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17939 with overlapping destination and base registers are used. This option avoids
17940 generating these instructions. This option is enabled by default when
17941 @option{-mcpu=cortex-m3} is specified.
17942
17943 @item -munaligned-access
17944 @itemx -mno-unaligned-access
17945 @opindex munaligned-access
17946 @opindex mno-unaligned-access
17947 Enables (or disables) reading and writing of 16- and 32- bit values
17948 from addresses that are not 16- or 32- bit aligned. By default
17949 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17950 ARMv8-M Baseline architectures, and enabled for all other
17951 architectures. If unaligned access is not enabled then words in packed
17952 data structures are accessed a byte at a time.
17953
17954 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17955 generated object file to either true or false, depending upon the
17956 setting of this option. If unaligned access is enabled then the
17957 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17958 defined.
17959
17960 @item -mneon-for-64bits
17961 @opindex mneon-for-64bits
17962 Enables using Neon to handle scalar 64-bits operations. This is
17963 disabled by default since the cost of moving data from core registers
17964 to Neon is high.
17965
17966 @item -mslow-flash-data
17967 @opindex mslow-flash-data
17968 Assume loading data from flash is slower than fetching instruction.
17969 Therefore literal load is minimized for better performance.
17970 This option is only supported when compiling for ARMv7 M-profile and
17971 off by default. It conflicts with @option{-mword-relocations}.
17972
17973 @item -masm-syntax-unified
17974 @opindex masm-syntax-unified
17975 Assume inline assembler is using unified asm syntax. The default is
17976 currently off which implies divided syntax. This option has no impact
17977 on Thumb2. However, this may change in future releases of GCC.
17978 Divided syntax should be considered deprecated.
17979
17980 @item -mrestrict-it
17981 @opindex mrestrict-it
17982 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17983 IT blocks can only contain a single 16-bit instruction from a select
17984 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17985
17986 @item -mprint-tune-info
17987 @opindex mprint-tune-info
17988 Print CPU tuning information as comment in assembler file. This is
17989 an option used only for regression testing of the compiler and not
17990 intended for ordinary use in compiling code. This option is disabled
17991 by default.
17992
17993 @item -mverbose-cost-dump
17994 @opindex mverbose-cost-dump
17995 Enable verbose cost model dumping in the debug dump files. This option is
17996 provided for use in debugging the compiler.
17997
17998 @item -mpure-code
17999 @opindex mpure-code
18000 Do not allow constant data to be placed in code sections.
18001 Additionally, when compiling for ELF object format give all text sections the
18002 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
18003 is only available when generating non-pic code for M-profile targets with the
18004 MOVT instruction.
18005
18006 @item -mcmse
18007 @opindex mcmse
18008 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
18009 Development Tools Engineering Specification", which can be found on
18010 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
18011 @end table
18012
18013 @node AVR Options
18014 @subsection AVR Options
18015 @cindex AVR Options
18016
18017 These options are defined for AVR implementations:
18018
18019 @table @gcctabopt
18020 @item -mmcu=@var{mcu}
18021 @opindex mmcu
18022 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18023
18024 The default for this option is@tie{}@samp{avr2}.
18025
18026 GCC supports the following AVR devices and ISAs:
18027
18028 @include avr-mmcu.texi
18029
18030 @item -mabsdata
18031 @opindex mabsdata
18032
18033 Assume that all data in static storage can be accessed by LDS / STS
18034 instructions. This option has only an effect on reduced Tiny devices like
18035 ATtiny40. See also the @code{absdata}
18036 @ref{AVR Variable Attributes,variable attribute}.
18037
18038 @item -maccumulate-args
18039 @opindex maccumulate-args
18040 Accumulate outgoing function arguments and acquire/release the needed
18041 stack space for outgoing function arguments once in function
18042 prologue/epilogue. Without this option, outgoing arguments are pushed
18043 before calling a function and popped afterwards.
18044
18045 Popping the arguments after the function call can be expensive on
18046 AVR so that accumulating the stack space might lead to smaller
18047 executables because arguments need not be removed from the
18048 stack after such a function call.
18049
18050 This option can lead to reduced code size for functions that perform
18051 several calls to functions that get their arguments on the stack like
18052 calls to printf-like functions.
18053
18054 @item -mbranch-cost=@var{cost}
18055 @opindex mbranch-cost
18056 Set the branch costs for conditional branch instructions to
18057 @var{cost}. Reasonable values for @var{cost} are small, non-negative
18058 integers. The default branch cost is 0.
18059
18060 @item -mcall-prologues
18061 @opindex mcall-prologues
18062 Functions prologues/epilogues are expanded as calls to appropriate
18063 subroutines. Code size is smaller.
18064
18065 @item -mgas-isr-prologues
18066 @opindex mgas-isr-prologues
18067 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18068 instruction supported by GNU Binutils.
18069 If this option is on, the feature can still be disabled for individual
18070 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18071 function attribute. This feature is activated per default
18072 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18073 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18074
18075 @item -mint8
18076 @opindex mint8
18077 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18078 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18079 and @code{long long} is 4 bytes. Please note that this option does not
18080 conform to the C standards, but it results in smaller code
18081 size.
18082
18083 @item -mmain-is-OS_task
18084 @opindex mmain-is-OS_task
18085 Do not save registers in @code{main}. The effect is the same like
18086 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18087 to @code{main}. It is activated per default if optimization is on.
18088
18089 @item -mn-flash=@var{num}
18090 @opindex mn-flash
18091 Assume that the flash memory has a size of
18092 @var{num} times 64@tie{}KiB.
18093
18094 @item -mno-interrupts
18095 @opindex mno-interrupts
18096 Generated code is not compatible with hardware interrupts.
18097 Code size is smaller.
18098
18099 @item -mrelax
18100 @opindex mrelax
18101 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18102 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18103 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18104 the assembler's command line and the @option{--relax} option to the
18105 linker's command line.
18106
18107 Jump relaxing is performed by the linker because jump offsets are not
18108 known before code is located. Therefore, the assembler code generated by the
18109 compiler is the same, but the instructions in the executable may
18110 differ from instructions in the assembler code.
18111
18112 Relaxing must be turned on if linker stubs are needed, see the
18113 section on @code{EIND} and linker stubs below.
18114
18115 @item -mrmw
18116 @opindex mrmw
18117 Assume that the device supports the Read-Modify-Write
18118 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18119
18120 @item -mshort-calls
18121 @opindex mshort-calls
18122
18123 Assume that @code{RJMP} and @code{RCALL} can target the whole
18124 program memory.
18125
18126 This option is used internally for multilib selection. It is
18127 not an optimization option, and you don't need to set it by hand.
18128
18129 @item -msp8
18130 @opindex msp8
18131 Treat the stack pointer register as an 8-bit register,
18132 i.e.@: assume the high byte of the stack pointer is zero.
18133 In general, you don't need to set this option by hand.
18134
18135 This option is used internally by the compiler to select and
18136 build multilibs for architectures @code{avr2} and @code{avr25}.
18137 These architectures mix devices with and without @code{SPH}.
18138 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18139 the compiler driver adds or removes this option from the compiler
18140 proper's command line, because the compiler then knows if the device
18141 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18142 register or not.
18143
18144 @item -mstrict-X
18145 @opindex mstrict-X
18146 Use address register @code{X} in a way proposed by the hardware. This means
18147 that @code{X} is only used in indirect, post-increment or
18148 pre-decrement addressing.
18149
18150 Without this option, the @code{X} register may be used in the same way
18151 as @code{Y} or @code{Z} which then is emulated by additional
18152 instructions.
18153 For example, loading a value with @code{X+const} addressing with a
18154 small non-negative @code{const < 64} to a register @var{Rn} is
18155 performed as
18156
18157 @example
18158 adiw r26, const ; X += const
18159 ld @var{Rn}, X ; @var{Rn} = *X
18160 sbiw r26, const ; X -= const
18161 @end example
18162
18163 @item -mtiny-stack
18164 @opindex mtiny-stack
18165 Only change the lower 8@tie{}bits of the stack pointer.
18166
18167 @item -mfract-convert-truncate
18168 @opindex mfract-convert-truncate
18169 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18170
18171 @item -nodevicelib
18172 @opindex nodevicelib
18173 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18174
18175 @item -Waddr-space-convert
18176 @opindex Waddr-space-convert
18177 @opindex Wno-addr-space-convert
18178 Warn about conversions between address spaces in the case where the
18179 resulting address space is not contained in the incoming address space.
18180
18181 @item -Wmisspelled-isr
18182 @opindex Wmisspelled-isr
18183 @opindex Wno-misspelled-isr
18184 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18185 Enabled by default.
18186 @end table
18187
18188 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18189 @cindex @code{EIND}
18190 Pointers in the implementation are 16@tie{}bits wide.
18191 The address of a function or label is represented as word address so
18192 that indirect jumps and calls can target any code address in the
18193 range of 64@tie{}Ki words.
18194
18195 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18196 bytes of program memory space, there is a special function register called
18197 @code{EIND} that serves as most significant part of the target address
18198 when @code{EICALL} or @code{EIJMP} instructions are used.
18199
18200 Indirect jumps and calls on these devices are handled as follows by
18201 the compiler and are subject to some limitations:
18202
18203 @itemize @bullet
18204
18205 @item
18206 The compiler never sets @code{EIND}.
18207
18208 @item
18209 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18210 instructions or might read @code{EIND} directly in order to emulate an
18211 indirect call/jump by means of a @code{RET} instruction.
18212
18213 @item
18214 The compiler assumes that @code{EIND} never changes during the startup
18215 code or during the application. In particular, @code{EIND} is not
18216 saved/restored in function or interrupt service routine
18217 prologue/epilogue.
18218
18219 @item
18220 For indirect calls to functions and computed goto, the linker
18221 generates @emph{stubs}. Stubs are jump pads sometimes also called
18222 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18223 The stub contains a direct jump to the desired address.
18224
18225 @item
18226 Linker relaxation must be turned on so that the linker generates
18227 the stubs correctly in all situations. See the compiler option
18228 @option{-mrelax} and the linker option @option{--relax}.
18229 There are corner cases where the linker is supposed to generate stubs
18230 but aborts without relaxation and without a helpful error message.
18231
18232 @item
18233 The default linker script is arranged for code with @code{EIND = 0}.
18234 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18235 linker script has to be used in order to place the sections whose
18236 name start with @code{.trampolines} into the segment where @code{EIND}
18237 points to.
18238
18239 @item
18240 The startup code from libgcc never sets @code{EIND}.
18241 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18242 For the impact of AVR-LibC on @code{EIND}, see the
18243 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18244
18245 @item
18246 It is legitimate for user-specific startup code to set up @code{EIND}
18247 early, for example by means of initialization code located in
18248 section @code{.init3}. Such code runs prior to general startup code
18249 that initializes RAM and calls constructors, but after the bit
18250 of startup code from AVR-LibC that sets @code{EIND} to the segment
18251 where the vector table is located.
18252 @example
18253 #include <avr/io.h>
18254
18255 static void
18256 __attribute__((section(".init3"),naked,used,no_instrument_function))
18257 init3_set_eind (void)
18258 @{
18259 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18260 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18261 @}
18262 @end example
18263
18264 @noindent
18265 The @code{__trampolines_start} symbol is defined in the linker script.
18266
18267 @item
18268 Stubs are generated automatically by the linker if
18269 the following two conditions are met:
18270 @itemize @minus
18271
18272 @item The address of a label is taken by means of the @code{gs} modifier
18273 (short for @emph{generate stubs}) like so:
18274 @example
18275 LDI r24, lo8(gs(@var{func}))
18276 LDI r25, hi8(gs(@var{func}))
18277 @end example
18278 @item The final location of that label is in a code segment
18279 @emph{outside} the segment where the stubs are located.
18280 @end itemize
18281
18282 @item
18283 The compiler emits such @code{gs} modifiers for code labels in the
18284 following situations:
18285 @itemize @minus
18286 @item Taking address of a function or code label.
18287 @item Computed goto.
18288 @item If prologue-save function is used, see @option{-mcall-prologues}
18289 command-line option.
18290 @item Switch/case dispatch tables. If you do not want such dispatch
18291 tables you can specify the @option{-fno-jump-tables} command-line option.
18292 @item C and C++ constructors/destructors called during startup/shutdown.
18293 @item If the tools hit a @code{gs()} modifier explained above.
18294 @end itemize
18295
18296 @item
18297 Jumping to non-symbolic addresses like so is @emph{not} supported:
18298
18299 @example
18300 int main (void)
18301 @{
18302 /* Call function at word address 0x2 */
18303 return ((int(*)(void)) 0x2)();
18304 @}
18305 @end example
18306
18307 Instead, a stub has to be set up, i.e.@: the function has to be called
18308 through a symbol (@code{func_4} in the example):
18309
18310 @example
18311 int main (void)
18312 @{
18313 extern int func_4 (void);
18314
18315 /* Call function at byte address 0x4 */
18316 return func_4();
18317 @}
18318 @end example
18319
18320 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18321 Alternatively, @code{func_4} can be defined in the linker script.
18322 @end itemize
18323
18324 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18325 @cindex @code{RAMPD}
18326 @cindex @code{RAMPX}
18327 @cindex @code{RAMPY}
18328 @cindex @code{RAMPZ}
18329 Some AVR devices support memories larger than the 64@tie{}KiB range
18330 that can be accessed with 16-bit pointers. To access memory locations
18331 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18332 register is used as high part of the address:
18333 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18334 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18335 register, respectively, to get a wide address. Similarly,
18336 @code{RAMPD} is used together with direct addressing.
18337
18338 @itemize
18339 @item
18340 The startup code initializes the @code{RAMP} special function
18341 registers with zero.
18342
18343 @item
18344 If a @ref{AVR Named Address Spaces,named address space} other than
18345 generic or @code{__flash} is used, then @code{RAMPZ} is set
18346 as needed before the operation.
18347
18348 @item
18349 If the device supports RAM larger than 64@tie{}KiB and the compiler
18350 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18351 is reset to zero after the operation.
18352
18353 @item
18354 If the device comes with a specific @code{RAMP} register, the ISR
18355 prologue/epilogue saves/restores that SFR and initializes it with
18356 zero in case the ISR code might (implicitly) use it.
18357
18358 @item
18359 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18360 If you use inline assembler to read from locations outside the
18361 16-bit address range and change one of the @code{RAMP} registers,
18362 you must reset it to zero after the access.
18363
18364 @end itemize
18365
18366 @subsubsection AVR Built-in Macros
18367
18368 GCC defines several built-in macros so that the user code can test
18369 for the presence or absence of features. Almost any of the following
18370 built-in macros are deduced from device capabilities and thus
18371 triggered by the @option{-mmcu=} command-line option.
18372
18373 For even more AVR-specific built-in macros see
18374 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18375
18376 @table @code
18377
18378 @item __AVR_ARCH__
18379 Build-in macro that resolves to a decimal number that identifies the
18380 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18381 Possible values are:
18382
18383 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18384 @code{4}, @code{5}, @code{51}, @code{6}
18385
18386 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18387 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18388
18389 respectively and
18390
18391 @code{100},
18392 @code{102}, @code{103}, @code{104},
18393 @code{105}, @code{106}, @code{107}
18394
18395 for @var{mcu}=@code{avrtiny},
18396 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18397 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18398 If @var{mcu} specifies a device, this built-in macro is set
18399 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18400 defined to @code{4}.
18401
18402 @item __AVR_@var{Device}__
18403 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18404 the device's name. For example, @option{-mmcu=atmega8} defines the
18405 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18406 @code{__AVR_ATtiny261A__}, etc.
18407
18408 The built-in macros' names follow
18409 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18410 the device name as from the AVR user manual. The difference between
18411 @var{Device} in the built-in macro and @var{device} in
18412 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18413
18414 If @var{device} is not a device but only a core architecture like
18415 @samp{avr51}, this macro is not defined.
18416
18417 @item __AVR_DEVICE_NAME__
18418 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18419 the device's name. For example, with @option{-mmcu=atmega8} the macro
18420 is defined to @code{atmega8}.
18421
18422 If @var{device} is not a device but only a core architecture like
18423 @samp{avr51}, this macro is not defined.
18424
18425 @item __AVR_XMEGA__
18426 The device / architecture belongs to the XMEGA family of devices.
18427
18428 @item __AVR_HAVE_ELPM__
18429 The device has the @code{ELPM} instruction.
18430
18431 @item __AVR_HAVE_ELPMX__
18432 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18433 R@var{n},Z+} instructions.
18434
18435 @item __AVR_HAVE_MOVW__
18436 The device has the @code{MOVW} instruction to perform 16-bit
18437 register-register moves.
18438
18439 @item __AVR_HAVE_LPMX__
18440 The device has the @code{LPM R@var{n},Z} and
18441 @code{LPM R@var{n},Z+} instructions.
18442
18443 @item __AVR_HAVE_MUL__
18444 The device has a hardware multiplier.
18445
18446 @item __AVR_HAVE_JMP_CALL__
18447 The device has the @code{JMP} and @code{CALL} instructions.
18448 This is the case for devices with more than 8@tie{}KiB of program
18449 memory.
18450
18451 @item __AVR_HAVE_EIJMP_EICALL__
18452 @itemx __AVR_3_BYTE_PC__
18453 The device has the @code{EIJMP} and @code{EICALL} instructions.
18454 This is the case for devices with more than 128@tie{}KiB of program memory.
18455 This also means that the program counter
18456 (PC) is 3@tie{}bytes wide.
18457
18458 @item __AVR_2_BYTE_PC__
18459 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18460 with up to 128@tie{}KiB of program memory.
18461
18462 @item __AVR_HAVE_8BIT_SP__
18463 @itemx __AVR_HAVE_16BIT_SP__
18464 The stack pointer (SP) register is treated as 8-bit respectively
18465 16-bit register by the compiler.
18466 The definition of these macros is affected by @option{-mtiny-stack}.
18467
18468 @item __AVR_HAVE_SPH__
18469 @itemx __AVR_SP8__
18470 The device has the SPH (high part of stack pointer) special function
18471 register or has an 8-bit stack pointer, respectively.
18472 The definition of these macros is affected by @option{-mmcu=} and
18473 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18474 by @option{-msp8}.
18475
18476 @item __AVR_HAVE_RAMPD__
18477 @itemx __AVR_HAVE_RAMPX__
18478 @itemx __AVR_HAVE_RAMPY__
18479 @itemx __AVR_HAVE_RAMPZ__
18480 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18481 @code{RAMPZ} special function register, respectively.
18482
18483 @item __NO_INTERRUPTS__
18484 This macro reflects the @option{-mno-interrupts} command-line option.
18485
18486 @item __AVR_ERRATA_SKIP__
18487 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18488 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18489 instructions because of a hardware erratum. Skip instructions are
18490 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18491 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18492 set.
18493
18494 @item __AVR_ISA_RMW__
18495 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18496
18497 @item __AVR_SFR_OFFSET__=@var{offset}
18498 Instructions that can address I/O special function registers directly
18499 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18500 address as if addressed by an instruction to access RAM like @code{LD}
18501 or @code{STS}. This offset depends on the device architecture and has
18502 to be subtracted from the RAM address in order to get the
18503 respective I/O@tie{}address.
18504
18505 @item __AVR_SHORT_CALLS__
18506 The @option{-mshort-calls} command line option is set.
18507
18508 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18509 Some devices support reading from flash memory by means of @code{LD*}
18510 instructions. The flash memory is seen in the data address space
18511 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18512 is not defined, this feature is not available. If defined,
18513 the address space is linear and there is no need to put
18514 @code{.rodata} into RAM. This is handled by the default linker
18515 description file, and is currently available for
18516 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18517 there is no need to use address spaces like @code{__flash} or
18518 features like attribute @code{progmem} and @code{pgm_read_*}.
18519
18520 @item __WITH_AVRLIBC__
18521 The compiler is configured to be used together with AVR-Libc.
18522 See the @option{--with-avrlibc} configure option.
18523
18524 @end table
18525
18526 @node Blackfin Options
18527 @subsection Blackfin Options
18528 @cindex Blackfin Options
18529
18530 @table @gcctabopt
18531 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18532 @opindex mcpu=
18533 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18534 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18535 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18536 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18537 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18538 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18539 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18540 @samp{bf561}, @samp{bf592}.
18541
18542 The optional @var{sirevision} specifies the silicon revision of the target
18543 Blackfin processor. Any workarounds available for the targeted silicon revision
18544 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18545 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18546 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18547 hexadecimal digits representing the major and minor numbers in the silicon
18548 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18549 is not defined. If @var{sirevision} is @samp{any}, the
18550 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18551 If this optional @var{sirevision} is not used, GCC assumes the latest known
18552 silicon revision of the targeted Blackfin processor.
18553
18554 GCC defines a preprocessor macro for the specified @var{cpu}.
18555 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18556 provided by libgloss to be linked in if @option{-msim} is not given.
18557
18558 Without this option, @samp{bf532} is used as the processor by default.
18559
18560 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18561 only the preprocessor macro is defined.
18562
18563 @item -msim
18564 @opindex msim
18565 Specifies that the program will be run on the simulator. This causes
18566 the simulator BSP provided by libgloss to be linked in. This option
18567 has effect only for @samp{bfin-elf} toolchain.
18568 Certain other options, such as @option{-mid-shared-library} and
18569 @option{-mfdpic}, imply @option{-msim}.
18570
18571 @item -momit-leaf-frame-pointer
18572 @opindex momit-leaf-frame-pointer
18573 Don't keep the frame pointer in a register for leaf functions. This
18574 avoids the instructions to save, set up and restore frame pointers and
18575 makes an extra register available in leaf functions.
18576
18577 @item -mspecld-anomaly
18578 @opindex mspecld-anomaly
18579 When enabled, the compiler ensures that the generated code does not
18580 contain speculative loads after jump instructions. If this option is used,
18581 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18582
18583 @item -mno-specld-anomaly
18584 @opindex mno-specld-anomaly
18585 @opindex mspecld-anomaly
18586 Don't generate extra code to prevent speculative loads from occurring.
18587
18588 @item -mcsync-anomaly
18589 @opindex mcsync-anomaly
18590 When enabled, the compiler ensures that the generated code does not
18591 contain CSYNC or SSYNC instructions too soon after conditional branches.
18592 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18593
18594 @item -mno-csync-anomaly
18595 @opindex mno-csync-anomaly
18596 @opindex mcsync-anomaly
18597 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18598 occurring too soon after a conditional branch.
18599
18600 @item -mlow64k
18601 @opindex mlow64k
18602 When enabled, the compiler is free to take advantage of the knowledge that
18603 the entire program fits into the low 64k of memory.
18604
18605 @item -mno-low64k
18606 @opindex mno-low64k
18607 Assume that the program is arbitrarily large. This is the default.
18608
18609 @item -mstack-check-l1
18610 @opindex mstack-check-l1
18611 Do stack checking using information placed into L1 scratchpad memory by the
18612 uClinux kernel.
18613
18614 @item -mid-shared-library
18615 @opindex mid-shared-library
18616 Generate code that supports shared libraries via the library ID method.
18617 This allows for execute in place and shared libraries in an environment
18618 without virtual memory management. This option implies @option{-fPIC}.
18619 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18620
18621 @item -mno-id-shared-library
18622 @opindex mno-id-shared-library
18623 @opindex mid-shared-library
18624 Generate code that doesn't assume ID-based shared libraries are being used.
18625 This is the default.
18626
18627 @item -mleaf-id-shared-library
18628 @opindex mleaf-id-shared-library
18629 Generate code that supports shared libraries via the library ID method,
18630 but assumes that this library or executable won't link against any other
18631 ID shared libraries. That allows the compiler to use faster code for jumps
18632 and calls.
18633
18634 @item -mno-leaf-id-shared-library
18635 @opindex mno-leaf-id-shared-library
18636 @opindex mleaf-id-shared-library
18637 Do not assume that the code being compiled won't link against any ID shared
18638 libraries. Slower code is generated for jump and call insns.
18639
18640 @item -mshared-library-id=n
18641 @opindex mshared-library-id
18642 Specifies the identification number of the ID-based shared library being
18643 compiled. Specifying a value of 0 generates more compact code; specifying
18644 other values forces the allocation of that number to the current
18645 library but is no more space- or time-efficient than omitting this option.
18646
18647 @item -msep-data
18648 @opindex msep-data
18649 Generate code that allows the data segment to be located in a different
18650 area of memory from the text segment. This allows for execute in place in
18651 an environment without virtual memory management by eliminating relocations
18652 against the text section.
18653
18654 @item -mno-sep-data
18655 @opindex mno-sep-data
18656 @opindex msep-data
18657 Generate code that assumes that the data segment follows the text segment.
18658 This is the default.
18659
18660 @item -mlong-calls
18661 @itemx -mno-long-calls
18662 @opindex mlong-calls
18663 @opindex mno-long-calls
18664 Tells the compiler to perform function calls by first loading the
18665 address of the function into a register and then performing a subroutine
18666 call on this register. This switch is needed if the target function
18667 lies outside of the 24-bit addressing range of the offset-based
18668 version of subroutine call instruction.
18669
18670 This feature is not enabled by default. Specifying
18671 @option{-mno-long-calls} restores the default behavior. Note these
18672 switches have no effect on how the compiler generates code to handle
18673 function calls via function pointers.
18674
18675 @item -mfast-fp
18676 @opindex mfast-fp
18677 Link with the fast floating-point library. This library relaxes some of
18678 the IEEE floating-point standard's rules for checking inputs against
18679 Not-a-Number (NAN), in the interest of performance.
18680
18681 @item -minline-plt
18682 @opindex minline-plt
18683 Enable inlining of PLT entries in function calls to functions that are
18684 not known to bind locally. It has no effect without @option{-mfdpic}.
18685
18686 @item -mmulticore
18687 @opindex mmulticore
18688 Build a standalone application for multicore Blackfin processors.
18689 This option causes proper start files and link scripts supporting
18690 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18691 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18692
18693 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18694 selects the one-application-per-core programming model. Without
18695 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18696 programming model is used. In this model, the main function of Core B
18697 should be named as @code{coreb_main}.
18698
18699 If this option is not used, the single-core application programming
18700 model is used.
18701
18702 @item -mcorea
18703 @opindex mcorea
18704 Build a standalone application for Core A of BF561 when using
18705 the one-application-per-core programming model. Proper start files
18706 and link scripts are used to support Core A, and the macro
18707 @code{__BFIN_COREA} is defined.
18708 This option can only be used in conjunction with @option{-mmulticore}.
18709
18710 @item -mcoreb
18711 @opindex mcoreb
18712 Build a standalone application for Core B of BF561 when using
18713 the one-application-per-core programming model. Proper start files
18714 and link scripts are used to support Core B, and the macro
18715 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18716 should be used instead of @code{main}.
18717 This option can only be used in conjunction with @option{-mmulticore}.
18718
18719 @item -msdram
18720 @opindex msdram
18721 Build a standalone application for SDRAM. Proper start files and
18722 link scripts are used to put the application into SDRAM, and the macro
18723 @code{__BFIN_SDRAM} is defined.
18724 The loader should initialize SDRAM before loading the application.
18725
18726 @item -micplb
18727 @opindex micplb
18728 Assume that ICPLBs are enabled at run time. This has an effect on certain
18729 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18730 are enabled; for standalone applications the default is off.
18731 @end table
18732
18733 @node C6X Options
18734 @subsection C6X Options
18735 @cindex C6X Options
18736
18737 @table @gcctabopt
18738 @item -march=@var{name}
18739 @opindex march
18740 This specifies the name of the target architecture. GCC uses this
18741 name to determine what kind of instructions it can emit when generating
18742 assembly code. Permissible names are: @samp{c62x},
18743 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18744
18745 @item -mbig-endian
18746 @opindex mbig-endian
18747 Generate code for a big-endian target.
18748
18749 @item -mlittle-endian
18750 @opindex mlittle-endian
18751 Generate code for a little-endian target. This is the default.
18752
18753 @item -msim
18754 @opindex msim
18755 Choose startup files and linker script suitable for the simulator.
18756
18757 @item -msdata=default
18758 @opindex msdata=default
18759 Put small global and static data in the @code{.neardata} section,
18760 which is pointed to by register @code{B14}. Put small uninitialized
18761 global and static data in the @code{.bss} section, which is adjacent
18762 to the @code{.neardata} section. Put small read-only data into the
18763 @code{.rodata} section. The corresponding sections used for large
18764 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18765
18766 @item -msdata=all
18767 @opindex msdata=all
18768 Put all data, not just small objects, into the sections reserved for
18769 small data, and use addressing relative to the @code{B14} register to
18770 access them.
18771
18772 @item -msdata=none
18773 @opindex msdata=none
18774 Make no use of the sections reserved for small data, and use absolute
18775 addresses to access all data. Put all initialized global and static
18776 data in the @code{.fardata} section, and all uninitialized data in the
18777 @code{.far} section. Put all constant data into the @code{.const}
18778 section.
18779 @end table
18780
18781 @node CRIS Options
18782 @subsection CRIS Options
18783 @cindex CRIS Options
18784
18785 These options are defined specifically for the CRIS ports.
18786
18787 @table @gcctabopt
18788 @item -march=@var{architecture-type}
18789 @itemx -mcpu=@var{architecture-type}
18790 @opindex march
18791 @opindex mcpu
18792 Generate code for the specified architecture. The choices for
18793 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18794 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18795 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18796 @samp{v10}.
18797
18798 @item -mtune=@var{architecture-type}
18799 @opindex mtune
18800 Tune to @var{architecture-type} everything applicable about the generated
18801 code, except for the ABI and the set of available instructions. The
18802 choices for @var{architecture-type} are the same as for
18803 @option{-march=@var{architecture-type}}.
18804
18805 @item -mmax-stack-frame=@var{n}
18806 @opindex mmax-stack-frame
18807 Warn when the stack frame of a function exceeds @var{n} bytes.
18808
18809 @item -metrax4
18810 @itemx -metrax100
18811 @opindex metrax4
18812 @opindex metrax100
18813 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18814 @option{-march=v3} and @option{-march=v8} respectively.
18815
18816 @item -mmul-bug-workaround
18817 @itemx -mno-mul-bug-workaround
18818 @opindex mmul-bug-workaround
18819 @opindex mno-mul-bug-workaround
18820 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18821 models where it applies. This option is active by default.
18822
18823 @item -mpdebug
18824 @opindex mpdebug
18825 Enable CRIS-specific verbose debug-related information in the assembly
18826 code. This option also has the effect of turning off the @samp{#NO_APP}
18827 formatted-code indicator to the assembler at the beginning of the
18828 assembly file.
18829
18830 @item -mcc-init
18831 @opindex mcc-init
18832 Do not use condition-code results from previous instruction; always emit
18833 compare and test instructions before use of condition codes.
18834
18835 @item -mno-side-effects
18836 @opindex mno-side-effects
18837 @opindex mside-effects
18838 Do not emit instructions with side effects in addressing modes other than
18839 post-increment.
18840
18841 @item -mstack-align
18842 @itemx -mno-stack-align
18843 @itemx -mdata-align
18844 @itemx -mno-data-align
18845 @itemx -mconst-align
18846 @itemx -mno-const-align
18847 @opindex mstack-align
18848 @opindex mno-stack-align
18849 @opindex mdata-align
18850 @opindex mno-data-align
18851 @opindex mconst-align
18852 @opindex mno-const-align
18853 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18854 stack frame, individual data and constants to be aligned for the maximum
18855 single data access size for the chosen CPU model. The default is to
18856 arrange for 32-bit alignment. ABI details such as structure layout are
18857 not affected by these options.
18858
18859 @item -m32-bit
18860 @itemx -m16-bit
18861 @itemx -m8-bit
18862 @opindex m32-bit
18863 @opindex m16-bit
18864 @opindex m8-bit
18865 Similar to the stack- data- and const-align options above, these options
18866 arrange for stack frame, writable data and constants to all be 32-bit,
18867 16-bit or 8-bit aligned. The default is 32-bit alignment.
18868
18869 @item -mno-prologue-epilogue
18870 @itemx -mprologue-epilogue
18871 @opindex mno-prologue-epilogue
18872 @opindex mprologue-epilogue
18873 With @option{-mno-prologue-epilogue}, the normal function prologue and
18874 epilogue which set up the stack frame are omitted and no return
18875 instructions or return sequences are generated in the code. Use this
18876 option only together with visual inspection of the compiled code: no
18877 warnings or errors are generated when call-saved registers must be saved,
18878 or storage for local variables needs to be allocated.
18879
18880 @item -mno-gotplt
18881 @itemx -mgotplt
18882 @opindex mno-gotplt
18883 @opindex mgotplt
18884 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18885 instruction sequences that load addresses for functions from the PLT part
18886 of the GOT rather than (traditional on other architectures) calls to the
18887 PLT@. The default is @option{-mgotplt}.
18888
18889 @item -melf
18890 @opindex melf
18891 Legacy no-op option only recognized with the cris-axis-elf and
18892 cris-axis-linux-gnu targets.
18893
18894 @item -mlinux
18895 @opindex mlinux
18896 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18897
18898 @item -sim
18899 @opindex sim
18900 This option, recognized for the cris-axis-elf, arranges
18901 to link with input-output functions from a simulator library. Code,
18902 initialized data and zero-initialized data are allocated consecutively.
18903
18904 @item -sim2
18905 @opindex sim2
18906 Like @option{-sim}, but pass linker options to locate initialized data at
18907 0x40000000 and zero-initialized data at 0x80000000.
18908 @end table
18909
18910 @node CR16 Options
18911 @subsection CR16 Options
18912 @cindex CR16 Options
18913
18914 These options are defined specifically for the CR16 ports.
18915
18916 @table @gcctabopt
18917
18918 @item -mmac
18919 @opindex mmac
18920 Enable the use of multiply-accumulate instructions. Disabled by default.
18921
18922 @item -mcr16cplus
18923 @itemx -mcr16c
18924 @opindex mcr16cplus
18925 @opindex mcr16c
18926 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18927 is default.
18928
18929 @item -msim
18930 @opindex msim
18931 Links the library libsim.a which is in compatible with simulator. Applicable
18932 to ELF compiler only.
18933
18934 @item -mint32
18935 @opindex mint32
18936 Choose integer type as 32-bit wide.
18937
18938 @item -mbit-ops
18939 @opindex mbit-ops
18940 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18941
18942 @item -mdata-model=@var{model}
18943 @opindex mdata-model
18944 Choose a data model. The choices for @var{model} are @samp{near},
18945 @samp{far} or @samp{medium}. @samp{medium} is default.
18946 However, @samp{far} is not valid with @option{-mcr16c}, as the
18947 CR16C architecture does not support the far data model.
18948 @end table
18949
18950 @node C-SKY Options
18951 @subsection C-SKY Options
18952 @cindex C-SKY Options
18953
18954 GCC supports these options when compiling for C-SKY V2 processors.
18955
18956 @table @gcctabopt
18957
18958 @item -march=@var{arch}
18959 @opindex march=
18960 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18961 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18962 The default is @samp{ck810}.
18963
18964 @item -mcpu=@var{cpu}
18965 @opindex mcpu=
18966 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18967 @samp{ck801}, @samp{ck801t},
18968 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18969 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18970 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18971 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18972 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18973 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18974 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18975 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18976 @samp{ck803eftr1}, @samp{ck803efhtr1},
18977 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18978 @samp{ck803sef}, @samp{ck803seft},
18979 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18980 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18981 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18982 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18983
18984 @item -mbig-endian
18985 @opindex mbig-endian
18986 @itemx -EB
18987 @opindex EB
18988 @itemx -mlittle-endian
18989 @opindex mlittle-endian
18990 @itemx -EL
18991 @opindex EL
18992
18993 Select big- or little-endian code. The default is little-endian.
18994
18995 @item -mhard-float
18996 @opindex mhard-float
18997 @itemx -msoft-float
18998 @opindex msoft-float
18999
19000 Select hardware or software floating-point implementations.
19001 The default is soft float.
19002
19003 @item -mdouble-float
19004 @itemx -mno-double-float
19005 @opindex mdouble-float
19006 When @option{-mhard-float} is in effect, enable generation of
19007 double-precision float instructions. This is the default except
19008 when compiling for CK803.
19009
19010 @item -mfdivdu
19011 @itemx -mno-fdivdu
19012 @opindex mfdivdu
19013 When @option{-mhard-float} is in effect, enable generation of
19014 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
19015 This is the default except when compiling for CK803.
19016
19017 @item -mfpu=@var{fpu}
19018 @opindex mfpu=
19019 Select the floating-point processor. This option can only be used with
19020 @option{-mhard-float}.
19021 Values for @var{fpu} are
19022 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19023 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19024 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19025
19026 @item -melrw
19027 @itemx -mno-elrw
19028 @opindex melrw
19029 Enable the extended @code{lrw} instruction. This option defaults to on
19030 for CK801 and off otherwise.
19031
19032 @item -mistack
19033 @itemx -mno-istack
19034 @opindex mistack
19035 Enable interrupt stack instructions; the default is off.
19036
19037 The @option{-mistack} option is required to handle the
19038 @code{interrupt} and @code{isr} function attributes
19039 (@pxref{C-SKY Function Attributes}).
19040
19041 @item -mmp
19042 @opindex mmp
19043 Enable multiprocessor instructions; the default is off.
19044
19045 @item -mcp
19046 @opindex mcp
19047 Enable coprocessor instructions; the default is off.
19048
19049 @item -mcache
19050 @opindex mcache
19051 Enable coprocessor instructions; the default is off.
19052
19053 @item -msecurity
19054 @opindex msecurity
19055 Enable C-SKY security instructions; the default is off.
19056
19057 @item -mtrust
19058 @opindex mtrust
19059 Enable C-SKY trust instructions; the default is off.
19060
19061 @item -mdsp
19062 @opindex mdsp
19063 @itemx -medsp
19064 @opindex medsp
19065 @itemx -mvdsp
19066 @opindex mvdsp
19067 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19068 All of these options default to off.
19069
19070 @item -mdiv
19071 @itemx -mno-div
19072 @opindex mdiv
19073 Generate divide instructions. Default is off.
19074
19075 @item -msmart
19076 @itemx -mno-smart
19077 @opindex msmart
19078 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19079 use of 16-bit instructions. This option is ignored for CK801 where this
19080 is the required behavior, and it defaults to on for CK802.
19081 For other targets, the default is off.
19082
19083 @item -mhigh-registers
19084 @itemx -mno-high-registers
19085 @opindex mhigh-registers
19086 Generate code using the high registers numbered 16-31. This option
19087 is not supported on CK801, CK802, or CK803, and is enabled by default
19088 for other processors.
19089
19090 @item -manchor
19091 @itemx -mno-anchor
19092 @opindex manchor
19093 Generate code using global anchor symbol addresses.
19094
19095 @item -mpushpop
19096 @itemx -mno-pushpop
19097 @opindex mpushpop
19098 Generate code using @code{push} and @code{pop} instructions. This option
19099 defaults to on.
19100
19101 @item -mmultiple-stld
19102 @itemx -mstm
19103 @itemx -mno-multiple-stld
19104 @itemx -mno-stm
19105 @opindex mmultiple-stld
19106 Generate code using @code{stm} and @code{ldm} instructions. This option
19107 isn't supported on CK801 but is enabled by default on other processors.
19108
19109 @item -mconstpool
19110 @itemx -mno-constpool
19111 @opindex mconstpool
19112 Create constant pools in the compiler instead of deferring it to the
19113 assembler. This option is the default and required for correct code
19114 generation on CK801 and CK802, and is optional on other processors.
19115
19116 @item -mstack-size
19117 @item -mno-stack-size
19118 @opindex mstack-size
19119 Emit @code{.stack_size} directives for each function in the assembly
19120 output. This option defaults to off.
19121
19122 @item -mccrt
19123 @itemx -mno-ccrt
19124 @opindex mccrt
19125 Generate code for the C-SKY compiler runtime instead of libgcc. This
19126 option defaults to off.
19127
19128 @item -mbranch-cost=@var{n}
19129 @opindex mbranch-cost=
19130 Set the branch costs to roughly @code{n} instructions. The default is 1.
19131
19132 @item -msched-prolog
19133 @itemx -mno-sched-prolog
19134 @opindex msched-prolog
19135 Permit scheduling of function prologue and epilogue sequences. Using
19136 this option can result in code that is not compliant with the C-SKY V2 ABI
19137 prologue requirements and that cannot be debugged or backtraced.
19138 It is disabled by default.
19139
19140 @end table
19141
19142 @node Darwin Options
19143 @subsection Darwin Options
19144 @cindex Darwin options
19145
19146 These options are defined for all architectures running the Darwin operating
19147 system.
19148
19149 FSF GCC on Darwin does not create ``fat'' object files; it creates
19150 an object file for the single architecture that GCC was built to
19151 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19152 @option{-arch} options are used; it does so by running the compiler or
19153 linker multiple times and joining the results together with
19154 @file{lipo}.
19155
19156 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19157 @samp{i686}) is determined by the flags that specify the ISA
19158 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19159 @option{-force_cpusubtype_ALL} option can be used to override this.
19160
19161 The Darwin tools vary in their behavior when presented with an ISA
19162 mismatch. The assembler, @file{as}, only permits instructions to
19163 be used that are valid for the subtype of the file it is generating,
19164 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19165 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19166 and prints an error if asked to create a shared library with a less
19167 restrictive subtype than its input files (for instance, trying to put
19168 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19169 for executables, @command{ld}, quietly gives the executable the most
19170 restrictive subtype of any of its input files.
19171
19172 @table @gcctabopt
19173 @item -F@var{dir}
19174 @opindex F
19175 Add the framework directory @var{dir} to the head of the list of
19176 directories to be searched for header files. These directories are
19177 interleaved with those specified by @option{-I} options and are
19178 scanned in a left-to-right order.
19179
19180 A framework directory is a directory with frameworks in it. A
19181 framework is a directory with a @file{Headers} and/or
19182 @file{PrivateHeaders} directory contained directly in it that ends
19183 in @file{.framework}. The name of a framework is the name of this
19184 directory excluding the @file{.framework}. Headers associated with
19185 the framework are found in one of those two directories, with
19186 @file{Headers} being searched first. A subframework is a framework
19187 directory that is in a framework's @file{Frameworks} directory.
19188 Includes of subframework headers can only appear in a header of a
19189 framework that contains the subframework, or in a sibling subframework
19190 header. Two subframeworks are siblings if they occur in the same
19191 framework. A subframework should not have the same name as a
19192 framework; a warning is issued if this is violated. Currently a
19193 subframework cannot have subframeworks; in the future, the mechanism
19194 may be extended to support this. The standard frameworks can be found
19195 in @file{/System/Library/Frameworks} and
19196 @file{/Library/Frameworks}. An example include looks like
19197 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19198 the name of the framework and @file{header.h} is found in the
19199 @file{PrivateHeaders} or @file{Headers} directory.
19200
19201 @item -iframework@var{dir}
19202 @opindex iframework
19203 Like @option{-F} except the directory is a treated as a system
19204 directory. The main difference between this @option{-iframework} and
19205 @option{-F} is that with @option{-iframework} the compiler does not
19206 warn about constructs contained within header files found via
19207 @var{dir}. This option is valid only for the C family of languages.
19208
19209 @item -gused
19210 @opindex gused
19211 Emit debugging information for symbols that are used. For stabs
19212 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19213 This is by default ON@.
19214
19215 @item -gfull
19216 @opindex gfull
19217 Emit debugging information for all symbols and types.
19218
19219 @item -mmacosx-version-min=@var{version}
19220 The earliest version of MacOS X that this executable will run on
19221 is @var{version}. Typical values of @var{version} include @code{10.1},
19222 @code{10.2}, and @code{10.3.9}.
19223
19224 If the compiler was built to use the system's headers by default,
19225 then the default for this option is the system version on which the
19226 compiler is running, otherwise the default is to make choices that
19227 are compatible with as many systems and code bases as possible.
19228
19229 @item -mkernel
19230 @opindex mkernel
19231 Enable kernel development mode. The @option{-mkernel} option sets
19232 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19233 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19234 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19235 applicable. This mode also sets @option{-mno-altivec},
19236 @option{-msoft-float}, @option{-fno-builtin} and
19237 @option{-mlong-branch} for PowerPC targets.
19238
19239 @item -mone-byte-bool
19240 @opindex mone-byte-bool
19241 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19242 By default @code{sizeof(bool)} is @code{4} when compiling for
19243 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19244 option has no effect on x86.
19245
19246 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19247 to generate code that is not binary compatible with code generated
19248 without that switch. Using this switch may require recompiling all
19249 other modules in a program, including system libraries. Use this
19250 switch to conform to a non-default data model.
19251
19252 @item -mfix-and-continue
19253 @itemx -ffix-and-continue
19254 @itemx -findirect-data
19255 @opindex mfix-and-continue
19256 @opindex ffix-and-continue
19257 @opindex findirect-data
19258 Generate code suitable for fast turnaround development, such as to
19259 allow GDB to dynamically load @file{.o} files into already-running
19260 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19261 are provided for backwards compatibility.
19262
19263 @item -all_load
19264 @opindex all_load
19265 Loads all members of static archive libraries.
19266 See man ld(1) for more information.
19267
19268 @item -arch_errors_fatal
19269 @opindex arch_errors_fatal
19270 Cause the errors having to do with files that have the wrong architecture
19271 to be fatal.
19272
19273 @item -bind_at_load
19274 @opindex bind_at_load
19275 Causes the output file to be marked such that the dynamic linker will
19276 bind all undefined references when the file is loaded or launched.
19277
19278 @item -bundle
19279 @opindex bundle
19280 Produce a Mach-o bundle format file.
19281 See man ld(1) for more information.
19282
19283 @item -bundle_loader @var{executable}
19284 @opindex bundle_loader
19285 This option specifies the @var{executable} that will load the build
19286 output file being linked. See man ld(1) for more information.
19287
19288 @item -dynamiclib
19289 @opindex dynamiclib
19290 When passed this option, GCC produces a dynamic library instead of
19291 an executable when linking, using the Darwin @file{libtool} command.
19292
19293 @item -force_cpusubtype_ALL
19294 @opindex force_cpusubtype_ALL
19295 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19296 one controlled by the @option{-mcpu} or @option{-march} option.
19297
19298 @item -allowable_client @var{client_name}
19299 @itemx -client_name
19300 @itemx -compatibility_version
19301 @itemx -current_version
19302 @itemx -dead_strip
19303 @itemx -dependency-file
19304 @itemx -dylib_file
19305 @itemx -dylinker_install_name
19306 @itemx -dynamic
19307 @itemx -exported_symbols_list
19308 @itemx -filelist
19309 @need 800
19310 @itemx -flat_namespace
19311 @itemx -force_flat_namespace
19312 @itemx -headerpad_max_install_names
19313 @itemx -image_base
19314 @itemx -init
19315 @itemx -install_name
19316 @itemx -keep_private_externs
19317 @itemx -multi_module
19318 @itemx -multiply_defined
19319 @itemx -multiply_defined_unused
19320 @need 800
19321 @itemx -noall_load
19322 @itemx -no_dead_strip_inits_and_terms
19323 @itemx -nofixprebinding
19324 @itemx -nomultidefs
19325 @itemx -noprebind
19326 @itemx -noseglinkedit
19327 @itemx -pagezero_size
19328 @itemx -prebind
19329 @itemx -prebind_all_twolevel_modules
19330 @itemx -private_bundle
19331 @need 800
19332 @itemx -read_only_relocs
19333 @itemx -sectalign
19334 @itemx -sectobjectsymbols
19335 @itemx -whyload
19336 @itemx -seg1addr
19337 @itemx -sectcreate
19338 @itemx -sectobjectsymbols
19339 @itemx -sectorder
19340 @itemx -segaddr
19341 @itemx -segs_read_only_addr
19342 @need 800
19343 @itemx -segs_read_write_addr
19344 @itemx -seg_addr_table
19345 @itemx -seg_addr_table_filename
19346 @itemx -seglinkedit
19347 @itemx -segprot
19348 @itemx -segs_read_only_addr
19349 @itemx -segs_read_write_addr
19350 @itemx -single_module
19351 @itemx -static
19352 @itemx -sub_library
19353 @need 800
19354 @itemx -sub_umbrella
19355 @itemx -twolevel_namespace
19356 @itemx -umbrella
19357 @itemx -undefined
19358 @itemx -unexported_symbols_list
19359 @itemx -weak_reference_mismatches
19360 @itemx -whatsloaded
19361 @opindex allowable_client
19362 @opindex client_name
19363 @opindex compatibility_version
19364 @opindex current_version
19365 @opindex dead_strip
19366 @opindex dependency-file
19367 @opindex dylib_file
19368 @opindex dylinker_install_name
19369 @opindex dynamic
19370 @opindex exported_symbols_list
19371 @opindex filelist
19372 @opindex flat_namespace
19373 @opindex force_flat_namespace
19374 @opindex headerpad_max_install_names
19375 @opindex image_base
19376 @opindex init
19377 @opindex install_name
19378 @opindex keep_private_externs
19379 @opindex multi_module
19380 @opindex multiply_defined
19381 @opindex multiply_defined_unused
19382 @opindex noall_load
19383 @opindex no_dead_strip_inits_and_terms
19384 @opindex nofixprebinding
19385 @opindex nomultidefs
19386 @opindex noprebind
19387 @opindex noseglinkedit
19388 @opindex pagezero_size
19389 @opindex prebind
19390 @opindex prebind_all_twolevel_modules
19391 @opindex private_bundle
19392 @opindex read_only_relocs
19393 @opindex sectalign
19394 @opindex sectobjectsymbols
19395 @opindex whyload
19396 @opindex seg1addr
19397 @opindex sectcreate
19398 @opindex sectobjectsymbols
19399 @opindex sectorder
19400 @opindex segaddr
19401 @opindex segs_read_only_addr
19402 @opindex segs_read_write_addr
19403 @opindex seg_addr_table
19404 @opindex seg_addr_table_filename
19405 @opindex seglinkedit
19406 @opindex segprot
19407 @opindex segs_read_only_addr
19408 @opindex segs_read_write_addr
19409 @opindex single_module
19410 @opindex static
19411 @opindex sub_library
19412 @opindex sub_umbrella
19413 @opindex twolevel_namespace
19414 @opindex umbrella
19415 @opindex undefined
19416 @opindex unexported_symbols_list
19417 @opindex weak_reference_mismatches
19418 @opindex whatsloaded
19419 These options are passed to the Darwin linker. The Darwin linker man page
19420 describes them in detail.
19421 @end table
19422
19423 @node DEC Alpha Options
19424 @subsection DEC Alpha Options
19425
19426 These @samp{-m} options are defined for the DEC Alpha implementations:
19427
19428 @table @gcctabopt
19429 @item -mno-soft-float
19430 @itemx -msoft-float
19431 @opindex mno-soft-float
19432 @opindex msoft-float
19433 Use (do not use) the hardware floating-point instructions for
19434 floating-point operations. When @option{-msoft-float} is specified,
19435 functions in @file{libgcc.a} are used to perform floating-point
19436 operations. Unless they are replaced by routines that emulate the
19437 floating-point operations, or compiled in such a way as to call such
19438 emulations routines, these routines issue floating-point
19439 operations. If you are compiling for an Alpha without floating-point
19440 operations, you must ensure that the library is built so as not to call
19441 them.
19442
19443 Note that Alpha implementations without floating-point operations are
19444 required to have floating-point registers.
19445
19446 @item -mfp-reg
19447 @itemx -mno-fp-regs
19448 @opindex mfp-reg
19449 @opindex mno-fp-regs
19450 Generate code that uses (does not use) the floating-point register set.
19451 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19452 register set is not used, floating-point operands are passed in integer
19453 registers as if they were integers and floating-point results are passed
19454 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19455 so any function with a floating-point argument or return value called by code
19456 compiled with @option{-mno-fp-regs} must also be compiled with that
19457 option.
19458
19459 A typical use of this option is building a kernel that does not use,
19460 and hence need not save and restore, any floating-point registers.
19461
19462 @item -mieee
19463 @opindex mieee
19464 The Alpha architecture implements floating-point hardware optimized for
19465 maximum performance. It is mostly compliant with the IEEE floating-point
19466 standard. However, for full compliance, software assistance is
19467 required. This option generates code fully IEEE-compliant code
19468 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19469 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19470 defined during compilation. The resulting code is less efficient but is
19471 able to correctly support denormalized numbers and exceptional IEEE
19472 values such as not-a-number and plus/minus infinity. Other Alpha
19473 compilers call this option @option{-ieee_with_no_inexact}.
19474
19475 @item -mieee-with-inexact
19476 @opindex mieee-with-inexact
19477 This is like @option{-mieee} except the generated code also maintains
19478 the IEEE @var{inexact-flag}. Turning on this option causes the
19479 generated code to implement fully-compliant IEEE math. In addition to
19480 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19481 macro. On some Alpha implementations the resulting code may execute
19482 significantly slower than the code generated by default. Since there is
19483 very little code that depends on the @var{inexact-flag}, you should
19484 normally not specify this option. Other Alpha compilers call this
19485 option @option{-ieee_with_inexact}.
19486
19487 @item -mfp-trap-mode=@var{trap-mode}
19488 @opindex mfp-trap-mode
19489 This option controls what floating-point related traps are enabled.
19490 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19491 The trap mode can be set to one of four values:
19492
19493 @table @samp
19494 @item n
19495 This is the default (normal) setting. The only traps that are enabled
19496 are the ones that cannot be disabled in software (e.g., division by zero
19497 trap).
19498
19499 @item u
19500 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19501 as well.
19502
19503 @item su
19504 Like @samp{u}, but the instructions are marked to be safe for software
19505 completion (see Alpha architecture manual for details).
19506
19507 @item sui
19508 Like @samp{su}, but inexact traps are enabled as well.
19509 @end table
19510
19511 @item -mfp-rounding-mode=@var{rounding-mode}
19512 @opindex mfp-rounding-mode
19513 Selects the IEEE rounding mode. Other Alpha compilers call this option
19514 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19515 of:
19516
19517 @table @samp
19518 @item n
19519 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19520 the nearest machine number or towards the even machine number in case
19521 of a tie.
19522
19523 @item m
19524 Round towards minus infinity.
19525
19526 @item c
19527 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19528
19529 @item d
19530 Dynamic rounding mode. A field in the floating-point control register
19531 (@var{fpcr}, see Alpha architecture reference manual) controls the
19532 rounding mode in effect. The C library initializes this register for
19533 rounding towards plus infinity. Thus, unless your program modifies the
19534 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19535 @end table
19536
19537 @item -mtrap-precision=@var{trap-precision}
19538 @opindex mtrap-precision
19539 In the Alpha architecture, floating-point traps are imprecise. This
19540 means without software assistance it is impossible to recover from a
19541 floating trap and program execution normally needs to be terminated.
19542 GCC can generate code that can assist operating system trap handlers
19543 in determining the exact location that caused a floating-point trap.
19544 Depending on the requirements of an application, different levels of
19545 precisions can be selected:
19546
19547 @table @samp
19548 @item p
19549 Program precision. This option is the default and means a trap handler
19550 can only identify which program caused a floating-point exception.
19551
19552 @item f
19553 Function precision. The trap handler can determine the function that
19554 caused a floating-point exception.
19555
19556 @item i
19557 Instruction precision. The trap handler can determine the exact
19558 instruction that caused a floating-point exception.
19559 @end table
19560
19561 Other Alpha compilers provide the equivalent options called
19562 @option{-scope_safe} and @option{-resumption_safe}.
19563
19564 @item -mieee-conformant
19565 @opindex mieee-conformant
19566 This option marks the generated code as IEEE conformant. You must not
19567 use this option unless you also specify @option{-mtrap-precision=i} and either
19568 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19569 is to emit the line @samp{.eflag 48} in the function prologue of the
19570 generated assembly file.
19571
19572 @item -mbuild-constants
19573 @opindex mbuild-constants
19574 Normally GCC examines a 32- or 64-bit integer constant to
19575 see if it can construct it from smaller constants in two or three
19576 instructions. If it cannot, it outputs the constant as a literal and
19577 generates code to load it from the data segment at run time.
19578
19579 Use this option to require GCC to construct @emph{all} integer constants
19580 using code, even if it takes more instructions (the maximum is six).
19581
19582 You typically use this option to build a shared library dynamic
19583 loader. Itself a shared library, it must relocate itself in memory
19584 before it can find the variables and constants in its own data segment.
19585
19586 @item -mbwx
19587 @itemx -mno-bwx
19588 @itemx -mcix
19589 @itemx -mno-cix
19590 @itemx -mfix
19591 @itemx -mno-fix
19592 @itemx -mmax
19593 @itemx -mno-max
19594 @opindex mbwx
19595 @opindex mno-bwx
19596 @opindex mcix
19597 @opindex mno-cix
19598 @opindex mfix
19599 @opindex mno-fix
19600 @opindex mmax
19601 @opindex mno-max
19602 Indicate whether GCC should generate code to use the optional BWX,
19603 CIX, FIX and MAX instruction sets. The default is to use the instruction
19604 sets supported by the CPU type specified via @option{-mcpu=} option or that
19605 of the CPU on which GCC was built if none is specified.
19606
19607 @item -mfloat-vax
19608 @itemx -mfloat-ieee
19609 @opindex mfloat-vax
19610 @opindex mfloat-ieee
19611 Generate code that uses (does not use) VAX F and G floating-point
19612 arithmetic instead of IEEE single and double precision.
19613
19614 @item -mexplicit-relocs
19615 @itemx -mno-explicit-relocs
19616 @opindex mexplicit-relocs
19617 @opindex mno-explicit-relocs
19618 Older Alpha assemblers provided no way to generate symbol relocations
19619 except via assembler macros. Use of these macros does not allow
19620 optimal instruction scheduling. GNU binutils as of version 2.12
19621 supports a new syntax that allows the compiler to explicitly mark
19622 which relocations should apply to which instructions. This option
19623 is mostly useful for debugging, as GCC detects the capabilities of
19624 the assembler when it is built and sets the default accordingly.
19625
19626 @item -msmall-data
19627 @itemx -mlarge-data
19628 @opindex msmall-data
19629 @opindex mlarge-data
19630 When @option{-mexplicit-relocs} is in effect, static data is
19631 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19632 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19633 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19634 16-bit relocations off of the @code{$gp} register. This limits the
19635 size of the small data area to 64KB, but allows the variables to be
19636 directly accessed via a single instruction.
19637
19638 The default is @option{-mlarge-data}. With this option the data area
19639 is limited to just below 2GB@. Programs that require more than 2GB of
19640 data must use @code{malloc} or @code{mmap} to allocate the data in the
19641 heap instead of in the program's data segment.
19642
19643 When generating code for shared libraries, @option{-fpic} implies
19644 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19645
19646 @item -msmall-text
19647 @itemx -mlarge-text
19648 @opindex msmall-text
19649 @opindex mlarge-text
19650 When @option{-msmall-text} is used, the compiler assumes that the
19651 code of the entire program (or shared library) fits in 4MB, and is
19652 thus reachable with a branch instruction. When @option{-msmall-data}
19653 is used, the compiler can assume that all local symbols share the
19654 same @code{$gp} value, and thus reduce the number of instructions
19655 required for a function call from 4 to 1.
19656
19657 The default is @option{-mlarge-text}.
19658
19659 @item -mcpu=@var{cpu_type}
19660 @opindex mcpu
19661 Set the instruction set and instruction scheduling parameters for
19662 machine type @var{cpu_type}. You can specify either the @samp{EV}
19663 style name or the corresponding chip number. GCC supports scheduling
19664 parameters for the EV4, EV5 and EV6 family of processors and
19665 chooses the default values for the instruction set from the processor
19666 you specify. If you do not specify a processor type, GCC defaults
19667 to the processor on which the compiler was built.
19668
19669 Supported values for @var{cpu_type} are
19670
19671 @table @samp
19672 @item ev4
19673 @itemx ev45
19674 @itemx 21064
19675 Schedules as an EV4 and has no instruction set extensions.
19676
19677 @item ev5
19678 @itemx 21164
19679 Schedules as an EV5 and has no instruction set extensions.
19680
19681 @item ev56
19682 @itemx 21164a
19683 Schedules as an EV5 and supports the BWX extension.
19684
19685 @item pca56
19686 @itemx 21164pc
19687 @itemx 21164PC
19688 Schedules as an EV5 and supports the BWX and MAX extensions.
19689
19690 @item ev6
19691 @itemx 21264
19692 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19693
19694 @item ev67
19695 @itemx 21264a
19696 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19697 @end table
19698
19699 Native toolchains also support the value @samp{native},
19700 which selects the best architecture option for the host processor.
19701 @option{-mcpu=native} has no effect if GCC does not recognize
19702 the processor.
19703
19704 @item -mtune=@var{cpu_type}
19705 @opindex mtune
19706 Set only the instruction scheduling parameters for machine type
19707 @var{cpu_type}. The instruction set is not changed.
19708
19709 Native toolchains also support the value @samp{native},
19710 which selects the best architecture option for the host processor.
19711 @option{-mtune=native} has no effect if GCC does not recognize
19712 the processor.
19713
19714 @item -mmemory-latency=@var{time}
19715 @opindex mmemory-latency
19716 Sets the latency the scheduler should assume for typical memory
19717 references as seen by the application. This number is highly
19718 dependent on the memory access patterns used by the application
19719 and the size of the external cache on the machine.
19720
19721 Valid options for @var{time} are
19722
19723 @table @samp
19724 @item @var{number}
19725 A decimal number representing clock cycles.
19726
19727 @item L1
19728 @itemx L2
19729 @itemx L3
19730 @itemx main
19731 The compiler contains estimates of the number of clock cycles for
19732 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19733 (also called Dcache, Scache, and Bcache), as well as to main memory.
19734 Note that L3 is only valid for EV5.
19735
19736 @end table
19737 @end table
19738
19739 @node FR30 Options
19740 @subsection FR30 Options
19741 @cindex FR30 Options
19742
19743 These options are defined specifically for the FR30 port.
19744
19745 @table @gcctabopt
19746
19747 @item -msmall-model
19748 @opindex msmall-model
19749 Use the small address space model. This can produce smaller code, but
19750 it does assume that all symbolic values and addresses fit into a
19751 20-bit range.
19752
19753 @item -mno-lsim
19754 @opindex mno-lsim
19755 Assume that runtime support has been provided and so there is no need
19756 to include the simulator library (@file{libsim.a}) on the linker
19757 command line.
19758
19759 @end table
19760
19761 @node FT32 Options
19762 @subsection FT32 Options
19763 @cindex FT32 Options
19764
19765 These options are defined specifically for the FT32 port.
19766
19767 @table @gcctabopt
19768
19769 @item -msim
19770 @opindex msim
19771 Specifies that the program will be run on the simulator. This causes
19772 an alternate runtime startup and library to be linked.
19773 You must not use this option when generating programs that will run on
19774 real hardware; you must provide your own runtime library for whatever
19775 I/O functions are needed.
19776
19777 @item -mlra
19778 @opindex mlra
19779 Enable Local Register Allocation. This is still experimental for FT32,
19780 so by default the compiler uses standard reload.
19781
19782 @item -mnodiv
19783 @opindex mnodiv
19784 Do not use div and mod instructions.
19785
19786 @item -mft32b
19787 @opindex mft32b
19788 Enable use of the extended instructions of the FT32B processor.
19789
19790 @item -mcompress
19791 @opindex mcompress
19792 Compress all code using the Ft32B code compression scheme.
19793
19794 @item -mnopm
19795 @opindex mnopm
19796 Do not generate code that reads program memory.
19797
19798 @end table
19799
19800 @node FRV Options
19801 @subsection FRV Options
19802 @cindex FRV Options
19803
19804 @table @gcctabopt
19805 @item -mgpr-32
19806 @opindex mgpr-32
19807
19808 Only use the first 32 general-purpose registers.
19809
19810 @item -mgpr-64
19811 @opindex mgpr-64
19812
19813 Use all 64 general-purpose registers.
19814
19815 @item -mfpr-32
19816 @opindex mfpr-32
19817
19818 Use only the first 32 floating-point registers.
19819
19820 @item -mfpr-64
19821 @opindex mfpr-64
19822
19823 Use all 64 floating-point registers.
19824
19825 @item -mhard-float
19826 @opindex mhard-float
19827
19828 Use hardware instructions for floating-point operations.
19829
19830 @item -msoft-float
19831 @opindex msoft-float
19832
19833 Use library routines for floating-point operations.
19834
19835 @item -malloc-cc
19836 @opindex malloc-cc
19837
19838 Dynamically allocate condition code registers.
19839
19840 @item -mfixed-cc
19841 @opindex mfixed-cc
19842
19843 Do not try to dynamically allocate condition code registers, only
19844 use @code{icc0} and @code{fcc0}.
19845
19846 @item -mdword
19847 @opindex mdword
19848
19849 Change ABI to use double word insns.
19850
19851 @item -mno-dword
19852 @opindex mno-dword
19853 @opindex mdword
19854
19855 Do not use double word instructions.
19856
19857 @item -mdouble
19858 @opindex mdouble
19859
19860 Use floating-point double instructions.
19861
19862 @item -mno-double
19863 @opindex mno-double
19864
19865 Do not use floating-point double instructions.
19866
19867 @item -mmedia
19868 @opindex mmedia
19869
19870 Use media instructions.
19871
19872 @item -mno-media
19873 @opindex mno-media
19874
19875 Do not use media instructions.
19876
19877 @item -mmuladd
19878 @opindex mmuladd
19879
19880 Use multiply and add/subtract instructions.
19881
19882 @item -mno-muladd
19883 @opindex mno-muladd
19884
19885 Do not use multiply and add/subtract instructions.
19886
19887 @item -mfdpic
19888 @opindex mfdpic
19889
19890 Select the FDPIC ABI, which uses function descriptors to represent
19891 pointers to functions. Without any PIC/PIE-related options, it
19892 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19893 assumes GOT entries and small data are within a 12-bit range from the
19894 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19895 are computed with 32 bits.
19896 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19897
19898 @item -minline-plt
19899 @opindex minline-plt
19900
19901 Enable inlining of PLT entries in function calls to functions that are
19902 not known to bind locally. It has no effect without @option{-mfdpic}.
19903 It's enabled by default if optimizing for speed and compiling for
19904 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19905 optimization option such as @option{-O3} or above is present in the
19906 command line.
19907
19908 @item -mTLS
19909 @opindex mTLS
19910
19911 Assume a large TLS segment when generating thread-local code.
19912
19913 @item -mtls
19914 @opindex mtls
19915
19916 Do not assume a large TLS segment when generating thread-local code.
19917
19918 @item -mgprel-ro
19919 @opindex mgprel-ro
19920
19921 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19922 that is known to be in read-only sections. It's enabled by default,
19923 except for @option{-fpic} or @option{-fpie}: even though it may help
19924 make the global offset table smaller, it trades 1 instruction for 4.
19925 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19926 one of which may be shared by multiple symbols, and it avoids the need
19927 for a GOT entry for the referenced symbol, so it's more likely to be a
19928 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19929
19930 @item -multilib-library-pic
19931 @opindex multilib-library-pic
19932
19933 Link with the (library, not FD) pic libraries. It's implied by
19934 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19935 @option{-fpic} without @option{-mfdpic}. You should never have to use
19936 it explicitly.
19937
19938 @item -mlinked-fp
19939 @opindex mlinked-fp
19940
19941 Follow the EABI requirement of always creating a frame pointer whenever
19942 a stack frame is allocated. This option is enabled by default and can
19943 be disabled with @option{-mno-linked-fp}.
19944
19945 @item -mlong-calls
19946 @opindex mlong-calls
19947
19948 Use indirect addressing to call functions outside the current
19949 compilation unit. This allows the functions to be placed anywhere
19950 within the 32-bit address space.
19951
19952 @item -malign-labels
19953 @opindex malign-labels
19954
19955 Try to align labels to an 8-byte boundary by inserting NOPs into the
19956 previous packet. This option only has an effect when VLIW packing
19957 is enabled. It doesn't create new packets; it merely adds NOPs to
19958 existing ones.
19959
19960 @item -mlibrary-pic
19961 @opindex mlibrary-pic
19962
19963 Generate position-independent EABI code.
19964
19965 @item -macc-4
19966 @opindex macc-4
19967
19968 Use only the first four media accumulator registers.
19969
19970 @item -macc-8
19971 @opindex macc-8
19972
19973 Use all eight media accumulator registers.
19974
19975 @item -mpack
19976 @opindex mpack
19977
19978 Pack VLIW instructions.
19979
19980 @item -mno-pack
19981 @opindex mno-pack
19982
19983 Do not pack VLIW instructions.
19984
19985 @item -mno-eflags
19986 @opindex mno-eflags
19987
19988 Do not mark ABI switches in e_flags.
19989
19990 @item -mcond-move
19991 @opindex mcond-move
19992
19993 Enable the use of conditional-move instructions (default).
19994
19995 This switch is mainly for debugging the compiler and will likely be removed
19996 in a future version.
19997
19998 @item -mno-cond-move
19999 @opindex mno-cond-move
20000
20001 Disable the use of conditional-move instructions.
20002
20003 This switch is mainly for debugging the compiler and will likely be removed
20004 in a future version.
20005
20006 @item -mscc
20007 @opindex mscc
20008
20009 Enable the use of conditional set instructions (default).
20010
20011 This switch is mainly for debugging the compiler and will likely be removed
20012 in a future version.
20013
20014 @item -mno-scc
20015 @opindex mno-scc
20016
20017 Disable the use of conditional set instructions.
20018
20019 This switch is mainly for debugging the compiler and will likely be removed
20020 in a future version.
20021
20022 @item -mcond-exec
20023 @opindex mcond-exec
20024
20025 Enable the use of conditional execution (default).
20026
20027 This switch is mainly for debugging the compiler and will likely be removed
20028 in a future version.
20029
20030 @item -mno-cond-exec
20031 @opindex mno-cond-exec
20032
20033 Disable the use of conditional execution.
20034
20035 This switch is mainly for debugging the compiler and will likely be removed
20036 in a future version.
20037
20038 @item -mvliw-branch
20039 @opindex mvliw-branch
20040
20041 Run a pass to pack branches into VLIW instructions (default).
20042
20043 This switch is mainly for debugging the compiler and will likely be removed
20044 in a future version.
20045
20046 @item -mno-vliw-branch
20047 @opindex mno-vliw-branch
20048
20049 Do not run a pass to pack branches into VLIW instructions.
20050
20051 This switch is mainly for debugging the compiler and will likely be removed
20052 in a future version.
20053
20054 @item -mmulti-cond-exec
20055 @opindex mmulti-cond-exec
20056
20057 Enable optimization of @code{&&} and @code{||} in conditional execution
20058 (default).
20059
20060 This switch is mainly for debugging the compiler and will likely be removed
20061 in a future version.
20062
20063 @item -mno-multi-cond-exec
20064 @opindex mno-multi-cond-exec
20065
20066 Disable optimization of @code{&&} and @code{||} in conditional execution.
20067
20068 This switch is mainly for debugging the compiler and will likely be removed
20069 in a future version.
20070
20071 @item -mnested-cond-exec
20072 @opindex mnested-cond-exec
20073
20074 Enable nested conditional execution optimizations (default).
20075
20076 This switch is mainly for debugging the compiler and will likely be removed
20077 in a future version.
20078
20079 @item -mno-nested-cond-exec
20080 @opindex mno-nested-cond-exec
20081
20082 Disable nested conditional execution optimizations.
20083
20084 This switch is mainly for debugging the compiler and will likely be removed
20085 in a future version.
20086
20087 @item -moptimize-membar
20088 @opindex moptimize-membar
20089
20090 This switch removes redundant @code{membar} instructions from the
20091 compiler-generated code. It is enabled by default.
20092
20093 @item -mno-optimize-membar
20094 @opindex mno-optimize-membar
20095 @opindex moptimize-membar
20096
20097 This switch disables the automatic removal of redundant @code{membar}
20098 instructions from the generated code.
20099
20100 @item -mtomcat-stats
20101 @opindex mtomcat-stats
20102
20103 Cause gas to print out tomcat statistics.
20104
20105 @item -mcpu=@var{cpu}
20106 @opindex mcpu
20107
20108 Select the processor type for which to generate code. Possible values are
20109 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20110 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20111
20112 @end table
20113
20114 @node GNU/Linux Options
20115 @subsection GNU/Linux Options
20116
20117 These @samp{-m} options are defined for GNU/Linux targets:
20118
20119 @table @gcctabopt
20120 @item -mglibc
20121 @opindex mglibc
20122 Use the GNU C library. This is the default except
20123 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20124 @samp{*-*-linux-*android*} targets.
20125
20126 @item -muclibc
20127 @opindex muclibc
20128 Use uClibc C library. This is the default on
20129 @samp{*-*-linux-*uclibc*} targets.
20130
20131 @item -mmusl
20132 @opindex mmusl
20133 Use the musl C library. This is the default on
20134 @samp{*-*-linux-*musl*} targets.
20135
20136 @item -mbionic
20137 @opindex mbionic
20138 Use Bionic C library. This is the default on
20139 @samp{*-*-linux-*android*} targets.
20140
20141 @item -mandroid
20142 @opindex mandroid
20143 Compile code compatible with Android platform. This is the default on
20144 @samp{*-*-linux-*android*} targets.
20145
20146 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20147 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20148 this option makes the GCC driver pass Android-specific options to the linker.
20149 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20150 to be defined.
20151
20152 @item -tno-android-cc
20153 @opindex tno-android-cc
20154 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20155 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20156 @option{-fno-rtti} by default.
20157
20158 @item -tno-android-ld
20159 @opindex tno-android-ld
20160 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20161 linking options to the linker.
20162
20163 @end table
20164
20165 @node H8/300 Options
20166 @subsection H8/300 Options
20167
20168 These @samp{-m} options are defined for the H8/300 implementations:
20169
20170 @table @gcctabopt
20171 @item -mrelax
20172 @opindex mrelax
20173 Shorten some address references at link time, when possible; uses the
20174 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20175 ld, Using ld}, for a fuller description.
20176
20177 @item -mh
20178 @opindex mh
20179 Generate code for the H8/300H@.
20180
20181 @item -ms
20182 @opindex ms
20183 Generate code for the H8S@.
20184
20185 @item -mn
20186 @opindex mn
20187 Generate code for the H8S and H8/300H in the normal mode. This switch
20188 must be used either with @option{-mh} or @option{-ms}.
20189
20190 @item -ms2600
20191 @opindex ms2600
20192 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20193
20194 @item -mexr
20195 @opindex mexr
20196 Extended registers are stored on stack before execution of function
20197 with monitor attribute. Default option is @option{-mexr}.
20198 This option is valid only for H8S targets.
20199
20200 @item -mno-exr
20201 @opindex mno-exr
20202 @opindex mexr
20203 Extended registers are not stored on stack before execution of function
20204 with monitor attribute. Default option is @option{-mno-exr}.
20205 This option is valid only for H8S targets.
20206
20207 @item -mint32
20208 @opindex mint32
20209 Make @code{int} data 32 bits by default.
20210
20211 @item -malign-300
20212 @opindex malign-300
20213 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20214 The default for the H8/300H and H8S is to align longs and floats on
20215 4-byte boundaries.
20216 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20217 This option has no effect on the H8/300.
20218 @end table
20219
20220 @node HPPA Options
20221 @subsection HPPA Options
20222 @cindex HPPA Options
20223
20224 These @samp{-m} options are defined for the HPPA family of computers:
20225
20226 @table @gcctabopt
20227 @item -march=@var{architecture-type}
20228 @opindex march
20229 Generate code for the specified architecture. The choices for
20230 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20231 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20232 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20233 architecture option for your machine. Code compiled for lower numbered
20234 architectures runs on higher numbered architectures, but not the
20235 other way around.
20236
20237 @item -mpa-risc-1-0
20238 @itemx -mpa-risc-1-1
20239 @itemx -mpa-risc-2-0
20240 @opindex mpa-risc-1-0
20241 @opindex mpa-risc-1-1
20242 @opindex mpa-risc-2-0
20243 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20244
20245 @item -mcaller-copies
20246 @opindex mcaller-copies
20247 The caller copies function arguments passed by hidden reference. This
20248 option should be used with care as it is not compatible with the default
20249 32-bit runtime. However, only aggregates larger than eight bytes are
20250 passed by hidden reference and the option provides better compatibility
20251 with OpenMP.
20252
20253 @item -mjump-in-delay
20254 @opindex mjump-in-delay
20255 This option is ignored and provided for compatibility purposes only.
20256
20257 @item -mdisable-fpregs
20258 @opindex mdisable-fpregs
20259 Prevent floating-point registers from being used in any manner. This is
20260 necessary for compiling kernels that perform lazy context switching of
20261 floating-point registers. If you use this option and attempt to perform
20262 floating-point operations, the compiler aborts.
20263
20264 @item -mdisable-indexing
20265 @opindex mdisable-indexing
20266 Prevent the compiler from using indexing address modes. This avoids some
20267 rather obscure problems when compiling MIG generated code under MACH@.
20268
20269 @item -mno-space-regs
20270 @opindex mno-space-regs
20271 @opindex mspace-regs
20272 Generate code that assumes the target has no space registers. This allows
20273 GCC to generate faster indirect calls and use unscaled index address modes.
20274
20275 Such code is suitable for level 0 PA systems and kernels.
20276
20277 @item -mfast-indirect-calls
20278 @opindex mfast-indirect-calls
20279 Generate code that assumes calls never cross space boundaries. This
20280 allows GCC to emit code that performs faster indirect calls.
20281
20282 This option does not work in the presence of shared libraries or nested
20283 functions.
20284
20285 @item -mfixed-range=@var{register-range}
20286 @opindex mfixed-range
20287 Generate code treating the given register range as fixed registers.
20288 A fixed register is one that the register allocator cannot use. This is
20289 useful when compiling kernel code. A register range is specified as
20290 two registers separated by a dash. Multiple register ranges can be
20291 specified separated by a comma.
20292
20293 @item -mlong-load-store
20294 @opindex mlong-load-store
20295 Generate 3-instruction load and store sequences as sometimes required by
20296 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20297 the HP compilers.
20298
20299 @item -mportable-runtime
20300 @opindex mportable-runtime
20301 Use the portable calling conventions proposed by HP for ELF systems.
20302
20303 @item -mgas
20304 @opindex mgas
20305 Enable the use of assembler directives only GAS understands.
20306
20307 @item -mschedule=@var{cpu-type}
20308 @opindex mschedule
20309 Schedule code according to the constraints for the machine type
20310 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20311 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20312 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20313 proper scheduling option for your machine. The default scheduling is
20314 @samp{8000}.
20315
20316 @item -mlinker-opt
20317 @opindex mlinker-opt
20318 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20319 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20320 linkers in which they give bogus error messages when linking some programs.
20321
20322 @item -msoft-float
20323 @opindex msoft-float
20324 Generate output containing library calls for floating point.
20325 @strong{Warning:} the requisite libraries are not available for all HPPA
20326 targets. Normally the facilities of the machine's usual C compiler are
20327 used, but this cannot be done directly in cross-compilation. You must make
20328 your own arrangements to provide suitable library functions for
20329 cross-compilation.
20330
20331 @option{-msoft-float} changes the calling convention in the output file;
20332 therefore, it is only useful if you compile @emph{all} of a program with
20333 this option. In particular, you need to compile @file{libgcc.a}, the
20334 library that comes with GCC, with @option{-msoft-float} in order for
20335 this to work.
20336
20337 @item -msio
20338 @opindex msio
20339 Generate the predefine, @code{_SIO}, for server IO@. The default is
20340 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20341 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20342 options are available under HP-UX and HI-UX@.
20343
20344 @item -mgnu-ld
20345 @opindex mgnu-ld
20346 Use options specific to GNU @command{ld}.
20347 This passes @option{-shared} to @command{ld} when
20348 building a shared library. It is the default when GCC is configured,
20349 explicitly or implicitly, with the GNU linker. This option does not
20350 affect which @command{ld} is called; it only changes what parameters
20351 are passed to that @command{ld}.
20352 The @command{ld} that is called is determined by the
20353 @option{--with-ld} configure option, GCC's program search path, and
20354 finally by the user's @env{PATH}. The linker used by GCC can be printed
20355 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20356 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20357
20358 @item -mhp-ld
20359 @opindex mhp-ld
20360 Use options specific to HP @command{ld}.
20361 This passes @option{-b} to @command{ld} when building
20362 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20363 links. It is the default when GCC is configured, explicitly or
20364 implicitly, with the HP linker. This option does not affect
20365 which @command{ld} is called; it only changes what parameters are passed to that
20366 @command{ld}.
20367 The @command{ld} that is called is determined by the @option{--with-ld}
20368 configure option, GCC's program search path, and finally by the user's
20369 @env{PATH}. The linker used by GCC can be printed using @samp{which
20370 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20371 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20372
20373 @item -mlong-calls
20374 @opindex mno-long-calls
20375 @opindex mlong-calls
20376 Generate code that uses long call sequences. This ensures that a call
20377 is always able to reach linker generated stubs. The default is to generate
20378 long calls only when the distance from the call site to the beginning
20379 of the function or translation unit, as the case may be, exceeds a
20380 predefined limit set by the branch type being used. The limits for
20381 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20382 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20383 240,000 bytes.
20384
20385 Distances are measured from the beginning of functions when using the
20386 @option{-ffunction-sections} option, or when using the @option{-mgas}
20387 and @option{-mno-portable-runtime} options together under HP-UX with
20388 the SOM linker.
20389
20390 It is normally not desirable to use this option as it degrades
20391 performance. However, it may be useful in large applications,
20392 particularly when partial linking is used to build the application.
20393
20394 The types of long calls used depends on the capabilities of the
20395 assembler and linker, and the type of code being generated. The
20396 impact on systems that support long absolute calls, and long pic
20397 symbol-difference or pc-relative calls should be relatively small.
20398 However, an indirect call is used on 32-bit ELF systems in pic code
20399 and it is quite long.
20400
20401 @item -munix=@var{unix-std}
20402 @opindex march
20403 Generate compiler predefines and select a startfile for the specified
20404 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20405 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20406 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20407 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20408 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20409 and later.
20410
20411 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20412 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20413 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20414 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20415 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20416 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20417
20418 It is @emph{important} to note that this option changes the interfaces
20419 for various library routines. It also affects the operational behavior
20420 of the C library. Thus, @emph{extreme} care is needed in using this
20421 option.
20422
20423 Library code that is intended to operate with more than one UNIX
20424 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20425 as appropriate. Most GNU software doesn't provide this capability.
20426
20427 @item -nolibdld
20428 @opindex nolibdld
20429 Suppress the generation of link options to search libdld.sl when the
20430 @option{-static} option is specified on HP-UX 10 and later.
20431
20432 @item -static
20433 @opindex static
20434 The HP-UX implementation of setlocale in libc has a dependency on
20435 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20436 when the @option{-static} option is specified, special link options
20437 are needed to resolve this dependency.
20438
20439 On HP-UX 10 and later, the GCC driver adds the necessary options to
20440 link with libdld.sl when the @option{-static} option is specified.
20441 This causes the resulting binary to be dynamic. On the 64-bit port,
20442 the linkers generate dynamic binaries by default in any case. The
20443 @option{-nolibdld} option can be used to prevent the GCC driver from
20444 adding these link options.
20445
20446 @item -threads
20447 @opindex threads
20448 Add support for multithreading with the @dfn{dce thread} library
20449 under HP-UX@. This option sets flags for both the preprocessor and
20450 linker.
20451 @end table
20452
20453 @node IA-64 Options
20454 @subsection IA-64 Options
20455 @cindex IA-64 Options
20456
20457 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20458
20459 @table @gcctabopt
20460 @item -mbig-endian
20461 @opindex mbig-endian
20462 Generate code for a big-endian target. This is the default for HP-UX@.
20463
20464 @item -mlittle-endian
20465 @opindex mlittle-endian
20466 Generate code for a little-endian target. This is the default for AIX5
20467 and GNU/Linux.
20468
20469 @item -mgnu-as
20470 @itemx -mno-gnu-as
20471 @opindex mgnu-as
20472 @opindex mno-gnu-as
20473 Generate (or don't) code for the GNU assembler. This is the default.
20474 @c Also, this is the default if the configure option @option{--with-gnu-as}
20475 @c is used.
20476
20477 @item -mgnu-ld
20478 @itemx -mno-gnu-ld
20479 @opindex mgnu-ld
20480 @opindex mno-gnu-ld
20481 Generate (or don't) code for the GNU linker. This is the default.
20482 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20483 @c is used.
20484
20485 @item -mno-pic
20486 @opindex mno-pic
20487 Generate code that does not use a global pointer register. The result
20488 is not position independent code, and violates the IA-64 ABI@.
20489
20490 @item -mvolatile-asm-stop
20491 @itemx -mno-volatile-asm-stop
20492 @opindex mvolatile-asm-stop
20493 @opindex mno-volatile-asm-stop
20494 Generate (or don't) a stop bit immediately before and after volatile asm
20495 statements.
20496
20497 @item -mregister-names
20498 @itemx -mno-register-names
20499 @opindex mregister-names
20500 @opindex mno-register-names
20501 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20502 the stacked registers. This may make assembler output more readable.
20503
20504 @item -mno-sdata
20505 @itemx -msdata
20506 @opindex mno-sdata
20507 @opindex msdata
20508 Disable (or enable) optimizations that use the small data section. This may
20509 be useful for working around optimizer bugs.
20510
20511 @item -mconstant-gp
20512 @opindex mconstant-gp
20513 Generate code that uses a single constant global pointer value. This is
20514 useful when compiling kernel code.
20515
20516 @item -mauto-pic
20517 @opindex mauto-pic
20518 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20519 This is useful when compiling firmware code.
20520
20521 @item -minline-float-divide-min-latency
20522 @opindex minline-float-divide-min-latency
20523 Generate code for inline divides of floating-point values
20524 using the minimum latency algorithm.
20525
20526 @item -minline-float-divide-max-throughput
20527 @opindex minline-float-divide-max-throughput
20528 Generate code for inline divides of floating-point values
20529 using the maximum throughput algorithm.
20530
20531 @item -mno-inline-float-divide
20532 @opindex mno-inline-float-divide
20533 Do not generate inline code for divides of floating-point values.
20534
20535 @item -minline-int-divide-min-latency
20536 @opindex minline-int-divide-min-latency
20537 Generate code for inline divides of integer values
20538 using the minimum latency algorithm.
20539
20540 @item -minline-int-divide-max-throughput
20541 @opindex minline-int-divide-max-throughput
20542 Generate code for inline divides of integer values
20543 using the maximum throughput algorithm.
20544
20545 @item -mno-inline-int-divide
20546 @opindex mno-inline-int-divide
20547 @opindex minline-int-divide
20548 Do not generate inline code for divides of integer values.
20549
20550 @item -minline-sqrt-min-latency
20551 @opindex minline-sqrt-min-latency
20552 Generate code for inline square roots
20553 using the minimum latency algorithm.
20554
20555 @item -minline-sqrt-max-throughput
20556 @opindex minline-sqrt-max-throughput
20557 Generate code for inline square roots
20558 using the maximum throughput algorithm.
20559
20560 @item -mno-inline-sqrt
20561 @opindex mno-inline-sqrt
20562 Do not generate inline code for @code{sqrt}.
20563
20564 @item -mfused-madd
20565 @itemx -mno-fused-madd
20566 @opindex mfused-madd
20567 @opindex mno-fused-madd
20568 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20569 instructions. The default is to use these instructions.
20570
20571 @item -mno-dwarf2-asm
20572 @itemx -mdwarf2-asm
20573 @opindex mno-dwarf2-asm
20574 @opindex mdwarf2-asm
20575 Don't (or do) generate assembler code for the DWARF line number debugging
20576 info. This may be useful when not using the GNU assembler.
20577
20578 @item -mearly-stop-bits
20579 @itemx -mno-early-stop-bits
20580 @opindex mearly-stop-bits
20581 @opindex mno-early-stop-bits
20582 Allow stop bits to be placed earlier than immediately preceding the
20583 instruction that triggered the stop bit. This can improve instruction
20584 scheduling, but does not always do so.
20585
20586 @item -mfixed-range=@var{register-range}
20587 @opindex mfixed-range
20588 Generate code treating the given register range as fixed registers.
20589 A fixed register is one that the register allocator cannot use. This is
20590 useful when compiling kernel code. A register range is specified as
20591 two registers separated by a dash. Multiple register ranges can be
20592 specified separated by a comma.
20593
20594 @item -mtls-size=@var{tls-size}
20595 @opindex mtls-size
20596 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20597 64.
20598
20599 @item -mtune=@var{cpu-type}
20600 @opindex mtune
20601 Tune the instruction scheduling for a particular CPU, Valid values are
20602 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20603 and @samp{mckinley}.
20604
20605 @item -milp32
20606 @itemx -mlp64
20607 @opindex milp32
20608 @opindex mlp64
20609 Generate code for a 32-bit or 64-bit environment.
20610 The 32-bit environment sets int, long and pointer to 32 bits.
20611 The 64-bit environment sets int to 32 bits and long and pointer
20612 to 64 bits. These are HP-UX specific flags.
20613
20614 @item -mno-sched-br-data-spec
20615 @itemx -msched-br-data-spec
20616 @opindex mno-sched-br-data-spec
20617 @opindex msched-br-data-spec
20618 (Dis/En)able data speculative scheduling before reload.
20619 This results in generation of @code{ld.a} instructions and
20620 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20621 The default setting is disabled.
20622
20623 @item -msched-ar-data-spec
20624 @itemx -mno-sched-ar-data-spec
20625 @opindex msched-ar-data-spec
20626 @opindex mno-sched-ar-data-spec
20627 (En/Dis)able data speculative scheduling after reload.
20628 This results in generation of @code{ld.a} instructions and
20629 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20630 The default setting is enabled.
20631
20632 @item -mno-sched-control-spec
20633 @itemx -msched-control-spec
20634 @opindex mno-sched-control-spec
20635 @opindex msched-control-spec
20636 (Dis/En)able control speculative scheduling. This feature is
20637 available only during region scheduling (i.e.@: before reload).
20638 This results in generation of the @code{ld.s} instructions and
20639 the corresponding check instructions @code{chk.s}.
20640 The default setting is disabled.
20641
20642 @item -msched-br-in-data-spec
20643 @itemx -mno-sched-br-in-data-spec
20644 @opindex msched-br-in-data-spec
20645 @opindex mno-sched-br-in-data-spec
20646 (En/Dis)able speculative scheduling of the instructions that
20647 are dependent on the data speculative loads before reload.
20648 This is effective only with @option{-msched-br-data-spec} enabled.
20649 The default setting is enabled.
20650
20651 @item -msched-ar-in-data-spec
20652 @itemx -mno-sched-ar-in-data-spec
20653 @opindex msched-ar-in-data-spec
20654 @opindex mno-sched-ar-in-data-spec
20655 (En/Dis)able speculative scheduling of the instructions that
20656 are dependent on the data speculative loads after reload.
20657 This is effective only with @option{-msched-ar-data-spec} enabled.
20658 The default setting is enabled.
20659
20660 @item -msched-in-control-spec
20661 @itemx -mno-sched-in-control-spec
20662 @opindex msched-in-control-spec
20663 @opindex mno-sched-in-control-spec
20664 (En/Dis)able speculative scheduling of the instructions that
20665 are dependent on the control speculative loads.
20666 This is effective only with @option{-msched-control-spec} enabled.
20667 The default setting is enabled.
20668
20669 @item -mno-sched-prefer-non-data-spec-insns
20670 @itemx -msched-prefer-non-data-spec-insns
20671 @opindex mno-sched-prefer-non-data-spec-insns
20672 @opindex msched-prefer-non-data-spec-insns
20673 If enabled, data-speculative instructions are chosen for schedule
20674 only if there are no other choices at the moment. This makes
20675 the use of the data speculation much more conservative.
20676 The default setting is disabled.
20677
20678 @item -mno-sched-prefer-non-control-spec-insns
20679 @itemx -msched-prefer-non-control-spec-insns
20680 @opindex mno-sched-prefer-non-control-spec-insns
20681 @opindex msched-prefer-non-control-spec-insns
20682 If enabled, control-speculative instructions are chosen for schedule
20683 only if there are no other choices at the moment. This makes
20684 the use of the control speculation much more conservative.
20685 The default setting is disabled.
20686
20687 @item -mno-sched-count-spec-in-critical-path
20688 @itemx -msched-count-spec-in-critical-path
20689 @opindex mno-sched-count-spec-in-critical-path
20690 @opindex msched-count-spec-in-critical-path
20691 If enabled, speculative dependencies are considered during
20692 computation of the instructions priorities. This makes the use of the
20693 speculation a bit more conservative.
20694 The default setting is disabled.
20695
20696 @item -msched-spec-ldc
20697 @opindex msched-spec-ldc
20698 Use a simple data speculation check. This option is on by default.
20699
20700 @item -msched-control-spec-ldc
20701 @opindex msched-spec-ldc
20702 Use a simple check for control speculation. This option is on by default.
20703
20704 @item -msched-stop-bits-after-every-cycle
20705 @opindex msched-stop-bits-after-every-cycle
20706 Place a stop bit after every cycle when scheduling. This option is on
20707 by default.
20708
20709 @item -msched-fp-mem-deps-zero-cost
20710 @opindex msched-fp-mem-deps-zero-cost
20711 Assume that floating-point stores and loads are not likely to cause a conflict
20712 when placed into the same instruction group. This option is disabled by
20713 default.
20714
20715 @item -msel-sched-dont-check-control-spec
20716 @opindex msel-sched-dont-check-control-spec
20717 Generate checks for control speculation in selective scheduling.
20718 This flag is disabled by default.
20719
20720 @item -msched-max-memory-insns=@var{max-insns}
20721 @opindex msched-max-memory-insns
20722 Limit on the number of memory insns per instruction group, giving lower
20723 priority to subsequent memory insns attempting to schedule in the same
20724 instruction group. Frequently useful to prevent cache bank conflicts.
20725 The default value is 1.
20726
20727 @item -msched-max-memory-insns-hard-limit
20728 @opindex msched-max-memory-insns-hard-limit
20729 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20730 disallowing more than that number in an instruction group.
20731 Otherwise, the limit is ``soft'', meaning that non-memory operations
20732 are preferred when the limit is reached, but memory operations may still
20733 be scheduled.
20734
20735 @end table
20736
20737 @node LM32 Options
20738 @subsection LM32 Options
20739 @cindex LM32 options
20740
20741 These @option{-m} options are defined for the LatticeMico32 architecture:
20742
20743 @table @gcctabopt
20744 @item -mbarrel-shift-enabled
20745 @opindex mbarrel-shift-enabled
20746 Enable barrel-shift instructions.
20747
20748 @item -mdivide-enabled
20749 @opindex mdivide-enabled
20750 Enable divide and modulus instructions.
20751
20752 @item -mmultiply-enabled
20753 @opindex multiply-enabled
20754 Enable multiply instructions.
20755
20756 @item -msign-extend-enabled
20757 @opindex msign-extend-enabled
20758 Enable sign extend instructions.
20759
20760 @item -muser-enabled
20761 @opindex muser-enabled
20762 Enable user-defined instructions.
20763
20764 @end table
20765
20766 @node M32C Options
20767 @subsection M32C Options
20768 @cindex M32C options
20769
20770 @table @gcctabopt
20771 @item -mcpu=@var{name}
20772 @opindex mcpu=
20773 Select the CPU for which code is generated. @var{name} may be one of
20774 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20775 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20776 the M32C/80 series.
20777
20778 @item -msim
20779 @opindex msim
20780 Specifies that the program will be run on the simulator. This causes
20781 an alternate runtime library to be linked in which supports, for
20782 example, file I/O@. You must not use this option when generating
20783 programs that will run on real hardware; you must provide your own
20784 runtime library for whatever I/O functions are needed.
20785
20786 @item -memregs=@var{number}
20787 @opindex memregs=
20788 Specifies the number of memory-based pseudo-registers GCC uses
20789 during code generation. These pseudo-registers are used like real
20790 registers, so there is a tradeoff between GCC's ability to fit the
20791 code into available registers, and the performance penalty of using
20792 memory instead of registers. Note that all modules in a program must
20793 be compiled with the same value for this option. Because of that, you
20794 must not use this option with GCC's default runtime libraries.
20795
20796 @end table
20797
20798 @node M32R/D Options
20799 @subsection M32R/D Options
20800 @cindex M32R/D options
20801
20802 These @option{-m} options are defined for Renesas M32R/D architectures:
20803
20804 @table @gcctabopt
20805 @item -m32r2
20806 @opindex m32r2
20807 Generate code for the M32R/2@.
20808
20809 @item -m32rx
20810 @opindex m32rx
20811 Generate code for the M32R/X@.
20812
20813 @item -m32r
20814 @opindex m32r
20815 Generate code for the M32R@. This is the default.
20816
20817 @item -mmodel=small
20818 @opindex mmodel=small
20819 Assume all objects live in the lower 16MB of memory (so that their addresses
20820 can be loaded with the @code{ld24} instruction), and assume all subroutines
20821 are reachable with the @code{bl} instruction.
20822 This is the default.
20823
20824 The addressability of a particular object can be set with the
20825 @code{model} attribute.
20826
20827 @item -mmodel=medium
20828 @opindex mmodel=medium
20829 Assume objects may be anywhere in the 32-bit address space (the compiler
20830 generates @code{seth/add3} instructions to load their addresses), and
20831 assume all subroutines are reachable with the @code{bl} instruction.
20832
20833 @item -mmodel=large
20834 @opindex mmodel=large
20835 Assume objects may be anywhere in the 32-bit address space (the compiler
20836 generates @code{seth/add3} instructions to load their addresses), and
20837 assume subroutines may not be reachable with the @code{bl} instruction
20838 (the compiler generates the much slower @code{seth/add3/jl}
20839 instruction sequence).
20840
20841 @item -msdata=none
20842 @opindex msdata=none
20843 Disable use of the small data area. Variables are put into
20844 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20845 @code{section} attribute has been specified).
20846 This is the default.
20847
20848 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20849 Objects may be explicitly put in the small data area with the
20850 @code{section} attribute using one of these sections.
20851
20852 @item -msdata=sdata
20853 @opindex msdata=sdata
20854 Put small global and static data in the small data area, but do not
20855 generate special code to reference them.
20856
20857 @item -msdata=use
20858 @opindex msdata=use
20859 Put small global and static data in the small data area, and generate
20860 special instructions to reference them.
20861
20862 @item -G @var{num}
20863 @opindex G
20864 @cindex smaller data references
20865 Put global and static objects less than or equal to @var{num} bytes
20866 into the small data or BSS sections instead of the normal data or BSS
20867 sections. The default value of @var{num} is 8.
20868 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20869 for this option to have any effect.
20870
20871 All modules should be compiled with the same @option{-G @var{num}} value.
20872 Compiling with different values of @var{num} may or may not work; if it
20873 doesn't the linker gives an error message---incorrect code is not
20874 generated.
20875
20876 @item -mdebug
20877 @opindex mdebug
20878 Makes the M32R-specific code in the compiler display some statistics
20879 that might help in debugging programs.
20880
20881 @item -malign-loops
20882 @opindex malign-loops
20883 Align all loops to a 32-byte boundary.
20884
20885 @item -mno-align-loops
20886 @opindex mno-align-loops
20887 Do not enforce a 32-byte alignment for loops. This is the default.
20888
20889 @item -missue-rate=@var{number}
20890 @opindex missue-rate=@var{number}
20891 Issue @var{number} instructions per cycle. @var{number} can only be 1
20892 or 2.
20893
20894 @item -mbranch-cost=@var{number}
20895 @opindex mbranch-cost=@var{number}
20896 @var{number} can only be 1 or 2. If it is 1 then branches are
20897 preferred over conditional code, if it is 2, then the opposite applies.
20898
20899 @item -mflush-trap=@var{number}
20900 @opindex mflush-trap=@var{number}
20901 Specifies the trap number to use to flush the cache. The default is
20902 12. Valid numbers are between 0 and 15 inclusive.
20903
20904 @item -mno-flush-trap
20905 @opindex mno-flush-trap
20906 Specifies that the cache cannot be flushed by using a trap.
20907
20908 @item -mflush-func=@var{name}
20909 @opindex mflush-func=@var{name}
20910 Specifies the name of the operating system function to call to flush
20911 the cache. The default is @samp{_flush_cache}, but a function call
20912 is only used if a trap is not available.
20913
20914 @item -mno-flush-func
20915 @opindex mno-flush-func
20916 Indicates that there is no OS function for flushing the cache.
20917
20918 @end table
20919
20920 @node M680x0 Options
20921 @subsection M680x0 Options
20922 @cindex M680x0 options
20923
20924 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20925 The default settings depend on which architecture was selected when
20926 the compiler was configured; the defaults for the most common choices
20927 are given below.
20928
20929 @table @gcctabopt
20930 @item -march=@var{arch}
20931 @opindex march
20932 Generate code for a specific M680x0 or ColdFire instruction set
20933 architecture. Permissible values of @var{arch} for M680x0
20934 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20935 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20936 architectures are selected according to Freescale's ISA classification
20937 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20938 @samp{isab} and @samp{isac}.
20939
20940 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20941 code for a ColdFire target. The @var{arch} in this macro is one of the
20942 @option{-march} arguments given above.
20943
20944 When used together, @option{-march} and @option{-mtune} select code
20945 that runs on a family of similar processors but that is optimized
20946 for a particular microarchitecture.
20947
20948 @item -mcpu=@var{cpu}
20949 @opindex mcpu
20950 Generate code for a specific M680x0 or ColdFire processor.
20951 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20952 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20953 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20954 below, which also classifies the CPUs into families:
20955
20956 @multitable @columnfractions 0.20 0.80
20957 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20958 @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}
20959 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20960 @item @samp{5206e} @tab @samp{5206e}
20961 @item @samp{5208} @tab @samp{5207} @samp{5208}
20962 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20963 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20964 @item @samp{5216} @tab @samp{5214} @samp{5216}
20965 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20966 @item @samp{5225} @tab @samp{5224} @samp{5225}
20967 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20968 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20969 @item @samp{5249} @tab @samp{5249}
20970 @item @samp{5250} @tab @samp{5250}
20971 @item @samp{5271} @tab @samp{5270} @samp{5271}
20972 @item @samp{5272} @tab @samp{5272}
20973 @item @samp{5275} @tab @samp{5274} @samp{5275}
20974 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20975 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20976 @item @samp{5307} @tab @samp{5307}
20977 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20978 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20979 @item @samp{5407} @tab @samp{5407}
20980 @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}
20981 @end multitable
20982
20983 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20984 @var{arch} is compatible with @var{cpu}. Other combinations of
20985 @option{-mcpu} and @option{-march} are rejected.
20986
20987 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20988 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20989 where the value of @var{family} is given by the table above.
20990
20991 @item -mtune=@var{tune}
20992 @opindex mtune
20993 Tune the code for a particular microarchitecture within the
20994 constraints set by @option{-march} and @option{-mcpu}.
20995 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20996 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20997 and @samp{cpu32}. The ColdFire microarchitectures
20998 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
20999
21000 You can also use @option{-mtune=68020-40} for code that needs
21001 to run relatively well on 68020, 68030 and 68040 targets.
21002 @option{-mtune=68020-60} is similar but includes 68060 targets
21003 as well. These two options select the same tuning decisions as
21004 @option{-m68020-40} and @option{-m68020-60} respectively.
21005
21006 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
21007 when tuning for 680x0 architecture @var{arch}. It also defines
21008 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
21009 option is used. If GCC is tuning for a range of architectures,
21010 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
21011 it defines the macros for every architecture in the range.
21012
21013 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
21014 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
21015 of the arguments given above.
21016
21017 @item -m68000
21018 @itemx -mc68000
21019 @opindex m68000
21020 @opindex mc68000
21021 Generate output for a 68000. This is the default
21022 when the compiler is configured for 68000-based systems.
21023 It is equivalent to @option{-march=68000}.
21024
21025 Use this option for microcontrollers with a 68000 or EC000 core,
21026 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21027
21028 @item -m68010
21029 @opindex m68010
21030 Generate output for a 68010. This is the default
21031 when the compiler is configured for 68010-based systems.
21032 It is equivalent to @option{-march=68010}.
21033
21034 @item -m68020
21035 @itemx -mc68020
21036 @opindex m68020
21037 @opindex mc68020
21038 Generate output for a 68020. This is the default
21039 when the compiler is configured for 68020-based systems.
21040 It is equivalent to @option{-march=68020}.
21041
21042 @item -m68030
21043 @opindex m68030
21044 Generate output for a 68030. This is the default when the compiler is
21045 configured for 68030-based systems. It is equivalent to
21046 @option{-march=68030}.
21047
21048 @item -m68040
21049 @opindex m68040
21050 Generate output for a 68040. This is the default when the compiler is
21051 configured for 68040-based systems. It is equivalent to
21052 @option{-march=68040}.
21053
21054 This option inhibits the use of 68881/68882 instructions that have to be
21055 emulated by software on the 68040. Use this option if your 68040 does not
21056 have code to emulate those instructions.
21057
21058 @item -m68060
21059 @opindex m68060
21060 Generate output for a 68060. This is the default when the compiler is
21061 configured for 68060-based systems. It is equivalent to
21062 @option{-march=68060}.
21063
21064 This option inhibits the use of 68020 and 68881/68882 instructions that
21065 have to be emulated by software on the 68060. Use this option if your 68060
21066 does not have code to emulate those instructions.
21067
21068 @item -mcpu32
21069 @opindex mcpu32
21070 Generate output for a CPU32. This is the default
21071 when the compiler is configured for CPU32-based systems.
21072 It is equivalent to @option{-march=cpu32}.
21073
21074 Use this option for microcontrollers with a
21075 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21076 68336, 68340, 68341, 68349 and 68360.
21077
21078 @item -m5200
21079 @opindex m5200
21080 Generate output for a 520X ColdFire CPU@. This is the default
21081 when the compiler is configured for 520X-based systems.
21082 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21083 in favor of that option.
21084
21085 Use this option for microcontroller with a 5200 core, including
21086 the MCF5202, MCF5203, MCF5204 and MCF5206.
21087
21088 @item -m5206e
21089 @opindex m5206e
21090 Generate output for a 5206e ColdFire CPU@. The option is now
21091 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21092
21093 @item -m528x
21094 @opindex m528x
21095 Generate output for a member of the ColdFire 528X family.
21096 The option is now deprecated in favor of the equivalent
21097 @option{-mcpu=528x}.
21098
21099 @item -m5307
21100 @opindex m5307
21101 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21102 in favor of the equivalent @option{-mcpu=5307}.
21103
21104 @item -m5407
21105 @opindex m5407
21106 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21107 in favor of the equivalent @option{-mcpu=5407}.
21108
21109 @item -mcfv4e
21110 @opindex mcfv4e
21111 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21112 This includes use of hardware floating-point instructions.
21113 The option is equivalent to @option{-mcpu=547x}, and is now
21114 deprecated in favor of that option.
21115
21116 @item -m68020-40
21117 @opindex m68020-40
21118 Generate output for a 68040, without using any of the new instructions.
21119 This results in code that can run relatively efficiently on either a
21120 68020/68881 or a 68030 or a 68040. The generated code does use the
21121 68881 instructions that are emulated on the 68040.
21122
21123 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21124
21125 @item -m68020-60
21126 @opindex m68020-60
21127 Generate output for a 68060, without using any of the new instructions.
21128 This results in code that can run relatively efficiently on either a
21129 68020/68881 or a 68030 or a 68040. The generated code does use the
21130 68881 instructions that are emulated on the 68060.
21131
21132 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21133
21134 @item -mhard-float
21135 @itemx -m68881
21136 @opindex mhard-float
21137 @opindex m68881
21138 Generate floating-point instructions. This is the default for 68020
21139 and above, and for ColdFire devices that have an FPU@. It defines the
21140 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21141 on ColdFire targets.
21142
21143 @item -msoft-float
21144 @opindex msoft-float
21145 Do not generate floating-point instructions; use library calls instead.
21146 This is the default for 68000, 68010, and 68832 targets. It is also
21147 the default for ColdFire devices that have no FPU.
21148
21149 @item -mdiv
21150 @itemx -mno-div
21151 @opindex mdiv
21152 @opindex mno-div
21153 Generate (do not generate) ColdFire hardware divide and remainder
21154 instructions. If @option{-march} is used without @option{-mcpu},
21155 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21156 architectures. Otherwise, the default is taken from the target CPU
21157 (either the default CPU, or the one specified by @option{-mcpu}). For
21158 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21159 @option{-mcpu=5206e}.
21160
21161 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21162
21163 @item -mshort
21164 @opindex mshort
21165 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21166 Additionally, parameters passed on the stack are also aligned to a
21167 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21168
21169 @item -mno-short
21170 @opindex mno-short
21171 Do not consider type @code{int} to be 16 bits wide. This is the default.
21172
21173 @item -mnobitfield
21174 @itemx -mno-bitfield
21175 @opindex mnobitfield
21176 @opindex mno-bitfield
21177 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21178 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21179
21180 @item -mbitfield
21181 @opindex mbitfield
21182 Do use the bit-field instructions. The @option{-m68020} option implies
21183 @option{-mbitfield}. This is the default if you use a configuration
21184 designed for a 68020.
21185
21186 @item -mrtd
21187 @opindex mrtd
21188 Use a different function-calling convention, in which functions
21189 that take a fixed number of arguments return with the @code{rtd}
21190 instruction, which pops their arguments while returning. This
21191 saves one instruction in the caller since there is no need to pop
21192 the arguments there.
21193
21194 This calling convention is incompatible with the one normally
21195 used on Unix, so you cannot use it if you need to call libraries
21196 compiled with the Unix compiler.
21197
21198 Also, you must provide function prototypes for all functions that
21199 take variable numbers of arguments (including @code{printf});
21200 otherwise incorrect code is generated for calls to those
21201 functions.
21202
21203 In addition, seriously incorrect code results if you call a
21204 function with too many arguments. (Normally, extra arguments are
21205 harmlessly ignored.)
21206
21207 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21208 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21209
21210 The default is @option{-mno-rtd}.
21211
21212 @item -malign-int
21213 @itemx -mno-align-int
21214 @opindex malign-int
21215 @opindex mno-align-int
21216 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21217 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21218 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21219 Aligning variables on 32-bit boundaries produces code that runs somewhat
21220 faster on processors with 32-bit busses at the expense of more memory.
21221
21222 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21223 aligns structures containing the above types differently than
21224 most published application binary interface specifications for the m68k.
21225
21226 @item -mpcrel
21227 @opindex mpcrel
21228 Use the pc-relative addressing mode of the 68000 directly, instead of
21229 using a global offset table. At present, this option implies @option{-fpic},
21230 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21231 not presently supported with @option{-mpcrel}, though this could be supported for
21232 68020 and higher processors.
21233
21234 @item -mno-strict-align
21235 @itemx -mstrict-align
21236 @opindex mno-strict-align
21237 @opindex mstrict-align
21238 Do not (do) assume that unaligned memory references are handled by
21239 the system.
21240
21241 @item -msep-data
21242 Generate code that allows the data segment to be located in a different
21243 area of memory from the text segment. This allows for execute-in-place in
21244 an environment without virtual memory management. This option implies
21245 @option{-fPIC}.
21246
21247 @item -mno-sep-data
21248 Generate code that assumes that the data segment follows the text segment.
21249 This is the default.
21250
21251 @item -mid-shared-library
21252 Generate code that supports shared libraries via the library ID method.
21253 This allows for execute-in-place and shared libraries in an environment
21254 without virtual memory management. This option implies @option{-fPIC}.
21255
21256 @item -mno-id-shared-library
21257 Generate code that doesn't assume ID-based shared libraries are being used.
21258 This is the default.
21259
21260 @item -mshared-library-id=n
21261 Specifies the identification number of the ID-based shared library being
21262 compiled. Specifying a value of 0 generates more compact code; specifying
21263 other values forces the allocation of that number to the current
21264 library, but is no more space- or time-efficient than omitting this option.
21265
21266 @item -mxgot
21267 @itemx -mno-xgot
21268 @opindex mxgot
21269 @opindex mno-xgot
21270 When generating position-independent code for ColdFire, generate code
21271 that works if the GOT has more than 8192 entries. This code is
21272 larger and slower than code generated without this option. On M680x0
21273 processors, this option is not needed; @option{-fPIC} suffices.
21274
21275 GCC normally uses a single instruction to load values from the GOT@.
21276 While this is relatively efficient, it only works if the GOT
21277 is smaller than about 64k. Anything larger causes the linker
21278 to report an error such as:
21279
21280 @cindex relocation truncated to fit (ColdFire)
21281 @smallexample
21282 relocation truncated to fit: R_68K_GOT16O foobar
21283 @end smallexample
21284
21285 If this happens, you should recompile your code with @option{-mxgot}.
21286 It should then work with very large GOTs. However, code generated with
21287 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21288 the value of a global symbol.
21289
21290 Note that some linkers, including newer versions of the GNU linker,
21291 can create multiple GOTs and sort GOT entries. If you have such a linker,
21292 you should only need to use @option{-mxgot} when compiling a single
21293 object file that accesses more than 8192 GOT entries. Very few do.
21294
21295 These options have no effect unless GCC is generating
21296 position-independent code.
21297
21298 @item -mlong-jump-table-offsets
21299 @opindex mlong-jump-table-offsets
21300 Use 32-bit offsets in @code{switch} tables. The default is to use
21301 16-bit offsets.
21302
21303 @end table
21304
21305 @node MCore Options
21306 @subsection MCore Options
21307 @cindex MCore options
21308
21309 These are the @samp{-m} options defined for the Motorola M*Core
21310 processors.
21311
21312 @table @gcctabopt
21313
21314 @item -mhardlit
21315 @itemx -mno-hardlit
21316 @opindex mhardlit
21317 @opindex mno-hardlit
21318 Inline constants into the code stream if it can be done in two
21319 instructions or less.
21320
21321 @item -mdiv
21322 @itemx -mno-div
21323 @opindex mdiv
21324 @opindex mno-div
21325 Use the divide instruction. (Enabled by default).
21326
21327 @item -mrelax-immediate
21328 @itemx -mno-relax-immediate
21329 @opindex mrelax-immediate
21330 @opindex mno-relax-immediate
21331 Allow arbitrary-sized immediates in bit operations.
21332
21333 @item -mwide-bitfields
21334 @itemx -mno-wide-bitfields
21335 @opindex mwide-bitfields
21336 @opindex mno-wide-bitfields
21337 Always treat bit-fields as @code{int}-sized.
21338
21339 @item -m4byte-functions
21340 @itemx -mno-4byte-functions
21341 @opindex m4byte-functions
21342 @opindex mno-4byte-functions
21343 Force all functions to be aligned to a 4-byte boundary.
21344
21345 @item -mcallgraph-data
21346 @itemx -mno-callgraph-data
21347 @opindex mcallgraph-data
21348 @opindex mno-callgraph-data
21349 Emit callgraph information.
21350
21351 @item -mslow-bytes
21352 @itemx -mno-slow-bytes
21353 @opindex mslow-bytes
21354 @opindex mno-slow-bytes
21355 Prefer word access when reading byte quantities.
21356
21357 @item -mlittle-endian
21358 @itemx -mbig-endian
21359 @opindex mlittle-endian
21360 @opindex mbig-endian
21361 Generate code for a little-endian target.
21362
21363 @item -m210
21364 @itemx -m340
21365 @opindex m210
21366 @opindex m340
21367 Generate code for the 210 processor.
21368
21369 @item -mno-lsim
21370 @opindex mno-lsim
21371 Assume that runtime support has been provided and so omit the
21372 simulator library (@file{libsim.a)} from the linker command line.
21373
21374 @item -mstack-increment=@var{size}
21375 @opindex mstack-increment
21376 Set the maximum amount for a single stack increment operation. Large
21377 values can increase the speed of programs that contain functions
21378 that need a large amount of stack space, but they can also trigger a
21379 segmentation fault if the stack is extended too much. The default
21380 value is 0x1000.
21381
21382 @end table
21383
21384 @node MeP Options
21385 @subsection MeP Options
21386 @cindex MeP options
21387
21388 @table @gcctabopt
21389
21390 @item -mabsdiff
21391 @opindex mabsdiff
21392 Enables the @code{abs} instruction, which is the absolute difference
21393 between two registers.
21394
21395 @item -mall-opts
21396 @opindex mall-opts
21397 Enables all the optional instructions---average, multiply, divide, bit
21398 operations, leading zero, absolute difference, min/max, clip, and
21399 saturation.
21400
21401
21402 @item -maverage
21403 @opindex maverage
21404 Enables the @code{ave} instruction, which computes the average of two
21405 registers.
21406
21407 @item -mbased=@var{n}
21408 @opindex mbased=
21409 Variables of size @var{n} bytes or smaller are placed in the
21410 @code{.based} section by default. Based variables use the @code{$tp}
21411 register as a base register, and there is a 128-byte limit to the
21412 @code{.based} section.
21413
21414 @item -mbitops
21415 @opindex mbitops
21416 Enables the bit operation instructions---bit test (@code{btstm}), set
21417 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21418 test-and-set (@code{tas}).
21419
21420 @item -mc=@var{name}
21421 @opindex mc=
21422 Selects which section constant data is placed in. @var{name} may
21423 be @samp{tiny}, @samp{near}, or @samp{far}.
21424
21425 @item -mclip
21426 @opindex mclip
21427 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21428 useful unless you also provide @option{-mminmax}.
21429
21430 @item -mconfig=@var{name}
21431 @opindex mconfig=
21432 Selects one of the built-in core configurations. Each MeP chip has
21433 one or more modules in it; each module has a core CPU and a variety of
21434 coprocessors, optional instructions, and peripherals. The
21435 @code{MeP-Integrator} tool, not part of GCC, provides these
21436 configurations through this option; using this option is the same as
21437 using all the corresponding command-line options. The default
21438 configuration is @samp{default}.
21439
21440 @item -mcop
21441 @opindex mcop
21442 Enables the coprocessor instructions. By default, this is a 32-bit
21443 coprocessor. Note that the coprocessor is normally enabled via the
21444 @option{-mconfig=} option.
21445
21446 @item -mcop32
21447 @opindex mcop32
21448 Enables the 32-bit coprocessor's instructions.
21449
21450 @item -mcop64
21451 @opindex mcop64
21452 Enables the 64-bit coprocessor's instructions.
21453
21454 @item -mivc2
21455 @opindex mivc2
21456 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21457
21458 @item -mdc
21459 @opindex mdc
21460 Causes constant variables to be placed in the @code{.near} section.
21461
21462 @item -mdiv
21463 @opindex mdiv
21464 Enables the @code{div} and @code{divu} instructions.
21465
21466 @item -meb
21467 @opindex meb
21468 Generate big-endian code.
21469
21470 @item -mel
21471 @opindex mel
21472 Generate little-endian code.
21473
21474 @item -mio-volatile
21475 @opindex mio-volatile
21476 Tells the compiler that any variable marked with the @code{io}
21477 attribute is to be considered volatile.
21478
21479 @item -ml
21480 @opindex ml
21481 Causes variables to be assigned to the @code{.far} section by default.
21482
21483 @item -mleadz
21484 @opindex mleadz
21485 Enables the @code{leadz} (leading zero) instruction.
21486
21487 @item -mm
21488 @opindex mm
21489 Causes variables to be assigned to the @code{.near} section by default.
21490
21491 @item -mminmax
21492 @opindex mminmax
21493 Enables the @code{min} and @code{max} instructions.
21494
21495 @item -mmult
21496 @opindex mmult
21497 Enables the multiplication and multiply-accumulate instructions.
21498
21499 @item -mno-opts
21500 @opindex mno-opts
21501 Disables all the optional instructions enabled by @option{-mall-opts}.
21502
21503 @item -mrepeat
21504 @opindex mrepeat
21505 Enables the @code{repeat} and @code{erepeat} instructions, used for
21506 low-overhead looping.
21507
21508 @item -ms
21509 @opindex ms
21510 Causes all variables to default to the @code{.tiny} section. Note
21511 that there is a 65536-byte limit to this section. Accesses to these
21512 variables use the @code{%gp} base register.
21513
21514 @item -msatur
21515 @opindex msatur
21516 Enables the saturation instructions. Note that the compiler does not
21517 currently generate these itself, but this option is included for
21518 compatibility with other tools, like @code{as}.
21519
21520 @item -msdram
21521 @opindex msdram
21522 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21523
21524 @item -msim
21525 @opindex msim
21526 Link the simulator run-time libraries.
21527
21528 @item -msimnovec
21529 @opindex msimnovec
21530 Link the simulator runtime libraries, excluding built-in support
21531 for reset and exception vectors and tables.
21532
21533 @item -mtf
21534 @opindex mtf
21535 Causes all functions to default to the @code{.far} section. Without
21536 this option, functions default to the @code{.near} section.
21537
21538 @item -mtiny=@var{n}
21539 @opindex mtiny=
21540 Variables that are @var{n} bytes or smaller are allocated to the
21541 @code{.tiny} section. These variables use the @code{$gp} base
21542 register. The default for this option is 4, but note that there's a
21543 65536-byte limit to the @code{.tiny} section.
21544
21545 @end table
21546
21547 @node MicroBlaze Options
21548 @subsection MicroBlaze Options
21549 @cindex MicroBlaze Options
21550
21551 @table @gcctabopt
21552
21553 @item -msoft-float
21554 @opindex msoft-float
21555 Use software emulation for floating point (default).
21556
21557 @item -mhard-float
21558 @opindex mhard-float
21559 Use hardware floating-point instructions.
21560
21561 @item -mmemcpy
21562 @opindex mmemcpy
21563 Do not optimize block moves, use @code{memcpy}.
21564
21565 @item -mno-clearbss
21566 @opindex mno-clearbss
21567 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21568
21569 @item -mcpu=@var{cpu-type}
21570 @opindex mcpu=
21571 Use features of, and schedule code for, the given CPU.
21572 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21573 where @var{X} is a major version, @var{YY} is the minor version, and
21574 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21575 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21576
21577 @item -mxl-soft-mul
21578 @opindex mxl-soft-mul
21579 Use software multiply emulation (default).
21580
21581 @item -mxl-soft-div
21582 @opindex mxl-soft-div
21583 Use software emulation for divides (default).
21584
21585 @item -mxl-barrel-shift
21586 @opindex mxl-barrel-shift
21587 Use the hardware barrel shifter.
21588
21589 @item -mxl-pattern-compare
21590 @opindex mxl-pattern-compare
21591 Use pattern compare instructions.
21592
21593 @item -msmall-divides
21594 @opindex msmall-divides
21595 Use table lookup optimization for small signed integer divisions.
21596
21597 @item -mxl-stack-check
21598 @opindex mxl-stack-check
21599 This option is deprecated. Use @option{-fstack-check} instead.
21600
21601 @item -mxl-gp-opt
21602 @opindex mxl-gp-opt
21603 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21604
21605 @item -mxl-multiply-high
21606 @opindex mxl-multiply-high
21607 Use multiply high instructions for high part of 32x32 multiply.
21608
21609 @item -mxl-float-convert
21610 @opindex mxl-float-convert
21611 Use hardware floating-point conversion instructions.
21612
21613 @item -mxl-float-sqrt
21614 @opindex mxl-float-sqrt
21615 Use hardware floating-point square root instruction.
21616
21617 @item -mbig-endian
21618 @opindex mbig-endian
21619 Generate code for a big-endian target.
21620
21621 @item -mlittle-endian
21622 @opindex mlittle-endian
21623 Generate code for a little-endian target.
21624
21625 @item -mxl-reorder
21626 @opindex mxl-reorder
21627 Use reorder instructions (swap and byte reversed load/store).
21628
21629 @item -mxl-mode-@var{app-model}
21630 Select application model @var{app-model}. Valid models are
21631 @table @samp
21632 @item executable
21633 normal executable (default), uses startup code @file{crt0.o}.
21634
21635 @item -mpic-data-is-text-relative
21636 @opindex mpic-data-is-text-relative
21637 Assume that the displacement between the text and data segments is fixed
21638 at static link time. This allows data to be referenced by offset from start of
21639 text address instead of GOT since PC-relative addressing is not supported.
21640
21641 @item xmdstub
21642 for use with Xilinx Microprocessor Debugger (XMD) based
21643 software intrusive debug agent called xmdstub. This uses startup file
21644 @file{crt1.o} and sets the start address of the program to 0x800.
21645
21646 @item bootstrap
21647 for applications that are loaded using a bootloader.
21648 This model uses startup file @file{crt2.o} which does not contain a processor
21649 reset vector handler. This is suitable for transferring control on a
21650 processor reset to the bootloader rather than the application.
21651
21652 @item novectors
21653 for applications that do not require any of the
21654 MicroBlaze vectors. This option may be useful for applications running
21655 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21656 @end table
21657
21658 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21659 @option{-mxl-mode-@var{app-model}}.
21660
21661 @end table
21662
21663 @node MIPS Options
21664 @subsection MIPS Options
21665 @cindex MIPS options
21666
21667 @table @gcctabopt
21668
21669 @item -EB
21670 @opindex EB
21671 Generate big-endian code.
21672
21673 @item -EL
21674 @opindex EL
21675 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21676 configurations.
21677
21678 @item -march=@var{arch}
21679 @opindex march
21680 Generate code that runs on @var{arch}, which can be the name of a
21681 generic MIPS ISA, or the name of a particular processor.
21682 The ISA names are:
21683 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21684 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21685 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21686 @samp{mips64r5} and @samp{mips64r6}.
21687 The processor names are:
21688 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21689 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21690 @samp{5kc}, @samp{5kf},
21691 @samp{20kc},
21692 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21693 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21694 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21695 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21696 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21697 @samp{i6400}, @samp{i6500},
21698 @samp{interaptiv},
21699 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21700 @samp{gs464e}, @samp{gs264e},
21701 @samp{m4k},
21702 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21703 @samp{m5100}, @samp{m5101},
21704 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21705 @samp{orion},
21706 @samp{p5600}, @samp{p6600},
21707 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21708 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21709 @samp{r6000}, @samp{r8000},
21710 @samp{rm7000}, @samp{rm9000},
21711 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21712 @samp{sb1},
21713 @samp{sr71000},
21714 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21715 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21716 @samp{xlr} and @samp{xlp}.
21717 The special value @samp{from-abi} selects the
21718 most compatible architecture for the selected ABI (that is,
21719 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21720
21721 The native Linux/GNU toolchain also supports the value @samp{native},
21722 which selects the best architecture option for the host processor.
21723 @option{-march=native} has no effect if GCC does not recognize
21724 the processor.
21725
21726 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21727 (for example, @option{-march=r2k}). Prefixes are optional, and
21728 @samp{vr} may be written @samp{r}.
21729
21730 Names of the form @samp{@var{n}f2_1} refer to processors with
21731 FPUs clocked at half the rate of the core, names of the form
21732 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21733 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21734 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21735 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21736 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21737 accepted as synonyms for @samp{@var{n}f1_1}.
21738
21739 GCC defines two macros based on the value of this option. The first
21740 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21741 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21742 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21743 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21744 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21745
21746 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21747 above. In other words, it has the full prefix and does not
21748 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21749 the macro names the resolved architecture (either @code{"mips1"} or
21750 @code{"mips3"}). It names the default architecture when no
21751 @option{-march} option is given.
21752
21753 @item -mtune=@var{arch}
21754 @opindex mtune
21755 Optimize for @var{arch}. Among other things, this option controls
21756 the way instructions are scheduled, and the perceived cost of arithmetic
21757 operations. The list of @var{arch} values is the same as for
21758 @option{-march}.
21759
21760 When this option is not used, GCC optimizes for the processor
21761 specified by @option{-march}. By using @option{-march} and
21762 @option{-mtune} together, it is possible to generate code that
21763 runs on a family of processors, but optimize the code for one
21764 particular member of that family.
21765
21766 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21767 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21768 @option{-march} ones described above.
21769
21770 @item -mips1
21771 @opindex mips1
21772 Equivalent to @option{-march=mips1}.
21773
21774 @item -mips2
21775 @opindex mips2
21776 Equivalent to @option{-march=mips2}.
21777
21778 @item -mips3
21779 @opindex mips3
21780 Equivalent to @option{-march=mips3}.
21781
21782 @item -mips4
21783 @opindex mips4
21784 Equivalent to @option{-march=mips4}.
21785
21786 @item -mips32
21787 @opindex mips32
21788 Equivalent to @option{-march=mips32}.
21789
21790 @item -mips32r3
21791 @opindex mips32r3
21792 Equivalent to @option{-march=mips32r3}.
21793
21794 @item -mips32r5
21795 @opindex mips32r5
21796 Equivalent to @option{-march=mips32r5}.
21797
21798 @item -mips32r6
21799 @opindex mips32r6
21800 Equivalent to @option{-march=mips32r6}.
21801
21802 @item -mips64
21803 @opindex mips64
21804 Equivalent to @option{-march=mips64}.
21805
21806 @item -mips64r2
21807 @opindex mips64r2
21808 Equivalent to @option{-march=mips64r2}.
21809
21810 @item -mips64r3
21811 @opindex mips64r3
21812 Equivalent to @option{-march=mips64r3}.
21813
21814 @item -mips64r5
21815 @opindex mips64r5
21816 Equivalent to @option{-march=mips64r5}.
21817
21818 @item -mips64r6
21819 @opindex mips64r6
21820 Equivalent to @option{-march=mips64r6}.
21821
21822 @item -mips16
21823 @itemx -mno-mips16
21824 @opindex mips16
21825 @opindex mno-mips16
21826 Generate (do not generate) MIPS16 code. If GCC is targeting a
21827 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21828
21829 MIPS16 code generation can also be controlled on a per-function basis
21830 by means of @code{mips16} and @code{nomips16} attributes.
21831 @xref{Function Attributes}, for more information.
21832
21833 @item -mflip-mips16
21834 @opindex mflip-mips16
21835 Generate MIPS16 code on alternating functions. This option is provided
21836 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21837 not intended for ordinary use in compiling user code.
21838
21839 @item -minterlink-compressed
21840 @itemx -mno-interlink-compressed
21841 @opindex minterlink-compressed
21842 @opindex mno-interlink-compressed
21843 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21844 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21845
21846 For example, code using the standard ISA encoding cannot jump directly
21847 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21848 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21849 knows that the target of the jump is not compressed.
21850
21851 @item -minterlink-mips16
21852 @itemx -mno-interlink-mips16
21853 @opindex minterlink-mips16
21854 @opindex mno-interlink-mips16
21855 Aliases of @option{-minterlink-compressed} and
21856 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21857 and are retained for backwards compatibility.
21858
21859 @item -mabi=32
21860 @itemx -mabi=o64
21861 @itemx -mabi=n32
21862 @itemx -mabi=64
21863 @itemx -mabi=eabi
21864 @opindex mabi=32
21865 @opindex mabi=o64
21866 @opindex mabi=n32
21867 @opindex mabi=64
21868 @opindex mabi=eabi
21869 Generate code for the given ABI@.
21870
21871 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21872 generates 64-bit code when you select a 64-bit architecture, but you
21873 can use @option{-mgp32} to get 32-bit code instead.
21874
21875 For information about the O64 ABI, see
21876 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21877
21878 GCC supports a variant of the o32 ABI in which floating-point registers
21879 are 64 rather than 32 bits wide. You can select this combination with
21880 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21881 and @code{mfhc1} instructions and is therefore only supported for
21882 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21883
21884 The register assignments for arguments and return values remain the
21885 same, but each scalar value is passed in a single 64-bit register
21886 rather than a pair of 32-bit registers. For example, scalar
21887 floating-point values are returned in @samp{$f0} only, not a
21888 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21889 remains the same in that the even-numbered double-precision registers
21890 are saved.
21891
21892 Two additional variants of the o32 ABI are supported to enable
21893 a transition from 32-bit to 64-bit registers. These are FPXX
21894 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21895 The FPXX extension mandates that all code must execute correctly
21896 when run using 32-bit or 64-bit registers. The code can be interlinked
21897 with either FP32 or FP64, but not both.
21898 The FP64A extension is similar to the FP64 extension but forbids the
21899 use of odd-numbered single-precision registers. This can be used
21900 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21901 processors and allows both FP32 and FP64A code to interlink and
21902 run in the same process without changing FPU modes.
21903
21904 @item -mabicalls
21905 @itemx -mno-abicalls
21906 @opindex mabicalls
21907 @opindex mno-abicalls
21908 Generate (do not generate) code that is suitable for SVR4-style
21909 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21910 systems.
21911
21912 @item -mshared
21913 @itemx -mno-shared
21914 Generate (do not generate) code that is fully position-independent,
21915 and that can therefore be linked into shared libraries. This option
21916 only affects @option{-mabicalls}.
21917
21918 All @option{-mabicalls} code has traditionally been position-independent,
21919 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21920 as an extension, the GNU toolchain allows executables to use absolute
21921 accesses for locally-binding symbols. It can also use shorter GP
21922 initialization sequences and generate direct calls to locally-defined
21923 functions. This mode is selected by @option{-mno-shared}.
21924
21925 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21926 objects that can only be linked by the GNU linker. However, the option
21927 does not affect the ABI of the final executable; it only affects the ABI
21928 of relocatable objects. Using @option{-mno-shared} generally makes
21929 executables both smaller and quicker.
21930
21931 @option{-mshared} is the default.
21932
21933 @item -mplt
21934 @itemx -mno-plt
21935 @opindex mplt
21936 @opindex mno-plt
21937 Assume (do not assume) that the static and dynamic linkers
21938 support PLTs and copy relocations. This option only affects
21939 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21940 has no effect without @option{-msym32}.
21941
21942 You can make @option{-mplt} the default by configuring
21943 GCC with @option{--with-mips-plt}. The default is
21944 @option{-mno-plt} otherwise.
21945
21946 @item -mxgot
21947 @itemx -mno-xgot
21948 @opindex mxgot
21949 @opindex mno-xgot
21950 Lift (do not lift) the usual restrictions on the size of the global
21951 offset table.
21952
21953 GCC normally uses a single instruction to load values from the GOT@.
21954 While this is relatively efficient, it only works if the GOT
21955 is smaller than about 64k. Anything larger causes the linker
21956 to report an error such as:
21957
21958 @cindex relocation truncated to fit (MIPS)
21959 @smallexample
21960 relocation truncated to fit: R_MIPS_GOT16 foobar
21961 @end smallexample
21962
21963 If this happens, you should recompile your code with @option{-mxgot}.
21964 This works with very large GOTs, although the code is also
21965 less efficient, since it takes three instructions to fetch the
21966 value of a global symbol.
21967
21968 Note that some linkers can create multiple GOTs. If you have such a
21969 linker, you should only need to use @option{-mxgot} when a single object
21970 file accesses more than 64k's worth of GOT entries. Very few do.
21971
21972 These options have no effect unless GCC is generating position
21973 independent code.
21974
21975 @item -mgp32
21976 @opindex mgp32
21977 Assume that general-purpose registers are 32 bits wide.
21978
21979 @item -mgp64
21980 @opindex mgp64
21981 Assume that general-purpose registers are 64 bits wide.
21982
21983 @item -mfp32
21984 @opindex mfp32
21985 Assume that floating-point registers are 32 bits wide.
21986
21987 @item -mfp64
21988 @opindex mfp64
21989 Assume that floating-point registers are 64 bits wide.
21990
21991 @item -mfpxx
21992 @opindex mfpxx
21993 Do not assume the width of floating-point registers.
21994
21995 @item -mhard-float
21996 @opindex mhard-float
21997 Use floating-point coprocessor instructions.
21998
21999 @item -msoft-float
22000 @opindex msoft-float
22001 Do not use floating-point coprocessor instructions. Implement
22002 floating-point calculations using library calls instead.
22003
22004 @item -mno-float
22005 @opindex mno-float
22006 Equivalent to @option{-msoft-float}, but additionally asserts that the
22007 program being compiled does not perform any floating-point operations.
22008 This option is presently supported only by some bare-metal MIPS
22009 configurations, where it may select a special set of libraries
22010 that lack all floating-point support (including, for example, the
22011 floating-point @code{printf} formats).
22012 If code compiled with @option{-mno-float} accidentally contains
22013 floating-point operations, it is likely to suffer a link-time
22014 or run-time failure.
22015
22016 @item -msingle-float
22017 @opindex msingle-float
22018 Assume that the floating-point coprocessor only supports single-precision
22019 operations.
22020
22021 @item -mdouble-float
22022 @opindex mdouble-float
22023 Assume that the floating-point coprocessor supports double-precision
22024 operations. This is the default.
22025
22026 @item -modd-spreg
22027 @itemx -mno-odd-spreg
22028 @opindex modd-spreg
22029 @opindex mno-odd-spreg
22030 Enable the use of odd-numbered single-precision floating-point registers
22031 for the o32 ABI. This is the default for processors that are known to
22032 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22033 is set by default.
22034
22035 @item -mabs=2008
22036 @itemx -mabs=legacy
22037 @opindex mabs=2008
22038 @opindex mabs=legacy
22039 These options control the treatment of the special not-a-number (NaN)
22040 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22041 @code{neg.@i{fmt}} machine instructions.
22042
22043 By default or when @option{-mabs=legacy} is used the legacy
22044 treatment is selected. In this case these instructions are considered
22045 arithmetic and avoided where correct operation is required and the
22046 input operand might be a NaN. A longer sequence of instructions that
22047 manipulate the sign bit of floating-point datum manually is used
22048 instead unless the @option{-ffinite-math-only} option has also been
22049 specified.
22050
22051 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
22052 this case these instructions are considered non-arithmetic and therefore
22053 operating correctly in all cases, including in particular where the
22054 input operand is a NaN. These instructions are therefore always used
22055 for the respective operations.
22056
22057 @item -mnan=2008
22058 @itemx -mnan=legacy
22059 @opindex mnan=2008
22060 @opindex mnan=legacy
22061 These options control the encoding of the special not-a-number (NaN)
22062 IEEE 754 floating-point data.
22063
22064 The @option{-mnan=legacy} option selects the legacy encoding. In this
22065 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22066 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22067 by the first bit of their trailing significand field being 1.
22068
22069 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
22070 this case qNaNs are denoted by the first bit of their trailing
22071 significand field being 1, whereas sNaNs are denoted by the first bit of
22072 their trailing significand field being 0.
22073
22074 The default is @option{-mnan=legacy} unless GCC has been configured with
22075 @option{--with-nan=2008}.
22076
22077 @item -mllsc
22078 @itemx -mno-llsc
22079 @opindex mllsc
22080 @opindex mno-llsc
22081 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22082 implement atomic memory built-in functions. When neither option is
22083 specified, GCC uses the instructions if the target architecture
22084 supports them.
22085
22086 @option{-mllsc} is useful if the runtime environment can emulate the
22087 instructions and @option{-mno-llsc} can be useful when compiling for
22088 nonstandard ISAs. You can make either option the default by
22089 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22090 respectively. @option{--with-llsc} is the default for some
22091 configurations; see the installation documentation for details.
22092
22093 @item -mdsp
22094 @itemx -mno-dsp
22095 @opindex mdsp
22096 @opindex mno-dsp
22097 Use (do not use) revision 1 of the MIPS DSP ASE@.
22098 @xref{MIPS DSP Built-in Functions}. This option defines the
22099 preprocessor macro @code{__mips_dsp}. It also defines
22100 @code{__mips_dsp_rev} to 1.
22101
22102 @item -mdspr2
22103 @itemx -mno-dspr2
22104 @opindex mdspr2
22105 @opindex mno-dspr2
22106 Use (do not use) revision 2 of the MIPS DSP ASE@.
22107 @xref{MIPS DSP Built-in Functions}. This option defines the
22108 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22109 It also defines @code{__mips_dsp_rev} to 2.
22110
22111 @item -msmartmips
22112 @itemx -mno-smartmips
22113 @opindex msmartmips
22114 @opindex mno-smartmips
22115 Use (do not use) the MIPS SmartMIPS ASE.
22116
22117 @item -mpaired-single
22118 @itemx -mno-paired-single
22119 @opindex mpaired-single
22120 @opindex mno-paired-single
22121 Use (do not use) paired-single floating-point instructions.
22122 @xref{MIPS Paired-Single Support}. This option requires
22123 hardware floating-point support to be enabled.
22124
22125 @item -mdmx
22126 @itemx -mno-mdmx
22127 @opindex mdmx
22128 @opindex mno-mdmx
22129 Use (do not use) MIPS Digital Media Extension instructions.
22130 This option can only be used when generating 64-bit code and requires
22131 hardware floating-point support to be enabled.
22132
22133 @item -mips3d
22134 @itemx -mno-mips3d
22135 @opindex mips3d
22136 @opindex mno-mips3d
22137 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22138 The option @option{-mips3d} implies @option{-mpaired-single}.
22139
22140 @item -mmicromips
22141 @itemx -mno-micromips
22142 @opindex mmicromips
22143 @opindex mno-mmicromips
22144 Generate (do not generate) microMIPS code.
22145
22146 MicroMIPS code generation can also be controlled on a per-function basis
22147 by means of @code{micromips} and @code{nomicromips} attributes.
22148 @xref{Function Attributes}, for more information.
22149
22150 @item -mmt
22151 @itemx -mno-mt
22152 @opindex mmt
22153 @opindex mno-mt
22154 Use (do not use) MT Multithreading instructions.
22155
22156 @item -mmcu
22157 @itemx -mno-mcu
22158 @opindex mmcu
22159 @opindex mno-mcu
22160 Use (do not use) the MIPS MCU ASE instructions.
22161
22162 @item -meva
22163 @itemx -mno-eva
22164 @opindex meva
22165 @opindex mno-eva
22166 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22167
22168 @item -mvirt
22169 @itemx -mno-virt
22170 @opindex mvirt
22171 @opindex mno-virt
22172 Use (do not use) the MIPS Virtualization (VZ) instructions.
22173
22174 @item -mxpa
22175 @itemx -mno-xpa
22176 @opindex mxpa
22177 @opindex mno-xpa
22178 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22179
22180 @item -mcrc
22181 @itemx -mno-crc
22182 @opindex mcrc
22183 @opindex mno-crc
22184 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22185
22186 @item -mginv
22187 @itemx -mno-ginv
22188 @opindex mginv
22189 @opindex mno-ginv
22190 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22191
22192 @item -mloongson-mmi
22193 @itemx -mno-loongson-mmi
22194 @opindex mloongson-mmi
22195 @opindex mno-loongson-mmi
22196 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22197
22198 @item -mloongson-ext
22199 @itemx -mno-loongson-ext
22200 @opindex mloongson-ext
22201 @opindex mno-loongson-ext
22202 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22203
22204 @item -mloongson-ext2
22205 @itemx -mno-loongson-ext2
22206 @opindex mloongson-ext2
22207 @opindex mno-loongson-ext2
22208 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22209
22210 @item -mlong64
22211 @opindex mlong64
22212 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22213 an explanation of the default and the way that the pointer size is
22214 determined.
22215
22216 @item -mlong32
22217 @opindex mlong32
22218 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22219
22220 The default size of @code{int}s, @code{long}s and pointers depends on
22221 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22222 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22223 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22224 or the same size as integer registers, whichever is smaller.
22225
22226 @item -msym32
22227 @itemx -mno-sym32
22228 @opindex msym32
22229 @opindex mno-sym32
22230 Assume (do not assume) that all symbols have 32-bit values, regardless
22231 of the selected ABI@. This option is useful in combination with
22232 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22233 to generate shorter and faster references to symbolic addresses.
22234
22235 @item -G @var{num}
22236 @opindex G
22237 Put definitions of externally-visible data in a small data section
22238 if that data is no bigger than @var{num} bytes. GCC can then generate
22239 more efficient accesses to the data; see @option{-mgpopt} for details.
22240
22241 The default @option{-G} option depends on the configuration.
22242
22243 @item -mlocal-sdata
22244 @itemx -mno-local-sdata
22245 @opindex mlocal-sdata
22246 @opindex mno-local-sdata
22247 Extend (do not extend) the @option{-G} behavior to local data too,
22248 such as to static variables in C@. @option{-mlocal-sdata} is the
22249 default for all configurations.
22250
22251 If the linker complains that an application is using too much small data,
22252 you might want to try rebuilding the less performance-critical parts with
22253 @option{-mno-local-sdata}. You might also want to build large
22254 libraries with @option{-mno-local-sdata}, so that the libraries leave
22255 more room for the main program.
22256
22257 @item -mextern-sdata
22258 @itemx -mno-extern-sdata
22259 @opindex mextern-sdata
22260 @opindex mno-extern-sdata
22261 Assume (do not assume) that externally-defined data is in
22262 a small data section if the size of that data is within the @option{-G} limit.
22263 @option{-mextern-sdata} is the default for all configurations.
22264
22265 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22266 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22267 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22268 is placed in a small data section. If @var{Var} is defined by another
22269 module, you must either compile that module with a high-enough
22270 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22271 definition. If @var{Var} is common, you must link the application
22272 with a high-enough @option{-G} setting.
22273
22274 The easiest way of satisfying these restrictions is to compile
22275 and link every module with the same @option{-G} option. However,
22276 you may wish to build a library that supports several different
22277 small data limits. You can do this by compiling the library with
22278 the highest supported @option{-G} setting and additionally using
22279 @option{-mno-extern-sdata} to stop the library from making assumptions
22280 about externally-defined data.
22281
22282 @item -mgpopt
22283 @itemx -mno-gpopt
22284 @opindex mgpopt
22285 @opindex mno-gpopt
22286 Use (do not use) GP-relative accesses for symbols that are known to be
22287 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22288 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22289 configurations.
22290
22291 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22292 might not hold the value of @code{_gp}. For example, if the code is
22293 part of a library that might be used in a boot monitor, programs that
22294 call boot monitor routines pass an unknown value in @code{$gp}.
22295 (In such situations, the boot monitor itself is usually compiled
22296 with @option{-G0}.)
22297
22298 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22299 @option{-mno-extern-sdata}.
22300
22301 @item -membedded-data
22302 @itemx -mno-embedded-data
22303 @opindex membedded-data
22304 @opindex mno-embedded-data
22305 Allocate variables to the read-only data section first if possible, then
22306 next in the small data section if possible, otherwise in data. This gives
22307 slightly slower code than the default, but reduces the amount of RAM required
22308 when executing, and thus may be preferred for some embedded systems.
22309
22310 @item -muninit-const-in-rodata
22311 @itemx -mno-uninit-const-in-rodata
22312 @opindex muninit-const-in-rodata
22313 @opindex mno-uninit-const-in-rodata
22314 Put uninitialized @code{const} variables in the read-only data section.
22315 This option is only meaningful in conjunction with @option{-membedded-data}.
22316
22317 @item -mcode-readable=@var{setting}
22318 @opindex mcode-readable
22319 Specify whether GCC may generate code that reads from executable sections.
22320 There are three possible settings:
22321
22322 @table @gcctabopt
22323 @item -mcode-readable=yes
22324 Instructions may freely access executable sections. This is the
22325 default setting.
22326
22327 @item -mcode-readable=pcrel
22328 MIPS16 PC-relative load instructions can access executable sections,
22329 but other instructions must not do so. This option is useful on 4KSc
22330 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22331 It is also useful on processors that can be configured to have a dual
22332 instruction/data SRAM interface and that, like the M4K, automatically
22333 redirect PC-relative loads to the instruction RAM.
22334
22335 @item -mcode-readable=no
22336 Instructions must not access executable sections. This option can be
22337 useful on targets that are configured to have a dual instruction/data
22338 SRAM interface but that (unlike the M4K) do not automatically redirect
22339 PC-relative loads to the instruction RAM.
22340 @end table
22341
22342 @item -msplit-addresses
22343 @itemx -mno-split-addresses
22344 @opindex msplit-addresses
22345 @opindex mno-split-addresses
22346 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22347 relocation operators. This option has been superseded by
22348 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22349
22350 @item -mexplicit-relocs
22351 @itemx -mno-explicit-relocs
22352 @opindex mexplicit-relocs
22353 @opindex mno-explicit-relocs
22354 Use (do not use) assembler relocation operators when dealing with symbolic
22355 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22356 is to use assembler macros instead.
22357
22358 @option{-mexplicit-relocs} is the default if GCC was configured
22359 to use an assembler that supports relocation operators.
22360
22361 @item -mcheck-zero-division
22362 @itemx -mno-check-zero-division
22363 @opindex mcheck-zero-division
22364 @opindex mno-check-zero-division
22365 Trap (do not trap) on integer division by zero.
22366
22367 The default is @option{-mcheck-zero-division}.
22368
22369 @item -mdivide-traps
22370 @itemx -mdivide-breaks
22371 @opindex mdivide-traps
22372 @opindex mdivide-breaks
22373 MIPS systems check for division by zero by generating either a
22374 conditional trap or a break instruction. Using traps results in
22375 smaller code, but is only supported on MIPS II and later. Also, some
22376 versions of the Linux kernel have a bug that prevents trap from
22377 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22378 allow conditional traps on architectures that support them and
22379 @option{-mdivide-breaks} to force the use of breaks.
22380
22381 The default is usually @option{-mdivide-traps}, but this can be
22382 overridden at configure time using @option{--with-divide=breaks}.
22383 Divide-by-zero checks can be completely disabled using
22384 @option{-mno-check-zero-division}.
22385
22386 @item -mload-store-pairs
22387 @itemx -mno-load-store-pairs
22388 @opindex mload-store-pairs
22389 @opindex mno-load-store-pairs
22390 Enable (disable) an optimization that pairs consecutive load or store
22391 instructions to enable load/store bonding. This option is enabled by
22392 default but only takes effect when the selected architecture is known
22393 to support bonding.
22394
22395 @item -mmemcpy
22396 @itemx -mno-memcpy
22397 @opindex mmemcpy
22398 @opindex mno-memcpy
22399 Force (do not force) the use of @code{memcpy} for non-trivial block
22400 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22401 most constant-sized copies.
22402
22403 @item -mlong-calls
22404 @itemx -mno-long-calls
22405 @opindex mlong-calls
22406 @opindex mno-long-calls
22407 Disable (do not disable) use of the @code{jal} instruction. Calling
22408 functions using @code{jal} is more efficient but requires the caller
22409 and callee to be in the same 256 megabyte segment.
22410
22411 This option has no effect on abicalls code. The default is
22412 @option{-mno-long-calls}.
22413
22414 @item -mmad
22415 @itemx -mno-mad
22416 @opindex mmad
22417 @opindex mno-mad
22418 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22419 instructions, as provided by the R4650 ISA@.
22420
22421 @item -mimadd
22422 @itemx -mno-imadd
22423 @opindex mimadd
22424 @opindex mno-imadd
22425 Enable (disable) use of the @code{madd} and @code{msub} integer
22426 instructions. The default is @option{-mimadd} on architectures
22427 that support @code{madd} and @code{msub} except for the 74k
22428 architecture where it was found to generate slower code.
22429
22430 @item -mfused-madd
22431 @itemx -mno-fused-madd
22432 @opindex mfused-madd
22433 @opindex mno-fused-madd
22434 Enable (disable) use of the floating-point multiply-accumulate
22435 instructions, when they are available. The default is
22436 @option{-mfused-madd}.
22437
22438 On the R8000 CPU when multiply-accumulate instructions are used,
22439 the intermediate product is calculated to infinite precision
22440 and is not subject to the FCSR Flush to Zero bit. This may be
22441 undesirable in some circumstances. On other processors the result
22442 is numerically identical to the equivalent computation using
22443 separate multiply, add, subtract and negate instructions.
22444
22445 @item -nocpp
22446 @opindex nocpp
22447 Tell the MIPS assembler to not run its preprocessor over user
22448 assembler files (with a @samp{.s} suffix) when assembling them.
22449
22450 @item -mfix-24k
22451 @itemx -mno-fix-24k
22452 @opindex mfix-24k
22453 @opindex mno-fix-24k
22454 Work around the 24K E48 (lost data on stores during refill) errata.
22455 The workarounds are implemented by the assembler rather than by GCC@.
22456
22457 @item -mfix-r4000
22458 @itemx -mno-fix-r4000
22459 @opindex mfix-r4000
22460 @opindex mno-fix-r4000
22461 Work around certain R4000 CPU errata:
22462 @itemize @minus
22463 @item
22464 A double-word or a variable shift may give an incorrect result if executed
22465 immediately after starting an integer division.
22466 @item
22467 A double-word or a variable shift may give an incorrect result if executed
22468 while an integer multiplication is in progress.
22469 @item
22470 An integer division may give an incorrect result if started in a delay slot
22471 of a taken branch or a jump.
22472 @end itemize
22473
22474 @item -mfix-r4400
22475 @itemx -mno-fix-r4400
22476 @opindex mfix-r4400
22477 @opindex mno-fix-r4400
22478 Work around certain R4400 CPU errata:
22479 @itemize @minus
22480 @item
22481 A double-word or a variable shift may give an incorrect result if executed
22482 immediately after starting an integer division.
22483 @end itemize
22484
22485 @item -mfix-r10000
22486 @itemx -mno-fix-r10000
22487 @opindex mfix-r10000
22488 @opindex mno-fix-r10000
22489 Work around certain R10000 errata:
22490 @itemize @minus
22491 @item
22492 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22493 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22494 @end itemize
22495
22496 This option can only be used if the target architecture supports
22497 branch-likely instructions. @option{-mfix-r10000} is the default when
22498 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22499 otherwise.
22500
22501 @item -mfix-r5900
22502 @itemx -mno-fix-r5900
22503 @opindex mfix-r5900
22504 Do not attempt to schedule the preceding instruction into the delay slot
22505 of a branch instruction placed at the end of a short loop of six
22506 instructions or fewer and always schedule a @code{nop} instruction there
22507 instead. The short loop bug under certain conditions causes loops to
22508 execute only once or twice, due to a hardware bug in the R5900 chip. The
22509 workaround is implemented by the assembler rather than by GCC@.
22510
22511 @item -mfix-rm7000
22512 @itemx -mno-fix-rm7000
22513 @opindex mfix-rm7000
22514 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22515 workarounds are implemented by the assembler rather than by GCC@.
22516
22517 @item -mfix-vr4120
22518 @itemx -mno-fix-vr4120
22519 @opindex mfix-vr4120
22520 Work around certain VR4120 errata:
22521 @itemize @minus
22522 @item
22523 @code{dmultu} does not always produce the correct result.
22524 @item
22525 @code{div} and @code{ddiv} do not always produce the correct result if one
22526 of the operands is negative.
22527 @end itemize
22528 The workarounds for the division errata rely on special functions in
22529 @file{libgcc.a}. At present, these functions are only provided by
22530 the @code{mips64vr*-elf} configurations.
22531
22532 Other VR4120 errata require a NOP to be inserted between certain pairs of
22533 instructions. These errata are handled by the assembler, not by GCC itself.
22534
22535 @item -mfix-vr4130
22536 @opindex mfix-vr4130
22537 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22538 workarounds are implemented by the assembler rather than by GCC,
22539 although GCC avoids using @code{mflo} and @code{mfhi} if the
22540 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22541 instructions are available instead.
22542
22543 @item -mfix-sb1
22544 @itemx -mno-fix-sb1
22545 @opindex mfix-sb1
22546 Work around certain SB-1 CPU core errata.
22547 (This flag currently works around the SB-1 revision 2
22548 ``F1'' and ``F2'' floating-point errata.)
22549
22550 @item -mr10k-cache-barrier=@var{setting}
22551 @opindex mr10k-cache-barrier
22552 Specify whether GCC should insert cache barriers to avoid the
22553 side effects of speculation on R10K processors.
22554
22555 In common with many processors, the R10K tries to predict the outcome
22556 of a conditional branch and speculatively executes instructions from
22557 the ``taken'' branch. It later aborts these instructions if the
22558 predicted outcome is wrong. However, on the R10K, even aborted
22559 instructions can have side effects.
22560
22561 This problem only affects kernel stores and, depending on the system,
22562 kernel loads. As an example, a speculatively-executed store may load
22563 the target memory into cache and mark the cache line as dirty, even if
22564 the store itself is later aborted. If a DMA operation writes to the
22565 same area of memory before the ``dirty'' line is flushed, the cached
22566 data overwrites the DMA-ed data. See the R10K processor manual
22567 for a full description, including other potential problems.
22568
22569 One workaround is to insert cache barrier instructions before every memory
22570 access that might be speculatively executed and that might have side
22571 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22572 controls GCC's implementation of this workaround. It assumes that
22573 aborted accesses to any byte in the following regions does not have
22574 side effects:
22575
22576 @enumerate
22577 @item
22578 the memory occupied by the current function's stack frame;
22579
22580 @item
22581 the memory occupied by an incoming stack argument;
22582
22583 @item
22584 the memory occupied by an object with a link-time-constant address.
22585 @end enumerate
22586
22587 It is the kernel's responsibility to ensure that speculative
22588 accesses to these regions are indeed safe.
22589
22590 If the input program contains a function declaration such as:
22591
22592 @smallexample
22593 void foo (void);
22594 @end smallexample
22595
22596 then the implementation of @code{foo} must allow @code{j foo} and
22597 @code{jal foo} to be executed speculatively. GCC honors this
22598 restriction for functions it compiles itself. It expects non-GCC
22599 functions (such as hand-written assembly code) to do the same.
22600
22601 The option has three forms:
22602
22603 @table @gcctabopt
22604 @item -mr10k-cache-barrier=load-store
22605 Insert a cache barrier before a load or store that might be
22606 speculatively executed and that might have side effects even
22607 if aborted.
22608
22609 @item -mr10k-cache-barrier=store
22610 Insert a cache barrier before a store that might be speculatively
22611 executed and that might have side effects even if aborted.
22612
22613 @item -mr10k-cache-barrier=none
22614 Disable the insertion of cache barriers. This is the default setting.
22615 @end table
22616
22617 @item -mflush-func=@var{func}
22618 @itemx -mno-flush-func
22619 @opindex mflush-func
22620 Specifies the function to call to flush the I and D caches, or to not
22621 call any such function. If called, the function must take the same
22622 arguments as the common @code{_flush_func}, that is, the address of the
22623 memory range for which the cache is being flushed, the size of the
22624 memory range, and the number 3 (to flush both caches). The default
22625 depends on the target GCC was configured for, but commonly is either
22626 @code{_flush_func} or @code{__cpu_flush}.
22627
22628 @item mbranch-cost=@var{num}
22629 @opindex mbranch-cost
22630 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22631 This cost is only a heuristic and is not guaranteed to produce
22632 consistent results across releases. A zero cost redundantly selects
22633 the default, which is based on the @option{-mtune} setting.
22634
22635 @item -mbranch-likely
22636 @itemx -mno-branch-likely
22637 @opindex mbranch-likely
22638 @opindex mno-branch-likely
22639 Enable or disable use of Branch Likely instructions, regardless of the
22640 default for the selected architecture. By default, Branch Likely
22641 instructions may be generated if they are supported by the selected
22642 architecture. An exception is for the MIPS32 and MIPS64 architectures
22643 and processors that implement those architectures; for those, Branch
22644 Likely instructions are not be generated by default because the MIPS32
22645 and MIPS64 architectures specifically deprecate their use.
22646
22647 @item -mcompact-branches=never
22648 @itemx -mcompact-branches=optimal
22649 @itemx -mcompact-branches=always
22650 @opindex mcompact-branches=never
22651 @opindex mcompact-branches=optimal
22652 @opindex mcompact-branches=always
22653 These options control which form of branches will be generated. The
22654 default is @option{-mcompact-branches=optimal}.
22655
22656 The @option{-mcompact-branches=never} option ensures that compact branch
22657 instructions will never be generated.
22658
22659 The @option{-mcompact-branches=always} option ensures that a compact
22660 branch instruction will be generated if available. If a compact branch
22661 instruction is not available, a delay slot form of the branch will be
22662 used instead.
22663
22664 This option is supported from MIPS Release 6 onwards.
22665
22666 The @option{-mcompact-branches=optimal} option will cause a delay slot
22667 branch to be used if one is available in the current ISA and the delay
22668 slot is successfully filled. If the delay slot is not filled, a compact
22669 branch will be chosen if one is available.
22670
22671 @item -mfp-exceptions
22672 @itemx -mno-fp-exceptions
22673 @opindex mfp-exceptions
22674 Specifies whether FP exceptions are enabled. This affects how
22675 FP instructions are scheduled for some processors.
22676 The default is that FP exceptions are
22677 enabled.
22678
22679 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22680 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22681 FP pipe.
22682
22683 @item -mvr4130-align
22684 @itemx -mno-vr4130-align
22685 @opindex mvr4130-align
22686 The VR4130 pipeline is two-way superscalar, but can only issue two
22687 instructions together if the first one is 8-byte aligned. When this
22688 option is enabled, GCC aligns pairs of instructions that it
22689 thinks should execute in parallel.
22690
22691 This option only has an effect when optimizing for the VR4130.
22692 It normally makes code faster, but at the expense of making it bigger.
22693 It is enabled by default at optimization level @option{-O3}.
22694
22695 @item -msynci
22696 @itemx -mno-synci
22697 @opindex msynci
22698 Enable (disable) generation of @code{synci} instructions on
22699 architectures that support it. The @code{synci} instructions (if
22700 enabled) are generated when @code{__builtin___clear_cache} is
22701 compiled.
22702
22703 This option defaults to @option{-mno-synci}, but the default can be
22704 overridden by configuring GCC with @option{--with-synci}.
22705
22706 When compiling code for single processor systems, it is generally safe
22707 to use @code{synci}. However, on many multi-core (SMP) systems, it
22708 does not invalidate the instruction caches on all cores and may lead
22709 to undefined behavior.
22710
22711 @item -mrelax-pic-calls
22712 @itemx -mno-relax-pic-calls
22713 @opindex mrelax-pic-calls
22714 Try to turn PIC calls that are normally dispatched via register
22715 @code{$25} into direct calls. This is only possible if the linker can
22716 resolve the destination at link time and if the destination is within
22717 range for a direct call.
22718
22719 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22720 an assembler and a linker that support the @code{.reloc} assembly
22721 directive and @option{-mexplicit-relocs} is in effect. With
22722 @option{-mno-explicit-relocs}, this optimization can be performed by the
22723 assembler and the linker alone without help from the compiler.
22724
22725 @item -mmcount-ra-address
22726 @itemx -mno-mcount-ra-address
22727 @opindex mmcount-ra-address
22728 @opindex mno-mcount-ra-address
22729 Emit (do not emit) code that allows @code{_mcount} to modify the
22730 calling function's return address. When enabled, this option extends
22731 the usual @code{_mcount} interface with a new @var{ra-address}
22732 parameter, which has type @code{intptr_t *} and is passed in register
22733 @code{$12}. @code{_mcount} can then modify the return address by
22734 doing both of the following:
22735 @itemize
22736 @item
22737 Returning the new address in register @code{$31}.
22738 @item
22739 Storing the new address in @code{*@var{ra-address}},
22740 if @var{ra-address} is nonnull.
22741 @end itemize
22742
22743 The default is @option{-mno-mcount-ra-address}.
22744
22745 @item -mframe-header-opt
22746 @itemx -mno-frame-header-opt
22747 @opindex mframe-header-opt
22748 Enable (disable) frame header optimization in the o32 ABI. When using the
22749 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22750 function to write out register arguments. When enabled, this optimization
22751 will suppress the allocation of the frame header if it can be determined that
22752 it is unused.
22753
22754 This optimization is off by default at all optimization levels.
22755
22756 @item -mlxc1-sxc1
22757 @itemx -mno-lxc1-sxc1
22758 @opindex mlxc1-sxc1
22759 When applicable, enable (disable) the generation of @code{lwxc1},
22760 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22761
22762 @item -mmadd4
22763 @itemx -mno-madd4
22764 @opindex mmadd4
22765 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22766 @code{madd.d} and related instructions. Enabled by default.
22767
22768 @end table
22769
22770 @node MMIX Options
22771 @subsection MMIX Options
22772 @cindex MMIX Options
22773
22774 These options are defined for the MMIX:
22775
22776 @table @gcctabopt
22777 @item -mlibfuncs
22778 @itemx -mno-libfuncs
22779 @opindex mlibfuncs
22780 @opindex mno-libfuncs
22781 Specify that intrinsic library functions are being compiled, passing all
22782 values in registers, no matter the size.
22783
22784 @item -mepsilon
22785 @itemx -mno-epsilon
22786 @opindex mepsilon
22787 @opindex mno-epsilon
22788 Generate floating-point comparison instructions that compare with respect
22789 to the @code{rE} epsilon register.
22790
22791 @item -mabi=mmixware
22792 @itemx -mabi=gnu
22793 @opindex mabi=mmixware
22794 @opindex mabi=gnu
22795 Generate code that passes function parameters and return values that (in
22796 the called function) are seen as registers @code{$0} and up, as opposed to
22797 the GNU ABI which uses global registers @code{$231} and up.
22798
22799 @item -mzero-extend
22800 @itemx -mno-zero-extend
22801 @opindex mzero-extend
22802 @opindex mno-zero-extend
22803 When reading data from memory in sizes shorter than 64 bits, use (do not
22804 use) zero-extending load instructions by default, rather than
22805 sign-extending ones.
22806
22807 @item -mknuthdiv
22808 @itemx -mno-knuthdiv
22809 @opindex mknuthdiv
22810 @opindex mno-knuthdiv
22811 Make the result of a division yielding a remainder have the same sign as
22812 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22813 remainder follows the sign of the dividend. Both methods are
22814 arithmetically valid, the latter being almost exclusively used.
22815
22816 @item -mtoplevel-symbols
22817 @itemx -mno-toplevel-symbols
22818 @opindex mtoplevel-symbols
22819 @opindex mno-toplevel-symbols
22820 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22821 code can be used with the @code{PREFIX} assembly directive.
22822
22823 @item -melf
22824 @opindex melf
22825 Generate an executable in the ELF format, rather than the default
22826 @samp{mmo} format used by the @command{mmix} simulator.
22827
22828 @item -mbranch-predict
22829 @itemx -mno-branch-predict
22830 @opindex mbranch-predict
22831 @opindex mno-branch-predict
22832 Use (do not use) the probable-branch instructions, when static branch
22833 prediction indicates a probable branch.
22834
22835 @item -mbase-addresses
22836 @itemx -mno-base-addresses
22837 @opindex mbase-addresses
22838 @opindex mno-base-addresses
22839 Generate (do not generate) code that uses @emph{base addresses}. Using a
22840 base address automatically generates a request (handled by the assembler
22841 and the linker) for a constant to be set up in a global register. The
22842 register is used for one or more base address requests within the range 0
22843 to 255 from the value held in the register. The generally leads to short
22844 and fast code, but the number of different data items that can be
22845 addressed is limited. This means that a program that uses lots of static
22846 data may require @option{-mno-base-addresses}.
22847
22848 @item -msingle-exit
22849 @itemx -mno-single-exit
22850 @opindex msingle-exit
22851 @opindex mno-single-exit
22852 Force (do not force) generated code to have a single exit point in each
22853 function.
22854 @end table
22855
22856 @node MN10300 Options
22857 @subsection MN10300 Options
22858 @cindex MN10300 options
22859
22860 These @option{-m} options are defined for Matsushita MN10300 architectures:
22861
22862 @table @gcctabopt
22863 @item -mmult-bug
22864 @opindex mmult-bug
22865 Generate code to avoid bugs in the multiply instructions for the MN10300
22866 processors. This is the default.
22867
22868 @item -mno-mult-bug
22869 @opindex mno-mult-bug
22870 Do not generate code to avoid bugs in the multiply instructions for the
22871 MN10300 processors.
22872
22873 @item -mam33
22874 @opindex mam33
22875 Generate code using features specific to the AM33 processor.
22876
22877 @item -mno-am33
22878 @opindex mno-am33
22879 Do not generate code using features specific to the AM33 processor. This
22880 is the default.
22881
22882 @item -mam33-2
22883 @opindex mam33-2
22884 Generate code using features specific to the AM33/2.0 processor.
22885
22886 @item -mam34
22887 @opindex mam34
22888 Generate code using features specific to the AM34 processor.
22889
22890 @item -mtune=@var{cpu-type}
22891 @opindex mtune
22892 Use the timing characteristics of the indicated CPU type when
22893 scheduling instructions. This does not change the targeted processor
22894 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22895 @samp{am33-2} or @samp{am34}.
22896
22897 @item -mreturn-pointer-on-d0
22898 @opindex mreturn-pointer-on-d0
22899 When generating a function that returns a pointer, return the pointer
22900 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22901 only in @code{a0}, and attempts to call such functions without a prototype
22902 result in errors. Note that this option is on by default; use
22903 @option{-mno-return-pointer-on-d0} to disable it.
22904
22905 @item -mno-crt0
22906 @opindex mno-crt0
22907 Do not link in the C run-time initialization object file.
22908
22909 @item -mrelax
22910 @opindex mrelax
22911 Indicate to the linker that it should perform a relaxation optimization pass
22912 to shorten branches, calls and absolute memory addresses. This option only
22913 has an effect when used on the command line for the final link step.
22914
22915 This option makes symbolic debugging impossible.
22916
22917 @item -mliw
22918 @opindex mliw
22919 Allow the compiler to generate @emph{Long Instruction Word}
22920 instructions if the target is the @samp{AM33} or later. This is the
22921 default. This option defines the preprocessor macro @code{__LIW__}.
22922
22923 @item -mno-liw
22924 @opindex mno-liw
22925 Do not allow the compiler to generate @emph{Long Instruction Word}
22926 instructions. This option defines the preprocessor macro
22927 @code{__NO_LIW__}.
22928
22929 @item -msetlb
22930 @opindex msetlb
22931 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22932 instructions if the target is the @samp{AM33} or later. This is the
22933 default. This option defines the preprocessor macro @code{__SETLB__}.
22934
22935 @item -mno-setlb
22936 @opindex mno-setlb
22937 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22938 instructions. This option defines the preprocessor macro
22939 @code{__NO_SETLB__}.
22940
22941 @end table
22942
22943 @node Moxie Options
22944 @subsection Moxie Options
22945 @cindex Moxie Options
22946
22947 @table @gcctabopt
22948
22949 @item -meb
22950 @opindex meb
22951 Generate big-endian code. This is the default for @samp{moxie-*-*}
22952 configurations.
22953
22954 @item -mel
22955 @opindex mel
22956 Generate little-endian code.
22957
22958 @item -mmul.x
22959 @opindex mmul.x
22960 Generate mul.x and umul.x instructions. This is the default for
22961 @samp{moxiebox-*-*} configurations.
22962
22963 @item -mno-crt0
22964 @opindex mno-crt0
22965 Do not link in the C run-time initialization object file.
22966
22967 @end table
22968
22969 @node MSP430 Options
22970 @subsection MSP430 Options
22971 @cindex MSP430 Options
22972
22973 These options are defined for the MSP430:
22974
22975 @table @gcctabopt
22976
22977 @item -masm-hex
22978 @opindex masm-hex
22979 Force assembly output to always use hex constants. Normally such
22980 constants are signed decimals, but this option is available for
22981 testsuite and/or aesthetic purposes.
22982
22983 @item -mmcu=
22984 @opindex mmcu=
22985 Select the MCU to target. This is used to create a C preprocessor
22986 symbol based upon the MCU name, converted to upper case and pre- and
22987 post-fixed with @samp{__}. This in turn is used by the
22988 @file{msp430.h} header file to select an MCU-specific supplementary
22989 header file.
22990
22991 The option also sets the ISA to use. If the MCU name is one that is
22992 known to only support the 430 ISA then that is selected, otherwise the
22993 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22994 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22995 name selects the 430X ISA.
22996
22997 In addition an MCU-specific linker script is added to the linker
22998 command line. The script's name is the name of the MCU with
22999 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
23000 command line defines the C preprocessor symbol @code{__XXX__} and
23001 cause the linker to search for a script called @file{xxx.ld}.
23002
23003 This option is also passed on to the assembler.
23004
23005 @item -mwarn-mcu
23006 @itemx -mno-warn-mcu
23007 @opindex mwarn-mcu
23008 @opindex mno-warn-mcu
23009 This option enables or disables warnings about conflicts between the
23010 MCU name specified by the @option{-mmcu} option and the ISA set by the
23011 @option{-mcpu} option and/or the hardware multiply support set by the
23012 @option{-mhwmult} option. It also toggles warnings about unrecognized
23013 MCU names. This option is on by default.
23014
23015 @item -mcpu=
23016 @opindex mcpu=
23017 Specifies the ISA to use. Accepted values are @samp{msp430},
23018 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
23019 @option{-mmcu=} option should be used to select the ISA.
23020
23021 @item -msim
23022 @opindex msim
23023 Link to the simulator runtime libraries and linker script. Overrides
23024 any scripts that would be selected by the @option{-mmcu=} option.
23025
23026 @item -mlarge
23027 @opindex mlarge
23028 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23029
23030 @item -msmall
23031 @opindex msmall
23032 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23033
23034 @item -mrelax
23035 @opindex mrelax
23036 This option is passed to the assembler and linker, and allows the
23037 linker to perform certain optimizations that cannot be done until
23038 the final link.
23039
23040 @item mhwmult=
23041 @opindex mhwmult=
23042 Describes the type of hardware multiply supported by the target.
23043 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23044 for the original 16-bit-only multiply supported by early MCUs.
23045 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23046 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23047 A value of @samp{auto} can also be given. This tells GCC to deduce
23048 the hardware multiply support based upon the MCU name provided by the
23049 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
23050 the MCU name is not recognized then no hardware multiply support is
23051 assumed. @code{auto} is the default setting.
23052
23053 Hardware multiplies are normally performed by calling a library
23054 routine. This saves space in the generated code. When compiling at
23055 @option{-O3} or higher however the hardware multiplier is invoked
23056 inline. This makes for bigger, but faster code.
23057
23058 The hardware multiply routines disable interrupts whilst running and
23059 restore the previous interrupt state when they finish. This makes
23060 them safe to use inside interrupt handlers as well as in normal code.
23061
23062 @item -minrt
23063 @opindex minrt
23064 Enable the use of a minimum runtime environment - no static
23065 initializers or constructors. This is intended for memory-constrained
23066 devices. The compiler includes special symbols in some objects
23067 that tell the linker and runtime which code fragments are required.
23068
23069 @item -mcode-region=
23070 @itemx -mdata-region=
23071 @opindex mcode-region
23072 @opindex mdata-region
23073 These options tell the compiler where to place functions and data that
23074 do not have one of the @code{lower}, @code{upper}, @code{either} or
23075 @code{section} attributes. Possible values are @code{lower},
23076 @code{upper}, @code{either} or @code{any}. The first three behave
23077 like the corresponding attribute. The fourth possible value -
23078 @code{any} - is the default. It leaves placement entirely up to the
23079 linker script and how it assigns the standard sections
23080 (@code{.text}, @code{.data}, etc) to the memory regions.
23081
23082 @item -msilicon-errata=
23083 @opindex msilicon-errata
23084 This option passes on a request to assembler to enable the fixes for
23085 the named silicon errata.
23086
23087 @item -msilicon-errata-warn=
23088 @opindex msilicon-errata-warn
23089 This option passes on a request to the assembler to enable warning
23090 messages when a silicon errata might need to be applied.
23091
23092 @end table
23093
23094 @node NDS32 Options
23095 @subsection NDS32 Options
23096 @cindex NDS32 Options
23097
23098 These options are defined for NDS32 implementations:
23099
23100 @table @gcctabopt
23101
23102 @item -mbig-endian
23103 @opindex mbig-endian
23104 Generate code in big-endian mode.
23105
23106 @item -mlittle-endian
23107 @opindex mlittle-endian
23108 Generate code in little-endian mode.
23109
23110 @item -mreduced-regs
23111 @opindex mreduced-regs
23112 Use reduced-set registers for register allocation.
23113
23114 @item -mfull-regs
23115 @opindex mfull-regs
23116 Use full-set registers for register allocation.
23117
23118 @item -mcmov
23119 @opindex mcmov
23120 Generate conditional move instructions.
23121
23122 @item -mno-cmov
23123 @opindex mno-cmov
23124 Do not generate conditional move instructions.
23125
23126 @item -mext-perf
23127 @opindex mext-perf
23128 Generate performance extension instructions.
23129
23130 @item -mno-ext-perf
23131 @opindex mno-ext-perf
23132 Do not generate performance extension instructions.
23133
23134 @item -mext-perf2
23135 @opindex mext-perf2
23136 Generate performance extension 2 instructions.
23137
23138 @item -mno-ext-perf2
23139 @opindex mno-ext-perf2
23140 Do not generate performance extension 2 instructions.
23141
23142 @item -mext-string
23143 @opindex mext-string
23144 Generate string extension instructions.
23145
23146 @item -mno-ext-string
23147 @opindex mno-ext-string
23148 Do not generate string extension instructions.
23149
23150 @item -mv3push
23151 @opindex mv3push
23152 Generate v3 push25/pop25 instructions.
23153
23154 @item -mno-v3push
23155 @opindex mno-v3push
23156 Do not generate v3 push25/pop25 instructions.
23157
23158 @item -m16-bit
23159 @opindex m16-bit
23160 Generate 16-bit instructions.
23161
23162 @item -mno-16-bit
23163 @opindex mno-16-bit
23164 Do not generate 16-bit instructions.
23165
23166 @item -misr-vector-size=@var{num}
23167 @opindex misr-vector-size
23168 Specify the size of each interrupt vector, which must be 4 or 16.
23169
23170 @item -mcache-block-size=@var{num}
23171 @opindex mcache-block-size
23172 Specify the size of each cache block,
23173 which must be a power of 2 between 4 and 512.
23174
23175 @item -march=@var{arch}
23176 @opindex march
23177 Specify the name of the target architecture.
23178
23179 @item -mcmodel=@var{code-model}
23180 @opindex mcmodel
23181 Set the code model to one of
23182 @table @asis
23183 @item @samp{small}
23184 All the data and read-only data segments must be within 512KB addressing space.
23185 The text segment must be within 16MB addressing space.
23186 @item @samp{medium}
23187 The data segment must be within 512KB while the read-only data segment can be
23188 within 4GB addressing space. The text segment should be still within 16MB
23189 addressing space.
23190 @item @samp{large}
23191 All the text and data segments can be within 4GB addressing space.
23192 @end table
23193
23194 @item -mctor-dtor
23195 @opindex mctor-dtor
23196 Enable constructor/destructor feature.
23197
23198 @item -mrelax
23199 @opindex mrelax
23200 Guide linker to relax instructions.
23201
23202 @end table
23203
23204 @node Nios II Options
23205 @subsection Nios II Options
23206 @cindex Nios II options
23207 @cindex Altera Nios II options
23208
23209 These are the options defined for the Altera Nios II processor.
23210
23211 @table @gcctabopt
23212
23213 @item -G @var{num}
23214 @opindex G
23215 @cindex smaller data references
23216 Put global and static objects less than or equal to @var{num} bytes
23217 into the small data or BSS sections instead of the normal data or BSS
23218 sections. The default value of @var{num} is 8.
23219
23220 @item -mgpopt=@var{option}
23221 @itemx -mgpopt
23222 @itemx -mno-gpopt
23223 @opindex mgpopt
23224 @opindex mno-gpopt
23225 Generate (do not generate) GP-relative accesses. The following
23226 @var{option} names are recognized:
23227
23228 @table @samp
23229
23230 @item none
23231 Do not generate GP-relative accesses.
23232
23233 @item local
23234 Generate GP-relative accesses for small data objects that are not
23235 external, weak, or uninitialized common symbols.
23236 Also use GP-relative addressing for objects that
23237 have been explicitly placed in a small data section via a @code{section}
23238 attribute.
23239
23240 @item global
23241 As for @samp{local}, but also generate GP-relative accesses for
23242 small data objects that are external, weak, or common. If you use this option,
23243 you must ensure that all parts of your program (including libraries) are
23244 compiled with the same @option{-G} setting.
23245
23246 @item data
23247 Generate GP-relative accesses for all data objects in the program. If you
23248 use this option, the entire data and BSS segments
23249 of your program must fit in 64K of memory and you must use an appropriate
23250 linker script to allocate them within the addressable range of the
23251 global pointer.
23252
23253 @item all
23254 Generate GP-relative addresses for function pointers as well as data
23255 pointers. If you use this option, the entire text, data, and BSS segments
23256 of your program must fit in 64K of memory and you must use an appropriate
23257 linker script to allocate them within the addressable range of the
23258 global pointer.
23259
23260 @end table
23261
23262 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23263 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23264
23265 The default is @option{-mgpopt} except when @option{-fpic} or
23266 @option{-fPIC} is specified to generate position-independent code.
23267 Note that the Nios II ABI does not permit GP-relative accesses from
23268 shared libraries.
23269
23270 You may need to specify @option{-mno-gpopt} explicitly when building
23271 programs that include large amounts of small data, including large
23272 GOT data sections. In this case, the 16-bit offset for GP-relative
23273 addressing may not be large enough to allow access to the entire
23274 small data section.
23275
23276 @item -mgprel-sec=@var{regexp}
23277 @opindex mgprel-sec
23278 This option specifies additional section names that can be accessed via
23279 GP-relative addressing. It is most useful in conjunction with
23280 @code{section} attributes on variable declarations
23281 (@pxref{Common Variable Attributes}) and a custom linker script.
23282 The @var{regexp} is a POSIX Extended Regular Expression.
23283
23284 This option does not affect the behavior of the @option{-G} option, and
23285 the specified sections are in addition to the standard @code{.sdata}
23286 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23287
23288 @item -mr0rel-sec=@var{regexp}
23289 @opindex mr0rel-sec
23290 This option specifies names of sections that can be accessed via a
23291 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23292 of the 32-bit address space. It is most useful in conjunction with
23293 @code{section} attributes on variable declarations
23294 (@pxref{Common Variable Attributes}) and a custom linker script.
23295 The @var{regexp} is a POSIX Extended Regular Expression.
23296
23297 In contrast to the use of GP-relative addressing for small data,
23298 zero-based addressing is never generated by default and there are no
23299 conventional section names used in standard linker scripts for sections
23300 in the low or high areas of memory.
23301
23302 @item -mel
23303 @itemx -meb
23304 @opindex mel
23305 @opindex meb
23306 Generate little-endian (default) or big-endian (experimental) code,
23307 respectively.
23308
23309 @item -march=@var{arch}
23310 @opindex march
23311 This specifies the name of the target Nios II architecture. GCC uses this
23312 name to determine what kind of instructions it can emit when generating
23313 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23314
23315 The preprocessor macro @code{__nios2_arch__} is available to programs,
23316 with value 1 or 2, indicating the targeted ISA level.
23317
23318 @item -mbypass-cache
23319 @itemx -mno-bypass-cache
23320 @opindex mno-bypass-cache
23321 @opindex mbypass-cache
23322 Force all load and store instructions to always bypass cache by
23323 using I/O variants of the instructions. The default is not to
23324 bypass the cache.
23325
23326 @item -mno-cache-volatile
23327 @itemx -mcache-volatile
23328 @opindex mcache-volatile
23329 @opindex mno-cache-volatile
23330 Volatile memory access bypass the cache using the I/O variants of
23331 the load and store instructions. The default is not to bypass the cache.
23332
23333 @item -mno-fast-sw-div
23334 @itemx -mfast-sw-div
23335 @opindex mno-fast-sw-div
23336 @opindex mfast-sw-div
23337 Do not use table-based fast divide for small numbers. The default
23338 is to use the fast divide at @option{-O3} and above.
23339
23340 @item -mno-hw-mul
23341 @itemx -mhw-mul
23342 @itemx -mno-hw-mulx
23343 @itemx -mhw-mulx
23344 @itemx -mno-hw-div
23345 @itemx -mhw-div
23346 @opindex mno-hw-mul
23347 @opindex mhw-mul
23348 @opindex mno-hw-mulx
23349 @opindex mhw-mulx
23350 @opindex mno-hw-div
23351 @opindex mhw-div
23352 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23353 instructions by the compiler. The default is to emit @code{mul}
23354 and not emit @code{div} and @code{mulx}.
23355
23356 @item -mbmx
23357 @itemx -mno-bmx
23358 @itemx -mcdx
23359 @itemx -mno-cdx
23360 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23361 CDX (code density) instructions. Enabling these instructions also
23362 requires @option{-march=r2}. Since these instructions are optional
23363 extensions to the R2 architecture, the default is not to emit them.
23364
23365 @item -mcustom-@var{insn}=@var{N}
23366 @itemx -mno-custom-@var{insn}
23367 @opindex mcustom-@var{insn}
23368 @opindex mno-custom-@var{insn}
23369 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23370 custom instruction with encoding @var{N} when generating code that uses
23371 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23372 instruction 253 for single-precision floating-point add operations instead
23373 of the default behavior of using a library call.
23374
23375 The following values of @var{insn} are supported. Except as otherwise
23376 noted, floating-point operations are expected to be implemented with
23377 normal IEEE 754 semantics and correspond directly to the C operators or the
23378 equivalent GCC built-in functions (@pxref{Other Builtins}).
23379
23380 Single-precision floating point:
23381 @table @asis
23382
23383 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23384 Binary arithmetic operations.
23385
23386 @item @samp{fnegs}
23387 Unary negation.
23388
23389 @item @samp{fabss}
23390 Unary absolute value.
23391
23392 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23393 Comparison operations.
23394
23395 @item @samp{fmins}, @samp{fmaxs}
23396 Floating-point minimum and maximum. These instructions are only
23397 generated if @option{-ffinite-math-only} is specified.
23398
23399 @item @samp{fsqrts}
23400 Unary square root operation.
23401
23402 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23403 Floating-point trigonometric and exponential functions. These instructions
23404 are only generated if @option{-funsafe-math-optimizations} is also specified.
23405
23406 @end table
23407
23408 Double-precision floating point:
23409 @table @asis
23410
23411 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23412 Binary arithmetic operations.
23413
23414 @item @samp{fnegd}
23415 Unary negation.
23416
23417 @item @samp{fabsd}
23418 Unary absolute value.
23419
23420 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23421 Comparison operations.
23422
23423 @item @samp{fmind}, @samp{fmaxd}
23424 Double-precision minimum and maximum. These instructions are only
23425 generated if @option{-ffinite-math-only} is specified.
23426
23427 @item @samp{fsqrtd}
23428 Unary square root operation.
23429
23430 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23431 Double-precision trigonometric and exponential functions. These instructions
23432 are only generated if @option{-funsafe-math-optimizations} is also specified.
23433
23434 @end table
23435
23436 Conversions:
23437 @table @asis
23438 @item @samp{fextsd}
23439 Conversion from single precision to double precision.
23440
23441 @item @samp{ftruncds}
23442 Conversion from double precision to single precision.
23443
23444 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23445 Conversion from floating point to signed or unsigned integer types, with
23446 truncation towards zero.
23447
23448 @item @samp{round}
23449 Conversion from single-precision floating point to signed integer,
23450 rounding to the nearest integer and ties away from zero.
23451 This corresponds to the @code{__builtin_lroundf} function when
23452 @option{-fno-math-errno} is used.
23453
23454 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23455 Conversion from signed or unsigned integer types to floating-point types.
23456
23457 @end table
23458
23459 In addition, all of the following transfer instructions for internal
23460 registers X and Y must be provided to use any of the double-precision
23461 floating-point instructions. Custom instructions taking two
23462 double-precision source operands expect the first operand in the
23463 64-bit register X. The other operand (or only operand of a unary
23464 operation) is given to the custom arithmetic instruction with the
23465 least significant half in source register @var{src1} and the most
23466 significant half in @var{src2}. A custom instruction that returns a
23467 double-precision result returns the most significant 32 bits in the
23468 destination register and the other half in 32-bit register Y.
23469 GCC automatically generates the necessary code sequences to write
23470 register X and/or read register Y when double-precision floating-point
23471 instructions are used.
23472
23473 @table @asis
23474
23475 @item @samp{fwrx}
23476 Write @var{src1} into the least significant half of X and @var{src2} into
23477 the most significant half of X.
23478
23479 @item @samp{fwry}
23480 Write @var{src1} into Y.
23481
23482 @item @samp{frdxhi}, @samp{frdxlo}
23483 Read the most or least (respectively) significant half of X and store it in
23484 @var{dest}.
23485
23486 @item @samp{frdy}
23487 Read the value of Y and store it into @var{dest}.
23488 @end table
23489
23490 Note that you can gain more local control over generation of Nios II custom
23491 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23492 and @code{target("no-custom-@var{insn}")} function attributes
23493 (@pxref{Function Attributes})
23494 or pragmas (@pxref{Function Specific Option Pragmas}).
23495
23496 @item -mcustom-fpu-cfg=@var{name}
23497 @opindex mcustom-fpu-cfg
23498
23499 This option enables a predefined, named set of custom instruction encodings
23500 (see @option{-mcustom-@var{insn}} above).
23501 Currently, the following sets are defined:
23502
23503 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23504 @gccoptlist{-mcustom-fmuls=252 @gol
23505 -mcustom-fadds=253 @gol
23506 -mcustom-fsubs=254 @gol
23507 -fsingle-precision-constant}
23508
23509 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23510 @gccoptlist{-mcustom-fmuls=252 @gol
23511 -mcustom-fadds=253 @gol
23512 -mcustom-fsubs=254 @gol
23513 -mcustom-fdivs=255 @gol
23514 -fsingle-precision-constant}
23515
23516 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23517 @gccoptlist{-mcustom-floatus=243 @gol
23518 -mcustom-fixsi=244 @gol
23519 -mcustom-floatis=245 @gol
23520 -mcustom-fcmpgts=246 @gol
23521 -mcustom-fcmples=249 @gol
23522 -mcustom-fcmpeqs=250 @gol
23523 -mcustom-fcmpnes=251 @gol
23524 -mcustom-fmuls=252 @gol
23525 -mcustom-fadds=253 @gol
23526 -mcustom-fsubs=254 @gol
23527 -mcustom-fdivs=255 @gol
23528 -fsingle-precision-constant}
23529
23530 Custom instruction assignments given by individual
23531 @option{-mcustom-@var{insn}=} options override those given by
23532 @option{-mcustom-fpu-cfg=}, regardless of the
23533 order of the options on the command line.
23534
23535 Note that you can gain more local control over selection of a FPU
23536 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23537 function attribute (@pxref{Function Attributes})
23538 or pragma (@pxref{Function Specific Option Pragmas}).
23539
23540 @end table
23541
23542 These additional @samp{-m} options are available for the Altera Nios II
23543 ELF (bare-metal) target:
23544
23545 @table @gcctabopt
23546
23547 @item -mhal
23548 @opindex mhal
23549 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23550 startup and termination code, and is typically used in conjunction with
23551 @option{-msys-crt0=} to specify the location of the alternate startup code
23552 provided by the HAL BSP.
23553
23554 @item -msmallc
23555 @opindex msmallc
23556 Link with a limited version of the C library, @option{-lsmallc}, rather than
23557 Newlib.
23558
23559 @item -msys-crt0=@var{startfile}
23560 @opindex msys-crt0
23561 @var{startfile} is the file name of the startfile (crt0) to use
23562 when linking. This option is only useful in conjunction with @option{-mhal}.
23563
23564 @item -msys-lib=@var{systemlib}
23565 @opindex msys-lib
23566 @var{systemlib} is the library name of the library that provides
23567 low-level system calls required by the C library,
23568 e.g.@: @code{read} and @code{write}.
23569 This option is typically used to link with a library provided by a HAL BSP.
23570
23571 @end table
23572
23573 @node Nvidia PTX Options
23574 @subsection Nvidia PTX Options
23575 @cindex Nvidia PTX options
23576 @cindex nvptx options
23577
23578 These options are defined for Nvidia PTX:
23579
23580 @table @gcctabopt
23581
23582 @item -m32
23583 @itemx -m64
23584 @opindex m32
23585 @opindex m64
23586 Generate code for 32-bit or 64-bit ABI.
23587
23588 @item -misa=@var{ISA-string}
23589 @opindex march
23590 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23591 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23592 @samp{sm_35}. The default ISA is sm_30.
23593
23594 @item -mmainkernel
23595 @opindex mmainkernel
23596 Link in code for a __main kernel. This is for stand-alone instead of
23597 offloading execution.
23598
23599 @item -moptimize
23600 @opindex moptimize
23601 Apply partitioned execution optimizations. This is the default when any
23602 level of optimization is selected.
23603
23604 @item -msoft-stack
23605 @opindex msoft-stack
23606 Generate code that does not use @code{.local} memory
23607 directly for stack storage. Instead, a per-warp stack pointer is
23608 maintained explicitly. This enables variable-length stack allocation (with
23609 variable-length arrays or @code{alloca}), and when global memory is used for
23610 underlying storage, makes it possible to access automatic variables from other
23611 threads, or with atomic instructions. This code generation variant is used
23612 for OpenMP offloading, but the option is exposed on its own for the purpose
23613 of testing the compiler; to generate code suitable for linking into programs
23614 using OpenMP offloading, use option @option{-mgomp}.
23615
23616 @item -muniform-simt
23617 @opindex muniform-simt
23618 Switch to code generation variant that allows to execute all threads in each
23619 warp, while maintaining memory state and side effects as if only one thread
23620 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23621 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23622 current lane index equals the master lane index), and the register being
23623 assigned is copied via a shuffle instruction from the master lane. Outside of
23624 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23625 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23626 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23627 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23628 with current lane index to compute the master lane index.
23629
23630 @item -mgomp
23631 @opindex mgomp
23632 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23633 @option{-muniform-simt} options, and selects corresponding multilib variant.
23634
23635 @end table
23636
23637 @node OpenRISC Options
23638 @subsection OpenRISC Options
23639 @cindex OpenRISC Options
23640
23641 These options are defined for OpenRISC:
23642
23643 @table @gcctabopt
23644
23645 @item -mboard=@var{name}
23646 @opindex mboard
23647 Configure a board specific runtime. This will be passed to the linker for
23648 newlib board library linking. The default is @code{or1ksim}.
23649
23650 @item -mnewlib
23651 @opindex mnewlib
23652 For compatibility, it's always newlib for elf now.
23653
23654 @item -mhard-div
23655 @opindex mhard-div
23656 Generate code for hardware which supports divide instructions. This is the
23657 default.
23658
23659 @item -mhard-mul
23660 @opindex mhard-mul
23661 Generate code for hardware which supports multiply instructions. This is the
23662 default.
23663
23664 @item -mcmov
23665 @opindex mcmov
23666 Generate code for hardware which supports the conditional move (@code{l.cmov})
23667 instruction.
23668
23669 @item -mror
23670 @opindex mror
23671 Generate code for hardware which supports rotate right instructions.
23672
23673 @item -msext
23674 @opindex msext
23675 Generate code for hardware which supports sign-extension instructions.
23676
23677 @item -msfimm
23678 @opindex msfimm
23679 Generate code for hardware which supports set flag immediate (@code{l.sf*i})
23680 instructions.
23681
23682 @item -mshftimm
23683 @opindex mshftimm
23684 Generate code for hardware which supports shift immediate related instructions
23685 (i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}). Note, to
23686 enable generation of the @code{l.rori} instruction the @option{-mror} flag must
23687 also be specified.
23688
23689 @item -msoft-div
23690 @opindex msoft-div
23691 Generate code for hardware which requires divide instruction emulation.
23692
23693 @item -msoft-mul
23694 @opindex msoft-mul
23695 Generate code for hardware which requires multiply instruction emulation.
23696
23697 @end table
23698
23699 @node PDP-11 Options
23700 @subsection PDP-11 Options
23701 @cindex PDP-11 Options
23702
23703 These options are defined for the PDP-11:
23704
23705 @table @gcctabopt
23706 @item -mfpu
23707 @opindex mfpu
23708 Use hardware FPP floating point. This is the default. (FIS floating
23709 point on the PDP-11/40 is not supported.) Implies -m45.
23710
23711 @item -msoft-float
23712 @opindex msoft-float
23713 Do not use hardware floating point.
23714
23715 @item -mac0
23716 @opindex mac0
23717 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23718
23719 @item -mno-ac0
23720 @opindex mno-ac0
23721 Return floating-point results in memory. This is the default.
23722
23723 @item -m40
23724 @opindex m40
23725 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23726
23727 @item -m45
23728 @opindex m45
23729 Generate code for a PDP-11/45. This is the default.
23730
23731 @item -m10
23732 @opindex m10
23733 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23734
23735 @item -mint16
23736 @itemx -mno-int32
23737 @opindex mint16
23738 @opindex mno-int32
23739 Use 16-bit @code{int}. This is the default.
23740
23741 @item -mint32
23742 @itemx -mno-int16
23743 @opindex mint32
23744 @opindex mno-int16
23745 Use 32-bit @code{int}.
23746
23747 @item -msplit
23748 @opindex msplit
23749 Target has split instruction and data space. Implies -m45.
23750
23751 @item -munix-asm
23752 @opindex munix-asm
23753 Use Unix assembler syntax.
23754
23755 @item -mdec-asm
23756 @opindex mdec-asm
23757 Use DEC assembler syntax.
23758
23759 @item -mgnu-asm
23760 @opindex mgnu-asm
23761 Use GNU assembler syntax. This is the default.
23762
23763 @item -mlra
23764 @opindex mlra
23765 Use the new LRA register allocator. By default, the old ``reload''
23766 allocator is used.
23767 @end table
23768
23769 @node picoChip Options
23770 @subsection picoChip Options
23771 @cindex picoChip options
23772
23773 These @samp{-m} options are defined for picoChip implementations:
23774
23775 @table @gcctabopt
23776
23777 @item -mae=@var{ae_type}
23778 @opindex mcpu
23779 Set the instruction set, register set, and instruction scheduling
23780 parameters for array element type @var{ae_type}. Supported values
23781 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23782
23783 @option{-mae=ANY} selects a completely generic AE type. Code
23784 generated with this option runs on any of the other AE types. The
23785 code is not as efficient as it would be if compiled for a specific
23786 AE type, and some types of operation (e.g., multiplication) do not
23787 work properly on all types of AE.
23788
23789 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23790 for compiled code, and is the default.
23791
23792 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23793 option may suffer from poor performance of byte (char) manipulation,
23794 since the DSP AE does not provide hardware support for byte load/stores.
23795
23796 @item -msymbol-as-address
23797 Enable the compiler to directly use a symbol name as an address in a
23798 load/store instruction, without first loading it into a
23799 register. Typically, the use of this option generates larger
23800 programs, which run faster than when the option isn't used. However, the
23801 results vary from program to program, so it is left as a user option,
23802 rather than being permanently enabled.
23803
23804 @item -mno-inefficient-warnings
23805 Disables warnings about the generation of inefficient code. These
23806 warnings can be generated, for example, when compiling code that
23807 performs byte-level memory operations on the MAC AE type. The MAC AE has
23808 no hardware support for byte-level memory operations, so all byte
23809 load/stores must be synthesized from word load/store operations. This is
23810 inefficient and a warning is generated to indicate
23811 that you should rewrite the code to avoid byte operations, or to target
23812 an AE type that has the necessary hardware support. This option disables
23813 these warnings.
23814
23815 @end table
23816
23817 @node PowerPC Options
23818 @subsection PowerPC Options
23819 @cindex PowerPC options
23820
23821 These are listed under @xref{RS/6000 and PowerPC Options}.
23822
23823 @node PRU Options
23824 @subsection PRU Options
23825 @cindex PRU Options
23826
23827 These command-line options are defined for PRU target:
23828
23829 @table @gcctabopt
23830 @item -minrt
23831 @opindex minrt
23832 Link with a minimum runtime environment, with no support for static
23833 initializers and constructors. Using this option can significantly reduce
23834 the size of the final ELF binary. Beware that the compiler could still
23835 generate code with static initializers and constructors. It is up to the
23836 programmer to ensure that the source program will not use those features.
23837
23838 @item -mmcu=@var{mcu}
23839 @opindex mmcu
23840 Specify the PRU MCU variant to use. Check Newlib for the exact list of
23841 supported MCUs.
23842
23843 @item -mno-relax
23844 @opindex mno-relax
23845 Make GCC pass the @option{--no-relax} command-line option to the linker
23846 instead of the @option{--relax} option.
23847
23848 @item -mloop
23849 @opindex mloop
23850 Allow (or do not allow) GCC to use the LOOP instruction.
23851
23852 @item -mabi=@var{variant}
23853 @opindex mabi
23854 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
23855 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
23856 more naturally with certain GCC assumptions. These are the differences:
23857
23858 @table @samp
23859 @item Function Pointer Size
23860 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
23861 supports only 32-bit data and code pointers.
23862
23863 @item Optional Return Value Pointer
23864 Function return values larger than 64 bits are passed by using a hidden
23865 pointer as the first argument of the function. TI ABI, though, mandates that
23866 the pointer can be NULL in case the caller is not using the returned value.
23867 GNU always passes and expects a valid return value pointer.
23868
23869 @end table
23870
23871 The current @option{-mabi=ti} implementation simply raises a compile error
23872 when any of the above code constructs is detected. As a consequence
23873 the standard C library cannot be built and it is omitted when linking with
23874 @option{-mabi=ti}.
23875
23876 Relaxation is a GNU feature and for safety reasons is disabled when using
23877 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
23878 instructions, so the GNU linker cannot adjust them when shortening adjacent
23879 LDI32 pseudo instructions.
23880
23881 @end table
23882
23883 @node RISC-V Options
23884 @subsection RISC-V Options
23885 @cindex RISC-V Options
23886
23887 These command-line options are defined for RISC-V targets:
23888
23889 @table @gcctabopt
23890 @item -mbranch-cost=@var{n}
23891 @opindex mbranch-cost
23892 Set the cost of branches to roughly @var{n} instructions.
23893
23894 @item -mplt
23895 @itemx -mno-plt
23896 @opindex plt
23897 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23898 non-PIC. The default is @option{-mplt}.
23899
23900 @item -mabi=@var{ABI-string}
23901 @opindex mabi
23902 Specify integer and floating-point calling convention. @var{ABI-string}
23903 contains two parts: the size of integer types and the registers used for
23904 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23905 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23906 32-bit), and that floating-point values up to 64 bits wide are passed in F
23907 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23908 allows the compiler to generate code that uses the F and D extensions but only
23909 allows floating-point values up to 32 bits long to be passed in registers; or
23910 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23911 passed in registers.
23912
23913 The default for this argument is system dependent, users who want a specific
23914 calling convention should specify one explicitly. The valid calling
23915 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23916 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23917 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23918 invalid because the ABI requires 64-bit values be passed in F registers, but F
23919 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23920 only be used with the @samp{rv32e} architecture. This ABI is not well
23921 specified at present, and is subject to change.
23922
23923 @item -mfdiv
23924 @itemx -mno-fdiv
23925 @opindex mfdiv
23926 Do or don't use hardware floating-point divide and square root instructions.
23927 This requires the F or D extensions for floating-point registers. The default
23928 is to use them if the specified architecture has these instructions.
23929
23930 @item -mdiv
23931 @itemx -mno-div
23932 @opindex mdiv
23933 Do or don't use hardware instructions for integer division. This requires the
23934 M extension. The default is to use them if the specified architecture has
23935 these instructions.
23936
23937 @item -march=@var{ISA-string}
23938 @opindex march
23939 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
23940 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23941 @samp{rv32imaf}.
23942
23943 @item -mtune=@var{processor-string}
23944 @opindex mtune
23945 Optimize the output for the given processor, specified by microarchitecture
23946 name. Permissible values for this option are: @samp{rocket},
23947 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
23948 and @samp{size}.
23949
23950 When @option{-mtune=} is not specified, the default is @samp{rocket}.
23951
23952 The @samp{size} choice is not intended for use by end-users. This is used
23953 when @option{-Os} is specified. It overrides the instruction cost info
23954 provided by @option{-mtune=}, but does not override the pipeline info. This
23955 helps reduce code size while still giving good performance.
23956
23957 @item -mpreferred-stack-boundary=@var{num}
23958 @opindex mpreferred-stack-boundary
23959 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23960 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23961 the default is 4 (16 bytes or 128-bits).
23962
23963 @strong{Warning:} If you use this switch, then you must build all modules with
23964 the same value, including any libraries. This includes the system libraries
23965 and startup modules.
23966
23967 @item -msmall-data-limit=@var{n}
23968 @opindex msmall-data-limit
23969 Put global and static data smaller than @var{n} bytes into a special section
23970 (on some targets).
23971
23972 @item -msave-restore
23973 @itemx -mno-save-restore
23974 @opindex msave-restore
23975 Do or don't use smaller but slower prologue and epilogue code that uses
23976 library function calls. The default is to use fast inline prologues and
23977 epilogues.
23978
23979 @item -mstrict-align
23980 @itemx -mno-strict-align
23981 @opindex mstrict-align
23982 Do not or do generate unaligned memory accesses. The default is set depending
23983 on whether the processor we are optimizing for supports fast unaligned access
23984 or not.
23985
23986 @item -mcmodel=medlow
23987 @opindex mcmodel=medlow
23988 Generate code for the medium-low code model. The program and its statically
23989 defined symbols must lie within a single 2 GiB address range and must lie
23990 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23991 statically or dynamically linked. This is the default code model.
23992
23993 @item -mcmodel=medany
23994 @opindex mcmodel=medany
23995 Generate code for the medium-any code model. The program and its statically
23996 defined symbols must be within any single 2 GiB address range. Programs can be
23997 statically or dynamically linked.
23998
23999 @item -mexplicit-relocs
24000 @itemx -mno-exlicit-relocs
24001 Use or do not use assembler relocation operators when dealing with symbolic
24002 addresses. The alternative is to use assembler macros instead, which may
24003 limit optimization.
24004
24005 @item -mrelax
24006 @itemx -mno-relax
24007 Take advantage of linker relaxations to reduce the number of instructions
24008 required to materialize symbol addresses. The default is to take advantage of
24009 linker relaxations.
24010
24011 @item -memit-attribute
24012 @itemx -mno-emit-attribute
24013 Emit (do not emit) RISC-V attribute to record extra information into ELF
24014 objects. This feature requires at least binutils 2.32.
24015 @end table
24016
24017 @node RL78 Options
24018 @subsection RL78 Options
24019 @cindex RL78 Options
24020
24021 @table @gcctabopt
24022
24023 @item -msim
24024 @opindex msim
24025 Links in additional target libraries to support operation within a
24026 simulator.
24027
24028 @item -mmul=none
24029 @itemx -mmul=g10
24030 @itemx -mmul=g13
24031 @itemx -mmul=g14
24032 @itemx -mmul=rl78
24033 @opindex mmul
24034 Specifies the type of hardware multiplication and division support to
24035 be used. The simplest is @code{none}, which uses software for both
24036 multiplication and division. This is the default. The @code{g13}
24037 value is for the hardware multiply/divide peripheral found on the
24038 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24039 the multiplication and division instructions supported by the RL78/G14
24040 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24041 the value @code{mg10} is an alias for @code{none}.
24042
24043 In addition a C preprocessor macro is defined, based upon the setting
24044 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24045 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24046
24047 @item -mcpu=g10
24048 @itemx -mcpu=g13
24049 @itemx -mcpu=g14
24050 @itemx -mcpu=rl78
24051 @opindex mcpu
24052 Specifies the RL78 core to target. The default is the G14 core, also
24053 known as an S3 core or just RL78. The G13 or S2 core does not have
24054 multiply or divide instructions, instead it uses a hardware peripheral
24055 for these operations. The G10 or S1 core does not have register
24056 banks, so it uses a different calling convention.
24057
24058 If this option is set it also selects the type of hardware multiply
24059 support to use, unless this is overridden by an explicit
24060 @option{-mmul=none} option on the command line. Thus specifying
24061 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24062 peripheral and specifying @option{-mcpu=g10} disables the use of
24063 hardware multiplications altogether.
24064
24065 Note, although the RL78/G14 core is the default target, specifying
24066 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24067 change the behavior of the toolchain since it also enables G14
24068 hardware multiply support. If these options are not specified on the
24069 command line then software multiplication routines will be used even
24070 though the code targets the RL78 core. This is for backwards
24071 compatibility with older toolchains which did not have hardware
24072 multiply and divide support.
24073
24074 In addition a C preprocessor macro is defined, based upon the setting
24075 of this option. Possible values are: @code{__RL78_G10__},
24076 @code{__RL78_G13__} or @code{__RL78_G14__}.
24077
24078 @item -mg10
24079 @itemx -mg13
24080 @itemx -mg14
24081 @itemx -mrl78
24082 @opindex mg10
24083 @opindex mg13
24084 @opindex mg14
24085 @opindex mrl78
24086 These are aliases for the corresponding @option{-mcpu=} option. They
24087 are provided for backwards compatibility.
24088
24089 @item -mallregs
24090 @opindex mallregs
24091 Allow the compiler to use all of the available registers. By default
24092 registers @code{r24..r31} are reserved for use in interrupt handlers.
24093 With this option enabled these registers can be used in ordinary
24094 functions as well.
24095
24096 @item -m64bit-doubles
24097 @itemx -m32bit-doubles
24098 @opindex m64bit-doubles
24099 @opindex m32bit-doubles
24100 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24101 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24102 @option{-m32bit-doubles}.
24103
24104 @item -msave-mduc-in-interrupts
24105 @itemx -mno-save-mduc-in-interrupts
24106 @opindex msave-mduc-in-interrupts
24107 @opindex mno-save-mduc-in-interrupts
24108 Specifies that interrupt handler functions should preserve the
24109 MDUC registers. This is only necessary if normal code might use
24110 the MDUC registers, for example because it performs multiplication
24111 and division operations. The default is to ignore the MDUC registers
24112 as this makes the interrupt handlers faster. The target option -mg13
24113 needs to be passed for this to work as this feature is only available
24114 on the G13 target (S2 core). The MDUC registers will only be saved
24115 if the interrupt handler performs a multiplication or division
24116 operation or it calls another function.
24117
24118 @end table
24119
24120 @node RS/6000 and PowerPC Options
24121 @subsection IBM RS/6000 and PowerPC Options
24122 @cindex RS/6000 and PowerPC Options
24123 @cindex IBM RS/6000 and PowerPC Options
24124
24125 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24126 @table @gcctabopt
24127 @item -mpowerpc-gpopt
24128 @itemx -mno-powerpc-gpopt
24129 @itemx -mpowerpc-gfxopt
24130 @itemx -mno-powerpc-gfxopt
24131 @need 800
24132 @itemx -mpowerpc64
24133 @itemx -mno-powerpc64
24134 @itemx -mmfcrf
24135 @itemx -mno-mfcrf
24136 @itemx -mpopcntb
24137 @itemx -mno-popcntb
24138 @itemx -mpopcntd
24139 @itemx -mno-popcntd
24140 @itemx -mfprnd
24141 @itemx -mno-fprnd
24142 @need 800
24143 @itemx -mcmpb
24144 @itemx -mno-cmpb
24145 @itemx -mhard-dfp
24146 @itemx -mno-hard-dfp
24147 @opindex mpowerpc-gpopt
24148 @opindex mno-powerpc-gpopt
24149 @opindex mpowerpc-gfxopt
24150 @opindex mno-powerpc-gfxopt
24151 @opindex mpowerpc64
24152 @opindex mno-powerpc64
24153 @opindex mmfcrf
24154 @opindex mno-mfcrf
24155 @opindex mpopcntb
24156 @opindex mno-popcntb
24157 @opindex mpopcntd
24158 @opindex mno-popcntd
24159 @opindex mfprnd
24160 @opindex mno-fprnd
24161 @opindex mcmpb
24162 @opindex mno-cmpb
24163 @opindex mhard-dfp
24164 @opindex mno-hard-dfp
24165 You use these options to specify which instructions are available on the
24166 processor you are using. The default value of these options is
24167 determined when configuring GCC@. Specifying the
24168 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24169 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24170 rather than the options listed above.
24171
24172 Specifying @option{-mpowerpc-gpopt} allows
24173 GCC to use the optional PowerPC architecture instructions in the
24174 General Purpose group, including floating-point square root. Specifying
24175 @option{-mpowerpc-gfxopt} allows GCC to
24176 use the optional PowerPC architecture instructions in the Graphics
24177 group, including floating-point select.
24178
24179 The @option{-mmfcrf} option allows GCC to generate the move from
24180 condition register field instruction implemented on the POWER4
24181 processor and other processors that support the PowerPC V2.01
24182 architecture.
24183 The @option{-mpopcntb} option allows GCC to generate the popcount and
24184 double-precision FP reciprocal estimate instruction implemented on the
24185 POWER5 processor and other processors that support the PowerPC V2.02
24186 architecture.
24187 The @option{-mpopcntd} option allows GCC to generate the popcount
24188 instruction implemented on the POWER7 processor and other processors
24189 that support the PowerPC V2.06 architecture.
24190 The @option{-mfprnd} option allows GCC to generate the FP round to
24191 integer instructions implemented on the POWER5+ processor and other
24192 processors that support the PowerPC V2.03 architecture.
24193 The @option{-mcmpb} option allows GCC to generate the compare bytes
24194 instruction implemented on the POWER6 processor and other processors
24195 that support the PowerPC V2.05 architecture.
24196 The @option{-mhard-dfp} option allows GCC to generate the decimal
24197 floating-point instructions implemented on some POWER processors.
24198
24199 The @option{-mpowerpc64} option allows GCC to generate the additional
24200 64-bit instructions that are found in the full PowerPC64 architecture
24201 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24202 @option{-mno-powerpc64}.
24203
24204 @item -mcpu=@var{cpu_type}
24205 @opindex mcpu
24206 Set architecture type, register usage, and
24207 instruction scheduling parameters for machine type @var{cpu_type}.
24208 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24209 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24210 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24211 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24212 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24213 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24214 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24215 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24216 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24217 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24218 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24219 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24220
24221 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24222 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24223 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24224 architecture machine types, with an appropriate, generic processor
24225 model assumed for scheduling purposes.
24226
24227 Specifying @samp{native} as cpu type detects and selects the
24228 architecture option that corresponds to the host processor of the
24229 system performing the compilation.
24230 @option{-mcpu=native} has no effect if GCC does not recognize the
24231 processor.
24232
24233 The other options specify a specific processor. Code generated under
24234 those options runs best on that processor, and may not run at all on
24235 others.
24236
24237 The @option{-mcpu} options automatically enable or disable the
24238 following options:
24239
24240 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24241 -mpopcntb -mpopcntd -mpowerpc64 @gol
24242 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24243 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24244 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24245 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24246
24247 The particular options set for any particular CPU varies between
24248 compiler versions, depending on what setting seems to produce optimal
24249 code for that CPU; it doesn't necessarily reflect the actual hardware's
24250 capabilities. If you wish to set an individual option to a particular
24251 value, you may specify it after the @option{-mcpu} option, like
24252 @option{-mcpu=970 -mno-altivec}.
24253
24254 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24255 not enabled or disabled by the @option{-mcpu} option at present because
24256 AIX does not have full support for these options. You may still
24257 enable or disable them individually if you're sure it'll work in your
24258 environment.
24259
24260 @item -mtune=@var{cpu_type}
24261 @opindex mtune
24262 Set the instruction scheduling parameters for machine type
24263 @var{cpu_type}, but do not set the architecture type or register usage,
24264 as @option{-mcpu=@var{cpu_type}} does. The same
24265 values for @var{cpu_type} are used for @option{-mtune} as for
24266 @option{-mcpu}. If both are specified, the code generated uses the
24267 architecture and registers set by @option{-mcpu}, but the
24268 scheduling parameters set by @option{-mtune}.
24269
24270 @item -mcmodel=small
24271 @opindex mcmodel=small
24272 Generate PowerPC64 code for the small model: The TOC is limited to
24273 64k.
24274
24275 @item -mcmodel=medium
24276 @opindex mcmodel=medium
24277 Generate PowerPC64 code for the medium model: The TOC and other static
24278 data may be up to a total of 4G in size. This is the default for 64-bit
24279 Linux.
24280
24281 @item -mcmodel=large
24282 @opindex mcmodel=large
24283 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24284 in size. Other data and code is only limited by the 64-bit address
24285 space.
24286
24287 @item -maltivec
24288 @itemx -mno-altivec
24289 @opindex maltivec
24290 @opindex mno-altivec
24291 Generate code that uses (does not use) AltiVec instructions, and also
24292 enable the use of built-in functions that allow more direct access to
24293 the AltiVec instruction set. You may also need to set
24294 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24295 enhancements.
24296
24297 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24298 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24299 match array element order corresponding to the endianness of the
24300 target. That is, element zero identifies the leftmost element in a
24301 vector register when targeting a big-endian platform, and identifies
24302 the rightmost element in a vector register when targeting a
24303 little-endian platform.
24304
24305 @item -mvrsave
24306 @itemx -mno-vrsave
24307 @opindex mvrsave
24308 @opindex mno-vrsave
24309 Generate VRSAVE instructions when generating AltiVec code.
24310
24311 @item -msecure-plt
24312 @opindex msecure-plt
24313 Generate code that allows @command{ld} and @command{ld.so}
24314 to build executables and shared
24315 libraries with non-executable @code{.plt} and @code{.got} sections.
24316 This is a PowerPC
24317 32-bit SYSV ABI option.
24318
24319 @item -mbss-plt
24320 @opindex mbss-plt
24321 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24322 fills in, and
24323 requires @code{.plt} and @code{.got}
24324 sections that are both writable and executable.
24325 This is a PowerPC 32-bit SYSV ABI option.
24326
24327 @item -misel
24328 @itemx -mno-isel
24329 @opindex misel
24330 @opindex mno-isel
24331 This switch enables or disables the generation of ISEL instructions.
24332
24333 @item -mvsx
24334 @itemx -mno-vsx
24335 @opindex mvsx
24336 @opindex mno-vsx
24337 Generate code that uses (does not use) vector/scalar (VSX)
24338 instructions, and also enable the use of built-in functions that allow
24339 more direct access to the VSX instruction set.
24340
24341 @item -mcrypto
24342 @itemx -mno-crypto
24343 @opindex mcrypto
24344 @opindex mno-crypto
24345 Enable the use (disable) of the built-in functions that allow direct
24346 access to the cryptographic instructions that were added in version
24347 2.07 of the PowerPC ISA.
24348
24349 @item -mhtm
24350 @itemx -mno-htm
24351 @opindex mhtm
24352 @opindex mno-htm
24353 Enable (disable) the use of the built-in functions that allow direct
24354 access to the Hardware Transactional Memory (HTM) instructions that
24355 were added in version 2.07 of the PowerPC ISA.
24356
24357 @item -mpower8-fusion
24358 @itemx -mno-power8-fusion
24359 @opindex mpower8-fusion
24360 @opindex mno-power8-fusion
24361 Generate code that keeps (does not keeps) some integer operations
24362 adjacent so that the instructions can be fused together on power8 and
24363 later processors.
24364
24365 @item -mpower8-vector
24366 @itemx -mno-power8-vector
24367 @opindex mpower8-vector
24368 @opindex mno-power8-vector
24369 Generate code that uses (does not use) the vector and scalar
24370 instructions that were added in version 2.07 of the PowerPC ISA. Also
24371 enable the use of built-in functions that allow more direct access to
24372 the vector instructions.
24373
24374 @item -mquad-memory
24375 @itemx -mno-quad-memory
24376 @opindex mquad-memory
24377 @opindex mno-quad-memory
24378 Generate code that uses (does not use) the non-atomic quad word memory
24379 instructions. The @option{-mquad-memory} option requires use of
24380 64-bit mode.
24381
24382 @item -mquad-memory-atomic
24383 @itemx -mno-quad-memory-atomic
24384 @opindex mquad-memory-atomic
24385 @opindex mno-quad-memory-atomic
24386 Generate code that uses (does not use) the atomic quad word memory
24387 instructions. The @option{-mquad-memory-atomic} option requires use of
24388 64-bit mode.
24389
24390 @item -mfloat128
24391 @itemx -mno-float128
24392 @opindex mfloat128
24393 @opindex mno-float128
24394 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24395 and use either software emulation for IEEE 128-bit floating point or
24396 hardware instructions.
24397
24398 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24399 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24400 use the IEEE 128-bit floating point support. The IEEE 128-bit
24401 floating point support only works on PowerPC Linux systems.
24402
24403 The default for @option{-mfloat128} is enabled on PowerPC Linux
24404 systems using the VSX instruction set, and disabled on other systems.
24405
24406 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24407 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24408 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24409 floating point instructions. Otherwise, if you do not specify to
24410 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24411 system, IEEE 128-bit floating point will be done with software
24412 emulation.
24413
24414 @item -mfloat128-hardware
24415 @itemx -mno-float128-hardware
24416 @opindex mfloat128-hardware
24417 @opindex mno-float128-hardware
24418 Enable/disable using ISA 3.0 hardware instructions to support the
24419 @var{__float128} data type.
24420
24421 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24422 Linux systems using the ISA 3.0 instruction set, and disabled on other
24423 systems.
24424
24425 @item -m32
24426 @itemx -m64
24427 @opindex m32
24428 @opindex m64
24429 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24430 targets (including GNU/Linux). The 32-bit environment sets int, long
24431 and pointer to 32 bits and generates code that runs on any PowerPC
24432 variant. The 64-bit environment sets int to 32 bits and long and
24433 pointer to 64 bits, and generates code for PowerPC64, as for
24434 @option{-mpowerpc64}.
24435
24436 @item -mfull-toc
24437 @itemx -mno-fp-in-toc
24438 @itemx -mno-sum-in-toc
24439 @itemx -mminimal-toc
24440 @opindex mfull-toc
24441 @opindex mno-fp-in-toc
24442 @opindex mno-sum-in-toc
24443 @opindex mminimal-toc
24444 Modify generation of the TOC (Table Of Contents), which is created for
24445 every executable file. The @option{-mfull-toc} option is selected by
24446 default. In that case, GCC allocates at least one TOC entry for
24447 each unique non-automatic variable reference in your program. GCC
24448 also places floating-point constants in the TOC@. However, only
24449 16,384 entries are available in the TOC@.
24450
24451 If you receive a linker error message that saying you have overflowed
24452 the available TOC space, you can reduce the amount of TOC space used
24453 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24454 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24455 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24456 generate code to calculate the sum of an address and a constant at
24457 run time instead of putting that sum into the TOC@. You may specify one
24458 or both of these options. Each causes GCC to produce very slightly
24459 slower and larger code at the expense of conserving TOC space.
24460
24461 If you still run out of space in the TOC even when you specify both of
24462 these options, specify @option{-mminimal-toc} instead. This option causes
24463 GCC to make only one TOC entry for every file. When you specify this
24464 option, GCC produces code that is slower and larger but which
24465 uses extremely little TOC space. You may wish to use this option
24466 only on files that contain less frequently-executed code.
24467
24468 @item -maix64
24469 @itemx -maix32
24470 @opindex maix64
24471 @opindex maix32
24472 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24473 @code{long} type, and the infrastructure needed to support them.
24474 Specifying @option{-maix64} implies @option{-mpowerpc64},
24475 while @option{-maix32} disables the 64-bit ABI and
24476 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24477
24478 @item -mxl-compat
24479 @itemx -mno-xl-compat
24480 @opindex mxl-compat
24481 @opindex mno-xl-compat
24482 Produce code that conforms more closely to IBM XL compiler semantics
24483 when using AIX-compatible ABI@. Pass floating-point arguments to
24484 prototyped functions beyond the register save area (RSA) on the stack
24485 in addition to argument FPRs. Do not assume that most significant
24486 double in 128-bit long double value is properly rounded when comparing
24487 values and converting to double. Use XL symbol names for long double
24488 support routines.
24489
24490 The AIX calling convention was extended but not initially documented to
24491 handle an obscure K&R C case of calling a function that takes the
24492 address of its arguments with fewer arguments than declared. IBM XL
24493 compilers access floating-point arguments that do not fit in the
24494 RSA from the stack when a subroutine is compiled without
24495 optimization. Because always storing floating-point arguments on the
24496 stack is inefficient and rarely needed, this option is not enabled by
24497 default and only is necessary when calling subroutines compiled by IBM
24498 XL compilers without optimization.
24499
24500 @item -mpe
24501 @opindex mpe
24502 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24503 application written to use message passing with special startup code to
24504 enable the application to run. The system must have PE installed in the
24505 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24506 must be overridden with the @option{-specs=} option to specify the
24507 appropriate directory location. The Parallel Environment does not
24508 support threads, so the @option{-mpe} option and the @option{-pthread}
24509 option are incompatible.
24510
24511 @item -malign-natural
24512 @itemx -malign-power
24513 @opindex malign-natural
24514 @opindex malign-power
24515 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24516 @option{-malign-natural} overrides the ABI-defined alignment of larger
24517 types, such as floating-point doubles, on their natural size-based boundary.
24518 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24519 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24520
24521 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24522 is not supported.
24523
24524 @item -msoft-float
24525 @itemx -mhard-float
24526 @opindex msoft-float
24527 @opindex mhard-float
24528 Generate code that does not use (uses) the floating-point register set.
24529 Software floating-point emulation is provided if you use the
24530 @option{-msoft-float} option, and pass the option to GCC when linking.
24531
24532 @item -mmultiple
24533 @itemx -mno-multiple
24534 @opindex mmultiple
24535 @opindex mno-multiple
24536 Generate code that uses (does not use) the load multiple word
24537 instructions and the store multiple word instructions. These
24538 instructions are generated by default on POWER systems, and not
24539 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24540 PowerPC systems, since those instructions do not work when the
24541 processor is in little-endian mode. The exceptions are PPC740 and
24542 PPC750 which permit these instructions in little-endian mode.
24543
24544 @item -mupdate
24545 @itemx -mno-update
24546 @opindex mupdate
24547 @opindex mno-update
24548 Generate code that uses (does not use) the load or store instructions
24549 that update the base register to the address of the calculated memory
24550 location. These instructions are generated by default. If you use
24551 @option{-mno-update}, there is a small window between the time that the
24552 stack pointer is updated and the address of the previous frame is
24553 stored, which means code that walks the stack frame across interrupts or
24554 signals may get corrupted data.
24555
24556 @item -mavoid-indexed-addresses
24557 @itemx -mno-avoid-indexed-addresses
24558 @opindex mavoid-indexed-addresses
24559 @opindex mno-avoid-indexed-addresses
24560 Generate code that tries to avoid (not avoid) the use of indexed load
24561 or store instructions. These instructions can incur a performance
24562 penalty on Power6 processors in certain situations, such as when
24563 stepping through large arrays that cross a 16M boundary. This option
24564 is enabled by default when targeting Power6 and disabled otherwise.
24565
24566 @item -mfused-madd
24567 @itemx -mno-fused-madd
24568 @opindex mfused-madd
24569 @opindex mno-fused-madd
24570 Generate code that uses (does not use) the floating-point multiply and
24571 accumulate instructions. These instructions are generated by default
24572 if hardware floating point is used. The machine-dependent
24573 @option{-mfused-madd} option is now mapped to the machine-independent
24574 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24575 mapped to @option{-ffp-contract=off}.
24576
24577 @item -mmulhw
24578 @itemx -mno-mulhw
24579 @opindex mmulhw
24580 @opindex mno-mulhw
24581 Generate code that uses (does not use) the half-word multiply and
24582 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24583 These instructions are generated by default when targeting those
24584 processors.
24585
24586 @item -mdlmzb
24587 @itemx -mno-dlmzb
24588 @opindex mdlmzb
24589 @opindex mno-dlmzb
24590 Generate code that uses (does not use) the string-search @samp{dlmzb}
24591 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24592 generated by default when targeting those processors.
24593
24594 @item -mno-bit-align
24595 @itemx -mbit-align
24596 @opindex mno-bit-align
24597 @opindex mbit-align
24598 On System V.4 and embedded PowerPC systems do not (do) force structures
24599 and unions that contain bit-fields to be aligned to the base type of the
24600 bit-field.
24601
24602 For example, by default a structure containing nothing but 8
24603 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24604 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24605 the structure is aligned to a 1-byte boundary and is 1 byte in
24606 size.
24607
24608 @item -mno-strict-align
24609 @itemx -mstrict-align
24610 @opindex mno-strict-align
24611 @opindex mstrict-align
24612 On System V.4 and embedded PowerPC systems do not (do) assume that
24613 unaligned memory references are handled by the system.
24614
24615 @item -mrelocatable
24616 @itemx -mno-relocatable
24617 @opindex mrelocatable
24618 @opindex mno-relocatable
24619 Generate code that allows (does not allow) a static executable to be
24620 relocated to a different address at run time. A simple embedded
24621 PowerPC system loader should relocate the entire contents of
24622 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24623 a table of 32-bit addresses generated by this option. For this to
24624 work, all objects linked together must be compiled with
24625 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24626 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24627
24628 @item -mrelocatable-lib
24629 @itemx -mno-relocatable-lib
24630 @opindex mrelocatable-lib
24631 @opindex mno-relocatable-lib
24632 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24633 @code{.fixup} section to allow static executables to be relocated at
24634 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24635 alignment of @option{-mrelocatable}. Objects compiled with
24636 @option{-mrelocatable-lib} may be linked with objects compiled with
24637 any combination of the @option{-mrelocatable} options.
24638
24639 @item -mno-toc
24640 @itemx -mtoc
24641 @opindex mno-toc
24642 @opindex mtoc
24643 On System V.4 and embedded PowerPC systems do not (do) assume that
24644 register 2 contains a pointer to a global area pointing to the addresses
24645 used in the program.
24646
24647 @item -mlittle
24648 @itemx -mlittle-endian
24649 @opindex mlittle
24650 @opindex mlittle-endian
24651 On System V.4 and embedded PowerPC systems compile code for the
24652 processor in little-endian mode. The @option{-mlittle-endian} option is
24653 the same as @option{-mlittle}.
24654
24655 @item -mbig
24656 @itemx -mbig-endian
24657 @opindex mbig
24658 @opindex mbig-endian
24659 On System V.4 and embedded PowerPC systems compile code for the
24660 processor in big-endian mode. The @option{-mbig-endian} option is
24661 the same as @option{-mbig}.
24662
24663 @item -mdynamic-no-pic
24664 @opindex mdynamic-no-pic
24665 On Darwin and Mac OS X systems, compile code so that it is not
24666 relocatable, but that its external references are relocatable. The
24667 resulting code is suitable for applications, but not shared
24668 libraries.
24669
24670 @item -msingle-pic-base
24671 @opindex msingle-pic-base
24672 Treat the register used for PIC addressing as read-only, rather than
24673 loading it in the prologue for each function. The runtime system is
24674 responsible for initializing this register with an appropriate value
24675 before execution begins.
24676
24677 @item -mprioritize-restricted-insns=@var{priority}
24678 @opindex mprioritize-restricted-insns
24679 This option controls the priority that is assigned to
24680 dispatch-slot restricted instructions during the second scheduling
24681 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24682 or @samp{2} to assign no, highest, or second-highest (respectively)
24683 priority to dispatch-slot restricted
24684 instructions.
24685
24686 @item -msched-costly-dep=@var{dependence_type}
24687 @opindex msched-costly-dep
24688 This option controls which dependences are considered costly
24689 by the target during instruction scheduling. The argument
24690 @var{dependence_type} takes one of the following values:
24691
24692 @table @asis
24693 @item @samp{no}
24694 No dependence is costly.
24695
24696 @item @samp{all}
24697 All dependences are costly.
24698
24699 @item @samp{true_store_to_load}
24700 A true dependence from store to load is costly.
24701
24702 @item @samp{store_to_load}
24703 Any dependence from store to load is costly.
24704
24705 @item @var{number}
24706 Any dependence for which the latency is greater than or equal to
24707 @var{number} is costly.
24708 @end table
24709
24710 @item -minsert-sched-nops=@var{scheme}
24711 @opindex minsert-sched-nops
24712 This option controls which NOP insertion scheme is used during
24713 the second scheduling pass. The argument @var{scheme} takes one of the
24714 following values:
24715
24716 @table @asis
24717 @item @samp{no}
24718 Don't insert NOPs.
24719
24720 @item @samp{pad}
24721 Pad with NOPs any dispatch group that has vacant issue slots,
24722 according to the scheduler's grouping.
24723
24724 @item @samp{regroup_exact}
24725 Insert NOPs to force costly dependent insns into
24726 separate groups. Insert exactly as many NOPs as needed to force an insn
24727 to a new group, according to the estimated processor grouping.
24728
24729 @item @var{number}
24730 Insert NOPs to force costly dependent insns into
24731 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24732 @end table
24733
24734 @item -mcall-sysv
24735 @opindex mcall-sysv
24736 On System V.4 and embedded PowerPC systems compile code using calling
24737 conventions that adhere to the March 1995 draft of the System V
24738 Application Binary Interface, PowerPC processor supplement. This is the
24739 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24740
24741 @item -mcall-sysv-eabi
24742 @itemx -mcall-eabi
24743 @opindex mcall-sysv-eabi
24744 @opindex mcall-eabi
24745 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24746
24747 @item -mcall-sysv-noeabi
24748 @opindex mcall-sysv-noeabi
24749 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24750
24751 @item -mcall-aixdesc
24752 @opindex m
24753 On System V.4 and embedded PowerPC systems compile code for the AIX
24754 operating system.
24755
24756 @item -mcall-linux
24757 @opindex mcall-linux
24758 On System V.4 and embedded PowerPC systems compile code for the
24759 Linux-based GNU system.
24760
24761 @item -mcall-freebsd
24762 @opindex mcall-freebsd
24763 On System V.4 and embedded PowerPC systems compile code for the
24764 FreeBSD operating system.
24765
24766 @item -mcall-netbsd
24767 @opindex mcall-netbsd
24768 On System V.4 and embedded PowerPC systems compile code for the
24769 NetBSD operating system.
24770
24771 @item -mcall-openbsd
24772 @opindex mcall-netbsd
24773 On System V.4 and embedded PowerPC systems compile code for the
24774 OpenBSD operating system.
24775
24776 @item -mtraceback=@var{traceback_type}
24777 @opindex mtraceback
24778 Select the type of traceback table. Valid values for @var{traceback_type}
24779 are @samp{full}, @samp{part}, and @samp{no}.
24780
24781 @item -maix-struct-return
24782 @opindex maix-struct-return
24783 Return all structures in memory (as specified by the AIX ABI)@.
24784
24785 @item -msvr4-struct-return
24786 @opindex msvr4-struct-return
24787 Return structures smaller than 8 bytes in registers (as specified by the
24788 SVR4 ABI)@.
24789
24790 @item -mabi=@var{abi-type}
24791 @opindex mabi
24792 Extend the current ABI with a particular extension, or remove such extension.
24793 Valid values are @samp{altivec}, @samp{no-altivec},
24794 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24795 @samp{elfv1}, @samp{elfv2}@.
24796
24797 @item -mabi=ibmlongdouble
24798 @opindex mabi=ibmlongdouble
24799 Change the current ABI to use IBM extended-precision long double.
24800 This is not likely to work if your system defaults to using IEEE
24801 extended-precision long double. If you change the long double type
24802 from IEEE extended-precision, the compiler will issue a warning unless
24803 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24804 to be enabled.
24805
24806 @item -mabi=ieeelongdouble
24807 @opindex mabi=ieeelongdouble
24808 Change the current ABI to use IEEE extended-precision long double.
24809 This is not likely to work if your system defaults to using IBM
24810 extended-precision long double. If you change the long double type
24811 from IBM extended-precision, the compiler will issue a warning unless
24812 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24813 to be enabled.
24814
24815 @item -mabi=elfv1
24816 @opindex mabi=elfv1
24817 Change the current ABI to use the ELFv1 ABI.
24818 This is the default ABI for big-endian PowerPC 64-bit Linux.
24819 Overriding the default ABI requires special system support and is
24820 likely to fail in spectacular ways.
24821
24822 @item -mabi=elfv2
24823 @opindex mabi=elfv2
24824 Change the current ABI to use the ELFv2 ABI.
24825 This is the default ABI for little-endian PowerPC 64-bit Linux.
24826 Overriding the default ABI requires special system support and is
24827 likely to fail in spectacular ways.
24828
24829 @item -mgnu-attribute
24830 @itemx -mno-gnu-attribute
24831 @opindex mgnu-attribute
24832 @opindex mno-gnu-attribute
24833 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24834 .gnu.attributes section that specify ABI variations in function
24835 parameters or return values.
24836
24837 @item -mprototype
24838 @itemx -mno-prototype
24839 @opindex mprototype
24840 @opindex mno-prototype
24841 On System V.4 and embedded PowerPC systems assume that all calls to
24842 variable argument functions are properly prototyped. Otherwise, the
24843 compiler must insert an instruction before every non-prototyped call to
24844 set or clear bit 6 of the condition code register (@code{CR}) to
24845 indicate whether floating-point values are passed in the floating-point
24846 registers in case the function takes variable arguments. With
24847 @option{-mprototype}, only calls to prototyped variable argument functions
24848 set or clear the bit.
24849
24850 @item -msim
24851 @opindex msim
24852 On embedded PowerPC systems, assume that the startup module is called
24853 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24854 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24855 configurations.
24856
24857 @item -mmvme
24858 @opindex mmvme
24859 On embedded PowerPC systems, assume that the startup module is called
24860 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24861 @file{libc.a}.
24862
24863 @item -mads
24864 @opindex mads
24865 On embedded PowerPC systems, assume that the startup module is called
24866 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24867 @file{libc.a}.
24868
24869 @item -myellowknife
24870 @opindex myellowknife
24871 On embedded PowerPC systems, assume that the startup module is called
24872 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24873 @file{libc.a}.
24874
24875 @item -mvxworks
24876 @opindex mvxworks
24877 On System V.4 and embedded PowerPC systems, specify that you are
24878 compiling for a VxWorks system.
24879
24880 @item -memb
24881 @opindex memb
24882 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24883 header to indicate that @samp{eabi} extended relocations are used.
24884
24885 @item -meabi
24886 @itemx -mno-eabi
24887 @opindex meabi
24888 @opindex mno-eabi
24889 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24890 Embedded Applications Binary Interface (EABI), which is a set of
24891 modifications to the System V.4 specifications. Selecting @option{-meabi}
24892 means that the stack is aligned to an 8-byte boundary, a function
24893 @code{__eabi} is called from @code{main} to set up the EABI
24894 environment, and the @option{-msdata} option can use both @code{r2} and
24895 @code{r13} to point to two separate small data areas. Selecting
24896 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24897 no EABI initialization function is called from @code{main}, and the
24898 @option{-msdata} option only uses @code{r13} to point to a single
24899 small data area. The @option{-meabi} option is on by default if you
24900 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24901
24902 @item -msdata=eabi
24903 @opindex msdata=eabi
24904 On System V.4 and embedded PowerPC systems, put small initialized
24905 @code{const} global and static data in the @code{.sdata2} section, which
24906 is pointed to by register @code{r2}. Put small initialized
24907 non-@code{const} global and static data in the @code{.sdata} section,
24908 which is pointed to by register @code{r13}. Put small uninitialized
24909 global and static data in the @code{.sbss} section, which is adjacent to
24910 the @code{.sdata} section. The @option{-msdata=eabi} option is
24911 incompatible with the @option{-mrelocatable} option. The
24912 @option{-msdata=eabi} option also sets the @option{-memb} option.
24913
24914 @item -msdata=sysv
24915 @opindex msdata=sysv
24916 On System V.4 and embedded PowerPC systems, put small global and static
24917 data in the @code{.sdata} section, which is pointed to by register
24918 @code{r13}. Put small uninitialized global and static data in the
24919 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24920 The @option{-msdata=sysv} option is incompatible with the
24921 @option{-mrelocatable} option.
24922
24923 @item -msdata=default
24924 @itemx -msdata
24925 @opindex msdata=default
24926 @opindex msdata
24927 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24928 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24929 same as @option{-msdata=sysv}.
24930
24931 @item -msdata=data
24932 @opindex msdata=data
24933 On System V.4 and embedded PowerPC systems, put small global
24934 data in the @code{.sdata} section. Put small uninitialized global
24935 data in the @code{.sbss} section. Do not use register @code{r13}
24936 to address small data however. This is the default behavior unless
24937 other @option{-msdata} options are used.
24938
24939 @item -msdata=none
24940 @itemx -mno-sdata
24941 @opindex msdata=none
24942 @opindex mno-sdata
24943 On embedded PowerPC systems, put all initialized global and static data
24944 in the @code{.data} section, and all uninitialized data in the
24945 @code{.bss} section.
24946
24947 @item -mreadonly-in-sdata
24948 @opindex mreadonly-in-sdata
24949 @opindex mno-readonly-in-sdata
24950 Put read-only objects in the @code{.sdata} section as well. This is the
24951 default.
24952
24953 @item -mblock-move-inline-limit=@var{num}
24954 @opindex mblock-move-inline-limit
24955 Inline all block moves (such as calls to @code{memcpy} or structure
24956 copies) less than or equal to @var{num} bytes. The minimum value for
24957 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24958 targets. The default value is target-specific.
24959
24960 @item -mblock-compare-inline-limit=@var{num}
24961 @opindex mblock-compare-inline-limit
24962 Generate non-looping inline code for all block compares (such as calls
24963 to @code{memcmp} or structure compares) less than or equal to @var{num}
24964 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24965 block compare is disabled. The default value is target-specific.
24966
24967 @item -mblock-compare-inline-loop-limit=@var{num}
24968 @opindex mblock-compare-inline-loop-limit
24969 Generate an inline expansion using loop code for all block compares that
24970 are less than or equal to @var{num} bytes, but greater than the limit
24971 for non-loop inline block compare expansion. If the block length is not
24972 constant, at most @var{num} bytes will be compared before @code{memcmp}
24973 is called to compare the remainder of the block. The default value is
24974 target-specific.
24975
24976 @item -mstring-compare-inline-limit=@var{num}
24977 @opindex mstring-compare-inline-limit
24978 Compare at most @var{num} string bytes with inline code.
24979 If the difference or end of string is not found at the
24980 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24981 take care of the rest of the comparison. The default is 64 bytes.
24982
24983 @item -G @var{num}
24984 @opindex G
24985 @cindex smaller data references (PowerPC)
24986 @cindex .sdata/.sdata2 references (PowerPC)
24987 On embedded PowerPC systems, put global and static items less than or
24988 equal to @var{num} bytes into the small data or BSS sections instead of
24989 the normal data or BSS section. By default, @var{num} is 8. The
24990 @option{-G @var{num}} switch is also passed to the linker.
24991 All modules should be compiled with the same @option{-G @var{num}} value.
24992
24993 @item -mregnames
24994 @itemx -mno-regnames
24995 @opindex mregnames
24996 @opindex mno-regnames
24997 On System V.4 and embedded PowerPC systems do (do not) emit register
24998 names in the assembly language output using symbolic forms.
24999
25000 @item -mlongcall
25001 @itemx -mno-longcall
25002 @opindex mlongcall
25003 @opindex mno-longcall
25004 By default assume that all calls are far away so that a longer and more
25005 expensive calling sequence is required. This is required for calls
25006 farther than 32 megabytes (33,554,432 bytes) from the current location.
25007 A short call is generated if the compiler knows
25008 the call cannot be that far away. This setting can be overridden by
25009 the @code{shortcall} function attribute, or by @code{#pragma
25010 longcall(0)}.
25011
25012 Some linkers are capable of detecting out-of-range calls and generating
25013 glue code on the fly. On these systems, long calls are unnecessary and
25014 generate slower code. As of this writing, the AIX linker can do this,
25015 as can the GNU linker for PowerPC/64. It is planned to add this feature
25016 to the GNU linker for 32-bit PowerPC systems as well.
25017
25018 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
25019 GCC can generate long calls using an inline PLT call sequence (see
25020 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
25021 ELFv1 (big-endian) do not support inline PLT calls.
25022
25023 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25024 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25025 addresses represent the callee and the branch island. The
25026 Darwin/PPC linker prefers the first address and generates a @code{bl
25027 callee} if the PPC @code{bl} instruction reaches the callee directly;
25028 otherwise, the linker generates @code{bl L42} to call the branch
25029 island. The branch island is appended to the body of the
25030 calling function; it computes the full 32-bit address of the callee
25031 and jumps to it.
25032
25033 On Mach-O (Darwin) systems, this option directs the compiler emit to
25034 the glue for every direct call, and the Darwin linker decides whether
25035 to use or discard it.
25036
25037 In the future, GCC may ignore all longcall specifications
25038 when the linker is known to generate glue.
25039
25040 @item -mpltseq
25041 @itemx -mno-pltseq
25042 @opindex mpltseq
25043 @opindex mno-pltseq
25044 Implement (do not implement) -fno-plt and long calls using an inline
25045 PLT call sequence that supports lazy linking and long calls to
25046 functions in dlopen'd shared libraries. Inline PLT calls are only
25047 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25048 linkers, and are enabled by default if the support is detected when
25049 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25050 configured with @option{--enable-secureplt}. @option{-mpltseq} code
25051 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25052 linked together.
25053
25054 @item -mtls-markers
25055 @itemx -mno-tls-markers
25056 @opindex mtls-markers
25057 @opindex mno-tls-markers
25058 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25059 specifying the function argument. The relocation allows the linker to
25060 reliably associate function call with argument setup instructions for
25061 TLS optimization, which in turn allows GCC to better schedule the
25062 sequence.
25063
25064 @item -mrecip
25065 @itemx -mno-recip
25066 @opindex mrecip
25067 This option enables use of the reciprocal estimate and
25068 reciprocal square root estimate instructions with additional
25069 Newton-Raphson steps to increase precision instead of doing a divide or
25070 square root and divide for floating-point arguments. You should use
25071 the @option{-ffast-math} option when using @option{-mrecip} (or at
25072 least @option{-funsafe-math-optimizations},
25073 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25074 @option{-fno-trapping-math}). Note that while the throughput of the
25075 sequence is generally higher than the throughput of the non-reciprocal
25076 instruction, the precision of the sequence can be decreased by up to 2
25077 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25078 roots.
25079
25080 @item -mrecip=@var{opt}
25081 @opindex mrecip=opt
25082 This option controls which reciprocal estimate instructions
25083 may be used. @var{opt} is a comma-separated list of options, which may
25084 be preceded by a @code{!} to invert the option:
25085
25086 @table @samp
25087
25088 @item all
25089 Enable all estimate instructions.
25090
25091 @item default
25092 Enable the default instructions, equivalent to @option{-mrecip}.
25093
25094 @item none
25095 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25096
25097 @item div
25098 Enable the reciprocal approximation instructions for both
25099 single and double precision.
25100
25101 @item divf
25102 Enable the single-precision reciprocal approximation instructions.
25103
25104 @item divd
25105 Enable the double-precision reciprocal approximation instructions.
25106
25107 @item rsqrt
25108 Enable the reciprocal square root approximation instructions for both
25109 single and double precision.
25110
25111 @item rsqrtf
25112 Enable the single-precision reciprocal square root approximation instructions.
25113
25114 @item rsqrtd
25115 Enable the double-precision reciprocal square root approximation instructions.
25116
25117 @end table
25118
25119 So, for example, @option{-mrecip=all,!rsqrtd} enables
25120 all of the reciprocal estimate instructions, except for the
25121 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25122 which handle the double-precision reciprocal square root calculations.
25123
25124 @item -mrecip-precision
25125 @itemx -mno-recip-precision
25126 @opindex mrecip-precision
25127 Assume (do not assume) that the reciprocal estimate instructions
25128 provide higher-precision estimates than is mandated by the PowerPC
25129 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25130 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25131 The double-precision square root estimate instructions are not generated by
25132 default on low-precision machines, since they do not provide an
25133 estimate that converges after three steps.
25134
25135 @item -mveclibabi=@var{type}
25136 @opindex mveclibabi
25137 Specifies the ABI type to use for vectorizing intrinsics using an
25138 external library. The only type supported at present is @samp{mass},
25139 which specifies to use IBM's Mathematical Acceleration Subsystem
25140 (MASS) libraries for vectorizing intrinsics using external libraries.
25141 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25142 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25143 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25144 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25145 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25146 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25147 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25148 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25149 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25150 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25151 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25152 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25153 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25154 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25155 for power7. Both @option{-ftree-vectorize} and
25156 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25157 libraries must be specified at link time.
25158
25159 @item -mfriz
25160 @itemx -mno-friz
25161 @opindex mfriz
25162 Generate (do not generate) the @code{friz} instruction when the
25163 @option{-funsafe-math-optimizations} option is used to optimize
25164 rounding of floating-point values to 64-bit integer and back to floating
25165 point. The @code{friz} instruction does not return the same value if
25166 the floating-point number is too large to fit in an integer.
25167
25168 @item -mpointers-to-nested-functions
25169 @itemx -mno-pointers-to-nested-functions
25170 @opindex mpointers-to-nested-functions
25171 Generate (do not generate) code to load up the static chain register
25172 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25173 systems where a function pointer points to a 3-word descriptor giving
25174 the function address, TOC value to be loaded in register @code{r2}, and
25175 static chain value to be loaded in register @code{r11}. The
25176 @option{-mpointers-to-nested-functions} is on by default. You cannot
25177 call through pointers to nested functions or pointers
25178 to functions compiled in other languages that use the static chain if
25179 you use @option{-mno-pointers-to-nested-functions}.
25180
25181 @item -msave-toc-indirect
25182 @itemx -mno-save-toc-indirect
25183 @opindex msave-toc-indirect
25184 Generate (do not generate) code to save the TOC value in the reserved
25185 stack location in the function prologue if the function calls through
25186 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25187 saved in the prologue, it is saved just before the call through the
25188 pointer. The @option{-mno-save-toc-indirect} option is the default.
25189
25190 @item -mcompat-align-parm
25191 @itemx -mno-compat-align-parm
25192 @opindex mcompat-align-parm
25193 Generate (do not generate) code to pass structure parameters with a
25194 maximum alignment of 64 bits, for compatibility with older versions
25195 of GCC.
25196
25197 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25198 structure parameter on a 128-bit boundary when that structure contained
25199 a member requiring 128-bit alignment. This is corrected in more
25200 recent versions of GCC. This option may be used to generate code
25201 that is compatible with functions compiled with older versions of
25202 GCC.
25203
25204 The @option{-mno-compat-align-parm} option is the default.
25205
25206 @item -mstack-protector-guard=@var{guard}
25207 @itemx -mstack-protector-guard-reg=@var{reg}
25208 @itemx -mstack-protector-guard-offset=@var{offset}
25209 @itemx -mstack-protector-guard-symbol=@var{symbol}
25210 @opindex mstack-protector-guard
25211 @opindex mstack-protector-guard-reg
25212 @opindex mstack-protector-guard-offset
25213 @opindex mstack-protector-guard-symbol
25214 Generate stack protection code using canary at @var{guard}. Supported
25215 locations are @samp{global} for global canary or @samp{tls} for per-thread
25216 canary in the TLS block (the default with GNU libc version 2.4 or later).
25217
25218 With the latter choice the options
25219 @option{-mstack-protector-guard-reg=@var{reg}} and
25220 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25221 which register to use as base register for reading the canary, and from what
25222 offset from that base register. The default for those is as specified in the
25223 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25224 the offset with a symbol reference to a canary in the TLS block.
25225
25226 @item -mpcrel
25227 @itemx -mno-pcrel
25228 @opindex mpcrel
25229 @opindex mno-pcrel
25230 Generate (do not generate) pc-relative addressing when the option
25231 @option{-mcpu=future} is used.
25232 @end table
25233
25234 @node RX Options
25235 @subsection RX Options
25236 @cindex RX Options
25237
25238 These command-line options are defined for RX targets:
25239
25240 @table @gcctabopt
25241 @item -m64bit-doubles
25242 @itemx -m32bit-doubles
25243 @opindex m64bit-doubles
25244 @opindex m32bit-doubles
25245 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25246 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25247 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25248 works on 32-bit values, which is why the default is
25249 @option{-m32bit-doubles}.
25250
25251 @item -fpu
25252 @itemx -nofpu
25253 @opindex fpu
25254 @opindex nofpu
25255 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25256 floating-point hardware. The default is enabled for the RX600
25257 series and disabled for the RX200 series.
25258
25259 Floating-point instructions are only generated for 32-bit floating-point
25260 values, however, so the FPU hardware is not used for doubles if the
25261 @option{-m64bit-doubles} option is used.
25262
25263 @emph{Note} If the @option{-fpu} option is enabled then
25264 @option{-funsafe-math-optimizations} is also enabled automatically.
25265 This is because the RX FPU instructions are themselves unsafe.
25266
25267 @item -mcpu=@var{name}
25268 @opindex mcpu
25269 Selects the type of RX CPU to be targeted. Currently three types are
25270 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25271 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25272
25273 The only difference between @samp{RX600} and @samp{RX610} is that the
25274 @samp{RX610} does not support the @code{MVTIPL} instruction.
25275
25276 The @samp{RX200} series does not have a hardware floating-point unit
25277 and so @option{-nofpu} is enabled by default when this type is
25278 selected.
25279
25280 @item -mbig-endian-data
25281 @itemx -mlittle-endian-data
25282 @opindex mbig-endian-data
25283 @opindex mlittle-endian-data
25284 Store data (but not code) in the big-endian format. The default is
25285 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25286 format.
25287
25288 @item -msmall-data-limit=@var{N}
25289 @opindex msmall-data-limit
25290 Specifies the maximum size in bytes of global and static variables
25291 which can be placed into the small data area. Using the small data
25292 area can lead to smaller and faster code, but the size of area is
25293 limited and it is up to the programmer to ensure that the area does
25294 not overflow. Also when the small data area is used one of the RX's
25295 registers (usually @code{r13}) is reserved for use pointing to this
25296 area, so it is no longer available for use by the compiler. This
25297 could result in slower and/or larger code if variables are pushed onto
25298 the stack instead of being held in this register.
25299
25300 Note, common variables (variables that have not been initialized) and
25301 constants are not placed into the small data area as they are assigned
25302 to other sections in the output executable.
25303
25304 The default value is zero, which disables this feature. Note, this
25305 feature is not enabled by default with higher optimization levels
25306 (@option{-O2} etc) because of the potentially detrimental effects of
25307 reserving a register. It is up to the programmer to experiment and
25308 discover whether this feature is of benefit to their program. See the
25309 description of the @option{-mpid} option for a description of how the
25310 actual register to hold the small data area pointer is chosen.
25311
25312 @item -msim
25313 @itemx -mno-sim
25314 @opindex msim
25315 @opindex mno-sim
25316 Use the simulator runtime. The default is to use the libgloss
25317 board-specific runtime.
25318
25319 @item -mas100-syntax
25320 @itemx -mno-as100-syntax
25321 @opindex mas100-syntax
25322 @opindex mno-as100-syntax
25323 When generating assembler output use a syntax that is compatible with
25324 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25325 assembler, but it has some restrictions so it is not generated by default.
25326
25327 @item -mmax-constant-size=@var{N}
25328 @opindex mmax-constant-size
25329 Specifies the maximum size, in bytes, of a constant that can be used as
25330 an operand in a RX instruction. Although the RX instruction set does
25331 allow constants of up to 4 bytes in length to be used in instructions,
25332 a longer value equates to a longer instruction. Thus in some
25333 circumstances it can be beneficial to restrict the size of constants
25334 that are used in instructions. Constants that are too big are instead
25335 placed into a constant pool and referenced via register indirection.
25336
25337 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25338 or 4 means that constants of any size are allowed.
25339
25340 @item -mrelax
25341 @opindex mrelax
25342 Enable linker relaxation. Linker relaxation is a process whereby the
25343 linker attempts to reduce the size of a program by finding shorter
25344 versions of various instructions. Disabled by default.
25345
25346 @item -mint-register=@var{N}
25347 @opindex mint-register
25348 Specify the number of registers to reserve for fast interrupt handler
25349 functions. The value @var{N} can be between 0 and 4. A value of 1
25350 means that register @code{r13} is reserved for the exclusive use
25351 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25352 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25353 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25354 A value of 0, the default, does not reserve any registers.
25355
25356 @item -msave-acc-in-interrupts
25357 @opindex msave-acc-in-interrupts
25358 Specifies that interrupt handler functions should preserve the
25359 accumulator register. This is only necessary if normal code might use
25360 the accumulator register, for example because it performs 64-bit
25361 multiplications. The default is to ignore the accumulator as this
25362 makes the interrupt handlers faster.
25363
25364 @item -mpid
25365 @itemx -mno-pid
25366 @opindex mpid
25367 @opindex mno-pid
25368 Enables the generation of position independent data. When enabled any
25369 access to constant data is done via an offset from a base address
25370 held in a register. This allows the location of constant data to be
25371 determined at run time without requiring the executable to be
25372 relocated, which is a benefit to embedded applications with tight
25373 memory constraints. Data that can be modified is not affected by this
25374 option.
25375
25376 Note, using this feature reserves a register, usually @code{r13}, for
25377 the constant data base address. This can result in slower and/or
25378 larger code, especially in complicated functions.
25379
25380 The actual register chosen to hold the constant data base address
25381 depends upon whether the @option{-msmall-data-limit} and/or the
25382 @option{-mint-register} command-line options are enabled. Starting
25383 with register @code{r13} and proceeding downwards, registers are
25384 allocated first to satisfy the requirements of @option{-mint-register},
25385 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25386 is possible for the small data area register to be @code{r8} if both
25387 @option{-mint-register=4} and @option{-mpid} are specified on the
25388 command line.
25389
25390 By default this feature is not enabled. The default can be restored
25391 via the @option{-mno-pid} command-line option.
25392
25393 @item -mno-warn-multiple-fast-interrupts
25394 @itemx -mwarn-multiple-fast-interrupts
25395 @opindex mno-warn-multiple-fast-interrupts
25396 @opindex mwarn-multiple-fast-interrupts
25397 Prevents GCC from issuing a warning message if it finds more than one
25398 fast interrupt handler when it is compiling a file. The default is to
25399 issue a warning for each extra fast interrupt handler found, as the RX
25400 only supports one such interrupt.
25401
25402 @item -mallow-string-insns
25403 @itemx -mno-allow-string-insns
25404 @opindex mallow-string-insns
25405 @opindex mno-allow-string-insns
25406 Enables or disables the use of the string manipulation instructions
25407 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25408 @code{SWHILE} and also the @code{RMPA} instruction. These
25409 instructions may prefetch data, which is not safe to do if accessing
25410 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25411 for more information).
25412
25413 The default is to allow these instructions, but it is not possible for
25414 GCC to reliably detect all circumstances where a string instruction
25415 might be used to access an I/O register, so their use cannot be
25416 disabled automatically. Instead it is reliant upon the programmer to
25417 use the @option{-mno-allow-string-insns} option if their program
25418 accesses I/O space.
25419
25420 When the instructions are enabled GCC defines the C preprocessor
25421 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25422 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25423
25424 @item -mjsr
25425 @itemx -mno-jsr
25426 @opindex mjsr
25427 @opindex mno-jsr
25428 Use only (or not only) @code{JSR} instructions to access functions.
25429 This option can be used when code size exceeds the range of @code{BSR}
25430 instructions. Note that @option{-mno-jsr} does not mean to not use
25431 @code{JSR} but instead means that any type of branch may be used.
25432 @end table
25433
25434 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25435 has special significance to the RX port when used with the
25436 @code{interrupt} function attribute. This attribute indicates a
25437 function intended to process fast interrupts. GCC ensures
25438 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25439 and/or @code{r13} and only provided that the normal use of the
25440 corresponding registers have been restricted via the
25441 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25442 options.
25443
25444 @node S/390 and zSeries Options
25445 @subsection S/390 and zSeries Options
25446 @cindex S/390 and zSeries Options
25447
25448 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25449
25450 @table @gcctabopt
25451 @item -mhard-float
25452 @itemx -msoft-float
25453 @opindex mhard-float
25454 @opindex msoft-float
25455 Use (do not use) the hardware floating-point instructions and registers
25456 for floating-point operations. When @option{-msoft-float} is specified,
25457 functions in @file{libgcc.a} are used to perform floating-point
25458 operations. When @option{-mhard-float} is specified, the compiler
25459 generates IEEE floating-point instructions. This is the default.
25460
25461 @item -mhard-dfp
25462 @itemx -mno-hard-dfp
25463 @opindex mhard-dfp
25464 @opindex mno-hard-dfp
25465 Use (do not use) the hardware decimal-floating-point instructions for
25466 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25467 specified, functions in @file{libgcc.a} are used to perform
25468 decimal-floating-point operations. When @option{-mhard-dfp} is
25469 specified, the compiler generates decimal-floating-point hardware
25470 instructions. This is the default for @option{-march=z9-ec} or higher.
25471
25472 @item -mlong-double-64
25473 @itemx -mlong-double-128
25474 @opindex mlong-double-64
25475 @opindex mlong-double-128
25476 These switches control the size of @code{long double} type. A size
25477 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25478 type. This is the default.
25479
25480 @item -mbackchain
25481 @itemx -mno-backchain
25482 @opindex mbackchain
25483 @opindex mno-backchain
25484 Store (do not store) the address of the caller's frame as backchain pointer
25485 into the callee's stack frame.
25486 A backchain may be needed to allow debugging using tools that do not understand
25487 DWARF call frame information.
25488 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25489 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25490 the backchain is placed into the topmost word of the 96/160 byte register
25491 save area.
25492
25493 In general, code compiled with @option{-mbackchain} is call-compatible with
25494 code compiled with @option{-mmo-backchain}; however, use of the backchain
25495 for debugging purposes usually requires that the whole binary is built with
25496 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25497 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25498 to build a linux kernel use @option{-msoft-float}.
25499
25500 The default is to not maintain the backchain.
25501
25502 @item -mpacked-stack
25503 @itemx -mno-packed-stack
25504 @opindex mpacked-stack
25505 @opindex mno-packed-stack
25506 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25507 specified, the compiler uses the all fields of the 96/160 byte register save
25508 area only for their default purpose; unused fields still take up stack space.
25509 When @option{-mpacked-stack} is specified, register save slots are densely
25510 packed at the top of the register save area; unused space is reused for other
25511 purposes, allowing for more efficient use of the available stack space.
25512 However, when @option{-mbackchain} is also in effect, the topmost word of
25513 the save area is always used to store the backchain, and the return address
25514 register is always saved two words below the backchain.
25515
25516 As long as the stack frame backchain is not used, code generated with
25517 @option{-mpacked-stack} is call-compatible with code generated with
25518 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25519 S/390 or zSeries generated code that uses the stack frame backchain at run
25520 time, not just for debugging purposes. Such code is not call-compatible
25521 with code compiled with @option{-mpacked-stack}. Also, note that the
25522 combination of @option{-mbackchain},
25523 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25524 to build a linux kernel use @option{-msoft-float}.
25525
25526 The default is to not use the packed stack layout.
25527
25528 @item -msmall-exec
25529 @itemx -mno-small-exec
25530 @opindex msmall-exec
25531 @opindex mno-small-exec
25532 Generate (or do not generate) code using the @code{bras} instruction
25533 to do subroutine calls.
25534 This only works reliably if the total executable size does not
25535 exceed 64k. The default is to use the @code{basr} instruction instead,
25536 which does not have this limitation.
25537
25538 @item -m64
25539 @itemx -m31
25540 @opindex m64
25541 @opindex m31
25542 When @option{-m31} is specified, generate code compliant to the
25543 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25544 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25545 particular to generate 64-bit instructions. For the @samp{s390}
25546 targets, the default is @option{-m31}, while the @samp{s390x}
25547 targets default to @option{-m64}.
25548
25549 @item -mzarch
25550 @itemx -mesa
25551 @opindex mzarch
25552 @opindex mesa
25553 When @option{-mzarch} is specified, generate code using the
25554 instructions available on z/Architecture.
25555 When @option{-mesa} is specified, generate code using the
25556 instructions available on ESA/390. Note that @option{-mesa} is
25557 not possible with @option{-m64}.
25558 When generating code compliant to the GNU/Linux for S/390 ABI,
25559 the default is @option{-mesa}. When generating code compliant
25560 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25561
25562 @item -mhtm
25563 @itemx -mno-htm
25564 @opindex mhtm
25565 @opindex mno-htm
25566 The @option{-mhtm} option enables a set of builtins making use of
25567 instructions available with the transactional execution facility
25568 introduced with the IBM zEnterprise EC12 machine generation
25569 @ref{S/390 System z Built-in Functions}.
25570 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25571
25572 @item -mvx
25573 @itemx -mno-vx
25574 @opindex mvx
25575 @opindex mno-vx
25576 When @option{-mvx} is specified, generate code using the instructions
25577 available with the vector extension facility introduced with the IBM
25578 z13 machine generation.
25579 This option changes the ABI for some vector type values with regard to
25580 alignment and calling conventions. In case vector type values are
25581 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25582 command will be added to mark the resulting binary with the ABI used.
25583 @option{-mvx} is enabled by default when using @option{-march=z13}.
25584
25585 @item -mzvector
25586 @itemx -mno-zvector
25587 @opindex mzvector
25588 @opindex mno-zvector
25589 The @option{-mzvector} option enables vector language extensions and
25590 builtins using instructions available with the vector extension
25591 facility introduced with the IBM z13 machine generation.
25592 This option adds support for @samp{vector} to be used as a keyword to
25593 define vector type variables and arguments. @samp{vector} is only
25594 available when GNU extensions are enabled. It will not be expanded
25595 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25596 In addition to the GCC low-level builtins @option{-mzvector} enables
25597 a set of builtins added for compatibility with AltiVec-style
25598 implementations like Power and Cell. In order to make use of these
25599 builtins the header file @file{vecintrin.h} needs to be included.
25600 @option{-mzvector} is disabled by default.
25601
25602 @item -mmvcle
25603 @itemx -mno-mvcle
25604 @opindex mmvcle
25605 @opindex mno-mvcle
25606 Generate (or do not generate) code using the @code{mvcle} instruction
25607 to perform block moves. When @option{-mno-mvcle} is specified,
25608 use a @code{mvc} loop instead. This is the default unless optimizing for
25609 size.
25610
25611 @item -mdebug
25612 @itemx -mno-debug
25613 @opindex mdebug
25614 @opindex mno-debug
25615 Print (or do not print) additional debug information when compiling.
25616 The default is to not print debug information.
25617
25618 @item -march=@var{cpu-type}
25619 @opindex march
25620 Generate code that runs on @var{cpu-type}, which is the name of a
25621 system representing a certain processor type. Possible values for
25622 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25623 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25624 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25625 @samp{z14}/@samp{arch12}, and @samp{native}.
25626
25627 The default is @option{-march=z900}.
25628
25629 Specifying @samp{native} as cpu type can be used to select the best
25630 architecture option for the host processor.
25631 @option{-march=native} has no effect if GCC does not recognize the
25632 processor.
25633
25634 @item -mtune=@var{cpu-type}
25635 @opindex mtune
25636 Tune to @var{cpu-type} everything applicable about the generated code,
25637 except for the ABI and the set of available instructions.
25638 The list of @var{cpu-type} values is the same as for @option{-march}.
25639 The default is the value used for @option{-march}.
25640
25641 @item -mtpf-trace
25642 @itemx -mno-tpf-trace
25643 @opindex mtpf-trace
25644 @opindex mno-tpf-trace
25645 Generate code that adds (does not add) in TPF OS specific branches to trace
25646 routines in the operating system. This option is off by default, even
25647 when compiling for the TPF OS@.
25648
25649 @item -mfused-madd
25650 @itemx -mno-fused-madd
25651 @opindex mfused-madd
25652 @opindex mno-fused-madd
25653 Generate code that uses (does not use) the floating-point multiply and
25654 accumulate instructions. These instructions are generated by default if
25655 hardware floating point is used.
25656
25657 @item -mwarn-framesize=@var{framesize}
25658 @opindex mwarn-framesize
25659 Emit a warning if the current function exceeds the given frame size. Because
25660 this is a compile-time check it doesn't need to be a real problem when the program
25661 runs. It is intended to identify functions that most probably cause
25662 a stack overflow. It is useful to be used in an environment with limited stack
25663 size e.g.@: the linux kernel.
25664
25665 @item -mwarn-dynamicstack
25666 @opindex mwarn-dynamicstack
25667 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25668 arrays. This is generally a bad idea with a limited stack size.
25669
25670 @item -mstack-guard=@var{stack-guard}
25671 @itemx -mstack-size=@var{stack-size}
25672 @opindex mstack-guard
25673 @opindex mstack-size
25674 If these options are provided the S/390 back end emits additional instructions in
25675 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25676 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25677 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25678 the frame size of the compiled function is chosen.
25679 These options are intended to be used to help debugging stack overflow problems.
25680 The additionally emitted code causes only little overhead and hence can also be
25681 used in production-like systems without greater performance degradation. The given
25682 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25683 @var{stack-guard} without exceeding 64k.
25684 In order to be efficient the extra code makes the assumption that the stack starts
25685 at an address aligned to the value given by @var{stack-size}.
25686 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25687
25688 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25689 @opindex mhotpatch
25690 If the hotpatch option is enabled, a ``hot-patching'' function
25691 prologue is generated for all functions in the compilation unit.
25692 The funtion label is prepended with the given number of two-byte
25693 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25694 the label, 2 * @var{post-halfwords} bytes are appended, using the
25695 largest NOP like instructions the architecture allows (maximum
25696 1000000).
25697
25698 If both arguments are zero, hotpatching is disabled.
25699
25700 This option can be overridden for individual functions with the
25701 @code{hotpatch} attribute.
25702 @end table
25703
25704 @node Score Options
25705 @subsection Score Options
25706 @cindex Score Options
25707
25708 These options are defined for Score implementations:
25709
25710 @table @gcctabopt
25711 @item -meb
25712 @opindex meb
25713 Compile code for big-endian mode. This is the default.
25714
25715 @item -mel
25716 @opindex mel
25717 Compile code for little-endian mode.
25718
25719 @item -mnhwloop
25720 @opindex mnhwloop
25721 Disable generation of @code{bcnz} instructions.
25722
25723 @item -muls
25724 @opindex muls
25725 Enable generation of unaligned load and store instructions.
25726
25727 @item -mmac
25728 @opindex mmac
25729 Enable the use of multiply-accumulate instructions. Disabled by default.
25730
25731 @item -mscore5
25732 @opindex mscore5
25733 Specify the SCORE5 as the target architecture.
25734
25735 @item -mscore5u
25736 @opindex mscore5u
25737 Specify the SCORE5U of the target architecture.
25738
25739 @item -mscore7
25740 @opindex mscore7
25741 Specify the SCORE7 as the target architecture. This is the default.
25742
25743 @item -mscore7d
25744 @opindex mscore7d
25745 Specify the SCORE7D as the target architecture.
25746 @end table
25747
25748 @node SH Options
25749 @subsection SH Options
25750
25751 These @samp{-m} options are defined for the SH implementations:
25752
25753 @table @gcctabopt
25754 @item -m1
25755 @opindex m1
25756 Generate code for the SH1.
25757
25758 @item -m2
25759 @opindex m2
25760 Generate code for the SH2.
25761
25762 @item -m2e
25763 Generate code for the SH2e.
25764
25765 @item -m2a-nofpu
25766 @opindex m2a-nofpu
25767 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25768 that the floating-point unit is not used.
25769
25770 @item -m2a-single-only
25771 @opindex m2a-single-only
25772 Generate code for the SH2a-FPU, in such a way that no double-precision
25773 floating-point operations are used.
25774
25775 @item -m2a-single
25776 @opindex m2a-single
25777 Generate code for the SH2a-FPU assuming the floating-point unit is in
25778 single-precision mode by default.
25779
25780 @item -m2a
25781 @opindex m2a
25782 Generate code for the SH2a-FPU assuming the floating-point unit is in
25783 double-precision mode by default.
25784
25785 @item -m3
25786 @opindex m3
25787 Generate code for the SH3.
25788
25789 @item -m3e
25790 @opindex m3e
25791 Generate code for the SH3e.
25792
25793 @item -m4-nofpu
25794 @opindex m4-nofpu
25795 Generate code for the SH4 without a floating-point unit.
25796
25797 @item -m4-single-only
25798 @opindex m4-single-only
25799 Generate code for the SH4 with a floating-point unit that only
25800 supports single-precision arithmetic.
25801
25802 @item -m4-single
25803 @opindex m4-single
25804 Generate code for the SH4 assuming the floating-point unit is in
25805 single-precision mode by default.
25806
25807 @item -m4
25808 @opindex m4
25809 Generate code for the SH4.
25810
25811 @item -m4-100
25812 @opindex m4-100
25813 Generate code for SH4-100.
25814
25815 @item -m4-100-nofpu
25816 @opindex m4-100-nofpu
25817 Generate code for SH4-100 in such a way that the
25818 floating-point unit is not used.
25819
25820 @item -m4-100-single
25821 @opindex m4-100-single
25822 Generate code for SH4-100 assuming the floating-point unit is in
25823 single-precision mode by default.
25824
25825 @item -m4-100-single-only
25826 @opindex m4-100-single-only
25827 Generate code for SH4-100 in such a way that no double-precision
25828 floating-point operations are used.
25829
25830 @item -m4-200
25831 @opindex m4-200
25832 Generate code for SH4-200.
25833
25834 @item -m4-200-nofpu
25835 @opindex m4-200-nofpu
25836 Generate code for SH4-200 without in such a way that the
25837 floating-point unit is not used.
25838
25839 @item -m4-200-single
25840 @opindex m4-200-single
25841 Generate code for SH4-200 assuming the floating-point unit is in
25842 single-precision mode by default.
25843
25844 @item -m4-200-single-only
25845 @opindex m4-200-single-only
25846 Generate code for SH4-200 in such a way that no double-precision
25847 floating-point operations are used.
25848
25849 @item -m4-300
25850 @opindex m4-300
25851 Generate code for SH4-300.
25852
25853 @item -m4-300-nofpu
25854 @opindex m4-300-nofpu
25855 Generate code for SH4-300 without in such a way that the
25856 floating-point unit is not used.
25857
25858 @item -m4-300-single
25859 @opindex m4-300-single
25860 Generate code for SH4-300 in such a way that no double-precision
25861 floating-point operations are used.
25862
25863 @item -m4-300-single-only
25864 @opindex m4-300-single-only
25865 Generate code for SH4-300 in such a way that no double-precision
25866 floating-point operations are used.
25867
25868 @item -m4-340
25869 @opindex m4-340
25870 Generate code for SH4-340 (no MMU, no FPU).
25871
25872 @item -m4-500
25873 @opindex m4-500
25874 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25875 assembler.
25876
25877 @item -m4a-nofpu
25878 @opindex m4a-nofpu
25879 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25880 floating-point unit is not used.
25881
25882 @item -m4a-single-only
25883 @opindex m4a-single-only
25884 Generate code for the SH4a, in such a way that no double-precision
25885 floating-point operations are used.
25886
25887 @item -m4a-single
25888 @opindex m4a-single
25889 Generate code for the SH4a assuming the floating-point unit is in
25890 single-precision mode by default.
25891
25892 @item -m4a
25893 @opindex m4a
25894 Generate code for the SH4a.
25895
25896 @item -m4al
25897 @opindex m4al
25898 Same as @option{-m4a-nofpu}, except that it implicitly passes
25899 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25900 instructions at the moment.
25901
25902 @item -mb
25903 @opindex mb
25904 Compile code for the processor in big-endian mode.
25905
25906 @item -ml
25907 @opindex ml
25908 Compile code for the processor in little-endian mode.
25909
25910 @item -mdalign
25911 @opindex mdalign
25912 Align doubles at 64-bit boundaries. Note that this changes the calling
25913 conventions, and thus some functions from the standard C library do
25914 not work unless you recompile it first with @option{-mdalign}.
25915
25916 @item -mrelax
25917 @opindex mrelax
25918 Shorten some address references at link time, when possible; uses the
25919 linker option @option{-relax}.
25920
25921 @item -mbigtable
25922 @opindex mbigtable
25923 Use 32-bit offsets in @code{switch} tables. The default is to use
25924 16-bit offsets.
25925
25926 @item -mbitops
25927 @opindex mbitops
25928 Enable the use of bit manipulation instructions on SH2A.
25929
25930 @item -mfmovd
25931 @opindex mfmovd
25932 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25933 alignment constraints.
25934
25935 @item -mrenesas
25936 @opindex mrenesas
25937 Comply with the calling conventions defined by Renesas.
25938
25939 @item -mno-renesas
25940 @opindex mno-renesas
25941 Comply with the calling conventions defined for GCC before the Renesas
25942 conventions were available. This option is the default for all
25943 targets of the SH toolchain.
25944
25945 @item -mnomacsave
25946 @opindex mnomacsave
25947 Mark the @code{MAC} register as call-clobbered, even if
25948 @option{-mrenesas} is given.
25949
25950 @item -mieee
25951 @itemx -mno-ieee
25952 @opindex mieee
25953 @opindex mno-ieee
25954 Control the IEEE compliance of floating-point comparisons, which affects the
25955 handling of cases where the result of a comparison is unordered. By default
25956 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25957 enabled @option{-mno-ieee} is implicitly set, which results in faster
25958 floating-point greater-equal and less-equal comparisons. The implicit settings
25959 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25960
25961 @item -minline-ic_invalidate
25962 @opindex minline-ic_invalidate
25963 Inline code to invalidate instruction cache entries after setting up
25964 nested function trampolines.
25965 This option has no effect if @option{-musermode} is in effect and the selected
25966 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
25967 instruction.
25968 If the selected code generation option does not allow the use of the @code{icbi}
25969 instruction, and @option{-musermode} is not in effect, the inlined code
25970 manipulates the instruction cache address array directly with an associative
25971 write. This not only requires privileged mode at run time, but it also
25972 fails if the cache line had been mapped via the TLB and has become unmapped.
25973
25974 @item -misize
25975 @opindex misize
25976 Dump instruction size and location in the assembly code.
25977
25978 @item -mpadstruct
25979 @opindex mpadstruct
25980 This option is deprecated. It pads structures to multiple of 4 bytes,
25981 which is incompatible with the SH ABI@.
25982
25983 @item -matomic-model=@var{model}
25984 @opindex matomic-model=@var{model}
25985 Sets the model of atomic operations and additional parameters as a comma
25986 separated list. For details on the atomic built-in functions see
25987 @ref{__atomic Builtins}. The following models and parameters are supported:
25988
25989 @table @samp
25990
25991 @item none
25992 Disable compiler generated atomic sequences and emit library calls for atomic
25993 operations. This is the default if the target is not @code{sh*-*-linux*}.
25994
25995 @item soft-gusa
25996 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25997 built-in functions. The generated atomic sequences require additional support
25998 from the interrupt/exception handling code of the system and are only suitable
25999 for SH3* and SH4* single-core systems. This option is enabled by default when
26000 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26001 this option also partially utilizes the hardware atomic instructions
26002 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26003 @samp{strict} is specified.
26004
26005 @item soft-tcb
26006 Generate software atomic sequences that use a variable in the thread control
26007 block. This is a variation of the gUSA sequences which can also be used on
26008 SH1* and SH2* targets. The generated atomic sequences require additional
26009 support from the interrupt/exception handling code of the system and are only
26010 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26011 parameter has to be specified as well.
26012
26013 @item soft-imask
26014 Generate software atomic sequences that temporarily disable interrupts by
26015 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26016 in privileged mode and is only suitable for single-core systems. Additional
26017 support from the interrupt/exception handling code of the system is not
26018 required. This model is enabled by default when the target is
26019 @code{sh*-*-linux*} and SH1* or SH2*.
26020
26021 @item hard-llcs
26022 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26023 instructions only. This is only available on SH4A and is suitable for
26024 multi-core systems. Since the hardware instructions support only 32 bit atomic
26025 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26026 Code compiled with this option is also compatible with other software
26027 atomic model interrupt/exception handling systems if executed on an SH4A
26028 system. Additional support from the interrupt/exception handling code of the
26029 system is not required for this model.
26030
26031 @item gbr-offset=
26032 This parameter specifies the offset in bytes of the variable in the thread
26033 control block structure that should be used by the generated atomic sequences
26034 when the @samp{soft-tcb} model has been selected. For other models this
26035 parameter is ignored. The specified value must be an integer multiple of four
26036 and in the range 0-1020.
26037
26038 @item strict
26039 This parameter prevents mixed usage of multiple atomic models, even if they
26040 are compatible, and makes the compiler generate atomic sequences of the
26041 specified model only.
26042
26043 @end table
26044
26045 @item -mtas
26046 @opindex mtas
26047 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26048 Notice that depending on the particular hardware and software configuration
26049 this can degrade overall performance due to the operand cache line flushes
26050 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26051 processors the @code{tas.b} instruction must be used with caution since it
26052 can result in data corruption for certain cache configurations.
26053
26054 @item -mprefergot
26055 @opindex mprefergot
26056 When generating position-independent code, emit function calls using
26057 the Global Offset Table instead of the Procedure Linkage Table.
26058
26059 @item -musermode
26060 @itemx -mno-usermode
26061 @opindex musermode
26062 @opindex mno-usermode
26063 Don't allow (allow) the compiler generating privileged mode code. Specifying
26064 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26065 inlined code would not work in user mode. @option{-musermode} is the default
26066 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26067 @option{-musermode} has no effect, since there is no user mode.
26068
26069 @item -multcost=@var{number}
26070 @opindex multcost=@var{number}
26071 Set the cost to assume for a multiply insn.
26072
26073 @item -mdiv=@var{strategy}
26074 @opindex mdiv=@var{strategy}
26075 Set the division strategy to be used for integer division operations.
26076 @var{strategy} can be one of:
26077
26078 @table @samp
26079
26080 @item call-div1
26081 Calls a library function that uses the single-step division instruction
26082 @code{div1} to perform the operation. Division by zero calculates an
26083 unspecified result and does not trap. This is the default except for SH4,
26084 SH2A and SHcompact.
26085
26086 @item call-fp
26087 Calls a library function that performs the operation in double precision
26088 floating point. Division by zero causes a floating-point exception. This is
26089 the default for SHcompact with FPU. Specifying this for targets that do not
26090 have a double precision FPU defaults to @code{call-div1}.
26091
26092 @item call-table
26093 Calls a library function that uses a lookup table for small divisors and
26094 the @code{div1} instruction with case distinction for larger divisors. Division
26095 by zero calculates an unspecified result and does not trap. This is the default
26096 for SH4. Specifying this for targets that do not have dynamic shift
26097 instructions defaults to @code{call-div1}.
26098
26099 @end table
26100
26101 When a division strategy has not been specified the default strategy is
26102 selected based on the current target. For SH2A the default strategy is to
26103 use the @code{divs} and @code{divu} instructions instead of library function
26104 calls.
26105
26106 @item -maccumulate-outgoing-args
26107 @opindex maccumulate-outgoing-args
26108 Reserve space once for outgoing arguments in the function prologue rather
26109 than around each call. Generally beneficial for performance and size. Also
26110 needed for unwinding to avoid changing the stack frame around conditional code.
26111
26112 @item -mdivsi3_libfunc=@var{name}
26113 @opindex mdivsi3_libfunc=@var{name}
26114 Set the name of the library function used for 32-bit signed division to
26115 @var{name}.
26116 This only affects the name used in the @samp{call} division strategies, and
26117 the compiler still expects the same sets of input/output/clobbered registers as
26118 if this option were not present.
26119
26120 @item -mfixed-range=@var{register-range}
26121 @opindex mfixed-range
26122 Generate code treating the given register range as fixed registers.
26123 A fixed register is one that the register allocator cannot use. This is
26124 useful when compiling kernel code. A register range is specified as
26125 two registers separated by a dash. Multiple register ranges can be
26126 specified separated by a comma.
26127
26128 @item -mbranch-cost=@var{num}
26129 @opindex mbranch-cost=@var{num}
26130 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26131 make the compiler try to generate more branch-free code if possible.
26132 If not specified the value is selected depending on the processor type that
26133 is being compiled for.
26134
26135 @item -mzdcbranch
26136 @itemx -mno-zdcbranch
26137 @opindex mzdcbranch
26138 @opindex mno-zdcbranch
26139 Assume (do not assume) that zero displacement conditional branch instructions
26140 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26141 compiler prefers zero displacement branch code sequences. This is
26142 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26143 disabled by specifying @option{-mno-zdcbranch}.
26144
26145 @item -mcbranch-force-delay-slot
26146 @opindex mcbranch-force-delay-slot
26147 Force the usage of delay slots for conditional branches, which stuffs the delay
26148 slot with a @code{nop} if a suitable instruction cannot be found. By default
26149 this option is disabled. It can be enabled to work around hardware bugs as
26150 found in the original SH7055.
26151
26152 @item -mfused-madd
26153 @itemx -mno-fused-madd
26154 @opindex mfused-madd
26155 @opindex mno-fused-madd
26156 Generate code that uses (does not use) the floating-point multiply and
26157 accumulate instructions. These instructions are generated by default
26158 if hardware floating point is used. The machine-dependent
26159 @option{-mfused-madd} option is now mapped to the machine-independent
26160 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26161 mapped to @option{-ffp-contract=off}.
26162
26163 @item -mfsca
26164 @itemx -mno-fsca
26165 @opindex mfsca
26166 @opindex mno-fsca
26167 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26168 and cosine approximations. The option @option{-mfsca} must be used in
26169 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26170 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26171 approximations even if @option{-funsafe-math-optimizations} is in effect.
26172
26173 @item -mfsrra
26174 @itemx -mno-fsrra
26175 @opindex mfsrra
26176 @opindex mno-fsrra
26177 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26178 reciprocal square root approximations. The option @option{-mfsrra} must be used
26179 in combination with @option{-funsafe-math-optimizations} and
26180 @option{-ffinite-math-only}. It is enabled by default when generating code for
26181 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26182 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26183 in effect.
26184
26185 @item -mpretend-cmove
26186 @opindex mpretend-cmove
26187 Prefer zero-displacement conditional branches for conditional move instruction
26188 patterns. This can result in faster code on the SH4 processor.
26189
26190 @item -mfdpic
26191 @opindex fdpic
26192 Generate code using the FDPIC ABI.
26193
26194 @end table
26195
26196 @node Solaris 2 Options
26197 @subsection Solaris 2 Options
26198 @cindex Solaris 2 options
26199
26200 These @samp{-m} options are supported on Solaris 2:
26201
26202 @table @gcctabopt
26203 @item -mclear-hwcap
26204 @opindex mclear-hwcap
26205 @option{-mclear-hwcap} tells the compiler to remove the hardware
26206 capabilities generated by the Solaris assembler. This is only necessary
26207 when object files use ISA extensions not supported by the current
26208 machine, but check at runtime whether or not to use them.
26209
26210 @item -mimpure-text
26211 @opindex mimpure-text
26212 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26213 the compiler to not pass @option{-z text} to the linker when linking a
26214 shared object. Using this option, you can link position-dependent
26215 code into a shared object.
26216
26217 @option{-mimpure-text} suppresses the ``relocations remain against
26218 allocatable but non-writable sections'' linker error message.
26219 However, the necessary relocations trigger copy-on-write, and the
26220 shared object is not actually shared across processes. Instead of
26221 using @option{-mimpure-text}, you should compile all source code with
26222 @option{-fpic} or @option{-fPIC}.
26223
26224 @end table
26225
26226 These switches are supported in addition to the above on Solaris 2:
26227
26228 @table @gcctabopt
26229 @item -pthreads
26230 @opindex pthreads
26231 This is a synonym for @option{-pthread}.
26232 @end table
26233
26234 @node SPARC Options
26235 @subsection SPARC Options
26236 @cindex SPARC options
26237
26238 These @samp{-m} options are supported on the SPARC:
26239
26240 @table @gcctabopt
26241 @item -mno-app-regs
26242 @itemx -mapp-regs
26243 @opindex mno-app-regs
26244 @opindex mapp-regs
26245 Specify @option{-mapp-regs} to generate output using the global registers
26246 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26247 global register 1, each global register 2 through 4 is then treated as an
26248 allocable register that is clobbered by function calls. This is the default.
26249
26250 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26251 specify @option{-mno-app-regs}. You should compile libraries and system
26252 software with this option.
26253
26254 @item -mflat
26255 @itemx -mno-flat
26256 @opindex mflat
26257 @opindex mno-flat
26258 With @option{-mflat}, the compiler does not generate save/restore instructions
26259 and uses a ``flat'' or single register window model. This model is compatible
26260 with the regular register window model. The local registers and the input
26261 registers (0--5) are still treated as ``call-saved'' registers and are
26262 saved on the stack as needed.
26263
26264 With @option{-mno-flat} (the default), the compiler generates save/restore
26265 instructions (except for leaf functions). This is the normal operating mode.
26266
26267 @item -mfpu
26268 @itemx -mhard-float
26269 @opindex mfpu
26270 @opindex mhard-float
26271 Generate output containing floating-point instructions. This is the
26272 default.
26273
26274 @item -mno-fpu
26275 @itemx -msoft-float
26276 @opindex mno-fpu
26277 @opindex msoft-float
26278 Generate output containing library calls for floating point.
26279 @strong{Warning:} the requisite libraries are not available for all SPARC
26280 targets. Normally the facilities of the machine's usual C compiler are
26281 used, but this cannot be done directly in cross-compilation. You must make
26282 your own arrangements to provide suitable library functions for
26283 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26284 @samp{sparclite-*-*} do provide software floating-point support.
26285
26286 @option{-msoft-float} changes the calling convention in the output file;
26287 therefore, it is only useful if you compile @emph{all} of a program with
26288 this option. In particular, you need to compile @file{libgcc.a}, the
26289 library that comes with GCC, with @option{-msoft-float} in order for
26290 this to work.
26291
26292 @item -mhard-quad-float
26293 @opindex mhard-quad-float
26294 Generate output containing quad-word (long double) floating-point
26295 instructions.
26296
26297 @item -msoft-quad-float
26298 @opindex msoft-quad-float
26299 Generate output containing library calls for quad-word (long double)
26300 floating-point instructions. The functions called are those specified
26301 in the SPARC ABI@. This is the default.
26302
26303 As of this writing, there are no SPARC implementations that have hardware
26304 support for the quad-word floating-point instructions. They all invoke
26305 a trap handler for one of these instructions, and then the trap handler
26306 emulates the effect of the instruction. Because of the trap handler overhead,
26307 this is much slower than calling the ABI library routines. Thus the
26308 @option{-msoft-quad-float} option is the default.
26309
26310 @item -mno-unaligned-doubles
26311 @itemx -munaligned-doubles
26312 @opindex mno-unaligned-doubles
26313 @opindex munaligned-doubles
26314 Assume that doubles have 8-byte alignment. This is the default.
26315
26316 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26317 alignment only if they are contained in another type, or if they have an
26318 absolute address. Otherwise, it assumes they have 4-byte alignment.
26319 Specifying this option avoids some rare compatibility problems with code
26320 generated by other compilers. It is not the default because it results
26321 in a performance loss, especially for floating-point code.
26322
26323 @item -muser-mode
26324 @itemx -mno-user-mode
26325 @opindex muser-mode
26326 @opindex mno-user-mode
26327 Do not generate code that can only run in supervisor mode. This is relevant
26328 only for the @code{casa} instruction emitted for the LEON3 processor. This
26329 is the default.
26330
26331 @item -mfaster-structs
26332 @itemx -mno-faster-structs
26333 @opindex mfaster-structs
26334 @opindex mno-faster-structs
26335 With @option{-mfaster-structs}, the compiler assumes that structures
26336 should have 8-byte alignment. This enables the use of pairs of
26337 @code{ldd} and @code{std} instructions for copies in structure
26338 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26339 However, the use of this changed alignment directly violates the SPARC
26340 ABI@. Thus, it's intended only for use on targets where the developer
26341 acknowledges that their resulting code is not directly in line with
26342 the rules of the ABI@.
26343
26344 @item -mstd-struct-return
26345 @itemx -mno-std-struct-return
26346 @opindex mstd-struct-return
26347 @opindex mno-std-struct-return
26348 With @option{-mstd-struct-return}, the compiler generates checking code
26349 in functions returning structures or unions to detect size mismatches
26350 between the two sides of function calls, as per the 32-bit ABI@.
26351
26352 The default is @option{-mno-std-struct-return}. This option has no effect
26353 in 64-bit mode.
26354
26355 @item -mlra
26356 @itemx -mno-lra
26357 @opindex mlra
26358 @opindex mno-lra
26359 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26360 so @option{-mno-lra} needs to be passed to get old Reload.
26361
26362 @item -mcpu=@var{cpu_type}
26363 @opindex mcpu
26364 Set the instruction set, register set, and instruction scheduling parameters
26365 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26366 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26367 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26368 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26369 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26370 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26371
26372 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26373 which selects the best architecture option for the host processor.
26374 @option{-mcpu=native} has no effect if GCC does not recognize
26375 the processor.
26376
26377 Default instruction scheduling parameters are used for values that select
26378 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26379 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26380
26381 Here is a list of each supported architecture and their supported
26382 implementations.
26383
26384 @table @asis
26385 @item v7
26386 cypress, leon3v7
26387
26388 @item v8
26389 supersparc, hypersparc, leon, leon3
26390
26391 @item sparclite
26392 f930, f934, sparclite86x
26393
26394 @item sparclet
26395 tsc701
26396
26397 @item v9
26398 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26399 niagara7, m8
26400 @end table
26401
26402 By default (unless configured otherwise), GCC generates code for the V7
26403 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26404 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26405 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26406 SPARCStation 1, 2, IPX etc.
26407
26408 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26409 architecture. The only difference from V7 code is that the compiler emits
26410 the integer multiply and integer divide instructions which exist in SPARC-V8
26411 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26412 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26413 2000 series.
26414
26415 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26416 the SPARC architecture. This adds the integer multiply, integer divide step
26417 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26418 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26419 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26420 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26421 MB86934 chip, which is the more recent SPARClite with FPU@.
26422
26423 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26424 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26425 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26426 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26427 optimizes it for the TEMIC SPARClet chip.
26428
26429 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26430 architecture. This adds 64-bit integer and floating-point move instructions,
26431 3 additional floating-point condition code registers and conditional move
26432 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26433 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26434 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26435 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26436 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26437 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26438 additionally optimizes it for Sun UltraSPARC T2 chips. With
26439 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26440 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26441 additionally optimizes it for Sun UltraSPARC T4 chips. With
26442 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26443 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26444 additionally optimizes it for Oracle M8 chips.
26445
26446 @item -mtune=@var{cpu_type}
26447 @opindex mtune
26448 Set the instruction scheduling parameters for machine type
26449 @var{cpu_type}, but do not set the instruction set or register set that the
26450 option @option{-mcpu=@var{cpu_type}} does.
26451
26452 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26453 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26454 that select a particular CPU implementation. Those are
26455 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26456 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26457 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26458 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26459 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26460 and GNU/Linux toolchains, @samp{native} can also be used.
26461
26462 @item -mv8plus
26463 @itemx -mno-v8plus
26464 @opindex mv8plus
26465 @opindex mno-v8plus
26466 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26467 difference from the V8 ABI is that the global and out registers are
26468 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26469 mode for all SPARC-V9 processors.
26470
26471 @item -mvis
26472 @itemx -mno-vis
26473 @opindex mvis
26474 @opindex mno-vis
26475 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26476 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26477
26478 @item -mvis2
26479 @itemx -mno-vis2
26480 @opindex mvis2
26481 @opindex mno-vis2
26482 With @option{-mvis2}, GCC generates code that takes advantage of
26483 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26484 default is @option{-mvis2} when targeting a cpu that supports such
26485 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26486 also sets @option{-mvis}.
26487
26488 @item -mvis3
26489 @itemx -mno-vis3
26490 @opindex mvis3
26491 @opindex mno-vis3
26492 With @option{-mvis3}, GCC generates code that takes advantage of
26493 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26494 default is @option{-mvis3} when targeting a cpu that supports such
26495 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26496 also sets @option{-mvis2} and @option{-mvis}.
26497
26498 @item -mvis4
26499 @itemx -mno-vis4
26500 @opindex mvis4
26501 @opindex mno-vis4
26502 With @option{-mvis4}, GCC generates code that takes advantage of
26503 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26504 default is @option{-mvis4} when targeting a cpu that supports such
26505 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26506 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26507
26508 @item -mvis4b
26509 @itemx -mno-vis4b
26510 @opindex mvis4b
26511 @opindex mno-vis4b
26512 With @option{-mvis4b}, GCC generates code that takes advantage of
26513 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26514 the additional VIS instructions introduced in the Oracle SPARC
26515 Architecture 2017. The default is @option{-mvis4b} when targeting a
26516 cpu that supports such instructions, such as m8 and later. Setting
26517 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26518 @option{-mvis2} and @option{-mvis}.
26519
26520 @item -mcbcond
26521 @itemx -mno-cbcond
26522 @opindex mcbcond
26523 @opindex mno-cbcond
26524 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26525 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26526 when targeting a CPU that supports such instructions, such as Niagara-4 and
26527 later.
26528
26529 @item -mfmaf
26530 @itemx -mno-fmaf
26531 @opindex mfmaf
26532 @opindex mno-fmaf
26533 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26534 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26535 when targeting a CPU that supports such instructions, such as Niagara-3 and
26536 later.
26537
26538 @item -mfsmuld
26539 @itemx -mno-fsmuld
26540 @opindex mfsmuld
26541 @opindex mno-fsmuld
26542 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26543 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26544 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26545 or V9 with FPU except @option{-mcpu=leon}.
26546
26547 @item -mpopc
26548 @itemx -mno-popc
26549 @opindex mpopc
26550 @opindex mno-popc
26551 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26552 Population Count instruction. The default is @option{-mpopc}
26553 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26554 later.
26555
26556 @item -msubxc
26557 @itemx -mno-subxc
26558 @opindex msubxc
26559 @opindex mno-subxc
26560 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26561 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26562 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26563 later.
26564
26565 @item -mfix-at697f
26566 @opindex mfix-at697f
26567 Enable the documented workaround for the single erratum of the Atmel AT697F
26568 processor (which corresponds to erratum #13 of the AT697E processor).
26569
26570 @item -mfix-ut699
26571 @opindex mfix-ut699
26572 Enable the documented workarounds for the floating-point errata and the data
26573 cache nullify errata of the UT699 processor.
26574
26575 @item -mfix-ut700
26576 @opindex mfix-ut700
26577 Enable the documented workaround for the back-to-back store errata of
26578 the UT699E/UT700 processor.
26579
26580 @item -mfix-gr712rc
26581 @opindex mfix-gr712rc
26582 Enable the documented workaround for the back-to-back store errata of
26583 the GR712RC processor.
26584 @end table
26585
26586 These @samp{-m} options are supported in addition to the above
26587 on SPARC-V9 processors in 64-bit environments:
26588
26589 @table @gcctabopt
26590 @item -m32
26591 @itemx -m64
26592 @opindex m32
26593 @opindex m64
26594 Generate code for a 32-bit or 64-bit environment.
26595 The 32-bit environment sets int, long and pointer to 32 bits.
26596 The 64-bit environment sets int to 32 bits and long and pointer
26597 to 64 bits.
26598
26599 @item -mcmodel=@var{which}
26600 @opindex mcmodel
26601 Set the code model to one of
26602
26603 @table @samp
26604 @item medlow
26605 The Medium/Low code model: 64-bit addresses, programs
26606 must be linked in the low 32 bits of memory. Programs can be statically
26607 or dynamically linked.
26608
26609 @item medmid
26610 The Medium/Middle code model: 64-bit addresses, programs
26611 must be linked in the low 44 bits of memory, the text and data segments must
26612 be less than 2GB in size and the data segment must be located within 2GB of
26613 the text segment.
26614
26615 @item medany
26616 The Medium/Anywhere code model: 64-bit addresses, programs
26617 may be linked anywhere in memory, the text and data segments must be less
26618 than 2GB in size and the data segment must be located within 2GB of the
26619 text segment.
26620
26621 @item embmedany
26622 The Medium/Anywhere code model for embedded systems:
26623 64-bit addresses, the text and data segments must be less than 2GB in
26624 size, both starting anywhere in memory (determined at link time). The
26625 global register %g4 points to the base of the data segment. Programs
26626 are statically linked and PIC is not supported.
26627 @end table
26628
26629 @item -mmemory-model=@var{mem-model}
26630 @opindex mmemory-model
26631 Set the memory model in force on the processor to one of
26632
26633 @table @samp
26634 @item default
26635 The default memory model for the processor and operating system.
26636
26637 @item rmo
26638 Relaxed Memory Order
26639
26640 @item pso
26641 Partial Store Order
26642
26643 @item tso
26644 Total Store Order
26645
26646 @item sc
26647 Sequential Consistency
26648 @end table
26649
26650 These memory models are formally defined in Appendix D of the SPARC-V9
26651 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26652
26653 @item -mstack-bias
26654 @itemx -mno-stack-bias
26655 @opindex mstack-bias
26656 @opindex mno-stack-bias
26657 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26658 frame pointer if present, are offset by @minus{}2047 which must be added back
26659 when making stack frame references. This is the default in 64-bit mode.
26660 Otherwise, assume no such offset is present.
26661 @end table
26662
26663 @node SPU Options
26664 @subsection SPU Options
26665 @cindex SPU options
26666
26667 These @samp{-m} options are supported on the SPU:
26668
26669 @table @gcctabopt
26670 @item -mwarn-reloc
26671 @itemx -merror-reloc
26672 @opindex mwarn-reloc
26673 @opindex merror-reloc
26674
26675 The loader for SPU does not handle dynamic relocations. By default, GCC
26676 gives an error when it generates code that requires a dynamic
26677 relocation. @option{-mno-error-reloc} disables the error,
26678 @option{-mwarn-reloc} generates a warning instead.
26679
26680 @item -msafe-dma
26681 @itemx -munsafe-dma
26682 @opindex msafe-dma
26683 @opindex munsafe-dma
26684
26685 Instructions that initiate or test completion of DMA must not be
26686 reordered with respect to loads and stores of the memory that is being
26687 accessed.
26688 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26689 memory accesses, but that can lead to inefficient code in places where the
26690 memory is known to not change. Rather than mark the memory as volatile,
26691 you can use @option{-msafe-dma} to tell the compiler to treat
26692 the DMA instructions as potentially affecting all memory.
26693
26694 @item -mbranch-hints
26695 @opindex mbranch-hints
26696
26697 By default, GCC generates a branch hint instruction to avoid
26698 pipeline stalls for always-taken or probably-taken branches. A hint
26699 is not generated closer than 8 instructions away from its branch.
26700 There is little reason to disable them, except for debugging purposes,
26701 or to make an object a little bit smaller.
26702
26703 @item -msmall-mem
26704 @itemx -mlarge-mem
26705 @opindex msmall-mem
26706 @opindex mlarge-mem
26707
26708 By default, GCC generates code assuming that addresses are never larger
26709 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
26710 a full 32-bit address.
26711
26712 @item -mstdmain
26713 @opindex mstdmain
26714
26715 By default, GCC links against startup code that assumes the SPU-style
26716 main function interface (which has an unconventional parameter list).
26717 With @option{-mstdmain}, GCC links your program against startup
26718 code that assumes a C99-style interface to @code{main}, including a
26719 local copy of @code{argv} strings.
26720
26721 @item -mfixed-range=@var{register-range}
26722 @opindex mfixed-range
26723 Generate code treating the given register range as fixed registers.
26724 A fixed register is one that the register allocator cannot use. This is
26725 useful when compiling kernel code. A register range is specified as
26726 two registers separated by a dash. Multiple register ranges can be
26727 specified separated by a comma.
26728
26729 @item -mea32
26730 @itemx -mea64
26731 @opindex mea32
26732 @opindex mea64
26733 Compile code assuming that pointers to the PPU address space accessed
26734 via the @code{__ea} named address space qualifier are either 32 or 64
26735 bits wide. The default is 32 bits. As this is an ABI-changing option,
26736 all object code in an executable must be compiled with the same setting.
26737
26738 @item -maddress-space-conversion
26739 @itemx -mno-address-space-conversion
26740 @opindex maddress-space-conversion
26741 @opindex mno-address-space-conversion
26742 Allow/disallow treating the @code{__ea} address space as superset
26743 of the generic address space. This enables explicit type casts
26744 between @code{__ea} and generic pointer as well as implicit
26745 conversions of generic pointers to @code{__ea} pointers. The
26746 default is to allow address space pointer conversions.
26747
26748 @item -mcache-size=@var{cache-size}
26749 @opindex mcache-size
26750 This option controls the version of libgcc that the compiler links to an
26751 executable and selects a software-managed cache for accessing variables
26752 in the @code{__ea} address space with a particular cache size. Possible
26753 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26754 and @samp{128}. The default cache size is 64KB.
26755
26756 @item -matomic-updates
26757 @itemx -mno-atomic-updates
26758 @opindex matomic-updates
26759 @opindex mno-atomic-updates
26760 This option controls the version of libgcc that the compiler links to an
26761 executable and selects whether atomic updates to the software-managed
26762 cache of PPU-side variables are used. If you use atomic updates, changes
26763 to a PPU variable from SPU code using the @code{__ea} named address space
26764 qualifier do not interfere with changes to other PPU variables residing
26765 in the same cache line from PPU code. If you do not use atomic updates,
26766 such interference may occur; however, writing back cache lines is
26767 more efficient. The default behavior is to use atomic updates.
26768
26769 @item -mdual-nops
26770 @itemx -mdual-nops=@var{n}
26771 @opindex mdual-nops
26772 By default, GCC inserts NOPs to increase dual issue when it expects
26773 it to increase performance. @var{n} can be a value from 0 to 10. A
26774 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26775 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26776
26777 @item -mhint-max-nops=@var{n}
26778 @opindex mhint-max-nops
26779 Maximum number of NOPs to insert for a branch hint. A branch hint must
26780 be at least 8 instructions away from the branch it is affecting. GCC
26781 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26782 generate the branch hint.
26783
26784 @item -mhint-max-distance=@var{n}
26785 @opindex mhint-max-distance
26786 The encoding of the branch hint instruction limits the hint to be within
26787 256 instructions of the branch it is affecting. By default, GCC makes
26788 sure it is within 125.
26789
26790 @item -msafe-hints
26791 @opindex msafe-hints
26792 Work around a hardware bug that causes the SPU to stall indefinitely.
26793 By default, GCC inserts the @code{hbrp} instruction to make sure
26794 this stall won't happen.
26795
26796 @end table
26797
26798 @node System V Options
26799 @subsection Options for System V
26800
26801 These additional options are available on System V Release 4 for
26802 compatibility with other compilers on those systems:
26803
26804 @table @gcctabopt
26805 @item -G
26806 @opindex G
26807 Create a shared object.
26808 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26809
26810 @item -Qy
26811 @opindex Qy
26812 Identify the versions of each tool used by the compiler, in a
26813 @code{.ident} assembler directive in the output.
26814
26815 @item -Qn
26816 @opindex Qn
26817 Refrain from adding @code{.ident} directives to the output file (this is
26818 the default).
26819
26820 @item -YP,@var{dirs}
26821 @opindex YP
26822 Search the directories @var{dirs}, and no others, for libraries
26823 specified with @option{-l}.
26824
26825 @item -Ym,@var{dir}
26826 @opindex Ym
26827 Look in the directory @var{dir} to find the M4 preprocessor.
26828 The assembler uses this option.
26829 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26830 @c the generic assembler that comes with Solaris takes just -Ym.
26831 @end table
26832
26833 @node TILE-Gx Options
26834 @subsection TILE-Gx Options
26835 @cindex TILE-Gx options
26836
26837 These @samp{-m} options are supported on the TILE-Gx:
26838
26839 @table @gcctabopt
26840 @item -mcmodel=small
26841 @opindex mcmodel=small
26842 Generate code for the small model. The distance for direct calls is
26843 limited to 500M in either direction. PC-relative addresses are 32
26844 bits. Absolute addresses support the full address range.
26845
26846 @item -mcmodel=large
26847 @opindex mcmodel=large
26848 Generate code for the large model. There is no limitation on call
26849 distance, pc-relative addresses, or absolute addresses.
26850
26851 @item -mcpu=@var{name}
26852 @opindex mcpu
26853 Selects the type of CPU to be targeted. Currently the only supported
26854 type is @samp{tilegx}.
26855
26856 @item -m32
26857 @itemx -m64
26858 @opindex m32
26859 @opindex m64
26860 Generate code for a 32-bit or 64-bit environment. The 32-bit
26861 environment sets int, long, and pointer to 32 bits. The 64-bit
26862 environment sets int to 32 bits and long and pointer to 64 bits.
26863
26864 @item -mbig-endian
26865 @itemx -mlittle-endian
26866 @opindex mbig-endian
26867 @opindex mlittle-endian
26868 Generate code in big/little endian mode, respectively.
26869 @end table
26870
26871 @node TILEPro Options
26872 @subsection TILEPro Options
26873 @cindex TILEPro options
26874
26875 These @samp{-m} options are supported on the TILEPro:
26876
26877 @table @gcctabopt
26878 @item -mcpu=@var{name}
26879 @opindex mcpu
26880 Selects the type of CPU to be targeted. Currently the only supported
26881 type is @samp{tilepro}.
26882
26883 @item -m32
26884 @opindex m32
26885 Generate code for a 32-bit environment, which sets int, long, and
26886 pointer to 32 bits. This is the only supported behavior so the flag
26887 is essentially ignored.
26888 @end table
26889
26890 @node V850 Options
26891 @subsection V850 Options
26892 @cindex V850 Options
26893
26894 These @samp{-m} options are defined for V850 implementations:
26895
26896 @table @gcctabopt
26897 @item -mlong-calls
26898 @itemx -mno-long-calls
26899 @opindex mlong-calls
26900 @opindex mno-long-calls
26901 Treat all calls as being far away (near). If calls are assumed to be
26902 far away, the compiler always loads the function's address into a
26903 register, and calls indirect through the pointer.
26904
26905 @item -mno-ep
26906 @itemx -mep
26907 @opindex mno-ep
26908 @opindex mep
26909 Do not optimize (do optimize) basic blocks that use the same index
26910 pointer 4 or more times to copy pointer into the @code{ep} register, and
26911 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26912 option is on by default if you optimize.
26913
26914 @item -mno-prolog-function
26915 @itemx -mprolog-function
26916 @opindex mno-prolog-function
26917 @opindex mprolog-function
26918 Do not use (do use) external functions to save and restore registers
26919 at the prologue and epilogue of a function. The external functions
26920 are slower, but use less code space if more than one function saves
26921 the same number of registers. The @option{-mprolog-function} option
26922 is on by default if you optimize.
26923
26924 @item -mspace
26925 @opindex mspace
26926 Try to make the code as small as possible. At present, this just turns
26927 on the @option{-mep} and @option{-mprolog-function} options.
26928
26929 @item -mtda=@var{n}
26930 @opindex mtda
26931 Put static or global variables whose size is @var{n} bytes or less into
26932 the tiny data area that register @code{ep} points to. The tiny data
26933 area can hold up to 256 bytes in total (128 bytes for byte references).
26934
26935 @item -msda=@var{n}
26936 @opindex msda
26937 Put static or global variables whose size is @var{n} bytes or less into
26938 the small data area that register @code{gp} points to. The small data
26939 area can hold up to 64 kilobytes.
26940
26941 @item -mzda=@var{n}
26942 @opindex mzda
26943 Put static or global variables whose size is @var{n} bytes or less into
26944 the first 32 kilobytes of memory.
26945
26946 @item -mv850
26947 @opindex mv850
26948 Specify that the target processor is the V850.
26949
26950 @item -mv850e3v5
26951 @opindex mv850e3v5
26952 Specify that the target processor is the V850E3V5. The preprocessor
26953 constant @code{__v850e3v5__} is defined if this option is used.
26954
26955 @item -mv850e2v4
26956 @opindex mv850e2v4
26957 Specify that the target processor is the V850E3V5. This is an alias for
26958 the @option{-mv850e3v5} option.
26959
26960 @item -mv850e2v3
26961 @opindex mv850e2v3
26962 Specify that the target processor is the V850E2V3. The preprocessor
26963 constant @code{__v850e2v3__} is defined if this option is used.
26964
26965 @item -mv850e2
26966 @opindex mv850e2
26967 Specify that the target processor is the V850E2. The preprocessor
26968 constant @code{__v850e2__} is defined if this option is used.
26969
26970 @item -mv850e1
26971 @opindex mv850e1
26972 Specify that the target processor is the V850E1. The preprocessor
26973 constants @code{__v850e1__} and @code{__v850e__} are defined if
26974 this option is used.
26975
26976 @item -mv850es
26977 @opindex mv850es
26978 Specify that the target processor is the V850ES. This is an alias for
26979 the @option{-mv850e1} option.
26980
26981 @item -mv850e
26982 @opindex mv850e
26983 Specify that the target processor is the V850E@. The preprocessor
26984 constant @code{__v850e__} is defined if this option is used.
26985
26986 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26987 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26988 are defined then a default target processor is chosen and the
26989 relevant @samp{__v850*__} preprocessor constant is defined.
26990
26991 The preprocessor constants @code{__v850} and @code{__v851__} are always
26992 defined, regardless of which processor variant is the target.
26993
26994 @item -mdisable-callt
26995 @itemx -mno-disable-callt
26996 @opindex mdisable-callt
26997 @opindex mno-disable-callt
26998 This option suppresses generation of the @code{CALLT} instruction for the
26999 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27000 architecture.
27001
27002 This option is enabled by default when the RH850 ABI is
27003 in use (see @option{-mrh850-abi}), and disabled by default when the
27004 GCC ABI is in use. If @code{CALLT} instructions are being generated
27005 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27006
27007 @item -mrelax
27008 @itemx -mno-relax
27009 @opindex mrelax
27010 @opindex mno-relax
27011 Pass on (or do not pass on) the @option{-mrelax} command-line option
27012 to the assembler.
27013
27014 @item -mlong-jumps
27015 @itemx -mno-long-jumps
27016 @opindex mlong-jumps
27017 @opindex mno-long-jumps
27018 Disable (or re-enable) the generation of PC-relative jump instructions.
27019
27020 @item -msoft-float
27021 @itemx -mhard-float
27022 @opindex msoft-float
27023 @opindex mhard-float
27024 Disable (or re-enable) the generation of hardware floating point
27025 instructions. This option is only significant when the target
27026 architecture is @samp{V850E2V3} or higher. If hardware floating point
27027 instructions are being generated then the C preprocessor symbol
27028 @code{__FPU_OK__} is defined, otherwise the symbol
27029 @code{__NO_FPU__} is defined.
27030
27031 @item -mloop
27032 @opindex mloop
27033 Enables the use of the e3v5 LOOP instruction. The use of this
27034 instruction is not enabled by default when the e3v5 architecture is
27035 selected because its use is still experimental.
27036
27037 @item -mrh850-abi
27038 @itemx -mghs
27039 @opindex mrh850-abi
27040 @opindex mghs
27041 Enables support for the RH850 version of the V850 ABI. This is the
27042 default. With this version of the ABI the following rules apply:
27043
27044 @itemize
27045 @item
27046 Integer sized structures and unions are returned via a memory pointer
27047 rather than a register.
27048
27049 @item
27050 Large structures and unions (more than 8 bytes in size) are passed by
27051 value.
27052
27053 @item
27054 Functions are aligned to 16-bit boundaries.
27055
27056 @item
27057 The @option{-m8byte-align} command-line option is supported.
27058
27059 @item
27060 The @option{-mdisable-callt} command-line option is enabled by
27061 default. The @option{-mno-disable-callt} command-line option is not
27062 supported.
27063 @end itemize
27064
27065 When this version of the ABI is enabled the C preprocessor symbol
27066 @code{__V850_RH850_ABI__} is defined.
27067
27068 @item -mgcc-abi
27069 @opindex mgcc-abi
27070 Enables support for the old GCC version of the V850 ABI. With this
27071 version of the ABI the following rules apply:
27072
27073 @itemize
27074 @item
27075 Integer sized structures and unions are returned in register @code{r10}.
27076
27077 @item
27078 Large structures and unions (more than 8 bytes in size) are passed by
27079 reference.
27080
27081 @item
27082 Functions are aligned to 32-bit boundaries, unless optimizing for
27083 size.
27084
27085 @item
27086 The @option{-m8byte-align} command-line option is not supported.
27087
27088 @item
27089 The @option{-mdisable-callt} command-line option is supported but not
27090 enabled by default.
27091 @end itemize
27092
27093 When this version of the ABI is enabled the C preprocessor symbol
27094 @code{__V850_GCC_ABI__} is defined.
27095
27096 @item -m8byte-align
27097 @itemx -mno-8byte-align
27098 @opindex m8byte-align
27099 @opindex mno-8byte-align
27100 Enables support for @code{double} and @code{long long} types to be
27101 aligned on 8-byte boundaries. The default is to restrict the
27102 alignment of all objects to at most 4-bytes. When
27103 @option{-m8byte-align} is in effect the C preprocessor symbol
27104 @code{__V850_8BYTE_ALIGN__} is defined.
27105
27106 @item -mbig-switch
27107 @opindex mbig-switch
27108 Generate code suitable for big switch tables. Use this option only if
27109 the assembler/linker complain about out of range branches within a switch
27110 table.
27111
27112 @item -mapp-regs
27113 @opindex mapp-regs
27114 This option causes r2 and r5 to be used in the code generated by
27115 the compiler. This setting is the default.
27116
27117 @item -mno-app-regs
27118 @opindex mno-app-regs
27119 This option causes r2 and r5 to be treated as fixed registers.
27120
27121 @end table
27122
27123 @node VAX Options
27124 @subsection VAX Options
27125 @cindex VAX options
27126
27127 These @samp{-m} options are defined for the VAX:
27128
27129 @table @gcctabopt
27130 @item -munix
27131 @opindex munix
27132 Do not output certain jump instructions (@code{aobleq} and so on)
27133 that the Unix assembler for the VAX cannot handle across long
27134 ranges.
27135
27136 @item -mgnu
27137 @opindex mgnu
27138 Do output those jump instructions, on the assumption that the
27139 GNU assembler is being used.
27140
27141 @item -mg
27142 @opindex mg
27143 Output code for G-format floating-point numbers instead of D-format.
27144 @end table
27145
27146 @node Visium Options
27147 @subsection Visium Options
27148 @cindex Visium options
27149
27150 @table @gcctabopt
27151
27152 @item -mdebug
27153 @opindex mdebug
27154 A program which performs file I/O and is destined to run on an MCM target
27155 should be linked with this option. It causes the libraries libc.a and
27156 libdebug.a to be linked. The program should be run on the target under
27157 the control of the GDB remote debugging stub.
27158
27159 @item -msim
27160 @opindex msim
27161 A program which performs file I/O and is destined to run on the simulator
27162 should be linked with option. This causes libraries libc.a and libsim.a to
27163 be linked.
27164
27165 @item -mfpu
27166 @itemx -mhard-float
27167 @opindex mfpu
27168 @opindex mhard-float
27169 Generate code containing floating-point instructions. This is the
27170 default.
27171
27172 @item -mno-fpu
27173 @itemx -msoft-float
27174 @opindex mno-fpu
27175 @opindex msoft-float
27176 Generate code containing library calls for floating-point.
27177
27178 @option{-msoft-float} changes the calling convention in the output file;
27179 therefore, it is only useful if you compile @emph{all} of a program with
27180 this option. In particular, you need to compile @file{libgcc.a}, the
27181 library that comes with GCC, with @option{-msoft-float} in order for
27182 this to work.
27183
27184 @item -mcpu=@var{cpu_type}
27185 @opindex mcpu
27186 Set the instruction set, register set, and instruction scheduling parameters
27187 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27188 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27189
27190 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27191
27192 By default (unless configured otherwise), GCC generates code for the GR5
27193 variant of the Visium architecture.
27194
27195 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27196 architecture. The only difference from GR5 code is that the compiler will
27197 generate block move instructions.
27198
27199 @item -mtune=@var{cpu_type}
27200 @opindex mtune
27201 Set the instruction scheduling parameters for machine type @var{cpu_type},
27202 but do not set the instruction set or register set that the option
27203 @option{-mcpu=@var{cpu_type}} would.
27204
27205 @item -msv-mode
27206 @opindex msv-mode
27207 Generate code for the supervisor mode, where there are no restrictions on
27208 the access to general registers. This is the default.
27209
27210 @item -muser-mode
27211 @opindex muser-mode
27212 Generate code for the user mode, where the access to some general registers
27213 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27214 mode; on the GR6, only registers r29 to r31 are affected.
27215 @end table
27216
27217 @node VMS Options
27218 @subsection VMS Options
27219
27220 These @samp{-m} options are defined for the VMS implementations:
27221
27222 @table @gcctabopt
27223 @item -mvms-return-codes
27224 @opindex mvms-return-codes
27225 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27226 condition (e.g.@: error) codes.
27227
27228 @item -mdebug-main=@var{prefix}
27229 @opindex mdebug-main=@var{prefix}
27230 Flag the first routine whose name starts with @var{prefix} as the main
27231 routine for the debugger.
27232
27233 @item -mmalloc64
27234 @opindex mmalloc64
27235 Default to 64-bit memory allocation routines.
27236
27237 @item -mpointer-size=@var{size}
27238 @opindex mpointer-size=@var{size}
27239 Set the default size of pointers. Possible options for @var{size} are
27240 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27241 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27242 The later option disables @code{pragma pointer_size}.
27243 @end table
27244
27245 @node VxWorks Options
27246 @subsection VxWorks Options
27247 @cindex VxWorks Options
27248
27249 The options in this section are defined for all VxWorks targets.
27250 Options specific to the target hardware are listed with the other
27251 options for that target.
27252
27253 @table @gcctabopt
27254 @item -mrtp
27255 @opindex mrtp
27256 GCC can generate code for both VxWorks kernels and real time processes
27257 (RTPs). This option switches from the former to the latter. It also
27258 defines the preprocessor macro @code{__RTP__}.
27259
27260 @item -non-static
27261 @opindex non-static
27262 Link an RTP executable against shared libraries rather than static
27263 libraries. The options @option{-static} and @option{-shared} can
27264 also be used for RTPs (@pxref{Link Options}); @option{-static}
27265 is the default.
27266
27267 @item -Bstatic
27268 @itemx -Bdynamic
27269 @opindex Bstatic
27270 @opindex Bdynamic
27271 These options are passed down to the linker. They are defined for
27272 compatibility with Diab.
27273
27274 @item -Xbind-lazy
27275 @opindex Xbind-lazy
27276 Enable lazy binding of function calls. This option is equivalent to
27277 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27278
27279 @item -Xbind-now
27280 @opindex Xbind-now
27281 Disable lazy binding of function calls. This option is the default and
27282 is defined for compatibility with Diab.
27283 @end table
27284
27285 @node x86 Options
27286 @subsection x86 Options
27287 @cindex x86 Options
27288
27289 These @samp{-m} options are defined for the x86 family of computers.
27290
27291 @table @gcctabopt
27292
27293 @item -march=@var{cpu-type}
27294 @opindex march
27295 Generate instructions for the machine type @var{cpu-type}. In contrast to
27296 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27297 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27298 to generate code that may not run at all on processors other than the one
27299 indicated. Specifying @option{-march=@var{cpu-type}} implies
27300 @option{-mtune=@var{cpu-type}}.
27301
27302 The choices for @var{cpu-type} are:
27303
27304 @table @samp
27305 @item native
27306 This selects the CPU to generate code for at compilation time by determining
27307 the processor type of the compiling machine. Using @option{-march=native}
27308 enables all instruction subsets supported by the local machine (hence
27309 the result might not run on different machines). Using @option{-mtune=native}
27310 produces code optimized for the local machine under the constraints
27311 of the selected instruction set.
27312
27313 @item x86-64
27314 A generic CPU with 64-bit extensions.
27315
27316 @item i386
27317 Original Intel i386 CPU@.
27318
27319 @item i486
27320 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27321
27322 @item i586
27323 @itemx pentium
27324 Intel Pentium CPU with no MMX support.
27325
27326 @item lakemont
27327 Intel Lakemont MCU, based on Intel Pentium CPU.
27328
27329 @item pentium-mmx
27330 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27331
27332 @item pentiumpro
27333 Intel Pentium Pro CPU@.
27334
27335 @item i686
27336 When used with @option{-march}, the Pentium Pro
27337 instruction set is used, so the code runs on all i686 family chips.
27338 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27339
27340 @item pentium2
27341 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27342 support.
27343
27344 @item pentium3
27345 @itemx pentium3m
27346 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27347 set support.
27348
27349 @item pentium-m
27350 Intel Pentium M; low-power version of Intel Pentium III CPU
27351 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27352
27353 @item pentium4
27354 @itemx pentium4m
27355 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27356
27357 @item prescott
27358 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27359 set support.
27360
27361 @item nocona
27362 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27363 SSE2 and SSE3 instruction set support.
27364
27365 @item core2
27366 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27367 instruction set support.
27368
27369 @item nehalem
27370 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27371 SSE4.1, SSE4.2 and POPCNT instruction set support.
27372
27373 @item westmere
27374 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27375 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27376
27377 @item sandybridge
27378 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27379 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27380
27381 @item ivybridge
27382 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27383 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27384 instruction set support.
27385
27386 @item haswell
27387 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27388 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27389 BMI, BMI2 and F16C instruction set support.
27390
27391 @item broadwell
27392 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27393 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27394 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27395
27396 @item skylake
27397 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27398 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27399 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27400 XSAVES instruction set support.
27401
27402 @item bonnell
27403 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27404 instruction set support.
27405
27406 @item silvermont
27407 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27408 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27409
27410 @item goldmont
27411 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27412 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27413 instruction set support.
27414
27415 @item goldmont-plus
27416 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27417 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27418 PTWRITE, RDPID, SGX and UMIP instruction set support.
27419
27420 @item tremont
27421 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27422 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27423 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27424
27425 @item knl
27426 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27427 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27428 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27429 AVX512CD instruction set support.
27430
27431 @item knm
27432 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27433 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27434 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27435 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27436
27437 @item skylake-avx512
27438 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27439 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27440 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27441 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27442
27443 @item cannonlake
27444 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27445 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27446 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27447 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27448 AVX512IFMA, SHA and UMIP instruction set support.
27449
27450 @item icelake-client
27451 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27452 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27453 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27454 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27455 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27456 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27457
27458 @item icelake-server
27459 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27460 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27461 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27462 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27463 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27464 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27465 set support.
27466
27467 @item cascadelake
27468 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27469 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27470 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27471 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27472
27473 @item k6
27474 AMD K6 CPU with MMX instruction set support.
27475
27476 @item k6-2
27477 @itemx k6-3
27478 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27479
27480 @item athlon
27481 @itemx athlon-tbird
27482 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27483 support.
27484
27485 @item athlon-4
27486 @itemx athlon-xp
27487 @itemx athlon-mp
27488 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27489 instruction set support.
27490
27491 @item k8
27492 @itemx opteron
27493 @itemx athlon64
27494 @itemx athlon-fx
27495 Processors based on the AMD K8 core with x86-64 instruction set support,
27496 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27497 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27498 instruction set extensions.)
27499
27500 @item k8-sse3
27501 @itemx opteron-sse3
27502 @itemx athlon64-sse3
27503 Improved versions of AMD K8 cores with SSE3 instruction set support.
27504
27505 @item amdfam10
27506 @itemx barcelona
27507 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27508 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27509 instruction set extensions.)
27510
27511 @item bdver1
27512 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27513 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27514 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27515 @item bdver2
27516 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27517 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27518 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27519 extensions.)
27520 @item bdver3
27521 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27522 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27523 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27524 64-bit instruction set extensions.
27525 @item bdver4
27526 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27527 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27528 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27529 SSE4.2, ABM and 64-bit instruction set extensions.
27530
27531 @item znver1
27532 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27533 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27534 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27535 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27536 instruction set extensions.
27537 @item znver2
27538 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27539 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27540 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27541 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27542 instruction set extensions.)
27543
27544
27545 @item btver1
27546 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27547 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27548 instruction set extensions.)
27549
27550 @item btver2
27551 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27552 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27553 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27554
27555 @item winchip-c6
27556 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27557 set support.
27558
27559 @item winchip2
27560 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27561 instruction set support.
27562
27563 @item c3
27564 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27565 (No scheduling is implemented for this chip.)
27566
27567 @item c3-2
27568 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27569 (No scheduling is implemented for this chip.)
27570
27571 @item c7
27572 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27573 (No scheduling is implemented for this chip.)
27574
27575 @item samuel-2
27576 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27577 (No scheduling is implemented for this chip.)
27578
27579 @item nehemiah
27580 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27581 (No scheduling is implemented for this chip.)
27582
27583 @item esther
27584 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27585 (No scheduling is implemented for this chip.)
27586
27587 @item eden-x2
27588 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27589 (No scheduling is implemented for this chip.)
27590
27591 @item eden-x4
27592 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27593 AVX and AVX2 instruction set support.
27594 (No scheduling is implemented for this chip.)
27595
27596 @item nano
27597 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27598 instruction set support.
27599 (No scheduling is implemented for this chip.)
27600
27601 @item nano-1000
27602 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27603 instruction set support.
27604 (No scheduling is implemented for this chip.)
27605
27606 @item nano-2000
27607 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27608 instruction set support.
27609 (No scheduling is implemented for this chip.)
27610
27611 @item nano-3000
27612 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27613 instruction set support.
27614 (No scheduling is implemented for this chip.)
27615
27616 @item nano-x2
27617 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27618 instruction set support.
27619 (No scheduling is implemented for this chip.)
27620
27621 @item nano-x4
27622 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27623 instruction set support.
27624 (No scheduling is implemented for this chip.)
27625
27626 @item geode
27627 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27628 @end table
27629
27630 @item -mtune=@var{cpu-type}
27631 @opindex mtune
27632 Tune to @var{cpu-type} everything applicable about the generated code, except
27633 for the ABI and the set of available instructions.
27634 While picking a specific @var{cpu-type} schedules things appropriately
27635 for that particular chip, the compiler does not generate any code that
27636 cannot run on the default machine type unless you use a
27637 @option{-march=@var{cpu-type}} option.
27638 For example, if GCC is configured for i686-pc-linux-gnu
27639 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27640 but still runs on i686 machines.
27641
27642 The choices for @var{cpu-type} are the same as for @option{-march}.
27643 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27644
27645 @table @samp
27646 @item generic
27647 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27648 If you know the CPU on which your code will run, then you should use
27649 the corresponding @option{-mtune} or @option{-march} option instead of
27650 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27651 of your application will have, then you should use this option.
27652
27653 As new processors are deployed in the marketplace, the behavior of this
27654 option will change. Therefore, if you upgrade to a newer version of
27655 GCC, code generation controlled by this option will change to reflect
27656 the processors
27657 that are most common at the time that version of GCC is released.
27658
27659 There is no @option{-march=generic} option because @option{-march}
27660 indicates the instruction set the compiler can use, and there is no
27661 generic instruction set applicable to all processors. In contrast,
27662 @option{-mtune} indicates the processor (or, in this case, collection of
27663 processors) for which the code is optimized.
27664
27665 @item intel
27666 Produce code optimized for the most current Intel processors, which are
27667 Haswell and Silvermont for this version of GCC. If you know the CPU
27668 on which your code will run, then you should use the corresponding
27669 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27670 But, if you want your application performs better on both Haswell and
27671 Silvermont, then you should use this option.
27672
27673 As new Intel processors are deployed in the marketplace, the behavior of
27674 this option will change. Therefore, if you upgrade to a newer version of
27675 GCC, code generation controlled by this option will change to reflect
27676 the most current Intel processors at the time that version of GCC is
27677 released.
27678
27679 There is no @option{-march=intel} option because @option{-march} indicates
27680 the instruction set the compiler can use, and there is no common
27681 instruction set applicable to all processors. In contrast,
27682 @option{-mtune} indicates the processor (or, in this case, collection of
27683 processors) for which the code is optimized.
27684 @end table
27685
27686 @item -mcpu=@var{cpu-type}
27687 @opindex mcpu
27688 A deprecated synonym for @option{-mtune}.
27689
27690 @item -mfpmath=@var{unit}
27691 @opindex mfpmath
27692 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27693 for @var{unit} are:
27694
27695 @table @samp
27696 @item 387
27697 Use the standard 387 floating-point coprocessor present on the majority of chips and
27698 emulated otherwise. Code compiled with this option runs almost everywhere.
27699 The temporary results are computed in 80-bit precision instead of the precision
27700 specified by the type, resulting in slightly different results compared to most
27701 of other chips. See @option{-ffloat-store} for more detailed description.
27702
27703 This is the default choice for non-Darwin x86-32 targets.
27704
27705 @item sse
27706 Use scalar floating-point instructions present in the SSE instruction set.
27707 This instruction set is supported by Pentium III and newer chips,
27708 and in the AMD line
27709 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27710 instruction set supports only single-precision arithmetic, thus the double and
27711 extended-precision arithmetic are still done using 387. A later version, present
27712 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27713 arithmetic too.
27714
27715 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27716 or @option{-msse2} switches to enable SSE extensions and make this option
27717 effective. For the x86-64 compiler, these extensions are enabled by default.
27718
27719 The resulting code should be considerably faster in the majority of cases and avoid
27720 the numerical instability problems of 387 code, but may break some existing
27721 code that expects temporaries to be 80 bits.
27722
27723 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27724 and the default choice for x86-32 targets with the SSE2 instruction set
27725 when @option{-ffast-math} is enabled.
27726
27727 @item sse,387
27728 @itemx sse+387
27729 @itemx both
27730 Attempt to utilize both instruction sets at once. This effectively doubles the
27731 amount of available registers, and on chips with separate execution units for
27732 387 and SSE the execution resources too. Use this option with care, as it is
27733 still experimental, because the GCC register allocator does not model separate
27734 functional units well, resulting in unstable performance.
27735 @end table
27736
27737 @item -masm=@var{dialect}
27738 @opindex masm=@var{dialect}
27739 Output assembly instructions using selected @var{dialect}. Also affects
27740 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27741 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27742 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27743 not support @samp{intel}.
27744
27745 @item -mieee-fp
27746 @itemx -mno-ieee-fp
27747 @opindex mieee-fp
27748 @opindex mno-ieee-fp
27749 Control whether or not the compiler uses IEEE floating-point
27750 comparisons. These correctly handle the case where the result of a
27751 comparison is unordered.
27752
27753 @item -m80387
27754 @itemx -mhard-float
27755 @opindex 80387
27756 @opindex mhard-float
27757 Generate output containing 80387 instructions for floating point.
27758
27759 @item -mno-80387
27760 @itemx -msoft-float
27761 @opindex no-80387
27762 @opindex msoft-float
27763 Generate output containing library calls for floating point.
27764
27765 @strong{Warning:} the requisite libraries are not part of GCC@.
27766 Normally the facilities of the machine's usual C compiler are used, but
27767 this cannot be done directly in cross-compilation. You must make your
27768 own arrangements to provide suitable library functions for
27769 cross-compilation.
27770
27771 On machines where a function returns floating-point results in the 80387
27772 register stack, some floating-point opcodes may be emitted even if
27773 @option{-msoft-float} is used.
27774
27775 @item -mno-fp-ret-in-387
27776 @opindex mno-fp-ret-in-387
27777 @opindex mfp-ret-in-387
27778 Do not use the FPU registers for return values of functions.
27779
27780 The usual calling convention has functions return values of types
27781 @code{float} and @code{double} in an FPU register, even if there
27782 is no FPU@. The idea is that the operating system should emulate
27783 an FPU@.
27784
27785 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27786 in ordinary CPU registers instead.
27787
27788 @item -mno-fancy-math-387
27789 @opindex mno-fancy-math-387
27790 @opindex mfancy-math-387
27791 Some 387 emulators do not support the @code{sin}, @code{cos} and
27792 @code{sqrt} instructions for the 387. Specify this option to avoid
27793 generating those instructions.
27794 This option is overridden when @option{-march}
27795 indicates that the target CPU always has an FPU and so the
27796 instruction does not need emulation. These
27797 instructions are not generated unless you also use the
27798 @option{-funsafe-math-optimizations} switch.
27799
27800 @item -malign-double
27801 @itemx -mno-align-double
27802 @opindex malign-double
27803 @opindex mno-align-double
27804 Control whether GCC aligns @code{double}, @code{long double}, and
27805 @code{long long} variables on a two-word boundary or a one-word
27806 boundary. Aligning @code{double} variables on a two-word boundary
27807 produces code that runs somewhat faster on a Pentium at the
27808 expense of more memory.
27809
27810 On x86-64, @option{-malign-double} is enabled by default.
27811
27812 @strong{Warning:} if you use the @option{-malign-double} switch,
27813 structures containing the above types are aligned differently than
27814 the published application binary interface specifications for the x86-32
27815 and are not binary compatible with structures in code compiled
27816 without that switch.
27817
27818 @item -m96bit-long-double
27819 @itemx -m128bit-long-double
27820 @opindex m96bit-long-double
27821 @opindex m128bit-long-double
27822 These switches control the size of @code{long double} type. The x86-32
27823 application binary interface specifies the size to be 96 bits,
27824 so @option{-m96bit-long-double} is the default in 32-bit mode.
27825
27826 Modern architectures (Pentium and newer) prefer @code{long double}
27827 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27828 conforming to the ABI, this is not possible. So specifying
27829 @option{-m128bit-long-double} aligns @code{long double}
27830 to a 16-byte boundary by padding the @code{long double} with an additional
27831 32-bit zero.
27832
27833 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27834 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27835
27836 Notice that neither of these options enable any extra precision over the x87
27837 standard of 80 bits for a @code{long double}.
27838
27839 @strong{Warning:} if you override the default value for your target ABI, this
27840 changes the size of
27841 structures and arrays containing @code{long double} variables,
27842 as well as modifying the function calling convention for functions taking
27843 @code{long double}. Hence they are not binary-compatible
27844 with code compiled without that switch.
27845
27846 @item -mlong-double-64
27847 @itemx -mlong-double-80
27848 @itemx -mlong-double-128
27849 @opindex mlong-double-64
27850 @opindex mlong-double-80
27851 @opindex mlong-double-128
27852 These switches control the size of @code{long double} type. A size
27853 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27854 type. This is the default for 32-bit Bionic C library. A size
27855 of 128 bits makes the @code{long double} type equivalent to the
27856 @code{__float128} type. This is the default for 64-bit Bionic C library.
27857
27858 @strong{Warning:} if you override the default value for your target ABI, this
27859 changes the size of
27860 structures and arrays containing @code{long double} variables,
27861 as well as modifying the function calling convention for functions taking
27862 @code{long double}. Hence they are not binary-compatible
27863 with code compiled without that switch.
27864
27865 @item -malign-data=@var{type}
27866 @opindex malign-data
27867 Control how GCC aligns variables. Supported values for @var{type} are
27868 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27869 and earlier, @samp{abi} uses alignment value as specified by the
27870 psABI, and @samp{cacheline} uses increased alignment value to match
27871 the cache line size. @samp{compat} is the default.
27872
27873 @item -mlarge-data-threshold=@var{threshold}
27874 @opindex mlarge-data-threshold
27875 When @option{-mcmodel=medium} is specified, data objects larger than
27876 @var{threshold} are placed in the large data section. This value must be the
27877 same across all objects linked into the binary, and defaults to 65535.
27878
27879 @item -mrtd
27880 @opindex mrtd
27881 Use a different function-calling convention, in which functions that
27882 take a fixed number of arguments return with the @code{ret @var{num}}
27883 instruction, which pops their arguments while returning. This saves one
27884 instruction in the caller since there is no need to pop the arguments
27885 there.
27886
27887 You can specify that an individual function is called with this calling
27888 sequence with the function attribute @code{stdcall}. You can also
27889 override the @option{-mrtd} option by using the function attribute
27890 @code{cdecl}. @xref{Function Attributes}.
27891
27892 @strong{Warning:} this calling convention is incompatible with the one
27893 normally used on Unix, so you cannot use it if you need to call
27894 libraries compiled with the Unix compiler.
27895
27896 Also, you must provide function prototypes for all functions that
27897 take variable numbers of arguments (including @code{printf});
27898 otherwise incorrect code is generated for calls to those
27899 functions.
27900
27901 In addition, seriously incorrect code results if you call a
27902 function with too many arguments. (Normally, extra arguments are
27903 harmlessly ignored.)
27904
27905 @item -mregparm=@var{num}
27906 @opindex mregparm
27907 Control how many registers are used to pass integer arguments. By
27908 default, no registers are used to pass arguments, and at most 3
27909 registers can be used. You can control this behavior for a specific
27910 function by using the function attribute @code{regparm}.
27911 @xref{Function Attributes}.
27912
27913 @strong{Warning:} if you use this switch, and
27914 @var{num} is nonzero, then you must build all modules with the same
27915 value, including any libraries. This includes the system libraries and
27916 startup modules.
27917
27918 @item -msseregparm
27919 @opindex msseregparm
27920 Use SSE register passing conventions for float and double arguments
27921 and return values. You can control this behavior for a specific
27922 function by using the function attribute @code{sseregparm}.
27923 @xref{Function Attributes}.
27924
27925 @strong{Warning:} if you use this switch then you must build all
27926 modules with the same value, including any libraries. This includes
27927 the system libraries and startup modules.
27928
27929 @item -mvect8-ret-in-mem
27930 @opindex mvect8-ret-in-mem
27931 Return 8-byte vectors in memory instead of MMX registers. This is the
27932 default on VxWorks to match the ABI of the Sun Studio compilers until
27933 version 12. @emph{Only} use this option if you need to remain
27934 compatible with existing code produced by those previous compiler
27935 versions or older versions of GCC@.
27936
27937 @item -mpc32
27938 @itemx -mpc64
27939 @itemx -mpc80
27940 @opindex mpc32
27941 @opindex mpc64
27942 @opindex mpc80
27943
27944 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27945 is specified, the significands of results of floating-point operations are
27946 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27947 significands of results of floating-point operations to 53 bits (double
27948 precision) and @option{-mpc80} rounds the significands of results of
27949 floating-point operations to 64 bits (extended double precision), which is
27950 the default. When this option is used, floating-point operations in higher
27951 precisions are not available to the programmer without setting the FPU
27952 control word explicitly.
27953
27954 Setting the rounding of floating-point operations to less than the default
27955 80 bits can speed some programs by 2% or more. Note that some mathematical
27956 libraries assume that extended-precision (80-bit) floating-point operations
27957 are enabled by default; routines in such libraries could suffer significant
27958 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27959 when this option is used to set the precision to less than extended precision.
27960
27961 @item -mstackrealign
27962 @opindex mstackrealign
27963 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27964 option generates an alternate prologue and epilogue that realigns the
27965 run-time stack if necessary. This supports mixing legacy codes that keep
27966 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27967 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27968 applicable to individual functions.
27969
27970 @item -mpreferred-stack-boundary=@var{num}
27971 @opindex mpreferred-stack-boundary
27972 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27973 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27974 the default is 4 (16 bytes or 128 bits).
27975
27976 @strong{Warning:} When generating code for the x86-64 architecture with
27977 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27978 used to keep the stack boundary aligned to 8 byte boundary. Since
27979 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27980 intended to be used in controlled environment where stack space is
27981 important limitation. This option leads to wrong code when functions
27982 compiled with 16 byte stack alignment (such as functions from a standard
27983 library) are called with misaligned stack. In this case, SSE
27984 instructions may lead to misaligned memory access traps. In addition,
27985 variable arguments are handled incorrectly for 16 byte aligned
27986 objects (including x87 long double and __int128), leading to wrong
27987 results. You must build all modules with
27988 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27989 includes the system libraries and startup modules.
27990
27991 @item -mincoming-stack-boundary=@var{num}
27992 @opindex mincoming-stack-boundary
27993 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27994 boundary. If @option{-mincoming-stack-boundary} is not specified,
27995 the one specified by @option{-mpreferred-stack-boundary} is used.
27996
27997 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27998 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27999 suffer significant run time performance penalties. On Pentium III, the
28000 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28001 properly if it is not 16-byte aligned.
28002
28003 To ensure proper alignment of this values on the stack, the stack boundary
28004 must be as aligned as that required by any value stored on the stack.
28005 Further, every function must be generated such that it keeps the stack
28006 aligned. Thus calling a function compiled with a higher preferred
28007 stack boundary from a function compiled with a lower preferred stack
28008 boundary most likely misaligns the stack. It is recommended that
28009 libraries that use callbacks always use the default setting.
28010
28011 This extra alignment does consume extra stack space, and generally
28012 increases code size. Code that is sensitive to stack space usage, such
28013 as embedded systems and operating system kernels, may want to reduce the
28014 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28015
28016 @need 200
28017 @item -mmmx
28018 @opindex mmmx
28019 @need 200
28020 @itemx -msse
28021 @opindex msse
28022 @need 200
28023 @itemx -msse2
28024 @opindex msse2
28025 @need 200
28026 @itemx -msse3
28027 @opindex msse3
28028 @need 200
28029 @itemx -mssse3
28030 @opindex mssse3
28031 @need 200
28032 @itemx -msse4
28033 @opindex msse4
28034 @need 200
28035 @itemx -msse4a
28036 @opindex msse4a
28037 @need 200
28038 @itemx -msse4.1
28039 @opindex msse4.1
28040 @need 200
28041 @itemx -msse4.2
28042 @opindex msse4.2
28043 @need 200
28044 @itemx -mavx
28045 @opindex mavx
28046 @need 200
28047 @itemx -mavx2
28048 @opindex mavx2
28049 @need 200
28050 @itemx -mavx512f
28051 @opindex mavx512f
28052 @need 200
28053 @itemx -mavx512pf
28054 @opindex mavx512pf
28055 @need 200
28056 @itemx -mavx512er
28057 @opindex mavx512er
28058 @need 200
28059 @itemx -mavx512cd
28060 @opindex mavx512cd
28061 @need 200
28062 @itemx -mavx512vl
28063 @opindex mavx512vl
28064 @need 200
28065 @itemx -mavx512bw
28066 @opindex mavx512bw
28067 @need 200
28068 @itemx -mavx512dq
28069 @opindex mavx512dq
28070 @need 200
28071 @itemx -mavx512ifma
28072 @opindex mavx512ifma
28073 @need 200
28074 @itemx -mavx512vbmi
28075 @opindex mavx512vbmi
28076 @need 200
28077 @itemx -msha
28078 @opindex msha
28079 @need 200
28080 @itemx -maes
28081 @opindex maes
28082 @need 200
28083 @itemx -mpclmul
28084 @opindex mpclmul
28085 @need 200
28086 @itemx -mclflushopt
28087 @opindex mclflushopt
28088 @need 200
28089 @itemx -mclwb
28090 @opindex mclwb
28091 @need 200
28092 @itemx -mfsgsbase
28093 @opindex mfsgsbase
28094 @need 200
28095 @itemx -mptwrite
28096 @opindex mptwrite
28097 @need 200
28098 @itemx -mrdrnd
28099 @opindex mrdrnd
28100 @need 200
28101 @itemx -mf16c
28102 @opindex mf16c
28103 @need 200
28104 @itemx -mfma
28105 @opindex mfma
28106 @need 200
28107 @itemx -mpconfig
28108 @opindex mpconfig
28109 @need 200
28110 @itemx -mwbnoinvd
28111 @opindex mwbnoinvd
28112 @need 200
28113 @itemx -mfma4
28114 @opindex mfma4
28115 @need 200
28116 @itemx -mprfchw
28117 @opindex mprfchw
28118 @need 200
28119 @itemx -mrdpid
28120 @opindex mrdpid
28121 @need 200
28122 @itemx -mprefetchwt1
28123 @opindex mprefetchwt1
28124 @need 200
28125 @itemx -mrdseed
28126 @opindex mrdseed
28127 @need 200
28128 @itemx -msgx
28129 @opindex msgx
28130 @need 200
28131 @itemx -mxop
28132 @opindex mxop
28133 @need 200
28134 @itemx -mlwp
28135 @opindex mlwp
28136 @need 200
28137 @itemx -m3dnow
28138 @opindex m3dnow
28139 @need 200
28140 @itemx -m3dnowa
28141 @opindex m3dnowa
28142 @need 200
28143 @itemx -mpopcnt
28144 @opindex mpopcnt
28145 @need 200
28146 @itemx -mabm
28147 @opindex mabm
28148 @need 200
28149 @itemx -madx
28150 @opindex madx
28151 @need 200
28152 @itemx -mbmi
28153 @opindex mbmi
28154 @need 200
28155 @itemx -mbmi2
28156 @opindex mbmi2
28157 @need 200
28158 @itemx -mlzcnt
28159 @opindex mlzcnt
28160 @need 200
28161 @itemx -mfxsr
28162 @opindex mfxsr
28163 @need 200
28164 @itemx -mxsave
28165 @opindex mxsave
28166 @need 200
28167 @itemx -mxsaveopt
28168 @opindex mxsaveopt
28169 @need 200
28170 @itemx -mxsavec
28171 @opindex mxsavec
28172 @need 200
28173 @itemx -mxsaves
28174 @opindex mxsaves
28175 @need 200
28176 @itemx -mrtm
28177 @opindex mrtm
28178 @need 200
28179 @itemx -mhle
28180 @opindex mhle
28181 @need 200
28182 @itemx -mtbm
28183 @opindex mtbm
28184 @need 200
28185 @itemx -mmwaitx
28186 @opindex mmwaitx
28187 @need 200
28188 @itemx -mclzero
28189 @opindex mclzero
28190 @need 200
28191 @itemx -mpku
28192 @opindex mpku
28193 @need 200
28194 @itemx -mavx512vbmi2
28195 @opindex mavx512vbmi2
28196 @need 200
28197 @itemx -mavx512bf16
28198 @opindex mavx512bf16
28199 @need 200
28200 @itemx -mgfni
28201 @opindex mgfni
28202 @need 200
28203 @itemx -mvaes
28204 @opindex mvaes
28205 @need 200
28206 @itemx -mwaitpkg
28207 @opindex mwaitpkg
28208 @need 200
28209 @itemx -mvpclmulqdq
28210 @opindex mvpclmulqdq
28211 @need 200
28212 @itemx -mavx512bitalg
28213 @opindex mavx512bitalg
28214 @need 200
28215 @itemx -mmovdiri
28216 @opindex mmovdiri
28217 @need 200
28218 @itemx -mmovdir64b
28219 @opindex mmovdir64b
28220 @need 200
28221 @itemx -menqcmd
28222 @opindex menqcmd
28223 @need 200
28224 @itemx -mavx512vpopcntdq
28225 @opindex mavx512vpopcntdq
28226 @need 200
28227 @itemx -mavx512vp2intersect
28228 @opindex mavx512vp2intersect
28229 @need 200
28230 @itemx -mavx5124fmaps
28231 @opindex mavx5124fmaps
28232 @need 200
28233 @itemx -mavx512vnni
28234 @opindex mavx512vnni
28235 @need 200
28236 @itemx -mavx5124vnniw
28237 @opindex mavx5124vnniw
28238 @need 200
28239 @itemx -mcldemote
28240 @opindex mcldemote
28241 These switches enable the use of instructions in the MMX, SSE,
28242 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28243 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28244 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28245 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28246 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28247 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28248 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28249 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28250 extended instruction sets. Each has a corresponding @option{-mno-} option to
28251 disable use of these instructions.
28252
28253 These extensions are also available as built-in functions: see
28254 @ref{x86 Built-in Functions}, for details of the functions enabled and
28255 disabled by these switches.
28256
28257 To generate SSE/SSE2 instructions automatically from floating-point
28258 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28259
28260 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28261 generates new AVX instructions or AVX equivalence for all SSEx instructions
28262 when needed.
28263
28264 These options enable GCC to use these extended instructions in
28265 generated code, even without @option{-mfpmath=sse}. Applications that
28266 perform run-time CPU detection must compile separate files for each
28267 supported architecture, using the appropriate flags. In particular,
28268 the file containing the CPU detection code should be compiled without
28269 these options.
28270
28271 @item -mdump-tune-features
28272 @opindex mdump-tune-features
28273 This option instructs GCC to dump the names of the x86 performance
28274 tuning features and default settings. The names can be used in
28275 @option{-mtune-ctrl=@var{feature-list}}.
28276
28277 @item -mtune-ctrl=@var{feature-list}
28278 @opindex mtune-ctrl=@var{feature-list}
28279 This option is used to do fine grain control of x86 code generation features.
28280 @var{feature-list} is a comma separated list of @var{feature} names. See also
28281 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28282 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28283 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28284 developers. Using it may lead to code paths not covered by testing and can
28285 potentially result in compiler ICEs or runtime errors.
28286
28287 @item -mno-default
28288 @opindex mno-default
28289 This option instructs GCC to turn off all tunable features. See also
28290 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28291
28292 @item -mcld
28293 @opindex mcld
28294 This option instructs GCC to emit a @code{cld} instruction in the prologue
28295 of functions that use string instructions. String instructions depend on
28296 the DF flag to select between autoincrement or autodecrement mode. While the
28297 ABI specifies the DF flag to be cleared on function entry, some operating
28298 systems violate this specification by not clearing the DF flag in their
28299 exception dispatchers. The exception handler can be invoked with the DF flag
28300 set, which leads to wrong direction mode when string instructions are used.
28301 This option can be enabled by default on 32-bit x86 targets by configuring
28302 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28303 instructions can be suppressed with the @option{-mno-cld} compiler option
28304 in this case.
28305
28306 @item -mvzeroupper
28307 @opindex mvzeroupper
28308 This option instructs GCC to emit a @code{vzeroupper} instruction
28309 before a transfer of control flow out of the function to minimize
28310 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28311 intrinsics.
28312
28313 @item -mprefer-avx128
28314 @opindex mprefer-avx128
28315 This option instructs GCC to use 128-bit AVX instructions instead of
28316 256-bit AVX instructions in the auto-vectorizer.
28317
28318 @item -mprefer-vector-width=@var{opt}
28319 @opindex mprefer-vector-width
28320 This option instructs GCC to use @var{opt}-bit vector width in instructions
28321 instead of default on the selected platform.
28322
28323 @table @samp
28324 @item none
28325 No extra limitations applied to GCC other than defined by the selected platform.
28326
28327 @item 128
28328 Prefer 128-bit vector width for instructions.
28329
28330 @item 256
28331 Prefer 256-bit vector width for instructions.
28332
28333 @item 512
28334 Prefer 512-bit vector width for instructions.
28335 @end table
28336
28337 @item -mcx16
28338 @opindex mcx16
28339 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28340 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28341 objects. This is useful for atomic updates of data structures exceeding one
28342 machine word in size. The compiler uses this instruction to implement
28343 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28344 128-bit integers, a library call is always used.
28345
28346 @item -msahf
28347 @opindex msahf
28348 This option enables generation of @code{SAHF} instructions in 64-bit code.
28349 Early Intel Pentium 4 CPUs with Intel 64 support,
28350 prior to the introduction of Pentium 4 G1 step in December 2005,
28351 lacked the @code{LAHF} and @code{SAHF} instructions
28352 which are supported by AMD64.
28353 These are load and store instructions, respectively, for certain status flags.
28354 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28355 @code{drem}, and @code{remainder} built-in functions;
28356 see @ref{Other Builtins} for details.
28357
28358 @item -mmovbe
28359 @opindex mmovbe
28360 This option enables use of the @code{movbe} instruction to implement
28361 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28362
28363 @item -mshstk
28364 @opindex mshstk
28365 The @option{-mshstk} option enables shadow stack built-in functions
28366 from x86 Control-flow Enforcement Technology (CET).
28367
28368 @item -mcrc32
28369 @opindex mcrc32
28370 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28371 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28372 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28373
28374 @item -mrecip
28375 @opindex mrecip
28376 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28377 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28378 with an additional Newton-Raphson step
28379 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28380 (and their vectorized
28381 variants) for single-precision floating-point arguments. These instructions
28382 are generated only when @option{-funsafe-math-optimizations} is enabled
28383 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28384 Note that while the throughput of the sequence is higher than the throughput
28385 of the non-reciprocal instruction, the precision of the sequence can be
28386 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28387
28388 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28389 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28390 combination), and doesn't need @option{-mrecip}.
28391
28392 Also note that GCC emits the above sequence with additional Newton-Raphson step
28393 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28394 already with @option{-ffast-math} (or the above option combination), and
28395 doesn't need @option{-mrecip}.
28396
28397 @item -mrecip=@var{opt}
28398 @opindex mrecip=opt
28399 This option controls which reciprocal estimate instructions
28400 may be used. @var{opt} is a comma-separated list of options, which may
28401 be preceded by a @samp{!} to invert the option:
28402
28403 @table @samp
28404 @item all
28405 Enable all estimate instructions.
28406
28407 @item default
28408 Enable the default instructions, equivalent to @option{-mrecip}.
28409
28410 @item none
28411 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28412
28413 @item div
28414 Enable the approximation for scalar division.
28415
28416 @item vec-div
28417 Enable the approximation for vectorized division.
28418
28419 @item sqrt
28420 Enable the approximation for scalar square root.
28421
28422 @item vec-sqrt
28423 Enable the approximation for vectorized square root.
28424 @end table
28425
28426 So, for example, @option{-mrecip=all,!sqrt} enables
28427 all of the reciprocal approximations, except for square root.
28428
28429 @item -mveclibabi=@var{type}
28430 @opindex mveclibabi
28431 Specifies the ABI type to use for vectorizing intrinsics using an
28432 external library. Supported values for @var{type} are @samp{svml}
28433 for the Intel short
28434 vector math library and @samp{acml} for the AMD math core library.
28435 To use this option, both @option{-ftree-vectorize} and
28436 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28437 ABI-compatible library must be specified at link time.
28438
28439 GCC currently emits calls to @code{vmldExp2},
28440 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28441 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28442 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28443 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28444 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28445 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28446 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28447 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28448 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28449 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28450 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28451 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28452 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28453 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28454 when @option{-mveclibabi=acml} is used.
28455
28456 @item -mabi=@var{name}
28457 @opindex mabi
28458 Generate code for the specified calling convention. Permissible values
28459 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28460 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28461 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28462 You can control this behavior for specific functions by
28463 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28464 @xref{Function Attributes}.
28465
28466 @item -mforce-indirect-call
28467 @opindex mforce-indirect-call
28468 Force all calls to functions to be indirect. This is useful
28469 when using Intel Processor Trace where it generates more precise timing
28470 information for function calls.
28471
28472 @item -mmanual-endbr
28473 @opindex mmanual-endbr
28474 Insert ENDBR instruction at function entry only via the @code{cf_check}
28475 function attribute. This is useful when used with the option
28476 @option{-fcf-protection=branch} to control ENDBR insertion at the
28477 function entry.
28478
28479 @item -mcall-ms2sysv-xlogues
28480 @opindex mcall-ms2sysv-xlogues
28481 @opindex mno-call-ms2sysv-xlogues
28482 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28483 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28484 default, the code for saving and restoring these registers is emitted inline,
28485 resulting in fairly lengthy prologues and epilogues. Using
28486 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28487 use stubs in the static portion of libgcc to perform these saves and restores,
28488 thus reducing function size at the cost of a few extra instructions.
28489
28490 @item -mtls-dialect=@var{type}
28491 @opindex mtls-dialect
28492 Generate code to access thread-local storage using the @samp{gnu} or
28493 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28494 @samp{gnu2} is more efficient, but it may add compile- and run-time
28495 requirements that cannot be satisfied on all systems.
28496
28497 @item -mpush-args
28498 @itemx -mno-push-args
28499 @opindex mpush-args
28500 @opindex mno-push-args
28501 Use PUSH operations to store outgoing parameters. This method is shorter
28502 and usually equally fast as method using SUB/MOV operations and is enabled
28503 by default. In some cases disabling it may improve performance because of
28504 improved scheduling and reduced dependencies.
28505
28506 @item -maccumulate-outgoing-args
28507 @opindex maccumulate-outgoing-args
28508 If enabled, the maximum amount of space required for outgoing arguments is
28509 computed in the function prologue. This is faster on most modern CPUs
28510 because of reduced dependencies, improved scheduling and reduced stack usage
28511 when the preferred stack boundary is not equal to 2. The drawback is a notable
28512 increase in code size. This switch implies @option{-mno-push-args}.
28513
28514 @item -mthreads
28515 @opindex mthreads
28516 Support thread-safe exception handling on MinGW. Programs that rely
28517 on thread-safe exception handling must compile and link all code with the
28518 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28519 @option{-D_MT}; when linking, it links in a special thread helper library
28520 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28521
28522 @item -mms-bitfields
28523 @itemx -mno-ms-bitfields
28524 @opindex mms-bitfields
28525 @opindex mno-ms-bitfields
28526
28527 Enable/disable bit-field layout compatible with the native Microsoft
28528 Windows compiler.
28529
28530 If @code{packed} is used on a structure, or if bit-fields are used,
28531 it may be that the Microsoft ABI lays out the structure differently
28532 than the way GCC normally does. Particularly when moving packed
28533 data between functions compiled with GCC and the native Microsoft compiler
28534 (either via function call or as data in a file), it may be necessary to access
28535 either format.
28536
28537 This option is enabled by default for Microsoft Windows
28538 targets. This behavior can also be controlled locally by use of variable
28539 or type attributes. For more information, see @ref{x86 Variable Attributes}
28540 and @ref{x86 Type Attributes}.
28541
28542 The Microsoft structure layout algorithm is fairly simple with the exception
28543 of the bit-field packing.
28544 The padding and alignment of members of structures and whether a bit-field
28545 can straddle a storage-unit boundary are determine by these rules:
28546
28547 @enumerate
28548 @item Structure members are stored sequentially in the order in which they are
28549 declared: the first member has the lowest memory address and the last member
28550 the highest.
28551
28552 @item Every data object has an alignment requirement. The alignment requirement
28553 for all data except structures, unions, and arrays is either the size of the
28554 object or the current packing size (specified with either the
28555 @code{aligned} attribute or the @code{pack} pragma),
28556 whichever is less. For structures, unions, and arrays,
28557 the alignment requirement is the largest alignment requirement of its members.
28558 Every object is allocated an offset so that:
28559
28560 @smallexample
28561 offset % alignment_requirement == 0
28562 @end smallexample
28563
28564 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28565 unit if the integral types are the same size and if the next bit-field fits
28566 into the current allocation unit without crossing the boundary imposed by the
28567 common alignment requirements of the bit-fields.
28568 @end enumerate
28569
28570 MSVC interprets zero-length bit-fields in the following ways:
28571
28572 @enumerate
28573 @item If a zero-length bit-field is inserted between two bit-fields that
28574 are normally coalesced, the bit-fields are not coalesced.
28575
28576 For example:
28577
28578 @smallexample
28579 struct
28580 @{
28581 unsigned long bf_1 : 12;
28582 unsigned long : 0;
28583 unsigned long bf_2 : 12;
28584 @} t1;
28585 @end smallexample
28586
28587 @noindent
28588 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28589 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28590
28591 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28592 alignment of the zero-length bit-field is greater than the member that follows it,
28593 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28594
28595 For example:
28596
28597 @smallexample
28598 struct
28599 @{
28600 char foo : 4;
28601 short : 0;
28602 char bar;
28603 @} t2;
28604
28605 struct
28606 @{
28607 char foo : 4;
28608 short : 0;
28609 double bar;
28610 @} t3;
28611 @end smallexample
28612
28613 @noindent
28614 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28615 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28616 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28617 of the structure.
28618
28619 Taking this into account, it is important to note the following:
28620
28621 @enumerate
28622 @item If a zero-length bit-field follows a normal bit-field, the type of the
28623 zero-length bit-field may affect the alignment of the structure as whole. For
28624 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28625 normal bit-field, and is of type short.
28626
28627 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28628 still affect the alignment of the structure:
28629
28630 @smallexample
28631 struct
28632 @{
28633 char foo : 6;
28634 long : 0;
28635 @} t4;
28636 @end smallexample
28637
28638 @noindent
28639 Here, @code{t4} takes up 4 bytes.
28640 @end enumerate
28641
28642 @item Zero-length bit-fields following non-bit-field members are ignored:
28643
28644 @smallexample
28645 struct
28646 @{
28647 char foo;
28648 long : 0;
28649 char bar;
28650 @} t5;
28651 @end smallexample
28652
28653 @noindent
28654 Here, @code{t5} takes up 2 bytes.
28655 @end enumerate
28656
28657
28658 @item -mno-align-stringops
28659 @opindex mno-align-stringops
28660 @opindex malign-stringops
28661 Do not align the destination of inlined string operations. This switch reduces
28662 code size and improves performance in case the destination is already aligned,
28663 but GCC doesn't know about it.
28664
28665 @item -minline-all-stringops
28666 @opindex minline-all-stringops
28667 By default GCC inlines string operations only when the destination is
28668 known to be aligned to least a 4-byte boundary.
28669 This enables more inlining and increases code
28670 size, but may improve performance of code that depends on fast
28671 @code{memcpy} and @code{memset} for short lengths.
28672 The option enables inline expansion of @code{strlen} for all
28673 pointer alignments.
28674
28675 @item -minline-stringops-dynamically
28676 @opindex minline-stringops-dynamically
28677 For string operations of unknown size, use run-time checks with
28678 inline code for small blocks and a library call for large blocks.
28679
28680 @item -mstringop-strategy=@var{alg}
28681 @opindex mstringop-strategy=@var{alg}
28682 Override the internal decision heuristic for the particular algorithm to use
28683 for inlining string operations. The allowed values for @var{alg} are:
28684
28685 @table @samp
28686 @item rep_byte
28687 @itemx rep_4byte
28688 @itemx rep_8byte
28689 Expand using i386 @code{rep} prefix of the specified size.
28690
28691 @item byte_loop
28692 @itemx loop
28693 @itemx unrolled_loop
28694 Expand into an inline loop.
28695
28696 @item libcall
28697 Always use a library call.
28698 @end table
28699
28700 @item -mmemcpy-strategy=@var{strategy}
28701 @opindex mmemcpy-strategy=@var{strategy}
28702 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28703 should be inlined and what inline algorithm to use when the expected size
28704 of the copy operation is known. @var{strategy}
28705 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28706 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28707 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28708 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28709 in the list must be specified in increasing order. The minimal byte size for
28710 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28711 preceding range.
28712
28713 @item -mmemset-strategy=@var{strategy}
28714 @opindex mmemset-strategy=@var{strategy}
28715 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28716 @code{__builtin_memset} expansion.
28717
28718 @item -momit-leaf-frame-pointer
28719 @opindex momit-leaf-frame-pointer
28720 Don't keep the frame pointer in a register for leaf functions. This
28721 avoids the instructions to save, set up, and restore frame pointers and
28722 makes an extra register available in leaf functions. The option
28723 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28724 which might make debugging harder.
28725
28726 @item -mtls-direct-seg-refs
28727 @itemx -mno-tls-direct-seg-refs
28728 @opindex mtls-direct-seg-refs
28729 Controls whether TLS variables may be accessed with offsets from the
28730 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28731 or whether the thread base pointer must be added. Whether or not this
28732 is valid depends on the operating system, and whether it maps the
28733 segment to cover the entire TLS area.
28734
28735 For systems that use the GNU C Library, the default is on.
28736
28737 @item -msse2avx
28738 @itemx -mno-sse2avx
28739 @opindex msse2avx
28740 Specify that the assembler should encode SSE instructions with VEX
28741 prefix. The option @option{-mavx} turns this on by default.
28742
28743 @item -mfentry
28744 @itemx -mno-fentry
28745 @opindex mfentry
28746 If profiling is active (@option{-pg}), put the profiling
28747 counter call before the prologue.
28748 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28749 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28750
28751 @item -mrecord-mcount
28752 @itemx -mno-record-mcount
28753 @opindex mrecord-mcount
28754 If profiling is active (@option{-pg}), generate a __mcount_loc section
28755 that contains pointers to each profiling call. This is useful for
28756 automatically patching and out calls.
28757
28758 @item -mnop-mcount
28759 @itemx -mno-nop-mcount
28760 @opindex mnop-mcount
28761 If profiling is active (@option{-pg}), generate the calls to
28762 the profiling functions as NOPs. This is useful when they
28763 should be patched in later dynamically. This is likely only
28764 useful together with @option{-mrecord-mcount}.
28765
28766 @item -minstrument-return=@var{type}
28767 @opindex minstrument-return
28768 Instrument function exit in -pg -mfentry instrumented functions with
28769 call to specified function. This only instruments true returns ending
28770 with ret, but not sibling calls ending with jump. Valid types
28771 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28772 or @var{nop5} to generate a 5 byte nop.
28773
28774 @item -mrecord-return
28775 @itemx -mno-record-return
28776 @opindex mrecord-return
28777 Generate a __return_loc section pointing to all return instrumentation code.
28778
28779 @item -mfentry-name=@var{name}
28780 @opindex mfentry-name
28781 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28782
28783 @item -mfentry-section=@var{name}
28784 @opindex mfentry-section
28785 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28786
28787 @item -mskip-rax-setup
28788 @itemx -mno-skip-rax-setup
28789 @opindex mskip-rax-setup
28790 When generating code for the x86-64 architecture with SSE extensions
28791 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28792 register when there are no variable arguments passed in vector registers.
28793
28794 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28795 saving vector registers on stack when passing variable arguments, the
28796 impacts of this option are callees may waste some stack space,
28797 misbehave or jump to a random location. GCC 4.4 or newer don't have
28798 those issues, regardless the RAX register value.
28799
28800 @item -m8bit-idiv
28801 @itemx -mno-8bit-idiv
28802 @opindex m8bit-idiv
28803 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28804 much faster than 32-bit/64-bit integer divide. This option generates a
28805 run-time check. If both dividend and divisor are within range of 0
28806 to 255, 8-bit unsigned integer divide is used instead of
28807 32-bit/64-bit integer divide.
28808
28809 @item -mavx256-split-unaligned-load
28810 @itemx -mavx256-split-unaligned-store
28811 @opindex mavx256-split-unaligned-load
28812 @opindex mavx256-split-unaligned-store
28813 Split 32-byte AVX unaligned load and store.
28814
28815 @item -mstack-protector-guard=@var{guard}
28816 @itemx -mstack-protector-guard-reg=@var{reg}
28817 @itemx -mstack-protector-guard-offset=@var{offset}
28818 @opindex mstack-protector-guard
28819 @opindex mstack-protector-guard-reg
28820 @opindex mstack-protector-guard-offset
28821 Generate stack protection code using canary at @var{guard}. Supported
28822 locations are @samp{global} for global canary or @samp{tls} for per-thread
28823 canary in the TLS block (the default). This option has effect only when
28824 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28825
28826 With the latter choice the options
28827 @option{-mstack-protector-guard-reg=@var{reg}} and
28828 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28829 which segment register (@code{%fs} or @code{%gs}) to use as base register
28830 for reading the canary, and from what offset from that base register.
28831 The default for those is as specified in the relevant ABI.
28832
28833 @item -mgeneral-regs-only
28834 @opindex mgeneral-regs-only
28835 Generate code that uses only the general-purpose registers. This
28836 prevents the compiler from using floating-point, vector, mask and bound
28837 registers.
28838
28839 @item -mindirect-branch=@var{choice}
28840 @opindex mindirect-branch
28841 Convert indirect call and jump with @var{choice}. The default is
28842 @samp{keep}, which keeps indirect call and jump unmodified.
28843 @samp{thunk} converts indirect call and jump to call and return thunk.
28844 @samp{thunk-inline} converts indirect call and jump to inlined call
28845 and return thunk. @samp{thunk-extern} converts indirect call and jump
28846 to external call and return thunk provided in a separate object file.
28847 You can control this behavior for a specific function by using the
28848 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28849
28850 Note that @option{-mcmodel=large} is incompatible with
28851 @option{-mindirect-branch=thunk} and
28852 @option{-mindirect-branch=thunk-extern} since the thunk function may
28853 not be reachable in the large code model.
28854
28855 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28856 @option{-fcf-protection=branch} since the external thunk cannot be modified
28857 to disable control-flow check.
28858
28859 @item -mfunction-return=@var{choice}
28860 @opindex mfunction-return
28861 Convert function return with @var{choice}. The default is @samp{keep},
28862 which keeps function return unmodified. @samp{thunk} converts function
28863 return to call and return thunk. @samp{thunk-inline} converts function
28864 return to inlined call and return thunk. @samp{thunk-extern} converts
28865 function return to external call and return thunk provided in a separate
28866 object file. You can control this behavior for a specific function by
28867 using the function attribute @code{function_return}.
28868 @xref{Function Attributes}.
28869
28870 Note that @option{-mcmodel=large} is incompatible with
28871 @option{-mfunction-return=thunk} and
28872 @option{-mfunction-return=thunk-extern} since the thunk function may
28873 not be reachable in the large code model.
28874
28875
28876 @item -mindirect-branch-register
28877 @opindex mindirect-branch-register
28878 Force indirect call and jump via register.
28879
28880 @end table
28881
28882 These @samp{-m} switches are supported in addition to the above
28883 on x86-64 processors in 64-bit environments.
28884
28885 @table @gcctabopt
28886 @item -m32
28887 @itemx -m64
28888 @itemx -mx32
28889 @itemx -m16
28890 @itemx -miamcu
28891 @opindex m32
28892 @opindex m64
28893 @opindex mx32
28894 @opindex m16
28895 @opindex miamcu
28896 Generate code for a 16-bit, 32-bit or 64-bit environment.
28897 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28898 to 32 bits, and
28899 generates code that runs on any i386 system.
28900
28901 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28902 types to 64 bits, and generates code for the x86-64 architecture.
28903 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28904 and @option{-mdynamic-no-pic} options.
28905
28906 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28907 to 32 bits, and
28908 generates code for the x86-64 architecture.
28909
28910 The @option{-m16} option is the same as @option{-m32}, except for that
28911 it outputs the @code{.code16gcc} assembly directive at the beginning of
28912 the assembly output so that the binary can run in 16-bit mode.
28913
28914 The @option{-miamcu} option generates code which conforms to Intel MCU
28915 psABI. It requires the @option{-m32} option to be turned on.
28916
28917 @item -mno-red-zone
28918 @opindex mno-red-zone
28919 @opindex mred-zone
28920 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28921 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28922 stack pointer that is not modified by signal or interrupt handlers
28923 and therefore can be used for temporary data without adjusting the stack
28924 pointer. The flag @option{-mno-red-zone} disables this red zone.
28925
28926 @item -mcmodel=small
28927 @opindex mcmodel=small
28928 Generate code for the small code model: the program and its symbols must
28929 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28930 Programs can be statically or dynamically linked. This is the default
28931 code model.
28932
28933 @item -mcmodel=kernel
28934 @opindex mcmodel=kernel
28935 Generate code for the kernel code model. The kernel runs in the
28936 negative 2 GB of the address space.
28937 This model has to be used for Linux kernel code.
28938
28939 @item -mcmodel=medium
28940 @opindex mcmodel=medium
28941 Generate code for the medium model: the program is linked in the lower 2
28942 GB of the address space. Small symbols are also placed there. Symbols
28943 with sizes larger than @option{-mlarge-data-threshold} are put into
28944 large data or BSS sections and can be located above 2GB. Programs can
28945 be statically or dynamically linked.
28946
28947 @item -mcmodel=large
28948 @opindex mcmodel=large
28949 Generate code for the large model. This model makes no assumptions
28950 about addresses and sizes of sections.
28951
28952 @item -maddress-mode=long
28953 @opindex maddress-mode=long
28954 Generate code for long address mode. This is only supported for 64-bit
28955 and x32 environments. It is the default address mode for 64-bit
28956 environments.
28957
28958 @item -maddress-mode=short
28959 @opindex maddress-mode=short
28960 Generate code for short address mode. This is only supported for 32-bit
28961 and x32 environments. It is the default address mode for 32-bit and
28962 x32 environments.
28963 @end table
28964
28965 @node x86 Windows Options
28966 @subsection x86 Windows Options
28967 @cindex x86 Windows Options
28968 @cindex Windows Options for x86
28969
28970 These additional options are available for Microsoft Windows targets:
28971
28972 @table @gcctabopt
28973 @item -mconsole
28974 @opindex mconsole
28975 This option
28976 specifies that a console application is to be generated, by
28977 instructing the linker to set the PE header subsystem type
28978 required for console applications.
28979 This option is available for Cygwin and MinGW targets and is
28980 enabled by default on those targets.
28981
28982 @item -mdll
28983 @opindex mdll
28984 This option is available for Cygwin and MinGW targets. It
28985 specifies that a DLL---a dynamic link library---is to be
28986 generated, enabling the selection of the required runtime
28987 startup object and entry point.
28988
28989 @item -mnop-fun-dllimport
28990 @opindex mnop-fun-dllimport
28991 This option is available for Cygwin and MinGW targets. It
28992 specifies that the @code{dllimport} attribute should be ignored.
28993
28994 @item -mthread
28995 @opindex mthread
28996 This option is available for MinGW targets. It specifies
28997 that MinGW-specific thread support is to be used.
28998
28999 @item -municode
29000 @opindex municode
29001 This option is available for MinGW-w64 targets. It causes
29002 the @code{UNICODE} preprocessor macro to be predefined, and
29003 chooses Unicode-capable runtime startup code.
29004
29005 @item -mwin32
29006 @opindex mwin32
29007 This option is available for Cygwin and MinGW targets. It
29008 specifies that the typical Microsoft Windows predefined macros are to
29009 be set in the pre-processor, but does not influence the choice
29010 of runtime library/startup code.
29011
29012 @item -mwindows
29013 @opindex mwindows
29014 This option is available for Cygwin and MinGW targets. It
29015 specifies that a GUI application is to be generated by
29016 instructing the linker to set the PE header subsystem type
29017 appropriately.
29018
29019 @item -fno-set-stack-executable
29020 @opindex fno-set-stack-executable
29021 @opindex fset-stack-executable
29022 This option is available for MinGW targets. It specifies that
29023 the executable flag for the stack used by nested functions isn't
29024 set. This is necessary for binaries running in kernel mode of
29025 Microsoft Windows, as there the User32 API, which is used to set executable
29026 privileges, isn't available.
29027
29028 @item -fwritable-relocated-rdata
29029 @opindex fno-writable-relocated-rdata
29030 @opindex fwritable-relocated-rdata
29031 This option is available for MinGW and Cygwin targets. It specifies
29032 that relocated-data in read-only section is put into the @code{.data}
29033 section. This is a necessary for older runtimes not supporting
29034 modification of @code{.rdata} sections for pseudo-relocation.
29035
29036 @item -mpe-aligned-commons
29037 @opindex mpe-aligned-commons
29038 This option is available for Cygwin and MinGW targets. It
29039 specifies that the GNU extension to the PE file format that
29040 permits the correct alignment of COMMON variables should be
29041 used when generating code. It is enabled by default if
29042 GCC detects that the target assembler found during configuration
29043 supports the feature.
29044 @end table
29045
29046 See also under @ref{x86 Options} for standard options.
29047
29048 @node Xstormy16 Options
29049 @subsection Xstormy16 Options
29050 @cindex Xstormy16 Options
29051
29052 These options are defined for Xstormy16:
29053
29054 @table @gcctabopt
29055 @item -msim
29056 @opindex msim
29057 Choose startup files and linker script suitable for the simulator.
29058 @end table
29059
29060 @node Xtensa Options
29061 @subsection Xtensa Options
29062 @cindex Xtensa Options
29063
29064 These options are supported for Xtensa targets:
29065
29066 @table @gcctabopt
29067 @item -mconst16
29068 @itemx -mno-const16
29069 @opindex mconst16
29070 @opindex mno-const16
29071 Enable or disable use of @code{CONST16} instructions for loading
29072 constant values. The @code{CONST16} instruction is currently not a
29073 standard option from Tensilica. When enabled, @code{CONST16}
29074 instructions are always used in place of the standard @code{L32R}
29075 instructions. The use of @code{CONST16} is enabled by default only if
29076 the @code{L32R} instruction is not available.
29077
29078 @item -mfused-madd
29079 @itemx -mno-fused-madd
29080 @opindex mfused-madd
29081 @opindex mno-fused-madd
29082 Enable or disable use of fused multiply/add and multiply/subtract
29083 instructions in the floating-point option. This has no effect if the
29084 floating-point option is not also enabled. Disabling fused multiply/add
29085 and multiply/subtract instructions forces the compiler to use separate
29086 instructions for the multiply and add/subtract operations. This may be
29087 desirable in some cases where strict IEEE 754-compliant results are
29088 required: the fused multiply add/subtract instructions do not round the
29089 intermediate result, thereby producing results with @emph{more} bits of
29090 precision than specified by the IEEE standard. Disabling fused multiply
29091 add/subtract instructions also ensures that the program output is not
29092 sensitive to the compiler's ability to combine multiply and add/subtract
29093 operations.
29094
29095 @item -mserialize-volatile
29096 @itemx -mno-serialize-volatile
29097 @opindex mserialize-volatile
29098 @opindex mno-serialize-volatile
29099 When this option is enabled, GCC inserts @code{MEMW} instructions before
29100 @code{volatile} memory references to guarantee sequential consistency.
29101 The default is @option{-mserialize-volatile}. Use
29102 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29103
29104 @item -mforce-no-pic
29105 @opindex mforce-no-pic
29106 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29107 position-independent code (PIC), this option disables PIC for compiling
29108 kernel code.
29109
29110 @item -mtext-section-literals
29111 @itemx -mno-text-section-literals
29112 @opindex mtext-section-literals
29113 @opindex mno-text-section-literals
29114 These options control the treatment of literal pools. The default is
29115 @option{-mno-text-section-literals}, which places literals in a separate
29116 section in the output file. This allows the literal pool to be placed
29117 in a data RAM/ROM, and it also allows the linker to combine literal
29118 pools from separate object files to remove redundant literals and
29119 improve code size. With @option{-mtext-section-literals}, the literals
29120 are interspersed in the text section in order to keep them as close as
29121 possible to their references. This may be necessary for large assembly
29122 files. Literals for each function are placed right before that function.
29123
29124 @item -mauto-litpools
29125 @itemx -mno-auto-litpools
29126 @opindex mauto-litpools
29127 @opindex mno-auto-litpools
29128 These options control the treatment of literal pools. The default is
29129 @option{-mno-auto-litpools}, which places literals in a separate
29130 section in the output file unless @option{-mtext-section-literals} is
29131 used. With @option{-mauto-litpools} the literals are interspersed in
29132 the text section by the assembler. Compiler does not produce explicit
29133 @code{.literal} directives and loads literals into registers with
29134 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29135 do relaxation and place literals as necessary. This option allows
29136 assembler to create several literal pools per function and assemble
29137 very big functions, which may not be possible with
29138 @option{-mtext-section-literals}.
29139
29140 @item -mtarget-align
29141 @itemx -mno-target-align
29142 @opindex mtarget-align
29143 @opindex mno-target-align
29144 When this option is enabled, GCC instructs the assembler to
29145 automatically align instructions to reduce branch penalties at the
29146 expense of some code density. The assembler attempts to widen density
29147 instructions to align branch targets and the instructions following call
29148 instructions. If there are not enough preceding safe density
29149 instructions to align a target, no widening is performed. The
29150 default is @option{-mtarget-align}. These options do not affect the
29151 treatment of auto-aligned instructions like @code{LOOP}, which the
29152 assembler always aligns, either by widening density instructions or
29153 by inserting NOP instructions.
29154
29155 @item -mlongcalls
29156 @itemx -mno-longcalls
29157 @opindex mlongcalls
29158 @opindex mno-longcalls
29159 When this option is enabled, GCC instructs the assembler to translate
29160 direct calls to indirect calls unless it can determine that the target
29161 of a direct call is in the range allowed by the call instruction. This
29162 translation typically occurs for calls to functions in other source
29163 files. Specifically, the assembler translates a direct @code{CALL}
29164 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29165 The default is @option{-mno-longcalls}. This option should be used in
29166 programs where the call target can potentially be out of range. This
29167 option is implemented in the assembler, not the compiler, so the
29168 assembly code generated by GCC still shows direct call
29169 instructions---look at the disassembled object code to see the actual
29170 instructions. Note that the assembler uses an indirect call for
29171 every cross-file call, not just those that really are out of range.
29172 @end table
29173
29174 @node zSeries Options
29175 @subsection zSeries Options
29176 @cindex zSeries options
29177
29178 These are listed under @xref{S/390 and zSeries Options}.
29179
29180
29181 @c man end
29182
29183 @node Spec Files
29184 @section Specifying Subprocesses and the Switches to Pass to Them
29185 @cindex Spec Files
29186
29187 @command{gcc} is a driver program. It performs its job by invoking a
29188 sequence of other programs to do the work of compiling, assembling and
29189 linking. GCC interprets its command-line parameters and uses these to
29190 deduce which programs it should invoke, and which command-line options
29191 it ought to place on their command lines. This behavior is controlled
29192 by @dfn{spec strings}. In most cases there is one spec string for each
29193 program that GCC can invoke, but a few programs have multiple spec
29194 strings to control their behavior. The spec strings built into GCC can
29195 be overridden by using the @option{-specs=} command-line switch to specify
29196 a spec file.
29197
29198 @dfn{Spec files} are plain-text files that are used to construct spec
29199 strings. They consist of a sequence of directives separated by blank
29200 lines. The type of directive is determined by the first non-whitespace
29201 character on the line, which can be one of the following:
29202
29203 @table @code
29204 @item %@var{command}
29205 Issues a @var{command} to the spec file processor. The commands that can
29206 appear here are:
29207
29208 @table @code
29209 @item %include <@var{file}>
29210 @cindex @code{%include}
29211 Search for @var{file} and insert its text at the current point in the
29212 specs file.
29213
29214 @item %include_noerr <@var{file}>
29215 @cindex @code{%include_noerr}
29216 Just like @samp{%include}, but do not generate an error message if the include
29217 file cannot be found.
29218
29219 @item %rename @var{old_name} @var{new_name}
29220 @cindex @code{%rename}
29221 Rename the spec string @var{old_name} to @var{new_name}.
29222
29223 @end table
29224
29225 @item *[@var{spec_name}]:
29226 This tells the compiler to create, override or delete the named spec
29227 string. All lines after this directive up to the next directive or
29228 blank line are considered to be the text for the spec string. If this
29229 results in an empty string then the spec is deleted. (Or, if the
29230 spec did not exist, then nothing happens.) Otherwise, if the spec
29231 does not currently exist a new spec is created. If the spec does
29232 exist then its contents are overridden by the text of this
29233 directive, unless the first character of that text is the @samp{+}
29234 character, in which case the text is appended to the spec.
29235
29236 @item [@var{suffix}]:
29237 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29238 and up to the next directive or blank line are considered to make up the
29239 spec string for the indicated suffix. When the compiler encounters an
29240 input file with the named suffix, it processes the spec string in
29241 order to work out how to compile that file. For example:
29242
29243 @smallexample
29244 .ZZ:
29245 z-compile -input %i
29246 @end smallexample
29247
29248 This says that any input file whose name ends in @samp{.ZZ} should be
29249 passed to the program @samp{z-compile}, which should be invoked with the
29250 command-line switch @option{-input} and with the result of performing the
29251 @samp{%i} substitution. (See below.)
29252
29253 As an alternative to providing a spec string, the text following a
29254 suffix directive can be one of the following:
29255
29256 @table @code
29257 @item @@@var{language}
29258 This says that the suffix is an alias for a known @var{language}. This is
29259 similar to using the @option{-x} command-line switch to GCC to specify a
29260 language explicitly. For example:
29261
29262 @smallexample
29263 .ZZ:
29264 @@c++
29265 @end smallexample
29266
29267 Says that .ZZ files are, in fact, C++ source files.
29268
29269 @item #@var{name}
29270 This causes an error messages saying:
29271
29272 @smallexample
29273 @var{name} compiler not installed on this system.
29274 @end smallexample
29275 @end table
29276
29277 GCC already has an extensive list of suffixes built into it.
29278 This directive adds an entry to the end of the list of suffixes, but
29279 since the list is searched from the end backwards, it is effectively
29280 possible to override earlier entries using this technique.
29281
29282 @end table
29283
29284 GCC has the following spec strings built into it. Spec files can
29285 override these strings or create their own. Note that individual
29286 targets can also add their own spec strings to this list.
29287
29288 @smallexample
29289 asm Options to pass to the assembler
29290 asm_final Options to pass to the assembler post-processor
29291 cpp Options to pass to the C preprocessor
29292 cc1 Options to pass to the C compiler
29293 cc1plus Options to pass to the C++ compiler
29294 endfile Object files to include at the end of the link
29295 link Options to pass to the linker
29296 lib Libraries to include on the command line to the linker
29297 libgcc Decides which GCC support library to pass to the linker
29298 linker Sets the name of the linker
29299 predefines Defines to be passed to the C preprocessor
29300 signed_char Defines to pass to CPP to say whether @code{char} is signed
29301 by default
29302 startfile Object files to include at the start of the link
29303 @end smallexample
29304
29305 Here is a small example of a spec file:
29306
29307 @smallexample
29308 %rename lib old_lib
29309
29310 *lib:
29311 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29312 @end smallexample
29313
29314 This example renames the spec called @samp{lib} to @samp{old_lib} and
29315 then overrides the previous definition of @samp{lib} with a new one.
29316 The new definition adds in some extra command-line options before
29317 including the text of the old definition.
29318
29319 @dfn{Spec strings} are a list of command-line options to be passed to their
29320 corresponding program. In addition, the spec strings can contain
29321 @samp{%}-prefixed sequences to substitute variable text or to
29322 conditionally insert text into the command line. Using these constructs
29323 it is possible to generate quite complex command lines.
29324
29325 Here is a table of all defined @samp{%}-sequences for spec
29326 strings. Note that spaces are not generated automatically around the
29327 results of expanding these sequences. Therefore you can concatenate them
29328 together or combine them with constant text in a single argument.
29329
29330 @table @code
29331 @item %%
29332 Substitute one @samp{%} into the program name or argument.
29333
29334 @item %i
29335 Substitute the name of the input file being processed.
29336
29337 @item %b
29338 Substitute the basename of the input file being processed.
29339 This is the substring up to (and not including) the last period
29340 and not including the directory.
29341
29342 @item %B
29343 This is the same as @samp{%b}, but include the file suffix (text after
29344 the last period).
29345
29346 @item %d
29347 Marks the argument containing or following the @samp{%d} as a
29348 temporary file name, so that that file is deleted if GCC exits
29349 successfully. Unlike @samp{%g}, this contributes no text to the
29350 argument.
29351
29352 @item %g@var{suffix}
29353 Substitute a file name that has suffix @var{suffix} and is chosen
29354 once per compilation, and mark the argument in the same way as
29355 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29356 name is now chosen in a way that is hard to predict even when previously
29357 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29358 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29359 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29360 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29361 was simply substituted with a file name chosen once per compilation,
29362 without regard to any appended suffix (which was therefore treated
29363 just like ordinary text), making such attacks more likely to succeed.
29364
29365 @item %u@var{suffix}
29366 Like @samp{%g}, but generates a new temporary file name
29367 each time it appears instead of once per compilation.
29368
29369 @item %U@var{suffix}
29370 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29371 new one if there is no such last file name. In the absence of any
29372 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29373 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29374 involves the generation of two distinct file names, one
29375 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29376 simply substituted with a file name chosen for the previous @samp{%u},
29377 without regard to any appended suffix.
29378
29379 @item %j@var{suffix}
29380 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29381 writable, and if @option{-save-temps} is not used;
29382 otherwise, substitute the name
29383 of a temporary file, just like @samp{%u}. This temporary file is not
29384 meant for communication between processes, but rather as a junk
29385 disposal mechanism.
29386
29387 @item %|@var{suffix}
29388 @itemx %m@var{suffix}
29389 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29390 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29391 all. These are the two most common ways to instruct a program that it
29392 should read from standard input or write to standard output. If you
29393 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29394 construct: see for example @file{gcc/fortran/lang-specs.h}.
29395
29396 @item %.@var{SUFFIX}
29397 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29398 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29399 terminated by the next space or %.
29400
29401 @item %w
29402 Marks the argument containing or following the @samp{%w} as the
29403 designated output file of this compilation. This puts the argument
29404 into the sequence of arguments that @samp{%o} substitutes.
29405
29406 @item %o
29407 Substitutes the names of all the output files, with spaces
29408 automatically placed around them. You should write spaces
29409 around the @samp{%o} as well or the results are undefined.
29410 @samp{%o} is for use in the specs for running the linker.
29411 Input files whose names have no recognized suffix are not compiled
29412 at all, but they are included among the output files, so they are
29413 linked.
29414
29415 @item %O
29416 Substitutes the suffix for object files. Note that this is
29417 handled specially when it immediately follows @samp{%g, %u, or %U},
29418 because of the need for those to form complete file names. The
29419 handling is such that @samp{%O} is treated exactly as if it had already
29420 been substituted, except that @samp{%g, %u, and %U} do not currently
29421 support additional @var{suffix} characters following @samp{%O} as they do
29422 following, for example, @samp{.o}.
29423
29424 @item %p
29425 Substitutes the standard macro predefinitions for the
29426 current target machine. Use this when running @command{cpp}.
29427
29428 @item %P
29429 Like @samp{%p}, but puts @samp{__} before and after the name of each
29430 predefined macro, except for macros that start with @samp{__} or with
29431 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29432 C@.
29433
29434 @item %I
29435 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29436 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29437 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29438 and @option{-imultilib} as necessary.
29439
29440 @item %s
29441 Current argument is the name of a library or startup file of some sort.
29442 Search for that file in a standard list of directories and substitute
29443 the full name found. The current working directory is included in the
29444 list of directories scanned.
29445
29446 @item %T
29447 Current argument is the name of a linker script. Search for that file
29448 in the current list of directories to scan for libraries. If the file
29449 is located insert a @option{--script} option into the command line
29450 followed by the full path name found. If the file is not found then
29451 generate an error message. Note: the current working directory is not
29452 searched.
29453
29454 @item %e@var{str}
29455 Print @var{str} as an error message. @var{str} is terminated by a newline.
29456 Use this when inconsistent options are detected.
29457
29458 @item %(@var{name})
29459 Substitute the contents of spec string @var{name} at this point.
29460
29461 @item %x@{@var{option}@}
29462 Accumulate an option for @samp{%X}.
29463
29464 @item %X
29465 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29466 spec string.
29467
29468 @item %Y
29469 Output the accumulated assembler options specified by @option{-Wa}.
29470
29471 @item %Z
29472 Output the accumulated preprocessor options specified by @option{-Wp}.
29473
29474 @item %a
29475 Process the @code{asm} spec. This is used to compute the
29476 switches to be passed to the assembler.
29477
29478 @item %A
29479 Process the @code{asm_final} spec. This is a spec string for
29480 passing switches to an assembler post-processor, if such a program is
29481 needed.
29482
29483 @item %l
29484 Process the @code{link} spec. This is the spec for computing the
29485 command line passed to the linker. Typically it makes use of the
29486 @samp{%L %G %S %D and %E} sequences.
29487
29488 @item %D
29489 Dump out a @option{-L} option for each directory that GCC believes might
29490 contain startup files. If the target supports multilibs then the
29491 current multilib directory is prepended to each of these paths.
29492
29493 @item %L
29494 Process the @code{lib} spec. This is a spec string for deciding which
29495 libraries are included on the command line to the linker.
29496
29497 @item %G
29498 Process the @code{libgcc} spec. This is a spec string for deciding
29499 which GCC support library is included on the command line to the linker.
29500
29501 @item %S
29502 Process the @code{startfile} spec. This is a spec for deciding which
29503 object files are the first ones passed to the linker. Typically
29504 this might be a file named @file{crt0.o}.
29505
29506 @item %E
29507 Process the @code{endfile} spec. This is a spec string that specifies
29508 the last object files that are passed to the linker.
29509
29510 @item %C
29511 Process the @code{cpp} spec. This is used to construct the arguments
29512 to be passed to the C preprocessor.
29513
29514 @item %1
29515 Process the @code{cc1} spec. This is used to construct the options to be
29516 passed to the actual C compiler (@command{cc1}).
29517
29518 @item %2
29519 Process the @code{cc1plus} spec. This is used to construct the options to be
29520 passed to the actual C++ compiler (@command{cc1plus}).
29521
29522 @item %*
29523 Substitute the variable part of a matched option. See below.
29524 Note that each comma in the substituted string is replaced by
29525 a single space.
29526
29527 @item %<S
29528 Remove all occurrences of @code{-S} from the command line. Note---this
29529 command is position dependent. @samp{%} commands in the spec string
29530 before this one see @code{-S}, @samp{%} commands in the spec string
29531 after this one do not.
29532
29533 @item %:@var{function}(@var{args})
29534 Call the named function @var{function}, passing it @var{args}.
29535 @var{args} is first processed as a nested spec string, then split
29536 into an argument vector in the usual fashion. The function returns
29537 a string which is processed as if it had appeared literally as part
29538 of the current spec.
29539
29540 The following built-in spec functions are provided:
29541
29542 @table @code
29543 @item @code{getenv}
29544 The @code{getenv} spec function takes two arguments: an environment
29545 variable name and a string. If the environment variable is not
29546 defined, a fatal error is issued. Otherwise, the return value is the
29547 value of the environment variable concatenated with the string. For
29548 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29549
29550 @smallexample
29551 %:getenv(TOPDIR /include)
29552 @end smallexample
29553
29554 expands to @file{/path/to/top/include}.
29555
29556 @item @code{if-exists}
29557 The @code{if-exists} spec function takes one argument, an absolute
29558 pathname to a file. If the file exists, @code{if-exists} returns the
29559 pathname. Here is a small example of its usage:
29560
29561 @smallexample
29562 *startfile:
29563 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29564 @end smallexample
29565
29566 @item @code{if-exists-else}
29567 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29568 spec function, except that it takes two arguments. The first argument is
29569 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29570 returns the pathname. If it does not exist, it returns the second argument.
29571 This way, @code{if-exists-else} can be used to select one file or another,
29572 based on the existence of the first. Here is a small example of its usage:
29573
29574 @smallexample
29575 *startfile:
29576 crt0%O%s %:if-exists(crti%O%s) \
29577 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29578 @end smallexample
29579
29580 @item @code{replace-outfile}
29581 The @code{replace-outfile} spec function takes two arguments. It looks for the
29582 first argument in the outfiles array and replaces it with the second argument. Here
29583 is a small example of its usage:
29584
29585 @smallexample
29586 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29587 @end smallexample
29588
29589 @item @code{remove-outfile}
29590 The @code{remove-outfile} spec function takes one argument. It looks for the
29591 first argument in the outfiles array and removes it. Here is a small example
29592 its usage:
29593
29594 @smallexample
29595 %:remove-outfile(-lm)
29596 @end smallexample
29597
29598 @item @code{pass-through-libs}
29599 The @code{pass-through-libs} spec function takes any number of arguments. It
29600 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29601 assumes are the names of linker input library archive files) and returns a
29602 result containing all the found arguments each prepended by
29603 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29604 intended to be passed to the LTO linker plugin.
29605
29606 @smallexample
29607 %:pass-through-libs(%G %L %G)
29608 @end smallexample
29609
29610 @item @code{print-asm-header}
29611 The @code{print-asm-header} function takes no arguments and simply
29612 prints a banner like:
29613
29614 @smallexample
29615 Assembler options
29616 =================
29617
29618 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29619 @end smallexample
29620
29621 It is used to separate compiler options from assembler options
29622 in the @option{--target-help} output.
29623 @end table
29624
29625 @item %@{S@}
29626 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29627 If that switch is not specified, this substitutes nothing. Note that
29628 the leading dash is omitted when specifying this option, and it is
29629 automatically inserted if the substitution is performed. Thus the spec
29630 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29631 and outputs the command-line option @option{-foo}.
29632
29633 @item %W@{S@}
29634 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29635 deleted on failure.
29636
29637 @item %@{S*@}
29638 Substitutes all the switches specified to GCC whose names start
29639 with @code{-S}, but which also take an argument. This is used for
29640 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29641 GCC considers @option{-o foo} as being
29642 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29643 text, including the space. Thus two arguments are generated.
29644
29645 @item %@{S*&T*@}
29646 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29647 (the order of @code{S} and @code{T} in the spec is not significant).
29648 There can be any number of ampersand-separated variables; for each the
29649 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29650
29651 @item %@{S:X@}
29652 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29653
29654 @item %@{!S:X@}
29655 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29656
29657 @item %@{S*:X@}
29658 Substitutes @code{X} if one or more switches whose names start with
29659 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29660 once, no matter how many such switches appeared. However, if @code{%*}
29661 appears somewhere in @code{X}, then @code{X} is substituted once
29662 for each matching switch, with the @code{%*} replaced by the part of
29663 that switch matching the @code{*}.
29664
29665 If @code{%*} appears as the last part of a spec sequence then a space
29666 is added after the end of the last substitution. If there is more
29667 text in the sequence, however, then a space is not generated. This
29668 allows the @code{%*} substitution to be used as part of a larger
29669 string. For example, a spec string like this:
29670
29671 @smallexample
29672 %@{mcu=*:--script=%*/memory.ld@}
29673 @end smallexample
29674
29675 @noindent
29676 when matching an option like @option{-mcu=newchip} produces:
29677
29678 @smallexample
29679 --script=newchip/memory.ld
29680 @end smallexample
29681
29682 @item %@{.S:X@}
29683 Substitutes @code{X}, if processing a file with suffix @code{S}.
29684
29685 @item %@{!.S:X@}
29686 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29687
29688 @item %@{,S:X@}
29689 Substitutes @code{X}, if processing a file for language @code{S}.
29690
29691 @item %@{!,S:X@}
29692 Substitutes @code{X}, if not processing a file for language @code{S}.
29693
29694 @item %@{S|P:X@}
29695 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29696 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29697 @code{*} sequences as well, although they have a stronger binding than
29698 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29699 alternatives must be starred, and only the first matching alternative
29700 is substituted.
29701
29702 For example, a spec string like this:
29703
29704 @smallexample
29705 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29706 @end smallexample
29707
29708 @noindent
29709 outputs the following command-line options from the following input
29710 command-line options:
29711
29712 @smallexample
29713 fred.c -foo -baz
29714 jim.d -bar -boggle
29715 -d fred.c -foo -baz -boggle
29716 -d jim.d -bar -baz -boggle
29717 @end smallexample
29718
29719 @item %@{S:X; T:Y; :D@}
29720
29721 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29722 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29723 be as many clauses as you need. This may be combined with @code{.},
29724 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29725
29726
29727 @end table
29728
29729 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29730 or similar construct can use a backslash to ignore the special meaning
29731 of the character following it, thus allowing literal matching of a
29732 character that is otherwise specially treated. For example,
29733 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29734 @option{-std=iso9899:1999} option is given.
29735
29736 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29737 construct may contain other nested @samp{%} constructs or spaces, or
29738 even newlines. They are processed as usual, as described above.
29739 Trailing white space in @code{X} is ignored. White space may also
29740 appear anywhere on the left side of the colon in these constructs,
29741 except between @code{.} or @code{*} and the corresponding word.
29742
29743 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29744 handled specifically in these constructs. If another value of
29745 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29746 @option{-W} switch is found later in the command line, the earlier
29747 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29748 just one letter, which passes all matching options.
29749
29750 The character @samp{|} at the beginning of the predicate text is used to
29751 indicate that a command should be piped to the following command, but
29752 only if @option{-pipe} is specified.
29753
29754 It is built into GCC which switches take arguments and which do not.
29755 (You might think it would be useful to generalize this to allow each
29756 compiler's spec to say which switches take arguments. But this cannot
29757 be done in a consistent fashion. GCC cannot even decide which input
29758 files have been specified without knowing which switches take arguments,
29759 and it must know which input files to compile in order to tell which
29760 compilers to run).
29761
29762 GCC also knows implicitly that arguments starting in @option{-l} are to be
29763 treated as compiler output files, and passed to the linker in their
29764 proper position among the other output files.
29765
29766 @node Environment Variables
29767 @section Environment Variables Affecting GCC
29768 @cindex environment variables
29769
29770 @c man begin ENVIRONMENT
29771 This section describes several environment variables that affect how GCC
29772 operates. Some of them work by specifying directories or prefixes to use
29773 when searching for various kinds of files. Some are used to specify other
29774 aspects of the compilation environment.
29775
29776 Note that you can also specify places to search using options such as
29777 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29778 take precedence over places specified using environment variables, which
29779 in turn take precedence over those specified by the configuration of GCC@.
29780 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29781 GNU Compiler Collection (GCC) Internals}.
29782
29783 @table @env
29784 @item LANG
29785 @itemx LC_CTYPE
29786 @c @itemx LC_COLLATE
29787 @itemx LC_MESSAGES
29788 @c @itemx LC_MONETARY
29789 @c @itemx LC_NUMERIC
29790 @c @itemx LC_TIME
29791 @itemx LC_ALL
29792 @findex LANG
29793 @findex LC_CTYPE
29794 @c @findex LC_COLLATE
29795 @findex LC_MESSAGES
29796 @c @findex LC_MONETARY
29797 @c @findex LC_NUMERIC
29798 @c @findex LC_TIME
29799 @findex LC_ALL
29800 @cindex locale
29801 These environment variables control the way that GCC uses
29802 localization information which allows GCC to work with different
29803 national conventions. GCC inspects the locale categories
29804 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29805 so. These locale categories can be set to any value supported by your
29806 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29807 Kingdom encoded in UTF-8.
29808
29809 The @env{LC_CTYPE} environment variable specifies character
29810 classification. GCC uses it to determine the character boundaries in
29811 a string; this is needed for some multibyte encodings that contain quote
29812 and escape characters that are otherwise interpreted as a string
29813 end or escape.
29814
29815 The @env{LC_MESSAGES} environment variable specifies the language to
29816 use in diagnostic messages.
29817
29818 If the @env{LC_ALL} environment variable is set, it overrides the value
29819 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29820 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29821 environment variable. If none of these variables are set, GCC
29822 defaults to traditional C English behavior.
29823
29824 @item TMPDIR
29825 @findex TMPDIR
29826 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29827 files. GCC uses temporary files to hold the output of one stage of
29828 compilation which is to be used as input to the next stage: for example,
29829 the output of the preprocessor, which is the input to the compiler
29830 proper.
29831
29832 @item GCC_COMPARE_DEBUG
29833 @findex GCC_COMPARE_DEBUG
29834 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29835 @option{-fcompare-debug} to the compiler driver. See the documentation
29836 of this option for more details.
29837
29838 @item GCC_EXEC_PREFIX
29839 @findex GCC_EXEC_PREFIX
29840 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29841 names of the subprograms executed by the compiler. No slash is added
29842 when this prefix is combined with the name of a subprogram, but you can
29843 specify a prefix that ends with a slash if you wish.
29844
29845 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29846 an appropriate prefix to use based on the pathname it is invoked with.
29847
29848 If GCC cannot find the subprogram using the specified prefix, it
29849 tries looking in the usual places for the subprogram.
29850
29851 The default value of @env{GCC_EXEC_PREFIX} is
29852 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29853 the installed compiler. In many cases @var{prefix} is the value
29854 of @code{prefix} when you ran the @file{configure} script.
29855
29856 Other prefixes specified with @option{-B} take precedence over this prefix.
29857
29858 This prefix is also used for finding files such as @file{crt0.o} that are
29859 used for linking.
29860
29861 In addition, the prefix is used in an unusual way in finding the
29862 directories to search for header files. For each of the standard
29863 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29864 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29865 replacing that beginning with the specified prefix to produce an
29866 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29867 @file{foo/bar} just before it searches the standard directory
29868 @file{/usr/local/lib/bar}.
29869 If a standard directory begins with the configured
29870 @var{prefix} then the value of @var{prefix} is replaced by
29871 @env{GCC_EXEC_PREFIX} when looking for header files.
29872
29873 @item COMPILER_PATH
29874 @findex COMPILER_PATH
29875 The value of @env{COMPILER_PATH} is a colon-separated list of
29876 directories, much like @env{PATH}. GCC tries the directories thus
29877 specified when searching for subprograms, if it cannot find the
29878 subprograms using @env{GCC_EXEC_PREFIX}.
29879
29880 @item LIBRARY_PATH
29881 @findex LIBRARY_PATH
29882 The value of @env{LIBRARY_PATH} is a colon-separated list of
29883 directories, much like @env{PATH}. When configured as a native compiler,
29884 GCC tries the directories thus specified when searching for special
29885 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29886 using GCC also uses these directories when searching for ordinary
29887 libraries for the @option{-l} option (but directories specified with
29888 @option{-L} come first).
29889
29890 @item LANG
29891 @findex LANG
29892 @cindex locale definition
29893 This variable is used to pass locale information to the compiler. One way in
29894 which this information is used is to determine the character set to be used
29895 when character literals, string literals and comments are parsed in C and C++.
29896 When the compiler is configured to allow multibyte characters,
29897 the following values for @env{LANG} are recognized:
29898
29899 @table @samp
29900 @item C-JIS
29901 Recognize JIS characters.
29902 @item C-SJIS
29903 Recognize SJIS characters.
29904 @item C-EUCJP
29905 Recognize EUCJP characters.
29906 @end table
29907
29908 If @env{LANG} is not defined, or if it has some other value, then the
29909 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29910 recognize and translate multibyte characters.
29911 @end table
29912
29913 @noindent
29914 Some additional environment variables affect the behavior of the
29915 preprocessor.
29916
29917 @include cppenv.texi
29918
29919 @c man end
29920
29921 @node Precompiled Headers
29922 @section Using Precompiled Headers
29923 @cindex precompiled headers
29924 @cindex speed of compilation
29925
29926 Often large projects have many header files that are included in every
29927 source file. The time the compiler takes to process these header files
29928 over and over again can account for nearly all of the time required to
29929 build the project. To make builds faster, GCC allows you to
29930 @dfn{precompile} a header file.
29931
29932 To create a precompiled header file, simply compile it as you would any
29933 other file, if necessary using the @option{-x} option to make the driver
29934 treat it as a C or C++ header file. You may want to use a
29935 tool like @command{make} to keep the precompiled header up-to-date when
29936 the headers it contains change.
29937
29938 A precompiled header file is searched for when @code{#include} is
29939 seen in the compilation. As it searches for the included file
29940 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29941 compiler looks for a precompiled header in each directory just before it
29942 looks for the include file in that directory. The name searched for is
29943 the name specified in the @code{#include} with @samp{.gch} appended. If
29944 the precompiled header file cannot be used, it is ignored.
29945
29946 For instance, if you have @code{#include "all.h"}, and you have
29947 @file{all.h.gch} in the same directory as @file{all.h}, then the
29948 precompiled header file is used if possible, and the original
29949 header is used otherwise.
29950
29951 Alternatively, you might decide to put the precompiled header file in a
29952 directory and use @option{-I} to ensure that directory is searched
29953 before (or instead of) the directory containing the original header.
29954 Then, if you want to check that the precompiled header file is always
29955 used, you can put a file of the same name as the original header in this
29956 directory containing an @code{#error} command.
29957
29958 This also works with @option{-include}. So yet another way to use
29959 precompiled headers, good for projects not designed with precompiled
29960 header files in mind, is to simply take most of the header files used by
29961 a project, include them from another header file, precompile that header
29962 file, and @option{-include} the precompiled header. If the header files
29963 have guards against multiple inclusion, they are skipped because
29964 they've already been included (in the precompiled header).
29965
29966 If you need to precompile the same header file for different
29967 languages, targets, or compiler options, you can instead make a
29968 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29969 header in the directory, perhaps using @option{-o}. It doesn't matter
29970 what you call the files in the directory; every precompiled header in
29971 the directory is considered. The first precompiled header
29972 encountered in the directory that is valid for this compilation is
29973 used; they're searched in no particular order.
29974
29975 There are many other possibilities, limited only by your imagination,
29976 good sense, and the constraints of your build system.
29977
29978 A precompiled header file can be used only when these conditions apply:
29979
29980 @itemize
29981 @item
29982 Only one precompiled header can be used in a particular compilation.
29983
29984 @item
29985 A precompiled header cannot be used once the first C token is seen. You
29986 can have preprocessor directives before a precompiled header; you cannot
29987 include a precompiled header from inside another header.
29988
29989 @item
29990 The precompiled header file must be produced for the same language as
29991 the current compilation. You cannot use a C precompiled header for a C++
29992 compilation.
29993
29994 @item
29995 The precompiled header file must have been produced by the same compiler
29996 binary as the current compilation is using.
29997
29998 @item
29999 Any macros defined before the precompiled header is included must
30000 either be defined in the same way as when the precompiled header was
30001 generated, or must not affect the precompiled header, which usually
30002 means that they don't appear in the precompiled header at all.
30003
30004 The @option{-D} option is one way to define a macro before a
30005 precompiled header is included; using a @code{#define} can also do it.
30006 There are also some options that define macros implicitly, like
30007 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30008 defined this way.
30009
30010 @item If debugging information is output when using the precompiled
30011 header, using @option{-g} or similar, the same kind of debugging information
30012 must have been output when building the precompiled header. However,
30013 a precompiled header built using @option{-g} can be used in a compilation
30014 when no debugging information is being output.
30015
30016 @item The same @option{-m} options must generally be used when building
30017 and using the precompiled header. @xref{Submodel Options},
30018 for any cases where this rule is relaxed.
30019
30020 @item Each of the following options must be the same when building and using
30021 the precompiled header:
30022
30023 @gccoptlist{-fexceptions}
30024
30025 @item
30026 Some other command-line options starting with @option{-f},
30027 @option{-p}, or @option{-O} must be defined in the same way as when
30028 the precompiled header was generated. At present, it's not clear
30029 which options are safe to change and which are not; the safest choice
30030 is to use exactly the same options when generating and using the
30031 precompiled header. The following are known to be safe:
30032
30033 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30034 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30035 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30036 -pedantic-errors}
30037
30038 @end itemize
30039
30040 For all of these except the last, the compiler automatically
30041 ignores the precompiled header if the conditions aren't met. If you
30042 find an option combination that doesn't work and doesn't cause the
30043 precompiled header to be ignored, please consider filing a bug report,
30044 see @ref{Bugs}.
30045
30046 If you do use differing options when generating and using the
30047 precompiled header, the actual behavior is a mixture of the
30048 behavior for the options. For instance, if you use @option{-g} to
30049 generate the precompiled header but not when using it, you may or may
30050 not get debugging information for routines in the precompiled header.