]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
RISC-V: Add -malign-data= option.
[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 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1038 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1039
1040 @emph{PDP-11 Options}
1041 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1042 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1043 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1044
1045 @emph{picoChip Options}
1046 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1047 -msymbol-as-address -mno-inefficient-warnings}
1048
1049 @emph{PowerPC Options}
1050 See RS/6000 and PowerPC Options.
1051
1052 @emph{PRU Options}
1053 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1054 -mabi=@var{variant} @gol}
1055
1056 @emph{RISC-V Options}
1057 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1058 -mplt -mno-plt @gol
1059 -mabi=@var{ABI-string} @gol
1060 -mfdiv -mno-fdiv @gol
1061 -mdiv -mno-div @gol
1062 -march=@var{ISA-string} @gol
1063 -mtune=@var{processor-string} @gol
1064 -mpreferred-stack-boundary=@var{num} @gol
1065 -msmall-data-limit=@var{N-bytes} @gol
1066 -msave-restore -mno-save-restore @gol
1067 -mstrict-align -mno-strict-align @gol
1068 -mcmodel=medlow -mcmodel=medany @gol
1069 -mexplicit-relocs -mno-explicit-relocs @gol
1070 -mrelax -mno-relax @gol
1071 -mriscv-attribute -mmo-riscv-attribute @gol
1072 -malign-data=@var{type}}
1073
1074 @emph{RL78 Options}
1075 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1076 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1077 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1078
1079 @emph{RS/6000 and PowerPC Options}
1080 @gccoptlist{-mcpu=@var{cpu-type} @gol
1081 -mtune=@var{cpu-type} @gol
1082 -mcmodel=@var{code-model} @gol
1083 -mpowerpc64 @gol
1084 -maltivec -mno-altivec @gol
1085 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1086 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1087 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1088 -mfprnd -mno-fprnd @gol
1089 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1090 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1091 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1092 -malign-power -malign-natural @gol
1093 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1094 -mupdate -mno-update @gol
1095 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1096 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1097 -mstrict-align -mno-strict-align -mrelocatable @gol
1098 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1099 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1100 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1101 -mprioritize-restricted-insns=@var{priority} @gol
1102 -msched-costly-dep=@var{dependence_type} @gol
1103 -minsert-sched-nops=@var{scheme} @gol
1104 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1105 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1106 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1107 -mtraceback=@var{traceback_type} @gol
1108 -maix-struct-return -msvr4-struct-return @gol
1109 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1110 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1111 -mblock-move-inline-limit=@var{num} @gol
1112 -mblock-compare-inline-limit=@var{num} @gol
1113 -mblock-compare-inline-loop-limit=@var{num} @gol
1114 -mstring-compare-inline-limit=@var{num} @gol
1115 -misel -mno-isel @gol
1116 -mvrsave -mno-vrsave @gol
1117 -mmulhw -mno-mulhw @gol
1118 -mdlmzb -mno-dlmzb @gol
1119 -mprototype -mno-prototype @gol
1120 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1121 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1122 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1123 -mno-recip-precision @gol
1124 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1125 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1126 -msave-toc-indirect -mno-save-toc-indirect @gol
1127 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1128 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1129 -mquad-memory -mno-quad-memory @gol
1130 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1131 -mcompat-align-parm -mno-compat-align-parm @gol
1132 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1133 -mgnu-attribute -mno-gnu-attribute @gol
1134 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1135 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1136
1137 @emph{RX Options}
1138 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1139 -mcpu=@gol
1140 -mbig-endian-data -mlittle-endian-data @gol
1141 -msmall-data @gol
1142 -msim -mno-sim@gol
1143 -mas100-syntax -mno-as100-syntax@gol
1144 -mrelax@gol
1145 -mmax-constant-size=@gol
1146 -mint-register=@gol
1147 -mpid@gol
1148 -mallow-string-insns -mno-allow-string-insns@gol
1149 -mjsr@gol
1150 -mno-warn-multiple-fast-interrupts@gol
1151 -msave-acc-in-interrupts}
1152
1153 @emph{S/390 and zSeries Options}
1154 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1155 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1156 -mlong-double-64 -mlong-double-128 @gol
1157 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1158 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1159 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1160 -mhtm -mvx -mzvector @gol
1161 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1162 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1163 -mhotpatch=@var{halfwords},@var{halfwords}}
1164
1165 @emph{Score Options}
1166 @gccoptlist{-meb -mel @gol
1167 -mnhwloop @gol
1168 -muls @gol
1169 -mmac @gol
1170 -mscore5 -mscore5u -mscore7 -mscore7d}
1171
1172 @emph{SH Options}
1173 @gccoptlist{-m1 -m2 -m2e @gol
1174 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1175 -m3 -m3e @gol
1176 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1177 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1178 -mb -ml -mdalign -mrelax @gol
1179 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1180 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1181 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1182 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1183 -maccumulate-outgoing-args @gol
1184 -matomic-model=@var{atomic-model} @gol
1185 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1186 -mcbranch-force-delay-slot @gol
1187 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1188 -mpretend-cmove -mtas}
1189
1190 @emph{Solaris 2 Options}
1191 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1192 -pthreads}
1193
1194 @emph{SPARC Options}
1195 @gccoptlist{-mcpu=@var{cpu-type} @gol
1196 -mtune=@var{cpu-type} @gol
1197 -mcmodel=@var{code-model} @gol
1198 -mmemory-model=@var{mem-model} @gol
1199 -m32 -m64 -mapp-regs -mno-app-regs @gol
1200 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1201 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1202 -mhard-quad-float -msoft-quad-float @gol
1203 -mstack-bias -mno-stack-bias @gol
1204 -mstd-struct-return -mno-std-struct-return @gol
1205 -munaligned-doubles -mno-unaligned-doubles @gol
1206 -muser-mode -mno-user-mode @gol
1207 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1208 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1209 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1210 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1211 -mpopc -mno-popc -msubxc -mno-subxc @gol
1212 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1213 -mlra -mno-lra}
1214
1215 @emph{SPU Options}
1216 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1217 -msafe-dma -munsafe-dma @gol
1218 -mbranch-hints @gol
1219 -msmall-mem -mlarge-mem -mstdmain @gol
1220 -mfixed-range=@var{register-range} @gol
1221 -mea32 -mea64 @gol
1222 -maddress-space-conversion -mno-address-space-conversion @gol
1223 -mcache-size=@var{cache-size} @gol
1224 -matomic-updates -mno-atomic-updates}
1225
1226 @emph{System V Options}
1227 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1228
1229 @emph{TILE-Gx Options}
1230 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1231 -mcmodel=@var{code-model}}
1232
1233 @emph{TILEPro Options}
1234 @gccoptlist{-mcpu=@var{cpu} -m32}
1235
1236 @emph{V850 Options}
1237 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1238 -mprolog-function -mno-prolog-function -mspace @gol
1239 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1240 -mapp-regs -mno-app-regs @gol
1241 -mdisable-callt -mno-disable-callt @gol
1242 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1243 -mv850e -mv850 -mv850e3v5 @gol
1244 -mloop @gol
1245 -mrelax @gol
1246 -mlong-jumps @gol
1247 -msoft-float @gol
1248 -mhard-float @gol
1249 -mgcc-abi @gol
1250 -mrh850-abi @gol
1251 -mbig-switch}
1252
1253 @emph{VAX Options}
1254 @gccoptlist{-mg -mgnu -munix}
1255
1256 @emph{Visium Options}
1257 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1258 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1259
1260 @emph{VMS Options}
1261 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1262 -mpointer-size=@var{size}}
1263
1264 @emph{VxWorks Options}
1265 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1266 -Xbind-lazy -Xbind-now}
1267
1268 @emph{x86 Options}
1269 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1270 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1271 -mfpmath=@var{unit} @gol
1272 -masm=@var{dialect} -mno-fancy-math-387 @gol
1273 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1274 -mno-wide-multiply -mrtd -malign-double @gol
1275 -mpreferred-stack-boundary=@var{num} @gol
1276 -mincoming-stack-boundary=@var{num} @gol
1277 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1278 -mrecip -mrecip=@var{opt} @gol
1279 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1280 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1281 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1282 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1283 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1284 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1285 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1286 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1287 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1288 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1289 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1290 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1291 -mrdseed -msgx -mavx512vp2intersect@gol
1292 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1293 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1294 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1295 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1296 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1297 -mregparm=@var{num} -msseregparm @gol
1298 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1299 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1300 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1301 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1302 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1303 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1304 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1305 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1306 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1307 -mstack-protector-guard-reg=@var{reg} @gol
1308 -mstack-protector-guard-offset=@var{offset} @gol
1309 -mstack-protector-guard-symbol=@var{symbol} @gol
1310 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1311 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1312 -mindirect-branch-register}
1313
1314 @emph{x86 Windows Options}
1315 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1316 -mnop-fun-dllimport -mthread @gol
1317 -municode -mwin32 -mwindows -fno-set-stack-executable}
1318
1319 @emph{Xstormy16 Options}
1320 @gccoptlist{-msim}
1321
1322 @emph{Xtensa Options}
1323 @gccoptlist{-mconst16 -mno-const16 @gol
1324 -mfused-madd -mno-fused-madd @gol
1325 -mforce-no-pic @gol
1326 -mserialize-volatile -mno-serialize-volatile @gol
1327 -mtext-section-literals -mno-text-section-literals @gol
1328 -mauto-litpools -mno-auto-litpools @gol
1329 -mtarget-align -mno-target-align @gol
1330 -mlongcalls -mno-longcalls}
1331
1332 @emph{zSeries Options}
1333 See S/390 and zSeries Options.
1334 @end table
1335
1336
1337 @node Overall Options
1338 @section Options Controlling the Kind of Output
1339
1340 Compilation can involve up to four stages: preprocessing, compilation
1341 proper, assembly and linking, always in that order. GCC is capable of
1342 preprocessing and compiling several files either into several
1343 assembler input files, or into one assembler input file; then each
1344 assembler input file produces an object file, and linking combines all
1345 the object files (those newly compiled, and those specified as input)
1346 into an executable file.
1347
1348 @cindex file name suffix
1349 For any given input file, the file name suffix determines what kind of
1350 compilation is done:
1351
1352 @table @gcctabopt
1353 @item @var{file}.c
1354 C source code that must be preprocessed.
1355
1356 @item @var{file}.i
1357 C source code that should not be preprocessed.
1358
1359 @item @var{file}.ii
1360 C++ source code that should not be preprocessed.
1361
1362 @item @var{file}.m
1363 Objective-C source code. Note that you must link with the @file{libobjc}
1364 library to make an Objective-C program work.
1365
1366 @item @var{file}.mi
1367 Objective-C source code that should not be preprocessed.
1368
1369 @item @var{file}.mm
1370 @itemx @var{file}.M
1371 Objective-C++ source code. Note that you must link with the @file{libobjc}
1372 library to make an Objective-C++ program work. Note that @samp{.M} refers
1373 to a literal capital M@.
1374
1375 @item @var{file}.mii
1376 Objective-C++ source code that should not be preprocessed.
1377
1378 @item @var{file}.h
1379 C, C++, Objective-C or Objective-C++ header file to be turned into a
1380 precompiled header (default), or C, C++ header file to be turned into an
1381 Ada spec (via the @option{-fdump-ada-spec} switch).
1382
1383 @item @var{file}.cc
1384 @itemx @var{file}.cp
1385 @itemx @var{file}.cxx
1386 @itemx @var{file}.cpp
1387 @itemx @var{file}.CPP
1388 @itemx @var{file}.c++
1389 @itemx @var{file}.C
1390 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1391 the last two letters must both be literally @samp{x}. Likewise,
1392 @samp{.C} refers to a literal capital C@.
1393
1394 @item @var{file}.mm
1395 @itemx @var{file}.M
1396 Objective-C++ source code that must be preprocessed.
1397
1398 @item @var{file}.mii
1399 Objective-C++ source code that should not be preprocessed.
1400
1401 @item @var{file}.hh
1402 @itemx @var{file}.H
1403 @itemx @var{file}.hp
1404 @itemx @var{file}.hxx
1405 @itemx @var{file}.hpp
1406 @itemx @var{file}.HPP
1407 @itemx @var{file}.h++
1408 @itemx @var{file}.tcc
1409 C++ header file to be turned into a precompiled header or Ada spec.
1410
1411 @item @var{file}.f
1412 @itemx @var{file}.for
1413 @itemx @var{file}.ftn
1414 Fixed form Fortran source code that should not be preprocessed.
1415
1416 @item @var{file}.F
1417 @itemx @var{file}.FOR
1418 @itemx @var{file}.fpp
1419 @itemx @var{file}.FPP
1420 @itemx @var{file}.FTN
1421 Fixed form Fortran source code that must be preprocessed (with the traditional
1422 preprocessor).
1423
1424 @item @var{file}.f90
1425 @itemx @var{file}.f95
1426 @itemx @var{file}.f03
1427 @itemx @var{file}.f08
1428 Free form Fortran source code that should not be preprocessed.
1429
1430 @item @var{file}.F90
1431 @itemx @var{file}.F95
1432 @itemx @var{file}.F03
1433 @itemx @var{file}.F08
1434 Free form Fortran source code that must be preprocessed (with the
1435 traditional preprocessor).
1436
1437 @item @var{file}.go
1438 Go source code.
1439
1440 @item @var{file}.brig
1441 BRIG files (binary representation of HSAIL).
1442
1443 @item @var{file}.d
1444 D source code.
1445
1446 @item @var{file}.di
1447 D interface file.
1448
1449 @item @var{file}.dd
1450 D documentation code (Ddoc).
1451
1452 @item @var{file}.ads
1453 Ada source code file that contains a library unit declaration (a
1454 declaration of a package, subprogram, or generic, or a generic
1455 instantiation), or a library unit renaming declaration (a package,
1456 generic, or subprogram renaming declaration). Such files are also
1457 called @dfn{specs}.
1458
1459 @item @var{file}.adb
1460 Ada source code file containing a library unit body (a subprogram or
1461 package body). Such files are also called @dfn{bodies}.
1462
1463 @c GCC also knows about some suffixes for languages not yet included:
1464 @c Ratfor:
1465 @c @var{file}.r
1466
1467 @item @var{file}.s
1468 Assembler code.
1469
1470 @item @var{file}.S
1471 @itemx @var{file}.sx
1472 Assembler code that must be preprocessed.
1473
1474 @item @var{other}
1475 An object file to be fed straight into linking.
1476 Any file name with no recognized suffix is treated this way.
1477 @end table
1478
1479 @opindex x
1480 You can specify the input language explicitly with the @option{-x} option:
1481
1482 @table @gcctabopt
1483 @item -x @var{language}
1484 Specify explicitly the @var{language} for the following input files
1485 (rather than letting the compiler choose a default based on the file
1486 name suffix). This option applies to all following input files until
1487 the next @option{-x} option. Possible values for @var{language} are:
1488 @smallexample
1489 c c-header cpp-output
1490 c++ c++-header c++-cpp-output
1491 objective-c objective-c-header objective-c-cpp-output
1492 objective-c++ objective-c++-header objective-c++-cpp-output
1493 assembler assembler-with-cpp
1494 ada
1495 d
1496 f77 f77-cpp-input f95 f95-cpp-input
1497 go
1498 brig
1499 @end smallexample
1500
1501 @item -x none
1502 Turn off any specification of a language, so that subsequent files are
1503 handled according to their file name suffixes (as they are if @option{-x}
1504 has not been used at all).
1505 @end table
1506
1507 If you only want some of the stages of compilation, you can use
1508 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1509 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1510 @command{gcc} is to stop. Note that some combinations (for example,
1511 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1512
1513 @table @gcctabopt
1514 @item -c
1515 @opindex c
1516 Compile or assemble the source files, but do not link. The linking
1517 stage simply is not done. The ultimate output is in the form of an
1518 object file for each source file.
1519
1520 By default, the object file name for a source file is made by replacing
1521 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1522
1523 Unrecognized input files, not requiring compilation or assembly, are
1524 ignored.
1525
1526 @item -S
1527 @opindex S
1528 Stop after the stage of compilation proper; do not assemble. The output
1529 is in the form of an assembler code file for each non-assembler input
1530 file specified.
1531
1532 By default, the assembler file name for a source file is made by
1533 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1534
1535 Input files that don't require compilation are ignored.
1536
1537 @item -E
1538 @opindex E
1539 Stop after the preprocessing stage; do not run the compiler proper. The
1540 output is in the form of preprocessed source code, which is sent to the
1541 standard output.
1542
1543 Input files that don't require preprocessing are ignored.
1544
1545 @cindex output file option
1546 @item -o @var{file}
1547 @opindex o
1548 Place output in file @var{file}. This applies to whatever
1549 sort of output is being produced, whether it be an executable file,
1550 an object file, an assembler file or preprocessed C code.
1551
1552 If @option{-o} is not specified, the default is to put an executable
1553 file in @file{a.out}, the object file for
1554 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1555 assembler file in @file{@var{source}.s}, a precompiled header file in
1556 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1557 standard output.
1558
1559 @item -v
1560 @opindex v
1561 Print (on standard error output) the commands executed to run the stages
1562 of compilation. Also print the version number of the compiler driver
1563 program and of the preprocessor and the compiler proper.
1564
1565 @item -###
1566 @opindex ###
1567 Like @option{-v} except the commands are not executed and arguments
1568 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1569 This is useful for shell scripts to capture the driver-generated command lines.
1570
1571 @item --help
1572 @opindex help
1573 Print (on the standard output) a description of the command-line options
1574 understood by @command{gcc}. If the @option{-v} option is also specified
1575 then @option{--help} is also passed on to the various processes
1576 invoked by @command{gcc}, so that they can display the command-line options
1577 they accept. If the @option{-Wextra} option has also been specified
1578 (prior to the @option{--help} option), then command-line options that
1579 have no documentation associated with them are also displayed.
1580
1581 @item --target-help
1582 @opindex target-help
1583 Print (on the standard output) a description of target-specific command-line
1584 options for each tool. For some targets extra target-specific
1585 information may also be printed.
1586
1587 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1588 Print (on the standard output) a description of the command-line
1589 options understood by the compiler that fit into all specified classes
1590 and qualifiers. These are the supported classes:
1591
1592 @table @asis
1593 @item @samp{optimizers}
1594 Display all of the optimization options supported by the
1595 compiler.
1596
1597 @item @samp{warnings}
1598 Display all of the options controlling warning messages
1599 produced by the compiler.
1600
1601 @item @samp{target}
1602 Display target-specific options. Unlike the
1603 @option{--target-help} option however, target-specific options of the
1604 linker and assembler are not displayed. This is because those
1605 tools do not currently support the extended @option{--help=} syntax.
1606
1607 @item @samp{params}
1608 Display the values recognized by the @option{--param}
1609 option.
1610
1611 @item @var{language}
1612 Display the options supported for @var{language}, where
1613 @var{language} is the name of one of the languages supported in this
1614 version of GCC@.
1615
1616 @item @samp{common}
1617 Display the options that are common to all languages.
1618 @end table
1619
1620 These are the supported qualifiers:
1621
1622 @table @asis
1623 @item @samp{undocumented}
1624 Display only those options that are undocumented.
1625
1626 @item @samp{joined}
1627 Display options taking an argument that appears after an equal
1628 sign in the same continuous piece of text, such as:
1629 @samp{--help=target}.
1630
1631 @item @samp{separate}
1632 Display options taking an argument that appears as a separate word
1633 following the original option, such as: @samp{-o output-file}.
1634 @end table
1635
1636 Thus for example to display all the undocumented target-specific
1637 switches supported by the compiler, use:
1638
1639 @smallexample
1640 --help=target,undocumented
1641 @end smallexample
1642
1643 The sense of a qualifier can be inverted by prefixing it with the
1644 @samp{^} character, so for example to display all binary warning
1645 options (i.e., ones that are either on or off and that do not take an
1646 argument) that have a description, use:
1647
1648 @smallexample
1649 --help=warnings,^joined,^undocumented
1650 @end smallexample
1651
1652 The argument to @option{--help=} should not consist solely of inverted
1653 qualifiers.
1654
1655 Combining several classes is possible, although this usually
1656 restricts the output so much that there is nothing to display. One
1657 case where it does work, however, is when one of the classes is
1658 @var{target}. For example, to display all the target-specific
1659 optimization options, use:
1660
1661 @smallexample
1662 --help=target,optimizers
1663 @end smallexample
1664
1665 The @option{--help=} option can be repeated on the command line. Each
1666 successive use displays its requested class of options, skipping
1667 those that have already been displayed. If @option{--help} is also
1668 specified anywhere on the command line then this takes precedence
1669 over any @option{--help=} option.
1670
1671 If the @option{-Q} option appears on the command line before the
1672 @option{--help=} option, then the descriptive text displayed by
1673 @option{--help=} is changed. Instead of describing the displayed
1674 options, an indication is given as to whether the option is enabled,
1675 disabled or set to a specific value (assuming that the compiler
1676 knows this at the point where the @option{--help=} option is used).
1677
1678 Here is a truncated example from the ARM port of @command{gcc}:
1679
1680 @smallexample
1681 % gcc -Q -mabi=2 --help=target -c
1682 The following options are target specific:
1683 -mabi= 2
1684 -mabort-on-noreturn [disabled]
1685 -mapcs [disabled]
1686 @end smallexample
1687
1688 The output is sensitive to the effects of previous command-line
1689 options, so for example it is possible to find out which optimizations
1690 are enabled at @option{-O2} by using:
1691
1692 @smallexample
1693 -Q -O2 --help=optimizers
1694 @end smallexample
1695
1696 Alternatively you can discover which binary optimizations are enabled
1697 by @option{-O3} by using:
1698
1699 @smallexample
1700 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1701 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1702 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1703 @end smallexample
1704
1705 @item --version
1706 @opindex version
1707 Display the version number and copyrights of the invoked GCC@.
1708
1709 @item -pass-exit-codes
1710 @opindex pass-exit-codes
1711 Normally the @command{gcc} program exits with the code of 1 if any
1712 phase of the compiler returns a non-success return code. If you specify
1713 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1714 the numerically highest error produced by any phase returning an error
1715 indication. The C, C++, and Fortran front ends return 4 if an internal
1716 compiler error is encountered.
1717
1718 @item -pipe
1719 @opindex pipe
1720 Use pipes rather than temporary files for communication between the
1721 various stages of compilation. This fails to work on some systems where
1722 the assembler is unable to read from a pipe; but the GNU assembler has
1723 no trouble.
1724
1725 @item -specs=@var{file}
1726 @opindex specs
1727 Process @var{file} after the compiler reads in the standard @file{specs}
1728 file, in order to override the defaults which the @command{gcc} driver
1729 program uses when determining what switches to pass to @command{cc1},
1730 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1731 @option{-specs=@var{file}} can be specified on the command line, and they
1732 are processed in order, from left to right. @xref{Spec Files}, for
1733 information about the format of the @var{file}.
1734
1735 @item -wrapper
1736 @opindex wrapper
1737 Invoke all subcommands under a wrapper program. The name of the
1738 wrapper program and its parameters are passed as a comma separated
1739 list.
1740
1741 @smallexample
1742 gcc -c t.c -wrapper gdb,--args
1743 @end smallexample
1744
1745 @noindent
1746 This invokes all subprograms of @command{gcc} under
1747 @samp{gdb --args}, thus the invocation of @command{cc1} is
1748 @samp{gdb --args cc1 @dots{}}.
1749
1750 @item -ffile-prefix-map=@var{old}=@var{new}
1751 @opindex ffile-prefix-map
1752 When compiling files residing in directory @file{@var{old}}, record
1753 any references to them in the result of the compilation as if the
1754 files resided in directory @file{@var{new}} instead. Specifying this
1755 option is equivalent to specifying all the individual
1756 @option{-f*-prefix-map} options. This can be used to make reproducible
1757 builds that are location independent. See also
1758 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1759
1760 @item -fplugin=@var{name}.so
1761 @opindex fplugin
1762 Load the plugin code in file @var{name}.so, assumed to be a
1763 shared object to be dlopen'd by the compiler. The base name of
1764 the shared object file is used to identify the plugin for the
1765 purposes of argument parsing (See
1766 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1767 Each plugin should define the callback functions specified in the
1768 Plugins API.
1769
1770 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1771 @opindex fplugin-arg
1772 Define an argument called @var{key} with a value of @var{value}
1773 for the plugin called @var{name}.
1774
1775 @item -fdump-ada-spec@r{[}-slim@r{]}
1776 @opindex fdump-ada-spec
1777 For C and C++ source and include files, generate corresponding Ada specs.
1778 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1779 GNAT User's Guide}, which provides detailed documentation on this feature.
1780
1781 @item -fada-spec-parent=@var{unit}
1782 @opindex fada-spec-parent
1783 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1784 Ada specs as child units of parent @var{unit}.
1785
1786 @item -fdump-go-spec=@var{file}
1787 @opindex fdump-go-spec
1788 For input files in any language, generate corresponding Go
1789 declarations in @var{file}. This generates Go @code{const},
1790 @code{type}, @code{var}, and @code{func} declarations which may be a
1791 useful way to start writing a Go interface to code written in some
1792 other language.
1793
1794 @include @value{srcdir}/../libiberty/at-file.texi
1795 @end table
1796
1797 @node Invoking G++
1798 @section Compiling C++ Programs
1799
1800 @cindex suffixes for C++ source
1801 @cindex C++ source file suffixes
1802 C++ source files conventionally use one of the suffixes @samp{.C},
1803 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1804 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1805 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1806 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1807 files with these names and compiles them as C++ programs even if you
1808 call the compiler the same way as for compiling C programs (usually
1809 with the name @command{gcc}).
1810
1811 @findex g++
1812 @findex c++
1813 However, the use of @command{gcc} does not add the C++ library.
1814 @command{g++} is a program that calls GCC and automatically specifies linking
1815 against the C++ library. It treats @samp{.c},
1816 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1817 files unless @option{-x} is used. This program is also useful when
1818 precompiling a C header file with a @samp{.h} extension for use in C++
1819 compilations. On many systems, @command{g++} is also installed with
1820 the name @command{c++}.
1821
1822 @cindex invoking @command{g++}
1823 When you compile C++ programs, you may specify many of the same
1824 command-line options that you use for compiling programs in any
1825 language; or command-line options meaningful for C and related
1826 languages; or options that are meaningful only for C++ programs.
1827 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1828 explanations of options for languages related to C@.
1829 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1830 explanations of options that are meaningful only for C++ programs.
1831
1832 @node C Dialect Options
1833 @section Options Controlling C Dialect
1834 @cindex dialect options
1835 @cindex language dialect options
1836 @cindex options, dialect
1837
1838 The following options control the dialect of C (or languages derived
1839 from C, such as C++, Objective-C and Objective-C++) that the compiler
1840 accepts:
1841
1842 @table @gcctabopt
1843 @cindex ANSI support
1844 @cindex ISO support
1845 @item -ansi
1846 @opindex ansi
1847 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1848 equivalent to @option{-std=c++98}.
1849
1850 This turns off certain features of GCC that are incompatible with ISO
1851 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1852 such as the @code{asm} and @code{typeof} keywords, and
1853 predefined macros such as @code{unix} and @code{vax} that identify the
1854 type of system you are using. It also enables the undesirable and
1855 rarely used ISO trigraph feature. For the C compiler,
1856 it disables recognition of C++ style @samp{//} comments as well as
1857 the @code{inline} keyword.
1858
1859 The alternate keywords @code{__asm__}, @code{__extension__},
1860 @code{__inline__} and @code{__typeof__} continue to work despite
1861 @option{-ansi}. You would not want to use them in an ISO C program, of
1862 course, but it is useful to put them in header files that might be included
1863 in compilations done with @option{-ansi}. Alternate predefined macros
1864 such as @code{__unix__} and @code{__vax__} are also available, with or
1865 without @option{-ansi}.
1866
1867 The @option{-ansi} option does not cause non-ISO programs to be
1868 rejected gratuitously. For that, @option{-Wpedantic} is required in
1869 addition to @option{-ansi}. @xref{Warning Options}.
1870
1871 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1872 option is used. Some header files may notice this macro and refrain
1873 from declaring certain functions or defining certain macros that the
1874 ISO standard doesn't call for; this is to avoid interfering with any
1875 programs that might use these names for other things.
1876
1877 Functions that are normally built in but do not have semantics
1878 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1879 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1880 built-in functions provided by GCC}, for details of the functions
1881 affected.
1882
1883 @item -std=
1884 @opindex std
1885 Determine the language standard. @xref{Standards,,Language Standards
1886 Supported by GCC}, for details of these standard versions. This option
1887 is currently only supported when compiling C or C++.
1888
1889 The compiler can accept several base standards, such as @samp{c90} or
1890 @samp{c++98}, and GNU dialects of those standards, such as
1891 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1892 compiler accepts all programs following that standard plus those
1893 using GNU extensions that do not contradict it. For example,
1894 @option{-std=c90} turns off certain features of GCC that are
1895 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1896 keywords, but not other GNU extensions that do not have a meaning in
1897 ISO C90, such as omitting the middle term of a @code{?:}
1898 expression. On the other hand, when a GNU dialect of a standard is
1899 specified, all features supported by the compiler are enabled, even when
1900 those features change the meaning of the base standard. As a result, some
1901 strict-conforming programs may be rejected. The particular standard
1902 is used by @option{-Wpedantic} to identify which features are GNU
1903 extensions given that version of the standard. For example
1904 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1905 comments, while @option{-std=gnu99 -Wpedantic} does not.
1906
1907 A value for this option must be provided; possible values are
1908
1909 @table @samp
1910 @item c90
1911 @itemx c89
1912 @itemx iso9899:1990
1913 Support all ISO C90 programs (certain GNU extensions that conflict
1914 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1915
1916 @item iso9899:199409
1917 ISO C90 as modified in amendment 1.
1918
1919 @item c99
1920 @itemx c9x
1921 @itemx iso9899:1999
1922 @itemx iso9899:199x
1923 ISO C99. This standard is substantially completely supported, modulo
1924 bugs and floating-point issues
1925 (mainly but not entirely relating to optional C99 features from
1926 Annexes F and G). See
1927 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1928 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1929
1930 @item c11
1931 @itemx c1x
1932 @itemx iso9899:2011
1933 ISO C11, the 2011 revision of the ISO C standard. This standard is
1934 substantially completely supported, modulo bugs, floating-point issues
1935 (mainly but not entirely relating to optional C11 features from
1936 Annexes F and G) and the optional Annexes K (Bounds-checking
1937 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1938
1939 @item c17
1940 @itemx c18
1941 @itemx iso9899:2017
1942 @itemx iso9899:2018
1943 ISO C17, the 2017 revision of the ISO C standard
1944 (published in 2018). This standard is
1945 same as C11 except for corrections of defects (all of which are also
1946 applied with @option{-std=c11}) and a new value of
1947 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1948
1949 @item c2x
1950 The next version of the ISO C standard, still under development. The
1951 support for this version is experimental and incomplete.
1952
1953 @item gnu90
1954 @itemx gnu89
1955 GNU dialect of ISO C90 (including some C99 features).
1956
1957 @item gnu99
1958 @itemx gnu9x
1959 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1960
1961 @item gnu11
1962 @itemx gnu1x
1963 GNU dialect of ISO C11.
1964 The name @samp{gnu1x} is deprecated.
1965
1966 @item gnu17
1967 @itemx gnu18
1968 GNU dialect of ISO C17. This is the default for C code.
1969
1970 @item gnu2x
1971 The next version of the ISO C standard, still under development, plus
1972 GNU extensions. The support for this version is experimental and
1973 incomplete.
1974
1975 @item c++98
1976 @itemx c++03
1977 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1978 additional defect reports. Same as @option{-ansi} for C++ code.
1979
1980 @item gnu++98
1981 @itemx gnu++03
1982 GNU dialect of @option{-std=c++98}.
1983
1984 @item c++11
1985 @itemx c++0x
1986 The 2011 ISO C++ standard plus amendments.
1987 The name @samp{c++0x} is deprecated.
1988
1989 @item gnu++11
1990 @itemx gnu++0x
1991 GNU dialect of @option{-std=c++11}.
1992 The name @samp{gnu++0x} is deprecated.
1993
1994 @item c++14
1995 @itemx c++1y
1996 The 2014 ISO C++ standard plus amendments.
1997 The name @samp{c++1y} is deprecated.
1998
1999 @item gnu++14
2000 @itemx gnu++1y
2001 GNU dialect of @option{-std=c++14}.
2002 This is the default for C++ code.
2003 The name @samp{gnu++1y} is deprecated.
2004
2005 @item c++17
2006 @itemx c++1z
2007 The 2017 ISO C++ standard plus amendments.
2008 The name @samp{c++1z} is deprecated.
2009
2010 @item gnu++17
2011 @itemx gnu++1z
2012 GNU dialect of @option{-std=c++17}.
2013 The name @samp{gnu++1z} is deprecated.
2014
2015 @item c++2a
2016 The next revision of the ISO C++ standard, tentatively planned for
2017 2020. Support is highly experimental, and will almost certainly
2018 change in incompatible ways in future releases.
2019
2020 @item gnu++2a
2021 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2022 and will almost certainly change in incompatible ways in future
2023 releases.
2024 @end table
2025
2026 @item -fgnu89-inline
2027 @opindex fgnu89-inline
2028 The option @option{-fgnu89-inline} tells GCC to use the traditional
2029 GNU semantics for @code{inline} functions when in C99 mode.
2030 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2031 Using this option is roughly equivalent to adding the
2032 @code{gnu_inline} function attribute to all inline functions
2033 (@pxref{Function Attributes}).
2034
2035 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2036 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2037 specifies the default behavior).
2038 This option is not supported in @option{-std=c90} or
2039 @option{-std=gnu90} mode.
2040
2041 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2042 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2043 in effect for @code{inline} functions. @xref{Common Predefined
2044 Macros,,,cpp,The C Preprocessor}.
2045
2046 @item -fpermitted-flt-eval-methods=@var{style}
2047 @opindex fpermitted-flt-eval-methods
2048 @opindex fpermitted-flt-eval-methods=c11
2049 @opindex fpermitted-flt-eval-methods=ts-18661-3
2050 ISO/IEC TS 18661-3 defines new permissible values for
2051 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2052 a semantic type that is an interchange or extended format should be
2053 evaluated to the precision and range of that type. These new values are
2054 a superset of those permitted under C99/C11, which does not specify the
2055 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2056 conforming to C11 may not have been written expecting the possibility of
2057 the new values.
2058
2059 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2060 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2061 or the extended set of values specified in ISO/IEC TS 18661-3.
2062
2063 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2064
2065 The default when in a standards compliant mode (@option{-std=c11} or similar)
2066 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2067 dialect (@option{-std=gnu11} or similar) is
2068 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2069
2070 @item -aux-info @var{filename}
2071 @opindex aux-info
2072 Output to the given filename prototyped declarations for all functions
2073 declared and/or defined in a translation unit, including those in header
2074 files. This option is silently ignored in any language other than C@.
2075
2076 Besides declarations, the file indicates, in comments, the origin of
2077 each declaration (source file and line), whether the declaration was
2078 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2079 @samp{O} for old, respectively, in the first character after the line
2080 number and the colon), and whether it came from a declaration or a
2081 definition (@samp{C} or @samp{F}, respectively, in the following
2082 character). In the case of function definitions, a K&R-style list of
2083 arguments followed by their declarations is also provided, inside
2084 comments, after the declaration.
2085
2086 @item -fallow-parameterless-variadic-functions
2087 @opindex fallow-parameterless-variadic-functions
2088 Accept variadic functions without named parameters.
2089
2090 Although it is possible to define such a function, this is not very
2091 useful as it is not possible to read the arguments. This is only
2092 supported for C as this construct is allowed by C++.
2093
2094 @item -fno-asm
2095 @opindex fno-asm
2096 @opindex fasm
2097 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2098 keyword, so that code can use these words as identifiers. You can use
2099 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2100 instead. @option{-ansi} implies @option{-fno-asm}.
2101
2102 In C++, this switch only affects the @code{typeof} keyword, since
2103 @code{asm} and @code{inline} are standard keywords. You may want to
2104 use the @option{-fno-gnu-keywords} flag instead, which has the same
2105 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2106 switch only affects the @code{asm} and @code{typeof} keywords, since
2107 @code{inline} is a standard keyword in ISO C99.
2108
2109 @item -fno-builtin
2110 @itemx -fno-builtin-@var{function}
2111 @opindex fno-builtin
2112 @opindex fbuiltin
2113 @cindex built-in functions
2114 Don't recognize built-in functions that do not begin with
2115 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2116 functions provided by GCC}, for details of the functions affected,
2117 including those which are not built-in functions when @option{-ansi} or
2118 @option{-std} options for strict ISO C conformance are used because they
2119 do not have an ISO standard meaning.
2120
2121 GCC normally generates special code to handle certain built-in functions
2122 more efficiently; for instance, calls to @code{alloca} may become single
2123 instructions which adjust the stack directly, and calls to @code{memcpy}
2124 may become inline copy loops. The resulting code is often both smaller
2125 and faster, but since the function calls no longer appear as such, you
2126 cannot set a breakpoint on those calls, nor can you change the behavior
2127 of the functions by linking with a different library. In addition,
2128 when a function is recognized as a built-in function, GCC may use
2129 information about that function to warn about problems with calls to
2130 that function, or to generate more efficient code, even if the
2131 resulting code still contains calls to that function. For example,
2132 warnings are given with @option{-Wformat} for bad calls to
2133 @code{printf} when @code{printf} is built in and @code{strlen} is
2134 known not to modify global memory.
2135
2136 With the @option{-fno-builtin-@var{function}} option
2137 only the built-in function @var{function} is
2138 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2139 function is named that is not built-in in this version of GCC, this
2140 option is ignored. There is no corresponding
2141 @option{-fbuiltin-@var{function}} option; if you wish to enable
2142 built-in functions selectively when using @option{-fno-builtin} or
2143 @option{-ffreestanding}, you may define macros such as:
2144
2145 @smallexample
2146 #define abs(n) __builtin_abs ((n))
2147 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2148 @end smallexample
2149
2150 @item -fgimple
2151 @opindex fgimple
2152
2153 Enable parsing of function definitions marked with @code{__GIMPLE}.
2154 This is an experimental feature that allows unit testing of GIMPLE
2155 passes.
2156
2157 @item -fhosted
2158 @opindex fhosted
2159 @cindex hosted environment
2160
2161 Assert that compilation targets a hosted environment. This implies
2162 @option{-fbuiltin}. A hosted environment is one in which the
2163 entire standard library is available, and in which @code{main} has a return
2164 type of @code{int}. Examples are nearly everything except a kernel.
2165 This is equivalent to @option{-fno-freestanding}.
2166
2167 @item -ffreestanding
2168 @opindex ffreestanding
2169 @cindex hosted environment
2170
2171 Assert that compilation targets a freestanding environment. This
2172 implies @option{-fno-builtin}. A freestanding environment
2173 is one in which the standard library may not exist, and program startup may
2174 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2175 This is equivalent to @option{-fno-hosted}.
2176
2177 @xref{Standards,,Language Standards Supported by GCC}, for details of
2178 freestanding and hosted environments.
2179
2180 @item -fopenacc
2181 @opindex fopenacc
2182 @cindex OpenACC accelerator programming
2183 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2184 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2185 compiler generates accelerated code according to the OpenACC Application
2186 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2187 implies @option{-pthread}, and thus is only supported on targets that
2188 have support for @option{-pthread}.
2189
2190 @item -fopenacc-dim=@var{geom}
2191 @opindex fopenacc-dim
2192 @cindex OpenACC accelerator programming
2193 Specify default compute dimensions for parallel offload regions that do
2194 not explicitly specify. The @var{geom} value is a triple of
2195 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2196 can be omitted, to use a target-specific default value.
2197
2198 @item -fopenmp
2199 @opindex fopenmp
2200 @cindex OpenMP parallel
2201 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2202 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2203 compiler generates parallel code according to the OpenMP Application
2204 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2205 implies @option{-pthread}, and thus is only supported on targets that
2206 have support for @option{-pthread}. @option{-fopenmp} implies
2207 @option{-fopenmp-simd}.
2208
2209 @item -fopenmp-simd
2210 @opindex fopenmp-simd
2211 @cindex OpenMP SIMD
2212 @cindex SIMD
2213 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2214 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2215 are ignored.
2216
2217 @item -fgnu-tm
2218 @opindex fgnu-tm
2219 When the option @option{-fgnu-tm} is specified, the compiler
2220 generates code for the Linux variant of Intel's current Transactional
2221 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2222 an experimental feature whose interface may change in future versions
2223 of GCC, as the official specification changes. Please note that not
2224 all architectures are supported for this feature.
2225
2226 For more information on GCC's support for transactional memory,
2227 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2228 Transactional Memory Library}.
2229
2230 Note that the transactional memory feature is not supported with
2231 non-call exceptions (@option{-fnon-call-exceptions}).
2232
2233 @item -fms-extensions
2234 @opindex fms-extensions
2235 Accept some non-standard constructs used in Microsoft header files.
2236
2237 In C++ code, this allows member names in structures to be similar
2238 to previous types declarations.
2239
2240 @smallexample
2241 typedef int UOW;
2242 struct ABC @{
2243 UOW UOW;
2244 @};
2245 @end smallexample
2246
2247 Some cases of unnamed fields in structures and unions are only
2248 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2249 fields within structs/unions}, for details.
2250
2251 Note that this option is off for all targets except for x86
2252 targets using ms-abi.
2253
2254 @item -fplan9-extensions
2255 @opindex fplan9-extensions
2256 Accept some non-standard constructs used in Plan 9 code.
2257
2258 This enables @option{-fms-extensions}, permits passing pointers to
2259 structures with anonymous fields to functions that expect pointers to
2260 elements of the type of the field, and permits referring to anonymous
2261 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2262 struct/union fields within structs/unions}, for details. This is only
2263 supported for C, not C++.
2264
2265 @item -fcond-mismatch
2266 @opindex fcond-mismatch
2267 Allow conditional expressions with mismatched types in the second and
2268 third arguments. The value of such an expression is void. This option
2269 is not supported for C++.
2270
2271 @item -flax-vector-conversions
2272 @opindex flax-vector-conversions
2273 Allow implicit conversions between vectors with differing numbers of
2274 elements and/or incompatible element types. This option should not be
2275 used for new code.
2276
2277 @item -funsigned-char
2278 @opindex funsigned-char
2279 Let the type @code{char} be unsigned, like @code{unsigned char}.
2280
2281 Each kind of machine has a default for what @code{char} should
2282 be. It is either like @code{unsigned char} by default or like
2283 @code{signed char} by default.
2284
2285 Ideally, a portable program should always use @code{signed char} or
2286 @code{unsigned char} when it depends on the signedness of an object.
2287 But many programs have been written to use plain @code{char} and
2288 expect it to be signed, or expect it to be unsigned, depending on the
2289 machines they were written for. This option, and its inverse, let you
2290 make such a program work with the opposite default.
2291
2292 The type @code{char} is always a distinct type from each of
2293 @code{signed char} or @code{unsigned char}, even though its behavior
2294 is always just like one of those two.
2295
2296 @item -fsigned-char
2297 @opindex fsigned-char
2298 Let the type @code{char} be signed, like @code{signed char}.
2299
2300 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2301 the negative form of @option{-funsigned-char}. Likewise, the option
2302 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2303
2304 @item -fsigned-bitfields
2305 @itemx -funsigned-bitfields
2306 @itemx -fno-signed-bitfields
2307 @itemx -fno-unsigned-bitfields
2308 @opindex fsigned-bitfields
2309 @opindex funsigned-bitfields
2310 @opindex fno-signed-bitfields
2311 @opindex fno-unsigned-bitfields
2312 These options control whether a bit-field is signed or unsigned, when the
2313 declaration does not use either @code{signed} or @code{unsigned}. By
2314 default, such a bit-field is signed, because this is consistent: the
2315 basic integer types such as @code{int} are signed types.
2316
2317 @item -fsso-struct=@var{endianness}
2318 @opindex fsso-struct
2319 Set the default scalar storage order of structures and unions to the
2320 specified endianness. The accepted values are @samp{big-endian},
2321 @samp{little-endian} and @samp{native} for the native endianness of
2322 the target (the default). This option is not supported for C++.
2323
2324 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2325 code that is not binary compatible with code generated without it if the
2326 specified endianness is not the native endianness of the target.
2327 @end table
2328
2329 @node C++ Dialect Options
2330 @section Options Controlling C++ Dialect
2331
2332 @cindex compiler options, C++
2333 @cindex C++ options, command-line
2334 @cindex options, C++
2335 This section describes the command-line options that are only meaningful
2336 for C++ programs. You can also use most of the GNU compiler options
2337 regardless of what language your program is in. For example, you
2338 might compile a file @file{firstClass.C} like this:
2339
2340 @smallexample
2341 g++ -g -fstrict-enums -O -c firstClass.C
2342 @end smallexample
2343
2344 @noindent
2345 In this example, only @option{-fstrict-enums} is an option meant
2346 only for C++ programs; you can use the other options with any
2347 language supported by GCC@.
2348
2349 Some options for compiling C programs, such as @option{-std}, are also
2350 relevant for C++ programs.
2351 @xref{C Dialect Options,,Options Controlling C Dialect}.
2352
2353 Here is a list of options that are @emph{only} for compiling C++ programs:
2354
2355 @table @gcctabopt
2356
2357 @item -fabi-version=@var{n}
2358 @opindex fabi-version
2359 Use version @var{n} of the C++ ABI@. The default is version 0.
2360
2361 Version 0 refers to the version conforming most closely to
2362 the C++ ABI specification. Therefore, the ABI obtained using version 0
2363 will change in different versions of G++ as ABI bugs are fixed.
2364
2365 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2366
2367 Version 2 is the version of the C++ ABI that first appeared in G++
2368 3.4, and was the default through G++ 4.9.
2369
2370 Version 3 corrects an error in mangling a constant address as a
2371 template argument.
2372
2373 Version 4, which first appeared in G++ 4.5, implements a standard
2374 mangling for vector types.
2375
2376 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2377 attribute const/volatile on function pointer types, decltype of a
2378 plain decl, and use of a function parameter in the declaration of
2379 another parameter.
2380
2381 Version 6, which first appeared in G++ 4.7, corrects the promotion
2382 behavior of C++11 scoped enums and the mangling of template argument
2383 packs, const/static_cast, prefix ++ and --, and a class scope function
2384 used as a template argument.
2385
2386 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2387 builtin type and corrects the mangling of lambdas in default argument
2388 scope.
2389
2390 Version 8, which first appeared in G++ 4.9, corrects the substitution
2391 behavior of function types with function-cv-qualifiers.
2392
2393 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2394 @code{nullptr_t}.
2395
2396 Version 10, which first appeared in G++ 6.1, adds mangling of
2397 attributes that affect type identity, such as ia32 calling convention
2398 attributes (e.g.@: @samp{stdcall}).
2399
2400 Version 11, which first appeared in G++ 7, corrects the mangling of
2401 sizeof... expressions and operator names. For multiple entities with
2402 the same name within a function, that are declared in different scopes,
2403 the mangling now changes starting with the twelfth occurrence. It also
2404 implies @option{-fnew-inheriting-ctors}.
2405
2406 Version 12, which first appeared in G++ 8, corrects the calling
2407 conventions for empty classes on the x86_64 target and for classes
2408 with only deleted copy/move constructors. It accidentally changes the
2409 calling convention for classes with a deleted copy constructor and a
2410 trivial move constructor.
2411
2412 Version 13, which first appeared in G++ 8.2, fixes the accidental
2413 change in version 12.
2414
2415 See also @option{-Wabi}.
2416
2417 @item -fabi-compat-version=@var{n}
2418 @opindex fabi-compat-version
2419 On targets that support strong aliases, G++
2420 works around mangling changes by creating an alias with the correct
2421 mangled name when defining a symbol with an incorrect mangled name.
2422 This switch specifies which ABI version to use for the alias.
2423
2424 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2425 compatibility). If another ABI version is explicitly selected, this
2426 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2427 use @option{-fabi-compat-version=2}.
2428
2429 If this option is not provided but @option{-Wabi=@var{n}} is, that
2430 version is used for compatibility aliases. If this option is provided
2431 along with @option{-Wabi} (without the version), the version from this
2432 option is used for the warning.
2433
2434 @item -fno-access-control
2435 @opindex fno-access-control
2436 @opindex faccess-control
2437 Turn off all access checking. This switch is mainly useful for working
2438 around bugs in the access control code.
2439
2440 @item -faligned-new
2441 @opindex faligned-new
2442 Enable support for C++17 @code{new} of types that require more
2443 alignment than @code{void* ::operator new(std::size_t)} provides. A
2444 numeric argument such as @code{-faligned-new=32} can be used to
2445 specify how much alignment (in bytes) is provided by that function,
2446 but few users will need to override the default of
2447 @code{alignof(std::max_align_t)}.
2448
2449 This flag is enabled by default for @option{-std=c++17}.
2450
2451 @item -fchar8_t
2452 @itemx -fno-char8_t
2453 @opindex fchar8_t
2454 @opindex fno-char8_t
2455 Enable support for @code{char8_t} as adopted for C++2a. This includes
2456 the addition of a new @code{char8_t} fundamental type, changes to the
2457 types of UTF-8 string and character literals, new signatures for
2458 user-defined literals, associated standard library updates, and new
2459 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2460
2461 This option enables functions to be overloaded for ordinary and UTF-8
2462 strings:
2463
2464 @smallexample
2465 int f(const char *); // #1
2466 int f(const char8_t *); // #2
2467 int v1 = f("text"); // Calls #1
2468 int v2 = f(u8"text"); // Calls #2
2469 @end smallexample
2470
2471 @noindent
2472 and introduces new signatures for user-defined literals:
2473
2474 @smallexample
2475 int operator""_udl1(char8_t);
2476 int v3 = u8'x'_udl1;
2477 int operator""_udl2(const char8_t*, std::size_t);
2478 int v4 = u8"text"_udl2;
2479 template<typename T, T...> int operator""_udl3();
2480 int v5 = u8"text"_udl3;
2481 @end smallexample
2482
2483 @noindent
2484 The change to the types of UTF-8 string and character literals introduces
2485 incompatibilities with ISO C++11 and later standards. For example, the
2486 following code is well-formed under ISO C++11, but is ill-formed when
2487 @option{-fchar8_t} is specified.
2488
2489 @smallexample
2490 char ca[] = u8"xx"; // error: char-array initialized from wide
2491 // string
2492 const char *cp = u8"xx";// error: invalid conversion from
2493 // `const char8_t*' to `const char*'
2494 int f(const char*);
2495 auto v = f(u8"xx"); // error: invalid conversion from
2496 // `const char8_t*' to `const char*'
2497 std::string s@{u8"xx"@}; // error: no matching function for call to
2498 // `std::basic_string<char>::basic_string()'
2499 using namespace std::literals;
2500 s = u8"xx"s; // error: conversion from
2501 // `basic_string<char8_t>' to non-scalar
2502 // type `basic_string<char>' requested
2503 @end smallexample
2504
2505 @item -fcheck-new
2506 @opindex fcheck-new
2507 Check that the pointer returned by @code{operator new} is non-null
2508 before attempting to modify the storage allocated. This check is
2509 normally unnecessary because the C++ standard specifies that
2510 @code{operator new} only returns @code{0} if it is declared
2511 @code{throw()}, in which case the compiler always checks the
2512 return value even without this option. In all other cases, when
2513 @code{operator new} has a non-empty exception specification, memory
2514 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2515 @samp{new (nothrow)}.
2516
2517 @item -fconcepts
2518 @opindex fconcepts
2519 Enable support for the C++ Extensions for Concepts Technical
2520 Specification, ISO 19217 (2015), which allows code like
2521
2522 @smallexample
2523 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2524 template <Addable T> T add (T a, T b) @{ return a + b; @}
2525 @end smallexample
2526
2527 @item -fconstexpr-depth=@var{n}
2528 @opindex fconstexpr-depth
2529 Set the maximum nested evaluation depth for C++11 constexpr functions
2530 to @var{n}. A limit is needed to detect endless recursion during
2531 constant expression evaluation. The minimum specified by the standard
2532 is 512.
2533
2534 @item -fconstexpr-cache-depth=@var{n}
2535 @opindex fconstexpr-cache-depth
2536 Set the maximum level of nested evaluation depth for C++11 constexpr
2537 functions that will be cached to @var{n}. This is a heuristic that
2538 trades off compilation speed (when the cache avoids repeated
2539 calculations) against memory consumption (when the cache grows very
2540 large from highly recursive evaluations). The default is 8. Very few
2541 users are likely to want to adjust it, but if your code does heavy
2542 constexpr calculations you might want to experiment to find which
2543 value works best for you.
2544
2545 @item -fconstexpr-loop-limit=@var{n}
2546 @opindex fconstexpr-loop-limit
2547 Set the maximum number of iterations for a loop in C++14 constexpr functions
2548 to @var{n}. A limit is needed to detect infinite loops during
2549 constant expression evaluation. The default is 262144 (1<<18).
2550
2551 @item -fconstexpr-ops-limit=@var{n}
2552 @opindex fconstexpr-ops-limit
2553 Set the maximum number of operations during a single constexpr evaluation.
2554 Even when number of iterations of a single loop is limited with the above limit,
2555 if there are several nested loops and each of them has many iterations but still
2556 smaller than the above limit, or if in a body of some loop or even outside
2557 of a loop too many expressions need to be evaluated, the resulting constexpr
2558 evaluation might take too long.
2559 The default is 33554432 (1<<25).
2560
2561 @item -fdeduce-init-list
2562 @opindex fdeduce-init-list
2563 Enable deduction of a template type parameter as
2564 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2565
2566 @smallexample
2567 template <class T> auto forward(T t) -> decltype (realfn (t))
2568 @{
2569 return realfn (t);
2570 @}
2571
2572 void f()
2573 @{
2574 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2575 @}
2576 @end smallexample
2577
2578 This deduction was implemented as a possible extension to the
2579 originally proposed semantics for the C++11 standard, but was not part
2580 of the final standard, so it is disabled by default. This option is
2581 deprecated, and may be removed in a future version of G++.
2582
2583 @item -fno-elide-constructors
2584 @opindex fno-elide-constructors
2585 @opindex felide-constructors
2586 The C++ standard allows an implementation to omit creating a temporary
2587 that is only used to initialize another object of the same type.
2588 Specifying this option disables that optimization, and forces G++ to
2589 call the copy constructor in all cases. This option also causes G++
2590 to call trivial member functions which otherwise would be expanded inline.
2591
2592 In C++17, the compiler is required to omit these temporaries, but this
2593 option still affects trivial member functions.
2594
2595 @item -fno-enforce-eh-specs
2596 @opindex fno-enforce-eh-specs
2597 @opindex fenforce-eh-specs
2598 Don't generate code to check for violation of exception specifications
2599 at run time. This option violates the C++ standard, but may be useful
2600 for reducing code size in production builds, much like defining
2601 @code{NDEBUG}. This does not give user code permission to throw
2602 exceptions in violation of the exception specifications; the compiler
2603 still optimizes based on the specifications, so throwing an
2604 unexpected exception results in undefined behavior at run time.
2605
2606 @item -fextern-tls-init
2607 @itemx -fno-extern-tls-init
2608 @opindex fextern-tls-init
2609 @opindex fno-extern-tls-init
2610 The C++11 and OpenMP standards allow @code{thread_local} and
2611 @code{threadprivate} variables to have dynamic (runtime)
2612 initialization. To support this, any use of such a variable goes
2613 through a wrapper function that performs any necessary initialization.
2614 When the use and definition of the variable are in the same
2615 translation unit, this overhead can be optimized away, but when the
2616 use is in a different translation unit there is significant overhead
2617 even if the variable doesn't actually need dynamic initialization. If
2618 the programmer can be sure that no use of the variable in a
2619 non-defining TU needs to trigger dynamic initialization (either
2620 because the variable is statically initialized, or a use of the
2621 variable in the defining TU will be executed before any uses in
2622 another TU), they can avoid this overhead with the
2623 @option{-fno-extern-tls-init} option.
2624
2625 On targets that support symbol aliases, the default is
2626 @option{-fextern-tls-init}. On targets that do not support symbol
2627 aliases, the default is @option{-fno-extern-tls-init}.
2628
2629 @item -fno-gnu-keywords
2630 @opindex fno-gnu-keywords
2631 @opindex fgnu-keywords
2632 Do not recognize @code{typeof} as a keyword, so that code can use this
2633 word as an identifier. You can use the keyword @code{__typeof__} instead.
2634 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2635 @option{-std=c++98}, @option{-std=c++11}, etc.
2636
2637 @item -fno-implicit-templates
2638 @opindex fno-implicit-templates
2639 @opindex fimplicit-templates
2640 Never emit code for non-inline templates that are instantiated
2641 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2642 If you use this option, you must take care to structure your code to
2643 include all the necessary explicit instantiations to avoid getting
2644 undefined symbols at link time.
2645 @xref{Template Instantiation}, for more information.
2646
2647 @item -fno-implicit-inline-templates
2648 @opindex fno-implicit-inline-templates
2649 @opindex fimplicit-inline-templates
2650 Don't emit code for implicit instantiations of inline templates, either.
2651 The default is to handle inlines differently so that compiles with and
2652 without optimization need the same set of explicit instantiations.
2653
2654 @item -fno-implement-inlines
2655 @opindex fno-implement-inlines
2656 @opindex fimplement-inlines
2657 To save space, do not emit out-of-line copies of inline functions
2658 controlled by @code{#pragma implementation}. This causes linker
2659 errors if these functions are not inlined everywhere they are called.
2660
2661 @item -fms-extensions
2662 @opindex fms-extensions
2663 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2664 int and getting a pointer to member function via non-standard syntax.
2665
2666 @item -fnew-inheriting-ctors
2667 @opindex fnew-inheriting-ctors
2668 Enable the P0136 adjustment to the semantics of C++11 constructor
2669 inheritance. This is part of C++17 but also considered to be a Defect
2670 Report against C++11 and C++14. This flag is enabled by default
2671 unless @option{-fabi-version=10} or lower is specified.
2672
2673 @item -fnew-ttp-matching
2674 @opindex fnew-ttp-matching
2675 Enable the P0522 resolution to Core issue 150, template template
2676 parameters and default arguments: this allows a template with default
2677 template arguments as an argument for a template template parameter
2678 with fewer template parameters. This flag is enabled by default for
2679 @option{-std=c++17}.
2680
2681 @item -fno-nonansi-builtins
2682 @opindex fno-nonansi-builtins
2683 @opindex fnonansi-builtins
2684 Disable built-in declarations of functions that are not mandated by
2685 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2686 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2687
2688 @item -fnothrow-opt
2689 @opindex fnothrow-opt
2690 Treat a @code{throw()} exception specification as if it were a
2691 @code{noexcept} specification to reduce or eliminate the text size
2692 overhead relative to a function with no exception specification. If
2693 the function has local variables of types with non-trivial
2694 destructors, the exception specification actually makes the
2695 function smaller because the EH cleanups for those variables can be
2696 optimized away. The semantic effect is that an exception thrown out of
2697 a function with such an exception specification results in a call
2698 to @code{terminate} rather than @code{unexpected}.
2699
2700 @item -fno-operator-names
2701 @opindex fno-operator-names
2702 @opindex foperator-names
2703 Do not treat the operator name keywords @code{and}, @code{bitand},
2704 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2705 synonyms as keywords.
2706
2707 @item -fno-optional-diags
2708 @opindex fno-optional-diags
2709 @opindex foptional-diags
2710 Disable diagnostics that the standard says a compiler does not need to
2711 issue. Currently, the only such diagnostic issued by G++ is the one for
2712 a name having multiple meanings within a class.
2713
2714 @item -fpermissive
2715 @opindex fpermissive
2716 Downgrade some diagnostics about nonconformant code from errors to
2717 warnings. Thus, using @option{-fpermissive} allows some
2718 nonconforming code to compile.
2719
2720 @item -fno-pretty-templates
2721 @opindex fno-pretty-templates
2722 @opindex fpretty-templates
2723 When an error message refers to a specialization of a function
2724 template, the compiler normally prints the signature of the
2725 template followed by the template arguments and any typedefs or
2726 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2727 rather than @code{void f(int)}) so that it's clear which template is
2728 involved. When an error message refers to a specialization of a class
2729 template, the compiler omits any template arguments that match
2730 the default template arguments for that template. If either of these
2731 behaviors make it harder to understand the error message rather than
2732 easier, you can use @option{-fno-pretty-templates} to disable them.
2733
2734 @item -frepo
2735 @opindex frepo
2736 Enable automatic template instantiation at link time. This option also
2737 implies @option{-fno-implicit-templates}. @xref{Template
2738 Instantiation}, for more information.
2739
2740 @item -fno-rtti
2741 @opindex fno-rtti
2742 @opindex frtti
2743 Disable generation of information about every class with virtual
2744 functions for use by the C++ run-time type identification features
2745 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2746 of the language, you can save some space by using this flag. Note that
2747 exception handling uses the same information, but G++ generates it as
2748 needed. The @code{dynamic_cast} operator can still be used for casts that
2749 do not require run-time type information, i.e.@: casts to @code{void *} or to
2750 unambiguous base classes.
2751
2752 Mixing code compiled with @option{-frtti} with that compiled with
2753 @option{-fno-rtti} may not work. For example, programs may
2754 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2755 for a class compiled with @option{-frtti}.
2756
2757 @item -fsized-deallocation
2758 @opindex fsized-deallocation
2759 Enable the built-in global declarations
2760 @smallexample
2761 void operator delete (void *, std::size_t) noexcept;
2762 void operator delete[] (void *, std::size_t) noexcept;
2763 @end smallexample
2764 as introduced in C++14. This is useful for user-defined replacement
2765 deallocation functions that, for example, use the size of the object
2766 to make deallocation faster. Enabled by default under
2767 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2768 warns about places that might want to add a definition.
2769
2770 @item -fstrict-enums
2771 @opindex fstrict-enums
2772 Allow the compiler to optimize using the assumption that a value of
2773 enumerated type can only be one of the values of the enumeration (as
2774 defined in the C++ standard; basically, a value that can be
2775 represented in the minimum number of bits needed to represent all the
2776 enumerators). This assumption may not be valid if the program uses a
2777 cast to convert an arbitrary integer value to the enumerated type.
2778
2779 @item -fstrong-eval-order
2780 @opindex fstrong-eval-order
2781 Evaluate member access, array subscripting, and shift expressions in
2782 left-to-right order, and evaluate assignment in right-to-left order,
2783 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2784 @option{-fstrong-eval-order=some} enables just the ordering of member
2785 access and shift expressions, and is the default without
2786 @option{-std=c++17}.
2787
2788 @item -ftemplate-backtrace-limit=@var{n}
2789 @opindex ftemplate-backtrace-limit
2790 Set the maximum number of template instantiation notes for a single
2791 warning or error to @var{n}. The default value is 10.
2792
2793 @item -ftemplate-depth=@var{n}
2794 @opindex ftemplate-depth
2795 Set the maximum instantiation depth for template classes to @var{n}.
2796 A limit on the template instantiation depth is needed to detect
2797 endless recursions during template class instantiation. ANSI/ISO C++
2798 conforming programs must not rely on a maximum depth greater than 17
2799 (changed to 1024 in C++11). The default value is 900, as the compiler
2800 can run out of stack space before hitting 1024 in some situations.
2801
2802 @item -fno-threadsafe-statics
2803 @opindex fno-threadsafe-statics
2804 @opindex fthreadsafe-statics
2805 Do not emit the extra code to use the routines specified in the C++
2806 ABI for thread-safe initialization of local statics. You can use this
2807 option to reduce code size slightly in code that doesn't need to be
2808 thread-safe.
2809
2810 @item -fuse-cxa-atexit
2811 @opindex fuse-cxa-atexit
2812 Register destructors for objects with static storage duration with the
2813 @code{__cxa_atexit} function rather than the @code{atexit} function.
2814 This option is required for fully standards-compliant handling of static
2815 destructors, but only works if your C library supports
2816 @code{__cxa_atexit}.
2817
2818 @item -fno-use-cxa-get-exception-ptr
2819 @opindex fno-use-cxa-get-exception-ptr
2820 @opindex fuse-cxa-get-exception-ptr
2821 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2822 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2823 if the runtime routine is not available.
2824
2825 @item -fvisibility-inlines-hidden
2826 @opindex fvisibility-inlines-hidden
2827 This switch declares that the user does not attempt to compare
2828 pointers to inline functions or methods where the addresses of the two functions
2829 are taken in different shared objects.
2830
2831 The effect of this is that GCC may, effectively, mark inline methods with
2832 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2833 appear in the export table of a DSO and do not require a PLT indirection
2834 when used within the DSO@. Enabling this option can have a dramatic effect
2835 on load and link times of a DSO as it massively reduces the size of the
2836 dynamic export table when the library makes heavy use of templates.
2837
2838 The behavior of this switch is not quite the same as marking the
2839 methods as hidden directly, because it does not affect static variables
2840 local to the function or cause the compiler to deduce that
2841 the function is defined in only one shared object.
2842
2843 You may mark a method as having a visibility explicitly to negate the
2844 effect of the switch for that method. For example, if you do want to
2845 compare pointers to a particular inline method, you might mark it as
2846 having default visibility. Marking the enclosing class with explicit
2847 visibility has no effect.
2848
2849 Explicitly instantiated inline methods are unaffected by this option
2850 as their linkage might otherwise cross a shared library boundary.
2851 @xref{Template Instantiation}.
2852
2853 @item -fvisibility-ms-compat
2854 @opindex fvisibility-ms-compat
2855 This flag attempts to use visibility settings to make GCC's C++
2856 linkage model compatible with that of Microsoft Visual Studio.
2857
2858 The flag makes these changes to GCC's linkage model:
2859
2860 @enumerate
2861 @item
2862 It sets the default visibility to @code{hidden}, like
2863 @option{-fvisibility=hidden}.
2864
2865 @item
2866 Types, but not their members, are not hidden by default.
2867
2868 @item
2869 The One Definition Rule is relaxed for types without explicit
2870 visibility specifications that are defined in more than one
2871 shared object: those declarations are permitted if they are
2872 permitted when this option is not used.
2873 @end enumerate
2874
2875 In new code it is better to use @option{-fvisibility=hidden} and
2876 export those classes that are intended to be externally visible.
2877 Unfortunately it is possible for code to rely, perhaps accidentally,
2878 on the Visual Studio behavior.
2879
2880 Among the consequences of these changes are that static data members
2881 of the same type with the same name but defined in different shared
2882 objects are different, so changing one does not change the other;
2883 and that pointers to function members defined in different shared
2884 objects may not compare equal. When this flag is given, it is a
2885 violation of the ODR to define types with the same name differently.
2886
2887 @item -fno-weak
2888 @opindex fno-weak
2889 @opindex fweak
2890 Do not use weak symbol support, even if it is provided by the linker.
2891 By default, G++ uses weak symbols if they are available. This
2892 option exists only for testing, and should not be used by end-users;
2893 it results in inferior code and has no benefits. This option may
2894 be removed in a future release of G++.
2895
2896 @item -nostdinc++
2897 @opindex nostdinc++
2898 Do not search for header files in the standard directories specific to
2899 C++, but do still search the other standard directories. (This option
2900 is used when building the C++ library.)
2901 @end table
2902
2903 In addition, these optimization, warning, and code generation options
2904 have meanings only for C++ programs:
2905
2906 @table @gcctabopt
2907 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2908 @opindex Wabi
2909 @opindex Wno-abi
2910 Warn when G++ it generates code that is probably not compatible with
2911 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2912 ABI with each major release, normally @option{-Wabi} will warn only if
2913 there is a check added later in a release series for an ABI issue
2914 discovered since the initial release. @option{-Wabi} will warn about
2915 more things if an older ABI version is selected (with
2916 @option{-fabi-version=@var{n}}).
2917
2918 @option{-Wabi} can also be used with an explicit version number to
2919 warn about compatibility with a particular @option{-fabi-version}
2920 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2921 @option{-fabi-version=2}.
2922
2923 If an explicit version number is provided and
2924 @option{-fabi-compat-version} is not specified, the version number
2925 from this option is used for compatibility aliases. If no explicit
2926 version number is provided with this option, but
2927 @option{-fabi-compat-version} is specified, that version number is
2928 used for ABI warnings.
2929
2930 Although an effort has been made to warn about
2931 all such cases, there are probably some cases that are not warned about,
2932 even though G++ is generating incompatible code. There may also be
2933 cases where warnings are emitted even though the code that is generated
2934 is compatible.
2935
2936 You should rewrite your code to avoid these warnings if you are
2937 concerned about the fact that code generated by G++ may not be binary
2938 compatible with code generated by other compilers.
2939
2940 Known incompatibilities in @option{-fabi-version=2} (which was the
2941 default from GCC 3.4 to 4.9) include:
2942
2943 @itemize @bullet
2944
2945 @item
2946 A template with a non-type template parameter of reference type was
2947 mangled incorrectly:
2948 @smallexample
2949 extern int N;
2950 template <int &> struct S @{@};
2951 void n (S<N>) @{2@}
2952 @end smallexample
2953
2954 This was fixed in @option{-fabi-version=3}.
2955
2956 @item
2957 SIMD vector types declared using @code{__attribute ((vector_size))} were
2958 mangled in a non-standard way that does not allow for overloading of
2959 functions taking vectors of different sizes.
2960
2961 The mangling was changed in @option{-fabi-version=4}.
2962
2963 @item
2964 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2965 qualifiers, and @code{decltype} of a plain declaration was folded away.
2966
2967 These mangling issues were fixed in @option{-fabi-version=5}.
2968
2969 @item
2970 Scoped enumerators passed as arguments to a variadic function are
2971 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2972 On most targets this does not actually affect the parameter passing
2973 ABI, as there is no way to pass an argument smaller than @code{int}.
2974
2975 Also, the ABI changed the mangling of template argument packs,
2976 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2977 a class scope function used as a template argument.
2978
2979 These issues were corrected in @option{-fabi-version=6}.
2980
2981 @item
2982 Lambdas in default argument scope were mangled incorrectly, and the
2983 ABI changed the mangling of @code{nullptr_t}.
2984
2985 These issues were corrected in @option{-fabi-version=7}.
2986
2987 @item
2988 When mangling a function type with function-cv-qualifiers, the
2989 un-qualified function type was incorrectly treated as a substitution
2990 candidate.
2991
2992 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2993
2994 @item
2995 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2996 unaligned accesses. Note that this did not affect the ABI of a
2997 function with a @code{nullptr_t} parameter, as parameters have a
2998 minimum alignment.
2999
3000 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
3001
3002 @item
3003 Target-specific attributes that affect the identity of a type, such as
3004 ia32 calling conventions on a function type (stdcall, regparm, etc.),
3005 did not affect the mangled name, leading to name collisions when
3006 function pointers were used as template arguments.
3007
3008 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
3009
3010 @end itemize
3011
3012 It also warns about psABI-related changes. The known psABI changes at this
3013 point include:
3014
3015 @itemize @bullet
3016
3017 @item
3018 For SysV/x86-64, unions with @code{long double} members are
3019 passed in memory as specified in psABI. For example:
3020
3021 @smallexample
3022 union U @{
3023 long double ld;
3024 int i;
3025 @};
3026 @end smallexample
3027
3028 @noindent
3029 @code{union U} is always passed in memory.
3030
3031 @end itemize
3032
3033 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3034 @opindex Wabi-tag
3035 @opindex Wabi-tag
3036 Warn when a type with an ABI tag is used in a context that does not
3037 have that ABI tag. See @ref{C++ Attributes} for more information
3038 about ABI tags.
3039
3040 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3041 @opindex Wctor-dtor-privacy
3042 @opindex Wno-ctor-dtor-privacy
3043 Warn when a class seems unusable because all the constructors or
3044 destructors in that class are private, and it has neither friends nor
3045 public static member functions. Also warn if there are no non-private
3046 methods, and there's at least one private member function that isn't
3047 a constructor or destructor.
3048
3049 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3050 @opindex Wdelete-non-virtual-dtor
3051 @opindex Wno-delete-non-virtual-dtor
3052 Warn when @code{delete} is used to destroy an instance of a class that
3053 has virtual functions and non-virtual destructor. It is unsafe to delete
3054 an instance of a derived class through a pointer to a base class if the
3055 base class does not have a virtual destructor. This warning is enabled
3056 by @option{-Wall}.
3057
3058 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3059 @opindex Wdeprecated-copy
3060 @opindex Wno-deprecated-copy
3061 Warn that the implicit declaration of a copy constructor or copy
3062 assignment operator is deprecated if the class has a user-provided
3063 copy constructor or copy assignment operator, in C++11 and up. This
3064 warning is enabled by @option{-Wextra}. With
3065 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3066 user-provided destructor.
3067
3068 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3069 @opindex Winit-list-lifetime
3070 @opindex Wno-init-list-lifetime
3071 Do not warn about uses of @code{std::initializer_list} that are likely
3072 to result in dangling pointers. Since the underlying array for an
3073 @code{initializer_list} is handled like a normal C++ temporary object,
3074 it is easy to inadvertently keep a pointer to the array past the end
3075 of the array's lifetime. For example:
3076
3077 @itemize @bullet
3078 @item
3079 If a function returns a temporary @code{initializer_list}, or a local
3080 @code{initializer_list} variable, the array's lifetime ends at the end
3081 of the return statement, so the value returned has a dangling pointer.
3082
3083 @item
3084 If a new-expression creates an @code{initializer_list}, the array only
3085 lives until the end of the enclosing full-expression, so the
3086 @code{initializer_list} in the heap has a dangling pointer.
3087
3088 @item
3089 When an @code{initializer_list} variable is assigned from a
3090 brace-enclosed initializer list, the temporary array created for the
3091 right side of the assignment only lives until the end of the
3092 full-expression, so at the next statement the @code{initializer_list}
3093 variable has a dangling pointer.
3094
3095 @smallexample
3096 // li's initial underlying array lives as long as li
3097 std::initializer_list<int> li = @{ 1,2,3 @};
3098 // assignment changes li to point to a temporary array
3099 li = @{ 4, 5 @};
3100 // now the temporary is gone and li has a dangling pointer
3101 int i = li.begin()[0] // undefined behavior
3102 @end smallexample
3103
3104 @item
3105 When a list constructor stores the @code{begin} pointer from the
3106 @code{initializer_list} argument, this doesn't extend the lifetime of
3107 the array, so if a class variable is constructed from a temporary
3108 @code{initializer_list}, the pointer is left dangling by the end of
3109 the variable declaration statement.
3110
3111 @end itemize
3112
3113 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3114 @opindex Wliteral-suffix
3115 @opindex Wno-literal-suffix
3116 Warn when a string or character literal is followed by a ud-suffix which does
3117 not begin with an underscore. As a conforming extension, GCC treats such
3118 suffixes as separate preprocessing tokens in order to maintain backwards
3119 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3120 For example:
3121
3122 @smallexample
3123 #define __STDC_FORMAT_MACROS
3124 #include <inttypes.h>
3125 #include <stdio.h>
3126
3127 int main() @{
3128 int64_t i64 = 123;
3129 printf("My int64: %" PRId64"\n", i64);
3130 @}
3131 @end smallexample
3132
3133 In this case, @code{PRId64} is treated as a separate preprocessing token.
3134
3135 Additionally, warn when a user-defined literal operator is declared with
3136 a literal suffix identifier that doesn't begin with an underscore. Literal
3137 suffix identifiers that don't begin with an underscore are reserved for
3138 future standardization.
3139
3140 This warning is enabled by default.
3141
3142 @item -Wlto-type-mismatch
3143 @opindex Wlto-type-mismatch
3144 @opindex Wno-lto-type-mismatch
3145
3146 During the link-time optimization warn about type mismatches in
3147 global declarations from different compilation units.
3148 Requires @option{-flto} to be enabled. Enabled by default.
3149
3150 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3151 @opindex Wnarrowing
3152 @opindex Wno-narrowing
3153 For C++11 and later standards, narrowing conversions are diagnosed by default,
3154 as required by the standard. A narrowing conversion from a constant produces
3155 an error, and a narrowing conversion from a non-constant produces a warning,
3156 but @option{-Wno-narrowing} suppresses the diagnostic.
3157 Note that this does not affect the meaning of well-formed code;
3158 narrowing conversions are still considered ill-formed in SFINAE contexts.
3159
3160 With @option{-Wnarrowing} in C++98, warn when a narrowing
3161 conversion prohibited by C++11 occurs within
3162 @samp{@{ @}}, e.g.
3163
3164 @smallexample
3165 int i = @{ 2.2 @}; // error: narrowing from double to int
3166 @end smallexample
3167
3168 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3169
3170 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3171 @opindex Wnoexcept
3172 @opindex Wno-noexcept
3173 Warn when a noexcept-expression evaluates to false because of a call
3174 to a function that does not have a non-throwing exception
3175 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3176 the compiler to never throw an exception.
3177
3178 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3179 @opindex Wnoexcept-type
3180 @opindex Wno-noexcept-type
3181 Warn if the C++17 feature making @code{noexcept} part of a function
3182 type changes the mangled name of a symbol relative to C++14. Enabled
3183 by @option{-Wabi} and @option{-Wc++17-compat}.
3184
3185 As an example:
3186
3187 @smallexample
3188 template <class T> void f(T t) @{ t(); @};
3189 void g() noexcept;
3190 void h() @{ f(g); @}
3191 @end smallexample
3192
3193 @noindent
3194 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3195 C++17 it calls @code{f<void(*)()noexcept>}.
3196
3197 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3198 @opindex Wclass-memaccess
3199 @opindex Wno-class-memaccess
3200 Warn when the destination of a call to a raw memory function such as
3201 @code{memset} or @code{memcpy} is an object of class type, and when writing
3202 into such an object might bypass the class non-trivial or deleted constructor
3203 or copy assignment, violate const-correctness or encapsulation, or corrupt
3204 virtual table pointers. Modifying the representation of such objects may
3205 violate invariants maintained by member functions of the class. For example,
3206 the call to @code{memset} below is undefined because it modifies a non-trivial
3207 class object and is, therefore, diagnosed. The safe way to either initialize
3208 or clear the storage of objects of such types is by using the appropriate
3209 constructor or assignment operator, if one is available.
3210 @smallexample
3211 std::string str = "abc";
3212 memset (&str, 0, sizeof str);
3213 @end smallexample
3214 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3215 Explicitly casting the pointer to the class object to @code{void *} or
3216 to a type that can be safely accessed by the raw memory function suppresses
3217 the warning.
3218
3219 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3220 @opindex Wnon-virtual-dtor
3221 @opindex Wno-non-virtual-dtor
3222 Warn when a class has virtual functions and an accessible non-virtual
3223 destructor itself or in an accessible polymorphic base class, in which
3224 case it is possible but unsafe to delete an instance of a derived
3225 class through a pointer to the class itself or base class. This
3226 warning is automatically enabled if @option{-Weffc++} is specified.
3227
3228 @item -Wregister @r{(C++ and Objective-C++ only)}
3229 @opindex Wregister
3230 @opindex Wno-register
3231 Warn on uses of the @code{register} storage class specifier, except
3232 when it is part of the GNU @ref{Explicit Register Variables} extension.
3233 The use of the @code{register} keyword as storage class specifier has
3234 been deprecated in C++11 and removed in C++17.
3235 Enabled by default with @option{-std=c++17}.
3236
3237 @item -Wreorder @r{(C++ and Objective-C++ only)}
3238 @opindex Wreorder
3239 @opindex Wno-reorder
3240 @cindex reordering, warning
3241 @cindex warning for reordering of member initializers
3242 Warn when the order of member initializers given in the code does not
3243 match the order in which they must be executed. For instance:
3244
3245 @smallexample
3246 struct A @{
3247 int i;
3248 int j;
3249 A(): j (0), i (1) @{ @}
3250 @};
3251 @end smallexample
3252
3253 @noindent
3254 The compiler rearranges the member initializers for @code{i}
3255 and @code{j} to match the declaration order of the members, emitting
3256 a warning to that effect. This warning is enabled by @option{-Wall}.
3257
3258 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3259 @opindex Wpessimizing-move
3260 @opindex Wno-pessimizing-move
3261 This warning warns when a call to @code{std::move} prevents copy
3262 elision. A typical scenario when copy elision can occur is when returning in
3263 a function with a class return type, when the expression being returned is the
3264 name of a non-volatile automatic object, and is not a function parameter, and
3265 has the same type as the function return type.
3266
3267 @smallexample
3268 struct T @{
3269 @dots{}
3270 @};
3271 T fn()
3272 @{
3273 T t;
3274 @dots{}
3275 return std::move (t);
3276 @}
3277 @end smallexample
3278
3279 But in this example, the @code{std::move} call prevents copy elision.
3280
3281 This warning is enabled by @option{-Wall}.
3282
3283 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3284 @opindex Wredundant-move
3285 @opindex Wno-redundant-move
3286 This warning warns about redundant calls to @code{std::move}; that is, when
3287 a move operation would have been performed even without the @code{std::move}
3288 call. This happens because the compiler is forced to treat the object as if
3289 it were an rvalue in certain situations such as returning a local variable,
3290 where copy elision isn't applicable. Consider:
3291
3292 @smallexample
3293 struct T @{
3294 @dots{}
3295 @};
3296 T fn(T t)
3297 @{
3298 @dots{}
3299 return std::move (t);
3300 @}
3301 @end smallexample
3302
3303 Here, the @code{std::move} call is redundant. Because G++ implements Core
3304 Issue 1579, another example is:
3305
3306 @smallexample
3307 struct T @{ // convertible to U
3308 @dots{}
3309 @};
3310 struct U @{
3311 @dots{}
3312 @};
3313 U fn()
3314 @{
3315 T t;
3316 @dots{}
3317 return std::move (t);
3318 @}
3319 @end smallexample
3320 In this example, copy elision isn't applicable because the type of the
3321 expression being returned and the function return type differ, yet G++
3322 treats the return value as if it were designated by an rvalue.
3323
3324 This warning is enabled by @option{-Wextra}.
3325
3326 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3327 @opindex fext-numeric-literals
3328 @opindex fno-ext-numeric-literals
3329 Accept imaginary, fixed-point, or machine-defined
3330 literal number suffixes as GNU extensions.
3331 When this option is turned off these suffixes are treated
3332 as C++11 user-defined literal numeric suffixes.
3333 This is on by default for all pre-C++11 dialects and all GNU dialects:
3334 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3335 @option{-std=gnu++14}.
3336 This option is off by default
3337 for ISO C++11 onwards (@option{-std=c++11}, ...).
3338 @end table
3339
3340 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3341
3342 @table @gcctabopt
3343 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3344 @opindex Weffc++
3345 @opindex Wno-effc++
3346 Warn about violations of the following style guidelines from Scott Meyers'
3347 @cite{Effective C++} series of books:
3348
3349 @itemize @bullet
3350 @item
3351 Define a copy constructor and an assignment operator for classes
3352 with dynamically-allocated memory.
3353
3354 @item
3355 Prefer initialization to assignment in constructors.
3356
3357 @item
3358 Have @code{operator=} return a reference to @code{*this}.
3359
3360 @item
3361 Don't try to return a reference when you must return an object.
3362
3363 @item
3364 Distinguish between prefix and postfix forms of increment and
3365 decrement operators.
3366
3367 @item
3368 Never overload @code{&&}, @code{||}, or @code{,}.
3369
3370 @end itemize
3371
3372 This option also enables @option{-Wnon-virtual-dtor}, which is also
3373 one of the effective C++ recommendations. However, the check is
3374 extended to warn about the lack of virtual destructor in accessible
3375 non-polymorphic bases classes too.
3376
3377 When selecting this option, be aware that the standard library
3378 headers do not obey all of these guidelines; use @samp{grep -v}
3379 to filter out those warnings.
3380
3381 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3382 @opindex Wstrict-null-sentinel
3383 @opindex Wno-strict-null-sentinel
3384 Warn about the use of an uncasted @code{NULL} as sentinel. When
3385 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3386 to @code{__null}. Although it is a null pointer constant rather than a
3387 null pointer, it is guaranteed to be of the same size as a pointer.
3388 But this use is not portable across different compilers.
3389
3390 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3391 @opindex Wno-non-template-friend
3392 @opindex Wnon-template-friend
3393 Disable warnings when non-template friend functions are declared
3394 within a template. In very old versions of GCC that predate implementation
3395 of the ISO standard, declarations such as
3396 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3397 could be interpreted as a particular specialization of a template
3398 function; the warning exists to diagnose compatibility problems,
3399 and is enabled by default.
3400
3401 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3402 @opindex Wold-style-cast
3403 @opindex Wno-old-style-cast
3404 Warn if an old-style (C-style) cast to a non-void type is used within
3405 a C++ program. The new-style casts (@code{dynamic_cast},
3406 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3407 less vulnerable to unintended effects and much easier to search for.
3408
3409 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3410 @opindex Woverloaded-virtual
3411 @opindex Wno-overloaded-virtual
3412 @cindex overloaded virtual function, warning
3413 @cindex warning for overloaded virtual function
3414 Warn when a function declaration hides virtual functions from a
3415 base class. For example, in:
3416
3417 @smallexample
3418 struct A @{
3419 virtual void f();
3420 @};
3421
3422 struct B: public A @{
3423 void f(int);
3424 @};
3425 @end smallexample
3426
3427 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3428 like:
3429
3430 @smallexample
3431 B* b;
3432 b->f();
3433 @end smallexample
3434
3435 @noindent
3436 fails to compile.
3437
3438 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3439 @opindex Wno-pmf-conversions
3440 @opindex Wpmf-conversions
3441 Disable the diagnostic for converting a bound pointer to member function
3442 to a plain pointer.
3443
3444 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3445 @opindex Wsign-promo
3446 @opindex Wno-sign-promo
3447 Warn when overload resolution chooses a promotion from unsigned or
3448 enumerated type to a signed type, over a conversion to an unsigned type of
3449 the same size. Previous versions of G++ tried to preserve
3450 unsignedness, but the standard mandates the current behavior.
3451
3452 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3453 @opindex Wtemplates
3454 @opindex Wno-templates
3455 Warn when a primary template declaration is encountered. Some coding
3456 rules disallow templates, and this may be used to enforce that rule.
3457 The warning is inactive inside a system header file, such as the STL, so
3458 one can still use the STL. One may also instantiate or specialize
3459 templates.
3460
3461 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3462 @opindex Wmultiple-inheritance
3463 @opindex Wno-multiple-inheritance
3464 Warn when a class is defined with multiple direct base classes. Some
3465 coding rules disallow multiple inheritance, and this may be used to
3466 enforce that rule. The warning is inactive inside a system header file,
3467 such as the STL, so one can still use the STL. One may also define
3468 classes that indirectly use multiple inheritance.
3469
3470 @item -Wvirtual-inheritance
3471 @opindex Wvirtual-inheritance
3472 @opindex Wno-virtual-inheritance
3473 Warn when a class is defined with a virtual direct base class. Some
3474 coding rules disallow multiple inheritance, and this may be used to
3475 enforce that rule. The warning is inactive inside a system header file,
3476 such as the STL, so one can still use the STL. One may also define
3477 classes that indirectly use virtual inheritance.
3478
3479 @item -Wnamespaces
3480 @opindex Wnamespaces
3481 @opindex Wno-namespaces
3482 Warn when a namespace definition is opened. Some coding rules disallow
3483 namespaces, and this may be used to enforce that rule. The warning is
3484 inactive inside a system header file, such as the STL, so one can still
3485 use the STL. One may also use using directives and qualified names.
3486
3487 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3488 @opindex Wterminate
3489 @opindex Wno-terminate
3490 Disable the warning about a throw-expression that will immediately
3491 result in a call to @code{terminate}.
3492
3493 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3494 @opindex Wno-class-conversion
3495 @opindex Wclass-conversion
3496 Disable the warning about the case when a conversion function converts an
3497 object to the same type, to a base class of that type, or to void; such
3498 a conversion function will never be called.
3499 @end table
3500
3501 @node Objective-C and Objective-C++ Dialect Options
3502 @section Options Controlling Objective-C and Objective-C++ Dialects
3503
3504 @cindex compiler options, Objective-C and Objective-C++
3505 @cindex Objective-C and Objective-C++ options, command-line
3506 @cindex options, Objective-C and Objective-C++
3507 (NOTE: This manual does not describe the Objective-C and Objective-C++
3508 languages themselves. @xref{Standards,,Language Standards
3509 Supported by GCC}, for references.)
3510
3511 This section describes the command-line options that are only meaningful
3512 for Objective-C and Objective-C++ programs. You can also use most of
3513 the language-independent GNU compiler options.
3514 For example, you might compile a file @file{some_class.m} like this:
3515
3516 @smallexample
3517 gcc -g -fgnu-runtime -O -c some_class.m
3518 @end smallexample
3519
3520 @noindent
3521 In this example, @option{-fgnu-runtime} is an option meant only for
3522 Objective-C and Objective-C++ programs; you can use the other options with
3523 any language supported by GCC@.
3524
3525 Note that since Objective-C is an extension of the C language, Objective-C
3526 compilations may also use options specific to the C front-end (e.g.,
3527 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3528 C++-specific options (e.g., @option{-Wabi}).
3529
3530 Here is a list of options that are @emph{only} for compiling Objective-C
3531 and Objective-C++ programs:
3532
3533 @table @gcctabopt
3534 @item -fconstant-string-class=@var{class-name}
3535 @opindex fconstant-string-class
3536 Use @var{class-name} as the name of the class to instantiate for each
3537 literal string specified with the syntax @code{@@"@dots{}"}. The default
3538 class name is @code{NXConstantString} if the GNU runtime is being used, and
3539 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3540 @option{-fconstant-cfstrings} option, if also present, overrides the
3541 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3542 to be laid out as constant CoreFoundation strings.
3543
3544 @item -fgnu-runtime
3545 @opindex fgnu-runtime
3546 Generate object code compatible with the standard GNU Objective-C
3547 runtime. This is the default for most types of systems.
3548
3549 @item -fnext-runtime
3550 @opindex fnext-runtime
3551 Generate output compatible with the NeXT runtime. This is the default
3552 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3553 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3554 used.
3555
3556 @item -fno-nil-receivers
3557 @opindex fno-nil-receivers
3558 @opindex fnil-receivers
3559 Assume that all Objective-C message dispatches (@code{[receiver
3560 message:arg]}) in this translation unit ensure that the receiver is
3561 not @code{nil}. This allows for more efficient entry points in the
3562 runtime to be used. This option is only available in conjunction with
3563 the NeXT runtime and ABI version 0 or 1.
3564
3565 @item -fobjc-abi-version=@var{n}
3566 @opindex fobjc-abi-version
3567 Use version @var{n} of the Objective-C ABI for the selected runtime.
3568 This option is currently supported only for the NeXT runtime. In that
3569 case, Version 0 is the traditional (32-bit) ABI without support for
3570 properties and other Objective-C 2.0 additions. Version 1 is the
3571 traditional (32-bit) ABI with support for properties and other
3572 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3573 nothing is specified, the default is Version 0 on 32-bit target
3574 machines, and Version 2 on 64-bit target machines.
3575
3576 @item -fobjc-call-cxx-cdtors
3577 @opindex fobjc-call-cxx-cdtors
3578 For each Objective-C class, check if any of its instance variables is a
3579 C++ object with a non-trivial default constructor. If so, synthesize a
3580 special @code{- (id) .cxx_construct} instance method which runs
3581 non-trivial default constructors on any such instance variables, in order,
3582 and then return @code{self}. Similarly, check if any instance variable
3583 is a C++ object with a non-trivial destructor, and if so, synthesize a
3584 special @code{- (void) .cxx_destruct} method which runs
3585 all such default destructors, in reverse order.
3586
3587 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3588 methods thusly generated only operate on instance variables
3589 declared in the current Objective-C class, and not those inherited
3590 from superclasses. It is the responsibility of the Objective-C
3591 runtime to invoke all such methods in an object's inheritance
3592 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3593 by the runtime immediately after a new object instance is allocated;
3594 the @code{- (void) .cxx_destruct} methods are invoked immediately
3595 before the runtime deallocates an object instance.
3596
3597 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3598 support for invoking the @code{- (id) .cxx_construct} and
3599 @code{- (void) .cxx_destruct} methods.
3600
3601 @item -fobjc-direct-dispatch
3602 @opindex fobjc-direct-dispatch
3603 Allow fast jumps to the message dispatcher. On Darwin this is
3604 accomplished via the comm page.
3605
3606 @item -fobjc-exceptions
3607 @opindex fobjc-exceptions
3608 Enable syntactic support for structured exception handling in
3609 Objective-C, similar to what is offered by C++. This option
3610 is required to use the Objective-C keywords @code{@@try},
3611 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3612 @code{@@synchronized}. This option is available with both the GNU
3613 runtime and the NeXT runtime (but not available in conjunction with
3614 the NeXT runtime on Mac OS X 10.2 and earlier).
3615
3616 @item -fobjc-gc
3617 @opindex fobjc-gc
3618 Enable garbage collection (GC) in Objective-C and Objective-C++
3619 programs. This option is only available with the NeXT runtime; the
3620 GNU runtime has a different garbage collection implementation that
3621 does not require special compiler flags.
3622
3623 @item -fobjc-nilcheck
3624 @opindex fobjc-nilcheck
3625 For the NeXT runtime with version 2 of the ABI, check for a nil
3626 receiver in method invocations before doing the actual method call.
3627 This is the default and can be disabled using
3628 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3629 checked for nil in this way no matter what this flag is set to.
3630 Currently this flag does nothing when the GNU runtime, or an older
3631 version of the NeXT runtime ABI, is used.
3632
3633 @item -fobjc-std=objc1
3634 @opindex fobjc-std
3635 Conform to the language syntax of Objective-C 1.0, the language
3636 recognized by GCC 4.0. This only affects the Objective-C additions to
3637 the C/C++ language; it does not affect conformance to C/C++ standards,
3638 which is controlled by the separate C/C++ dialect option flags. When
3639 this option is used with the Objective-C or Objective-C++ compiler,
3640 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3641 This is useful if you need to make sure that your Objective-C code can
3642 be compiled with older versions of GCC@.
3643
3644 @item -freplace-objc-classes
3645 @opindex freplace-objc-classes
3646 Emit a special marker instructing @command{ld(1)} not to statically link in
3647 the resulting object file, and allow @command{dyld(1)} to load it in at
3648 run time instead. This is used in conjunction with the Fix-and-Continue
3649 debugging mode, where the object file in question may be recompiled and
3650 dynamically reloaded in the course of program execution, without the need
3651 to restart the program itself. Currently, Fix-and-Continue functionality
3652 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3653 and later.
3654
3655 @item -fzero-link
3656 @opindex fzero-link
3657 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3658 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3659 compile time) with static class references that get initialized at load time,
3660 which improves run-time performance. Specifying the @option{-fzero-link} flag
3661 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3662 to be retained. This is useful in Zero-Link debugging mode, since it allows
3663 for individual class implementations to be modified during program execution.
3664 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3665 regardless of command-line options.
3666
3667 @item -fno-local-ivars
3668 @opindex fno-local-ivars
3669 @opindex flocal-ivars
3670 By default instance variables in Objective-C can be accessed as if
3671 they were local variables from within the methods of the class they're
3672 declared in. This can lead to shadowing between instance variables
3673 and other variables declared either locally inside a class method or
3674 globally with the same name. Specifying the @option{-fno-local-ivars}
3675 flag disables this behavior thus avoiding variable shadowing issues.
3676
3677 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3678 @opindex fivar-visibility
3679 Set the default instance variable visibility to the specified option
3680 so that instance variables declared outside the scope of any access
3681 modifier directives default to the specified visibility.
3682
3683 @item -gen-decls
3684 @opindex gen-decls
3685 Dump interface declarations for all classes seen in the source file to a
3686 file named @file{@var{sourcename}.decl}.
3687
3688 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3689 @opindex Wassign-intercept
3690 @opindex Wno-assign-intercept
3691 Warn whenever an Objective-C assignment is being intercepted by the
3692 garbage collector.
3693
3694 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3695 @opindex Wno-protocol
3696 @opindex Wprotocol
3697 If a class is declared to implement a protocol, a warning is issued for
3698 every method in the protocol that is not implemented by the class. The
3699 default behavior is to issue a warning for every method not explicitly
3700 implemented in the class, even if a method implementation is inherited
3701 from the superclass. If you use the @option{-Wno-protocol} option, then
3702 methods inherited from the superclass are considered to be implemented,
3703 and no warning is issued for them.
3704
3705 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3706 @opindex Wselector
3707 @opindex Wno-selector
3708 Warn if multiple methods of different types for the same selector are
3709 found during compilation. The check is performed on the list of methods
3710 in the final stage of compilation. Additionally, a check is performed
3711 for each selector appearing in a @code{@@selector(@dots{})}
3712 expression, and a corresponding method for that selector has been found
3713 during compilation. Because these checks scan the method table only at
3714 the end of compilation, these warnings are not produced if the final
3715 stage of compilation is not reached, for example because an error is
3716 found during compilation, or because the @option{-fsyntax-only} option is
3717 being used.
3718
3719 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3720 @opindex Wstrict-selector-match
3721 @opindex Wno-strict-selector-match
3722 Warn if multiple methods with differing argument and/or return types are
3723 found for a given selector when attempting to send a message using this
3724 selector to a receiver of type @code{id} or @code{Class}. When this flag
3725 is off (which is the default behavior), the compiler omits such warnings
3726 if any differences found are confined to types that share the same size
3727 and alignment.
3728
3729 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3730 @opindex Wundeclared-selector
3731 @opindex Wno-undeclared-selector
3732 Warn if a @code{@@selector(@dots{})} expression referring to an
3733 undeclared selector is found. A selector is considered undeclared if no
3734 method with that name has been declared before the
3735 @code{@@selector(@dots{})} expression, either explicitly in an
3736 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3737 an @code{@@implementation} section. This option always performs its
3738 checks as soon as a @code{@@selector(@dots{})} expression is found,
3739 while @option{-Wselector} only performs its checks in the final stage of
3740 compilation. This also enforces the coding style convention
3741 that methods and selectors must be declared before being used.
3742
3743 @item -print-objc-runtime-info
3744 @opindex print-objc-runtime-info
3745 Generate C header describing the largest structure that is passed by
3746 value, if any.
3747
3748 @end table
3749
3750 @node Diagnostic Message Formatting Options
3751 @section Options to Control Diagnostic Messages Formatting
3752 @cindex options to control diagnostics formatting
3753 @cindex diagnostic messages
3754 @cindex message formatting
3755
3756 Traditionally, diagnostic messages have been formatted irrespective of
3757 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3758 options described below
3759 to control the formatting algorithm for diagnostic messages,
3760 e.g.@: how many characters per line, how often source location
3761 information should be reported. Note that some language front ends may not
3762 honor these options.
3763
3764 @table @gcctabopt
3765 @item -fmessage-length=@var{n}
3766 @opindex fmessage-length
3767 Try to format error messages so that they fit on lines of about
3768 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3769 done; each error message appears on a single line. This is the
3770 default for all front ends.
3771
3772 Note - this option also affects the display of the @samp{#error} and
3773 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3774 function/type/variable attribute. It does not however affect the
3775 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3776
3777 @item -fdiagnostics-show-location=once
3778 @opindex fdiagnostics-show-location
3779 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3780 reporter to emit source location information @emph{once}; that is, in
3781 case the message is too long to fit on a single physical line and has to
3782 be wrapped, the source location won't be emitted (as prefix) again,
3783 over and over, in subsequent continuation lines. This is the default
3784 behavior.
3785
3786 @item -fdiagnostics-show-location=every-line
3787 Only meaningful in line-wrapping mode. Instructs the diagnostic
3788 messages reporter to emit the same source location information (as
3789 prefix) for physical lines that result from the process of breaking
3790 a message which is too long to fit on a single line.
3791
3792 @item -fdiagnostics-color[=@var{WHEN}]
3793 @itemx -fno-diagnostics-color
3794 @opindex fdiagnostics-color
3795 @cindex highlight, color
3796 @vindex GCC_COLORS @r{environment variable}
3797 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3798 or @samp{auto}. The default depends on how the compiler has been configured,
3799 it can be any of the above @var{WHEN} options or also @samp{never}
3800 if @env{GCC_COLORS} environment variable isn't present in the environment,
3801 and @samp{auto} otherwise.
3802 @samp{auto} means to use color only when the standard error is a terminal.
3803 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3804 aliases for @option{-fdiagnostics-color=always} and
3805 @option{-fdiagnostics-color=never}, respectively.
3806
3807 The colors are defined by the environment variable @env{GCC_COLORS}.
3808 Its value is a colon-separated list of capabilities and Select Graphic
3809 Rendition (SGR) substrings. SGR commands are interpreted by the
3810 terminal or terminal emulator. (See the section in the documentation
3811 of your text terminal for permitted values and their meanings as
3812 character attributes.) These substring values are integers in decimal
3813 representation and can be concatenated with semicolons.
3814 Common values to concatenate include
3815 @samp{1} for bold,
3816 @samp{4} for underline,
3817 @samp{5} for blink,
3818 @samp{7} for inverse,
3819 @samp{39} for default foreground color,
3820 @samp{30} to @samp{37} for foreground colors,
3821 @samp{90} to @samp{97} for 16-color mode foreground colors,
3822 @samp{38;5;0} to @samp{38;5;255}
3823 for 88-color and 256-color modes foreground colors,
3824 @samp{49} for default background color,
3825 @samp{40} to @samp{47} for background colors,
3826 @samp{100} to @samp{107} for 16-color mode background colors,
3827 and @samp{48;5;0} to @samp{48;5;255}
3828 for 88-color and 256-color modes background colors.
3829
3830 The default @env{GCC_COLORS} is
3831 @smallexample
3832 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3833 quote=01:fixit-insert=32:fixit-delete=31:\
3834 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3835 type-diff=01;32
3836 @end smallexample
3837 @noindent
3838 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3839 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3840 @samp{01} is bold, and @samp{31} is red.
3841 Setting @env{GCC_COLORS} to the empty string disables colors.
3842 Supported capabilities are as follows.
3843
3844 @table @code
3845 @item error=
3846 @vindex error GCC_COLORS @r{capability}
3847 SGR substring for error: markers.
3848
3849 @item warning=
3850 @vindex warning GCC_COLORS @r{capability}
3851 SGR substring for warning: markers.
3852
3853 @item note=
3854 @vindex note GCC_COLORS @r{capability}
3855 SGR substring for note: markers.
3856
3857 @item range1=
3858 @vindex range1 GCC_COLORS @r{capability}
3859 SGR substring for first additional range.
3860
3861 @item range2=
3862 @vindex range2 GCC_COLORS @r{capability}
3863 SGR substring for second additional range.
3864
3865 @item locus=
3866 @vindex locus GCC_COLORS @r{capability}
3867 SGR substring for location information, @samp{file:line} or
3868 @samp{file:line:column} etc.
3869
3870 @item quote=
3871 @vindex quote GCC_COLORS @r{capability}
3872 SGR substring for information printed within quotes.
3873
3874 @item fixit-insert=
3875 @vindex fixit-insert GCC_COLORS @r{capability}
3876 SGR substring for fix-it hints suggesting text to
3877 be inserted or replaced.
3878
3879 @item fixit-delete=
3880 @vindex fixit-delete GCC_COLORS @r{capability}
3881 SGR substring for fix-it hints suggesting text to
3882 be deleted.
3883
3884 @item diff-filename=
3885 @vindex diff-filename GCC_COLORS @r{capability}
3886 SGR substring for filename headers within generated patches.
3887
3888 @item diff-hunk=
3889 @vindex diff-hunk GCC_COLORS @r{capability}
3890 SGR substring for the starts of hunks within generated patches.
3891
3892 @item diff-delete=
3893 @vindex diff-delete GCC_COLORS @r{capability}
3894 SGR substring for deleted lines within generated patches.
3895
3896 @item diff-insert=
3897 @vindex diff-insert GCC_COLORS @r{capability}
3898 SGR substring for inserted lines within generated patches.
3899
3900 @item type-diff=
3901 @vindex type-diff GCC_COLORS @r{capability}
3902 SGR substring for highlighting mismatching types within template
3903 arguments in the C++ frontend.
3904 @end table
3905
3906 @item -fno-diagnostics-show-option
3907 @opindex fno-diagnostics-show-option
3908 @opindex fdiagnostics-show-option
3909 By default, each diagnostic emitted includes text indicating the
3910 command-line option that directly controls the diagnostic (if such an
3911 option is known to the diagnostic machinery). Specifying the
3912 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3913
3914 @item -fno-diagnostics-show-caret
3915 @opindex fno-diagnostics-show-caret
3916 @opindex fdiagnostics-show-caret
3917 By default, each diagnostic emitted includes the original source line
3918 and a caret @samp{^} indicating the column. This option suppresses this
3919 information. The source line is truncated to @var{n} characters, if
3920 the @option{-fmessage-length=n} option is given. When the output is done
3921 to the terminal, the width is limited to the width given by the
3922 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3923
3924 @item -fno-diagnostics-show-labels
3925 @opindex fno-diagnostics-show-labels
3926 @opindex fdiagnostics-show-labels
3927 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3928 diagnostics can label ranges of source code with pertinent information, such
3929 as the types of expressions:
3930
3931 @smallexample
3932 printf ("foo %s bar", long_i + long_j);
3933 ~^ ~~~~~~~~~~~~~~~
3934 | |
3935 char * long int
3936 @end smallexample
3937
3938 This option suppresses the printing of these labels (in the example above,
3939 the vertical bars and the ``char *'' and ``long int'' text).
3940
3941 @item -fno-diagnostics-show-line-numbers
3942 @opindex fno-diagnostics-show-line-numbers
3943 @opindex fdiagnostics-show-line-numbers
3944 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3945 a left margin is printed, showing line numbers. This option suppresses this
3946 left margin.
3947
3948 @item -fdiagnostics-minimum-margin-width=@var{width}
3949 @opindex fdiagnostics-minimum-margin-width
3950 This option controls the minimum width of the left margin printed by
3951 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3952
3953 @item -fdiagnostics-parseable-fixits
3954 @opindex fdiagnostics-parseable-fixits
3955 Emit fix-it hints in a machine-parseable format, suitable for consumption
3956 by IDEs. For each fix-it, a line will be printed after the relevant
3957 diagnostic, starting with the string ``fix-it:''. For example:
3958
3959 @smallexample
3960 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3961 @end smallexample
3962
3963 The location is expressed as a half-open range, expressed as a count of
3964 bytes, starting at byte 1 for the initial column. In the above example,
3965 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3966 given string:
3967
3968 @smallexample
3969 00000000011111111112222222222
3970 12345678901234567890123456789
3971 gtk_widget_showall (dlg);
3972 ^^^^^^^^^^^^^^^^^^
3973 gtk_widget_show_all
3974 @end smallexample
3975
3976 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3977 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3978 (e.g. vertical tab as ``\013'').
3979
3980 An empty replacement string indicates that the given range is to be removed.
3981 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3982 be inserted at the given position.
3983
3984 @item -fdiagnostics-generate-patch
3985 @opindex fdiagnostics-generate-patch
3986 Print fix-it hints to stderr in unified diff format, after any diagnostics
3987 are printed. For example:
3988
3989 @smallexample
3990 --- test.c
3991 +++ test.c
3992 @@ -42,5 +42,5 @@
3993
3994 void show_cb(GtkDialog *dlg)
3995 @{
3996 - gtk_widget_showall(dlg);
3997 + gtk_widget_show_all(dlg);
3998 @}
3999
4000 @end smallexample
4001
4002 The diff may or may not be colorized, following the same rules
4003 as for diagnostics (see @option{-fdiagnostics-color}).
4004
4005 @item -fdiagnostics-show-template-tree
4006 @opindex fdiagnostics-show-template-tree
4007
4008 In the C++ frontend, when printing diagnostics showing mismatching
4009 template types, such as:
4010
4011 @smallexample
4012 could not convert 'std::map<int, std::vector<double> >()'
4013 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4014 @end smallexample
4015
4016 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4017 tree-like structure showing the common and differing parts of the types,
4018 such as:
4019
4020 @smallexample
4021 map<
4022 [...],
4023 vector<
4024 [double != float]>>
4025 @end smallexample
4026
4027 The parts that differ are highlighted with color (``double'' and
4028 ``float'' in this case).
4029
4030 @item -fno-elide-type
4031 @opindex fno-elide-type
4032 @opindex felide-type
4033 By default when the C++ frontend prints diagnostics showing mismatching
4034 template types, common parts of the types are printed as ``[...]'' to
4035 simplify the error message. For example:
4036
4037 @smallexample
4038 could not convert 'std::map<int, std::vector<double> >()'
4039 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4040 @end smallexample
4041
4042 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4043 This flag also affects the output of the
4044 @option{-fdiagnostics-show-template-tree} flag.
4045
4046 @item -fno-show-column
4047 @opindex fno-show-column
4048 @opindex fshow-column
4049 Do not print column numbers in diagnostics. This may be necessary if
4050 diagnostics are being scanned by a program that does not understand the
4051 column numbers, such as @command{dejagnu}.
4052
4053 @item -fdiagnostics-format=@var{FORMAT}
4054 @opindex fdiagnostics-format
4055 Select a different format for printing diagnostics.
4056 @var{FORMAT} is @samp{text} or @samp{json}.
4057 The default is @samp{text}.
4058
4059 The @samp{json} format consists of a top-level JSON array containing JSON
4060 objects representing the diagnostics.
4061
4062 The JSON is emitted as one line, without formatting; the examples below
4063 have been formatted for clarity.
4064
4065 Diagnostics can have child diagnostics. For example, this error and note:
4066
4067 @smallexample
4068 misleading-indentation.c:15:3: warning: this 'if' clause does not
4069 guard... [-Wmisleading-indentation]
4070 15 | if (flag)
4071 | ^~
4072 misleading-indentation.c:17:5: note: ...this statement, but the latter
4073 is misleadingly indented as if it were guarded by the 'if'
4074 17 | y = 2;
4075 | ^
4076 @end smallexample
4077
4078 @noindent
4079 might be printed in JSON form (after formatting) like this:
4080
4081 @smallexample
4082 [
4083 @{
4084 "kind": "warning",
4085 "locations": [
4086 @{
4087 "caret": @{
4088 "column": 3,
4089 "file": "misleading-indentation.c",
4090 "line": 15
4091 @},
4092 "finish": @{
4093 "column": 4,
4094 "file": "misleading-indentation.c",
4095 "line": 15
4096 @}
4097 @}
4098 ],
4099 "message": "this \u2018if\u2019 clause does not guard...",
4100 "option": "-Wmisleading-indentation",
4101 "children": [
4102 @{
4103 "kind": "note",
4104 "locations": [
4105 @{
4106 "caret": @{
4107 "column": 5,
4108 "file": "misleading-indentation.c",
4109 "line": 17
4110 @}
4111 @}
4112 ],
4113 "message": "...this statement, but the latter is @dots{}"
4114 @}
4115 ]
4116 @},
4117 @dots{}
4118 ]
4119 @end smallexample
4120
4121 @noindent
4122 where the @code{note} is a child of the @code{warning}.
4123
4124 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4125 an @code{option} key describing the command-line option controlling the
4126 warning.
4127
4128 A diagnostic can contain zero or more locations. Each location has up
4129 to three positions within it: a @code{caret} position and optional
4130 @code{start} and @code{finish} positions. A location can also have
4131 an optional @code{label} string. For example, this error:
4132
4133 @smallexample
4134 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4135 'struct s'@} and 'T' @{aka 'struct t'@})
4136 64 | return callee_4a () + callee_4b ();
4137 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4138 | | |
4139 | | T @{aka struct t@}
4140 | S @{aka struct s@}
4141 @end smallexample
4142
4143 @noindent
4144 has three locations. Its primary location is at the ``+'' token at column
4145 23. It has two secondary locations, describing the left and right-hand sides
4146 of the expression, which have labels. It might be printed in JSON form as:
4147
4148 @smallexample
4149 @{
4150 "children": [],
4151 "kind": "error",
4152 "locations": [
4153 @{
4154 "caret": @{
4155 "column": 23, "file": "bad-binary-ops.c", "line": 64
4156 @}
4157 @},
4158 @{
4159 "caret": @{
4160 "column": 10, "file": "bad-binary-ops.c", "line": 64
4161 @},
4162 "finish": @{
4163 "column": 21, "file": "bad-binary-ops.c", "line": 64
4164 @},
4165 "label": "S @{aka struct s@}"
4166 @},
4167 @{
4168 "caret": @{
4169 "column": 25, "file": "bad-binary-ops.c", "line": 64
4170 @},
4171 "finish": @{
4172 "column": 36, "file": "bad-binary-ops.c", "line": 64
4173 @},
4174 "label": "T @{aka struct t@}"
4175 @}
4176 ],
4177 "message": "invalid operands to binary + @dots{}"
4178 @}
4179 @end smallexample
4180
4181 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4182 consisting of half-open intervals, similar to the output of
4183 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4184 with a replacement fix-it hint:
4185
4186 @smallexample
4187 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4188 mean 'color'?
4189 8 | return ptr->colour;
4190 | ^~~~~~
4191 | color
4192 @end smallexample
4193
4194 @noindent
4195 might be printed in JSON form as:
4196
4197 @smallexample
4198 @{
4199 "children": [],
4200 "fixits": [
4201 @{
4202 "next": @{
4203 "column": 21,
4204 "file": "demo.c",
4205 "line": 8
4206 @},
4207 "start": @{
4208 "column": 15,
4209 "file": "demo.c",
4210 "line": 8
4211 @},
4212 "string": "color"
4213 @}
4214 ],
4215 "kind": "error",
4216 "locations": [
4217 @{
4218 "caret": @{
4219 "column": 15,
4220 "file": "demo.c",
4221 "line": 8
4222 @},
4223 "finish": @{
4224 "column": 20,
4225 "file": "demo.c",
4226 "line": 8
4227 @}
4228 @}
4229 ],
4230 "message": "\u2018struct s\u2019 has no member named @dots{}"
4231 @}
4232 @end smallexample
4233
4234 @noindent
4235 where the fix-it hint suggests replacing the text from @code{start} up
4236 to but not including @code{next} with @code{string}'s value. Deletions
4237 are expressed via an empty value for @code{string}, insertions by
4238 having @code{start} equal @code{next}.
4239
4240 @end table
4241
4242 @node Warning Options
4243 @section Options to Request or Suppress Warnings
4244 @cindex options to control warnings
4245 @cindex warning messages
4246 @cindex messages, warning
4247 @cindex suppressing warnings
4248
4249 Warnings are diagnostic messages that report constructions that
4250 are not inherently erroneous but that are risky or suggest there
4251 may have been an error.
4252
4253 The following language-independent options do not enable specific
4254 warnings but control the kinds of diagnostics produced by GCC@.
4255
4256 @table @gcctabopt
4257 @cindex syntax checking
4258 @item -fsyntax-only
4259 @opindex fsyntax-only
4260 Check the code for syntax errors, but don't do anything beyond that.
4261
4262 @item -fmax-errors=@var{n}
4263 @opindex fmax-errors
4264 Limits the maximum number of error messages to @var{n}, at which point
4265 GCC bails out rather than attempting to continue processing the source
4266 code. If @var{n} is 0 (the default), there is no limit on the number
4267 of error messages produced. If @option{-Wfatal-errors} is also
4268 specified, then @option{-Wfatal-errors} takes precedence over this
4269 option.
4270
4271 @item -w
4272 @opindex w
4273 Inhibit all warning messages.
4274
4275 @item -Werror
4276 @opindex Werror
4277 @opindex Wno-error
4278 Make all warnings into errors.
4279
4280 @item -Werror=
4281 @opindex Werror=
4282 @opindex Wno-error=
4283 Make the specified warning into an error. The specifier for a warning
4284 is appended; for example @option{-Werror=switch} turns the warnings
4285 controlled by @option{-Wswitch} into errors. This switch takes a
4286 negative form, to be used to negate @option{-Werror} for specific
4287 warnings; for example @option{-Wno-error=switch} makes
4288 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4289 is in effect.
4290
4291 The warning message for each controllable warning includes the
4292 option that controls the warning. That option can then be used with
4293 @option{-Werror=} and @option{-Wno-error=} as described above.
4294 (Printing of the option in the warning message can be disabled using the
4295 @option{-fno-diagnostics-show-option} flag.)
4296
4297 Note that specifying @option{-Werror=}@var{foo} automatically implies
4298 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4299 imply anything.
4300
4301 @item -Wfatal-errors
4302 @opindex Wfatal-errors
4303 @opindex Wno-fatal-errors
4304 This option causes the compiler to abort compilation on the first error
4305 occurred rather than trying to keep going and printing further error
4306 messages.
4307
4308 @end table
4309
4310 You can request many specific warnings with options beginning with
4311 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4312 implicit declarations. Each of these specific warning options also
4313 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4314 example, @option{-Wno-implicit}. This manual lists only one of the
4315 two forms, whichever is not the default. For further
4316 language-specific options also refer to @ref{C++ Dialect Options} and
4317 @ref{Objective-C and Objective-C++ Dialect Options}.
4318
4319 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4320 options, such as @option{-Wunused}, which may turn on further options,
4321 such as @option{-Wunused-value}. The combined effect of positive and
4322 negative forms is that more specific options have priority over less
4323 specific ones, independently of their position in the command-line. For
4324 options of the same specificity, the last one takes effect. Options
4325 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4326 as if they appeared at the end of the command-line.
4327
4328 When an unrecognized warning option is requested (e.g.,
4329 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4330 that the option is not recognized. However, if the @option{-Wno-} form
4331 is used, the behavior is slightly different: no diagnostic is
4332 produced for @option{-Wno-unknown-warning} unless other diagnostics
4333 are being produced. This allows the use of new @option{-Wno-} options
4334 with old compilers, but if something goes wrong, the compiler
4335 warns that an unrecognized option is present.
4336
4337 @table @gcctabopt
4338 @item -Wpedantic
4339 @itemx -pedantic
4340 @opindex pedantic
4341 @opindex Wpedantic
4342 @opindex Wno-pedantic
4343 Issue all the warnings demanded by strict ISO C and ISO C++;
4344 reject all programs that use forbidden extensions, and some other
4345 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4346 version of the ISO C standard specified by any @option{-std} option used.
4347
4348 Valid ISO C and ISO C++ programs should compile properly with or without
4349 this option (though a rare few require @option{-ansi} or a
4350 @option{-std} option specifying the required version of ISO C)@. However,
4351 without this option, certain GNU extensions and traditional C and C++
4352 features are supported as well. With this option, they are rejected.
4353
4354 @option{-Wpedantic} does not cause warning messages for use of the
4355 alternate keywords whose names begin and end with @samp{__}. This alternate
4356 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4357 i.e. @samp{__intN__}.
4358 Pedantic warnings are also disabled in the expression that follows
4359 @code{__extension__}. However, only system header files should use
4360 these escape routes; application programs should avoid them.
4361 @xref{Alternate Keywords}.
4362
4363 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4364 C conformance. They soon find that it does not do quite what they want:
4365 it finds some non-ISO practices, but not all---only those for which
4366 ISO C @emph{requires} a diagnostic, and some others for which
4367 diagnostics have been added.
4368
4369 A feature to report any failure to conform to ISO C might be useful in
4370 some instances, but would require considerable additional work and would
4371 be quite different from @option{-Wpedantic}. We don't have plans to
4372 support such a feature in the near future.
4373
4374 Where the standard specified with @option{-std} represents a GNU
4375 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4376 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4377 extended dialect is based. Warnings from @option{-Wpedantic} are given
4378 where they are required by the base standard. (It does not make sense
4379 for such warnings to be given only for features not in the specified GNU
4380 C dialect, since by definition the GNU dialects of C include all
4381 features the compiler supports with the given option, and there would be
4382 nothing to warn about.)
4383
4384 @item -pedantic-errors
4385 @opindex pedantic-errors
4386 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4387 requires a diagnostic, in some cases where there is undefined behavior
4388 at compile-time and in some other cases that do not prevent compilation
4389 of programs that are valid according to the standard. This is not
4390 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4391 by this option and not enabled by the latter and vice versa.
4392
4393 @item -Wall
4394 @opindex Wall
4395 @opindex Wno-all
4396 This enables all the warnings about constructions that some users
4397 consider questionable, and that are easy to avoid (or modify to
4398 prevent the warning), even in conjunction with macros. This also
4399 enables some language-specific warnings described in @ref{C++ Dialect
4400 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4401
4402 @option{-Wall} turns on the following warning flags:
4403
4404 @gccoptlist{-Waddress @gol
4405 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4406 -Wbool-compare @gol
4407 -Wbool-operation @gol
4408 -Wc++11-compat -Wc++14-compat @gol
4409 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4410 -Wchar-subscripts @gol
4411 -Wcomment @gol
4412 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4413 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4414 -Wformat @gol
4415 -Wint-in-bool-context @gol
4416 -Wimplicit @r{(C and Objective-C only)} @gol
4417 -Wimplicit-int @r{(C and Objective-C only)} @gol
4418 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4419 -Winit-self @r{(only for C++)} @gol
4420 -Wlogical-not-parentheses @gol
4421 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4422 -Wmaybe-uninitialized @gol
4423 -Wmemset-elt-size @gol
4424 -Wmemset-transposed-args @gol
4425 -Wmisleading-indentation @r{(only for C/C++)} @gol
4426 -Wmissing-attributes @gol
4427 -Wmissing-braces @r{(only for C/ObjC)} @gol
4428 -Wmultistatement-macros @gol
4429 -Wnarrowing @r{(only for C++)} @gol
4430 -Wnonnull @gol
4431 -Wnonnull-compare @gol
4432 -Wopenmp-simd @gol
4433 -Wparentheses @gol
4434 -Wpessimizing-move @r{(only for C++)} @gol
4435 -Wpointer-sign @gol
4436 -Wreorder @gol
4437 -Wrestrict @gol
4438 -Wreturn-type @gol
4439 -Wsequence-point @gol
4440 -Wsign-compare @r{(only in C++)} @gol
4441 -Wsizeof-pointer-div @gol
4442 -Wsizeof-pointer-memaccess @gol
4443 -Wstrict-aliasing @gol
4444 -Wstrict-overflow=1 @gol
4445 -Wswitch @gol
4446 -Wtautological-compare @gol
4447 -Wtrigraphs @gol
4448 -Wuninitialized @gol
4449 -Wunknown-pragmas @gol
4450 -Wunused-function @gol
4451 -Wunused-label @gol
4452 -Wunused-value @gol
4453 -Wunused-variable @gol
4454 -Wvolatile-register-var}
4455
4456 Note that some warning flags are not implied by @option{-Wall}. Some of
4457 them warn about constructions that users generally do not consider
4458 questionable, but which occasionally you might wish to check for;
4459 others warn about constructions that are necessary or hard to avoid in
4460 some cases, and there is no simple way to modify the code to suppress
4461 the warning. Some of them are enabled by @option{-Wextra} but many of
4462 them must be enabled individually.
4463
4464 @item -Wextra
4465 @opindex W
4466 @opindex Wextra
4467 @opindex Wno-extra
4468 This enables some extra warning flags that are not enabled by
4469 @option{-Wall}. (This option used to be called @option{-W}. The older
4470 name is still supported, but the newer name is more descriptive.)
4471
4472 @gccoptlist{-Wclobbered @gol
4473 -Wcast-function-type @gol
4474 -Wdeprecated-copy @r{(C++ only)} @gol
4475 -Wempty-body @gol
4476 -Wignored-qualifiers @gol
4477 -Wimplicit-fallthrough=3 @gol
4478 -Wmissing-field-initializers @gol
4479 -Wmissing-parameter-type @r{(C only)} @gol
4480 -Wold-style-declaration @r{(C only)} @gol
4481 -Woverride-init @gol
4482 -Wsign-compare @r{(C only)} @gol
4483 -Wredundant-move @r{(only for C++)} @gol
4484 -Wtype-limits @gol
4485 -Wuninitialized @gol
4486 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4487 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4488 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4489
4490
4491 The option @option{-Wextra} also prints warning messages for the
4492 following cases:
4493
4494 @itemize @bullet
4495
4496 @item
4497 A pointer is compared against integer zero with @code{<}, @code{<=},
4498 @code{>}, or @code{>=}.
4499
4500 @item
4501 (C++ only) An enumerator and a non-enumerator both appear in a
4502 conditional expression.
4503
4504 @item
4505 (C++ only) Ambiguous virtual bases.
4506
4507 @item
4508 (C++ only) Subscripting an array that has been declared @code{register}.
4509
4510 @item
4511 (C++ only) Taking the address of a variable that has been declared
4512 @code{register}.
4513
4514 @item
4515 (C++ only) A base class is not initialized in the copy constructor
4516 of a derived class.
4517
4518 @end itemize
4519
4520 @item -Wchar-subscripts
4521 @opindex Wchar-subscripts
4522 @opindex Wno-char-subscripts
4523 Warn if an array subscript has type @code{char}. This is a common cause
4524 of error, as programmers often forget that this type is signed on some
4525 machines.
4526 This warning is enabled by @option{-Wall}.
4527
4528 @item -Wno-coverage-mismatch
4529 @opindex Wno-coverage-mismatch
4530 @opindex Wcoverage-mismatch
4531 Warn if feedback profiles do not match when using the
4532 @option{-fprofile-use} option.
4533 If a source file is changed between compiling with @option{-fprofile-generate}
4534 and with @option{-fprofile-use}, the files with the profile feedback can fail
4535 to match the source file and GCC cannot use the profile feedback
4536 information. By default, this warning is enabled and is treated as an
4537 error. @option{-Wno-coverage-mismatch} can be used to disable the
4538 warning or @option{-Wno-error=coverage-mismatch} can be used to
4539 disable the error. Disabling the error for this warning can result in
4540 poorly optimized code and is useful only in the
4541 case of very minor changes such as bug fixes to an existing code-base.
4542 Completely disabling the warning is not recommended.
4543
4544 @item -Wno-cpp
4545 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4546
4547 Suppress warning messages emitted by @code{#warning} directives.
4548
4549 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4550 @opindex Wdouble-promotion
4551 @opindex Wno-double-promotion
4552 Give a warning when a value of type @code{float} is implicitly
4553 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4554 floating-point unit implement @code{float} in hardware, but emulate
4555 @code{double} in software. On such a machine, doing computations
4556 using @code{double} values is much more expensive because of the
4557 overhead required for software emulation.
4558
4559 It is easy to accidentally do computations with @code{double} because
4560 floating-point literals are implicitly of type @code{double}. For
4561 example, in:
4562 @smallexample
4563 @group
4564 float area(float radius)
4565 @{
4566 return 3.14159 * radius * radius;
4567 @}
4568 @end group
4569 @end smallexample
4570 the compiler performs the entire computation with @code{double}
4571 because the floating-point literal is a @code{double}.
4572
4573 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4574 @opindex Wduplicate-decl-specifier
4575 @opindex Wno-duplicate-decl-specifier
4576 Warn if a declaration has duplicate @code{const}, @code{volatile},
4577 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4578 @option{-Wall}.
4579
4580 @item -Wformat
4581 @itemx -Wformat=@var{n}
4582 @opindex Wformat
4583 @opindex Wno-format
4584 @opindex ffreestanding
4585 @opindex fno-builtin
4586 @opindex Wformat=
4587 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4588 the arguments supplied have types appropriate to the format string
4589 specified, and that the conversions specified in the format string make
4590 sense. This includes standard functions, and others specified by format
4591 attributes (@pxref{Function Attributes}), in the @code{printf},
4592 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4593 not in the C standard) families (or other target-specific families).
4594 Which functions are checked without format attributes having been
4595 specified depends on the standard version selected, and such checks of
4596 functions without the attribute specified are disabled by
4597 @option{-ffreestanding} or @option{-fno-builtin}.
4598
4599 The formats are checked against the format features supported by GNU
4600 libc version 2.2. These include all ISO C90 and C99 features, as well
4601 as features from the Single Unix Specification and some BSD and GNU
4602 extensions. Other library implementations may not support all these
4603 features; GCC does not support warning about features that go beyond a
4604 particular library's limitations. However, if @option{-Wpedantic} is used
4605 with @option{-Wformat}, warnings are given about format features not
4606 in the selected standard version (but not for @code{strfmon} formats,
4607 since those are not in any version of the C standard). @xref{C Dialect
4608 Options,,Options Controlling C Dialect}.
4609
4610 @table @gcctabopt
4611 @item -Wformat=1
4612 @itemx -Wformat
4613 @opindex Wformat
4614 @opindex Wformat=1
4615 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4616 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4617 @option{-Wformat} also checks for null format arguments for several
4618 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4619 aspects of this level of format checking can be disabled by the
4620 options: @option{-Wno-format-contains-nul},
4621 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4622 @option{-Wformat} is enabled by @option{-Wall}.
4623
4624 @item -Wno-format-contains-nul
4625 @opindex Wno-format-contains-nul
4626 @opindex Wformat-contains-nul
4627 If @option{-Wformat} is specified, do not warn about format strings that
4628 contain NUL bytes.
4629
4630 @item -Wno-format-extra-args
4631 @opindex Wno-format-extra-args
4632 @opindex Wformat-extra-args
4633 If @option{-Wformat} is specified, do not warn about excess arguments to a
4634 @code{printf} or @code{scanf} format function. The C standard specifies
4635 that such arguments are ignored.
4636
4637 Where the unused arguments lie between used arguments that are
4638 specified with @samp{$} operand number specifications, normally
4639 warnings are still given, since the implementation could not know what
4640 type to pass to @code{va_arg} to skip the unused arguments. However,
4641 in the case of @code{scanf} formats, this option suppresses the
4642 warning if the unused arguments are all pointers, since the Single
4643 Unix Specification says that such unused arguments are allowed.
4644
4645 @item -Wformat-overflow
4646 @itemx -Wformat-overflow=@var{level}
4647 @opindex Wformat-overflow
4648 @opindex Wno-format-overflow
4649 Warn about calls to formatted input/output functions such as @code{sprintf}
4650 and @code{vsprintf} that might overflow the destination buffer. When the
4651 exact number of bytes written by a format directive cannot be determined
4652 at compile-time it is estimated based on heuristics that depend on the
4653 @var{level} argument and on optimization. While enabling optimization
4654 will in most cases improve the accuracy of the warning, it may also
4655 result in false positives.
4656
4657 @table @gcctabopt
4658 @item -Wformat-overflow
4659 @itemx -Wformat-overflow=1
4660 @opindex Wformat-overflow
4661 @opindex Wno-format-overflow
4662 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4663 employs a conservative approach that warns only about calls that most
4664 likely overflow the buffer. At this level, numeric arguments to format
4665 directives with unknown values are assumed to have the value of one, and
4666 strings of unknown length to be empty. Numeric arguments that are known
4667 to be bounded to a subrange of their type, or string arguments whose output
4668 is bounded either by their directive's precision or by a finite set of
4669 string literals, are assumed to take on the value within the range that
4670 results in the most bytes on output. For example, the call to @code{sprintf}
4671 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4672 the terminating NUL character (@code{'\0'}) appended by the function
4673 to the destination buffer will be written past its end. Increasing
4674 the size of the buffer by a single byte is sufficient to avoid the
4675 warning, though it may not be sufficient to avoid the overflow.
4676
4677 @smallexample
4678 void f (int a, int b)
4679 @{
4680 char buf [13];
4681 sprintf (buf, "a = %i, b = %i\n", a, b);
4682 @}
4683 @end smallexample
4684
4685 @item -Wformat-overflow=2
4686 Level @var{2} warns also about calls that might overflow the destination
4687 buffer given an argument of sufficient length or magnitude. At level
4688 @var{2}, unknown numeric arguments are assumed to have the minimum
4689 representable value for signed types with a precision greater than 1, and
4690 the maximum representable value otherwise. Unknown string arguments whose
4691 length cannot be assumed to be bounded either by the directive's precision,
4692 or by a finite set of string literals they may evaluate to, or the character
4693 array they may point to, are assumed to be 1 character long.
4694
4695 At level @var{2}, the call in the example above is again diagnosed, but
4696 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4697 @code{%i} directive will write some of its digits beyond the end of
4698 the destination buffer. To make the call safe regardless of the values
4699 of the two variables, the size of the destination buffer must be increased
4700 to at least 34 bytes. GCC includes the minimum size of the buffer in
4701 an informational note following the warning.
4702
4703 An alternative to increasing the size of the destination buffer is to
4704 constrain the range of formatted values. The maximum length of string
4705 arguments can be bounded by specifying the precision in the format
4706 directive. When numeric arguments of format directives can be assumed
4707 to be bounded by less than the precision of their type, choosing
4708 an appropriate length modifier to the format specifier will reduce
4709 the required buffer size. For example, if @var{a} and @var{b} in the
4710 example above can be assumed to be within the precision of
4711 the @code{short int} type then using either the @code{%hi} format
4712 directive or casting the argument to @code{short} reduces the maximum
4713 required size of the buffer to 24 bytes.
4714
4715 @smallexample
4716 void f (int a, int b)
4717 @{
4718 char buf [23];
4719 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4720 @}
4721 @end smallexample
4722 @end table
4723
4724 @item -Wno-format-zero-length
4725 @opindex Wno-format-zero-length
4726 @opindex Wformat-zero-length
4727 If @option{-Wformat} is specified, do not warn about zero-length formats.
4728 The C standard specifies that zero-length formats are allowed.
4729
4730
4731 @item -Wformat=2
4732 @opindex Wformat=2
4733 Enable @option{-Wformat} plus additional format checks. Currently
4734 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4735 -Wformat-y2k}.
4736
4737 @item -Wformat-nonliteral
4738 @opindex Wformat-nonliteral
4739 @opindex Wno-format-nonliteral
4740 If @option{-Wformat} is specified, also warn if the format string is not a
4741 string literal and so cannot be checked, unless the format function
4742 takes its format arguments as a @code{va_list}.
4743
4744 @item -Wformat-security
4745 @opindex Wformat-security
4746 @opindex Wno-format-security
4747 If @option{-Wformat} is specified, also warn about uses of format
4748 functions that represent possible security problems. At present, this
4749 warns about calls to @code{printf} and @code{scanf} functions where the
4750 format string is not a string literal and there are no format arguments,
4751 as in @code{printf (foo);}. This may be a security hole if the format
4752 string came from untrusted input and contains @samp{%n}. (This is
4753 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4754 in future warnings may be added to @option{-Wformat-security} that are not
4755 included in @option{-Wformat-nonliteral}.)
4756
4757 @item -Wformat-signedness
4758 @opindex Wformat-signedness
4759 @opindex Wno-format-signedness
4760 If @option{-Wformat} is specified, also warn if the format string
4761 requires an unsigned argument and the argument is signed and vice versa.
4762
4763 @item -Wformat-truncation
4764 @itemx -Wformat-truncation=@var{level}
4765 @opindex Wformat-truncation
4766 @opindex Wno-format-truncation
4767 Warn about calls to formatted input/output functions such as @code{snprintf}
4768 and @code{vsnprintf} that might result in output truncation. When the exact
4769 number of bytes written by a format directive cannot be determined at
4770 compile-time it is estimated based on heuristics that depend on
4771 the @var{level} argument and on optimization. While enabling optimization
4772 will in most cases improve the accuracy of the warning, it may also result
4773 in false positives. Except as noted otherwise, the option uses the same
4774 logic @option{-Wformat-overflow}.
4775
4776 @table @gcctabopt
4777 @item -Wformat-truncation
4778 @itemx -Wformat-truncation=1
4779 @opindex Wformat-truncation
4780 @opindex Wno-format-truncation
4781 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4782 employs a conservative approach that warns only about calls to bounded
4783 functions whose return value is unused and that will most likely result
4784 in output truncation.
4785
4786 @item -Wformat-truncation=2
4787 Level @var{2} warns also about calls to bounded functions whose return
4788 value is used and that might result in truncation given an argument of
4789 sufficient length or magnitude.
4790 @end table
4791
4792 @item -Wformat-y2k
4793 @opindex Wformat-y2k
4794 @opindex Wno-format-y2k
4795 If @option{-Wformat} is specified, also warn about @code{strftime}
4796 formats that may yield only a two-digit year.
4797 @end table
4798
4799 @item -Wnonnull
4800 @opindex Wnonnull
4801 @opindex Wno-nonnull
4802 Warn about passing a null pointer for arguments marked as
4803 requiring a non-null value by the @code{nonnull} function attribute.
4804
4805 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4806 can be disabled with the @option{-Wno-nonnull} option.
4807
4808 @item -Wnonnull-compare
4809 @opindex Wnonnull-compare
4810 @opindex Wno-nonnull-compare
4811 Warn when comparing an argument marked with the @code{nonnull}
4812 function attribute against null inside the function.
4813
4814 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4815 can be disabled with the @option{-Wno-nonnull-compare} option.
4816
4817 @item -Wnull-dereference
4818 @opindex Wnull-dereference
4819 @opindex Wno-null-dereference
4820 Warn if the compiler detects paths that trigger erroneous or
4821 undefined behavior due to dereferencing a null pointer. This option
4822 is only active when @option{-fdelete-null-pointer-checks} is active,
4823 which is enabled by optimizations in most targets. The precision of
4824 the warnings depends on the optimization options used.
4825
4826 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4827 @opindex Winaccessible-base
4828 @opindex Wno-inaccessible-base
4829 Warn when a base class is inaccessible in a class derived from it due to
4830 ambiguity. The warning is enabled by default. Note the warning for virtual
4831 bases is enabled by the @option{-Wextra} option.
4832 @smallexample
4833 @group
4834 struct A @{ int a; @};
4835
4836 struct B : A @{ @};
4837
4838 struct C : B, A @{ @};
4839 @end group
4840 @end smallexample
4841
4842 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4843 @opindex Winit-self
4844 @opindex Wno-init-self
4845 Warn about uninitialized variables that are initialized with themselves.
4846 Note this option can only be used with the @option{-Wuninitialized} option.
4847
4848 For example, GCC warns about @code{i} being uninitialized in the
4849 following snippet only when @option{-Winit-self} has been specified:
4850 @smallexample
4851 @group
4852 int f()
4853 @{
4854 int i = i;
4855 return i;
4856 @}
4857 @end group
4858 @end smallexample
4859
4860 This warning is enabled by @option{-Wall} in C++.
4861
4862 @item -Wimplicit-int @r{(C and Objective-C only)}
4863 @opindex Wimplicit-int
4864 @opindex Wno-implicit-int
4865 Warn when a declaration does not specify a type.
4866 This warning is enabled by @option{-Wall}.
4867
4868 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4869 @opindex Wimplicit-function-declaration
4870 @opindex Wno-implicit-function-declaration
4871 Give a warning whenever a function is used before being declared. In
4872 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4873 enabled by default and it is made into an error by
4874 @option{-pedantic-errors}. This warning is also enabled by
4875 @option{-Wall}.
4876
4877 @item -Wimplicit @r{(C and Objective-C only)}
4878 @opindex Wimplicit
4879 @opindex Wno-implicit
4880 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4881 This warning is enabled by @option{-Wall}.
4882
4883 @item -Wimplicit-fallthrough
4884 @opindex Wimplicit-fallthrough
4885 @opindex Wno-implicit-fallthrough
4886 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4887 and @option{-Wno-implicit-fallthrough} is the same as
4888 @option{-Wimplicit-fallthrough=0}.
4889
4890 @item -Wimplicit-fallthrough=@var{n}
4891 @opindex Wimplicit-fallthrough=
4892 Warn when a switch case falls through. For example:
4893
4894 @smallexample
4895 @group
4896 switch (cond)
4897 @{
4898 case 1:
4899 a = 1;
4900 break;
4901 case 2:
4902 a = 2;
4903 case 3:
4904 a = 3;
4905 break;
4906 @}
4907 @end group
4908 @end smallexample
4909
4910 This warning does not warn when the last statement of a case cannot
4911 fall through, e.g. when there is a return statement or a call to function
4912 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4913 also takes into account control flow statements, such as ifs, and only
4914 warns when appropriate. E.g.@:
4915
4916 @smallexample
4917 @group
4918 switch (cond)
4919 @{
4920 case 1:
4921 if (i > 3) @{
4922 bar (5);
4923 break;
4924 @} else if (i < 1) @{
4925 bar (0);
4926 @} else
4927 return;
4928 default:
4929 @dots{}
4930 @}
4931 @end group
4932 @end smallexample
4933
4934 Since there are occasions where a switch case fall through is desirable,
4935 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4936 to be used along with a null statement to suppress this warning that
4937 would normally occur:
4938
4939 @smallexample
4940 @group
4941 switch (cond)
4942 @{
4943 case 1:
4944 bar (0);
4945 __attribute__ ((fallthrough));
4946 default:
4947 @dots{}
4948 @}
4949 @end group
4950 @end smallexample
4951
4952 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4953 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4954 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4955 Instead of these attributes, it is also possible to add a fallthrough comment
4956 to silence the warning. The whole body of the C or C++ style comment should
4957 match the given regular expressions listed below. The option argument @var{n}
4958 specifies what kind of comments are accepted:
4959
4960 @itemize @bullet
4961
4962 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4963
4964 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4965 expression, any comment is used as fallthrough comment.
4966
4967 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4968 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4969
4970 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4971 following regular expressions:
4972
4973 @itemize @bullet
4974
4975 @item @code{-fallthrough}
4976
4977 @item @code{@@fallthrough@@}
4978
4979 @item @code{lint -fallthrough[ \t]*}
4980
4981 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4982
4983 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4984
4985 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4986
4987 @end itemize
4988
4989 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4990 following regular expressions:
4991
4992 @itemize @bullet
4993
4994 @item @code{-fallthrough}
4995
4996 @item @code{@@fallthrough@@}
4997
4998 @item @code{lint -fallthrough[ \t]*}
4999
5000 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5001
5002 @end itemize
5003
5004 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5005 fallthrough comments, only attributes disable the warning.
5006
5007 @end itemize
5008
5009 The comment needs to be followed after optional whitespace and other comments
5010 by @code{case} or @code{default} keywords or by a user label that precedes some
5011 @code{case} or @code{default} label.
5012
5013 @smallexample
5014 @group
5015 switch (cond)
5016 @{
5017 case 1:
5018 bar (0);
5019 /* FALLTHRU */
5020 default:
5021 @dots{}
5022 @}
5023 @end group
5024 @end smallexample
5025
5026 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5027
5028 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5029 @opindex Wif-not-aligned
5030 @opindex Wno-if-not-aligned
5031 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5032 should be issued. This is enabled by default.
5033 Use @option{-Wno-if-not-aligned} to disable it.
5034
5035 @item -Wignored-qualifiers @r{(C and C++ only)}
5036 @opindex Wignored-qualifiers
5037 @opindex Wno-ignored-qualifiers
5038 Warn if the return type of a function has a type qualifier
5039 such as @code{const}. For ISO C such a type qualifier has no effect,
5040 since the value returned by a function is not an lvalue.
5041 For C++, the warning is only emitted for scalar types or @code{void}.
5042 ISO C prohibits qualified @code{void} return types on function
5043 definitions, so such return types always receive a warning
5044 even without this option.
5045
5046 This warning is also enabled by @option{-Wextra}.
5047
5048 @item -Wignored-attributes @r{(C and C++ only)}
5049 @opindex Wignored-attributes
5050 @opindex Wno-ignored-attributes
5051 Warn when an attribute is ignored. This is different from the
5052 @option{-Wattributes} option in that it warns whenever the compiler decides
5053 to drop an attribute, not that the attribute is either unknown, used in a
5054 wrong place, etc. This warning is enabled by default.
5055
5056 @item -Wmain
5057 @opindex Wmain
5058 @opindex Wno-main
5059 Warn if the type of @code{main} is suspicious. @code{main} should be
5060 a function with external linkage, returning int, taking either zero
5061 arguments, two, or three arguments of appropriate types. This warning
5062 is enabled by default in C++ and is enabled by either @option{-Wall}
5063 or @option{-Wpedantic}.
5064
5065 @item -Wmisleading-indentation @r{(C and C++ only)}
5066 @opindex Wmisleading-indentation
5067 @opindex Wno-misleading-indentation
5068 Warn when the indentation of the code does not reflect the block structure.
5069 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5070 @code{for} clauses with a guarded statement that does not use braces,
5071 followed by an unguarded statement with the same indentation.
5072
5073 In the following example, the call to ``bar'' is misleadingly indented as
5074 if it were guarded by the ``if'' conditional.
5075
5076 @smallexample
5077 if (some_condition ())
5078 foo ();
5079 bar (); /* Gotcha: this is not guarded by the "if". */
5080 @end smallexample
5081
5082 In the case of mixed tabs and spaces, the warning uses the
5083 @option{-ftabstop=} option to determine if the statements line up
5084 (defaulting to 8).
5085
5086 The warning is not issued for code involving multiline preprocessor logic
5087 such as the following example.
5088
5089 @smallexample
5090 if (flagA)
5091 foo (0);
5092 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5093 if (flagB)
5094 #endif
5095 foo (1);
5096 @end smallexample
5097
5098 The warning is not issued after a @code{#line} directive, since this
5099 typically indicates autogenerated code, and no assumptions can be made
5100 about the layout of the file that the directive references.
5101
5102 This warning is enabled by @option{-Wall} in C and C++.
5103
5104 @item -Wmissing-attributes
5105 @opindex Wmissing-attributes
5106 @opindex Wno-missing-attributes
5107 Warn when a declaration of a function is missing one or more attributes
5108 that a related function is declared with and whose absence may adversely
5109 affect the correctness or efficiency of generated code. For example,
5110 the warning is issued for declarations of aliases that use attributes
5111 to specify less restrictive requirements than those of their targets.
5112 This typically represents a potential optimization opportunity.
5113 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5114 issued when the alias is more restrictive than the target, which could
5115 lead to incorrect code generation.
5116 Attributes considered include @code{alloc_align}, @code{alloc_size},
5117 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5118 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5119 @code{returns_nonnull}, and @code{returns_twice}.
5120
5121 In C++, the warning is issued when an explicit specialization of a primary
5122 template declared with attribute @code{alloc_align}, @code{alloc_size},
5123 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5124 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5125 @code{error}, and @code{warning} suppress the warning.
5126 (@pxref{Function Attributes}).
5127
5128 You can use the @code{copy} attribute to apply the same
5129 set of attributes to a declaration as that on another declaration without
5130 explicitly enumerating the attributes. This attribute can be applied
5131 to declarations of functions (@pxref{Common Function Attributes}),
5132 variables (@pxref{Common Variable Attributes}), or types
5133 (@pxref{Common Type Attributes}).
5134
5135 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5136
5137 For example, since the declaration of the primary function template
5138 below makes use of both attribute @code{malloc} and @code{alloc_size}
5139 the declaration of the explicit specialization of the template is
5140 diagnosed because it is missing one of the attributes.
5141
5142 @smallexample
5143 template <class T>
5144 T* __attribute__ ((malloc, alloc_size (1)))
5145 allocate (size_t);
5146
5147 template <>
5148 void* __attribute__ ((malloc)) // missing alloc_size
5149 allocate<void> (size_t);
5150 @end smallexample
5151
5152 @item -Wmissing-braces
5153 @opindex Wmissing-braces
5154 @opindex Wno-missing-braces
5155 Warn if an aggregate or union initializer is not fully bracketed. In
5156 the following example, the initializer for @code{a} is not fully
5157 bracketed, but that for @code{b} is fully bracketed. This warning is
5158 enabled by @option{-Wall} in C.
5159
5160 @smallexample
5161 int a[2][2] = @{ 0, 1, 2, 3 @};
5162 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5163 @end smallexample
5164
5165 This warning is enabled by @option{-Wall}.
5166
5167 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5168 @opindex Wmissing-include-dirs
5169 @opindex Wno-missing-include-dirs
5170 Warn if a user-supplied include directory does not exist.
5171
5172 @item -Wmissing-profile
5173 @opindex Wmissing-profile
5174 @opindex Wno-missing-profile
5175 Warn if feedback profiles are missing when using the
5176 @option{-fprofile-use} option.
5177 This option diagnoses those cases where a new function or a new file is added
5178 to the user code between compiling with @option{-fprofile-generate} and with
5179 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5180 profile feedback data files do not contain any profile feedback information for
5181 the newly added function or file respectively. Also, in the case when profile
5182 count data (.gcda) files are removed, GCC cannot use any profile feedback
5183 information. In all these cases, warnings are issued to inform the user that a
5184 profile generation step is due. @option{-Wno-missing-profile} can be used to
5185 disable the warning. Ignoring the warning can result in poorly optimized code.
5186 Completely disabling the warning is not recommended and should be done only
5187 when non-existent profile data is justified.
5188
5189 @item -Wmultistatement-macros
5190 @opindex Wmultistatement-macros
5191 @opindex Wno-multistatement-macros
5192 Warn about unsafe multiple statement macros that appear to be guarded
5193 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5194 @code{while}, in which only the first statement is actually guarded after
5195 the macro is expanded.
5196
5197 For example:
5198
5199 @smallexample
5200 #define DOIT x++; y++
5201 if (c)
5202 DOIT;
5203 @end smallexample
5204
5205 will increment @code{y} unconditionally, not just when @code{c} holds.
5206 The can usually be fixed by wrapping the macro in a do-while loop:
5207 @smallexample
5208 #define DOIT do @{ x++; y++; @} while (0)
5209 if (c)
5210 DOIT;
5211 @end smallexample
5212
5213 This warning is enabled by @option{-Wall} in C and C++.
5214
5215 @item -Wparentheses
5216 @opindex Wparentheses
5217 @opindex Wno-parentheses
5218 Warn if parentheses are omitted in certain contexts, such
5219 as when there is an assignment in a context where a truth value
5220 is expected, or when operators are nested whose precedence people
5221 often get confused about.
5222
5223 Also warn if a comparison like @code{x<=y<=z} appears; this is
5224 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5225 interpretation from that of ordinary mathematical notation.
5226
5227 Also warn for dangerous uses of the GNU extension to
5228 @code{?:} with omitted middle operand. When the condition
5229 in the @code{?}: operator is a boolean expression, the omitted value is
5230 always 1. Often programmers expect it to be a value computed
5231 inside the conditional expression instead.
5232
5233 For C++ this also warns for some cases of unnecessary parentheses in
5234 declarations, which can indicate an attempt at a function call instead
5235 of a declaration:
5236 @smallexample
5237 @{
5238 // Declares a local variable called mymutex.
5239 std::unique_lock<std::mutex> (mymutex);
5240 // User meant std::unique_lock<std::mutex> lock (mymutex);
5241 @}
5242 @end smallexample
5243
5244 This warning is enabled by @option{-Wall}.
5245
5246 @item -Wsequence-point
5247 @opindex Wsequence-point
5248 @opindex Wno-sequence-point
5249 Warn about code that may have undefined semantics because of violations
5250 of sequence point rules in the C and C++ standards.
5251
5252 The C and C++ standards define the order in which expressions in a C/C++
5253 program are evaluated in terms of @dfn{sequence points}, which represent
5254 a partial ordering between the execution of parts of the program: those
5255 executed before the sequence point, and those executed after it. These
5256 occur after the evaluation of a full expression (one which is not part
5257 of a larger expression), after the evaluation of the first operand of a
5258 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5259 function is called (but after the evaluation of its arguments and the
5260 expression denoting the called function), and in certain other places.
5261 Other than as expressed by the sequence point rules, the order of
5262 evaluation of subexpressions of an expression is not specified. All
5263 these rules describe only a partial order rather than a total order,
5264 since, for example, if two functions are called within one expression
5265 with no sequence point between them, the order in which the functions
5266 are called is not specified. However, the standards committee have
5267 ruled that function calls do not overlap.
5268
5269 It is not specified when between sequence points modifications to the
5270 values of objects take effect. Programs whose behavior depends on this
5271 have undefined behavior; the C and C++ standards specify that ``Between
5272 the previous and next sequence point an object shall have its stored
5273 value modified at most once by the evaluation of an expression.
5274 Furthermore, the prior value shall be read only to determine the value
5275 to be stored.''. If a program breaks these rules, the results on any
5276 particular implementation are entirely unpredictable.
5277
5278 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5279 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5280 diagnosed by this option, and it may give an occasional false positive
5281 result, but in general it has been found fairly effective at detecting
5282 this sort of problem in programs.
5283
5284 The C++17 standard will define the order of evaluation of operands in
5285 more cases: in particular it requires that the right-hand side of an
5286 assignment be evaluated before the left-hand side, so the above
5287 examples are no longer undefined. But this warning will still warn
5288 about them, to help people avoid writing code that is undefined in C
5289 and earlier revisions of C++.
5290
5291 The standard is worded confusingly, therefore there is some debate
5292 over the precise meaning of the sequence point rules in subtle cases.
5293 Links to discussions of the problem, including proposed formal
5294 definitions, may be found on the GCC readings page, at
5295 @uref{http://gcc.gnu.org/@/readings.html}.
5296
5297 This warning is enabled by @option{-Wall} for C and C++.
5298
5299 @item -Wno-return-local-addr
5300 @opindex Wno-return-local-addr
5301 @opindex Wreturn-local-addr
5302 Do not warn about returning a pointer (or in C++, a reference) to a
5303 variable that goes out of scope after the function returns.
5304
5305 @item -Wreturn-type
5306 @opindex Wreturn-type
5307 @opindex Wno-return-type
5308 Warn whenever a function is defined with a return type that defaults
5309 to @code{int}. Also warn about any @code{return} statement with no
5310 return value in a function whose return type is not @code{void}
5311 (falling off the end of the function body is considered returning
5312 without a value).
5313
5314 For C only, warn about a @code{return} statement with an expression in a
5315 function whose return type is @code{void}, unless the expression type is
5316 also @code{void}. As a GNU extension, the latter case is accepted
5317 without a warning unless @option{-Wpedantic} is used. Attempting
5318 to use the return value of a non-@code{void} function other than @code{main}
5319 that flows off the end by reaching the closing curly brace that terminates
5320 the function is undefined.
5321
5322 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5323 than @code{main} results in undefined behavior even when the value of
5324 the function is not used.
5325
5326 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5327
5328 @item -Wshift-count-negative
5329 @opindex Wshift-count-negative
5330 @opindex Wno-shift-count-negative
5331 Warn if shift count is negative. This warning is enabled by default.
5332
5333 @item -Wshift-count-overflow
5334 @opindex Wshift-count-overflow
5335 @opindex Wno-shift-count-overflow
5336 Warn if shift count >= width of type. This warning is enabled by default.
5337
5338 @item -Wshift-negative-value
5339 @opindex Wshift-negative-value
5340 @opindex Wno-shift-negative-value
5341 Warn if left shifting a negative value. This warning is enabled by
5342 @option{-Wextra} in C99 and C++11 modes (and newer).
5343
5344 @item -Wshift-overflow
5345 @itemx -Wshift-overflow=@var{n}
5346 @opindex Wshift-overflow
5347 @opindex Wno-shift-overflow
5348 Warn about left shift overflows. This warning is enabled by
5349 default in C99 and C++11 modes (and newer).
5350
5351 @table @gcctabopt
5352 @item -Wshift-overflow=1
5353 This is the warning level of @option{-Wshift-overflow} and is enabled
5354 by default in C99 and C++11 modes (and newer). This warning level does
5355 not warn about left-shifting 1 into the sign bit. (However, in C, such
5356 an overflow is still rejected in contexts where an integer constant expression
5357 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5358 shifts always wrap.
5359
5360 @item -Wshift-overflow=2
5361 This warning level also warns about left-shifting 1 into the sign bit,
5362 unless C++14 mode (or newer) is active.
5363 @end table
5364
5365 @item -Wswitch
5366 @opindex Wswitch
5367 @opindex Wno-switch
5368 Warn whenever a @code{switch} statement has an index of enumerated type
5369 and lacks a @code{case} for one or more of the named codes of that
5370 enumeration. (The presence of a @code{default} label prevents this
5371 warning.) @code{case} labels outside the enumeration range also
5372 provoke warnings when this option is used (even if there is a
5373 @code{default} label).
5374 This warning is enabled by @option{-Wall}.
5375
5376 @item -Wswitch-default
5377 @opindex Wswitch-default
5378 @opindex Wno-switch-default
5379 Warn whenever a @code{switch} statement does not have a @code{default}
5380 case.
5381
5382 @item -Wswitch-enum
5383 @opindex Wswitch-enum
5384 @opindex Wno-switch-enum
5385 Warn whenever a @code{switch} statement has an index of enumerated type
5386 and lacks a @code{case} for one or more of the named codes of that
5387 enumeration. @code{case} labels outside the enumeration range also
5388 provoke warnings when this option is used. The only difference
5389 between @option{-Wswitch} and this option is that this option gives a
5390 warning about an omitted enumeration code even if there is a
5391 @code{default} label.
5392
5393 @item -Wswitch-bool
5394 @opindex Wswitch-bool
5395 @opindex Wno-switch-bool
5396 Warn whenever a @code{switch} statement has an index of boolean type
5397 and the case values are outside the range of a boolean type.
5398 It is possible to suppress this warning by casting the controlling
5399 expression to a type other than @code{bool}. For example:
5400 @smallexample
5401 @group
5402 switch ((int) (a == 4))
5403 @{
5404 @dots{}
5405 @}
5406 @end group
5407 @end smallexample
5408 This warning is enabled by default for C and C++ programs.
5409
5410 @item -Wswitch-outside-range
5411 @opindex Wswitch-outside-range
5412 @opindex Wno-switch-outside-range
5413 Warn whenever a @code{switch} case has a value that is outside of its
5414 respective type range. This warning is enabled by default for
5415 C and C++ programs.
5416
5417 @item -Wswitch-unreachable
5418 @opindex Wswitch-unreachable
5419 @opindex Wno-switch-unreachable
5420 Warn whenever a @code{switch} statement contains statements between the
5421 controlling expression and the first case label, which will never be
5422 executed. For example:
5423 @smallexample
5424 @group
5425 switch (cond)
5426 @{
5427 i = 15;
5428 @dots{}
5429 case 5:
5430 @dots{}
5431 @}
5432 @end group
5433 @end smallexample
5434 @option{-Wswitch-unreachable} does not warn if the statement between the
5435 controlling expression and the first case label is just a declaration:
5436 @smallexample
5437 @group
5438 switch (cond)
5439 @{
5440 int i;
5441 @dots{}
5442 case 5:
5443 i = 5;
5444 @dots{}
5445 @}
5446 @end group
5447 @end smallexample
5448 This warning is enabled by default for C and C++ programs.
5449
5450 @item -Wsync-nand @r{(C and C++ only)}
5451 @opindex Wsync-nand
5452 @opindex Wno-sync-nand
5453 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5454 built-in functions are used. These functions changed semantics in GCC 4.4.
5455
5456 @item -Wunused-but-set-parameter
5457 @opindex Wunused-but-set-parameter
5458 @opindex Wno-unused-but-set-parameter
5459 Warn whenever a function parameter is assigned to, but otherwise unused
5460 (aside from its declaration).
5461
5462 To suppress this warning use the @code{unused} attribute
5463 (@pxref{Variable Attributes}).
5464
5465 This warning is also enabled by @option{-Wunused} together with
5466 @option{-Wextra}.
5467
5468 @item -Wunused-but-set-variable
5469 @opindex Wunused-but-set-variable
5470 @opindex Wno-unused-but-set-variable
5471 Warn whenever a local variable is assigned to, but otherwise unused
5472 (aside from its declaration).
5473 This warning is enabled by @option{-Wall}.
5474
5475 To suppress this warning use the @code{unused} attribute
5476 (@pxref{Variable Attributes}).
5477
5478 This warning is also enabled by @option{-Wunused}, which is enabled
5479 by @option{-Wall}.
5480
5481 @item -Wunused-function
5482 @opindex Wunused-function
5483 @opindex Wno-unused-function
5484 Warn whenever a static function is declared but not defined or a
5485 non-inline static function is unused.
5486 This warning is enabled by @option{-Wall}.
5487
5488 @item -Wunused-label
5489 @opindex Wunused-label
5490 @opindex Wno-unused-label
5491 Warn whenever a label is declared but not used.
5492 This warning is enabled by @option{-Wall}.
5493
5494 To suppress this warning use the @code{unused} attribute
5495 (@pxref{Variable Attributes}).
5496
5497 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5498 @opindex Wunused-local-typedefs
5499 @opindex Wno-unused-local-typedefs
5500 Warn when a typedef locally defined in a function is not used.
5501 This warning is enabled by @option{-Wall}.
5502
5503 @item -Wunused-parameter
5504 @opindex Wunused-parameter
5505 @opindex Wno-unused-parameter
5506 Warn whenever a function parameter is unused aside from its declaration.
5507
5508 To suppress this warning use the @code{unused} attribute
5509 (@pxref{Variable Attributes}).
5510
5511 @item -Wno-unused-result
5512 @opindex Wunused-result
5513 @opindex Wno-unused-result
5514 Do not warn if a caller of a function marked with attribute
5515 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5516 its return value. The default is @option{-Wunused-result}.
5517
5518 @item -Wunused-variable
5519 @opindex Wunused-variable
5520 @opindex Wno-unused-variable
5521 Warn whenever a local or static variable is unused aside from its
5522 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5523 but not for C++. This warning is enabled by @option{-Wall}.
5524
5525 To suppress this warning use the @code{unused} attribute
5526 (@pxref{Variable Attributes}).
5527
5528 @item -Wunused-const-variable
5529 @itemx -Wunused-const-variable=@var{n}
5530 @opindex Wunused-const-variable
5531 @opindex Wno-unused-const-variable
5532 Warn whenever a constant static variable is unused aside from its declaration.
5533 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5534 for C, but not for C++. In C this declares variable storage, but in C++ this
5535 is not an error since const variables take the place of @code{#define}s.
5536
5537 To suppress this warning use the @code{unused} attribute
5538 (@pxref{Variable Attributes}).
5539
5540 @table @gcctabopt
5541 @item -Wunused-const-variable=1
5542 This is the warning level that is enabled by @option{-Wunused-variable} for
5543 C. It warns only about unused static const variables defined in the main
5544 compilation unit, but not about static const variables declared in any
5545 header included.
5546
5547 @item -Wunused-const-variable=2
5548 This warning level also warns for unused constant static variables in
5549 headers (excluding system headers). This is the warning level of
5550 @option{-Wunused-const-variable} and must be explicitly requested since
5551 in C++ this isn't an error and in C it might be harder to clean up all
5552 headers included.
5553 @end table
5554
5555 @item -Wunused-value
5556 @opindex Wunused-value
5557 @opindex Wno-unused-value
5558 Warn whenever a statement computes a result that is explicitly not
5559 used. To suppress this warning cast the unused expression to
5560 @code{void}. This includes an expression-statement or the left-hand
5561 side of a comma expression that contains no side effects. For example,
5562 an expression such as @code{x[i,j]} causes a warning, while
5563 @code{x[(void)i,j]} does not.
5564
5565 This warning is enabled by @option{-Wall}.
5566
5567 @item -Wunused
5568 @opindex Wunused
5569 @opindex Wno-unused
5570 All the above @option{-Wunused} options combined.
5571
5572 In order to get a warning about an unused function parameter, you must
5573 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5574 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5575
5576 @item -Wuninitialized
5577 @opindex Wuninitialized
5578 @opindex Wno-uninitialized
5579 Warn if an automatic variable is used without first being initialized
5580 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5581 warn if a non-static reference or non-static @code{const} member
5582 appears in a class without constructors.
5583
5584 If you want to warn about code that uses the uninitialized value of the
5585 variable in its own initializer, use the @option{-Winit-self} option.
5586
5587 These warnings occur for individual uninitialized or clobbered
5588 elements of structure, union or array variables as well as for
5589 variables that are uninitialized or clobbered as a whole. They do
5590 not occur for variables or elements declared @code{volatile}. Because
5591 these warnings depend on optimization, the exact variables or elements
5592 for which there are warnings depends on the precise optimization
5593 options and version of GCC used.
5594
5595 Note that there may be no warning about a variable that is used only
5596 to compute a value that itself is never used, because such
5597 computations may be deleted by data flow analysis before the warnings
5598 are printed.
5599
5600 @item -Winvalid-memory-model
5601 @opindex Winvalid-memory-model
5602 @opindex Wno-invalid-memory-model
5603 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5604 and the C11 atomic generic functions with a memory consistency argument
5605 that is either invalid for the operation or outside the range of values
5606 of the @code{memory_order} enumeration. For example, since the
5607 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5608 defined for the relaxed, release, and sequentially consistent memory
5609 orders the following code is diagnosed:
5610
5611 @smallexample
5612 void store (int *i)
5613 @{
5614 __atomic_store_n (i, 0, memory_order_consume);
5615 @}
5616 @end smallexample
5617
5618 @option{-Winvalid-memory-model} is enabled by default.
5619
5620 @item -Wmaybe-uninitialized
5621 @opindex Wmaybe-uninitialized
5622 @opindex Wno-maybe-uninitialized
5623 For an automatic (i.e.@: local) variable, if there exists a path from the
5624 function entry to a use of the variable that is initialized, but there exist
5625 some other paths for which the variable is not initialized, the compiler
5626 emits a warning if it cannot prove the uninitialized paths are not
5627 executed at run time.
5628
5629 These warnings are only possible in optimizing compilation, because otherwise
5630 GCC does not keep track of the state of variables.
5631
5632 These warnings are made optional because GCC may not be able to determine when
5633 the code is correct in spite of appearing to have an error. Here is one
5634 example of how this can happen:
5635
5636 @smallexample
5637 @group
5638 @{
5639 int x;
5640 switch (y)
5641 @{
5642 case 1: x = 1;
5643 break;
5644 case 2: x = 4;
5645 break;
5646 case 3: x = 5;
5647 @}
5648 foo (x);
5649 @}
5650 @end group
5651 @end smallexample
5652
5653 @noindent
5654 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5655 always initialized, but GCC doesn't know this. To suppress the
5656 warning, you need to provide a default case with assert(0) or
5657 similar code.
5658
5659 @cindex @code{longjmp} warnings
5660 This option also warns when a non-volatile automatic variable might be
5661 changed by a call to @code{longjmp}.
5662 The compiler sees only the calls to @code{setjmp}. It cannot know
5663 where @code{longjmp} will be called; in fact, a signal handler could
5664 call it at any point in the code. As a result, you may get a warning
5665 even when there is in fact no problem because @code{longjmp} cannot
5666 in fact be called at the place that would cause a problem.
5667
5668 Some spurious warnings can be avoided if you declare all the functions
5669 you use that never return as @code{noreturn}. @xref{Function
5670 Attributes}.
5671
5672 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5673
5674 @item -Wunknown-pragmas
5675 @opindex Wunknown-pragmas
5676 @opindex Wno-unknown-pragmas
5677 @cindex warning for unknown pragmas
5678 @cindex unknown pragmas, warning
5679 @cindex pragmas, warning of unknown
5680 Warn when a @code{#pragma} directive is encountered that is not understood by
5681 GCC@. If this command-line option is used, warnings are even issued
5682 for unknown pragmas in system header files. This is not the case if
5683 the warnings are only enabled by the @option{-Wall} command-line option.
5684
5685 @item -Wno-pragmas
5686 @opindex Wno-pragmas
5687 @opindex Wpragmas
5688 Do not warn about misuses of pragmas, such as incorrect parameters,
5689 invalid syntax, or conflicts between pragmas. See also
5690 @option{-Wunknown-pragmas}.
5691
5692 @item -Wno-prio-ctor-dtor
5693 @opindex Wno-prio-ctor-dtor
5694 @opindex Wprio-ctor-dtor
5695 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5696 The use of constructor and destructor attributes allow you to assign a
5697 priority to the constructor/destructor to control its order of execution
5698 before @code{main} is called or after it returns. The priority values must be
5699 greater than 100 as the compiler reserves priority values between 0--100 for
5700 the implementation.
5701
5702 @item -Wstrict-aliasing
5703 @opindex Wstrict-aliasing
5704 @opindex Wno-strict-aliasing
5705 This option is only active when @option{-fstrict-aliasing} is active.
5706 It warns about code that might break the strict aliasing rules that the
5707 compiler is using for optimization. The warning does not catch all
5708 cases, but does attempt to catch the more common pitfalls. It is
5709 included in @option{-Wall}.
5710 It is equivalent to @option{-Wstrict-aliasing=3}
5711
5712 @item -Wstrict-aliasing=n
5713 @opindex Wstrict-aliasing=n
5714 This option is only active when @option{-fstrict-aliasing} is active.
5715 It warns about code that might break the strict aliasing rules that the
5716 compiler is using for optimization.
5717 Higher levels correspond to higher accuracy (fewer false positives).
5718 Higher levels also correspond to more effort, similar to the way @option{-O}
5719 works.
5720 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5721
5722 Level 1: Most aggressive, quick, least accurate.
5723 Possibly useful when higher levels
5724 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5725 false negatives. However, it has many false positives.
5726 Warns for all pointer conversions between possibly incompatible types,
5727 even if never dereferenced. Runs in the front end only.
5728
5729 Level 2: Aggressive, quick, not too precise.
5730 May still have many false positives (not as many as level 1 though),
5731 and few false negatives (but possibly more than level 1).
5732 Unlike level 1, it only warns when an address is taken. Warns about
5733 incomplete types. Runs in the front end only.
5734
5735 Level 3 (default for @option{-Wstrict-aliasing}):
5736 Should have very few false positives and few false
5737 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5738 Takes care of the common pun+dereference pattern in the front end:
5739 @code{*(int*)&some_float}.
5740 If optimization is enabled, it also runs in the back end, where it deals
5741 with multiple statement cases using flow-sensitive points-to information.
5742 Only warns when the converted pointer is dereferenced.
5743 Does not warn about incomplete types.
5744
5745 @item -Wstrict-overflow
5746 @itemx -Wstrict-overflow=@var{n}
5747 @opindex Wstrict-overflow
5748 @opindex Wno-strict-overflow
5749 This option is only active when signed overflow is undefined.
5750 It warns about cases where the compiler optimizes based on the
5751 assumption that signed overflow does not occur. Note that it does not
5752 warn about all cases where the code might overflow: it only warns
5753 about cases where the compiler implements some optimization. Thus
5754 this warning depends on the optimization level.
5755
5756 An optimization that assumes that signed overflow does not occur is
5757 perfectly safe if the values of the variables involved are such that
5758 overflow never does, in fact, occur. Therefore this warning can
5759 easily give a false positive: a warning about code that is not
5760 actually a problem. To help focus on important issues, several
5761 warning levels are defined. No warnings are issued for the use of
5762 undefined signed overflow when estimating how many iterations a loop
5763 requires, in particular when determining whether a loop will be
5764 executed at all.
5765
5766 @table @gcctabopt
5767 @item -Wstrict-overflow=1
5768 Warn about cases that are both questionable and easy to avoid. For
5769 example the compiler simplifies
5770 @code{x + 1 > x} to @code{1}. This level of
5771 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5772 are not, and must be explicitly requested.
5773
5774 @item -Wstrict-overflow=2
5775 Also warn about other cases where a comparison is simplified to a
5776 constant. For example: @code{abs (x) >= 0}. This can only be
5777 simplified when signed integer overflow is undefined, because
5778 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5779 zero. @option{-Wstrict-overflow} (with no level) is the same as
5780 @option{-Wstrict-overflow=2}.
5781
5782 @item -Wstrict-overflow=3
5783 Also warn about other cases where a comparison is simplified. For
5784 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5785
5786 @item -Wstrict-overflow=4
5787 Also warn about other simplifications not covered by the above cases.
5788 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5789
5790 @item -Wstrict-overflow=5
5791 Also warn about cases where the compiler reduces the magnitude of a
5792 constant involved in a comparison. For example: @code{x + 2 > y} is
5793 simplified to @code{x + 1 >= y}. This is reported only at the
5794 highest warning level because this simplification applies to many
5795 comparisons, so this warning level gives a very large number of
5796 false positives.
5797 @end table
5798
5799 @item -Wstringop-overflow
5800 @itemx -Wstringop-overflow=@var{type}
5801 @opindex Wstringop-overflow
5802 @opindex Wno-stringop-overflow
5803 Warn for calls to string manipulation functions such as @code{memcpy} and
5804 @code{strcpy} that are determined to overflow the destination buffer. The
5805 optional argument is one greater than the type of Object Size Checking to
5806 perform to determine the size of the destination. @xref{Object Size Checking}.
5807 The argument is meaningful only for functions that operate on character arrays
5808 but not for raw memory functions like @code{memcpy} which always make use
5809 of Object Size type-0. The option also warns for calls that specify a size
5810 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5811 The option produces the best results with optimization enabled but can detect
5812 a small subset of simple buffer overflows even without optimization in
5813 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5814 correspond to the standard functions. In any case, the option warns about
5815 just a subset of buffer overflows detected by the corresponding overflow
5816 checking built-ins. For example, the option will issue a warning for
5817 the @code{strcpy} call below because it copies at least 5 characters
5818 (the string @code{"blue"} including the terminating NUL) into the buffer
5819 of size 4.
5820
5821 @smallexample
5822 enum Color @{ blue, purple, yellow @};
5823 const char* f (enum Color clr)
5824 @{
5825 static char buf [4];
5826 const char *str;
5827 switch (clr)
5828 @{
5829 case blue: str = "blue"; break;
5830 case purple: str = "purple"; break;
5831 case yellow: str = "yellow"; break;
5832 @}
5833
5834 return strcpy (buf, str); // warning here
5835 @}
5836 @end smallexample
5837
5838 Option @option{-Wstringop-overflow=2} is enabled by default.
5839
5840 @table @gcctabopt
5841 @item -Wstringop-overflow
5842 @itemx -Wstringop-overflow=1
5843 @opindex Wstringop-overflow
5844 @opindex Wno-stringop-overflow
5845 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5846 to determine the sizes of destination objects. This is the default setting
5847 of the option. At this setting the option will not warn for writes past
5848 the end of subobjects of larger objects accessed by pointers unless the
5849 size of the largest surrounding object is known. When the destination may
5850 be one of several objects it is assumed to be the largest one of them. On
5851 Linux systems, when optimization is enabled at this setting the option warns
5852 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5853 a non-zero value.
5854
5855 @item -Wstringop-overflow=2
5856 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5857 to determine the sizes of destination objects. At this setting the option
5858 will warn about overflows when writing to members of the largest complete
5859 objects whose exact size is known. It will, however, not warn for excessive
5860 writes to the same members of unknown objects referenced by pointers since
5861 they may point to arrays containing unknown numbers of elements.
5862
5863 @item -Wstringop-overflow=3
5864 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5865 to determine the sizes of destination objects. At this setting the option
5866 warns about overflowing the smallest object or data member. This is the
5867 most restrictive setting of the option that may result in warnings for safe
5868 code.
5869
5870 @item -Wstringop-overflow=4
5871 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5872 to determine the sizes of destination objects. At this setting the option
5873 will warn about overflowing any data members, and when the destination is
5874 one of several objects it uses the size of the largest of them to decide
5875 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5876 setting of the option may result in warnings for benign code.
5877 @end table
5878
5879 @item -Wstringop-truncation
5880 @opindex Wstringop-truncation
5881 @opindex Wno-stringop-truncation
5882 Warn for calls to bounded string manipulation functions such as @code{strncat},
5883 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5884 or leave the destination unchanged.
5885
5886 In the following example, the call to @code{strncat} specifies a bound that
5887 is less than the length of the source string. As a result, the copy of
5888 the source will be truncated and so the call is diagnosed. To avoid the
5889 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5890
5891 @smallexample
5892 void append (char *buf, size_t bufsize)
5893 @{
5894 strncat (buf, ".txt", 3);
5895 @}
5896 @end smallexample
5897
5898 As another example, the following call to @code{strncpy} results in copying
5899 to @code{d} just the characters preceding the terminating NUL, without
5900 appending the NUL to the end. Assuming the result of @code{strncpy} is
5901 necessarily a NUL-terminated string is a common mistake, and so the call
5902 is diagnosed. To avoid the warning when the result is not expected to be
5903 NUL-terminated, call @code{memcpy} instead.
5904
5905 @smallexample
5906 void copy (char *d, const char *s)
5907 @{
5908 strncpy (d, s, strlen (s));
5909 @}
5910 @end smallexample
5911
5912 In the following example, the call to @code{strncpy} specifies the size
5913 of the destination buffer as the bound. If the length of the source
5914 string is equal to or greater than this size the result of the copy will
5915 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5916 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5917 element of the buffer to @code{NUL}.
5918
5919 @smallexample
5920 void copy (const char *s)
5921 @{
5922 char buf[80];
5923 strncpy (buf, s, sizeof buf);
5924 @dots{}
5925 @}
5926 @end smallexample
5927
5928 In situations where a character array is intended to store a sequence
5929 of bytes with no terminating @code{NUL} such an array may be annotated
5930 with attribute @code{nonstring} to avoid this warning. Such arrays,
5931 however, are not suitable arguments to functions that expect
5932 @code{NUL}-terminated strings. To help detect accidental misuses of
5933 such arrays GCC issues warnings unless it can prove that the use is
5934 safe. @xref{Common Variable Attributes}.
5935
5936 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5937 @opindex Wsuggest-attribute=
5938 @opindex Wno-suggest-attribute=
5939 Warn for cases where adding an attribute may be beneficial. The
5940 attributes currently supported are listed below.
5941
5942 @table @gcctabopt
5943 @item -Wsuggest-attribute=pure
5944 @itemx -Wsuggest-attribute=const
5945 @itemx -Wsuggest-attribute=noreturn
5946 @itemx -Wmissing-noreturn
5947 @itemx -Wsuggest-attribute=malloc
5948 @opindex Wsuggest-attribute=pure
5949 @opindex Wno-suggest-attribute=pure
5950 @opindex Wsuggest-attribute=const
5951 @opindex Wno-suggest-attribute=const
5952 @opindex Wsuggest-attribute=noreturn
5953 @opindex Wno-suggest-attribute=noreturn
5954 @opindex Wmissing-noreturn
5955 @opindex Wno-missing-noreturn
5956 @opindex Wsuggest-attribute=malloc
5957 @opindex Wno-suggest-attribute=malloc
5958
5959 Warn about functions that might be candidates for attributes
5960 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5961 only warns for functions visible in other compilation units or (in the case of
5962 @code{pure} and @code{const}) if it cannot prove that the function returns
5963 normally. A function returns normally if it doesn't contain an infinite loop or
5964 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5965 requires option @option{-fipa-pure-const}, which is enabled by default at
5966 @option{-O} and higher. Higher optimization levels improve the accuracy
5967 of the analysis.
5968
5969 @item -Wsuggest-attribute=format
5970 @itemx -Wmissing-format-attribute
5971 @opindex Wsuggest-attribute=format
5972 @opindex Wmissing-format-attribute
5973 @opindex Wno-suggest-attribute=format
5974 @opindex Wno-missing-format-attribute
5975 @opindex Wformat
5976 @opindex Wno-format
5977
5978 Warn about function pointers that might be candidates for @code{format}
5979 attributes. Note these are only possible candidates, not absolute ones.
5980 GCC guesses that function pointers with @code{format} attributes that
5981 are used in assignment, initialization, parameter passing or return
5982 statements should have a corresponding @code{format} attribute in the
5983 resulting type. I.e.@: the left-hand side of the assignment or
5984 initialization, the type of the parameter variable, or the return type
5985 of the containing function respectively should also have a @code{format}
5986 attribute to avoid the warning.
5987
5988 GCC also warns about function definitions that might be
5989 candidates for @code{format} attributes. Again, these are only
5990 possible candidates. GCC guesses that @code{format} attributes
5991 might be appropriate for any function that calls a function like
5992 @code{vprintf} or @code{vscanf}, but this might not always be the
5993 case, and some functions for which @code{format} attributes are
5994 appropriate may not be detected.
5995
5996 @item -Wsuggest-attribute=cold
5997 @opindex Wsuggest-attribute=cold
5998 @opindex Wno-suggest-attribute=cold
5999
6000 Warn about functions that might be candidates for @code{cold} attribute. This
6001 is based on static detection and generally will only warn about functions which
6002 always leads to a call to another @code{cold} function such as wrappers of
6003 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6004 @end table
6005
6006 @item -Wsuggest-final-types
6007 @opindex Wno-suggest-final-types
6008 @opindex Wsuggest-final-types
6009 Warn about types with virtual methods where code quality would be improved
6010 if the type were declared with the C++11 @code{final} specifier,
6011 or, if possible,
6012 declared in an anonymous namespace. This allows GCC to more aggressively
6013 devirtualize the polymorphic calls. This warning is more effective with
6014 link-time optimization,
6015 where the information about the class hierarchy graph is
6016 more complete.
6017
6018 @item -Wsuggest-final-methods
6019 @opindex Wno-suggest-final-methods
6020 @opindex Wsuggest-final-methods
6021 Warn about virtual methods where code quality would be improved if the method
6022 were declared with the C++11 @code{final} specifier,
6023 or, if possible, its type were
6024 declared in an anonymous namespace or with the @code{final} specifier.
6025 This warning is
6026 more effective with link-time optimization, where the information about the
6027 class hierarchy graph is more complete. It is recommended to first consider
6028 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6029 annotations.
6030
6031 @item -Wsuggest-override
6032 Warn about overriding virtual functions that are not marked with the override
6033 keyword.
6034
6035 @item -Walloc-zero
6036 @opindex Wno-alloc-zero
6037 @opindex Walloc-zero
6038 Warn about calls to allocation functions decorated with attribute
6039 @code{alloc_size} that specify zero bytes, including those to the built-in
6040 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6041 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6042 when called with a zero size differs among implementations (and in the case
6043 of @code{realloc} has been deprecated) relying on it may result in subtle
6044 portability bugs and should be avoided.
6045
6046 @item -Walloc-size-larger-than=@var{byte-size}
6047 @opindex Walloc-size-larger-than=
6048 @opindex Wno-alloc-size-larger-than
6049 Warn about calls to functions decorated with attribute @code{alloc_size}
6050 that attempt to allocate objects larger than the specified number of bytes,
6051 or where the result of the size computation in an integer type with infinite
6052 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6053 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6054 Warnings controlled by the option can be disabled either by specifying
6055 @var{byte-size} of @samp{SIZE_MAX} or more or by
6056 @option{-Wno-alloc-size-larger-than}.
6057 @xref{Function Attributes}.
6058
6059 @item -Wno-alloc-size-larger-than
6060 @opindex Wno-alloc-size-larger-than
6061 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6062 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6063 larger.
6064
6065 @item -Walloca
6066 @opindex Wno-alloca
6067 @opindex Walloca
6068 This option warns on all uses of @code{alloca} in the source.
6069
6070 @item -Walloca-larger-than=@var{byte-size}
6071 @opindex Walloca-larger-than=
6072 @opindex Wno-alloca-larger-than
6073 This option warns on calls to @code{alloca} with an integer argument whose
6074 value is either zero, or that is not bounded by a controlling predicate
6075 that limits its value to at most @var{byte-size}. It also warns for calls
6076 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6077 types are considered unbounded even if they appear to be constrained to
6078 the expected range.
6079
6080 For example, a bounded case of @code{alloca} could be:
6081
6082 @smallexample
6083 void func (size_t n)
6084 @{
6085 void *p;
6086 if (n <= 1000)
6087 p = alloca (n);
6088 else
6089 p = malloc (n);
6090 f (p);
6091 @}
6092 @end smallexample
6093
6094 In the above example, passing @code{-Walloca-larger-than=1000} would not
6095 issue a warning because the call to @code{alloca} is known to be at most
6096 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6097 the compiler would emit a warning.
6098
6099 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6100 controlling predicate constraining its integer argument. For example:
6101
6102 @smallexample
6103 void func ()
6104 @{
6105 void *p = alloca (n);
6106 f (p);
6107 @}
6108 @end smallexample
6109
6110 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6111 a warning, but this time because of the lack of bounds checking.
6112
6113 Note, that even seemingly correct code involving signed integers could
6114 cause a warning:
6115
6116 @smallexample
6117 void func (signed int n)
6118 @{
6119 if (n < 500)
6120 @{
6121 p = alloca (n);
6122 f (p);
6123 @}
6124 @}
6125 @end smallexample
6126
6127 In the above example, @var{n} could be negative, causing a larger than
6128 expected argument to be implicitly cast into the @code{alloca} call.
6129
6130 This option also warns when @code{alloca} is used in a loop.
6131
6132 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6133 but is usually only effective when @option{-ftree-vrp} is active (default
6134 for @option{-O2} and above).
6135
6136 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6137
6138 @item -Wno-alloca-larger-than
6139 @opindex Wno-alloca-larger-than
6140 Disable @option{-Walloca-larger-than=} warnings. The option is
6141 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6142
6143 @item -Warray-bounds
6144 @itemx -Warray-bounds=@var{n}
6145 @opindex Wno-array-bounds
6146 @opindex Warray-bounds
6147 This option is only active when @option{-ftree-vrp} is active
6148 (default for @option{-O2} and above). It warns about subscripts to arrays
6149 that are always out of bounds. This warning is enabled by @option{-Wall}.
6150
6151 @table @gcctabopt
6152 @item -Warray-bounds=1
6153 This is the warning level of @option{-Warray-bounds} and is enabled
6154 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6155
6156 @item -Warray-bounds=2
6157 This warning level also warns about out of bounds access for
6158 arrays at the end of a struct and for arrays accessed through
6159 pointers. This warning level may give a larger number of
6160 false positives and is deactivated by default.
6161 @end table
6162
6163 @item -Wattribute-alias=@var{n}
6164 @itemx -Wno-attribute-alias
6165 @opindex Wattribute-alias
6166 @opindex Wno-attribute-alias
6167 Warn about declarations using the @code{alias} and similar attributes whose
6168 target is incompatible with the type of the alias.
6169 @xref{Function Attributes,,Declaring Attributes of Functions}.
6170
6171 @table @gcctabopt
6172 @item -Wattribute-alias=1
6173 The default warning level of the @option{-Wattribute-alias} option diagnoses
6174 incompatibilities between the type of the alias declaration and that of its
6175 target. Such incompatibilities are typically indicative of bugs.
6176
6177 @item -Wattribute-alias=2
6178
6179 At this level @option{-Wattribute-alias} also diagnoses cases where
6180 the attributes of the alias declaration are more restrictive than the
6181 attributes applied to its target. These mismatches can potentially
6182 result in incorrect code generation. In other cases they may be
6183 benign and could be resolved simply by adding the missing attribute to
6184 the target. For comparison, see the @option{-Wmissing-attributes}
6185 option, which controls diagnostics when the alias declaration is less
6186 restrictive than the target, rather than more restrictive.
6187
6188 Attributes considered include @code{alloc_align}, @code{alloc_size},
6189 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6190 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6191 @code{returns_nonnull}, and @code{returns_twice}.
6192 @end table
6193
6194 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6195 This is the default. You can disable these warnings with either
6196 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6197
6198 @item -Wbool-compare
6199 @opindex Wno-bool-compare
6200 @opindex Wbool-compare
6201 Warn about boolean expression compared with an integer value different from
6202 @code{true}/@code{false}. For instance, the following comparison is
6203 always false:
6204 @smallexample
6205 int n = 5;
6206 @dots{}
6207 if ((n > 1) == 2) @{ @dots{} @}
6208 @end smallexample
6209 This warning is enabled by @option{-Wall}.
6210
6211 @item -Wbool-operation
6212 @opindex Wno-bool-operation
6213 @opindex Wbool-operation
6214 Warn about suspicious operations on expressions of a boolean type. For
6215 instance, bitwise negation of a boolean is very likely a bug in the program.
6216 For C, this warning also warns about incrementing or decrementing a boolean,
6217 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6218 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6219
6220 This warning is enabled by @option{-Wall}.
6221
6222 @item -Wduplicated-branches
6223 @opindex Wno-duplicated-branches
6224 @opindex Wduplicated-branches
6225 Warn when an if-else has identical branches. This warning detects cases like
6226 @smallexample
6227 if (p != NULL)
6228 return 0;
6229 else
6230 return 0;
6231 @end smallexample
6232 It doesn't warn when both branches contain just a null statement. This warning
6233 also warn for conditional operators:
6234 @smallexample
6235 int i = x ? *p : *p;
6236 @end smallexample
6237
6238 @item -Wduplicated-cond
6239 @opindex Wno-duplicated-cond
6240 @opindex Wduplicated-cond
6241 Warn about duplicated conditions in an if-else-if chain. For instance,
6242 warn for the following code:
6243 @smallexample
6244 if (p->q != NULL) @{ @dots{} @}
6245 else if (p->q != NULL) @{ @dots{} @}
6246 @end smallexample
6247
6248 @item -Wframe-address
6249 @opindex Wno-frame-address
6250 @opindex Wframe-address
6251 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6252 is called with an argument greater than 0. Such calls may return indeterminate
6253 values or crash the program. The warning is included in @option{-Wall}.
6254
6255 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6256 @opindex Wno-discarded-qualifiers
6257 @opindex Wdiscarded-qualifiers
6258 Do not warn if type qualifiers on pointers are being discarded.
6259 Typically, the compiler warns if a @code{const char *} variable is
6260 passed to a function that takes a @code{char *} parameter. This option
6261 can be used to suppress such a warning.
6262
6263 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6264 @opindex Wno-discarded-array-qualifiers
6265 @opindex Wdiscarded-array-qualifiers
6266 Do not warn if type qualifiers on arrays which are pointer targets
6267 are being discarded. Typically, the compiler warns if a
6268 @code{const int (*)[]} variable is passed to a function that
6269 takes a @code{int (*)[]} parameter. This option can be used to
6270 suppress such a warning.
6271
6272 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6273 @opindex Wno-incompatible-pointer-types
6274 @opindex Wincompatible-pointer-types
6275 Do not warn when there is a conversion between pointers that have incompatible
6276 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6277 which warns for pointer argument passing or assignment with different
6278 signedness.
6279
6280 @item -Wno-int-conversion @r{(C and Objective-C only)}
6281 @opindex Wno-int-conversion
6282 @opindex Wint-conversion
6283 Do not warn about incompatible integer to pointer and pointer to integer
6284 conversions. This warning is about implicit conversions; for explicit
6285 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6286 @option{-Wno-pointer-to-int-cast} may be used.
6287
6288 @item -Wno-div-by-zero
6289 @opindex Wno-div-by-zero
6290 @opindex Wdiv-by-zero
6291 Do not warn about compile-time integer division by zero. Floating-point
6292 division by zero is not warned about, as it can be a legitimate way of
6293 obtaining infinities and NaNs.
6294
6295 @item -Wsystem-headers
6296 @opindex Wsystem-headers
6297 @opindex Wno-system-headers
6298 @cindex warnings from system headers
6299 @cindex system headers, warnings from
6300 Print warning messages for constructs found in system header files.
6301 Warnings from system headers are normally suppressed, on the assumption
6302 that they usually do not indicate real problems and would only make the
6303 compiler output harder to read. Using this command-line option tells
6304 GCC to emit warnings from system headers as if they occurred in user
6305 code. However, note that using @option{-Wall} in conjunction with this
6306 option does @emph{not} warn about unknown pragmas in system
6307 headers---for that, @option{-Wunknown-pragmas} must also be used.
6308
6309 @item -Wtautological-compare
6310 @opindex Wtautological-compare
6311 @opindex Wno-tautological-compare
6312 Warn if a self-comparison always evaluates to true or false. This
6313 warning detects various mistakes such as:
6314 @smallexample
6315 int i = 1;
6316 @dots{}
6317 if (i > i) @{ @dots{} @}
6318 @end smallexample
6319
6320 This warning also warns about bitwise comparisons that always evaluate
6321 to true or false, for instance:
6322 @smallexample
6323 if ((a & 16) == 10) @{ @dots{} @}
6324 @end smallexample
6325 will always be false.
6326
6327 This warning is enabled by @option{-Wall}.
6328
6329 @item -Wtrampolines
6330 @opindex Wtrampolines
6331 @opindex Wno-trampolines
6332 Warn about trampolines generated for pointers to nested functions.
6333 A trampoline is a small piece of data or code that is created at run
6334 time on the stack when the address of a nested function is taken, and is
6335 used to call the nested function indirectly. For some targets, it is
6336 made up of data only and thus requires no special treatment. But, for
6337 most targets, it is made up of code and thus requires the stack to be
6338 made executable in order for the program to work properly.
6339
6340 @item -Wfloat-equal
6341 @opindex Wfloat-equal
6342 @opindex Wno-float-equal
6343 Warn if floating-point values are used in equality comparisons.
6344
6345 The idea behind this is that sometimes it is convenient (for the
6346 programmer) to consider floating-point values as approximations to
6347 infinitely precise real numbers. If you are doing this, then you need
6348 to compute (by analyzing the code, or in some other way) the maximum or
6349 likely maximum error that the computation introduces, and allow for it
6350 when performing comparisons (and when producing output, but that's a
6351 different problem). In particular, instead of testing for equality, you
6352 should check to see whether the two values have ranges that overlap; and
6353 this is done with the relational operators, so equality comparisons are
6354 probably mistaken.
6355
6356 @item -Wtraditional @r{(C and Objective-C only)}
6357 @opindex Wtraditional
6358 @opindex Wno-traditional
6359 Warn about certain constructs that behave differently in traditional and
6360 ISO C@. Also warn about ISO C constructs that have no traditional C
6361 equivalent, and/or problematic constructs that should be avoided.
6362
6363 @itemize @bullet
6364 @item
6365 Macro parameters that appear within string literals in the macro body.
6366 In traditional C macro replacement takes place within string literals,
6367 but in ISO C it does not.
6368
6369 @item
6370 In traditional C, some preprocessor directives did not exist.
6371 Traditional preprocessors only considered a line to be a directive
6372 if the @samp{#} appeared in column 1 on the line. Therefore
6373 @option{-Wtraditional} warns about directives that traditional C
6374 understands but ignores because the @samp{#} does not appear as the
6375 first character on the line. It also suggests you hide directives like
6376 @code{#pragma} not understood by traditional C by indenting them. Some
6377 traditional implementations do not recognize @code{#elif}, so this option
6378 suggests avoiding it altogether.
6379
6380 @item
6381 A function-like macro that appears without arguments.
6382
6383 @item
6384 The unary plus operator.
6385
6386 @item
6387 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6388 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6389 constants.) Note, these suffixes appear in macros defined in the system
6390 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6391 Use of these macros in user code might normally lead to spurious
6392 warnings, however GCC's integrated preprocessor has enough context to
6393 avoid warning in these cases.
6394
6395 @item
6396 A function declared external in one block and then used after the end of
6397 the block.
6398
6399 @item
6400 A @code{switch} statement has an operand of type @code{long}.
6401
6402 @item
6403 A non-@code{static} function declaration follows a @code{static} one.
6404 This construct is not accepted by some traditional C compilers.
6405
6406 @item
6407 The ISO type of an integer constant has a different width or
6408 signedness from its traditional type. This warning is only issued if
6409 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6410 typically represent bit patterns, are not warned about.
6411
6412 @item
6413 Usage of ISO string concatenation is detected.
6414
6415 @item
6416 Initialization of automatic aggregates.
6417
6418 @item
6419 Identifier conflicts with labels. Traditional C lacks a separate
6420 namespace for labels.
6421
6422 @item
6423 Initialization of unions. If the initializer is zero, the warning is
6424 omitted. This is done under the assumption that the zero initializer in
6425 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6426 initializer warnings and relies on default initialization to zero in the
6427 traditional C case.
6428
6429 @item
6430 Conversions by prototypes between fixed/floating-point values and vice
6431 versa. The absence of these prototypes when compiling with traditional
6432 C causes serious problems. This is a subset of the possible
6433 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6434
6435 @item
6436 Use of ISO C style function definitions. This warning intentionally is
6437 @emph{not} issued for prototype declarations or variadic functions
6438 because these ISO C features appear in your code when using
6439 libiberty's traditional C compatibility macros, @code{PARAMS} and
6440 @code{VPARAMS}. This warning is also bypassed for nested functions
6441 because that feature is already a GCC extension and thus not relevant to
6442 traditional C compatibility.
6443 @end itemize
6444
6445 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6446 @opindex Wtraditional-conversion
6447 @opindex Wno-traditional-conversion
6448 Warn if a prototype causes a type conversion that is different from what
6449 would happen to the same argument in the absence of a prototype. This
6450 includes conversions of fixed point to floating and vice versa, and
6451 conversions changing the width or signedness of a fixed-point argument
6452 except when the same as the default promotion.
6453
6454 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6455 @opindex Wdeclaration-after-statement
6456 @opindex Wno-declaration-after-statement
6457 Warn when a declaration is found after a statement in a block. This
6458 construct, known from C++, was introduced with ISO C99 and is by default
6459 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6460
6461 @item -Wshadow
6462 @opindex Wshadow
6463 @opindex Wno-shadow
6464 Warn whenever a local variable or type declaration shadows another
6465 variable, parameter, type, class member (in C++), or instance variable
6466 (in Objective-C) or whenever a built-in function is shadowed. Note
6467 that in C++, the compiler warns if a local variable shadows an
6468 explicit typedef, but not if it shadows a struct/class/enum.
6469 Same as @option{-Wshadow=global}.
6470
6471 @item -Wno-shadow-ivar @r{(Objective-C only)}
6472 @opindex Wno-shadow-ivar
6473 @opindex Wshadow-ivar
6474 Do not warn whenever a local variable shadows an instance variable in an
6475 Objective-C method.
6476
6477 @item -Wshadow=global
6478 @opindex Wshadow=local
6479 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6480
6481 @item -Wshadow=local
6482 @opindex Wshadow=local
6483 Warn when a local variable shadows another local variable or parameter.
6484 This warning is enabled by @option{-Wshadow=global}.
6485
6486 @item -Wshadow=compatible-local
6487 @opindex Wshadow=compatible-local
6488 Warn when a local variable shadows another local variable or parameter
6489 whose type is compatible with that of the shadowing variable. In C++,
6490 type compatibility here means the type of the shadowing variable can be
6491 converted to that of the shadowed variable. The creation of this flag
6492 (in addition to @option{-Wshadow=local}) is based on the idea that when
6493 a local variable shadows another one of incompatible type, it is most
6494 likely intentional, not a bug or typo, as shown in the following example:
6495
6496 @smallexample
6497 @group
6498 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6499 @{
6500 for (int i = 0; i < N; ++i)
6501 @{
6502 ...
6503 @}
6504 ...
6505 @}
6506 @end group
6507 @end smallexample
6508
6509 Since the two variable @code{i} in the example above have incompatible types,
6510 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6511 Because their types are incompatible, if a programmer accidentally uses one
6512 in place of the other, type checking will catch that and emit an error or
6513 warning. So not warning (about shadowing) in this case will not lead to
6514 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6515 possibly reduce the number of warnings triggered by intentional shadowing.
6516
6517 This warning is enabled by @option{-Wshadow=local}.
6518
6519 @item -Wlarger-than=@var{byte-size}
6520 @opindex Wlarger-than=
6521 @opindex Wlarger-than-@var{byte-size}
6522 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6523 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6524 Warnings controlled by the option can be disabled either by specifying
6525 @var{byte-size} of @samp{SIZE_MAX} or more or by
6526 @option{-Wno-larger-than}.
6527
6528 @item -Wno-larger-than
6529 @opindex Wno-larger-than
6530 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6531 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6532
6533 @item -Wframe-larger-than=@var{byte-size}
6534 @opindex Wframe-larger-than=
6535 @opindex Wno-frame-larger-than
6536 Warn if the size of a function frame exceeds @var{byte-size}.
6537 The computation done to determine the stack frame size is approximate
6538 and not conservative.
6539 The actual requirements may be somewhat greater than @var{byte-size}
6540 even if you do not get a warning. In addition, any space allocated
6541 via @code{alloca}, variable-length arrays, or related constructs
6542 is not included by the compiler when determining
6543 whether or not to issue a warning.
6544 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6545 Warnings controlled by the option can be disabled either by specifying
6546 @var{byte-size} of @samp{SIZE_MAX} or more or by
6547 @option{-Wno-frame-larger-than}.
6548
6549 @item -Wno-frame-larger-than
6550 @opindex Wno-frame-larger-than
6551 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6552 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6553
6554 @item -Wno-free-nonheap-object
6555 @opindex Wno-free-nonheap-object
6556 @opindex Wfree-nonheap-object
6557 Do not warn when attempting to free an object that was not allocated
6558 on the heap.
6559
6560 @item -Wstack-usage=@var{byte-size}
6561 @opindex Wstack-usage
6562 @opindex Wno-stack-usage
6563 Warn if the stack usage of a function might exceed @var{byte-size}.
6564 The computation done to determine the stack usage is conservative.
6565 Any space allocated via @code{alloca}, variable-length arrays, or related
6566 constructs is included by the compiler when determining whether or not to
6567 issue a warning.
6568
6569 The message is in keeping with the output of @option{-fstack-usage}.
6570
6571 @itemize
6572 @item
6573 If the stack usage is fully static but exceeds the specified amount, it's:
6574
6575 @smallexample
6576 warning: stack usage is 1120 bytes
6577 @end smallexample
6578 @item
6579 If the stack usage is (partly) dynamic but bounded, it's:
6580
6581 @smallexample
6582 warning: stack usage might be 1648 bytes
6583 @end smallexample
6584 @item
6585 If the stack usage is (partly) dynamic and not bounded, it's:
6586
6587 @smallexample
6588 warning: stack usage might be unbounded
6589 @end smallexample
6590 @end itemize
6591
6592 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6593 Warnings controlled by the option can be disabled either by specifying
6594 @var{byte-size} of @samp{SIZE_MAX} or more or by
6595 @option{-Wno-stack-usage}.
6596
6597 @item -Wno-stack-usage
6598 @opindex Wno-stack-usage
6599 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6600 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6601
6602 @item -Wunsafe-loop-optimizations
6603 @opindex Wunsafe-loop-optimizations
6604 @opindex Wno-unsafe-loop-optimizations
6605 Warn if the loop cannot be optimized because the compiler cannot
6606 assume anything on the bounds of the loop indices. With
6607 @option{-funsafe-loop-optimizations} warn if the compiler makes
6608 such assumptions.
6609
6610 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6611 @opindex Wno-pedantic-ms-format
6612 @opindex Wpedantic-ms-format
6613 When used in combination with @option{-Wformat}
6614 and @option{-pedantic} without GNU extensions, this option
6615 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6616 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6617 which depend on the MS runtime.
6618
6619 @item -Waligned-new
6620 @opindex Waligned-new
6621 @opindex Wno-aligned-new
6622 Warn about a new-expression of a type that requires greater alignment
6623 than the @code{alignof(std::max_align_t)} but uses an allocation
6624 function without an explicit alignment parameter. This option is
6625 enabled by @option{-Wall}.
6626
6627 Normally this only warns about global allocation functions, but
6628 @option{-Waligned-new=all} also warns about class member allocation
6629 functions.
6630
6631 @item -Wplacement-new
6632 @itemx -Wplacement-new=@var{n}
6633 @opindex Wplacement-new
6634 @opindex Wno-placement-new
6635 Warn about placement new expressions with undefined behavior, such as
6636 constructing an object in a buffer that is smaller than the type of
6637 the object. For example, the placement new expression below is diagnosed
6638 because it attempts to construct an array of 64 integers in a buffer only
6639 64 bytes large.
6640 @smallexample
6641 char buf [64];
6642 new (buf) int[64];
6643 @end smallexample
6644 This warning is enabled by default.
6645
6646 @table @gcctabopt
6647 @item -Wplacement-new=1
6648 This is the default warning level of @option{-Wplacement-new}. At this
6649 level the warning is not issued for some strictly undefined constructs that
6650 GCC allows as extensions for compatibility with legacy code. For example,
6651 the following @code{new} expression is not diagnosed at this level even
6652 though it has undefined behavior according to the C++ standard because
6653 it writes past the end of the one-element array.
6654 @smallexample
6655 struct S @{ int n, a[1]; @};
6656 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6657 new (s->a)int [32]();
6658 @end smallexample
6659
6660 @item -Wplacement-new=2
6661 At this level, in addition to diagnosing all the same constructs as at level
6662 1, a diagnostic is also issued for placement new expressions that construct
6663 an object in the last member of structure whose type is an array of a single
6664 element and whose size is less than the size of the object being constructed.
6665 While the previous example would be diagnosed, the following construct makes
6666 use of the flexible member array extension to avoid the warning at level 2.
6667 @smallexample
6668 struct S @{ int n, a[]; @};
6669 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6670 new (s->a)int [32]();
6671 @end smallexample
6672
6673 @end table
6674
6675 @item -Wpointer-arith
6676 @opindex Wpointer-arith
6677 @opindex Wno-pointer-arith
6678 Warn about anything that depends on the ``size of'' a function type or
6679 of @code{void}. GNU C assigns these types a size of 1, for
6680 convenience in calculations with @code{void *} pointers and pointers
6681 to functions. In C++, warn also when an arithmetic operation involves
6682 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6683
6684 @item -Wpointer-compare
6685 @opindex Wpointer-compare
6686 @opindex Wno-pointer-compare
6687 Warn if a pointer is compared with a zero character constant. This usually
6688 means that the pointer was meant to be dereferenced. For example:
6689
6690 @smallexample
6691 const char *p = foo ();
6692 if (p == '\0')
6693 return 42;
6694 @end smallexample
6695
6696 Note that the code above is invalid in C++11.
6697
6698 This warning is enabled by default.
6699
6700 @item -Wtype-limits
6701 @opindex Wtype-limits
6702 @opindex Wno-type-limits
6703 Warn if a comparison is always true or always false due to the limited
6704 range of the data type, but do not warn for constant expressions. For
6705 example, warn if an unsigned variable is compared against zero with
6706 @code{<} or @code{>=}. This warning is also enabled by
6707 @option{-Wextra}.
6708
6709 @item -Wabsolute-value @r{(C and Objective-C only)}
6710 @opindex Wabsolute-value
6711 @opindex Wno-absolute-value
6712 Warn for calls to standard functions that compute the absolute value
6713 of an argument when a more appropriate standard function is available.
6714 For example, calling @code{abs(3.14)} triggers the warning because the
6715 appropriate function to call to compute the absolute value of a double
6716 argument is @code{fabs}. The option also triggers warnings when the
6717 argument in a call to such a function has an unsigned type. This
6718 warning can be suppressed with an explicit type cast and it is also
6719 enabled by @option{-Wextra}.
6720
6721 @include cppwarnopts.texi
6722
6723 @item -Wbad-function-cast @r{(C and Objective-C only)}
6724 @opindex Wbad-function-cast
6725 @opindex Wno-bad-function-cast
6726 Warn when a function call is cast to a non-matching type.
6727 For example, warn if a call to a function returning an integer type
6728 is cast to a pointer type.
6729
6730 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6731 @opindex Wc90-c99-compat
6732 @opindex Wno-c90-c99-compat
6733 Warn about features not present in ISO C90, but present in ISO C99.
6734 For instance, warn about use of variable length arrays, @code{long long}
6735 type, @code{bool} type, compound literals, designated initializers, and so
6736 on. This option is independent of the standards mode. Warnings are disabled
6737 in the expression that follows @code{__extension__}.
6738
6739 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6740 @opindex Wc99-c11-compat
6741 @opindex Wno-c99-c11-compat
6742 Warn about features not present in ISO C99, but present in ISO C11.
6743 For instance, warn about use of anonymous structures and unions,
6744 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6745 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6746 and so on. This option is independent of the standards mode. Warnings are
6747 disabled in the expression that follows @code{__extension__}.
6748
6749 @item -Wc++-compat @r{(C and Objective-C only)}
6750 @opindex Wc++-compat
6751 @opindex Wno-c++-compat
6752 Warn about ISO C constructs that are outside of the common subset of
6753 ISO C and ISO C++, e.g.@: request for implicit conversion from
6754 @code{void *} to a pointer to non-@code{void} type.
6755
6756 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6757 @opindex Wc++11-compat
6758 @opindex Wno-c++11-compat
6759 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6760 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6761 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6762 enabled by @option{-Wall}.
6763
6764 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6765 @opindex Wc++14-compat
6766 @opindex Wno-c++14-compat
6767 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6768 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6769
6770 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6771 @opindex Wc++17-compat
6772 @opindex Wno-c++17-compat
6773 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6774 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6775
6776 @item -Wcast-qual
6777 @opindex Wcast-qual
6778 @opindex Wno-cast-qual
6779 Warn whenever a pointer is cast so as to remove a type qualifier from
6780 the target type. For example, warn if a @code{const char *} is cast
6781 to an ordinary @code{char *}.
6782
6783 Also warn when making a cast that introduces a type qualifier in an
6784 unsafe way. For example, casting @code{char **} to @code{const char **}
6785 is unsafe, as in this example:
6786
6787 @smallexample
6788 /* p is char ** value. */
6789 const char **q = (const char **) p;
6790 /* Assignment of readonly string to const char * is OK. */
6791 *q = "string";
6792 /* Now char** pointer points to read-only memory. */
6793 **p = 'b';
6794 @end smallexample
6795
6796 @item -Wcast-align
6797 @opindex Wcast-align
6798 @opindex Wno-cast-align
6799 Warn whenever a pointer is cast such that the required alignment of the
6800 target is increased. For example, warn if a @code{char *} is cast to
6801 an @code{int *} on machines where integers can only be accessed at
6802 two- or four-byte boundaries.
6803
6804 @item -Wcast-align=strict
6805 @opindex Wcast-align=strict
6806 Warn whenever a pointer is cast such that the required alignment of the
6807 target is increased. For example, warn if a @code{char *} is cast to
6808 an @code{int *} regardless of the target machine.
6809
6810 @item -Wcast-function-type
6811 @opindex Wcast-function-type
6812 @opindex Wno-cast-function-type
6813 Warn when a function pointer is cast to an incompatible function pointer.
6814 In a cast involving function types with a variable argument list only
6815 the types of initial arguments that are provided are considered.
6816 Any parameter of pointer-type matches any other pointer-type. Any benign
6817 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6818 on ILP32 targets. Likewise type qualifiers are ignored. The function
6819 type @code{void (*) (void)} is special and matches everything, which can
6820 be used to suppress this warning.
6821 In a cast involving pointer to member types this warning warns whenever
6822 the type cast is changing the pointer to member type.
6823 This warning is enabled by @option{-Wextra}.
6824
6825 @item -Wwrite-strings
6826 @opindex Wwrite-strings
6827 @opindex Wno-write-strings
6828 When compiling C, give string constants the type @code{const
6829 char[@var{length}]} so that copying the address of one into a
6830 non-@code{const} @code{char *} pointer produces a warning. These
6831 warnings help you find at compile time code that can try to write
6832 into a string constant, but only if you have been very careful about
6833 using @code{const} in declarations and prototypes. Otherwise, it is
6834 just a nuisance. This is why we did not make @option{-Wall} request
6835 these warnings.
6836
6837 When compiling C++, warn about the deprecated conversion from string
6838 literals to @code{char *}. This warning is enabled by default for C++
6839 programs.
6840
6841 @item -Wcatch-value
6842 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6843 @opindex Wcatch-value
6844 @opindex Wno-catch-value
6845 Warn about catch handlers that do not catch via reference.
6846 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6847 warn about polymorphic class types that are caught by value.
6848 With @option{-Wcatch-value=2} warn about all class types that are caught
6849 by value. With @option{-Wcatch-value=3} warn about all types that are
6850 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6851
6852 @item -Wclobbered
6853 @opindex Wclobbered
6854 @opindex Wno-clobbered
6855 Warn for variables that might be changed by @code{longjmp} or
6856 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6857
6858 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6859 @opindex Wconditionally-supported
6860 @opindex Wno-conditionally-supported
6861 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6862
6863 @item -Wconversion
6864 @opindex Wconversion
6865 @opindex Wno-conversion
6866 Warn for implicit conversions that may alter a value. This includes
6867 conversions between real and integer, like @code{abs (x)} when
6868 @code{x} is @code{double}; conversions between signed and unsigned,
6869 like @code{unsigned ui = -1}; and conversions to smaller types, like
6870 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6871 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6872 changed by the conversion like in @code{abs (2.0)}. Warnings about
6873 conversions between signed and unsigned integers can be disabled by
6874 using @option{-Wno-sign-conversion}.
6875
6876 For C++, also warn for confusing overload resolution for user-defined
6877 conversions; and conversions that never use a type conversion
6878 operator: conversions to @code{void}, the same type, a base class or a
6879 reference to them. Warnings about conversions between signed and
6880 unsigned integers are disabled by default in C++ unless
6881 @option{-Wsign-conversion} is explicitly enabled.
6882
6883 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6884 @opindex Wconversion-null
6885 @opindex Wno-conversion-null
6886 Do not warn for conversions between @code{NULL} and non-pointer
6887 types. @option{-Wconversion-null} is enabled by default.
6888
6889 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6890 @opindex Wzero-as-null-pointer-constant
6891 @opindex Wno-zero-as-null-pointer-constant
6892 Warn when a literal @samp{0} is used as null pointer constant. This can
6893 be useful to facilitate the conversion to @code{nullptr} in C++11.
6894
6895 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6896 @opindex Wsubobject-linkage
6897 @opindex Wno-subobject-linkage
6898 Warn if a class type has a base or a field whose type uses the anonymous
6899 namespace or depends on a type with no linkage. If a type A depends on
6900 a type B with no or internal linkage, defining it in multiple
6901 translation units would be an ODR violation because the meaning of B
6902 is different in each translation unit. If A only appears in a single
6903 translation unit, the best way to silence the warning is to give it
6904 internal linkage by putting it in an anonymous namespace as well. The
6905 compiler doesn't give this warning for types defined in the main .C
6906 file, as those are unlikely to have multiple definitions.
6907 @option{-Wsubobject-linkage} is enabled by default.
6908
6909 @item -Wdangling-else
6910 @opindex Wdangling-else
6911 @opindex Wno-dangling-else
6912 Warn about constructions where there may be confusion to which
6913 @code{if} statement an @code{else} branch belongs. Here is an example of
6914 such a case:
6915
6916 @smallexample
6917 @group
6918 @{
6919 if (a)
6920 if (b)
6921 foo ();
6922 else
6923 bar ();
6924 @}
6925 @end group
6926 @end smallexample
6927
6928 In C/C++, every @code{else} branch belongs to the innermost possible
6929 @code{if} statement, which in this example is @code{if (b)}. This is
6930 often not what the programmer expected, as illustrated in the above
6931 example by indentation the programmer chose. When there is the
6932 potential for this confusion, GCC issues a warning when this flag
6933 is specified. To eliminate the warning, add explicit braces around
6934 the innermost @code{if} statement so there is no way the @code{else}
6935 can belong to the enclosing @code{if}. The resulting code
6936 looks like this:
6937
6938 @smallexample
6939 @group
6940 @{
6941 if (a)
6942 @{
6943 if (b)
6944 foo ();
6945 else
6946 bar ();
6947 @}
6948 @}
6949 @end group
6950 @end smallexample
6951
6952 This warning is enabled by @option{-Wparentheses}.
6953
6954 @item -Wdate-time
6955 @opindex Wdate-time
6956 @opindex Wno-date-time
6957 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6958 are encountered as they might prevent bit-wise-identical reproducible
6959 compilations.
6960
6961 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6962 @opindex Wdelete-incomplete
6963 @opindex Wno-delete-incomplete
6964 Warn when deleting a pointer to incomplete type, which may cause
6965 undefined behavior at runtime. This warning is enabled by default.
6966
6967 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6968 @opindex Wuseless-cast
6969 @opindex Wno-useless-cast
6970 Warn when an expression is casted to its own type.
6971
6972 @item -Wempty-body
6973 @opindex Wempty-body
6974 @opindex Wno-empty-body
6975 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6976 while} statement. This warning is also enabled by @option{-Wextra}.
6977
6978 @item -Wenum-compare
6979 @opindex Wenum-compare
6980 @opindex Wno-enum-compare
6981 Warn about a comparison between values of different enumerated types.
6982 In C++ enumerated type mismatches in conditional expressions are also
6983 diagnosed and the warning is enabled by default. In C this warning is
6984 enabled by @option{-Wall}.
6985
6986 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6987 @opindex Wextra-semi
6988 @opindex Wno-extra-semi
6989 Warn about redundant semicolon after in-class function definition.
6990
6991 @item -Wjump-misses-init @r{(C, Objective-C only)}
6992 @opindex Wjump-misses-init
6993 @opindex Wno-jump-misses-init
6994 Warn if a @code{goto} statement or a @code{switch} statement jumps
6995 forward across the initialization of a variable, or jumps backward to a
6996 label after the variable has been initialized. This only warns about
6997 variables that are initialized when they are declared. This warning is
6998 only supported for C and Objective-C; in C++ this sort of branch is an
6999 error in any case.
7000
7001 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7002 can be disabled with the @option{-Wno-jump-misses-init} option.
7003
7004 @item -Wsign-compare
7005 @opindex Wsign-compare
7006 @opindex Wno-sign-compare
7007 @cindex warning for comparison of signed and unsigned values
7008 @cindex comparison of signed and unsigned values, warning
7009 @cindex signed and unsigned values, comparison warning
7010 Warn when a comparison between signed and unsigned values could produce
7011 an incorrect result when the signed value is converted to unsigned.
7012 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7013 also enabled by @option{-Wextra}.
7014
7015 @item -Wsign-conversion
7016 @opindex Wsign-conversion
7017 @opindex Wno-sign-conversion
7018 Warn for implicit conversions that may change the sign of an integer
7019 value, like assigning a signed integer expression to an unsigned
7020 integer variable. An explicit cast silences the warning. In C, this
7021 option is enabled also by @option{-Wconversion}.
7022
7023 @item -Wfloat-conversion
7024 @opindex Wfloat-conversion
7025 @opindex Wno-float-conversion
7026 Warn for implicit conversions that reduce the precision of a real value.
7027 This includes conversions from real to integer, and from higher precision
7028 real to lower precision real values. This option is also enabled by
7029 @option{-Wconversion}.
7030
7031 @item -Wno-scalar-storage-order
7032 @opindex Wno-scalar-storage-order
7033 @opindex Wscalar-storage-order
7034 Do not warn on suspicious constructs involving reverse scalar storage order.
7035
7036 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7037 @opindex Wsized-deallocation
7038 @opindex Wno-sized-deallocation
7039 Warn about a definition of an unsized deallocation function
7040 @smallexample
7041 void operator delete (void *) noexcept;
7042 void operator delete[] (void *) noexcept;
7043 @end smallexample
7044 without a definition of the corresponding sized deallocation function
7045 @smallexample
7046 void operator delete (void *, std::size_t) noexcept;
7047 void operator delete[] (void *, std::size_t) noexcept;
7048 @end smallexample
7049 or vice versa. Enabled by @option{-Wextra} along with
7050 @option{-fsized-deallocation}.
7051
7052 @item -Wsizeof-pointer-div
7053 @opindex Wsizeof-pointer-div
7054 @opindex Wno-sizeof-pointer-div
7055 Warn for suspicious divisions of two sizeof expressions that divide
7056 the pointer size by the element size, which is the usual way to compute
7057 the array size but won't work out correctly with pointers. This warning
7058 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7059 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7060
7061 @item -Wsizeof-pointer-memaccess
7062 @opindex Wsizeof-pointer-memaccess
7063 @opindex Wno-sizeof-pointer-memaccess
7064 Warn for suspicious length parameters to certain string and memory built-in
7065 functions if the argument uses @code{sizeof}. This warning triggers for
7066 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7067 an array, but a pointer, and suggests a possible fix, or about
7068 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7069 also warns about calls to bounded string copy functions like @code{strncat}
7070 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7071 the source array. For example, in the following function the call to
7072 @code{strncat} specifies the size of the source string as the bound. That
7073 is almost certainly a mistake and so the call is diagnosed.
7074 @smallexample
7075 void make_file (const char *name)
7076 @{
7077 char path[PATH_MAX];
7078 strncpy (path, name, sizeof path - 1);
7079 strncat (path, ".text", sizeof ".text");
7080 @dots{}
7081 @}
7082 @end smallexample
7083
7084 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7085
7086 @item -Wsizeof-array-argument
7087 @opindex Wsizeof-array-argument
7088 @opindex Wno-sizeof-array-argument
7089 Warn when the @code{sizeof} operator is applied to a parameter that is
7090 declared as an array in a function definition. This warning is enabled by
7091 default for C and C++ programs.
7092
7093 @item -Wmemset-elt-size
7094 @opindex Wmemset-elt-size
7095 @opindex Wno-memset-elt-size
7096 Warn for suspicious calls to the @code{memset} built-in function, if the
7097 first argument references an array, and the third argument is a number
7098 equal to the number of elements, but not equal to the size of the array
7099 in memory. This indicates that the user has omitted a multiplication by
7100 the element size. This warning is enabled by @option{-Wall}.
7101
7102 @item -Wmemset-transposed-args
7103 @opindex Wmemset-transposed-args
7104 @opindex Wno-memset-transposed-args
7105 Warn for suspicious calls to the @code{memset} built-in function where
7106 the second argument is not zero and the third argument is zero. For
7107 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7108 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7109 is only emitted if the third argument is a literal zero. Otherwise, if
7110 it is an expression that is folded to zero, or a cast of zero to some
7111 type, it is far less likely that the arguments have been mistakenly
7112 transposed and no warning is emitted. This warning is enabled
7113 by @option{-Wall}.
7114
7115 @item -Waddress
7116 @opindex Waddress
7117 @opindex Wno-address
7118 Warn about suspicious uses of memory addresses. These include using
7119 the address of a function in a conditional expression, such as
7120 @code{void func(void); if (func)}, and comparisons against the memory
7121 address of a string literal, such as @code{if (x == "abc")}. Such
7122 uses typically indicate a programmer error: the address of a function
7123 always evaluates to true, so their use in a conditional usually
7124 indicate that the programmer forgot the parentheses in a function
7125 call; and comparisons against string literals result in unspecified
7126 behavior and are not portable in C, so they usually indicate that the
7127 programmer intended to use @code{strcmp}. This warning is enabled by
7128 @option{-Wall}.
7129
7130 @item -Waddress-of-packed-member
7131 @opindex Waddress-of-packed-member
7132 @opindex Wno-address-of-packed-member
7133 Warn when the address of packed member of struct or union is taken,
7134 which usually results in an unaligned pointer value. This is
7135 enabled by default.
7136
7137 @item -Wlogical-op
7138 @opindex Wlogical-op
7139 @opindex Wno-logical-op
7140 Warn about suspicious uses of logical operators in expressions.
7141 This includes using logical operators in contexts where a
7142 bit-wise operator is likely to be expected. Also warns when
7143 the operands of a logical operator are the same:
7144 @smallexample
7145 extern int a;
7146 if (a < 0 && a < 0) @{ @dots{} @}
7147 @end smallexample
7148
7149 @item -Wlogical-not-parentheses
7150 @opindex Wlogical-not-parentheses
7151 @opindex Wno-logical-not-parentheses
7152 Warn about logical not used on the left hand side operand of a comparison.
7153 This option does not warn if the right operand is considered to be a boolean
7154 expression. Its purpose is to detect suspicious code like the following:
7155 @smallexample
7156 int a;
7157 @dots{}
7158 if (!a > 1) @{ @dots{} @}
7159 @end smallexample
7160
7161 It is possible to suppress the warning by wrapping the LHS into
7162 parentheses:
7163 @smallexample
7164 if ((!a) > 1) @{ @dots{} @}
7165 @end smallexample
7166
7167 This warning is enabled by @option{-Wall}.
7168
7169 @item -Waggregate-return
7170 @opindex Waggregate-return
7171 @opindex Wno-aggregate-return
7172 Warn if any functions that return structures or unions are defined or
7173 called. (In languages where you can return an array, this also elicits
7174 a warning.)
7175
7176 @item -Wno-aggressive-loop-optimizations
7177 @opindex Wno-aggressive-loop-optimizations
7178 @opindex Waggressive-loop-optimizations
7179 Warn if in a loop with constant number of iterations the compiler detects
7180 undefined behavior in some statement during one or more of the iterations.
7181
7182 @item -Wno-attributes
7183 @opindex Wno-attributes
7184 @opindex Wattributes
7185 Do not warn if an unexpected @code{__attribute__} is used, such as
7186 unrecognized attributes, function attributes applied to variables,
7187 etc. This does not stop errors for incorrect use of supported
7188 attributes.
7189
7190 @item -Wno-builtin-declaration-mismatch
7191 @opindex Wno-builtin-declaration-mismatch
7192 @opindex Wbuiltin-declaration-mismatch
7193 Warn if a built-in function is declared with an incompatible signature
7194 or as a non-function, or when a built-in function declared with a type
7195 that does not include a prototype is called with arguments whose promoted
7196 types do not match those expected by the function. When @option{-Wextra}
7197 is specified, also warn when a built-in function that takes arguments is
7198 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7199 warning is enabled by default. To avoid the warning include the appropriate
7200 header to bring the prototypes of built-in functions into scope.
7201
7202 For example, the call to @code{memset} below is diagnosed by the warning
7203 because the function expects a value of type @code{size_t} as its argument
7204 but the type of @code{32} is @code{int}. With @option{-Wextra},
7205 the declaration of the function is diagnosed as well.
7206 @smallexample
7207 extern void* memset ();
7208 void f (void *d)
7209 @{
7210 memset (d, '\0', 32);
7211 @}
7212 @end smallexample
7213
7214 @item -Wno-builtin-macro-redefined
7215 @opindex Wno-builtin-macro-redefined
7216 @opindex Wbuiltin-macro-redefined
7217 Do not warn if certain built-in macros are redefined. This suppresses
7218 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7219 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7220
7221 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7222 @opindex Wstrict-prototypes
7223 @opindex Wno-strict-prototypes
7224 Warn if a function is declared or defined without specifying the
7225 argument types. (An old-style function definition is permitted without
7226 a warning if preceded by a declaration that specifies the argument
7227 types.)
7228
7229 @item -Wold-style-declaration @r{(C and Objective-C only)}
7230 @opindex Wold-style-declaration
7231 @opindex Wno-old-style-declaration
7232 Warn for obsolescent usages, according to the C Standard, in a
7233 declaration. For example, warn if storage-class specifiers like
7234 @code{static} are not the first things in a declaration. This warning
7235 is also enabled by @option{-Wextra}.
7236
7237 @item -Wold-style-definition @r{(C and Objective-C only)}
7238 @opindex Wold-style-definition
7239 @opindex Wno-old-style-definition
7240 Warn if an old-style function definition is used. A warning is given
7241 even if there is a previous prototype.
7242
7243 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7244 @opindex Wmissing-parameter-type
7245 @opindex Wno-missing-parameter-type
7246 A function parameter is declared without a type specifier in K&R-style
7247 functions:
7248
7249 @smallexample
7250 void foo(bar) @{ @}
7251 @end smallexample
7252
7253 This warning is also enabled by @option{-Wextra}.
7254
7255 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7256 @opindex Wmissing-prototypes
7257 @opindex Wno-missing-prototypes
7258 Warn if a global function is defined without a previous prototype
7259 declaration. This warning is issued even if the definition itself
7260 provides a prototype. Use this option to detect global functions
7261 that do not have a matching prototype declaration in a header file.
7262 This option is not valid for C++ because all function declarations
7263 provide prototypes and a non-matching declaration declares an
7264 overload rather than conflict with an earlier declaration.
7265 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7266
7267 @item -Wmissing-declarations
7268 @opindex Wmissing-declarations
7269 @opindex Wno-missing-declarations
7270 Warn if a global function is defined without a previous declaration.
7271 Do so even if the definition itself provides a prototype.
7272 Use this option to detect global functions that are not declared in
7273 header files. In C, no warnings are issued for functions with previous
7274 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7275 missing prototypes. In C++, no warnings are issued for function templates,
7276 or for inline functions, or for functions in anonymous namespaces.
7277
7278 @item -Wmissing-field-initializers
7279 @opindex Wmissing-field-initializers
7280 @opindex Wno-missing-field-initializers
7281 @opindex W
7282 @opindex Wextra
7283 @opindex Wno-extra
7284 Warn if a structure's initializer has some fields missing. For
7285 example, the following code causes such a warning, because
7286 @code{x.h} is implicitly zero:
7287
7288 @smallexample
7289 struct s @{ int f, g, h; @};
7290 struct s x = @{ 3, 4 @};
7291 @end smallexample
7292
7293 This option does not warn about designated initializers, so the following
7294 modification does not trigger a warning:
7295
7296 @smallexample
7297 struct s @{ int f, g, h; @};
7298 struct s x = @{ .f = 3, .g = 4 @};
7299 @end smallexample
7300
7301 In C this option does not warn about the universal zero initializer
7302 @samp{@{ 0 @}}:
7303
7304 @smallexample
7305 struct s @{ int f, g, h; @};
7306 struct s x = @{ 0 @};
7307 @end smallexample
7308
7309 Likewise, in C++ this option does not warn about the empty @{ @}
7310 initializer, for example:
7311
7312 @smallexample
7313 struct s @{ int f, g, h; @};
7314 s x = @{ @};
7315 @end smallexample
7316
7317 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7318 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7319
7320 @item -Wno-multichar
7321 @opindex Wno-multichar
7322 @opindex Wmultichar
7323 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7324 Usually they indicate a typo in the user's code, as they have
7325 implementation-defined values, and should not be used in portable code.
7326
7327 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7328 @opindex Wnormalized=
7329 @opindex Wnormalized
7330 @opindex Wno-normalized
7331 @cindex NFC
7332 @cindex NFKC
7333 @cindex character set, input normalization
7334 In ISO C and ISO C++, two identifiers are different if they are
7335 different sequences of characters. However, sometimes when characters
7336 outside the basic ASCII character set are used, you can have two
7337 different character sequences that look the same. To avoid confusion,
7338 the ISO 10646 standard sets out some @dfn{normalization rules} which
7339 when applied ensure that two sequences that look the same are turned into
7340 the same sequence. GCC can warn you if you are using identifiers that
7341 have not been normalized; this option controls that warning.
7342
7343 There are four levels of warning supported by GCC@. The default is
7344 @option{-Wnormalized=nfc}, which warns about any identifier that is
7345 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7346 recommended form for most uses. It is equivalent to
7347 @option{-Wnormalized}.
7348
7349 Unfortunately, there are some characters allowed in identifiers by
7350 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7351 identifiers. That is, there's no way to use these symbols in portable
7352 ISO C or C++ and have all your identifiers in NFC@.
7353 @option{-Wnormalized=id} suppresses the warning for these characters.
7354 It is hoped that future versions of the standards involved will correct
7355 this, which is why this option is not the default.
7356
7357 You can switch the warning off for all characters by writing
7358 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7359 only do this if you are using some other normalization scheme (like
7360 ``D''), because otherwise you can easily create bugs that are
7361 literally impossible to see.
7362
7363 Some characters in ISO 10646 have distinct meanings but look identical
7364 in some fonts or display methodologies, especially once formatting has
7365 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7366 LETTER N'', displays just like a regular @code{n} that has been
7367 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7368 normalization scheme to convert all these into a standard form as
7369 well, and GCC warns if your code is not in NFKC if you use
7370 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7371 about every identifier that contains the letter O because it might be
7372 confused with the digit 0, and so is not the default, but may be
7373 useful as a local coding convention if the programming environment
7374 cannot be fixed to display these characters distinctly.
7375
7376 @item -Wno-attribute-warning
7377 @opindex Wno-attribute-warning
7378 @opindex Wattribute-warning
7379 Do not warn about usage of functions (@pxref{Function Attributes})
7380 declared with @code{warning} attribute. By default, this warning is
7381 enabled. @option{-Wno-attribute-warning} can be used to disable the
7382 warning or @option{-Wno-error=attribute-warning} can be used to
7383 disable the error when compiled with @option{-Werror} flag.
7384
7385 @item -Wno-deprecated
7386 @opindex Wno-deprecated
7387 @opindex Wdeprecated
7388 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7389
7390 @item -Wno-deprecated-declarations
7391 @opindex Wno-deprecated-declarations
7392 @opindex Wdeprecated-declarations
7393 Do not warn about uses of functions (@pxref{Function Attributes}),
7394 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7395 Attributes}) marked as deprecated by using the @code{deprecated}
7396 attribute.
7397
7398 @item -Wno-overflow
7399 @opindex Wno-overflow
7400 @opindex Woverflow
7401 Do not warn about compile-time overflow in constant expressions.
7402
7403 @item -Wno-odr
7404 @opindex Wno-odr
7405 @opindex Wodr
7406 Warn about One Definition Rule violations during link-time optimization.
7407 Enabled by default.
7408
7409 @item -Wopenmp-simd
7410 @opindex Wopenmp-simd
7411 @opindex Wno-openmp-simd
7412 Warn if the vectorizer cost model overrides the OpenMP
7413 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7414 option can be used to relax the cost model.
7415
7416 @item -Woverride-init @r{(C and Objective-C only)}
7417 @opindex Woverride-init
7418 @opindex Wno-override-init
7419 @opindex W
7420 @opindex Wextra
7421 @opindex Wno-extra
7422 Warn if an initialized field without side effects is overridden when
7423 using designated initializers (@pxref{Designated Inits, , Designated
7424 Initializers}).
7425
7426 This warning is included in @option{-Wextra}. To get other
7427 @option{-Wextra} warnings without this one, use @option{-Wextra
7428 -Wno-override-init}.
7429
7430 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7431 @opindex Woverride-init-side-effects
7432 @opindex Wno-override-init-side-effects
7433 Warn if an initialized field with side effects is overridden when
7434 using designated initializers (@pxref{Designated Inits, , Designated
7435 Initializers}). This warning is enabled by default.
7436
7437 @item -Wpacked
7438 @opindex Wpacked
7439 @opindex Wno-packed
7440 Warn if a structure is given the packed attribute, but the packed
7441 attribute has no effect on the layout or size of the structure.
7442 Such structures may be mis-aligned for little benefit. For
7443 instance, in this code, the variable @code{f.x} in @code{struct bar}
7444 is misaligned even though @code{struct bar} does not itself
7445 have the packed attribute:
7446
7447 @smallexample
7448 @group
7449 struct foo @{
7450 int x;
7451 char a, b, c, d;
7452 @} __attribute__((packed));
7453 struct bar @{
7454 char z;
7455 struct foo f;
7456 @};
7457 @end group
7458 @end smallexample
7459
7460 @item -Wpacked-bitfield-compat
7461 @opindex Wpacked-bitfield-compat
7462 @opindex Wno-packed-bitfield-compat
7463 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7464 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7465 the change can lead to differences in the structure layout. GCC
7466 informs you when the offset of such a field has changed in GCC 4.4.
7467 For example there is no longer a 4-bit padding between field @code{a}
7468 and @code{b} in this structure:
7469
7470 @smallexample
7471 struct foo
7472 @{
7473 char a:4;
7474 char b:8;
7475 @} __attribute__ ((packed));
7476 @end smallexample
7477
7478 This warning is enabled by default. Use
7479 @option{-Wno-packed-bitfield-compat} to disable this warning.
7480
7481 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7482 @opindex Wpacked-not-aligned
7483 @opindex Wno-packed-not-aligned
7484 Warn if a structure field with explicitly specified alignment in a
7485 packed struct or union is misaligned. For example, a warning will
7486 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7487 'struct S' is less than 8}, in this code:
7488
7489 @smallexample
7490 @group
7491 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7492 struct __attribute__ ((packed)) S @{
7493 struct S8 s8;
7494 @};
7495 @end group
7496 @end smallexample
7497
7498 This warning is enabled by @option{-Wall}.
7499
7500 @item -Wpadded
7501 @opindex Wpadded
7502 @opindex Wno-padded
7503 Warn if padding is included in a structure, either to align an element
7504 of the structure or to align the whole structure. Sometimes when this
7505 happens it is possible to rearrange the fields of the structure to
7506 reduce the padding and so make the structure smaller.
7507
7508 @item -Wredundant-decls
7509 @opindex Wredundant-decls
7510 @opindex Wno-redundant-decls
7511 Warn if anything is declared more than once in the same scope, even in
7512 cases where multiple declaration is valid and changes nothing.
7513
7514 @item -Wno-restrict
7515 @opindex Wrestrict
7516 @opindex Wno-restrict
7517 Warn when an object referenced by a @code{restrict}-qualified parameter
7518 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7519 argument, or when copies between such objects overlap. For example,
7520 the call to the @code{strcpy} function below attempts to truncate the string
7521 by replacing its initial characters with the last four. However, because
7522 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7523 the call is diagnosed.
7524
7525 @smallexample
7526 void foo (void)
7527 @{
7528 char a[] = "abcd1234";
7529 strcpy (a, a + 4);
7530 @dots{}
7531 @}
7532 @end smallexample
7533 The @option{-Wrestrict} option detects some instances of simple overlap
7534 even without optimization but works best at @option{-O2} and above. It
7535 is included in @option{-Wall}.
7536
7537 @item -Wnested-externs @r{(C and Objective-C only)}
7538 @opindex Wnested-externs
7539 @opindex Wno-nested-externs
7540 Warn if an @code{extern} declaration is encountered within a function.
7541
7542 @item -Wno-inherited-variadic-ctor
7543 @opindex Winherited-variadic-ctor
7544 @opindex Wno-inherited-variadic-ctor
7545 Suppress warnings about use of C++11 inheriting constructors when the
7546 base class inherited from has a C variadic constructor; the warning is
7547 on by default because the ellipsis is not inherited.
7548
7549 @item -Winline
7550 @opindex Winline
7551 @opindex Wno-inline
7552 Warn if a function that is declared as inline cannot be inlined.
7553 Even with this option, the compiler does not warn about failures to
7554 inline functions declared in system headers.
7555
7556 The compiler uses a variety of heuristics to determine whether or not
7557 to inline a function. For example, the compiler takes into account
7558 the size of the function being inlined and the amount of inlining
7559 that has already been done in the current function. Therefore,
7560 seemingly insignificant changes in the source program can cause the
7561 warnings produced by @option{-Winline} to appear or disappear.
7562
7563 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7564 @opindex Wno-invalid-offsetof
7565 @opindex Winvalid-offsetof
7566 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7567 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7568 to a non-standard-layout type is undefined. In existing C++ implementations,
7569 however, @code{offsetof} typically gives meaningful results.
7570 This flag is for users who are aware that they are
7571 writing nonportable code and who have deliberately chosen to ignore the
7572 warning about it.
7573
7574 The restrictions on @code{offsetof} may be relaxed in a future version
7575 of the C++ standard.
7576
7577 @item -Wint-in-bool-context
7578 @opindex Wint-in-bool-context
7579 @opindex Wno-int-in-bool-context
7580 Warn for suspicious use of integer values where boolean values are expected,
7581 such as conditional expressions (?:) using non-boolean integer constants in
7582 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7583 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7584 for all kinds of multiplications regardless of the data type.
7585 This warning is enabled by @option{-Wall}.
7586
7587 @item -Wno-int-to-pointer-cast
7588 @opindex Wno-int-to-pointer-cast
7589 @opindex Wint-to-pointer-cast
7590 Suppress warnings from casts to pointer type of an integer of a
7591 different size. In C++, casting to a pointer type of smaller size is
7592 an error. @option{Wint-to-pointer-cast} is enabled by default.
7593
7594
7595 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7596 @opindex Wno-pointer-to-int-cast
7597 @opindex Wpointer-to-int-cast
7598 Suppress warnings from casts from a pointer to an integer type of a
7599 different size.
7600
7601 @item -Winvalid-pch
7602 @opindex Winvalid-pch
7603 @opindex Wno-invalid-pch
7604 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7605 the search path but cannot be used.
7606
7607 @item -Wlong-long
7608 @opindex Wlong-long
7609 @opindex Wno-long-long
7610 Warn if @code{long long} type is used. This is enabled by either
7611 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7612 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7613
7614 @item -Wvariadic-macros
7615 @opindex Wvariadic-macros
7616 @opindex Wno-variadic-macros
7617 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7618 alternate syntax is used in ISO C99 mode. This is enabled by either
7619 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7620 messages, use @option{-Wno-variadic-macros}.
7621
7622 @item -Wvarargs
7623 @opindex Wvarargs
7624 @opindex Wno-varargs
7625 Warn upon questionable usage of the macros used to handle variable
7626 arguments like @code{va_start}. This is default. To inhibit the
7627 warning messages, use @option{-Wno-varargs}.
7628
7629 @item -Wvector-operation-performance
7630 @opindex Wvector-operation-performance
7631 @opindex Wno-vector-operation-performance
7632 Warn if vector operation is not implemented via SIMD capabilities of the
7633 architecture. Mainly useful for the performance tuning.
7634 Vector operation can be implemented @code{piecewise}, which means that the
7635 scalar operation is performed on every vector element;
7636 @code{in parallel}, which means that the vector operation is implemented
7637 using scalars of wider type, which normally is more performance efficient;
7638 and @code{as a single scalar}, which means that vector fits into a
7639 scalar type.
7640
7641 @item -Wno-virtual-move-assign
7642 @opindex Wvirtual-move-assign
7643 @opindex Wno-virtual-move-assign
7644 Suppress warnings about inheriting from a virtual base with a
7645 non-trivial C++11 move assignment operator. This is dangerous because
7646 if the virtual base is reachable along more than one path, it is
7647 moved multiple times, which can mean both objects end up in the
7648 moved-from state. If the move assignment operator is written to avoid
7649 moving from a moved-from object, this warning can be disabled.
7650
7651 @item -Wvla
7652 @opindex Wvla
7653 @opindex Wno-vla
7654 Warn if a variable-length array is used in the code.
7655 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7656 the variable-length array.
7657
7658 @item -Wvla-larger-than=@var{byte-size}
7659 @opindex Wvla-larger-than=
7660 @opindex Wno-vla-larger-than
7661 If this option is used, the compiler will warn for declarations of
7662 variable-length arrays whose size is either unbounded, or bounded
7663 by an argument that allows the array size to exceed @var{byte-size}
7664 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7665 works, but with variable-length arrays.
7666
7667 Note that GCC may optimize small variable-length arrays of a known
7668 value into plain arrays, so this warning may not get triggered for
7669 such arrays.
7670
7671 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7672 is typically only effective when @option{-ftree-vrp} is active (default
7673 for @option{-O2} and above).
7674
7675 See also @option{-Walloca-larger-than=@var{byte-size}}.
7676
7677 @item -Wno-vla-larger-than
7678 @opindex Wno-vla-larger-than
7679 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7680 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7681
7682 @item -Wvolatile-register-var
7683 @opindex Wvolatile-register-var
7684 @opindex Wno-volatile-register-var
7685 Warn if a register variable is declared volatile. The volatile
7686 modifier does not inhibit all optimizations that may eliminate reads
7687 and/or writes to register variables. This warning is enabled by
7688 @option{-Wall}.
7689
7690 @item -Wdisabled-optimization
7691 @opindex Wdisabled-optimization
7692 @opindex Wno-disabled-optimization
7693 Warn if a requested optimization pass is disabled. This warning does
7694 not generally indicate that there is anything wrong with your code; it
7695 merely indicates that GCC's optimizers are unable to handle the code
7696 effectively. Often, the problem is that your code is too big or too
7697 complex; GCC refuses to optimize programs when the optimization
7698 itself is likely to take inordinate amounts of time.
7699
7700 @item -Wpointer-sign @r{(C and Objective-C only)}
7701 @opindex Wpointer-sign
7702 @opindex Wno-pointer-sign
7703 Warn for pointer argument passing or assignment with different signedness.
7704 This option is only supported for C and Objective-C@. It is implied by
7705 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7706 @option{-Wno-pointer-sign}.
7707
7708 @item -Wstack-protector
7709 @opindex Wstack-protector
7710 @opindex Wno-stack-protector
7711 This option is only active when @option{-fstack-protector} is active. It
7712 warns about functions that are not protected against stack smashing.
7713
7714 @item -Woverlength-strings
7715 @opindex Woverlength-strings
7716 @opindex Wno-overlength-strings
7717 Warn about string constants that are longer than the ``minimum
7718 maximum'' length specified in the C standard. Modern compilers
7719 generally allow string constants that are much longer than the
7720 standard's minimum limit, but very portable programs should avoid
7721 using longer strings.
7722
7723 The limit applies @emph{after} string constant concatenation, and does
7724 not count the trailing NUL@. In C90, the limit was 509 characters; in
7725 C99, it was raised to 4095. C++98 does not specify a normative
7726 minimum maximum, so we do not diagnose overlength strings in C++@.
7727
7728 This option is implied by @option{-Wpedantic}, and can be disabled with
7729 @option{-Wno-overlength-strings}.
7730
7731 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7732 @opindex Wunsuffixed-float-constants
7733 @opindex Wno-unsuffixed-float-constants
7734
7735 Issue a warning for any floating constant that does not have
7736 a suffix. When used together with @option{-Wsystem-headers} it
7737 warns about such constants in system header files. This can be useful
7738 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7739 from the decimal floating-point extension to C99.
7740
7741 @item -Wno-designated-init @r{(C and Objective-C only)}
7742 Suppress warnings when a positional initializer is used to initialize
7743 a structure that has been marked with the @code{designated_init}
7744 attribute.
7745
7746 @item -Whsa
7747 Issue a warning when HSAIL cannot be emitted for the compiled function or
7748 OpenMP construct.
7749
7750 @end table
7751
7752 @node Debugging Options
7753 @section Options for Debugging Your Program
7754 @cindex options, debugging
7755 @cindex debugging information options
7756
7757 To tell GCC to emit extra information for use by a debugger, in almost
7758 all cases you need only to add @option{-g} to your other options.
7759
7760 GCC allows you to use @option{-g} with
7761 @option{-O}. The shortcuts taken by optimized code may occasionally
7762 be surprising: some variables you declared may not exist
7763 at all; flow of control may briefly move where you did not expect it;
7764 some statements may not be executed because they compute constant
7765 results or their values are already at hand; some statements may
7766 execute in different places because they have been moved out of loops.
7767 Nevertheless it is possible to debug optimized output. This makes
7768 it reasonable to use the optimizer for programs that might have bugs.
7769
7770 If you are not using some other optimization option, consider
7771 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7772 With no @option{-O} option at all, some compiler passes that collect
7773 information useful for debugging do not run at all, so that
7774 @option{-Og} may result in a better debugging experience.
7775
7776 @table @gcctabopt
7777 @item -g
7778 @opindex g
7779 Produce debugging information in the operating system's native format
7780 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7781 information.
7782
7783 On most systems that use stabs format, @option{-g} enables use of extra
7784 debugging information that only GDB can use; this extra information
7785 makes debugging work better in GDB but probably makes other debuggers
7786 crash or
7787 refuse to read the program. If you want to control for certain whether
7788 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7789 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7790
7791 @item -ggdb
7792 @opindex ggdb
7793 Produce debugging information for use by GDB@. This means to use the
7794 most expressive format available (DWARF, stabs, or the native format
7795 if neither of those are supported), including GDB extensions if at all
7796 possible.
7797
7798 @item -gdwarf
7799 @itemx -gdwarf-@var{version}
7800 @opindex gdwarf
7801 Produce debugging information in DWARF format (if that is supported).
7802 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7803 for most targets is 4. DWARF Version 5 is only experimental.
7804
7805 Note that with DWARF Version 2, some ports require and always
7806 use some non-conflicting DWARF 3 extensions in the unwind tables.
7807
7808 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7809 for maximum benefit.
7810
7811 GCC no longer supports DWARF Version 1, which is substantially
7812 different than Version 2 and later. For historical reasons, some
7813 other DWARF-related options such as
7814 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7815 in their names, but apply to all currently-supported versions of DWARF.
7816
7817 @item -gstabs
7818 @opindex gstabs
7819 Produce debugging information in stabs format (if that is supported),
7820 without GDB extensions. This is the format used by DBX on most BSD
7821 systems. On MIPS, Alpha and System V Release 4 systems this option
7822 produces stabs debugging output that is not understood by DBX@.
7823 On System V Release 4 systems this option requires the GNU assembler.
7824
7825 @item -gstabs+
7826 @opindex gstabs+
7827 Produce debugging information in stabs format (if that is supported),
7828 using GNU extensions understood only by the GNU debugger (GDB)@. The
7829 use of these extensions is likely to make other debuggers crash or
7830 refuse to read the program.
7831
7832 @item -gxcoff
7833 @opindex gxcoff
7834 Produce debugging information in XCOFF format (if that is supported).
7835 This is the format used by the DBX debugger on IBM RS/6000 systems.
7836
7837 @item -gxcoff+
7838 @opindex gxcoff+
7839 Produce debugging information in XCOFF format (if that is supported),
7840 using GNU extensions understood only by the GNU debugger (GDB)@. The
7841 use of these extensions is likely to make other debuggers crash or
7842 refuse to read the program, and may cause assemblers other than the GNU
7843 assembler (GAS) to fail with an error.
7844
7845 @item -gvms
7846 @opindex gvms
7847 Produce debugging information in Alpha/VMS debug format (if that is
7848 supported). This is the format used by DEBUG on Alpha/VMS systems.
7849
7850 @item -g@var{level}
7851 @itemx -ggdb@var{level}
7852 @itemx -gstabs@var{level}
7853 @itemx -gxcoff@var{level}
7854 @itemx -gvms@var{level}
7855 Request debugging information and also use @var{level} to specify how
7856 much information. The default level is 2.
7857
7858 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7859 @option{-g}.
7860
7861 Level 1 produces minimal information, enough for making backtraces in
7862 parts of the program that you don't plan to debug. This includes
7863 descriptions of functions and external variables, and line number
7864 tables, but no information about local variables.
7865
7866 Level 3 includes extra information, such as all the macro definitions
7867 present in the program. Some debuggers support macro expansion when
7868 you use @option{-g3}.
7869
7870 If you use multiple @option{-g} options, with or without level numbers,
7871 the last such option is the one that is effective.
7872
7873 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7874 confusion with @option{-gdwarf-@var{level}}.
7875 Instead use an additional @option{-g@var{level}} option to change the
7876 debug level for DWARF.
7877
7878 @item -fno-eliminate-unused-debug-symbols
7879 @opindex feliminate-unused-debug-symbols
7880 @opindex fno-eliminate-unused-debug-symbols
7881 By default, no debug information is produced for symbols that are not actually
7882 used. Use this option if you want debug information for all symbols.
7883
7884 @item -femit-class-debug-always
7885 @opindex femit-class-debug-always
7886 Instead of emitting debugging information for a C++ class in only one
7887 object file, emit it in all object files using the class. This option
7888 should be used only with debuggers that are unable to handle the way GCC
7889 normally emits debugging information for classes because using this
7890 option increases the size of debugging information by as much as a
7891 factor of two.
7892
7893 @item -fno-merge-debug-strings
7894 @opindex fmerge-debug-strings
7895 @opindex fno-merge-debug-strings
7896 Direct the linker to not merge together strings in the debugging
7897 information that are identical in different object files. Merging is
7898 not supported by all assemblers or linkers. Merging decreases the size
7899 of the debug information in the output file at the cost of increasing
7900 link processing time. Merging is enabled by default.
7901
7902 @item -fdebug-prefix-map=@var{old}=@var{new}
7903 @opindex fdebug-prefix-map
7904 When compiling files residing in directory @file{@var{old}}, record
7905 debugging information describing them as if the files resided in
7906 directory @file{@var{new}} instead. This can be used to replace a
7907 build-time path with an install-time path in the debug info. It can
7908 also be used to change an absolute path to a relative path by using
7909 @file{.} for @var{new}. This can give more reproducible builds, which
7910 are location independent, but may require an extra command to tell GDB
7911 where to find the source files. See also @option{-ffile-prefix-map}.
7912
7913 @item -fvar-tracking
7914 @opindex fvar-tracking
7915 Run variable tracking pass. It computes where variables are stored at each
7916 position in code. Better debugging information is then generated
7917 (if the debugging information format supports this information).
7918
7919 It is enabled by default when compiling with optimization (@option{-Os},
7920 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7921 the debug info format supports it.
7922
7923 @item -fvar-tracking-assignments
7924 @opindex fvar-tracking-assignments
7925 @opindex fno-var-tracking-assignments
7926 Annotate assignments to user variables early in the compilation and
7927 attempt to carry the annotations over throughout the compilation all the
7928 way to the end, in an attempt to improve debug information while
7929 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7930
7931 It can be enabled even if var-tracking is disabled, in which case
7932 annotations are created and maintained, but discarded at the end.
7933 By default, this flag is enabled together with @option{-fvar-tracking},
7934 except when selective scheduling is enabled.
7935
7936 @item -gsplit-dwarf
7937 @opindex gsplit-dwarf
7938 Separate as much DWARF debugging information as possible into a
7939 separate output file with the extension @file{.dwo}. This option allows
7940 the build system to avoid linking files with debug information. To
7941 be useful, this option requires a debugger capable of reading @file{.dwo}
7942 files.
7943
7944 @item -gdescribe-dies
7945 @opindex gdescribe-dies
7946 Add description attributes to some DWARF DIEs that have no name attribute,
7947 such as artificial variables, external references and call site
7948 parameter DIEs.
7949
7950 @item -gpubnames
7951 @opindex gpubnames
7952 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7953
7954 @item -ggnu-pubnames
7955 @opindex ggnu-pubnames
7956 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7957 suitable for conversion into a GDB@ index. This option is only useful
7958 with a linker that can produce GDB@ index version 7.
7959
7960 @item -fdebug-types-section
7961 @opindex fdebug-types-section
7962 @opindex fno-debug-types-section
7963 When using DWARF Version 4 or higher, type DIEs can be put into
7964 their own @code{.debug_types} section instead of making them part of the
7965 @code{.debug_info} section. It is more efficient to put them in a separate
7966 comdat section since the linker can then remove duplicates.
7967 But not all DWARF consumers support @code{.debug_types} sections yet
7968 and on some objects @code{.debug_types} produces larger instead of smaller
7969 debugging information.
7970
7971 @item -grecord-gcc-switches
7972 @itemx -gno-record-gcc-switches
7973 @opindex grecord-gcc-switches
7974 @opindex gno-record-gcc-switches
7975 This switch causes the command-line options used to invoke the
7976 compiler that may affect code generation to be appended to the
7977 DW_AT_producer attribute in DWARF debugging information. The options
7978 are concatenated with spaces separating them from each other and from
7979 the compiler version.
7980 It is enabled by default.
7981 See also @option{-frecord-gcc-switches} for another
7982 way of storing compiler options into the object file.
7983
7984 @item -gstrict-dwarf
7985 @opindex gstrict-dwarf
7986 Disallow using extensions of later DWARF standard version than selected
7987 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7988 DWARF extensions from later standard versions is allowed.
7989
7990 @item -gno-strict-dwarf
7991 @opindex gno-strict-dwarf
7992 Allow using extensions of later DWARF standard version than selected with
7993 @option{-gdwarf-@var{version}}.
7994
7995 @item -gas-loc-support
7996 @opindex gas-loc-support
7997 Inform the compiler that the assembler supports @code{.loc} directives.
7998 It may then use them for the assembler to generate DWARF2+ line number
7999 tables.
8000
8001 This is generally desirable, because assembler-generated line-number
8002 tables are a lot more compact than those the compiler can generate
8003 itself.
8004
8005 This option will be enabled by default if, at GCC configure time, the
8006 assembler was found to support such directives.
8007
8008 @item -gno-as-loc-support
8009 @opindex gno-as-loc-support
8010 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8011 line number tables are to be generated.
8012
8013 @item -gas-locview-support
8014 @opindex gas-locview-support
8015 Inform the compiler that the assembler supports @code{view} assignment
8016 and reset assertion checking in @code{.loc} directives.
8017
8018 This option will be enabled by default if, at GCC configure time, the
8019 assembler was found to support them.
8020
8021 @item -gno-as-locview-support
8022 Force GCC to assign view numbers internally, if
8023 @option{-gvariable-location-views} are explicitly requested.
8024
8025 @item -gcolumn-info
8026 @itemx -gno-column-info
8027 @opindex gcolumn-info
8028 @opindex gno-column-info
8029 Emit location column information into DWARF debugging information, rather
8030 than just file and line.
8031 This option is enabled by default.
8032
8033 @item -gstatement-frontiers
8034 @itemx -gno-statement-frontiers
8035 @opindex gstatement-frontiers
8036 @opindex gno-statement-frontiers
8037 This option causes GCC to create markers in the internal representation
8038 at the beginning of statements, and to keep them roughly in place
8039 throughout compilation, using them to guide the output of @code{is_stmt}
8040 markers in the line number table. This is enabled by default when
8041 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8042 @dots{}), and outputting DWARF 2 debug information at the normal level.
8043
8044 @item -gvariable-location-views
8045 @itemx -gvariable-location-views=incompat5
8046 @itemx -gno-variable-location-views
8047 @opindex gvariable-location-views
8048 @opindex gvariable-location-views=incompat5
8049 @opindex gno-variable-location-views
8050 Augment variable location lists with progressive view numbers implied
8051 from the line number table. This enables debug information consumers to
8052 inspect state at certain points of the program, even if no instructions
8053 associated with the corresponding source locations are present at that
8054 point. If the assembler lacks support for view numbers in line number
8055 tables, this will cause the compiler to emit the line number table,
8056 which generally makes them somewhat less compact. The augmented line
8057 number tables and location lists are fully backward-compatible, so they
8058 can be consumed by debug information consumers that are not aware of
8059 these augmentations, but they won't derive any benefit from them either.
8060
8061 This is enabled by default when outputting DWARF 2 debug information at
8062 the normal level, as long as there is assembler support,
8063 @option{-fvar-tracking-assignments} is enabled and
8064 @option{-gstrict-dwarf} is not. When assembler support is not
8065 available, this may still be enabled, but it will force GCC to output
8066 internal line number tables, and if
8067 @option{-ginternal-reset-location-views} is not enabled, that will most
8068 certainly lead to silently mismatching location views.
8069
8070 There is a proposed representation for view numbers that is not backward
8071 compatible with the location list format introduced in DWARF 5, that can
8072 be enabled with @option{-gvariable-location-views=incompat5}. This
8073 option may be removed in the future, is only provided as a reference
8074 implementation of the proposed representation. Debug information
8075 consumers are not expected to support this extended format, and they
8076 would be rendered unable to decode location lists using it.
8077
8078 @item -ginternal-reset-location-views
8079 @itemx -gnointernal-reset-location-views
8080 @opindex ginternal-reset-location-views
8081 @opindex gno-internal-reset-location-views
8082 Attempt to determine location views that can be omitted from location
8083 view lists. This requires the compiler to have very accurate insn
8084 length estimates, which isn't always the case, and it may cause
8085 incorrect view lists to be generated silently when using an assembler
8086 that does not support location view lists. The GNU assembler will flag
8087 any such error as a @code{view number mismatch}. This is only enabled
8088 on ports that define a reliable estimation function.
8089
8090 @item -ginline-points
8091 @itemx -gno-inline-points
8092 @opindex ginline-points
8093 @opindex gno-inline-points
8094 Generate extended debug information for inlined functions. Location
8095 view tracking markers are inserted at inlined entry points, so that
8096 address and view numbers can be computed and output in debug
8097 information. This can be enabled independently of location views, in
8098 which case the view numbers won't be output, but it can only be enabled
8099 along with statement frontiers, and it is only enabled by default if
8100 location views are enabled.
8101
8102 @item -gz@r{[}=@var{type}@r{]}
8103 @opindex gz
8104 Produce compressed debug sections in DWARF format, if that is supported.
8105 If @var{type} is not given, the default type depends on the capabilities
8106 of the assembler and linker used. @var{type} may be one of
8107 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8108 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8109 compression in traditional GNU format). If the linker doesn't support
8110 writing compressed debug sections, the option is rejected. Otherwise,
8111 if the assembler does not support them, @option{-gz} is silently ignored
8112 when producing object files.
8113
8114 @item -femit-struct-debug-baseonly
8115 @opindex femit-struct-debug-baseonly
8116 Emit debug information for struct-like types
8117 only when the base name of the compilation source file
8118 matches the base name of file in which the struct is defined.
8119
8120 This option substantially reduces the size of debugging information,
8121 but at significant potential loss in type information to the debugger.
8122 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8123 See @option{-femit-struct-debug-detailed} for more detailed control.
8124
8125 This option works only with DWARF debug output.
8126
8127 @item -femit-struct-debug-reduced
8128 @opindex femit-struct-debug-reduced
8129 Emit debug information for struct-like types
8130 only when the base name of the compilation source file
8131 matches the base name of file in which the type is defined,
8132 unless the struct is a template or defined in a system header.
8133
8134 This option significantly reduces the size of debugging information,
8135 with some potential loss in type information to the debugger.
8136 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8137 See @option{-femit-struct-debug-detailed} for more detailed control.
8138
8139 This option works only with DWARF debug output.
8140
8141 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8142 @opindex femit-struct-debug-detailed
8143 Specify the struct-like types
8144 for which the compiler generates debug information.
8145 The intent is to reduce duplicate struct debug information
8146 between different object files within the same program.
8147
8148 This option is a detailed version of
8149 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8150 which serves for most needs.
8151
8152 A specification has the syntax@*
8153 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8154
8155 The optional first word limits the specification to
8156 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8157 A struct type is used directly when it is the type of a variable, member.
8158 Indirect uses arise through pointers to structs.
8159 That is, when use of an incomplete struct is valid, the use is indirect.
8160 An example is
8161 @samp{struct one direct; struct two * indirect;}.
8162
8163 The optional second word limits the specification to
8164 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8165 Generic structs are a bit complicated to explain.
8166 For C++, these are non-explicit specializations of template classes,
8167 or non-template classes within the above.
8168 Other programming languages have generics,
8169 but @option{-femit-struct-debug-detailed} does not yet implement them.
8170
8171 The third word specifies the source files for those
8172 structs for which the compiler should emit debug information.
8173 The values @samp{none} and @samp{any} have the normal meaning.
8174 The value @samp{base} means that
8175 the base of name of the file in which the type declaration appears
8176 must match the base of the name of the main compilation file.
8177 In practice, this means that when compiling @file{foo.c}, debug information
8178 is generated for types declared in that file and @file{foo.h},
8179 but not other header files.
8180 The value @samp{sys} means those types satisfying @samp{base}
8181 or declared in system or compiler headers.
8182
8183 You may need to experiment to determine the best settings for your application.
8184
8185 The default is @option{-femit-struct-debug-detailed=all}.
8186
8187 This option works only with DWARF debug output.
8188
8189 @item -fno-dwarf2-cfi-asm
8190 @opindex fdwarf2-cfi-asm
8191 @opindex fno-dwarf2-cfi-asm
8192 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8193 instead of using GAS @code{.cfi_*} directives.
8194
8195 @item -fno-eliminate-unused-debug-types
8196 @opindex feliminate-unused-debug-types
8197 @opindex fno-eliminate-unused-debug-types
8198 Normally, when producing DWARF output, GCC avoids producing debug symbol
8199 output for types that are nowhere used in the source file being compiled.
8200 Sometimes it is useful to have GCC emit debugging
8201 information for all types declared in a compilation
8202 unit, regardless of whether or not they are actually used
8203 in that compilation unit, for example
8204 if, in the debugger, you want to cast a value to a type that is
8205 not actually used in your program (but is declared). More often,
8206 however, this results in a significant amount of wasted space.
8207 @end table
8208
8209 @node Optimize Options
8210 @section Options That Control Optimization
8211 @cindex optimize options
8212 @cindex options, optimization
8213
8214 These options control various sorts of optimizations.
8215
8216 Without any optimization option, the compiler's goal is to reduce the
8217 cost of compilation and to make debugging produce the expected
8218 results. Statements are independent: if you stop the program with a
8219 breakpoint between statements, you can then assign a new value to any
8220 variable or change the program counter to any other statement in the
8221 function and get exactly the results you expect from the source
8222 code.
8223
8224 Turning on optimization flags makes the compiler attempt to improve
8225 the performance and/or code size at the expense of compilation time
8226 and possibly the ability to debug the program.
8227
8228 The compiler performs optimization based on the knowledge it has of the
8229 program. Compiling multiple files at once to a single output file mode allows
8230 the compiler to use information gained from all of the files when compiling
8231 each of them.
8232
8233 Not all optimizations are controlled directly by a flag. Only
8234 optimizations that have a flag are listed in this section.
8235
8236 Most optimizations are completely disabled at @option{-O0} or if an
8237 @option{-O} level is not set on the command line, even if individual
8238 optimization flags are specified. Similarly, @option{-Og} suppresses
8239 many optimization passes.
8240
8241 Depending on the target and how GCC was configured, a slightly different
8242 set of optimizations may be enabled at each @option{-O} level than
8243 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8244 to find out the exact set of optimizations that are enabled at each level.
8245 @xref{Overall Options}, for examples.
8246
8247 @table @gcctabopt
8248 @item -O
8249 @itemx -O1
8250 @opindex O
8251 @opindex O1
8252 Optimize. Optimizing compilation takes somewhat more time, and a lot
8253 more memory for a large function.
8254
8255 With @option{-O}, the compiler tries to reduce code size and execution
8256 time, without performing any optimizations that take a great deal of
8257 compilation time.
8258
8259 @c Note that in addition to the default_options_table list in opts.c,
8260 @c several optimization flags default to true but control optimization
8261 @c passes that are explicitly disabled at -O0.
8262
8263 @option{-O} turns on the following optimization flags:
8264
8265 @c Please keep the following list alphabetized.
8266 @gccoptlist{-fauto-inc-dec @gol
8267 -fbranch-count-reg @gol
8268 -fcombine-stack-adjustments @gol
8269 -fcompare-elim @gol
8270 -fcprop-registers @gol
8271 -fdce @gol
8272 -fdefer-pop @gol
8273 -fdelayed-branch @gol
8274 -fdse @gol
8275 -fforward-propagate @gol
8276 -fguess-branch-probability @gol
8277 -fif-conversion @gol
8278 -fif-conversion2 @gol
8279 -finline-functions-called-once @gol
8280 -fipa-profile @gol
8281 -fipa-pure-const @gol
8282 -fipa-reference @gol
8283 -fipa-reference-addressable @gol
8284 -fmerge-constants @gol
8285 -fmove-loop-invariants @gol
8286 -fomit-frame-pointer @gol
8287 -freorder-blocks @gol
8288 -fshrink-wrap @gol
8289 -fshrink-wrap-separate @gol
8290 -fsplit-wide-types @gol
8291 -fssa-backprop @gol
8292 -fssa-phiopt @gol
8293 -ftree-bit-ccp @gol
8294 -ftree-ccp @gol
8295 -ftree-ch @gol
8296 -ftree-coalesce-vars @gol
8297 -ftree-copy-prop @gol
8298 -ftree-dce @gol
8299 -ftree-dominator-opts @gol
8300 -ftree-dse @gol
8301 -ftree-forwprop @gol
8302 -ftree-fre @gol
8303 -ftree-phiprop @gol
8304 -ftree-pta @gol
8305 -ftree-scev-cprop @gol
8306 -ftree-sink @gol
8307 -ftree-slsr @gol
8308 -ftree-sra @gol
8309 -ftree-ter @gol
8310 -funit-at-a-time}
8311
8312 @item -O2
8313 @opindex O2
8314 Optimize even more. GCC performs nearly all supported optimizations
8315 that do not involve a space-speed tradeoff.
8316 As compared to @option{-O}, this option increases both compilation time
8317 and the performance of the generated code.
8318
8319 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8320 also turns on the following optimization flags:
8321
8322 @c Please keep the following list alphabetized!
8323 @gccoptlist{-falign-functions -falign-jumps @gol
8324 -falign-labels -falign-loops @gol
8325 -fcaller-saves @gol
8326 -fcode-hoisting @gol
8327 -fcrossjumping @gol
8328 -fcse-follow-jumps -fcse-skip-blocks @gol
8329 -fdelete-null-pointer-checks @gol
8330 -fdevirtualize -fdevirtualize-speculatively @gol
8331 -fexpensive-optimizations @gol
8332 -ffinite-loops @gol
8333 -fgcse -fgcse-lm @gol
8334 -fhoist-adjacent-loads @gol
8335 -finline-small-functions @gol
8336 -findirect-inlining @gol
8337 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8338 -fipa-ra -fipa-sra -fipa-vrp @gol
8339 -fisolate-erroneous-paths-dereference @gol
8340 -flra-remat @gol
8341 -foptimize-sibling-calls @gol
8342 -foptimize-strlen @gol
8343 -fpartial-inlining @gol
8344 -fpeephole2 @gol
8345 -freorder-blocks-algorithm=stc @gol
8346 -freorder-blocks-and-partition -freorder-functions @gol
8347 -frerun-cse-after-loop @gol
8348 -fschedule-insns -fschedule-insns2 @gol
8349 -fsched-interblock -fsched-spec @gol
8350 -fstore-merging @gol
8351 -fstrict-aliasing @gol
8352 -fthread-jumps @gol
8353 -ftree-builtin-call-dce @gol
8354 -ftree-pre @gol
8355 -ftree-switch-conversion -ftree-tail-merge @gol
8356 -ftree-vrp}
8357
8358 Please note the warning under @option{-fgcse} about
8359 invoking @option{-O2} on programs that use computed gotos.
8360
8361 @item -O3
8362 @opindex O3
8363 Optimize yet more. @option{-O3} turns on all optimizations specified
8364 by @option{-O2} and also turns on the following optimization flags:
8365
8366 @c Please keep the following list alphabetized!
8367 @gccoptlist{-fgcse-after-reload @gol
8368 -finline-functions @gol
8369 -fipa-cp-clone
8370 -floop-interchange @gol
8371 -floop-unroll-and-jam @gol
8372 -fpeel-loops @gol
8373 -fpredictive-commoning @gol
8374 -fsplit-paths @gol
8375 -ftree-loop-distribute-patterns @gol
8376 -ftree-loop-distribution @gol
8377 -ftree-loop-vectorize @gol
8378 -ftree-partial-pre @gol
8379 -ftree-slp-vectorize @gol
8380 -funswitch-loops @gol
8381 -fvect-cost-model @gol
8382 -fversion-loops-for-strides}
8383
8384 @item -O0
8385 @opindex O0
8386 Reduce compilation time and make debugging produce the expected
8387 results. This is the default.
8388
8389 @item -Os
8390 @opindex Os
8391 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8392 except those that often increase code size:
8393
8394 @gccoptlist{-falign-functions -falign-jumps @gol
8395 -falign-labels -falign-loops @gol
8396 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8397
8398 It also enables @option{-finline-functions}, causes the compiler to tune for
8399 code size rather than execution speed, and performs further optimizations
8400 designed to reduce code size.
8401
8402 @item -Ofast
8403 @opindex Ofast
8404 Disregard strict standards compliance. @option{-Ofast} enables all
8405 @option{-O3} optimizations. It also enables optimizations that are not
8406 valid for all standard-compliant programs.
8407 It turns on @option{-ffast-math} and the Fortran-specific
8408 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8409 specified, and @option{-fno-protect-parens}.
8410
8411 @item -Og
8412 @opindex Og
8413 Optimize debugging experience. @option{-Og} should be the optimization
8414 level of choice for the standard edit-compile-debug cycle, offering
8415 a reasonable level of optimization while maintaining fast compilation
8416 and a good debugging experience. It is a better choice than @option{-O0}
8417 for producing debuggable code because some compiler passes
8418 that collect debug information are disabled at @option{-O0}.
8419
8420 Like @option{-O0}, @option{-Og} completely disables a number of
8421 optimization passes so that individual options controlling them have
8422 no effect. Otherwise @option{-Og} enables all @option{-O1}
8423 optimization flags except for those that may interfere with debugging:
8424
8425 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8426 -fif-conversion -fif-conversion2 @gol
8427 -finline-functions-called-once @gol
8428 -fmove-loop-invariants -fssa-phiopt @gol
8429 -ftree-bit-ccp -ftree-pta -ftree-sra}
8430
8431 @end table
8432
8433 If you use multiple @option{-O} options, with or without level numbers,
8434 the last such option is the one that is effective.
8435
8436 Options of the form @option{-f@var{flag}} specify machine-independent
8437 flags. Most flags have both positive and negative forms; the negative
8438 form of @option{-ffoo} is @option{-fno-foo}. In the table
8439 below, only one of the forms is listed---the one you typically
8440 use. You can figure out the other form by either removing @samp{no-}
8441 or adding it.
8442
8443 The following options control specific optimizations. They are either
8444 activated by @option{-O} options or are related to ones that are. You
8445 can use the following flags in the rare cases when ``fine-tuning'' of
8446 optimizations to be performed is desired.
8447
8448 @table @gcctabopt
8449 @item -fno-defer-pop
8450 @opindex fno-defer-pop
8451 @opindex fdefer-pop
8452 For machines that must pop arguments after a function call, always pop
8453 the arguments as soon as each function returns.
8454 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8455 this allows the compiler to let arguments accumulate on the stack for several
8456 function calls and pop them all at once.
8457
8458 @item -fforward-propagate
8459 @opindex fforward-propagate
8460 Perform a forward propagation pass on RTL@. The pass tries to combine two
8461 instructions and checks if the result can be simplified. If loop unrolling
8462 is active, two passes are performed and the second is scheduled after
8463 loop unrolling.
8464
8465 This option is enabled by default at optimization levels @option{-O},
8466 @option{-O2}, @option{-O3}, @option{-Os}.
8467
8468 @item -ffp-contract=@var{style}
8469 @opindex ffp-contract
8470 @option{-ffp-contract=off} disables floating-point expression contraction.
8471 @option{-ffp-contract=fast} enables floating-point expression contraction
8472 such as forming of fused multiply-add operations if the target has
8473 native support for them.
8474 @option{-ffp-contract=on} enables floating-point expression contraction
8475 if allowed by the language standard. This is currently not implemented
8476 and treated equal to @option{-ffp-contract=off}.
8477
8478 The default is @option{-ffp-contract=fast}.
8479
8480 @item -fomit-frame-pointer
8481 @opindex fomit-frame-pointer
8482 Omit the frame pointer in functions that don't need one. This avoids the
8483 instructions to save, set up and restore the frame pointer; on many targets
8484 it also makes an extra register available.
8485
8486 On some targets this flag has no effect because the standard calling sequence
8487 always uses a frame pointer, so it cannot be omitted.
8488
8489 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8490 is used in all functions. Several targets always omit the frame pointer in
8491 leaf functions.
8492
8493 Enabled by default at @option{-O} and higher.
8494
8495 @item -foptimize-sibling-calls
8496 @opindex foptimize-sibling-calls
8497 Optimize sibling and tail recursive calls.
8498
8499 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8500
8501 @item -foptimize-strlen
8502 @opindex foptimize-strlen
8503 Optimize various standard C string functions (e.g.@: @code{strlen},
8504 @code{strchr} or @code{strcpy}) and
8505 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8506
8507 Enabled at levels @option{-O2}, @option{-O3}.
8508
8509 @item -fno-inline
8510 @opindex fno-inline
8511 @opindex finline
8512 Do not expand any functions inline apart from those marked with
8513 the @code{always_inline} attribute. This is the default when not
8514 optimizing.
8515
8516 Single functions can be exempted from inlining by marking them
8517 with the @code{noinline} attribute.
8518
8519 @item -finline-small-functions
8520 @opindex finline-small-functions
8521 Integrate functions into their callers when their body is smaller than expected
8522 function call code (so overall size of program gets smaller). The compiler
8523 heuristically decides which functions are simple enough to be worth integrating
8524 in this way. This inlining applies to all functions, even those not declared
8525 inline.
8526
8527 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8528
8529 @item -findirect-inlining
8530 @opindex findirect-inlining
8531 Inline also indirect calls that are discovered to be known at compile
8532 time thanks to previous inlining. This option has any effect only
8533 when inlining itself is turned on by the @option{-finline-functions}
8534 or @option{-finline-small-functions} options.
8535
8536 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8537
8538 @item -finline-functions
8539 @opindex finline-functions
8540 Consider all functions for inlining, even if they are not declared inline.
8541 The compiler heuristically decides which functions are worth integrating
8542 in this way.
8543
8544 If all calls to a given function are integrated, and the function is
8545 declared @code{static}, then the function is normally not output as
8546 assembler code in its own right.
8547
8548 Enabled at levels @option{-O3}, @option{-Os}. Also enabled
8549 by @option{-fprofile-use} and @option{-fauto-profile}.
8550
8551 @item -finline-functions-called-once
8552 @opindex finline-functions-called-once
8553 Consider all @code{static} functions called once for inlining into their
8554 caller even if they are not marked @code{inline}. If a call to a given
8555 function is integrated, then the function is not output as assembler code
8556 in its own right.
8557
8558 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8559 but not @option{-Og}.
8560
8561 @item -fearly-inlining
8562 @opindex fearly-inlining
8563 Inline functions marked by @code{always_inline} and functions whose body seems
8564 smaller than the function call overhead early before doing
8565 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8566 makes profiling significantly cheaper and usually inlining faster on programs
8567 having large chains of nested wrapper functions.
8568
8569 Enabled by default.
8570
8571 @item -fipa-sra
8572 @opindex fipa-sra
8573 Perform interprocedural scalar replacement of aggregates, removal of
8574 unused parameters and replacement of parameters passed by reference
8575 by parameters passed by value.
8576
8577 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8578
8579 @item -finline-limit=@var{n}
8580 @opindex finline-limit
8581 By default, GCC limits the size of functions that can be inlined. This flag
8582 allows coarse control of this limit. @var{n} is the size of functions that
8583 can be inlined in number of pseudo instructions.
8584
8585 Inlining is actually controlled by a number of parameters, which may be
8586 specified individually by using @option{--param @var{name}=@var{value}}.
8587 The @option{-finline-limit=@var{n}} option sets some of these parameters
8588 as follows:
8589
8590 @table @gcctabopt
8591 @item max-inline-insns-single
8592 is set to @var{n}/2.
8593 @item max-inline-insns-auto
8594 is set to @var{n}/2.
8595 @end table
8596
8597 See below for a documentation of the individual
8598 parameters controlling inlining and for the defaults of these parameters.
8599
8600 @emph{Note:} there may be no value to @option{-finline-limit} that results
8601 in default behavior.
8602
8603 @emph{Note:} pseudo instruction represents, in this particular context, an
8604 abstract measurement of function's size. In no way does it represent a count
8605 of assembly instructions and as such its exact meaning might change from one
8606 release to an another.
8607
8608 @item -fno-keep-inline-dllexport
8609 @opindex fno-keep-inline-dllexport
8610 @opindex fkeep-inline-dllexport
8611 This is a more fine-grained version of @option{-fkeep-inline-functions},
8612 which applies only to functions that are declared using the @code{dllexport}
8613 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8614 Functions}.
8615
8616 @item -fkeep-inline-functions
8617 @opindex fkeep-inline-functions
8618 In C, emit @code{static} functions that are declared @code{inline}
8619 into the object file, even if the function has been inlined into all
8620 of its callers. This switch does not affect functions using the
8621 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8622 inline functions into the object file.
8623
8624 @item -fkeep-static-functions
8625 @opindex fkeep-static-functions
8626 Emit @code{static} functions into the object file, even if the function
8627 is never used.
8628
8629 @item -fkeep-static-consts
8630 @opindex fkeep-static-consts
8631 Emit variables declared @code{static const} when optimization isn't turned
8632 on, even if the variables aren't referenced.
8633
8634 GCC enables this option by default. If you want to force the compiler to
8635 check if a variable is referenced, regardless of whether or not
8636 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8637
8638 @item -fmerge-constants
8639 @opindex fmerge-constants
8640 Attempt to merge identical constants (string constants and floating-point
8641 constants) across compilation units.
8642
8643 This option is the default for optimized compilation if the assembler and
8644 linker support it. Use @option{-fno-merge-constants} to inhibit this
8645 behavior.
8646
8647 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8648
8649 @item -fmerge-all-constants
8650 @opindex fmerge-all-constants
8651 Attempt to merge identical constants and identical variables.
8652
8653 This option implies @option{-fmerge-constants}. In addition to
8654 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8655 arrays or initialized constant variables with integral or floating-point
8656 types. Languages like C or C++ require each variable, including multiple
8657 instances of the same variable in recursive calls, to have distinct locations,
8658 so using this option results in non-conforming
8659 behavior.
8660
8661 @item -fmodulo-sched
8662 @opindex fmodulo-sched
8663 Perform swing modulo scheduling immediately before the first scheduling
8664 pass. This pass looks at innermost loops and reorders their
8665 instructions by overlapping different iterations.
8666
8667 @item -fmodulo-sched-allow-regmoves
8668 @opindex fmodulo-sched-allow-regmoves
8669 Perform more aggressive SMS-based modulo scheduling with register moves
8670 allowed. By setting this flag certain anti-dependences edges are
8671 deleted, which triggers the generation of reg-moves based on the
8672 life-range analysis. This option is effective only with
8673 @option{-fmodulo-sched} enabled.
8674
8675 @item -fno-branch-count-reg
8676 @opindex fno-branch-count-reg
8677 @opindex fbranch-count-reg
8678 Disable the optimization pass that scans for opportunities to use
8679 ``decrement and branch'' instructions on a count register instead of
8680 instruction sequences that decrement a register, compare it against zero, and
8681 then branch based upon the result. This option is only meaningful on
8682 architectures that support such instructions, which include x86, PowerPC,
8683 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8684 doesn't remove the decrement and branch instructions from the generated
8685 instruction stream introduced by other optimization passes.
8686
8687 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8688 except for @option{-Og}.
8689
8690 @item -fno-function-cse
8691 @opindex fno-function-cse
8692 @opindex ffunction-cse
8693 Do not put function addresses in registers; make each instruction that
8694 calls a constant function contain the function's address explicitly.
8695
8696 This option results in less efficient code, but some strange hacks
8697 that alter the assembler output may be confused by the optimizations
8698 performed when this option is not used.
8699
8700 The default is @option{-ffunction-cse}
8701
8702 @item -fno-zero-initialized-in-bss
8703 @opindex fno-zero-initialized-in-bss
8704 @opindex fzero-initialized-in-bss
8705 If the target supports a BSS section, GCC by default puts variables that
8706 are initialized to zero into BSS@. This can save space in the resulting
8707 code.
8708
8709 This option turns off this behavior because some programs explicitly
8710 rely on variables going to the data section---e.g., so that the
8711 resulting executable can find the beginning of that section and/or make
8712 assumptions based on that.
8713
8714 The default is @option{-fzero-initialized-in-bss}.
8715
8716 @item -fthread-jumps
8717 @opindex fthread-jumps
8718 Perform optimizations that check to see if a jump branches to a
8719 location where another comparison subsumed by the first is found. If
8720 so, the first branch is redirected to either the destination of the
8721 second branch or a point immediately following it, depending on whether
8722 the condition is known to be true or false.
8723
8724 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8725
8726 @item -fsplit-wide-types
8727 @opindex fsplit-wide-types
8728 When using a type that occupies multiple registers, such as @code{long
8729 long} on a 32-bit system, split the registers apart and allocate them
8730 independently. This normally generates better code for those types,
8731 but may make debugging more difficult.
8732
8733 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8734 @option{-Os}.
8735
8736 @item -fsplit-wide-types-early
8737 @opindex fsplit-wide-types-early
8738 Fully split wide types early, instead of very late.
8739 This option has no effect unless @option{-fsplit-wide-types} is turned on.
8740
8741 This is the default on some targets.
8742
8743 @item -fcse-follow-jumps
8744 @opindex fcse-follow-jumps
8745 In common subexpression elimination (CSE), scan through jump instructions
8746 when the target of the jump is not reached by any other path. For
8747 example, when CSE encounters an @code{if} statement with an
8748 @code{else} clause, CSE follows the jump when the condition
8749 tested is false.
8750
8751 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8752
8753 @item -fcse-skip-blocks
8754 @opindex fcse-skip-blocks
8755 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8756 follow jumps that conditionally skip over blocks. When CSE
8757 encounters a simple @code{if} statement with no else clause,
8758 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8759 body of the @code{if}.
8760
8761 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8762
8763 @item -frerun-cse-after-loop
8764 @opindex frerun-cse-after-loop
8765 Re-run common subexpression elimination after loop optimizations are
8766 performed.
8767
8768 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8769
8770 @item -fgcse
8771 @opindex fgcse
8772 Perform a global common subexpression elimination pass.
8773 This pass also performs global constant and copy propagation.
8774
8775 @emph{Note:} When compiling a program using computed gotos, a GCC
8776 extension, you may get better run-time performance if you disable
8777 the global common subexpression elimination pass by adding
8778 @option{-fno-gcse} to the command line.
8779
8780 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8781
8782 @item -fgcse-lm
8783 @opindex fgcse-lm
8784 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8785 attempts to move loads that are only killed by stores into themselves. This
8786 allows a loop containing a load/store sequence to be changed to a load outside
8787 the loop, and a copy/store within the loop.
8788
8789 Enabled by default when @option{-fgcse} is enabled.
8790
8791 @item -fgcse-sm
8792 @opindex fgcse-sm
8793 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8794 global common subexpression elimination. This pass attempts to move
8795 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8796 loops containing a load/store sequence can be changed to a load before
8797 the loop and a store after the loop.
8798
8799 Not enabled at any optimization level.
8800
8801 @item -fgcse-las
8802 @opindex fgcse-las
8803 When @option{-fgcse-las} is enabled, the global common subexpression
8804 elimination pass eliminates redundant loads that come after stores to the
8805 same memory location (both partial and full redundancies).
8806
8807 Not enabled at any optimization level.
8808
8809 @item -fgcse-after-reload
8810 @opindex fgcse-after-reload
8811 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8812 pass is performed after reload. The purpose of this pass is to clean up
8813 redundant spilling.
8814
8815 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8816
8817 @item -faggressive-loop-optimizations
8818 @opindex faggressive-loop-optimizations
8819 This option tells the loop optimizer to use language constraints to
8820 derive bounds for the number of iterations of a loop. This assumes that
8821 loop code does not invoke undefined behavior by for example causing signed
8822 integer overflows or out-of-bound array accesses. The bounds for the
8823 number of iterations of a loop are used to guide loop unrolling and peeling
8824 and loop exit test optimizations.
8825 This option is enabled by default.
8826
8827 @item -funconstrained-commons
8828 @opindex funconstrained-commons
8829 This option tells the compiler that variables declared in common blocks
8830 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8831 prevents certain optimizations that depend on knowing the array bounds.
8832
8833 @item -fcrossjumping
8834 @opindex fcrossjumping
8835 Perform cross-jumping transformation.
8836 This transformation unifies equivalent code and saves code size. The
8837 resulting code may or may not perform better than without cross-jumping.
8838
8839 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8840
8841 @item -fauto-inc-dec
8842 @opindex fauto-inc-dec
8843 Combine increments or decrements of addresses with memory accesses.
8844 This pass is always skipped on architectures that do not have
8845 instructions to support this. Enabled by default at @option{-O} and
8846 higher on architectures that support this.
8847
8848 @item -fdce
8849 @opindex fdce
8850 Perform dead code elimination (DCE) on RTL@.
8851 Enabled by default at @option{-O} and higher.
8852
8853 @item -fdse
8854 @opindex fdse
8855 Perform dead store elimination (DSE) on RTL@.
8856 Enabled by default at @option{-O} and higher.
8857
8858 @item -fif-conversion
8859 @opindex fif-conversion
8860 Attempt to transform conditional jumps into branch-less equivalents. This
8861 includes use of conditional moves, min, max, set flags and abs instructions, and
8862 some tricks doable by standard arithmetics. The use of conditional execution
8863 on chips where it is available is controlled by @option{-fif-conversion2}.
8864
8865 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8866 not with @option{-Og}.
8867
8868 @item -fif-conversion2
8869 @opindex fif-conversion2
8870 Use conditional execution (where available) to transform conditional jumps into
8871 branch-less equivalents.
8872
8873 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8874 not with @option{-Og}.
8875
8876 @item -fdeclone-ctor-dtor
8877 @opindex fdeclone-ctor-dtor
8878 The C++ ABI requires multiple entry points for constructors and
8879 destructors: one for a base subobject, one for a complete object, and
8880 one for a virtual destructor that calls operator delete afterwards.
8881 For a hierarchy with virtual bases, the base and complete variants are
8882 clones, which means two copies of the function. With this option, the
8883 base and complete variants are changed to be thunks that call a common
8884 implementation.
8885
8886 Enabled by @option{-Os}.
8887
8888 @item -fdelete-null-pointer-checks
8889 @opindex fdelete-null-pointer-checks
8890 Assume that programs cannot safely dereference null pointers, and that
8891 no code or data element resides at address zero.
8892 This option enables simple constant
8893 folding optimizations at all optimization levels. In addition, other
8894 optimization passes in GCC use this flag to control global dataflow
8895 analyses that eliminate useless checks for null pointers; these assume
8896 that a memory access to address zero always results in a trap, so
8897 that if a pointer is checked after it has already been dereferenced,
8898 it cannot be null.
8899
8900 Note however that in some environments this assumption is not true.
8901 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8902 for programs that depend on that behavior.
8903
8904 This option is enabled by default on most targets. On Nios II ELF, it
8905 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8906
8907 Passes that use the dataflow information
8908 are enabled independently at different optimization levels.
8909
8910 @item -fdevirtualize
8911 @opindex fdevirtualize
8912 Attempt to convert calls to virtual functions to direct calls. This
8913 is done both within a procedure and interprocedurally as part of
8914 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8915 propagation (@option{-fipa-cp}).
8916 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8917
8918 @item -fdevirtualize-speculatively
8919 @opindex fdevirtualize-speculatively
8920 Attempt to convert calls to virtual functions to speculative direct calls.
8921 Based on the analysis of the type inheritance graph, determine for a given call
8922 the set of likely targets. If the set is small, preferably of size 1, change
8923 the call into a conditional deciding between direct and indirect calls. The
8924 speculative calls enable more optimizations, such as inlining. When they seem
8925 useless after further optimization, they are converted back into original form.
8926
8927 @item -fdevirtualize-at-ltrans
8928 @opindex fdevirtualize-at-ltrans
8929 Stream extra information needed for aggressive devirtualization when running
8930 the link-time optimizer in local transformation mode.
8931 This option enables more devirtualization but
8932 significantly increases the size of streamed data. For this reason it is
8933 disabled by default.
8934
8935 @item -fexpensive-optimizations
8936 @opindex fexpensive-optimizations
8937 Perform a number of minor optimizations that are relatively expensive.
8938
8939 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8940
8941 @item -free
8942 @opindex free
8943 Attempt to remove redundant extension instructions. This is especially
8944 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8945 registers after writing to their lower 32-bit half.
8946
8947 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8948 @option{-O3}, @option{-Os}.
8949
8950 @item -fno-lifetime-dse
8951 @opindex fno-lifetime-dse
8952 @opindex flifetime-dse
8953 In C++ the value of an object is only affected by changes within its
8954 lifetime: when the constructor begins, the object has an indeterminate
8955 value, and any changes during the lifetime of the object are dead when
8956 the object is destroyed. Normally dead store elimination will take
8957 advantage of this; if your code relies on the value of the object
8958 storage persisting beyond the lifetime of the object, you can use this
8959 flag to disable this optimization. To preserve stores before the
8960 constructor starts (e.g.@: because your operator new clears the object
8961 storage) but still treat the object as dead after the destructor you,
8962 can use @option{-flifetime-dse=1}. The default behavior can be
8963 explicitly selected with @option{-flifetime-dse=2}.
8964 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8965
8966 @item -flive-range-shrinkage
8967 @opindex flive-range-shrinkage
8968 Attempt to decrease register pressure through register live range
8969 shrinkage. This is helpful for fast processors with small or moderate
8970 size register sets.
8971
8972 @item -fira-algorithm=@var{algorithm}
8973 @opindex fira-algorithm
8974 Use the specified coloring algorithm for the integrated register
8975 allocator. The @var{algorithm} argument can be @samp{priority}, which
8976 specifies Chow's priority coloring, or @samp{CB}, which specifies
8977 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8978 for all architectures, but for those targets that do support it, it is
8979 the default because it generates better code.
8980
8981 @item -fira-region=@var{region}
8982 @opindex fira-region
8983 Use specified regions for the integrated register allocator. The
8984 @var{region} argument should be one of the following:
8985
8986 @table @samp
8987
8988 @item all
8989 Use all loops as register allocation regions.
8990 This can give the best results for machines with a small and/or
8991 irregular register set.
8992
8993 @item mixed
8994 Use all loops except for loops with small register pressure
8995 as the regions. This value usually gives
8996 the best results in most cases and for most architectures,
8997 and is enabled by default when compiling with optimization for speed
8998 (@option{-O}, @option{-O2}, @dots{}).
8999
9000 @item one
9001 Use all functions as a single region.
9002 This typically results in the smallest code size, and is enabled by default for
9003 @option{-Os} or @option{-O0}.
9004
9005 @end table
9006
9007 @item -fira-hoist-pressure
9008 @opindex fira-hoist-pressure
9009 Use IRA to evaluate register pressure in the code hoisting pass for
9010 decisions to hoist expressions. This option usually results in smaller
9011 code, but it can slow the compiler down.
9012
9013 This option is enabled at level @option{-Os} for all targets.
9014
9015 @item -fira-loop-pressure
9016 @opindex fira-loop-pressure
9017 Use IRA to evaluate register pressure in loops for decisions to move
9018 loop invariants. This option usually results in generation
9019 of faster and smaller code on machines with large register files (>= 32
9020 registers), but it can slow the compiler down.
9021
9022 This option is enabled at level @option{-O3} for some targets.
9023
9024 @item -fno-ira-share-save-slots
9025 @opindex fno-ira-share-save-slots
9026 @opindex fira-share-save-slots
9027 Disable sharing of stack slots used for saving call-used hard
9028 registers living through a call. Each hard register gets a
9029 separate stack slot, and as a result function stack frames are
9030 larger.
9031
9032 @item -fno-ira-share-spill-slots
9033 @opindex fno-ira-share-spill-slots
9034 @opindex fira-share-spill-slots
9035 Disable sharing of stack slots allocated for pseudo-registers. Each
9036 pseudo-register that does not get a hard register gets a separate
9037 stack slot, and as a result function stack frames are larger.
9038
9039 @item -flra-remat
9040 @opindex flra-remat
9041 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9042 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9043 values if it is profitable.
9044
9045 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9046
9047 @item -fdelayed-branch
9048 @opindex fdelayed-branch
9049 If supported for the target machine, attempt to reorder instructions
9050 to exploit instruction slots available after delayed branch
9051 instructions.
9052
9053 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9054 but not at @option{-Og}.
9055
9056 @item -fschedule-insns
9057 @opindex fschedule-insns
9058 If supported for the target machine, attempt to reorder instructions to
9059 eliminate execution stalls due to required data being unavailable. This
9060 helps machines that have slow floating point or memory load instructions
9061 by allowing other instructions to be issued until the result of the load
9062 or floating-point instruction is required.
9063
9064 Enabled at levels @option{-O2}, @option{-O3}.
9065
9066 @item -fschedule-insns2
9067 @opindex fschedule-insns2
9068 Similar to @option{-fschedule-insns}, but requests an additional pass of
9069 instruction scheduling after register allocation has been done. This is
9070 especially useful on machines with a relatively small number of
9071 registers and where memory load instructions take more than one cycle.
9072
9073 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9074
9075 @item -fno-sched-interblock
9076 @opindex fno-sched-interblock
9077 @opindex fsched-interblock
9078 Disable instruction scheduling across basic blocks, which
9079 is normally enabled when scheduling before register allocation, i.e.@:
9080 with @option{-fschedule-insns} or at @option{-O2} or higher.
9081
9082 @item -fno-sched-spec
9083 @opindex fno-sched-spec
9084 @opindex fsched-spec
9085 Disable speculative motion of non-load instructions, which
9086 is normally enabled when scheduling before register allocation, i.e.@:
9087 with @option{-fschedule-insns} or at @option{-O2} or higher.
9088
9089 @item -fsched-pressure
9090 @opindex fsched-pressure
9091 Enable register pressure sensitive insn scheduling before register
9092 allocation. This only makes sense when scheduling before register
9093 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9094 @option{-O2} or higher. Usage of this option can improve the
9095 generated code and decrease its size by preventing register pressure
9096 increase above the number of available hard registers and subsequent
9097 spills in register allocation.
9098
9099 @item -fsched-spec-load
9100 @opindex fsched-spec-load
9101 Allow speculative motion of some load instructions. This only makes
9102 sense when scheduling before register allocation, i.e.@: with
9103 @option{-fschedule-insns} or at @option{-O2} or higher.
9104
9105 @item -fsched-spec-load-dangerous
9106 @opindex fsched-spec-load-dangerous
9107 Allow speculative motion of more load instructions. This only makes
9108 sense when scheduling before register allocation, i.e.@: with
9109 @option{-fschedule-insns} or at @option{-O2} or higher.
9110
9111 @item -fsched-stalled-insns
9112 @itemx -fsched-stalled-insns=@var{n}
9113 @opindex fsched-stalled-insns
9114 Define how many insns (if any) can be moved prematurely from the queue
9115 of stalled insns into the ready list during the second scheduling pass.
9116 @option{-fno-sched-stalled-insns} means that no insns are moved
9117 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9118 on how many queued insns can be moved prematurely.
9119 @option{-fsched-stalled-insns} without a value is equivalent to
9120 @option{-fsched-stalled-insns=1}.
9121
9122 @item -fsched-stalled-insns-dep
9123 @itemx -fsched-stalled-insns-dep=@var{n}
9124 @opindex fsched-stalled-insns-dep
9125 Define how many insn groups (cycles) are examined for a dependency
9126 on a stalled insn that is a candidate for premature removal from the queue
9127 of stalled insns. This has an effect only during the second scheduling pass,
9128 and only if @option{-fsched-stalled-insns} is used.
9129 @option{-fno-sched-stalled-insns-dep} is equivalent to
9130 @option{-fsched-stalled-insns-dep=0}.
9131 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9132 @option{-fsched-stalled-insns-dep=1}.
9133
9134 @item -fsched2-use-superblocks
9135 @opindex fsched2-use-superblocks
9136 When scheduling after register allocation, use superblock scheduling.
9137 This allows motion across basic block boundaries,
9138 resulting in faster schedules. This option is experimental, as not all machine
9139 descriptions used by GCC model the CPU closely enough to avoid unreliable
9140 results from the algorithm.
9141
9142 This only makes sense when scheduling after register allocation, i.e.@: with
9143 @option{-fschedule-insns2} or at @option{-O2} or higher.
9144
9145 @item -fsched-group-heuristic
9146 @opindex fsched-group-heuristic
9147 Enable the group heuristic in the scheduler. This heuristic favors
9148 the instruction that belongs to a schedule group. This is enabled
9149 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9150 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9151
9152 @item -fsched-critical-path-heuristic
9153 @opindex fsched-critical-path-heuristic
9154 Enable the critical-path heuristic in the scheduler. This heuristic favors
9155 instructions on the critical path. This is enabled by default when
9156 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9157 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9158
9159 @item -fsched-spec-insn-heuristic
9160 @opindex fsched-spec-insn-heuristic
9161 Enable the speculative instruction heuristic in the scheduler. This
9162 heuristic favors speculative instructions with greater dependency weakness.
9163 This is enabled by default when scheduling is enabled, i.e.@:
9164 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9165 or at @option{-O2} or higher.
9166
9167 @item -fsched-rank-heuristic
9168 @opindex fsched-rank-heuristic
9169 Enable the rank heuristic in the scheduler. This heuristic favors
9170 the instruction belonging to a basic block with greater size or frequency.
9171 This is enabled by default when scheduling is enabled, i.e.@:
9172 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9173 at @option{-O2} or higher.
9174
9175 @item -fsched-last-insn-heuristic
9176 @opindex fsched-last-insn-heuristic
9177 Enable the last-instruction heuristic in the scheduler. This heuristic
9178 favors the instruction that is less dependent on the last instruction
9179 scheduled. This is enabled by default when scheduling is enabled,
9180 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9181 at @option{-O2} or higher.
9182
9183 @item -fsched-dep-count-heuristic
9184 @opindex fsched-dep-count-heuristic
9185 Enable the dependent-count heuristic in the scheduler. This heuristic
9186 favors the instruction that has more instructions depending on it.
9187 This is enabled by default when scheduling is enabled, i.e.@:
9188 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9189 at @option{-O2} or higher.
9190
9191 @item -freschedule-modulo-scheduled-loops
9192 @opindex freschedule-modulo-scheduled-loops
9193 Modulo scheduling is performed before traditional scheduling. If a loop
9194 is modulo scheduled, later scheduling passes may change its schedule.
9195 Use this option to control that behavior.
9196
9197 @item -fselective-scheduling
9198 @opindex fselective-scheduling
9199 Schedule instructions using selective scheduling algorithm. Selective
9200 scheduling runs instead of the first scheduler pass.
9201
9202 @item -fselective-scheduling2
9203 @opindex fselective-scheduling2
9204 Schedule instructions using selective scheduling algorithm. Selective
9205 scheduling runs instead of the second scheduler pass.
9206
9207 @item -fsel-sched-pipelining
9208 @opindex fsel-sched-pipelining
9209 Enable software pipelining of innermost loops during selective scheduling.
9210 This option has no effect unless one of @option{-fselective-scheduling} or
9211 @option{-fselective-scheduling2} is turned on.
9212
9213 @item -fsel-sched-pipelining-outer-loops
9214 @opindex fsel-sched-pipelining-outer-loops
9215 When pipelining loops during selective scheduling, also pipeline outer loops.
9216 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9217
9218 @item -fsemantic-interposition
9219 @opindex fsemantic-interposition
9220 Some object formats, like ELF, allow interposing of symbols by the
9221 dynamic linker.
9222 This means that for symbols exported from the DSO, the compiler cannot perform
9223 interprocedural propagation, inlining and other optimizations in anticipation
9224 that the function or variable in question may change. While this feature is
9225 useful, for example, to rewrite memory allocation functions by a debugging
9226 implementation, it is expensive in the terms of code quality.
9227 With @option{-fno-semantic-interposition} the compiler assumes that
9228 if interposition happens for functions the overwriting function will have
9229 precisely the same semantics (and side effects).
9230 Similarly if interposition happens
9231 for variables, the constructor of the variable will be the same. The flag
9232 has no effect for functions explicitly declared inline
9233 (where it is never allowed for interposition to change semantics)
9234 and for symbols explicitly declared weak.
9235
9236 @item -fshrink-wrap
9237 @opindex fshrink-wrap
9238 Emit function prologues only before parts of the function that need it,
9239 rather than at the top of the function. This flag is enabled by default at
9240 @option{-O} and higher.
9241
9242 @item -fshrink-wrap-separate
9243 @opindex fshrink-wrap-separate
9244 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9245 those parts are only executed when needed.
9246 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9247 is also turned on and the target supports this.
9248
9249 @item -fcaller-saves
9250 @opindex fcaller-saves
9251 Enable allocation of values to registers that are clobbered by
9252 function calls, by emitting extra instructions to save and restore the
9253 registers around such calls. Such allocation is done only when it
9254 seems to result in better code.
9255
9256 This option is always enabled by default on certain machines, usually
9257 those which have no call-preserved registers to use instead.
9258
9259 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9260
9261 @item -fcombine-stack-adjustments
9262 @opindex fcombine-stack-adjustments
9263 Tracks stack adjustments (pushes and pops) and stack memory references
9264 and then tries to find ways to combine them.
9265
9266 Enabled by default at @option{-O1} and higher.
9267
9268 @item -fipa-ra
9269 @opindex fipa-ra
9270 Use caller save registers for allocation if those registers are not used by
9271 any called function. In that case it is not necessary to save and restore
9272 them around calls. This is only possible if called functions are part of
9273 same compilation unit as current function and they are compiled before it.
9274
9275 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9276 is disabled if generated code will be instrumented for profiling
9277 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9278 exactly (this happens on targets that do not expose prologues
9279 and epilogues in RTL).
9280
9281 @item -fconserve-stack
9282 @opindex fconserve-stack
9283 Attempt to minimize stack usage. The compiler attempts to use less
9284 stack space, even if that makes the program slower. This option
9285 implies setting the @option{large-stack-frame} parameter to 100
9286 and the @option{large-stack-frame-growth} parameter to 400.
9287
9288 @item -ftree-reassoc
9289 @opindex ftree-reassoc
9290 Perform reassociation on trees. This flag is enabled by default
9291 at @option{-O} and higher.
9292
9293 @item -fcode-hoisting
9294 @opindex fcode-hoisting
9295 Perform code hoisting. Code hoisting tries to move the
9296 evaluation of expressions executed on all paths to the function exit
9297 as early as possible. This is especially useful as a code size
9298 optimization, but it often helps for code speed as well.
9299 This flag is enabled by default at @option{-O2} and higher.
9300
9301 @item -ftree-pre
9302 @opindex ftree-pre
9303 Perform partial redundancy elimination (PRE) on trees. This flag is
9304 enabled by default at @option{-O2} and @option{-O3}.
9305
9306 @item -ftree-partial-pre
9307 @opindex ftree-partial-pre
9308 Make partial redundancy elimination (PRE) more aggressive. This flag is
9309 enabled by default at @option{-O3}.
9310
9311 @item -ftree-forwprop
9312 @opindex ftree-forwprop
9313 Perform forward propagation on trees. This flag is enabled by default
9314 at @option{-O} and higher.
9315
9316 @item -ftree-fre
9317 @opindex ftree-fre
9318 Perform full redundancy elimination (FRE) on trees. The difference
9319 between FRE and PRE is that FRE only considers expressions
9320 that are computed on all paths leading to the redundant computation.
9321 This analysis is faster than PRE, though it exposes fewer redundancies.
9322 This flag is enabled by default at @option{-O} and higher.
9323
9324 @item -ftree-phiprop
9325 @opindex ftree-phiprop
9326 Perform hoisting of loads from conditional pointers on trees. This
9327 pass is enabled by default at @option{-O} and higher.
9328
9329 @item -fhoist-adjacent-loads
9330 @opindex fhoist-adjacent-loads
9331 Speculatively hoist loads from both branches of an if-then-else if the
9332 loads are from adjacent locations in the same structure and the target
9333 architecture has a conditional move instruction. This flag is enabled
9334 by default at @option{-O2} and higher.
9335
9336 @item -ftree-copy-prop
9337 @opindex ftree-copy-prop
9338 Perform copy propagation on trees. This pass eliminates unnecessary
9339 copy operations. This flag is enabled by default at @option{-O} and
9340 higher.
9341
9342 @item -fipa-pure-const
9343 @opindex fipa-pure-const
9344 Discover which functions are pure or constant.
9345 Enabled by default at @option{-O} and higher.
9346
9347 @item -fipa-reference
9348 @opindex fipa-reference
9349 Discover which static variables do not escape the
9350 compilation unit.
9351 Enabled by default at @option{-O} and higher.
9352
9353 @item -fipa-reference-addressable
9354 @opindex fipa-reference-addressable
9355 Discover read-only, write-only and non-addressable static variables.
9356 Enabled by default at @option{-O} and higher.
9357
9358 @item -fipa-stack-alignment
9359 @opindex fipa-stack-alignment
9360 Reduce stack alignment on call sites if possible.
9361 Enabled by default.
9362
9363 @item -fipa-pta
9364 @opindex fipa-pta
9365 Perform interprocedural pointer analysis and interprocedural modification
9366 and reference analysis. This option can cause excessive memory and
9367 compile-time usage on large compilation units. It is not enabled by
9368 default at any optimization level.
9369
9370 @item -fipa-profile
9371 @opindex fipa-profile
9372 Perform interprocedural profile propagation. The functions called only from
9373 cold functions are marked as cold. Also functions executed once (such as
9374 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9375 functions and loop less parts of functions executed once are then optimized for
9376 size.
9377 Enabled by default at @option{-O} and higher.
9378
9379 @item -fipa-cp
9380 @opindex fipa-cp
9381 Perform interprocedural constant propagation.
9382 This optimization analyzes the program to determine when values passed
9383 to functions are constants and then optimizes accordingly.
9384 This optimization can substantially increase performance
9385 if the application has constants passed to functions.
9386 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9387 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9388
9389 @item -fipa-cp-clone
9390 @opindex fipa-cp-clone
9391 Perform function cloning to make interprocedural constant propagation stronger.
9392 When enabled, interprocedural constant propagation performs function cloning
9393 when externally visible function can be called with constant arguments.
9394 Because this optimization can create multiple copies of functions,
9395 it may significantly increase code size
9396 (see @option{--param ipcp-unit-growth=@var{value}}).
9397 This flag is enabled by default at @option{-O3}.
9398 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9399
9400 @item -fipa-bit-cp
9401 @opindex fipa-bit-cp
9402 When enabled, perform interprocedural bitwise constant
9403 propagation. This flag is enabled by default at @option{-O2} and
9404 by @option{-fprofile-use} and @option{-fauto-profile}.
9405 It requires that @option{-fipa-cp} is enabled.
9406
9407 @item -fipa-vrp
9408 @opindex fipa-vrp
9409 When enabled, perform interprocedural propagation of value
9410 ranges. This flag is enabled by default at @option{-O2}. It requires
9411 that @option{-fipa-cp} is enabled.
9412
9413 @item -fipa-icf
9414 @opindex fipa-icf
9415 Perform Identical Code Folding for functions and read-only variables.
9416 The optimization reduces code size and may disturb unwind stacks by replacing
9417 a function by equivalent one with a different name. The optimization works
9418 more effectively with link-time optimization enabled.
9419
9420 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9421 works on different levels and thus the optimizations are not same - there are
9422 equivalences that are found only by GCC and equivalences found only by Gold.
9423
9424 This flag is enabled by default at @option{-O2} and @option{-Os}.
9425
9426 @item -flive-patching=@var{level}
9427 @opindex flive-patching
9428 Control GCC's optimizations to produce output suitable for live-patching.
9429
9430 If the compiler's optimization uses a function's body or information extracted
9431 from its body to optimize/change another function, the latter is called an
9432 impacted function of the former. If a function is patched, its impacted
9433 functions should be patched too.
9434
9435 The impacted functions are determined by the compiler's interprocedural
9436 optimizations. For example, a caller is impacted when inlining a function
9437 into its caller,
9438 cloning a function and changing its caller to call this new clone,
9439 or extracting a function's pureness/constness information to optimize
9440 its direct or indirect callers, etc.
9441
9442 Usually, the more IPA optimizations enabled, the larger the number of
9443 impacted functions for each function. In order to control the number of
9444 impacted functions and more easily compute the list of impacted function,
9445 IPA optimizations can be partially enabled at two different levels.
9446
9447 The @var{level} argument should be one of the following:
9448
9449 @table @samp
9450
9451 @item inline-clone
9452
9453 Only enable inlining and cloning optimizations, which includes inlining,
9454 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9455 As a result, when patching a function, all its callers and its clones'
9456 callers are impacted, therefore need to be patched as well.
9457
9458 @option{-flive-patching=inline-clone} disables the following optimization flags:
9459 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9460 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9461 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9462 -fipa-stack-alignment}
9463
9464 @item inline-only-static
9465
9466 Only enable inlining of static functions.
9467 As a result, when patching a static function, all its callers are impacted
9468 and so need to be patched as well.
9469
9470 In addition to all the flags that @option{-flive-patching=inline-clone}
9471 disables,
9472 @option{-flive-patching=inline-only-static} disables the following additional
9473 optimization flags:
9474 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9475
9476 @end table
9477
9478 When @option{-flive-patching} is specified without any value, the default value
9479 is @var{inline-clone}.
9480
9481 This flag is disabled by default.
9482
9483 Note that @option{-flive-patching} is not supported with link-time optimization
9484 (@option{-flto}).
9485
9486 @item -fisolate-erroneous-paths-dereference
9487 @opindex fisolate-erroneous-paths-dereference
9488 Detect paths that trigger erroneous or undefined behavior due to
9489 dereferencing a null pointer. Isolate those paths from the main control
9490 flow and turn the statement with erroneous or undefined behavior into a trap.
9491 This flag is enabled by default at @option{-O2} and higher and depends on
9492 @option{-fdelete-null-pointer-checks} also being enabled.
9493
9494 @item -fisolate-erroneous-paths-attribute
9495 @opindex fisolate-erroneous-paths-attribute
9496 Detect paths that trigger erroneous or undefined behavior due to a null value
9497 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9498 attribute. Isolate those paths from the main control flow and turn the
9499 statement with erroneous or undefined behavior into a trap. This is not
9500 currently enabled, but may be enabled by @option{-O2} in the future.
9501
9502 @item -ftree-sink
9503 @opindex ftree-sink
9504 Perform forward store motion on trees. This flag is
9505 enabled by default at @option{-O} and higher.
9506
9507 @item -ftree-bit-ccp
9508 @opindex ftree-bit-ccp
9509 Perform sparse conditional bit constant propagation on trees and propagate
9510 pointer alignment information.
9511 This pass only operates on local scalar variables and is enabled by default
9512 at @option{-O1} and higher, except for @option{-Og}.
9513 It requires that @option{-ftree-ccp} is enabled.
9514
9515 @item -ftree-ccp
9516 @opindex ftree-ccp
9517 Perform sparse conditional constant propagation (CCP) on trees. This
9518 pass only operates on local scalar variables and is enabled by default
9519 at @option{-O} and higher.
9520
9521 @item -fssa-backprop
9522 @opindex fssa-backprop
9523 Propagate information about uses of a value up the definition chain
9524 in order to simplify the definitions. For example, this pass strips
9525 sign operations if the sign of a value never matters. The flag is
9526 enabled by default at @option{-O} and higher.
9527
9528 @item -fssa-phiopt
9529 @opindex fssa-phiopt
9530 Perform pattern matching on SSA PHI nodes to optimize conditional
9531 code. This pass is enabled by default at @option{-O1} and higher,
9532 except for @option{-Og}.
9533
9534 @item -ftree-switch-conversion
9535 @opindex ftree-switch-conversion
9536 Perform conversion of simple initializations in a switch to
9537 initializations from a scalar array. This flag is enabled by default
9538 at @option{-O2} and higher.
9539
9540 @item -ftree-tail-merge
9541 @opindex ftree-tail-merge
9542 Look for identical code sequences. When found, replace one with a jump to the
9543 other. This optimization is known as tail merging or cross jumping. This flag
9544 is enabled by default at @option{-O2} and higher. The compilation time
9545 in this pass can
9546 be limited using @option{max-tail-merge-comparisons} parameter and
9547 @option{max-tail-merge-iterations} parameter.
9548
9549 @item -ftree-dce
9550 @opindex ftree-dce
9551 Perform dead code elimination (DCE) on trees. This flag is enabled by
9552 default at @option{-O} and higher.
9553
9554 @item -ftree-builtin-call-dce
9555 @opindex ftree-builtin-call-dce
9556 Perform conditional dead code elimination (DCE) for calls to built-in functions
9557 that may set @code{errno} but are otherwise free of side effects. This flag is
9558 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9559 specified.
9560
9561 @item -ffinite-loops
9562 @opindex ffinite-loops
9563 @opindex fno-finite-loops
9564 Assume that a loop with an exit will eventually take the exit and not loop
9565 indefinitely. This allows the compiler to remove loops that otherwise have
9566 no side-effects, not considering eventual endless looping as such.
9567
9568 This option is enabled by default at @option{-O2}.
9569
9570 @item -ftree-dominator-opts
9571 @opindex ftree-dominator-opts
9572 Perform a variety of simple scalar cleanups (constant/copy
9573 propagation, redundancy elimination, range propagation and expression
9574 simplification) based on a dominator tree traversal. This also
9575 performs jump threading (to reduce jumps to jumps). This flag is
9576 enabled by default at @option{-O} and higher.
9577
9578 @item -ftree-dse
9579 @opindex ftree-dse
9580 Perform dead store elimination (DSE) on trees. A dead store is a store into
9581 a memory location that is later overwritten by another store without
9582 any intervening loads. In this case the earlier store can be deleted. This
9583 flag is enabled by default at @option{-O} and higher.
9584
9585 @item -ftree-ch
9586 @opindex ftree-ch
9587 Perform loop header copying on trees. This is beneficial since it increases
9588 effectiveness of code motion optimizations. It also saves one jump. This flag
9589 is enabled by default at @option{-O} and higher. It is not enabled
9590 for @option{-Os}, since it usually increases code size.
9591
9592 @item -ftree-loop-optimize
9593 @opindex ftree-loop-optimize
9594 Perform loop optimizations on trees. This flag is enabled by default
9595 at @option{-O} and higher.
9596
9597 @item -ftree-loop-linear
9598 @itemx -floop-strip-mine
9599 @itemx -floop-block
9600 @opindex ftree-loop-linear
9601 @opindex floop-strip-mine
9602 @opindex floop-block
9603 Perform loop nest optimizations. Same as
9604 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9605 to be configured with @option{--with-isl} to enable the Graphite loop
9606 transformation infrastructure.
9607
9608 @item -fgraphite-identity
9609 @opindex fgraphite-identity
9610 Enable the identity transformation for graphite. For every SCoP we generate
9611 the polyhedral representation and transform it back to gimple. Using
9612 @option{-fgraphite-identity} we can check the costs or benefits of the
9613 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9614 are also performed by the code generator isl, like index splitting and
9615 dead code elimination in loops.
9616
9617 @item -floop-nest-optimize
9618 @opindex floop-nest-optimize
9619 Enable the isl based loop nest optimizer. This is a generic loop nest
9620 optimizer based on the Pluto optimization algorithms. It calculates a loop
9621 structure optimized for data-locality and parallelism. This option
9622 is experimental.
9623
9624 @item -floop-parallelize-all
9625 @opindex floop-parallelize-all
9626 Use the Graphite data dependence analysis to identify loops that can
9627 be parallelized. Parallelize all the loops that can be analyzed to
9628 not contain loop carried dependences without checking that it is
9629 profitable to parallelize the loops.
9630
9631 @item -ftree-coalesce-vars
9632 @opindex ftree-coalesce-vars
9633 While transforming the program out of the SSA representation, attempt to
9634 reduce copying by coalescing versions of different user-defined
9635 variables, instead of just compiler temporaries. This may severely
9636 limit the ability to debug an optimized program compiled with
9637 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9638 prevents SSA coalescing of user variables. This option is enabled by
9639 default if optimization is enabled, and it does very little otherwise.
9640
9641 @item -ftree-loop-if-convert
9642 @opindex ftree-loop-if-convert
9643 Attempt to transform conditional jumps in the innermost loops to
9644 branch-less equivalents. The intent is to remove control-flow from
9645 the innermost loops in order to improve the ability of the
9646 vectorization pass to handle these loops. This is enabled by default
9647 if vectorization is enabled.
9648
9649 @item -ftree-loop-distribution
9650 @opindex ftree-loop-distribution
9651 Perform loop distribution. This flag can improve cache performance on
9652 big loop bodies and allow further loop optimizations, like
9653 parallelization or vectorization, to take place. For example, the loop
9654 @smallexample
9655 DO I = 1, N
9656 A(I) = B(I) + C
9657 D(I) = E(I) * F
9658 ENDDO
9659 @end smallexample
9660 is transformed to
9661 @smallexample
9662 DO I = 1, N
9663 A(I) = B(I) + C
9664 ENDDO
9665 DO I = 1, N
9666 D(I) = E(I) * F
9667 ENDDO
9668 @end smallexample
9669 This flag is enabled by default at @option{-O3}.
9670 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9671
9672 @item -ftree-loop-distribute-patterns
9673 @opindex ftree-loop-distribute-patterns
9674 Perform loop distribution of patterns that can be code generated with
9675 calls to a library. This flag is enabled by default at @option{-O3}, and
9676 by @option{-fprofile-use} and @option{-fauto-profile}.
9677
9678 This pass distributes the initialization loops and generates a call to
9679 memset zero. For example, the loop
9680 @smallexample
9681 DO I = 1, N
9682 A(I) = 0
9683 B(I) = A(I) + I
9684 ENDDO
9685 @end smallexample
9686 is transformed to
9687 @smallexample
9688 DO I = 1, N
9689 A(I) = 0
9690 ENDDO
9691 DO I = 1, N
9692 B(I) = A(I) + I
9693 ENDDO
9694 @end smallexample
9695 and the initialization loop is transformed into a call to memset zero.
9696 This flag is enabled by default at @option{-O3}.
9697 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9698
9699 @item -floop-interchange
9700 @opindex floop-interchange
9701 Perform loop interchange outside of graphite. This flag can improve cache
9702 performance on loop nest and allow further loop optimizations, like
9703 vectorization, to take place. For example, the loop
9704 @smallexample
9705 for (int i = 0; i < N; i++)
9706 for (int j = 0; j < N; j++)
9707 for (int k = 0; k < N; k++)
9708 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9709 @end smallexample
9710 is transformed to
9711 @smallexample
9712 for (int i = 0; i < N; i++)
9713 for (int k = 0; k < N; k++)
9714 for (int j = 0; j < N; j++)
9715 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9716 @end smallexample
9717 This flag is enabled by default at @option{-O3}.
9718 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9719
9720 @item -floop-unroll-and-jam
9721 @opindex floop-unroll-and-jam
9722 Apply unroll and jam transformations on feasible loops. In a loop
9723 nest this unrolls the outer loop by some factor and fuses the resulting
9724 multiple inner loops. This flag is enabled by default at @option{-O3}.
9725 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9726
9727 @item -ftree-loop-im
9728 @opindex ftree-loop-im
9729 Perform loop invariant motion on trees. This pass moves only invariants that
9730 are hard to handle at RTL level (function calls, operations that expand to
9731 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9732 operands of conditions that are invariant out of the loop, so that we can use
9733 just trivial invariantness analysis in loop unswitching. The pass also includes
9734 store motion.
9735
9736 @item -ftree-loop-ivcanon
9737 @opindex ftree-loop-ivcanon
9738 Create a canonical counter for number of iterations in loops for which
9739 determining number of iterations requires complicated analysis. Later
9740 optimizations then may determine the number easily. Useful especially
9741 in connection with unrolling.
9742
9743 @item -ftree-scev-cprop
9744 @opindex ftree-scev-cprop
9745 Perform final value replacement. If a variable is modified in a loop
9746 in such a way that its value when exiting the loop can be determined using
9747 only its initial value and the number of loop iterations, replace uses of
9748 the final value by such a computation, provided it is sufficiently cheap.
9749 This reduces data dependencies and may allow further simplifications.
9750 Enabled by default at @option{-O} and higher.
9751
9752 @item -fivopts
9753 @opindex fivopts
9754 Perform induction variable optimizations (strength reduction, induction
9755 variable merging and induction variable elimination) on trees.
9756
9757 @item -ftree-parallelize-loops=n
9758 @opindex ftree-parallelize-loops
9759 Parallelize loops, i.e., split their iteration space to run in n threads.
9760 This is only possible for loops whose iterations are independent
9761 and can be arbitrarily reordered. The optimization is only
9762 profitable on multiprocessor machines, for loops that are CPU-intensive,
9763 rather than constrained e.g.@: by memory bandwidth. This option
9764 implies @option{-pthread}, and thus is only supported on targets
9765 that have support for @option{-pthread}.
9766
9767 @item -ftree-pta
9768 @opindex ftree-pta
9769 Perform function-local points-to analysis on trees. This flag is
9770 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9771
9772 @item -ftree-sra
9773 @opindex ftree-sra
9774 Perform scalar replacement of aggregates. This pass replaces structure
9775 references with scalars to prevent committing structures to memory too
9776 early. This flag is enabled by default at @option{-O1} and higher,
9777 except for @option{-Og}.
9778
9779 @item -fstore-merging
9780 @opindex fstore-merging
9781 Perform merging of narrow stores to consecutive memory addresses. This pass
9782 merges contiguous stores of immediate values narrower than a word into fewer
9783 wider stores to reduce the number of instructions. This is enabled by default
9784 at @option{-O2} and higher as well as @option{-Os}.
9785
9786 @item -ftree-ter
9787 @opindex ftree-ter
9788 Perform temporary expression replacement during the SSA->normal phase. Single
9789 use/single def temporaries are replaced at their use location with their
9790 defining expression. This results in non-GIMPLE code, but gives the expanders
9791 much more complex trees to work on resulting in better RTL generation. This is
9792 enabled by default at @option{-O} and higher.
9793
9794 @item -ftree-slsr
9795 @opindex ftree-slsr
9796 Perform straight-line strength reduction on trees. This recognizes related
9797 expressions involving multiplications and replaces them by less expensive
9798 calculations when possible. This is enabled by default at @option{-O} and
9799 higher.
9800
9801 @item -ftree-vectorize
9802 @opindex ftree-vectorize
9803 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9804 and @option{-ftree-slp-vectorize} if not explicitly specified.
9805
9806 @item -ftree-loop-vectorize
9807 @opindex ftree-loop-vectorize
9808 Perform loop vectorization on trees. This flag is enabled by default at
9809 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9810 and @option{-fauto-profile}.
9811
9812 @item -ftree-slp-vectorize
9813 @opindex ftree-slp-vectorize
9814 Perform basic block vectorization on trees. This flag is enabled by default at
9815 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9816 and @option{-fauto-profile}.
9817
9818 @item -fvect-cost-model=@var{model}
9819 @opindex fvect-cost-model
9820 Alter the cost model used for vectorization. The @var{model} argument
9821 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9822 With the @samp{unlimited} model the vectorized code-path is assumed
9823 to be profitable while with the @samp{dynamic} model a runtime check
9824 guards the vectorized code-path to enable it only for iteration
9825 counts that will likely execute faster than when executing the original
9826 scalar loop. The @samp{cheap} model disables vectorization of
9827 loops where doing so would be cost prohibitive for example due to
9828 required runtime checks for data dependence or alignment but otherwise
9829 is equal to the @samp{dynamic} model.
9830 The default cost model depends on other optimization flags and is
9831 either @samp{dynamic} or @samp{cheap}.
9832
9833 @item -fsimd-cost-model=@var{model}
9834 @opindex fsimd-cost-model
9835 Alter the cost model used for vectorization of loops marked with the OpenMP
9836 simd directive. The @var{model} argument should be one of
9837 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9838 have the same meaning as described in @option{-fvect-cost-model} and by
9839 default a cost model defined with @option{-fvect-cost-model} is used.
9840
9841 @item -ftree-vrp
9842 @opindex ftree-vrp
9843 Perform Value Range Propagation on trees. This is similar to the
9844 constant propagation pass, but instead of values, ranges of values are
9845 propagated. This allows the optimizers to remove unnecessary range
9846 checks like array bound checks and null pointer checks. This is
9847 enabled by default at @option{-O2} and higher. Null pointer check
9848 elimination is only done if @option{-fdelete-null-pointer-checks} is
9849 enabled.
9850
9851 @item -fsplit-paths
9852 @opindex fsplit-paths
9853 Split paths leading to loop backedges. This can improve dead code
9854 elimination and common subexpression elimination. This is enabled by
9855 default at @option{-O3} and above.
9856
9857 @item -fsplit-ivs-in-unroller
9858 @opindex fsplit-ivs-in-unroller
9859 Enables expression of values of induction variables in later iterations
9860 of the unrolled loop using the value in the first iteration. This breaks
9861 long dependency chains, thus improving efficiency of the scheduling passes.
9862
9863 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9864 same effect. However, that is not reliable in cases where the loop body
9865 is more complicated than a single basic block. It also does not work at all
9866 on some architectures due to restrictions in the CSE pass.
9867
9868 This optimization is enabled by default.
9869
9870 @item -fvariable-expansion-in-unroller
9871 @opindex fvariable-expansion-in-unroller
9872 With this option, the compiler creates multiple copies of some
9873 local variables when unrolling a loop, which can result in superior code.
9874
9875 This optimization is enabled by default for PowerPC targets, but disabled
9876 by default otherwise.
9877
9878 @item -fpartial-inlining
9879 @opindex fpartial-inlining
9880 Inline parts of functions. This option has any effect only
9881 when inlining itself is turned on by the @option{-finline-functions}
9882 or @option{-finline-small-functions} options.
9883
9884 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9885
9886 @item -fpredictive-commoning
9887 @opindex fpredictive-commoning
9888 Perform predictive commoning optimization, i.e., reusing computations
9889 (especially memory loads and stores) performed in previous
9890 iterations of loops.
9891
9892 This option is enabled at level @option{-O3}.
9893 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9894
9895 @item -fprefetch-loop-arrays
9896 @opindex fprefetch-loop-arrays
9897 If supported by the target machine, generate instructions to prefetch
9898 memory to improve the performance of loops that access large arrays.
9899
9900 This option may generate better or worse code; results are highly
9901 dependent on the structure of loops within the source code.
9902
9903 Disabled at level @option{-Os}.
9904
9905 @item -fno-printf-return-value
9906 @opindex fno-printf-return-value
9907 @opindex fprintf-return-value
9908 Do not substitute constants for known return value of formatted output
9909 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9910 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9911 transformation allows GCC to optimize or even eliminate branches based
9912 on the known return value of these functions called with arguments that
9913 are either constant, or whose values are known to be in a range that
9914 makes determining the exact return value possible. For example, when
9915 @option{-fprintf-return-value} is in effect, both the branch and the
9916 body of the @code{if} statement (but not the call to @code{snprint})
9917 can be optimized away when @code{i} is a 32-bit or smaller integer
9918 because the return value is guaranteed to be at most 8.
9919
9920 @smallexample
9921 char buf[9];
9922 if (snprintf (buf, "%08x", i) >= sizeof buf)
9923 @dots{}
9924 @end smallexample
9925
9926 The @option{-fprintf-return-value} option relies on other optimizations
9927 and yields best results with @option{-O2} and above. It works in tandem
9928 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9929 options. The @option{-fprintf-return-value} option is enabled by default.
9930
9931 @item -fno-peephole
9932 @itemx -fno-peephole2
9933 @opindex fno-peephole
9934 @opindex fpeephole
9935 @opindex fno-peephole2
9936 @opindex fpeephole2
9937 Disable any machine-specific peephole optimizations. The difference
9938 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9939 are implemented in the compiler; some targets use one, some use the
9940 other, a few use both.
9941
9942 @option{-fpeephole} is enabled by default.
9943 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9944
9945 @item -fno-guess-branch-probability
9946 @opindex fno-guess-branch-probability
9947 @opindex fguess-branch-probability
9948 Do not guess branch probabilities using heuristics.
9949
9950 GCC uses heuristics to guess branch probabilities if they are
9951 not provided by profiling feedback (@option{-fprofile-arcs}). These
9952 heuristics are based on the control flow graph. If some branch probabilities
9953 are specified by @code{__builtin_expect}, then the heuristics are
9954 used to guess branch probabilities for the rest of the control flow graph,
9955 taking the @code{__builtin_expect} info into account. The interactions
9956 between the heuristics and @code{__builtin_expect} can be complex, and in
9957 some cases, it may be useful to disable the heuristics so that the effects
9958 of @code{__builtin_expect} are easier to understand.
9959
9960 It is also possible to specify expected probability of the expression
9961 with @code{__builtin_expect_with_probability} built-in function.
9962
9963 The default is @option{-fguess-branch-probability} at levels
9964 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9965
9966 @item -freorder-blocks
9967 @opindex freorder-blocks
9968 Reorder basic blocks in the compiled function in order to reduce number of
9969 taken branches and improve code locality.
9970
9971 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9972
9973 @item -freorder-blocks-algorithm=@var{algorithm}
9974 @opindex freorder-blocks-algorithm
9975 Use the specified algorithm for basic block reordering. The
9976 @var{algorithm} argument can be @samp{simple}, which does not increase
9977 code size (except sometimes due to secondary effects like alignment),
9978 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9979 put all often executed code together, minimizing the number of branches
9980 executed by making extra copies of code.
9981
9982 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9983 @samp{stc} at levels @option{-O2}, @option{-O3}.
9984
9985 @item -freorder-blocks-and-partition
9986 @opindex freorder-blocks-and-partition
9987 In addition to reordering basic blocks in the compiled function, in order
9988 to reduce number of taken branches, partitions hot and cold basic blocks
9989 into separate sections of the assembly and @file{.o} files, to improve
9990 paging and cache locality performance.
9991
9992 This optimization is automatically turned off in the presence of
9993 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9994 section attribute and on any architecture that does not support named
9995 sections. When @option{-fsplit-stack} is used this option is not
9996 enabled by default (to avoid linker errors), but may be enabled
9997 explicitly (if using a working linker).
9998
9999 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10000
10001 @item -freorder-functions
10002 @opindex freorder-functions
10003 Reorder functions in the object file in order to
10004 improve code locality. This is implemented by using special
10005 subsections @code{.text.hot} for most frequently executed functions and
10006 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
10007 the linker so object file format must support named sections and linker must
10008 place them in a reasonable way.
10009
10010 This option isn't effective unless you either provide profile feedback
10011 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10012 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10013
10014 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10015
10016 @item -fstrict-aliasing
10017 @opindex fstrict-aliasing
10018 Allow the compiler to assume the strictest aliasing rules applicable to
10019 the language being compiled. For C (and C++), this activates
10020 optimizations based on the type of expressions. In particular, an
10021 object of one type is assumed never to reside at the same address as an
10022 object of a different type, unless the types are almost the same. For
10023 example, an @code{unsigned int} can alias an @code{int}, but not a
10024 @code{void*} or a @code{double}. A character type may alias any other
10025 type.
10026
10027 @anchor{Type-punning}Pay special attention to code like this:
10028 @smallexample
10029 union a_union @{
10030 int i;
10031 double d;
10032 @};
10033
10034 int f() @{
10035 union a_union t;
10036 t.d = 3.0;
10037 return t.i;
10038 @}
10039 @end smallexample
10040 The practice of reading from a different union member than the one most
10041 recently written to (called ``type-punning'') is common. Even with
10042 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10043 is accessed through the union type. So, the code above works as
10044 expected. @xref{Structures unions enumerations and bit-fields
10045 implementation}. However, this code might not:
10046 @smallexample
10047 int f() @{
10048 union a_union t;
10049 int* ip;
10050 t.d = 3.0;
10051 ip = &t.i;
10052 return *ip;
10053 @}
10054 @end smallexample
10055
10056 Similarly, access by taking the address, casting the resulting pointer
10057 and dereferencing the result has undefined behavior, even if the cast
10058 uses a union type, e.g.:
10059 @smallexample
10060 int f() @{
10061 double d = 3.0;
10062 return ((union a_union *) &d)->i;
10063 @}
10064 @end smallexample
10065
10066 The @option{-fstrict-aliasing} option is enabled at levels
10067 @option{-O2}, @option{-O3}, @option{-Os}.
10068
10069 @item -falign-functions
10070 @itemx -falign-functions=@var{n}
10071 @itemx -falign-functions=@var{n}:@var{m}
10072 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10073 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10074 @opindex falign-functions
10075 Align the start of functions to the next power-of-two greater than
10076 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10077 the first @var{m} bytes of the function can be fetched by the CPU
10078 without crossing an @var{n}-byte alignment boundary.
10079
10080 If @var{m} is not specified, it defaults to @var{n}.
10081
10082 Examples: @option{-falign-functions=32} aligns functions to the next
10083 32-byte boundary, @option{-falign-functions=24} aligns to the next
10084 32-byte boundary only if this can be done by skipping 23 bytes or less,
10085 @option{-falign-functions=32:7} aligns to the next
10086 32-byte boundary only if this can be done by skipping 6 bytes or less.
10087
10088 The second pair of @var{n2}:@var{m2} values allows you to specify
10089 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10090 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10091 otherwise aligns to the next 32-byte boundary if this can be done
10092 by skipping 2 bytes or less.
10093 If @var{m2} is not specified, it defaults to @var{n2}.
10094
10095 Some assemblers only support this flag when @var{n} is a power of two;
10096 in that case, it is rounded up.
10097
10098 @option{-fno-align-functions} and @option{-falign-functions=1} are
10099 equivalent and mean that functions are not aligned.
10100
10101 If @var{n} is not specified or is zero, use a machine-dependent default.
10102 The maximum allowed @var{n} option value is 65536.
10103
10104 Enabled at levels @option{-O2}, @option{-O3}.
10105
10106 @item -flimit-function-alignment
10107 If this option is enabled, the compiler tries to avoid unnecessarily
10108 overaligning functions. It attempts to instruct the assembler to align
10109 by the amount specified by @option{-falign-functions}, but not to
10110 skip more bytes than the size of the function.
10111
10112 @item -falign-labels
10113 @itemx -falign-labels=@var{n}
10114 @itemx -falign-labels=@var{n}:@var{m}
10115 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10116 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10117 @opindex falign-labels
10118 Align all branch targets to a power-of-two boundary.
10119
10120 Parameters of this option are analogous to the @option{-falign-functions} option.
10121 @option{-fno-align-labels} and @option{-falign-labels=1} are
10122 equivalent and mean that labels are not aligned.
10123
10124 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10125 are greater than this value, then their values are used instead.
10126
10127 If @var{n} is not specified or is zero, use a machine-dependent default
10128 which is very likely to be @samp{1}, meaning no alignment.
10129 The maximum allowed @var{n} option value is 65536.
10130
10131 Enabled at levels @option{-O2}, @option{-O3}.
10132
10133 @item -falign-loops
10134 @itemx -falign-loops=@var{n}
10135 @itemx -falign-loops=@var{n}:@var{m}
10136 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10137 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10138 @opindex falign-loops
10139 Align loops to a power-of-two boundary. If the loops are executed
10140 many times, this makes up for any execution of the dummy padding
10141 instructions.
10142
10143 Parameters of this option are analogous to the @option{-falign-functions} option.
10144 @option{-fno-align-loops} and @option{-falign-loops=1} are
10145 equivalent and mean that loops are not aligned.
10146 The maximum allowed @var{n} option value is 65536.
10147
10148 If @var{n} is not specified or is zero, use a machine-dependent default.
10149
10150 Enabled at levels @option{-O2}, @option{-O3}.
10151
10152 @item -falign-jumps
10153 @itemx -falign-jumps=@var{n}
10154 @itemx -falign-jumps=@var{n}:@var{m}
10155 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10156 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10157 @opindex falign-jumps
10158 Align branch targets to a power-of-two boundary, for branch targets
10159 where the targets can only be reached by jumping. In this case,
10160 no dummy operations need be executed.
10161
10162 Parameters of this option are analogous to the @option{-falign-functions} option.
10163 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10164 equivalent and mean that loops are not aligned.
10165
10166 If @var{n} is not specified or is zero, use a machine-dependent default.
10167 The maximum allowed @var{n} option value is 65536.
10168
10169 Enabled at levels @option{-O2}, @option{-O3}.
10170
10171 @item -funit-at-a-time
10172 @opindex funit-at-a-time
10173 This option is left for compatibility reasons. @option{-funit-at-a-time}
10174 has no effect, while @option{-fno-unit-at-a-time} implies
10175 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10176
10177 Enabled by default.
10178
10179 @item -fno-toplevel-reorder
10180 @opindex fno-toplevel-reorder
10181 @opindex ftoplevel-reorder
10182 Do not reorder top-level functions, variables, and @code{asm}
10183 statements. Output them in the same order that they appear in the
10184 input file. When this option is used, unreferenced static variables
10185 are not removed. This option is intended to support existing code
10186 that relies on a particular ordering. For new code, it is better to
10187 use attributes when possible.
10188
10189 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10190 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10191 Additionally @option{-fno-toplevel-reorder} implies
10192 @option{-fno-section-anchors}.
10193
10194 @item -fweb
10195 @opindex fweb
10196 Constructs webs as commonly used for register allocation purposes and assign
10197 each web individual pseudo register. This allows the register allocation pass
10198 to operate on pseudos directly, but also strengthens several other optimization
10199 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10200 however, make debugging impossible, since variables no longer stay in a
10201 ``home register''.
10202
10203 Enabled by default with @option{-funroll-loops}.
10204
10205 @item -fwhole-program
10206 @opindex fwhole-program
10207 Assume that the current compilation unit represents the whole program being
10208 compiled. All public functions and variables with the exception of @code{main}
10209 and those merged by attribute @code{externally_visible} become static functions
10210 and in effect are optimized more aggressively by interprocedural optimizers.
10211
10212 This option should not be used in combination with @option{-flto}.
10213 Instead relying on a linker plugin should provide safer and more precise
10214 information.
10215
10216 @item -flto[=@var{n}]
10217 @opindex flto
10218 This option runs the standard link-time optimizer. When invoked
10219 with source code, it generates GIMPLE (one of GCC's internal
10220 representations) and writes it to special ELF sections in the object
10221 file. When the object files are linked together, all the function
10222 bodies are read from these ELF sections and instantiated as if they
10223 had been part of the same translation unit.
10224
10225 To use the link-time optimizer, @option{-flto} and optimization
10226 options should be specified at compile time and during the final link.
10227 It is recommended that you compile all the files participating in the
10228 same link with the same options and also specify those options at
10229 link time.
10230 For example:
10231
10232 @smallexample
10233 gcc -c -O2 -flto foo.c
10234 gcc -c -O2 -flto bar.c
10235 gcc -o myprog -flto -O2 foo.o bar.o
10236 @end smallexample
10237
10238 The first two invocations to GCC save a bytecode representation
10239 of GIMPLE into special ELF sections inside @file{foo.o} and
10240 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10241 @file{foo.o} and @file{bar.o}, merges the two files into a single
10242 internal image, and compiles the result as usual. Since both
10243 @file{foo.o} and @file{bar.o} are merged into a single image, this
10244 causes all the interprocedural analyses and optimizations in GCC to
10245 work across the two files as if they were a single one. This means,
10246 for example, that the inliner is able to inline functions in
10247 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10248
10249 Another (simpler) way to enable link-time optimization is:
10250
10251 @smallexample
10252 gcc -o myprog -flto -O2 foo.c bar.c
10253 @end smallexample
10254
10255 The above generates bytecode for @file{foo.c} and @file{bar.c},
10256 merges them together into a single GIMPLE representation and optimizes
10257 them as usual to produce @file{myprog}.
10258
10259 The important thing to keep in mind is that to enable link-time
10260 optimizations you need to use the GCC driver to perform the link step.
10261 GCC automatically performs link-time optimization if any of the
10262 objects involved were compiled with the @option{-flto} command-line option.
10263 You can always override
10264 the automatic decision to do link-time optimization
10265 by passing @option{-fno-lto} to the link command.
10266
10267 To make whole program optimization effective, it is necessary to make
10268 certain whole program assumptions. The compiler needs to know
10269 what functions and variables can be accessed by libraries and runtime
10270 outside of the link-time optimized unit. When supported by the linker,
10271 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10272 to the compiler about used and externally visible symbols. When
10273 the linker plugin is not available, @option{-fwhole-program} should be
10274 used to allow the compiler to make these assumptions, which leads
10275 to more aggressive optimization decisions.
10276
10277 When a file is compiled with @option{-flto} without
10278 @option{-fuse-linker-plugin}, the generated object file is larger than
10279 a regular object file because it contains GIMPLE bytecodes and the usual
10280 final code (see @option{-ffat-lto-objects}. This means that
10281 object files with LTO information can be linked as normal object
10282 files; if @option{-fno-lto} is passed to the linker, no
10283 interprocedural optimizations are applied. Note that when
10284 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10285 but you cannot perform a regular, non-LTO link on them.
10286
10287 When producing the final binary, GCC only
10288 applies link-time optimizations to those files that contain bytecode.
10289 Therefore, you can mix and match object files and libraries with
10290 GIMPLE bytecodes and final object code. GCC automatically selects
10291 which files to optimize in LTO mode and which files to link without
10292 further processing.
10293
10294 Generally, options specified at link time override those
10295 specified at compile time, although in some cases GCC attempts to infer
10296 link-time options from the settings used to compile the input files.
10297
10298 If you do not specify an optimization level option @option{-O} at
10299 link time, then GCC uses the highest optimization level
10300 used when compiling the object files. Note that it is generally
10301 ineffective to specify an optimization level option only at link time and
10302 not at compile time, for two reasons. First, compiling without
10303 optimization suppresses compiler passes that gather information
10304 needed for effective optimization at link time. Second, some early
10305 optimization passes can be performed only at compile time and
10306 not at link time.
10307
10308 There are some code generation flags preserved by GCC when
10309 generating bytecodes, as they need to be used during the final link.
10310 Currently, the following options and their settings are taken from
10311 the first object file that explicitly specifies them:
10312 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10313 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10314 and all the @option{-m} target flags.
10315
10316 Certain ABI-changing flags are required to match in all compilation units,
10317 and trying to override this at link time with a conflicting value
10318 is ignored. This includes options such as @option{-freg-struct-return}
10319 and @option{-fpcc-struct-return}.
10320
10321 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10322 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10323 are passed through to the link stage and merged conservatively for
10324 conflicting translation units. Specifically
10325 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10326 precedence; and for example @option{-ffp-contract=off} takes precedence
10327 over @option{-ffp-contract=fast}. You can override them at link time.
10328
10329 If LTO encounters objects with C linkage declared with incompatible
10330 types in separate translation units to be linked together (undefined
10331 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10332 issued. The behavior is still undefined at run time. Similar
10333 diagnostics may be raised for other languages.
10334
10335 Another feature of LTO is that it is possible to apply interprocedural
10336 optimizations on files written in different languages:
10337
10338 @smallexample
10339 gcc -c -flto foo.c
10340 g++ -c -flto bar.cc
10341 gfortran -c -flto baz.f90
10342 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10343 @end smallexample
10344
10345 Notice that the final link is done with @command{g++} to get the C++
10346 runtime libraries and @option{-lgfortran} is added to get the Fortran
10347 runtime libraries. In general, when mixing languages in LTO mode, you
10348 should use the same link command options as when mixing languages in a
10349 regular (non-LTO) compilation.
10350
10351 If object files containing GIMPLE bytecode are stored in a library archive, say
10352 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10353 are using a linker with plugin support. To create static libraries suitable
10354 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10355 and @command{ranlib};
10356 to show the symbols of object files with GIMPLE bytecode, use
10357 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10358 and @command{nm} have been compiled with plugin support. At link time, use the
10359 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10360 the LTO optimization process:
10361
10362 @smallexample
10363 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10364 @end smallexample
10365
10366 With the linker plugin enabled, the linker extracts the needed
10367 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10368 to make them part of the aggregated GIMPLE image to be optimized.
10369
10370 If you are not using a linker with plugin support and/or do not
10371 enable the linker plugin, then the objects inside @file{libfoo.a}
10372 are extracted and linked as usual, but they do not participate
10373 in the LTO optimization process. In order to make a static library suitable
10374 for both LTO optimization and usual linkage, compile its object files with
10375 @option{-flto} @option{-ffat-lto-objects}.
10376
10377 Link-time optimizations do not require the presence of the whole program to
10378 operate. If the program does not require any symbols to be exported, it is
10379 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10380 the interprocedural optimizers to use more aggressive assumptions which may
10381 lead to improved optimization opportunities.
10382 Use of @option{-fwhole-program} is not needed when linker plugin is
10383 active (see @option{-fuse-linker-plugin}).
10384
10385 The current implementation of LTO makes no
10386 attempt to generate bytecode that is portable between different
10387 types of hosts. The bytecode files are versioned and there is a
10388 strict version check, so bytecode files generated in one version of
10389 GCC do not work with an older or newer version of GCC.
10390
10391 Link-time optimization does not work well with generation of debugging
10392 information on systems other than those using a combination of ELF and
10393 DWARF.
10394
10395 If you specify the optional @var{n}, the optimization and code
10396 generation done at link time is executed in parallel using @var{n}
10397 parallel jobs by utilizing an installed @command{make} program. The
10398 environment variable @env{MAKE} may be used to override the program
10399 used. The default value for @var{n} is 1.
10400
10401 You can also specify @option{-flto=jobserver} to use GNU make's
10402 job server mode to determine the number of parallel jobs. This
10403 is useful when the Makefile calling GCC is already executing in parallel.
10404 You must prepend a @samp{+} to the command recipe in the parent Makefile
10405 for this to work. This option likely only works if @env{MAKE} is
10406 GNU make.
10407
10408 @item -flto-partition=@var{alg}
10409 @opindex flto-partition
10410 Specify the partitioning algorithm used by the link-time optimizer.
10411 The value is either @samp{1to1} to specify a partitioning mirroring
10412 the original source files or @samp{balanced} to specify partitioning
10413 into equally sized chunks (whenever possible) or @samp{max} to create
10414 new partition for every symbol where possible. Specifying @samp{none}
10415 as an algorithm disables partitioning and streaming completely.
10416 The default value is @samp{balanced}. While @samp{1to1} can be used
10417 as an workaround for various code ordering issues, the @samp{max}
10418 partitioning is intended for internal testing only.
10419 The value @samp{one} specifies that exactly one partition should be
10420 used while the value @samp{none} bypasses partitioning and executes
10421 the link-time optimization step directly from the WPA phase.
10422
10423 @item -flto-compression-level=@var{n}
10424 @opindex flto-compression-level
10425 This option specifies the level of compression used for intermediate
10426 language written to LTO object files, and is only meaningful in
10427 conjunction with LTO mode (@option{-flto}). Valid
10428 values are 0 (no compression) to 9 (maximum compression). Values
10429 outside this range are clamped to either 0 or 9. If the option is not
10430 given, a default balanced compression setting is used.
10431
10432 @item -fuse-linker-plugin
10433 @opindex fuse-linker-plugin
10434 Enables the use of a linker plugin during link-time optimization. This
10435 option relies on plugin support in the linker, which is available in gold
10436 or in GNU ld 2.21 or newer.
10437
10438 This option enables the extraction of object files with GIMPLE bytecode out
10439 of library archives. This improves the quality of optimization by exposing
10440 more code to the link-time optimizer. This information specifies what
10441 symbols can be accessed externally (by non-LTO object or during dynamic
10442 linking). Resulting code quality improvements on binaries (and shared
10443 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10444 See @option{-flto} for a description of the effect of this flag and how to
10445 use it.
10446
10447 This option is enabled by default when LTO support in GCC is enabled
10448 and GCC was configured for use with
10449 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10450
10451 @item -ffat-lto-objects
10452 @opindex ffat-lto-objects
10453 Fat LTO objects are object files that contain both the intermediate language
10454 and the object code. This makes them usable for both LTO linking and normal
10455 linking. This option is effective only when compiling with @option{-flto}
10456 and is ignored at link time.
10457
10458 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10459 requires the complete toolchain to be aware of LTO. It requires a linker with
10460 linker plugin support for basic functionality. Additionally,
10461 @command{nm}, @command{ar} and @command{ranlib}
10462 need to support linker plugins to allow a full-featured build environment
10463 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10464 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10465 to these tools. With non fat LTO makefiles need to be modified to use them.
10466
10467 Note that modern binutils provide plugin auto-load mechanism.
10468 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10469 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10470 @command{gcc-ranlib}).
10471
10472 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10473 support.
10474
10475 @item -fcompare-elim
10476 @opindex fcompare-elim
10477 After register allocation and post-register allocation instruction splitting,
10478 identify arithmetic instructions that compute processor flags similar to a
10479 comparison operation based on that arithmetic. If possible, eliminate the
10480 explicit comparison operation.
10481
10482 This pass only applies to certain targets that cannot explicitly represent
10483 the comparison operation before register allocation is complete.
10484
10485 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10486
10487 @item -fcprop-registers
10488 @opindex fcprop-registers
10489 After register allocation and post-register allocation instruction splitting,
10490 perform a copy-propagation pass to try to reduce scheduling dependencies
10491 and occasionally eliminate the copy.
10492
10493 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10494
10495 @item -fprofile-correction
10496 @opindex fprofile-correction
10497 Profiles collected using an instrumented binary for multi-threaded programs may
10498 be inconsistent due to missed counter updates. When this option is specified,
10499 GCC uses heuristics to correct or smooth out such inconsistencies. By
10500 default, GCC emits an error message when an inconsistent profile is detected.
10501
10502 This option is enabled by @option{-fauto-profile}.
10503
10504 @item -fprofile-use
10505 @itemx -fprofile-use=@var{path}
10506 @opindex fprofile-use
10507 Enable profile feedback-directed optimizations,
10508 and the following optimizations, many of which
10509 are generally profitable only with profile feedback available:
10510
10511 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10512 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10513 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10514 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10515 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10516 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10517 -fprofile-reorder-functions}
10518
10519 Before you can use this option, you must first generate profiling information.
10520 @xref{Instrumentation Options}, for information about the
10521 @option{-fprofile-generate} option.
10522
10523 By default, GCC emits an error message if the feedback profiles do not
10524 match the source code. This error can be turned into a warning by using
10525 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10526 optimized code. Additionally, by default, GCC also emits a warning message if
10527 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10528
10529 If @var{path} is specified, GCC looks at the @var{path} to find
10530 the profile feedback data files. See @option{-fprofile-dir}.
10531
10532 @item -fauto-profile
10533 @itemx -fauto-profile=@var{path}
10534 @opindex fauto-profile
10535 Enable sampling-based feedback-directed optimizations,
10536 and the following optimizations,
10537 many of which are generally profitable only with profile feedback available:
10538
10539 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10540 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10541 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10542 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10543 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10544 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10545 -fprofile-correction}
10546
10547 @var{path} is the name of a file containing AutoFDO profile information.
10548 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10549
10550 Producing an AutoFDO profile data file requires running your program
10551 with the @command{perf} utility on a supported GNU/Linux target system.
10552 For more information, see @uref{https://perf.wiki.kernel.org/}.
10553
10554 E.g.
10555 @smallexample
10556 perf record -e br_inst_retired:near_taken -b -o perf.data \
10557 -- your_program
10558 @end smallexample
10559
10560 Then use the @command{create_gcov} tool to convert the raw profile data
10561 to a format that can be used by GCC.@ You must also supply the
10562 unstripped binary for your program to this tool.
10563 See @uref{https://github.com/google/autofdo}.
10564
10565 E.g.
10566 @smallexample
10567 create_gcov --binary=your_program.unstripped --profile=perf.data \
10568 --gcov=profile.afdo
10569 @end smallexample
10570 @end table
10571
10572 The following options control compiler behavior regarding floating-point
10573 arithmetic. These options trade off between speed and
10574 correctness. All must be specifically enabled.
10575
10576 @table @gcctabopt
10577 @item -ffloat-store
10578 @opindex ffloat-store
10579 Do not store floating-point variables in registers, and inhibit other
10580 options that might change whether a floating-point value is taken from a
10581 register or memory.
10582
10583 @cindex floating-point precision
10584 This option prevents undesirable excess precision on machines such as
10585 the 68000 where the floating registers (of the 68881) keep more
10586 precision than a @code{double} is supposed to have. Similarly for the
10587 x86 architecture. For most programs, the excess precision does only
10588 good, but a few programs rely on the precise definition of IEEE floating
10589 point. Use @option{-ffloat-store} for such programs, after modifying
10590 them to store all pertinent intermediate computations into variables.
10591
10592 @item -fexcess-precision=@var{style}
10593 @opindex fexcess-precision
10594 This option allows further control over excess precision on machines
10595 where floating-point operations occur in a format with more precision or
10596 range than the IEEE standard and interchange floating-point types. By
10597 default, @option{-fexcess-precision=fast} is in effect; this means that
10598 operations may be carried out in a wider precision than the types specified
10599 in the source if that would result in faster code, and it is unpredictable
10600 when rounding to the types specified in the source code takes place.
10601 When compiling C, if @option{-fexcess-precision=standard} is specified then
10602 excess precision follows the rules specified in ISO C99; in particular,
10603 both casts and assignments cause values to be rounded to their
10604 semantic types (whereas @option{-ffloat-store} only affects
10605 assignments). This option is enabled by default for C if a strict
10606 conformance option such as @option{-std=c99} is used.
10607 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10608 regardless of whether a strict conformance option is used.
10609
10610 @opindex mfpmath
10611 @option{-fexcess-precision=standard} is not implemented for languages
10612 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10613 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10614 semantics apply without excess precision, and in the latter, rounding
10615 is unpredictable.
10616
10617 @item -ffast-math
10618 @opindex ffast-math
10619 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10620 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10621 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10622 @option{-fexcess-precision=fast}.
10623
10624 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10625
10626 This option is not turned on by any @option{-O} option besides
10627 @option{-Ofast} since it can result in incorrect output for programs
10628 that depend on an exact implementation of IEEE or ISO rules/specifications
10629 for math functions. It may, however, yield faster code for programs
10630 that do not require the guarantees of these specifications.
10631
10632 @item -fno-math-errno
10633 @opindex fno-math-errno
10634 @opindex fmath-errno
10635 Do not set @code{errno} after calling math functions that are executed
10636 with a single instruction, e.g., @code{sqrt}. A program that relies on
10637 IEEE exceptions for math error handling may want to use this flag
10638 for speed while maintaining IEEE arithmetic compatibility.
10639
10640 This option is not turned on by any @option{-O} option since
10641 it can result in incorrect output for programs that depend on
10642 an exact implementation of IEEE or ISO rules/specifications for
10643 math functions. It may, however, yield faster code for programs
10644 that do not require the guarantees of these specifications.
10645
10646 The default is @option{-fmath-errno}.
10647
10648 On Darwin systems, the math library never sets @code{errno}. There is
10649 therefore no reason for the compiler to consider the possibility that
10650 it might, and @option{-fno-math-errno} is the default.
10651
10652 @item -funsafe-math-optimizations
10653 @opindex funsafe-math-optimizations
10654
10655 Allow optimizations for floating-point arithmetic that (a) assume
10656 that arguments and results are valid and (b) may violate IEEE or
10657 ANSI standards. When used at link time, it may include libraries
10658 or startup files that change the default FPU control word or other
10659 similar optimizations.
10660
10661 This option is not turned on by any @option{-O} option since
10662 it can result in incorrect output for programs that depend on
10663 an exact implementation of IEEE or ISO rules/specifications for
10664 math functions. It may, however, yield faster code for programs
10665 that do not require the guarantees of these specifications.
10666 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10667 @option{-fassociative-math} and @option{-freciprocal-math}.
10668
10669 The default is @option{-fno-unsafe-math-optimizations}.
10670
10671 @item -fassociative-math
10672 @opindex fassociative-math
10673
10674 Allow re-association of operands in series of floating-point operations.
10675 This violates the ISO C and C++ language standard by possibly changing
10676 computation result. NOTE: re-ordering may change the sign of zero as
10677 well as ignore NaNs and inhibit or create underflow or overflow (and
10678 thus cannot be used on code that relies on rounding behavior like
10679 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10680 and thus may not be used when ordered comparisons are required.
10681 This option requires that both @option{-fno-signed-zeros} and
10682 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10683 much sense with @option{-frounding-math}. For Fortran the option
10684 is automatically enabled when both @option{-fno-signed-zeros} and
10685 @option{-fno-trapping-math} are in effect.
10686
10687 The default is @option{-fno-associative-math}.
10688
10689 @item -freciprocal-math
10690 @opindex freciprocal-math
10691
10692 Allow the reciprocal of a value to be used instead of dividing by
10693 the value if this enables optimizations. For example @code{x / y}
10694 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10695 is subject to common subexpression elimination. Note that this loses
10696 precision and increases the number of flops operating on the value.
10697
10698 The default is @option{-fno-reciprocal-math}.
10699
10700 @item -ffinite-math-only
10701 @opindex ffinite-math-only
10702 Allow optimizations for floating-point arithmetic that assume
10703 that arguments and results are not NaNs or +-Infs.
10704
10705 This option is not turned on by any @option{-O} option since
10706 it can result in incorrect output for programs that depend on
10707 an exact implementation of IEEE or ISO rules/specifications for
10708 math functions. It may, however, yield faster code for programs
10709 that do not require the guarantees of these specifications.
10710
10711 The default is @option{-fno-finite-math-only}.
10712
10713 @item -fno-signed-zeros
10714 @opindex fno-signed-zeros
10715 @opindex fsigned-zeros
10716 Allow optimizations for floating-point arithmetic that ignore the
10717 signedness of zero. IEEE arithmetic specifies the behavior of
10718 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10719 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10720 This option implies that the sign of a zero result isn't significant.
10721
10722 The default is @option{-fsigned-zeros}.
10723
10724 @item -fno-trapping-math
10725 @opindex fno-trapping-math
10726 @opindex ftrapping-math
10727 Compile code assuming that floating-point operations cannot generate
10728 user-visible traps. These traps include division by zero, overflow,
10729 underflow, inexact result and invalid operation. This option requires
10730 that @option{-fno-signaling-nans} be in effect. Setting this option may
10731 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10732
10733 This option should never be turned on by any @option{-O} option since
10734 it can result in incorrect output for programs that depend on
10735 an exact implementation of IEEE or ISO rules/specifications for
10736 math functions.
10737
10738 The default is @option{-ftrapping-math}.
10739
10740 @item -frounding-math
10741 @opindex frounding-math
10742 Disable transformations and optimizations that assume default floating-point
10743 rounding behavior. This is round-to-zero for all floating point
10744 to integer conversions, and round-to-nearest for all other arithmetic
10745 truncations. This option should be specified for programs that change
10746 the FP rounding mode dynamically, or that may be executed with a
10747 non-default rounding mode. This option disables constant folding of
10748 floating-point expressions at compile time (which may be affected by
10749 rounding mode) and arithmetic transformations that are unsafe in the
10750 presence of sign-dependent rounding modes.
10751
10752 The default is @option{-fno-rounding-math}.
10753
10754 This option is experimental and does not currently guarantee to
10755 disable all GCC optimizations that are affected by rounding mode.
10756 Future versions of GCC may provide finer control of this setting
10757 using C99's @code{FENV_ACCESS} pragma. This command-line option
10758 will be used to specify the default state for @code{FENV_ACCESS}.
10759
10760 @item -fsignaling-nans
10761 @opindex fsignaling-nans
10762 Compile code assuming that IEEE signaling NaNs may generate user-visible
10763 traps during floating-point operations. Setting this option disables
10764 optimizations that may change the number of exceptions visible with
10765 signaling NaNs. This option implies @option{-ftrapping-math}.
10766
10767 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10768 be defined.
10769
10770 The default is @option{-fno-signaling-nans}.
10771
10772 This option is experimental and does not currently guarantee to
10773 disable all GCC optimizations that affect signaling NaN behavior.
10774
10775 @item -fno-fp-int-builtin-inexact
10776 @opindex fno-fp-int-builtin-inexact
10777 @opindex ffp-int-builtin-inexact
10778 Do not allow the built-in functions @code{ceil}, @code{floor},
10779 @code{round} and @code{trunc}, and their @code{float} and @code{long
10780 double} variants, to generate code that raises the ``inexact''
10781 floating-point exception for noninteger arguments. ISO C99 and C11
10782 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10783 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10784 functions to do so.
10785
10786 The default is @option{-ffp-int-builtin-inexact}, allowing the
10787 exception to be raised. This option does nothing unless
10788 @option{-ftrapping-math} is in effect.
10789
10790 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10791 generate a call to a library function then the ``inexact'' exception
10792 may be raised if the library implementation does not follow TS 18661.
10793
10794 @item -fsingle-precision-constant
10795 @opindex fsingle-precision-constant
10796 Treat floating-point constants as single precision instead of
10797 implicitly converting them to double-precision constants.
10798
10799 @item -fcx-limited-range
10800 @opindex fcx-limited-range
10801 When enabled, this option states that a range reduction step is not
10802 needed when performing complex division. Also, there is no checking
10803 whether the result of a complex multiplication or division is @code{NaN
10804 + I*NaN}, with an attempt to rescue the situation in that case. The
10805 default is @option{-fno-cx-limited-range}, but is enabled by
10806 @option{-ffast-math}.
10807
10808 This option controls the default setting of the ISO C99
10809 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10810 all languages.
10811
10812 @item -fcx-fortran-rules
10813 @opindex fcx-fortran-rules
10814 Complex multiplication and division follow Fortran rules. Range
10815 reduction is done as part of complex division, but there is no checking
10816 whether the result of a complex multiplication or division is @code{NaN
10817 + I*NaN}, with an attempt to rescue the situation in that case.
10818
10819 The default is @option{-fno-cx-fortran-rules}.
10820
10821 @end table
10822
10823 The following options control optimizations that may improve
10824 performance, but are not enabled by any @option{-O} options. This
10825 section includes experimental options that may produce broken code.
10826
10827 @table @gcctabopt
10828 @item -fbranch-probabilities
10829 @opindex fbranch-probabilities
10830 After running a program compiled with @option{-fprofile-arcs}
10831 (@pxref{Instrumentation Options}),
10832 you can compile it a second time using
10833 @option{-fbranch-probabilities}, to improve optimizations based on
10834 the number of times each branch was taken. When a program
10835 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10836 counts to a file called @file{@var{sourcename}.gcda} for each source
10837 file. The information in this data file is very dependent on the
10838 structure of the generated code, so you must use the same source code
10839 and the same optimization options for both compilations.
10840
10841 With @option{-fbranch-probabilities}, GCC puts a
10842 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10843 These can be used to improve optimization. Currently, they are only
10844 used in one place: in @file{reorg.c}, instead of guessing which path a
10845 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10846 exactly determine which path is taken more often.
10847
10848 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10849
10850 @item -fprofile-values
10851 @opindex fprofile-values
10852 If combined with @option{-fprofile-arcs}, it adds code so that some
10853 data about values of expressions in the program is gathered.
10854
10855 With @option{-fbranch-probabilities}, it reads back the data gathered
10856 from profiling values of expressions for usage in optimizations.
10857
10858 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10859 @option{-fauto-profile}.
10860
10861 @item -fprofile-reorder-functions
10862 @opindex fprofile-reorder-functions
10863 Function reordering based on profile instrumentation collects
10864 first time of execution of a function and orders these functions
10865 in ascending order.
10866
10867 Enabled with @option{-fprofile-use}.
10868
10869 @item -fvpt
10870 @opindex fvpt
10871 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10872 to add code to gather information about values of expressions.
10873
10874 With @option{-fbranch-probabilities}, it reads back the data gathered
10875 and actually performs the optimizations based on them.
10876 Currently the optimizations include specialization of division operations
10877 using the knowledge about the value of the denominator.
10878
10879 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10880
10881 @item -frename-registers
10882 @opindex frename-registers
10883 Attempt to avoid false dependencies in scheduled code by making use
10884 of registers left over after register allocation. This optimization
10885 most benefits processors with lots of registers. Depending on the
10886 debug information format adopted by the target, however, it can
10887 make debugging impossible, since variables no longer stay in
10888 a ``home register''.
10889
10890 Enabled by default with @option{-funroll-loops}.
10891
10892 @item -fschedule-fusion
10893 @opindex fschedule-fusion
10894 Performs a target dependent pass over the instruction stream to schedule
10895 instructions of same type together because target machine can execute them
10896 more efficiently if they are adjacent to each other in the instruction flow.
10897
10898 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10899
10900 @item -ftracer
10901 @opindex ftracer
10902 Perform tail duplication to enlarge superblock size. This transformation
10903 simplifies the control flow of the function allowing other optimizations to do
10904 a better job.
10905
10906 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10907
10908 @item -funroll-loops
10909 @opindex funroll-loops
10910 Unroll loops whose number of iterations can be determined at compile time or
10911 upon entry to the loop. @option{-funroll-loops} implies
10912 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10913 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10914 a small constant number of iterations). This option makes code larger, and may
10915 or may not make it run faster.
10916
10917 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10918
10919 @item -funroll-all-loops
10920 @opindex funroll-all-loops
10921 Unroll all loops, even if their number of iterations is uncertain when
10922 the loop is entered. This usually makes programs run more slowly.
10923 @option{-funroll-all-loops} implies the same options as
10924 @option{-funroll-loops}.
10925
10926 @item -fpeel-loops
10927 @opindex fpeel-loops
10928 Peels loops for which there is enough information that they do not
10929 roll much (from profile feedback or static analysis). It also turns on
10930 complete loop peeling (i.e.@: complete removal of loops with small constant
10931 number of iterations).
10932
10933 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10934
10935 @item -fmove-loop-invariants
10936 @opindex fmove-loop-invariants
10937 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10938 at level @option{-O1} and higher, except for @option{-Og}.
10939
10940 @item -fsplit-loops
10941 @opindex fsplit-loops
10942 Split a loop into two if it contains a condition that's always true
10943 for one side of the iteration space and false for the other.
10944
10945 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10946
10947 @item -funswitch-loops
10948 @opindex funswitch-loops
10949 Move branches with loop invariant conditions out of the loop, with duplicates
10950 of the loop on both branches (modified according to result of the condition).
10951
10952 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10953
10954 @item -fversion-loops-for-strides
10955 @opindex fversion-loops-for-strides
10956 If a loop iterates over an array with a variable stride, create another
10957 version of the loop that assumes the stride is always one. For example:
10958
10959 @smallexample
10960 for (int i = 0; i < n; ++i)
10961 x[i * stride] = @dots{};
10962 @end smallexample
10963
10964 becomes:
10965
10966 @smallexample
10967 if (stride == 1)
10968 for (int i = 0; i < n; ++i)
10969 x[i] = @dots{};
10970 else
10971 for (int i = 0; i < n; ++i)
10972 x[i * stride] = @dots{};
10973 @end smallexample
10974
10975 This is particularly useful for assumed-shape arrays in Fortran where
10976 (for example) it allows better vectorization assuming contiguous accesses.
10977 This flag is enabled by default at @option{-O3}.
10978 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10979
10980 @item -ffunction-sections
10981 @itemx -fdata-sections
10982 @opindex ffunction-sections
10983 @opindex fdata-sections
10984 Place each function or data item into its own section in the output
10985 file if the target supports arbitrary sections. The name of the
10986 function or the name of the data item determines the section's name
10987 in the output file.
10988
10989 Use these options on systems where the linker can perform optimizations to
10990 improve locality of reference in the instruction space. Most systems using the
10991 ELF object format have linkers with such optimizations. On AIX, the linker
10992 rearranges sections (CSECTs) based on the call graph. The performance impact
10993 varies.
10994
10995 Together with a linker garbage collection (linker @option{--gc-sections}
10996 option) these options may lead to smaller statically-linked executables (after
10997 stripping).
10998
10999 On ELF/DWARF systems these options do not degenerate the quality of the debug
11000 information. There could be issues with other object files/debug info formats.
11001
11002 Only use these options when there are significant benefits from doing so. When
11003 you specify these options, the assembler and linker create larger object and
11004 executable files and are also slower. These options affect code generation.
11005 They prevent optimizations by the compiler and assembler using relative
11006 locations inside a translation unit since the locations are unknown until
11007 link time. An example of such an optimization is relaxing calls to short call
11008 instructions.
11009
11010 @item -fbranch-target-load-optimize
11011 @opindex fbranch-target-load-optimize
11012 Perform branch target register load optimization before prologue / epilogue
11013 threading.
11014 The use of target registers can typically be exposed only during reload,
11015 thus hoisting loads out of loops and doing inter-block scheduling needs
11016 a separate optimization pass.
11017
11018 @item -fbranch-target-load-optimize2
11019 @opindex fbranch-target-load-optimize2
11020 Perform branch target register load optimization after prologue / epilogue
11021 threading.
11022
11023 @item -fbtr-bb-exclusive
11024 @opindex fbtr-bb-exclusive
11025 When performing branch target register load optimization, don't reuse
11026 branch target registers within any basic block.
11027
11028 @item -fstdarg-opt
11029 @opindex fstdarg-opt
11030 Optimize the prologue of variadic argument functions with respect to usage of
11031 those arguments.
11032
11033 @item -fsection-anchors
11034 @opindex fsection-anchors
11035 Try to reduce the number of symbolic address calculations by using
11036 shared ``anchor'' symbols to address nearby objects. This transformation
11037 can help to reduce the number of GOT entries and GOT accesses on some
11038 targets.
11039
11040 For example, the implementation of the following function @code{foo}:
11041
11042 @smallexample
11043 static int a, b, c;
11044 int foo (void) @{ return a + b + c; @}
11045 @end smallexample
11046
11047 @noindent
11048 usually calculates the addresses of all three variables, but if you
11049 compile it with @option{-fsection-anchors}, it accesses the variables
11050 from a common anchor point instead. The effect is similar to the
11051 following pseudocode (which isn't valid C):
11052
11053 @smallexample
11054 int foo (void)
11055 @{
11056 register int *xr = &x;
11057 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11058 @}
11059 @end smallexample
11060
11061 Not all targets support this option.
11062
11063 @item --param @var{name}=@var{value}
11064 @opindex param
11065 In some places, GCC uses various constants to control the amount of
11066 optimization that is done. For example, GCC does not inline functions
11067 that contain more than a certain number of instructions. You can
11068 control some of these constants on the command line using the
11069 @option{--param} option.
11070
11071 The names of specific parameters, and the meaning of the values, are
11072 tied to the internals of the compiler, and are subject to change
11073 without notice in future releases.
11074
11075 In order to get minimal, maximal and default value of a parameter,
11076 one can use @option{--help=param -Q} options.
11077
11078 In each case, the @var{value} is an integer. The allowable choices for
11079 @var{name} are:
11080
11081 @table @gcctabopt
11082 @item predictable-branch-outcome
11083 When branch is predicted to be taken with probability lower than this threshold
11084 (in percent), then it is considered well predictable.
11085
11086 @item max-rtl-if-conversion-insns
11087 RTL if-conversion tries to remove conditional branches around a block and
11088 replace them with conditionally executed instructions. This parameter
11089 gives the maximum number of instructions in a block which should be
11090 considered for if-conversion. The compiler will
11091 also use other heuristics to decide whether if-conversion is likely to be
11092 profitable.
11093
11094 @item max-rtl-if-conversion-predictable-cost
11095 @itemx max-rtl-if-conversion-unpredictable-cost
11096 RTL if-conversion will try to remove conditional branches around a block
11097 and replace them with conditionally executed instructions. These parameters
11098 give the maximum permissible cost for the sequence that would be generated
11099 by if-conversion depending on whether the branch is statically determined
11100 to be predictable or not. The units for this parameter are the same as
11101 those for the GCC internal seq_cost metric. The compiler will try to
11102 provide a reasonable default for this parameter using the BRANCH_COST
11103 target macro.
11104
11105 @item max-crossjump-edges
11106 The maximum number of incoming edges to consider for cross-jumping.
11107 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11108 the number of edges incoming to each block. Increasing values mean
11109 more aggressive optimization, making the compilation time increase with
11110 probably small improvement in executable size.
11111
11112 @item min-crossjump-insns
11113 The minimum number of instructions that must be matched at the end
11114 of two blocks before cross-jumping is performed on them. This
11115 value is ignored in the case where all instructions in the block being
11116 cross-jumped from are matched.
11117
11118 @item max-grow-copy-bb-insns
11119 The maximum code size expansion factor when copying basic blocks
11120 instead of jumping. The expansion is relative to a jump instruction.
11121
11122 @item max-goto-duplication-insns
11123 The maximum number of instructions to duplicate to a block that jumps
11124 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11125 passes, GCC factors computed gotos early in the compilation process,
11126 and unfactors them as late as possible. Only computed jumps at the
11127 end of a basic blocks with no more than max-goto-duplication-insns are
11128 unfactored.
11129
11130 @item max-delay-slot-insn-search
11131 The maximum number of instructions to consider when looking for an
11132 instruction to fill a delay slot. If more than this arbitrary number of
11133 instructions are searched, the time savings from filling the delay slot
11134 are minimal, so stop searching. Increasing values mean more
11135 aggressive optimization, making the compilation time increase with probably
11136 small improvement in execution time.
11137
11138 @item max-delay-slot-live-search
11139 When trying to fill delay slots, the maximum number of instructions to
11140 consider when searching for a block with valid live register
11141 information. Increasing this arbitrarily chosen value means more
11142 aggressive optimization, increasing the compilation time. This parameter
11143 should be removed when the delay slot code is rewritten to maintain the
11144 control-flow graph.
11145
11146 @item max-gcse-memory
11147 The approximate maximum amount of memory that can be allocated in
11148 order to perform the global common subexpression elimination
11149 optimization. If more memory than specified is required, the
11150 optimization is not done.
11151
11152 @item max-gcse-insertion-ratio
11153 If the ratio of expression insertions to deletions is larger than this value
11154 for any expression, then RTL PRE inserts or removes the expression and thus
11155 leaves partially redundant computations in the instruction stream.
11156
11157 @item max-pending-list-length
11158 The maximum number of pending dependencies scheduling allows
11159 before flushing the current state and starting over. Large functions
11160 with few branches or calls can create excessively large lists which
11161 needlessly consume memory and resources.
11162
11163 @item max-modulo-backtrack-attempts
11164 The maximum number of backtrack attempts the scheduler should make
11165 when modulo scheduling a loop. Larger values can exponentially increase
11166 compilation time.
11167
11168 @item max-inline-insns-single
11169 Several parameters control the tree inliner used in GCC@.
11170 This number sets the maximum number of instructions (counted in GCC's
11171 internal representation) in a single function that the tree inliner
11172 considers for inlining. This only affects functions declared
11173 inline and methods implemented in a class declaration (C++).
11174
11175 @item max-inline-insns-auto
11176 When you use @option{-finline-functions} (included in @option{-O3}),
11177 a lot of functions that would otherwise not be considered for inlining
11178 by the compiler are investigated. To those functions, a different
11179 (more restrictive) limit compared to functions declared inline can
11180 be applied.
11181
11182 @item max-inline-insns-small
11183 This is bound applied to calls which are considered relevant with
11184 @option{-finline-small-functions}.
11185
11186 @item max-inline-insns-size
11187 This is bound applied to calls which are optimized for size. Small growth
11188 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11189
11190 @item uninlined-function-insns
11191 Number of instructions accounted by inliner for function overhead such as
11192 function prologue and epilogue.
11193
11194 @item uninlined-function-time
11195 Extra time accounted by inliner for function overhead such as time needed to
11196 execute function prologue and epilogue
11197
11198 @item uninlined-thunk-insns
11199 @item uninlined-thunk-time
11200 Same as @option{--param uninlined-function-insns} and
11201 @option{--param uninlined-function-time} but applied to function thunks
11202
11203 @item inline-min-speedup
11204 When estimated performance improvement of caller + callee runtime exceeds this
11205 threshold (in percent), the function can be inlined regardless of the limit on
11206 @option{--param max-inline-insns-single} and @option{--param
11207 max-inline-insns-auto}.
11208
11209 @item large-function-insns
11210 The limit specifying really large functions. For functions larger than this
11211 limit after inlining, inlining is constrained by
11212 @option{--param large-function-growth}. This parameter is useful primarily
11213 to avoid extreme compilation time caused by non-linear algorithms used by the
11214 back end.
11215
11216 @item large-function-growth
11217 Specifies maximal growth of large function caused by inlining in percents.
11218 For example, parameter value 100 limits large function growth to 2.0 times
11219 the original size.
11220
11221 @item large-unit-insns
11222 The limit specifying large translation unit. Growth caused by inlining of
11223 units larger than this limit is limited by @option{--param inline-unit-growth}.
11224 For small units this might be too tight.
11225 For example, consider a unit consisting of function A
11226 that is inline and B that just calls A three times. If B is small relative to
11227 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11228 large units consisting of small inlineable functions, however, the overall unit
11229 growth limit is needed to avoid exponential explosion of code size. Thus for
11230 smaller units, the size is increased to @option{--param large-unit-insns}
11231 before applying @option{--param inline-unit-growth}.
11232
11233 @item inline-unit-growth
11234 Specifies maximal overall growth of the compilation unit caused by inlining.
11235 For example, parameter value 20 limits unit growth to 1.2 times the original
11236 size. Cold functions (either marked cold via an attribute or by profile
11237 feedback) are not accounted into the unit size.
11238
11239 @item ipcp-unit-growth
11240 Specifies maximal overall growth of the compilation unit caused by
11241 interprocedural constant propagation. For example, parameter value 10 limits
11242 unit growth to 1.1 times the original size.
11243
11244 @item large-stack-frame
11245 The limit specifying large stack frames. While inlining the algorithm is trying
11246 to not grow past this limit too much.
11247
11248 @item large-stack-frame-growth
11249 Specifies maximal growth of large stack frames caused by inlining in percents.
11250 For example, parameter value 1000 limits large stack frame growth to 11 times
11251 the original size.
11252
11253 @item max-inline-insns-recursive
11254 @itemx max-inline-insns-recursive-auto
11255 Specifies the maximum number of instructions an out-of-line copy of a
11256 self-recursive inline
11257 function can grow into by performing recursive inlining.
11258
11259 @option{--param max-inline-insns-recursive} applies to functions
11260 declared inline.
11261 For functions not declared inline, recursive inlining
11262 happens only when @option{-finline-functions} (included in @option{-O3}) is
11263 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11264
11265 @item max-inline-recursive-depth
11266 @itemx max-inline-recursive-depth-auto
11267 Specifies the maximum recursion depth used for recursive inlining.
11268
11269 @option{--param max-inline-recursive-depth} applies to functions
11270 declared inline. For functions not declared inline, recursive inlining
11271 happens only when @option{-finline-functions} (included in @option{-O3}) is
11272 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11273
11274 @item min-inline-recursive-probability
11275 Recursive inlining is profitable only for function having deep recursion
11276 in average and can hurt for function having little recursion depth by
11277 increasing the prologue size or complexity of function body to other
11278 optimizers.
11279
11280 When profile feedback is available (see @option{-fprofile-generate}) the actual
11281 recursion depth can be guessed from the probability that function recurses
11282 via a given call expression. This parameter limits inlining only to call
11283 expressions whose probability exceeds the given threshold (in percents).
11284
11285 @item early-inlining-insns
11286 Specify growth that the early inliner can make. In effect it increases
11287 the amount of inlining for code having a large abstraction penalty.
11288
11289 @item max-early-inliner-iterations
11290 Limit of iterations of the early inliner. This basically bounds
11291 the number of nested indirect calls the early inliner can resolve.
11292 Deeper chains are still handled by late inlining.
11293
11294 @item comdat-sharing-probability
11295 Probability (in percent) that C++ inline function with comdat visibility
11296 are shared across multiple compilation units.
11297
11298 @item profile-func-internal-id
11299 A parameter to control whether to use function internal id in profile
11300 database lookup. If the value is 0, the compiler uses an id that
11301 is based on function assembler name and filename, which makes old profile
11302 data more tolerant to source changes such as function reordering etc.
11303
11304 @item min-vect-loop-bound
11305 The minimum number of iterations under which loops are not vectorized
11306 when @option{-ftree-vectorize} is used. The number of iterations after
11307 vectorization needs to be greater than the value specified by this option
11308 to allow vectorization.
11309
11310 @item gcse-cost-distance-ratio
11311 Scaling factor in calculation of maximum distance an expression
11312 can be moved by GCSE optimizations. This is currently supported only in the
11313 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11314 is with simple expressions, i.e., the expressions that have cost
11315 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11316 hoisting of simple expressions.
11317
11318 @item gcse-unrestricted-cost
11319 Cost, roughly measured as the cost of a single typical machine
11320 instruction, at which GCSE optimizations do not constrain
11321 the distance an expression can travel. This is currently
11322 supported only in the code hoisting pass. The lesser the cost,
11323 the more aggressive code hoisting is. Specifying 0
11324 allows all expressions to travel unrestricted distances.
11325
11326 @item max-hoist-depth
11327 The depth of search in the dominator tree for expressions to hoist.
11328 This is used to avoid quadratic behavior in hoisting algorithm.
11329 The value of 0 does not limit on the search, but may slow down compilation
11330 of huge functions.
11331
11332 @item max-tail-merge-comparisons
11333 The maximum amount of similar bbs to compare a bb with. This is used to
11334 avoid quadratic behavior in tree tail merging.
11335
11336 @item max-tail-merge-iterations
11337 The maximum amount of iterations of the pass over the function. This is used to
11338 limit compilation time in tree tail merging.
11339
11340 @item store-merging-allow-unaligned
11341 Allow the store merging pass to introduce unaligned stores if it is legal to
11342 do so.
11343
11344 @item max-stores-to-merge
11345 The maximum number of stores to attempt to merge into wider stores in the store
11346 merging pass.
11347
11348 @item max-unrolled-insns
11349 The maximum number of instructions that a loop may have to be unrolled.
11350 If a loop is unrolled, this parameter also determines how many times
11351 the loop code is unrolled.
11352
11353 @item max-average-unrolled-insns
11354 The maximum number of instructions biased by probabilities of their execution
11355 that a loop may have to be unrolled. If a loop is unrolled,
11356 this parameter also determines how many times the loop code is unrolled.
11357
11358 @item max-unroll-times
11359 The maximum number of unrollings of a single loop.
11360
11361 @item max-peeled-insns
11362 The maximum number of instructions that a loop may have to be peeled.
11363 If a loop is peeled, this parameter also determines how many times
11364 the loop code is peeled.
11365
11366 @item max-peel-times
11367 The maximum number of peelings of a single loop.
11368
11369 @item max-peel-branches
11370 The maximum number of branches on the hot path through the peeled sequence.
11371
11372 @item max-completely-peeled-insns
11373 The maximum number of insns of a completely peeled loop.
11374
11375 @item max-completely-peel-times
11376 The maximum number of iterations of a loop to be suitable for complete peeling.
11377
11378 @item max-completely-peel-loop-nest-depth
11379 The maximum depth of a loop nest suitable for complete peeling.
11380
11381 @item max-unswitch-insns
11382 The maximum number of insns of an unswitched loop.
11383
11384 @item max-unswitch-level
11385 The maximum number of branches unswitched in a single loop.
11386
11387 @item lim-expensive
11388 The minimum cost of an expensive expression in the loop invariant motion.
11389
11390 @item iv-consider-all-candidates-bound
11391 Bound on number of candidates for induction variables, below which
11392 all candidates are considered for each use in induction variable
11393 optimizations. If there are more candidates than this,
11394 only the most relevant ones are considered to avoid quadratic time complexity.
11395
11396 @item iv-max-considered-uses
11397 The induction variable optimizations give up on loops that contain more
11398 induction variable uses.
11399
11400 @item iv-always-prune-cand-set-bound
11401 If the number of candidates in the set is smaller than this value,
11402 always try to remove unnecessary ivs from the set
11403 when adding a new one.
11404
11405 @item avg-loop-niter
11406 Average number of iterations of a loop.
11407
11408 @item dse-max-object-size
11409 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11410 Larger values may result in larger compilation times.
11411
11412 @item dse-max-alias-queries-per-store
11413 Maximum number of queries into the alias oracle per store.
11414 Larger values result in larger compilation times and may result in more
11415 removed dead stores.
11416
11417 @item scev-max-expr-size
11418 Bound on size of expressions used in the scalar evolutions analyzer.
11419 Large expressions slow the analyzer.
11420
11421 @item scev-max-expr-complexity
11422 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11423 Complex expressions slow the analyzer.
11424
11425 @item max-tree-if-conversion-phi-args
11426 Maximum number of arguments in a PHI supported by TREE if conversion
11427 unless the loop is marked with simd pragma.
11428
11429 @item vect-max-version-for-alignment-checks
11430 The maximum number of run-time checks that can be performed when
11431 doing loop versioning for alignment in the vectorizer.
11432
11433 @item vect-max-version-for-alias-checks
11434 The maximum number of run-time checks that can be performed when
11435 doing loop versioning for alias in the vectorizer.
11436
11437 @item vect-max-peeling-for-alignment
11438 The maximum number of loop peels to enhance access alignment
11439 for vectorizer. Value -1 means no limit.
11440
11441 @item max-iterations-to-track
11442 The maximum number of iterations of a loop the brute-force algorithm
11443 for analysis of the number of iterations of the loop tries to evaluate.
11444
11445 @item hot-bb-count-ws-permille
11446 A basic block profile count is considered hot if it contributes to
11447 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
11448
11449 @item hot-bb-frequency-fraction
11450 Select fraction of the entry block frequency of executions of basic block in
11451 function given basic block needs to have to be considered hot.
11452
11453 @item max-predicted-iterations
11454 The maximum number of loop iterations we predict statically. This is useful
11455 in cases where a function contains a single loop with known bound and
11456 another loop with unknown bound.
11457 The known number of iterations is predicted correctly, while
11458 the unknown number of iterations average to roughly 10. This means that the
11459 loop without bounds appears artificially cold relative to the other one.
11460
11461 @item builtin-expect-probability
11462 Control the probability of the expression having the specified value. This
11463 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11464
11465 @item builtin-string-cmp-inline-length
11466 The maximum length of a constant string for a builtin string cmp call
11467 eligible for inlining.
11468
11469 @item align-threshold
11470
11471 Select fraction of the maximal frequency of executions of a basic block in
11472 a function to align the basic block.
11473
11474 @item align-loop-iterations
11475
11476 A loop expected to iterate at least the selected number of iterations is
11477 aligned.
11478
11479 @item tracer-dynamic-coverage
11480 @itemx tracer-dynamic-coverage-feedback
11481
11482 This value is used to limit superblock formation once the given percentage of
11483 executed instructions is covered. This limits unnecessary code size
11484 expansion.
11485
11486 The @option{tracer-dynamic-coverage-feedback} parameter
11487 is used only when profile
11488 feedback is available. The real profiles (as opposed to statically estimated
11489 ones) are much less balanced allowing the threshold to be larger value.
11490
11491 @item tracer-max-code-growth
11492 Stop tail duplication once code growth has reached given percentage. This is
11493 a rather artificial limit, as most of the duplicates are eliminated later in
11494 cross jumping, so it may be set to much higher values than is the desired code
11495 growth.
11496
11497 @item tracer-min-branch-ratio
11498
11499 Stop reverse growth when the reverse probability of best edge is less than this
11500 threshold (in percent).
11501
11502 @item tracer-min-branch-probability
11503 @itemx tracer-min-branch-probability-feedback
11504
11505 Stop forward growth if the best edge has probability lower than this
11506 threshold.
11507
11508 Similarly to @option{tracer-dynamic-coverage} two parameters are
11509 provided. @option{tracer-min-branch-probability-feedback} is used for
11510 compilation with profile feedback and @option{tracer-min-branch-probability}
11511 compilation without. The value for compilation with profile feedback
11512 needs to be more conservative (higher) in order to make tracer
11513 effective.
11514
11515 @item stack-clash-protection-guard-size
11516 Specify the size of the operating system provided stack guard as
11517 2 raised to @var{num} bytes. Higher values may reduce the
11518 number of explicit probes, but a value larger than the operating system
11519 provided guard will leave code vulnerable to stack clash style attacks.
11520
11521 @item stack-clash-protection-probe-interval
11522 Stack clash protection involves probing stack space as it is allocated. This
11523 param controls the maximum distance between probes into the stack as 2 raised
11524 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11525 larger than the operating system provided guard will leave code vulnerable to
11526 stack clash style attacks.
11527
11528 @item max-cse-path-length
11529
11530 The maximum number of basic blocks on path that CSE considers.
11531
11532 @item max-cse-insns
11533 The maximum number of instructions CSE processes before flushing.
11534
11535 @item ggc-min-expand
11536
11537 GCC uses a garbage collector to manage its own memory allocation. This
11538 parameter specifies the minimum percentage by which the garbage
11539 collector's heap should be allowed to expand between collections.
11540 Tuning this may improve compilation speed; it has no effect on code
11541 generation.
11542
11543 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11544 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11545 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11546 GCC is not able to calculate RAM on a particular platform, the lower
11547 bound of 30% is used. Setting this parameter and
11548 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11549 every opportunity. This is extremely slow, but can be useful for
11550 debugging.
11551
11552 @item ggc-min-heapsize
11553
11554 Minimum size of the garbage collector's heap before it begins bothering
11555 to collect garbage. The first collection occurs after the heap expands
11556 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11557 tuning this may improve compilation speed, and has no effect on code
11558 generation.
11559
11560 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11561 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11562 with a lower bound of 4096 (four megabytes) and an upper bound of
11563 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11564 particular platform, the lower bound is used. Setting this parameter
11565 very large effectively disables garbage collection. Setting this
11566 parameter and @option{ggc-min-expand} to zero causes a full collection
11567 to occur at every opportunity.
11568
11569 @item max-reload-search-insns
11570 The maximum number of instruction reload should look backward for equivalent
11571 register. Increasing values mean more aggressive optimization, making the
11572 compilation time increase with probably slightly better performance.
11573
11574 @item max-cselib-memory-locations
11575 The maximum number of memory locations cselib should take into account.
11576 Increasing values mean more aggressive optimization, making the compilation time
11577 increase with probably slightly better performance.
11578
11579 @item max-sched-ready-insns
11580 The maximum number of instructions ready to be issued the scheduler should
11581 consider at any given time during the first scheduling pass. Increasing
11582 values mean more thorough searches, making the compilation time increase
11583 with probably little benefit.
11584
11585 @item max-sched-region-blocks
11586 The maximum number of blocks in a region to be considered for
11587 interblock scheduling.
11588
11589 @item max-pipeline-region-blocks
11590 The maximum number of blocks in a region to be considered for
11591 pipelining in the selective scheduler.
11592
11593 @item max-sched-region-insns
11594 The maximum number of insns in a region to be considered for
11595 interblock scheduling.
11596
11597 @item max-pipeline-region-insns
11598 The maximum number of insns in a region to be considered for
11599 pipelining in the selective scheduler.
11600
11601 @item min-spec-prob
11602 The minimum probability (in percents) of reaching a source block
11603 for interblock speculative scheduling.
11604
11605 @item max-sched-extend-regions-iters
11606 The maximum number of iterations through CFG to extend regions.
11607 A value of 0 disables region extensions.
11608
11609 @item max-sched-insn-conflict-delay
11610 The maximum conflict delay for an insn to be considered for speculative motion.
11611
11612 @item sched-spec-prob-cutoff
11613 The minimal probability of speculation success (in percents), so that
11614 speculative insns are scheduled.
11615
11616 @item sched-state-edge-prob-cutoff
11617 The minimum probability an edge must have for the scheduler to save its
11618 state across it.
11619
11620 @item sched-mem-true-dep-cost
11621 Minimal distance (in CPU cycles) between store and load targeting same
11622 memory locations.
11623
11624 @item selsched-max-lookahead
11625 The maximum size of the lookahead window of selective scheduling. It is a
11626 depth of search for available instructions.
11627
11628 @item selsched-max-sched-times
11629 The maximum number of times that an instruction is scheduled during
11630 selective scheduling. This is the limit on the number of iterations
11631 through which the instruction may be pipelined.
11632
11633 @item selsched-insns-to-rename
11634 The maximum number of best instructions in the ready list that are considered
11635 for renaming in the selective scheduler.
11636
11637 @item sms-min-sc
11638 The minimum value of stage count that swing modulo scheduler
11639 generates.
11640
11641 @item max-last-value-rtl
11642 The maximum size measured as number of RTLs that can be recorded in an expression
11643 in combiner for a pseudo register as last known value of that register.
11644
11645 @item max-combine-insns
11646 The maximum number of instructions the RTL combiner tries to combine.
11647
11648 @item integer-share-limit
11649 Small integer constants can use a shared data structure, reducing the
11650 compiler's memory usage and increasing its speed. This sets the maximum
11651 value of a shared integer constant.
11652
11653 @item ssp-buffer-size
11654 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11655 protection when @option{-fstack-protection} is used.
11656
11657 @item min-size-for-stack-sharing
11658 The minimum size of variables taking part in stack slot sharing when not
11659 optimizing.
11660
11661 @item max-jump-thread-duplication-stmts
11662 Maximum number of statements allowed in a block that needs to be
11663 duplicated when threading jumps.
11664
11665 @item max-fields-for-field-sensitive
11666 Maximum number of fields in a structure treated in
11667 a field sensitive manner during pointer analysis.
11668
11669 @item prefetch-latency
11670 Estimate on average number of instructions that are executed before
11671 prefetch finishes. The distance prefetched ahead is proportional
11672 to this constant. Increasing this number may also lead to less
11673 streams being prefetched (see @option{simultaneous-prefetches}).
11674
11675 @item simultaneous-prefetches
11676 Maximum number of prefetches that can run at the same time.
11677
11678 @item l1-cache-line-size
11679 The size of cache line in L1 data cache, in bytes.
11680
11681 @item l1-cache-size
11682 The size of L1 data cache, in kilobytes.
11683
11684 @item l2-cache-size
11685 The size of L2 data cache, in kilobytes.
11686
11687 @item prefetch-dynamic-strides
11688 Whether the loop array prefetch pass should issue software prefetch hints
11689 for strides that are non-constant. In some cases this may be
11690 beneficial, though the fact the stride is non-constant may make it
11691 hard to predict when there is clear benefit to issuing these hints.
11692
11693 Set to 1 if the prefetch hints should be issued for non-constant
11694 strides. Set to 0 if prefetch hints should be issued only for strides that
11695 are known to be constant and below @option{prefetch-minimum-stride}.
11696
11697 @item prefetch-minimum-stride
11698 Minimum constant stride, in bytes, to start using prefetch hints for. If
11699 the stride is less than this threshold, prefetch hints will not be issued.
11700
11701 This setting is useful for processors that have hardware prefetchers, in
11702 which case there may be conflicts between the hardware prefetchers and
11703 the software prefetchers. If the hardware prefetchers have a maximum
11704 stride they can handle, it should be used here to improve the use of
11705 software prefetchers.
11706
11707 A value of -1 means we don't have a threshold and therefore
11708 prefetch hints can be issued for any constant stride.
11709
11710 This setting is only useful for strides that are known and constant.
11711
11712 @item loop-interchange-max-num-stmts
11713 The maximum number of stmts in a loop to be interchanged.
11714
11715 @item loop-interchange-stride-ratio
11716 The minimum ratio between stride of two loops for interchange to be profitable.
11717
11718 @item min-insn-to-prefetch-ratio
11719 The minimum ratio between the number of instructions and the
11720 number of prefetches to enable prefetching in a loop.
11721
11722 @item prefetch-min-insn-to-mem-ratio
11723 The minimum ratio between the number of instructions and the
11724 number of memory references to enable prefetching in a loop.
11725
11726 @item use-canonical-types
11727 Whether the compiler should use the ``canonical'' type system.
11728 Should always be 1, which uses a more efficient internal
11729 mechanism for comparing types in C++ and Objective-C++. However, if
11730 bugs in the canonical type system are causing compilation failures,
11731 set this value to 0 to disable canonical types.
11732
11733 @item switch-conversion-max-branch-ratio
11734 Switch initialization conversion refuses to create arrays that are
11735 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11736 branches in the switch.
11737
11738 @item max-partial-antic-length
11739 Maximum length of the partial antic set computed during the tree
11740 partial redundancy elimination optimization (@option{-ftree-pre}) when
11741 optimizing at @option{-O3} and above. For some sorts of source code
11742 the enhanced partial redundancy elimination optimization can run away,
11743 consuming all of the memory available on the host machine. This
11744 parameter sets a limit on the length of the sets that are computed,
11745 which prevents the runaway behavior. Setting a value of 0 for
11746 this parameter allows an unlimited set length.
11747
11748 @item rpo-vn-max-loop-depth
11749 Maximum loop depth that is value-numbered optimistically.
11750 When the limit hits the innermost
11751 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11752 loop nest are value-numbered optimistically and the remaining ones not.
11753
11754 @item sccvn-max-alias-queries-per-access
11755 Maximum number of alias-oracle queries we perform when looking for
11756 redundancies for loads and stores. If this limit is hit the search
11757 is aborted and the load or store is not considered redundant. The
11758 number of queries is algorithmically limited to the number of
11759 stores on all paths from the load to the function entry.
11760
11761 @item ira-max-loops-num
11762 IRA uses regional register allocation by default. If a function
11763 contains more loops than the number given by this parameter, only at most
11764 the given number of the most frequently-executed loops form regions
11765 for regional register allocation.
11766
11767 @item ira-max-conflict-table-size
11768 Although IRA uses a sophisticated algorithm to compress the conflict
11769 table, the table can still require excessive amounts of memory for
11770 huge functions. If the conflict table for a function could be more
11771 than the size in MB given by this parameter, the register allocator
11772 instead uses a faster, simpler, and lower-quality
11773 algorithm that does not require building a pseudo-register conflict table.
11774
11775 @item ira-loop-reserved-regs
11776 IRA can be used to evaluate more accurate register pressure in loops
11777 for decisions to move loop invariants (see @option{-O3}). The number
11778 of available registers reserved for some other purposes is given
11779 by this parameter. Default of the parameter
11780 is the best found from numerous experiments.
11781
11782 @item lra-inheritance-ebb-probability-cutoff
11783 LRA tries to reuse values reloaded in registers in subsequent insns.
11784 This optimization is called inheritance. EBB is used as a region to
11785 do this optimization. The parameter defines a minimal fall-through
11786 edge probability in percentage used to add BB to inheritance EBB in
11787 LRA. The default value was chosen
11788 from numerous runs of SPEC2000 on x86-64.
11789
11790 @item loop-invariant-max-bbs-in-loop
11791 Loop invariant motion can be very expensive, both in compilation time and
11792 in amount of needed compile-time memory, with very large loops. Loops
11793 with more basic blocks than this parameter won't have loop invariant
11794 motion optimization performed on them.
11795
11796 @item loop-max-datarefs-for-datadeps
11797 Building data dependencies is expensive for very large loops. This
11798 parameter limits the number of data references in loops that are
11799 considered for data dependence analysis. These large loops are no
11800 handled by the optimizations using loop data dependencies.
11801
11802 @item max-vartrack-size
11803 Sets a maximum number of hash table slots to use during variable
11804 tracking dataflow analysis of any function. If this limit is exceeded
11805 with variable tracking at assignments enabled, analysis for that
11806 function is retried without it, after removing all debug insns from
11807 the function. If the limit is exceeded even without debug insns, var
11808 tracking analysis is completely disabled for the function. Setting
11809 the parameter to zero makes it unlimited.
11810
11811 @item max-vartrack-expr-depth
11812 Sets a maximum number of recursion levels when attempting to map
11813 variable names or debug temporaries to value expressions. This trades
11814 compilation time for more complete debug information. If this is set too
11815 low, value expressions that are available and could be represented in
11816 debug information may end up not being used; setting this higher may
11817 enable the compiler to find more complex debug expressions, but compile
11818 time and memory use may grow.
11819
11820 @item max-debug-marker-count
11821 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11822 markers) to avoid complexity explosion at inlining or expanding to RTL.
11823 If a function has more such gimple stmts than the set limit, such stmts
11824 will be dropped from the inlined copy of a function, and from its RTL
11825 expansion.
11826
11827 @item min-nondebug-insn-uid
11828 Use uids starting at this parameter for nondebug insns. The range below
11829 the parameter is reserved exclusively for debug insns created by
11830 @option{-fvar-tracking-assignments}, but debug insns may get
11831 (non-overlapping) uids above it if the reserved range is exhausted.
11832
11833 @item ipa-sra-ptr-growth-factor
11834 IPA-SRA replaces a pointer to an aggregate with one or more new
11835 parameters only when their cumulative size is less or equal to
11836 @option{ipa-sra-ptr-growth-factor} times the size of the original
11837 pointer parameter.
11838
11839 @item sra-max-scalarization-size-Ospeed
11840 @itemx sra-max-scalarization-size-Osize
11841 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11842 replace scalar parts of aggregates with uses of independent scalar
11843 variables. These parameters control the maximum size, in storage units,
11844 of aggregate which is considered for replacement when compiling for
11845 speed
11846 (@option{sra-max-scalarization-size-Ospeed}) or size
11847 (@option{sra-max-scalarization-size-Osize}) respectively.
11848
11849 @item tm-max-aggregate-size
11850 When making copies of thread-local variables in a transaction, this
11851 parameter specifies the size in bytes after which variables are
11852 saved with the logging functions as opposed to save/restore code
11853 sequence pairs. This option only applies when using
11854 @option{-fgnu-tm}.
11855
11856 @item graphite-max-nb-scop-params
11857 To avoid exponential effects in the Graphite loop transforms, the
11858 number of parameters in a Static Control Part (SCoP) is bounded.
11859 A value of zero can be used to lift
11860 the bound. A variable whose value is unknown at compilation time and
11861 defined outside a SCoP is a parameter of the SCoP.
11862
11863 @item loop-block-tile-size
11864 Loop blocking or strip mining transforms, enabled with
11865 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11866 loop in the loop nest by a given number of iterations. The strip
11867 length can be changed using the @option{loop-block-tile-size}
11868 parameter.
11869
11870 @item ipa-cp-value-list-size
11871 IPA-CP attempts to track all possible values and types passed to a function's
11872 parameter in order to propagate them and perform devirtualization.
11873 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11874 stores per one formal parameter of a function.
11875
11876 @item ipa-cp-eval-threshold
11877 IPA-CP calculates its own score of cloning profitability heuristics
11878 and performs those cloning opportunities with scores that exceed
11879 @option{ipa-cp-eval-threshold}.
11880
11881 @item ipa-cp-recursion-penalty
11882 Percentage penalty the recursive functions will receive when they
11883 are evaluated for cloning.
11884
11885 @item ipa-cp-single-call-penalty
11886 Percentage penalty functions containing a single call to another
11887 function will receive when they are evaluated for cloning.
11888
11889 @item ipa-max-agg-items
11890 IPA-CP is also capable to propagate a number of scalar values passed
11891 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11892 number of such values per one parameter.
11893
11894 @item ipa-cp-loop-hint-bonus
11895 When IPA-CP determines that a cloning candidate would make the number
11896 of iterations of a loop known, it adds a bonus of
11897 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11898 the candidate.
11899
11900 @item ipa-max-aa-steps
11901 During its analysis of function bodies, IPA-CP employs alias analysis
11902 in order to track values pointed to by function parameters. In order
11903 not spend too much time analyzing huge functions, it gives up and
11904 consider all memory clobbered after examining
11905 @option{ipa-max-aa-steps} statements modifying memory.
11906
11907 @item lto-partitions
11908 Specify desired number of partitions produced during WHOPR compilation.
11909 The number of partitions should exceed the number of CPUs used for compilation.
11910
11911 @item lto-min-partition
11912 Size of minimal partition for WHOPR (in estimated instructions).
11913 This prevents expenses of splitting very small programs into too many
11914 partitions.
11915
11916 @item lto-max-partition
11917 Size of max partition for WHOPR (in estimated instructions).
11918 to provide an upper bound for individual size of partition.
11919 Meant to be used only with balanced partitioning.
11920
11921 @item lto-max-streaming-parallelism
11922 Maximal number of parallel processes used for LTO streaming.
11923
11924 @item cxx-max-namespaces-for-diagnostic-help
11925 The maximum number of namespaces to consult for suggestions when C++
11926 name lookup fails for an identifier.
11927
11928 @item sink-frequency-threshold
11929 The maximum relative execution frequency (in percents) of the target block
11930 relative to a statement's original block to allow statement sinking of a
11931 statement. Larger numbers result in more aggressive statement sinking.
11932 A small positive adjustment is applied for
11933 statements with memory operands as those are even more profitable so sink.
11934
11935 @item max-stores-to-sink
11936 The maximum number of conditional store pairs that can be sunk. Set to 0
11937 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11938 (@option{-ftree-loop-if-convert}) is disabled.
11939
11940 @item allow-store-data-races
11941 Allow optimizers to introduce new data races on stores.
11942 Set to 1 to allow, otherwise to 0.
11943
11944 @item case-values-threshold
11945 The smallest number of different values for which it is best to use a
11946 jump-table instead of a tree of conditional branches. If the value is
11947 0, use the default for the machine.
11948
11949 @item jump-table-max-growth-ratio-for-size
11950 The maximum code size growth ratio when expanding
11951 into a jump table (in percent). The parameter is used when
11952 optimizing for size.
11953
11954 @item jump-table-max-growth-ratio-for-speed
11955 The maximum code size growth ratio when expanding
11956 into a jump table (in percent). The parameter is used when
11957 optimizing for speed.
11958
11959 @item tree-reassoc-width
11960 Set the maximum number of instructions executed in parallel in
11961 reassociated tree. This parameter overrides target dependent
11962 heuristics used by default if has non zero value.
11963
11964 @item sched-pressure-algorithm
11965 Choose between the two available implementations of
11966 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11967 and is the more likely to prevent instructions from being reordered.
11968 Algorithm 2 was designed to be a compromise between the relatively
11969 conservative approach taken by algorithm 1 and the rather aggressive
11970 approach taken by the default scheduler. It relies more heavily on
11971 having a regular register file and accurate register pressure classes.
11972 See @file{haifa-sched.c} in the GCC sources for more details.
11973
11974 The default choice depends on the target.
11975
11976 @item max-slsr-cand-scan
11977 Set the maximum number of existing candidates that are considered when
11978 seeking a basis for a new straight-line strength reduction candidate.
11979
11980 @item asan-globals
11981 Enable buffer overflow detection for global objects. This kind
11982 of protection is enabled by default if you are using
11983 @option{-fsanitize=address} option.
11984 To disable global objects protection use @option{--param asan-globals=0}.
11985
11986 @item asan-stack
11987 Enable buffer overflow detection for stack objects. This kind of
11988 protection is enabled by default when using @option{-fsanitize=address}.
11989 To disable stack protection use @option{--param asan-stack=0} option.
11990
11991 @item asan-instrument-reads
11992 Enable buffer overflow detection for memory reads. This kind of
11993 protection is enabled by default when using @option{-fsanitize=address}.
11994 To disable memory reads protection use
11995 @option{--param asan-instrument-reads=0}.
11996
11997 @item asan-instrument-writes
11998 Enable buffer overflow detection for memory writes. This kind of
11999 protection is enabled by default when using @option{-fsanitize=address}.
12000 To disable memory writes protection use
12001 @option{--param asan-instrument-writes=0} option.
12002
12003 @item asan-memintrin
12004 Enable detection for built-in functions. This kind of protection
12005 is enabled by default when using @option{-fsanitize=address}.
12006 To disable built-in functions protection use
12007 @option{--param asan-memintrin=0}.
12008
12009 @item asan-use-after-return
12010 Enable detection of use-after-return. This kind of protection
12011 is enabled by default when using the @option{-fsanitize=address} option.
12012 To disable it use @option{--param asan-use-after-return=0}.
12013
12014 Note: By default the check is disabled at run time. To enable it,
12015 add @code{detect_stack_use_after_return=1} to the environment variable
12016 @env{ASAN_OPTIONS}.
12017
12018 @item asan-instrumentation-with-call-threshold
12019 If number of memory accesses in function being instrumented
12020 is greater or equal to this number, use callbacks instead of inline checks.
12021 E.g. to disable inline code use
12022 @option{--param asan-instrumentation-with-call-threshold=0}.
12023
12024 @item use-after-scope-direct-emission-threshold
12025 If the size of a local variable in bytes is smaller or equal to this
12026 number, directly poison (or unpoison) shadow memory instead of using
12027 run-time callbacks.
12028
12029 @item max-fsm-thread-path-insns
12030 Maximum number of instructions to copy when duplicating blocks on a
12031 finite state automaton jump thread path.
12032
12033 @item max-fsm-thread-length
12034 Maximum number of basic blocks on a finite state automaton jump thread
12035 path.
12036
12037 @item max-fsm-thread-paths
12038 Maximum number of new jump thread paths to create for a finite state
12039 automaton.
12040
12041 @item parloops-chunk-size
12042 Chunk size of omp schedule for loops parallelized by parloops.
12043
12044 @item parloops-schedule
12045 Schedule type of omp schedule for loops parallelized by parloops (static,
12046 dynamic, guided, auto, runtime).
12047
12048 @item parloops-min-per-thread
12049 The minimum number of iterations per thread of an innermost parallelized
12050 loop for which the parallelized variant is preferred over the single threaded
12051 one. Note that for a parallelized loop nest the
12052 minimum number of iterations of the outermost loop per thread is two.
12053
12054 @item max-ssa-name-query-depth
12055 Maximum depth of recursion when querying properties of SSA names in things
12056 like fold routines. One level of recursion corresponds to following a
12057 use-def chain.
12058
12059 @item hsa-gen-debug-stores
12060 Enable emission of special debug stores within HSA kernels which are
12061 then read and reported by libgomp plugin. Generation of these stores
12062 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12063 enable it.
12064
12065 @item max-speculative-devirt-maydefs
12066 The maximum number of may-defs we analyze when looking for a must-def
12067 specifying the dynamic type of an object that invokes a virtual call
12068 we may be able to devirtualize speculatively.
12069
12070 @item max-vrp-switch-assertions
12071 The maximum number of assertions to add along the default edge of a switch
12072 statement during VRP.
12073
12074 @item unroll-jam-min-percent
12075 The minimum percentage of memory references that must be optimized
12076 away for the unroll-and-jam transformation to be considered profitable.
12077
12078 @item unroll-jam-max-unroll
12079 The maximum number of times the outer loop should be unrolled by
12080 the unroll-and-jam transformation.
12081
12082 @item max-rtl-if-conversion-unpredictable-cost
12083 Maximum permissible cost for the sequence that would be generated
12084 by the RTL if-conversion pass for a branch that is considered unpredictable.
12085
12086 @item max-variable-expansions-in-unroller
12087 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12088 of times that an individual variable will be expanded during loop unrolling.
12089
12090 @item tracer-min-branch-probability-feedback
12091 Stop forward growth if the probability of best edge is less than
12092 this threshold (in percent). Used when profile feedback is available.
12093
12094 @item partial-inlining-entry-probability
12095 Maximum probability of the entry BB of split region
12096 (in percent relative to entry BB of the function)
12097 to make partial inlining happen.
12098
12099 @item max-tracked-strlens
12100 Maximum number of strings for which strlen optimization pass will
12101 track string lengths.
12102
12103 @item gcse-after-reload-partial-fraction
12104 The threshold ratio for performing partial redundancy
12105 elimination after reload.
12106
12107 @item gcse-after-reload-critical-fraction
12108 The threshold ratio of critical edges execution count that
12109 permit performing redundancy elimination after reload.
12110
12111 @item max-loop-header-insns
12112 The maximum number of insns in loop header duplicated
12113 by the copy loop headers pass.
12114
12115 @item vect-epilogues-nomask
12116 Enable loop epilogue vectorization using smaller vector size.
12117
12118 @item slp-max-insns-in-bb
12119 Maximum number of instructions in basic block to be
12120 considered for SLP vectorization.
12121
12122 @item avoid-fma-max-bits
12123 Maximum number of bits for which we avoid creating FMAs.
12124
12125 @item sms-loop-average-count-threshold
12126 A threshold on the average loop count considered by the swing modulo scheduler.
12127
12128 @item sms-dfa-history
12129 The number of cycles the swing modulo scheduler considers when checking
12130 conflicts using DFA.
12131
12132 @item hot-bb-count-fraction
12133 Select fraction of the maximal count of repetitions of basic block
12134 in program given basic block needs
12135 to have to be considered hot (used in non-LTO mode)
12136
12137 @item max-inline-insns-recursive-auto
12138 The maximum number of instructions non-inline function
12139 can grow to via recursive inlining.
12140
12141 @item graphite-allow-codegen-errors
12142 Whether codegen errors should be ICEs when @option{-fchecking}.
12143
12144 @item sms-max-ii-factor
12145 A factor for tuning the upper bound that swing modulo scheduler
12146 uses for scheduling a loop.
12147
12148 @item lra-max-considered-reload-pseudos
12149 The max number of reload pseudos which are considered during
12150 spilling a non-reload pseudo.
12151
12152 @item max-pow-sqrt-depth
12153 Maximum depth of sqrt chains to use when synthesizing exponentiation
12154 by a real constant.
12155
12156 @item max-dse-active-local-stores
12157 Maximum number of active local stores in RTL dead store elimination.
12158
12159 @item asan-instrument-allocas
12160 Enable asan allocas/VLAs protection.
12161
12162 @item max-iterations-computation-cost
12163 Bound on the cost of an expression to compute the number of iterations.
12164
12165 @item max-isl-operations
12166 Maximum number of isl operations, 0 means unlimited.
12167
12168 @item graphite-max-arrays-per-scop
12169 Maximum number of arrays per scop.
12170
12171 @item max-vartrack-reverse-op-size
12172 Max. size of loc list for which reverse ops should be added.
12173
12174 @item unlikely-bb-count-fraction
12175 The minimum fraction of profile runs a given basic block execution count
12176 must be not to be considered unlikely.
12177
12178 @item tracer-dynamic-coverage-feedback
12179 The percentage of function, weighted by execution frequency,
12180 that must be covered by trace formation.
12181 Used when profile feedback is available.
12182
12183 @item max-inline-recursive-depth-auto
12184 The maximum depth of recursive inlining for non-inline functions.
12185
12186 @item fsm-scale-path-stmts
12187 Scale factor to apply to the number of statements in a threading path
12188 when comparing to the number of (scaled) blocks.
12189
12190 @item fsm-maximum-phi-arguments
12191 Maximum number of arguments a PHI may have before the FSM threader
12192 will not try to thread through its block.
12193
12194 @item uninit-control-dep-attempts
12195 Maximum number of nested calls to search for control dependencies
12196 during uninitialized variable analysis.
12197
12198 @item max-once-peeled-insns
12199 The maximum number of insns of a peeled loop that rolls only once.
12200
12201 @item sra-max-scalarization-size-Osize
12202 Maximum size, in storage units, of an aggregate
12203 which should be considered for scalarization when compiling for size.
12204
12205 @item fsm-scale-path-blocks
12206 Scale factor to apply to the number of blocks in a threading path
12207 when comparing to the number of (scaled) statements.
12208
12209 @item sched-autopref-queue-depth
12210 Hardware autoprefetcher scheduler model control flag.
12211 Number of lookahead cycles the model looks into; at '
12212 ' only enable instruction sorting heuristic.
12213
12214 @item loop-versioning-max-inner-insns
12215 The maximum number of instructions that an inner loop can have
12216 before the loop versioning pass considers it too big to copy.
12217
12218 @item loop-versioning-max-outer-insns
12219 The maximum number of instructions that an outer loop can have
12220 before the loop versioning pass considers it too big to copy,
12221 discounting any instructions in inner loops that directly benefit
12222 from versioning.
12223
12224 @item ssa-name-def-chain-limit
12225 The maximum number of SSA_NAME assignments to follow in determining
12226 a property of a variable such as its value. This limits the number
12227 of iterations or recursive calls GCC performs when optimizing certain
12228 statements or when determining their validity prior to issuing
12229 diagnostics.
12230
12231 @end table
12232 @end table
12233
12234 @node Instrumentation Options
12235 @section Program Instrumentation Options
12236 @cindex instrumentation options
12237 @cindex program instrumentation options
12238 @cindex run-time error checking options
12239 @cindex profiling options
12240 @cindex options, program instrumentation
12241 @cindex options, run-time error checking
12242 @cindex options, profiling
12243
12244 GCC supports a number of command-line options that control adding
12245 run-time instrumentation to the code it normally generates.
12246 For example, one purpose of instrumentation is collect profiling
12247 statistics for use in finding program hot spots, code coverage
12248 analysis, or profile-guided optimizations.
12249 Another class of program instrumentation is adding run-time checking
12250 to detect programming errors like invalid pointer
12251 dereferences or out-of-bounds array accesses, as well as deliberately
12252 hostile attacks such as stack smashing or C++ vtable hijacking.
12253 There is also a general hook which can be used to implement other
12254 forms of tracing or function-level instrumentation for debug or
12255 program analysis purposes.
12256
12257 @table @gcctabopt
12258 @cindex @command{prof}
12259 @cindex @command{gprof}
12260 @item -p
12261 @itemx -pg
12262 @opindex p
12263 @opindex pg
12264 Generate extra code to write profile information suitable for the
12265 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12266 (for @option{-pg}). You must use this option when compiling
12267 the source files you want data about, and you must also use it when
12268 linking.
12269
12270 You can use the function attribute @code{no_instrument_function} to
12271 suppress profiling of individual functions when compiling with these options.
12272 @xref{Common Function Attributes}.
12273
12274 @item -fprofile-arcs
12275 @opindex fprofile-arcs
12276 Add code so that program flow @dfn{arcs} are instrumented. During
12277 execution the program records how many times each branch and call is
12278 executed and how many times it is taken or returns. On targets that support
12279 constructors with priority support, profiling properly handles constructors,
12280 destructors and C++ constructors (and destructors) of classes which are used
12281 as a type of a global variable.
12282
12283 When the compiled
12284 program exits it saves this data to a file called
12285 @file{@var{auxname}.gcda} for each source file. The data may be used for
12286 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12287 test coverage analysis (@option{-ftest-coverage}). Each object file's
12288 @var{auxname} is generated from the name of the output file, if
12289 explicitly specified and it is not the final executable, otherwise it is
12290 the basename of the source file. In both cases any suffix is removed
12291 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12292 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12293 @xref{Cross-profiling}.
12294
12295 @cindex @command{gcov}
12296 @item --coverage
12297 @opindex coverage
12298
12299 This option is used to compile and link code instrumented for coverage
12300 analysis. The option is a synonym for @option{-fprofile-arcs}
12301 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12302 linking). See the documentation for those options for more details.
12303
12304 @itemize
12305
12306 @item
12307 Compile the source files with @option{-fprofile-arcs} plus optimization
12308 and code generation options. For test coverage analysis, use the
12309 additional @option{-ftest-coverage} option. You do not need to profile
12310 every source file in a program.
12311
12312 @item
12313 Compile the source files additionally with @option{-fprofile-abs-path}
12314 to create absolute path names in the @file{.gcno} files. This allows
12315 @command{gcov} to find the correct sources in projects where compilations
12316 occur with different working directories.
12317
12318 @item
12319 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12320 (the latter implies the former).
12321
12322 @item
12323 Run the program on a representative workload to generate the arc profile
12324 information. This may be repeated any number of times. You can run
12325 concurrent instances of your program, and provided that the file system
12326 supports locking, the data files will be correctly updated. Unless
12327 a strict ISO C dialect option is in effect, @code{fork} calls are
12328 detected and correctly handled without double counting.
12329
12330 @item
12331 For profile-directed optimizations, compile the source files again with
12332 the same optimization and code generation options plus
12333 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12334 Control Optimization}).
12335
12336 @item
12337 For test coverage analysis, use @command{gcov} to produce human readable
12338 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12339 @command{gcov} documentation for further information.
12340
12341 @end itemize
12342
12343 With @option{-fprofile-arcs}, for each function of your program GCC
12344 creates a program flow graph, then finds a spanning tree for the graph.
12345 Only arcs that are not on the spanning tree have to be instrumented: the
12346 compiler adds code to count the number of times that these arcs are
12347 executed. When an arc is the only exit or only entrance to a block, the
12348 instrumentation code can be added to the block; otherwise, a new basic
12349 block must be created to hold the instrumentation code.
12350
12351 @need 2000
12352 @item -ftest-coverage
12353 @opindex ftest-coverage
12354 Produce a notes file that the @command{gcov} code-coverage utility
12355 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12356 show program coverage. Each source file's note file is called
12357 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12358 above for a description of @var{auxname} and instructions on how to
12359 generate test coverage data. Coverage data matches the source files
12360 more closely if you do not optimize.
12361
12362 @item -fprofile-abs-path
12363 @opindex fprofile-abs-path
12364 Automatically convert relative source file names to absolute path names
12365 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12366 sources in projects where compilations occur with different working
12367 directories.
12368
12369 @item -fprofile-dir=@var{path}
12370 @opindex fprofile-dir
12371
12372 Set the directory to search for the profile data files in to @var{path}.
12373 This option affects only the profile data generated by
12374 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12375 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12376 and its related options. Both absolute and relative paths can be used.
12377 By default, GCC uses the current directory as @var{path}, thus the
12378 profile data file appears in the same directory as the object file.
12379 In order to prevent the file name clashing, if the object file name is
12380 not an absolute path, we mangle the absolute path of the
12381 @file{@var{sourcename}.gcda} file and use it as the file name of a
12382 @file{.gcda} file. See similar option @option{-fprofile-note}.
12383
12384 When an executable is run in a massive parallel environment, it is recommended
12385 to save profile to different folders. That can be done with variables
12386 in @var{path} that are exported during run-time:
12387
12388 @table @gcctabopt
12389
12390 @item %p
12391 process ID.
12392
12393 @item %q@{VAR@}
12394 value of environment variable @var{VAR}
12395
12396 @end table
12397
12398 @item -fprofile-generate
12399 @itemx -fprofile-generate=@var{path}
12400 @opindex fprofile-generate
12401
12402 Enable options usually used for instrumenting application to produce
12403 profile useful for later recompilation with profile feedback based
12404 optimization. You must use @option{-fprofile-generate} both when
12405 compiling and when linking your program.
12406
12407 The following options are enabled:
12408 @option{-fprofile-arcs}, @option{-fprofile-values},
12409 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12410
12411 If @var{path} is specified, GCC looks at the @var{path} to find
12412 the profile feedback data files. See @option{-fprofile-dir}.
12413
12414 To optimize the program based on the collected profile information, use
12415 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12416
12417 @item -fprofile-note=@var{path}
12418 @opindex fprofile-note
12419
12420 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
12421 location. If you combine the option with multiple source files,
12422 the @file{.gcno} file will be overwritten.
12423
12424 @item -fprofile-update=@var{method}
12425 @opindex fprofile-update
12426
12427 Alter the update method for an application instrumented for profile
12428 feedback based optimization. The @var{method} argument should be one of
12429 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12430 The first one is useful for single-threaded applications,
12431 while the second one prevents profile corruption by emitting thread-safe code.
12432
12433 @strong{Warning:} When an application does not properly join all threads
12434 (or creates an detached thread), a profile file can be still corrupted.
12435
12436 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12437 when supported by a target, or to @samp{single} otherwise. The GCC driver
12438 automatically selects @samp{prefer-atomic} when @option{-pthread}
12439 is present in the command line.
12440
12441 @item -fprofile-filter-files=@var{regex}
12442 @opindex fprofile-filter-files
12443
12444 Instrument only functions from files where names match
12445 any regular expression (separated by a semi-colon).
12446
12447 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12448 only @file{main.c} and all C files starting with 'module'.
12449
12450 @item -fprofile-exclude-files=@var{regex}
12451 @opindex fprofile-exclude-files
12452
12453 Instrument only functions from files where names do not match
12454 all the regular expressions (separated by a semi-colon).
12455
12456 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12457 of all files that are located in @file{/usr/} folder.
12458
12459 @item -fsanitize=address
12460 @opindex fsanitize=address
12461 Enable AddressSanitizer, a fast memory error detector.
12462 Memory access instructions are instrumented to detect
12463 out-of-bounds and use-after-free bugs.
12464 The option enables @option{-fsanitize-address-use-after-scope}.
12465 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12466 more details. The run-time behavior can be influenced using the
12467 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12468 the available options are shown at startup of the instrumented program. See
12469 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12470 for a list of supported options.
12471 The option cannot be combined with @option{-fsanitize=thread}.
12472
12473 @item -fsanitize=kernel-address
12474 @opindex fsanitize=kernel-address
12475 Enable AddressSanitizer for Linux kernel.
12476 See @uref{https://github.com/google/kasan/wiki} for more details.
12477
12478 @item -fsanitize=pointer-compare
12479 @opindex fsanitize=pointer-compare
12480 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12481 The option must be combined with either @option{-fsanitize=kernel-address} or
12482 @option{-fsanitize=address}
12483 The option cannot be combined with @option{-fsanitize=thread}.
12484 Note: By default the check is disabled at run time. To enable it,
12485 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12486 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12487 invalid operation only when both pointers are non-null.
12488
12489 @item -fsanitize=pointer-subtract
12490 @opindex fsanitize=pointer-subtract
12491 Instrument subtraction with pointer operands.
12492 The option must be combined with either @option{-fsanitize=kernel-address} or
12493 @option{-fsanitize=address}
12494 The option cannot be combined with @option{-fsanitize=thread}.
12495 Note: By default the check is disabled at run time. To enable it,
12496 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12497 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12498 invalid operation only when both pointers are non-null.
12499
12500 @item -fsanitize=thread
12501 @opindex fsanitize=thread
12502 Enable ThreadSanitizer, a fast data race detector.
12503 Memory access instructions are instrumented to detect
12504 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12505 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12506 environment variable; see
12507 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12508 supported options.
12509 The option cannot be combined with @option{-fsanitize=address},
12510 @option{-fsanitize=leak}.
12511
12512 Note that sanitized atomic builtins cannot throw exceptions when
12513 operating on invalid memory addresses with non-call exceptions
12514 (@option{-fnon-call-exceptions}).
12515
12516 @item -fsanitize=leak
12517 @opindex fsanitize=leak
12518 Enable LeakSanitizer, a memory leak detector.
12519 This option only matters for linking of executables and
12520 the executable is linked against a library that overrides @code{malloc}
12521 and other allocator functions. See
12522 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12523 details. The run-time behavior can be influenced using the
12524 @env{LSAN_OPTIONS} environment variable.
12525 The option cannot be combined with @option{-fsanitize=thread}.
12526
12527 @item -fsanitize=undefined
12528 @opindex fsanitize=undefined
12529 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12530 Various computations are instrumented to detect undefined behavior
12531 at runtime. Current suboptions are:
12532
12533 @table @gcctabopt
12534
12535 @item -fsanitize=shift
12536 @opindex fsanitize=shift
12537 This option enables checking that the result of a shift operation is
12538 not undefined. Note that what exactly is considered undefined differs
12539 slightly between C and C++, as well as between ISO C90 and C99, etc.
12540 This option has two suboptions, @option{-fsanitize=shift-base} and
12541 @option{-fsanitize=shift-exponent}.
12542
12543 @item -fsanitize=shift-exponent
12544 @opindex fsanitize=shift-exponent
12545 This option enables checking that the second argument of a shift operation
12546 is not negative and is smaller than the precision of the promoted first
12547 argument.
12548
12549 @item -fsanitize=shift-base
12550 @opindex fsanitize=shift-base
12551 If the second argument of a shift operation is within range, check that the
12552 result of a shift operation is not undefined. Note that what exactly is
12553 considered undefined differs slightly between C and C++, as well as between
12554 ISO C90 and C99, etc.
12555
12556 @item -fsanitize=integer-divide-by-zero
12557 @opindex fsanitize=integer-divide-by-zero
12558 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12559
12560 @item -fsanitize=unreachable
12561 @opindex fsanitize=unreachable
12562 With this option, the compiler turns the @code{__builtin_unreachable}
12563 call into a diagnostics message call instead. When reaching the
12564 @code{__builtin_unreachable} call, the behavior is undefined.
12565
12566 @item -fsanitize=vla-bound
12567 @opindex fsanitize=vla-bound
12568 This option instructs the compiler to check that the size of a variable
12569 length array is positive.
12570
12571 @item -fsanitize=null
12572 @opindex fsanitize=null
12573 This option enables pointer checking. Particularly, the application
12574 built with this option turned on will issue an error message when it
12575 tries to dereference a NULL pointer, or if a reference (possibly an
12576 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12577 on an object pointed by a NULL pointer.
12578
12579 @item -fsanitize=return
12580 @opindex fsanitize=return
12581 This option enables return statement checking. Programs
12582 built with this option turned on will issue an error message
12583 when the end of a non-void function is reached without actually
12584 returning a value. This option works in C++ only.
12585
12586 @item -fsanitize=signed-integer-overflow
12587 @opindex fsanitize=signed-integer-overflow
12588 This option enables signed integer overflow checking. We check that
12589 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12590 does not overflow in the signed arithmetics. Note, integer promotion
12591 rules must be taken into account. That is, the following is not an
12592 overflow:
12593 @smallexample
12594 signed char a = SCHAR_MAX;
12595 a++;
12596 @end smallexample
12597
12598 @item -fsanitize=bounds
12599 @opindex fsanitize=bounds
12600 This option enables instrumentation of array bounds. Various out of bounds
12601 accesses are detected. Flexible array members, flexible array member-like
12602 arrays, and initializers of variables with static storage are not instrumented.
12603
12604 @item -fsanitize=bounds-strict
12605 @opindex fsanitize=bounds-strict
12606 This option enables strict instrumentation of array bounds. Most out of bounds
12607 accesses are detected, including flexible array members and flexible array
12608 member-like arrays. Initializers of variables with static storage are not
12609 instrumented.
12610
12611 @item -fsanitize=alignment
12612 @opindex fsanitize=alignment
12613
12614 This option enables checking of alignment of pointers when they are
12615 dereferenced, or when a reference is bound to insufficiently aligned target,
12616 or when a method or constructor is invoked on insufficiently aligned object.
12617
12618 @item -fsanitize=object-size
12619 @opindex fsanitize=object-size
12620 This option enables instrumentation of memory references using the
12621 @code{__builtin_object_size} function. Various out of bounds pointer
12622 accesses are detected.
12623
12624 @item -fsanitize=float-divide-by-zero
12625 @opindex fsanitize=float-divide-by-zero
12626 Detect floating-point division by zero. Unlike other similar options,
12627 @option{-fsanitize=float-divide-by-zero} is not enabled by
12628 @option{-fsanitize=undefined}, since floating-point division by zero can
12629 be a legitimate way of obtaining infinities and NaNs.
12630
12631 @item -fsanitize=float-cast-overflow
12632 @opindex fsanitize=float-cast-overflow
12633 This option enables floating-point type to integer conversion checking.
12634 We check that the result of the conversion does not overflow.
12635 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12636 not enabled by @option{-fsanitize=undefined}.
12637 This option does not work well with @code{FE_INVALID} exceptions enabled.
12638
12639 @item -fsanitize=nonnull-attribute
12640 @opindex fsanitize=nonnull-attribute
12641
12642 This option enables instrumentation of calls, checking whether null values
12643 are not passed to arguments marked as requiring a non-null value by the
12644 @code{nonnull} function attribute.
12645
12646 @item -fsanitize=returns-nonnull-attribute
12647 @opindex fsanitize=returns-nonnull-attribute
12648
12649 This option enables instrumentation of return statements in functions
12650 marked with @code{returns_nonnull} function attribute, to detect returning
12651 of null values from such functions.
12652
12653 @item -fsanitize=bool
12654 @opindex fsanitize=bool
12655
12656 This option enables instrumentation of loads from bool. If a value other
12657 than 0/1 is loaded, a run-time error is issued.
12658
12659 @item -fsanitize=enum
12660 @opindex fsanitize=enum
12661
12662 This option enables instrumentation of loads from an enum type. If
12663 a value outside the range of values for the enum type is loaded,
12664 a run-time error is issued.
12665
12666 @item -fsanitize=vptr
12667 @opindex fsanitize=vptr
12668
12669 This option enables instrumentation of C++ member function calls, member
12670 accesses and some conversions between pointers to base and derived classes,
12671 to verify the referenced object has the correct dynamic type.
12672
12673 @item -fsanitize=pointer-overflow
12674 @opindex fsanitize=pointer-overflow
12675
12676 This option enables instrumentation of pointer arithmetics. If the pointer
12677 arithmetics overflows, a run-time error is issued.
12678
12679 @item -fsanitize=builtin
12680 @opindex fsanitize=builtin
12681
12682 This option enables instrumentation of arguments to selected builtin
12683 functions. If an invalid value is passed to such arguments, a run-time
12684 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12685 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12686 by this option.
12687
12688 @end table
12689
12690 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12691 @option{-fsanitize=undefined} gives a diagnostic message.
12692 This currently works only for the C family of languages.
12693
12694 @item -fno-sanitize=all
12695 @opindex fno-sanitize=all
12696
12697 This option disables all previously enabled sanitizers.
12698 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12699 together.
12700
12701 @item -fasan-shadow-offset=@var{number}
12702 @opindex fasan-shadow-offset
12703 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12704 It is useful for experimenting with different shadow memory layouts in
12705 Kernel AddressSanitizer.
12706
12707 @item -fsanitize-sections=@var{s1},@var{s2},...
12708 @opindex fsanitize-sections
12709 Sanitize global variables in selected user-defined sections. @var{si} may
12710 contain wildcards.
12711
12712 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12713 @opindex fsanitize-recover
12714 @opindex fno-sanitize-recover
12715 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12716 mentioned in comma-separated list of @var{opts}. Enabling this option
12717 for a sanitizer component causes it to attempt to continue
12718 running the program as if no error happened. This means multiple
12719 runtime errors can be reported in a single program run, and the exit
12720 code of the program may indicate success even when errors
12721 have been reported. The @option{-fno-sanitize-recover=} option
12722 can be used to alter
12723 this behavior: only the first detected error is reported
12724 and program then exits with a non-zero exit code.
12725
12726 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12727 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12728 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12729 @option{-fsanitize=bounds-strict},
12730 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12731 For these sanitizers error recovery is turned on by default,
12732 except @option{-fsanitize=address}, for which this feature is experimental.
12733 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12734 accepted, the former enables recovery for all sanitizers that support it,
12735 the latter disables recovery for all sanitizers that support it.
12736
12737 Even if a recovery mode is turned on the compiler side, it needs to be also
12738 enabled on the runtime library side, otherwise the failures are still fatal.
12739 The runtime library defaults to @code{halt_on_error=0} for
12740 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12741 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12742 setting the @code{halt_on_error} flag in the corresponding environment variable.
12743
12744 Syntax without an explicit @var{opts} parameter is deprecated. It is
12745 equivalent to specifying an @var{opts} list of:
12746
12747 @smallexample
12748 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12749 @end smallexample
12750
12751 @item -fsanitize-address-use-after-scope
12752 @opindex fsanitize-address-use-after-scope
12753 Enable sanitization of local variables to detect use-after-scope bugs.
12754 The option sets @option{-fstack-reuse} to @samp{none}.
12755
12756 @item -fsanitize-undefined-trap-on-error
12757 @opindex fsanitize-undefined-trap-on-error
12758 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12759 report undefined behavior using @code{__builtin_trap} rather than
12760 a @code{libubsan} library routine. The advantage of this is that the
12761 @code{libubsan} library is not needed and is not linked in, so this
12762 is usable even in freestanding environments.
12763
12764 @item -fsanitize-coverage=trace-pc
12765 @opindex fsanitize-coverage=trace-pc
12766 Enable coverage-guided fuzzing code instrumentation.
12767 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12768
12769 @item -fsanitize-coverage=trace-cmp
12770 @opindex fsanitize-coverage=trace-cmp
12771 Enable dataflow guided fuzzing code instrumentation.
12772 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12773 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12774 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12775 variable or @code{__sanitizer_cov_trace_const_cmp1},
12776 @code{__sanitizer_cov_trace_const_cmp2},
12777 @code{__sanitizer_cov_trace_const_cmp4} or
12778 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12779 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12780 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12781 @code{__sanitizer_cov_trace_switch} for switch statements.
12782
12783 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12784 @opindex fcf-protection
12785 Enable code instrumentation of control-flow transfers to increase
12786 program security by checking that target addresses of control-flow
12787 transfer instructions (such as indirect function call, function return,
12788 indirect jump) are valid. This prevents diverting the flow of control
12789 to an unexpected target. This is intended to protect against such
12790 threats as Return-oriented Programming (ROP), and similarly
12791 call/jmp-oriented programming (COP/JOP).
12792
12793 The value @code{branch} tells the compiler to implement checking of
12794 validity of control-flow transfer at the point of indirect branch
12795 instructions, i.e.@: call/jmp instructions. The value @code{return}
12796 implements checking of validity at the point of returning from a
12797 function. The value @code{full} is an alias for specifying both
12798 @code{branch} and @code{return}. The value @code{none} turns off
12799 instrumentation.
12800
12801 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12802 used. The first bit of @code{__CET__} is set to 1 for the value
12803 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12804 the @code{return}.
12805
12806 You can also use the @code{nocf_check} attribute to identify
12807 which functions and calls should be skipped from instrumentation
12808 (@pxref{Function Attributes}).
12809
12810 Currently the x86 GNU/Linux target provides an implementation based
12811 on Intel Control-flow Enforcement Technology (CET).
12812
12813 @item -fstack-protector
12814 @opindex fstack-protector
12815 Emit extra code to check for buffer overflows, such as stack smashing
12816 attacks. This is done by adding a guard variable to functions with
12817 vulnerable objects. This includes functions that call @code{alloca}, and
12818 functions with buffers larger than 8 bytes. The guards are initialized
12819 when a function is entered and then checked when the function exits.
12820 If a guard check fails, an error message is printed and the program exits.
12821
12822 @item -fstack-protector-all
12823 @opindex fstack-protector-all
12824 Like @option{-fstack-protector} except that all functions are protected.
12825
12826 @item -fstack-protector-strong
12827 @opindex fstack-protector-strong
12828 Like @option{-fstack-protector} but includes additional functions to
12829 be protected --- those that have local array definitions, or have
12830 references to local frame addresses.
12831
12832 @item -fstack-protector-explicit
12833 @opindex fstack-protector-explicit
12834 Like @option{-fstack-protector} but only protects those functions which
12835 have the @code{stack_protect} attribute.
12836
12837 @item -fstack-check
12838 @opindex fstack-check
12839 Generate code to verify that you do not go beyond the boundary of the
12840 stack. You should specify this flag if you are running in an
12841 environment with multiple threads, but you only rarely need to specify it in
12842 a single-threaded environment since stack overflow is automatically
12843 detected on nearly all systems if there is only one stack.
12844
12845 Note that this switch does not actually cause checking to be done; the
12846 operating system or the language runtime must do that. The switch causes
12847 generation of code to ensure that they see the stack being extended.
12848
12849 You can additionally specify a string parameter: @samp{no} means no
12850 checking, @samp{generic} means force the use of old-style checking,
12851 @samp{specific} means use the best checking method and is equivalent
12852 to bare @option{-fstack-check}.
12853
12854 Old-style checking is a generic mechanism that requires no specific
12855 target support in the compiler but comes with the following drawbacks:
12856
12857 @enumerate
12858 @item
12859 Modified allocation strategy for large objects: they are always
12860 allocated dynamically if their size exceeds a fixed threshold. Note this
12861 may change the semantics of some code.
12862
12863 @item
12864 Fixed limit on the size of the static frame of functions: when it is
12865 topped by a particular function, stack checking is not reliable and
12866 a warning is issued by the compiler.
12867
12868 @item
12869 Inefficiency: because of both the modified allocation strategy and the
12870 generic implementation, code performance is hampered.
12871 @end enumerate
12872
12873 Note that old-style stack checking is also the fallback method for
12874 @samp{specific} if no target support has been added in the compiler.
12875
12876 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12877 and stack overflows. @samp{specific} is an excellent choice when compiling
12878 Ada code. It is not generally sufficient to protect against stack-clash
12879 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12880
12881 @item -fstack-clash-protection
12882 @opindex fstack-clash-protection
12883 Generate code to prevent stack clash style attacks. When this option is
12884 enabled, the compiler will only allocate one page of stack space at a time
12885 and each page is accessed immediately after allocation. Thus, it prevents
12886 allocations from jumping over any stack guard page provided by the
12887 operating system.
12888
12889 Most targets do not fully support stack clash protection. However, on
12890 those targets @option{-fstack-clash-protection} will protect dynamic stack
12891 allocations. @option{-fstack-clash-protection} may also provide limited
12892 protection for static stack allocations if the target supports
12893 @option{-fstack-check=specific}.
12894
12895 @item -fstack-limit-register=@var{reg}
12896 @itemx -fstack-limit-symbol=@var{sym}
12897 @itemx -fno-stack-limit
12898 @opindex fstack-limit-register
12899 @opindex fstack-limit-symbol
12900 @opindex fno-stack-limit
12901 Generate code to ensure that the stack does not grow beyond a certain value,
12902 either the value of a register or the address of a symbol. If a larger
12903 stack is required, a signal is raised at run time. For most targets,
12904 the signal is raised before the stack overruns the boundary, so
12905 it is possible to catch the signal without taking special precautions.
12906
12907 For instance, if the stack starts at absolute address @samp{0x80000000}
12908 and grows downwards, you can use the flags
12909 @option{-fstack-limit-symbol=__stack_limit} and
12910 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12911 of 128KB@. Note that this may only work with the GNU linker.
12912
12913 You can locally override stack limit checking by using the
12914 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12915
12916 @item -fsplit-stack
12917 @opindex fsplit-stack
12918 Generate code to automatically split the stack before it overflows.
12919 The resulting program has a discontiguous stack which can only
12920 overflow if the program is unable to allocate any more memory. This
12921 is most useful when running threaded programs, as it is no longer
12922 necessary to calculate a good stack size to use for each thread. This
12923 is currently only implemented for the x86 targets running
12924 GNU/Linux.
12925
12926 When code compiled with @option{-fsplit-stack} calls code compiled
12927 without @option{-fsplit-stack}, there may not be much stack space
12928 available for the latter code to run. If compiling all code,
12929 including library code, with @option{-fsplit-stack} is not an option,
12930 then the linker can fix up these calls so that the code compiled
12931 without @option{-fsplit-stack} always has a large stack. Support for
12932 this is implemented in the gold linker in GNU binutils release 2.21
12933 and later.
12934
12935 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12936 @opindex fvtable-verify
12937 This option is only available when compiling C++ code.
12938 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12939 feature that verifies at run time, for every virtual call, that
12940 the vtable pointer through which the call is made is valid for the type of
12941 the object, and has not been corrupted or overwritten. If an invalid vtable
12942 pointer is detected at run time, an error is reported and execution of the
12943 program is immediately halted.
12944
12945 This option causes run-time data structures to be built at program startup,
12946 which are used for verifying the vtable pointers.
12947 The options @samp{std} and @samp{preinit}
12948 control the timing of when these data structures are built. In both cases the
12949 data structures are built before execution reaches @code{main}. Using
12950 @option{-fvtable-verify=std} causes the data structures to be built after
12951 shared libraries have been loaded and initialized.
12952 @option{-fvtable-verify=preinit} causes them to be built before shared
12953 libraries have been loaded and initialized.
12954
12955 If this option appears multiple times in the command line with different
12956 values specified, @samp{none} takes highest priority over both @samp{std} and
12957 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12958
12959 @item -fvtv-debug
12960 @opindex fvtv-debug
12961 When used in conjunction with @option{-fvtable-verify=std} or
12962 @option{-fvtable-verify=preinit}, causes debug versions of the
12963 runtime functions for the vtable verification feature to be called.
12964 This flag also causes the compiler to log information about which
12965 vtable pointers it finds for each class.
12966 This information is written to a file named @file{vtv_set_ptr_data.log}
12967 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12968 if that is defined or the current working directory otherwise.
12969
12970 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12971 file, be sure to delete any existing one.
12972
12973 @item -fvtv-counts
12974 @opindex fvtv-counts
12975 This is a debugging flag. When used in conjunction with
12976 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12977 causes the compiler to keep track of the total number of virtual calls
12978 it encounters and the number of verifications it inserts. It also
12979 counts the number of calls to certain run-time library functions
12980 that it inserts and logs this information for each compilation unit.
12981 The compiler writes this information to a file named
12982 @file{vtv_count_data.log} in the directory named by the environment
12983 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12984 directory otherwise. It also counts the size of the vtable pointer sets
12985 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12986 in the same directory.
12987
12988 Note: This feature @emph{appends} data to the log files. To get fresh log
12989 files, be sure to delete any existing ones.
12990
12991 @item -finstrument-functions
12992 @opindex finstrument-functions
12993 Generate instrumentation calls for entry and exit to functions. Just
12994 after function entry and just before function exit, the following
12995 profiling functions are called with the address of the current
12996 function and its call site. (On some platforms,
12997 @code{__builtin_return_address} does not work beyond the current
12998 function, so the call site information may not be available to the
12999 profiling functions otherwise.)
13000
13001 @smallexample
13002 void __cyg_profile_func_enter (void *this_fn,
13003 void *call_site);
13004 void __cyg_profile_func_exit (void *this_fn,
13005 void *call_site);
13006 @end smallexample
13007
13008 The first argument is the address of the start of the current function,
13009 which may be looked up exactly in the symbol table.
13010
13011 This instrumentation is also done for functions expanded inline in other
13012 functions. The profiling calls indicate where, conceptually, the
13013 inline function is entered and exited. This means that addressable
13014 versions of such functions must be available. If all your uses of a
13015 function are expanded inline, this may mean an additional expansion of
13016 code size. If you use @code{extern inline} in your C code, an
13017 addressable version of such functions must be provided. (This is
13018 normally the case anyway, but if you get lucky and the optimizer always
13019 expands the functions inline, you might have gotten away without
13020 providing static copies.)
13021
13022 A function may be given the attribute @code{no_instrument_function}, in
13023 which case this instrumentation is not done. This can be used, for
13024 example, for the profiling functions listed above, high-priority
13025 interrupt routines, and any functions from which the profiling functions
13026 cannot safely be called (perhaps signal handlers, if the profiling
13027 routines generate output or allocate memory).
13028 @xref{Common Function Attributes}.
13029
13030 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13031 @opindex finstrument-functions-exclude-file-list
13032
13033 Set the list of functions that are excluded from instrumentation (see
13034 the description of @option{-finstrument-functions}). If the file that
13035 contains a function definition matches with one of @var{file}, then
13036 that function is not instrumented. The match is done on substrings:
13037 if the @var{file} parameter is a substring of the file name, it is
13038 considered to be a match.
13039
13040 For example:
13041
13042 @smallexample
13043 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13044 @end smallexample
13045
13046 @noindent
13047 excludes any inline function defined in files whose pathnames
13048 contain @file{/bits/stl} or @file{include/sys}.
13049
13050 If, for some reason, you want to include letter @samp{,} in one of
13051 @var{sym}, write @samp{\,}. For example,
13052 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13053 (note the single quote surrounding the option).
13054
13055 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13056 @opindex finstrument-functions-exclude-function-list
13057
13058 This is similar to @option{-finstrument-functions-exclude-file-list},
13059 but this option sets the list of function names to be excluded from
13060 instrumentation. The function name to be matched is its user-visible
13061 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13062 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
13063 match is done on substrings: if the @var{sym} parameter is a substring
13064 of the function name, it is considered to be a match. For C99 and C++
13065 extended identifiers, the function name must be given in UTF-8, not
13066 using universal character names.
13067
13068 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13069 @opindex fpatchable-function-entry
13070 Generate @var{N} NOPs right at the beginning
13071 of each function, with the function entry point before the @var{M}th NOP.
13072 If @var{M} is omitted, it defaults to @code{0} so the
13073 function entry points to the address just at the first NOP.
13074 The NOP instructions reserve extra space which can be used to patch in
13075 any desired instrumentation at run time, provided that the code segment
13076 is writable. The amount of space is controllable indirectly via
13077 the number of NOPs; the NOP instruction used corresponds to the instruction
13078 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13079 is target-specific and may also depend on the architecture variant and/or
13080 other compilation options.
13081
13082 For run-time identification, the starting addresses of these areas,
13083 which correspond to their respective function entries minus @var{M},
13084 are additionally collected in the @code{__patchable_function_entries}
13085 section of the resulting binary.
13086
13087 Note that the value of @code{__attribute__ ((patchable_function_entry
13088 (N,M)))} takes precedence over command-line option
13089 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13090 the area size or to remove it completely on a single function.
13091 If @code{N=0}, no pad location is recorded.
13092
13093 The NOP instructions are inserted at---and maybe before, depending on
13094 @var{M}---the function entry address, even before the prologue.
13095
13096 @end table
13097
13098
13099 @node Preprocessor Options
13100 @section Options Controlling the Preprocessor
13101 @cindex preprocessor options
13102 @cindex options, preprocessor
13103
13104 These options control the C preprocessor, which is run on each C source
13105 file before actual compilation.
13106
13107 If you use the @option{-E} option, nothing is done except preprocessing.
13108 Some of these options make sense only together with @option{-E} because
13109 they cause the preprocessor output to be unsuitable for actual
13110 compilation.
13111
13112 In addition to the options listed here, there are a number of options
13113 to control search paths for include files documented in
13114 @ref{Directory Options}.
13115 Options to control preprocessor diagnostics are listed in
13116 @ref{Warning Options}.
13117
13118 @table @gcctabopt
13119 @include cppopts.texi
13120
13121 @item -Wp,@var{option}
13122 @opindex Wp
13123 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13124 and pass @var{option} directly through to the preprocessor. If
13125 @var{option} contains commas, it is split into multiple options at the
13126 commas. However, many options are modified, translated or interpreted
13127 by the compiler driver before being passed to the preprocessor, and
13128 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13129 interface is undocumented and subject to change, so whenever possible
13130 you should avoid using @option{-Wp} and let the driver handle the
13131 options instead.
13132
13133 @item -Xpreprocessor @var{option}
13134 @opindex Xpreprocessor
13135 Pass @var{option} as an option to the preprocessor. You can use this to
13136 supply system-specific preprocessor options that GCC does not
13137 recognize.
13138
13139 If you want to pass an option that takes an argument, you must use
13140 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13141
13142 @item -no-integrated-cpp
13143 @opindex no-integrated-cpp
13144 Perform preprocessing as a separate pass before compilation.
13145 By default, GCC performs preprocessing as an integrated part of
13146 input tokenization and parsing.
13147 If this option is provided, the appropriate language front end
13148 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13149 and Objective-C, respectively) is instead invoked twice,
13150 once for preprocessing only and once for actual compilation
13151 of the preprocessed input.
13152 This option may be useful in conjunction with the @option{-B} or
13153 @option{-wrapper} options to specify an alternate preprocessor or
13154 perform additional processing of the program source between
13155 normal preprocessing and compilation.
13156
13157 @end table
13158
13159 @node Assembler Options
13160 @section Passing Options to the Assembler
13161
13162 @c prevent bad page break with this line
13163 You can pass options to the assembler.
13164
13165 @table @gcctabopt
13166 @item -Wa,@var{option}
13167 @opindex Wa
13168 Pass @var{option} as an option to the assembler. If @var{option}
13169 contains commas, it is split into multiple options at the commas.
13170
13171 @item -Xassembler @var{option}
13172 @opindex Xassembler
13173 Pass @var{option} as an option to the assembler. You can use this to
13174 supply system-specific assembler options that GCC does not
13175 recognize.
13176
13177 If you want to pass an option that takes an argument, you must use
13178 @option{-Xassembler} twice, once for the option and once for the argument.
13179
13180 @end table
13181
13182 @node Link Options
13183 @section Options for Linking
13184 @cindex link options
13185 @cindex options, linking
13186
13187 These options come into play when the compiler links object files into
13188 an executable output file. They are meaningless if the compiler is
13189 not doing a link step.
13190
13191 @table @gcctabopt
13192 @cindex file names
13193 @item @var{object-file-name}
13194 A file name that does not end in a special recognized suffix is
13195 considered to name an object file or library. (Object files are
13196 distinguished from libraries by the linker according to the file
13197 contents.) If linking is done, these object files are used as input
13198 to the linker.
13199
13200 @item -c
13201 @itemx -S
13202 @itemx -E
13203 @opindex c
13204 @opindex S
13205 @opindex E
13206 If any of these options is used, then the linker is not run, and
13207 object file names should not be used as arguments. @xref{Overall
13208 Options}.
13209
13210 @item -flinker-output=@var{type}
13211 @opindex flinker-output
13212 This option controls code generation of the link-time optimizer. By
13213 default the linker output is automatically determined by the linker
13214 plugin. For debugging the compiler and if incremental linking with a
13215 non-LTO object file is desired, it may be useful to control the type
13216 manually.
13217
13218 If @var{type} is @samp{exec}, code generation produces a static
13219 binary. In this case @option{-fpic} and @option{-fpie} are both
13220 disabled.
13221
13222 If @var{type} is @samp{dyn}, code generation produces a shared
13223 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13224 but not enabled automatically. This allows to build shared libraries
13225 without position-independent code on architectures where this is
13226 possible, i.e.@: on x86.
13227
13228 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
13229 executable. This results in similar optimizations as @samp{exec}
13230 except that @option{-fpie} is not disabled if specified at compilation
13231 time.
13232
13233 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
13234 done. The sections containing intermediate code for link-time optimization are
13235 merged, pre-optimized, and output to the resulting object file. In addition, if
13236 @option{-ffat-lto-objects} is specified, binary code is produced for future
13237 non-LTO linking. The object file produced by incremental linking is smaller
13238 than a static library produced from the same object files. At link time the
13239 result of incremental linking also loads faster than a static
13240 library assuming that the majority of objects in the library are used.
13241
13242 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13243 code generation is forced, a final binary is produced, and the intermediate
13244 code for later link-time optimization is stripped. When multiple object files
13245 are linked together the resulting code is better optimized than with
13246 link-time optimizations disabled (for example, cross-module inlining
13247 happens), but most of benefits of whole program optimizations are lost.
13248
13249 During the incremental link (by @option{-r}) the linker plugin defaults to
13250 @option{rel}. With current interfaces to GNU Binutils it is however not
13251 possible to incrementally link LTO objects and non-LTO objects into a single
13252 mixed object file. If any of object files in incremental link cannot
13253 be used for link-time optimization, the linker plugin issues a warning and
13254 uses @samp{nolto-rel}. To maintain whole program optimization, it is
13255 recommended to link such objects into static library instead. Alternatively it
13256 is possible to use H.J. Lu's binutils with support for mixed objects.
13257
13258 @item -fuse-ld=bfd
13259 @opindex fuse-ld=bfd
13260 Use the @command{bfd} linker instead of the default linker.
13261
13262 @item -fuse-ld=gold
13263 @opindex fuse-ld=gold
13264 Use the @command{gold} linker instead of the default linker.
13265
13266 @item -fuse-ld=lld
13267 @opindex fuse-ld=lld
13268 Use the LLVM @command{lld} linker instead of the default linker.
13269
13270 @cindex Libraries
13271 @item -l@var{library}
13272 @itemx -l @var{library}
13273 @opindex l
13274 Search the library named @var{library} when linking. (The second
13275 alternative with the library as a separate argument is only for
13276 POSIX compliance and is not recommended.)
13277
13278 The @option{-l} option is passed directly to the linker by GCC. Refer
13279 to your linker documentation for exact details. The general
13280 description below applies to the GNU linker.
13281
13282 The linker searches a standard list of directories for the library.
13283 The directories searched include several standard system directories
13284 plus any that you specify with @option{-L}.
13285
13286 Static libraries are archives of object files, and have file names
13287 like @file{lib@var{library}.a}. Some targets also support shared
13288 libraries, which typically have names like @file{lib@var{library}.so}.
13289 If both static and shared libraries are found, the linker gives
13290 preference to linking with the shared library unless the
13291 @option{-static} option is used.
13292
13293 It makes a difference where in the command you write this option; the
13294 linker searches and processes libraries and object files in the order they
13295 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13296 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13297 to functions in @samp{z}, those functions may not be loaded.
13298
13299 @item -lobjc
13300 @opindex lobjc
13301 You need this special case of the @option{-l} option in order to
13302 link an Objective-C or Objective-C++ program.
13303
13304 @item -nostartfiles
13305 @opindex nostartfiles
13306 Do not use the standard system startup files when linking.
13307 The standard system libraries are used normally, unless @option{-nostdlib},
13308 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13309
13310 @item -nodefaultlibs
13311 @opindex nodefaultlibs
13312 Do not use the standard system libraries when linking.
13313 Only the libraries you specify are passed to the linker, and options
13314 specifying linkage of the system libraries, such as @option{-static-libgcc}
13315 or @option{-shared-libgcc}, are ignored.
13316 The standard startup files are used normally, unless @option{-nostartfiles}
13317 is used.
13318
13319 The compiler may generate calls to @code{memcmp},
13320 @code{memset}, @code{memcpy} and @code{memmove}.
13321 These entries are usually resolved by entries in
13322 libc. These entry points should be supplied through some other
13323 mechanism when this option is specified.
13324
13325 @item -nolibc
13326 @opindex nolibc
13327 Do not use the C library or system libraries tightly coupled with it when
13328 linking. Still link with the startup files, @file{libgcc} or toolchain
13329 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13330 or @file{libstdc++} unless options preventing their inclusion are used as
13331 well. This typically removes @option{-lc} from the link command line, as well
13332 as system libraries that normally go with it and become meaningless when
13333 absence of a C library is assumed, for example @option{-lpthread} or
13334 @option{-lm} in some configurations. This is intended for bare-board
13335 targets when there is indeed no C library available.
13336
13337 @item -nostdlib
13338 @opindex nostdlib
13339 Do not use the standard system startup files or libraries when linking.
13340 No startup files and only the libraries you specify are passed to
13341 the linker, and options specifying linkage of the system libraries, such as
13342 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13343
13344 The compiler may generate calls to @code{memcmp}, @code{memset},
13345 @code{memcpy} and @code{memmove}.
13346 These entries are usually resolved by entries in
13347 libc. These entry points should be supplied through some other
13348 mechanism when this option is specified.
13349
13350 @cindex @option{-lgcc}, use with @option{-nostdlib}
13351 @cindex @option{-nostdlib} and unresolved references
13352 @cindex unresolved references and @option{-nostdlib}
13353 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13354 @cindex @option{-nodefaultlibs} and unresolved references
13355 @cindex unresolved references and @option{-nodefaultlibs}
13356 One of the standard libraries bypassed by @option{-nostdlib} and
13357 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13358 which GCC uses to overcome shortcomings of particular machines, or special
13359 needs for some languages.
13360 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13361 Collection (GCC) Internals},
13362 for more discussion of @file{libgcc.a}.)
13363 In most cases, you need @file{libgcc.a} even when you want to avoid
13364 other standard libraries. In other words, when you specify @option{-nostdlib}
13365 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13366 This ensures that you have no unresolved references to internal GCC
13367 library subroutines.
13368 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13369 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13370 GNU Compiler Collection (GCC) Internals}.)
13371
13372 @item -e @var{entry}
13373 @itemx --entry=@var{entry}
13374 @opindex e
13375 @opindex entry
13376
13377 Specify that the program entry point is @var{entry}. The argument is
13378 interpreted by the linker; the GNU linker accepts either a symbol name
13379 or an address.
13380
13381 @item -pie
13382 @opindex pie
13383 Produce a dynamically linked position independent executable on targets
13384 that support it. For predictable results, you must also specify the same
13385 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13386 or model suboptions) when you specify this linker option.
13387
13388 @item -no-pie
13389 @opindex no-pie
13390 Don't produce a dynamically linked position independent executable.
13391
13392 @item -static-pie
13393 @opindex static-pie
13394 Produce a static position independent executable on targets that support
13395 it. A static position independent executable is similar to a static
13396 executable, but can be loaded at any address without a dynamic linker.
13397 For predictable results, you must also specify the same set of options
13398 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13399 suboptions) when you specify this linker option.
13400
13401 @item -pthread
13402 @opindex pthread
13403 Link with the POSIX threads library. This option is supported on
13404 GNU/Linux targets, most other Unix derivatives, and also on
13405 x86 Cygwin and MinGW targets. On some targets this option also sets
13406 flags for the preprocessor, so it should be used consistently for both
13407 compilation and linking.
13408
13409 @item -r
13410 @opindex r
13411 Produce a relocatable object as output. This is also known as partial
13412 linking.
13413
13414 @item -rdynamic
13415 @opindex rdynamic
13416 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13417 that support it. This instructs the linker to add all symbols, not
13418 only used ones, to the dynamic symbol table. This option is needed
13419 for some uses of @code{dlopen} or to allow obtaining backtraces
13420 from within a program.
13421
13422 @item -s
13423 @opindex s
13424 Remove all symbol table and relocation information from the executable.
13425
13426 @item -static
13427 @opindex static
13428 On systems that support dynamic linking, this overrides @option{-pie}
13429 and prevents linking with the shared libraries. On other systems, this
13430 option has no effect.
13431
13432 @item -shared
13433 @opindex shared
13434 Produce a shared object which can then be linked with other objects to
13435 form an executable. Not all systems support this option. For predictable
13436 results, you must also specify the same set of options used for compilation
13437 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13438 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13439 needs to build supplementary stub code for constructors to work. On
13440 multi-libbed systems, @samp{gcc -shared} must select the correct support
13441 libraries to link against. Failing to supply the correct flags may lead
13442 to subtle defects. Supplying them in cases where they are not necessary
13443 is innocuous.}
13444
13445 @item -shared-libgcc
13446 @itemx -static-libgcc
13447 @opindex shared-libgcc
13448 @opindex static-libgcc
13449 On systems that provide @file{libgcc} as a shared library, these options
13450 force the use of either the shared or static version, respectively.
13451 If no shared version of @file{libgcc} was built when the compiler was
13452 configured, these options have no effect.
13453
13454 There are several situations in which an application should use the
13455 shared @file{libgcc} instead of the static version. The most common
13456 of these is when the application wishes to throw and catch exceptions
13457 across different shared libraries. In that case, each of the libraries
13458 as well as the application itself should use the shared @file{libgcc}.
13459
13460 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13461 whenever you build a shared library or a main executable, because C++
13462 programs typically use exceptions, so this is the right thing to do.
13463
13464 If, instead, you use the GCC driver to create shared libraries, you may
13465 find that they are not always linked with the shared @file{libgcc}.
13466 If GCC finds, at its configuration time, that you have a non-GNU linker
13467 or a GNU linker that does not support option @option{--eh-frame-hdr},
13468 it links the shared version of @file{libgcc} into shared libraries
13469 by default. Otherwise, it takes advantage of the linker and optimizes
13470 away the linking with the shared version of @file{libgcc}, linking with
13471 the static version of libgcc by default. This allows exceptions to
13472 propagate through such shared libraries, without incurring relocation
13473 costs at library load time.
13474
13475 However, if a library or main executable is supposed to throw or catch
13476 exceptions, you must link it using the G++ driver, or using the option
13477 @option{-shared-libgcc}, such that it is linked with the shared
13478 @file{libgcc}.
13479
13480 @item -static-libasan
13481 @opindex static-libasan
13482 When the @option{-fsanitize=address} option is used to link a program,
13483 the GCC driver automatically links against @option{libasan}. If
13484 @file{libasan} is available as a shared library, and the @option{-static}
13485 option is not used, then this links against the shared version of
13486 @file{libasan}. The @option{-static-libasan} option directs the GCC
13487 driver to link @file{libasan} statically, without necessarily linking
13488 other libraries statically.
13489
13490 @item -static-libtsan
13491 @opindex static-libtsan
13492 When the @option{-fsanitize=thread} option is used to link a program,
13493 the GCC driver automatically links against @option{libtsan}. If
13494 @file{libtsan} is available as a shared library, and the @option{-static}
13495 option is not used, then this links against the shared version of
13496 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13497 driver to link @file{libtsan} statically, without necessarily linking
13498 other libraries statically.
13499
13500 @item -static-liblsan
13501 @opindex static-liblsan
13502 When the @option{-fsanitize=leak} option is used to link a program,
13503 the GCC driver automatically links against @option{liblsan}. If
13504 @file{liblsan} is available as a shared library, and the @option{-static}
13505 option is not used, then this links against the shared version of
13506 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13507 driver to link @file{liblsan} statically, without necessarily linking
13508 other libraries statically.
13509
13510 @item -static-libubsan
13511 @opindex static-libubsan
13512 When the @option{-fsanitize=undefined} option is used to link a program,
13513 the GCC driver automatically links against @option{libubsan}. If
13514 @file{libubsan} is available as a shared library, and the @option{-static}
13515 option is not used, then this links against the shared version of
13516 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13517 driver to link @file{libubsan} statically, without necessarily linking
13518 other libraries statically.
13519
13520 @item -static-libstdc++
13521 @opindex static-libstdc++
13522 When the @command{g++} program is used to link a C++ program, it
13523 normally automatically links against @option{libstdc++}. If
13524 @file{libstdc++} is available as a shared library, and the
13525 @option{-static} option is not used, then this links against the
13526 shared version of @file{libstdc++}. That is normally fine. However, it
13527 is sometimes useful to freeze the version of @file{libstdc++} used by
13528 the program without going all the way to a fully static link. The
13529 @option{-static-libstdc++} option directs the @command{g++} driver to
13530 link @file{libstdc++} statically, without necessarily linking other
13531 libraries statically.
13532
13533 @item -symbolic
13534 @opindex symbolic
13535 Bind references to global symbols when building a shared object. Warn
13536 about any unresolved references (unless overridden by the link editor
13537 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13538 this option.
13539
13540 @item -T @var{script}
13541 @opindex T
13542 @cindex linker script
13543 Use @var{script} as the linker script. This option is supported by most
13544 systems using the GNU linker. On some targets, such as bare-board
13545 targets without an operating system, the @option{-T} option may be required
13546 when linking to avoid references to undefined symbols.
13547
13548 @item -Xlinker @var{option}
13549 @opindex Xlinker
13550 Pass @var{option} as an option to the linker. You can use this to
13551 supply system-specific linker options that GCC does not recognize.
13552
13553 If you want to pass an option that takes a separate argument, you must use
13554 @option{-Xlinker} twice, once for the option and once for the argument.
13555 For example, to pass @option{-assert definitions}, you must write
13556 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13557 @option{-Xlinker "-assert definitions"}, because this passes the entire
13558 string as a single argument, which is not what the linker expects.
13559
13560 When using the GNU linker, it is usually more convenient to pass
13561 arguments to linker options using the @option{@var{option}=@var{value}}
13562 syntax than as separate arguments. For example, you can specify
13563 @option{-Xlinker -Map=output.map} rather than
13564 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13565 this syntax for command-line options.
13566
13567 @item -Wl,@var{option}
13568 @opindex Wl
13569 Pass @var{option} as an option to the linker. If @var{option} contains
13570 commas, it is split into multiple options at the commas. You can use this
13571 syntax to pass an argument to the option.
13572 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13573 linker. When using the GNU linker, you can also get the same effect with
13574 @option{-Wl,-Map=output.map}.
13575
13576 @item -u @var{symbol}
13577 @opindex u
13578 Pretend the symbol @var{symbol} is undefined, to force linking of
13579 library modules to define it. You can use @option{-u} multiple times with
13580 different symbols to force loading of additional library modules.
13581
13582 @item -z @var{keyword}
13583 @opindex z
13584 @option{-z} is passed directly on to the linker along with the keyword
13585 @var{keyword}. See the section in the documentation of your linker for
13586 permitted values and their meanings.
13587 @end table
13588
13589 @node Directory Options
13590 @section Options for Directory Search
13591 @cindex directory options
13592 @cindex options, directory search
13593 @cindex search path
13594
13595 These options specify directories to search for header files, for
13596 libraries and for parts of the compiler:
13597
13598 @table @gcctabopt
13599 @include cppdiropts.texi
13600
13601 @item -iplugindir=@var{dir}
13602 @opindex iplugindir=
13603 Set the directory to search for plugins that are passed
13604 by @option{-fplugin=@var{name}} instead of
13605 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13606 to be used by the user, but only passed by the driver.
13607
13608 @item -L@var{dir}
13609 @opindex L
13610 Add directory @var{dir} to the list of directories to be searched
13611 for @option{-l}.
13612
13613 @item -B@var{prefix}
13614 @opindex B
13615 This option specifies where to find the executables, libraries,
13616 include files, and data files of the compiler itself.
13617
13618 The compiler driver program runs one or more of the subprograms
13619 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13620 @var{prefix} as a prefix for each program it tries to run, both with and
13621 without @samp{@var{machine}/@var{version}/} for the corresponding target
13622 machine and compiler version.
13623
13624 For each subprogram to be run, the compiler driver first tries the
13625 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13626 is not specified, the driver tries two standard prefixes,
13627 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13628 those results in a file name that is found, the unmodified program
13629 name is searched for using the directories specified in your
13630 @env{PATH} environment variable.
13631
13632 The compiler checks to see if the path provided by @option{-B}
13633 refers to a directory, and if necessary it adds a directory
13634 separator character at the end of the path.
13635
13636 @option{-B} prefixes that effectively specify directory names also apply
13637 to libraries in the linker, because the compiler translates these
13638 options into @option{-L} options for the linker. They also apply to
13639 include files in the preprocessor, because the compiler translates these
13640 options into @option{-isystem} options for the preprocessor. In this case,
13641 the compiler appends @samp{include} to the prefix.
13642
13643 The runtime support file @file{libgcc.a} can also be searched for using
13644 the @option{-B} prefix, if needed. If it is not found there, the two
13645 standard prefixes above are tried, and that is all. The file is left
13646 out of the link if it is not found by those means.
13647
13648 Another way to specify a prefix much like the @option{-B} prefix is to use
13649 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13650 Variables}.
13651
13652 As a special kludge, if the path provided by @option{-B} is
13653 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13654 9, then it is replaced by @file{[dir/]include}. This is to help
13655 with boot-strapping the compiler.
13656
13657 @item -no-canonical-prefixes
13658 @opindex no-canonical-prefixes
13659 Do not expand any symbolic links, resolve references to @samp{/../}
13660 or @samp{/./}, or make the path absolute when generating a relative
13661 prefix.
13662
13663 @item --sysroot=@var{dir}
13664 @opindex sysroot
13665 Use @var{dir} as the logical root directory for headers and libraries.
13666 For example, if the compiler normally searches for headers in
13667 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13668 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13669
13670 If you use both this option and the @option{-isysroot} option, then
13671 the @option{--sysroot} option applies to libraries, but the
13672 @option{-isysroot} option applies to header files.
13673
13674 The GNU linker (beginning with version 2.16) has the necessary support
13675 for this option. If your linker does not support this option, the
13676 header file aspect of @option{--sysroot} still works, but the
13677 library aspect does not.
13678
13679 @item --no-sysroot-suffix
13680 @opindex no-sysroot-suffix
13681 For some targets, a suffix is added to the root directory specified
13682 with @option{--sysroot}, depending on the other options used, so that
13683 headers may for example be found in
13684 @file{@var{dir}/@var{suffix}/usr/include} instead of
13685 @file{@var{dir}/usr/include}. This option disables the addition of
13686 such a suffix.
13687
13688 @end table
13689
13690 @node Code Gen Options
13691 @section Options for Code Generation Conventions
13692 @cindex code generation conventions
13693 @cindex options, code generation
13694 @cindex run-time options
13695
13696 These machine-independent options control the interface conventions
13697 used in code generation.
13698
13699 Most of them have both positive and negative forms; the negative form
13700 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13701 one of the forms is listed---the one that is not the default. You
13702 can figure out the other form by either removing @samp{no-} or adding
13703 it.
13704
13705 @table @gcctabopt
13706 @item -fstack-reuse=@var{reuse-level}
13707 @opindex fstack_reuse
13708 This option controls stack space reuse for user declared local/auto variables
13709 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13710 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13711 local variables and temporaries, @samp{named_vars} enables the reuse only for
13712 user defined local variables with names, and @samp{none} disables stack reuse
13713 completely. The default value is @samp{all}. The option is needed when the
13714 program extends the lifetime of a scoped local variable or a compiler generated
13715 temporary beyond the end point defined by the language. When a lifetime of
13716 a variable ends, and if the variable lives in memory, the optimizing compiler
13717 has the freedom to reuse its stack space with other temporaries or scoped
13718 local variables whose live range does not overlap with it. Legacy code extending
13719 local lifetime is likely to break with the stack reuse optimization.
13720
13721 For example,
13722
13723 @smallexample
13724 int *p;
13725 @{
13726 int local1;
13727
13728 p = &local1;
13729 local1 = 10;
13730 ....
13731 @}
13732 @{
13733 int local2;
13734 local2 = 20;
13735 ...
13736 @}
13737
13738 if (*p == 10) // out of scope use of local1
13739 @{
13740
13741 @}
13742 @end smallexample
13743
13744 Another example:
13745 @smallexample
13746
13747 struct A
13748 @{
13749 A(int k) : i(k), j(k) @{ @}
13750 int i;
13751 int j;
13752 @};
13753
13754 A *ap;
13755
13756 void foo(const A& ar)
13757 @{
13758 ap = &ar;
13759 @}
13760
13761 void bar()
13762 @{
13763 foo(A(10)); // temp object's lifetime ends when foo returns
13764
13765 @{
13766 A a(20);
13767 ....
13768 @}
13769 ap->i+= 10; // ap references out of scope temp whose space
13770 // is reused with a. What is the value of ap->i?
13771 @}
13772
13773 @end smallexample
13774
13775 The lifetime of a compiler generated temporary is well defined by the C++
13776 standard. When a lifetime of a temporary ends, and if the temporary lives
13777 in memory, the optimizing compiler has the freedom to reuse its stack
13778 space with other temporaries or scoped local variables whose live range
13779 does not overlap with it. However some of the legacy code relies on
13780 the behavior of older compilers in which temporaries' stack space is
13781 not reused, the aggressive stack reuse can lead to runtime errors. This
13782 option is used to control the temporary stack reuse optimization.
13783
13784 @item -ftrapv
13785 @opindex ftrapv
13786 This option generates traps for signed overflow on addition, subtraction,
13787 multiplication operations.
13788 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13789 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13790 @option{-fwrapv} being effective. Note that only active options override, so
13791 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13792 results in @option{-ftrapv} being effective.
13793
13794 @item -fwrapv
13795 @opindex fwrapv
13796 This option instructs the compiler to assume that signed arithmetic
13797 overflow of addition, subtraction and multiplication wraps around
13798 using twos-complement representation. This flag enables some optimizations
13799 and disables others.
13800 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13801 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13802 @option{-fwrapv} being effective. Note that only active options override, so
13803 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13804 results in @option{-ftrapv} being effective.
13805
13806 @item -fwrapv-pointer
13807 @opindex fwrapv-pointer
13808 This option instructs the compiler to assume that pointer arithmetic
13809 overflow on addition and subtraction wraps around using twos-complement
13810 representation. This flag disables some optimizations which assume
13811 pointer overflow is invalid.
13812
13813 @item -fstrict-overflow
13814 @opindex fstrict-overflow
13815 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13816 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13817
13818 @item -fexceptions
13819 @opindex fexceptions
13820 Enable exception handling. Generates extra code needed to propagate
13821 exceptions. For some targets, this implies GCC generates frame
13822 unwind information for all functions, which can produce significant data
13823 size overhead, although it does not affect execution. If you do not
13824 specify this option, GCC enables it by default for languages like
13825 C++ that normally require exception handling, and disables it for
13826 languages like C that do not normally require it. However, you may need
13827 to enable this option when compiling C code that needs to interoperate
13828 properly with exception handlers written in C++. You may also wish to
13829 disable this option if you are compiling older C++ programs that don't
13830 use exception handling.
13831
13832 @item -fnon-call-exceptions
13833 @opindex fnon-call-exceptions
13834 Generate code that allows trapping instructions to throw exceptions.
13835 Note that this requires platform-specific runtime support that does
13836 not exist everywhere. Moreover, it only allows @emph{trapping}
13837 instructions to throw exceptions, i.e.@: memory references or floating-point
13838 instructions. It does not allow exceptions to be thrown from
13839 arbitrary signal handlers such as @code{SIGALRM}.
13840
13841 @item -fdelete-dead-exceptions
13842 @opindex fdelete-dead-exceptions
13843 Consider that instructions that may throw exceptions but don't otherwise
13844 contribute to the execution of the program can be optimized away.
13845 This option is enabled by default for the Ada front end, as permitted by
13846 the Ada language specification.
13847 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13848
13849 @item -funwind-tables
13850 @opindex funwind-tables
13851 Similar to @option{-fexceptions}, except that it just generates any needed
13852 static data, but does not affect the generated code in any other way.
13853 You normally do not need to enable this option; instead, a language processor
13854 that needs this handling enables it on your behalf.
13855
13856 @item -fasynchronous-unwind-tables
13857 @opindex fasynchronous-unwind-tables
13858 Generate unwind table in DWARF format, if supported by target machine. The
13859 table is exact at each instruction boundary, so it can be used for stack
13860 unwinding from asynchronous events (such as debugger or garbage collector).
13861
13862 @item -fno-gnu-unique
13863 @opindex fno-gnu-unique
13864 @opindex fgnu-unique
13865 On systems with recent GNU assembler and C library, the C++ compiler
13866 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13867 of template static data members and static local variables in inline
13868 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13869 is necessary to avoid problems with a library used by two different
13870 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13871 therefore disagreeing with the other one about the binding of the
13872 symbol. But this causes @code{dlclose} to be ignored for affected
13873 DSOs; if your program relies on reinitialization of a DSO via
13874 @code{dlclose} and @code{dlopen}, you can use
13875 @option{-fno-gnu-unique}.
13876
13877 @item -fpcc-struct-return
13878 @opindex fpcc-struct-return
13879 Return ``short'' @code{struct} and @code{union} values in memory like
13880 longer ones, rather than in registers. This convention is less
13881 efficient, but it has the advantage of allowing intercallability between
13882 GCC-compiled files and files compiled with other compilers, particularly
13883 the Portable C Compiler (pcc).
13884
13885 The precise convention for returning structures in memory depends
13886 on the target configuration macros.
13887
13888 Short structures and unions are those whose size and alignment match
13889 that of some integer type.
13890
13891 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13892 switch is not binary compatible with code compiled with the
13893 @option{-freg-struct-return} switch.
13894 Use it to conform to a non-default application binary interface.
13895
13896 @item -freg-struct-return
13897 @opindex freg-struct-return
13898 Return @code{struct} and @code{union} values in registers when possible.
13899 This is more efficient for small structures than
13900 @option{-fpcc-struct-return}.
13901
13902 If you specify neither @option{-fpcc-struct-return} nor
13903 @option{-freg-struct-return}, GCC defaults to whichever convention is
13904 standard for the target. If there is no standard convention, GCC
13905 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13906 the principal compiler. In those cases, we can choose the standard, and
13907 we chose the more efficient register return alternative.
13908
13909 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13910 switch is not binary compatible with code compiled with the
13911 @option{-fpcc-struct-return} switch.
13912 Use it to conform to a non-default application binary interface.
13913
13914 @item -fshort-enums
13915 @opindex fshort-enums
13916 Allocate to an @code{enum} type only as many bytes as it needs for the
13917 declared range of possible values. Specifically, the @code{enum} type
13918 is equivalent to the smallest integer type that has enough room.
13919
13920 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13921 code that is not binary compatible with code generated without that switch.
13922 Use it to conform to a non-default application binary interface.
13923
13924 @item -fshort-wchar
13925 @opindex fshort-wchar
13926 Override the underlying type for @code{wchar_t} to be @code{short
13927 unsigned int} instead of the default for the target. This option is
13928 useful for building programs to run under WINE@.
13929
13930 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13931 code that is not binary compatible with code generated without that switch.
13932 Use it to conform to a non-default application binary interface.
13933
13934 @item -fno-common
13935 @opindex fno-common
13936 @opindex fcommon
13937 @cindex tentative definitions
13938 In C code, this option controls the placement of global variables
13939 defined without an initializer, known as @dfn{tentative definitions}
13940 in the C standard. Tentative definitions are distinct from declarations
13941 of a variable with the @code{extern} keyword, which do not allocate storage.
13942
13943 Unix C compilers have traditionally allocated storage for
13944 uninitialized global variables in a common block. This allows the
13945 linker to resolve all tentative definitions of the same variable
13946 in different compilation units to the same object, or to a non-tentative
13947 definition.
13948 This is the behavior specified by @option{-fcommon}, and is the default for
13949 GCC on most targets.
13950 On the other hand, this behavior is not required by ISO
13951 C, and on some targets may carry a speed or code size penalty on
13952 variable references.
13953
13954 The @option{-fno-common} option specifies that the compiler should instead
13955 place uninitialized global variables in the BSS section of the object file.
13956 This inhibits the merging of tentative definitions by the linker so
13957 you get a multiple-definition error if the same
13958 variable is defined in more than one compilation unit.
13959 Compiling with @option{-fno-common} is useful on targets for which
13960 it provides better performance, or if you wish to verify that the
13961 program will work on other systems that always treat uninitialized
13962 variable definitions this way.
13963
13964 @item -fno-ident
13965 @opindex fno-ident
13966 @opindex fident
13967 Ignore the @code{#ident} directive.
13968
13969 @item -finhibit-size-directive
13970 @opindex finhibit-size-directive
13971 Don't output a @code{.size} assembler directive, or anything else that
13972 would cause trouble if the function is split in the middle, and the
13973 two halves are placed at locations far apart in memory. This option is
13974 used when compiling @file{crtstuff.c}; you should not need to use it
13975 for anything else.
13976
13977 @item -fverbose-asm
13978 @opindex fverbose-asm
13979 Put extra commentary information in the generated assembly code to
13980 make it more readable. This option is generally only of use to those
13981 who actually need to read the generated assembly code (perhaps while
13982 debugging the compiler itself).
13983
13984 @option{-fno-verbose-asm}, the default, causes the
13985 extra information to be omitted and is useful when comparing two assembler
13986 files.
13987
13988 The added comments include:
13989
13990 @itemize @bullet
13991
13992 @item
13993 information on the compiler version and command-line options,
13994
13995 @item
13996 the source code lines associated with the assembly instructions,
13997 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13998
13999 @item
14000 hints on which high-level expressions correspond to
14001 the various assembly instruction operands.
14002
14003 @end itemize
14004
14005 For example, given this C source file:
14006
14007 @smallexample
14008 int test (int n)
14009 @{
14010 int i;
14011 int total = 0;
14012
14013 for (i = 0; i < n; i++)
14014 total += i * i;
14015
14016 return total;
14017 @}
14018 @end smallexample
14019
14020 compiling to (x86_64) assembly via @option{-S} and emitting the result
14021 direct to stdout via @option{-o} @option{-}
14022
14023 @smallexample
14024 gcc -S test.c -fverbose-asm -Os -o -
14025 @end smallexample
14026
14027 gives output similar to this:
14028
14029 @smallexample
14030 .file "test.c"
14031 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14032 [...snip...]
14033 # options passed:
14034 [...snip...]
14035
14036 .text
14037 .globl test
14038 .type test, @@function
14039 test:
14040 .LFB0:
14041 .cfi_startproc
14042 # test.c:4: int total = 0;
14043 xorl %eax, %eax # <retval>
14044 # test.c:6: for (i = 0; i < n; i++)
14045 xorl %edx, %edx # i
14046 .L2:
14047 # test.c:6: for (i = 0; i < n; i++)
14048 cmpl %edi, %edx # n, i
14049 jge .L5 #,
14050 # test.c:7: total += i * i;
14051 movl %edx, %ecx # i, tmp92
14052 imull %edx, %ecx # i, tmp92
14053 # test.c:6: for (i = 0; i < n; i++)
14054 incl %edx # i
14055 # test.c:7: total += i * i;
14056 addl %ecx, %eax # tmp92, <retval>
14057 jmp .L2 #
14058 .L5:
14059 # test.c:10: @}
14060 ret
14061 .cfi_endproc
14062 .LFE0:
14063 .size test, .-test
14064 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14065 .section .note.GNU-stack,"",@@progbits
14066 @end smallexample
14067
14068 The comments are intended for humans rather than machines and hence the
14069 precise format of the comments is subject to change.
14070
14071 @item -frecord-gcc-switches
14072 @opindex frecord-gcc-switches
14073 This switch causes the command line used to invoke the
14074 compiler to be recorded into the object file that is being created.
14075 This switch is only implemented on some targets and the exact format
14076 of the recording is target and binary file format dependent, but it
14077 usually takes the form of a section containing ASCII text. This
14078 switch is related to the @option{-fverbose-asm} switch, but that
14079 switch only records information in the assembler output file as
14080 comments, so it never reaches the object file.
14081 See also @option{-grecord-gcc-switches} for another
14082 way of storing compiler options into the object file.
14083
14084 @item -fpic
14085 @opindex fpic
14086 @cindex global offset table
14087 @cindex PIC
14088 Generate position-independent code (PIC) suitable for use in a shared
14089 library, if supported for the target machine. Such code accesses all
14090 constant addresses through a global offset table (GOT)@. The dynamic
14091 loader resolves the GOT entries when the program starts (the dynamic
14092 loader is not part of GCC; it is part of the operating system). If
14093 the GOT size for the linked executable exceeds a machine-specific
14094 maximum size, you get an error message from the linker indicating that
14095 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14096 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14097 on the m68k and RS/6000. The x86 has no such limit.)
14098
14099 Position-independent code requires special support, and therefore works
14100 only on certain machines. For the x86, GCC supports PIC for System V
14101 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14102 position-independent.
14103
14104 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14105 are defined to 1.
14106
14107 @item -fPIC
14108 @opindex fPIC
14109 If supported for the target machine, emit position-independent code,
14110 suitable for dynamic linking and avoiding any limit on the size of the
14111 global offset table. This option makes a difference on AArch64, m68k,
14112 PowerPC and SPARC@.
14113
14114 Position-independent code requires special support, and therefore works
14115 only on certain machines.
14116
14117 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14118 are defined to 2.
14119
14120 @item -fpie
14121 @itemx -fPIE
14122 @opindex fpie
14123 @opindex fPIE
14124 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14125 generated position-independent code can be only linked into executables.
14126 Usually these options are used to compile code that will be linked using
14127 the @option{-pie} GCC option.
14128
14129 @option{-fpie} and @option{-fPIE} both define the macros
14130 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14131 for @option{-fpie} and 2 for @option{-fPIE}.
14132
14133 @item -fno-plt
14134 @opindex fno-plt
14135 @opindex fplt
14136 Do not use the PLT for external function calls in position-independent code.
14137 Instead, load the callee address at call sites from the GOT and branch to it.
14138 This leads to more efficient code by eliminating PLT stubs and exposing
14139 GOT loads to optimizations. On architectures such as 32-bit x86 where
14140 PLT stubs expect the GOT pointer in a specific register, this gives more
14141 register allocation freedom to the compiler.
14142 Lazy binding requires use of the PLT;
14143 with @option{-fno-plt} all external symbols are resolved at load time.
14144
14145 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14146 through the PLT for specific external functions.
14147
14148 In position-dependent code, a few targets also convert calls to
14149 functions that are marked to not use the PLT to use the GOT instead.
14150
14151 @item -fno-jump-tables
14152 @opindex fno-jump-tables
14153 @opindex fjump-tables
14154 Do not use jump tables for switch statements even where it would be
14155 more efficient than other code generation strategies. This option is
14156 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14157 building code that forms part of a dynamic linker and cannot
14158 reference the address of a jump table. On some targets, jump tables
14159 do not require a GOT and this option is not needed.
14160
14161 @item -ffixed-@var{reg}
14162 @opindex ffixed
14163 Treat the register named @var{reg} as a fixed register; generated code
14164 should never refer to it (except perhaps as a stack pointer, frame
14165 pointer or in some other fixed role).
14166
14167 @var{reg} must be the name of a register. The register names accepted
14168 are machine-specific and are defined in the @code{REGISTER_NAMES}
14169 macro in the machine description macro file.
14170
14171 This flag does not have a negative form, because it specifies a
14172 three-way choice.
14173
14174 @item -fcall-used-@var{reg}
14175 @opindex fcall-used
14176 Treat the register named @var{reg} as an allocable register that is
14177 clobbered by function calls. It may be allocated for temporaries or
14178 variables that do not live across a call. Functions compiled this way
14179 do not save and restore the register @var{reg}.
14180
14181 It is an error to use this flag with the frame pointer or stack pointer.
14182 Use of this flag for other registers that have fixed pervasive roles in
14183 the machine's execution model produces disastrous results.
14184
14185 This flag does not have a negative form, because it specifies a
14186 three-way choice.
14187
14188 @item -fcall-saved-@var{reg}
14189 @opindex fcall-saved
14190 Treat the register named @var{reg} as an allocable register saved by
14191 functions. It may be allocated even for temporaries or variables that
14192 live across a call. Functions compiled this way save and restore
14193 the register @var{reg} if they use it.
14194
14195 It is an error to use this flag with the frame pointer or stack pointer.
14196 Use of this flag for other registers that have fixed pervasive roles in
14197 the machine's execution model produces disastrous results.
14198
14199 A different sort of disaster results from the use of this flag for
14200 a register in which function values may be returned.
14201
14202 This flag does not have a negative form, because it specifies a
14203 three-way choice.
14204
14205 @item -fpack-struct[=@var{n}]
14206 @opindex fpack-struct
14207 Without a value specified, pack all structure members together without
14208 holes. When a value is specified (which must be a small power of two), pack
14209 structure members according to this value, representing the maximum
14210 alignment (that is, objects with default alignment requirements larger than
14211 this are output potentially unaligned at the next fitting location.
14212
14213 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14214 code that is not binary compatible with code generated without that switch.
14215 Additionally, it makes the code suboptimal.
14216 Use it to conform to a non-default application binary interface.
14217
14218 @item -fleading-underscore
14219 @opindex fleading-underscore
14220 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14221 change the way C symbols are represented in the object file. One use
14222 is to help link with legacy assembly code.
14223
14224 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14225 generate code that is not binary compatible with code generated without that
14226 switch. Use it to conform to a non-default application binary interface.
14227 Not all targets provide complete support for this switch.
14228
14229 @item -ftls-model=@var{model}
14230 @opindex ftls-model
14231 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14232 The @var{model} argument should be one of @samp{global-dynamic},
14233 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14234 Note that the choice is subject to optimization: the compiler may use
14235 a more efficient model for symbols not visible outside of the translation
14236 unit, or if @option{-fpic} is not given on the command line.
14237
14238 The default without @option{-fpic} is @samp{initial-exec}; with
14239 @option{-fpic} the default is @samp{global-dynamic}.
14240
14241 @item -ftrampolines
14242 @opindex ftrampolines
14243 For targets that normally need trampolines for nested functions, always
14244 generate them instead of using descriptors. Otherwise, for targets that
14245 do not need them, like for example HP-PA or IA-64, do nothing.
14246
14247 A trampoline is a small piece of code that is created at run time on the
14248 stack when the address of a nested function is taken, and is used to call
14249 the nested function indirectly. Therefore, it requires the stack to be
14250 made executable in order for the program to work properly.
14251
14252 @option{-fno-trampolines} is enabled by default on a language by language
14253 basis to let the compiler avoid generating them, if it computes that this
14254 is safe, and replace them with descriptors. Descriptors are made up of data
14255 only, but the generated code must be prepared to deal with them. As of this
14256 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14257
14258 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14259 @option{-fno-trampolines} are not binary compatible if nested functions are
14260 present. This option must therefore be used on a program-wide basis and be
14261 manipulated with extreme care.
14262
14263 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14264 @opindex fvisibility
14265 Set the default ELF image symbol visibility to the specified option---all
14266 symbols are marked with this unless overridden within the code.
14267 Using this feature can very substantially improve linking and
14268 load times of shared object libraries, produce more optimized
14269 code, provide near-perfect API export and prevent symbol clashes.
14270 It is @strong{strongly} recommended that you use this in any shared objects
14271 you distribute.
14272
14273 Despite the nomenclature, @samp{default} always means public; i.e.,
14274 available to be linked against from outside the shared object.
14275 @samp{protected} and @samp{internal} are pretty useless in real-world
14276 usage so the only other commonly used option is @samp{hidden}.
14277 The default if @option{-fvisibility} isn't specified is
14278 @samp{default}, i.e., make every symbol public.
14279
14280 A good explanation of the benefits offered by ensuring ELF
14281 symbols have the correct visibility is given by ``How To Write
14282 Shared Libraries'' by Ulrich Drepper (which can be found at
14283 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14284 solution made possible by this option to marking things hidden when
14285 the default is public is to make the default hidden and mark things
14286 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14287 and @code{__attribute__ ((visibility("default")))} instead of
14288 @code{__declspec(dllexport)} you get almost identical semantics with
14289 identical syntax. This is a great boon to those working with
14290 cross-platform projects.
14291
14292 For those adding visibility support to existing code, you may find
14293 @code{#pragma GCC visibility} of use. This works by you enclosing
14294 the declarations you wish to set visibility for with (for example)
14295 @code{#pragma GCC visibility push(hidden)} and
14296 @code{#pragma GCC visibility pop}.
14297 Bear in mind that symbol visibility should be viewed @strong{as
14298 part of the API interface contract} and thus all new code should
14299 always specify visibility when it is not the default; i.e., declarations
14300 only for use within the local DSO should @strong{always} be marked explicitly
14301 as hidden as so to avoid PLT indirection overheads---making this
14302 abundantly clear also aids readability and self-documentation of the code.
14303 Note that due to ISO C++ specification requirements, @code{operator new} and
14304 @code{operator delete} must always be of default visibility.
14305
14306 Be aware that headers from outside your project, in particular system
14307 headers and headers from any other library you use, may not be
14308 expecting to be compiled with visibility other than the default. You
14309 may need to explicitly say @code{#pragma GCC visibility push(default)}
14310 before including any such headers.
14311
14312 @code{extern} declarations are not affected by @option{-fvisibility}, so
14313 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14314 no modifications. However, this means that calls to @code{extern}
14315 functions with no explicit visibility use the PLT, so it is more
14316 effective to use @code{__attribute ((visibility))} and/or
14317 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14318 declarations should be treated as hidden.
14319
14320 Note that @option{-fvisibility} does affect C++ vague linkage
14321 entities. This means that, for instance, an exception class that is
14322 be thrown between DSOs must be explicitly marked with default
14323 visibility so that the @samp{type_info} nodes are unified between
14324 the DSOs.
14325
14326 An overview of these techniques, their benefits and how to use them
14327 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14328
14329 @item -fstrict-volatile-bitfields
14330 @opindex fstrict-volatile-bitfields
14331 This option should be used if accesses to volatile bit-fields (or other
14332 structure fields, although the compiler usually honors those types
14333 anyway) should use a single access of the width of the
14334 field's type, aligned to a natural alignment if possible. For
14335 example, targets with memory-mapped peripheral registers might require
14336 all such accesses to be 16 bits wide; with this flag you can
14337 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14338 is 16 bits on these targets) to force GCC to use 16-bit accesses
14339 instead of, perhaps, a more efficient 32-bit access.
14340
14341 If this option is disabled, the compiler uses the most efficient
14342 instruction. In the previous example, that might be a 32-bit load
14343 instruction, even though that accesses bytes that do not contain
14344 any portion of the bit-field, or memory-mapped registers unrelated to
14345 the one being updated.
14346
14347 In some cases, such as when the @code{packed} attribute is applied to a
14348 structure field, it may not be possible to access the field with a single
14349 read or write that is correctly aligned for the target machine. In this
14350 case GCC falls back to generating multiple accesses rather than code that
14351 will fault or truncate the result at run time.
14352
14353 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14354 not allowed to touch non bit-field members. It is therefore recommended
14355 to define all bits of the field's type as bit-field members.
14356
14357 The default value of this option is determined by the application binary
14358 interface for the target processor.
14359
14360 @item -fsync-libcalls
14361 @opindex fsync-libcalls
14362 This option controls whether any out-of-line instance of the @code{__sync}
14363 family of functions may be used to implement the C++11 @code{__atomic}
14364 family of functions.
14365
14366 The default value of this option is enabled, thus the only useful form
14367 of the option is @option{-fno-sync-libcalls}. This option is used in
14368 the implementation of the @file{libatomic} runtime library.
14369
14370 @end table
14371
14372 @node Developer Options
14373 @section GCC Developer Options
14374 @cindex developer options
14375 @cindex debugging GCC
14376 @cindex debug dump options
14377 @cindex dump options
14378 @cindex compilation statistics
14379
14380 This section describes command-line options that are primarily of
14381 interest to GCC developers, including options to support compiler
14382 testing and investigation of compiler bugs and compile-time
14383 performance problems. This includes options that produce debug dumps
14384 at various points in the compilation; that print statistics such as
14385 memory use and execution time; and that print information about GCC's
14386 configuration, such as where it searches for libraries. You should
14387 rarely need to use any of these options for ordinary compilation and
14388 linking tasks.
14389
14390 Many developer options that cause GCC to dump output to a file take an
14391 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14392 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14393 error.
14394
14395 If @samp{=@var{filename}} is omitted, a default dump file name is
14396 constructed by concatenating the base dump file name, a pass number,
14397 phase letter, and pass name. The base dump file name is the name of
14398 output file produced by the compiler if explicitly specified and not
14399 an executable; otherwise it is the source file name.
14400 The pass number is determined by the order passes are registered with
14401 the compiler's pass manager.
14402 This is generally the same as the order of execution, but passes
14403 registered by plugins, target-specific passes, or passes that are
14404 otherwise registered late are numbered higher than the pass named
14405 @samp{final}, even if they are executed earlier. The phase letter is
14406 one of @samp{i} (inter-procedural analysis), @samp{l}
14407 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14408 The files are created in the directory of the output file.
14409
14410 @table @gcctabopt
14411
14412 @item -d@var{letters}
14413 @itemx -fdump-rtl-@var{pass}
14414 @itemx -fdump-rtl-@var{pass}=@var{filename}
14415 @opindex d
14416 @opindex fdump-rtl-@var{pass}
14417 Says to make debugging dumps during compilation at times specified by
14418 @var{letters}. This is used for debugging the RTL-based passes of the
14419 compiler.
14420
14421 Some @option{-d@var{letters}} switches have different meaning when
14422 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14423 for information about preprocessor-specific dump options.
14424
14425 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14426 @option{-d} option @var{letters}. Here are the possible
14427 letters for use in @var{pass} and @var{letters}, and their meanings:
14428
14429 @table @gcctabopt
14430
14431 @item -fdump-rtl-alignments
14432 @opindex fdump-rtl-alignments
14433 Dump after branch alignments have been computed.
14434
14435 @item -fdump-rtl-asmcons
14436 @opindex fdump-rtl-asmcons
14437 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14438
14439 @item -fdump-rtl-auto_inc_dec
14440 @opindex fdump-rtl-auto_inc_dec
14441 Dump after auto-inc-dec discovery. This pass is only run on
14442 architectures that have auto inc or auto dec instructions.
14443
14444 @item -fdump-rtl-barriers
14445 @opindex fdump-rtl-barriers
14446 Dump after cleaning up the barrier instructions.
14447
14448 @item -fdump-rtl-bbpart
14449 @opindex fdump-rtl-bbpart
14450 Dump after partitioning hot and cold basic blocks.
14451
14452 @item -fdump-rtl-bbro
14453 @opindex fdump-rtl-bbro
14454 Dump after block reordering.
14455
14456 @item -fdump-rtl-btl1
14457 @itemx -fdump-rtl-btl2
14458 @opindex fdump-rtl-btl2
14459 @opindex fdump-rtl-btl2
14460 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14461 after the two branch
14462 target load optimization passes.
14463
14464 @item -fdump-rtl-bypass
14465 @opindex fdump-rtl-bypass
14466 Dump after jump bypassing and control flow optimizations.
14467
14468 @item -fdump-rtl-combine
14469 @opindex fdump-rtl-combine
14470 Dump after the RTL instruction combination pass.
14471
14472 @item -fdump-rtl-compgotos
14473 @opindex fdump-rtl-compgotos
14474 Dump after duplicating the computed gotos.
14475
14476 @item -fdump-rtl-ce1
14477 @itemx -fdump-rtl-ce2
14478 @itemx -fdump-rtl-ce3
14479 @opindex fdump-rtl-ce1
14480 @opindex fdump-rtl-ce2
14481 @opindex fdump-rtl-ce3
14482 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14483 @option{-fdump-rtl-ce3} enable dumping after the three
14484 if conversion passes.
14485
14486 @item -fdump-rtl-cprop_hardreg
14487 @opindex fdump-rtl-cprop_hardreg
14488 Dump after hard register copy propagation.
14489
14490 @item -fdump-rtl-csa
14491 @opindex fdump-rtl-csa
14492 Dump after combining stack adjustments.
14493
14494 @item -fdump-rtl-cse1
14495 @itemx -fdump-rtl-cse2
14496 @opindex fdump-rtl-cse1
14497 @opindex fdump-rtl-cse2
14498 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14499 the two common subexpression elimination passes.
14500
14501 @item -fdump-rtl-dce
14502 @opindex fdump-rtl-dce
14503 Dump after the standalone dead code elimination passes.
14504
14505 @item -fdump-rtl-dbr
14506 @opindex fdump-rtl-dbr
14507 Dump after delayed branch scheduling.
14508
14509 @item -fdump-rtl-dce1
14510 @itemx -fdump-rtl-dce2
14511 @opindex fdump-rtl-dce1
14512 @opindex fdump-rtl-dce2
14513 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14514 the two dead store elimination passes.
14515
14516 @item -fdump-rtl-eh
14517 @opindex fdump-rtl-eh
14518 Dump after finalization of EH handling code.
14519
14520 @item -fdump-rtl-eh_ranges
14521 @opindex fdump-rtl-eh_ranges
14522 Dump after conversion of EH handling range regions.
14523
14524 @item -fdump-rtl-expand
14525 @opindex fdump-rtl-expand
14526 Dump after RTL generation.
14527
14528 @item -fdump-rtl-fwprop1
14529 @itemx -fdump-rtl-fwprop2
14530 @opindex fdump-rtl-fwprop1
14531 @opindex fdump-rtl-fwprop2
14532 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14533 dumping after the two forward propagation passes.
14534
14535 @item -fdump-rtl-gcse1
14536 @itemx -fdump-rtl-gcse2
14537 @opindex fdump-rtl-gcse1
14538 @opindex fdump-rtl-gcse2
14539 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14540 after global common subexpression elimination.
14541
14542 @item -fdump-rtl-init-regs
14543 @opindex fdump-rtl-init-regs
14544 Dump after the initialization of the registers.
14545
14546 @item -fdump-rtl-initvals
14547 @opindex fdump-rtl-initvals
14548 Dump after the computation of the initial value sets.
14549
14550 @item -fdump-rtl-into_cfglayout
14551 @opindex fdump-rtl-into_cfglayout
14552 Dump after converting to cfglayout mode.
14553
14554 @item -fdump-rtl-ira
14555 @opindex fdump-rtl-ira
14556 Dump after iterated register allocation.
14557
14558 @item -fdump-rtl-jump
14559 @opindex fdump-rtl-jump
14560 Dump after the second jump optimization.
14561
14562 @item -fdump-rtl-loop2
14563 @opindex fdump-rtl-loop2
14564 @option{-fdump-rtl-loop2} enables dumping after the rtl
14565 loop optimization passes.
14566
14567 @item -fdump-rtl-mach
14568 @opindex fdump-rtl-mach
14569 Dump after performing the machine dependent reorganization pass, if that
14570 pass exists.
14571
14572 @item -fdump-rtl-mode_sw
14573 @opindex fdump-rtl-mode_sw
14574 Dump after removing redundant mode switches.
14575
14576 @item -fdump-rtl-rnreg
14577 @opindex fdump-rtl-rnreg
14578 Dump after register renumbering.
14579
14580 @item -fdump-rtl-outof_cfglayout
14581 @opindex fdump-rtl-outof_cfglayout
14582 Dump after converting from cfglayout mode.
14583
14584 @item -fdump-rtl-peephole2
14585 @opindex fdump-rtl-peephole2
14586 Dump after the peephole pass.
14587
14588 @item -fdump-rtl-postreload
14589 @opindex fdump-rtl-postreload
14590 Dump after post-reload optimizations.
14591
14592 @item -fdump-rtl-pro_and_epilogue
14593 @opindex fdump-rtl-pro_and_epilogue
14594 Dump after generating the function prologues and epilogues.
14595
14596 @item -fdump-rtl-sched1
14597 @itemx -fdump-rtl-sched2
14598 @opindex fdump-rtl-sched1
14599 @opindex fdump-rtl-sched2
14600 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14601 after the basic block scheduling passes.
14602
14603 @item -fdump-rtl-ree
14604 @opindex fdump-rtl-ree
14605 Dump after sign/zero extension elimination.
14606
14607 @item -fdump-rtl-seqabstr
14608 @opindex fdump-rtl-seqabstr
14609 Dump after common sequence discovery.
14610
14611 @item -fdump-rtl-shorten
14612 @opindex fdump-rtl-shorten
14613 Dump after shortening branches.
14614
14615 @item -fdump-rtl-sibling
14616 @opindex fdump-rtl-sibling
14617 Dump after sibling call optimizations.
14618
14619 @item -fdump-rtl-split1
14620 @itemx -fdump-rtl-split2
14621 @itemx -fdump-rtl-split3
14622 @itemx -fdump-rtl-split4
14623 @itemx -fdump-rtl-split5
14624 @opindex fdump-rtl-split1
14625 @opindex fdump-rtl-split2
14626 @opindex fdump-rtl-split3
14627 @opindex fdump-rtl-split4
14628 @opindex fdump-rtl-split5
14629 These options enable dumping after five rounds of
14630 instruction splitting.
14631
14632 @item -fdump-rtl-sms
14633 @opindex fdump-rtl-sms
14634 Dump after modulo scheduling. This pass is only run on some
14635 architectures.
14636
14637 @item -fdump-rtl-stack
14638 @opindex fdump-rtl-stack
14639 Dump after conversion from GCC's ``flat register file'' registers to the
14640 x87's stack-like registers. This pass is only run on x86 variants.
14641
14642 @item -fdump-rtl-subreg1
14643 @itemx -fdump-rtl-subreg2
14644 @opindex fdump-rtl-subreg1
14645 @opindex fdump-rtl-subreg2
14646 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14647 the two subreg expansion passes.
14648
14649 @item -fdump-rtl-unshare
14650 @opindex fdump-rtl-unshare
14651 Dump after all rtl has been unshared.
14652
14653 @item -fdump-rtl-vartrack
14654 @opindex fdump-rtl-vartrack
14655 Dump after variable tracking.
14656
14657 @item -fdump-rtl-vregs
14658 @opindex fdump-rtl-vregs
14659 Dump after converting virtual registers to hard registers.
14660
14661 @item -fdump-rtl-web
14662 @opindex fdump-rtl-web
14663 Dump after live range splitting.
14664
14665 @item -fdump-rtl-regclass
14666 @itemx -fdump-rtl-subregs_of_mode_init
14667 @itemx -fdump-rtl-subregs_of_mode_finish
14668 @itemx -fdump-rtl-dfinit
14669 @itemx -fdump-rtl-dfinish
14670 @opindex fdump-rtl-regclass
14671 @opindex fdump-rtl-subregs_of_mode_init
14672 @opindex fdump-rtl-subregs_of_mode_finish
14673 @opindex fdump-rtl-dfinit
14674 @opindex fdump-rtl-dfinish
14675 These dumps are defined but always produce empty files.
14676
14677 @item -da
14678 @itemx -fdump-rtl-all
14679 @opindex da
14680 @opindex fdump-rtl-all
14681 Produce all the dumps listed above.
14682
14683 @item -dA
14684 @opindex dA
14685 Annotate the assembler output with miscellaneous debugging information.
14686
14687 @item -dD
14688 @opindex dD
14689 Dump all macro definitions, at the end of preprocessing, in addition to
14690 normal output.
14691
14692 @item -dH
14693 @opindex dH
14694 Produce a core dump whenever an error occurs.
14695
14696 @item -dp
14697 @opindex dp
14698 Annotate the assembler output with a comment indicating which
14699 pattern and alternative is used. The length and cost of each instruction are
14700 also printed.
14701
14702 @item -dP
14703 @opindex dP
14704 Dump the RTL in the assembler output as a comment before each instruction.
14705 Also turns on @option{-dp} annotation.
14706
14707 @item -dx
14708 @opindex dx
14709 Just generate RTL for a function instead of compiling it. Usually used
14710 with @option{-fdump-rtl-expand}.
14711 @end table
14712
14713 @item -fdump-debug
14714 @opindex fdump-debug
14715 Dump debugging information generated during the debug
14716 generation phase.
14717
14718 @item -fdump-earlydebug
14719 @opindex fdump-earlydebug
14720 Dump debugging information generated during the early debug
14721 generation phase.
14722
14723 @item -fdump-noaddr
14724 @opindex fdump-noaddr
14725 When doing debugging dumps, suppress address output. This makes it more
14726 feasible to use diff on debugging dumps for compiler invocations with
14727 different compiler binaries and/or different
14728 text / bss / data / heap / stack / dso start locations.
14729
14730 @item -freport-bug
14731 @opindex freport-bug
14732 Collect and dump debug information into a temporary file if an
14733 internal compiler error (ICE) occurs.
14734
14735 @item -fdump-unnumbered
14736 @opindex fdump-unnumbered
14737 When doing debugging dumps, suppress instruction numbers and address output.
14738 This makes it more feasible to use diff on debugging dumps for compiler
14739 invocations with different options, in particular with and without
14740 @option{-g}.
14741
14742 @item -fdump-unnumbered-links
14743 @opindex fdump-unnumbered-links
14744 When doing debugging dumps (see @option{-d} option above), suppress
14745 instruction numbers for the links to the previous and next instructions
14746 in a sequence.
14747
14748 @item -fdump-ipa-@var{switch}
14749 @itemx -fdump-ipa-@var{switch}-@var{options}
14750 @opindex fdump-ipa
14751 Control the dumping at various stages of inter-procedural analysis
14752 language tree to a file. The file name is generated by appending a
14753 switch specific suffix to the source file name, and the file is created
14754 in the same directory as the output file. The following dumps are
14755 possible:
14756
14757 @table @samp
14758 @item all
14759 Enables all inter-procedural analysis dumps.
14760
14761 @item cgraph
14762 Dumps information about call-graph optimization, unused function removal,
14763 and inlining decisions.
14764
14765 @item inline
14766 Dump after function inlining.
14767
14768 @end table
14769
14770 Additionally, the options @option{-optimized}, @option{-missed},
14771 @option{-note}, and @option{-all} can be provided, with the same meaning
14772 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14773
14774 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14775 information on callsites that were inlined, along with callsites
14776 that were not inlined.
14777
14778 By default, the dump will contain messages about successful
14779 optimizations (equivalent to @option{-optimized}) together with
14780 low-level details about the analysis.
14781
14782 @item -fdump-lang-all
14783 @itemx -fdump-lang-@var{switch}
14784 @itemx -fdump-lang-@var{switch}-@var{options}
14785 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14786 @opindex fdump-lang-all
14787 @opindex fdump-lang
14788 Control the dumping of language-specific information. The @var{options}
14789 and @var{filename} portions behave as described in the
14790 @option{-fdump-tree} option. The following @var{switch} values are
14791 accepted:
14792
14793 @table @samp
14794 @item all
14795
14796 Enable all language-specific dumps.
14797
14798 @item class
14799 Dump class hierarchy information. Virtual table information is emitted
14800 unless '@option{slim}' is specified. This option is applicable to C++ only.
14801
14802 @item raw
14803 Dump the raw internal tree data. This option is applicable to C++ only.
14804
14805 @end table
14806
14807 @item -fdump-passes
14808 @opindex fdump-passes
14809 Print on @file{stderr} the list of optimization passes that are turned
14810 on and off by the current command-line options.
14811
14812 @item -fdump-statistics-@var{option}
14813 @opindex fdump-statistics
14814 Enable and control dumping of pass statistics in a separate file. The
14815 file name is generated by appending a suffix ending in
14816 @samp{.statistics} to the source file name, and the file is created in
14817 the same directory as the output file. If the @samp{-@var{option}}
14818 form is used, @samp{-stats} causes counters to be summed over the
14819 whole compilation unit while @samp{-details} dumps every event as
14820 the passes generate them. The default with no option is to sum
14821 counters for each function compiled.
14822
14823 @item -fdump-tree-all
14824 @itemx -fdump-tree-@var{switch}
14825 @itemx -fdump-tree-@var{switch}-@var{options}
14826 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14827 @opindex fdump-tree-all
14828 @opindex fdump-tree
14829 Control the dumping at various stages of processing the intermediate
14830 language tree to a file. If the @samp{-@var{options}}
14831 form is used, @var{options} is a list of @samp{-} separated options
14832 which control the details of the dump. Not all options are applicable
14833 to all dumps; those that are not meaningful are ignored. The
14834 following options are available
14835
14836 @table @samp
14837 @item address
14838 Print the address of each node. Usually this is not meaningful as it
14839 changes according to the environment and source file. Its primary use
14840 is for tying up a dump file with a debug environment.
14841 @item asmname
14842 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14843 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14844 use working backward from mangled names in the assembly file.
14845 @item slim
14846 When dumping front-end intermediate representations, inhibit dumping
14847 of members of a scope or body of a function merely because that scope
14848 has been reached. Only dump such items when they are directly reachable
14849 by some other path.
14850
14851 When dumping pretty-printed trees, this option inhibits dumping the
14852 bodies of control structures.
14853
14854 When dumping RTL, print the RTL in slim (condensed) form instead of
14855 the default LISP-like representation.
14856 @item raw
14857 Print a raw representation of the tree. By default, trees are
14858 pretty-printed into a C-like representation.
14859 @item details
14860 Enable more detailed dumps (not honored by every dump option). Also
14861 include information from the optimization passes.
14862 @item stats
14863 Enable dumping various statistics about the pass (not honored by every dump
14864 option).
14865 @item blocks
14866 Enable showing basic block boundaries (disabled in raw dumps).
14867 @item graph
14868 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14869 dump a representation of the control flow graph suitable for viewing with
14870 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14871 the file is pretty-printed as a subgraph, so that GraphViz can render them
14872 all in a single plot.
14873
14874 This option currently only works for RTL dumps, and the RTL is always
14875 dumped in slim form.
14876 @item vops
14877 Enable showing virtual operands for every statement.
14878 @item lineno
14879 Enable showing line numbers for statements.
14880 @item uid
14881 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14882 @item verbose
14883 Enable showing the tree dump for each statement.
14884 @item eh
14885 Enable showing the EH region number holding each statement.
14886 @item scev
14887 Enable showing scalar evolution analysis details.
14888 @item optimized
14889 Enable showing optimization information (only available in certain
14890 passes).
14891 @item missed
14892 Enable showing missed optimization information (only available in certain
14893 passes).
14894 @item note
14895 Enable other detailed optimization information (only available in
14896 certain passes).
14897 @item all
14898 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14899 and @option{lineno}.
14900 @item optall
14901 Turn on all optimization options, i.e., @option{optimized},
14902 @option{missed}, and @option{note}.
14903 @end table
14904
14905 To determine what tree dumps are available or find the dump for a pass
14906 of interest follow the steps below.
14907
14908 @enumerate
14909 @item
14910 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14911 look for a code that corresponds to the pass you are interested in.
14912 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14913 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14914 The number at the end distinguishes distinct invocations of the same pass.
14915 @item
14916 To enable the creation of the dump file, append the pass code to
14917 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14918 to enable the dump from the Early Value Range Propagation pass, invoke
14919 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14920 specify the name of the dump file. If you don't specify one, GCC
14921 creates as described below.
14922 @item
14923 Find the pass dump in a file whose name is composed of three components
14924 separated by a period: the name of the source file GCC was invoked to
14925 compile, a numeric suffix indicating the pass number followed by the
14926 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14927 and finally the pass code. For example, the Early VRP pass dump might
14928 be in a file named @file{myfile.c.038t.evrp} in the current working
14929 directory. Note that the numeric codes are not stable and may change
14930 from one version of GCC to another.
14931 @end enumerate
14932
14933 @item -fopt-info
14934 @itemx -fopt-info-@var{options}
14935 @itemx -fopt-info-@var{options}=@var{filename}
14936 @opindex fopt-info
14937 Controls optimization dumps from various optimization passes. If the
14938 @samp{-@var{options}} form is used, @var{options} is a list of
14939 @samp{-} separated option keywords to select the dump details and
14940 optimizations.
14941
14942 The @var{options} can be divided into three groups:
14943 @enumerate
14944 @item
14945 options describing what kinds of messages should be emitted,
14946 @item
14947 options describing the verbosity of the dump, and
14948 @item
14949 options describing which optimizations should be included.
14950 @end enumerate
14951 The options from each group can be freely mixed as they are
14952 non-overlapping. However, in case of any conflicts,
14953 the later options override the earlier options on the command
14954 line.
14955
14956 The following options control which kinds of messages should be emitted:
14957
14958 @table @samp
14959 @item optimized
14960 Print information when an optimization is successfully applied. It is
14961 up to a pass to decide which information is relevant. For example, the
14962 vectorizer passes print the source location of loops which are
14963 successfully vectorized.
14964 @item missed
14965 Print information about missed optimizations. Individual passes
14966 control which information to include in the output.
14967 @item note
14968 Print verbose information about optimizations, such as certain
14969 transformations, more detailed messages about decisions etc.
14970 @item all
14971 Print detailed optimization information. This includes
14972 @samp{optimized}, @samp{missed}, and @samp{note}.
14973 @end table
14974
14975 The following option controls the dump verbosity:
14976
14977 @table @samp
14978 @item internals
14979 By default, only ``high-level'' messages are emitted. This option enables
14980 additional, more detailed, messages, which are likely to only be of interest
14981 to GCC developers.
14982 @end table
14983
14984 One or more of the following option keywords can be used to describe a
14985 group of optimizations:
14986
14987 @table @samp
14988 @item ipa
14989 Enable dumps from all interprocedural optimizations.
14990 @item loop
14991 Enable dumps from all loop optimizations.
14992 @item inline
14993 Enable dumps from all inlining optimizations.
14994 @item omp
14995 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14996 @item vec
14997 Enable dumps from all vectorization optimizations.
14998 @item optall
14999 Enable dumps from all optimizations. This is a superset of
15000 the optimization groups listed above.
15001 @end table
15002
15003 If @var{options} is
15004 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
15005 about successful optimizations from all the passes, omitting messages
15006 that are treated as ``internals''.
15007
15008 If the @var{filename} is provided, then the dumps from all the
15009 applicable optimizations are concatenated into the @var{filename}.
15010 Otherwise the dump is output onto @file{stderr}. Though multiple
15011 @option{-fopt-info} options are accepted, only one of them can include
15012 a @var{filename}. If other filenames are provided then all but the
15013 first such option are ignored.
15014
15015 Note that the output @var{filename} is overwritten
15016 in case of multiple translation units. If a combined output from
15017 multiple translation units is desired, @file{stderr} should be used
15018 instead.
15019
15020 In the following example, the optimization info is output to
15021 @file{stderr}:
15022
15023 @smallexample
15024 gcc -O3 -fopt-info
15025 @end smallexample
15026
15027 This example:
15028 @smallexample
15029 gcc -O3 -fopt-info-missed=missed.all
15030 @end smallexample
15031
15032 @noindent
15033 outputs missed optimization report from all the passes into
15034 @file{missed.all}, and this one:
15035
15036 @smallexample
15037 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15038 @end smallexample
15039
15040 @noindent
15041 prints information about missed optimization opportunities from
15042 vectorization passes on @file{stderr}.
15043 Note that @option{-fopt-info-vec-missed} is equivalent to
15044 @option{-fopt-info-missed-vec}. The order of the optimization group
15045 names and message types listed after @option{-fopt-info} does not matter.
15046
15047 As another example,
15048 @smallexample
15049 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15050 @end smallexample
15051
15052 @noindent
15053 outputs information about missed optimizations as well as
15054 optimized locations from all the inlining passes into
15055 @file{inline.txt}.
15056
15057 Finally, consider:
15058
15059 @smallexample
15060 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15061 @end smallexample
15062
15063 @noindent
15064 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15065 in conflict since only one output file is allowed. In this case, only
15066 the first option takes effect and the subsequent options are
15067 ignored. Thus only @file{vec.miss} is produced which contains
15068 dumps from the vectorizer about missed opportunities.
15069
15070 @item -fsave-optimization-record
15071 @opindex fsave-optimization-record
15072 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15073 were performed, for those optimizations that support @option{-fopt-info}.
15074
15075 This option is experimental and the format of the data within the
15076 compressed JSON file is subject to change.
15077
15078 It is roughly equivalent to a machine-readable version of
15079 @option{-fopt-info-all}, as a collection of messages with source file,
15080 line number and column number, with the following additional data for
15081 each message:
15082
15083 @itemize @bullet
15084
15085 @item
15086 the execution count of the code being optimized, along with metadata about
15087 whether this was from actual profile data, or just an estimate, allowing
15088 consumers to prioritize messages by code hotness,
15089
15090 @item
15091 the function name of the code being optimized, where applicable,
15092
15093 @item
15094 the ``inlining chain'' for the code being optimized, so that when
15095 a function is inlined into several different places (which might
15096 themselves be inlined), the reader can distinguish between the copies,
15097
15098 @item
15099 objects identifying those parts of the message that refer to expressions,
15100 statements or symbol-table nodes, which of these categories they are, and,
15101 when available, their source code location,
15102
15103 @item
15104 the GCC pass that emitted the message, and
15105
15106 @item
15107 the location in GCC's own code from which the message was emitted
15108
15109 @end itemize
15110
15111 Additionally, some messages are logically nested within other
15112 messages, reflecting implementation details of the optimization
15113 passes.
15114
15115 @item -fsched-verbose=@var{n}
15116 @opindex fsched-verbose
15117 On targets that use instruction scheduling, this option controls the
15118 amount of debugging output the scheduler prints to the dump files.
15119
15120 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15121 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15122 For @var{n} greater than one, it also output basic block probabilities,
15123 detailed ready list information and unit/insn info. For @var{n} greater
15124 than two, it includes RTL at abort point, control-flow and regions info.
15125 And for @var{n} over four, @option{-fsched-verbose} also includes
15126 dependence info.
15127
15128
15129
15130 @item -fenable-@var{kind}-@var{pass}
15131 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15132 @opindex fdisable-
15133 @opindex fenable-
15134
15135 This is a set of options that are used to explicitly disable/enable
15136 optimization passes. These options are intended for use for debugging GCC.
15137 Compiler users should use regular options for enabling/disabling
15138 passes instead.
15139
15140 @table @gcctabopt
15141
15142 @item -fdisable-ipa-@var{pass}
15143 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15144 statically invoked in the compiler multiple times, the pass name should be
15145 appended with a sequential number starting from 1.
15146
15147 @item -fdisable-rtl-@var{pass}
15148 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15149 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15150 statically invoked in the compiler multiple times, the pass name should be
15151 appended with a sequential number starting from 1. @var{range-list} is a
15152 comma-separated list of function ranges or assembler names. Each range is a number
15153 pair separated by a colon. The range is inclusive in both ends. If the range
15154 is trivial, the number pair can be simplified as a single number. If the
15155 function's call graph node's @var{uid} falls within one of the specified ranges,
15156 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15157 function header of a dump file, and the pass names can be dumped by using
15158 option @option{-fdump-passes}.
15159
15160 @item -fdisable-tree-@var{pass}
15161 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15162 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15163 option arguments.
15164
15165 @item -fenable-ipa-@var{pass}
15166 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15167 statically invoked in the compiler multiple times, the pass name should be
15168 appended with a sequential number starting from 1.
15169
15170 @item -fenable-rtl-@var{pass}
15171 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15172 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15173 description and examples.
15174
15175 @item -fenable-tree-@var{pass}
15176 @itemx -fenable-tree-@var{pass}=@var{range-list}
15177 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15178 of option arguments.
15179
15180 @end table
15181
15182 Here are some examples showing uses of these options.
15183
15184 @smallexample
15185
15186 # disable ccp1 for all functions
15187 -fdisable-tree-ccp1
15188 # disable complete unroll for function whose cgraph node uid is 1
15189 -fenable-tree-cunroll=1
15190 # disable gcse2 for functions at the following ranges [1,1],
15191 # [300,400], and [400,1000]
15192 # disable gcse2 for functions foo and foo2
15193 -fdisable-rtl-gcse2=foo,foo2
15194 # disable early inlining
15195 -fdisable-tree-einline
15196 # disable ipa inlining
15197 -fdisable-ipa-inline
15198 # enable tree full unroll
15199 -fenable-tree-unroll
15200
15201 @end smallexample
15202
15203 @item -fchecking
15204 @itemx -fchecking=@var{n}
15205 @opindex fchecking
15206 @opindex fno-checking
15207 Enable internal consistency checking. The default depends on
15208 the compiler configuration. @option{-fchecking=2} enables further
15209 internal consistency checking that might affect code generation.
15210
15211 @item -frandom-seed=@var{string}
15212 @opindex frandom-seed
15213 This option provides a seed that GCC uses in place of
15214 random numbers in generating certain symbol names
15215 that have to be different in every compiled file. It is also used to
15216 place unique stamps in coverage data files and the object files that
15217 produce them. You can use the @option{-frandom-seed} option to produce
15218 reproducibly identical object files.
15219
15220 The @var{string} can either be a number (decimal, octal or hex) or an
15221 arbitrary string (in which case it's converted to a number by
15222 computing CRC32).
15223
15224 The @var{string} should be different for every file you compile.
15225
15226 @item -save-temps
15227 @itemx -save-temps=cwd
15228 @opindex save-temps
15229 Store the usual ``temporary'' intermediate files permanently; place them
15230 in the current directory and name them based on the source file. Thus,
15231 compiling @file{foo.c} with @option{-c -save-temps} produces files
15232 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15233 preprocessed @file{foo.i} output file even though the compiler now
15234 normally uses an integrated preprocessor.
15235
15236 When used in combination with the @option{-x} command-line option,
15237 @option{-save-temps} is sensible enough to avoid over writing an
15238 input source file with the same extension as an intermediate file.
15239 The corresponding intermediate file may be obtained by renaming the
15240 source file before using @option{-save-temps}.
15241
15242 If you invoke GCC in parallel, compiling several different source
15243 files that share a common base name in different subdirectories or the
15244 same source file compiled for multiple output destinations, it is
15245 likely that the different parallel compilers will interfere with each
15246 other, and overwrite the temporary files. For instance:
15247
15248 @smallexample
15249 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15250 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15251 @end smallexample
15252
15253 may result in @file{foo.i} and @file{foo.o} being written to
15254 simultaneously by both compilers.
15255
15256 @item -save-temps=obj
15257 @opindex save-temps=obj
15258 Store the usual ``temporary'' intermediate files permanently. If the
15259 @option{-o} option is used, the temporary files are based on the
15260 object file. If the @option{-o} option is not used, the
15261 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15262
15263 For example:
15264
15265 @smallexample
15266 gcc -save-temps=obj -c foo.c
15267 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15268 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15269 @end smallexample
15270
15271 @noindent
15272 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15273 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15274 @file{dir2/yfoobar.o}.
15275
15276 @item -time@r{[}=@var{file}@r{]}
15277 @opindex time
15278 Report the CPU time taken by each subprocess in the compilation
15279 sequence. For C source files, this is the compiler proper and assembler
15280 (plus the linker if linking is done).
15281
15282 Without the specification of an output file, the output looks like this:
15283
15284 @smallexample
15285 # cc1 0.12 0.01
15286 # as 0.00 0.01
15287 @end smallexample
15288
15289 The first number on each line is the ``user time'', that is time spent
15290 executing the program itself. The second number is ``system time'',
15291 time spent executing operating system routines on behalf of the program.
15292 Both numbers are in seconds.
15293
15294 With the specification of an output file, the output is appended to the
15295 named file, and it looks like this:
15296
15297 @smallexample
15298 0.12 0.01 cc1 @var{options}
15299 0.00 0.01 as @var{options}
15300 @end smallexample
15301
15302 The ``user time'' and the ``system time'' are moved before the program
15303 name, and the options passed to the program are displayed, so that one
15304 can later tell what file was being compiled, and with which options.
15305
15306 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15307 @opindex fdump-final-insns
15308 Dump the final internal representation (RTL) to @var{file}. If the
15309 optional argument is omitted (or if @var{file} is @code{.}), the name
15310 of the dump file is determined by appending @code{.gkd} to the
15311 compilation output file name.
15312
15313 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15314 @opindex fcompare-debug
15315 @opindex fno-compare-debug
15316 If no error occurs during compilation, run the compiler a second time,
15317 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15318 passed to the second compilation. Dump the final internal
15319 representation in both compilations, and print an error if they differ.
15320
15321 If the equal sign is omitted, the default @option{-gtoggle} is used.
15322
15323 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15324 and nonzero, implicitly enables @option{-fcompare-debug}. If
15325 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15326 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15327 is used.
15328
15329 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15330 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15331 of the final representation and the second compilation, preventing even
15332 @env{GCC_COMPARE_DEBUG} from taking effect.
15333
15334 To verify full coverage during @option{-fcompare-debug} testing, set
15335 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15336 which GCC rejects as an invalid option in any actual compilation
15337 (rather than preprocessing, assembly or linking). To get just a
15338 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15339 not overridden} will do.
15340
15341 @item -fcompare-debug-second
15342 @opindex fcompare-debug-second
15343 This option is implicitly passed to the compiler for the second
15344 compilation requested by @option{-fcompare-debug}, along with options to
15345 silence warnings, and omitting other options that would cause the compiler
15346 to produce output to files or to standard output as a side effect. Dump
15347 files and preserved temporary files are renamed so as to contain the
15348 @code{.gk} additional extension during the second compilation, to avoid
15349 overwriting those generated by the first.
15350
15351 When this option is passed to the compiler driver, it causes the
15352 @emph{first} compilation to be skipped, which makes it useful for little
15353 other than debugging the compiler proper.
15354
15355 @item -gtoggle
15356 @opindex gtoggle
15357 Turn off generation of debug info, if leaving out this option
15358 generates it, or turn it on at level 2 otherwise. The position of this
15359 argument in the command line does not matter; it takes effect after all
15360 other options are processed, and it does so only once, no matter how
15361 many times it is given. This is mainly intended to be used with
15362 @option{-fcompare-debug}.
15363
15364 @item -fvar-tracking-assignments-toggle
15365 @opindex fvar-tracking-assignments-toggle
15366 @opindex fno-var-tracking-assignments-toggle
15367 Toggle @option{-fvar-tracking-assignments}, in the same way that
15368 @option{-gtoggle} toggles @option{-g}.
15369
15370 @item -Q
15371 @opindex Q
15372 Makes the compiler print out each function name as it is compiled, and
15373 print some statistics about each pass when it finishes.
15374
15375 @item -ftime-report
15376 @opindex ftime-report
15377 Makes the compiler print some statistics about the time consumed by each
15378 pass when it finishes.
15379
15380 @item -ftime-report-details
15381 @opindex ftime-report-details
15382 Record the time consumed by infrastructure parts separately for each pass.
15383
15384 @item -fira-verbose=@var{n}
15385 @opindex fira-verbose
15386 Control the verbosity of the dump file for the integrated register allocator.
15387 The default value is 5. If the value @var{n} is greater or equal to 10,
15388 the dump output is sent to stderr using the same format as @var{n} minus 10.
15389
15390 @item -flto-report
15391 @opindex flto-report
15392 Prints a report with internal details on the workings of the link-time
15393 optimizer. The contents of this report vary from version to version.
15394 It is meant to be useful to GCC developers when processing object
15395 files in LTO mode (via @option{-flto}).
15396
15397 Disabled by default.
15398
15399 @item -flto-report-wpa
15400 @opindex flto-report-wpa
15401 Like @option{-flto-report}, but only print for the WPA phase of link-time
15402 optimization.
15403
15404 @item -fmem-report
15405 @opindex fmem-report
15406 Makes the compiler print some statistics about permanent memory
15407 allocation when it finishes.
15408
15409 @item -fmem-report-wpa
15410 @opindex fmem-report-wpa
15411 Makes the compiler print some statistics about permanent memory
15412 allocation for the WPA phase only.
15413
15414 @item -fpre-ipa-mem-report
15415 @opindex fpre-ipa-mem-report
15416 @item -fpost-ipa-mem-report
15417 @opindex fpost-ipa-mem-report
15418 Makes the compiler print some statistics about permanent memory
15419 allocation before or after interprocedural optimization.
15420
15421 @item -fprofile-report
15422 @opindex fprofile-report
15423 Makes the compiler print some statistics about consistency of the
15424 (estimated) profile and effect of individual passes.
15425
15426 @item -fstack-usage
15427 @opindex fstack-usage
15428 Makes the compiler output stack usage information for the program, on a
15429 per-function basis. The filename for the dump is made by appending
15430 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15431 the output file, if explicitly specified and it is not an executable,
15432 otherwise it is the basename of the source file. An entry is made up
15433 of three fields:
15434
15435 @itemize
15436 @item
15437 The name of the function.
15438 @item
15439 A number of bytes.
15440 @item
15441 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15442 @end itemize
15443
15444 The qualifier @code{static} means that the function manipulates the stack
15445 statically: a fixed number of bytes are allocated for the frame on function
15446 entry and released on function exit; no stack adjustments are otherwise made
15447 in the function. The second field is this fixed number of bytes.
15448
15449 The qualifier @code{dynamic} means that the function manipulates the stack
15450 dynamically: in addition to the static allocation described above, stack
15451 adjustments are made in the body of the function, for example to push/pop
15452 arguments around function calls. If the qualifier @code{bounded} is also
15453 present, the amount of these adjustments is bounded at compile time and
15454 the second field is an upper bound of the total amount of stack used by
15455 the function. If it is not present, the amount of these adjustments is
15456 not bounded at compile time and the second field only represents the
15457 bounded part.
15458
15459 @item -fstats
15460 @opindex fstats
15461 Emit statistics about front-end processing at the end of the compilation.
15462 This option is supported only by the C++ front end, and
15463 the information is generally only useful to the G++ development team.
15464
15465 @item -fdbg-cnt-list
15466 @opindex fdbg-cnt-list
15467 Print the name and the counter upper bound for all debug counters.
15468
15469
15470 @item -fdbg-cnt=@var{counter-value-list}
15471 @opindex fdbg-cnt
15472 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15473 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15474 tuples which sets the lower and the upper bound of each debug
15475 counter @var{name}. The @var{lower_bound} is optional and is zero
15476 initialized if not set.
15477 All debug counters have the initial upper bound of @code{UINT_MAX};
15478 thus @code{dbg_cnt} returns true always unless the upper bound
15479 is set by this option.
15480 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15481 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15482 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15483
15484 @item -print-file-name=@var{library}
15485 @opindex print-file-name
15486 Print the full absolute name of the library file @var{library} that
15487 would be used when linking---and don't do anything else. With this
15488 option, GCC does not compile or link anything; it just prints the
15489 file name.
15490
15491 @item -print-multi-directory
15492 @opindex print-multi-directory
15493 Print the directory name corresponding to the multilib selected by any
15494 other switches present in the command line. This directory is supposed
15495 to exist in @env{GCC_EXEC_PREFIX}.
15496
15497 @item -print-multi-lib
15498 @opindex print-multi-lib
15499 Print the mapping from multilib directory names to compiler switches
15500 that enable them. The directory name is separated from the switches by
15501 @samp{;}, and each switch starts with an @samp{@@} instead of the
15502 @samp{-}, without spaces between multiple switches. This is supposed to
15503 ease shell processing.
15504
15505 @item -print-multi-os-directory
15506 @opindex print-multi-os-directory
15507 Print the path to OS libraries for the selected
15508 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15509 present in the @file{lib} subdirectory and no multilibs are used, this is
15510 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15511 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15512 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15513 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15514
15515 @item -print-multiarch
15516 @opindex print-multiarch
15517 Print the path to OS libraries for the selected multiarch,
15518 relative to some @file{lib} subdirectory.
15519
15520 @item -print-prog-name=@var{program}
15521 @opindex print-prog-name
15522 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15523
15524 @item -print-libgcc-file-name
15525 @opindex print-libgcc-file-name
15526 Same as @option{-print-file-name=libgcc.a}.
15527
15528 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15529 but you do want to link with @file{libgcc.a}. You can do:
15530
15531 @smallexample
15532 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15533 @end smallexample
15534
15535 @item -print-search-dirs
15536 @opindex print-search-dirs
15537 Print the name of the configured installation directory and a list of
15538 program and library directories @command{gcc} searches---and don't do anything else.
15539
15540 This is useful when @command{gcc} prints the error message
15541 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15542 To resolve this you either need to put @file{cpp0} and the other compiler
15543 components where @command{gcc} expects to find them, or you can set the environment
15544 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15545 Don't forget the trailing @samp{/}.
15546 @xref{Environment Variables}.
15547
15548 @item -print-sysroot
15549 @opindex print-sysroot
15550 Print the target sysroot directory that is used during
15551 compilation. This is the target sysroot specified either at configure
15552 time or using the @option{--sysroot} option, possibly with an extra
15553 suffix that depends on compilation options. If no target sysroot is
15554 specified, the option prints nothing.
15555
15556 @item -print-sysroot-headers-suffix
15557 @opindex print-sysroot-headers-suffix
15558 Print the suffix added to the target sysroot when searching for
15559 headers, or give an error if the compiler is not configured with such
15560 a suffix---and don't do anything else.
15561
15562 @item -dumpmachine
15563 @opindex dumpmachine
15564 Print the compiler's target machine (for example,
15565 @samp{i686-pc-linux-gnu})---and don't do anything else.
15566
15567 @item -dumpversion
15568 @opindex dumpversion
15569 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15570 anything else. This is the compiler version used in filesystem paths and
15571 specs. Depending on how the compiler has been configured it can be just
15572 a single number (major version), two numbers separated by a dot (major and
15573 minor version) or three numbers separated by dots (major, minor and patchlevel
15574 version).
15575
15576 @item -dumpfullversion
15577 @opindex dumpfullversion
15578 Print the full compiler version---and don't do anything else. The output is
15579 always three numbers separated by dots, major, minor and patchlevel version.
15580
15581 @item -dumpspecs
15582 @opindex dumpspecs
15583 Print the compiler's built-in specs---and don't do anything else. (This
15584 is used when GCC itself is being built.) @xref{Spec Files}.
15585 @end table
15586
15587 @node Submodel Options
15588 @section Machine-Dependent Options
15589 @cindex submodel options
15590 @cindex specifying hardware config
15591 @cindex hardware models and configurations, specifying
15592 @cindex target-dependent options
15593 @cindex machine-dependent options
15594
15595 Each target machine supported by GCC can have its own options---for
15596 example, to allow you to compile for a particular processor variant or
15597 ABI, or to control optimizations specific to that machine. By
15598 convention, the names of machine-specific options start with
15599 @samp{-m}.
15600
15601 Some configurations of the compiler also support additional target-specific
15602 options, usually for compatibility with other compilers on the same
15603 platform.
15604
15605 @c This list is ordered alphanumerically by subsection name.
15606 @c It should be the same order and spelling as these options are listed
15607 @c in Machine Dependent Options
15608
15609 @menu
15610 * AArch64 Options::
15611 * Adapteva Epiphany Options::
15612 * AMD GCN Options::
15613 * ARC Options::
15614 * ARM Options::
15615 * AVR Options::
15616 * Blackfin Options::
15617 * C6X Options::
15618 * CRIS Options::
15619 * CR16 Options::
15620 * C-SKY Options::
15621 * Darwin Options::
15622 * DEC Alpha Options::
15623 * FR30 Options::
15624 * FT32 Options::
15625 * FRV Options::
15626 * GNU/Linux Options::
15627 * H8/300 Options::
15628 * HPPA Options::
15629 * IA-64 Options::
15630 * LM32 Options::
15631 * M32C Options::
15632 * M32R/D Options::
15633 * M680x0 Options::
15634 * MCore Options::
15635 * MeP Options::
15636 * MicroBlaze Options::
15637 * MIPS Options::
15638 * MMIX Options::
15639 * MN10300 Options::
15640 * Moxie Options::
15641 * MSP430 Options::
15642 * NDS32 Options::
15643 * Nios II Options::
15644 * Nvidia PTX Options::
15645 * OpenRISC Options::
15646 * PDP-11 Options::
15647 * picoChip Options::
15648 * PowerPC Options::
15649 * PRU Options::
15650 * RISC-V Options::
15651 * RL78 Options::
15652 * RS/6000 and PowerPC Options::
15653 * RX Options::
15654 * S/390 and zSeries Options::
15655 * Score Options::
15656 * SH Options::
15657 * Solaris 2 Options::
15658 * SPARC Options::
15659 * SPU Options::
15660 * System V Options::
15661 * TILE-Gx Options::
15662 * TILEPro Options::
15663 * V850 Options::
15664 * VAX Options::
15665 * Visium Options::
15666 * VMS Options::
15667 * VxWorks Options::
15668 * x86 Options::
15669 * x86 Windows Options::
15670 * Xstormy16 Options::
15671 * Xtensa Options::
15672 * zSeries Options::
15673 @end menu
15674
15675 @node AArch64 Options
15676 @subsection AArch64 Options
15677 @cindex AArch64 Options
15678
15679 These options are defined for AArch64 implementations:
15680
15681 @table @gcctabopt
15682
15683 @item -mabi=@var{name}
15684 @opindex mabi
15685 Generate code for the specified data model. Permissible values
15686 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15687 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15688 but long int and pointers are 64 bits.
15689
15690 The default depends on the specific target configuration. Note that
15691 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15692 entire program with the same ABI, and link with a compatible set of libraries.
15693
15694 @item -mbig-endian
15695 @opindex mbig-endian
15696 Generate big-endian code. This is the default when GCC is configured for an
15697 @samp{aarch64_be-*-*} target.
15698
15699 @item -mgeneral-regs-only
15700 @opindex mgeneral-regs-only
15701 Generate code which uses only the general-purpose registers. This will prevent
15702 the compiler from using floating-point and Advanced SIMD registers but will not
15703 impose any restrictions on the assembler.
15704
15705 @item -mlittle-endian
15706 @opindex mlittle-endian
15707 Generate little-endian code. This is the default when GCC is configured for an
15708 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15709
15710 @item -mcmodel=tiny
15711 @opindex mcmodel=tiny
15712 Generate code for the tiny code model. The program and its statically defined
15713 symbols must be within 1MB of each other. Programs can be statically or
15714 dynamically linked.
15715
15716 @item -mcmodel=small
15717 @opindex mcmodel=small
15718 Generate code for the small code model. The program and its statically defined
15719 symbols must be within 4GB of each other. Programs can be statically or
15720 dynamically linked. This is the default code model.
15721
15722 @item -mcmodel=large
15723 @opindex mcmodel=large
15724 Generate code for the large code model. This makes no assumptions about
15725 addresses and sizes of sections. Programs can be statically linked only.
15726
15727 @item -mstrict-align
15728 @itemx -mno-strict-align
15729 @opindex mstrict-align
15730 @opindex mno-strict-align
15731 Avoid or allow generating memory accesses that may not be aligned on a natural
15732 object boundary as described in the architecture specification.
15733
15734 @item -momit-leaf-frame-pointer
15735 @itemx -mno-omit-leaf-frame-pointer
15736 @opindex momit-leaf-frame-pointer
15737 @opindex mno-omit-leaf-frame-pointer
15738 Omit or keep the frame pointer in leaf functions. The former behavior is the
15739 default.
15740
15741 @item -mstack-protector-guard=@var{guard}
15742 @itemx -mstack-protector-guard-reg=@var{reg}
15743 @itemx -mstack-protector-guard-offset=@var{offset}
15744 @opindex mstack-protector-guard
15745 @opindex mstack-protector-guard-reg
15746 @opindex mstack-protector-guard-offset
15747 Generate stack protection code using canary at @var{guard}. Supported
15748 locations are @samp{global} for a global canary or @samp{sysreg} for a
15749 canary in an appropriate system register.
15750
15751 With the latter choice the options
15752 @option{-mstack-protector-guard-reg=@var{reg}} and
15753 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15754 which system register to use as base register for reading the canary,
15755 and from what offset from that base register. There is no default
15756 register or offset as this is entirely for use within the Linux
15757 kernel.
15758
15759 @item -mstack-protector-guard=@var{guard}
15760 @itemx -mstack-protector-guard-reg=@var{reg}
15761 @itemx -mstack-protector-guard-offset=@var{offset}
15762 @opindex mstack-protector-guard
15763 @opindex mstack-protector-guard-reg
15764 @opindex mstack-protector-guard-offset
15765 Generate stack protection code using canary at @var{guard}. Supported
15766 locations are @samp{global} for a global canary or @samp{sysreg} for a
15767 canary in an appropriate system register.
15768
15769 With the latter choice the options
15770 @option{-mstack-protector-guard-reg=@var{reg}} and
15771 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15772 which system register to use as base register for reading the canary,
15773 and from what offset from that base register. There is no default
15774 register or offset as this is entirely for use within the Linux
15775 kernel.
15776
15777 @item -mtls-dialect=desc
15778 @opindex mtls-dialect=desc
15779 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15780 of TLS variables. This is the default.
15781
15782 @item -mtls-dialect=traditional
15783 @opindex mtls-dialect=traditional
15784 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15785 of TLS variables.
15786
15787 @item -mtls-size=@var{size}
15788 @opindex mtls-size
15789 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15790 This option requires binutils 2.26 or newer.
15791
15792 @item -mfix-cortex-a53-835769
15793 @itemx -mno-fix-cortex-a53-835769
15794 @opindex mfix-cortex-a53-835769
15795 @opindex mno-fix-cortex-a53-835769
15796 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15797 This involves inserting a NOP instruction between memory instructions and
15798 64-bit integer multiply-accumulate instructions.
15799
15800 @item -mfix-cortex-a53-843419
15801 @itemx -mno-fix-cortex-a53-843419
15802 @opindex mfix-cortex-a53-843419
15803 @opindex mno-fix-cortex-a53-843419
15804 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15805 This erratum workaround is made at link time and this will only pass the
15806 corresponding flag to the linker.
15807
15808 @item -mlow-precision-recip-sqrt
15809 @itemx -mno-low-precision-recip-sqrt
15810 @opindex mlow-precision-recip-sqrt
15811 @opindex mno-low-precision-recip-sqrt
15812 Enable or disable the reciprocal square root approximation.
15813 This option only has an effect if @option{-ffast-math} or
15814 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15815 precision of reciprocal square root results to about 16 bits for
15816 single precision and to 32 bits for double precision.
15817
15818 @item -mlow-precision-sqrt
15819 @itemx -mno-low-precision-sqrt
15820 @opindex mlow-precision-sqrt
15821 @opindex mno-low-precision-sqrt
15822 Enable or disable the square root approximation.
15823 This option only has an effect if @option{-ffast-math} or
15824 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15825 precision of square root results to about 16 bits for
15826 single precision and to 32 bits for double precision.
15827 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15828
15829 @item -mlow-precision-div
15830 @itemx -mno-low-precision-div
15831 @opindex mlow-precision-div
15832 @opindex mno-low-precision-div
15833 Enable or disable the division approximation.
15834 This option only has an effect if @option{-ffast-math} or
15835 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15836 precision of division results to about 16 bits for
15837 single precision and to 32 bits for double precision.
15838
15839 @item -mtrack-speculation
15840 @itemx -mno-track-speculation
15841 Enable or disable generation of additional code to track speculative
15842 execution through conditional branches. The tracking state can then
15843 be used by the compiler when expanding calls to
15844 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15845 sequence to be generated.
15846
15847 @item -march=@var{name}
15848 @opindex march
15849 Specify the name of the target architecture and, optionally, one or
15850 more feature modifiers. This option has the form
15851 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15852
15853 The permissible values for @var{arch} are @samp{armv8-a},
15854 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15855 @samp{armv8.5-a} or @var{native}.
15856
15857 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15858 support for the ARMv8.5-A architecture extensions.
15859
15860 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15861 support for the ARMv8.4-A architecture extensions.
15862
15863 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15864 support for the ARMv8.3-A architecture extensions.
15865
15866 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15867 support for the ARMv8.2-A architecture extensions.
15868
15869 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15870 support for the ARMv8.1-A architecture extension. In particular, it
15871 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15872
15873 The value @samp{native} is available on native AArch64 GNU/Linux and
15874 causes the compiler to pick the architecture of the host system. This
15875 option has no effect if the compiler is unable to recognize the
15876 architecture of the host system,
15877
15878 The permissible values for @var{feature} are listed in the sub-section
15879 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15880 Feature Modifiers}. Where conflicting feature modifiers are
15881 specified, the right-most feature is used.
15882
15883 GCC uses @var{name} to determine what kind of instructions it can emit
15884 when generating assembly code. If @option{-march} is specified
15885 without either of @option{-mtune} or @option{-mcpu} also being
15886 specified, the code is tuned to perform well across a range of target
15887 processors implementing the target architecture.
15888
15889 @item -mtune=@var{name}
15890 @opindex mtune
15891 Specify the name of the target processor for which GCC should tune the
15892 performance of the code. Permissible values for this option are:
15893 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15894 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15895 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15896 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
15897 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
15898 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
15899 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
15900 @samp{thunderxt83}, @samp{thunderx2t99},
15901 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15902 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15903 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15904 @samp{native}.
15905
15906 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15907 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15908 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15909 should tune for a big.LITTLE system.
15910
15911 Additionally on native AArch64 GNU/Linux systems the value
15912 @samp{native} tunes performance to the host system. This option has no effect
15913 if the compiler is unable to recognize the processor of the host system.
15914
15915 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15916 are specified, the code is tuned to perform well across a range
15917 of target processors.
15918
15919 This option cannot be suffixed by feature modifiers.
15920
15921 @item -mcpu=@var{name}
15922 @opindex mcpu
15923 Specify the name of the target processor, optionally suffixed by one
15924 or more feature modifiers. This option has the form
15925 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15926 the permissible values for @var{cpu} are the same as those available
15927 for @option{-mtune}. The permissible values for @var{feature} are
15928 documented in the sub-section on
15929 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15930 Feature Modifiers}. Where conflicting feature modifiers are
15931 specified, the right-most feature is used.
15932
15933 GCC uses @var{name} to determine what kind of instructions it can emit when
15934 generating assembly code (as if by @option{-march}) and to determine
15935 the target processor for which to tune for performance (as if
15936 by @option{-mtune}). Where this option is used in conjunction
15937 with @option{-march} or @option{-mtune}, those options take precedence
15938 over the appropriate part of this option.
15939
15940 @item -moverride=@var{string}
15941 @opindex moverride
15942 Override tuning decisions made by the back-end in response to a
15943 @option{-mtune=} switch. The syntax, semantics, and accepted values
15944 for @var{string} in this option are not guaranteed to be consistent
15945 across releases.
15946
15947 This option is only intended to be useful when developing GCC.
15948
15949 @item -mverbose-cost-dump
15950 @opindex mverbose-cost-dump
15951 Enable verbose cost model dumping in the debug dump files. This option is
15952 provided for use in debugging the compiler.
15953
15954 @item -mpc-relative-literal-loads
15955 @itemx -mno-pc-relative-literal-loads
15956 @opindex mpc-relative-literal-loads
15957 @opindex mno-pc-relative-literal-loads
15958 Enable or disable PC-relative literal loads. With this option literal pools are
15959 accessed using a single instruction and emitted after each function. This
15960 limits the maximum size of functions to 1MB. This is enabled by default for
15961 @option{-mcmodel=tiny}.
15962
15963 @item -msign-return-address=@var{scope}
15964 @opindex msign-return-address
15965 Select the function scope on which return address signing will be applied.
15966 Permissible values are @samp{none}, which disables return address signing,
15967 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15968 functions, and @samp{all}, which enables pointer signing for all functions. The
15969 default value is @samp{none}. This option has been deprecated by
15970 -mbranch-protection.
15971
15972 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
15973 @opindex mbranch-protection
15974 Select the branch protection features to use.
15975 @samp{none} is the default and turns off all types of branch protection.
15976 @samp{standard} turns on all types of branch protection features. If a feature
15977 has additional tuning options, then @samp{standard} sets it to its standard
15978 level.
15979 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
15980 level: signing functions that save the return address to memory (non-leaf
15981 functions will practically always do this) using the a-key. The optional
15982 argument @samp{leaf} can be used to extend the signing to include leaf
15983 functions. The optional argument @samp{b-key} can be used to sign the functions
15984 with the B-key instead of the A-key.
15985 @samp{bti} turns on branch target identification mechanism.
15986
15987 @item -msve-vector-bits=@var{bits}
15988 @opindex msve-vector-bits
15989 Specify the number of bits in an SVE vector register. This option only has
15990 an effect when SVE is enabled.
15991
15992 GCC supports two forms of SVE code generation: ``vector-length
15993 agnostic'' output that works with any size of vector register and
15994 ``vector-length specific'' output that allows GCC to make assumptions
15995 about the vector length when it is useful for optimization reasons.
15996 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
15997 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
15998 Specifying @samp{scalable} selects vector-length agnostic
15999 output. At present @samp{-msve-vector-bits=128} also generates vector-length
16000 agnostic output. All other values generate vector-length specific code.
16001 The behavior of these values may change in future releases and no value except
16002 @samp{scalable} should be relied on for producing code that is portable across
16003 different hardware SVE vector lengths.
16004
16005 The default is @samp{-msve-vector-bits=scalable}, which produces
16006 vector-length agnostic code.
16007 @end table
16008
16009 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16010 @anchor{aarch64-feature-modifiers}
16011 @cindex @option{-march} feature modifiers
16012 @cindex @option{-mcpu} feature modifiers
16013 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16014 the following and their inverses @option{no@var{feature}}:
16015
16016 @table @samp
16017 @item crc
16018 Enable CRC extension. This is on by default for
16019 @option{-march=armv8.1-a}.
16020 @item crypto
16021 Enable Crypto extension. This also enables Advanced SIMD and floating-point
16022 instructions.
16023 @item fp
16024 Enable floating-point instructions. This is on by default for all possible
16025 values for options @option{-march} and @option{-mcpu}.
16026 @item simd
16027 Enable Advanced SIMD instructions. This also enables floating-point
16028 instructions. This is on by default for all possible values for options
16029 @option{-march} and @option{-mcpu}.
16030 @item sve
16031 Enable Scalable Vector Extension instructions. This also enables Advanced
16032 SIMD and floating-point instructions.
16033 @item lse
16034 Enable Large System Extension instructions. This is on by default for
16035 @option{-march=armv8.1-a}.
16036 @item rdma
16037 Enable Round Double Multiply Accumulate instructions. This is on by default
16038 for @option{-march=armv8.1-a}.
16039 @item fp16
16040 Enable FP16 extension. This also enables floating-point instructions.
16041 @item fp16fml
16042 Enable FP16 fmla extension. This also enables FP16 extensions and
16043 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.
16044
16045 @item rcpc
16046 Enable the RcPc extension. This does not change code generation from GCC,
16047 but is passed on to the assembler, enabling inline asm statements to use
16048 instructions from the RcPc extension.
16049 @item dotprod
16050 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16051 @item aes
16052 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
16053 SIMD instructions.
16054 @item sha2
16055 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
16056 @item sha3
16057 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
16058 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16059 @item sm4
16060 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
16061 Use of this option with architectures prior to Armv8.2-A is not supported.
16062 @item profile
16063 Enable the Statistical Profiling extension. This option is only to enable the
16064 extension at the assembler level and does not affect code generation.
16065 @item rng
16066 Enable the Armv8.5-a Random Number instructions. This option is only to
16067 enable the extension at the assembler level and does not affect code
16068 generation.
16069 @item memtag
16070 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16071 enable the extension at the assembler level and does not affect code
16072 generation.
16073 @item sb
16074 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16075 enable the extension at the assembler level and does not affect code
16076 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16077 @item ssbs
16078 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16079 is only to enable the extension at the assembler level and does not affect code
16080 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16081 @item predres
16082 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16083 This option is only to enable the extension at the assembler level and does
16084 not affect code generation. This option is enabled by default for
16085 @item sve2
16086 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16087 instructions.
16088 @item sve2-bitperm
16089 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16090 @item sve2-sm4
16091 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16092 @item sve2-aes
16093 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16094 @item sve2-sha3
16095 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16096 @option{-march=armv8.5-a}.
16097
16098 @end table
16099
16100 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16101 which implies @option{fp}.
16102 Conversely, @option{nofp} implies @option{nosimd}, which implies
16103 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16104
16105 @node Adapteva Epiphany Options
16106 @subsection Adapteva Epiphany Options
16107
16108 These @samp{-m} options are defined for Adapteva Epiphany:
16109
16110 @table @gcctabopt
16111 @item -mhalf-reg-file
16112 @opindex mhalf-reg-file
16113 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16114 That allows code to run on hardware variants that lack these registers.
16115
16116 @item -mprefer-short-insn-regs
16117 @opindex mprefer-short-insn-regs
16118 Preferentially allocate registers that allow short instruction generation.
16119 This can result in increased instruction count, so this may either reduce or
16120 increase overall code size.
16121
16122 @item -mbranch-cost=@var{num}
16123 @opindex mbranch-cost
16124 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16125 This cost is only a heuristic and is not guaranteed to produce
16126 consistent results across releases.
16127
16128 @item -mcmove
16129 @opindex mcmove
16130 Enable the generation of conditional moves.
16131
16132 @item -mnops=@var{num}
16133 @opindex mnops
16134 Emit @var{num} NOPs before every other generated instruction.
16135
16136 @item -mno-soft-cmpsf
16137 @opindex mno-soft-cmpsf
16138 @opindex msoft-cmpsf
16139 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16140 and test the flags. This is faster than a software comparison, but can
16141 get incorrect results in the presence of NaNs, or when two different small
16142 numbers are compared such that their difference is calculated as zero.
16143 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16144 software comparisons.
16145
16146 @item -mstack-offset=@var{num}
16147 @opindex mstack-offset
16148 Set the offset between the top of the stack and the stack pointer.
16149 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16150 can be used by leaf functions without stack allocation.
16151 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16152 Note also that this option changes the ABI; compiling a program with a
16153 different stack offset than the libraries have been compiled with
16154 generally does not work.
16155 This option can be useful if you want to evaluate if a different stack
16156 offset would give you better code, but to actually use a different stack
16157 offset to build working programs, it is recommended to configure the
16158 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16159
16160 @item -mno-round-nearest
16161 @opindex mno-round-nearest
16162 @opindex mround-nearest
16163 Make the scheduler assume that the rounding mode has been set to
16164 truncating. The default is @option{-mround-nearest}.
16165
16166 @item -mlong-calls
16167 @opindex mlong-calls
16168 If not otherwise specified by an attribute, assume all calls might be beyond
16169 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16170 function address into a register before performing a (otherwise direct) call.
16171 This is the default.
16172
16173 @item -mshort-calls
16174 @opindex short-calls
16175 If not otherwise specified by an attribute, assume all direct calls are
16176 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16177 for direct calls. The default is @option{-mlong-calls}.
16178
16179 @item -msmall16
16180 @opindex msmall16
16181 Assume addresses can be loaded as 16-bit unsigned values. This does not
16182 apply to function addresses for which @option{-mlong-calls} semantics
16183 are in effect.
16184
16185 @item -mfp-mode=@var{mode}
16186 @opindex mfp-mode
16187 Set the prevailing mode of the floating-point unit.
16188 This determines the floating-point mode that is provided and expected
16189 at function call and return time. Making this mode match the mode you
16190 predominantly need at function start can make your programs smaller and
16191 faster by avoiding unnecessary mode switches.
16192
16193 @var{mode} can be set to one the following values:
16194
16195 @table @samp
16196 @item caller
16197 Any mode at function entry is valid, and retained or restored when
16198 the function returns, and when it calls other functions.
16199 This mode is useful for compiling libraries or other compilation units
16200 you might want to incorporate into different programs with different
16201 prevailing FPU modes, and the convenience of being able to use a single
16202 object file outweighs the size and speed overhead for any extra
16203 mode switching that might be needed, compared with what would be needed
16204 with a more specific choice of prevailing FPU mode.
16205
16206 @item truncate
16207 This is the mode used for floating-point calculations with
16208 truncating (i.e.@: round towards zero) rounding mode. That includes
16209 conversion from floating point to integer.
16210
16211 @item round-nearest
16212 This is the mode used for floating-point calculations with
16213 round-to-nearest-or-even rounding mode.
16214
16215 @item int
16216 This is the mode used to perform integer calculations in the FPU, e.g.@:
16217 integer multiply, or integer multiply-and-accumulate.
16218 @end table
16219
16220 The default is @option{-mfp-mode=caller}
16221
16222 @item -mno-split-lohi
16223 @itemx -mno-postinc
16224 @itemx -mno-postmodify
16225 @opindex mno-split-lohi
16226 @opindex msplit-lohi
16227 @opindex mno-postinc
16228 @opindex mpostinc
16229 @opindex mno-postmodify
16230 @opindex mpostmodify
16231 Code generation tweaks that disable, respectively, splitting of 32-bit
16232 loads, generation of post-increment addresses, and generation of
16233 post-modify addresses. The defaults are @option{msplit-lohi},
16234 @option{-mpost-inc}, and @option{-mpost-modify}.
16235
16236 @item -mnovect-double
16237 @opindex mno-vect-double
16238 @opindex mvect-double
16239 Change the preferred SIMD mode to SImode. The default is
16240 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16241
16242 @item -max-vect-align=@var{num}
16243 @opindex max-vect-align
16244 The maximum alignment for SIMD vector mode types.
16245 @var{num} may be 4 or 8. The default is 8.
16246 Note that this is an ABI change, even though many library function
16247 interfaces are unaffected if they don't use SIMD vector modes
16248 in places that affect size and/or alignment of relevant types.
16249
16250 @item -msplit-vecmove-early
16251 @opindex msplit-vecmove-early
16252 Split vector moves into single word moves before reload. In theory this
16253 can give better register allocation, but so far the reverse seems to be
16254 generally the case.
16255
16256 @item -m1reg-@var{reg}
16257 @opindex m1reg-
16258 Specify a register to hold the constant @minus{}1, which makes loading small negative
16259 constants and certain bitmasks faster.
16260 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16261 which specify use of that register as a fixed register,
16262 and @samp{none}, which means that no register is used for this
16263 purpose. The default is @option{-m1reg-none}.
16264
16265 @end table
16266
16267 @node AMD GCN Options
16268 @subsection AMD GCN Options
16269 @cindex AMD GCN Options
16270
16271 These options are defined specifically for the AMD GCN port.
16272
16273 @table @gcctabopt
16274
16275 @item -march=@var{gpu}
16276 @opindex march
16277 @itemx -mtune=@var{gpu}
16278 @opindex mtune
16279 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16280 are
16281
16282 @table @samp
16283 @opindex fiji
16284 @item fiji
16285 Compile for GCN3 Fiji devices (gfx803).
16286
16287 @item gfx900
16288 Compile for GCN5 Vega 10 devices (gfx900).
16289
16290 @item gfx906
16291 Compile for GCN5 Vega 20 devices (gfx906).
16292
16293 @end table
16294
16295 @item -mstack-size=@var{bytes}
16296 @opindex mstack-size
16297 Specify how many @var{bytes} of stack space will be requested for each GPU
16298 thread (wave-front). Beware that there may be many threads and limited memory
16299 available. The size of the stack allocation may also have an impact on
16300 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16301 1MB otherwise.
16302
16303 @end table
16304
16305 @node ARC Options
16306 @subsection ARC Options
16307 @cindex ARC options
16308
16309 The following options control the architecture variant for which code
16310 is being compiled:
16311
16312 @c architecture variants
16313 @table @gcctabopt
16314
16315 @item -mbarrel-shifter
16316 @opindex mbarrel-shifter
16317 Generate instructions supported by barrel shifter. This is the default
16318 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16319
16320 @item -mjli-always
16321 @opindex mjli-alawys
16322 Force to call a function using jli_s instruction. This option is
16323 valid only for ARCv2 architecture.
16324
16325 @item -mcpu=@var{cpu}
16326 @opindex mcpu
16327 Set architecture type, register usage, and instruction scheduling
16328 parameters for @var{cpu}. There are also shortcut alias options
16329 available for backward compatibility and convenience. Supported
16330 values for @var{cpu} are
16331
16332 @table @samp
16333 @opindex mA6
16334 @opindex mARC600
16335 @item arc600
16336 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16337
16338 @item arc601
16339 @opindex mARC601
16340 Compile for ARC601. Alias: @option{-mARC601}.
16341
16342 @item arc700
16343 @opindex mA7
16344 @opindex mARC700
16345 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16346 This is the default when configured with @option{--with-cpu=arc700}@.
16347
16348 @item arcem
16349 Compile for ARC EM.
16350
16351 @item archs
16352 Compile for ARC HS.
16353
16354 @item em
16355 Compile for ARC EM CPU with no hardware extensions.
16356
16357 @item em4
16358 Compile for ARC EM4 CPU.
16359
16360 @item em4_dmips
16361 Compile for ARC EM4 DMIPS CPU.
16362
16363 @item em4_fpus
16364 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16365 extension.
16366
16367 @item em4_fpuda
16368 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16369 double assist instructions.
16370
16371 @item hs
16372 Compile for ARC HS CPU with no hardware extensions except the atomic
16373 instructions.
16374
16375 @item hs34
16376 Compile for ARC HS34 CPU.
16377
16378 @item hs38
16379 Compile for ARC HS38 CPU.
16380
16381 @item hs38_linux
16382 Compile for ARC HS38 CPU with all hardware extensions on.
16383
16384 @item arc600_norm
16385 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16386
16387 @item arc600_mul32x16
16388 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16389 instructions enabled.
16390
16391 @item arc600_mul64
16392 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16393 instructions enabled.
16394
16395 @item arc601_norm
16396 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16397
16398 @item arc601_mul32x16
16399 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16400 instructions enabled.
16401
16402 @item arc601_mul64
16403 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16404 instructions enabled.
16405
16406 @item nps400
16407 Compile for ARC 700 on NPS400 chip.
16408
16409 @item em_mini
16410 Compile for ARC EM minimalist configuration featuring reduced register
16411 set.
16412
16413 @end table
16414
16415 @item -mdpfp
16416 @opindex mdpfp
16417 @itemx -mdpfp-compact
16418 @opindex mdpfp-compact
16419 Generate double-precision FPX instructions, tuned for the compact
16420 implementation.
16421
16422 @item -mdpfp-fast
16423 @opindex mdpfp-fast
16424 Generate double-precision FPX instructions, tuned for the fast
16425 implementation.
16426
16427 @item -mno-dpfp-lrsr
16428 @opindex mno-dpfp-lrsr
16429 Disable @code{lr} and @code{sr} instructions from using FPX extension
16430 aux registers.
16431
16432 @item -mea
16433 @opindex mea
16434 Generate extended arithmetic instructions. Currently only
16435 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16436 supported. This is always enabled for @option{-mcpu=ARC700}.
16437
16438 @item -mno-mpy
16439 @opindex mno-mpy
16440 @opindex mmpy
16441 Do not generate @code{mpy}-family instructions for ARC700. This option is
16442 deprecated.
16443
16444 @item -mmul32x16
16445 @opindex mmul32x16
16446 Generate 32x16-bit multiply and multiply-accumulate instructions.
16447
16448 @item -mmul64
16449 @opindex mmul64
16450 Generate @code{mul64} and @code{mulu64} instructions.
16451 Only valid for @option{-mcpu=ARC600}.
16452
16453 @item -mnorm
16454 @opindex mnorm
16455 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16456 is in effect.
16457
16458 @item -mspfp
16459 @opindex mspfp
16460 @itemx -mspfp-compact
16461 @opindex mspfp-compact
16462 Generate single-precision FPX instructions, tuned for the compact
16463 implementation.
16464
16465 @item -mspfp-fast
16466 @opindex mspfp-fast
16467 Generate single-precision FPX instructions, tuned for the fast
16468 implementation.
16469
16470 @item -msimd
16471 @opindex msimd
16472 Enable generation of ARC SIMD instructions via target-specific
16473 builtins. Only valid for @option{-mcpu=ARC700}.
16474
16475 @item -msoft-float
16476 @opindex msoft-float
16477 This option ignored; it is provided for compatibility purposes only.
16478 Software floating-point code is emitted by default, and this default
16479 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16480 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16481 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16482
16483 @item -mswap
16484 @opindex mswap
16485 Generate @code{swap} instructions.
16486
16487 @item -matomic
16488 @opindex matomic
16489 This enables use of the locked load/store conditional extension to implement
16490 atomic memory built-in functions. Not available for ARC 6xx or ARC
16491 EM cores.
16492
16493 @item -mdiv-rem
16494 @opindex mdiv-rem
16495 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16496
16497 @item -mcode-density
16498 @opindex mcode-density
16499 Enable code density instructions for ARC EM.
16500 This option is on by default for ARC HS.
16501
16502 @item -mll64
16503 @opindex mll64
16504 Enable double load/store operations for ARC HS cores.
16505
16506 @item -mtp-regno=@var{regno}
16507 @opindex mtp-regno
16508 Specify thread pointer register number.
16509
16510 @item -mmpy-option=@var{multo}
16511 @opindex mmpy-option
16512 Compile ARCv2 code with a multiplier design option. You can specify
16513 the option using either a string or numeric value for @var{multo}.
16514 @samp{wlh1} is the default value. The recognized values are:
16515
16516 @table @samp
16517 @item 0
16518 @itemx none
16519 No multiplier available.
16520
16521 @item 1
16522 @itemx w
16523 16x16 multiplier, fully pipelined.
16524 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16525
16526 @item 2
16527 @itemx wlh1
16528 32x32 multiplier, fully
16529 pipelined (1 stage). The following instructions are additionally
16530 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16531
16532 @item 3
16533 @itemx wlh2
16534 32x32 multiplier, fully pipelined
16535 (2 stages). The following instructions are additionally enabled: @code{mpy},
16536 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16537
16538 @item 4
16539 @itemx wlh3
16540 Two 16x16 multipliers, blocking,
16541 sequential. The following instructions are additionally enabled: @code{mpy},
16542 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16543
16544 @item 5
16545 @itemx wlh4
16546 One 16x16 multiplier, blocking,
16547 sequential. The following instructions are additionally enabled: @code{mpy},
16548 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16549
16550 @item 6
16551 @itemx wlh5
16552 One 32x4 multiplier, blocking,
16553 sequential. The following instructions are additionally enabled: @code{mpy},
16554 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16555
16556 @item 7
16557 @itemx plus_dmpy
16558 ARC HS SIMD support.
16559
16560 @item 8
16561 @itemx plus_macd
16562 ARC HS SIMD support.
16563
16564 @item 9
16565 @itemx plus_qmacw
16566 ARC HS SIMD support.
16567
16568 @end table
16569
16570 This option is only available for ARCv2 cores@.
16571
16572 @item -mfpu=@var{fpu}
16573 @opindex mfpu
16574 Enables support for specific floating-point hardware extensions for ARCv2
16575 cores. Supported values for @var{fpu} are:
16576
16577 @table @samp
16578
16579 @item fpus
16580 Enables support for single-precision floating-point hardware
16581 extensions@.
16582
16583 @item fpud
16584 Enables support for double-precision floating-point hardware
16585 extensions. The single-precision floating-point extension is also
16586 enabled. Not available for ARC EM@.
16587
16588 @item fpuda
16589 Enables support for double-precision floating-point hardware
16590 extensions using double-precision assist instructions. The single-precision
16591 floating-point extension is also enabled. This option is
16592 only available for ARC EM@.
16593
16594 @item fpuda_div
16595 Enables support for double-precision floating-point hardware
16596 extensions using double-precision assist instructions.
16597 The single-precision floating-point, square-root, and divide
16598 extensions are also enabled. This option is
16599 only available for ARC EM@.
16600
16601 @item fpuda_fma
16602 Enables support for double-precision floating-point hardware
16603 extensions using double-precision assist instructions.
16604 The single-precision floating-point and fused multiply and add
16605 hardware extensions are also enabled. This option is
16606 only available for ARC EM@.
16607
16608 @item fpuda_all
16609 Enables support for double-precision floating-point hardware
16610 extensions using double-precision assist instructions.
16611 All single-precision floating-point hardware extensions are also
16612 enabled. This option is only available for ARC EM@.
16613
16614 @item fpus_div
16615 Enables support for single-precision floating-point, square-root and divide
16616 hardware extensions@.
16617
16618 @item fpud_div
16619 Enables support for double-precision floating-point, square-root and divide
16620 hardware extensions. This option
16621 includes option @samp{fpus_div}. Not available for ARC EM@.
16622
16623 @item fpus_fma
16624 Enables support for single-precision floating-point and
16625 fused multiply and add hardware extensions@.
16626
16627 @item fpud_fma
16628 Enables support for double-precision floating-point and
16629 fused multiply and add hardware extensions. This option
16630 includes option @samp{fpus_fma}. Not available for ARC EM@.
16631
16632 @item fpus_all
16633 Enables support for all single-precision floating-point hardware
16634 extensions@.
16635
16636 @item fpud_all
16637 Enables support for all single- and double-precision floating-point
16638 hardware extensions. Not available for ARC EM@.
16639
16640 @end table
16641
16642 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16643 @opindex mirq-ctrl-saved
16644 Specifies general-purposes registers that the processor automatically
16645 saves/restores on interrupt entry and exit. @var{register-range} is
16646 specified as two registers separated by a dash. The register range
16647 always starts with @code{r0}, the upper limit is @code{fp} register.
16648 @var{blink} and @var{lp_count} are optional. This option is only
16649 valid for ARC EM and ARC HS cores.
16650
16651 @item -mrgf-banked-regs=@var{number}
16652 @opindex mrgf-banked-regs
16653 Specifies the number of registers replicated in second register bank
16654 on entry to fast interrupt. Fast interrupts are interrupts with the
16655 highest priority level P0. These interrupts save only PC and STATUS32
16656 registers to avoid memory transactions during interrupt entry and exit
16657 sequences. Use this option when you are using fast interrupts in an
16658 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16659
16660 @item -mlpc-width=@var{width}
16661 @opindex mlpc-width
16662 Specify the width of the @code{lp_count} register. Valid values for
16663 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16664 fixed to 32 bits. If the width is less than 32, the compiler does not
16665 attempt to transform loops in your program to use the zero-delay loop
16666 mechanism unless it is known that the @code{lp_count} register can
16667 hold the required loop-counter value. Depending on the width
16668 specified, the compiler and run-time library might continue to use the
16669 loop mechanism for various needs. This option defines macro
16670 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16671
16672 @item -mrf16
16673 @opindex mrf16
16674 This option instructs the compiler to generate code for a 16-entry
16675 register file. This option defines the @code{__ARC_RF16__}
16676 preprocessor macro.
16677
16678 @item -mbranch-index
16679 @opindex mbranch-index
16680 Enable use of @code{bi} or @code{bih} instructions to implement jump
16681 tables.
16682
16683 @end table
16684
16685 The following options are passed through to the assembler, and also
16686 define preprocessor macro symbols.
16687
16688 @c Flags used by the assembler, but for which we define preprocessor
16689 @c macro symbols as well.
16690 @table @gcctabopt
16691 @item -mdsp-packa
16692 @opindex mdsp-packa
16693 Passed down to the assembler to enable the DSP Pack A extensions.
16694 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16695 deprecated.
16696
16697 @item -mdvbf
16698 @opindex mdvbf
16699 Passed down to the assembler to enable the dual Viterbi butterfly
16700 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16701 option is deprecated.
16702
16703 @c ARC700 4.10 extension instruction
16704 @item -mlock
16705 @opindex mlock
16706 Passed down to the assembler to enable the locked load/store
16707 conditional extension. Also sets the preprocessor symbol
16708 @code{__Xlock}.
16709
16710 @item -mmac-d16
16711 @opindex mmac-d16
16712 Passed down to the assembler. Also sets the preprocessor symbol
16713 @code{__Xxmac_d16}. This option is deprecated.
16714
16715 @item -mmac-24
16716 @opindex mmac-24
16717 Passed down to the assembler. Also sets the preprocessor symbol
16718 @code{__Xxmac_24}. This option is deprecated.
16719
16720 @c ARC700 4.10 extension instruction
16721 @item -mrtsc
16722 @opindex mrtsc
16723 Passed down to the assembler to enable the 64-bit time-stamp counter
16724 extension instruction. Also sets the preprocessor symbol
16725 @code{__Xrtsc}. This option is deprecated.
16726
16727 @c ARC700 4.10 extension instruction
16728 @item -mswape
16729 @opindex mswape
16730 Passed down to the assembler to enable the swap byte ordering
16731 extension instruction. Also sets the preprocessor symbol
16732 @code{__Xswape}.
16733
16734 @item -mtelephony
16735 @opindex mtelephony
16736 Passed down to the assembler to enable dual- and single-operand
16737 instructions for telephony. Also sets the preprocessor symbol
16738 @code{__Xtelephony}. This option is deprecated.
16739
16740 @item -mxy
16741 @opindex mxy
16742 Passed down to the assembler to enable the XY memory extension. Also
16743 sets the preprocessor symbol @code{__Xxy}.
16744
16745 @end table
16746
16747 The following options control how the assembly code is annotated:
16748
16749 @c Assembly annotation options
16750 @table @gcctabopt
16751 @item -misize
16752 @opindex misize
16753 Annotate assembler instructions with estimated addresses.
16754
16755 @item -mannotate-align
16756 @opindex mannotate-align
16757 Explain what alignment considerations lead to the decision to make an
16758 instruction short or long.
16759
16760 @end table
16761
16762 The following options are passed through to the linker:
16763
16764 @c options passed through to the linker
16765 @table @gcctabopt
16766 @item -marclinux
16767 @opindex marclinux
16768 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16769 This option is enabled by default in tool chains built for
16770 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16771 when profiling is not requested.
16772
16773 @item -marclinux_prof
16774 @opindex marclinux_prof
16775 Passed through to the linker, to specify use of the
16776 @code{arclinux_prof} emulation. This option is enabled by default in
16777 tool chains built for @w{@code{arc-linux-uclibc}} and
16778 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16779
16780 @end table
16781
16782 The following options control the semantics of generated code:
16783
16784 @c semantically relevant code generation options
16785 @table @gcctabopt
16786 @item -mlong-calls
16787 @opindex mlong-calls
16788 Generate calls as register indirect calls, thus providing access
16789 to the full 32-bit address range.
16790
16791 @item -mmedium-calls
16792 @opindex mmedium-calls
16793 Don't use less than 25-bit addressing range for calls, which is the
16794 offset available for an unconditional branch-and-link
16795 instruction. Conditional execution of function calls is suppressed, to
16796 allow use of the 25-bit range, rather than the 21-bit range with
16797 conditional branch-and-link. This is the default for tool chains built
16798 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16799
16800 @item -G @var{num}
16801 @opindex G
16802 Put definitions of externally-visible data in a small data section if
16803 that data is no bigger than @var{num} bytes. The default value of
16804 @var{num} is 4 for any ARC configuration, or 8 when we have double
16805 load/store operations.
16806
16807 @item -mno-sdata
16808 @opindex mno-sdata
16809 @opindex msdata
16810 Do not generate sdata references. This is the default for tool chains
16811 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16812 targets.
16813
16814 @item -mvolatile-cache
16815 @opindex mvolatile-cache
16816 Use ordinarily cached memory accesses for volatile references. This is the
16817 default.
16818
16819 @item -mno-volatile-cache
16820 @opindex mno-volatile-cache
16821 @opindex mvolatile-cache
16822 Enable cache bypass for volatile references.
16823
16824 @end table
16825
16826 The following options fine tune code generation:
16827 @c code generation tuning options
16828 @table @gcctabopt
16829 @item -malign-call
16830 @opindex malign-call
16831 Do alignment optimizations for call instructions.
16832
16833 @item -mauto-modify-reg
16834 @opindex mauto-modify-reg
16835 Enable the use of pre/post modify with register displacement.
16836
16837 @item -mbbit-peephole
16838 @opindex mbbit-peephole
16839 Enable bbit peephole2.
16840
16841 @item -mno-brcc
16842 @opindex mno-brcc
16843 This option disables a target-specific pass in @file{arc_reorg} to
16844 generate compare-and-branch (@code{br@var{cc}}) instructions.
16845 It has no effect on
16846 generation of these instructions driven by the combiner pass.
16847
16848 @item -mcase-vector-pcrel
16849 @opindex mcase-vector-pcrel
16850 Use PC-relative switch case tables to enable case table shortening.
16851 This is the default for @option{-Os}.
16852
16853 @item -mcompact-casesi
16854 @opindex mcompact-casesi
16855 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16856 and only available for ARCv1 cores. This option is deprecated.
16857
16858 @item -mno-cond-exec
16859 @opindex mno-cond-exec
16860 Disable the ARCompact-specific pass to generate conditional
16861 execution instructions.
16862
16863 Due to delay slot scheduling and interactions between operand numbers,
16864 literal sizes, instruction lengths, and the support for conditional execution,
16865 the target-independent pass to generate conditional execution is often lacking,
16866 so the ARC port has kept a special pass around that tries to find more
16867 conditional execution generation opportunities after register allocation,
16868 branch shortening, and delay slot scheduling have been done. This pass
16869 generally, but not always, improves performance and code size, at the cost of
16870 extra compilation time, which is why there is an option to switch it off.
16871 If you have a problem with call instructions exceeding their allowable
16872 offset range because they are conditionalized, you should consider using
16873 @option{-mmedium-calls} instead.
16874
16875 @item -mearly-cbranchsi
16876 @opindex mearly-cbranchsi
16877 Enable pre-reload use of the @code{cbranchsi} pattern.
16878
16879 @item -mexpand-adddi
16880 @opindex mexpand-adddi
16881 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16882 @code{add.f}, @code{adc} etc. This option is deprecated.
16883
16884 @item -mindexed-loads
16885 @opindex mindexed-loads
16886 Enable the use of indexed loads. This can be problematic because some
16887 optimizers then assume that indexed stores exist, which is not
16888 the case.
16889
16890 @item -mlra
16891 @opindex mlra
16892 Enable Local Register Allocation. This is still experimental for ARC,
16893 so by default the compiler uses standard reload
16894 (i.e.@: @option{-mno-lra}).
16895
16896 @item -mlra-priority-none
16897 @opindex mlra-priority-none
16898 Don't indicate any priority for target registers.
16899
16900 @item -mlra-priority-compact
16901 @opindex mlra-priority-compact
16902 Indicate target register priority for r0..r3 / r12..r15.
16903
16904 @item -mlra-priority-noncompact
16905 @opindex mlra-priority-noncompact
16906 Reduce target register priority for r0..r3 / r12..r15.
16907
16908 @item -mmillicode
16909 @opindex mmillicode
16910 When optimizing for size (using @option{-Os}), prologues and epilogues
16911 that have to save or restore a large number of registers are often
16912 shortened by using call to a special function in libgcc; this is
16913 referred to as a @emph{millicode} call. As these calls can pose
16914 performance issues, and/or cause linking issues when linking in a
16915 nonstandard way, this option is provided to turn on or off millicode
16916 call generation.
16917
16918 @item -mcode-density-frame
16919 @opindex mcode-density-frame
16920 This option enable the compiler to emit @code{enter} and @code{leave}
16921 instructions. These instructions are only valid for CPUs with
16922 code-density feature.
16923
16924 @item -mmixed-code
16925 @opindex mmixed-code
16926 Tweak register allocation to help 16-bit instruction generation.
16927 This generally has the effect of decreasing the average instruction size
16928 while increasing the instruction count.
16929
16930 @item -mq-class
16931 @opindex mq-class
16932 Enable @samp{q} instruction alternatives.
16933 This is the default for @option{-Os}.
16934
16935 @item -mRcq
16936 @opindex mRcq
16937 Enable @samp{Rcq} constraint handling.
16938 Most short code generation depends on this.
16939 This is the default.
16940
16941 @item -mRcw
16942 @opindex mRcw
16943 Enable @samp{Rcw} constraint handling.
16944 Most ccfsm condexec mostly depends on this.
16945 This is the default.
16946
16947 @item -msize-level=@var{level}
16948 @opindex msize-level
16949 Fine-tune size optimization with regards to instruction lengths and alignment.
16950 The recognized values for @var{level} are:
16951 @table @samp
16952 @item 0
16953 No size optimization. This level is deprecated and treated like @samp{1}.
16954
16955 @item 1
16956 Short instructions are used opportunistically.
16957
16958 @item 2
16959 In addition, alignment of loops and of code after barriers are dropped.
16960
16961 @item 3
16962 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16963
16964 @end table
16965
16966 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16967 the behavior when this is not set is equivalent to level @samp{1}.
16968
16969 @item -mtune=@var{cpu}
16970 @opindex mtune
16971 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16972 by @option{-mcpu=}.
16973
16974 Supported values for @var{cpu} are
16975
16976 @table @samp
16977 @item ARC600
16978 Tune for ARC600 CPU.
16979
16980 @item ARC601
16981 Tune for ARC601 CPU.
16982
16983 @item ARC700
16984 Tune for ARC700 CPU with standard multiplier block.
16985
16986 @item ARC700-xmac
16987 Tune for ARC700 CPU with XMAC block.
16988
16989 @item ARC725D
16990 Tune for ARC725D CPU.
16991
16992 @item ARC750D
16993 Tune for ARC750D CPU.
16994
16995 @end table
16996
16997 @item -mmultcost=@var{num}
16998 @opindex mmultcost
16999 Cost to assume for a multiply instruction, with @samp{4} being equal to a
17000 normal instruction.
17001
17002 @item -munalign-prob-threshold=@var{probability}
17003 @opindex munalign-prob-threshold
17004 Set probability threshold for unaligning branches.
17005 When tuning for @samp{ARC700} and optimizing for speed, branches without
17006 filled delay slot are preferably emitted unaligned and long, unless
17007 profiling indicates that the probability for the branch to be taken
17008 is below @var{probability}. @xref{Cross-profiling}.
17009 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
17010
17011 @end table
17012
17013 The following options are maintained for backward compatibility, but
17014 are now deprecated and will be removed in a future release:
17015
17016 @c Deprecated options
17017 @table @gcctabopt
17018
17019 @item -margonaut
17020 @opindex margonaut
17021 Obsolete FPX.
17022
17023 @item -mbig-endian
17024 @opindex mbig-endian
17025 @itemx -EB
17026 @opindex EB
17027 Compile code for big-endian targets. Use of these options is now
17028 deprecated. Big-endian code is supported by configuring GCC to build
17029 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17030 for which big endian is the default.
17031
17032 @item -mlittle-endian
17033 @opindex mlittle-endian
17034 @itemx -EL
17035 @opindex EL
17036 Compile code for little-endian targets. Use of these options is now
17037 deprecated. Little-endian code is supported by configuring GCC to build
17038 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17039 for which little endian is the default.
17040
17041 @item -mbarrel_shifter
17042 @opindex mbarrel_shifter
17043 Replaced by @option{-mbarrel-shifter}.
17044
17045 @item -mdpfp_compact
17046 @opindex mdpfp_compact
17047 Replaced by @option{-mdpfp-compact}.
17048
17049 @item -mdpfp_fast
17050 @opindex mdpfp_fast
17051 Replaced by @option{-mdpfp-fast}.
17052
17053 @item -mdsp_packa
17054 @opindex mdsp_packa
17055 Replaced by @option{-mdsp-packa}.
17056
17057 @item -mEA
17058 @opindex mEA
17059 Replaced by @option{-mea}.
17060
17061 @item -mmac_24
17062 @opindex mmac_24
17063 Replaced by @option{-mmac-24}.
17064
17065 @item -mmac_d16
17066 @opindex mmac_d16
17067 Replaced by @option{-mmac-d16}.
17068
17069 @item -mspfp_compact
17070 @opindex mspfp_compact
17071 Replaced by @option{-mspfp-compact}.
17072
17073 @item -mspfp_fast
17074 @opindex mspfp_fast
17075 Replaced by @option{-mspfp-fast}.
17076
17077 @item -mtune=@var{cpu}
17078 @opindex mtune
17079 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17080 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17081 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17082
17083 @item -multcost=@var{num}
17084 @opindex multcost
17085 Replaced by @option{-mmultcost}.
17086
17087 @end table
17088
17089 @node ARM Options
17090 @subsection ARM Options
17091 @cindex ARM options
17092
17093 These @samp{-m} options are defined for the ARM port:
17094
17095 @table @gcctabopt
17096 @item -mabi=@var{name}
17097 @opindex mabi
17098 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17099 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17100
17101 @item -mapcs-frame
17102 @opindex mapcs-frame
17103 Generate a stack frame that is compliant with the ARM Procedure Call
17104 Standard for all functions, even if this is not strictly necessary for
17105 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17106 with this option causes the stack frames not to be generated for
17107 leaf functions. The default is @option{-mno-apcs-frame}.
17108 This option is deprecated.
17109
17110 @item -mapcs
17111 @opindex mapcs
17112 This is a synonym for @option{-mapcs-frame} and is deprecated.
17113
17114 @ignore
17115 @c not currently implemented
17116 @item -mapcs-stack-check
17117 @opindex mapcs-stack-check
17118 Generate code to check the amount of stack space available upon entry to
17119 every function (that actually uses some stack space). If there is
17120 insufficient space available then either the function
17121 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17122 called, depending upon the amount of stack space required. The runtime
17123 system is required to provide these functions. The default is
17124 @option{-mno-apcs-stack-check}, since this produces smaller code.
17125
17126 @c not currently implemented
17127 @item -mapcs-reentrant
17128 @opindex mapcs-reentrant
17129 Generate reentrant, position-independent code. The default is
17130 @option{-mno-apcs-reentrant}.
17131 @end ignore
17132
17133 @item -mthumb-interwork
17134 @opindex mthumb-interwork
17135 Generate code that supports calling between the ARM and Thumb
17136 instruction sets. Without this option, on pre-v5 architectures, the
17137 two instruction sets cannot be reliably used inside one program. The
17138 default is @option{-mno-thumb-interwork}, since slightly larger code
17139 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17140 configurations this option is meaningless.
17141
17142 @item -mno-sched-prolog
17143 @opindex mno-sched-prolog
17144 @opindex msched-prolog
17145 Prevent the reordering of instructions in the function prologue, or the
17146 merging of those instruction with the instructions in the function's
17147 body. This means that all functions start with a recognizable set
17148 of instructions (or in fact one of a choice from a small set of
17149 different function prologues), and this information can be used to
17150 locate the start of functions inside an executable piece of code. The
17151 default is @option{-msched-prolog}.
17152
17153 @item -mfloat-abi=@var{name}
17154 @opindex mfloat-abi
17155 Specifies which floating-point ABI to use. Permissible values
17156 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17157
17158 Specifying @samp{soft} causes GCC to generate output containing
17159 library calls for floating-point operations.
17160 @samp{softfp} allows the generation of code using hardware floating-point
17161 instructions, but still uses the soft-float calling conventions.
17162 @samp{hard} allows generation of floating-point instructions
17163 and uses FPU-specific calling conventions.
17164
17165 The default depends on the specific target configuration. Note that
17166 the hard-float and soft-float ABIs are not link-compatible; you must
17167 compile your entire program with the same ABI, and link with a
17168 compatible set of libraries.
17169
17170 @item -mgeneral-regs-only
17171 @opindex mgeneral-regs-only
17172 Generate code which uses only the general-purpose registers. This will prevent
17173 the compiler from using floating-point and Advanced SIMD registers but will not
17174 impose any restrictions on the assembler.
17175
17176 @item -mlittle-endian
17177 @opindex mlittle-endian
17178 Generate code for a processor running in little-endian mode. This is
17179 the default for all standard configurations.
17180
17181 @item -mbig-endian
17182 @opindex mbig-endian
17183 Generate code for a processor running in big-endian mode; the default is
17184 to compile code for a little-endian processor.
17185
17186 @item -mbe8
17187 @itemx -mbe32
17188 @opindex mbe8
17189 When linking a big-endian image select between BE8 and BE32 formats.
17190 The option has no effect for little-endian images and is ignored. The
17191 default is dependent on the selected target architecture. For ARMv6
17192 and later architectures the default is BE8, for older architectures
17193 the default is BE32. BE32 format has been deprecated by ARM.
17194
17195 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17196 @opindex march
17197 This specifies the name of the target ARM architecture. GCC uses this
17198 name to determine what kind of instructions it can emit when generating
17199 assembly code. This option can be used in conjunction with or instead
17200 of the @option{-mcpu=} option.
17201
17202 Permissible names are:
17203 @samp{armv4t},
17204 @samp{armv5t}, @samp{armv5te},
17205 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17206 @samp{armv6z}, @samp{armv6zk},
17207 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17208 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17209 @samp{armv8.4-a},
17210 @samp{armv8.5-a},
17211 @samp{armv7-r},
17212 @samp{armv8-r},
17213 @samp{armv6-m}, @samp{armv6s-m},
17214 @samp{armv7-m}, @samp{armv7e-m},
17215 @samp{armv8-m.base}, @samp{armv8-m.main},
17216 @samp{iwmmxt} and @samp{iwmmxt2}.
17217
17218 Additionally, the following architectures, which lack support for the
17219 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17220
17221 Many of the architectures support extensions. These can be added by
17222 appending @samp{+@var{extension}} to the architecture name. Extension
17223 options are processed in order and capabilities accumulate. An extension
17224 will also enable any necessary base extensions
17225 upon which it depends. For example, the @samp{+crypto} extension
17226 will always enable the @samp{+simd} extension. The exception to the
17227 additive construction is for extensions that are prefixed with
17228 @samp{+no@dots{}}: these extensions disable the specified option and
17229 any other extensions that may depend on the presence of that
17230 extension.
17231
17232 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17233 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17234 entirely disabled by the @samp{+nofp} option that follows it.
17235
17236 Most extension names are generically named, but have an effect that is
17237 dependent upon the architecture to which it is applied. For example,
17238 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17239 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17240 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17241 variant for @samp{armv8-a}.
17242
17243 The table below lists the supported extensions for each architecture.
17244 Architectures not mentioned do not support any extensions.
17245
17246 @table @samp
17247 @item armv5te
17248 @itemx armv6
17249 @itemx armv6j
17250 @itemx armv6k
17251 @itemx armv6kz
17252 @itemx armv6t2
17253 @itemx armv6z
17254 @itemx armv6zk
17255 @table @samp
17256 @item +fp
17257 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17258 used as an alias for this extension.
17259
17260 @item +nofp
17261 Disable the floating-point instructions.
17262 @end table
17263
17264 @item armv7
17265 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17266 @table @samp
17267 @item +fp
17268 The VFPv3 floating-point instructions, with 16 double-precision
17269 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17270 for this extension. Note that floating-point is not supported by the
17271 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17272 ARMv7-R architectures.
17273
17274 @item +nofp
17275 Disable the floating-point instructions.
17276 @end table
17277
17278 @item armv7-a
17279 @table @samp
17280 @item +mp
17281 The multiprocessing extension.
17282
17283 @item +sec
17284 The security extension.
17285
17286 @item +fp
17287 The VFPv3 floating-point instructions, with 16 double-precision
17288 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17289 for this extension.
17290
17291 @item +simd
17292 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17293 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17294 for this extension.
17295
17296 @item +vfpv3
17297 The VFPv3 floating-point instructions, with 32 double-precision
17298 registers.
17299
17300 @item +vfpv3-d16-fp16
17301 The VFPv3 floating-point instructions, with 16 double-precision
17302 registers and the half-precision floating-point conversion operations.
17303
17304 @item +vfpv3-fp16
17305 The VFPv3 floating-point instructions, with 32 double-precision
17306 registers and the half-precision floating-point conversion operations.
17307
17308 @item +vfpv4-d16
17309 The VFPv4 floating-point instructions, with 16 double-precision
17310 registers.
17311
17312 @item +vfpv4
17313 The VFPv4 floating-point instructions, with 32 double-precision
17314 registers.
17315
17316 @item +neon-fp16
17317 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17318 the half-precision floating-point conversion operations.
17319
17320 @item +neon-vfpv4
17321 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17322
17323 @item +nosimd
17324 Disable the Advanced SIMD instructions (does not disable floating point).
17325
17326 @item +nofp
17327 Disable the floating-point and Advanced SIMD instructions.
17328 @end table
17329
17330 @item armv7ve
17331 The extended version of the ARMv7-A architecture with support for
17332 virtualization.
17333 @table @samp
17334 @item +fp
17335 The VFPv4 floating-point instructions, with 16 double-precision registers.
17336 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17337
17338 @item +simd
17339 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17340 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17341
17342 @item +vfpv3-d16
17343 The VFPv3 floating-point instructions, with 16 double-precision
17344 registers.
17345
17346 @item +vfpv3
17347 The VFPv3 floating-point instructions, with 32 double-precision
17348 registers.
17349
17350 @item +vfpv3-d16-fp16
17351 The VFPv3 floating-point instructions, with 16 double-precision
17352 registers and the half-precision floating-point conversion operations.
17353
17354 @item +vfpv3-fp16
17355 The VFPv3 floating-point instructions, with 32 double-precision
17356 registers and the half-precision floating-point conversion operations.
17357
17358 @item +vfpv4-d16
17359 The VFPv4 floating-point instructions, with 16 double-precision
17360 registers.
17361
17362 @item +vfpv4
17363 The VFPv4 floating-point instructions, with 32 double-precision
17364 registers.
17365
17366 @item +neon
17367 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17368 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17369
17370 @item +neon-fp16
17371 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17372 the half-precision floating-point conversion operations.
17373
17374 @item +nosimd
17375 Disable the Advanced SIMD instructions (does not disable floating point).
17376
17377 @item +nofp
17378 Disable the floating-point and Advanced SIMD instructions.
17379 @end table
17380
17381 @item armv8-a
17382 @table @samp
17383 @item +crc
17384 The Cyclic Redundancy Check (CRC) instructions.
17385 @item +simd
17386 The ARMv8-A Advanced SIMD and floating-point instructions.
17387 @item +crypto
17388 The cryptographic instructions.
17389 @item +nocrypto
17390 Disable the cryptographic instructions.
17391 @item +nofp
17392 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17393 @item +sb
17394 Speculation Barrier Instruction.
17395 @item +predres
17396 Execution and Data Prediction Restriction Instructions.
17397 @end table
17398
17399 @item armv8.1-a
17400 @table @samp
17401 @item +simd
17402 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17403
17404 @item +crypto
17405 The cryptographic instructions. This also enables the Advanced SIMD and
17406 floating-point instructions.
17407
17408 @item +nocrypto
17409 Disable the cryptographic instructions.
17410
17411 @item +nofp
17412 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17413
17414 @item +sb
17415 Speculation Barrier Instruction.
17416
17417 @item +predres
17418 Execution and Data Prediction Restriction Instructions.
17419 @end table
17420
17421 @item armv8.2-a
17422 @itemx armv8.3-a
17423 @table @samp
17424 @item +fp16
17425 The half-precision floating-point data processing instructions.
17426 This also enables the Advanced SIMD and floating-point instructions.
17427
17428 @item +fp16fml
17429 The half-precision floating-point fmla extension. This also enables
17430 the half-precision floating-point extension and Advanced SIMD and
17431 floating-point instructions.
17432
17433 @item +simd
17434 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17435
17436 @item +crypto
17437 The cryptographic instructions. This also enables the Advanced SIMD and
17438 floating-point instructions.
17439
17440 @item +dotprod
17441 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17442
17443 @item +nocrypto
17444 Disable the cryptographic extension.
17445
17446 @item +nofp
17447 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17448
17449 @item +sb
17450 Speculation Barrier Instruction.
17451
17452 @item +predres
17453 Execution and Data Prediction Restriction Instructions.
17454 @end table
17455
17456 @item armv8.4-a
17457 @table @samp
17458 @item +fp16
17459 The half-precision floating-point data processing instructions.
17460 This also enables the Advanced SIMD and floating-point instructions as well
17461 as the Dot Product extension and the half-precision floating-point fmla
17462 extension.
17463
17464 @item +simd
17465 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17466 Dot Product extension.
17467
17468 @item +crypto
17469 The cryptographic instructions. This also enables the Advanced SIMD and
17470 floating-point instructions as well as the Dot Product extension.
17471
17472 @item +nocrypto
17473 Disable the cryptographic extension.
17474
17475 @item +nofp
17476 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17477
17478 @item +sb
17479 Speculation Barrier Instruction.
17480
17481 @item +predres
17482 Execution and Data Prediction Restriction Instructions.
17483 @end table
17484
17485 @item armv8.5-a
17486 @table @samp
17487 @item +fp16
17488 The half-precision floating-point data processing instructions.
17489 This also enables the Advanced SIMD and floating-point instructions as well
17490 as the Dot Product extension and the half-precision floating-point fmla
17491 extension.
17492
17493 @item +simd
17494 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17495 Dot Product extension.
17496
17497 @item +crypto
17498 The cryptographic instructions. This also enables the Advanced SIMD and
17499 floating-point instructions as well as the Dot Product extension.
17500
17501 @item +nocrypto
17502 Disable the cryptographic extension.
17503
17504 @item +nofp
17505 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17506 @end table
17507
17508 @item armv7-r
17509 @table @samp
17510 @item +fp.sp
17511 The single-precision VFPv3 floating-point instructions. The extension
17512 @samp{+vfpv3xd} can be used as an alias for this extension.
17513
17514 @item +fp
17515 The VFPv3 floating-point instructions with 16 double-precision registers.
17516 The extension +vfpv3-d16 can be used as an alias for this extension.
17517
17518 @item +vfpv3xd-d16-fp16
17519 The single-precision VFPv3 floating-point instructions with 16 double-precision
17520 registers and the half-precision floating-point conversion operations.
17521
17522 @item +vfpv3-d16-fp16
17523 The VFPv3 floating-point instructions with 16 double-precision
17524 registers and the half-precision floating-point conversion operations.
17525
17526 @item +nofp
17527 Disable the floating-point extension.
17528
17529 @item +idiv
17530 The ARM-state integer division instructions.
17531
17532 @item +noidiv
17533 Disable the ARM-state integer division extension.
17534 @end table
17535
17536 @item armv7e-m
17537 @table @samp
17538 @item +fp
17539 The single-precision VFPv4 floating-point instructions.
17540
17541 @item +fpv5
17542 The single-precision FPv5 floating-point instructions.
17543
17544 @item +fp.dp
17545 The single- and double-precision FPv5 floating-point instructions.
17546
17547 @item +nofp
17548 Disable the floating-point extensions.
17549 @end table
17550
17551 @item armv8-m.main
17552 @table @samp
17553 @item +dsp
17554 The DSP instructions.
17555
17556 @item +nodsp
17557 Disable the DSP extension.
17558
17559 @item +fp
17560 The single-precision floating-point instructions.
17561
17562 @item +fp.dp
17563 The single- and double-precision floating-point instructions.
17564
17565 @item +nofp
17566 Disable the floating-point extension.
17567 @end table
17568
17569 @item armv8-r
17570 @table @samp
17571 @item +crc
17572 The Cyclic Redundancy Check (CRC) instructions.
17573 @item +fp.sp
17574 The single-precision FPv5 floating-point instructions.
17575 @item +simd
17576 The ARMv8-A Advanced SIMD and floating-point instructions.
17577 @item +crypto
17578 The cryptographic instructions.
17579 @item +nocrypto
17580 Disable the cryptographic instructions.
17581 @item +nofp
17582 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17583 @end table
17584
17585 @end table
17586
17587 @option{-march=native} causes the compiler to auto-detect the architecture
17588 of the build computer. At present, this feature is only supported on
17589 GNU/Linux, and not all architectures are recognized. If the auto-detect
17590 is unsuccessful the option has no effect.
17591
17592 @item -mtune=@var{name}
17593 @opindex mtune
17594 This option specifies the name of the target ARM processor for
17595 which GCC should tune the performance of the code.
17596 For some ARM implementations better performance can be obtained by using
17597 this option.
17598 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17599 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17600 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17601 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17602 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17603 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17604 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17605 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17606 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17607 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17608 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17609 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17610 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17611 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17612 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17613 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17614 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17615 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17616 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17617 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17618 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17619 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17620
17621 Additionally, this option can specify that GCC should tune the performance
17622 of the code for a big.LITTLE system. Permissible names are:
17623 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17624 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17625 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17626 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17627
17628 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17629 performance for a blend of processors within architecture @var{arch}.
17630 The aim is to generate code that run well on the current most popular
17631 processors, balancing between optimizations that benefit some CPUs in the
17632 range, and avoiding performance pitfalls of other CPUs. The effects of
17633 this option may change in future GCC versions as CPU models come and go.
17634
17635 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17636 the extension options do not affect the tuning of the generated code.
17637
17638 @option{-mtune=native} causes the compiler to auto-detect the CPU
17639 of the build computer. At present, this feature is only supported on
17640 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17641 unsuccessful the option has no effect.
17642
17643 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17644 @opindex mcpu
17645 This specifies the name of the target ARM processor. GCC uses this name
17646 to derive the name of the target ARM architecture (as if specified
17647 by @option{-march}) and the ARM processor type for which to tune for
17648 performance (as if specified by @option{-mtune}). Where this option
17649 is used in conjunction with @option{-march} or @option{-mtune},
17650 those options take precedence over the appropriate part of this option.
17651
17652 Many of the supported CPUs implement optional architectural
17653 extensions. Where this is so the architectural extensions are
17654 normally enabled by default. If implementations that lack the
17655 extension exist, then the extension syntax can be used to disable
17656 those extensions that have been omitted. For floating-point and
17657 Advanced SIMD (Neon) instructions, the settings of the options
17658 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17659 floating-point and Advanced SIMD instructions will only be used if
17660 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17661 @option{-mfpu} other than @samp{auto} will override the available
17662 floating-point and SIMD extension instructions.
17663
17664 For example, @samp{cortex-a9} can be found in three major
17665 configurations: integer only, with just a floating-point unit or with
17666 floating-point and Advanced SIMD. The default is to enable all the
17667 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17668 be used to disable just the SIMD or both the SIMD and floating-point
17669 instructions respectively.
17670
17671 Permissible names for this option are the same as those for
17672 @option{-mtune}.
17673
17674 The following extension options are common to the listed CPUs:
17675
17676 @table @samp
17677 @item +nodsp
17678 Disable the DSP instructions on @samp{cortex-m33}.
17679
17680 @item +nofp
17681 Disables the floating-point instructions on @samp{arm9e},
17682 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17683 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17684 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17685 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17686 Disables the floating-point and SIMD instructions on
17687 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17688 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17689 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17690 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17691 @samp{cortex-a53} and @samp{cortex-a55}.
17692
17693 @item +nofp.dp
17694 Disables the double-precision component of the floating-point instructions
17695 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17696 @samp{cortex-m7}.
17697
17698 @item +nosimd
17699 Disables the SIMD (but not floating-point) instructions on
17700 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17701 and @samp{cortex-a9}.
17702
17703 @item +crypto
17704 Enables the cryptographic instructions on @samp{cortex-a32},
17705 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17706 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17707 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17708 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17709 @samp{cortex-a75.cortex-a55}.
17710 @end table
17711
17712 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17713 VFPv3 with 16 double-precision registers. It supports the following
17714 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17715 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17716 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17717 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17718 the extensions to @option{-march=armv7-a}.
17719
17720 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17721 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17722 See @option{-mtune} for more information.
17723
17724 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17725 of the build computer. At present, this feature is only supported on
17726 GNU/Linux, and not all architectures are recognized. If the auto-detect
17727 is unsuccessful the option has no effect.
17728
17729 @item -mfpu=@var{name}
17730 @opindex mfpu
17731 This specifies what floating-point hardware (or hardware emulation) is
17732 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17733 @samp{vfpv3},
17734 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17735 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17736 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17737 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17738 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17739 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17740 is an alias for @samp{vfpv2}.
17741
17742 The setting @samp{auto} is the default and is special. It causes the
17743 compiler to select the floating-point and Advanced SIMD instructions
17744 based on the settings of @option{-mcpu} and @option{-march}.
17745
17746 If the selected floating-point hardware includes the NEON extension
17747 (e.g.@: @option{-mfpu=neon}), note that floating-point
17748 operations are not generated by GCC's auto-vectorization pass unless
17749 @option{-funsafe-math-optimizations} is also specified. This is
17750 because NEON hardware does not fully implement the IEEE 754 standard for
17751 floating-point arithmetic (in particular denormal values are treated as
17752 zero), so the use of NEON instructions may lead to a loss of precision.
17753
17754 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}).
17755
17756 @item -mfp16-format=@var{name}
17757 @opindex mfp16-format
17758 Specify the format of the @code{__fp16} half-precision floating-point type.
17759 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17760 the default is @samp{none}, in which case the @code{__fp16} type is not
17761 defined. @xref{Half-Precision}, for more information.
17762
17763 @item -mstructure-size-boundary=@var{n}
17764 @opindex mstructure-size-boundary
17765 The sizes of all structures and unions are rounded up to a multiple
17766 of the number of bits set by this option. Permissible values are 8, 32
17767 and 64. The default value varies for different toolchains. For the COFF
17768 targeted toolchain the default value is 8. A value of 64 is only allowed
17769 if the underlying ABI supports it.
17770
17771 Specifying a larger number can produce faster, more efficient code, but
17772 can also increase the size of the program. Different values are potentially
17773 incompatible. Code compiled with one value cannot necessarily expect to
17774 work with code or libraries compiled with another value, if they exchange
17775 information using structures or unions.
17776
17777 This option is deprecated.
17778
17779 @item -mabort-on-noreturn
17780 @opindex mabort-on-noreturn
17781 Generate a call to the function @code{abort} at the end of a
17782 @code{noreturn} function. It is executed if the function tries to
17783 return.
17784
17785 @item -mlong-calls
17786 @itemx -mno-long-calls
17787 @opindex mlong-calls
17788 @opindex mno-long-calls
17789 Tells the compiler to perform function calls by first loading the
17790 address of the function into a register and then performing a subroutine
17791 call on this register. This switch is needed if the target function
17792 lies outside of the 64-megabyte addressing range of the offset-based
17793 version of subroutine call instruction.
17794
17795 Even if this switch is enabled, not all function calls are turned
17796 into long calls. The heuristic is that static functions, functions
17797 that have the @code{short_call} attribute, functions that are inside
17798 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17799 definitions have already been compiled within the current compilation
17800 unit are not turned into long calls. The exceptions to this rule are
17801 that weak function definitions, functions with the @code{long_call}
17802 attribute or the @code{section} attribute, and functions that are within
17803 the scope of a @code{#pragma long_calls} directive are always
17804 turned into long calls.
17805
17806 This feature is not enabled by default. Specifying
17807 @option{-mno-long-calls} restores the default behavior, as does
17808 placing the function calls within the scope of a @code{#pragma
17809 long_calls_off} directive. Note these switches have no effect on how
17810 the compiler generates code to handle function calls via function
17811 pointers.
17812
17813 @item -msingle-pic-base
17814 @opindex msingle-pic-base
17815 Treat the register used for PIC addressing as read-only, rather than
17816 loading it in the prologue for each function. The runtime system is
17817 responsible for initializing this register with an appropriate value
17818 before execution begins.
17819
17820 @item -mpic-register=@var{reg}
17821 @opindex mpic-register
17822 Specify the register to be used for PIC addressing.
17823 For standard PIC base case, the default is any suitable register
17824 determined by compiler. For single PIC base case, the default is
17825 @samp{R9} if target is EABI based or stack-checking is enabled,
17826 otherwise the default is @samp{R10}.
17827
17828 @item -mpic-data-is-text-relative
17829 @opindex mpic-data-is-text-relative
17830 Assume that the displacement between the text and data segments is fixed
17831 at static link time. This permits using PC-relative addressing
17832 operations to access data known to be in the data segment. For
17833 non-VxWorks RTP targets, this option is enabled by default. When
17834 disabled on such targets, it will enable @option{-msingle-pic-base} by
17835 default.
17836
17837 @item -mpoke-function-name
17838 @opindex mpoke-function-name
17839 Write the name of each function into the text section, directly
17840 preceding the function prologue. The generated code is similar to this:
17841
17842 @smallexample
17843 t0
17844 .ascii "arm_poke_function_name", 0
17845 .align
17846 t1
17847 .word 0xff000000 + (t1 - t0)
17848 arm_poke_function_name
17849 mov ip, sp
17850 stmfd sp!, @{fp, ip, lr, pc@}
17851 sub fp, ip, #4
17852 @end smallexample
17853
17854 When performing a stack backtrace, code can inspect the value of
17855 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17856 location @code{pc - 12} and the top 8 bits are set, then we know that
17857 there is a function name embedded immediately preceding this location
17858 and has length @code{((pc[-3]) & 0xff000000)}.
17859
17860 @item -mthumb
17861 @itemx -marm
17862 @opindex marm
17863 @opindex mthumb
17864
17865 Select between generating code that executes in ARM and Thumb
17866 states. The default for most configurations is to generate code
17867 that executes in ARM state, but the default can be changed by
17868 configuring GCC with the @option{--with-mode=}@var{state}
17869 configure option.
17870
17871 You can also override the ARM and Thumb mode for each function
17872 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17873 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17874
17875 @item -mflip-thumb
17876 @opindex mflip-thumb
17877 Switch ARM/Thumb modes on alternating functions.
17878 This option is provided for regression testing of mixed Thumb/ARM code
17879 generation, and is not intended for ordinary use in compiling code.
17880
17881 @item -mtpcs-frame
17882 @opindex mtpcs-frame
17883 Generate a stack frame that is compliant with the Thumb Procedure Call
17884 Standard for all non-leaf functions. (A leaf function is one that does
17885 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17886
17887 @item -mtpcs-leaf-frame
17888 @opindex mtpcs-leaf-frame
17889 Generate a stack frame that is compliant with the Thumb Procedure Call
17890 Standard for all leaf functions. (A leaf function is one that does
17891 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17892
17893 @item -mcallee-super-interworking
17894 @opindex mcallee-super-interworking
17895 Gives all externally visible functions in the file being compiled an ARM
17896 instruction set header which switches to Thumb mode before executing the
17897 rest of the function. This allows these functions to be called from
17898 non-interworking code. This option is not valid in AAPCS configurations
17899 because interworking is enabled by default.
17900
17901 @item -mcaller-super-interworking
17902 @opindex mcaller-super-interworking
17903 Allows calls via function pointers (including virtual functions) to
17904 execute correctly regardless of whether the target code has been
17905 compiled for interworking or not. There is a small overhead in the cost
17906 of executing a function pointer if this option is enabled. This option
17907 is not valid in AAPCS configurations because interworking is enabled
17908 by default.
17909
17910 @item -mtp=@var{name}
17911 @opindex mtp
17912 Specify the access model for the thread local storage pointer. The valid
17913 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17914 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17915 (supported in the arm6k architecture), and @samp{auto}, which uses the
17916 best available method for the selected processor. The default setting is
17917 @samp{auto}.
17918
17919 @item -mtls-dialect=@var{dialect}
17920 @opindex mtls-dialect
17921 Specify the dialect to use for accessing thread local storage. Two
17922 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17923 @samp{gnu} dialect selects the original GNU scheme for supporting
17924 local and global dynamic TLS models. The @samp{gnu2} dialect
17925 selects the GNU descriptor scheme, which provides better performance
17926 for shared libraries. The GNU descriptor scheme is compatible with
17927 the original scheme, but does require new assembler, linker and
17928 library support. Initial and local exec TLS models are unaffected by
17929 this option and always use the original scheme.
17930
17931 @item -mword-relocations
17932 @opindex mword-relocations
17933 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17934 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17935 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17936 is specified. This option conflicts with @option{-mslow-flash-data}.
17937
17938 @item -mfix-cortex-m3-ldrd
17939 @opindex mfix-cortex-m3-ldrd
17940 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17941 with overlapping destination and base registers are used. This option avoids
17942 generating these instructions. This option is enabled by default when
17943 @option{-mcpu=cortex-m3} is specified.
17944
17945 @item -munaligned-access
17946 @itemx -mno-unaligned-access
17947 @opindex munaligned-access
17948 @opindex mno-unaligned-access
17949 Enables (or disables) reading and writing of 16- and 32- bit values
17950 from addresses that are not 16- or 32- bit aligned. By default
17951 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17952 ARMv8-M Baseline architectures, and enabled for all other
17953 architectures. If unaligned access is not enabled then words in packed
17954 data structures are accessed a byte at a time.
17955
17956 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17957 generated object file to either true or false, depending upon the
17958 setting of this option. If unaligned access is enabled then the
17959 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17960 defined.
17961
17962 @item -mneon-for-64bits
17963 @opindex mneon-for-64bits
17964 Enables using Neon to handle scalar 64-bits operations. This is
17965 disabled by default since the cost of moving data from core registers
17966 to Neon is high.
17967
17968 @item -mslow-flash-data
17969 @opindex mslow-flash-data
17970 Assume loading data from flash is slower than fetching instruction.
17971 Therefore literal load is minimized for better performance.
17972 This option is only supported when compiling for ARMv7 M-profile and
17973 off by default. It conflicts with @option{-mword-relocations}.
17974
17975 @item -masm-syntax-unified
17976 @opindex masm-syntax-unified
17977 Assume inline assembler is using unified asm syntax. The default is
17978 currently off which implies divided syntax. This option has no impact
17979 on Thumb2. However, this may change in future releases of GCC.
17980 Divided syntax should be considered deprecated.
17981
17982 @item -mrestrict-it
17983 @opindex mrestrict-it
17984 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17985 IT blocks can only contain a single 16-bit instruction from a select
17986 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17987
17988 @item -mprint-tune-info
17989 @opindex mprint-tune-info
17990 Print CPU tuning information as comment in assembler file. This is
17991 an option used only for regression testing of the compiler and not
17992 intended for ordinary use in compiling code. This option is disabled
17993 by default.
17994
17995 @item -mverbose-cost-dump
17996 @opindex mverbose-cost-dump
17997 Enable verbose cost model dumping in the debug dump files. This option is
17998 provided for use in debugging the compiler.
17999
18000 @item -mpure-code
18001 @opindex mpure-code
18002 Do not allow constant data to be placed in code sections.
18003 Additionally, when compiling for ELF object format give all text sections the
18004 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
18005 is only available when generating non-pic code for M-profile targets with the
18006 MOVT instruction.
18007
18008 @item -mcmse
18009 @opindex mcmse
18010 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
18011 Development Tools Engineering Specification", which can be found on
18012 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
18013 @end table
18014
18015 @node AVR Options
18016 @subsection AVR Options
18017 @cindex AVR Options
18018
18019 These options are defined for AVR implementations:
18020
18021 @table @gcctabopt
18022 @item -mmcu=@var{mcu}
18023 @opindex mmcu
18024 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18025
18026 The default for this option is@tie{}@samp{avr2}.
18027
18028 GCC supports the following AVR devices and ISAs:
18029
18030 @include avr-mmcu.texi
18031
18032 @item -mabsdata
18033 @opindex mabsdata
18034
18035 Assume that all data in static storage can be accessed by LDS / STS
18036 instructions. This option has only an effect on reduced Tiny devices like
18037 ATtiny40. See also the @code{absdata}
18038 @ref{AVR Variable Attributes,variable attribute}.
18039
18040 @item -maccumulate-args
18041 @opindex maccumulate-args
18042 Accumulate outgoing function arguments and acquire/release the needed
18043 stack space for outgoing function arguments once in function
18044 prologue/epilogue. Without this option, outgoing arguments are pushed
18045 before calling a function and popped afterwards.
18046
18047 Popping the arguments after the function call can be expensive on
18048 AVR so that accumulating the stack space might lead to smaller
18049 executables because arguments need not be removed from the
18050 stack after such a function call.
18051
18052 This option can lead to reduced code size for functions that perform
18053 several calls to functions that get their arguments on the stack like
18054 calls to printf-like functions.
18055
18056 @item -mbranch-cost=@var{cost}
18057 @opindex mbranch-cost
18058 Set the branch costs for conditional branch instructions to
18059 @var{cost}. Reasonable values for @var{cost} are small, non-negative
18060 integers. The default branch cost is 0.
18061
18062 @item -mcall-prologues
18063 @opindex mcall-prologues
18064 Functions prologues/epilogues are expanded as calls to appropriate
18065 subroutines. Code size is smaller.
18066
18067 @item -mgas-isr-prologues
18068 @opindex mgas-isr-prologues
18069 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18070 instruction supported by GNU Binutils.
18071 If this option is on, the feature can still be disabled for individual
18072 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18073 function attribute. This feature is activated per default
18074 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18075 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18076
18077 @item -mint8
18078 @opindex mint8
18079 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18080 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18081 and @code{long long} is 4 bytes. Please note that this option does not
18082 conform to the C standards, but it results in smaller code
18083 size.
18084
18085 @item -mmain-is-OS_task
18086 @opindex mmain-is-OS_task
18087 Do not save registers in @code{main}. The effect is the same like
18088 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18089 to @code{main}. It is activated per default if optimization is on.
18090
18091 @item -mn-flash=@var{num}
18092 @opindex mn-flash
18093 Assume that the flash memory has a size of
18094 @var{num} times 64@tie{}KiB.
18095
18096 @item -mno-interrupts
18097 @opindex mno-interrupts
18098 Generated code is not compatible with hardware interrupts.
18099 Code size is smaller.
18100
18101 @item -mrelax
18102 @opindex mrelax
18103 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18104 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18105 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18106 the assembler's command line and the @option{--relax} option to the
18107 linker's command line.
18108
18109 Jump relaxing is performed by the linker because jump offsets are not
18110 known before code is located. Therefore, the assembler code generated by the
18111 compiler is the same, but the instructions in the executable may
18112 differ from instructions in the assembler code.
18113
18114 Relaxing must be turned on if linker stubs are needed, see the
18115 section on @code{EIND} and linker stubs below.
18116
18117 @item -mrmw
18118 @opindex mrmw
18119 Assume that the device supports the Read-Modify-Write
18120 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18121
18122 @item -mshort-calls
18123 @opindex mshort-calls
18124
18125 Assume that @code{RJMP} and @code{RCALL} can target the whole
18126 program memory.
18127
18128 This option is used internally for multilib selection. It is
18129 not an optimization option, and you don't need to set it by hand.
18130
18131 @item -msp8
18132 @opindex msp8
18133 Treat the stack pointer register as an 8-bit register,
18134 i.e.@: assume the high byte of the stack pointer is zero.
18135 In general, you don't need to set this option by hand.
18136
18137 This option is used internally by the compiler to select and
18138 build multilibs for architectures @code{avr2} and @code{avr25}.
18139 These architectures mix devices with and without @code{SPH}.
18140 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18141 the compiler driver adds or removes this option from the compiler
18142 proper's command line, because the compiler then knows if the device
18143 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18144 register or not.
18145
18146 @item -mstrict-X
18147 @opindex mstrict-X
18148 Use address register @code{X} in a way proposed by the hardware. This means
18149 that @code{X} is only used in indirect, post-increment or
18150 pre-decrement addressing.
18151
18152 Without this option, the @code{X} register may be used in the same way
18153 as @code{Y} or @code{Z} which then is emulated by additional
18154 instructions.
18155 For example, loading a value with @code{X+const} addressing with a
18156 small non-negative @code{const < 64} to a register @var{Rn} is
18157 performed as
18158
18159 @example
18160 adiw r26, const ; X += const
18161 ld @var{Rn}, X ; @var{Rn} = *X
18162 sbiw r26, const ; X -= const
18163 @end example
18164
18165 @item -mtiny-stack
18166 @opindex mtiny-stack
18167 Only change the lower 8@tie{}bits of the stack pointer.
18168
18169 @item -mfract-convert-truncate
18170 @opindex mfract-convert-truncate
18171 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18172
18173 @item -nodevicelib
18174 @opindex nodevicelib
18175 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18176
18177 @item -Waddr-space-convert
18178 @opindex Waddr-space-convert
18179 @opindex Wno-addr-space-convert
18180 Warn about conversions between address spaces in the case where the
18181 resulting address space is not contained in the incoming address space.
18182
18183 @item -Wmisspelled-isr
18184 @opindex Wmisspelled-isr
18185 @opindex Wno-misspelled-isr
18186 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18187 Enabled by default.
18188 @end table
18189
18190 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18191 @cindex @code{EIND}
18192 Pointers in the implementation are 16@tie{}bits wide.
18193 The address of a function or label is represented as word address so
18194 that indirect jumps and calls can target any code address in the
18195 range of 64@tie{}Ki words.
18196
18197 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18198 bytes of program memory space, there is a special function register called
18199 @code{EIND} that serves as most significant part of the target address
18200 when @code{EICALL} or @code{EIJMP} instructions are used.
18201
18202 Indirect jumps and calls on these devices are handled as follows by
18203 the compiler and are subject to some limitations:
18204
18205 @itemize @bullet
18206
18207 @item
18208 The compiler never sets @code{EIND}.
18209
18210 @item
18211 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18212 instructions or might read @code{EIND} directly in order to emulate an
18213 indirect call/jump by means of a @code{RET} instruction.
18214
18215 @item
18216 The compiler assumes that @code{EIND} never changes during the startup
18217 code or during the application. In particular, @code{EIND} is not
18218 saved/restored in function or interrupt service routine
18219 prologue/epilogue.
18220
18221 @item
18222 For indirect calls to functions and computed goto, the linker
18223 generates @emph{stubs}. Stubs are jump pads sometimes also called
18224 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18225 The stub contains a direct jump to the desired address.
18226
18227 @item
18228 Linker relaxation must be turned on so that the linker generates
18229 the stubs correctly in all situations. See the compiler option
18230 @option{-mrelax} and the linker option @option{--relax}.
18231 There are corner cases where the linker is supposed to generate stubs
18232 but aborts without relaxation and without a helpful error message.
18233
18234 @item
18235 The default linker script is arranged for code with @code{EIND = 0}.
18236 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18237 linker script has to be used in order to place the sections whose
18238 name start with @code{.trampolines} into the segment where @code{EIND}
18239 points to.
18240
18241 @item
18242 The startup code from libgcc never sets @code{EIND}.
18243 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18244 For the impact of AVR-LibC on @code{EIND}, see the
18245 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18246
18247 @item
18248 It is legitimate for user-specific startup code to set up @code{EIND}
18249 early, for example by means of initialization code located in
18250 section @code{.init3}. Such code runs prior to general startup code
18251 that initializes RAM and calls constructors, but after the bit
18252 of startup code from AVR-LibC that sets @code{EIND} to the segment
18253 where the vector table is located.
18254 @example
18255 #include <avr/io.h>
18256
18257 static void
18258 __attribute__((section(".init3"),naked,used,no_instrument_function))
18259 init3_set_eind (void)
18260 @{
18261 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18262 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18263 @}
18264 @end example
18265
18266 @noindent
18267 The @code{__trampolines_start} symbol is defined in the linker script.
18268
18269 @item
18270 Stubs are generated automatically by the linker if
18271 the following two conditions are met:
18272 @itemize @minus
18273
18274 @item The address of a label is taken by means of the @code{gs} modifier
18275 (short for @emph{generate stubs}) like so:
18276 @example
18277 LDI r24, lo8(gs(@var{func}))
18278 LDI r25, hi8(gs(@var{func}))
18279 @end example
18280 @item The final location of that label is in a code segment
18281 @emph{outside} the segment where the stubs are located.
18282 @end itemize
18283
18284 @item
18285 The compiler emits such @code{gs} modifiers for code labels in the
18286 following situations:
18287 @itemize @minus
18288 @item Taking address of a function or code label.
18289 @item Computed goto.
18290 @item If prologue-save function is used, see @option{-mcall-prologues}
18291 command-line option.
18292 @item Switch/case dispatch tables. If you do not want such dispatch
18293 tables you can specify the @option{-fno-jump-tables} command-line option.
18294 @item C and C++ constructors/destructors called during startup/shutdown.
18295 @item If the tools hit a @code{gs()} modifier explained above.
18296 @end itemize
18297
18298 @item
18299 Jumping to non-symbolic addresses like so is @emph{not} supported:
18300
18301 @example
18302 int main (void)
18303 @{
18304 /* Call function at word address 0x2 */
18305 return ((int(*)(void)) 0x2)();
18306 @}
18307 @end example
18308
18309 Instead, a stub has to be set up, i.e.@: the function has to be called
18310 through a symbol (@code{func_4} in the example):
18311
18312 @example
18313 int main (void)
18314 @{
18315 extern int func_4 (void);
18316
18317 /* Call function at byte address 0x4 */
18318 return func_4();
18319 @}
18320 @end example
18321
18322 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18323 Alternatively, @code{func_4} can be defined in the linker script.
18324 @end itemize
18325
18326 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18327 @cindex @code{RAMPD}
18328 @cindex @code{RAMPX}
18329 @cindex @code{RAMPY}
18330 @cindex @code{RAMPZ}
18331 Some AVR devices support memories larger than the 64@tie{}KiB range
18332 that can be accessed with 16-bit pointers. To access memory locations
18333 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18334 register is used as high part of the address:
18335 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18336 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18337 register, respectively, to get a wide address. Similarly,
18338 @code{RAMPD} is used together with direct addressing.
18339
18340 @itemize
18341 @item
18342 The startup code initializes the @code{RAMP} special function
18343 registers with zero.
18344
18345 @item
18346 If a @ref{AVR Named Address Spaces,named address space} other than
18347 generic or @code{__flash} is used, then @code{RAMPZ} is set
18348 as needed before the operation.
18349
18350 @item
18351 If the device supports RAM larger than 64@tie{}KiB and the compiler
18352 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18353 is reset to zero after the operation.
18354
18355 @item
18356 If the device comes with a specific @code{RAMP} register, the ISR
18357 prologue/epilogue saves/restores that SFR and initializes it with
18358 zero in case the ISR code might (implicitly) use it.
18359
18360 @item
18361 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18362 If you use inline assembler to read from locations outside the
18363 16-bit address range and change one of the @code{RAMP} registers,
18364 you must reset it to zero after the access.
18365
18366 @end itemize
18367
18368 @subsubsection AVR Built-in Macros
18369
18370 GCC defines several built-in macros so that the user code can test
18371 for the presence or absence of features. Almost any of the following
18372 built-in macros are deduced from device capabilities and thus
18373 triggered by the @option{-mmcu=} command-line option.
18374
18375 For even more AVR-specific built-in macros see
18376 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18377
18378 @table @code
18379
18380 @item __AVR_ARCH__
18381 Build-in macro that resolves to a decimal number that identifies the
18382 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18383 Possible values are:
18384
18385 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18386 @code{4}, @code{5}, @code{51}, @code{6}
18387
18388 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18389 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18390
18391 respectively and
18392
18393 @code{100},
18394 @code{102}, @code{103}, @code{104},
18395 @code{105}, @code{106}, @code{107}
18396
18397 for @var{mcu}=@code{avrtiny},
18398 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18399 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18400 If @var{mcu} specifies a device, this built-in macro is set
18401 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18402 defined to @code{4}.
18403
18404 @item __AVR_@var{Device}__
18405 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18406 the device's name. For example, @option{-mmcu=atmega8} defines the
18407 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18408 @code{__AVR_ATtiny261A__}, etc.
18409
18410 The built-in macros' names follow
18411 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18412 the device name as from the AVR user manual. The difference between
18413 @var{Device} in the built-in macro and @var{device} in
18414 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18415
18416 If @var{device} is not a device but only a core architecture like
18417 @samp{avr51}, this macro is not defined.
18418
18419 @item __AVR_DEVICE_NAME__
18420 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18421 the device's name. For example, with @option{-mmcu=atmega8} the macro
18422 is defined to @code{atmega8}.
18423
18424 If @var{device} is not a device but only a core architecture like
18425 @samp{avr51}, this macro is not defined.
18426
18427 @item __AVR_XMEGA__
18428 The device / architecture belongs to the XMEGA family of devices.
18429
18430 @item __AVR_HAVE_ELPM__
18431 The device has the @code{ELPM} instruction.
18432
18433 @item __AVR_HAVE_ELPMX__
18434 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18435 R@var{n},Z+} instructions.
18436
18437 @item __AVR_HAVE_MOVW__
18438 The device has the @code{MOVW} instruction to perform 16-bit
18439 register-register moves.
18440
18441 @item __AVR_HAVE_LPMX__
18442 The device has the @code{LPM R@var{n},Z} and
18443 @code{LPM R@var{n},Z+} instructions.
18444
18445 @item __AVR_HAVE_MUL__
18446 The device has a hardware multiplier.
18447
18448 @item __AVR_HAVE_JMP_CALL__
18449 The device has the @code{JMP} and @code{CALL} instructions.
18450 This is the case for devices with more than 8@tie{}KiB of program
18451 memory.
18452
18453 @item __AVR_HAVE_EIJMP_EICALL__
18454 @itemx __AVR_3_BYTE_PC__
18455 The device has the @code{EIJMP} and @code{EICALL} instructions.
18456 This is the case for devices with more than 128@tie{}KiB of program memory.
18457 This also means that the program counter
18458 (PC) is 3@tie{}bytes wide.
18459
18460 @item __AVR_2_BYTE_PC__
18461 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18462 with up to 128@tie{}KiB of program memory.
18463
18464 @item __AVR_HAVE_8BIT_SP__
18465 @itemx __AVR_HAVE_16BIT_SP__
18466 The stack pointer (SP) register is treated as 8-bit respectively
18467 16-bit register by the compiler.
18468 The definition of these macros is affected by @option{-mtiny-stack}.
18469
18470 @item __AVR_HAVE_SPH__
18471 @itemx __AVR_SP8__
18472 The device has the SPH (high part of stack pointer) special function
18473 register or has an 8-bit stack pointer, respectively.
18474 The definition of these macros is affected by @option{-mmcu=} and
18475 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18476 by @option{-msp8}.
18477
18478 @item __AVR_HAVE_RAMPD__
18479 @itemx __AVR_HAVE_RAMPX__
18480 @itemx __AVR_HAVE_RAMPY__
18481 @itemx __AVR_HAVE_RAMPZ__
18482 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18483 @code{RAMPZ} special function register, respectively.
18484
18485 @item __NO_INTERRUPTS__
18486 This macro reflects the @option{-mno-interrupts} command-line option.
18487
18488 @item __AVR_ERRATA_SKIP__
18489 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18490 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18491 instructions because of a hardware erratum. Skip instructions are
18492 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18493 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18494 set.
18495
18496 @item __AVR_ISA_RMW__
18497 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18498
18499 @item __AVR_SFR_OFFSET__=@var{offset}
18500 Instructions that can address I/O special function registers directly
18501 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18502 address as if addressed by an instruction to access RAM like @code{LD}
18503 or @code{STS}. This offset depends on the device architecture and has
18504 to be subtracted from the RAM address in order to get the
18505 respective I/O@tie{}address.
18506
18507 @item __AVR_SHORT_CALLS__
18508 The @option{-mshort-calls} command line option is set.
18509
18510 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18511 Some devices support reading from flash memory by means of @code{LD*}
18512 instructions. The flash memory is seen in the data address space
18513 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18514 is not defined, this feature is not available. If defined,
18515 the address space is linear and there is no need to put
18516 @code{.rodata} into RAM. This is handled by the default linker
18517 description file, and is currently available for
18518 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18519 there is no need to use address spaces like @code{__flash} or
18520 features like attribute @code{progmem} and @code{pgm_read_*}.
18521
18522 @item __WITH_AVRLIBC__
18523 The compiler is configured to be used together with AVR-Libc.
18524 See the @option{--with-avrlibc} configure option.
18525
18526 @end table
18527
18528 @node Blackfin Options
18529 @subsection Blackfin Options
18530 @cindex Blackfin Options
18531
18532 @table @gcctabopt
18533 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18534 @opindex mcpu=
18535 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18536 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18537 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18538 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18539 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18540 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18541 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18542 @samp{bf561}, @samp{bf592}.
18543
18544 The optional @var{sirevision} specifies the silicon revision of the target
18545 Blackfin processor. Any workarounds available for the targeted silicon revision
18546 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18547 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18548 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18549 hexadecimal digits representing the major and minor numbers in the silicon
18550 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18551 is not defined. If @var{sirevision} is @samp{any}, the
18552 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18553 If this optional @var{sirevision} is not used, GCC assumes the latest known
18554 silicon revision of the targeted Blackfin processor.
18555
18556 GCC defines a preprocessor macro for the specified @var{cpu}.
18557 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18558 provided by libgloss to be linked in if @option{-msim} is not given.
18559
18560 Without this option, @samp{bf532} is used as the processor by default.
18561
18562 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18563 only the preprocessor macro is defined.
18564
18565 @item -msim
18566 @opindex msim
18567 Specifies that the program will be run on the simulator. This causes
18568 the simulator BSP provided by libgloss to be linked in. This option
18569 has effect only for @samp{bfin-elf} toolchain.
18570 Certain other options, such as @option{-mid-shared-library} and
18571 @option{-mfdpic}, imply @option{-msim}.
18572
18573 @item -momit-leaf-frame-pointer
18574 @opindex momit-leaf-frame-pointer
18575 Don't keep the frame pointer in a register for leaf functions. This
18576 avoids the instructions to save, set up and restore frame pointers and
18577 makes an extra register available in leaf functions.
18578
18579 @item -mspecld-anomaly
18580 @opindex mspecld-anomaly
18581 When enabled, the compiler ensures that the generated code does not
18582 contain speculative loads after jump instructions. If this option is used,
18583 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18584
18585 @item -mno-specld-anomaly
18586 @opindex mno-specld-anomaly
18587 @opindex mspecld-anomaly
18588 Don't generate extra code to prevent speculative loads from occurring.
18589
18590 @item -mcsync-anomaly
18591 @opindex mcsync-anomaly
18592 When enabled, the compiler ensures that the generated code does not
18593 contain CSYNC or SSYNC instructions too soon after conditional branches.
18594 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18595
18596 @item -mno-csync-anomaly
18597 @opindex mno-csync-anomaly
18598 @opindex mcsync-anomaly
18599 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18600 occurring too soon after a conditional branch.
18601
18602 @item -mlow64k
18603 @opindex mlow64k
18604 When enabled, the compiler is free to take advantage of the knowledge that
18605 the entire program fits into the low 64k of memory.
18606
18607 @item -mno-low64k
18608 @opindex mno-low64k
18609 Assume that the program is arbitrarily large. This is the default.
18610
18611 @item -mstack-check-l1
18612 @opindex mstack-check-l1
18613 Do stack checking using information placed into L1 scratchpad memory by the
18614 uClinux kernel.
18615
18616 @item -mid-shared-library
18617 @opindex mid-shared-library
18618 Generate code that supports shared libraries via the library ID method.
18619 This allows for execute in place and shared libraries in an environment
18620 without virtual memory management. This option implies @option{-fPIC}.
18621 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18622
18623 @item -mno-id-shared-library
18624 @opindex mno-id-shared-library
18625 @opindex mid-shared-library
18626 Generate code that doesn't assume ID-based shared libraries are being used.
18627 This is the default.
18628
18629 @item -mleaf-id-shared-library
18630 @opindex mleaf-id-shared-library
18631 Generate code that supports shared libraries via the library ID method,
18632 but assumes that this library or executable won't link against any other
18633 ID shared libraries. That allows the compiler to use faster code for jumps
18634 and calls.
18635
18636 @item -mno-leaf-id-shared-library
18637 @opindex mno-leaf-id-shared-library
18638 @opindex mleaf-id-shared-library
18639 Do not assume that the code being compiled won't link against any ID shared
18640 libraries. Slower code is generated for jump and call insns.
18641
18642 @item -mshared-library-id=n
18643 @opindex mshared-library-id
18644 Specifies the identification number of the ID-based shared library being
18645 compiled. Specifying a value of 0 generates more compact code; specifying
18646 other values forces the allocation of that number to the current
18647 library but is no more space- or time-efficient than omitting this option.
18648
18649 @item -msep-data
18650 @opindex msep-data
18651 Generate code that allows the data segment to be located in a different
18652 area of memory from the text segment. This allows for execute in place in
18653 an environment without virtual memory management by eliminating relocations
18654 against the text section.
18655
18656 @item -mno-sep-data
18657 @opindex mno-sep-data
18658 @opindex msep-data
18659 Generate code that assumes that the data segment follows the text segment.
18660 This is the default.
18661
18662 @item -mlong-calls
18663 @itemx -mno-long-calls
18664 @opindex mlong-calls
18665 @opindex mno-long-calls
18666 Tells the compiler to perform function calls by first loading the
18667 address of the function into a register and then performing a subroutine
18668 call on this register. This switch is needed if the target function
18669 lies outside of the 24-bit addressing range of the offset-based
18670 version of subroutine call instruction.
18671
18672 This feature is not enabled by default. Specifying
18673 @option{-mno-long-calls} restores the default behavior. Note these
18674 switches have no effect on how the compiler generates code to handle
18675 function calls via function pointers.
18676
18677 @item -mfast-fp
18678 @opindex mfast-fp
18679 Link with the fast floating-point library. This library relaxes some of
18680 the IEEE floating-point standard's rules for checking inputs against
18681 Not-a-Number (NAN), in the interest of performance.
18682
18683 @item -minline-plt
18684 @opindex minline-plt
18685 Enable inlining of PLT entries in function calls to functions that are
18686 not known to bind locally. It has no effect without @option{-mfdpic}.
18687
18688 @item -mmulticore
18689 @opindex mmulticore
18690 Build a standalone application for multicore Blackfin processors.
18691 This option causes proper start files and link scripts supporting
18692 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18693 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18694
18695 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18696 selects the one-application-per-core programming model. Without
18697 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18698 programming model is used. In this model, the main function of Core B
18699 should be named as @code{coreb_main}.
18700
18701 If this option is not used, the single-core application programming
18702 model is used.
18703
18704 @item -mcorea
18705 @opindex mcorea
18706 Build a standalone application for Core A of BF561 when using
18707 the one-application-per-core programming model. Proper start files
18708 and link scripts are used to support Core A, and the macro
18709 @code{__BFIN_COREA} is defined.
18710 This option can only be used in conjunction with @option{-mmulticore}.
18711
18712 @item -mcoreb
18713 @opindex mcoreb
18714 Build a standalone application for Core B of BF561 when using
18715 the one-application-per-core programming model. Proper start files
18716 and link scripts are used to support Core B, and the macro
18717 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18718 should be used instead of @code{main}.
18719 This option can only be used in conjunction with @option{-mmulticore}.
18720
18721 @item -msdram
18722 @opindex msdram
18723 Build a standalone application for SDRAM. Proper start files and
18724 link scripts are used to put the application into SDRAM, and the macro
18725 @code{__BFIN_SDRAM} is defined.
18726 The loader should initialize SDRAM before loading the application.
18727
18728 @item -micplb
18729 @opindex micplb
18730 Assume that ICPLBs are enabled at run time. This has an effect on certain
18731 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18732 are enabled; for standalone applications the default is off.
18733 @end table
18734
18735 @node C6X Options
18736 @subsection C6X Options
18737 @cindex C6X Options
18738
18739 @table @gcctabopt
18740 @item -march=@var{name}
18741 @opindex march
18742 This specifies the name of the target architecture. GCC uses this
18743 name to determine what kind of instructions it can emit when generating
18744 assembly code. Permissible names are: @samp{c62x},
18745 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18746
18747 @item -mbig-endian
18748 @opindex mbig-endian
18749 Generate code for a big-endian target.
18750
18751 @item -mlittle-endian
18752 @opindex mlittle-endian
18753 Generate code for a little-endian target. This is the default.
18754
18755 @item -msim
18756 @opindex msim
18757 Choose startup files and linker script suitable for the simulator.
18758
18759 @item -msdata=default
18760 @opindex msdata=default
18761 Put small global and static data in the @code{.neardata} section,
18762 which is pointed to by register @code{B14}. Put small uninitialized
18763 global and static data in the @code{.bss} section, which is adjacent
18764 to the @code{.neardata} section. Put small read-only data into the
18765 @code{.rodata} section. The corresponding sections used for large
18766 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18767
18768 @item -msdata=all
18769 @opindex msdata=all
18770 Put all data, not just small objects, into the sections reserved for
18771 small data, and use addressing relative to the @code{B14} register to
18772 access them.
18773
18774 @item -msdata=none
18775 @opindex msdata=none
18776 Make no use of the sections reserved for small data, and use absolute
18777 addresses to access all data. Put all initialized global and static
18778 data in the @code{.fardata} section, and all uninitialized data in the
18779 @code{.far} section. Put all constant data into the @code{.const}
18780 section.
18781 @end table
18782
18783 @node CRIS Options
18784 @subsection CRIS Options
18785 @cindex CRIS Options
18786
18787 These options are defined specifically for the CRIS ports.
18788
18789 @table @gcctabopt
18790 @item -march=@var{architecture-type}
18791 @itemx -mcpu=@var{architecture-type}
18792 @opindex march
18793 @opindex mcpu
18794 Generate code for the specified architecture. The choices for
18795 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18796 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18797 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18798 @samp{v10}.
18799
18800 @item -mtune=@var{architecture-type}
18801 @opindex mtune
18802 Tune to @var{architecture-type} everything applicable about the generated
18803 code, except for the ABI and the set of available instructions. The
18804 choices for @var{architecture-type} are the same as for
18805 @option{-march=@var{architecture-type}}.
18806
18807 @item -mmax-stack-frame=@var{n}
18808 @opindex mmax-stack-frame
18809 Warn when the stack frame of a function exceeds @var{n} bytes.
18810
18811 @item -metrax4
18812 @itemx -metrax100
18813 @opindex metrax4
18814 @opindex metrax100
18815 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18816 @option{-march=v3} and @option{-march=v8} respectively.
18817
18818 @item -mmul-bug-workaround
18819 @itemx -mno-mul-bug-workaround
18820 @opindex mmul-bug-workaround
18821 @opindex mno-mul-bug-workaround
18822 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18823 models where it applies. This option is active by default.
18824
18825 @item -mpdebug
18826 @opindex mpdebug
18827 Enable CRIS-specific verbose debug-related information in the assembly
18828 code. This option also has the effect of turning off the @samp{#NO_APP}
18829 formatted-code indicator to the assembler at the beginning of the
18830 assembly file.
18831
18832 @item -mcc-init
18833 @opindex mcc-init
18834 Do not use condition-code results from previous instruction; always emit
18835 compare and test instructions before use of condition codes.
18836
18837 @item -mno-side-effects
18838 @opindex mno-side-effects
18839 @opindex mside-effects
18840 Do not emit instructions with side effects in addressing modes other than
18841 post-increment.
18842
18843 @item -mstack-align
18844 @itemx -mno-stack-align
18845 @itemx -mdata-align
18846 @itemx -mno-data-align
18847 @itemx -mconst-align
18848 @itemx -mno-const-align
18849 @opindex mstack-align
18850 @opindex mno-stack-align
18851 @opindex mdata-align
18852 @opindex mno-data-align
18853 @opindex mconst-align
18854 @opindex mno-const-align
18855 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18856 stack frame, individual data and constants to be aligned for the maximum
18857 single data access size for the chosen CPU model. The default is to
18858 arrange for 32-bit alignment. ABI details such as structure layout are
18859 not affected by these options.
18860
18861 @item -m32-bit
18862 @itemx -m16-bit
18863 @itemx -m8-bit
18864 @opindex m32-bit
18865 @opindex m16-bit
18866 @opindex m8-bit
18867 Similar to the stack- data- and const-align options above, these options
18868 arrange for stack frame, writable data and constants to all be 32-bit,
18869 16-bit or 8-bit aligned. The default is 32-bit alignment.
18870
18871 @item -mno-prologue-epilogue
18872 @itemx -mprologue-epilogue
18873 @opindex mno-prologue-epilogue
18874 @opindex mprologue-epilogue
18875 With @option{-mno-prologue-epilogue}, the normal function prologue and
18876 epilogue which set up the stack frame are omitted and no return
18877 instructions or return sequences are generated in the code. Use this
18878 option only together with visual inspection of the compiled code: no
18879 warnings or errors are generated when call-saved registers must be saved,
18880 or storage for local variables needs to be allocated.
18881
18882 @item -mno-gotplt
18883 @itemx -mgotplt
18884 @opindex mno-gotplt
18885 @opindex mgotplt
18886 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18887 instruction sequences that load addresses for functions from the PLT part
18888 of the GOT rather than (traditional on other architectures) calls to the
18889 PLT@. The default is @option{-mgotplt}.
18890
18891 @item -melf
18892 @opindex melf
18893 Legacy no-op option only recognized with the cris-axis-elf and
18894 cris-axis-linux-gnu targets.
18895
18896 @item -mlinux
18897 @opindex mlinux
18898 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18899
18900 @item -sim
18901 @opindex sim
18902 This option, recognized for the cris-axis-elf, arranges
18903 to link with input-output functions from a simulator library. Code,
18904 initialized data and zero-initialized data are allocated consecutively.
18905
18906 @item -sim2
18907 @opindex sim2
18908 Like @option{-sim}, but pass linker options to locate initialized data at
18909 0x40000000 and zero-initialized data at 0x80000000.
18910 @end table
18911
18912 @node CR16 Options
18913 @subsection CR16 Options
18914 @cindex CR16 Options
18915
18916 These options are defined specifically for the CR16 ports.
18917
18918 @table @gcctabopt
18919
18920 @item -mmac
18921 @opindex mmac
18922 Enable the use of multiply-accumulate instructions. Disabled by default.
18923
18924 @item -mcr16cplus
18925 @itemx -mcr16c
18926 @opindex mcr16cplus
18927 @opindex mcr16c
18928 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18929 is default.
18930
18931 @item -msim
18932 @opindex msim
18933 Links the library libsim.a which is in compatible with simulator. Applicable
18934 to ELF compiler only.
18935
18936 @item -mint32
18937 @opindex mint32
18938 Choose integer type as 32-bit wide.
18939
18940 @item -mbit-ops
18941 @opindex mbit-ops
18942 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18943
18944 @item -mdata-model=@var{model}
18945 @opindex mdata-model
18946 Choose a data model. The choices for @var{model} are @samp{near},
18947 @samp{far} or @samp{medium}. @samp{medium} is default.
18948 However, @samp{far} is not valid with @option{-mcr16c}, as the
18949 CR16C architecture does not support the far data model.
18950 @end table
18951
18952 @node C-SKY Options
18953 @subsection C-SKY Options
18954 @cindex C-SKY Options
18955
18956 GCC supports these options when compiling for C-SKY V2 processors.
18957
18958 @table @gcctabopt
18959
18960 @item -march=@var{arch}
18961 @opindex march=
18962 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18963 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18964 The default is @samp{ck810}.
18965
18966 @item -mcpu=@var{cpu}
18967 @opindex mcpu=
18968 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18969 @samp{ck801}, @samp{ck801t},
18970 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18971 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18972 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18973 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18974 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18975 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18976 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18977 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18978 @samp{ck803eftr1}, @samp{ck803efhtr1},
18979 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18980 @samp{ck803sef}, @samp{ck803seft},
18981 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18982 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18983 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18984 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18985
18986 @item -mbig-endian
18987 @opindex mbig-endian
18988 @itemx -EB
18989 @opindex EB
18990 @itemx -mlittle-endian
18991 @opindex mlittle-endian
18992 @itemx -EL
18993 @opindex EL
18994
18995 Select big- or little-endian code. The default is little-endian.
18996
18997 @item -mhard-float
18998 @opindex mhard-float
18999 @itemx -msoft-float
19000 @opindex msoft-float
19001
19002 Select hardware or software floating-point implementations.
19003 The default is soft float.
19004
19005 @item -mdouble-float
19006 @itemx -mno-double-float
19007 @opindex mdouble-float
19008 When @option{-mhard-float} is in effect, enable generation of
19009 double-precision float instructions. This is the default except
19010 when compiling for CK803.
19011
19012 @item -mfdivdu
19013 @itemx -mno-fdivdu
19014 @opindex mfdivdu
19015 When @option{-mhard-float} is in effect, enable generation of
19016 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
19017 This is the default except when compiling for CK803.
19018
19019 @item -mfpu=@var{fpu}
19020 @opindex mfpu=
19021 Select the floating-point processor. This option can only be used with
19022 @option{-mhard-float}.
19023 Values for @var{fpu} are
19024 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19025 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19026 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19027
19028 @item -melrw
19029 @itemx -mno-elrw
19030 @opindex melrw
19031 Enable the extended @code{lrw} instruction. This option defaults to on
19032 for CK801 and off otherwise.
19033
19034 @item -mistack
19035 @itemx -mno-istack
19036 @opindex mistack
19037 Enable interrupt stack instructions; the default is off.
19038
19039 The @option{-mistack} option is required to handle the
19040 @code{interrupt} and @code{isr} function attributes
19041 (@pxref{C-SKY Function Attributes}).
19042
19043 @item -mmp
19044 @opindex mmp
19045 Enable multiprocessor instructions; the default is off.
19046
19047 @item -mcp
19048 @opindex mcp
19049 Enable coprocessor instructions; the default is off.
19050
19051 @item -mcache
19052 @opindex mcache
19053 Enable coprocessor instructions; the default is off.
19054
19055 @item -msecurity
19056 @opindex msecurity
19057 Enable C-SKY security instructions; the default is off.
19058
19059 @item -mtrust
19060 @opindex mtrust
19061 Enable C-SKY trust instructions; the default is off.
19062
19063 @item -mdsp
19064 @opindex mdsp
19065 @itemx -medsp
19066 @opindex medsp
19067 @itemx -mvdsp
19068 @opindex mvdsp
19069 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19070 All of these options default to off.
19071
19072 @item -mdiv
19073 @itemx -mno-div
19074 @opindex mdiv
19075 Generate divide instructions. Default is off.
19076
19077 @item -msmart
19078 @itemx -mno-smart
19079 @opindex msmart
19080 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19081 use of 16-bit instructions. This option is ignored for CK801 where this
19082 is the required behavior, and it defaults to on for CK802.
19083 For other targets, the default is off.
19084
19085 @item -mhigh-registers
19086 @itemx -mno-high-registers
19087 @opindex mhigh-registers
19088 Generate code using the high registers numbered 16-31. This option
19089 is not supported on CK801, CK802, or CK803, and is enabled by default
19090 for other processors.
19091
19092 @item -manchor
19093 @itemx -mno-anchor
19094 @opindex manchor
19095 Generate code using global anchor symbol addresses.
19096
19097 @item -mpushpop
19098 @itemx -mno-pushpop
19099 @opindex mpushpop
19100 Generate code using @code{push} and @code{pop} instructions. This option
19101 defaults to on.
19102
19103 @item -mmultiple-stld
19104 @itemx -mstm
19105 @itemx -mno-multiple-stld
19106 @itemx -mno-stm
19107 @opindex mmultiple-stld
19108 Generate code using @code{stm} and @code{ldm} instructions. This option
19109 isn't supported on CK801 but is enabled by default on other processors.
19110
19111 @item -mconstpool
19112 @itemx -mno-constpool
19113 @opindex mconstpool
19114 Create constant pools in the compiler instead of deferring it to the
19115 assembler. This option is the default and required for correct code
19116 generation on CK801 and CK802, and is optional on other processors.
19117
19118 @item -mstack-size
19119 @item -mno-stack-size
19120 @opindex mstack-size
19121 Emit @code{.stack_size} directives for each function in the assembly
19122 output. This option defaults to off.
19123
19124 @item -mccrt
19125 @itemx -mno-ccrt
19126 @opindex mccrt
19127 Generate code for the C-SKY compiler runtime instead of libgcc. This
19128 option defaults to off.
19129
19130 @item -mbranch-cost=@var{n}
19131 @opindex mbranch-cost=
19132 Set the branch costs to roughly @code{n} instructions. The default is 1.
19133
19134 @item -msched-prolog
19135 @itemx -mno-sched-prolog
19136 @opindex msched-prolog
19137 Permit scheduling of function prologue and epilogue sequences. Using
19138 this option can result in code that is not compliant with the C-SKY V2 ABI
19139 prologue requirements and that cannot be debugged or backtraced.
19140 It is disabled by default.
19141
19142 @end table
19143
19144 @node Darwin Options
19145 @subsection Darwin Options
19146 @cindex Darwin options
19147
19148 These options are defined for all architectures running the Darwin operating
19149 system.
19150
19151 FSF GCC on Darwin does not create ``fat'' object files; it creates
19152 an object file for the single architecture that GCC was built to
19153 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19154 @option{-arch} options are used; it does so by running the compiler or
19155 linker multiple times and joining the results together with
19156 @file{lipo}.
19157
19158 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19159 @samp{i686}) is determined by the flags that specify the ISA
19160 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19161 @option{-force_cpusubtype_ALL} option can be used to override this.
19162
19163 The Darwin tools vary in their behavior when presented with an ISA
19164 mismatch. The assembler, @file{as}, only permits instructions to
19165 be used that are valid for the subtype of the file it is generating,
19166 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19167 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19168 and prints an error if asked to create a shared library with a less
19169 restrictive subtype than its input files (for instance, trying to put
19170 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19171 for executables, @command{ld}, quietly gives the executable the most
19172 restrictive subtype of any of its input files.
19173
19174 @table @gcctabopt
19175 @item -F@var{dir}
19176 @opindex F
19177 Add the framework directory @var{dir} to the head of the list of
19178 directories to be searched for header files. These directories are
19179 interleaved with those specified by @option{-I} options and are
19180 scanned in a left-to-right order.
19181
19182 A framework directory is a directory with frameworks in it. A
19183 framework is a directory with a @file{Headers} and/or
19184 @file{PrivateHeaders} directory contained directly in it that ends
19185 in @file{.framework}. The name of a framework is the name of this
19186 directory excluding the @file{.framework}. Headers associated with
19187 the framework are found in one of those two directories, with
19188 @file{Headers} being searched first. A subframework is a framework
19189 directory that is in a framework's @file{Frameworks} directory.
19190 Includes of subframework headers can only appear in a header of a
19191 framework that contains the subframework, or in a sibling subframework
19192 header. Two subframeworks are siblings if they occur in the same
19193 framework. A subframework should not have the same name as a
19194 framework; a warning is issued if this is violated. Currently a
19195 subframework cannot have subframeworks; in the future, the mechanism
19196 may be extended to support this. The standard frameworks can be found
19197 in @file{/System/Library/Frameworks} and
19198 @file{/Library/Frameworks}. An example include looks like
19199 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19200 the name of the framework and @file{header.h} is found in the
19201 @file{PrivateHeaders} or @file{Headers} directory.
19202
19203 @item -iframework@var{dir}
19204 @opindex iframework
19205 Like @option{-F} except the directory is a treated as a system
19206 directory. The main difference between this @option{-iframework} and
19207 @option{-F} is that with @option{-iframework} the compiler does not
19208 warn about constructs contained within header files found via
19209 @var{dir}. This option is valid only for the C family of languages.
19210
19211 @item -gused
19212 @opindex gused
19213 Emit debugging information for symbols that are used. For stabs
19214 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19215 This is by default ON@.
19216
19217 @item -gfull
19218 @opindex gfull
19219 Emit debugging information for all symbols and types.
19220
19221 @item -mmacosx-version-min=@var{version}
19222 The earliest version of MacOS X that this executable will run on
19223 is @var{version}. Typical values of @var{version} include @code{10.1},
19224 @code{10.2}, and @code{10.3.9}.
19225
19226 If the compiler was built to use the system's headers by default,
19227 then the default for this option is the system version on which the
19228 compiler is running, otherwise the default is to make choices that
19229 are compatible with as many systems and code bases as possible.
19230
19231 @item -mkernel
19232 @opindex mkernel
19233 Enable kernel development mode. The @option{-mkernel} option sets
19234 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19235 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19236 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19237 applicable. This mode also sets @option{-mno-altivec},
19238 @option{-msoft-float}, @option{-fno-builtin} and
19239 @option{-mlong-branch} for PowerPC targets.
19240
19241 @item -mone-byte-bool
19242 @opindex mone-byte-bool
19243 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19244 By default @code{sizeof(bool)} is @code{4} when compiling for
19245 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19246 option has no effect on x86.
19247
19248 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19249 to generate code that is not binary compatible with code generated
19250 without that switch. Using this switch may require recompiling all
19251 other modules in a program, including system libraries. Use this
19252 switch to conform to a non-default data model.
19253
19254 @item -mfix-and-continue
19255 @itemx -ffix-and-continue
19256 @itemx -findirect-data
19257 @opindex mfix-and-continue
19258 @opindex ffix-and-continue
19259 @opindex findirect-data
19260 Generate code suitable for fast turnaround development, such as to
19261 allow GDB to dynamically load @file{.o} files into already-running
19262 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19263 are provided for backwards compatibility.
19264
19265 @item -all_load
19266 @opindex all_load
19267 Loads all members of static archive libraries.
19268 See man ld(1) for more information.
19269
19270 @item -arch_errors_fatal
19271 @opindex arch_errors_fatal
19272 Cause the errors having to do with files that have the wrong architecture
19273 to be fatal.
19274
19275 @item -bind_at_load
19276 @opindex bind_at_load
19277 Causes the output file to be marked such that the dynamic linker will
19278 bind all undefined references when the file is loaded or launched.
19279
19280 @item -bundle
19281 @opindex bundle
19282 Produce a Mach-o bundle format file.
19283 See man ld(1) for more information.
19284
19285 @item -bundle_loader @var{executable}
19286 @opindex bundle_loader
19287 This option specifies the @var{executable} that will load the build
19288 output file being linked. See man ld(1) for more information.
19289
19290 @item -dynamiclib
19291 @opindex dynamiclib
19292 When passed this option, GCC produces a dynamic library instead of
19293 an executable when linking, using the Darwin @file{libtool} command.
19294
19295 @item -force_cpusubtype_ALL
19296 @opindex force_cpusubtype_ALL
19297 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19298 one controlled by the @option{-mcpu} or @option{-march} option.
19299
19300 @item -allowable_client @var{client_name}
19301 @itemx -client_name
19302 @itemx -compatibility_version
19303 @itemx -current_version
19304 @itemx -dead_strip
19305 @itemx -dependency-file
19306 @itemx -dylib_file
19307 @itemx -dylinker_install_name
19308 @itemx -dynamic
19309 @itemx -exported_symbols_list
19310 @itemx -filelist
19311 @need 800
19312 @itemx -flat_namespace
19313 @itemx -force_flat_namespace
19314 @itemx -headerpad_max_install_names
19315 @itemx -image_base
19316 @itemx -init
19317 @itemx -install_name
19318 @itemx -keep_private_externs
19319 @itemx -multi_module
19320 @itemx -multiply_defined
19321 @itemx -multiply_defined_unused
19322 @need 800
19323 @itemx -noall_load
19324 @itemx -no_dead_strip_inits_and_terms
19325 @itemx -nofixprebinding
19326 @itemx -nomultidefs
19327 @itemx -noprebind
19328 @itemx -noseglinkedit
19329 @itemx -pagezero_size
19330 @itemx -prebind
19331 @itemx -prebind_all_twolevel_modules
19332 @itemx -private_bundle
19333 @need 800
19334 @itemx -read_only_relocs
19335 @itemx -sectalign
19336 @itemx -sectobjectsymbols
19337 @itemx -whyload
19338 @itemx -seg1addr
19339 @itemx -sectcreate
19340 @itemx -sectobjectsymbols
19341 @itemx -sectorder
19342 @itemx -segaddr
19343 @itemx -segs_read_only_addr
19344 @need 800
19345 @itemx -segs_read_write_addr
19346 @itemx -seg_addr_table
19347 @itemx -seg_addr_table_filename
19348 @itemx -seglinkedit
19349 @itemx -segprot
19350 @itemx -segs_read_only_addr
19351 @itemx -segs_read_write_addr
19352 @itemx -single_module
19353 @itemx -static
19354 @itemx -sub_library
19355 @need 800
19356 @itemx -sub_umbrella
19357 @itemx -twolevel_namespace
19358 @itemx -umbrella
19359 @itemx -undefined
19360 @itemx -unexported_symbols_list
19361 @itemx -weak_reference_mismatches
19362 @itemx -whatsloaded
19363 @opindex allowable_client
19364 @opindex client_name
19365 @opindex compatibility_version
19366 @opindex current_version
19367 @opindex dead_strip
19368 @opindex dependency-file
19369 @opindex dylib_file
19370 @opindex dylinker_install_name
19371 @opindex dynamic
19372 @opindex exported_symbols_list
19373 @opindex filelist
19374 @opindex flat_namespace
19375 @opindex force_flat_namespace
19376 @opindex headerpad_max_install_names
19377 @opindex image_base
19378 @opindex init
19379 @opindex install_name
19380 @opindex keep_private_externs
19381 @opindex multi_module
19382 @opindex multiply_defined
19383 @opindex multiply_defined_unused
19384 @opindex noall_load
19385 @opindex no_dead_strip_inits_and_terms
19386 @opindex nofixprebinding
19387 @opindex nomultidefs
19388 @opindex noprebind
19389 @opindex noseglinkedit
19390 @opindex pagezero_size
19391 @opindex prebind
19392 @opindex prebind_all_twolevel_modules
19393 @opindex private_bundle
19394 @opindex read_only_relocs
19395 @opindex sectalign
19396 @opindex sectobjectsymbols
19397 @opindex whyload
19398 @opindex seg1addr
19399 @opindex sectcreate
19400 @opindex sectobjectsymbols
19401 @opindex sectorder
19402 @opindex segaddr
19403 @opindex segs_read_only_addr
19404 @opindex segs_read_write_addr
19405 @opindex seg_addr_table
19406 @opindex seg_addr_table_filename
19407 @opindex seglinkedit
19408 @opindex segprot
19409 @opindex segs_read_only_addr
19410 @opindex segs_read_write_addr
19411 @opindex single_module
19412 @opindex static
19413 @opindex sub_library
19414 @opindex sub_umbrella
19415 @opindex twolevel_namespace
19416 @opindex umbrella
19417 @opindex undefined
19418 @opindex unexported_symbols_list
19419 @opindex weak_reference_mismatches
19420 @opindex whatsloaded
19421 These options are passed to the Darwin linker. The Darwin linker man page
19422 describes them in detail.
19423 @end table
19424
19425 @node DEC Alpha Options
19426 @subsection DEC Alpha Options
19427
19428 These @samp{-m} options are defined for the DEC Alpha implementations:
19429
19430 @table @gcctabopt
19431 @item -mno-soft-float
19432 @itemx -msoft-float
19433 @opindex mno-soft-float
19434 @opindex msoft-float
19435 Use (do not use) the hardware floating-point instructions for
19436 floating-point operations. When @option{-msoft-float} is specified,
19437 functions in @file{libgcc.a} are used to perform floating-point
19438 operations. Unless they are replaced by routines that emulate the
19439 floating-point operations, or compiled in such a way as to call such
19440 emulations routines, these routines issue floating-point
19441 operations. If you are compiling for an Alpha without floating-point
19442 operations, you must ensure that the library is built so as not to call
19443 them.
19444
19445 Note that Alpha implementations without floating-point operations are
19446 required to have floating-point registers.
19447
19448 @item -mfp-reg
19449 @itemx -mno-fp-regs
19450 @opindex mfp-reg
19451 @opindex mno-fp-regs
19452 Generate code that uses (does not use) the floating-point register set.
19453 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19454 register set is not used, floating-point operands are passed in integer
19455 registers as if they were integers and floating-point results are passed
19456 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19457 so any function with a floating-point argument or return value called by code
19458 compiled with @option{-mno-fp-regs} must also be compiled with that
19459 option.
19460
19461 A typical use of this option is building a kernel that does not use,
19462 and hence need not save and restore, any floating-point registers.
19463
19464 @item -mieee
19465 @opindex mieee
19466 The Alpha architecture implements floating-point hardware optimized for
19467 maximum performance. It is mostly compliant with the IEEE floating-point
19468 standard. However, for full compliance, software assistance is
19469 required. This option generates code fully IEEE-compliant code
19470 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19471 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19472 defined during compilation. The resulting code is less efficient but is
19473 able to correctly support denormalized numbers and exceptional IEEE
19474 values such as not-a-number and plus/minus infinity. Other Alpha
19475 compilers call this option @option{-ieee_with_no_inexact}.
19476
19477 @item -mieee-with-inexact
19478 @opindex mieee-with-inexact
19479 This is like @option{-mieee} except the generated code also maintains
19480 the IEEE @var{inexact-flag}. Turning on this option causes the
19481 generated code to implement fully-compliant IEEE math. In addition to
19482 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19483 macro. On some Alpha implementations the resulting code may execute
19484 significantly slower than the code generated by default. Since there is
19485 very little code that depends on the @var{inexact-flag}, you should
19486 normally not specify this option. Other Alpha compilers call this
19487 option @option{-ieee_with_inexact}.
19488
19489 @item -mfp-trap-mode=@var{trap-mode}
19490 @opindex mfp-trap-mode
19491 This option controls what floating-point related traps are enabled.
19492 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19493 The trap mode can be set to one of four values:
19494
19495 @table @samp
19496 @item n
19497 This is the default (normal) setting. The only traps that are enabled
19498 are the ones that cannot be disabled in software (e.g., division by zero
19499 trap).
19500
19501 @item u
19502 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19503 as well.
19504
19505 @item su
19506 Like @samp{u}, but the instructions are marked to be safe for software
19507 completion (see Alpha architecture manual for details).
19508
19509 @item sui
19510 Like @samp{su}, but inexact traps are enabled as well.
19511 @end table
19512
19513 @item -mfp-rounding-mode=@var{rounding-mode}
19514 @opindex mfp-rounding-mode
19515 Selects the IEEE rounding mode. Other Alpha compilers call this option
19516 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19517 of:
19518
19519 @table @samp
19520 @item n
19521 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19522 the nearest machine number or towards the even machine number in case
19523 of a tie.
19524
19525 @item m
19526 Round towards minus infinity.
19527
19528 @item c
19529 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19530
19531 @item d
19532 Dynamic rounding mode. A field in the floating-point control register
19533 (@var{fpcr}, see Alpha architecture reference manual) controls the
19534 rounding mode in effect. The C library initializes this register for
19535 rounding towards plus infinity. Thus, unless your program modifies the
19536 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19537 @end table
19538
19539 @item -mtrap-precision=@var{trap-precision}
19540 @opindex mtrap-precision
19541 In the Alpha architecture, floating-point traps are imprecise. This
19542 means without software assistance it is impossible to recover from a
19543 floating trap and program execution normally needs to be terminated.
19544 GCC can generate code that can assist operating system trap handlers
19545 in determining the exact location that caused a floating-point trap.
19546 Depending on the requirements of an application, different levels of
19547 precisions can be selected:
19548
19549 @table @samp
19550 @item p
19551 Program precision. This option is the default and means a trap handler
19552 can only identify which program caused a floating-point exception.
19553
19554 @item f
19555 Function precision. The trap handler can determine the function that
19556 caused a floating-point exception.
19557
19558 @item i
19559 Instruction precision. The trap handler can determine the exact
19560 instruction that caused a floating-point exception.
19561 @end table
19562
19563 Other Alpha compilers provide the equivalent options called
19564 @option{-scope_safe} and @option{-resumption_safe}.
19565
19566 @item -mieee-conformant
19567 @opindex mieee-conformant
19568 This option marks the generated code as IEEE conformant. You must not
19569 use this option unless you also specify @option{-mtrap-precision=i} and either
19570 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19571 is to emit the line @samp{.eflag 48} in the function prologue of the
19572 generated assembly file.
19573
19574 @item -mbuild-constants
19575 @opindex mbuild-constants
19576 Normally GCC examines a 32- or 64-bit integer constant to
19577 see if it can construct it from smaller constants in two or three
19578 instructions. If it cannot, it outputs the constant as a literal and
19579 generates code to load it from the data segment at run time.
19580
19581 Use this option to require GCC to construct @emph{all} integer constants
19582 using code, even if it takes more instructions (the maximum is six).
19583
19584 You typically use this option to build a shared library dynamic
19585 loader. Itself a shared library, it must relocate itself in memory
19586 before it can find the variables and constants in its own data segment.
19587
19588 @item -mbwx
19589 @itemx -mno-bwx
19590 @itemx -mcix
19591 @itemx -mno-cix
19592 @itemx -mfix
19593 @itemx -mno-fix
19594 @itemx -mmax
19595 @itemx -mno-max
19596 @opindex mbwx
19597 @opindex mno-bwx
19598 @opindex mcix
19599 @opindex mno-cix
19600 @opindex mfix
19601 @opindex mno-fix
19602 @opindex mmax
19603 @opindex mno-max
19604 Indicate whether GCC should generate code to use the optional BWX,
19605 CIX, FIX and MAX instruction sets. The default is to use the instruction
19606 sets supported by the CPU type specified via @option{-mcpu=} option or that
19607 of the CPU on which GCC was built if none is specified.
19608
19609 @item -mfloat-vax
19610 @itemx -mfloat-ieee
19611 @opindex mfloat-vax
19612 @opindex mfloat-ieee
19613 Generate code that uses (does not use) VAX F and G floating-point
19614 arithmetic instead of IEEE single and double precision.
19615
19616 @item -mexplicit-relocs
19617 @itemx -mno-explicit-relocs
19618 @opindex mexplicit-relocs
19619 @opindex mno-explicit-relocs
19620 Older Alpha assemblers provided no way to generate symbol relocations
19621 except via assembler macros. Use of these macros does not allow
19622 optimal instruction scheduling. GNU binutils as of version 2.12
19623 supports a new syntax that allows the compiler to explicitly mark
19624 which relocations should apply to which instructions. This option
19625 is mostly useful for debugging, as GCC detects the capabilities of
19626 the assembler when it is built and sets the default accordingly.
19627
19628 @item -msmall-data
19629 @itemx -mlarge-data
19630 @opindex msmall-data
19631 @opindex mlarge-data
19632 When @option{-mexplicit-relocs} is in effect, static data is
19633 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19634 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19635 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19636 16-bit relocations off of the @code{$gp} register. This limits the
19637 size of the small data area to 64KB, but allows the variables to be
19638 directly accessed via a single instruction.
19639
19640 The default is @option{-mlarge-data}. With this option the data area
19641 is limited to just below 2GB@. Programs that require more than 2GB of
19642 data must use @code{malloc} or @code{mmap} to allocate the data in the
19643 heap instead of in the program's data segment.
19644
19645 When generating code for shared libraries, @option{-fpic} implies
19646 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19647
19648 @item -msmall-text
19649 @itemx -mlarge-text
19650 @opindex msmall-text
19651 @opindex mlarge-text
19652 When @option{-msmall-text} is used, the compiler assumes that the
19653 code of the entire program (or shared library) fits in 4MB, and is
19654 thus reachable with a branch instruction. When @option{-msmall-data}
19655 is used, the compiler can assume that all local symbols share the
19656 same @code{$gp} value, and thus reduce the number of instructions
19657 required for a function call from 4 to 1.
19658
19659 The default is @option{-mlarge-text}.
19660
19661 @item -mcpu=@var{cpu_type}
19662 @opindex mcpu
19663 Set the instruction set and instruction scheduling parameters for
19664 machine type @var{cpu_type}. You can specify either the @samp{EV}
19665 style name or the corresponding chip number. GCC supports scheduling
19666 parameters for the EV4, EV5 and EV6 family of processors and
19667 chooses the default values for the instruction set from the processor
19668 you specify. If you do not specify a processor type, GCC defaults
19669 to the processor on which the compiler was built.
19670
19671 Supported values for @var{cpu_type} are
19672
19673 @table @samp
19674 @item ev4
19675 @itemx ev45
19676 @itemx 21064
19677 Schedules as an EV4 and has no instruction set extensions.
19678
19679 @item ev5
19680 @itemx 21164
19681 Schedules as an EV5 and has no instruction set extensions.
19682
19683 @item ev56
19684 @itemx 21164a
19685 Schedules as an EV5 and supports the BWX extension.
19686
19687 @item pca56
19688 @itemx 21164pc
19689 @itemx 21164PC
19690 Schedules as an EV5 and supports the BWX and MAX extensions.
19691
19692 @item ev6
19693 @itemx 21264
19694 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19695
19696 @item ev67
19697 @itemx 21264a
19698 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19699 @end table
19700
19701 Native toolchains also support the value @samp{native},
19702 which selects the best architecture option for the host processor.
19703 @option{-mcpu=native} has no effect if GCC does not recognize
19704 the processor.
19705
19706 @item -mtune=@var{cpu_type}
19707 @opindex mtune
19708 Set only the instruction scheduling parameters for machine type
19709 @var{cpu_type}. The instruction set is not changed.
19710
19711 Native toolchains also support the value @samp{native},
19712 which selects the best architecture option for the host processor.
19713 @option{-mtune=native} has no effect if GCC does not recognize
19714 the processor.
19715
19716 @item -mmemory-latency=@var{time}
19717 @opindex mmemory-latency
19718 Sets the latency the scheduler should assume for typical memory
19719 references as seen by the application. This number is highly
19720 dependent on the memory access patterns used by the application
19721 and the size of the external cache on the machine.
19722
19723 Valid options for @var{time} are
19724
19725 @table @samp
19726 @item @var{number}
19727 A decimal number representing clock cycles.
19728
19729 @item L1
19730 @itemx L2
19731 @itemx L3
19732 @itemx main
19733 The compiler contains estimates of the number of clock cycles for
19734 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19735 (also called Dcache, Scache, and Bcache), as well as to main memory.
19736 Note that L3 is only valid for EV5.
19737
19738 @end table
19739 @end table
19740
19741 @node FR30 Options
19742 @subsection FR30 Options
19743 @cindex FR30 Options
19744
19745 These options are defined specifically for the FR30 port.
19746
19747 @table @gcctabopt
19748
19749 @item -msmall-model
19750 @opindex msmall-model
19751 Use the small address space model. This can produce smaller code, but
19752 it does assume that all symbolic values and addresses fit into a
19753 20-bit range.
19754
19755 @item -mno-lsim
19756 @opindex mno-lsim
19757 Assume that runtime support has been provided and so there is no need
19758 to include the simulator library (@file{libsim.a}) on the linker
19759 command line.
19760
19761 @end table
19762
19763 @node FT32 Options
19764 @subsection FT32 Options
19765 @cindex FT32 Options
19766
19767 These options are defined specifically for the FT32 port.
19768
19769 @table @gcctabopt
19770
19771 @item -msim
19772 @opindex msim
19773 Specifies that the program will be run on the simulator. This causes
19774 an alternate runtime startup and library to be linked.
19775 You must not use this option when generating programs that will run on
19776 real hardware; you must provide your own runtime library for whatever
19777 I/O functions are needed.
19778
19779 @item -mlra
19780 @opindex mlra
19781 Enable Local Register Allocation. This is still experimental for FT32,
19782 so by default the compiler uses standard reload.
19783
19784 @item -mnodiv
19785 @opindex mnodiv
19786 Do not use div and mod instructions.
19787
19788 @item -mft32b
19789 @opindex mft32b
19790 Enable use of the extended instructions of the FT32B processor.
19791
19792 @item -mcompress
19793 @opindex mcompress
19794 Compress all code using the Ft32B code compression scheme.
19795
19796 @item -mnopm
19797 @opindex mnopm
19798 Do not generate code that reads program memory.
19799
19800 @end table
19801
19802 @node FRV Options
19803 @subsection FRV Options
19804 @cindex FRV Options
19805
19806 @table @gcctabopt
19807 @item -mgpr-32
19808 @opindex mgpr-32
19809
19810 Only use the first 32 general-purpose registers.
19811
19812 @item -mgpr-64
19813 @opindex mgpr-64
19814
19815 Use all 64 general-purpose registers.
19816
19817 @item -mfpr-32
19818 @opindex mfpr-32
19819
19820 Use only the first 32 floating-point registers.
19821
19822 @item -mfpr-64
19823 @opindex mfpr-64
19824
19825 Use all 64 floating-point registers.
19826
19827 @item -mhard-float
19828 @opindex mhard-float
19829
19830 Use hardware instructions for floating-point operations.
19831
19832 @item -msoft-float
19833 @opindex msoft-float
19834
19835 Use library routines for floating-point operations.
19836
19837 @item -malloc-cc
19838 @opindex malloc-cc
19839
19840 Dynamically allocate condition code registers.
19841
19842 @item -mfixed-cc
19843 @opindex mfixed-cc
19844
19845 Do not try to dynamically allocate condition code registers, only
19846 use @code{icc0} and @code{fcc0}.
19847
19848 @item -mdword
19849 @opindex mdword
19850
19851 Change ABI to use double word insns.
19852
19853 @item -mno-dword
19854 @opindex mno-dword
19855 @opindex mdword
19856
19857 Do not use double word instructions.
19858
19859 @item -mdouble
19860 @opindex mdouble
19861
19862 Use floating-point double instructions.
19863
19864 @item -mno-double
19865 @opindex mno-double
19866
19867 Do not use floating-point double instructions.
19868
19869 @item -mmedia
19870 @opindex mmedia
19871
19872 Use media instructions.
19873
19874 @item -mno-media
19875 @opindex mno-media
19876
19877 Do not use media instructions.
19878
19879 @item -mmuladd
19880 @opindex mmuladd
19881
19882 Use multiply and add/subtract instructions.
19883
19884 @item -mno-muladd
19885 @opindex mno-muladd
19886
19887 Do not use multiply and add/subtract instructions.
19888
19889 @item -mfdpic
19890 @opindex mfdpic
19891
19892 Select the FDPIC ABI, which uses function descriptors to represent
19893 pointers to functions. Without any PIC/PIE-related options, it
19894 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19895 assumes GOT entries and small data are within a 12-bit range from the
19896 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19897 are computed with 32 bits.
19898 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19899
19900 @item -minline-plt
19901 @opindex minline-plt
19902
19903 Enable inlining of PLT entries in function calls to functions that are
19904 not known to bind locally. It has no effect without @option{-mfdpic}.
19905 It's enabled by default if optimizing for speed and compiling for
19906 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19907 optimization option such as @option{-O3} or above is present in the
19908 command line.
19909
19910 @item -mTLS
19911 @opindex mTLS
19912
19913 Assume a large TLS segment when generating thread-local code.
19914
19915 @item -mtls
19916 @opindex mtls
19917
19918 Do not assume a large TLS segment when generating thread-local code.
19919
19920 @item -mgprel-ro
19921 @opindex mgprel-ro
19922
19923 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19924 that is known to be in read-only sections. It's enabled by default,
19925 except for @option{-fpic} or @option{-fpie}: even though it may help
19926 make the global offset table smaller, it trades 1 instruction for 4.
19927 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19928 one of which may be shared by multiple symbols, and it avoids the need
19929 for a GOT entry for the referenced symbol, so it's more likely to be a
19930 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19931
19932 @item -multilib-library-pic
19933 @opindex multilib-library-pic
19934
19935 Link with the (library, not FD) pic libraries. It's implied by
19936 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19937 @option{-fpic} without @option{-mfdpic}. You should never have to use
19938 it explicitly.
19939
19940 @item -mlinked-fp
19941 @opindex mlinked-fp
19942
19943 Follow the EABI requirement of always creating a frame pointer whenever
19944 a stack frame is allocated. This option is enabled by default and can
19945 be disabled with @option{-mno-linked-fp}.
19946
19947 @item -mlong-calls
19948 @opindex mlong-calls
19949
19950 Use indirect addressing to call functions outside the current
19951 compilation unit. This allows the functions to be placed anywhere
19952 within the 32-bit address space.
19953
19954 @item -malign-labels
19955 @opindex malign-labels
19956
19957 Try to align labels to an 8-byte boundary by inserting NOPs into the
19958 previous packet. This option only has an effect when VLIW packing
19959 is enabled. It doesn't create new packets; it merely adds NOPs to
19960 existing ones.
19961
19962 @item -mlibrary-pic
19963 @opindex mlibrary-pic
19964
19965 Generate position-independent EABI code.
19966
19967 @item -macc-4
19968 @opindex macc-4
19969
19970 Use only the first four media accumulator registers.
19971
19972 @item -macc-8
19973 @opindex macc-8
19974
19975 Use all eight media accumulator registers.
19976
19977 @item -mpack
19978 @opindex mpack
19979
19980 Pack VLIW instructions.
19981
19982 @item -mno-pack
19983 @opindex mno-pack
19984
19985 Do not pack VLIW instructions.
19986
19987 @item -mno-eflags
19988 @opindex mno-eflags
19989
19990 Do not mark ABI switches in e_flags.
19991
19992 @item -mcond-move
19993 @opindex mcond-move
19994
19995 Enable the use of conditional-move instructions (default).
19996
19997 This switch is mainly for debugging the compiler and will likely be removed
19998 in a future version.
19999
20000 @item -mno-cond-move
20001 @opindex mno-cond-move
20002
20003 Disable the use of conditional-move instructions.
20004
20005 This switch is mainly for debugging the compiler and will likely be removed
20006 in a future version.
20007
20008 @item -mscc
20009 @opindex mscc
20010
20011 Enable the use of conditional set instructions (default).
20012
20013 This switch is mainly for debugging the compiler and will likely be removed
20014 in a future version.
20015
20016 @item -mno-scc
20017 @opindex mno-scc
20018
20019 Disable the use of conditional set instructions.
20020
20021 This switch is mainly for debugging the compiler and will likely be removed
20022 in a future version.
20023
20024 @item -mcond-exec
20025 @opindex mcond-exec
20026
20027 Enable the use of conditional execution (default).
20028
20029 This switch is mainly for debugging the compiler and will likely be removed
20030 in a future version.
20031
20032 @item -mno-cond-exec
20033 @opindex mno-cond-exec
20034
20035 Disable the use of conditional execution.
20036
20037 This switch is mainly for debugging the compiler and will likely be removed
20038 in a future version.
20039
20040 @item -mvliw-branch
20041 @opindex mvliw-branch
20042
20043 Run a pass to pack branches into VLIW instructions (default).
20044
20045 This switch is mainly for debugging the compiler and will likely be removed
20046 in a future version.
20047
20048 @item -mno-vliw-branch
20049 @opindex mno-vliw-branch
20050
20051 Do not run a pass to pack branches into VLIW instructions.
20052
20053 This switch is mainly for debugging the compiler and will likely be removed
20054 in a future version.
20055
20056 @item -mmulti-cond-exec
20057 @opindex mmulti-cond-exec
20058
20059 Enable optimization of @code{&&} and @code{||} in conditional execution
20060 (default).
20061
20062 This switch is mainly for debugging the compiler and will likely be removed
20063 in a future version.
20064
20065 @item -mno-multi-cond-exec
20066 @opindex mno-multi-cond-exec
20067
20068 Disable optimization of @code{&&} and @code{||} in conditional execution.
20069
20070 This switch is mainly for debugging the compiler and will likely be removed
20071 in a future version.
20072
20073 @item -mnested-cond-exec
20074 @opindex mnested-cond-exec
20075
20076 Enable nested conditional execution optimizations (default).
20077
20078 This switch is mainly for debugging the compiler and will likely be removed
20079 in a future version.
20080
20081 @item -mno-nested-cond-exec
20082 @opindex mno-nested-cond-exec
20083
20084 Disable nested conditional execution optimizations.
20085
20086 This switch is mainly for debugging the compiler and will likely be removed
20087 in a future version.
20088
20089 @item -moptimize-membar
20090 @opindex moptimize-membar
20091
20092 This switch removes redundant @code{membar} instructions from the
20093 compiler-generated code. It is enabled by default.
20094
20095 @item -mno-optimize-membar
20096 @opindex mno-optimize-membar
20097 @opindex moptimize-membar
20098
20099 This switch disables the automatic removal of redundant @code{membar}
20100 instructions from the generated code.
20101
20102 @item -mtomcat-stats
20103 @opindex mtomcat-stats
20104
20105 Cause gas to print out tomcat statistics.
20106
20107 @item -mcpu=@var{cpu}
20108 @opindex mcpu
20109
20110 Select the processor type for which to generate code. Possible values are
20111 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20112 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20113
20114 @end table
20115
20116 @node GNU/Linux Options
20117 @subsection GNU/Linux Options
20118
20119 These @samp{-m} options are defined for GNU/Linux targets:
20120
20121 @table @gcctabopt
20122 @item -mglibc
20123 @opindex mglibc
20124 Use the GNU C library. This is the default except
20125 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20126 @samp{*-*-linux-*android*} targets.
20127
20128 @item -muclibc
20129 @opindex muclibc
20130 Use uClibc C library. This is the default on
20131 @samp{*-*-linux-*uclibc*} targets.
20132
20133 @item -mmusl
20134 @opindex mmusl
20135 Use the musl C library. This is the default on
20136 @samp{*-*-linux-*musl*} targets.
20137
20138 @item -mbionic
20139 @opindex mbionic
20140 Use Bionic C library. This is the default on
20141 @samp{*-*-linux-*android*} targets.
20142
20143 @item -mandroid
20144 @opindex mandroid
20145 Compile code compatible with Android platform. This is the default on
20146 @samp{*-*-linux-*android*} targets.
20147
20148 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20149 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20150 this option makes the GCC driver pass Android-specific options to the linker.
20151 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20152 to be defined.
20153
20154 @item -tno-android-cc
20155 @opindex tno-android-cc
20156 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20157 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20158 @option{-fno-rtti} by default.
20159
20160 @item -tno-android-ld
20161 @opindex tno-android-ld
20162 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20163 linking options to the linker.
20164
20165 @end table
20166
20167 @node H8/300 Options
20168 @subsection H8/300 Options
20169
20170 These @samp{-m} options are defined for the H8/300 implementations:
20171
20172 @table @gcctabopt
20173 @item -mrelax
20174 @opindex mrelax
20175 Shorten some address references at link time, when possible; uses the
20176 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20177 ld, Using ld}, for a fuller description.
20178
20179 @item -mh
20180 @opindex mh
20181 Generate code for the H8/300H@.
20182
20183 @item -ms
20184 @opindex ms
20185 Generate code for the H8S@.
20186
20187 @item -mn
20188 @opindex mn
20189 Generate code for the H8S and H8/300H in the normal mode. This switch
20190 must be used either with @option{-mh} or @option{-ms}.
20191
20192 @item -ms2600
20193 @opindex ms2600
20194 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20195
20196 @item -mexr
20197 @opindex mexr
20198 Extended registers are stored on stack before execution of function
20199 with monitor attribute. Default option is @option{-mexr}.
20200 This option is valid only for H8S targets.
20201
20202 @item -mno-exr
20203 @opindex mno-exr
20204 @opindex mexr
20205 Extended registers are not stored on stack before execution of function
20206 with monitor attribute. Default option is @option{-mno-exr}.
20207 This option is valid only for H8S targets.
20208
20209 @item -mint32
20210 @opindex mint32
20211 Make @code{int} data 32 bits by default.
20212
20213 @item -malign-300
20214 @opindex malign-300
20215 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20216 The default for the H8/300H and H8S is to align longs and floats on
20217 4-byte boundaries.
20218 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20219 This option has no effect on the H8/300.
20220 @end table
20221
20222 @node HPPA Options
20223 @subsection HPPA Options
20224 @cindex HPPA Options
20225
20226 These @samp{-m} options are defined for the HPPA family of computers:
20227
20228 @table @gcctabopt
20229 @item -march=@var{architecture-type}
20230 @opindex march
20231 Generate code for the specified architecture. The choices for
20232 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20233 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20234 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20235 architecture option for your machine. Code compiled for lower numbered
20236 architectures runs on higher numbered architectures, but not the
20237 other way around.
20238
20239 @item -mpa-risc-1-0
20240 @itemx -mpa-risc-1-1
20241 @itemx -mpa-risc-2-0
20242 @opindex mpa-risc-1-0
20243 @opindex mpa-risc-1-1
20244 @opindex mpa-risc-2-0
20245 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20246
20247 @item -mcaller-copies
20248 @opindex mcaller-copies
20249 The caller copies function arguments passed by hidden reference. This
20250 option should be used with care as it is not compatible with the default
20251 32-bit runtime. However, only aggregates larger than eight bytes are
20252 passed by hidden reference and the option provides better compatibility
20253 with OpenMP.
20254
20255 @item -mjump-in-delay
20256 @opindex mjump-in-delay
20257 This option is ignored and provided for compatibility purposes only.
20258
20259 @item -mdisable-fpregs
20260 @opindex mdisable-fpregs
20261 Prevent floating-point registers from being used in any manner. This is
20262 necessary for compiling kernels that perform lazy context switching of
20263 floating-point registers. If you use this option and attempt to perform
20264 floating-point operations, the compiler aborts.
20265
20266 @item -mdisable-indexing
20267 @opindex mdisable-indexing
20268 Prevent the compiler from using indexing address modes. This avoids some
20269 rather obscure problems when compiling MIG generated code under MACH@.
20270
20271 @item -mno-space-regs
20272 @opindex mno-space-regs
20273 @opindex mspace-regs
20274 Generate code that assumes the target has no space registers. This allows
20275 GCC to generate faster indirect calls and use unscaled index address modes.
20276
20277 Such code is suitable for level 0 PA systems and kernels.
20278
20279 @item -mfast-indirect-calls
20280 @opindex mfast-indirect-calls
20281 Generate code that assumes calls never cross space boundaries. This
20282 allows GCC to emit code that performs faster indirect calls.
20283
20284 This option does not work in the presence of shared libraries or nested
20285 functions.
20286
20287 @item -mfixed-range=@var{register-range}
20288 @opindex mfixed-range
20289 Generate code treating the given register range as fixed registers.
20290 A fixed register is one that the register allocator cannot use. This is
20291 useful when compiling kernel code. A register range is specified as
20292 two registers separated by a dash. Multiple register ranges can be
20293 specified separated by a comma.
20294
20295 @item -mlong-load-store
20296 @opindex mlong-load-store
20297 Generate 3-instruction load and store sequences as sometimes required by
20298 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20299 the HP compilers.
20300
20301 @item -mportable-runtime
20302 @opindex mportable-runtime
20303 Use the portable calling conventions proposed by HP for ELF systems.
20304
20305 @item -mgas
20306 @opindex mgas
20307 Enable the use of assembler directives only GAS understands.
20308
20309 @item -mschedule=@var{cpu-type}
20310 @opindex mschedule
20311 Schedule code according to the constraints for the machine type
20312 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20313 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20314 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20315 proper scheduling option for your machine. The default scheduling is
20316 @samp{8000}.
20317
20318 @item -mlinker-opt
20319 @opindex mlinker-opt
20320 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20321 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20322 linkers in which they give bogus error messages when linking some programs.
20323
20324 @item -msoft-float
20325 @opindex msoft-float
20326 Generate output containing library calls for floating point.
20327 @strong{Warning:} the requisite libraries are not available for all HPPA
20328 targets. Normally the facilities of the machine's usual C compiler are
20329 used, but this cannot be done directly in cross-compilation. You must make
20330 your own arrangements to provide suitable library functions for
20331 cross-compilation.
20332
20333 @option{-msoft-float} changes the calling convention in the output file;
20334 therefore, it is only useful if you compile @emph{all} of a program with
20335 this option. In particular, you need to compile @file{libgcc.a}, the
20336 library that comes with GCC, with @option{-msoft-float} in order for
20337 this to work.
20338
20339 @item -msio
20340 @opindex msio
20341 Generate the predefine, @code{_SIO}, for server IO@. The default is
20342 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20343 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20344 options are available under HP-UX and HI-UX@.
20345
20346 @item -mgnu-ld
20347 @opindex mgnu-ld
20348 Use options specific to GNU @command{ld}.
20349 This passes @option{-shared} to @command{ld} when
20350 building a shared library. It is the default when GCC is configured,
20351 explicitly or implicitly, with the GNU linker. This option does not
20352 affect which @command{ld} is called; it only changes what parameters
20353 are passed to that @command{ld}.
20354 The @command{ld} that is called is determined by the
20355 @option{--with-ld} configure option, GCC's program search path, and
20356 finally by the user's @env{PATH}. The linker used by GCC can be printed
20357 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20358 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20359
20360 @item -mhp-ld
20361 @opindex mhp-ld
20362 Use options specific to HP @command{ld}.
20363 This passes @option{-b} to @command{ld} when building
20364 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20365 links. It is the default when GCC is configured, explicitly or
20366 implicitly, with the HP linker. This option does not affect
20367 which @command{ld} is called; it only changes what parameters are passed to that
20368 @command{ld}.
20369 The @command{ld} that is called is determined by the @option{--with-ld}
20370 configure option, GCC's program search path, and finally by the user's
20371 @env{PATH}. The linker used by GCC can be printed using @samp{which
20372 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20373 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20374
20375 @item -mlong-calls
20376 @opindex mno-long-calls
20377 @opindex mlong-calls
20378 Generate code that uses long call sequences. This ensures that a call
20379 is always able to reach linker generated stubs. The default is to generate
20380 long calls only when the distance from the call site to the beginning
20381 of the function or translation unit, as the case may be, exceeds a
20382 predefined limit set by the branch type being used. The limits for
20383 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20384 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20385 240,000 bytes.
20386
20387 Distances are measured from the beginning of functions when using the
20388 @option{-ffunction-sections} option, or when using the @option{-mgas}
20389 and @option{-mno-portable-runtime} options together under HP-UX with
20390 the SOM linker.
20391
20392 It is normally not desirable to use this option as it degrades
20393 performance. However, it may be useful in large applications,
20394 particularly when partial linking is used to build the application.
20395
20396 The types of long calls used depends on the capabilities of the
20397 assembler and linker, and the type of code being generated. The
20398 impact on systems that support long absolute calls, and long pic
20399 symbol-difference or pc-relative calls should be relatively small.
20400 However, an indirect call is used on 32-bit ELF systems in pic code
20401 and it is quite long.
20402
20403 @item -munix=@var{unix-std}
20404 @opindex march
20405 Generate compiler predefines and select a startfile for the specified
20406 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20407 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20408 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20409 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20410 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20411 and later.
20412
20413 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20414 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20415 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20416 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20417 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20418 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20419
20420 It is @emph{important} to note that this option changes the interfaces
20421 for various library routines. It also affects the operational behavior
20422 of the C library. Thus, @emph{extreme} care is needed in using this
20423 option.
20424
20425 Library code that is intended to operate with more than one UNIX
20426 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20427 as appropriate. Most GNU software doesn't provide this capability.
20428
20429 @item -nolibdld
20430 @opindex nolibdld
20431 Suppress the generation of link options to search libdld.sl when the
20432 @option{-static} option is specified on HP-UX 10 and later.
20433
20434 @item -static
20435 @opindex static
20436 The HP-UX implementation of setlocale in libc has a dependency on
20437 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20438 when the @option{-static} option is specified, special link options
20439 are needed to resolve this dependency.
20440
20441 On HP-UX 10 and later, the GCC driver adds the necessary options to
20442 link with libdld.sl when the @option{-static} option is specified.
20443 This causes the resulting binary to be dynamic. On the 64-bit port,
20444 the linkers generate dynamic binaries by default in any case. The
20445 @option{-nolibdld} option can be used to prevent the GCC driver from
20446 adding these link options.
20447
20448 @item -threads
20449 @opindex threads
20450 Add support for multithreading with the @dfn{dce thread} library
20451 under HP-UX@. This option sets flags for both the preprocessor and
20452 linker.
20453 @end table
20454
20455 @node IA-64 Options
20456 @subsection IA-64 Options
20457 @cindex IA-64 Options
20458
20459 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20460
20461 @table @gcctabopt
20462 @item -mbig-endian
20463 @opindex mbig-endian
20464 Generate code for a big-endian target. This is the default for HP-UX@.
20465
20466 @item -mlittle-endian
20467 @opindex mlittle-endian
20468 Generate code for a little-endian target. This is the default for AIX5
20469 and GNU/Linux.
20470
20471 @item -mgnu-as
20472 @itemx -mno-gnu-as
20473 @opindex mgnu-as
20474 @opindex mno-gnu-as
20475 Generate (or don't) code for the GNU assembler. This is the default.
20476 @c Also, this is the default if the configure option @option{--with-gnu-as}
20477 @c is used.
20478
20479 @item -mgnu-ld
20480 @itemx -mno-gnu-ld
20481 @opindex mgnu-ld
20482 @opindex mno-gnu-ld
20483 Generate (or don't) code for the GNU linker. This is the default.
20484 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20485 @c is used.
20486
20487 @item -mno-pic
20488 @opindex mno-pic
20489 Generate code that does not use a global pointer register. The result
20490 is not position independent code, and violates the IA-64 ABI@.
20491
20492 @item -mvolatile-asm-stop
20493 @itemx -mno-volatile-asm-stop
20494 @opindex mvolatile-asm-stop
20495 @opindex mno-volatile-asm-stop
20496 Generate (or don't) a stop bit immediately before and after volatile asm
20497 statements.
20498
20499 @item -mregister-names
20500 @itemx -mno-register-names
20501 @opindex mregister-names
20502 @opindex mno-register-names
20503 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20504 the stacked registers. This may make assembler output more readable.
20505
20506 @item -mno-sdata
20507 @itemx -msdata
20508 @opindex mno-sdata
20509 @opindex msdata
20510 Disable (or enable) optimizations that use the small data section. This may
20511 be useful for working around optimizer bugs.
20512
20513 @item -mconstant-gp
20514 @opindex mconstant-gp
20515 Generate code that uses a single constant global pointer value. This is
20516 useful when compiling kernel code.
20517
20518 @item -mauto-pic
20519 @opindex mauto-pic
20520 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20521 This is useful when compiling firmware code.
20522
20523 @item -minline-float-divide-min-latency
20524 @opindex minline-float-divide-min-latency
20525 Generate code for inline divides of floating-point values
20526 using the minimum latency algorithm.
20527
20528 @item -minline-float-divide-max-throughput
20529 @opindex minline-float-divide-max-throughput
20530 Generate code for inline divides of floating-point values
20531 using the maximum throughput algorithm.
20532
20533 @item -mno-inline-float-divide
20534 @opindex mno-inline-float-divide
20535 Do not generate inline code for divides of floating-point values.
20536
20537 @item -minline-int-divide-min-latency
20538 @opindex minline-int-divide-min-latency
20539 Generate code for inline divides of integer values
20540 using the minimum latency algorithm.
20541
20542 @item -minline-int-divide-max-throughput
20543 @opindex minline-int-divide-max-throughput
20544 Generate code for inline divides of integer values
20545 using the maximum throughput algorithm.
20546
20547 @item -mno-inline-int-divide
20548 @opindex mno-inline-int-divide
20549 @opindex minline-int-divide
20550 Do not generate inline code for divides of integer values.
20551
20552 @item -minline-sqrt-min-latency
20553 @opindex minline-sqrt-min-latency
20554 Generate code for inline square roots
20555 using the minimum latency algorithm.
20556
20557 @item -minline-sqrt-max-throughput
20558 @opindex minline-sqrt-max-throughput
20559 Generate code for inline square roots
20560 using the maximum throughput algorithm.
20561
20562 @item -mno-inline-sqrt
20563 @opindex mno-inline-sqrt
20564 Do not generate inline code for @code{sqrt}.
20565
20566 @item -mfused-madd
20567 @itemx -mno-fused-madd
20568 @opindex mfused-madd
20569 @opindex mno-fused-madd
20570 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20571 instructions. The default is to use these instructions.
20572
20573 @item -mno-dwarf2-asm
20574 @itemx -mdwarf2-asm
20575 @opindex mno-dwarf2-asm
20576 @opindex mdwarf2-asm
20577 Don't (or do) generate assembler code for the DWARF line number debugging
20578 info. This may be useful when not using the GNU assembler.
20579
20580 @item -mearly-stop-bits
20581 @itemx -mno-early-stop-bits
20582 @opindex mearly-stop-bits
20583 @opindex mno-early-stop-bits
20584 Allow stop bits to be placed earlier than immediately preceding the
20585 instruction that triggered the stop bit. This can improve instruction
20586 scheduling, but does not always do so.
20587
20588 @item -mfixed-range=@var{register-range}
20589 @opindex mfixed-range
20590 Generate code treating the given register range as fixed registers.
20591 A fixed register is one that the register allocator cannot use. This is
20592 useful when compiling kernel code. A register range is specified as
20593 two registers separated by a dash. Multiple register ranges can be
20594 specified separated by a comma.
20595
20596 @item -mtls-size=@var{tls-size}
20597 @opindex mtls-size
20598 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20599 64.
20600
20601 @item -mtune=@var{cpu-type}
20602 @opindex mtune
20603 Tune the instruction scheduling for a particular CPU, Valid values are
20604 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20605 and @samp{mckinley}.
20606
20607 @item -milp32
20608 @itemx -mlp64
20609 @opindex milp32
20610 @opindex mlp64
20611 Generate code for a 32-bit or 64-bit environment.
20612 The 32-bit environment sets int, long and pointer to 32 bits.
20613 The 64-bit environment sets int to 32 bits and long and pointer
20614 to 64 bits. These are HP-UX specific flags.
20615
20616 @item -mno-sched-br-data-spec
20617 @itemx -msched-br-data-spec
20618 @opindex mno-sched-br-data-spec
20619 @opindex msched-br-data-spec
20620 (Dis/En)able data speculative scheduling before reload.
20621 This results in generation of @code{ld.a} instructions and
20622 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20623 The default setting is disabled.
20624
20625 @item -msched-ar-data-spec
20626 @itemx -mno-sched-ar-data-spec
20627 @opindex msched-ar-data-spec
20628 @opindex mno-sched-ar-data-spec
20629 (En/Dis)able data speculative scheduling after reload.
20630 This results in generation of @code{ld.a} instructions and
20631 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20632 The default setting is enabled.
20633
20634 @item -mno-sched-control-spec
20635 @itemx -msched-control-spec
20636 @opindex mno-sched-control-spec
20637 @opindex msched-control-spec
20638 (Dis/En)able control speculative scheduling. This feature is
20639 available only during region scheduling (i.e.@: before reload).
20640 This results in generation of the @code{ld.s} instructions and
20641 the corresponding check instructions @code{chk.s}.
20642 The default setting is disabled.
20643
20644 @item -msched-br-in-data-spec
20645 @itemx -mno-sched-br-in-data-spec
20646 @opindex msched-br-in-data-spec
20647 @opindex mno-sched-br-in-data-spec
20648 (En/Dis)able speculative scheduling of the instructions that
20649 are dependent on the data speculative loads before reload.
20650 This is effective only with @option{-msched-br-data-spec} enabled.
20651 The default setting is enabled.
20652
20653 @item -msched-ar-in-data-spec
20654 @itemx -mno-sched-ar-in-data-spec
20655 @opindex msched-ar-in-data-spec
20656 @opindex mno-sched-ar-in-data-spec
20657 (En/Dis)able speculative scheduling of the instructions that
20658 are dependent on the data speculative loads after reload.
20659 This is effective only with @option{-msched-ar-data-spec} enabled.
20660 The default setting is enabled.
20661
20662 @item -msched-in-control-spec
20663 @itemx -mno-sched-in-control-spec
20664 @opindex msched-in-control-spec
20665 @opindex mno-sched-in-control-spec
20666 (En/Dis)able speculative scheduling of the instructions that
20667 are dependent on the control speculative loads.
20668 This is effective only with @option{-msched-control-spec} enabled.
20669 The default setting is enabled.
20670
20671 @item -mno-sched-prefer-non-data-spec-insns
20672 @itemx -msched-prefer-non-data-spec-insns
20673 @opindex mno-sched-prefer-non-data-spec-insns
20674 @opindex msched-prefer-non-data-spec-insns
20675 If enabled, data-speculative instructions are chosen for schedule
20676 only if there are no other choices at the moment. This makes
20677 the use of the data speculation much more conservative.
20678 The default setting is disabled.
20679
20680 @item -mno-sched-prefer-non-control-spec-insns
20681 @itemx -msched-prefer-non-control-spec-insns
20682 @opindex mno-sched-prefer-non-control-spec-insns
20683 @opindex msched-prefer-non-control-spec-insns
20684 If enabled, control-speculative instructions are chosen for schedule
20685 only if there are no other choices at the moment. This makes
20686 the use of the control speculation much more conservative.
20687 The default setting is disabled.
20688
20689 @item -mno-sched-count-spec-in-critical-path
20690 @itemx -msched-count-spec-in-critical-path
20691 @opindex mno-sched-count-spec-in-critical-path
20692 @opindex msched-count-spec-in-critical-path
20693 If enabled, speculative dependencies are considered during
20694 computation of the instructions priorities. This makes the use of the
20695 speculation a bit more conservative.
20696 The default setting is disabled.
20697
20698 @item -msched-spec-ldc
20699 @opindex msched-spec-ldc
20700 Use a simple data speculation check. This option is on by default.
20701
20702 @item -msched-control-spec-ldc
20703 @opindex msched-spec-ldc
20704 Use a simple check for control speculation. This option is on by default.
20705
20706 @item -msched-stop-bits-after-every-cycle
20707 @opindex msched-stop-bits-after-every-cycle
20708 Place a stop bit after every cycle when scheduling. This option is on
20709 by default.
20710
20711 @item -msched-fp-mem-deps-zero-cost
20712 @opindex msched-fp-mem-deps-zero-cost
20713 Assume that floating-point stores and loads are not likely to cause a conflict
20714 when placed into the same instruction group. This option is disabled by
20715 default.
20716
20717 @item -msel-sched-dont-check-control-spec
20718 @opindex msel-sched-dont-check-control-spec
20719 Generate checks for control speculation in selective scheduling.
20720 This flag is disabled by default.
20721
20722 @item -msched-max-memory-insns=@var{max-insns}
20723 @opindex msched-max-memory-insns
20724 Limit on the number of memory insns per instruction group, giving lower
20725 priority to subsequent memory insns attempting to schedule in the same
20726 instruction group. Frequently useful to prevent cache bank conflicts.
20727 The default value is 1.
20728
20729 @item -msched-max-memory-insns-hard-limit
20730 @opindex msched-max-memory-insns-hard-limit
20731 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20732 disallowing more than that number in an instruction group.
20733 Otherwise, the limit is ``soft'', meaning that non-memory operations
20734 are preferred when the limit is reached, but memory operations may still
20735 be scheduled.
20736
20737 @end table
20738
20739 @node LM32 Options
20740 @subsection LM32 Options
20741 @cindex LM32 options
20742
20743 These @option{-m} options are defined for the LatticeMico32 architecture:
20744
20745 @table @gcctabopt
20746 @item -mbarrel-shift-enabled
20747 @opindex mbarrel-shift-enabled
20748 Enable barrel-shift instructions.
20749
20750 @item -mdivide-enabled
20751 @opindex mdivide-enabled
20752 Enable divide and modulus instructions.
20753
20754 @item -mmultiply-enabled
20755 @opindex multiply-enabled
20756 Enable multiply instructions.
20757
20758 @item -msign-extend-enabled
20759 @opindex msign-extend-enabled
20760 Enable sign extend instructions.
20761
20762 @item -muser-enabled
20763 @opindex muser-enabled
20764 Enable user-defined instructions.
20765
20766 @end table
20767
20768 @node M32C Options
20769 @subsection M32C Options
20770 @cindex M32C options
20771
20772 @table @gcctabopt
20773 @item -mcpu=@var{name}
20774 @opindex mcpu=
20775 Select the CPU for which code is generated. @var{name} may be one of
20776 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20777 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20778 the M32C/80 series.
20779
20780 @item -msim
20781 @opindex msim
20782 Specifies that the program will be run on the simulator. This causes
20783 an alternate runtime library to be linked in which supports, for
20784 example, file I/O@. You must not use this option when generating
20785 programs that will run on real hardware; you must provide your own
20786 runtime library for whatever I/O functions are needed.
20787
20788 @item -memregs=@var{number}
20789 @opindex memregs=
20790 Specifies the number of memory-based pseudo-registers GCC uses
20791 during code generation. These pseudo-registers are used like real
20792 registers, so there is a tradeoff between GCC's ability to fit the
20793 code into available registers, and the performance penalty of using
20794 memory instead of registers. Note that all modules in a program must
20795 be compiled with the same value for this option. Because of that, you
20796 must not use this option with GCC's default runtime libraries.
20797
20798 @end table
20799
20800 @node M32R/D Options
20801 @subsection M32R/D Options
20802 @cindex M32R/D options
20803
20804 These @option{-m} options are defined for Renesas M32R/D architectures:
20805
20806 @table @gcctabopt
20807 @item -m32r2
20808 @opindex m32r2
20809 Generate code for the M32R/2@.
20810
20811 @item -m32rx
20812 @opindex m32rx
20813 Generate code for the M32R/X@.
20814
20815 @item -m32r
20816 @opindex m32r
20817 Generate code for the M32R@. This is the default.
20818
20819 @item -mmodel=small
20820 @opindex mmodel=small
20821 Assume all objects live in the lower 16MB of memory (so that their addresses
20822 can be loaded with the @code{ld24} instruction), and assume all subroutines
20823 are reachable with the @code{bl} instruction.
20824 This is the default.
20825
20826 The addressability of a particular object can be set with the
20827 @code{model} attribute.
20828
20829 @item -mmodel=medium
20830 @opindex mmodel=medium
20831 Assume objects may be anywhere in the 32-bit address space (the compiler
20832 generates @code{seth/add3} instructions to load their addresses), and
20833 assume all subroutines are reachable with the @code{bl} instruction.
20834
20835 @item -mmodel=large
20836 @opindex mmodel=large
20837 Assume objects may be anywhere in the 32-bit address space (the compiler
20838 generates @code{seth/add3} instructions to load their addresses), and
20839 assume subroutines may not be reachable with the @code{bl} instruction
20840 (the compiler generates the much slower @code{seth/add3/jl}
20841 instruction sequence).
20842
20843 @item -msdata=none
20844 @opindex msdata=none
20845 Disable use of the small data area. Variables are put into
20846 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20847 @code{section} attribute has been specified).
20848 This is the default.
20849
20850 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20851 Objects may be explicitly put in the small data area with the
20852 @code{section} attribute using one of these sections.
20853
20854 @item -msdata=sdata
20855 @opindex msdata=sdata
20856 Put small global and static data in the small data area, but do not
20857 generate special code to reference them.
20858
20859 @item -msdata=use
20860 @opindex msdata=use
20861 Put small global and static data in the small data area, and generate
20862 special instructions to reference them.
20863
20864 @item -G @var{num}
20865 @opindex G
20866 @cindex smaller data references
20867 Put global and static objects less than or equal to @var{num} bytes
20868 into the small data or BSS sections instead of the normal data or BSS
20869 sections. The default value of @var{num} is 8.
20870 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20871 for this option to have any effect.
20872
20873 All modules should be compiled with the same @option{-G @var{num}} value.
20874 Compiling with different values of @var{num} may or may not work; if it
20875 doesn't the linker gives an error message---incorrect code is not
20876 generated.
20877
20878 @item -mdebug
20879 @opindex mdebug
20880 Makes the M32R-specific code in the compiler display some statistics
20881 that might help in debugging programs.
20882
20883 @item -malign-loops
20884 @opindex malign-loops
20885 Align all loops to a 32-byte boundary.
20886
20887 @item -mno-align-loops
20888 @opindex mno-align-loops
20889 Do not enforce a 32-byte alignment for loops. This is the default.
20890
20891 @item -missue-rate=@var{number}
20892 @opindex missue-rate=@var{number}
20893 Issue @var{number} instructions per cycle. @var{number} can only be 1
20894 or 2.
20895
20896 @item -mbranch-cost=@var{number}
20897 @opindex mbranch-cost=@var{number}
20898 @var{number} can only be 1 or 2. If it is 1 then branches are
20899 preferred over conditional code, if it is 2, then the opposite applies.
20900
20901 @item -mflush-trap=@var{number}
20902 @opindex mflush-trap=@var{number}
20903 Specifies the trap number to use to flush the cache. The default is
20904 12. Valid numbers are between 0 and 15 inclusive.
20905
20906 @item -mno-flush-trap
20907 @opindex mno-flush-trap
20908 Specifies that the cache cannot be flushed by using a trap.
20909
20910 @item -mflush-func=@var{name}
20911 @opindex mflush-func=@var{name}
20912 Specifies the name of the operating system function to call to flush
20913 the cache. The default is @samp{_flush_cache}, but a function call
20914 is only used if a trap is not available.
20915
20916 @item -mno-flush-func
20917 @opindex mno-flush-func
20918 Indicates that there is no OS function for flushing the cache.
20919
20920 @end table
20921
20922 @node M680x0 Options
20923 @subsection M680x0 Options
20924 @cindex M680x0 options
20925
20926 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20927 The default settings depend on which architecture was selected when
20928 the compiler was configured; the defaults for the most common choices
20929 are given below.
20930
20931 @table @gcctabopt
20932 @item -march=@var{arch}
20933 @opindex march
20934 Generate code for a specific M680x0 or ColdFire instruction set
20935 architecture. Permissible values of @var{arch} for M680x0
20936 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20937 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20938 architectures are selected according to Freescale's ISA classification
20939 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20940 @samp{isab} and @samp{isac}.
20941
20942 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20943 code for a ColdFire target. The @var{arch} in this macro is one of the
20944 @option{-march} arguments given above.
20945
20946 When used together, @option{-march} and @option{-mtune} select code
20947 that runs on a family of similar processors but that is optimized
20948 for a particular microarchitecture.
20949
20950 @item -mcpu=@var{cpu}
20951 @opindex mcpu
20952 Generate code for a specific M680x0 or ColdFire processor.
20953 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20954 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20955 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20956 below, which also classifies the CPUs into families:
20957
20958 @multitable @columnfractions 0.20 0.80
20959 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20960 @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}
20961 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20962 @item @samp{5206e} @tab @samp{5206e}
20963 @item @samp{5208} @tab @samp{5207} @samp{5208}
20964 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20965 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20966 @item @samp{5216} @tab @samp{5214} @samp{5216}
20967 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20968 @item @samp{5225} @tab @samp{5224} @samp{5225}
20969 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20970 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20971 @item @samp{5249} @tab @samp{5249}
20972 @item @samp{5250} @tab @samp{5250}
20973 @item @samp{5271} @tab @samp{5270} @samp{5271}
20974 @item @samp{5272} @tab @samp{5272}
20975 @item @samp{5275} @tab @samp{5274} @samp{5275}
20976 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20977 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20978 @item @samp{5307} @tab @samp{5307}
20979 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20980 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20981 @item @samp{5407} @tab @samp{5407}
20982 @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}
20983 @end multitable
20984
20985 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20986 @var{arch} is compatible with @var{cpu}. Other combinations of
20987 @option{-mcpu} and @option{-march} are rejected.
20988
20989 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20990 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20991 where the value of @var{family} is given by the table above.
20992
20993 @item -mtune=@var{tune}
20994 @opindex mtune
20995 Tune the code for a particular microarchitecture within the
20996 constraints set by @option{-march} and @option{-mcpu}.
20997 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20998 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20999 and @samp{cpu32}. The ColdFire microarchitectures
21000 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
21001
21002 You can also use @option{-mtune=68020-40} for code that needs
21003 to run relatively well on 68020, 68030 and 68040 targets.
21004 @option{-mtune=68020-60} is similar but includes 68060 targets
21005 as well. These two options select the same tuning decisions as
21006 @option{-m68020-40} and @option{-m68020-60} respectively.
21007
21008 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
21009 when tuning for 680x0 architecture @var{arch}. It also defines
21010 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
21011 option is used. If GCC is tuning for a range of architectures,
21012 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
21013 it defines the macros for every architecture in the range.
21014
21015 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
21016 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
21017 of the arguments given above.
21018
21019 @item -m68000
21020 @itemx -mc68000
21021 @opindex m68000
21022 @opindex mc68000
21023 Generate output for a 68000. This is the default
21024 when the compiler is configured for 68000-based systems.
21025 It is equivalent to @option{-march=68000}.
21026
21027 Use this option for microcontrollers with a 68000 or EC000 core,
21028 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21029
21030 @item -m68010
21031 @opindex m68010
21032 Generate output for a 68010. This is the default
21033 when the compiler is configured for 68010-based systems.
21034 It is equivalent to @option{-march=68010}.
21035
21036 @item -m68020
21037 @itemx -mc68020
21038 @opindex m68020
21039 @opindex mc68020
21040 Generate output for a 68020. This is the default
21041 when the compiler is configured for 68020-based systems.
21042 It is equivalent to @option{-march=68020}.
21043
21044 @item -m68030
21045 @opindex m68030
21046 Generate output for a 68030. This is the default when the compiler is
21047 configured for 68030-based systems. It is equivalent to
21048 @option{-march=68030}.
21049
21050 @item -m68040
21051 @opindex m68040
21052 Generate output for a 68040. This is the default when the compiler is
21053 configured for 68040-based systems. It is equivalent to
21054 @option{-march=68040}.
21055
21056 This option inhibits the use of 68881/68882 instructions that have to be
21057 emulated by software on the 68040. Use this option if your 68040 does not
21058 have code to emulate those instructions.
21059
21060 @item -m68060
21061 @opindex m68060
21062 Generate output for a 68060. This is the default when the compiler is
21063 configured for 68060-based systems. It is equivalent to
21064 @option{-march=68060}.
21065
21066 This option inhibits the use of 68020 and 68881/68882 instructions that
21067 have to be emulated by software on the 68060. Use this option if your 68060
21068 does not have code to emulate those instructions.
21069
21070 @item -mcpu32
21071 @opindex mcpu32
21072 Generate output for a CPU32. This is the default
21073 when the compiler is configured for CPU32-based systems.
21074 It is equivalent to @option{-march=cpu32}.
21075
21076 Use this option for microcontrollers with a
21077 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21078 68336, 68340, 68341, 68349 and 68360.
21079
21080 @item -m5200
21081 @opindex m5200
21082 Generate output for a 520X ColdFire CPU@. This is the default
21083 when the compiler is configured for 520X-based systems.
21084 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21085 in favor of that option.
21086
21087 Use this option for microcontroller with a 5200 core, including
21088 the MCF5202, MCF5203, MCF5204 and MCF5206.
21089
21090 @item -m5206e
21091 @opindex m5206e
21092 Generate output for a 5206e ColdFire CPU@. The option is now
21093 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21094
21095 @item -m528x
21096 @opindex m528x
21097 Generate output for a member of the ColdFire 528X family.
21098 The option is now deprecated in favor of the equivalent
21099 @option{-mcpu=528x}.
21100
21101 @item -m5307
21102 @opindex m5307
21103 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21104 in favor of the equivalent @option{-mcpu=5307}.
21105
21106 @item -m5407
21107 @opindex m5407
21108 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21109 in favor of the equivalent @option{-mcpu=5407}.
21110
21111 @item -mcfv4e
21112 @opindex mcfv4e
21113 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21114 This includes use of hardware floating-point instructions.
21115 The option is equivalent to @option{-mcpu=547x}, and is now
21116 deprecated in favor of that option.
21117
21118 @item -m68020-40
21119 @opindex m68020-40
21120 Generate output for a 68040, without using any of the new instructions.
21121 This results in code that can run relatively efficiently on either a
21122 68020/68881 or a 68030 or a 68040. The generated code does use the
21123 68881 instructions that are emulated on the 68040.
21124
21125 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21126
21127 @item -m68020-60
21128 @opindex m68020-60
21129 Generate output for a 68060, without using any of the new instructions.
21130 This results in code that can run relatively efficiently on either a
21131 68020/68881 or a 68030 or a 68040. The generated code does use the
21132 68881 instructions that are emulated on the 68060.
21133
21134 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21135
21136 @item -mhard-float
21137 @itemx -m68881
21138 @opindex mhard-float
21139 @opindex m68881
21140 Generate floating-point instructions. This is the default for 68020
21141 and above, and for ColdFire devices that have an FPU@. It defines the
21142 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21143 on ColdFire targets.
21144
21145 @item -msoft-float
21146 @opindex msoft-float
21147 Do not generate floating-point instructions; use library calls instead.
21148 This is the default for 68000, 68010, and 68832 targets. It is also
21149 the default for ColdFire devices that have no FPU.
21150
21151 @item -mdiv
21152 @itemx -mno-div
21153 @opindex mdiv
21154 @opindex mno-div
21155 Generate (do not generate) ColdFire hardware divide and remainder
21156 instructions. If @option{-march} is used without @option{-mcpu},
21157 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21158 architectures. Otherwise, the default is taken from the target CPU
21159 (either the default CPU, or the one specified by @option{-mcpu}). For
21160 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21161 @option{-mcpu=5206e}.
21162
21163 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21164
21165 @item -mshort
21166 @opindex mshort
21167 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21168 Additionally, parameters passed on the stack are also aligned to a
21169 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21170
21171 @item -mno-short
21172 @opindex mno-short
21173 Do not consider type @code{int} to be 16 bits wide. This is the default.
21174
21175 @item -mnobitfield
21176 @itemx -mno-bitfield
21177 @opindex mnobitfield
21178 @opindex mno-bitfield
21179 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21180 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21181
21182 @item -mbitfield
21183 @opindex mbitfield
21184 Do use the bit-field instructions. The @option{-m68020} option implies
21185 @option{-mbitfield}. This is the default if you use a configuration
21186 designed for a 68020.
21187
21188 @item -mrtd
21189 @opindex mrtd
21190 Use a different function-calling convention, in which functions
21191 that take a fixed number of arguments return with the @code{rtd}
21192 instruction, which pops their arguments while returning. This
21193 saves one instruction in the caller since there is no need to pop
21194 the arguments there.
21195
21196 This calling convention is incompatible with the one normally
21197 used on Unix, so you cannot use it if you need to call libraries
21198 compiled with the Unix compiler.
21199
21200 Also, you must provide function prototypes for all functions that
21201 take variable numbers of arguments (including @code{printf});
21202 otherwise incorrect code is generated for calls to those
21203 functions.
21204
21205 In addition, seriously incorrect code results if you call a
21206 function with too many arguments. (Normally, extra arguments are
21207 harmlessly ignored.)
21208
21209 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21210 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21211
21212 The default is @option{-mno-rtd}.
21213
21214 @item -malign-int
21215 @itemx -mno-align-int
21216 @opindex malign-int
21217 @opindex mno-align-int
21218 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21219 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21220 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21221 Aligning variables on 32-bit boundaries produces code that runs somewhat
21222 faster on processors with 32-bit busses at the expense of more memory.
21223
21224 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21225 aligns structures containing the above types differently than
21226 most published application binary interface specifications for the m68k.
21227
21228 @item -mpcrel
21229 @opindex mpcrel
21230 Use the pc-relative addressing mode of the 68000 directly, instead of
21231 using a global offset table. At present, this option implies @option{-fpic},
21232 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21233 not presently supported with @option{-mpcrel}, though this could be supported for
21234 68020 and higher processors.
21235
21236 @item -mno-strict-align
21237 @itemx -mstrict-align
21238 @opindex mno-strict-align
21239 @opindex mstrict-align
21240 Do not (do) assume that unaligned memory references are handled by
21241 the system.
21242
21243 @item -msep-data
21244 Generate code that allows the data segment to be located in a different
21245 area of memory from the text segment. This allows for execute-in-place in
21246 an environment without virtual memory management. This option implies
21247 @option{-fPIC}.
21248
21249 @item -mno-sep-data
21250 Generate code that assumes that the data segment follows the text segment.
21251 This is the default.
21252
21253 @item -mid-shared-library
21254 Generate code that supports shared libraries via the library ID method.
21255 This allows for execute-in-place and shared libraries in an environment
21256 without virtual memory management. This option implies @option{-fPIC}.
21257
21258 @item -mno-id-shared-library
21259 Generate code that doesn't assume ID-based shared libraries are being used.
21260 This is the default.
21261
21262 @item -mshared-library-id=n
21263 Specifies the identification number of the ID-based shared library being
21264 compiled. Specifying a value of 0 generates more compact code; specifying
21265 other values forces the allocation of that number to the current
21266 library, but is no more space- or time-efficient than omitting this option.
21267
21268 @item -mxgot
21269 @itemx -mno-xgot
21270 @opindex mxgot
21271 @opindex mno-xgot
21272 When generating position-independent code for ColdFire, generate code
21273 that works if the GOT has more than 8192 entries. This code is
21274 larger and slower than code generated without this option. On M680x0
21275 processors, this option is not needed; @option{-fPIC} suffices.
21276
21277 GCC normally uses a single instruction to load values from the GOT@.
21278 While this is relatively efficient, it only works if the GOT
21279 is smaller than about 64k. Anything larger causes the linker
21280 to report an error such as:
21281
21282 @cindex relocation truncated to fit (ColdFire)
21283 @smallexample
21284 relocation truncated to fit: R_68K_GOT16O foobar
21285 @end smallexample
21286
21287 If this happens, you should recompile your code with @option{-mxgot}.
21288 It should then work with very large GOTs. However, code generated with
21289 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21290 the value of a global symbol.
21291
21292 Note that some linkers, including newer versions of the GNU linker,
21293 can create multiple GOTs and sort GOT entries. If you have such a linker,
21294 you should only need to use @option{-mxgot} when compiling a single
21295 object file that accesses more than 8192 GOT entries. Very few do.
21296
21297 These options have no effect unless GCC is generating
21298 position-independent code.
21299
21300 @item -mlong-jump-table-offsets
21301 @opindex mlong-jump-table-offsets
21302 Use 32-bit offsets in @code{switch} tables. The default is to use
21303 16-bit offsets.
21304
21305 @end table
21306
21307 @node MCore Options
21308 @subsection MCore Options
21309 @cindex MCore options
21310
21311 These are the @samp{-m} options defined for the Motorola M*Core
21312 processors.
21313
21314 @table @gcctabopt
21315
21316 @item -mhardlit
21317 @itemx -mno-hardlit
21318 @opindex mhardlit
21319 @opindex mno-hardlit
21320 Inline constants into the code stream if it can be done in two
21321 instructions or less.
21322
21323 @item -mdiv
21324 @itemx -mno-div
21325 @opindex mdiv
21326 @opindex mno-div
21327 Use the divide instruction. (Enabled by default).
21328
21329 @item -mrelax-immediate
21330 @itemx -mno-relax-immediate
21331 @opindex mrelax-immediate
21332 @opindex mno-relax-immediate
21333 Allow arbitrary-sized immediates in bit operations.
21334
21335 @item -mwide-bitfields
21336 @itemx -mno-wide-bitfields
21337 @opindex mwide-bitfields
21338 @opindex mno-wide-bitfields
21339 Always treat bit-fields as @code{int}-sized.
21340
21341 @item -m4byte-functions
21342 @itemx -mno-4byte-functions
21343 @opindex m4byte-functions
21344 @opindex mno-4byte-functions
21345 Force all functions to be aligned to a 4-byte boundary.
21346
21347 @item -mcallgraph-data
21348 @itemx -mno-callgraph-data
21349 @opindex mcallgraph-data
21350 @opindex mno-callgraph-data
21351 Emit callgraph information.
21352
21353 @item -mslow-bytes
21354 @itemx -mno-slow-bytes
21355 @opindex mslow-bytes
21356 @opindex mno-slow-bytes
21357 Prefer word access when reading byte quantities.
21358
21359 @item -mlittle-endian
21360 @itemx -mbig-endian
21361 @opindex mlittle-endian
21362 @opindex mbig-endian
21363 Generate code for a little-endian target.
21364
21365 @item -m210
21366 @itemx -m340
21367 @opindex m210
21368 @opindex m340
21369 Generate code for the 210 processor.
21370
21371 @item -mno-lsim
21372 @opindex mno-lsim
21373 Assume that runtime support has been provided and so omit the
21374 simulator library (@file{libsim.a)} from the linker command line.
21375
21376 @item -mstack-increment=@var{size}
21377 @opindex mstack-increment
21378 Set the maximum amount for a single stack increment operation. Large
21379 values can increase the speed of programs that contain functions
21380 that need a large amount of stack space, but they can also trigger a
21381 segmentation fault if the stack is extended too much. The default
21382 value is 0x1000.
21383
21384 @end table
21385
21386 @node MeP Options
21387 @subsection MeP Options
21388 @cindex MeP options
21389
21390 @table @gcctabopt
21391
21392 @item -mabsdiff
21393 @opindex mabsdiff
21394 Enables the @code{abs} instruction, which is the absolute difference
21395 between two registers.
21396
21397 @item -mall-opts
21398 @opindex mall-opts
21399 Enables all the optional instructions---average, multiply, divide, bit
21400 operations, leading zero, absolute difference, min/max, clip, and
21401 saturation.
21402
21403
21404 @item -maverage
21405 @opindex maverage
21406 Enables the @code{ave} instruction, which computes the average of two
21407 registers.
21408
21409 @item -mbased=@var{n}
21410 @opindex mbased=
21411 Variables of size @var{n} bytes or smaller are placed in the
21412 @code{.based} section by default. Based variables use the @code{$tp}
21413 register as a base register, and there is a 128-byte limit to the
21414 @code{.based} section.
21415
21416 @item -mbitops
21417 @opindex mbitops
21418 Enables the bit operation instructions---bit test (@code{btstm}), set
21419 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21420 test-and-set (@code{tas}).
21421
21422 @item -mc=@var{name}
21423 @opindex mc=
21424 Selects which section constant data is placed in. @var{name} may
21425 be @samp{tiny}, @samp{near}, or @samp{far}.
21426
21427 @item -mclip
21428 @opindex mclip
21429 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21430 useful unless you also provide @option{-mminmax}.
21431
21432 @item -mconfig=@var{name}
21433 @opindex mconfig=
21434 Selects one of the built-in core configurations. Each MeP chip has
21435 one or more modules in it; each module has a core CPU and a variety of
21436 coprocessors, optional instructions, and peripherals. The
21437 @code{MeP-Integrator} tool, not part of GCC, provides these
21438 configurations through this option; using this option is the same as
21439 using all the corresponding command-line options. The default
21440 configuration is @samp{default}.
21441
21442 @item -mcop
21443 @opindex mcop
21444 Enables the coprocessor instructions. By default, this is a 32-bit
21445 coprocessor. Note that the coprocessor is normally enabled via the
21446 @option{-mconfig=} option.
21447
21448 @item -mcop32
21449 @opindex mcop32
21450 Enables the 32-bit coprocessor's instructions.
21451
21452 @item -mcop64
21453 @opindex mcop64
21454 Enables the 64-bit coprocessor's instructions.
21455
21456 @item -mivc2
21457 @opindex mivc2
21458 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21459
21460 @item -mdc
21461 @opindex mdc
21462 Causes constant variables to be placed in the @code{.near} section.
21463
21464 @item -mdiv
21465 @opindex mdiv
21466 Enables the @code{div} and @code{divu} instructions.
21467
21468 @item -meb
21469 @opindex meb
21470 Generate big-endian code.
21471
21472 @item -mel
21473 @opindex mel
21474 Generate little-endian code.
21475
21476 @item -mio-volatile
21477 @opindex mio-volatile
21478 Tells the compiler that any variable marked with the @code{io}
21479 attribute is to be considered volatile.
21480
21481 @item -ml
21482 @opindex ml
21483 Causes variables to be assigned to the @code{.far} section by default.
21484
21485 @item -mleadz
21486 @opindex mleadz
21487 Enables the @code{leadz} (leading zero) instruction.
21488
21489 @item -mm
21490 @opindex mm
21491 Causes variables to be assigned to the @code{.near} section by default.
21492
21493 @item -mminmax
21494 @opindex mminmax
21495 Enables the @code{min} and @code{max} instructions.
21496
21497 @item -mmult
21498 @opindex mmult
21499 Enables the multiplication and multiply-accumulate instructions.
21500
21501 @item -mno-opts
21502 @opindex mno-opts
21503 Disables all the optional instructions enabled by @option{-mall-opts}.
21504
21505 @item -mrepeat
21506 @opindex mrepeat
21507 Enables the @code{repeat} and @code{erepeat} instructions, used for
21508 low-overhead looping.
21509
21510 @item -ms
21511 @opindex ms
21512 Causes all variables to default to the @code{.tiny} section. Note
21513 that there is a 65536-byte limit to this section. Accesses to these
21514 variables use the @code{%gp} base register.
21515
21516 @item -msatur
21517 @opindex msatur
21518 Enables the saturation instructions. Note that the compiler does not
21519 currently generate these itself, but this option is included for
21520 compatibility with other tools, like @code{as}.
21521
21522 @item -msdram
21523 @opindex msdram
21524 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21525
21526 @item -msim
21527 @opindex msim
21528 Link the simulator run-time libraries.
21529
21530 @item -msimnovec
21531 @opindex msimnovec
21532 Link the simulator runtime libraries, excluding built-in support
21533 for reset and exception vectors and tables.
21534
21535 @item -mtf
21536 @opindex mtf
21537 Causes all functions to default to the @code{.far} section. Without
21538 this option, functions default to the @code{.near} section.
21539
21540 @item -mtiny=@var{n}
21541 @opindex mtiny=
21542 Variables that are @var{n} bytes or smaller are allocated to the
21543 @code{.tiny} section. These variables use the @code{$gp} base
21544 register. The default for this option is 4, but note that there's a
21545 65536-byte limit to the @code{.tiny} section.
21546
21547 @end table
21548
21549 @node MicroBlaze Options
21550 @subsection MicroBlaze Options
21551 @cindex MicroBlaze Options
21552
21553 @table @gcctabopt
21554
21555 @item -msoft-float
21556 @opindex msoft-float
21557 Use software emulation for floating point (default).
21558
21559 @item -mhard-float
21560 @opindex mhard-float
21561 Use hardware floating-point instructions.
21562
21563 @item -mmemcpy
21564 @opindex mmemcpy
21565 Do not optimize block moves, use @code{memcpy}.
21566
21567 @item -mno-clearbss
21568 @opindex mno-clearbss
21569 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21570
21571 @item -mcpu=@var{cpu-type}
21572 @opindex mcpu=
21573 Use features of, and schedule code for, the given CPU.
21574 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21575 where @var{X} is a major version, @var{YY} is the minor version, and
21576 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21577 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21578
21579 @item -mxl-soft-mul
21580 @opindex mxl-soft-mul
21581 Use software multiply emulation (default).
21582
21583 @item -mxl-soft-div
21584 @opindex mxl-soft-div
21585 Use software emulation for divides (default).
21586
21587 @item -mxl-barrel-shift
21588 @opindex mxl-barrel-shift
21589 Use the hardware barrel shifter.
21590
21591 @item -mxl-pattern-compare
21592 @opindex mxl-pattern-compare
21593 Use pattern compare instructions.
21594
21595 @item -msmall-divides
21596 @opindex msmall-divides
21597 Use table lookup optimization for small signed integer divisions.
21598
21599 @item -mxl-stack-check
21600 @opindex mxl-stack-check
21601 This option is deprecated. Use @option{-fstack-check} instead.
21602
21603 @item -mxl-gp-opt
21604 @opindex mxl-gp-opt
21605 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21606
21607 @item -mxl-multiply-high
21608 @opindex mxl-multiply-high
21609 Use multiply high instructions for high part of 32x32 multiply.
21610
21611 @item -mxl-float-convert
21612 @opindex mxl-float-convert
21613 Use hardware floating-point conversion instructions.
21614
21615 @item -mxl-float-sqrt
21616 @opindex mxl-float-sqrt
21617 Use hardware floating-point square root instruction.
21618
21619 @item -mbig-endian
21620 @opindex mbig-endian
21621 Generate code for a big-endian target.
21622
21623 @item -mlittle-endian
21624 @opindex mlittle-endian
21625 Generate code for a little-endian target.
21626
21627 @item -mxl-reorder
21628 @opindex mxl-reorder
21629 Use reorder instructions (swap and byte reversed load/store).
21630
21631 @item -mxl-mode-@var{app-model}
21632 Select application model @var{app-model}. Valid models are
21633 @table @samp
21634 @item executable
21635 normal executable (default), uses startup code @file{crt0.o}.
21636
21637 @item -mpic-data-is-text-relative
21638 @opindex mpic-data-is-text-relative
21639 Assume that the displacement between the text and data segments is fixed
21640 at static link time. This allows data to be referenced by offset from start of
21641 text address instead of GOT since PC-relative addressing is not supported.
21642
21643 @item xmdstub
21644 for use with Xilinx Microprocessor Debugger (XMD) based
21645 software intrusive debug agent called xmdstub. This uses startup file
21646 @file{crt1.o} and sets the start address of the program to 0x800.
21647
21648 @item bootstrap
21649 for applications that are loaded using a bootloader.
21650 This model uses startup file @file{crt2.o} which does not contain a processor
21651 reset vector handler. This is suitable for transferring control on a
21652 processor reset to the bootloader rather than the application.
21653
21654 @item novectors
21655 for applications that do not require any of the
21656 MicroBlaze vectors. This option may be useful for applications running
21657 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21658 @end table
21659
21660 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21661 @option{-mxl-mode-@var{app-model}}.
21662
21663 @end table
21664
21665 @node MIPS Options
21666 @subsection MIPS Options
21667 @cindex MIPS options
21668
21669 @table @gcctabopt
21670
21671 @item -EB
21672 @opindex EB
21673 Generate big-endian code.
21674
21675 @item -EL
21676 @opindex EL
21677 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21678 configurations.
21679
21680 @item -march=@var{arch}
21681 @opindex march
21682 Generate code that runs on @var{arch}, which can be the name of a
21683 generic MIPS ISA, or the name of a particular processor.
21684 The ISA names are:
21685 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21686 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21687 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21688 @samp{mips64r5} and @samp{mips64r6}.
21689 The processor names are:
21690 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21691 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21692 @samp{5kc}, @samp{5kf},
21693 @samp{20kc},
21694 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21695 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21696 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21697 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21698 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21699 @samp{i6400}, @samp{i6500},
21700 @samp{interaptiv},
21701 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21702 @samp{gs464e}, @samp{gs264e},
21703 @samp{m4k},
21704 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21705 @samp{m5100}, @samp{m5101},
21706 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21707 @samp{orion},
21708 @samp{p5600}, @samp{p6600},
21709 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21710 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21711 @samp{r6000}, @samp{r8000},
21712 @samp{rm7000}, @samp{rm9000},
21713 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21714 @samp{sb1},
21715 @samp{sr71000},
21716 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21717 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21718 @samp{xlr} and @samp{xlp}.
21719 The special value @samp{from-abi} selects the
21720 most compatible architecture for the selected ABI (that is,
21721 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21722
21723 The native Linux/GNU toolchain also supports the value @samp{native},
21724 which selects the best architecture option for the host processor.
21725 @option{-march=native} has no effect if GCC does not recognize
21726 the processor.
21727
21728 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21729 (for example, @option{-march=r2k}). Prefixes are optional, and
21730 @samp{vr} may be written @samp{r}.
21731
21732 Names of the form @samp{@var{n}f2_1} refer to processors with
21733 FPUs clocked at half the rate of the core, names of the form
21734 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21735 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21736 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21737 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21738 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21739 accepted as synonyms for @samp{@var{n}f1_1}.
21740
21741 GCC defines two macros based on the value of this option. The first
21742 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21743 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21744 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21745 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21746 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21747
21748 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21749 above. In other words, it has the full prefix and does not
21750 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21751 the macro names the resolved architecture (either @code{"mips1"} or
21752 @code{"mips3"}). It names the default architecture when no
21753 @option{-march} option is given.
21754
21755 @item -mtune=@var{arch}
21756 @opindex mtune
21757 Optimize for @var{arch}. Among other things, this option controls
21758 the way instructions are scheduled, and the perceived cost of arithmetic
21759 operations. The list of @var{arch} values is the same as for
21760 @option{-march}.
21761
21762 When this option is not used, GCC optimizes for the processor
21763 specified by @option{-march}. By using @option{-march} and
21764 @option{-mtune} together, it is possible to generate code that
21765 runs on a family of processors, but optimize the code for one
21766 particular member of that family.
21767
21768 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21769 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21770 @option{-march} ones described above.
21771
21772 @item -mips1
21773 @opindex mips1
21774 Equivalent to @option{-march=mips1}.
21775
21776 @item -mips2
21777 @opindex mips2
21778 Equivalent to @option{-march=mips2}.
21779
21780 @item -mips3
21781 @opindex mips3
21782 Equivalent to @option{-march=mips3}.
21783
21784 @item -mips4
21785 @opindex mips4
21786 Equivalent to @option{-march=mips4}.
21787
21788 @item -mips32
21789 @opindex mips32
21790 Equivalent to @option{-march=mips32}.
21791
21792 @item -mips32r3
21793 @opindex mips32r3
21794 Equivalent to @option{-march=mips32r3}.
21795
21796 @item -mips32r5
21797 @opindex mips32r5
21798 Equivalent to @option{-march=mips32r5}.
21799
21800 @item -mips32r6
21801 @opindex mips32r6
21802 Equivalent to @option{-march=mips32r6}.
21803
21804 @item -mips64
21805 @opindex mips64
21806 Equivalent to @option{-march=mips64}.
21807
21808 @item -mips64r2
21809 @opindex mips64r2
21810 Equivalent to @option{-march=mips64r2}.
21811
21812 @item -mips64r3
21813 @opindex mips64r3
21814 Equivalent to @option{-march=mips64r3}.
21815
21816 @item -mips64r5
21817 @opindex mips64r5
21818 Equivalent to @option{-march=mips64r5}.
21819
21820 @item -mips64r6
21821 @opindex mips64r6
21822 Equivalent to @option{-march=mips64r6}.
21823
21824 @item -mips16
21825 @itemx -mno-mips16
21826 @opindex mips16
21827 @opindex mno-mips16
21828 Generate (do not generate) MIPS16 code. If GCC is targeting a
21829 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21830
21831 MIPS16 code generation can also be controlled on a per-function basis
21832 by means of @code{mips16} and @code{nomips16} attributes.
21833 @xref{Function Attributes}, for more information.
21834
21835 @item -mflip-mips16
21836 @opindex mflip-mips16
21837 Generate MIPS16 code on alternating functions. This option is provided
21838 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21839 not intended for ordinary use in compiling user code.
21840
21841 @item -minterlink-compressed
21842 @itemx -mno-interlink-compressed
21843 @opindex minterlink-compressed
21844 @opindex mno-interlink-compressed
21845 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21846 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21847
21848 For example, code using the standard ISA encoding cannot jump directly
21849 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21850 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21851 knows that the target of the jump is not compressed.
21852
21853 @item -minterlink-mips16
21854 @itemx -mno-interlink-mips16
21855 @opindex minterlink-mips16
21856 @opindex mno-interlink-mips16
21857 Aliases of @option{-minterlink-compressed} and
21858 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21859 and are retained for backwards compatibility.
21860
21861 @item -mabi=32
21862 @itemx -mabi=o64
21863 @itemx -mabi=n32
21864 @itemx -mabi=64
21865 @itemx -mabi=eabi
21866 @opindex mabi=32
21867 @opindex mabi=o64
21868 @opindex mabi=n32
21869 @opindex mabi=64
21870 @opindex mabi=eabi
21871 Generate code for the given ABI@.
21872
21873 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21874 generates 64-bit code when you select a 64-bit architecture, but you
21875 can use @option{-mgp32} to get 32-bit code instead.
21876
21877 For information about the O64 ABI, see
21878 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21879
21880 GCC supports a variant of the o32 ABI in which floating-point registers
21881 are 64 rather than 32 bits wide. You can select this combination with
21882 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21883 and @code{mfhc1} instructions and is therefore only supported for
21884 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21885
21886 The register assignments for arguments and return values remain the
21887 same, but each scalar value is passed in a single 64-bit register
21888 rather than a pair of 32-bit registers. For example, scalar
21889 floating-point values are returned in @samp{$f0} only, not a
21890 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21891 remains the same in that the even-numbered double-precision registers
21892 are saved.
21893
21894 Two additional variants of the o32 ABI are supported to enable
21895 a transition from 32-bit to 64-bit registers. These are FPXX
21896 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21897 The FPXX extension mandates that all code must execute correctly
21898 when run using 32-bit or 64-bit registers. The code can be interlinked
21899 with either FP32 or FP64, but not both.
21900 The FP64A extension is similar to the FP64 extension but forbids the
21901 use of odd-numbered single-precision registers. This can be used
21902 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21903 processors and allows both FP32 and FP64A code to interlink and
21904 run in the same process without changing FPU modes.
21905
21906 @item -mabicalls
21907 @itemx -mno-abicalls
21908 @opindex mabicalls
21909 @opindex mno-abicalls
21910 Generate (do not generate) code that is suitable for SVR4-style
21911 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21912 systems.
21913
21914 @item -mshared
21915 @itemx -mno-shared
21916 Generate (do not generate) code that is fully position-independent,
21917 and that can therefore be linked into shared libraries. This option
21918 only affects @option{-mabicalls}.
21919
21920 All @option{-mabicalls} code has traditionally been position-independent,
21921 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21922 as an extension, the GNU toolchain allows executables to use absolute
21923 accesses for locally-binding symbols. It can also use shorter GP
21924 initialization sequences and generate direct calls to locally-defined
21925 functions. This mode is selected by @option{-mno-shared}.
21926
21927 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21928 objects that can only be linked by the GNU linker. However, the option
21929 does not affect the ABI of the final executable; it only affects the ABI
21930 of relocatable objects. Using @option{-mno-shared} generally makes
21931 executables both smaller and quicker.
21932
21933 @option{-mshared} is the default.
21934
21935 @item -mplt
21936 @itemx -mno-plt
21937 @opindex mplt
21938 @opindex mno-plt
21939 Assume (do not assume) that the static and dynamic linkers
21940 support PLTs and copy relocations. This option only affects
21941 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21942 has no effect without @option{-msym32}.
21943
21944 You can make @option{-mplt} the default by configuring
21945 GCC with @option{--with-mips-plt}. The default is
21946 @option{-mno-plt} otherwise.
21947
21948 @item -mxgot
21949 @itemx -mno-xgot
21950 @opindex mxgot
21951 @opindex mno-xgot
21952 Lift (do not lift) the usual restrictions on the size of the global
21953 offset table.
21954
21955 GCC normally uses a single instruction to load values from the GOT@.
21956 While this is relatively efficient, it only works if the GOT
21957 is smaller than about 64k. Anything larger causes the linker
21958 to report an error such as:
21959
21960 @cindex relocation truncated to fit (MIPS)
21961 @smallexample
21962 relocation truncated to fit: R_MIPS_GOT16 foobar
21963 @end smallexample
21964
21965 If this happens, you should recompile your code with @option{-mxgot}.
21966 This works with very large GOTs, although the code is also
21967 less efficient, since it takes three instructions to fetch the
21968 value of a global symbol.
21969
21970 Note that some linkers can create multiple GOTs. If you have such a
21971 linker, you should only need to use @option{-mxgot} when a single object
21972 file accesses more than 64k's worth of GOT entries. Very few do.
21973
21974 These options have no effect unless GCC is generating position
21975 independent code.
21976
21977 @item -mgp32
21978 @opindex mgp32
21979 Assume that general-purpose registers are 32 bits wide.
21980
21981 @item -mgp64
21982 @opindex mgp64
21983 Assume that general-purpose registers are 64 bits wide.
21984
21985 @item -mfp32
21986 @opindex mfp32
21987 Assume that floating-point registers are 32 bits wide.
21988
21989 @item -mfp64
21990 @opindex mfp64
21991 Assume that floating-point registers are 64 bits wide.
21992
21993 @item -mfpxx
21994 @opindex mfpxx
21995 Do not assume the width of floating-point registers.
21996
21997 @item -mhard-float
21998 @opindex mhard-float
21999 Use floating-point coprocessor instructions.
22000
22001 @item -msoft-float
22002 @opindex msoft-float
22003 Do not use floating-point coprocessor instructions. Implement
22004 floating-point calculations using library calls instead.
22005
22006 @item -mno-float
22007 @opindex mno-float
22008 Equivalent to @option{-msoft-float}, but additionally asserts that the
22009 program being compiled does not perform any floating-point operations.
22010 This option is presently supported only by some bare-metal MIPS
22011 configurations, where it may select a special set of libraries
22012 that lack all floating-point support (including, for example, the
22013 floating-point @code{printf} formats).
22014 If code compiled with @option{-mno-float} accidentally contains
22015 floating-point operations, it is likely to suffer a link-time
22016 or run-time failure.
22017
22018 @item -msingle-float
22019 @opindex msingle-float
22020 Assume that the floating-point coprocessor only supports single-precision
22021 operations.
22022
22023 @item -mdouble-float
22024 @opindex mdouble-float
22025 Assume that the floating-point coprocessor supports double-precision
22026 operations. This is the default.
22027
22028 @item -modd-spreg
22029 @itemx -mno-odd-spreg
22030 @opindex modd-spreg
22031 @opindex mno-odd-spreg
22032 Enable the use of odd-numbered single-precision floating-point registers
22033 for the o32 ABI. This is the default for processors that are known to
22034 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22035 is set by default.
22036
22037 @item -mabs=2008
22038 @itemx -mabs=legacy
22039 @opindex mabs=2008
22040 @opindex mabs=legacy
22041 These options control the treatment of the special not-a-number (NaN)
22042 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22043 @code{neg.@i{fmt}} machine instructions.
22044
22045 By default or when @option{-mabs=legacy} is used the legacy
22046 treatment is selected. In this case these instructions are considered
22047 arithmetic and avoided where correct operation is required and the
22048 input operand might be a NaN. A longer sequence of instructions that
22049 manipulate the sign bit of floating-point datum manually is used
22050 instead unless the @option{-ffinite-math-only} option has also been
22051 specified.
22052
22053 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
22054 this case these instructions are considered non-arithmetic and therefore
22055 operating correctly in all cases, including in particular where the
22056 input operand is a NaN. These instructions are therefore always used
22057 for the respective operations.
22058
22059 @item -mnan=2008
22060 @itemx -mnan=legacy
22061 @opindex mnan=2008
22062 @opindex mnan=legacy
22063 These options control the encoding of the special not-a-number (NaN)
22064 IEEE 754 floating-point data.
22065
22066 The @option{-mnan=legacy} option selects the legacy encoding. In this
22067 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22068 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22069 by the first bit of their trailing significand field being 1.
22070
22071 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
22072 this case qNaNs are denoted by the first bit of their trailing
22073 significand field being 1, whereas sNaNs are denoted by the first bit of
22074 their trailing significand field being 0.
22075
22076 The default is @option{-mnan=legacy} unless GCC has been configured with
22077 @option{--with-nan=2008}.
22078
22079 @item -mllsc
22080 @itemx -mno-llsc
22081 @opindex mllsc
22082 @opindex mno-llsc
22083 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22084 implement atomic memory built-in functions. When neither option is
22085 specified, GCC uses the instructions if the target architecture
22086 supports them.
22087
22088 @option{-mllsc} is useful if the runtime environment can emulate the
22089 instructions and @option{-mno-llsc} can be useful when compiling for
22090 nonstandard ISAs. You can make either option the default by
22091 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22092 respectively. @option{--with-llsc} is the default for some
22093 configurations; see the installation documentation for details.
22094
22095 @item -mdsp
22096 @itemx -mno-dsp
22097 @opindex mdsp
22098 @opindex mno-dsp
22099 Use (do not use) revision 1 of the MIPS DSP ASE@.
22100 @xref{MIPS DSP Built-in Functions}. This option defines the
22101 preprocessor macro @code{__mips_dsp}. It also defines
22102 @code{__mips_dsp_rev} to 1.
22103
22104 @item -mdspr2
22105 @itemx -mno-dspr2
22106 @opindex mdspr2
22107 @opindex mno-dspr2
22108 Use (do not use) revision 2 of the MIPS DSP ASE@.
22109 @xref{MIPS DSP Built-in Functions}. This option defines the
22110 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22111 It also defines @code{__mips_dsp_rev} to 2.
22112
22113 @item -msmartmips
22114 @itemx -mno-smartmips
22115 @opindex msmartmips
22116 @opindex mno-smartmips
22117 Use (do not use) the MIPS SmartMIPS ASE.
22118
22119 @item -mpaired-single
22120 @itemx -mno-paired-single
22121 @opindex mpaired-single
22122 @opindex mno-paired-single
22123 Use (do not use) paired-single floating-point instructions.
22124 @xref{MIPS Paired-Single Support}. This option requires
22125 hardware floating-point support to be enabled.
22126
22127 @item -mdmx
22128 @itemx -mno-mdmx
22129 @opindex mdmx
22130 @opindex mno-mdmx
22131 Use (do not use) MIPS Digital Media Extension instructions.
22132 This option can only be used when generating 64-bit code and requires
22133 hardware floating-point support to be enabled.
22134
22135 @item -mips3d
22136 @itemx -mno-mips3d
22137 @opindex mips3d
22138 @opindex mno-mips3d
22139 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22140 The option @option{-mips3d} implies @option{-mpaired-single}.
22141
22142 @item -mmicromips
22143 @itemx -mno-micromips
22144 @opindex mmicromips
22145 @opindex mno-mmicromips
22146 Generate (do not generate) microMIPS code.
22147
22148 MicroMIPS code generation can also be controlled on a per-function basis
22149 by means of @code{micromips} and @code{nomicromips} attributes.
22150 @xref{Function Attributes}, for more information.
22151
22152 @item -mmt
22153 @itemx -mno-mt
22154 @opindex mmt
22155 @opindex mno-mt
22156 Use (do not use) MT Multithreading instructions.
22157
22158 @item -mmcu
22159 @itemx -mno-mcu
22160 @opindex mmcu
22161 @opindex mno-mcu
22162 Use (do not use) the MIPS MCU ASE instructions.
22163
22164 @item -meva
22165 @itemx -mno-eva
22166 @opindex meva
22167 @opindex mno-eva
22168 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22169
22170 @item -mvirt
22171 @itemx -mno-virt
22172 @opindex mvirt
22173 @opindex mno-virt
22174 Use (do not use) the MIPS Virtualization (VZ) instructions.
22175
22176 @item -mxpa
22177 @itemx -mno-xpa
22178 @opindex mxpa
22179 @opindex mno-xpa
22180 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22181
22182 @item -mcrc
22183 @itemx -mno-crc
22184 @opindex mcrc
22185 @opindex mno-crc
22186 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22187
22188 @item -mginv
22189 @itemx -mno-ginv
22190 @opindex mginv
22191 @opindex mno-ginv
22192 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22193
22194 @item -mloongson-mmi
22195 @itemx -mno-loongson-mmi
22196 @opindex mloongson-mmi
22197 @opindex mno-loongson-mmi
22198 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22199
22200 @item -mloongson-ext
22201 @itemx -mno-loongson-ext
22202 @opindex mloongson-ext
22203 @opindex mno-loongson-ext
22204 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22205
22206 @item -mloongson-ext2
22207 @itemx -mno-loongson-ext2
22208 @opindex mloongson-ext2
22209 @opindex mno-loongson-ext2
22210 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22211
22212 @item -mlong64
22213 @opindex mlong64
22214 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22215 an explanation of the default and the way that the pointer size is
22216 determined.
22217
22218 @item -mlong32
22219 @opindex mlong32
22220 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22221
22222 The default size of @code{int}s, @code{long}s and pointers depends on
22223 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22224 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22225 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22226 or the same size as integer registers, whichever is smaller.
22227
22228 @item -msym32
22229 @itemx -mno-sym32
22230 @opindex msym32
22231 @opindex mno-sym32
22232 Assume (do not assume) that all symbols have 32-bit values, regardless
22233 of the selected ABI@. This option is useful in combination with
22234 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22235 to generate shorter and faster references to symbolic addresses.
22236
22237 @item -G @var{num}
22238 @opindex G
22239 Put definitions of externally-visible data in a small data section
22240 if that data is no bigger than @var{num} bytes. GCC can then generate
22241 more efficient accesses to the data; see @option{-mgpopt} for details.
22242
22243 The default @option{-G} option depends on the configuration.
22244
22245 @item -mlocal-sdata
22246 @itemx -mno-local-sdata
22247 @opindex mlocal-sdata
22248 @opindex mno-local-sdata
22249 Extend (do not extend) the @option{-G} behavior to local data too,
22250 such as to static variables in C@. @option{-mlocal-sdata} is the
22251 default for all configurations.
22252
22253 If the linker complains that an application is using too much small data,
22254 you might want to try rebuilding the less performance-critical parts with
22255 @option{-mno-local-sdata}. You might also want to build large
22256 libraries with @option{-mno-local-sdata}, so that the libraries leave
22257 more room for the main program.
22258
22259 @item -mextern-sdata
22260 @itemx -mno-extern-sdata
22261 @opindex mextern-sdata
22262 @opindex mno-extern-sdata
22263 Assume (do not assume) that externally-defined data is in
22264 a small data section if the size of that data is within the @option{-G} limit.
22265 @option{-mextern-sdata} is the default for all configurations.
22266
22267 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22268 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22269 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22270 is placed in a small data section. If @var{Var} is defined by another
22271 module, you must either compile that module with a high-enough
22272 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22273 definition. If @var{Var} is common, you must link the application
22274 with a high-enough @option{-G} setting.
22275
22276 The easiest way of satisfying these restrictions is to compile
22277 and link every module with the same @option{-G} option. However,
22278 you may wish to build a library that supports several different
22279 small data limits. You can do this by compiling the library with
22280 the highest supported @option{-G} setting and additionally using
22281 @option{-mno-extern-sdata} to stop the library from making assumptions
22282 about externally-defined data.
22283
22284 @item -mgpopt
22285 @itemx -mno-gpopt
22286 @opindex mgpopt
22287 @opindex mno-gpopt
22288 Use (do not use) GP-relative accesses for symbols that are known to be
22289 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22290 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22291 configurations.
22292
22293 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22294 might not hold the value of @code{_gp}. For example, if the code is
22295 part of a library that might be used in a boot monitor, programs that
22296 call boot monitor routines pass an unknown value in @code{$gp}.
22297 (In such situations, the boot monitor itself is usually compiled
22298 with @option{-G0}.)
22299
22300 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22301 @option{-mno-extern-sdata}.
22302
22303 @item -membedded-data
22304 @itemx -mno-embedded-data
22305 @opindex membedded-data
22306 @opindex mno-embedded-data
22307 Allocate variables to the read-only data section first if possible, then
22308 next in the small data section if possible, otherwise in data. This gives
22309 slightly slower code than the default, but reduces the amount of RAM required
22310 when executing, and thus may be preferred for some embedded systems.
22311
22312 @item -muninit-const-in-rodata
22313 @itemx -mno-uninit-const-in-rodata
22314 @opindex muninit-const-in-rodata
22315 @opindex mno-uninit-const-in-rodata
22316 Put uninitialized @code{const} variables in the read-only data section.
22317 This option is only meaningful in conjunction with @option{-membedded-data}.
22318
22319 @item -mcode-readable=@var{setting}
22320 @opindex mcode-readable
22321 Specify whether GCC may generate code that reads from executable sections.
22322 There are three possible settings:
22323
22324 @table @gcctabopt
22325 @item -mcode-readable=yes
22326 Instructions may freely access executable sections. This is the
22327 default setting.
22328
22329 @item -mcode-readable=pcrel
22330 MIPS16 PC-relative load instructions can access executable sections,
22331 but other instructions must not do so. This option is useful on 4KSc
22332 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22333 It is also useful on processors that can be configured to have a dual
22334 instruction/data SRAM interface and that, like the M4K, automatically
22335 redirect PC-relative loads to the instruction RAM.
22336
22337 @item -mcode-readable=no
22338 Instructions must not access executable sections. This option can be
22339 useful on targets that are configured to have a dual instruction/data
22340 SRAM interface but that (unlike the M4K) do not automatically redirect
22341 PC-relative loads to the instruction RAM.
22342 @end table
22343
22344 @item -msplit-addresses
22345 @itemx -mno-split-addresses
22346 @opindex msplit-addresses
22347 @opindex mno-split-addresses
22348 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22349 relocation operators. This option has been superseded by
22350 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22351
22352 @item -mexplicit-relocs
22353 @itemx -mno-explicit-relocs
22354 @opindex mexplicit-relocs
22355 @opindex mno-explicit-relocs
22356 Use (do not use) assembler relocation operators when dealing with symbolic
22357 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22358 is to use assembler macros instead.
22359
22360 @option{-mexplicit-relocs} is the default if GCC was configured
22361 to use an assembler that supports relocation operators.
22362
22363 @item -mcheck-zero-division
22364 @itemx -mno-check-zero-division
22365 @opindex mcheck-zero-division
22366 @opindex mno-check-zero-division
22367 Trap (do not trap) on integer division by zero.
22368
22369 The default is @option{-mcheck-zero-division}.
22370
22371 @item -mdivide-traps
22372 @itemx -mdivide-breaks
22373 @opindex mdivide-traps
22374 @opindex mdivide-breaks
22375 MIPS systems check for division by zero by generating either a
22376 conditional trap or a break instruction. Using traps results in
22377 smaller code, but is only supported on MIPS II and later. Also, some
22378 versions of the Linux kernel have a bug that prevents trap from
22379 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22380 allow conditional traps on architectures that support them and
22381 @option{-mdivide-breaks} to force the use of breaks.
22382
22383 The default is usually @option{-mdivide-traps}, but this can be
22384 overridden at configure time using @option{--with-divide=breaks}.
22385 Divide-by-zero checks can be completely disabled using
22386 @option{-mno-check-zero-division}.
22387
22388 @item -mload-store-pairs
22389 @itemx -mno-load-store-pairs
22390 @opindex mload-store-pairs
22391 @opindex mno-load-store-pairs
22392 Enable (disable) an optimization that pairs consecutive load or store
22393 instructions to enable load/store bonding. This option is enabled by
22394 default but only takes effect when the selected architecture is known
22395 to support bonding.
22396
22397 @item -mmemcpy
22398 @itemx -mno-memcpy
22399 @opindex mmemcpy
22400 @opindex mno-memcpy
22401 Force (do not force) the use of @code{memcpy} for non-trivial block
22402 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22403 most constant-sized copies.
22404
22405 @item -mlong-calls
22406 @itemx -mno-long-calls
22407 @opindex mlong-calls
22408 @opindex mno-long-calls
22409 Disable (do not disable) use of the @code{jal} instruction. Calling
22410 functions using @code{jal} is more efficient but requires the caller
22411 and callee to be in the same 256 megabyte segment.
22412
22413 This option has no effect on abicalls code. The default is
22414 @option{-mno-long-calls}.
22415
22416 @item -mmad
22417 @itemx -mno-mad
22418 @opindex mmad
22419 @opindex mno-mad
22420 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22421 instructions, as provided by the R4650 ISA@.
22422
22423 @item -mimadd
22424 @itemx -mno-imadd
22425 @opindex mimadd
22426 @opindex mno-imadd
22427 Enable (disable) use of the @code{madd} and @code{msub} integer
22428 instructions. The default is @option{-mimadd} on architectures
22429 that support @code{madd} and @code{msub} except for the 74k
22430 architecture where it was found to generate slower code.
22431
22432 @item -mfused-madd
22433 @itemx -mno-fused-madd
22434 @opindex mfused-madd
22435 @opindex mno-fused-madd
22436 Enable (disable) use of the floating-point multiply-accumulate
22437 instructions, when they are available. The default is
22438 @option{-mfused-madd}.
22439
22440 On the R8000 CPU when multiply-accumulate instructions are used,
22441 the intermediate product is calculated to infinite precision
22442 and is not subject to the FCSR Flush to Zero bit. This may be
22443 undesirable in some circumstances. On other processors the result
22444 is numerically identical to the equivalent computation using
22445 separate multiply, add, subtract and negate instructions.
22446
22447 @item -nocpp
22448 @opindex nocpp
22449 Tell the MIPS assembler to not run its preprocessor over user
22450 assembler files (with a @samp{.s} suffix) when assembling them.
22451
22452 @item -mfix-24k
22453 @itemx -mno-fix-24k
22454 @opindex mfix-24k
22455 @opindex mno-fix-24k
22456 Work around the 24K E48 (lost data on stores during refill) errata.
22457 The workarounds are implemented by the assembler rather than by GCC@.
22458
22459 @item -mfix-r4000
22460 @itemx -mno-fix-r4000
22461 @opindex mfix-r4000
22462 @opindex mno-fix-r4000
22463 Work around certain R4000 CPU errata:
22464 @itemize @minus
22465 @item
22466 A double-word or a variable shift may give an incorrect result if executed
22467 immediately after starting an integer division.
22468 @item
22469 A double-word or a variable shift may give an incorrect result if executed
22470 while an integer multiplication is in progress.
22471 @item
22472 An integer division may give an incorrect result if started in a delay slot
22473 of a taken branch or a jump.
22474 @end itemize
22475
22476 @item -mfix-r4400
22477 @itemx -mno-fix-r4400
22478 @opindex mfix-r4400
22479 @opindex mno-fix-r4400
22480 Work around certain R4400 CPU errata:
22481 @itemize @minus
22482 @item
22483 A double-word or a variable shift may give an incorrect result if executed
22484 immediately after starting an integer division.
22485 @end itemize
22486
22487 @item -mfix-r10000
22488 @itemx -mno-fix-r10000
22489 @opindex mfix-r10000
22490 @opindex mno-fix-r10000
22491 Work around certain R10000 errata:
22492 @itemize @minus
22493 @item
22494 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22495 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22496 @end itemize
22497
22498 This option can only be used if the target architecture supports
22499 branch-likely instructions. @option{-mfix-r10000} is the default when
22500 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22501 otherwise.
22502
22503 @item -mfix-r5900
22504 @itemx -mno-fix-r5900
22505 @opindex mfix-r5900
22506 Do not attempt to schedule the preceding instruction into the delay slot
22507 of a branch instruction placed at the end of a short loop of six
22508 instructions or fewer and always schedule a @code{nop} instruction there
22509 instead. The short loop bug under certain conditions causes loops to
22510 execute only once or twice, due to a hardware bug in the R5900 chip. The
22511 workaround is implemented by the assembler rather than by GCC@.
22512
22513 @item -mfix-rm7000
22514 @itemx -mno-fix-rm7000
22515 @opindex mfix-rm7000
22516 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22517 workarounds are implemented by the assembler rather than by GCC@.
22518
22519 @item -mfix-vr4120
22520 @itemx -mno-fix-vr4120
22521 @opindex mfix-vr4120
22522 Work around certain VR4120 errata:
22523 @itemize @minus
22524 @item
22525 @code{dmultu} does not always produce the correct result.
22526 @item
22527 @code{div} and @code{ddiv} do not always produce the correct result if one
22528 of the operands is negative.
22529 @end itemize
22530 The workarounds for the division errata rely on special functions in
22531 @file{libgcc.a}. At present, these functions are only provided by
22532 the @code{mips64vr*-elf} configurations.
22533
22534 Other VR4120 errata require a NOP to be inserted between certain pairs of
22535 instructions. These errata are handled by the assembler, not by GCC itself.
22536
22537 @item -mfix-vr4130
22538 @opindex mfix-vr4130
22539 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22540 workarounds are implemented by the assembler rather than by GCC,
22541 although GCC avoids using @code{mflo} and @code{mfhi} if the
22542 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22543 instructions are available instead.
22544
22545 @item -mfix-sb1
22546 @itemx -mno-fix-sb1
22547 @opindex mfix-sb1
22548 Work around certain SB-1 CPU core errata.
22549 (This flag currently works around the SB-1 revision 2
22550 ``F1'' and ``F2'' floating-point errata.)
22551
22552 @item -mr10k-cache-barrier=@var{setting}
22553 @opindex mr10k-cache-barrier
22554 Specify whether GCC should insert cache barriers to avoid the
22555 side effects of speculation on R10K processors.
22556
22557 In common with many processors, the R10K tries to predict the outcome
22558 of a conditional branch and speculatively executes instructions from
22559 the ``taken'' branch. It later aborts these instructions if the
22560 predicted outcome is wrong. However, on the R10K, even aborted
22561 instructions can have side effects.
22562
22563 This problem only affects kernel stores and, depending on the system,
22564 kernel loads. As an example, a speculatively-executed store may load
22565 the target memory into cache and mark the cache line as dirty, even if
22566 the store itself is later aborted. If a DMA operation writes to the
22567 same area of memory before the ``dirty'' line is flushed, the cached
22568 data overwrites the DMA-ed data. See the R10K processor manual
22569 for a full description, including other potential problems.
22570
22571 One workaround is to insert cache barrier instructions before every memory
22572 access that might be speculatively executed and that might have side
22573 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22574 controls GCC's implementation of this workaround. It assumes that
22575 aborted accesses to any byte in the following regions does not have
22576 side effects:
22577
22578 @enumerate
22579 @item
22580 the memory occupied by the current function's stack frame;
22581
22582 @item
22583 the memory occupied by an incoming stack argument;
22584
22585 @item
22586 the memory occupied by an object with a link-time-constant address.
22587 @end enumerate
22588
22589 It is the kernel's responsibility to ensure that speculative
22590 accesses to these regions are indeed safe.
22591
22592 If the input program contains a function declaration such as:
22593
22594 @smallexample
22595 void foo (void);
22596 @end smallexample
22597
22598 then the implementation of @code{foo} must allow @code{j foo} and
22599 @code{jal foo} to be executed speculatively. GCC honors this
22600 restriction for functions it compiles itself. It expects non-GCC
22601 functions (such as hand-written assembly code) to do the same.
22602
22603 The option has three forms:
22604
22605 @table @gcctabopt
22606 @item -mr10k-cache-barrier=load-store
22607 Insert a cache barrier before a load or store that might be
22608 speculatively executed and that might have side effects even
22609 if aborted.
22610
22611 @item -mr10k-cache-barrier=store
22612 Insert a cache barrier before a store that might be speculatively
22613 executed and that might have side effects even if aborted.
22614
22615 @item -mr10k-cache-barrier=none
22616 Disable the insertion of cache barriers. This is the default setting.
22617 @end table
22618
22619 @item -mflush-func=@var{func}
22620 @itemx -mno-flush-func
22621 @opindex mflush-func
22622 Specifies the function to call to flush the I and D caches, or to not
22623 call any such function. If called, the function must take the same
22624 arguments as the common @code{_flush_func}, that is, the address of the
22625 memory range for which the cache is being flushed, the size of the
22626 memory range, and the number 3 (to flush both caches). The default
22627 depends on the target GCC was configured for, but commonly is either
22628 @code{_flush_func} or @code{__cpu_flush}.
22629
22630 @item mbranch-cost=@var{num}
22631 @opindex mbranch-cost
22632 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22633 This cost is only a heuristic and is not guaranteed to produce
22634 consistent results across releases. A zero cost redundantly selects
22635 the default, which is based on the @option{-mtune} setting.
22636
22637 @item -mbranch-likely
22638 @itemx -mno-branch-likely
22639 @opindex mbranch-likely
22640 @opindex mno-branch-likely
22641 Enable or disable use of Branch Likely instructions, regardless of the
22642 default for the selected architecture. By default, Branch Likely
22643 instructions may be generated if they are supported by the selected
22644 architecture. An exception is for the MIPS32 and MIPS64 architectures
22645 and processors that implement those architectures; for those, Branch
22646 Likely instructions are not be generated by default because the MIPS32
22647 and MIPS64 architectures specifically deprecate their use.
22648
22649 @item -mcompact-branches=never
22650 @itemx -mcompact-branches=optimal
22651 @itemx -mcompact-branches=always
22652 @opindex mcompact-branches=never
22653 @opindex mcompact-branches=optimal
22654 @opindex mcompact-branches=always
22655 These options control which form of branches will be generated. The
22656 default is @option{-mcompact-branches=optimal}.
22657
22658 The @option{-mcompact-branches=never} option ensures that compact branch
22659 instructions will never be generated.
22660
22661 The @option{-mcompact-branches=always} option ensures that a compact
22662 branch instruction will be generated if available. If a compact branch
22663 instruction is not available, a delay slot form of the branch will be
22664 used instead.
22665
22666 This option is supported from MIPS Release 6 onwards.
22667
22668 The @option{-mcompact-branches=optimal} option will cause a delay slot
22669 branch to be used if one is available in the current ISA and the delay
22670 slot is successfully filled. If the delay slot is not filled, a compact
22671 branch will be chosen if one is available.
22672
22673 @item -mfp-exceptions
22674 @itemx -mno-fp-exceptions
22675 @opindex mfp-exceptions
22676 Specifies whether FP exceptions are enabled. This affects how
22677 FP instructions are scheduled for some processors.
22678 The default is that FP exceptions are
22679 enabled.
22680
22681 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22682 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22683 FP pipe.
22684
22685 @item -mvr4130-align
22686 @itemx -mno-vr4130-align
22687 @opindex mvr4130-align
22688 The VR4130 pipeline is two-way superscalar, but can only issue two
22689 instructions together if the first one is 8-byte aligned. When this
22690 option is enabled, GCC aligns pairs of instructions that it
22691 thinks should execute in parallel.
22692
22693 This option only has an effect when optimizing for the VR4130.
22694 It normally makes code faster, but at the expense of making it bigger.
22695 It is enabled by default at optimization level @option{-O3}.
22696
22697 @item -msynci
22698 @itemx -mno-synci
22699 @opindex msynci
22700 Enable (disable) generation of @code{synci} instructions on
22701 architectures that support it. The @code{synci} instructions (if
22702 enabled) are generated when @code{__builtin___clear_cache} is
22703 compiled.
22704
22705 This option defaults to @option{-mno-synci}, but the default can be
22706 overridden by configuring GCC with @option{--with-synci}.
22707
22708 When compiling code for single processor systems, it is generally safe
22709 to use @code{synci}. However, on many multi-core (SMP) systems, it
22710 does not invalidate the instruction caches on all cores and may lead
22711 to undefined behavior.
22712
22713 @item -mrelax-pic-calls
22714 @itemx -mno-relax-pic-calls
22715 @opindex mrelax-pic-calls
22716 Try to turn PIC calls that are normally dispatched via register
22717 @code{$25} into direct calls. This is only possible if the linker can
22718 resolve the destination at link time and if the destination is within
22719 range for a direct call.
22720
22721 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22722 an assembler and a linker that support the @code{.reloc} assembly
22723 directive and @option{-mexplicit-relocs} is in effect. With
22724 @option{-mno-explicit-relocs}, this optimization can be performed by the
22725 assembler and the linker alone without help from the compiler.
22726
22727 @item -mmcount-ra-address
22728 @itemx -mno-mcount-ra-address
22729 @opindex mmcount-ra-address
22730 @opindex mno-mcount-ra-address
22731 Emit (do not emit) code that allows @code{_mcount} to modify the
22732 calling function's return address. When enabled, this option extends
22733 the usual @code{_mcount} interface with a new @var{ra-address}
22734 parameter, which has type @code{intptr_t *} and is passed in register
22735 @code{$12}. @code{_mcount} can then modify the return address by
22736 doing both of the following:
22737 @itemize
22738 @item
22739 Returning the new address in register @code{$31}.
22740 @item
22741 Storing the new address in @code{*@var{ra-address}},
22742 if @var{ra-address} is nonnull.
22743 @end itemize
22744
22745 The default is @option{-mno-mcount-ra-address}.
22746
22747 @item -mframe-header-opt
22748 @itemx -mno-frame-header-opt
22749 @opindex mframe-header-opt
22750 Enable (disable) frame header optimization in the o32 ABI. When using the
22751 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22752 function to write out register arguments. When enabled, this optimization
22753 will suppress the allocation of the frame header if it can be determined that
22754 it is unused.
22755
22756 This optimization is off by default at all optimization levels.
22757
22758 @item -mlxc1-sxc1
22759 @itemx -mno-lxc1-sxc1
22760 @opindex mlxc1-sxc1
22761 When applicable, enable (disable) the generation of @code{lwxc1},
22762 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22763
22764 @item -mmadd4
22765 @itemx -mno-madd4
22766 @opindex mmadd4
22767 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22768 @code{madd.d} and related instructions. Enabled by default.
22769
22770 @end table
22771
22772 @node MMIX Options
22773 @subsection MMIX Options
22774 @cindex MMIX Options
22775
22776 These options are defined for the MMIX:
22777
22778 @table @gcctabopt
22779 @item -mlibfuncs
22780 @itemx -mno-libfuncs
22781 @opindex mlibfuncs
22782 @opindex mno-libfuncs
22783 Specify that intrinsic library functions are being compiled, passing all
22784 values in registers, no matter the size.
22785
22786 @item -mepsilon
22787 @itemx -mno-epsilon
22788 @opindex mepsilon
22789 @opindex mno-epsilon
22790 Generate floating-point comparison instructions that compare with respect
22791 to the @code{rE} epsilon register.
22792
22793 @item -mabi=mmixware
22794 @itemx -mabi=gnu
22795 @opindex mabi=mmixware
22796 @opindex mabi=gnu
22797 Generate code that passes function parameters and return values that (in
22798 the called function) are seen as registers @code{$0} and up, as opposed to
22799 the GNU ABI which uses global registers @code{$231} and up.
22800
22801 @item -mzero-extend
22802 @itemx -mno-zero-extend
22803 @opindex mzero-extend
22804 @opindex mno-zero-extend
22805 When reading data from memory in sizes shorter than 64 bits, use (do not
22806 use) zero-extending load instructions by default, rather than
22807 sign-extending ones.
22808
22809 @item -mknuthdiv
22810 @itemx -mno-knuthdiv
22811 @opindex mknuthdiv
22812 @opindex mno-knuthdiv
22813 Make the result of a division yielding a remainder have the same sign as
22814 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22815 remainder follows the sign of the dividend. Both methods are
22816 arithmetically valid, the latter being almost exclusively used.
22817
22818 @item -mtoplevel-symbols
22819 @itemx -mno-toplevel-symbols
22820 @opindex mtoplevel-symbols
22821 @opindex mno-toplevel-symbols
22822 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22823 code can be used with the @code{PREFIX} assembly directive.
22824
22825 @item -melf
22826 @opindex melf
22827 Generate an executable in the ELF format, rather than the default
22828 @samp{mmo} format used by the @command{mmix} simulator.
22829
22830 @item -mbranch-predict
22831 @itemx -mno-branch-predict
22832 @opindex mbranch-predict
22833 @opindex mno-branch-predict
22834 Use (do not use) the probable-branch instructions, when static branch
22835 prediction indicates a probable branch.
22836
22837 @item -mbase-addresses
22838 @itemx -mno-base-addresses
22839 @opindex mbase-addresses
22840 @opindex mno-base-addresses
22841 Generate (do not generate) code that uses @emph{base addresses}. Using a
22842 base address automatically generates a request (handled by the assembler
22843 and the linker) for a constant to be set up in a global register. The
22844 register is used for one or more base address requests within the range 0
22845 to 255 from the value held in the register. The generally leads to short
22846 and fast code, but the number of different data items that can be
22847 addressed is limited. This means that a program that uses lots of static
22848 data may require @option{-mno-base-addresses}.
22849
22850 @item -msingle-exit
22851 @itemx -mno-single-exit
22852 @opindex msingle-exit
22853 @opindex mno-single-exit
22854 Force (do not force) generated code to have a single exit point in each
22855 function.
22856 @end table
22857
22858 @node MN10300 Options
22859 @subsection MN10300 Options
22860 @cindex MN10300 options
22861
22862 These @option{-m} options are defined for Matsushita MN10300 architectures:
22863
22864 @table @gcctabopt
22865 @item -mmult-bug
22866 @opindex mmult-bug
22867 Generate code to avoid bugs in the multiply instructions for the MN10300
22868 processors. This is the default.
22869
22870 @item -mno-mult-bug
22871 @opindex mno-mult-bug
22872 Do not generate code to avoid bugs in the multiply instructions for the
22873 MN10300 processors.
22874
22875 @item -mam33
22876 @opindex mam33
22877 Generate code using features specific to the AM33 processor.
22878
22879 @item -mno-am33
22880 @opindex mno-am33
22881 Do not generate code using features specific to the AM33 processor. This
22882 is the default.
22883
22884 @item -mam33-2
22885 @opindex mam33-2
22886 Generate code using features specific to the AM33/2.0 processor.
22887
22888 @item -mam34
22889 @opindex mam34
22890 Generate code using features specific to the AM34 processor.
22891
22892 @item -mtune=@var{cpu-type}
22893 @opindex mtune
22894 Use the timing characteristics of the indicated CPU type when
22895 scheduling instructions. This does not change the targeted processor
22896 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22897 @samp{am33-2} or @samp{am34}.
22898
22899 @item -mreturn-pointer-on-d0
22900 @opindex mreturn-pointer-on-d0
22901 When generating a function that returns a pointer, return the pointer
22902 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22903 only in @code{a0}, and attempts to call such functions without a prototype
22904 result in errors. Note that this option is on by default; use
22905 @option{-mno-return-pointer-on-d0} to disable it.
22906
22907 @item -mno-crt0
22908 @opindex mno-crt0
22909 Do not link in the C run-time initialization object file.
22910
22911 @item -mrelax
22912 @opindex mrelax
22913 Indicate to the linker that it should perform a relaxation optimization pass
22914 to shorten branches, calls and absolute memory addresses. This option only
22915 has an effect when used on the command line for the final link step.
22916
22917 This option makes symbolic debugging impossible.
22918
22919 @item -mliw
22920 @opindex mliw
22921 Allow the compiler to generate @emph{Long Instruction Word}
22922 instructions if the target is the @samp{AM33} or later. This is the
22923 default. This option defines the preprocessor macro @code{__LIW__}.
22924
22925 @item -mno-liw
22926 @opindex mno-liw
22927 Do not allow the compiler to generate @emph{Long Instruction Word}
22928 instructions. This option defines the preprocessor macro
22929 @code{__NO_LIW__}.
22930
22931 @item -msetlb
22932 @opindex msetlb
22933 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22934 instructions if the target is the @samp{AM33} or later. This is the
22935 default. This option defines the preprocessor macro @code{__SETLB__}.
22936
22937 @item -mno-setlb
22938 @opindex mno-setlb
22939 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22940 instructions. This option defines the preprocessor macro
22941 @code{__NO_SETLB__}.
22942
22943 @end table
22944
22945 @node Moxie Options
22946 @subsection Moxie Options
22947 @cindex Moxie Options
22948
22949 @table @gcctabopt
22950
22951 @item -meb
22952 @opindex meb
22953 Generate big-endian code. This is the default for @samp{moxie-*-*}
22954 configurations.
22955
22956 @item -mel
22957 @opindex mel
22958 Generate little-endian code.
22959
22960 @item -mmul.x
22961 @opindex mmul.x
22962 Generate mul.x and umul.x instructions. This is the default for
22963 @samp{moxiebox-*-*} configurations.
22964
22965 @item -mno-crt0
22966 @opindex mno-crt0
22967 Do not link in the C run-time initialization object file.
22968
22969 @end table
22970
22971 @node MSP430 Options
22972 @subsection MSP430 Options
22973 @cindex MSP430 Options
22974
22975 These options are defined for the MSP430:
22976
22977 @table @gcctabopt
22978
22979 @item -masm-hex
22980 @opindex masm-hex
22981 Force assembly output to always use hex constants. Normally such
22982 constants are signed decimals, but this option is available for
22983 testsuite and/or aesthetic purposes.
22984
22985 @item -mmcu=
22986 @opindex mmcu=
22987 Select the MCU to target. This is used to create a C preprocessor
22988 symbol based upon the MCU name, converted to upper case and pre- and
22989 post-fixed with @samp{__}. This in turn is used by the
22990 @file{msp430.h} header file to select an MCU-specific supplementary
22991 header file.
22992
22993 The option also sets the ISA to use. If the MCU name is one that is
22994 known to only support the 430 ISA then that is selected, otherwise the
22995 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22996 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22997 name selects the 430X ISA.
22998
22999 In addition an MCU-specific linker script is added to the linker
23000 command line. The script's name is the name of the MCU with
23001 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
23002 command line defines the C preprocessor symbol @code{__XXX__} and
23003 cause the linker to search for a script called @file{xxx.ld}.
23004
23005 This option is also passed on to the assembler.
23006
23007 @item -mwarn-mcu
23008 @itemx -mno-warn-mcu
23009 @opindex mwarn-mcu
23010 @opindex mno-warn-mcu
23011 This option enables or disables warnings about conflicts between the
23012 MCU name specified by the @option{-mmcu} option and the ISA set by the
23013 @option{-mcpu} option and/or the hardware multiply support set by the
23014 @option{-mhwmult} option. It also toggles warnings about unrecognized
23015 MCU names. This option is on by default.
23016
23017 @item -mcpu=
23018 @opindex mcpu=
23019 Specifies the ISA to use. Accepted values are @samp{msp430},
23020 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
23021 @option{-mmcu=} option should be used to select the ISA.
23022
23023 @item -msim
23024 @opindex msim
23025 Link to the simulator runtime libraries and linker script. Overrides
23026 any scripts that would be selected by the @option{-mmcu=} option.
23027
23028 @item -mlarge
23029 @opindex mlarge
23030 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23031
23032 @item -msmall
23033 @opindex msmall
23034 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23035
23036 @item -mrelax
23037 @opindex mrelax
23038 This option is passed to the assembler and linker, and allows the
23039 linker to perform certain optimizations that cannot be done until
23040 the final link.
23041
23042 @item mhwmult=
23043 @opindex mhwmult=
23044 Describes the type of hardware multiply supported by the target.
23045 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23046 for the original 16-bit-only multiply supported by early MCUs.
23047 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23048 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23049 A value of @samp{auto} can also be given. This tells GCC to deduce
23050 the hardware multiply support based upon the MCU name provided by the
23051 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
23052 the MCU name is not recognized then no hardware multiply support is
23053 assumed. @code{auto} is the default setting.
23054
23055 Hardware multiplies are normally performed by calling a library
23056 routine. This saves space in the generated code. When compiling at
23057 @option{-O3} or higher however the hardware multiplier is invoked
23058 inline. This makes for bigger, but faster code.
23059
23060 The hardware multiply routines disable interrupts whilst running and
23061 restore the previous interrupt state when they finish. This makes
23062 them safe to use inside interrupt handlers as well as in normal code.
23063
23064 @item -minrt
23065 @opindex minrt
23066 Enable the use of a minimum runtime environment - no static
23067 initializers or constructors. This is intended for memory-constrained
23068 devices. The compiler includes special symbols in some objects
23069 that tell the linker and runtime which code fragments are required.
23070
23071 @item -mcode-region=
23072 @itemx -mdata-region=
23073 @opindex mcode-region
23074 @opindex mdata-region
23075 These options tell the compiler where to place functions and data that
23076 do not have one of the @code{lower}, @code{upper}, @code{either} or
23077 @code{section} attributes. Possible values are @code{lower},
23078 @code{upper}, @code{either} or @code{any}. The first three behave
23079 like the corresponding attribute. The fourth possible value -
23080 @code{any} - is the default. It leaves placement entirely up to the
23081 linker script and how it assigns the standard sections
23082 (@code{.text}, @code{.data}, etc) to the memory regions.
23083
23084 @item -msilicon-errata=
23085 @opindex msilicon-errata
23086 This option passes on a request to assembler to enable the fixes for
23087 the named silicon errata.
23088
23089 @item -msilicon-errata-warn=
23090 @opindex msilicon-errata-warn
23091 This option passes on a request to the assembler to enable warning
23092 messages when a silicon errata might need to be applied.
23093
23094 @end table
23095
23096 @node NDS32 Options
23097 @subsection NDS32 Options
23098 @cindex NDS32 Options
23099
23100 These options are defined for NDS32 implementations:
23101
23102 @table @gcctabopt
23103
23104 @item -mbig-endian
23105 @opindex mbig-endian
23106 Generate code in big-endian mode.
23107
23108 @item -mlittle-endian
23109 @opindex mlittle-endian
23110 Generate code in little-endian mode.
23111
23112 @item -mreduced-regs
23113 @opindex mreduced-regs
23114 Use reduced-set registers for register allocation.
23115
23116 @item -mfull-regs
23117 @opindex mfull-regs
23118 Use full-set registers for register allocation.
23119
23120 @item -mcmov
23121 @opindex mcmov
23122 Generate conditional move instructions.
23123
23124 @item -mno-cmov
23125 @opindex mno-cmov
23126 Do not generate conditional move instructions.
23127
23128 @item -mext-perf
23129 @opindex mext-perf
23130 Generate performance extension instructions.
23131
23132 @item -mno-ext-perf
23133 @opindex mno-ext-perf
23134 Do not generate performance extension instructions.
23135
23136 @item -mext-perf2
23137 @opindex mext-perf2
23138 Generate performance extension 2 instructions.
23139
23140 @item -mno-ext-perf2
23141 @opindex mno-ext-perf2
23142 Do not generate performance extension 2 instructions.
23143
23144 @item -mext-string
23145 @opindex mext-string
23146 Generate string extension instructions.
23147
23148 @item -mno-ext-string
23149 @opindex mno-ext-string
23150 Do not generate string extension instructions.
23151
23152 @item -mv3push
23153 @opindex mv3push
23154 Generate v3 push25/pop25 instructions.
23155
23156 @item -mno-v3push
23157 @opindex mno-v3push
23158 Do not generate v3 push25/pop25 instructions.
23159
23160 @item -m16-bit
23161 @opindex m16-bit
23162 Generate 16-bit instructions.
23163
23164 @item -mno-16-bit
23165 @opindex mno-16-bit
23166 Do not generate 16-bit instructions.
23167
23168 @item -misr-vector-size=@var{num}
23169 @opindex misr-vector-size
23170 Specify the size of each interrupt vector, which must be 4 or 16.
23171
23172 @item -mcache-block-size=@var{num}
23173 @opindex mcache-block-size
23174 Specify the size of each cache block,
23175 which must be a power of 2 between 4 and 512.
23176
23177 @item -march=@var{arch}
23178 @opindex march
23179 Specify the name of the target architecture.
23180
23181 @item -mcmodel=@var{code-model}
23182 @opindex mcmodel
23183 Set the code model to one of
23184 @table @asis
23185 @item @samp{small}
23186 All the data and read-only data segments must be within 512KB addressing space.
23187 The text segment must be within 16MB addressing space.
23188 @item @samp{medium}
23189 The data segment must be within 512KB while the read-only data segment can be
23190 within 4GB addressing space. The text segment should be still within 16MB
23191 addressing space.
23192 @item @samp{large}
23193 All the text and data segments can be within 4GB addressing space.
23194 @end table
23195
23196 @item -mctor-dtor
23197 @opindex mctor-dtor
23198 Enable constructor/destructor feature.
23199
23200 @item -mrelax
23201 @opindex mrelax
23202 Guide linker to relax instructions.
23203
23204 @end table
23205
23206 @node Nios II Options
23207 @subsection Nios II Options
23208 @cindex Nios II options
23209 @cindex Altera Nios II options
23210
23211 These are the options defined for the Altera Nios II processor.
23212
23213 @table @gcctabopt
23214
23215 @item -G @var{num}
23216 @opindex G
23217 @cindex smaller data references
23218 Put global and static objects less than or equal to @var{num} bytes
23219 into the small data or BSS sections instead of the normal data or BSS
23220 sections. The default value of @var{num} is 8.
23221
23222 @item -mgpopt=@var{option}
23223 @itemx -mgpopt
23224 @itemx -mno-gpopt
23225 @opindex mgpopt
23226 @opindex mno-gpopt
23227 Generate (do not generate) GP-relative accesses. The following
23228 @var{option} names are recognized:
23229
23230 @table @samp
23231
23232 @item none
23233 Do not generate GP-relative accesses.
23234
23235 @item local
23236 Generate GP-relative accesses for small data objects that are not
23237 external, weak, or uninitialized common symbols.
23238 Also use GP-relative addressing for objects that
23239 have been explicitly placed in a small data section via a @code{section}
23240 attribute.
23241
23242 @item global
23243 As for @samp{local}, but also generate GP-relative accesses for
23244 small data objects that are external, weak, or common. If you use this option,
23245 you must ensure that all parts of your program (including libraries) are
23246 compiled with the same @option{-G} setting.
23247
23248 @item data
23249 Generate GP-relative accesses for all data objects in the program. If you
23250 use this option, the entire data and BSS segments
23251 of your program must fit in 64K of memory and you must use an appropriate
23252 linker script to allocate them within the addressable range of the
23253 global pointer.
23254
23255 @item all
23256 Generate GP-relative addresses for function pointers as well as data
23257 pointers. If you use this option, the entire text, data, and BSS segments
23258 of your program must fit in 64K of memory and you must use an appropriate
23259 linker script to allocate them within the addressable range of the
23260 global pointer.
23261
23262 @end table
23263
23264 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23265 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23266
23267 The default is @option{-mgpopt} except when @option{-fpic} or
23268 @option{-fPIC} is specified to generate position-independent code.
23269 Note that the Nios II ABI does not permit GP-relative accesses from
23270 shared libraries.
23271
23272 You may need to specify @option{-mno-gpopt} explicitly when building
23273 programs that include large amounts of small data, including large
23274 GOT data sections. In this case, the 16-bit offset for GP-relative
23275 addressing may not be large enough to allow access to the entire
23276 small data section.
23277
23278 @item -mgprel-sec=@var{regexp}
23279 @opindex mgprel-sec
23280 This option specifies additional section names that can be accessed via
23281 GP-relative addressing. It is most useful in conjunction with
23282 @code{section} attributes on variable declarations
23283 (@pxref{Common Variable Attributes}) and a custom linker script.
23284 The @var{regexp} is a POSIX Extended Regular Expression.
23285
23286 This option does not affect the behavior of the @option{-G} option, and
23287 the specified sections are in addition to the standard @code{.sdata}
23288 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23289
23290 @item -mr0rel-sec=@var{regexp}
23291 @opindex mr0rel-sec
23292 This option specifies names of sections that can be accessed via a
23293 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23294 of the 32-bit address space. It is most useful in conjunction with
23295 @code{section} attributes on variable declarations
23296 (@pxref{Common Variable Attributes}) and a custom linker script.
23297 The @var{regexp} is a POSIX Extended Regular Expression.
23298
23299 In contrast to the use of GP-relative addressing for small data,
23300 zero-based addressing is never generated by default and there are no
23301 conventional section names used in standard linker scripts for sections
23302 in the low or high areas of memory.
23303
23304 @item -mel
23305 @itemx -meb
23306 @opindex mel
23307 @opindex meb
23308 Generate little-endian (default) or big-endian (experimental) code,
23309 respectively.
23310
23311 @item -march=@var{arch}
23312 @opindex march
23313 This specifies the name of the target Nios II architecture. GCC uses this
23314 name to determine what kind of instructions it can emit when generating
23315 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23316
23317 The preprocessor macro @code{__nios2_arch__} is available to programs,
23318 with value 1 or 2, indicating the targeted ISA level.
23319
23320 @item -mbypass-cache
23321 @itemx -mno-bypass-cache
23322 @opindex mno-bypass-cache
23323 @opindex mbypass-cache
23324 Force all load and store instructions to always bypass cache by
23325 using I/O variants of the instructions. The default is not to
23326 bypass the cache.
23327
23328 @item -mno-cache-volatile
23329 @itemx -mcache-volatile
23330 @opindex mcache-volatile
23331 @opindex mno-cache-volatile
23332 Volatile memory access bypass the cache using the I/O variants of
23333 the load and store instructions. The default is not to bypass the cache.
23334
23335 @item -mno-fast-sw-div
23336 @itemx -mfast-sw-div
23337 @opindex mno-fast-sw-div
23338 @opindex mfast-sw-div
23339 Do not use table-based fast divide for small numbers. The default
23340 is to use the fast divide at @option{-O3} and above.
23341
23342 @item -mno-hw-mul
23343 @itemx -mhw-mul
23344 @itemx -mno-hw-mulx
23345 @itemx -mhw-mulx
23346 @itemx -mno-hw-div
23347 @itemx -mhw-div
23348 @opindex mno-hw-mul
23349 @opindex mhw-mul
23350 @opindex mno-hw-mulx
23351 @opindex mhw-mulx
23352 @opindex mno-hw-div
23353 @opindex mhw-div
23354 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23355 instructions by the compiler. The default is to emit @code{mul}
23356 and not emit @code{div} and @code{mulx}.
23357
23358 @item -mbmx
23359 @itemx -mno-bmx
23360 @itemx -mcdx
23361 @itemx -mno-cdx
23362 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23363 CDX (code density) instructions. Enabling these instructions also
23364 requires @option{-march=r2}. Since these instructions are optional
23365 extensions to the R2 architecture, the default is not to emit them.
23366
23367 @item -mcustom-@var{insn}=@var{N}
23368 @itemx -mno-custom-@var{insn}
23369 @opindex mcustom-@var{insn}
23370 @opindex mno-custom-@var{insn}
23371 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23372 custom instruction with encoding @var{N} when generating code that uses
23373 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23374 instruction 253 for single-precision floating-point add operations instead
23375 of the default behavior of using a library call.
23376
23377 The following values of @var{insn} are supported. Except as otherwise
23378 noted, floating-point operations are expected to be implemented with
23379 normal IEEE 754 semantics and correspond directly to the C operators or the
23380 equivalent GCC built-in functions (@pxref{Other Builtins}).
23381
23382 Single-precision floating point:
23383 @table @asis
23384
23385 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23386 Binary arithmetic operations.
23387
23388 @item @samp{fnegs}
23389 Unary negation.
23390
23391 @item @samp{fabss}
23392 Unary absolute value.
23393
23394 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23395 Comparison operations.
23396
23397 @item @samp{fmins}, @samp{fmaxs}
23398 Floating-point minimum and maximum. These instructions are only
23399 generated if @option{-ffinite-math-only} is specified.
23400
23401 @item @samp{fsqrts}
23402 Unary square root operation.
23403
23404 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23405 Floating-point trigonometric and exponential functions. These instructions
23406 are only generated if @option{-funsafe-math-optimizations} is also specified.
23407
23408 @end table
23409
23410 Double-precision floating point:
23411 @table @asis
23412
23413 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23414 Binary arithmetic operations.
23415
23416 @item @samp{fnegd}
23417 Unary negation.
23418
23419 @item @samp{fabsd}
23420 Unary absolute value.
23421
23422 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23423 Comparison operations.
23424
23425 @item @samp{fmind}, @samp{fmaxd}
23426 Double-precision minimum and maximum. These instructions are only
23427 generated if @option{-ffinite-math-only} is specified.
23428
23429 @item @samp{fsqrtd}
23430 Unary square root operation.
23431
23432 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23433 Double-precision trigonometric and exponential functions. These instructions
23434 are only generated if @option{-funsafe-math-optimizations} is also specified.
23435
23436 @end table
23437
23438 Conversions:
23439 @table @asis
23440 @item @samp{fextsd}
23441 Conversion from single precision to double precision.
23442
23443 @item @samp{ftruncds}
23444 Conversion from double precision to single precision.
23445
23446 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23447 Conversion from floating point to signed or unsigned integer types, with
23448 truncation towards zero.
23449
23450 @item @samp{round}
23451 Conversion from single-precision floating point to signed integer,
23452 rounding to the nearest integer and ties away from zero.
23453 This corresponds to the @code{__builtin_lroundf} function when
23454 @option{-fno-math-errno} is used.
23455
23456 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23457 Conversion from signed or unsigned integer types to floating-point types.
23458
23459 @end table
23460
23461 In addition, all of the following transfer instructions for internal
23462 registers X and Y must be provided to use any of the double-precision
23463 floating-point instructions. Custom instructions taking two
23464 double-precision source operands expect the first operand in the
23465 64-bit register X. The other operand (or only operand of a unary
23466 operation) is given to the custom arithmetic instruction with the
23467 least significant half in source register @var{src1} and the most
23468 significant half in @var{src2}. A custom instruction that returns a
23469 double-precision result returns the most significant 32 bits in the
23470 destination register and the other half in 32-bit register Y.
23471 GCC automatically generates the necessary code sequences to write
23472 register X and/or read register Y when double-precision floating-point
23473 instructions are used.
23474
23475 @table @asis
23476
23477 @item @samp{fwrx}
23478 Write @var{src1} into the least significant half of X and @var{src2} into
23479 the most significant half of X.
23480
23481 @item @samp{fwry}
23482 Write @var{src1} into Y.
23483
23484 @item @samp{frdxhi}, @samp{frdxlo}
23485 Read the most or least (respectively) significant half of X and store it in
23486 @var{dest}.
23487
23488 @item @samp{frdy}
23489 Read the value of Y and store it into @var{dest}.
23490 @end table
23491
23492 Note that you can gain more local control over generation of Nios II custom
23493 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23494 and @code{target("no-custom-@var{insn}")} function attributes
23495 (@pxref{Function Attributes})
23496 or pragmas (@pxref{Function Specific Option Pragmas}).
23497
23498 @item -mcustom-fpu-cfg=@var{name}
23499 @opindex mcustom-fpu-cfg
23500
23501 This option enables a predefined, named set of custom instruction encodings
23502 (see @option{-mcustom-@var{insn}} above).
23503 Currently, the following sets are defined:
23504
23505 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23506 @gccoptlist{-mcustom-fmuls=252 @gol
23507 -mcustom-fadds=253 @gol
23508 -mcustom-fsubs=254 @gol
23509 -fsingle-precision-constant}
23510
23511 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23512 @gccoptlist{-mcustom-fmuls=252 @gol
23513 -mcustom-fadds=253 @gol
23514 -mcustom-fsubs=254 @gol
23515 -mcustom-fdivs=255 @gol
23516 -fsingle-precision-constant}
23517
23518 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23519 @gccoptlist{-mcustom-floatus=243 @gol
23520 -mcustom-fixsi=244 @gol
23521 -mcustom-floatis=245 @gol
23522 -mcustom-fcmpgts=246 @gol
23523 -mcustom-fcmples=249 @gol
23524 -mcustom-fcmpeqs=250 @gol
23525 -mcustom-fcmpnes=251 @gol
23526 -mcustom-fmuls=252 @gol
23527 -mcustom-fadds=253 @gol
23528 -mcustom-fsubs=254 @gol
23529 -mcustom-fdivs=255 @gol
23530 -fsingle-precision-constant}
23531
23532 Custom instruction assignments given by individual
23533 @option{-mcustom-@var{insn}=} options override those given by
23534 @option{-mcustom-fpu-cfg=}, regardless of the
23535 order of the options on the command line.
23536
23537 Note that you can gain more local control over selection of a FPU
23538 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23539 function attribute (@pxref{Function Attributes})
23540 or pragma (@pxref{Function Specific Option Pragmas}).
23541
23542 @end table
23543
23544 These additional @samp{-m} options are available for the Altera Nios II
23545 ELF (bare-metal) target:
23546
23547 @table @gcctabopt
23548
23549 @item -mhal
23550 @opindex mhal
23551 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23552 startup and termination code, and is typically used in conjunction with
23553 @option{-msys-crt0=} to specify the location of the alternate startup code
23554 provided by the HAL BSP.
23555
23556 @item -msmallc
23557 @opindex msmallc
23558 Link with a limited version of the C library, @option{-lsmallc}, rather than
23559 Newlib.
23560
23561 @item -msys-crt0=@var{startfile}
23562 @opindex msys-crt0
23563 @var{startfile} is the file name of the startfile (crt0) to use
23564 when linking. This option is only useful in conjunction with @option{-mhal}.
23565
23566 @item -msys-lib=@var{systemlib}
23567 @opindex msys-lib
23568 @var{systemlib} is the library name of the library that provides
23569 low-level system calls required by the C library,
23570 e.g.@: @code{read} and @code{write}.
23571 This option is typically used to link with a library provided by a HAL BSP.
23572
23573 @end table
23574
23575 @node Nvidia PTX Options
23576 @subsection Nvidia PTX Options
23577 @cindex Nvidia PTX options
23578 @cindex nvptx options
23579
23580 These options are defined for Nvidia PTX:
23581
23582 @table @gcctabopt
23583
23584 @item -m32
23585 @itemx -m64
23586 @opindex m32
23587 @opindex m64
23588 Generate code for 32-bit or 64-bit ABI.
23589
23590 @item -misa=@var{ISA-string}
23591 @opindex march
23592 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23593 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23594 @samp{sm_35}. The default ISA is sm_30.
23595
23596 @item -mmainkernel
23597 @opindex mmainkernel
23598 Link in code for a __main kernel. This is for stand-alone instead of
23599 offloading execution.
23600
23601 @item -moptimize
23602 @opindex moptimize
23603 Apply partitioned execution optimizations. This is the default when any
23604 level of optimization is selected.
23605
23606 @item -msoft-stack
23607 @opindex msoft-stack
23608 Generate code that does not use @code{.local} memory
23609 directly for stack storage. Instead, a per-warp stack pointer is
23610 maintained explicitly. This enables variable-length stack allocation (with
23611 variable-length arrays or @code{alloca}), and when global memory is used for
23612 underlying storage, makes it possible to access automatic variables from other
23613 threads, or with atomic instructions. This code generation variant is used
23614 for OpenMP offloading, but the option is exposed on its own for the purpose
23615 of testing the compiler; to generate code suitable for linking into programs
23616 using OpenMP offloading, use option @option{-mgomp}.
23617
23618 @item -muniform-simt
23619 @opindex muniform-simt
23620 Switch to code generation variant that allows to execute all threads in each
23621 warp, while maintaining memory state and side effects as if only one thread
23622 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23623 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23624 current lane index equals the master lane index), and the register being
23625 assigned is copied via a shuffle instruction from the master lane. Outside of
23626 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23627 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23628 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23629 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23630 with current lane index to compute the master lane index.
23631
23632 @item -mgomp
23633 @opindex mgomp
23634 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23635 @option{-muniform-simt} options, and selects corresponding multilib variant.
23636
23637 @end table
23638
23639 @node OpenRISC Options
23640 @subsection OpenRISC Options
23641 @cindex OpenRISC Options
23642
23643 These options are defined for OpenRISC:
23644
23645 @table @gcctabopt
23646
23647 @item -mboard=@var{name}
23648 @opindex mboard
23649 Configure a board specific runtime. This will be passed to the linker for
23650 newlib board library linking. The default is @code{or1ksim}.
23651
23652 @item -mnewlib
23653 @opindex mnewlib
23654 This option is ignored; it is for compatibility purposes only. This used to
23655 select linker and preprocessor options for use with newlib.
23656
23657 @item -msoft-div
23658 @itemx -mhard-div
23659 @opindex msoft-div
23660 @opindex mhard-div
23661 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
23662 This default is hardware divide.
23663
23664 @item -msoft-mul
23665 @itemx -mhard-mul
23666 @opindex msoft-mul
23667 @opindex mhard-mul
23668 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
23669 This default is hardware multiply.
23670
23671 @item -msoft-float
23672 @itemx -mhard-float
23673 @opindex msoft-float
23674 @opindex mhard-float
23675 Select software or hardware for floating point operations.
23676 The default is software.
23677
23678 @item -mdouble-float
23679 @opindex mdouble-float
23680 When @option{-mhard-float} is selected, enables generation of double-precision
23681 floating point instructions. By default functions from @file{libgcc} are used
23682 to perform double-precision floating point operations.
23683
23684 @item -munordered-float
23685 @opindex munordered-float
23686 When @option{-mhard-float} is selected, enables generation of unordered
23687 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
23688 functions from @file{libgcc} are used to perform unordered floating point
23689 compare and set flag operations.
23690
23691 @item -mcmov
23692 @opindex mcmov
23693 Enable generation of conditional move (@code{l.cmov}) instructions. By
23694 default the equivalent will be generated using using set and branch.
23695
23696 @item -mror
23697 @opindex mror
23698 Enable generation of rotate right (@code{l.ror}) instructions. By default
23699 functions from @file{libgcc} are used to perform rotate right operations.
23700
23701 @item -mrori
23702 @opindex mrori
23703 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
23704 By default functions from @file{libgcc} are used to perform rotate right with
23705 immediate operations.
23706
23707 @item -msext
23708 @opindex msext
23709 Enable generation of sign extension (@code{l.ext*}) instructions. By default
23710 memory loads are used to perform sign extension.
23711
23712 @item -msfimm
23713 @opindex msfimm
23714 Enable generation of compare and set flag with immediate (@code{l.sf*i})
23715 instructions. By default extra instructions will be generated to store the
23716 immediate to a register first.
23717
23718 @item -mshftimm
23719 @opindex mshftimm
23720 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
23721 @code{l.slli}) instructions. By default extra instructions will be generated
23722 to store the immediate to a register first.
23723
23724
23725 @end table
23726
23727 @node PDP-11 Options
23728 @subsection PDP-11 Options
23729 @cindex PDP-11 Options
23730
23731 These options are defined for the PDP-11:
23732
23733 @table @gcctabopt
23734 @item -mfpu
23735 @opindex mfpu
23736 Use hardware FPP floating point. This is the default. (FIS floating
23737 point on the PDP-11/40 is not supported.) Implies -m45.
23738
23739 @item -msoft-float
23740 @opindex msoft-float
23741 Do not use hardware floating point.
23742
23743 @item -mac0
23744 @opindex mac0
23745 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23746
23747 @item -mno-ac0
23748 @opindex mno-ac0
23749 Return floating-point results in memory. This is the default.
23750
23751 @item -m40
23752 @opindex m40
23753 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23754
23755 @item -m45
23756 @opindex m45
23757 Generate code for a PDP-11/45. This is the default.
23758
23759 @item -m10
23760 @opindex m10
23761 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23762
23763 @item -mint16
23764 @itemx -mno-int32
23765 @opindex mint16
23766 @opindex mno-int32
23767 Use 16-bit @code{int}. This is the default.
23768
23769 @item -mint32
23770 @itemx -mno-int16
23771 @opindex mint32
23772 @opindex mno-int16
23773 Use 32-bit @code{int}.
23774
23775 @item -msplit
23776 @opindex msplit
23777 Target has split instruction and data space. Implies -m45.
23778
23779 @item -munix-asm
23780 @opindex munix-asm
23781 Use Unix assembler syntax.
23782
23783 @item -mdec-asm
23784 @opindex mdec-asm
23785 Use DEC assembler syntax.
23786
23787 @item -mgnu-asm
23788 @opindex mgnu-asm
23789 Use GNU assembler syntax. This is the default.
23790
23791 @item -mlra
23792 @opindex mlra
23793 Use the new LRA register allocator. By default, the old ``reload''
23794 allocator is used.
23795 @end table
23796
23797 @node picoChip Options
23798 @subsection picoChip Options
23799 @cindex picoChip options
23800
23801 These @samp{-m} options are defined for picoChip implementations:
23802
23803 @table @gcctabopt
23804
23805 @item -mae=@var{ae_type}
23806 @opindex mcpu
23807 Set the instruction set, register set, and instruction scheduling
23808 parameters for array element type @var{ae_type}. Supported values
23809 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23810
23811 @option{-mae=ANY} selects a completely generic AE type. Code
23812 generated with this option runs on any of the other AE types. The
23813 code is not as efficient as it would be if compiled for a specific
23814 AE type, and some types of operation (e.g., multiplication) do not
23815 work properly on all types of AE.
23816
23817 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23818 for compiled code, and is the default.
23819
23820 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23821 option may suffer from poor performance of byte (char) manipulation,
23822 since the DSP AE does not provide hardware support for byte load/stores.
23823
23824 @item -msymbol-as-address
23825 Enable the compiler to directly use a symbol name as an address in a
23826 load/store instruction, without first loading it into a
23827 register. Typically, the use of this option generates larger
23828 programs, which run faster than when the option isn't used. However, the
23829 results vary from program to program, so it is left as a user option,
23830 rather than being permanently enabled.
23831
23832 @item -mno-inefficient-warnings
23833 Disables warnings about the generation of inefficient code. These
23834 warnings can be generated, for example, when compiling code that
23835 performs byte-level memory operations on the MAC AE type. The MAC AE has
23836 no hardware support for byte-level memory operations, so all byte
23837 load/stores must be synthesized from word load/store operations. This is
23838 inefficient and a warning is generated to indicate
23839 that you should rewrite the code to avoid byte operations, or to target
23840 an AE type that has the necessary hardware support. This option disables
23841 these warnings.
23842
23843 @end table
23844
23845 @node PowerPC Options
23846 @subsection PowerPC Options
23847 @cindex PowerPC options
23848
23849 These are listed under @xref{RS/6000 and PowerPC Options}.
23850
23851 @node PRU Options
23852 @subsection PRU Options
23853 @cindex PRU Options
23854
23855 These command-line options are defined for PRU target:
23856
23857 @table @gcctabopt
23858 @item -minrt
23859 @opindex minrt
23860 Link with a minimum runtime environment, with no support for static
23861 initializers and constructors. Using this option can significantly reduce
23862 the size of the final ELF binary. Beware that the compiler could still
23863 generate code with static initializers and constructors. It is up to the
23864 programmer to ensure that the source program will not use those features.
23865
23866 @item -mmcu=@var{mcu}
23867 @opindex mmcu
23868 Specify the PRU MCU variant to use. Check Newlib for the exact list of
23869 supported MCUs.
23870
23871 @item -mno-relax
23872 @opindex mno-relax
23873 Make GCC pass the @option{--no-relax} command-line option to the linker
23874 instead of the @option{--relax} option.
23875
23876 @item -mloop
23877 @opindex mloop
23878 Allow (or do not allow) GCC to use the LOOP instruction.
23879
23880 @item -mabi=@var{variant}
23881 @opindex mabi
23882 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
23883 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
23884 more naturally with certain GCC assumptions. These are the differences:
23885
23886 @table @samp
23887 @item Function Pointer Size
23888 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
23889 supports only 32-bit data and code pointers.
23890
23891 @item Optional Return Value Pointer
23892 Function return values larger than 64 bits are passed by using a hidden
23893 pointer as the first argument of the function. TI ABI, though, mandates that
23894 the pointer can be NULL in case the caller is not using the returned value.
23895 GNU always passes and expects a valid return value pointer.
23896
23897 @end table
23898
23899 The current @option{-mabi=ti} implementation simply raises a compile error
23900 when any of the above code constructs is detected. As a consequence
23901 the standard C library cannot be built and it is omitted when linking with
23902 @option{-mabi=ti}.
23903
23904 Relaxation is a GNU feature and for safety reasons is disabled when using
23905 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
23906 instructions, so the GNU linker cannot adjust them when shortening adjacent
23907 LDI32 pseudo instructions.
23908
23909 @end table
23910
23911 @node RISC-V Options
23912 @subsection RISC-V Options
23913 @cindex RISC-V Options
23914
23915 These command-line options are defined for RISC-V targets:
23916
23917 @table @gcctabopt
23918 @item -mbranch-cost=@var{n}
23919 @opindex mbranch-cost
23920 Set the cost of branches to roughly @var{n} instructions.
23921
23922 @item -mplt
23923 @itemx -mno-plt
23924 @opindex plt
23925 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23926 non-PIC. The default is @option{-mplt}.
23927
23928 @item -mabi=@var{ABI-string}
23929 @opindex mabi
23930 Specify integer and floating-point calling convention. @var{ABI-string}
23931 contains two parts: the size of integer types and the registers used for
23932 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23933 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23934 32-bit), and that floating-point values up to 64 bits wide are passed in F
23935 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23936 allows the compiler to generate code that uses the F and D extensions but only
23937 allows floating-point values up to 32 bits long to be passed in registers; or
23938 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23939 passed in registers.
23940
23941 The default for this argument is system dependent, users who want a specific
23942 calling convention should specify one explicitly. The valid calling
23943 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23944 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23945 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23946 invalid because the ABI requires 64-bit values be passed in F registers, but F
23947 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23948 only be used with the @samp{rv32e} architecture. This ABI is not well
23949 specified at present, and is subject to change.
23950
23951 @item -mfdiv
23952 @itemx -mno-fdiv
23953 @opindex mfdiv
23954 Do or don't use hardware floating-point divide and square root instructions.
23955 This requires the F or D extensions for floating-point registers. The default
23956 is to use them if the specified architecture has these instructions.
23957
23958 @item -mdiv
23959 @itemx -mno-div
23960 @opindex mdiv
23961 Do or don't use hardware instructions for integer division. This requires the
23962 M extension. The default is to use them if the specified architecture has
23963 these instructions.
23964
23965 @item -march=@var{ISA-string}
23966 @opindex march
23967 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
23968 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23969 @samp{rv32imaf}.
23970
23971 @item -mtune=@var{processor-string}
23972 @opindex mtune
23973 Optimize the output for the given processor, specified by microarchitecture
23974 name. Permissible values for this option are: @samp{rocket},
23975 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
23976 and @samp{size}.
23977
23978 When @option{-mtune=} is not specified, the default is @samp{rocket}.
23979
23980 The @samp{size} choice is not intended for use by end-users. This is used
23981 when @option{-Os} is specified. It overrides the instruction cost info
23982 provided by @option{-mtune=}, but does not override the pipeline info. This
23983 helps reduce code size while still giving good performance.
23984
23985 @item -mpreferred-stack-boundary=@var{num}
23986 @opindex mpreferred-stack-boundary
23987 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23988 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23989 the default is 4 (16 bytes or 128-bits).
23990
23991 @strong{Warning:} If you use this switch, then you must build all modules with
23992 the same value, including any libraries. This includes the system libraries
23993 and startup modules.
23994
23995 @item -msmall-data-limit=@var{n}
23996 @opindex msmall-data-limit
23997 Put global and static data smaller than @var{n} bytes into a special section
23998 (on some targets).
23999
24000 @item -msave-restore
24001 @itemx -mno-save-restore
24002 @opindex msave-restore
24003 Do or don't use smaller but slower prologue and epilogue code that uses
24004 library function calls. The default is to use fast inline prologues and
24005 epilogues.
24006
24007 @item -mstrict-align
24008 @itemx -mno-strict-align
24009 @opindex mstrict-align
24010 Do not or do generate unaligned memory accesses. The default is set depending
24011 on whether the processor we are optimizing for supports fast unaligned access
24012 or not.
24013
24014 @item -mcmodel=medlow
24015 @opindex mcmodel=medlow
24016 Generate code for the medium-low code model. The program and its statically
24017 defined symbols must lie within a single 2 GiB address range and must lie
24018 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24019 statically or dynamically linked. This is the default code model.
24020
24021 @item -mcmodel=medany
24022 @opindex mcmodel=medany
24023 Generate code for the medium-any code model. The program and its statically
24024 defined symbols must be within any single 2 GiB address range. Programs can be
24025 statically or dynamically linked.
24026
24027 @item -mexplicit-relocs
24028 @itemx -mno-exlicit-relocs
24029 Use or do not use assembler relocation operators when dealing with symbolic
24030 addresses. The alternative is to use assembler macros instead, which may
24031 limit optimization.
24032
24033 @item -mrelax
24034 @itemx -mno-relax
24035 Take advantage of linker relaxations to reduce the number of instructions
24036 required to materialize symbol addresses. The default is to take advantage of
24037 linker relaxations.
24038
24039 @item -memit-attribute
24040 @itemx -mno-emit-attribute
24041 Emit (do not emit) RISC-V attribute to record extra information into ELF
24042 objects. This feature requires at least binutils 2.32.
24043
24044 @item -malign-data=@var{type}
24045 @opindex malign-data
24046 Control how GCC aligns variables and constants of array, structure, or union
24047 types. Supported values for @var{type} are @samp{xlen} which uses x register
24048 width as the alignment value, and @samp{natural} which uses natural alignment.
24049 @samp{xlen} is the default.
24050 @end table
24051
24052 @node RL78 Options
24053 @subsection RL78 Options
24054 @cindex RL78 Options
24055
24056 @table @gcctabopt
24057
24058 @item -msim
24059 @opindex msim
24060 Links in additional target libraries to support operation within a
24061 simulator.
24062
24063 @item -mmul=none
24064 @itemx -mmul=g10
24065 @itemx -mmul=g13
24066 @itemx -mmul=g14
24067 @itemx -mmul=rl78
24068 @opindex mmul
24069 Specifies the type of hardware multiplication and division support to
24070 be used. The simplest is @code{none}, which uses software for both
24071 multiplication and division. This is the default. The @code{g13}
24072 value is for the hardware multiply/divide peripheral found on the
24073 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24074 the multiplication and division instructions supported by the RL78/G14
24075 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24076 the value @code{mg10} is an alias for @code{none}.
24077
24078 In addition a C preprocessor macro is defined, based upon the setting
24079 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24080 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24081
24082 @item -mcpu=g10
24083 @itemx -mcpu=g13
24084 @itemx -mcpu=g14
24085 @itemx -mcpu=rl78
24086 @opindex mcpu
24087 Specifies the RL78 core to target. The default is the G14 core, also
24088 known as an S3 core or just RL78. The G13 or S2 core does not have
24089 multiply or divide instructions, instead it uses a hardware peripheral
24090 for these operations. The G10 or S1 core does not have register
24091 banks, so it uses a different calling convention.
24092
24093 If this option is set it also selects the type of hardware multiply
24094 support to use, unless this is overridden by an explicit
24095 @option{-mmul=none} option on the command line. Thus specifying
24096 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24097 peripheral and specifying @option{-mcpu=g10} disables the use of
24098 hardware multiplications altogether.
24099
24100 Note, although the RL78/G14 core is the default target, specifying
24101 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24102 change the behavior of the toolchain since it also enables G14
24103 hardware multiply support. If these options are not specified on the
24104 command line then software multiplication routines will be used even
24105 though the code targets the RL78 core. This is for backwards
24106 compatibility with older toolchains which did not have hardware
24107 multiply and divide support.
24108
24109 In addition a C preprocessor macro is defined, based upon the setting
24110 of this option. Possible values are: @code{__RL78_G10__},
24111 @code{__RL78_G13__} or @code{__RL78_G14__}.
24112
24113 @item -mg10
24114 @itemx -mg13
24115 @itemx -mg14
24116 @itemx -mrl78
24117 @opindex mg10
24118 @opindex mg13
24119 @opindex mg14
24120 @opindex mrl78
24121 These are aliases for the corresponding @option{-mcpu=} option. They
24122 are provided for backwards compatibility.
24123
24124 @item -mallregs
24125 @opindex mallregs
24126 Allow the compiler to use all of the available registers. By default
24127 registers @code{r24..r31} are reserved for use in interrupt handlers.
24128 With this option enabled these registers can be used in ordinary
24129 functions as well.
24130
24131 @item -m64bit-doubles
24132 @itemx -m32bit-doubles
24133 @opindex m64bit-doubles
24134 @opindex m32bit-doubles
24135 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24136 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24137 @option{-m32bit-doubles}.
24138
24139 @item -msave-mduc-in-interrupts
24140 @itemx -mno-save-mduc-in-interrupts
24141 @opindex msave-mduc-in-interrupts
24142 @opindex mno-save-mduc-in-interrupts
24143 Specifies that interrupt handler functions should preserve the
24144 MDUC registers. This is only necessary if normal code might use
24145 the MDUC registers, for example because it performs multiplication
24146 and division operations. The default is to ignore the MDUC registers
24147 as this makes the interrupt handlers faster. The target option -mg13
24148 needs to be passed for this to work as this feature is only available
24149 on the G13 target (S2 core). The MDUC registers will only be saved
24150 if the interrupt handler performs a multiplication or division
24151 operation or it calls another function.
24152
24153 @end table
24154
24155 @node RS/6000 and PowerPC Options
24156 @subsection IBM RS/6000 and PowerPC Options
24157 @cindex RS/6000 and PowerPC Options
24158 @cindex IBM RS/6000 and PowerPC Options
24159
24160 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24161 @table @gcctabopt
24162 @item -mpowerpc-gpopt
24163 @itemx -mno-powerpc-gpopt
24164 @itemx -mpowerpc-gfxopt
24165 @itemx -mno-powerpc-gfxopt
24166 @need 800
24167 @itemx -mpowerpc64
24168 @itemx -mno-powerpc64
24169 @itemx -mmfcrf
24170 @itemx -mno-mfcrf
24171 @itemx -mpopcntb
24172 @itemx -mno-popcntb
24173 @itemx -mpopcntd
24174 @itemx -mno-popcntd
24175 @itemx -mfprnd
24176 @itemx -mno-fprnd
24177 @need 800
24178 @itemx -mcmpb
24179 @itemx -mno-cmpb
24180 @itemx -mhard-dfp
24181 @itemx -mno-hard-dfp
24182 @opindex mpowerpc-gpopt
24183 @opindex mno-powerpc-gpopt
24184 @opindex mpowerpc-gfxopt
24185 @opindex mno-powerpc-gfxopt
24186 @opindex mpowerpc64
24187 @opindex mno-powerpc64
24188 @opindex mmfcrf
24189 @opindex mno-mfcrf
24190 @opindex mpopcntb
24191 @opindex mno-popcntb
24192 @opindex mpopcntd
24193 @opindex mno-popcntd
24194 @opindex mfprnd
24195 @opindex mno-fprnd
24196 @opindex mcmpb
24197 @opindex mno-cmpb
24198 @opindex mhard-dfp
24199 @opindex mno-hard-dfp
24200 You use these options to specify which instructions are available on the
24201 processor you are using. The default value of these options is
24202 determined when configuring GCC@. Specifying the
24203 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24204 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24205 rather than the options listed above.
24206
24207 Specifying @option{-mpowerpc-gpopt} allows
24208 GCC to use the optional PowerPC architecture instructions in the
24209 General Purpose group, including floating-point square root. Specifying
24210 @option{-mpowerpc-gfxopt} allows GCC to
24211 use the optional PowerPC architecture instructions in the Graphics
24212 group, including floating-point select.
24213
24214 The @option{-mmfcrf} option allows GCC to generate the move from
24215 condition register field instruction implemented on the POWER4
24216 processor and other processors that support the PowerPC V2.01
24217 architecture.
24218 The @option{-mpopcntb} option allows GCC to generate the popcount and
24219 double-precision FP reciprocal estimate instruction implemented on the
24220 POWER5 processor and other processors that support the PowerPC V2.02
24221 architecture.
24222 The @option{-mpopcntd} option allows GCC to generate the popcount
24223 instruction implemented on the POWER7 processor and other processors
24224 that support the PowerPC V2.06 architecture.
24225 The @option{-mfprnd} option allows GCC to generate the FP round to
24226 integer instructions implemented on the POWER5+ processor and other
24227 processors that support the PowerPC V2.03 architecture.
24228 The @option{-mcmpb} option allows GCC to generate the compare bytes
24229 instruction implemented on the POWER6 processor and other processors
24230 that support the PowerPC V2.05 architecture.
24231 The @option{-mhard-dfp} option allows GCC to generate the decimal
24232 floating-point instructions implemented on some POWER processors.
24233
24234 The @option{-mpowerpc64} option allows GCC to generate the additional
24235 64-bit instructions that are found in the full PowerPC64 architecture
24236 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24237 @option{-mno-powerpc64}.
24238
24239 @item -mcpu=@var{cpu_type}
24240 @opindex mcpu
24241 Set architecture type, register usage, and
24242 instruction scheduling parameters for machine type @var{cpu_type}.
24243 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24244 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24245 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24246 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24247 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24248 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24249 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24250 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24251 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24252 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24253 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24254 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24255
24256 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24257 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24258 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24259 architecture machine types, with an appropriate, generic processor
24260 model assumed for scheduling purposes.
24261
24262 Specifying @samp{native} as cpu type detects and selects the
24263 architecture option that corresponds to the host processor of the
24264 system performing the compilation.
24265 @option{-mcpu=native} has no effect if GCC does not recognize the
24266 processor.
24267
24268 The other options specify a specific processor. Code generated under
24269 those options runs best on that processor, and may not run at all on
24270 others.
24271
24272 The @option{-mcpu} options automatically enable or disable the
24273 following options:
24274
24275 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24276 -mpopcntb -mpopcntd -mpowerpc64 @gol
24277 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24278 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24279 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24280 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24281
24282 The particular options set for any particular CPU varies between
24283 compiler versions, depending on what setting seems to produce optimal
24284 code for that CPU; it doesn't necessarily reflect the actual hardware's
24285 capabilities. If you wish to set an individual option to a particular
24286 value, you may specify it after the @option{-mcpu} option, like
24287 @option{-mcpu=970 -mno-altivec}.
24288
24289 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24290 not enabled or disabled by the @option{-mcpu} option at present because
24291 AIX does not have full support for these options. You may still
24292 enable or disable them individually if you're sure it'll work in your
24293 environment.
24294
24295 @item -mtune=@var{cpu_type}
24296 @opindex mtune
24297 Set the instruction scheduling parameters for machine type
24298 @var{cpu_type}, but do not set the architecture type or register usage,
24299 as @option{-mcpu=@var{cpu_type}} does. The same
24300 values for @var{cpu_type} are used for @option{-mtune} as for
24301 @option{-mcpu}. If both are specified, the code generated uses the
24302 architecture and registers set by @option{-mcpu}, but the
24303 scheduling parameters set by @option{-mtune}.
24304
24305 @item -mcmodel=small
24306 @opindex mcmodel=small
24307 Generate PowerPC64 code for the small model: The TOC is limited to
24308 64k.
24309
24310 @item -mcmodel=medium
24311 @opindex mcmodel=medium
24312 Generate PowerPC64 code for the medium model: The TOC and other static
24313 data may be up to a total of 4G in size. This is the default for 64-bit
24314 Linux.
24315
24316 @item -mcmodel=large
24317 @opindex mcmodel=large
24318 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24319 in size. Other data and code is only limited by the 64-bit address
24320 space.
24321
24322 @item -maltivec
24323 @itemx -mno-altivec
24324 @opindex maltivec
24325 @opindex mno-altivec
24326 Generate code that uses (does not use) AltiVec instructions, and also
24327 enable the use of built-in functions that allow more direct access to
24328 the AltiVec instruction set. You may also need to set
24329 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24330 enhancements.
24331
24332 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24333 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24334 match array element order corresponding to the endianness of the
24335 target. That is, element zero identifies the leftmost element in a
24336 vector register when targeting a big-endian platform, and identifies
24337 the rightmost element in a vector register when targeting a
24338 little-endian platform.
24339
24340 @item -mvrsave
24341 @itemx -mno-vrsave
24342 @opindex mvrsave
24343 @opindex mno-vrsave
24344 Generate VRSAVE instructions when generating AltiVec code.
24345
24346 @item -msecure-plt
24347 @opindex msecure-plt
24348 Generate code that allows @command{ld} and @command{ld.so}
24349 to build executables and shared
24350 libraries with non-executable @code{.plt} and @code{.got} sections.
24351 This is a PowerPC
24352 32-bit SYSV ABI option.
24353
24354 @item -mbss-plt
24355 @opindex mbss-plt
24356 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24357 fills in, and
24358 requires @code{.plt} and @code{.got}
24359 sections that are both writable and executable.
24360 This is a PowerPC 32-bit SYSV ABI option.
24361
24362 @item -misel
24363 @itemx -mno-isel
24364 @opindex misel
24365 @opindex mno-isel
24366 This switch enables or disables the generation of ISEL instructions.
24367
24368 @item -mvsx
24369 @itemx -mno-vsx
24370 @opindex mvsx
24371 @opindex mno-vsx
24372 Generate code that uses (does not use) vector/scalar (VSX)
24373 instructions, and also enable the use of built-in functions that allow
24374 more direct access to the VSX instruction set.
24375
24376 @item -mcrypto
24377 @itemx -mno-crypto
24378 @opindex mcrypto
24379 @opindex mno-crypto
24380 Enable the use (disable) of the built-in functions that allow direct
24381 access to the cryptographic instructions that were added in version
24382 2.07 of the PowerPC ISA.
24383
24384 @item -mhtm
24385 @itemx -mno-htm
24386 @opindex mhtm
24387 @opindex mno-htm
24388 Enable (disable) the use of the built-in functions that allow direct
24389 access to the Hardware Transactional Memory (HTM) instructions that
24390 were added in version 2.07 of the PowerPC ISA.
24391
24392 @item -mpower8-fusion
24393 @itemx -mno-power8-fusion
24394 @opindex mpower8-fusion
24395 @opindex mno-power8-fusion
24396 Generate code that keeps (does not keeps) some integer operations
24397 adjacent so that the instructions can be fused together on power8 and
24398 later processors.
24399
24400 @item -mpower8-vector
24401 @itemx -mno-power8-vector
24402 @opindex mpower8-vector
24403 @opindex mno-power8-vector
24404 Generate code that uses (does not use) the vector and scalar
24405 instructions that were added in version 2.07 of the PowerPC ISA. Also
24406 enable the use of built-in functions that allow more direct access to
24407 the vector instructions.
24408
24409 @item -mquad-memory
24410 @itemx -mno-quad-memory
24411 @opindex mquad-memory
24412 @opindex mno-quad-memory
24413 Generate code that uses (does not use) the non-atomic quad word memory
24414 instructions. The @option{-mquad-memory} option requires use of
24415 64-bit mode.
24416
24417 @item -mquad-memory-atomic
24418 @itemx -mno-quad-memory-atomic
24419 @opindex mquad-memory-atomic
24420 @opindex mno-quad-memory-atomic
24421 Generate code that uses (does not use) the atomic quad word memory
24422 instructions. The @option{-mquad-memory-atomic} option requires use of
24423 64-bit mode.
24424
24425 @item -mfloat128
24426 @itemx -mno-float128
24427 @opindex mfloat128
24428 @opindex mno-float128
24429 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24430 and use either software emulation for IEEE 128-bit floating point or
24431 hardware instructions.
24432
24433 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24434 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24435 use the IEEE 128-bit floating point support. The IEEE 128-bit
24436 floating point support only works on PowerPC Linux systems.
24437
24438 The default for @option{-mfloat128} is enabled on PowerPC Linux
24439 systems using the VSX instruction set, and disabled on other systems.
24440
24441 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24442 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24443 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24444 floating point instructions. Otherwise, if you do not specify to
24445 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24446 system, IEEE 128-bit floating point will be done with software
24447 emulation.
24448
24449 @item -mfloat128-hardware
24450 @itemx -mno-float128-hardware
24451 @opindex mfloat128-hardware
24452 @opindex mno-float128-hardware
24453 Enable/disable using ISA 3.0 hardware instructions to support the
24454 @var{__float128} data type.
24455
24456 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24457 Linux systems using the ISA 3.0 instruction set, and disabled on other
24458 systems.
24459
24460 @item -m32
24461 @itemx -m64
24462 @opindex m32
24463 @opindex m64
24464 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24465 targets (including GNU/Linux). The 32-bit environment sets int, long
24466 and pointer to 32 bits and generates code that runs on any PowerPC
24467 variant. The 64-bit environment sets int to 32 bits and long and
24468 pointer to 64 bits, and generates code for PowerPC64, as for
24469 @option{-mpowerpc64}.
24470
24471 @item -mfull-toc
24472 @itemx -mno-fp-in-toc
24473 @itemx -mno-sum-in-toc
24474 @itemx -mminimal-toc
24475 @opindex mfull-toc
24476 @opindex mno-fp-in-toc
24477 @opindex mno-sum-in-toc
24478 @opindex mminimal-toc
24479 Modify generation of the TOC (Table Of Contents), which is created for
24480 every executable file. The @option{-mfull-toc} option is selected by
24481 default. In that case, GCC allocates at least one TOC entry for
24482 each unique non-automatic variable reference in your program. GCC
24483 also places floating-point constants in the TOC@. However, only
24484 16,384 entries are available in the TOC@.
24485
24486 If you receive a linker error message that saying you have overflowed
24487 the available TOC space, you can reduce the amount of TOC space used
24488 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24489 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24490 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24491 generate code to calculate the sum of an address and a constant at
24492 run time instead of putting that sum into the TOC@. You may specify one
24493 or both of these options. Each causes GCC to produce very slightly
24494 slower and larger code at the expense of conserving TOC space.
24495
24496 If you still run out of space in the TOC even when you specify both of
24497 these options, specify @option{-mminimal-toc} instead. This option causes
24498 GCC to make only one TOC entry for every file. When you specify this
24499 option, GCC produces code that is slower and larger but which
24500 uses extremely little TOC space. You may wish to use this option
24501 only on files that contain less frequently-executed code.
24502
24503 @item -maix64
24504 @itemx -maix32
24505 @opindex maix64
24506 @opindex maix32
24507 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24508 @code{long} type, and the infrastructure needed to support them.
24509 Specifying @option{-maix64} implies @option{-mpowerpc64},
24510 while @option{-maix32} disables the 64-bit ABI and
24511 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24512
24513 @item -mxl-compat
24514 @itemx -mno-xl-compat
24515 @opindex mxl-compat
24516 @opindex mno-xl-compat
24517 Produce code that conforms more closely to IBM XL compiler semantics
24518 when using AIX-compatible ABI@. Pass floating-point arguments to
24519 prototyped functions beyond the register save area (RSA) on the stack
24520 in addition to argument FPRs. Do not assume that most significant
24521 double in 128-bit long double value is properly rounded when comparing
24522 values and converting to double. Use XL symbol names for long double
24523 support routines.
24524
24525 The AIX calling convention was extended but not initially documented to
24526 handle an obscure K&R C case of calling a function that takes the
24527 address of its arguments with fewer arguments than declared. IBM XL
24528 compilers access floating-point arguments that do not fit in the
24529 RSA from the stack when a subroutine is compiled without
24530 optimization. Because always storing floating-point arguments on the
24531 stack is inefficient and rarely needed, this option is not enabled by
24532 default and only is necessary when calling subroutines compiled by IBM
24533 XL compilers without optimization.
24534
24535 @item -mpe
24536 @opindex mpe
24537 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24538 application written to use message passing with special startup code to
24539 enable the application to run. The system must have PE installed in the
24540 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24541 must be overridden with the @option{-specs=} option to specify the
24542 appropriate directory location. The Parallel Environment does not
24543 support threads, so the @option{-mpe} option and the @option{-pthread}
24544 option are incompatible.
24545
24546 @item -malign-natural
24547 @itemx -malign-power
24548 @opindex malign-natural
24549 @opindex malign-power
24550 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24551 @option{-malign-natural} overrides the ABI-defined alignment of larger
24552 types, such as floating-point doubles, on their natural size-based boundary.
24553 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24554 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24555
24556 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24557 is not supported.
24558
24559 @item -msoft-float
24560 @itemx -mhard-float
24561 @opindex msoft-float
24562 @opindex mhard-float
24563 Generate code that does not use (uses) the floating-point register set.
24564 Software floating-point emulation is provided if you use the
24565 @option{-msoft-float} option, and pass the option to GCC when linking.
24566
24567 @item -mmultiple
24568 @itemx -mno-multiple
24569 @opindex mmultiple
24570 @opindex mno-multiple
24571 Generate code that uses (does not use) the load multiple word
24572 instructions and the store multiple word instructions. These
24573 instructions are generated by default on POWER systems, and not
24574 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24575 PowerPC systems, since those instructions do not work when the
24576 processor is in little-endian mode. The exceptions are PPC740 and
24577 PPC750 which permit these instructions in little-endian mode.
24578
24579 @item -mupdate
24580 @itemx -mno-update
24581 @opindex mupdate
24582 @opindex mno-update
24583 Generate code that uses (does not use) the load or store instructions
24584 that update the base register to the address of the calculated memory
24585 location. These instructions are generated by default. If you use
24586 @option{-mno-update}, there is a small window between the time that the
24587 stack pointer is updated and the address of the previous frame is
24588 stored, which means code that walks the stack frame across interrupts or
24589 signals may get corrupted data.
24590
24591 @item -mavoid-indexed-addresses
24592 @itemx -mno-avoid-indexed-addresses
24593 @opindex mavoid-indexed-addresses
24594 @opindex mno-avoid-indexed-addresses
24595 Generate code that tries to avoid (not avoid) the use of indexed load
24596 or store instructions. These instructions can incur a performance
24597 penalty on Power6 processors in certain situations, such as when
24598 stepping through large arrays that cross a 16M boundary. This option
24599 is enabled by default when targeting Power6 and disabled otherwise.
24600
24601 @item -mfused-madd
24602 @itemx -mno-fused-madd
24603 @opindex mfused-madd
24604 @opindex mno-fused-madd
24605 Generate code that uses (does not use) the floating-point multiply and
24606 accumulate instructions. These instructions are generated by default
24607 if hardware floating point is used. The machine-dependent
24608 @option{-mfused-madd} option is now mapped to the machine-independent
24609 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24610 mapped to @option{-ffp-contract=off}.
24611
24612 @item -mmulhw
24613 @itemx -mno-mulhw
24614 @opindex mmulhw
24615 @opindex mno-mulhw
24616 Generate code that uses (does not use) the half-word multiply and
24617 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24618 These instructions are generated by default when targeting those
24619 processors.
24620
24621 @item -mdlmzb
24622 @itemx -mno-dlmzb
24623 @opindex mdlmzb
24624 @opindex mno-dlmzb
24625 Generate code that uses (does not use) the string-search @samp{dlmzb}
24626 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24627 generated by default when targeting those processors.
24628
24629 @item -mno-bit-align
24630 @itemx -mbit-align
24631 @opindex mno-bit-align
24632 @opindex mbit-align
24633 On System V.4 and embedded PowerPC systems do not (do) force structures
24634 and unions that contain bit-fields to be aligned to the base type of the
24635 bit-field.
24636
24637 For example, by default a structure containing nothing but 8
24638 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24639 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24640 the structure is aligned to a 1-byte boundary and is 1 byte in
24641 size.
24642
24643 @item -mno-strict-align
24644 @itemx -mstrict-align
24645 @opindex mno-strict-align
24646 @opindex mstrict-align
24647 On System V.4 and embedded PowerPC systems do not (do) assume that
24648 unaligned memory references are handled by the system.
24649
24650 @item -mrelocatable
24651 @itemx -mno-relocatable
24652 @opindex mrelocatable
24653 @opindex mno-relocatable
24654 Generate code that allows (does not allow) a static executable to be
24655 relocated to a different address at run time. A simple embedded
24656 PowerPC system loader should relocate the entire contents of
24657 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24658 a table of 32-bit addresses generated by this option. For this to
24659 work, all objects linked together must be compiled with
24660 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24661 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24662
24663 @item -mrelocatable-lib
24664 @itemx -mno-relocatable-lib
24665 @opindex mrelocatable-lib
24666 @opindex mno-relocatable-lib
24667 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24668 @code{.fixup} section to allow static executables to be relocated at
24669 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24670 alignment of @option{-mrelocatable}. Objects compiled with
24671 @option{-mrelocatable-lib} may be linked with objects compiled with
24672 any combination of the @option{-mrelocatable} options.
24673
24674 @item -mno-toc
24675 @itemx -mtoc
24676 @opindex mno-toc
24677 @opindex mtoc
24678 On System V.4 and embedded PowerPC systems do not (do) assume that
24679 register 2 contains a pointer to a global area pointing to the addresses
24680 used in the program.
24681
24682 @item -mlittle
24683 @itemx -mlittle-endian
24684 @opindex mlittle
24685 @opindex mlittle-endian
24686 On System V.4 and embedded PowerPC systems compile code for the
24687 processor in little-endian mode. The @option{-mlittle-endian} option is
24688 the same as @option{-mlittle}.
24689
24690 @item -mbig
24691 @itemx -mbig-endian
24692 @opindex mbig
24693 @opindex mbig-endian
24694 On System V.4 and embedded PowerPC systems compile code for the
24695 processor in big-endian mode. The @option{-mbig-endian} option is
24696 the same as @option{-mbig}.
24697
24698 @item -mdynamic-no-pic
24699 @opindex mdynamic-no-pic
24700 On Darwin and Mac OS X systems, compile code so that it is not
24701 relocatable, but that its external references are relocatable. The
24702 resulting code is suitable for applications, but not shared
24703 libraries.
24704
24705 @item -msingle-pic-base
24706 @opindex msingle-pic-base
24707 Treat the register used for PIC addressing as read-only, rather than
24708 loading it in the prologue for each function. The runtime system is
24709 responsible for initializing this register with an appropriate value
24710 before execution begins.
24711
24712 @item -mprioritize-restricted-insns=@var{priority}
24713 @opindex mprioritize-restricted-insns
24714 This option controls the priority that is assigned to
24715 dispatch-slot restricted instructions during the second scheduling
24716 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24717 or @samp{2} to assign no, highest, or second-highest (respectively)
24718 priority to dispatch-slot restricted
24719 instructions.
24720
24721 @item -msched-costly-dep=@var{dependence_type}
24722 @opindex msched-costly-dep
24723 This option controls which dependences are considered costly
24724 by the target during instruction scheduling. The argument
24725 @var{dependence_type} takes one of the following values:
24726
24727 @table @asis
24728 @item @samp{no}
24729 No dependence is costly.
24730
24731 @item @samp{all}
24732 All dependences are costly.
24733
24734 @item @samp{true_store_to_load}
24735 A true dependence from store to load is costly.
24736
24737 @item @samp{store_to_load}
24738 Any dependence from store to load is costly.
24739
24740 @item @var{number}
24741 Any dependence for which the latency is greater than or equal to
24742 @var{number} is costly.
24743 @end table
24744
24745 @item -minsert-sched-nops=@var{scheme}
24746 @opindex minsert-sched-nops
24747 This option controls which NOP insertion scheme is used during
24748 the second scheduling pass. The argument @var{scheme} takes one of the
24749 following values:
24750
24751 @table @asis
24752 @item @samp{no}
24753 Don't insert NOPs.
24754
24755 @item @samp{pad}
24756 Pad with NOPs any dispatch group that has vacant issue slots,
24757 according to the scheduler's grouping.
24758
24759 @item @samp{regroup_exact}
24760 Insert NOPs to force costly dependent insns into
24761 separate groups. Insert exactly as many NOPs as needed to force an insn
24762 to a new group, according to the estimated processor grouping.
24763
24764 @item @var{number}
24765 Insert NOPs to force costly dependent insns into
24766 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24767 @end table
24768
24769 @item -mcall-sysv
24770 @opindex mcall-sysv
24771 On System V.4 and embedded PowerPC systems compile code using calling
24772 conventions that adhere to the March 1995 draft of the System V
24773 Application Binary Interface, PowerPC processor supplement. This is the
24774 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24775
24776 @item -mcall-sysv-eabi
24777 @itemx -mcall-eabi
24778 @opindex mcall-sysv-eabi
24779 @opindex mcall-eabi
24780 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24781
24782 @item -mcall-sysv-noeabi
24783 @opindex mcall-sysv-noeabi
24784 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24785
24786 @item -mcall-aixdesc
24787 @opindex m
24788 On System V.4 and embedded PowerPC systems compile code for the AIX
24789 operating system.
24790
24791 @item -mcall-linux
24792 @opindex mcall-linux
24793 On System V.4 and embedded PowerPC systems compile code for the
24794 Linux-based GNU system.
24795
24796 @item -mcall-freebsd
24797 @opindex mcall-freebsd
24798 On System V.4 and embedded PowerPC systems compile code for the
24799 FreeBSD operating system.
24800
24801 @item -mcall-netbsd
24802 @opindex mcall-netbsd
24803 On System V.4 and embedded PowerPC systems compile code for the
24804 NetBSD operating system.
24805
24806 @item -mcall-openbsd
24807 @opindex mcall-netbsd
24808 On System V.4 and embedded PowerPC systems compile code for the
24809 OpenBSD operating system.
24810
24811 @item -mtraceback=@var{traceback_type}
24812 @opindex mtraceback
24813 Select the type of traceback table. Valid values for @var{traceback_type}
24814 are @samp{full}, @samp{part}, and @samp{no}.
24815
24816 @item -maix-struct-return
24817 @opindex maix-struct-return
24818 Return all structures in memory (as specified by the AIX ABI)@.
24819
24820 @item -msvr4-struct-return
24821 @opindex msvr4-struct-return
24822 Return structures smaller than 8 bytes in registers (as specified by the
24823 SVR4 ABI)@.
24824
24825 @item -mabi=@var{abi-type}
24826 @opindex mabi
24827 Extend the current ABI with a particular extension, or remove such extension.
24828 Valid values are @samp{altivec}, @samp{no-altivec},
24829 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24830 @samp{elfv1}, @samp{elfv2}@.
24831
24832 @item -mabi=ibmlongdouble
24833 @opindex mabi=ibmlongdouble
24834 Change the current ABI to use IBM extended-precision long double.
24835 This is not likely to work if your system defaults to using IEEE
24836 extended-precision long double. If you change the long double type
24837 from IEEE extended-precision, the compiler will issue a warning unless
24838 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24839 to be enabled.
24840
24841 @item -mabi=ieeelongdouble
24842 @opindex mabi=ieeelongdouble
24843 Change the current ABI to use IEEE extended-precision long double.
24844 This is not likely to work if your system defaults to using IBM
24845 extended-precision long double. If you change the long double type
24846 from IBM extended-precision, the compiler will issue a warning unless
24847 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24848 to be enabled.
24849
24850 @item -mabi=elfv1
24851 @opindex mabi=elfv1
24852 Change the current ABI to use the ELFv1 ABI.
24853 This is the default ABI for big-endian PowerPC 64-bit Linux.
24854 Overriding the default ABI requires special system support and is
24855 likely to fail in spectacular ways.
24856
24857 @item -mabi=elfv2
24858 @opindex mabi=elfv2
24859 Change the current ABI to use the ELFv2 ABI.
24860 This is the default ABI for little-endian PowerPC 64-bit Linux.
24861 Overriding the default ABI requires special system support and is
24862 likely to fail in spectacular ways.
24863
24864 @item -mgnu-attribute
24865 @itemx -mno-gnu-attribute
24866 @opindex mgnu-attribute
24867 @opindex mno-gnu-attribute
24868 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24869 .gnu.attributes section that specify ABI variations in function
24870 parameters or return values.
24871
24872 @item -mprototype
24873 @itemx -mno-prototype
24874 @opindex mprototype
24875 @opindex mno-prototype
24876 On System V.4 and embedded PowerPC systems assume that all calls to
24877 variable argument functions are properly prototyped. Otherwise, the
24878 compiler must insert an instruction before every non-prototyped call to
24879 set or clear bit 6 of the condition code register (@code{CR}) to
24880 indicate whether floating-point values are passed in the floating-point
24881 registers in case the function takes variable arguments. With
24882 @option{-mprototype}, only calls to prototyped variable argument functions
24883 set or clear the bit.
24884
24885 @item -msim
24886 @opindex msim
24887 On embedded PowerPC systems, assume that the startup module is called
24888 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24889 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24890 configurations.
24891
24892 @item -mmvme
24893 @opindex mmvme
24894 On embedded PowerPC systems, assume that the startup module is called
24895 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24896 @file{libc.a}.
24897
24898 @item -mads
24899 @opindex mads
24900 On embedded PowerPC systems, assume that the startup module is called
24901 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24902 @file{libc.a}.
24903
24904 @item -myellowknife
24905 @opindex myellowknife
24906 On embedded PowerPC systems, assume that the startup module is called
24907 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24908 @file{libc.a}.
24909
24910 @item -mvxworks
24911 @opindex mvxworks
24912 On System V.4 and embedded PowerPC systems, specify that you are
24913 compiling for a VxWorks system.
24914
24915 @item -memb
24916 @opindex memb
24917 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24918 header to indicate that @samp{eabi} extended relocations are used.
24919
24920 @item -meabi
24921 @itemx -mno-eabi
24922 @opindex meabi
24923 @opindex mno-eabi
24924 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24925 Embedded Applications Binary Interface (EABI), which is a set of
24926 modifications to the System V.4 specifications. Selecting @option{-meabi}
24927 means that the stack is aligned to an 8-byte boundary, a function
24928 @code{__eabi} is called from @code{main} to set up the EABI
24929 environment, and the @option{-msdata} option can use both @code{r2} and
24930 @code{r13} to point to two separate small data areas. Selecting
24931 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24932 no EABI initialization function is called from @code{main}, and the
24933 @option{-msdata} option only uses @code{r13} to point to a single
24934 small data area. The @option{-meabi} option is on by default if you
24935 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24936
24937 @item -msdata=eabi
24938 @opindex msdata=eabi
24939 On System V.4 and embedded PowerPC systems, put small initialized
24940 @code{const} global and static data in the @code{.sdata2} section, which
24941 is pointed to by register @code{r2}. Put small initialized
24942 non-@code{const} global and static data in the @code{.sdata} section,
24943 which is pointed to by register @code{r13}. Put small uninitialized
24944 global and static data in the @code{.sbss} section, which is adjacent to
24945 the @code{.sdata} section. The @option{-msdata=eabi} option is
24946 incompatible with the @option{-mrelocatable} option. The
24947 @option{-msdata=eabi} option also sets the @option{-memb} option.
24948
24949 @item -msdata=sysv
24950 @opindex msdata=sysv
24951 On System V.4 and embedded PowerPC systems, put small global and static
24952 data in the @code{.sdata} section, which is pointed to by register
24953 @code{r13}. Put small uninitialized global and static data in the
24954 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24955 The @option{-msdata=sysv} option is incompatible with the
24956 @option{-mrelocatable} option.
24957
24958 @item -msdata=default
24959 @itemx -msdata
24960 @opindex msdata=default
24961 @opindex msdata
24962 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24963 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24964 same as @option{-msdata=sysv}.
24965
24966 @item -msdata=data
24967 @opindex msdata=data
24968 On System V.4 and embedded PowerPC systems, put small global
24969 data in the @code{.sdata} section. Put small uninitialized global
24970 data in the @code{.sbss} section. Do not use register @code{r13}
24971 to address small data however. This is the default behavior unless
24972 other @option{-msdata} options are used.
24973
24974 @item -msdata=none
24975 @itemx -mno-sdata
24976 @opindex msdata=none
24977 @opindex mno-sdata
24978 On embedded PowerPC systems, put all initialized global and static data
24979 in the @code{.data} section, and all uninitialized data in the
24980 @code{.bss} section.
24981
24982 @item -mreadonly-in-sdata
24983 @opindex mreadonly-in-sdata
24984 @opindex mno-readonly-in-sdata
24985 Put read-only objects in the @code{.sdata} section as well. This is the
24986 default.
24987
24988 @item -mblock-move-inline-limit=@var{num}
24989 @opindex mblock-move-inline-limit
24990 Inline all block moves (such as calls to @code{memcpy} or structure
24991 copies) less than or equal to @var{num} bytes. The minimum value for
24992 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24993 targets. The default value is target-specific.
24994
24995 @item -mblock-compare-inline-limit=@var{num}
24996 @opindex mblock-compare-inline-limit
24997 Generate non-looping inline code for all block compares (such as calls
24998 to @code{memcmp} or structure compares) less than or equal to @var{num}
24999 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25000 block compare is disabled. The default value is target-specific.
25001
25002 @item -mblock-compare-inline-loop-limit=@var{num}
25003 @opindex mblock-compare-inline-loop-limit
25004 Generate an inline expansion using loop code for all block compares that
25005 are less than or equal to @var{num} bytes, but greater than the limit
25006 for non-loop inline block compare expansion. If the block length is not
25007 constant, at most @var{num} bytes will be compared before @code{memcmp}
25008 is called to compare the remainder of the block. The default value is
25009 target-specific.
25010
25011 @item -mstring-compare-inline-limit=@var{num}
25012 @opindex mstring-compare-inline-limit
25013 Compare at most @var{num} string bytes with inline code.
25014 If the difference or end of string is not found at the
25015 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25016 take care of the rest of the comparison. The default is 64 bytes.
25017
25018 @item -G @var{num}
25019 @opindex G
25020 @cindex smaller data references (PowerPC)
25021 @cindex .sdata/.sdata2 references (PowerPC)
25022 On embedded PowerPC systems, put global and static items less than or
25023 equal to @var{num} bytes into the small data or BSS sections instead of
25024 the normal data or BSS section. By default, @var{num} is 8. The
25025 @option{-G @var{num}} switch is also passed to the linker.
25026 All modules should be compiled with the same @option{-G @var{num}} value.
25027
25028 @item -mregnames
25029 @itemx -mno-regnames
25030 @opindex mregnames
25031 @opindex mno-regnames
25032 On System V.4 and embedded PowerPC systems do (do not) emit register
25033 names in the assembly language output using symbolic forms.
25034
25035 @item -mlongcall
25036 @itemx -mno-longcall
25037 @opindex mlongcall
25038 @opindex mno-longcall
25039 By default assume that all calls are far away so that a longer and more
25040 expensive calling sequence is required. This is required for calls
25041 farther than 32 megabytes (33,554,432 bytes) from the current location.
25042 A short call is generated if the compiler knows
25043 the call cannot be that far away. This setting can be overridden by
25044 the @code{shortcall} function attribute, or by @code{#pragma
25045 longcall(0)}.
25046
25047 Some linkers are capable of detecting out-of-range calls and generating
25048 glue code on the fly. On these systems, long calls are unnecessary and
25049 generate slower code. As of this writing, the AIX linker can do this,
25050 as can the GNU linker for PowerPC/64. It is planned to add this feature
25051 to the GNU linker for 32-bit PowerPC systems as well.
25052
25053 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
25054 GCC can generate long calls using an inline PLT call sequence (see
25055 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
25056 ELFv1 (big-endian) do not support inline PLT calls.
25057
25058 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25059 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25060 addresses represent the callee and the branch island. The
25061 Darwin/PPC linker prefers the first address and generates a @code{bl
25062 callee} if the PPC @code{bl} instruction reaches the callee directly;
25063 otherwise, the linker generates @code{bl L42} to call the branch
25064 island. The branch island is appended to the body of the
25065 calling function; it computes the full 32-bit address of the callee
25066 and jumps to it.
25067
25068 On Mach-O (Darwin) systems, this option directs the compiler emit to
25069 the glue for every direct call, and the Darwin linker decides whether
25070 to use or discard it.
25071
25072 In the future, GCC may ignore all longcall specifications
25073 when the linker is known to generate glue.
25074
25075 @item -mpltseq
25076 @itemx -mno-pltseq
25077 @opindex mpltseq
25078 @opindex mno-pltseq
25079 Implement (do not implement) -fno-plt and long calls using an inline
25080 PLT call sequence that supports lazy linking and long calls to
25081 functions in dlopen'd shared libraries. Inline PLT calls are only
25082 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25083 linkers, and are enabled by default if the support is detected when
25084 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25085 configured with @option{--enable-secureplt}. @option{-mpltseq} code
25086 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25087 linked together.
25088
25089 @item -mtls-markers
25090 @itemx -mno-tls-markers
25091 @opindex mtls-markers
25092 @opindex mno-tls-markers
25093 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25094 specifying the function argument. The relocation allows the linker to
25095 reliably associate function call with argument setup instructions for
25096 TLS optimization, which in turn allows GCC to better schedule the
25097 sequence.
25098
25099 @item -mrecip
25100 @itemx -mno-recip
25101 @opindex mrecip
25102 This option enables use of the reciprocal estimate and
25103 reciprocal square root estimate instructions with additional
25104 Newton-Raphson steps to increase precision instead of doing a divide or
25105 square root and divide for floating-point arguments. You should use
25106 the @option{-ffast-math} option when using @option{-mrecip} (or at
25107 least @option{-funsafe-math-optimizations},
25108 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25109 @option{-fno-trapping-math}). Note that while the throughput of the
25110 sequence is generally higher than the throughput of the non-reciprocal
25111 instruction, the precision of the sequence can be decreased by up to 2
25112 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25113 roots.
25114
25115 @item -mrecip=@var{opt}
25116 @opindex mrecip=opt
25117 This option controls which reciprocal estimate instructions
25118 may be used. @var{opt} is a comma-separated list of options, which may
25119 be preceded by a @code{!} to invert the option:
25120
25121 @table @samp
25122
25123 @item all
25124 Enable all estimate instructions.
25125
25126 @item default
25127 Enable the default instructions, equivalent to @option{-mrecip}.
25128
25129 @item none
25130 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25131
25132 @item div
25133 Enable the reciprocal approximation instructions for both
25134 single and double precision.
25135
25136 @item divf
25137 Enable the single-precision reciprocal approximation instructions.
25138
25139 @item divd
25140 Enable the double-precision reciprocal approximation instructions.
25141
25142 @item rsqrt
25143 Enable the reciprocal square root approximation instructions for both
25144 single and double precision.
25145
25146 @item rsqrtf
25147 Enable the single-precision reciprocal square root approximation instructions.
25148
25149 @item rsqrtd
25150 Enable the double-precision reciprocal square root approximation instructions.
25151
25152 @end table
25153
25154 So, for example, @option{-mrecip=all,!rsqrtd} enables
25155 all of the reciprocal estimate instructions, except for the
25156 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25157 which handle the double-precision reciprocal square root calculations.
25158
25159 @item -mrecip-precision
25160 @itemx -mno-recip-precision
25161 @opindex mrecip-precision
25162 Assume (do not assume) that the reciprocal estimate instructions
25163 provide higher-precision estimates than is mandated by the PowerPC
25164 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25165 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25166 The double-precision square root estimate instructions are not generated by
25167 default on low-precision machines, since they do not provide an
25168 estimate that converges after three steps.
25169
25170 @item -mveclibabi=@var{type}
25171 @opindex mveclibabi
25172 Specifies the ABI type to use for vectorizing intrinsics using an
25173 external library. The only type supported at present is @samp{mass},
25174 which specifies to use IBM's Mathematical Acceleration Subsystem
25175 (MASS) libraries for vectorizing intrinsics using external libraries.
25176 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25177 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25178 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25179 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25180 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25181 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25182 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25183 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25184 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25185 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25186 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25187 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25188 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25189 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25190 for power7. Both @option{-ftree-vectorize} and
25191 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25192 libraries must be specified at link time.
25193
25194 @item -mfriz
25195 @itemx -mno-friz
25196 @opindex mfriz
25197 Generate (do not generate) the @code{friz} instruction when the
25198 @option{-funsafe-math-optimizations} option is used to optimize
25199 rounding of floating-point values to 64-bit integer and back to floating
25200 point. The @code{friz} instruction does not return the same value if
25201 the floating-point number is too large to fit in an integer.
25202
25203 @item -mpointers-to-nested-functions
25204 @itemx -mno-pointers-to-nested-functions
25205 @opindex mpointers-to-nested-functions
25206 Generate (do not generate) code to load up the static chain register
25207 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25208 systems where a function pointer points to a 3-word descriptor giving
25209 the function address, TOC value to be loaded in register @code{r2}, and
25210 static chain value to be loaded in register @code{r11}. The
25211 @option{-mpointers-to-nested-functions} is on by default. You cannot
25212 call through pointers to nested functions or pointers
25213 to functions compiled in other languages that use the static chain if
25214 you use @option{-mno-pointers-to-nested-functions}.
25215
25216 @item -msave-toc-indirect
25217 @itemx -mno-save-toc-indirect
25218 @opindex msave-toc-indirect
25219 Generate (do not generate) code to save the TOC value in the reserved
25220 stack location in the function prologue if the function calls through
25221 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25222 saved in the prologue, it is saved just before the call through the
25223 pointer. The @option{-mno-save-toc-indirect} option is the default.
25224
25225 @item -mcompat-align-parm
25226 @itemx -mno-compat-align-parm
25227 @opindex mcompat-align-parm
25228 Generate (do not generate) code to pass structure parameters with a
25229 maximum alignment of 64 bits, for compatibility with older versions
25230 of GCC.
25231
25232 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25233 structure parameter on a 128-bit boundary when that structure contained
25234 a member requiring 128-bit alignment. This is corrected in more
25235 recent versions of GCC. This option may be used to generate code
25236 that is compatible with functions compiled with older versions of
25237 GCC.
25238
25239 The @option{-mno-compat-align-parm} option is the default.
25240
25241 @item -mstack-protector-guard=@var{guard}
25242 @itemx -mstack-protector-guard-reg=@var{reg}
25243 @itemx -mstack-protector-guard-offset=@var{offset}
25244 @itemx -mstack-protector-guard-symbol=@var{symbol}
25245 @opindex mstack-protector-guard
25246 @opindex mstack-protector-guard-reg
25247 @opindex mstack-protector-guard-offset
25248 @opindex mstack-protector-guard-symbol
25249 Generate stack protection code using canary at @var{guard}. Supported
25250 locations are @samp{global} for global canary or @samp{tls} for per-thread
25251 canary in the TLS block (the default with GNU libc version 2.4 or later).
25252
25253 With the latter choice the options
25254 @option{-mstack-protector-guard-reg=@var{reg}} and
25255 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25256 which register to use as base register for reading the canary, and from what
25257 offset from that base register. The default for those is as specified in the
25258 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25259 the offset with a symbol reference to a canary in the TLS block.
25260
25261 @item -mpcrel
25262 @itemx -mno-pcrel
25263 @opindex mpcrel
25264 @opindex mno-pcrel
25265 Generate (do not generate) pc-relative addressing when the option
25266 @option{-mcpu=future} is used.
25267 @end table
25268
25269 @node RX Options
25270 @subsection RX Options
25271 @cindex RX Options
25272
25273 These command-line options are defined for RX targets:
25274
25275 @table @gcctabopt
25276 @item -m64bit-doubles
25277 @itemx -m32bit-doubles
25278 @opindex m64bit-doubles
25279 @opindex m32bit-doubles
25280 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25281 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25282 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25283 works on 32-bit values, which is why the default is
25284 @option{-m32bit-doubles}.
25285
25286 @item -fpu
25287 @itemx -nofpu
25288 @opindex fpu
25289 @opindex nofpu
25290 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25291 floating-point hardware. The default is enabled for the RX600
25292 series and disabled for the RX200 series.
25293
25294 Floating-point instructions are only generated for 32-bit floating-point
25295 values, however, so the FPU hardware is not used for doubles if the
25296 @option{-m64bit-doubles} option is used.
25297
25298 @emph{Note} If the @option{-fpu} option is enabled then
25299 @option{-funsafe-math-optimizations} is also enabled automatically.
25300 This is because the RX FPU instructions are themselves unsafe.
25301
25302 @item -mcpu=@var{name}
25303 @opindex mcpu
25304 Selects the type of RX CPU to be targeted. Currently three types are
25305 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25306 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25307
25308 The only difference between @samp{RX600} and @samp{RX610} is that the
25309 @samp{RX610} does not support the @code{MVTIPL} instruction.
25310
25311 The @samp{RX200} series does not have a hardware floating-point unit
25312 and so @option{-nofpu} is enabled by default when this type is
25313 selected.
25314
25315 @item -mbig-endian-data
25316 @itemx -mlittle-endian-data
25317 @opindex mbig-endian-data
25318 @opindex mlittle-endian-data
25319 Store data (but not code) in the big-endian format. The default is
25320 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25321 format.
25322
25323 @item -msmall-data-limit=@var{N}
25324 @opindex msmall-data-limit
25325 Specifies the maximum size in bytes of global and static variables
25326 which can be placed into the small data area. Using the small data
25327 area can lead to smaller and faster code, but the size of area is
25328 limited and it is up to the programmer to ensure that the area does
25329 not overflow. Also when the small data area is used one of the RX's
25330 registers (usually @code{r13}) is reserved for use pointing to this
25331 area, so it is no longer available for use by the compiler. This
25332 could result in slower and/or larger code if variables are pushed onto
25333 the stack instead of being held in this register.
25334
25335 Note, common variables (variables that have not been initialized) and
25336 constants are not placed into the small data area as they are assigned
25337 to other sections in the output executable.
25338
25339 The default value is zero, which disables this feature. Note, this
25340 feature is not enabled by default with higher optimization levels
25341 (@option{-O2} etc) because of the potentially detrimental effects of
25342 reserving a register. It is up to the programmer to experiment and
25343 discover whether this feature is of benefit to their program. See the
25344 description of the @option{-mpid} option for a description of how the
25345 actual register to hold the small data area pointer is chosen.
25346
25347 @item -msim
25348 @itemx -mno-sim
25349 @opindex msim
25350 @opindex mno-sim
25351 Use the simulator runtime. The default is to use the libgloss
25352 board-specific runtime.
25353
25354 @item -mas100-syntax
25355 @itemx -mno-as100-syntax
25356 @opindex mas100-syntax
25357 @opindex mno-as100-syntax
25358 When generating assembler output use a syntax that is compatible with
25359 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25360 assembler, but it has some restrictions so it is not generated by default.
25361
25362 @item -mmax-constant-size=@var{N}
25363 @opindex mmax-constant-size
25364 Specifies the maximum size, in bytes, of a constant that can be used as
25365 an operand in a RX instruction. Although the RX instruction set does
25366 allow constants of up to 4 bytes in length to be used in instructions,
25367 a longer value equates to a longer instruction. Thus in some
25368 circumstances it can be beneficial to restrict the size of constants
25369 that are used in instructions. Constants that are too big are instead
25370 placed into a constant pool and referenced via register indirection.
25371
25372 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25373 or 4 means that constants of any size are allowed.
25374
25375 @item -mrelax
25376 @opindex mrelax
25377 Enable linker relaxation. Linker relaxation is a process whereby the
25378 linker attempts to reduce the size of a program by finding shorter
25379 versions of various instructions. Disabled by default.
25380
25381 @item -mint-register=@var{N}
25382 @opindex mint-register
25383 Specify the number of registers to reserve for fast interrupt handler
25384 functions. The value @var{N} can be between 0 and 4. A value of 1
25385 means that register @code{r13} is reserved for the exclusive use
25386 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25387 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25388 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25389 A value of 0, the default, does not reserve any registers.
25390
25391 @item -msave-acc-in-interrupts
25392 @opindex msave-acc-in-interrupts
25393 Specifies that interrupt handler functions should preserve the
25394 accumulator register. This is only necessary if normal code might use
25395 the accumulator register, for example because it performs 64-bit
25396 multiplications. The default is to ignore the accumulator as this
25397 makes the interrupt handlers faster.
25398
25399 @item -mpid
25400 @itemx -mno-pid
25401 @opindex mpid
25402 @opindex mno-pid
25403 Enables the generation of position independent data. When enabled any
25404 access to constant data is done via an offset from a base address
25405 held in a register. This allows the location of constant data to be
25406 determined at run time without requiring the executable to be
25407 relocated, which is a benefit to embedded applications with tight
25408 memory constraints. Data that can be modified is not affected by this
25409 option.
25410
25411 Note, using this feature reserves a register, usually @code{r13}, for
25412 the constant data base address. This can result in slower and/or
25413 larger code, especially in complicated functions.
25414
25415 The actual register chosen to hold the constant data base address
25416 depends upon whether the @option{-msmall-data-limit} and/or the
25417 @option{-mint-register} command-line options are enabled. Starting
25418 with register @code{r13} and proceeding downwards, registers are
25419 allocated first to satisfy the requirements of @option{-mint-register},
25420 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25421 is possible for the small data area register to be @code{r8} if both
25422 @option{-mint-register=4} and @option{-mpid} are specified on the
25423 command line.
25424
25425 By default this feature is not enabled. The default can be restored
25426 via the @option{-mno-pid} command-line option.
25427
25428 @item -mno-warn-multiple-fast-interrupts
25429 @itemx -mwarn-multiple-fast-interrupts
25430 @opindex mno-warn-multiple-fast-interrupts
25431 @opindex mwarn-multiple-fast-interrupts
25432 Prevents GCC from issuing a warning message if it finds more than one
25433 fast interrupt handler when it is compiling a file. The default is to
25434 issue a warning for each extra fast interrupt handler found, as the RX
25435 only supports one such interrupt.
25436
25437 @item -mallow-string-insns
25438 @itemx -mno-allow-string-insns
25439 @opindex mallow-string-insns
25440 @opindex mno-allow-string-insns
25441 Enables or disables the use of the string manipulation instructions
25442 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25443 @code{SWHILE} and also the @code{RMPA} instruction. These
25444 instructions may prefetch data, which is not safe to do if accessing
25445 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25446 for more information).
25447
25448 The default is to allow these instructions, but it is not possible for
25449 GCC to reliably detect all circumstances where a string instruction
25450 might be used to access an I/O register, so their use cannot be
25451 disabled automatically. Instead it is reliant upon the programmer to
25452 use the @option{-mno-allow-string-insns} option if their program
25453 accesses I/O space.
25454
25455 When the instructions are enabled GCC defines the C preprocessor
25456 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25457 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25458
25459 @item -mjsr
25460 @itemx -mno-jsr
25461 @opindex mjsr
25462 @opindex mno-jsr
25463 Use only (or not only) @code{JSR} instructions to access functions.
25464 This option can be used when code size exceeds the range of @code{BSR}
25465 instructions. Note that @option{-mno-jsr} does not mean to not use
25466 @code{JSR} but instead means that any type of branch may be used.
25467 @end table
25468
25469 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25470 has special significance to the RX port when used with the
25471 @code{interrupt} function attribute. This attribute indicates a
25472 function intended to process fast interrupts. GCC ensures
25473 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25474 and/or @code{r13} and only provided that the normal use of the
25475 corresponding registers have been restricted via the
25476 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25477 options.
25478
25479 @node S/390 and zSeries Options
25480 @subsection S/390 and zSeries Options
25481 @cindex S/390 and zSeries Options
25482
25483 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25484
25485 @table @gcctabopt
25486 @item -mhard-float
25487 @itemx -msoft-float
25488 @opindex mhard-float
25489 @opindex msoft-float
25490 Use (do not use) the hardware floating-point instructions and registers
25491 for floating-point operations. When @option{-msoft-float} is specified,
25492 functions in @file{libgcc.a} are used to perform floating-point
25493 operations. When @option{-mhard-float} is specified, the compiler
25494 generates IEEE floating-point instructions. This is the default.
25495
25496 @item -mhard-dfp
25497 @itemx -mno-hard-dfp
25498 @opindex mhard-dfp
25499 @opindex mno-hard-dfp
25500 Use (do not use) the hardware decimal-floating-point instructions for
25501 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25502 specified, functions in @file{libgcc.a} are used to perform
25503 decimal-floating-point operations. When @option{-mhard-dfp} is
25504 specified, the compiler generates decimal-floating-point hardware
25505 instructions. This is the default for @option{-march=z9-ec} or higher.
25506
25507 @item -mlong-double-64
25508 @itemx -mlong-double-128
25509 @opindex mlong-double-64
25510 @opindex mlong-double-128
25511 These switches control the size of @code{long double} type. A size
25512 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25513 type. This is the default.
25514
25515 @item -mbackchain
25516 @itemx -mno-backchain
25517 @opindex mbackchain
25518 @opindex mno-backchain
25519 Store (do not store) the address of the caller's frame as backchain pointer
25520 into the callee's stack frame.
25521 A backchain may be needed to allow debugging using tools that do not understand
25522 DWARF call frame information.
25523 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25524 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25525 the backchain is placed into the topmost word of the 96/160 byte register
25526 save area.
25527
25528 In general, code compiled with @option{-mbackchain} is call-compatible with
25529 code compiled with @option{-mmo-backchain}; however, use of the backchain
25530 for debugging purposes usually requires that the whole binary is built with
25531 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25532 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25533 to build a linux kernel use @option{-msoft-float}.
25534
25535 The default is to not maintain the backchain.
25536
25537 @item -mpacked-stack
25538 @itemx -mno-packed-stack
25539 @opindex mpacked-stack
25540 @opindex mno-packed-stack
25541 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25542 specified, the compiler uses the all fields of the 96/160 byte register save
25543 area only for their default purpose; unused fields still take up stack space.
25544 When @option{-mpacked-stack} is specified, register save slots are densely
25545 packed at the top of the register save area; unused space is reused for other
25546 purposes, allowing for more efficient use of the available stack space.
25547 However, when @option{-mbackchain} is also in effect, the topmost word of
25548 the save area is always used to store the backchain, and the return address
25549 register is always saved two words below the backchain.
25550
25551 As long as the stack frame backchain is not used, code generated with
25552 @option{-mpacked-stack} is call-compatible with code generated with
25553 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25554 S/390 or zSeries generated code that uses the stack frame backchain at run
25555 time, not just for debugging purposes. Such code is not call-compatible
25556 with code compiled with @option{-mpacked-stack}. Also, note that the
25557 combination of @option{-mbackchain},
25558 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25559 to build a linux kernel use @option{-msoft-float}.
25560
25561 The default is to not use the packed stack layout.
25562
25563 @item -msmall-exec
25564 @itemx -mno-small-exec
25565 @opindex msmall-exec
25566 @opindex mno-small-exec
25567 Generate (or do not generate) code using the @code{bras} instruction
25568 to do subroutine calls.
25569 This only works reliably if the total executable size does not
25570 exceed 64k. The default is to use the @code{basr} instruction instead,
25571 which does not have this limitation.
25572
25573 @item -m64
25574 @itemx -m31
25575 @opindex m64
25576 @opindex m31
25577 When @option{-m31} is specified, generate code compliant to the
25578 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25579 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25580 particular to generate 64-bit instructions. For the @samp{s390}
25581 targets, the default is @option{-m31}, while the @samp{s390x}
25582 targets default to @option{-m64}.
25583
25584 @item -mzarch
25585 @itemx -mesa
25586 @opindex mzarch
25587 @opindex mesa
25588 When @option{-mzarch} is specified, generate code using the
25589 instructions available on z/Architecture.
25590 When @option{-mesa} is specified, generate code using the
25591 instructions available on ESA/390. Note that @option{-mesa} is
25592 not possible with @option{-m64}.
25593 When generating code compliant to the GNU/Linux for S/390 ABI,
25594 the default is @option{-mesa}. When generating code compliant
25595 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25596
25597 @item -mhtm
25598 @itemx -mno-htm
25599 @opindex mhtm
25600 @opindex mno-htm
25601 The @option{-mhtm} option enables a set of builtins making use of
25602 instructions available with the transactional execution facility
25603 introduced with the IBM zEnterprise EC12 machine generation
25604 @ref{S/390 System z Built-in Functions}.
25605 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25606
25607 @item -mvx
25608 @itemx -mno-vx
25609 @opindex mvx
25610 @opindex mno-vx
25611 When @option{-mvx} is specified, generate code using the instructions
25612 available with the vector extension facility introduced with the IBM
25613 z13 machine generation.
25614 This option changes the ABI for some vector type values with regard to
25615 alignment and calling conventions. In case vector type values are
25616 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25617 command will be added to mark the resulting binary with the ABI used.
25618 @option{-mvx} is enabled by default when using @option{-march=z13}.
25619
25620 @item -mzvector
25621 @itemx -mno-zvector
25622 @opindex mzvector
25623 @opindex mno-zvector
25624 The @option{-mzvector} option enables vector language extensions and
25625 builtins using instructions available with the vector extension
25626 facility introduced with the IBM z13 machine generation.
25627 This option adds support for @samp{vector} to be used as a keyword to
25628 define vector type variables and arguments. @samp{vector} is only
25629 available when GNU extensions are enabled. It will not be expanded
25630 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25631 In addition to the GCC low-level builtins @option{-mzvector} enables
25632 a set of builtins added for compatibility with AltiVec-style
25633 implementations like Power and Cell. In order to make use of these
25634 builtins the header file @file{vecintrin.h} needs to be included.
25635 @option{-mzvector} is disabled by default.
25636
25637 @item -mmvcle
25638 @itemx -mno-mvcle
25639 @opindex mmvcle
25640 @opindex mno-mvcle
25641 Generate (or do not generate) code using the @code{mvcle} instruction
25642 to perform block moves. When @option{-mno-mvcle} is specified,
25643 use a @code{mvc} loop instead. This is the default unless optimizing for
25644 size.
25645
25646 @item -mdebug
25647 @itemx -mno-debug
25648 @opindex mdebug
25649 @opindex mno-debug
25650 Print (or do not print) additional debug information when compiling.
25651 The default is to not print debug information.
25652
25653 @item -march=@var{cpu-type}
25654 @opindex march
25655 Generate code that runs on @var{cpu-type}, which is the name of a
25656 system representing a certain processor type. Possible values for
25657 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25658 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25659 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25660 @samp{z14}/@samp{arch12}, and @samp{native}.
25661
25662 The default is @option{-march=z900}.
25663
25664 Specifying @samp{native} as cpu type can be used to select the best
25665 architecture option for the host processor.
25666 @option{-march=native} has no effect if GCC does not recognize the
25667 processor.
25668
25669 @item -mtune=@var{cpu-type}
25670 @opindex mtune
25671 Tune to @var{cpu-type} everything applicable about the generated code,
25672 except for the ABI and the set of available instructions.
25673 The list of @var{cpu-type} values is the same as for @option{-march}.
25674 The default is the value used for @option{-march}.
25675
25676 @item -mtpf-trace
25677 @itemx -mno-tpf-trace
25678 @opindex mtpf-trace
25679 @opindex mno-tpf-trace
25680 Generate code that adds (does not add) in TPF OS specific branches to trace
25681 routines in the operating system. This option is off by default, even
25682 when compiling for the TPF OS@.
25683
25684 @item -mfused-madd
25685 @itemx -mno-fused-madd
25686 @opindex mfused-madd
25687 @opindex mno-fused-madd
25688 Generate code that uses (does not use) the floating-point multiply and
25689 accumulate instructions. These instructions are generated by default if
25690 hardware floating point is used.
25691
25692 @item -mwarn-framesize=@var{framesize}
25693 @opindex mwarn-framesize
25694 Emit a warning if the current function exceeds the given frame size. Because
25695 this is a compile-time check it doesn't need to be a real problem when the program
25696 runs. It is intended to identify functions that most probably cause
25697 a stack overflow. It is useful to be used in an environment with limited stack
25698 size e.g.@: the linux kernel.
25699
25700 @item -mwarn-dynamicstack
25701 @opindex mwarn-dynamicstack
25702 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25703 arrays. This is generally a bad idea with a limited stack size.
25704
25705 @item -mstack-guard=@var{stack-guard}
25706 @itemx -mstack-size=@var{stack-size}
25707 @opindex mstack-guard
25708 @opindex mstack-size
25709 If these options are provided the S/390 back end emits additional instructions in
25710 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25711 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25712 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25713 the frame size of the compiled function is chosen.
25714 These options are intended to be used to help debugging stack overflow problems.
25715 The additionally emitted code causes only little overhead and hence can also be
25716 used in production-like systems without greater performance degradation. The given
25717 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25718 @var{stack-guard} without exceeding 64k.
25719 In order to be efficient the extra code makes the assumption that the stack starts
25720 at an address aligned to the value given by @var{stack-size}.
25721 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25722
25723 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25724 @opindex mhotpatch
25725 If the hotpatch option is enabled, a ``hot-patching'' function
25726 prologue is generated for all functions in the compilation unit.
25727 The funtion label is prepended with the given number of two-byte
25728 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25729 the label, 2 * @var{post-halfwords} bytes are appended, using the
25730 largest NOP like instructions the architecture allows (maximum
25731 1000000).
25732
25733 If both arguments are zero, hotpatching is disabled.
25734
25735 This option can be overridden for individual functions with the
25736 @code{hotpatch} attribute.
25737 @end table
25738
25739 @node Score Options
25740 @subsection Score Options
25741 @cindex Score Options
25742
25743 These options are defined for Score implementations:
25744
25745 @table @gcctabopt
25746 @item -meb
25747 @opindex meb
25748 Compile code for big-endian mode. This is the default.
25749
25750 @item -mel
25751 @opindex mel
25752 Compile code for little-endian mode.
25753
25754 @item -mnhwloop
25755 @opindex mnhwloop
25756 Disable generation of @code{bcnz} instructions.
25757
25758 @item -muls
25759 @opindex muls
25760 Enable generation of unaligned load and store instructions.
25761
25762 @item -mmac
25763 @opindex mmac
25764 Enable the use of multiply-accumulate instructions. Disabled by default.
25765
25766 @item -mscore5
25767 @opindex mscore5
25768 Specify the SCORE5 as the target architecture.
25769
25770 @item -mscore5u
25771 @opindex mscore5u
25772 Specify the SCORE5U of the target architecture.
25773
25774 @item -mscore7
25775 @opindex mscore7
25776 Specify the SCORE7 as the target architecture. This is the default.
25777
25778 @item -mscore7d
25779 @opindex mscore7d
25780 Specify the SCORE7D as the target architecture.
25781 @end table
25782
25783 @node SH Options
25784 @subsection SH Options
25785
25786 These @samp{-m} options are defined for the SH implementations:
25787
25788 @table @gcctabopt
25789 @item -m1
25790 @opindex m1
25791 Generate code for the SH1.
25792
25793 @item -m2
25794 @opindex m2
25795 Generate code for the SH2.
25796
25797 @item -m2e
25798 Generate code for the SH2e.
25799
25800 @item -m2a-nofpu
25801 @opindex m2a-nofpu
25802 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25803 that the floating-point unit is not used.
25804
25805 @item -m2a-single-only
25806 @opindex m2a-single-only
25807 Generate code for the SH2a-FPU, in such a way that no double-precision
25808 floating-point operations are used.
25809
25810 @item -m2a-single
25811 @opindex m2a-single
25812 Generate code for the SH2a-FPU assuming the floating-point unit is in
25813 single-precision mode by default.
25814
25815 @item -m2a
25816 @opindex m2a
25817 Generate code for the SH2a-FPU assuming the floating-point unit is in
25818 double-precision mode by default.
25819
25820 @item -m3
25821 @opindex m3
25822 Generate code for the SH3.
25823
25824 @item -m3e
25825 @opindex m3e
25826 Generate code for the SH3e.
25827
25828 @item -m4-nofpu
25829 @opindex m4-nofpu
25830 Generate code for the SH4 without a floating-point unit.
25831
25832 @item -m4-single-only
25833 @opindex m4-single-only
25834 Generate code for the SH4 with a floating-point unit that only
25835 supports single-precision arithmetic.
25836
25837 @item -m4-single
25838 @opindex m4-single
25839 Generate code for the SH4 assuming the floating-point unit is in
25840 single-precision mode by default.
25841
25842 @item -m4
25843 @opindex m4
25844 Generate code for the SH4.
25845
25846 @item -m4-100
25847 @opindex m4-100
25848 Generate code for SH4-100.
25849
25850 @item -m4-100-nofpu
25851 @opindex m4-100-nofpu
25852 Generate code for SH4-100 in such a way that the
25853 floating-point unit is not used.
25854
25855 @item -m4-100-single
25856 @opindex m4-100-single
25857 Generate code for SH4-100 assuming the floating-point unit is in
25858 single-precision mode by default.
25859
25860 @item -m4-100-single-only
25861 @opindex m4-100-single-only
25862 Generate code for SH4-100 in such a way that no double-precision
25863 floating-point operations are used.
25864
25865 @item -m4-200
25866 @opindex m4-200
25867 Generate code for SH4-200.
25868
25869 @item -m4-200-nofpu
25870 @opindex m4-200-nofpu
25871 Generate code for SH4-200 without in such a way that the
25872 floating-point unit is not used.
25873
25874 @item -m4-200-single
25875 @opindex m4-200-single
25876 Generate code for SH4-200 assuming the floating-point unit is in
25877 single-precision mode by default.
25878
25879 @item -m4-200-single-only
25880 @opindex m4-200-single-only
25881 Generate code for SH4-200 in such a way that no double-precision
25882 floating-point operations are used.
25883
25884 @item -m4-300
25885 @opindex m4-300
25886 Generate code for SH4-300.
25887
25888 @item -m4-300-nofpu
25889 @opindex m4-300-nofpu
25890 Generate code for SH4-300 without in such a way that the
25891 floating-point unit is not used.
25892
25893 @item -m4-300-single
25894 @opindex m4-300-single
25895 Generate code for SH4-300 in such a way that no double-precision
25896 floating-point operations are used.
25897
25898 @item -m4-300-single-only
25899 @opindex m4-300-single-only
25900 Generate code for SH4-300 in such a way that no double-precision
25901 floating-point operations are used.
25902
25903 @item -m4-340
25904 @opindex m4-340
25905 Generate code for SH4-340 (no MMU, no FPU).
25906
25907 @item -m4-500
25908 @opindex m4-500
25909 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25910 assembler.
25911
25912 @item -m4a-nofpu
25913 @opindex m4a-nofpu
25914 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25915 floating-point unit is not used.
25916
25917 @item -m4a-single-only
25918 @opindex m4a-single-only
25919 Generate code for the SH4a, in such a way that no double-precision
25920 floating-point operations are used.
25921
25922 @item -m4a-single
25923 @opindex m4a-single
25924 Generate code for the SH4a assuming the floating-point unit is in
25925 single-precision mode by default.
25926
25927 @item -m4a
25928 @opindex m4a
25929 Generate code for the SH4a.
25930
25931 @item -m4al
25932 @opindex m4al
25933 Same as @option{-m4a-nofpu}, except that it implicitly passes
25934 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25935 instructions at the moment.
25936
25937 @item -mb
25938 @opindex mb
25939 Compile code for the processor in big-endian mode.
25940
25941 @item -ml
25942 @opindex ml
25943 Compile code for the processor in little-endian mode.
25944
25945 @item -mdalign
25946 @opindex mdalign
25947 Align doubles at 64-bit boundaries. Note that this changes the calling
25948 conventions, and thus some functions from the standard C library do
25949 not work unless you recompile it first with @option{-mdalign}.
25950
25951 @item -mrelax
25952 @opindex mrelax
25953 Shorten some address references at link time, when possible; uses the
25954 linker option @option{-relax}.
25955
25956 @item -mbigtable
25957 @opindex mbigtable
25958 Use 32-bit offsets in @code{switch} tables. The default is to use
25959 16-bit offsets.
25960
25961 @item -mbitops
25962 @opindex mbitops
25963 Enable the use of bit manipulation instructions on SH2A.
25964
25965 @item -mfmovd
25966 @opindex mfmovd
25967 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25968 alignment constraints.
25969
25970 @item -mrenesas
25971 @opindex mrenesas
25972 Comply with the calling conventions defined by Renesas.
25973
25974 @item -mno-renesas
25975 @opindex mno-renesas
25976 Comply with the calling conventions defined for GCC before the Renesas
25977 conventions were available. This option is the default for all
25978 targets of the SH toolchain.
25979
25980 @item -mnomacsave
25981 @opindex mnomacsave
25982 Mark the @code{MAC} register as call-clobbered, even if
25983 @option{-mrenesas} is given.
25984
25985 @item -mieee
25986 @itemx -mno-ieee
25987 @opindex mieee
25988 @opindex mno-ieee
25989 Control the IEEE compliance of floating-point comparisons, which affects the
25990 handling of cases where the result of a comparison is unordered. By default
25991 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25992 enabled @option{-mno-ieee} is implicitly set, which results in faster
25993 floating-point greater-equal and less-equal comparisons. The implicit settings
25994 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25995
25996 @item -minline-ic_invalidate
25997 @opindex minline-ic_invalidate
25998 Inline code to invalidate instruction cache entries after setting up
25999 nested function trampolines.
26000 This option has no effect if @option{-musermode} is in effect and the selected
26001 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26002 instruction.
26003 If the selected code generation option does not allow the use of the @code{icbi}
26004 instruction, and @option{-musermode} is not in effect, the inlined code
26005 manipulates the instruction cache address array directly with an associative
26006 write. This not only requires privileged mode at run time, but it also
26007 fails if the cache line had been mapped via the TLB and has become unmapped.
26008
26009 @item -misize
26010 @opindex misize
26011 Dump instruction size and location in the assembly code.
26012
26013 @item -mpadstruct
26014 @opindex mpadstruct
26015 This option is deprecated. It pads structures to multiple of 4 bytes,
26016 which is incompatible with the SH ABI@.
26017
26018 @item -matomic-model=@var{model}
26019 @opindex matomic-model=@var{model}
26020 Sets the model of atomic operations and additional parameters as a comma
26021 separated list. For details on the atomic built-in functions see
26022 @ref{__atomic Builtins}. The following models and parameters are supported:
26023
26024 @table @samp
26025
26026 @item none
26027 Disable compiler generated atomic sequences and emit library calls for atomic
26028 operations. This is the default if the target is not @code{sh*-*-linux*}.
26029
26030 @item soft-gusa
26031 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26032 built-in functions. The generated atomic sequences require additional support
26033 from the interrupt/exception handling code of the system and are only suitable
26034 for SH3* and SH4* single-core systems. This option is enabled by default when
26035 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26036 this option also partially utilizes the hardware atomic instructions
26037 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26038 @samp{strict} is specified.
26039
26040 @item soft-tcb
26041 Generate software atomic sequences that use a variable in the thread control
26042 block. This is a variation of the gUSA sequences which can also be used on
26043 SH1* and SH2* targets. The generated atomic sequences require additional
26044 support from the interrupt/exception handling code of the system and are only
26045 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26046 parameter has to be specified as well.
26047
26048 @item soft-imask
26049 Generate software atomic sequences that temporarily disable interrupts by
26050 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26051 in privileged mode and is only suitable for single-core systems. Additional
26052 support from the interrupt/exception handling code of the system is not
26053 required. This model is enabled by default when the target is
26054 @code{sh*-*-linux*} and SH1* or SH2*.
26055
26056 @item hard-llcs
26057 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26058 instructions only. This is only available on SH4A and is suitable for
26059 multi-core systems. Since the hardware instructions support only 32 bit atomic
26060 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26061 Code compiled with this option is also compatible with other software
26062 atomic model interrupt/exception handling systems if executed on an SH4A
26063 system. Additional support from the interrupt/exception handling code of the
26064 system is not required for this model.
26065
26066 @item gbr-offset=
26067 This parameter specifies the offset in bytes of the variable in the thread
26068 control block structure that should be used by the generated atomic sequences
26069 when the @samp{soft-tcb} model has been selected. For other models this
26070 parameter is ignored. The specified value must be an integer multiple of four
26071 and in the range 0-1020.
26072
26073 @item strict
26074 This parameter prevents mixed usage of multiple atomic models, even if they
26075 are compatible, and makes the compiler generate atomic sequences of the
26076 specified model only.
26077
26078 @end table
26079
26080 @item -mtas
26081 @opindex mtas
26082 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26083 Notice that depending on the particular hardware and software configuration
26084 this can degrade overall performance due to the operand cache line flushes
26085 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26086 processors the @code{tas.b} instruction must be used with caution since it
26087 can result in data corruption for certain cache configurations.
26088
26089 @item -mprefergot
26090 @opindex mprefergot
26091 When generating position-independent code, emit function calls using
26092 the Global Offset Table instead of the Procedure Linkage Table.
26093
26094 @item -musermode
26095 @itemx -mno-usermode
26096 @opindex musermode
26097 @opindex mno-usermode
26098 Don't allow (allow) the compiler generating privileged mode code. Specifying
26099 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26100 inlined code would not work in user mode. @option{-musermode} is the default
26101 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26102 @option{-musermode} has no effect, since there is no user mode.
26103
26104 @item -multcost=@var{number}
26105 @opindex multcost=@var{number}
26106 Set the cost to assume for a multiply insn.
26107
26108 @item -mdiv=@var{strategy}
26109 @opindex mdiv=@var{strategy}
26110 Set the division strategy to be used for integer division operations.
26111 @var{strategy} can be one of:
26112
26113 @table @samp
26114
26115 @item call-div1
26116 Calls a library function that uses the single-step division instruction
26117 @code{div1} to perform the operation. Division by zero calculates an
26118 unspecified result and does not trap. This is the default except for SH4,
26119 SH2A and SHcompact.
26120
26121 @item call-fp
26122 Calls a library function that performs the operation in double precision
26123 floating point. Division by zero causes a floating-point exception. This is
26124 the default for SHcompact with FPU. Specifying this for targets that do not
26125 have a double precision FPU defaults to @code{call-div1}.
26126
26127 @item call-table
26128 Calls a library function that uses a lookup table for small divisors and
26129 the @code{div1} instruction with case distinction for larger divisors. Division
26130 by zero calculates an unspecified result and does not trap. This is the default
26131 for SH4. Specifying this for targets that do not have dynamic shift
26132 instructions defaults to @code{call-div1}.
26133
26134 @end table
26135
26136 When a division strategy has not been specified the default strategy is
26137 selected based on the current target. For SH2A the default strategy is to
26138 use the @code{divs} and @code{divu} instructions instead of library function
26139 calls.
26140
26141 @item -maccumulate-outgoing-args
26142 @opindex maccumulate-outgoing-args
26143 Reserve space once for outgoing arguments in the function prologue rather
26144 than around each call. Generally beneficial for performance and size. Also
26145 needed for unwinding to avoid changing the stack frame around conditional code.
26146
26147 @item -mdivsi3_libfunc=@var{name}
26148 @opindex mdivsi3_libfunc=@var{name}
26149 Set the name of the library function used for 32-bit signed division to
26150 @var{name}.
26151 This only affects the name used in the @samp{call} division strategies, and
26152 the compiler still expects the same sets of input/output/clobbered registers as
26153 if this option were not present.
26154
26155 @item -mfixed-range=@var{register-range}
26156 @opindex mfixed-range
26157 Generate code treating the given register range as fixed registers.
26158 A fixed register is one that the register allocator cannot use. This is
26159 useful when compiling kernel code. A register range is specified as
26160 two registers separated by a dash. Multiple register ranges can be
26161 specified separated by a comma.
26162
26163 @item -mbranch-cost=@var{num}
26164 @opindex mbranch-cost=@var{num}
26165 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26166 make the compiler try to generate more branch-free code if possible.
26167 If not specified the value is selected depending on the processor type that
26168 is being compiled for.
26169
26170 @item -mzdcbranch
26171 @itemx -mno-zdcbranch
26172 @opindex mzdcbranch
26173 @opindex mno-zdcbranch
26174 Assume (do not assume) that zero displacement conditional branch instructions
26175 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26176 compiler prefers zero displacement branch code sequences. This is
26177 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26178 disabled by specifying @option{-mno-zdcbranch}.
26179
26180 @item -mcbranch-force-delay-slot
26181 @opindex mcbranch-force-delay-slot
26182 Force the usage of delay slots for conditional branches, which stuffs the delay
26183 slot with a @code{nop} if a suitable instruction cannot be found. By default
26184 this option is disabled. It can be enabled to work around hardware bugs as
26185 found in the original SH7055.
26186
26187 @item -mfused-madd
26188 @itemx -mno-fused-madd
26189 @opindex mfused-madd
26190 @opindex mno-fused-madd
26191 Generate code that uses (does not use) the floating-point multiply and
26192 accumulate instructions. These instructions are generated by default
26193 if hardware floating point is used. The machine-dependent
26194 @option{-mfused-madd} option is now mapped to the machine-independent
26195 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26196 mapped to @option{-ffp-contract=off}.
26197
26198 @item -mfsca
26199 @itemx -mno-fsca
26200 @opindex mfsca
26201 @opindex mno-fsca
26202 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26203 and cosine approximations. The option @option{-mfsca} must be used in
26204 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26205 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26206 approximations even if @option{-funsafe-math-optimizations} is in effect.
26207
26208 @item -mfsrra
26209 @itemx -mno-fsrra
26210 @opindex mfsrra
26211 @opindex mno-fsrra
26212 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26213 reciprocal square root approximations. The option @option{-mfsrra} must be used
26214 in combination with @option{-funsafe-math-optimizations} and
26215 @option{-ffinite-math-only}. It is enabled by default when generating code for
26216 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26217 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26218 in effect.
26219
26220 @item -mpretend-cmove
26221 @opindex mpretend-cmove
26222 Prefer zero-displacement conditional branches for conditional move instruction
26223 patterns. This can result in faster code on the SH4 processor.
26224
26225 @item -mfdpic
26226 @opindex fdpic
26227 Generate code using the FDPIC ABI.
26228
26229 @end table
26230
26231 @node Solaris 2 Options
26232 @subsection Solaris 2 Options
26233 @cindex Solaris 2 options
26234
26235 These @samp{-m} options are supported on Solaris 2:
26236
26237 @table @gcctabopt
26238 @item -mclear-hwcap
26239 @opindex mclear-hwcap
26240 @option{-mclear-hwcap} tells the compiler to remove the hardware
26241 capabilities generated by the Solaris assembler. This is only necessary
26242 when object files use ISA extensions not supported by the current
26243 machine, but check at runtime whether or not to use them.
26244
26245 @item -mimpure-text
26246 @opindex mimpure-text
26247 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26248 the compiler to not pass @option{-z text} to the linker when linking a
26249 shared object. Using this option, you can link position-dependent
26250 code into a shared object.
26251
26252 @option{-mimpure-text} suppresses the ``relocations remain against
26253 allocatable but non-writable sections'' linker error message.
26254 However, the necessary relocations trigger copy-on-write, and the
26255 shared object is not actually shared across processes. Instead of
26256 using @option{-mimpure-text}, you should compile all source code with
26257 @option{-fpic} or @option{-fPIC}.
26258
26259 @end table
26260
26261 These switches are supported in addition to the above on Solaris 2:
26262
26263 @table @gcctabopt
26264 @item -pthreads
26265 @opindex pthreads
26266 This is a synonym for @option{-pthread}.
26267 @end table
26268
26269 @node SPARC Options
26270 @subsection SPARC Options
26271 @cindex SPARC options
26272
26273 These @samp{-m} options are supported on the SPARC:
26274
26275 @table @gcctabopt
26276 @item -mno-app-regs
26277 @itemx -mapp-regs
26278 @opindex mno-app-regs
26279 @opindex mapp-regs
26280 Specify @option{-mapp-regs} to generate output using the global registers
26281 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26282 global register 1, each global register 2 through 4 is then treated as an
26283 allocable register that is clobbered by function calls. This is the default.
26284
26285 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26286 specify @option{-mno-app-regs}. You should compile libraries and system
26287 software with this option.
26288
26289 @item -mflat
26290 @itemx -mno-flat
26291 @opindex mflat
26292 @opindex mno-flat
26293 With @option{-mflat}, the compiler does not generate save/restore instructions
26294 and uses a ``flat'' or single register window model. This model is compatible
26295 with the regular register window model. The local registers and the input
26296 registers (0--5) are still treated as ``call-saved'' registers and are
26297 saved on the stack as needed.
26298
26299 With @option{-mno-flat} (the default), the compiler generates save/restore
26300 instructions (except for leaf functions). This is the normal operating mode.
26301
26302 @item -mfpu
26303 @itemx -mhard-float
26304 @opindex mfpu
26305 @opindex mhard-float
26306 Generate output containing floating-point instructions. This is the
26307 default.
26308
26309 @item -mno-fpu
26310 @itemx -msoft-float
26311 @opindex mno-fpu
26312 @opindex msoft-float
26313 Generate output containing library calls for floating point.
26314 @strong{Warning:} the requisite libraries are not available for all SPARC
26315 targets. Normally the facilities of the machine's usual C compiler are
26316 used, but this cannot be done directly in cross-compilation. You must make
26317 your own arrangements to provide suitable library functions for
26318 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26319 @samp{sparclite-*-*} do provide software floating-point support.
26320
26321 @option{-msoft-float} changes the calling convention in the output file;
26322 therefore, it is only useful if you compile @emph{all} of a program with
26323 this option. In particular, you need to compile @file{libgcc.a}, the
26324 library that comes with GCC, with @option{-msoft-float} in order for
26325 this to work.
26326
26327 @item -mhard-quad-float
26328 @opindex mhard-quad-float
26329 Generate output containing quad-word (long double) floating-point
26330 instructions.
26331
26332 @item -msoft-quad-float
26333 @opindex msoft-quad-float
26334 Generate output containing library calls for quad-word (long double)
26335 floating-point instructions. The functions called are those specified
26336 in the SPARC ABI@. This is the default.
26337
26338 As of this writing, there are no SPARC implementations that have hardware
26339 support for the quad-word floating-point instructions. They all invoke
26340 a trap handler for one of these instructions, and then the trap handler
26341 emulates the effect of the instruction. Because of the trap handler overhead,
26342 this is much slower than calling the ABI library routines. Thus the
26343 @option{-msoft-quad-float} option is the default.
26344
26345 @item -mno-unaligned-doubles
26346 @itemx -munaligned-doubles
26347 @opindex mno-unaligned-doubles
26348 @opindex munaligned-doubles
26349 Assume that doubles have 8-byte alignment. This is the default.
26350
26351 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26352 alignment only if they are contained in another type, or if they have an
26353 absolute address. Otherwise, it assumes they have 4-byte alignment.
26354 Specifying this option avoids some rare compatibility problems with code
26355 generated by other compilers. It is not the default because it results
26356 in a performance loss, especially for floating-point code.
26357
26358 @item -muser-mode
26359 @itemx -mno-user-mode
26360 @opindex muser-mode
26361 @opindex mno-user-mode
26362 Do not generate code that can only run in supervisor mode. This is relevant
26363 only for the @code{casa} instruction emitted for the LEON3 processor. This
26364 is the default.
26365
26366 @item -mfaster-structs
26367 @itemx -mno-faster-structs
26368 @opindex mfaster-structs
26369 @opindex mno-faster-structs
26370 With @option{-mfaster-structs}, the compiler assumes that structures
26371 should have 8-byte alignment. This enables the use of pairs of
26372 @code{ldd} and @code{std} instructions for copies in structure
26373 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26374 However, the use of this changed alignment directly violates the SPARC
26375 ABI@. Thus, it's intended only for use on targets where the developer
26376 acknowledges that their resulting code is not directly in line with
26377 the rules of the ABI@.
26378
26379 @item -mstd-struct-return
26380 @itemx -mno-std-struct-return
26381 @opindex mstd-struct-return
26382 @opindex mno-std-struct-return
26383 With @option{-mstd-struct-return}, the compiler generates checking code
26384 in functions returning structures or unions to detect size mismatches
26385 between the two sides of function calls, as per the 32-bit ABI@.
26386
26387 The default is @option{-mno-std-struct-return}. This option has no effect
26388 in 64-bit mode.
26389
26390 @item -mlra
26391 @itemx -mno-lra
26392 @opindex mlra
26393 @opindex mno-lra
26394 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26395 so @option{-mno-lra} needs to be passed to get old Reload.
26396
26397 @item -mcpu=@var{cpu_type}
26398 @opindex mcpu
26399 Set the instruction set, register set, and instruction scheduling parameters
26400 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26401 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26402 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26403 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26404 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26405 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26406
26407 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26408 which selects the best architecture option for the host processor.
26409 @option{-mcpu=native} has no effect if GCC does not recognize
26410 the processor.
26411
26412 Default instruction scheduling parameters are used for values that select
26413 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26414 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26415
26416 Here is a list of each supported architecture and their supported
26417 implementations.
26418
26419 @table @asis
26420 @item v7
26421 cypress, leon3v7
26422
26423 @item v8
26424 supersparc, hypersparc, leon, leon3
26425
26426 @item sparclite
26427 f930, f934, sparclite86x
26428
26429 @item sparclet
26430 tsc701
26431
26432 @item v9
26433 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26434 niagara7, m8
26435 @end table
26436
26437 By default (unless configured otherwise), GCC generates code for the V7
26438 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26439 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26440 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26441 SPARCStation 1, 2, IPX etc.
26442
26443 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26444 architecture. The only difference from V7 code is that the compiler emits
26445 the integer multiply and integer divide instructions which exist in SPARC-V8
26446 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26447 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26448 2000 series.
26449
26450 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26451 the SPARC architecture. This adds the integer multiply, integer divide step
26452 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26453 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26454 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26455 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26456 MB86934 chip, which is the more recent SPARClite with FPU@.
26457
26458 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26459 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26460 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26461 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26462 optimizes it for the TEMIC SPARClet chip.
26463
26464 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26465 architecture. This adds 64-bit integer and floating-point move instructions,
26466 3 additional floating-point condition code registers and conditional move
26467 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26468 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26469 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26470 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26471 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26472 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26473 additionally optimizes it for Sun UltraSPARC T2 chips. With
26474 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26475 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26476 additionally optimizes it for Sun UltraSPARC T4 chips. With
26477 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26478 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26479 additionally optimizes it for Oracle M8 chips.
26480
26481 @item -mtune=@var{cpu_type}
26482 @opindex mtune
26483 Set the instruction scheduling parameters for machine type
26484 @var{cpu_type}, but do not set the instruction set or register set that the
26485 option @option{-mcpu=@var{cpu_type}} does.
26486
26487 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26488 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26489 that select a particular CPU implementation. Those are
26490 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26491 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26492 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26493 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26494 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26495 and GNU/Linux toolchains, @samp{native} can also be used.
26496
26497 @item -mv8plus
26498 @itemx -mno-v8plus
26499 @opindex mv8plus
26500 @opindex mno-v8plus
26501 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26502 difference from the V8 ABI is that the global and out registers are
26503 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26504 mode for all SPARC-V9 processors.
26505
26506 @item -mvis
26507 @itemx -mno-vis
26508 @opindex mvis
26509 @opindex mno-vis
26510 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26511 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26512
26513 @item -mvis2
26514 @itemx -mno-vis2
26515 @opindex mvis2
26516 @opindex mno-vis2
26517 With @option{-mvis2}, GCC generates code that takes advantage of
26518 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26519 default is @option{-mvis2} when targeting a cpu that supports such
26520 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26521 also sets @option{-mvis}.
26522
26523 @item -mvis3
26524 @itemx -mno-vis3
26525 @opindex mvis3
26526 @opindex mno-vis3
26527 With @option{-mvis3}, GCC generates code that takes advantage of
26528 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26529 default is @option{-mvis3} when targeting a cpu that supports such
26530 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26531 also sets @option{-mvis2} and @option{-mvis}.
26532
26533 @item -mvis4
26534 @itemx -mno-vis4
26535 @opindex mvis4
26536 @opindex mno-vis4
26537 With @option{-mvis4}, GCC generates code that takes advantage of
26538 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26539 default is @option{-mvis4} when targeting a cpu that supports such
26540 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26541 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26542
26543 @item -mvis4b
26544 @itemx -mno-vis4b
26545 @opindex mvis4b
26546 @opindex mno-vis4b
26547 With @option{-mvis4b}, GCC generates code that takes advantage of
26548 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26549 the additional VIS instructions introduced in the Oracle SPARC
26550 Architecture 2017. The default is @option{-mvis4b} when targeting a
26551 cpu that supports such instructions, such as m8 and later. Setting
26552 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26553 @option{-mvis2} and @option{-mvis}.
26554
26555 @item -mcbcond
26556 @itemx -mno-cbcond
26557 @opindex mcbcond
26558 @opindex mno-cbcond
26559 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26560 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26561 when targeting a CPU that supports such instructions, such as Niagara-4 and
26562 later.
26563
26564 @item -mfmaf
26565 @itemx -mno-fmaf
26566 @opindex mfmaf
26567 @opindex mno-fmaf
26568 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26569 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26570 when targeting a CPU that supports such instructions, such as Niagara-3 and
26571 later.
26572
26573 @item -mfsmuld
26574 @itemx -mno-fsmuld
26575 @opindex mfsmuld
26576 @opindex mno-fsmuld
26577 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26578 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26579 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26580 or V9 with FPU except @option{-mcpu=leon}.
26581
26582 @item -mpopc
26583 @itemx -mno-popc
26584 @opindex mpopc
26585 @opindex mno-popc
26586 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26587 Population Count instruction. The default is @option{-mpopc}
26588 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26589 later.
26590
26591 @item -msubxc
26592 @itemx -mno-subxc
26593 @opindex msubxc
26594 @opindex mno-subxc
26595 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26596 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26597 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26598 later.
26599
26600 @item -mfix-at697f
26601 @opindex mfix-at697f
26602 Enable the documented workaround for the single erratum of the Atmel AT697F
26603 processor (which corresponds to erratum #13 of the AT697E processor).
26604
26605 @item -mfix-ut699
26606 @opindex mfix-ut699
26607 Enable the documented workarounds for the floating-point errata and the data
26608 cache nullify errata of the UT699 processor.
26609
26610 @item -mfix-ut700
26611 @opindex mfix-ut700
26612 Enable the documented workaround for the back-to-back store errata of
26613 the UT699E/UT700 processor.
26614
26615 @item -mfix-gr712rc
26616 @opindex mfix-gr712rc
26617 Enable the documented workaround for the back-to-back store errata of
26618 the GR712RC processor.
26619 @end table
26620
26621 These @samp{-m} options are supported in addition to the above
26622 on SPARC-V9 processors in 64-bit environments:
26623
26624 @table @gcctabopt
26625 @item -m32
26626 @itemx -m64
26627 @opindex m32
26628 @opindex m64
26629 Generate code for a 32-bit or 64-bit environment.
26630 The 32-bit environment sets int, long and pointer to 32 bits.
26631 The 64-bit environment sets int to 32 bits and long and pointer
26632 to 64 bits.
26633
26634 @item -mcmodel=@var{which}
26635 @opindex mcmodel
26636 Set the code model to one of
26637
26638 @table @samp
26639 @item medlow
26640 The Medium/Low code model: 64-bit addresses, programs
26641 must be linked in the low 32 bits of memory. Programs can be statically
26642 or dynamically linked.
26643
26644 @item medmid
26645 The Medium/Middle code model: 64-bit addresses, programs
26646 must be linked in the low 44 bits of memory, the text and data segments must
26647 be less than 2GB in size and the data segment must be located within 2GB of
26648 the text segment.
26649
26650 @item medany
26651 The Medium/Anywhere code model: 64-bit addresses, programs
26652 may be linked anywhere in memory, the text and data segments must be less
26653 than 2GB in size and the data segment must be located within 2GB of the
26654 text segment.
26655
26656 @item embmedany
26657 The Medium/Anywhere code model for embedded systems:
26658 64-bit addresses, the text and data segments must be less than 2GB in
26659 size, both starting anywhere in memory (determined at link time). The
26660 global register %g4 points to the base of the data segment. Programs
26661 are statically linked and PIC is not supported.
26662 @end table
26663
26664 @item -mmemory-model=@var{mem-model}
26665 @opindex mmemory-model
26666 Set the memory model in force on the processor to one of
26667
26668 @table @samp
26669 @item default
26670 The default memory model for the processor and operating system.
26671
26672 @item rmo
26673 Relaxed Memory Order
26674
26675 @item pso
26676 Partial Store Order
26677
26678 @item tso
26679 Total Store Order
26680
26681 @item sc
26682 Sequential Consistency
26683 @end table
26684
26685 These memory models are formally defined in Appendix D of the SPARC-V9
26686 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26687
26688 @item -mstack-bias
26689 @itemx -mno-stack-bias
26690 @opindex mstack-bias
26691 @opindex mno-stack-bias
26692 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26693 frame pointer if present, are offset by @minus{}2047 which must be added back
26694 when making stack frame references. This is the default in 64-bit mode.
26695 Otherwise, assume no such offset is present.
26696 @end table
26697
26698 @node SPU Options
26699 @subsection SPU Options
26700 @cindex SPU options
26701
26702 These @samp{-m} options are supported on the SPU:
26703
26704 @table @gcctabopt
26705 @item -mwarn-reloc
26706 @itemx -merror-reloc
26707 @opindex mwarn-reloc
26708 @opindex merror-reloc
26709
26710 The loader for SPU does not handle dynamic relocations. By default, GCC
26711 gives an error when it generates code that requires a dynamic
26712 relocation. @option{-mno-error-reloc} disables the error,
26713 @option{-mwarn-reloc} generates a warning instead.
26714
26715 @item -msafe-dma
26716 @itemx -munsafe-dma
26717 @opindex msafe-dma
26718 @opindex munsafe-dma
26719
26720 Instructions that initiate or test completion of DMA must not be
26721 reordered with respect to loads and stores of the memory that is being
26722 accessed.
26723 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26724 memory accesses, but that can lead to inefficient code in places where the
26725 memory is known to not change. Rather than mark the memory as volatile,
26726 you can use @option{-msafe-dma} to tell the compiler to treat
26727 the DMA instructions as potentially affecting all memory.
26728
26729 @item -mbranch-hints
26730 @opindex mbranch-hints
26731
26732 By default, GCC generates a branch hint instruction to avoid
26733 pipeline stalls for always-taken or probably-taken branches. A hint
26734 is not generated closer than 8 instructions away from its branch.
26735 There is little reason to disable them, except for debugging purposes,
26736 or to make an object a little bit smaller.
26737
26738 @item -msmall-mem
26739 @itemx -mlarge-mem
26740 @opindex msmall-mem
26741 @opindex mlarge-mem
26742
26743 By default, GCC generates code assuming that addresses are never larger
26744 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
26745 a full 32-bit address.
26746
26747 @item -mstdmain
26748 @opindex mstdmain
26749
26750 By default, GCC links against startup code that assumes the SPU-style
26751 main function interface (which has an unconventional parameter list).
26752 With @option{-mstdmain}, GCC links your program against startup
26753 code that assumes a C99-style interface to @code{main}, including a
26754 local copy of @code{argv} strings.
26755
26756 @item -mfixed-range=@var{register-range}
26757 @opindex mfixed-range
26758 Generate code treating the given register range as fixed registers.
26759 A fixed register is one that the register allocator cannot use. This is
26760 useful when compiling kernel code. A register range is specified as
26761 two registers separated by a dash. Multiple register ranges can be
26762 specified separated by a comma.
26763
26764 @item -mea32
26765 @itemx -mea64
26766 @opindex mea32
26767 @opindex mea64
26768 Compile code assuming that pointers to the PPU address space accessed
26769 via the @code{__ea} named address space qualifier are either 32 or 64
26770 bits wide. The default is 32 bits. As this is an ABI-changing option,
26771 all object code in an executable must be compiled with the same setting.
26772
26773 @item -maddress-space-conversion
26774 @itemx -mno-address-space-conversion
26775 @opindex maddress-space-conversion
26776 @opindex mno-address-space-conversion
26777 Allow/disallow treating the @code{__ea} address space as superset
26778 of the generic address space. This enables explicit type casts
26779 between @code{__ea} and generic pointer as well as implicit
26780 conversions of generic pointers to @code{__ea} pointers. The
26781 default is to allow address space pointer conversions.
26782
26783 @item -mcache-size=@var{cache-size}
26784 @opindex mcache-size
26785 This option controls the version of libgcc that the compiler links to an
26786 executable and selects a software-managed cache for accessing variables
26787 in the @code{__ea} address space with a particular cache size. Possible
26788 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26789 and @samp{128}. The default cache size is 64KB.
26790
26791 @item -matomic-updates
26792 @itemx -mno-atomic-updates
26793 @opindex matomic-updates
26794 @opindex mno-atomic-updates
26795 This option controls the version of libgcc that the compiler links to an
26796 executable and selects whether atomic updates to the software-managed
26797 cache of PPU-side variables are used. If you use atomic updates, changes
26798 to a PPU variable from SPU code using the @code{__ea} named address space
26799 qualifier do not interfere with changes to other PPU variables residing
26800 in the same cache line from PPU code. If you do not use atomic updates,
26801 such interference may occur; however, writing back cache lines is
26802 more efficient. The default behavior is to use atomic updates.
26803
26804 @item -mdual-nops
26805 @itemx -mdual-nops=@var{n}
26806 @opindex mdual-nops
26807 By default, GCC inserts NOPs to increase dual issue when it expects
26808 it to increase performance. @var{n} can be a value from 0 to 10. A
26809 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26810 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26811
26812 @item -mhint-max-nops=@var{n}
26813 @opindex mhint-max-nops
26814 Maximum number of NOPs to insert for a branch hint. A branch hint must
26815 be at least 8 instructions away from the branch it is affecting. GCC
26816 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26817 generate the branch hint.
26818
26819 @item -mhint-max-distance=@var{n}
26820 @opindex mhint-max-distance
26821 The encoding of the branch hint instruction limits the hint to be within
26822 256 instructions of the branch it is affecting. By default, GCC makes
26823 sure it is within 125.
26824
26825 @item -msafe-hints
26826 @opindex msafe-hints
26827 Work around a hardware bug that causes the SPU to stall indefinitely.
26828 By default, GCC inserts the @code{hbrp} instruction to make sure
26829 this stall won't happen.
26830
26831 @end table
26832
26833 @node System V Options
26834 @subsection Options for System V
26835
26836 These additional options are available on System V Release 4 for
26837 compatibility with other compilers on those systems:
26838
26839 @table @gcctabopt
26840 @item -G
26841 @opindex G
26842 Create a shared object.
26843 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26844
26845 @item -Qy
26846 @opindex Qy
26847 Identify the versions of each tool used by the compiler, in a
26848 @code{.ident} assembler directive in the output.
26849
26850 @item -Qn
26851 @opindex Qn
26852 Refrain from adding @code{.ident} directives to the output file (this is
26853 the default).
26854
26855 @item -YP,@var{dirs}
26856 @opindex YP
26857 Search the directories @var{dirs}, and no others, for libraries
26858 specified with @option{-l}.
26859
26860 @item -Ym,@var{dir}
26861 @opindex Ym
26862 Look in the directory @var{dir} to find the M4 preprocessor.
26863 The assembler uses this option.
26864 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26865 @c the generic assembler that comes with Solaris takes just -Ym.
26866 @end table
26867
26868 @node TILE-Gx Options
26869 @subsection TILE-Gx Options
26870 @cindex TILE-Gx options
26871
26872 These @samp{-m} options are supported on the TILE-Gx:
26873
26874 @table @gcctabopt
26875 @item -mcmodel=small
26876 @opindex mcmodel=small
26877 Generate code for the small model. The distance for direct calls is
26878 limited to 500M in either direction. PC-relative addresses are 32
26879 bits. Absolute addresses support the full address range.
26880
26881 @item -mcmodel=large
26882 @opindex mcmodel=large
26883 Generate code for the large model. There is no limitation on call
26884 distance, pc-relative addresses, or absolute addresses.
26885
26886 @item -mcpu=@var{name}
26887 @opindex mcpu
26888 Selects the type of CPU to be targeted. Currently the only supported
26889 type is @samp{tilegx}.
26890
26891 @item -m32
26892 @itemx -m64
26893 @opindex m32
26894 @opindex m64
26895 Generate code for a 32-bit or 64-bit environment. The 32-bit
26896 environment sets int, long, and pointer to 32 bits. The 64-bit
26897 environment sets int to 32 bits and long and pointer to 64 bits.
26898
26899 @item -mbig-endian
26900 @itemx -mlittle-endian
26901 @opindex mbig-endian
26902 @opindex mlittle-endian
26903 Generate code in big/little endian mode, respectively.
26904 @end table
26905
26906 @node TILEPro Options
26907 @subsection TILEPro Options
26908 @cindex TILEPro options
26909
26910 These @samp{-m} options are supported on the TILEPro:
26911
26912 @table @gcctabopt
26913 @item -mcpu=@var{name}
26914 @opindex mcpu
26915 Selects the type of CPU to be targeted. Currently the only supported
26916 type is @samp{tilepro}.
26917
26918 @item -m32
26919 @opindex m32
26920 Generate code for a 32-bit environment, which sets int, long, and
26921 pointer to 32 bits. This is the only supported behavior so the flag
26922 is essentially ignored.
26923 @end table
26924
26925 @node V850 Options
26926 @subsection V850 Options
26927 @cindex V850 Options
26928
26929 These @samp{-m} options are defined for V850 implementations:
26930
26931 @table @gcctabopt
26932 @item -mlong-calls
26933 @itemx -mno-long-calls
26934 @opindex mlong-calls
26935 @opindex mno-long-calls
26936 Treat all calls as being far away (near). If calls are assumed to be
26937 far away, the compiler always loads the function's address into a
26938 register, and calls indirect through the pointer.
26939
26940 @item -mno-ep
26941 @itemx -mep
26942 @opindex mno-ep
26943 @opindex mep
26944 Do not optimize (do optimize) basic blocks that use the same index
26945 pointer 4 or more times to copy pointer into the @code{ep} register, and
26946 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26947 option is on by default if you optimize.
26948
26949 @item -mno-prolog-function
26950 @itemx -mprolog-function
26951 @opindex mno-prolog-function
26952 @opindex mprolog-function
26953 Do not use (do use) external functions to save and restore registers
26954 at the prologue and epilogue of a function. The external functions
26955 are slower, but use less code space if more than one function saves
26956 the same number of registers. The @option{-mprolog-function} option
26957 is on by default if you optimize.
26958
26959 @item -mspace
26960 @opindex mspace
26961 Try to make the code as small as possible. At present, this just turns
26962 on the @option{-mep} and @option{-mprolog-function} options.
26963
26964 @item -mtda=@var{n}
26965 @opindex mtda
26966 Put static or global variables whose size is @var{n} bytes or less into
26967 the tiny data area that register @code{ep} points to. The tiny data
26968 area can hold up to 256 bytes in total (128 bytes for byte references).
26969
26970 @item -msda=@var{n}
26971 @opindex msda
26972 Put static or global variables whose size is @var{n} bytes or less into
26973 the small data area that register @code{gp} points to. The small data
26974 area can hold up to 64 kilobytes.
26975
26976 @item -mzda=@var{n}
26977 @opindex mzda
26978 Put static or global variables whose size is @var{n} bytes or less into
26979 the first 32 kilobytes of memory.
26980
26981 @item -mv850
26982 @opindex mv850
26983 Specify that the target processor is the V850.
26984
26985 @item -mv850e3v5
26986 @opindex mv850e3v5
26987 Specify that the target processor is the V850E3V5. The preprocessor
26988 constant @code{__v850e3v5__} is defined if this option is used.
26989
26990 @item -mv850e2v4
26991 @opindex mv850e2v4
26992 Specify that the target processor is the V850E3V5. This is an alias for
26993 the @option{-mv850e3v5} option.
26994
26995 @item -mv850e2v3
26996 @opindex mv850e2v3
26997 Specify that the target processor is the V850E2V3. The preprocessor
26998 constant @code{__v850e2v3__} is defined if this option is used.
26999
27000 @item -mv850e2
27001 @opindex mv850e2
27002 Specify that the target processor is the V850E2. The preprocessor
27003 constant @code{__v850e2__} is defined if this option is used.
27004
27005 @item -mv850e1
27006 @opindex mv850e1
27007 Specify that the target processor is the V850E1. The preprocessor
27008 constants @code{__v850e1__} and @code{__v850e__} are defined if
27009 this option is used.
27010
27011 @item -mv850es
27012 @opindex mv850es
27013 Specify that the target processor is the V850ES. This is an alias for
27014 the @option{-mv850e1} option.
27015
27016 @item -mv850e
27017 @opindex mv850e
27018 Specify that the target processor is the V850E@. The preprocessor
27019 constant @code{__v850e__} is defined if this option is used.
27020
27021 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
27022 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
27023 are defined then a default target processor is chosen and the
27024 relevant @samp{__v850*__} preprocessor constant is defined.
27025
27026 The preprocessor constants @code{__v850} and @code{__v851__} are always
27027 defined, regardless of which processor variant is the target.
27028
27029 @item -mdisable-callt
27030 @itemx -mno-disable-callt
27031 @opindex mdisable-callt
27032 @opindex mno-disable-callt
27033 This option suppresses generation of the @code{CALLT} instruction for the
27034 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27035 architecture.
27036
27037 This option is enabled by default when the RH850 ABI is
27038 in use (see @option{-mrh850-abi}), and disabled by default when the
27039 GCC ABI is in use. If @code{CALLT} instructions are being generated
27040 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27041
27042 @item -mrelax
27043 @itemx -mno-relax
27044 @opindex mrelax
27045 @opindex mno-relax
27046 Pass on (or do not pass on) the @option{-mrelax} command-line option
27047 to the assembler.
27048
27049 @item -mlong-jumps
27050 @itemx -mno-long-jumps
27051 @opindex mlong-jumps
27052 @opindex mno-long-jumps
27053 Disable (or re-enable) the generation of PC-relative jump instructions.
27054
27055 @item -msoft-float
27056 @itemx -mhard-float
27057 @opindex msoft-float
27058 @opindex mhard-float
27059 Disable (or re-enable) the generation of hardware floating point
27060 instructions. This option is only significant when the target
27061 architecture is @samp{V850E2V3} or higher. If hardware floating point
27062 instructions are being generated then the C preprocessor symbol
27063 @code{__FPU_OK__} is defined, otherwise the symbol
27064 @code{__NO_FPU__} is defined.
27065
27066 @item -mloop
27067 @opindex mloop
27068 Enables the use of the e3v5 LOOP instruction. The use of this
27069 instruction is not enabled by default when the e3v5 architecture is
27070 selected because its use is still experimental.
27071
27072 @item -mrh850-abi
27073 @itemx -mghs
27074 @opindex mrh850-abi
27075 @opindex mghs
27076 Enables support for the RH850 version of the V850 ABI. This is the
27077 default. With this version of the ABI the following rules apply:
27078
27079 @itemize
27080 @item
27081 Integer sized structures and unions are returned via a memory pointer
27082 rather than a register.
27083
27084 @item
27085 Large structures and unions (more than 8 bytes in size) are passed by
27086 value.
27087
27088 @item
27089 Functions are aligned to 16-bit boundaries.
27090
27091 @item
27092 The @option{-m8byte-align} command-line option is supported.
27093
27094 @item
27095 The @option{-mdisable-callt} command-line option is enabled by
27096 default. The @option{-mno-disable-callt} command-line option is not
27097 supported.
27098 @end itemize
27099
27100 When this version of the ABI is enabled the C preprocessor symbol
27101 @code{__V850_RH850_ABI__} is defined.
27102
27103 @item -mgcc-abi
27104 @opindex mgcc-abi
27105 Enables support for the old GCC version of the V850 ABI. With this
27106 version of the ABI the following rules apply:
27107
27108 @itemize
27109 @item
27110 Integer sized structures and unions are returned in register @code{r10}.
27111
27112 @item
27113 Large structures and unions (more than 8 bytes in size) are passed by
27114 reference.
27115
27116 @item
27117 Functions are aligned to 32-bit boundaries, unless optimizing for
27118 size.
27119
27120 @item
27121 The @option{-m8byte-align} command-line option is not supported.
27122
27123 @item
27124 The @option{-mdisable-callt} command-line option is supported but not
27125 enabled by default.
27126 @end itemize
27127
27128 When this version of the ABI is enabled the C preprocessor symbol
27129 @code{__V850_GCC_ABI__} is defined.
27130
27131 @item -m8byte-align
27132 @itemx -mno-8byte-align
27133 @opindex m8byte-align
27134 @opindex mno-8byte-align
27135 Enables support for @code{double} and @code{long long} types to be
27136 aligned on 8-byte boundaries. The default is to restrict the
27137 alignment of all objects to at most 4-bytes. When
27138 @option{-m8byte-align} is in effect the C preprocessor symbol
27139 @code{__V850_8BYTE_ALIGN__} is defined.
27140
27141 @item -mbig-switch
27142 @opindex mbig-switch
27143 Generate code suitable for big switch tables. Use this option only if
27144 the assembler/linker complain about out of range branches within a switch
27145 table.
27146
27147 @item -mapp-regs
27148 @opindex mapp-regs
27149 This option causes r2 and r5 to be used in the code generated by
27150 the compiler. This setting is the default.
27151
27152 @item -mno-app-regs
27153 @opindex mno-app-regs
27154 This option causes r2 and r5 to be treated as fixed registers.
27155
27156 @end table
27157
27158 @node VAX Options
27159 @subsection VAX Options
27160 @cindex VAX options
27161
27162 These @samp{-m} options are defined for the VAX:
27163
27164 @table @gcctabopt
27165 @item -munix
27166 @opindex munix
27167 Do not output certain jump instructions (@code{aobleq} and so on)
27168 that the Unix assembler for the VAX cannot handle across long
27169 ranges.
27170
27171 @item -mgnu
27172 @opindex mgnu
27173 Do output those jump instructions, on the assumption that the
27174 GNU assembler is being used.
27175
27176 @item -mg
27177 @opindex mg
27178 Output code for G-format floating-point numbers instead of D-format.
27179 @end table
27180
27181 @node Visium Options
27182 @subsection Visium Options
27183 @cindex Visium options
27184
27185 @table @gcctabopt
27186
27187 @item -mdebug
27188 @opindex mdebug
27189 A program which performs file I/O and is destined to run on an MCM target
27190 should be linked with this option. It causes the libraries libc.a and
27191 libdebug.a to be linked. The program should be run on the target under
27192 the control of the GDB remote debugging stub.
27193
27194 @item -msim
27195 @opindex msim
27196 A program which performs file I/O and is destined to run on the simulator
27197 should be linked with option. This causes libraries libc.a and libsim.a to
27198 be linked.
27199
27200 @item -mfpu
27201 @itemx -mhard-float
27202 @opindex mfpu
27203 @opindex mhard-float
27204 Generate code containing floating-point instructions. This is the
27205 default.
27206
27207 @item -mno-fpu
27208 @itemx -msoft-float
27209 @opindex mno-fpu
27210 @opindex msoft-float
27211 Generate code containing library calls for floating-point.
27212
27213 @option{-msoft-float} changes the calling convention in the output file;
27214 therefore, it is only useful if you compile @emph{all} of a program with
27215 this option. In particular, you need to compile @file{libgcc.a}, the
27216 library that comes with GCC, with @option{-msoft-float} in order for
27217 this to work.
27218
27219 @item -mcpu=@var{cpu_type}
27220 @opindex mcpu
27221 Set the instruction set, register set, and instruction scheduling parameters
27222 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27223 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27224
27225 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27226
27227 By default (unless configured otherwise), GCC generates code for the GR5
27228 variant of the Visium architecture.
27229
27230 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27231 architecture. The only difference from GR5 code is that the compiler will
27232 generate block move instructions.
27233
27234 @item -mtune=@var{cpu_type}
27235 @opindex mtune
27236 Set the instruction scheduling parameters for machine type @var{cpu_type},
27237 but do not set the instruction set or register set that the option
27238 @option{-mcpu=@var{cpu_type}} would.
27239
27240 @item -msv-mode
27241 @opindex msv-mode
27242 Generate code for the supervisor mode, where there are no restrictions on
27243 the access to general registers. This is the default.
27244
27245 @item -muser-mode
27246 @opindex muser-mode
27247 Generate code for the user mode, where the access to some general registers
27248 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27249 mode; on the GR6, only registers r29 to r31 are affected.
27250 @end table
27251
27252 @node VMS Options
27253 @subsection VMS Options
27254
27255 These @samp{-m} options are defined for the VMS implementations:
27256
27257 @table @gcctabopt
27258 @item -mvms-return-codes
27259 @opindex mvms-return-codes
27260 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27261 condition (e.g.@: error) codes.
27262
27263 @item -mdebug-main=@var{prefix}
27264 @opindex mdebug-main=@var{prefix}
27265 Flag the first routine whose name starts with @var{prefix} as the main
27266 routine for the debugger.
27267
27268 @item -mmalloc64
27269 @opindex mmalloc64
27270 Default to 64-bit memory allocation routines.
27271
27272 @item -mpointer-size=@var{size}
27273 @opindex mpointer-size=@var{size}
27274 Set the default size of pointers. Possible options for @var{size} are
27275 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27276 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27277 The later option disables @code{pragma pointer_size}.
27278 @end table
27279
27280 @node VxWorks Options
27281 @subsection VxWorks Options
27282 @cindex VxWorks Options
27283
27284 The options in this section are defined for all VxWorks targets.
27285 Options specific to the target hardware are listed with the other
27286 options for that target.
27287
27288 @table @gcctabopt
27289 @item -mrtp
27290 @opindex mrtp
27291 GCC can generate code for both VxWorks kernels and real time processes
27292 (RTPs). This option switches from the former to the latter. It also
27293 defines the preprocessor macro @code{__RTP__}.
27294
27295 @item -non-static
27296 @opindex non-static
27297 Link an RTP executable against shared libraries rather than static
27298 libraries. The options @option{-static} and @option{-shared} can
27299 also be used for RTPs (@pxref{Link Options}); @option{-static}
27300 is the default.
27301
27302 @item -Bstatic
27303 @itemx -Bdynamic
27304 @opindex Bstatic
27305 @opindex Bdynamic
27306 These options are passed down to the linker. They are defined for
27307 compatibility with Diab.
27308
27309 @item -Xbind-lazy
27310 @opindex Xbind-lazy
27311 Enable lazy binding of function calls. This option is equivalent to
27312 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27313
27314 @item -Xbind-now
27315 @opindex Xbind-now
27316 Disable lazy binding of function calls. This option is the default and
27317 is defined for compatibility with Diab.
27318 @end table
27319
27320 @node x86 Options
27321 @subsection x86 Options
27322 @cindex x86 Options
27323
27324 These @samp{-m} options are defined for the x86 family of computers.
27325
27326 @table @gcctabopt
27327
27328 @item -march=@var{cpu-type}
27329 @opindex march
27330 Generate instructions for the machine type @var{cpu-type}. In contrast to
27331 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27332 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27333 to generate code that may not run at all on processors other than the one
27334 indicated. Specifying @option{-march=@var{cpu-type}} implies
27335 @option{-mtune=@var{cpu-type}}.
27336
27337 The choices for @var{cpu-type} are:
27338
27339 @table @samp
27340 @item native
27341 This selects the CPU to generate code for at compilation time by determining
27342 the processor type of the compiling machine. Using @option{-march=native}
27343 enables all instruction subsets supported by the local machine (hence
27344 the result might not run on different machines). Using @option{-mtune=native}
27345 produces code optimized for the local machine under the constraints
27346 of the selected instruction set.
27347
27348 @item x86-64
27349 A generic CPU with 64-bit extensions.
27350
27351 @item i386
27352 Original Intel i386 CPU@.
27353
27354 @item i486
27355 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27356
27357 @item i586
27358 @itemx pentium
27359 Intel Pentium CPU with no MMX support.
27360
27361 @item lakemont
27362 Intel Lakemont MCU, based on Intel Pentium CPU.
27363
27364 @item pentium-mmx
27365 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27366
27367 @item pentiumpro
27368 Intel Pentium Pro CPU@.
27369
27370 @item i686
27371 When used with @option{-march}, the Pentium Pro
27372 instruction set is used, so the code runs on all i686 family chips.
27373 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27374
27375 @item pentium2
27376 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27377 support.
27378
27379 @item pentium3
27380 @itemx pentium3m
27381 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27382 set support.
27383
27384 @item pentium-m
27385 Intel Pentium M; low-power version of Intel Pentium III CPU
27386 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27387
27388 @item pentium4
27389 @itemx pentium4m
27390 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27391
27392 @item prescott
27393 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27394 set support.
27395
27396 @item nocona
27397 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27398 SSE2 and SSE3 instruction set support.
27399
27400 @item core2
27401 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27402 instruction set support.
27403
27404 @item nehalem
27405 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27406 SSE4.1, SSE4.2 and POPCNT instruction set support.
27407
27408 @item westmere
27409 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27410 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27411
27412 @item sandybridge
27413 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27414 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27415
27416 @item ivybridge
27417 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27418 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27419 instruction set support.
27420
27421 @item haswell
27422 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27423 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27424 BMI, BMI2 and F16C instruction set support.
27425
27426 @item broadwell
27427 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27428 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27429 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27430
27431 @item skylake
27432 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27433 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27434 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27435 XSAVES instruction set support.
27436
27437 @item bonnell
27438 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27439 instruction set support.
27440
27441 @item silvermont
27442 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27443 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27444
27445 @item goldmont
27446 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27447 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27448 instruction set support.
27449
27450 @item goldmont-plus
27451 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27452 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27453 PTWRITE, RDPID, SGX and UMIP instruction set support.
27454
27455 @item tremont
27456 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27457 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27458 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27459
27460 @item knl
27461 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27462 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27463 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27464 AVX512CD instruction set support.
27465
27466 @item knm
27467 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27468 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27469 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27470 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27471
27472 @item skylake-avx512
27473 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27474 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27475 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27476 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27477
27478 @item cannonlake
27479 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27480 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27481 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27482 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27483 AVX512IFMA, SHA and UMIP instruction set support.
27484
27485 @item icelake-client
27486 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27487 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27488 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27489 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27490 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27491 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27492
27493 @item icelake-server
27494 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27495 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27496 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27497 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27498 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27499 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27500 set support.
27501
27502 @item cascadelake
27503 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27504 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27505 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27506 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27507
27508 @item k6
27509 AMD K6 CPU with MMX instruction set support.
27510
27511 @item k6-2
27512 @itemx k6-3
27513 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27514
27515 @item athlon
27516 @itemx athlon-tbird
27517 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27518 support.
27519
27520 @item athlon-4
27521 @itemx athlon-xp
27522 @itemx athlon-mp
27523 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27524 instruction set support.
27525
27526 @item k8
27527 @itemx opteron
27528 @itemx athlon64
27529 @itemx athlon-fx
27530 Processors based on the AMD K8 core with x86-64 instruction set support,
27531 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27532 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27533 instruction set extensions.)
27534
27535 @item k8-sse3
27536 @itemx opteron-sse3
27537 @itemx athlon64-sse3
27538 Improved versions of AMD K8 cores with SSE3 instruction set support.
27539
27540 @item amdfam10
27541 @itemx barcelona
27542 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27543 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27544 instruction set extensions.)
27545
27546 @item bdver1
27547 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27548 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27549 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27550 @item bdver2
27551 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27552 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27553 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27554 extensions.)
27555 @item bdver3
27556 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27557 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27558 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27559 64-bit instruction set extensions.
27560 @item bdver4
27561 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27562 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27563 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27564 SSE4.2, ABM and 64-bit instruction set extensions.
27565
27566 @item znver1
27567 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27568 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27569 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27570 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27571 instruction set extensions.
27572 @item znver2
27573 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27574 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27575 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27576 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27577 instruction set extensions.)
27578
27579
27580 @item btver1
27581 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27582 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27583 instruction set extensions.)
27584
27585 @item btver2
27586 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27587 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27588 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27589
27590 @item winchip-c6
27591 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27592 set support.
27593
27594 @item winchip2
27595 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27596 instruction set support.
27597
27598 @item c3
27599 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27600 (No scheduling is implemented for this chip.)
27601
27602 @item c3-2
27603 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27604 (No scheduling is implemented for this chip.)
27605
27606 @item c7
27607 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27608 (No scheduling is implemented for this chip.)
27609
27610 @item samuel-2
27611 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27612 (No scheduling is implemented for this chip.)
27613
27614 @item nehemiah
27615 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27616 (No scheduling is implemented for this chip.)
27617
27618 @item esther
27619 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27620 (No scheduling is implemented for this chip.)
27621
27622 @item eden-x2
27623 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27624 (No scheduling is implemented for this chip.)
27625
27626 @item eden-x4
27627 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27628 AVX and AVX2 instruction set support.
27629 (No scheduling is implemented for this chip.)
27630
27631 @item nano
27632 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27633 instruction set support.
27634 (No scheduling is implemented for this chip.)
27635
27636 @item nano-1000
27637 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27638 instruction set support.
27639 (No scheduling is implemented for this chip.)
27640
27641 @item nano-2000
27642 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27643 instruction set support.
27644 (No scheduling is implemented for this chip.)
27645
27646 @item nano-3000
27647 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27648 instruction set support.
27649 (No scheduling is implemented for this chip.)
27650
27651 @item nano-x2
27652 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27653 instruction set support.
27654 (No scheduling is implemented for this chip.)
27655
27656 @item nano-x4
27657 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27658 instruction set support.
27659 (No scheduling is implemented for this chip.)
27660
27661 @item geode
27662 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27663 @end table
27664
27665 @item -mtune=@var{cpu-type}
27666 @opindex mtune
27667 Tune to @var{cpu-type} everything applicable about the generated code, except
27668 for the ABI and the set of available instructions.
27669 While picking a specific @var{cpu-type} schedules things appropriately
27670 for that particular chip, the compiler does not generate any code that
27671 cannot run on the default machine type unless you use a
27672 @option{-march=@var{cpu-type}} option.
27673 For example, if GCC is configured for i686-pc-linux-gnu
27674 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27675 but still runs on i686 machines.
27676
27677 The choices for @var{cpu-type} are the same as for @option{-march}.
27678 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27679
27680 @table @samp
27681 @item generic
27682 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27683 If you know the CPU on which your code will run, then you should use
27684 the corresponding @option{-mtune} or @option{-march} option instead of
27685 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27686 of your application will have, then you should use this option.
27687
27688 As new processors are deployed in the marketplace, the behavior of this
27689 option will change. Therefore, if you upgrade to a newer version of
27690 GCC, code generation controlled by this option will change to reflect
27691 the processors
27692 that are most common at the time that version of GCC is released.
27693
27694 There is no @option{-march=generic} option because @option{-march}
27695 indicates the instruction set the compiler can use, and there is no
27696 generic instruction set applicable to all processors. In contrast,
27697 @option{-mtune} indicates the processor (or, in this case, collection of
27698 processors) for which the code is optimized.
27699
27700 @item intel
27701 Produce code optimized for the most current Intel processors, which are
27702 Haswell and Silvermont for this version of GCC. If you know the CPU
27703 on which your code will run, then you should use the corresponding
27704 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27705 But, if you want your application performs better on both Haswell and
27706 Silvermont, then you should use this option.
27707
27708 As new Intel processors are deployed in the marketplace, the behavior of
27709 this option will change. Therefore, if you upgrade to a newer version of
27710 GCC, code generation controlled by this option will change to reflect
27711 the most current Intel processors at the time that version of GCC is
27712 released.
27713
27714 There is no @option{-march=intel} option because @option{-march} indicates
27715 the instruction set the compiler can use, and there is no common
27716 instruction set applicable to all processors. In contrast,
27717 @option{-mtune} indicates the processor (or, in this case, collection of
27718 processors) for which the code is optimized.
27719 @end table
27720
27721 @item -mcpu=@var{cpu-type}
27722 @opindex mcpu
27723 A deprecated synonym for @option{-mtune}.
27724
27725 @item -mfpmath=@var{unit}
27726 @opindex mfpmath
27727 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27728 for @var{unit} are:
27729
27730 @table @samp
27731 @item 387
27732 Use the standard 387 floating-point coprocessor present on the majority of chips and
27733 emulated otherwise. Code compiled with this option runs almost everywhere.
27734 The temporary results are computed in 80-bit precision instead of the precision
27735 specified by the type, resulting in slightly different results compared to most
27736 of other chips. See @option{-ffloat-store} for more detailed description.
27737
27738 This is the default choice for non-Darwin x86-32 targets.
27739
27740 @item sse
27741 Use scalar floating-point instructions present in the SSE instruction set.
27742 This instruction set is supported by Pentium III and newer chips,
27743 and in the AMD line
27744 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27745 instruction set supports only single-precision arithmetic, thus the double and
27746 extended-precision arithmetic are still done using 387. A later version, present
27747 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27748 arithmetic too.
27749
27750 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27751 or @option{-msse2} switches to enable SSE extensions and make this option
27752 effective. For the x86-64 compiler, these extensions are enabled by default.
27753
27754 The resulting code should be considerably faster in the majority of cases and avoid
27755 the numerical instability problems of 387 code, but may break some existing
27756 code that expects temporaries to be 80 bits.
27757
27758 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27759 and the default choice for x86-32 targets with the SSE2 instruction set
27760 when @option{-ffast-math} is enabled.
27761
27762 @item sse,387
27763 @itemx sse+387
27764 @itemx both
27765 Attempt to utilize both instruction sets at once. This effectively doubles the
27766 amount of available registers, and on chips with separate execution units for
27767 387 and SSE the execution resources too. Use this option with care, as it is
27768 still experimental, because the GCC register allocator does not model separate
27769 functional units well, resulting in unstable performance.
27770 @end table
27771
27772 @item -masm=@var{dialect}
27773 @opindex masm=@var{dialect}
27774 Output assembly instructions using selected @var{dialect}. Also affects
27775 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27776 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27777 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27778 not support @samp{intel}.
27779
27780 @item -mieee-fp
27781 @itemx -mno-ieee-fp
27782 @opindex mieee-fp
27783 @opindex mno-ieee-fp
27784 Control whether or not the compiler uses IEEE floating-point
27785 comparisons. These correctly handle the case where the result of a
27786 comparison is unordered.
27787
27788 @item -m80387
27789 @itemx -mhard-float
27790 @opindex 80387
27791 @opindex mhard-float
27792 Generate output containing 80387 instructions for floating point.
27793
27794 @item -mno-80387
27795 @itemx -msoft-float
27796 @opindex no-80387
27797 @opindex msoft-float
27798 Generate output containing library calls for floating point.
27799
27800 @strong{Warning:} the requisite libraries are not part of GCC@.
27801 Normally the facilities of the machine's usual C compiler are used, but
27802 this cannot be done directly in cross-compilation. You must make your
27803 own arrangements to provide suitable library functions for
27804 cross-compilation.
27805
27806 On machines where a function returns floating-point results in the 80387
27807 register stack, some floating-point opcodes may be emitted even if
27808 @option{-msoft-float} is used.
27809
27810 @item -mno-fp-ret-in-387
27811 @opindex mno-fp-ret-in-387
27812 @opindex mfp-ret-in-387
27813 Do not use the FPU registers for return values of functions.
27814
27815 The usual calling convention has functions return values of types
27816 @code{float} and @code{double} in an FPU register, even if there
27817 is no FPU@. The idea is that the operating system should emulate
27818 an FPU@.
27819
27820 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27821 in ordinary CPU registers instead.
27822
27823 @item -mno-fancy-math-387
27824 @opindex mno-fancy-math-387
27825 @opindex mfancy-math-387
27826 Some 387 emulators do not support the @code{sin}, @code{cos} and
27827 @code{sqrt} instructions for the 387. Specify this option to avoid
27828 generating those instructions.
27829 This option is overridden when @option{-march}
27830 indicates that the target CPU always has an FPU and so the
27831 instruction does not need emulation. These
27832 instructions are not generated unless you also use the
27833 @option{-funsafe-math-optimizations} switch.
27834
27835 @item -malign-double
27836 @itemx -mno-align-double
27837 @opindex malign-double
27838 @opindex mno-align-double
27839 Control whether GCC aligns @code{double}, @code{long double}, and
27840 @code{long long} variables on a two-word boundary or a one-word
27841 boundary. Aligning @code{double} variables on a two-word boundary
27842 produces code that runs somewhat faster on a Pentium at the
27843 expense of more memory.
27844
27845 On x86-64, @option{-malign-double} is enabled by default.
27846
27847 @strong{Warning:} if you use the @option{-malign-double} switch,
27848 structures containing the above types are aligned differently than
27849 the published application binary interface specifications for the x86-32
27850 and are not binary compatible with structures in code compiled
27851 without that switch.
27852
27853 @item -m96bit-long-double
27854 @itemx -m128bit-long-double
27855 @opindex m96bit-long-double
27856 @opindex m128bit-long-double
27857 These switches control the size of @code{long double} type. The x86-32
27858 application binary interface specifies the size to be 96 bits,
27859 so @option{-m96bit-long-double} is the default in 32-bit mode.
27860
27861 Modern architectures (Pentium and newer) prefer @code{long double}
27862 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27863 conforming to the ABI, this is not possible. So specifying
27864 @option{-m128bit-long-double} aligns @code{long double}
27865 to a 16-byte boundary by padding the @code{long double} with an additional
27866 32-bit zero.
27867
27868 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27869 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27870
27871 Notice that neither of these options enable any extra precision over the x87
27872 standard of 80 bits for a @code{long double}.
27873
27874 @strong{Warning:} if you override the default value for your target ABI, this
27875 changes the size of
27876 structures and arrays containing @code{long double} variables,
27877 as well as modifying the function calling convention for functions taking
27878 @code{long double}. Hence they are not binary-compatible
27879 with code compiled without that switch.
27880
27881 @item -mlong-double-64
27882 @itemx -mlong-double-80
27883 @itemx -mlong-double-128
27884 @opindex mlong-double-64
27885 @opindex mlong-double-80
27886 @opindex mlong-double-128
27887 These switches control the size of @code{long double} type. A size
27888 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27889 type. This is the default for 32-bit Bionic C library. A size
27890 of 128 bits makes the @code{long double} type equivalent to the
27891 @code{__float128} type. This is the default for 64-bit Bionic C library.
27892
27893 @strong{Warning:} if you override the default value for your target ABI, this
27894 changes the size of
27895 structures and arrays containing @code{long double} variables,
27896 as well as modifying the function calling convention for functions taking
27897 @code{long double}. Hence they are not binary-compatible
27898 with code compiled without that switch.
27899
27900 @item -malign-data=@var{type}
27901 @opindex malign-data
27902 Control how GCC aligns variables. Supported values for @var{type} are
27903 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27904 and earlier, @samp{abi} uses alignment value as specified by the
27905 psABI, and @samp{cacheline} uses increased alignment value to match
27906 the cache line size. @samp{compat} is the default.
27907
27908 @item -mlarge-data-threshold=@var{threshold}
27909 @opindex mlarge-data-threshold
27910 When @option{-mcmodel=medium} is specified, data objects larger than
27911 @var{threshold} are placed in the large data section. This value must be the
27912 same across all objects linked into the binary, and defaults to 65535.
27913
27914 @item -mrtd
27915 @opindex mrtd
27916 Use a different function-calling convention, in which functions that
27917 take a fixed number of arguments return with the @code{ret @var{num}}
27918 instruction, which pops their arguments while returning. This saves one
27919 instruction in the caller since there is no need to pop the arguments
27920 there.
27921
27922 You can specify that an individual function is called with this calling
27923 sequence with the function attribute @code{stdcall}. You can also
27924 override the @option{-mrtd} option by using the function attribute
27925 @code{cdecl}. @xref{Function Attributes}.
27926
27927 @strong{Warning:} this calling convention is incompatible with the one
27928 normally used on Unix, so you cannot use it if you need to call
27929 libraries compiled with the Unix compiler.
27930
27931 Also, you must provide function prototypes for all functions that
27932 take variable numbers of arguments (including @code{printf});
27933 otherwise incorrect code is generated for calls to those
27934 functions.
27935
27936 In addition, seriously incorrect code results if you call a
27937 function with too many arguments. (Normally, extra arguments are
27938 harmlessly ignored.)
27939
27940 @item -mregparm=@var{num}
27941 @opindex mregparm
27942 Control how many registers are used to pass integer arguments. By
27943 default, no registers are used to pass arguments, and at most 3
27944 registers can be used. You can control this behavior for a specific
27945 function by using the function attribute @code{regparm}.
27946 @xref{Function Attributes}.
27947
27948 @strong{Warning:} if you use this switch, and
27949 @var{num} is nonzero, then you must build all modules with the same
27950 value, including any libraries. This includes the system libraries and
27951 startup modules.
27952
27953 @item -msseregparm
27954 @opindex msseregparm
27955 Use SSE register passing conventions for float and double arguments
27956 and return values. You can control this behavior for a specific
27957 function by using the function attribute @code{sseregparm}.
27958 @xref{Function Attributes}.
27959
27960 @strong{Warning:} if you use this switch then you must build all
27961 modules with the same value, including any libraries. This includes
27962 the system libraries and startup modules.
27963
27964 @item -mvect8-ret-in-mem
27965 @opindex mvect8-ret-in-mem
27966 Return 8-byte vectors in memory instead of MMX registers. This is the
27967 default on VxWorks to match the ABI of the Sun Studio compilers until
27968 version 12. @emph{Only} use this option if you need to remain
27969 compatible with existing code produced by those previous compiler
27970 versions or older versions of GCC@.
27971
27972 @item -mpc32
27973 @itemx -mpc64
27974 @itemx -mpc80
27975 @opindex mpc32
27976 @opindex mpc64
27977 @opindex mpc80
27978
27979 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27980 is specified, the significands of results of floating-point operations are
27981 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27982 significands of results of floating-point operations to 53 bits (double
27983 precision) and @option{-mpc80} rounds the significands of results of
27984 floating-point operations to 64 bits (extended double precision), which is
27985 the default. When this option is used, floating-point operations in higher
27986 precisions are not available to the programmer without setting the FPU
27987 control word explicitly.
27988
27989 Setting the rounding of floating-point operations to less than the default
27990 80 bits can speed some programs by 2% or more. Note that some mathematical
27991 libraries assume that extended-precision (80-bit) floating-point operations
27992 are enabled by default; routines in such libraries could suffer significant
27993 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27994 when this option is used to set the precision to less than extended precision.
27995
27996 @item -mstackrealign
27997 @opindex mstackrealign
27998 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27999 option generates an alternate prologue and epilogue that realigns the
28000 run-time stack if necessary. This supports mixing legacy codes that keep
28001 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
28002 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
28003 applicable to individual functions.
28004
28005 @item -mpreferred-stack-boundary=@var{num}
28006 @opindex mpreferred-stack-boundary
28007 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28008 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28009 the default is 4 (16 bytes or 128 bits).
28010
28011 @strong{Warning:} When generating code for the x86-64 architecture with
28012 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
28013 used to keep the stack boundary aligned to 8 byte boundary. Since
28014 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
28015 intended to be used in controlled environment where stack space is
28016 important limitation. This option leads to wrong code when functions
28017 compiled with 16 byte stack alignment (such as functions from a standard
28018 library) are called with misaligned stack. In this case, SSE
28019 instructions may lead to misaligned memory access traps. In addition,
28020 variable arguments are handled incorrectly for 16 byte aligned
28021 objects (including x87 long double and __int128), leading to wrong
28022 results. You must build all modules with
28023 @option{-mpreferred-stack-boundary=3}, including any libraries. This
28024 includes the system libraries and startup modules.
28025
28026 @item -mincoming-stack-boundary=@var{num}
28027 @opindex mincoming-stack-boundary
28028 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28029 boundary. If @option{-mincoming-stack-boundary} is not specified,
28030 the one specified by @option{-mpreferred-stack-boundary} is used.
28031
28032 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28033 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28034 suffer significant run time performance penalties. On Pentium III, the
28035 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28036 properly if it is not 16-byte aligned.
28037
28038 To ensure proper alignment of this values on the stack, the stack boundary
28039 must be as aligned as that required by any value stored on the stack.
28040 Further, every function must be generated such that it keeps the stack
28041 aligned. Thus calling a function compiled with a higher preferred
28042 stack boundary from a function compiled with a lower preferred stack
28043 boundary most likely misaligns the stack. It is recommended that
28044 libraries that use callbacks always use the default setting.
28045
28046 This extra alignment does consume extra stack space, and generally
28047 increases code size. Code that is sensitive to stack space usage, such
28048 as embedded systems and operating system kernels, may want to reduce the
28049 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28050
28051 @need 200
28052 @item -mmmx
28053 @opindex mmmx
28054 @need 200
28055 @itemx -msse
28056 @opindex msse
28057 @need 200
28058 @itemx -msse2
28059 @opindex msse2
28060 @need 200
28061 @itemx -msse3
28062 @opindex msse3
28063 @need 200
28064 @itemx -mssse3
28065 @opindex mssse3
28066 @need 200
28067 @itemx -msse4
28068 @opindex msse4
28069 @need 200
28070 @itemx -msse4a
28071 @opindex msse4a
28072 @need 200
28073 @itemx -msse4.1
28074 @opindex msse4.1
28075 @need 200
28076 @itemx -msse4.2
28077 @opindex msse4.2
28078 @need 200
28079 @itemx -mavx
28080 @opindex mavx
28081 @need 200
28082 @itemx -mavx2
28083 @opindex mavx2
28084 @need 200
28085 @itemx -mavx512f
28086 @opindex mavx512f
28087 @need 200
28088 @itemx -mavx512pf
28089 @opindex mavx512pf
28090 @need 200
28091 @itemx -mavx512er
28092 @opindex mavx512er
28093 @need 200
28094 @itemx -mavx512cd
28095 @opindex mavx512cd
28096 @need 200
28097 @itemx -mavx512vl
28098 @opindex mavx512vl
28099 @need 200
28100 @itemx -mavx512bw
28101 @opindex mavx512bw
28102 @need 200
28103 @itemx -mavx512dq
28104 @opindex mavx512dq
28105 @need 200
28106 @itemx -mavx512ifma
28107 @opindex mavx512ifma
28108 @need 200
28109 @itemx -mavx512vbmi
28110 @opindex mavx512vbmi
28111 @need 200
28112 @itemx -msha
28113 @opindex msha
28114 @need 200
28115 @itemx -maes
28116 @opindex maes
28117 @need 200
28118 @itemx -mpclmul
28119 @opindex mpclmul
28120 @need 200
28121 @itemx -mclflushopt
28122 @opindex mclflushopt
28123 @need 200
28124 @itemx -mclwb
28125 @opindex mclwb
28126 @need 200
28127 @itemx -mfsgsbase
28128 @opindex mfsgsbase
28129 @need 200
28130 @itemx -mptwrite
28131 @opindex mptwrite
28132 @need 200
28133 @itemx -mrdrnd
28134 @opindex mrdrnd
28135 @need 200
28136 @itemx -mf16c
28137 @opindex mf16c
28138 @need 200
28139 @itemx -mfma
28140 @opindex mfma
28141 @need 200
28142 @itemx -mpconfig
28143 @opindex mpconfig
28144 @need 200
28145 @itemx -mwbnoinvd
28146 @opindex mwbnoinvd
28147 @need 200
28148 @itemx -mfma4
28149 @opindex mfma4
28150 @need 200
28151 @itemx -mprfchw
28152 @opindex mprfchw
28153 @need 200
28154 @itemx -mrdpid
28155 @opindex mrdpid
28156 @need 200
28157 @itemx -mprefetchwt1
28158 @opindex mprefetchwt1
28159 @need 200
28160 @itemx -mrdseed
28161 @opindex mrdseed
28162 @need 200
28163 @itemx -msgx
28164 @opindex msgx
28165 @need 200
28166 @itemx -mxop
28167 @opindex mxop
28168 @need 200
28169 @itemx -mlwp
28170 @opindex mlwp
28171 @need 200
28172 @itemx -m3dnow
28173 @opindex m3dnow
28174 @need 200
28175 @itemx -m3dnowa
28176 @opindex m3dnowa
28177 @need 200
28178 @itemx -mpopcnt
28179 @opindex mpopcnt
28180 @need 200
28181 @itemx -mabm
28182 @opindex mabm
28183 @need 200
28184 @itemx -madx
28185 @opindex madx
28186 @need 200
28187 @itemx -mbmi
28188 @opindex mbmi
28189 @need 200
28190 @itemx -mbmi2
28191 @opindex mbmi2
28192 @need 200
28193 @itemx -mlzcnt
28194 @opindex mlzcnt
28195 @need 200
28196 @itemx -mfxsr
28197 @opindex mfxsr
28198 @need 200
28199 @itemx -mxsave
28200 @opindex mxsave
28201 @need 200
28202 @itemx -mxsaveopt
28203 @opindex mxsaveopt
28204 @need 200
28205 @itemx -mxsavec
28206 @opindex mxsavec
28207 @need 200
28208 @itemx -mxsaves
28209 @opindex mxsaves
28210 @need 200
28211 @itemx -mrtm
28212 @opindex mrtm
28213 @need 200
28214 @itemx -mhle
28215 @opindex mhle
28216 @need 200
28217 @itemx -mtbm
28218 @opindex mtbm
28219 @need 200
28220 @itemx -mmwaitx
28221 @opindex mmwaitx
28222 @need 200
28223 @itemx -mclzero
28224 @opindex mclzero
28225 @need 200
28226 @itemx -mpku
28227 @opindex mpku
28228 @need 200
28229 @itemx -mavx512vbmi2
28230 @opindex mavx512vbmi2
28231 @need 200
28232 @itemx -mavx512bf16
28233 @opindex mavx512bf16
28234 @need 200
28235 @itemx -mgfni
28236 @opindex mgfni
28237 @need 200
28238 @itemx -mvaes
28239 @opindex mvaes
28240 @need 200
28241 @itemx -mwaitpkg
28242 @opindex mwaitpkg
28243 @need 200
28244 @itemx -mvpclmulqdq
28245 @opindex mvpclmulqdq
28246 @need 200
28247 @itemx -mavx512bitalg
28248 @opindex mavx512bitalg
28249 @need 200
28250 @itemx -mmovdiri
28251 @opindex mmovdiri
28252 @need 200
28253 @itemx -mmovdir64b
28254 @opindex mmovdir64b
28255 @need 200
28256 @itemx -menqcmd
28257 @opindex menqcmd
28258 @need 200
28259 @itemx -mavx512vpopcntdq
28260 @opindex mavx512vpopcntdq
28261 @need 200
28262 @itemx -mavx512vp2intersect
28263 @opindex mavx512vp2intersect
28264 @need 200
28265 @itemx -mavx5124fmaps
28266 @opindex mavx5124fmaps
28267 @need 200
28268 @itemx -mavx512vnni
28269 @opindex mavx512vnni
28270 @need 200
28271 @itemx -mavx5124vnniw
28272 @opindex mavx5124vnniw
28273 @need 200
28274 @itemx -mcldemote
28275 @opindex mcldemote
28276 These switches enable the use of instructions in the MMX, SSE,
28277 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28278 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28279 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28280 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28281 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28282 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28283 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28284 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28285 extended instruction sets. Each has a corresponding @option{-mno-} option to
28286 disable use of these instructions.
28287
28288 These extensions are also available as built-in functions: see
28289 @ref{x86 Built-in Functions}, for details of the functions enabled and
28290 disabled by these switches.
28291
28292 To generate SSE/SSE2 instructions automatically from floating-point
28293 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28294
28295 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28296 generates new AVX instructions or AVX equivalence for all SSEx instructions
28297 when needed.
28298
28299 These options enable GCC to use these extended instructions in
28300 generated code, even without @option{-mfpmath=sse}. Applications that
28301 perform run-time CPU detection must compile separate files for each
28302 supported architecture, using the appropriate flags. In particular,
28303 the file containing the CPU detection code should be compiled without
28304 these options.
28305
28306 @item -mdump-tune-features
28307 @opindex mdump-tune-features
28308 This option instructs GCC to dump the names of the x86 performance
28309 tuning features and default settings. The names can be used in
28310 @option{-mtune-ctrl=@var{feature-list}}.
28311
28312 @item -mtune-ctrl=@var{feature-list}
28313 @opindex mtune-ctrl=@var{feature-list}
28314 This option is used to do fine grain control of x86 code generation features.
28315 @var{feature-list} is a comma separated list of @var{feature} names. See also
28316 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28317 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28318 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28319 developers. Using it may lead to code paths not covered by testing and can
28320 potentially result in compiler ICEs or runtime errors.
28321
28322 @item -mno-default
28323 @opindex mno-default
28324 This option instructs GCC to turn off all tunable features. See also
28325 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28326
28327 @item -mcld
28328 @opindex mcld
28329 This option instructs GCC to emit a @code{cld} instruction in the prologue
28330 of functions that use string instructions. String instructions depend on
28331 the DF flag to select between autoincrement or autodecrement mode. While the
28332 ABI specifies the DF flag to be cleared on function entry, some operating
28333 systems violate this specification by not clearing the DF flag in their
28334 exception dispatchers. The exception handler can be invoked with the DF flag
28335 set, which leads to wrong direction mode when string instructions are used.
28336 This option can be enabled by default on 32-bit x86 targets by configuring
28337 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28338 instructions can be suppressed with the @option{-mno-cld} compiler option
28339 in this case.
28340
28341 @item -mvzeroupper
28342 @opindex mvzeroupper
28343 This option instructs GCC to emit a @code{vzeroupper} instruction
28344 before a transfer of control flow out of the function to minimize
28345 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28346 intrinsics.
28347
28348 @item -mprefer-avx128
28349 @opindex mprefer-avx128
28350 This option instructs GCC to use 128-bit AVX instructions instead of
28351 256-bit AVX instructions in the auto-vectorizer.
28352
28353 @item -mprefer-vector-width=@var{opt}
28354 @opindex mprefer-vector-width
28355 This option instructs GCC to use @var{opt}-bit vector width in instructions
28356 instead of default on the selected platform.
28357
28358 @table @samp
28359 @item none
28360 No extra limitations applied to GCC other than defined by the selected platform.
28361
28362 @item 128
28363 Prefer 128-bit vector width for instructions.
28364
28365 @item 256
28366 Prefer 256-bit vector width for instructions.
28367
28368 @item 512
28369 Prefer 512-bit vector width for instructions.
28370 @end table
28371
28372 @item -mcx16
28373 @opindex mcx16
28374 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28375 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28376 objects. This is useful for atomic updates of data structures exceeding one
28377 machine word in size. The compiler uses this instruction to implement
28378 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28379 128-bit integers, a library call is always used.
28380
28381 @item -msahf
28382 @opindex msahf
28383 This option enables generation of @code{SAHF} instructions in 64-bit code.
28384 Early Intel Pentium 4 CPUs with Intel 64 support,
28385 prior to the introduction of Pentium 4 G1 step in December 2005,
28386 lacked the @code{LAHF} and @code{SAHF} instructions
28387 which are supported by AMD64.
28388 These are load and store instructions, respectively, for certain status flags.
28389 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28390 @code{drem}, and @code{remainder} built-in functions;
28391 see @ref{Other Builtins} for details.
28392
28393 @item -mmovbe
28394 @opindex mmovbe
28395 This option enables use of the @code{movbe} instruction to implement
28396 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28397
28398 @item -mshstk
28399 @opindex mshstk
28400 The @option{-mshstk} option enables shadow stack built-in functions
28401 from x86 Control-flow Enforcement Technology (CET).
28402
28403 @item -mcrc32
28404 @opindex mcrc32
28405 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28406 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28407 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28408
28409 @item -mrecip
28410 @opindex mrecip
28411 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28412 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28413 with an additional Newton-Raphson step
28414 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28415 (and their vectorized
28416 variants) for single-precision floating-point arguments. These instructions
28417 are generated only when @option{-funsafe-math-optimizations} is enabled
28418 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28419 Note that while the throughput of the sequence is higher than the throughput
28420 of the non-reciprocal instruction, the precision of the sequence can be
28421 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28422
28423 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28424 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28425 combination), and doesn't need @option{-mrecip}.
28426
28427 Also note that GCC emits the above sequence with additional Newton-Raphson step
28428 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28429 already with @option{-ffast-math} (or the above option combination), and
28430 doesn't need @option{-mrecip}.
28431
28432 @item -mrecip=@var{opt}
28433 @opindex mrecip=opt
28434 This option controls which reciprocal estimate instructions
28435 may be used. @var{opt} is a comma-separated list of options, which may
28436 be preceded by a @samp{!} to invert the option:
28437
28438 @table @samp
28439 @item all
28440 Enable all estimate instructions.
28441
28442 @item default
28443 Enable the default instructions, equivalent to @option{-mrecip}.
28444
28445 @item none
28446 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28447
28448 @item div
28449 Enable the approximation for scalar division.
28450
28451 @item vec-div
28452 Enable the approximation for vectorized division.
28453
28454 @item sqrt
28455 Enable the approximation for scalar square root.
28456
28457 @item vec-sqrt
28458 Enable the approximation for vectorized square root.
28459 @end table
28460
28461 So, for example, @option{-mrecip=all,!sqrt} enables
28462 all of the reciprocal approximations, except for square root.
28463
28464 @item -mveclibabi=@var{type}
28465 @opindex mveclibabi
28466 Specifies the ABI type to use for vectorizing intrinsics using an
28467 external library. Supported values for @var{type} are @samp{svml}
28468 for the Intel short
28469 vector math library and @samp{acml} for the AMD math core library.
28470 To use this option, both @option{-ftree-vectorize} and
28471 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28472 ABI-compatible library must be specified at link time.
28473
28474 GCC currently emits calls to @code{vmldExp2},
28475 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28476 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28477 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28478 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28479 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28480 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28481 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28482 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28483 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28484 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28485 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28486 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28487 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28488 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28489 when @option{-mveclibabi=acml} is used.
28490
28491 @item -mabi=@var{name}
28492 @opindex mabi
28493 Generate code for the specified calling convention. Permissible values
28494 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28495 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28496 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28497 You can control this behavior for specific functions by
28498 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28499 @xref{Function Attributes}.
28500
28501 @item -mforce-indirect-call
28502 @opindex mforce-indirect-call
28503 Force all calls to functions to be indirect. This is useful
28504 when using Intel Processor Trace where it generates more precise timing
28505 information for function calls.
28506
28507 @item -mmanual-endbr
28508 @opindex mmanual-endbr
28509 Insert ENDBR instruction at function entry only via the @code{cf_check}
28510 function attribute. This is useful when used with the option
28511 @option{-fcf-protection=branch} to control ENDBR insertion at the
28512 function entry.
28513
28514 @item -mcall-ms2sysv-xlogues
28515 @opindex mcall-ms2sysv-xlogues
28516 @opindex mno-call-ms2sysv-xlogues
28517 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28518 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28519 default, the code for saving and restoring these registers is emitted inline,
28520 resulting in fairly lengthy prologues and epilogues. Using
28521 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28522 use stubs in the static portion of libgcc to perform these saves and restores,
28523 thus reducing function size at the cost of a few extra instructions.
28524
28525 @item -mtls-dialect=@var{type}
28526 @opindex mtls-dialect
28527 Generate code to access thread-local storage using the @samp{gnu} or
28528 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28529 @samp{gnu2} is more efficient, but it may add compile- and run-time
28530 requirements that cannot be satisfied on all systems.
28531
28532 @item -mpush-args
28533 @itemx -mno-push-args
28534 @opindex mpush-args
28535 @opindex mno-push-args
28536 Use PUSH operations to store outgoing parameters. This method is shorter
28537 and usually equally fast as method using SUB/MOV operations and is enabled
28538 by default. In some cases disabling it may improve performance because of
28539 improved scheduling and reduced dependencies.
28540
28541 @item -maccumulate-outgoing-args
28542 @opindex maccumulate-outgoing-args
28543 If enabled, the maximum amount of space required for outgoing arguments is
28544 computed in the function prologue. This is faster on most modern CPUs
28545 because of reduced dependencies, improved scheduling and reduced stack usage
28546 when the preferred stack boundary is not equal to 2. The drawback is a notable
28547 increase in code size. This switch implies @option{-mno-push-args}.
28548
28549 @item -mthreads
28550 @opindex mthreads
28551 Support thread-safe exception handling on MinGW. Programs that rely
28552 on thread-safe exception handling must compile and link all code with the
28553 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28554 @option{-D_MT}; when linking, it links in a special thread helper library
28555 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28556
28557 @item -mms-bitfields
28558 @itemx -mno-ms-bitfields
28559 @opindex mms-bitfields
28560 @opindex mno-ms-bitfields
28561
28562 Enable/disable bit-field layout compatible with the native Microsoft
28563 Windows compiler.
28564
28565 If @code{packed} is used on a structure, or if bit-fields are used,
28566 it may be that the Microsoft ABI lays out the structure differently
28567 than the way GCC normally does. Particularly when moving packed
28568 data between functions compiled with GCC and the native Microsoft compiler
28569 (either via function call or as data in a file), it may be necessary to access
28570 either format.
28571
28572 This option is enabled by default for Microsoft Windows
28573 targets. This behavior can also be controlled locally by use of variable
28574 or type attributes. For more information, see @ref{x86 Variable Attributes}
28575 and @ref{x86 Type Attributes}.
28576
28577 The Microsoft structure layout algorithm is fairly simple with the exception
28578 of the bit-field packing.
28579 The padding and alignment of members of structures and whether a bit-field
28580 can straddle a storage-unit boundary are determine by these rules:
28581
28582 @enumerate
28583 @item Structure members are stored sequentially in the order in which they are
28584 declared: the first member has the lowest memory address and the last member
28585 the highest.
28586
28587 @item Every data object has an alignment requirement. The alignment requirement
28588 for all data except structures, unions, and arrays is either the size of the
28589 object or the current packing size (specified with either the
28590 @code{aligned} attribute or the @code{pack} pragma),
28591 whichever is less. For structures, unions, and arrays,
28592 the alignment requirement is the largest alignment requirement of its members.
28593 Every object is allocated an offset so that:
28594
28595 @smallexample
28596 offset % alignment_requirement == 0
28597 @end smallexample
28598
28599 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28600 unit if the integral types are the same size and if the next bit-field fits
28601 into the current allocation unit without crossing the boundary imposed by the
28602 common alignment requirements of the bit-fields.
28603 @end enumerate
28604
28605 MSVC interprets zero-length bit-fields in the following ways:
28606
28607 @enumerate
28608 @item If a zero-length bit-field is inserted between two bit-fields that
28609 are normally coalesced, the bit-fields are not coalesced.
28610
28611 For example:
28612
28613 @smallexample
28614 struct
28615 @{
28616 unsigned long bf_1 : 12;
28617 unsigned long : 0;
28618 unsigned long bf_2 : 12;
28619 @} t1;
28620 @end smallexample
28621
28622 @noindent
28623 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28624 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28625
28626 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28627 alignment of the zero-length bit-field is greater than the member that follows it,
28628 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28629
28630 For example:
28631
28632 @smallexample
28633 struct
28634 @{
28635 char foo : 4;
28636 short : 0;
28637 char bar;
28638 @} t2;
28639
28640 struct
28641 @{
28642 char foo : 4;
28643 short : 0;
28644 double bar;
28645 @} t3;
28646 @end smallexample
28647
28648 @noindent
28649 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28650 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28651 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28652 of the structure.
28653
28654 Taking this into account, it is important to note the following:
28655
28656 @enumerate
28657 @item If a zero-length bit-field follows a normal bit-field, the type of the
28658 zero-length bit-field may affect the alignment of the structure as whole. For
28659 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28660 normal bit-field, and is of type short.
28661
28662 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28663 still affect the alignment of the structure:
28664
28665 @smallexample
28666 struct
28667 @{
28668 char foo : 6;
28669 long : 0;
28670 @} t4;
28671 @end smallexample
28672
28673 @noindent
28674 Here, @code{t4} takes up 4 bytes.
28675 @end enumerate
28676
28677 @item Zero-length bit-fields following non-bit-field members are ignored:
28678
28679 @smallexample
28680 struct
28681 @{
28682 char foo;
28683 long : 0;
28684 char bar;
28685 @} t5;
28686 @end smallexample
28687
28688 @noindent
28689 Here, @code{t5} takes up 2 bytes.
28690 @end enumerate
28691
28692
28693 @item -mno-align-stringops
28694 @opindex mno-align-stringops
28695 @opindex malign-stringops
28696 Do not align the destination of inlined string operations. This switch reduces
28697 code size and improves performance in case the destination is already aligned,
28698 but GCC doesn't know about it.
28699
28700 @item -minline-all-stringops
28701 @opindex minline-all-stringops
28702 By default GCC inlines string operations only when the destination is
28703 known to be aligned to least a 4-byte boundary.
28704 This enables more inlining and increases code
28705 size, but may improve performance of code that depends on fast
28706 @code{memcpy} and @code{memset} for short lengths.
28707 The option enables inline expansion of @code{strlen} for all
28708 pointer alignments.
28709
28710 @item -minline-stringops-dynamically
28711 @opindex minline-stringops-dynamically
28712 For string operations of unknown size, use run-time checks with
28713 inline code for small blocks and a library call for large blocks.
28714
28715 @item -mstringop-strategy=@var{alg}
28716 @opindex mstringop-strategy=@var{alg}
28717 Override the internal decision heuristic for the particular algorithm to use
28718 for inlining string operations. The allowed values for @var{alg} are:
28719
28720 @table @samp
28721 @item rep_byte
28722 @itemx rep_4byte
28723 @itemx rep_8byte
28724 Expand using i386 @code{rep} prefix of the specified size.
28725
28726 @item byte_loop
28727 @itemx loop
28728 @itemx unrolled_loop
28729 Expand into an inline loop.
28730
28731 @item libcall
28732 Always use a library call.
28733 @end table
28734
28735 @item -mmemcpy-strategy=@var{strategy}
28736 @opindex mmemcpy-strategy=@var{strategy}
28737 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28738 should be inlined and what inline algorithm to use when the expected size
28739 of the copy operation is known. @var{strategy}
28740 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28741 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28742 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28743 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28744 in the list must be specified in increasing order. The minimal byte size for
28745 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28746 preceding range.
28747
28748 @item -mmemset-strategy=@var{strategy}
28749 @opindex mmemset-strategy=@var{strategy}
28750 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28751 @code{__builtin_memset} expansion.
28752
28753 @item -momit-leaf-frame-pointer
28754 @opindex momit-leaf-frame-pointer
28755 Don't keep the frame pointer in a register for leaf functions. This
28756 avoids the instructions to save, set up, and restore frame pointers and
28757 makes an extra register available in leaf functions. The option
28758 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28759 which might make debugging harder.
28760
28761 @item -mtls-direct-seg-refs
28762 @itemx -mno-tls-direct-seg-refs
28763 @opindex mtls-direct-seg-refs
28764 Controls whether TLS variables may be accessed with offsets from the
28765 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28766 or whether the thread base pointer must be added. Whether or not this
28767 is valid depends on the operating system, and whether it maps the
28768 segment to cover the entire TLS area.
28769
28770 For systems that use the GNU C Library, the default is on.
28771
28772 @item -msse2avx
28773 @itemx -mno-sse2avx
28774 @opindex msse2avx
28775 Specify that the assembler should encode SSE instructions with VEX
28776 prefix. The option @option{-mavx} turns this on by default.
28777
28778 @item -mfentry
28779 @itemx -mno-fentry
28780 @opindex mfentry
28781 If profiling is active (@option{-pg}), put the profiling
28782 counter call before the prologue.
28783 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28784 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28785
28786 @item -mrecord-mcount
28787 @itemx -mno-record-mcount
28788 @opindex mrecord-mcount
28789 If profiling is active (@option{-pg}), generate a __mcount_loc section
28790 that contains pointers to each profiling call. This is useful for
28791 automatically patching and out calls.
28792
28793 @item -mnop-mcount
28794 @itemx -mno-nop-mcount
28795 @opindex mnop-mcount
28796 If profiling is active (@option{-pg}), generate the calls to
28797 the profiling functions as NOPs. This is useful when they
28798 should be patched in later dynamically. This is likely only
28799 useful together with @option{-mrecord-mcount}.
28800
28801 @item -minstrument-return=@var{type}
28802 @opindex minstrument-return
28803 Instrument function exit in -pg -mfentry instrumented functions with
28804 call to specified function. This only instruments true returns ending
28805 with ret, but not sibling calls ending with jump. Valid types
28806 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28807 or @var{nop5} to generate a 5 byte nop.
28808
28809 @item -mrecord-return
28810 @itemx -mno-record-return
28811 @opindex mrecord-return
28812 Generate a __return_loc section pointing to all return instrumentation code.
28813
28814 @item -mfentry-name=@var{name}
28815 @opindex mfentry-name
28816 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28817
28818 @item -mfentry-section=@var{name}
28819 @opindex mfentry-section
28820 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28821
28822 @item -mskip-rax-setup
28823 @itemx -mno-skip-rax-setup
28824 @opindex mskip-rax-setup
28825 When generating code for the x86-64 architecture with SSE extensions
28826 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28827 register when there are no variable arguments passed in vector registers.
28828
28829 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28830 saving vector registers on stack when passing variable arguments, the
28831 impacts of this option are callees may waste some stack space,
28832 misbehave or jump to a random location. GCC 4.4 or newer don't have
28833 those issues, regardless the RAX register value.
28834
28835 @item -m8bit-idiv
28836 @itemx -mno-8bit-idiv
28837 @opindex m8bit-idiv
28838 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28839 much faster than 32-bit/64-bit integer divide. This option generates a
28840 run-time check. If both dividend and divisor are within range of 0
28841 to 255, 8-bit unsigned integer divide is used instead of
28842 32-bit/64-bit integer divide.
28843
28844 @item -mavx256-split-unaligned-load
28845 @itemx -mavx256-split-unaligned-store
28846 @opindex mavx256-split-unaligned-load
28847 @opindex mavx256-split-unaligned-store
28848 Split 32-byte AVX unaligned load and store.
28849
28850 @item -mstack-protector-guard=@var{guard}
28851 @itemx -mstack-protector-guard-reg=@var{reg}
28852 @itemx -mstack-protector-guard-offset=@var{offset}
28853 @opindex mstack-protector-guard
28854 @opindex mstack-protector-guard-reg
28855 @opindex mstack-protector-guard-offset
28856 Generate stack protection code using canary at @var{guard}. Supported
28857 locations are @samp{global} for global canary or @samp{tls} for per-thread
28858 canary in the TLS block (the default). This option has effect only when
28859 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28860
28861 With the latter choice the options
28862 @option{-mstack-protector-guard-reg=@var{reg}} and
28863 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28864 which segment register (@code{%fs} or @code{%gs}) to use as base register
28865 for reading the canary, and from what offset from that base register.
28866 The default for those is as specified in the relevant ABI.
28867
28868 @item -mgeneral-regs-only
28869 @opindex mgeneral-regs-only
28870 Generate code that uses only the general-purpose registers. This
28871 prevents the compiler from using floating-point, vector, mask and bound
28872 registers.
28873
28874 @item -mindirect-branch=@var{choice}
28875 @opindex mindirect-branch
28876 Convert indirect call and jump with @var{choice}. The default is
28877 @samp{keep}, which keeps indirect call and jump unmodified.
28878 @samp{thunk} converts indirect call and jump to call and return thunk.
28879 @samp{thunk-inline} converts indirect call and jump to inlined call
28880 and return thunk. @samp{thunk-extern} converts indirect call and jump
28881 to external call and return thunk provided in a separate object file.
28882 You can control this behavior for a specific function by using the
28883 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28884
28885 Note that @option{-mcmodel=large} is incompatible with
28886 @option{-mindirect-branch=thunk} and
28887 @option{-mindirect-branch=thunk-extern} since the thunk function may
28888 not be reachable in the large code model.
28889
28890 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28891 @option{-fcf-protection=branch} since the external thunk cannot be modified
28892 to disable control-flow check.
28893
28894 @item -mfunction-return=@var{choice}
28895 @opindex mfunction-return
28896 Convert function return with @var{choice}. The default is @samp{keep},
28897 which keeps function return unmodified. @samp{thunk} converts function
28898 return to call and return thunk. @samp{thunk-inline} converts function
28899 return to inlined call and return thunk. @samp{thunk-extern} converts
28900 function return to external call and return thunk provided in a separate
28901 object file. You can control this behavior for a specific function by
28902 using the function attribute @code{function_return}.
28903 @xref{Function Attributes}.
28904
28905 Note that @option{-mcmodel=large} is incompatible with
28906 @option{-mfunction-return=thunk} and
28907 @option{-mfunction-return=thunk-extern} since the thunk function may
28908 not be reachable in the large code model.
28909
28910
28911 @item -mindirect-branch-register
28912 @opindex mindirect-branch-register
28913 Force indirect call and jump via register.
28914
28915 @end table
28916
28917 These @samp{-m} switches are supported in addition to the above
28918 on x86-64 processors in 64-bit environments.
28919
28920 @table @gcctabopt
28921 @item -m32
28922 @itemx -m64
28923 @itemx -mx32
28924 @itemx -m16
28925 @itemx -miamcu
28926 @opindex m32
28927 @opindex m64
28928 @opindex mx32
28929 @opindex m16
28930 @opindex miamcu
28931 Generate code for a 16-bit, 32-bit or 64-bit environment.
28932 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28933 to 32 bits, and
28934 generates code that runs on any i386 system.
28935
28936 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28937 types to 64 bits, and generates code for the x86-64 architecture.
28938 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28939 and @option{-mdynamic-no-pic} options.
28940
28941 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28942 to 32 bits, and
28943 generates code for the x86-64 architecture.
28944
28945 The @option{-m16} option is the same as @option{-m32}, except for that
28946 it outputs the @code{.code16gcc} assembly directive at the beginning of
28947 the assembly output so that the binary can run in 16-bit mode.
28948
28949 The @option{-miamcu} option generates code which conforms to Intel MCU
28950 psABI. It requires the @option{-m32} option to be turned on.
28951
28952 @item -mno-red-zone
28953 @opindex mno-red-zone
28954 @opindex mred-zone
28955 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28956 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28957 stack pointer that is not modified by signal or interrupt handlers
28958 and therefore can be used for temporary data without adjusting the stack
28959 pointer. The flag @option{-mno-red-zone} disables this red zone.
28960
28961 @item -mcmodel=small
28962 @opindex mcmodel=small
28963 Generate code for the small code model: the program and its symbols must
28964 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28965 Programs can be statically or dynamically linked. This is the default
28966 code model.
28967
28968 @item -mcmodel=kernel
28969 @opindex mcmodel=kernel
28970 Generate code for the kernel code model. The kernel runs in the
28971 negative 2 GB of the address space.
28972 This model has to be used for Linux kernel code.
28973
28974 @item -mcmodel=medium
28975 @opindex mcmodel=medium
28976 Generate code for the medium model: the program is linked in the lower 2
28977 GB of the address space. Small symbols are also placed there. Symbols
28978 with sizes larger than @option{-mlarge-data-threshold} are put into
28979 large data or BSS sections and can be located above 2GB. Programs can
28980 be statically or dynamically linked.
28981
28982 @item -mcmodel=large
28983 @opindex mcmodel=large
28984 Generate code for the large model. This model makes no assumptions
28985 about addresses and sizes of sections.
28986
28987 @item -maddress-mode=long
28988 @opindex maddress-mode=long
28989 Generate code for long address mode. This is only supported for 64-bit
28990 and x32 environments. It is the default address mode for 64-bit
28991 environments.
28992
28993 @item -maddress-mode=short
28994 @opindex maddress-mode=short
28995 Generate code for short address mode. This is only supported for 32-bit
28996 and x32 environments. It is the default address mode for 32-bit and
28997 x32 environments.
28998 @end table
28999
29000 @node x86 Windows Options
29001 @subsection x86 Windows Options
29002 @cindex x86 Windows Options
29003 @cindex Windows Options for x86
29004
29005 These additional options are available for Microsoft Windows targets:
29006
29007 @table @gcctabopt
29008 @item -mconsole
29009 @opindex mconsole
29010 This option
29011 specifies that a console application is to be generated, by
29012 instructing the linker to set the PE header subsystem type
29013 required for console applications.
29014 This option is available for Cygwin and MinGW targets and is
29015 enabled by default on those targets.
29016
29017 @item -mdll
29018 @opindex mdll
29019 This option is available for Cygwin and MinGW targets. It
29020 specifies that a DLL---a dynamic link library---is to be
29021 generated, enabling the selection of the required runtime
29022 startup object and entry point.
29023
29024 @item -mnop-fun-dllimport
29025 @opindex mnop-fun-dllimport
29026 This option is available for Cygwin and MinGW targets. It
29027 specifies that the @code{dllimport} attribute should be ignored.
29028
29029 @item -mthread
29030 @opindex mthread
29031 This option is available for MinGW targets. It specifies
29032 that MinGW-specific thread support is to be used.
29033
29034 @item -municode
29035 @opindex municode
29036 This option is available for MinGW-w64 targets. It causes
29037 the @code{UNICODE} preprocessor macro to be predefined, and
29038 chooses Unicode-capable runtime startup code.
29039
29040 @item -mwin32
29041 @opindex mwin32
29042 This option is available for Cygwin and MinGW targets. It
29043 specifies that the typical Microsoft Windows predefined macros are to
29044 be set in the pre-processor, but does not influence the choice
29045 of runtime library/startup code.
29046
29047 @item -mwindows
29048 @opindex mwindows
29049 This option is available for Cygwin and MinGW targets. It
29050 specifies that a GUI application is to be generated by
29051 instructing the linker to set the PE header subsystem type
29052 appropriately.
29053
29054 @item -fno-set-stack-executable
29055 @opindex fno-set-stack-executable
29056 @opindex fset-stack-executable
29057 This option is available for MinGW targets. It specifies that
29058 the executable flag for the stack used by nested functions isn't
29059 set. This is necessary for binaries running in kernel mode of
29060 Microsoft Windows, as there the User32 API, which is used to set executable
29061 privileges, isn't available.
29062
29063 @item -fwritable-relocated-rdata
29064 @opindex fno-writable-relocated-rdata
29065 @opindex fwritable-relocated-rdata
29066 This option is available for MinGW and Cygwin targets. It specifies
29067 that relocated-data in read-only section is put into the @code{.data}
29068 section. This is a necessary for older runtimes not supporting
29069 modification of @code{.rdata} sections for pseudo-relocation.
29070
29071 @item -mpe-aligned-commons
29072 @opindex mpe-aligned-commons
29073 This option is available for Cygwin and MinGW targets. It
29074 specifies that the GNU extension to the PE file format that
29075 permits the correct alignment of COMMON variables should be
29076 used when generating code. It is enabled by default if
29077 GCC detects that the target assembler found during configuration
29078 supports the feature.
29079 @end table
29080
29081 See also under @ref{x86 Options} for standard options.
29082
29083 @node Xstormy16 Options
29084 @subsection Xstormy16 Options
29085 @cindex Xstormy16 Options
29086
29087 These options are defined for Xstormy16:
29088
29089 @table @gcctabopt
29090 @item -msim
29091 @opindex msim
29092 Choose startup files and linker script suitable for the simulator.
29093 @end table
29094
29095 @node Xtensa Options
29096 @subsection Xtensa Options
29097 @cindex Xtensa Options
29098
29099 These options are supported for Xtensa targets:
29100
29101 @table @gcctabopt
29102 @item -mconst16
29103 @itemx -mno-const16
29104 @opindex mconst16
29105 @opindex mno-const16
29106 Enable or disable use of @code{CONST16} instructions for loading
29107 constant values. The @code{CONST16} instruction is currently not a
29108 standard option from Tensilica. When enabled, @code{CONST16}
29109 instructions are always used in place of the standard @code{L32R}
29110 instructions. The use of @code{CONST16} is enabled by default only if
29111 the @code{L32R} instruction is not available.
29112
29113 @item -mfused-madd
29114 @itemx -mno-fused-madd
29115 @opindex mfused-madd
29116 @opindex mno-fused-madd
29117 Enable or disable use of fused multiply/add and multiply/subtract
29118 instructions in the floating-point option. This has no effect if the
29119 floating-point option is not also enabled. Disabling fused multiply/add
29120 and multiply/subtract instructions forces the compiler to use separate
29121 instructions for the multiply and add/subtract operations. This may be
29122 desirable in some cases where strict IEEE 754-compliant results are
29123 required: the fused multiply add/subtract instructions do not round the
29124 intermediate result, thereby producing results with @emph{more} bits of
29125 precision than specified by the IEEE standard. Disabling fused multiply
29126 add/subtract instructions also ensures that the program output is not
29127 sensitive to the compiler's ability to combine multiply and add/subtract
29128 operations.
29129
29130 @item -mserialize-volatile
29131 @itemx -mno-serialize-volatile
29132 @opindex mserialize-volatile
29133 @opindex mno-serialize-volatile
29134 When this option is enabled, GCC inserts @code{MEMW} instructions before
29135 @code{volatile} memory references to guarantee sequential consistency.
29136 The default is @option{-mserialize-volatile}. Use
29137 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29138
29139 @item -mforce-no-pic
29140 @opindex mforce-no-pic
29141 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29142 position-independent code (PIC), this option disables PIC for compiling
29143 kernel code.
29144
29145 @item -mtext-section-literals
29146 @itemx -mno-text-section-literals
29147 @opindex mtext-section-literals
29148 @opindex mno-text-section-literals
29149 These options control the treatment of literal pools. The default is
29150 @option{-mno-text-section-literals}, which places literals in a separate
29151 section in the output file. This allows the literal pool to be placed
29152 in a data RAM/ROM, and it also allows the linker to combine literal
29153 pools from separate object files to remove redundant literals and
29154 improve code size. With @option{-mtext-section-literals}, the literals
29155 are interspersed in the text section in order to keep them as close as
29156 possible to their references. This may be necessary for large assembly
29157 files. Literals for each function are placed right before that function.
29158
29159 @item -mauto-litpools
29160 @itemx -mno-auto-litpools
29161 @opindex mauto-litpools
29162 @opindex mno-auto-litpools
29163 These options control the treatment of literal pools. The default is
29164 @option{-mno-auto-litpools}, which places literals in a separate
29165 section in the output file unless @option{-mtext-section-literals} is
29166 used. With @option{-mauto-litpools} the literals are interspersed in
29167 the text section by the assembler. Compiler does not produce explicit
29168 @code{.literal} directives and loads literals into registers with
29169 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29170 do relaxation and place literals as necessary. This option allows
29171 assembler to create several literal pools per function and assemble
29172 very big functions, which may not be possible with
29173 @option{-mtext-section-literals}.
29174
29175 @item -mtarget-align
29176 @itemx -mno-target-align
29177 @opindex mtarget-align
29178 @opindex mno-target-align
29179 When this option is enabled, GCC instructs the assembler to
29180 automatically align instructions to reduce branch penalties at the
29181 expense of some code density. The assembler attempts to widen density
29182 instructions to align branch targets and the instructions following call
29183 instructions. If there are not enough preceding safe density
29184 instructions to align a target, no widening is performed. The
29185 default is @option{-mtarget-align}. These options do not affect the
29186 treatment of auto-aligned instructions like @code{LOOP}, which the
29187 assembler always aligns, either by widening density instructions or
29188 by inserting NOP instructions.
29189
29190 @item -mlongcalls
29191 @itemx -mno-longcalls
29192 @opindex mlongcalls
29193 @opindex mno-longcalls
29194 When this option is enabled, GCC instructs the assembler to translate
29195 direct calls to indirect calls unless it can determine that the target
29196 of a direct call is in the range allowed by the call instruction. This
29197 translation typically occurs for calls to functions in other source
29198 files. Specifically, the assembler translates a direct @code{CALL}
29199 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29200 The default is @option{-mno-longcalls}. This option should be used in
29201 programs where the call target can potentially be out of range. This
29202 option is implemented in the assembler, not the compiler, so the
29203 assembly code generated by GCC still shows direct call
29204 instructions---look at the disassembled object code to see the actual
29205 instructions. Note that the assembler uses an indirect call for
29206 every cross-file call, not just those that really are out of range.
29207 @end table
29208
29209 @node zSeries Options
29210 @subsection zSeries Options
29211 @cindex zSeries options
29212
29213 These are listed under @xref{S/390 and zSeries Options}.
29214
29215
29216 @c man end
29217
29218 @node Spec Files
29219 @section Specifying Subprocesses and the Switches to Pass to Them
29220 @cindex Spec Files
29221
29222 @command{gcc} is a driver program. It performs its job by invoking a
29223 sequence of other programs to do the work of compiling, assembling and
29224 linking. GCC interprets its command-line parameters and uses these to
29225 deduce which programs it should invoke, and which command-line options
29226 it ought to place on their command lines. This behavior is controlled
29227 by @dfn{spec strings}. In most cases there is one spec string for each
29228 program that GCC can invoke, but a few programs have multiple spec
29229 strings to control their behavior. The spec strings built into GCC can
29230 be overridden by using the @option{-specs=} command-line switch to specify
29231 a spec file.
29232
29233 @dfn{Spec files} are plain-text files that are used to construct spec
29234 strings. They consist of a sequence of directives separated by blank
29235 lines. The type of directive is determined by the first non-whitespace
29236 character on the line, which can be one of the following:
29237
29238 @table @code
29239 @item %@var{command}
29240 Issues a @var{command} to the spec file processor. The commands that can
29241 appear here are:
29242
29243 @table @code
29244 @item %include <@var{file}>
29245 @cindex @code{%include}
29246 Search for @var{file} and insert its text at the current point in the
29247 specs file.
29248
29249 @item %include_noerr <@var{file}>
29250 @cindex @code{%include_noerr}
29251 Just like @samp{%include}, but do not generate an error message if the include
29252 file cannot be found.
29253
29254 @item %rename @var{old_name} @var{new_name}
29255 @cindex @code{%rename}
29256 Rename the spec string @var{old_name} to @var{new_name}.
29257
29258 @end table
29259
29260 @item *[@var{spec_name}]:
29261 This tells the compiler to create, override or delete the named spec
29262 string. All lines after this directive up to the next directive or
29263 blank line are considered to be the text for the spec string. If this
29264 results in an empty string then the spec is deleted. (Or, if the
29265 spec did not exist, then nothing happens.) Otherwise, if the spec
29266 does not currently exist a new spec is created. If the spec does
29267 exist then its contents are overridden by the text of this
29268 directive, unless the first character of that text is the @samp{+}
29269 character, in which case the text is appended to the spec.
29270
29271 @item [@var{suffix}]:
29272 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29273 and up to the next directive or blank line are considered to make up the
29274 spec string for the indicated suffix. When the compiler encounters an
29275 input file with the named suffix, it processes the spec string in
29276 order to work out how to compile that file. For example:
29277
29278 @smallexample
29279 .ZZ:
29280 z-compile -input %i
29281 @end smallexample
29282
29283 This says that any input file whose name ends in @samp{.ZZ} should be
29284 passed to the program @samp{z-compile}, which should be invoked with the
29285 command-line switch @option{-input} and with the result of performing the
29286 @samp{%i} substitution. (See below.)
29287
29288 As an alternative to providing a spec string, the text following a
29289 suffix directive can be one of the following:
29290
29291 @table @code
29292 @item @@@var{language}
29293 This says that the suffix is an alias for a known @var{language}. This is
29294 similar to using the @option{-x} command-line switch to GCC to specify a
29295 language explicitly. For example:
29296
29297 @smallexample
29298 .ZZ:
29299 @@c++
29300 @end smallexample
29301
29302 Says that .ZZ files are, in fact, C++ source files.
29303
29304 @item #@var{name}
29305 This causes an error messages saying:
29306
29307 @smallexample
29308 @var{name} compiler not installed on this system.
29309 @end smallexample
29310 @end table
29311
29312 GCC already has an extensive list of suffixes built into it.
29313 This directive adds an entry to the end of the list of suffixes, but
29314 since the list is searched from the end backwards, it is effectively
29315 possible to override earlier entries using this technique.
29316
29317 @end table
29318
29319 GCC has the following spec strings built into it. Spec files can
29320 override these strings or create their own. Note that individual
29321 targets can also add their own spec strings to this list.
29322
29323 @smallexample
29324 asm Options to pass to the assembler
29325 asm_final Options to pass to the assembler post-processor
29326 cpp Options to pass to the C preprocessor
29327 cc1 Options to pass to the C compiler
29328 cc1plus Options to pass to the C++ compiler
29329 endfile Object files to include at the end of the link
29330 link Options to pass to the linker
29331 lib Libraries to include on the command line to the linker
29332 libgcc Decides which GCC support library to pass to the linker
29333 linker Sets the name of the linker
29334 predefines Defines to be passed to the C preprocessor
29335 signed_char Defines to pass to CPP to say whether @code{char} is signed
29336 by default
29337 startfile Object files to include at the start of the link
29338 @end smallexample
29339
29340 Here is a small example of a spec file:
29341
29342 @smallexample
29343 %rename lib old_lib
29344
29345 *lib:
29346 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29347 @end smallexample
29348
29349 This example renames the spec called @samp{lib} to @samp{old_lib} and
29350 then overrides the previous definition of @samp{lib} with a new one.
29351 The new definition adds in some extra command-line options before
29352 including the text of the old definition.
29353
29354 @dfn{Spec strings} are a list of command-line options to be passed to their
29355 corresponding program. In addition, the spec strings can contain
29356 @samp{%}-prefixed sequences to substitute variable text or to
29357 conditionally insert text into the command line. Using these constructs
29358 it is possible to generate quite complex command lines.
29359
29360 Here is a table of all defined @samp{%}-sequences for spec
29361 strings. Note that spaces are not generated automatically around the
29362 results of expanding these sequences. Therefore you can concatenate them
29363 together or combine them with constant text in a single argument.
29364
29365 @table @code
29366 @item %%
29367 Substitute one @samp{%} into the program name or argument.
29368
29369 @item %i
29370 Substitute the name of the input file being processed.
29371
29372 @item %b
29373 Substitute the basename of the input file being processed.
29374 This is the substring up to (and not including) the last period
29375 and not including the directory.
29376
29377 @item %B
29378 This is the same as @samp{%b}, but include the file suffix (text after
29379 the last period).
29380
29381 @item %d
29382 Marks the argument containing or following the @samp{%d} as a
29383 temporary file name, so that that file is deleted if GCC exits
29384 successfully. Unlike @samp{%g}, this contributes no text to the
29385 argument.
29386
29387 @item %g@var{suffix}
29388 Substitute a file name that has suffix @var{suffix} and is chosen
29389 once per compilation, and mark the argument in the same way as
29390 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29391 name is now chosen in a way that is hard to predict even when previously
29392 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29393 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29394 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29395 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29396 was simply substituted with a file name chosen once per compilation,
29397 without regard to any appended suffix (which was therefore treated
29398 just like ordinary text), making such attacks more likely to succeed.
29399
29400 @item %u@var{suffix}
29401 Like @samp{%g}, but generates a new temporary file name
29402 each time it appears instead of once per compilation.
29403
29404 @item %U@var{suffix}
29405 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29406 new one if there is no such last file name. In the absence of any
29407 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29408 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29409 involves the generation of two distinct file names, one
29410 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29411 simply substituted with a file name chosen for the previous @samp{%u},
29412 without regard to any appended suffix.
29413
29414 @item %j@var{suffix}
29415 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29416 writable, and if @option{-save-temps} is not used;
29417 otherwise, substitute the name
29418 of a temporary file, just like @samp{%u}. This temporary file is not
29419 meant for communication between processes, but rather as a junk
29420 disposal mechanism.
29421
29422 @item %|@var{suffix}
29423 @itemx %m@var{suffix}
29424 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29425 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29426 all. These are the two most common ways to instruct a program that it
29427 should read from standard input or write to standard output. If you
29428 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29429 construct: see for example @file{gcc/fortran/lang-specs.h}.
29430
29431 @item %.@var{SUFFIX}
29432 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29433 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29434 terminated by the next space or %.
29435
29436 @item %w
29437 Marks the argument containing or following the @samp{%w} as the
29438 designated output file of this compilation. This puts the argument
29439 into the sequence of arguments that @samp{%o} substitutes.
29440
29441 @item %o
29442 Substitutes the names of all the output files, with spaces
29443 automatically placed around them. You should write spaces
29444 around the @samp{%o} as well or the results are undefined.
29445 @samp{%o} is for use in the specs for running the linker.
29446 Input files whose names have no recognized suffix are not compiled
29447 at all, but they are included among the output files, so they are
29448 linked.
29449
29450 @item %O
29451 Substitutes the suffix for object files. Note that this is
29452 handled specially when it immediately follows @samp{%g, %u, or %U},
29453 because of the need for those to form complete file names. The
29454 handling is such that @samp{%O} is treated exactly as if it had already
29455 been substituted, except that @samp{%g, %u, and %U} do not currently
29456 support additional @var{suffix} characters following @samp{%O} as they do
29457 following, for example, @samp{.o}.
29458
29459 @item %p
29460 Substitutes the standard macro predefinitions for the
29461 current target machine. Use this when running @command{cpp}.
29462
29463 @item %P
29464 Like @samp{%p}, but puts @samp{__} before and after the name of each
29465 predefined macro, except for macros that start with @samp{__} or with
29466 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29467 C@.
29468
29469 @item %I
29470 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29471 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29472 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29473 and @option{-imultilib} as necessary.
29474
29475 @item %s
29476 Current argument is the name of a library or startup file of some sort.
29477 Search for that file in a standard list of directories and substitute
29478 the full name found. The current working directory is included in the
29479 list of directories scanned.
29480
29481 @item %T
29482 Current argument is the name of a linker script. Search for that file
29483 in the current list of directories to scan for libraries. If the file
29484 is located insert a @option{--script} option into the command line
29485 followed by the full path name found. If the file is not found then
29486 generate an error message. Note: the current working directory is not
29487 searched.
29488
29489 @item %e@var{str}
29490 Print @var{str} as an error message. @var{str} is terminated by a newline.
29491 Use this when inconsistent options are detected.
29492
29493 @item %(@var{name})
29494 Substitute the contents of spec string @var{name} at this point.
29495
29496 @item %x@{@var{option}@}
29497 Accumulate an option for @samp{%X}.
29498
29499 @item %X
29500 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29501 spec string.
29502
29503 @item %Y
29504 Output the accumulated assembler options specified by @option{-Wa}.
29505
29506 @item %Z
29507 Output the accumulated preprocessor options specified by @option{-Wp}.
29508
29509 @item %a
29510 Process the @code{asm} spec. This is used to compute the
29511 switches to be passed to the assembler.
29512
29513 @item %A
29514 Process the @code{asm_final} spec. This is a spec string for
29515 passing switches to an assembler post-processor, if such a program is
29516 needed.
29517
29518 @item %l
29519 Process the @code{link} spec. This is the spec for computing the
29520 command line passed to the linker. Typically it makes use of the
29521 @samp{%L %G %S %D and %E} sequences.
29522
29523 @item %D
29524 Dump out a @option{-L} option for each directory that GCC believes might
29525 contain startup files. If the target supports multilibs then the
29526 current multilib directory is prepended to each of these paths.
29527
29528 @item %L
29529 Process the @code{lib} spec. This is a spec string for deciding which
29530 libraries are included on the command line to the linker.
29531
29532 @item %G
29533 Process the @code{libgcc} spec. This is a spec string for deciding
29534 which GCC support library is included on the command line to the linker.
29535
29536 @item %S
29537 Process the @code{startfile} spec. This is a spec for deciding which
29538 object files are the first ones passed to the linker. Typically
29539 this might be a file named @file{crt0.o}.
29540
29541 @item %E
29542 Process the @code{endfile} spec. This is a spec string that specifies
29543 the last object files that are passed to the linker.
29544
29545 @item %C
29546 Process the @code{cpp} spec. This is used to construct the arguments
29547 to be passed to the C preprocessor.
29548
29549 @item %1
29550 Process the @code{cc1} spec. This is used to construct the options to be
29551 passed to the actual C compiler (@command{cc1}).
29552
29553 @item %2
29554 Process the @code{cc1plus} spec. This is used to construct the options to be
29555 passed to the actual C++ compiler (@command{cc1plus}).
29556
29557 @item %*
29558 Substitute the variable part of a matched option. See below.
29559 Note that each comma in the substituted string is replaced by
29560 a single space.
29561
29562 @item %<S
29563 Remove all occurrences of @code{-S} from the command line. Note---this
29564 command is position dependent. @samp{%} commands in the spec string
29565 before this one see @code{-S}, @samp{%} commands in the spec string
29566 after this one do not.
29567
29568 @item %:@var{function}(@var{args})
29569 Call the named function @var{function}, passing it @var{args}.
29570 @var{args} is first processed as a nested spec string, then split
29571 into an argument vector in the usual fashion. The function returns
29572 a string which is processed as if it had appeared literally as part
29573 of the current spec.
29574
29575 The following built-in spec functions are provided:
29576
29577 @table @code
29578 @item @code{getenv}
29579 The @code{getenv} spec function takes two arguments: an environment
29580 variable name and a string. If the environment variable is not
29581 defined, a fatal error is issued. Otherwise, the return value is the
29582 value of the environment variable concatenated with the string. For
29583 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29584
29585 @smallexample
29586 %:getenv(TOPDIR /include)
29587 @end smallexample
29588
29589 expands to @file{/path/to/top/include}.
29590
29591 @item @code{if-exists}
29592 The @code{if-exists} spec function takes one argument, an absolute
29593 pathname to a file. If the file exists, @code{if-exists} returns the
29594 pathname. Here is a small example of its usage:
29595
29596 @smallexample
29597 *startfile:
29598 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29599 @end smallexample
29600
29601 @item @code{if-exists-else}
29602 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29603 spec function, except that it takes two arguments. The first argument is
29604 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29605 returns the pathname. If it does not exist, it returns the second argument.
29606 This way, @code{if-exists-else} can be used to select one file or another,
29607 based on the existence of the first. Here is a small example of its usage:
29608
29609 @smallexample
29610 *startfile:
29611 crt0%O%s %:if-exists(crti%O%s) \
29612 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29613 @end smallexample
29614
29615 @item @code{replace-outfile}
29616 The @code{replace-outfile} spec function takes two arguments. It looks for the
29617 first argument in the outfiles array and replaces it with the second argument. Here
29618 is a small example of its usage:
29619
29620 @smallexample
29621 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29622 @end smallexample
29623
29624 @item @code{remove-outfile}
29625 The @code{remove-outfile} spec function takes one argument. It looks for the
29626 first argument in the outfiles array and removes it. Here is a small example
29627 its usage:
29628
29629 @smallexample
29630 %:remove-outfile(-lm)
29631 @end smallexample
29632
29633 @item @code{pass-through-libs}
29634 The @code{pass-through-libs} spec function takes any number of arguments. It
29635 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29636 assumes are the names of linker input library archive files) and returns a
29637 result containing all the found arguments each prepended by
29638 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29639 intended to be passed to the LTO linker plugin.
29640
29641 @smallexample
29642 %:pass-through-libs(%G %L %G)
29643 @end smallexample
29644
29645 @item @code{print-asm-header}
29646 The @code{print-asm-header} function takes no arguments and simply
29647 prints a banner like:
29648
29649 @smallexample
29650 Assembler options
29651 =================
29652
29653 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29654 @end smallexample
29655
29656 It is used to separate compiler options from assembler options
29657 in the @option{--target-help} output.
29658 @end table
29659
29660 @item %@{S@}
29661 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29662 If that switch is not specified, this substitutes nothing. Note that
29663 the leading dash is omitted when specifying this option, and it is
29664 automatically inserted if the substitution is performed. Thus the spec
29665 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29666 and outputs the command-line option @option{-foo}.
29667
29668 @item %W@{S@}
29669 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29670 deleted on failure.
29671
29672 @item %@{S*@}
29673 Substitutes all the switches specified to GCC whose names start
29674 with @code{-S}, but which also take an argument. This is used for
29675 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29676 GCC considers @option{-o foo} as being
29677 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29678 text, including the space. Thus two arguments are generated.
29679
29680 @item %@{S*&T*@}
29681 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29682 (the order of @code{S} and @code{T} in the spec is not significant).
29683 There can be any number of ampersand-separated variables; for each the
29684 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29685
29686 @item %@{S:X@}
29687 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29688
29689 @item %@{!S:X@}
29690 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29691
29692 @item %@{S*:X@}
29693 Substitutes @code{X} if one or more switches whose names start with
29694 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29695 once, no matter how many such switches appeared. However, if @code{%*}
29696 appears somewhere in @code{X}, then @code{X} is substituted once
29697 for each matching switch, with the @code{%*} replaced by the part of
29698 that switch matching the @code{*}.
29699
29700 If @code{%*} appears as the last part of a spec sequence then a space
29701 is added after the end of the last substitution. If there is more
29702 text in the sequence, however, then a space is not generated. This
29703 allows the @code{%*} substitution to be used as part of a larger
29704 string. For example, a spec string like this:
29705
29706 @smallexample
29707 %@{mcu=*:--script=%*/memory.ld@}
29708 @end smallexample
29709
29710 @noindent
29711 when matching an option like @option{-mcu=newchip} produces:
29712
29713 @smallexample
29714 --script=newchip/memory.ld
29715 @end smallexample
29716
29717 @item %@{.S:X@}
29718 Substitutes @code{X}, if processing a file with suffix @code{S}.
29719
29720 @item %@{!.S:X@}
29721 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29722
29723 @item %@{,S:X@}
29724 Substitutes @code{X}, if processing a file for language @code{S}.
29725
29726 @item %@{!,S:X@}
29727 Substitutes @code{X}, if not processing a file for language @code{S}.
29728
29729 @item %@{S|P:X@}
29730 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29731 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29732 @code{*} sequences as well, although they have a stronger binding than
29733 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29734 alternatives must be starred, and only the first matching alternative
29735 is substituted.
29736
29737 For example, a spec string like this:
29738
29739 @smallexample
29740 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29741 @end smallexample
29742
29743 @noindent
29744 outputs the following command-line options from the following input
29745 command-line options:
29746
29747 @smallexample
29748 fred.c -foo -baz
29749 jim.d -bar -boggle
29750 -d fred.c -foo -baz -boggle
29751 -d jim.d -bar -baz -boggle
29752 @end smallexample
29753
29754 @item %@{S:X; T:Y; :D@}
29755
29756 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29757 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29758 be as many clauses as you need. This may be combined with @code{.},
29759 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29760
29761
29762 @end table
29763
29764 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29765 or similar construct can use a backslash to ignore the special meaning
29766 of the character following it, thus allowing literal matching of a
29767 character that is otherwise specially treated. For example,
29768 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29769 @option{-std=iso9899:1999} option is given.
29770
29771 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29772 construct may contain other nested @samp{%} constructs or spaces, or
29773 even newlines. They are processed as usual, as described above.
29774 Trailing white space in @code{X} is ignored. White space may also
29775 appear anywhere on the left side of the colon in these constructs,
29776 except between @code{.} or @code{*} and the corresponding word.
29777
29778 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29779 handled specifically in these constructs. If another value of
29780 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29781 @option{-W} switch is found later in the command line, the earlier
29782 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29783 just one letter, which passes all matching options.
29784
29785 The character @samp{|} at the beginning of the predicate text is used to
29786 indicate that a command should be piped to the following command, but
29787 only if @option{-pipe} is specified.
29788
29789 It is built into GCC which switches take arguments and which do not.
29790 (You might think it would be useful to generalize this to allow each
29791 compiler's spec to say which switches take arguments. But this cannot
29792 be done in a consistent fashion. GCC cannot even decide which input
29793 files have been specified without knowing which switches take arguments,
29794 and it must know which input files to compile in order to tell which
29795 compilers to run).
29796
29797 GCC also knows implicitly that arguments starting in @option{-l} are to be
29798 treated as compiler output files, and passed to the linker in their
29799 proper position among the other output files.
29800
29801 @node Environment Variables
29802 @section Environment Variables Affecting GCC
29803 @cindex environment variables
29804
29805 @c man begin ENVIRONMENT
29806 This section describes several environment variables that affect how GCC
29807 operates. Some of them work by specifying directories or prefixes to use
29808 when searching for various kinds of files. Some are used to specify other
29809 aspects of the compilation environment.
29810
29811 Note that you can also specify places to search using options such as
29812 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29813 take precedence over places specified using environment variables, which
29814 in turn take precedence over those specified by the configuration of GCC@.
29815 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29816 GNU Compiler Collection (GCC) Internals}.
29817
29818 @table @env
29819 @item LANG
29820 @itemx LC_CTYPE
29821 @c @itemx LC_COLLATE
29822 @itemx LC_MESSAGES
29823 @c @itemx LC_MONETARY
29824 @c @itemx LC_NUMERIC
29825 @c @itemx LC_TIME
29826 @itemx LC_ALL
29827 @findex LANG
29828 @findex LC_CTYPE
29829 @c @findex LC_COLLATE
29830 @findex LC_MESSAGES
29831 @c @findex LC_MONETARY
29832 @c @findex LC_NUMERIC
29833 @c @findex LC_TIME
29834 @findex LC_ALL
29835 @cindex locale
29836 These environment variables control the way that GCC uses
29837 localization information which allows GCC to work with different
29838 national conventions. GCC inspects the locale categories
29839 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29840 so. These locale categories can be set to any value supported by your
29841 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29842 Kingdom encoded in UTF-8.
29843
29844 The @env{LC_CTYPE} environment variable specifies character
29845 classification. GCC uses it to determine the character boundaries in
29846 a string; this is needed for some multibyte encodings that contain quote
29847 and escape characters that are otherwise interpreted as a string
29848 end or escape.
29849
29850 The @env{LC_MESSAGES} environment variable specifies the language to
29851 use in diagnostic messages.
29852
29853 If the @env{LC_ALL} environment variable is set, it overrides the value
29854 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29855 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29856 environment variable. If none of these variables are set, GCC
29857 defaults to traditional C English behavior.
29858
29859 @item TMPDIR
29860 @findex TMPDIR
29861 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29862 files. GCC uses temporary files to hold the output of one stage of
29863 compilation which is to be used as input to the next stage: for example,
29864 the output of the preprocessor, which is the input to the compiler
29865 proper.
29866
29867 @item GCC_COMPARE_DEBUG
29868 @findex GCC_COMPARE_DEBUG
29869 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29870 @option{-fcompare-debug} to the compiler driver. See the documentation
29871 of this option for more details.
29872
29873 @item GCC_EXEC_PREFIX
29874 @findex GCC_EXEC_PREFIX
29875 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29876 names of the subprograms executed by the compiler. No slash is added
29877 when this prefix is combined with the name of a subprogram, but you can
29878 specify a prefix that ends with a slash if you wish.
29879
29880 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29881 an appropriate prefix to use based on the pathname it is invoked with.
29882
29883 If GCC cannot find the subprogram using the specified prefix, it
29884 tries looking in the usual places for the subprogram.
29885
29886 The default value of @env{GCC_EXEC_PREFIX} is
29887 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29888 the installed compiler. In many cases @var{prefix} is the value
29889 of @code{prefix} when you ran the @file{configure} script.
29890
29891 Other prefixes specified with @option{-B} take precedence over this prefix.
29892
29893 This prefix is also used for finding files such as @file{crt0.o} that are
29894 used for linking.
29895
29896 In addition, the prefix is used in an unusual way in finding the
29897 directories to search for header files. For each of the standard
29898 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29899 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29900 replacing that beginning with the specified prefix to produce an
29901 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29902 @file{foo/bar} just before it searches the standard directory
29903 @file{/usr/local/lib/bar}.
29904 If a standard directory begins with the configured
29905 @var{prefix} then the value of @var{prefix} is replaced by
29906 @env{GCC_EXEC_PREFIX} when looking for header files.
29907
29908 @item COMPILER_PATH
29909 @findex COMPILER_PATH
29910 The value of @env{COMPILER_PATH} is a colon-separated list of
29911 directories, much like @env{PATH}. GCC tries the directories thus
29912 specified when searching for subprograms, if it cannot find the
29913 subprograms using @env{GCC_EXEC_PREFIX}.
29914
29915 @item LIBRARY_PATH
29916 @findex LIBRARY_PATH
29917 The value of @env{LIBRARY_PATH} is a colon-separated list of
29918 directories, much like @env{PATH}. When configured as a native compiler,
29919 GCC tries the directories thus specified when searching for special
29920 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29921 using GCC also uses these directories when searching for ordinary
29922 libraries for the @option{-l} option (but directories specified with
29923 @option{-L} come first).
29924
29925 @item LANG
29926 @findex LANG
29927 @cindex locale definition
29928 This variable is used to pass locale information to the compiler. One way in
29929 which this information is used is to determine the character set to be used
29930 when character literals, string literals and comments are parsed in C and C++.
29931 When the compiler is configured to allow multibyte characters,
29932 the following values for @env{LANG} are recognized:
29933
29934 @table @samp
29935 @item C-JIS
29936 Recognize JIS characters.
29937 @item C-SJIS
29938 Recognize SJIS characters.
29939 @item C-EUCJP
29940 Recognize EUCJP characters.
29941 @end table
29942
29943 If @env{LANG} is not defined, or if it has some other value, then the
29944 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29945 recognize and translate multibyte characters.
29946 @end table
29947
29948 @noindent
29949 Some additional environment variables affect the behavior of the
29950 preprocessor.
29951
29952 @include cppenv.texi
29953
29954 @c man end
29955
29956 @node Precompiled Headers
29957 @section Using Precompiled Headers
29958 @cindex precompiled headers
29959 @cindex speed of compilation
29960
29961 Often large projects have many header files that are included in every
29962 source file. The time the compiler takes to process these header files
29963 over and over again can account for nearly all of the time required to
29964 build the project. To make builds faster, GCC allows you to
29965 @dfn{precompile} a header file.
29966
29967 To create a precompiled header file, simply compile it as you would any
29968 other file, if necessary using the @option{-x} option to make the driver
29969 treat it as a C or C++ header file. You may want to use a
29970 tool like @command{make} to keep the precompiled header up-to-date when
29971 the headers it contains change.
29972
29973 A precompiled header file is searched for when @code{#include} is
29974 seen in the compilation. As it searches for the included file
29975 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29976 compiler looks for a precompiled header in each directory just before it
29977 looks for the include file in that directory. The name searched for is
29978 the name specified in the @code{#include} with @samp{.gch} appended. If
29979 the precompiled header file cannot be used, it is ignored.
29980
29981 For instance, if you have @code{#include "all.h"}, and you have
29982 @file{all.h.gch} in the same directory as @file{all.h}, then the
29983 precompiled header file is used if possible, and the original
29984 header is used otherwise.
29985
29986 Alternatively, you might decide to put the precompiled header file in a
29987 directory and use @option{-I} to ensure that directory is searched
29988 before (or instead of) the directory containing the original header.
29989 Then, if you want to check that the precompiled header file is always
29990 used, you can put a file of the same name as the original header in this
29991 directory containing an @code{#error} command.
29992
29993 This also works with @option{-include}. So yet another way to use
29994 precompiled headers, good for projects not designed with precompiled
29995 header files in mind, is to simply take most of the header files used by
29996 a project, include them from another header file, precompile that header
29997 file, and @option{-include} the precompiled header. If the header files
29998 have guards against multiple inclusion, they are skipped because
29999 they've already been included (in the precompiled header).
30000
30001 If you need to precompile the same header file for different
30002 languages, targets, or compiler options, you can instead make a
30003 @emph{directory} named like @file{all.h.gch}, and put each precompiled
30004 header in the directory, perhaps using @option{-o}. It doesn't matter
30005 what you call the files in the directory; every precompiled header in
30006 the directory is considered. The first precompiled header
30007 encountered in the directory that is valid for this compilation is
30008 used; they're searched in no particular order.
30009
30010 There are many other possibilities, limited only by your imagination,
30011 good sense, and the constraints of your build system.
30012
30013 A precompiled header file can be used only when these conditions apply:
30014
30015 @itemize
30016 @item
30017 Only one precompiled header can be used in a particular compilation.
30018
30019 @item
30020 A precompiled header cannot be used once the first C token is seen. You
30021 can have preprocessor directives before a precompiled header; you cannot
30022 include a precompiled header from inside another header.
30023
30024 @item
30025 The precompiled header file must be produced for the same language as
30026 the current compilation. You cannot use a C precompiled header for a C++
30027 compilation.
30028
30029 @item
30030 The precompiled header file must have been produced by the same compiler
30031 binary as the current compilation is using.
30032
30033 @item
30034 Any macros defined before the precompiled header is included must
30035 either be defined in the same way as when the precompiled header was
30036 generated, or must not affect the precompiled header, which usually
30037 means that they don't appear in the precompiled header at all.
30038
30039 The @option{-D} option is one way to define a macro before a
30040 precompiled header is included; using a @code{#define} can also do it.
30041 There are also some options that define macros implicitly, like
30042 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30043 defined this way.
30044
30045 @item If debugging information is output when using the precompiled
30046 header, using @option{-g} or similar, the same kind of debugging information
30047 must have been output when building the precompiled header. However,
30048 a precompiled header built using @option{-g} can be used in a compilation
30049 when no debugging information is being output.
30050
30051 @item The same @option{-m} options must generally be used when building
30052 and using the precompiled header. @xref{Submodel Options},
30053 for any cases where this rule is relaxed.
30054
30055 @item Each of the following options must be the same when building and using
30056 the precompiled header:
30057
30058 @gccoptlist{-fexceptions}
30059
30060 @item
30061 Some other command-line options starting with @option{-f},
30062 @option{-p}, or @option{-O} must be defined in the same way as when
30063 the precompiled header was generated. At present, it's not clear
30064 which options are safe to change and which are not; the safest choice
30065 is to use exactly the same options when generating and using the
30066 precompiled header. The following are known to be safe:
30067
30068 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30069 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30070 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30071 -pedantic-errors}
30072
30073 @end itemize
30074
30075 For all of these except the last, the compiler automatically
30076 ignores the precompiled header if the conditions aren't met. If you
30077 find an option combination that doesn't work and doesn't cause the
30078 precompiled header to be ignored, please consider filing a bug report,
30079 see @ref{Bugs}.
30080
30081 If you do use differing options when generating and using the
30082 precompiled header, the actual behavior is a mixture of the
30083 behavior for the options. For instance, if you use @option{-g} to
30084 generate the precompiled header but not when using it, you may or may
30085 not get debugging information for routines in the precompiled header.