]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
1407d019d1404ebbdb9630d6f541eab2e7a1bd01
[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 -fno-rtti -fsized-deallocation @gol
226 -ftemplate-backtrace-limit=@var{n} @gol
227 -ftemplate-depth=@var{n} @gol
228 -fno-threadsafe-statics -fuse-cxa-atexit @gol
229 -fno-weak -nostdinc++ @gol
230 -fvisibility-inlines-hidden @gol
231 -fvisibility-ms-compat @gol
232 -fext-numeric-literals @gol
233 -Wabi=@var{n} -Wabi-tag -Wcomma-subscript -Wconversion-null @gol
234 -Wctor-dtor-privacy @gol
235 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
236 -Wliteral-suffix @gol
237 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
238 -Wnamespaces -Wnarrowing @gol
239 -Wpessimizing-move -Wredundant-move @gol
240 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
241 -Wnon-virtual-dtor -Wreorder -Wregister @gol
242 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
243 -Wno-non-template-friend -Wold-style-cast @gol
244 -Woverloaded-virtual -Wno-pmf-conversions @gol
245 -Wno-class-conversion -Wno-terminate @gol
246 -Wsign-promo -Wvirtual-inheritance -Wvolatile}
247
248 @item Objective-C and Objective-C++ Language Options
249 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
250 Objective-C and Objective-C++ Dialects}.
251 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
252 -fgnu-runtime -fnext-runtime @gol
253 -fno-nil-receivers @gol
254 -fobjc-abi-version=@var{n} @gol
255 -fobjc-call-cxx-cdtors @gol
256 -fobjc-direct-dispatch @gol
257 -fobjc-exceptions @gol
258 -fobjc-gc @gol
259 -fobjc-nilcheck @gol
260 -fobjc-std=objc1 @gol
261 -fno-local-ivars @gol
262 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
263 -freplace-objc-classes @gol
264 -fzero-link @gol
265 -gen-decls @gol
266 -Wassign-intercept @gol
267 -Wno-protocol -Wselector @gol
268 -Wstrict-selector-match @gol
269 -Wundeclared-selector}
270
271 @item Diagnostic Message Formatting Options
272 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
273 @gccoptlist{-fmessage-length=@var{n} @gol
274 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
275 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
276 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol
277 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
278 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
279 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
280 -fdiagnostics-minimum-margin-width=@var{width} @gol
281 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
282 -fdiagnostics-show-template-tree -fno-elide-type @gol
283 -fno-show-column}
284
285 @item Warning Options
286 @xref{Warning Options,,Options to Request or Suppress Warnings}.
287 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
288 -pedantic-errors @gol
289 -w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol
290 -Waggregate-return -Waligned-new @gol
291 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
292 -Walloca -Walloca-larger-than=@var{byte-size} @gol
293 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
294 -Wno-attributes -Wattribute-alias=@var{n} @gol
295 -Wbool-compare -Wbool-operation @gol
296 -Wno-builtin-declaration-mismatch @gol
297 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
298 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
299 -Wc++20-compat @gol
300 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
301 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
302 -Wclobbered -Wcomment -Wconditionally-supported @gol
303 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
304 -Wdelete-incomplete @gol
305 -Wno-attribute-warning @gol
306 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
307 -Wdisabled-optimization @gol
308 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
309 -Wno-div-by-zero -Wdouble-promotion @gol
310 -Wduplicated-branches -Wduplicated-cond @gol
311 -Wempty-body -Wenum-compare -Wenum-conversion @gol
312 -Wno-endif-labels -Wexpansion-to-defined @gol
313 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
314 -Wfloat-equal -Wformat -Wformat=2 @gol
315 -Wno-format-contains-nul -Wno-format-extra-args @gol
316 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
317 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
318 -Wformat-y2k -Wframe-address @gol
319 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
320 -Wjump-misses-init @gol
321 -Whsa -Wif-not-aligned @gol
322 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
323 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
324 -Wimplicit-function-declaration -Wimplicit-int @gol
325 -Winaccessible-base @gol
326 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
327 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
328 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
329 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
330 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
331 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
332 -Wmissing-field-initializers -Wmissing-format-attribute @gol
333 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
334 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
335 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
336 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
337 -Woverride-init-side-effects -Woverlength-strings @gol
338 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
339 -Wparentheses -Wno-pedantic-ms-format @gol
340 -Wplacement-new -Wplacement-new=@var{n} @gol
341 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
342 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
343 -Wrestrict -Wno-return-local-addr @gol
344 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
345 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
346 -Wshift-overflow -Wshift-overflow=@var{n} @gol
347 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
348 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
349 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
350 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
351 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
352 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
353 -Wstring-compare @gol
354 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
355 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
356 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
357 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
358 -Wswitch-unreachable -Wsync-nand @gol
359 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
360 -Wtype-limits -Wundef @gol
361 -Wuninitialized -Wunknown-pragmas @gol
362 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
363 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
364 -Wunused-parameter -Wno-unused-result @gol
365 -Wunused-value -Wunused-variable @gol
366 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
367 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
368 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
369 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
370 -Wwrite-strings @gol
371 -Wzero-as-null-pointer-constant}
372
373 @item C and Objective-C-only Warning Options
374 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
375 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
376 -Wold-style-declaration -Wold-style-definition @gol
377 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
378 -Wdeclaration-after-statement -Wpointer-sign}
379
380 @item Debugging Options
381 @xref{Debugging Options,,Options for Debugging Your Program}.
382 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
383 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
384 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
385 -gas-loc-support -gno-as-loc-support @gol
386 -gas-locview-support -gno-as-locview-support @gol
387 -gcolumn-info -gno-column-info @gol
388 -gstatement-frontiers -gno-statement-frontiers @gol
389 -gvariable-location-views -gno-variable-location-views @gol
390 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
391 -ginline-points -gno-inline-points @gol
392 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
393 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
394 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
395 -fno-eliminate-unused-debug-types @gol
396 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
397 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
398 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
399 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
400 -fvar-tracking -fvar-tracking-assignments}
401
402 @item Optimization Options
403 @xref{Optimize Options,,Options that Control Optimization}.
404 @gccoptlist{-faggressive-loop-optimizations @gol
405 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
406 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
407 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
408 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
409 -fallow-store-data-races @gol
410 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
411 -fauto-inc-dec -fbranch-probabilities @gol
412 -fcaller-saves @gol
413 -fcombine-stack-adjustments -fconserve-stack @gol
414 -fcompare-elim -fcprop-registers -fcrossjumping @gol
415 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
416 -fcx-limited-range @gol
417 -fdata-sections -fdce -fdelayed-branch @gol
418 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
419 -fdevirtualize-at-ltrans -fdse @gol
420 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
421 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
422 -ffinite-loops @gol
423 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
424 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
425 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
426 -fif-conversion2 -findirect-inlining @gol
427 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
428 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
429 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
430 -fipa-reference -fipa-reference-addressable @gol
431 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
432 -flive-patching=@var{level} @gol
433 -fira-region=@var{region} -fira-hoist-pressure @gol
434 -fira-loop-pressure -fno-ira-share-save-slots @gol
435 -fno-ira-share-spill-slots @gol
436 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
437 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
438 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
439 -floop-block -floop-interchange -floop-strip-mine @gol
440 -floop-unroll-and-jam -floop-nest-optimize @gol
441 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
442 -flto-partition=@var{alg} -fmerge-all-constants @gol
443 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
444 -fmove-loop-invariants -fno-branch-count-reg @gol
445 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
446 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
447 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
448 -fno-sched-spec -fno-signed-zeros @gol
449 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
450 -fomit-frame-pointer -foptimize-sibling-calls @gol
451 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
452 -fprefetch-loop-arrays @gol
453 -fprofile-correction @gol
454 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
455 -fprofile-reorder-functions @gol
456 -freciprocal-math -free -frename-registers -freorder-blocks @gol
457 -freorder-blocks-algorithm=@var{algorithm} @gol
458 -freorder-blocks-and-partition -freorder-functions @gol
459 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
460 -frounding-math -fsave-optimization-record @gol
461 -fsched2-use-superblocks -fsched-pressure @gol
462 -fsched-spec-load -fsched-spec-load-dangerous @gol
463 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
464 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
465 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
466 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
467 -fschedule-fusion @gol
468 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
469 -fselective-scheduling -fselective-scheduling2 @gol
470 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
471 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
472 -fsignaling-nans @gol
473 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
474 -fsplit-paths @gol
475 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
476 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
477 -fthread-jumps -ftracer -ftree-bit-ccp @gol
478 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
479 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
480 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
481 -ftree-loop-if-convert -ftree-loop-im @gol
482 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
483 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
484 -ftree-loop-vectorize @gol
485 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
486 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
487 -ftree-switch-conversion -ftree-tail-merge @gol
488 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
489 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
490 -funsafe-math-optimizations -funswitch-loops @gol
491 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
492 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
493 --param @var{name}=@var{value}
494 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
495
496 @item Program Instrumentation Options
497 @xref{Instrumentation Options,,Program Instrumentation Options}.
498 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
499 -fprofile-abs-path @gol
500 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
501 -fprofile-note=@var{path} -fprofile-update=@var{method} @gol
502 -fprofile-filter-files=@var{regex} -fprofile-exclude-files=@var{regex} @gol
503 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
504 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
505 -fsanitize-undefined-trap-on-error -fbounds-check @gol
506 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
507 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
508 -fstack-protector-explicit -fstack-check @gol
509 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
510 -fno-stack-limit -fsplit-stack @gol
511 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
512 -fvtv-counts -fvtv-debug @gol
513 -finstrument-functions @gol
514 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
515 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
516
517 @item Preprocessor Options
518 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
519 @gccoptlist{-A@var{question}=@var{answer} @gol
520 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
521 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
522 -dD -dI -dM -dN -dU @gol
523 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
524 -fexec-charset=@var{charset} -fextended-identifiers @gol
525 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
526 -fmax-include-depth=@var{depth} @gol
527 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
528 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
529 -fwide-exec-charset=@var{charset} -fworking-directory @gol
530 -H -imacros @var{file} -include @var{file} @gol
531 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
532 -no-integrated-cpp -P -pthread -remap @gol
533 -traditional -traditional-cpp -trigraphs @gol
534 -U@var{macro} -undef @gol
535 -Wp,@var{option} -Xpreprocessor @var{option}}
536
537 @item Assembler Options
538 @xref{Assembler Options,,Passing Options to the Assembler}.
539 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
540
541 @item Linker Options
542 @xref{Link Options,,Options for Linking}.
543 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
544 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
545 -e @var{entry} --entry=@var{entry} @gol
546 -pie -pthread -r -rdynamic @gol
547 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
548 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
549 -shared -shared-libgcc -symbolic @gol
550 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
551 -u @var{symbol} -z @var{keyword}}
552
553 @item Directory Options
554 @xref{Directory Options,,Options for Directory Search}.
555 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
556 -idirafter @var{dir} @gol
557 -imacros @var{file} -imultilib @var{dir} @gol
558 -iplugindir=@var{dir} -iprefix @var{file} @gol
559 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
560 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
561 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
562 -nostdinc -nostdinc++ --sysroot=@var{dir}}
563
564 @item Code Generation Options
565 @xref{Code Gen Options,,Options for Code Generation Conventions}.
566 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
567 -ffixed-@var{reg} -fexceptions @gol
568 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
569 -fasynchronous-unwind-tables @gol
570 -fno-gnu-unique @gol
571 -finhibit-size-directive -fno-common -fno-ident @gol
572 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
573 -fno-jump-tables @gol
574 -frecord-gcc-switches @gol
575 -freg-struct-return -fshort-enums -fshort-wchar @gol
576 -fverbose-asm -fpack-struct[=@var{n}] @gol
577 -fleading-underscore -ftls-model=@var{model} @gol
578 -fstack-reuse=@var{reuse_level} @gol
579 -ftrampolines -ftrapv -fwrapv @gol
580 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
581 -fstrict-volatile-bitfields -fsync-libcalls}
582
583 @item Developer Options
584 @xref{Developer Options,,GCC Developer Options}.
585 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
586 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
587 -fdbg-cnt=@var{counter-value-list} @gol
588 -fdisable-ipa-@var{pass_name} @gol
589 -fdisable-rtl-@var{pass_name} @gol
590 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
591 -fdisable-tree-@var{pass_name} @gol
592 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
593 -fdump-debug -fdump-earlydebug @gol
594 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
595 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
596 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
597 -fdump-lang-all @gol
598 -fdump-lang-@var{switch} @gol
599 -fdump-lang-@var{switch}-@var{options} @gol
600 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
601 -fdump-passes @gol
602 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
603 -fdump-statistics @gol
604 -fdump-tree-all @gol
605 -fdump-tree-@var{switch} @gol
606 -fdump-tree-@var{switch}-@var{options} @gol
607 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
608 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
609 -fenable-@var{kind}-@var{pass} @gol
610 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
611 -fira-verbose=@var{n} @gol
612 -flto-report -flto-report-wpa -fmem-report-wpa @gol
613 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
614 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
615 -fprofile-report @gol
616 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
617 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
618 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
619 -fvar-tracking-assignments-toggle -gtoggle @gol
620 -print-file-name=@var{library} -print-libgcc-file-name @gol
621 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
622 -print-prog-name=@var{program} -print-search-dirs -Q @gol
623 -print-sysroot -print-sysroot-headers-suffix @gol
624 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
625
626 @item Machine-Dependent Options
627 @xref{Submodel Options,,Machine-Dependent Options}.
628 @c This list is ordered alphanumerically by subsection name.
629 @c Try and put the significant identifier (CPU or system) first,
630 @c so users have a clue at guessing where the ones they want will be.
631
632 @emph{AArch64 Options}
633 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
634 -mgeneral-regs-only @gol
635 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
636 -mstrict-align -mno-strict-align @gol
637 -momit-leaf-frame-pointer @gol
638 -mtls-dialect=desc -mtls-dialect=traditional @gol
639 -mtls-size=@var{size} @gol
640 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
641 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
642 -mpc-relative-literal-loads @gol
643 -msign-return-address=@var{scope} @gol
644 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
645 +@var{b-key}]|@var{bti} @gol
646 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
647 -moverride=@var{string} -mverbose-cost-dump @gol
648 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
649 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
650 -moutline-atomics }
651
652 @emph{Adapteva Epiphany Options}
653 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
654 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
655 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
656 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
657 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
658 -msplit-vecmove-early -m1reg-@var{reg}}
659
660 @emph{AMD GCN Options}
661 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
662
663 @emph{ARC Options}
664 @gccoptlist{-mbarrel-shifter -mjli-always @gol
665 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
666 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
667 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
668 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
669 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
670 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
671 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
672 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
673 -mvolatile-cache -mtp-regno=@var{regno} @gol
674 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
675 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
676 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
677 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
678 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
679 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
680 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
681 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
682
683 @emph{ARM Options}
684 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
685 -mabi=@var{name} @gol
686 -mapcs-stack-check -mno-apcs-stack-check @gol
687 -mapcs-reentrant -mno-apcs-reentrant @gol
688 -mgeneral-regs-only @gol
689 -msched-prolog -mno-sched-prolog @gol
690 -mlittle-endian -mbig-endian @gol
691 -mbe8 -mbe32 @gol
692 -mfloat-abi=@var{name} @gol
693 -mfp16-format=@var{name}
694 -mthumb-interwork -mno-thumb-interwork @gol
695 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
696 -mtune=@var{name} -mprint-tune-info @gol
697 -mstructure-size-boundary=@var{n} @gol
698 -mabort-on-noreturn @gol
699 -mlong-calls -mno-long-calls @gol
700 -msingle-pic-base -mno-single-pic-base @gol
701 -mpic-register=@var{reg} @gol
702 -mnop-fun-dllimport @gol
703 -mpoke-function-name @gol
704 -mthumb -marm -mflip-thumb @gol
705 -mtpcs-frame -mtpcs-leaf-frame @gol
706 -mcaller-super-interworking -mcallee-super-interworking @gol
707 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
708 -mword-relocations @gol
709 -mfix-cortex-m3-ldrd @gol
710 -munaligned-access @gol
711 -mneon-for-64bits @gol
712 -mslow-flash-data @gol
713 -masm-syntax-unified @gol
714 -mrestrict-it @gol
715 -mverbose-cost-dump @gol
716 -mpure-code @gol
717 -mcmse @gol
718 -mfdpic}
719
720 @emph{AVR Options}
721 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
722 -mbranch-cost=@var{cost} @gol
723 -mcall-prologues -mgas-isr-prologues -mint8 @gol
724 -mn_flash=@var{size} -mno-interrupts @gol
725 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
726 -mfract-convert-truncate @gol
727 -mshort-calls -nodevicelib @gol
728 -Waddr-space-convert -Wmisspelled-isr}
729
730 @emph{Blackfin Options}
731 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
732 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
733 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
734 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
735 -mno-id-shared-library -mshared-library-id=@var{n} @gol
736 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
737 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
738 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
739 -micplb}
740
741 @emph{C6X Options}
742 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
743 -msim -msdata=@var{sdata-type}}
744
745 @emph{CRIS Options}
746 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
747 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
748 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
749 -mstack-align -mdata-align -mconst-align @gol
750 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
751 -melf -maout -melinux -mlinux -sim -sim2 @gol
752 -mmul-bug-workaround -mno-mul-bug-workaround}
753
754 @emph{CR16 Options}
755 @gccoptlist{-mmac @gol
756 -mcr16cplus -mcr16c @gol
757 -msim -mint32 -mbit-ops
758 -mdata-model=@var{model}}
759
760 @emph{C-SKY Options}
761 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
762 -mbig-endian -EB -mlittle-endian -EL @gol
763 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
764 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
765 -mdsp -medsp -mvdsp @gol
766 -mdiv -msmart -mhigh-registers -manchor @gol
767 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
768 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
769
770 @emph{Darwin Options}
771 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
772 -arch_only -bind_at_load -bundle -bundle_loader @gol
773 -client_name -compatibility_version -current_version @gol
774 -dead_strip @gol
775 -dependency-file -dylib_file -dylinker_install_name @gol
776 -dynamic -dynamiclib -exported_symbols_list @gol
777 -filelist -flat_namespace -force_cpusubtype_ALL @gol
778 -force_flat_namespace -headerpad_max_install_names @gol
779 -iframework @gol
780 -image_base -init -install_name -keep_private_externs @gol
781 -multi_module -multiply_defined -multiply_defined_unused @gol
782 -noall_load -no_dead_strip_inits_and_terms @gol
783 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
784 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
785 -private_bundle -read_only_relocs -sectalign @gol
786 -sectobjectsymbols -whyload -seg1addr @gol
787 -sectcreate -sectobjectsymbols -sectorder @gol
788 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
789 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
790 -segprot -segs_read_only_addr -segs_read_write_addr @gol
791 -single_module -static -sub_library -sub_umbrella @gol
792 -twolevel_namespace -umbrella -undefined @gol
793 -unexported_symbols_list -weak_reference_mismatches @gol
794 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
795 -mkernel -mone-byte-bool}
796
797 @emph{DEC Alpha Options}
798 @gccoptlist{-mno-fp-regs -msoft-float @gol
799 -mieee -mieee-with-inexact -mieee-conformant @gol
800 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
801 -mtrap-precision=@var{mode} -mbuild-constants @gol
802 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
803 -mbwx -mmax -mfix -mcix @gol
804 -mfloat-vax -mfloat-ieee @gol
805 -mexplicit-relocs -msmall-data -mlarge-data @gol
806 -msmall-text -mlarge-text @gol
807 -mmemory-latency=@var{time}}
808
809 @emph{eBPF Options}
810 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
811 -mframe-limit=@var{bytes}}
812
813 @emph{FR30 Options}
814 @gccoptlist{-msmall-model -mno-lsim}
815
816 @emph{FT32 Options}
817 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
818
819 @emph{FRV Options}
820 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
821 -mhard-float -msoft-float @gol
822 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
823 -mdouble -mno-double @gol
824 -mmedia -mno-media -mmuladd -mno-muladd @gol
825 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
826 -mlinked-fp -mlong-calls -malign-labels @gol
827 -mlibrary-pic -macc-4 -macc-8 @gol
828 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
829 -moptimize-membar -mno-optimize-membar @gol
830 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
831 -mvliw-branch -mno-vliw-branch @gol
832 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
833 -mno-nested-cond-exec -mtomcat-stats @gol
834 -mTLS -mtls @gol
835 -mcpu=@var{cpu}}
836
837 @emph{GNU/Linux Options}
838 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
839 -tno-android-cc -tno-android-ld}
840
841 @emph{H8/300 Options}
842 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
843
844 @emph{HPPA Options}
845 @gccoptlist{-march=@var{architecture-type} @gol
846 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
847 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
848 -mfixed-range=@var{register-range} @gol
849 -mjump-in-delay -mlinker-opt -mlong-calls @gol
850 -mlong-load-store -mno-disable-fpregs @gol
851 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
852 -mno-jump-in-delay -mno-long-load-store @gol
853 -mno-portable-runtime -mno-soft-float @gol
854 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
855 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
856 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
857 -munix=@var{unix-std} -nolibdld -static -threads}
858
859 @emph{IA-64 Options}
860 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
861 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
862 -mconstant-gp -mauto-pic -mfused-madd @gol
863 -minline-float-divide-min-latency @gol
864 -minline-float-divide-max-throughput @gol
865 -mno-inline-float-divide @gol
866 -minline-int-divide-min-latency @gol
867 -minline-int-divide-max-throughput @gol
868 -mno-inline-int-divide @gol
869 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
870 -mno-inline-sqrt @gol
871 -mdwarf2-asm -mearly-stop-bits @gol
872 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
873 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
874 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
875 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
876 -msched-spec-ldc -msched-spec-control-ldc @gol
877 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
878 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
879 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
880 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
881
882 @emph{LM32 Options}
883 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
884 -msign-extend-enabled -muser-enabled}
885
886 @emph{M32R/D Options}
887 @gccoptlist{-m32r2 -m32rx -m32r @gol
888 -mdebug @gol
889 -malign-loops -mno-align-loops @gol
890 -missue-rate=@var{number} @gol
891 -mbranch-cost=@var{number} @gol
892 -mmodel=@var{code-size-model-type} @gol
893 -msdata=@var{sdata-type} @gol
894 -mno-flush-func -mflush-func=@var{name} @gol
895 -mno-flush-trap -mflush-trap=@var{number} @gol
896 -G @var{num}}
897
898 @emph{M32C Options}
899 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
900
901 @emph{M680x0 Options}
902 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
903 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
904 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
905 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
906 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
907 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
908 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
909 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
910 -mxgot -mno-xgot -mlong-jump-table-offsets}
911
912 @emph{MCore Options}
913 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
914 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
915 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
916 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
917 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
918
919 @emph{MeP Options}
920 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
921 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
922 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
923 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
924 -mtiny=@var{n}}
925
926 @emph{MicroBlaze Options}
927 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
928 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
929 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
930 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
931 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
932 -mpic-data-is-text-relative}
933
934 @emph{MIPS Options}
935 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
936 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
937 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
938 -mips16 -mno-mips16 -mflip-mips16 @gol
939 -minterlink-compressed -mno-interlink-compressed @gol
940 -minterlink-mips16 -mno-interlink-mips16 @gol
941 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
942 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
943 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
944 -mno-float -msingle-float -mdouble-float @gol
945 -modd-spreg -mno-odd-spreg @gol
946 -mabs=@var{mode} -mnan=@var{encoding} @gol
947 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
948 -mmcu -mmno-mcu @gol
949 -meva -mno-eva @gol
950 -mvirt -mno-virt @gol
951 -mxpa -mno-xpa @gol
952 -mcrc -mno-crc @gol
953 -mginv -mno-ginv @gol
954 -mmicromips -mno-micromips @gol
955 -mmsa -mno-msa @gol
956 -mloongson-mmi -mno-loongson-mmi @gol
957 -mloongson-ext -mno-loongson-ext @gol
958 -mloongson-ext2 -mno-loongson-ext2 @gol
959 -mfpu=@var{fpu-type} @gol
960 -msmartmips -mno-smartmips @gol
961 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
962 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
963 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
964 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
965 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
966 -membedded-data -mno-embedded-data @gol
967 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
968 -mcode-readable=@var{setting} @gol
969 -msplit-addresses -mno-split-addresses @gol
970 -mexplicit-relocs -mno-explicit-relocs @gol
971 -mcheck-zero-division -mno-check-zero-division @gol
972 -mdivide-traps -mdivide-breaks @gol
973 -mload-store-pairs -mno-load-store-pairs @gol
974 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
975 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
976 -mfix-24k -mno-fix-24k @gol
977 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
978 -mfix-r5900 -mno-fix-r5900 @gol
979 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
980 -mfix-vr4120 -mno-fix-vr4120 @gol
981 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
982 -mflush-func=@var{func} -mno-flush-func @gol
983 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
984 -mcompact-branches=@var{policy} @gol
985 -mfp-exceptions -mno-fp-exceptions @gol
986 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
987 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
988 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
989 -mframe-header-opt -mno-frame-header-opt}
990
991 @emph{MMIX Options}
992 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
993 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
994 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
995 -mno-base-addresses -msingle-exit -mno-single-exit}
996
997 @emph{MN10300 Options}
998 @gccoptlist{-mmult-bug -mno-mult-bug @gol
999 -mno-am33 -mam33 -mam33-2 -mam34 @gol
1000 -mtune=@var{cpu-type} @gol
1001 -mreturn-pointer-on-d0 @gol
1002 -mno-crt0 -mrelax -mliw -msetlb}
1003
1004 @emph{Moxie Options}
1005 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1006
1007 @emph{MSP430 Options}
1008 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1009 -mwarn-mcu @gol
1010 -mcode-region= -mdata-region= @gol
1011 -msilicon-errata= -msilicon-errata-warn= @gol
1012 -mhwmult= -minrt}
1013
1014 @emph{NDS32 Options}
1015 @gccoptlist{-mbig-endian -mlittle-endian @gol
1016 -mreduced-regs -mfull-regs @gol
1017 -mcmov -mno-cmov @gol
1018 -mext-perf -mno-ext-perf @gol
1019 -mext-perf2 -mno-ext-perf2 @gol
1020 -mext-string -mno-ext-string @gol
1021 -mv3push -mno-v3push @gol
1022 -m16bit -mno-16bit @gol
1023 -misr-vector-size=@var{num} @gol
1024 -mcache-block-size=@var{num} @gol
1025 -march=@var{arch} @gol
1026 -mcmodel=@var{code-model} @gol
1027 -mctor-dtor -mrelax}
1028
1029 @emph{Nios II Options}
1030 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1031 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1032 -mel -meb @gol
1033 -mno-bypass-cache -mbypass-cache @gol
1034 -mno-cache-volatile -mcache-volatile @gol
1035 -mno-fast-sw-div -mfast-sw-div @gol
1036 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1037 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1038 -mcustom-fpu-cfg=@var{name} @gol
1039 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1040 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1041
1042 @emph{Nvidia PTX Options}
1043 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1044
1045 @emph{OpenRISC Options}
1046 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1047 -msoft-mul -msoft-div @gol
1048 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1049 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1050
1051 @emph{PDP-11 Options}
1052 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1053 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1054 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1055
1056 @emph{picoChip Options}
1057 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1058 -msymbol-as-address -mno-inefficient-warnings}
1059
1060 @emph{PowerPC Options}
1061 See RS/6000 and PowerPC Options.
1062
1063 @emph{PRU Options}
1064 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1065 -mabi=@var{variant} @gol}
1066
1067 @emph{RISC-V Options}
1068 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1069 -mplt -mno-plt @gol
1070 -mabi=@var{ABI-string} @gol
1071 -mfdiv -mno-fdiv @gol
1072 -mdiv -mno-div @gol
1073 -march=@var{ISA-string} @gol
1074 -mtune=@var{processor-string} @gol
1075 -mpreferred-stack-boundary=@var{num} @gol
1076 -msmall-data-limit=@var{N-bytes} @gol
1077 -msave-restore -mno-save-restore @gol
1078 -mstrict-align -mno-strict-align @gol
1079 -mcmodel=medlow -mcmodel=medany @gol
1080 -mexplicit-relocs -mno-explicit-relocs @gol
1081 -mrelax -mno-relax @gol
1082 -mriscv-attribute -mmo-riscv-attribute @gol
1083 -malign-data=@var{type}}
1084
1085 @emph{RL78 Options}
1086 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1087 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1088 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1089
1090 @emph{RS/6000 and PowerPC Options}
1091 @gccoptlist{-mcpu=@var{cpu-type} @gol
1092 -mtune=@var{cpu-type} @gol
1093 -mcmodel=@var{code-model} @gol
1094 -mpowerpc64 @gol
1095 -maltivec -mno-altivec @gol
1096 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1097 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1098 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1099 -mfprnd -mno-fprnd @gol
1100 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1101 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1102 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1103 -malign-power -malign-natural @gol
1104 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1105 -mupdate -mno-update @gol
1106 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1107 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1108 -mstrict-align -mno-strict-align -mrelocatable @gol
1109 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1110 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1111 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1112 -mprioritize-restricted-insns=@var{priority} @gol
1113 -msched-costly-dep=@var{dependence_type} @gol
1114 -minsert-sched-nops=@var{scheme} @gol
1115 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1116 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1117 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1118 -mtraceback=@var{traceback_type} @gol
1119 -maix-struct-return -msvr4-struct-return @gol
1120 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1121 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1122 -mblock-move-inline-limit=@var{num} @gol
1123 -mblock-compare-inline-limit=@var{num} @gol
1124 -mblock-compare-inline-loop-limit=@var{num} @gol
1125 -mstring-compare-inline-limit=@var{num} @gol
1126 -misel -mno-isel @gol
1127 -mvrsave -mno-vrsave @gol
1128 -mmulhw -mno-mulhw @gol
1129 -mdlmzb -mno-dlmzb @gol
1130 -mprototype -mno-prototype @gol
1131 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1132 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1133 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1134 -mno-recip-precision @gol
1135 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1136 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1137 -msave-toc-indirect -mno-save-toc-indirect @gol
1138 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1139 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1140 -mquad-memory -mno-quad-memory @gol
1141 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1142 -mcompat-align-parm -mno-compat-align-parm @gol
1143 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1144 -mgnu-attribute -mno-gnu-attribute @gol
1145 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1146 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1147
1148 @emph{RX Options}
1149 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1150 -mcpu=@gol
1151 -mbig-endian-data -mlittle-endian-data @gol
1152 -msmall-data @gol
1153 -msim -mno-sim@gol
1154 -mas100-syntax -mno-as100-syntax@gol
1155 -mrelax@gol
1156 -mmax-constant-size=@gol
1157 -mint-register=@gol
1158 -mpid@gol
1159 -mallow-string-insns -mno-allow-string-insns@gol
1160 -mjsr@gol
1161 -mno-warn-multiple-fast-interrupts@gol
1162 -msave-acc-in-interrupts}
1163
1164 @emph{S/390 and zSeries Options}
1165 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1166 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1167 -mlong-double-64 -mlong-double-128 @gol
1168 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1169 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1170 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1171 -mhtm -mvx -mzvector @gol
1172 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1173 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1174 -mhotpatch=@var{halfwords},@var{halfwords}}
1175
1176 @emph{Score Options}
1177 @gccoptlist{-meb -mel @gol
1178 -mnhwloop @gol
1179 -muls @gol
1180 -mmac @gol
1181 -mscore5 -mscore5u -mscore7 -mscore7d}
1182
1183 @emph{SH Options}
1184 @gccoptlist{-m1 -m2 -m2e @gol
1185 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1186 -m3 -m3e @gol
1187 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1188 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1189 -mb -ml -mdalign -mrelax @gol
1190 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1191 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1192 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1193 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1194 -maccumulate-outgoing-args @gol
1195 -matomic-model=@var{atomic-model} @gol
1196 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1197 -mcbranch-force-delay-slot @gol
1198 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1199 -mpretend-cmove -mtas}
1200
1201 @emph{Solaris 2 Options}
1202 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1203 -pthreads}
1204
1205 @emph{SPARC Options}
1206 @gccoptlist{-mcpu=@var{cpu-type} @gol
1207 -mtune=@var{cpu-type} @gol
1208 -mcmodel=@var{code-model} @gol
1209 -mmemory-model=@var{mem-model} @gol
1210 -m32 -m64 -mapp-regs -mno-app-regs @gol
1211 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1212 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1213 -mhard-quad-float -msoft-quad-float @gol
1214 -mstack-bias -mno-stack-bias @gol
1215 -mstd-struct-return -mno-std-struct-return @gol
1216 -munaligned-doubles -mno-unaligned-doubles @gol
1217 -muser-mode -mno-user-mode @gol
1218 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1219 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1220 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1221 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1222 -mpopc -mno-popc -msubxc -mno-subxc @gol
1223 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1224 -mlra -mno-lra}
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 @itemx -fconcepts-ts
2519 @opindex fconcepts
2520 @opindex fconcepts-ts
2521 Below @option{-std=c++2a}, @option{-fconcepts} enables support for the
2522 C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
2523
2524 With @option{-std=c++2a} and above, Concepts are part of the language
2525 standard, so @option{-fconcepts} defaults to on. But the standard
2526 specification of Concepts differs significantly from the TS, so some
2527 constructs that were allowed in the TS but didn't make it into the
2528 standard can still be enabled by @option{-fconcepts-ts}.
2529
2530 @item -fconstexpr-depth=@var{n}
2531 @opindex fconstexpr-depth
2532 Set the maximum nested evaluation depth for C++11 constexpr functions
2533 to @var{n}. A limit is needed to detect endless recursion during
2534 constant expression evaluation. The minimum specified by the standard
2535 is 512.
2536
2537 @item -fconstexpr-cache-depth=@var{n}
2538 @opindex fconstexpr-cache-depth
2539 Set the maximum level of nested evaluation depth for C++11 constexpr
2540 functions that will be cached to @var{n}. This is a heuristic that
2541 trades off compilation speed (when the cache avoids repeated
2542 calculations) against memory consumption (when the cache grows very
2543 large from highly recursive evaluations). The default is 8. Very few
2544 users are likely to want to adjust it, but if your code does heavy
2545 constexpr calculations you might want to experiment to find which
2546 value works best for you.
2547
2548 @item -fconstexpr-loop-limit=@var{n}
2549 @opindex fconstexpr-loop-limit
2550 Set the maximum number of iterations for a loop in C++14 constexpr functions
2551 to @var{n}. A limit is needed to detect infinite loops during
2552 constant expression evaluation. The default is 262144 (1<<18).
2553
2554 @item -fconstexpr-ops-limit=@var{n}
2555 @opindex fconstexpr-ops-limit
2556 Set the maximum number of operations during a single constexpr evaluation.
2557 Even when number of iterations of a single loop is limited with the above limit,
2558 if there are several nested loops and each of them has many iterations but still
2559 smaller than the above limit, or if in a body of some loop or even outside
2560 of a loop too many expressions need to be evaluated, the resulting constexpr
2561 evaluation might take too long.
2562 The default is 33554432 (1<<25).
2563
2564 @item -fno-elide-constructors
2565 @opindex fno-elide-constructors
2566 @opindex felide-constructors
2567 The C++ standard allows an implementation to omit creating a temporary
2568 that is only used to initialize another object of the same type.
2569 Specifying this option disables that optimization, and forces G++ to
2570 call the copy constructor in all cases. This option also causes G++
2571 to call trivial member functions which otherwise would be expanded inline.
2572
2573 In C++17, the compiler is required to omit these temporaries, but this
2574 option still affects trivial member functions.
2575
2576 @item -fno-enforce-eh-specs
2577 @opindex fno-enforce-eh-specs
2578 @opindex fenforce-eh-specs
2579 Don't generate code to check for violation of exception specifications
2580 at run time. This option violates the C++ standard, but may be useful
2581 for reducing code size in production builds, much like defining
2582 @code{NDEBUG}. This does not give user code permission to throw
2583 exceptions in violation of the exception specifications; the compiler
2584 still optimizes based on the specifications, so throwing an
2585 unexpected exception results in undefined behavior at run time.
2586
2587 @item -fextern-tls-init
2588 @itemx -fno-extern-tls-init
2589 @opindex fextern-tls-init
2590 @opindex fno-extern-tls-init
2591 The C++11 and OpenMP standards allow @code{thread_local} and
2592 @code{threadprivate} variables to have dynamic (runtime)
2593 initialization. To support this, any use of such a variable goes
2594 through a wrapper function that performs any necessary initialization.
2595 When the use and definition of the variable are in the same
2596 translation unit, this overhead can be optimized away, but when the
2597 use is in a different translation unit there is significant overhead
2598 even if the variable doesn't actually need dynamic initialization. If
2599 the programmer can be sure that no use of the variable in a
2600 non-defining TU needs to trigger dynamic initialization (either
2601 because the variable is statically initialized, or a use of the
2602 variable in the defining TU will be executed before any uses in
2603 another TU), they can avoid this overhead with the
2604 @option{-fno-extern-tls-init} option.
2605
2606 On targets that support symbol aliases, the default is
2607 @option{-fextern-tls-init}. On targets that do not support symbol
2608 aliases, the default is @option{-fno-extern-tls-init}.
2609
2610 @item -fno-gnu-keywords
2611 @opindex fno-gnu-keywords
2612 @opindex fgnu-keywords
2613 Do not recognize @code{typeof} as a keyword, so that code can use this
2614 word as an identifier. You can use the keyword @code{__typeof__} instead.
2615 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2616 @option{-std=c++98}, @option{-std=c++11}, etc.
2617
2618 @item -fno-implicit-templates
2619 @opindex fno-implicit-templates
2620 @opindex fimplicit-templates
2621 Never emit code for non-inline templates that are instantiated
2622 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2623 If you use this option, you must take care to structure your code to
2624 include all the necessary explicit instantiations to avoid getting
2625 undefined symbols at link time.
2626 @xref{Template Instantiation}, for more information.
2627
2628 @item -fno-implicit-inline-templates
2629 @opindex fno-implicit-inline-templates
2630 @opindex fimplicit-inline-templates
2631 Don't emit code for implicit instantiations of inline templates, either.
2632 The default is to handle inlines differently so that compiles with and
2633 without optimization need the same set of explicit instantiations.
2634
2635 @item -fno-implement-inlines
2636 @opindex fno-implement-inlines
2637 @opindex fimplement-inlines
2638 To save space, do not emit out-of-line copies of inline functions
2639 controlled by @code{#pragma implementation}. This causes linker
2640 errors if these functions are not inlined everywhere they are called.
2641
2642 @item -fms-extensions
2643 @opindex fms-extensions
2644 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2645 int and getting a pointer to member function via non-standard syntax.
2646
2647 @item -fnew-inheriting-ctors
2648 @opindex fnew-inheriting-ctors
2649 Enable the P0136 adjustment to the semantics of C++11 constructor
2650 inheritance. This is part of C++17 but also considered to be a Defect
2651 Report against C++11 and C++14. This flag is enabled by default
2652 unless @option{-fabi-version=10} or lower is specified.
2653
2654 @item -fnew-ttp-matching
2655 @opindex fnew-ttp-matching
2656 Enable the P0522 resolution to Core issue 150, template template
2657 parameters and default arguments: this allows a template with default
2658 template arguments as an argument for a template template parameter
2659 with fewer template parameters. This flag is enabled by default for
2660 @option{-std=c++17}.
2661
2662 @item -fno-nonansi-builtins
2663 @opindex fno-nonansi-builtins
2664 @opindex fnonansi-builtins
2665 Disable built-in declarations of functions that are not mandated by
2666 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2667 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2668
2669 @item -fnothrow-opt
2670 @opindex fnothrow-opt
2671 Treat a @code{throw()} exception specification as if it were a
2672 @code{noexcept} specification to reduce or eliminate the text size
2673 overhead relative to a function with no exception specification. If
2674 the function has local variables of types with non-trivial
2675 destructors, the exception specification actually makes the
2676 function smaller because the EH cleanups for those variables can be
2677 optimized away. The semantic effect is that an exception thrown out of
2678 a function with such an exception specification results in a call
2679 to @code{terminate} rather than @code{unexpected}.
2680
2681 @item -fno-operator-names
2682 @opindex fno-operator-names
2683 @opindex foperator-names
2684 Do not treat the operator name keywords @code{and}, @code{bitand},
2685 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2686 synonyms as keywords.
2687
2688 @item -fno-optional-diags
2689 @opindex fno-optional-diags
2690 @opindex foptional-diags
2691 Disable diagnostics that the standard says a compiler does not need to
2692 issue. Currently, the only such diagnostic issued by G++ is the one for
2693 a name having multiple meanings within a class.
2694
2695 @item -fpermissive
2696 @opindex fpermissive
2697 Downgrade some diagnostics about nonconformant code from errors to
2698 warnings. Thus, using @option{-fpermissive} allows some
2699 nonconforming code to compile.
2700
2701 @item -fno-pretty-templates
2702 @opindex fno-pretty-templates
2703 @opindex fpretty-templates
2704 When an error message refers to a specialization of a function
2705 template, the compiler normally prints the signature of the
2706 template followed by the template arguments and any typedefs or
2707 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2708 rather than @code{void f(int)}) so that it's clear which template is
2709 involved. When an error message refers to a specialization of a class
2710 template, the compiler omits any template arguments that match
2711 the default template arguments for that template. If either of these
2712 behaviors make it harder to understand the error message rather than
2713 easier, you can use @option{-fno-pretty-templates} to disable them.
2714
2715 @item -fno-rtti
2716 @opindex fno-rtti
2717 @opindex frtti
2718 Disable generation of information about every class with virtual
2719 functions for use by the C++ run-time type identification features
2720 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2721 of the language, you can save some space by using this flag. Note that
2722 exception handling uses the same information, but G++ generates it as
2723 needed. The @code{dynamic_cast} operator can still be used for casts that
2724 do not require run-time type information, i.e.@: casts to @code{void *} or to
2725 unambiguous base classes.
2726
2727 Mixing code compiled with @option{-frtti} with that compiled with
2728 @option{-fno-rtti} may not work. For example, programs may
2729 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2730 for a class compiled with @option{-frtti}.
2731
2732 @item -fsized-deallocation
2733 @opindex fsized-deallocation
2734 Enable the built-in global declarations
2735 @smallexample
2736 void operator delete (void *, std::size_t) noexcept;
2737 void operator delete[] (void *, std::size_t) noexcept;
2738 @end smallexample
2739 as introduced in C++14. This is useful for user-defined replacement
2740 deallocation functions that, for example, use the size of the object
2741 to make deallocation faster. Enabled by default under
2742 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2743 warns about places that might want to add a definition.
2744
2745 @item -fstrict-enums
2746 @opindex fstrict-enums
2747 Allow the compiler to optimize using the assumption that a value of
2748 enumerated type can only be one of the values of the enumeration (as
2749 defined in the C++ standard; basically, a value that can be
2750 represented in the minimum number of bits needed to represent all the
2751 enumerators). This assumption may not be valid if the program uses a
2752 cast to convert an arbitrary integer value to the enumerated type.
2753
2754 @item -fstrong-eval-order
2755 @opindex fstrong-eval-order
2756 Evaluate member access, array subscripting, and shift expressions in
2757 left-to-right order, and evaluate assignment in right-to-left order,
2758 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2759 @option{-fstrong-eval-order=some} enables just the ordering of member
2760 access and shift expressions, and is the default without
2761 @option{-std=c++17}.
2762
2763 @item -ftemplate-backtrace-limit=@var{n}
2764 @opindex ftemplate-backtrace-limit
2765 Set the maximum number of template instantiation notes for a single
2766 warning or error to @var{n}. The default value is 10.
2767
2768 @item -ftemplate-depth=@var{n}
2769 @opindex ftemplate-depth
2770 Set the maximum instantiation depth for template classes to @var{n}.
2771 A limit on the template instantiation depth is needed to detect
2772 endless recursions during template class instantiation. ANSI/ISO C++
2773 conforming programs must not rely on a maximum depth greater than 17
2774 (changed to 1024 in C++11). The default value is 900, as the compiler
2775 can run out of stack space before hitting 1024 in some situations.
2776
2777 @item -fno-threadsafe-statics
2778 @opindex fno-threadsafe-statics
2779 @opindex fthreadsafe-statics
2780 Do not emit the extra code to use the routines specified in the C++
2781 ABI for thread-safe initialization of local statics. You can use this
2782 option to reduce code size slightly in code that doesn't need to be
2783 thread-safe.
2784
2785 @item -fuse-cxa-atexit
2786 @opindex fuse-cxa-atexit
2787 Register destructors for objects with static storage duration with the
2788 @code{__cxa_atexit} function rather than the @code{atexit} function.
2789 This option is required for fully standards-compliant handling of static
2790 destructors, but only works if your C library supports
2791 @code{__cxa_atexit}.
2792
2793 @item -fno-use-cxa-get-exception-ptr
2794 @opindex fno-use-cxa-get-exception-ptr
2795 @opindex fuse-cxa-get-exception-ptr
2796 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2797 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2798 if the runtime routine is not available.
2799
2800 @item -fvisibility-inlines-hidden
2801 @opindex fvisibility-inlines-hidden
2802 This switch declares that the user does not attempt to compare
2803 pointers to inline functions or methods where the addresses of the two functions
2804 are taken in different shared objects.
2805
2806 The effect of this is that GCC may, effectively, mark inline methods with
2807 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2808 appear in the export table of a DSO and do not require a PLT indirection
2809 when used within the DSO@. Enabling this option can have a dramatic effect
2810 on load and link times of a DSO as it massively reduces the size of the
2811 dynamic export table when the library makes heavy use of templates.
2812
2813 The behavior of this switch is not quite the same as marking the
2814 methods as hidden directly, because it does not affect static variables
2815 local to the function or cause the compiler to deduce that
2816 the function is defined in only one shared object.
2817
2818 You may mark a method as having a visibility explicitly to negate the
2819 effect of the switch for that method. For example, if you do want to
2820 compare pointers to a particular inline method, you might mark it as
2821 having default visibility. Marking the enclosing class with explicit
2822 visibility has no effect.
2823
2824 Explicitly instantiated inline methods are unaffected by this option
2825 as their linkage might otherwise cross a shared library boundary.
2826 @xref{Template Instantiation}.
2827
2828 @item -fvisibility-ms-compat
2829 @opindex fvisibility-ms-compat
2830 This flag attempts to use visibility settings to make GCC's C++
2831 linkage model compatible with that of Microsoft Visual Studio.
2832
2833 The flag makes these changes to GCC's linkage model:
2834
2835 @enumerate
2836 @item
2837 It sets the default visibility to @code{hidden}, like
2838 @option{-fvisibility=hidden}.
2839
2840 @item
2841 Types, but not their members, are not hidden by default.
2842
2843 @item
2844 The One Definition Rule is relaxed for types without explicit
2845 visibility specifications that are defined in more than one
2846 shared object: those declarations are permitted if they are
2847 permitted when this option is not used.
2848 @end enumerate
2849
2850 In new code it is better to use @option{-fvisibility=hidden} and
2851 export those classes that are intended to be externally visible.
2852 Unfortunately it is possible for code to rely, perhaps accidentally,
2853 on the Visual Studio behavior.
2854
2855 Among the consequences of these changes are that static data members
2856 of the same type with the same name but defined in different shared
2857 objects are different, so changing one does not change the other;
2858 and that pointers to function members defined in different shared
2859 objects may not compare equal. When this flag is given, it is a
2860 violation of the ODR to define types with the same name differently.
2861
2862 @item -fno-weak
2863 @opindex fno-weak
2864 @opindex fweak
2865 Do not use weak symbol support, even if it is provided by the linker.
2866 By default, G++ uses weak symbols if they are available. This
2867 option exists only for testing, and should not be used by end-users;
2868 it results in inferior code and has no benefits. This option may
2869 be removed in a future release of G++.
2870
2871 @item -nostdinc++
2872 @opindex nostdinc++
2873 Do not search for header files in the standard directories specific to
2874 C++, but do still search the other standard directories. (This option
2875 is used when building the C++ library.)
2876 @end table
2877
2878 In addition, these optimization, warning, and code generation options
2879 have meanings only for C++ programs:
2880
2881 @table @gcctabopt
2882 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2883 @opindex Wabi
2884 @opindex Wno-abi
2885 Warn when G++ it generates code that is probably not compatible with
2886 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2887 ABI with each major release, normally @option{-Wabi} will warn only if
2888 there is a check added later in a release series for an ABI issue
2889 discovered since the initial release. @option{-Wabi} will warn about
2890 more things if an older ABI version is selected (with
2891 @option{-fabi-version=@var{n}}).
2892
2893 @option{-Wabi} can also be used with an explicit version number to
2894 warn about compatibility with a particular @option{-fabi-version}
2895 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2896 @option{-fabi-version=2}.
2897
2898 If an explicit version number is provided and
2899 @option{-fabi-compat-version} is not specified, the version number
2900 from this option is used for compatibility aliases. If no explicit
2901 version number is provided with this option, but
2902 @option{-fabi-compat-version} is specified, that version number is
2903 used for ABI warnings.
2904
2905 Although an effort has been made to warn about
2906 all such cases, there are probably some cases that are not warned about,
2907 even though G++ is generating incompatible code. There may also be
2908 cases where warnings are emitted even though the code that is generated
2909 is compatible.
2910
2911 You should rewrite your code to avoid these warnings if you are
2912 concerned about the fact that code generated by G++ may not be binary
2913 compatible with code generated by other compilers.
2914
2915 Known incompatibilities in @option{-fabi-version=2} (which was the
2916 default from GCC 3.4 to 4.9) include:
2917
2918 @itemize @bullet
2919
2920 @item
2921 A template with a non-type template parameter of reference type was
2922 mangled incorrectly:
2923 @smallexample
2924 extern int N;
2925 template <int &> struct S @{@};
2926 void n (S<N>) @{2@}
2927 @end smallexample
2928
2929 This was fixed in @option{-fabi-version=3}.
2930
2931 @item
2932 SIMD vector types declared using @code{__attribute ((vector_size))} were
2933 mangled in a non-standard way that does not allow for overloading of
2934 functions taking vectors of different sizes.
2935
2936 The mangling was changed in @option{-fabi-version=4}.
2937
2938 @item
2939 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2940 qualifiers, and @code{decltype} of a plain declaration was folded away.
2941
2942 These mangling issues were fixed in @option{-fabi-version=5}.
2943
2944 @item
2945 Scoped enumerators passed as arguments to a variadic function are
2946 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2947 On most targets this does not actually affect the parameter passing
2948 ABI, as there is no way to pass an argument smaller than @code{int}.
2949
2950 Also, the ABI changed the mangling of template argument packs,
2951 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2952 a class scope function used as a template argument.
2953
2954 These issues were corrected in @option{-fabi-version=6}.
2955
2956 @item
2957 Lambdas in default argument scope were mangled incorrectly, and the
2958 ABI changed the mangling of @code{nullptr_t}.
2959
2960 These issues were corrected in @option{-fabi-version=7}.
2961
2962 @item
2963 When mangling a function type with function-cv-qualifiers, the
2964 un-qualified function type was incorrectly treated as a substitution
2965 candidate.
2966
2967 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2968
2969 @item
2970 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2971 unaligned accesses. Note that this did not affect the ABI of a
2972 function with a @code{nullptr_t} parameter, as parameters have a
2973 minimum alignment.
2974
2975 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2976
2977 @item
2978 Target-specific attributes that affect the identity of a type, such as
2979 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2980 did not affect the mangled name, leading to name collisions when
2981 function pointers were used as template arguments.
2982
2983 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2984
2985 @end itemize
2986
2987 It also warns about psABI-related changes. The known psABI changes at this
2988 point include:
2989
2990 @itemize @bullet
2991
2992 @item
2993 For SysV/x86-64, unions with @code{long double} members are
2994 passed in memory as specified in psABI. For example:
2995
2996 @smallexample
2997 union U @{
2998 long double ld;
2999 int i;
3000 @};
3001 @end smallexample
3002
3003 @noindent
3004 @code{union U} is always passed in memory.
3005
3006 @end itemize
3007
3008 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3009 @opindex Wabi-tag
3010 @opindex Wabi-tag
3011 Warn when a type with an ABI tag is used in a context that does not
3012 have that ABI tag. See @ref{C++ Attributes} for more information
3013 about ABI tags.
3014
3015 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3016 @opindex Wcomma-subscript
3017 @opindex Wno-comma-subscript
3018 Warn about uses of a comma expression within a subscripting expression.
3019 This usage was deprecated in C++2a. However, a comma expression wrapped
3020 in @code{( )} is not deprecated. Example:
3021
3022 @smallexample
3023 @group
3024 void f(int *a, int b, int c) @{
3025 a[b,c]; // deprecated
3026 a[(b,c)]; // OK
3027 @}
3028 @end group
3029 @end smallexample
3030
3031 Enabled by default with @option{-std=c++2a}.
3032
3033 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3034 @opindex Wctor-dtor-privacy
3035 @opindex Wno-ctor-dtor-privacy
3036 Warn when a class seems unusable because all the constructors or
3037 destructors in that class are private, and it has neither friends nor
3038 public static member functions. Also warn if there are no non-private
3039 methods, and there's at least one private member function that isn't
3040 a constructor or destructor.
3041
3042 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3043 @opindex Wdelete-non-virtual-dtor
3044 @opindex Wno-delete-non-virtual-dtor
3045 Warn when @code{delete} is used to destroy an instance of a class that
3046 has virtual functions and non-virtual destructor. It is unsafe to delete
3047 an instance of a derived class through a pointer to a base class if the
3048 base class does not have a virtual destructor. This warning is enabled
3049 by @option{-Wall}.
3050
3051 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3052 @opindex Wdeprecated-copy
3053 @opindex Wno-deprecated-copy
3054 Warn that the implicit declaration of a copy constructor or copy
3055 assignment operator is deprecated if the class has a user-provided
3056 copy constructor or copy assignment operator, in C++11 and up. This
3057 warning is enabled by @option{-Wextra}. With
3058 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3059 user-provided destructor.
3060
3061 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3062 @opindex Winit-list-lifetime
3063 @opindex Wno-init-list-lifetime
3064 Do not warn about uses of @code{std::initializer_list} that are likely
3065 to result in dangling pointers. Since the underlying array for an
3066 @code{initializer_list} is handled like a normal C++ temporary object,
3067 it is easy to inadvertently keep a pointer to the array past the end
3068 of the array's lifetime. For example:
3069
3070 @itemize @bullet
3071 @item
3072 If a function returns a temporary @code{initializer_list}, or a local
3073 @code{initializer_list} variable, the array's lifetime ends at the end
3074 of the return statement, so the value returned has a dangling pointer.
3075
3076 @item
3077 If a new-expression creates an @code{initializer_list}, the array only
3078 lives until the end of the enclosing full-expression, so the
3079 @code{initializer_list} in the heap has a dangling pointer.
3080
3081 @item
3082 When an @code{initializer_list} variable is assigned from a
3083 brace-enclosed initializer list, the temporary array created for the
3084 right side of the assignment only lives until the end of the
3085 full-expression, so at the next statement the @code{initializer_list}
3086 variable has a dangling pointer.
3087
3088 @smallexample
3089 // li's initial underlying array lives as long as li
3090 std::initializer_list<int> li = @{ 1,2,3 @};
3091 // assignment changes li to point to a temporary array
3092 li = @{ 4, 5 @};
3093 // now the temporary is gone and li has a dangling pointer
3094 int i = li.begin()[0] // undefined behavior
3095 @end smallexample
3096
3097 @item
3098 When a list constructor stores the @code{begin} pointer from the
3099 @code{initializer_list} argument, this doesn't extend the lifetime of
3100 the array, so if a class variable is constructed from a temporary
3101 @code{initializer_list}, the pointer is left dangling by the end of
3102 the variable declaration statement.
3103
3104 @end itemize
3105
3106 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3107 @opindex Wliteral-suffix
3108 @opindex Wno-literal-suffix
3109 Warn when a string or character literal is followed by a ud-suffix which does
3110 not begin with an underscore. As a conforming extension, GCC treats such
3111 suffixes as separate preprocessing tokens in order to maintain backwards
3112 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3113 For example:
3114
3115 @smallexample
3116 #define __STDC_FORMAT_MACROS
3117 #include <inttypes.h>
3118 #include <stdio.h>
3119
3120 int main() @{
3121 int64_t i64 = 123;
3122 printf("My int64: %" PRId64"\n", i64);
3123 @}
3124 @end smallexample
3125
3126 In this case, @code{PRId64} is treated as a separate preprocessing token.
3127
3128 Additionally, warn when a user-defined literal operator is declared with
3129 a literal suffix identifier that doesn't begin with an underscore. Literal
3130 suffix identifiers that don't begin with an underscore are reserved for
3131 future standardization.
3132
3133 This warning is enabled by default.
3134
3135 @item -Wlto-type-mismatch
3136 @opindex Wlto-type-mismatch
3137 @opindex Wno-lto-type-mismatch
3138
3139 During the link-time optimization warn about type mismatches in
3140 global declarations from different compilation units.
3141 Requires @option{-flto} to be enabled. Enabled by default.
3142
3143 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3144 @opindex Wnarrowing
3145 @opindex Wno-narrowing
3146 For C++11 and later standards, narrowing conversions are diagnosed by default,
3147 as required by the standard. A narrowing conversion from a constant produces
3148 an error, and a narrowing conversion from a non-constant produces a warning,
3149 but @option{-Wno-narrowing} suppresses the diagnostic.
3150 Note that this does not affect the meaning of well-formed code;
3151 narrowing conversions are still considered ill-formed in SFINAE contexts.
3152
3153 With @option{-Wnarrowing} in C++98, warn when a narrowing
3154 conversion prohibited by C++11 occurs within
3155 @samp{@{ @}}, e.g.
3156
3157 @smallexample
3158 int i = @{ 2.2 @}; // error: narrowing from double to int
3159 @end smallexample
3160
3161 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3162
3163 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3164 @opindex Wnoexcept
3165 @opindex Wno-noexcept
3166 Warn when a noexcept-expression evaluates to false because of a call
3167 to a function that does not have a non-throwing exception
3168 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3169 the compiler to never throw an exception.
3170
3171 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3172 @opindex Wnoexcept-type
3173 @opindex Wno-noexcept-type
3174 Warn if the C++17 feature making @code{noexcept} part of a function
3175 type changes the mangled name of a symbol relative to C++14. Enabled
3176 by @option{-Wabi} and @option{-Wc++17-compat}.
3177
3178 As an example:
3179
3180 @smallexample
3181 template <class T> void f(T t) @{ t(); @};
3182 void g() noexcept;
3183 void h() @{ f(g); @}
3184 @end smallexample
3185
3186 @noindent
3187 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3188 C++17 it calls @code{f<void(*)()noexcept>}.
3189
3190 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3191 @opindex Wclass-memaccess
3192 @opindex Wno-class-memaccess
3193 Warn when the destination of a call to a raw memory function such as
3194 @code{memset} or @code{memcpy} is an object of class type, and when writing
3195 into such an object might bypass the class non-trivial or deleted constructor
3196 or copy assignment, violate const-correctness or encapsulation, or corrupt
3197 virtual table pointers. Modifying the representation of such objects may
3198 violate invariants maintained by member functions of the class. For example,
3199 the call to @code{memset} below is undefined because it modifies a non-trivial
3200 class object and is, therefore, diagnosed. The safe way to either initialize
3201 or clear the storage of objects of such types is by using the appropriate
3202 constructor or assignment operator, if one is available.
3203 @smallexample
3204 std::string str = "abc";
3205 memset (&str, 0, sizeof str);
3206 @end smallexample
3207 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3208 Explicitly casting the pointer to the class object to @code{void *} or
3209 to a type that can be safely accessed by the raw memory function suppresses
3210 the warning.
3211
3212 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3213 @opindex Wnon-virtual-dtor
3214 @opindex Wno-non-virtual-dtor
3215 Warn when a class has virtual functions and an accessible non-virtual
3216 destructor itself or in an accessible polymorphic base class, in which
3217 case it is possible but unsafe to delete an instance of a derived
3218 class through a pointer to the class itself or base class. This
3219 warning is automatically enabled if @option{-Weffc++} is specified.
3220
3221 @item -Wregister @r{(C++ and Objective-C++ only)}
3222 @opindex Wregister
3223 @opindex Wno-register
3224 Warn on uses of the @code{register} storage class specifier, except
3225 when it is part of the GNU @ref{Explicit Register Variables} extension.
3226 The use of the @code{register} keyword as storage class specifier has
3227 been deprecated in C++11 and removed in C++17.
3228 Enabled by default with @option{-std=c++17}.
3229
3230 @item -Wreorder @r{(C++ and Objective-C++ only)}
3231 @opindex Wreorder
3232 @opindex Wno-reorder
3233 @cindex reordering, warning
3234 @cindex warning for reordering of member initializers
3235 Warn when the order of member initializers given in the code does not
3236 match the order in which they must be executed. For instance:
3237
3238 @smallexample
3239 struct A @{
3240 int i;
3241 int j;
3242 A(): j (0), i (1) @{ @}
3243 @};
3244 @end smallexample
3245
3246 @noindent
3247 The compiler rearranges the member initializers for @code{i}
3248 and @code{j} to match the declaration order of the members, emitting
3249 a warning to that effect. This warning is enabled by @option{-Wall}.
3250
3251 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3252 @opindex Wpessimizing-move
3253 @opindex Wno-pessimizing-move
3254 This warning warns when a call to @code{std::move} prevents copy
3255 elision. A typical scenario when copy elision can occur is when returning in
3256 a function with a class return type, when the expression being returned is the
3257 name of a non-volatile automatic object, and is not a function parameter, and
3258 has the same type as the function return type.
3259
3260 @smallexample
3261 struct T @{
3262 @dots{}
3263 @};
3264 T fn()
3265 @{
3266 T t;
3267 @dots{}
3268 return std::move (t);
3269 @}
3270 @end smallexample
3271
3272 But in this example, the @code{std::move} call prevents copy elision.
3273
3274 This warning is enabled by @option{-Wall}.
3275
3276 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3277 @opindex Wredundant-move
3278 @opindex Wno-redundant-move
3279 This warning warns about redundant calls to @code{std::move}; that is, when
3280 a move operation would have been performed even without the @code{std::move}
3281 call. This happens because the compiler is forced to treat the object as if
3282 it were an rvalue in certain situations such as returning a local variable,
3283 where copy elision isn't applicable. Consider:
3284
3285 @smallexample
3286 struct T @{
3287 @dots{}
3288 @};
3289 T fn(T t)
3290 @{
3291 @dots{}
3292 return std::move (t);
3293 @}
3294 @end smallexample
3295
3296 Here, the @code{std::move} call is redundant. Because G++ implements Core
3297 Issue 1579, another example is:
3298
3299 @smallexample
3300 struct T @{ // convertible to U
3301 @dots{}
3302 @};
3303 struct U @{
3304 @dots{}
3305 @};
3306 U fn()
3307 @{
3308 T t;
3309 @dots{}
3310 return std::move (t);
3311 @}
3312 @end smallexample
3313 In this example, copy elision isn't applicable because the type of the
3314 expression being returned and the function return type differ, yet G++
3315 treats the return value as if it were designated by an rvalue.
3316
3317 This warning is enabled by @option{-Wextra}.
3318
3319 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3320 @opindex fext-numeric-literals
3321 @opindex fno-ext-numeric-literals
3322 Accept imaginary, fixed-point, or machine-defined
3323 literal number suffixes as GNU extensions.
3324 When this option is turned off these suffixes are treated
3325 as C++11 user-defined literal numeric suffixes.
3326 This is on by default for all pre-C++11 dialects and all GNU dialects:
3327 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3328 @option{-std=gnu++14}.
3329 This option is off by default
3330 for ISO C++11 onwards (@option{-std=c++11}, ...).
3331 @end table
3332
3333 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3334
3335 @table @gcctabopt
3336 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3337 @opindex Weffc++
3338 @opindex Wno-effc++
3339 Warn about violations of the following style guidelines from Scott Meyers'
3340 @cite{Effective C++} series of books:
3341
3342 @itemize @bullet
3343 @item
3344 Define a copy constructor and an assignment operator for classes
3345 with dynamically-allocated memory.
3346
3347 @item
3348 Prefer initialization to assignment in constructors.
3349
3350 @item
3351 Have @code{operator=} return a reference to @code{*this}.
3352
3353 @item
3354 Don't try to return a reference when you must return an object.
3355
3356 @item
3357 Distinguish between prefix and postfix forms of increment and
3358 decrement operators.
3359
3360 @item
3361 Never overload @code{&&}, @code{||}, or @code{,}.
3362
3363 @end itemize
3364
3365 This option also enables @option{-Wnon-virtual-dtor}, which is also
3366 one of the effective C++ recommendations. However, the check is
3367 extended to warn about the lack of virtual destructor in accessible
3368 non-polymorphic bases classes too.
3369
3370 When selecting this option, be aware that the standard library
3371 headers do not obey all of these guidelines; use @samp{grep -v}
3372 to filter out those warnings.
3373
3374 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3375 @opindex Wstrict-null-sentinel
3376 @opindex Wno-strict-null-sentinel
3377 Warn about the use of an uncasted @code{NULL} as sentinel. When
3378 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3379 to @code{__null}. Although it is a null pointer constant rather than a
3380 null pointer, it is guaranteed to be of the same size as a pointer.
3381 But this use is not portable across different compilers.
3382
3383 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3384 @opindex Wno-non-template-friend
3385 @opindex Wnon-template-friend
3386 Disable warnings when non-template friend functions are declared
3387 within a template. In very old versions of GCC that predate implementation
3388 of the ISO standard, declarations such as
3389 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3390 could be interpreted as a particular specialization of a template
3391 function; the warning exists to diagnose compatibility problems,
3392 and is enabled by default.
3393
3394 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3395 @opindex Wold-style-cast
3396 @opindex Wno-old-style-cast
3397 Warn if an old-style (C-style) cast to a non-void type is used within
3398 a C++ program. The new-style casts (@code{dynamic_cast},
3399 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3400 less vulnerable to unintended effects and much easier to search for.
3401
3402 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3403 @opindex Woverloaded-virtual
3404 @opindex Wno-overloaded-virtual
3405 @cindex overloaded virtual function, warning
3406 @cindex warning for overloaded virtual function
3407 Warn when a function declaration hides virtual functions from a
3408 base class. For example, in:
3409
3410 @smallexample
3411 struct A @{
3412 virtual void f();
3413 @};
3414
3415 struct B: public A @{
3416 void f(int);
3417 @};
3418 @end smallexample
3419
3420 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3421 like:
3422
3423 @smallexample
3424 B* b;
3425 b->f();
3426 @end smallexample
3427
3428 @noindent
3429 fails to compile.
3430
3431 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3432 @opindex Wno-pmf-conversions
3433 @opindex Wpmf-conversions
3434 Disable the diagnostic for converting a bound pointer to member function
3435 to a plain pointer.
3436
3437 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3438 @opindex Wsign-promo
3439 @opindex Wno-sign-promo
3440 Warn when overload resolution chooses a promotion from unsigned or
3441 enumerated type to a signed type, over a conversion to an unsigned type of
3442 the same size. Previous versions of G++ tried to preserve
3443 unsignedness, but the standard mandates the current behavior.
3444
3445 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3446 @opindex Wtemplates
3447 @opindex Wno-templates
3448 Warn when a primary template declaration is encountered. Some coding
3449 rules disallow templates, and this may be used to enforce that rule.
3450 The warning is inactive inside a system header file, such as the STL, so
3451 one can still use the STL. One may also instantiate or specialize
3452 templates.
3453
3454 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3455 @opindex Wmultiple-inheritance
3456 @opindex Wno-multiple-inheritance
3457 Warn when a class is defined with multiple direct base classes. Some
3458 coding rules disallow multiple inheritance, and this may be used to
3459 enforce that rule. The warning is inactive inside a system header file,
3460 such as the STL, so one can still use the STL. One may also define
3461 classes that indirectly use multiple inheritance.
3462
3463 @item -Wvirtual-inheritance
3464 @opindex Wvirtual-inheritance
3465 @opindex Wno-virtual-inheritance
3466 Warn when a class is defined with a virtual direct base class. Some
3467 coding rules disallow multiple inheritance, and this may be used to
3468 enforce that rule. The warning is inactive inside a system header file,
3469 such as the STL, so one can still use the STL. One may also define
3470 classes that indirectly use virtual inheritance.
3471
3472 @item -Wnamespaces
3473 @opindex Wnamespaces
3474 @opindex Wno-namespaces
3475 Warn when a namespace definition is opened. Some coding rules disallow
3476 namespaces, and this may be used to enforce that rule. The warning is
3477 inactive inside a system header file, such as the STL, so one can still
3478 use the STL. One may also use using directives and qualified names.
3479
3480 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3481 @opindex Wterminate
3482 @opindex Wno-terminate
3483 Disable the warning about a throw-expression that will immediately
3484 result in a call to @code{terminate}.
3485
3486 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3487 @opindex Wno-class-conversion
3488 @opindex Wclass-conversion
3489 Disable the warning about the case when a conversion function converts an
3490 object to the same type, to a base class of that type, or to void; such
3491 a conversion function will never be called.
3492
3493 @item -Wvolatile @r{(C++ and Objective-C++ only)}
3494 @opindex Wvolatile
3495 @opindex Wno-volatile
3496 Warn about deprecated uses of the @code{volatile} qualifier. This includes
3497 postfix and prefix @code{++} and @code{--} expressions of
3498 @code{volatile}-qualified types, using simple assignments where the left
3499 operand is a @code{volatile}-qualified non-class type for their value,
3500 compound assignments where the left operand is a @code{volatile}-qualified
3501 non-class type, @code{volatile}-qualified function return type,
3502 @code{volatile}-qualified parameter type, and structured bindings of a
3503 @code{volatile}-qualified type. This usage was deprecated in C++20.
3504
3505 Enabled by default with @option{-std=c++2a}.
3506 @end table
3507
3508 @node Objective-C and Objective-C++ Dialect Options
3509 @section Options Controlling Objective-C and Objective-C++ Dialects
3510
3511 @cindex compiler options, Objective-C and Objective-C++
3512 @cindex Objective-C and Objective-C++ options, command-line
3513 @cindex options, Objective-C and Objective-C++
3514 (NOTE: This manual does not describe the Objective-C and Objective-C++
3515 languages themselves. @xref{Standards,,Language Standards
3516 Supported by GCC}, for references.)
3517
3518 This section describes the command-line options that are only meaningful
3519 for Objective-C and Objective-C++ programs. You can also use most of
3520 the language-independent GNU compiler options.
3521 For example, you might compile a file @file{some_class.m} like this:
3522
3523 @smallexample
3524 gcc -g -fgnu-runtime -O -c some_class.m
3525 @end smallexample
3526
3527 @noindent
3528 In this example, @option{-fgnu-runtime} is an option meant only for
3529 Objective-C and Objective-C++ programs; you can use the other options with
3530 any language supported by GCC@.
3531
3532 Note that since Objective-C is an extension of the C language, Objective-C
3533 compilations may also use options specific to the C front-end (e.g.,
3534 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3535 C++-specific options (e.g., @option{-Wabi}).
3536
3537 Here is a list of options that are @emph{only} for compiling Objective-C
3538 and Objective-C++ programs:
3539
3540 @table @gcctabopt
3541 @item -fconstant-string-class=@var{class-name}
3542 @opindex fconstant-string-class
3543 Use @var{class-name} as the name of the class to instantiate for each
3544 literal string specified with the syntax @code{@@"@dots{}"}. The default
3545 class name is @code{NXConstantString} if the GNU runtime is being used, and
3546 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3547 @option{-fconstant-cfstrings} option, if also present, overrides the
3548 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3549 to be laid out as constant CoreFoundation strings.
3550
3551 @item -fgnu-runtime
3552 @opindex fgnu-runtime
3553 Generate object code compatible with the standard GNU Objective-C
3554 runtime. This is the default for most types of systems.
3555
3556 @item -fnext-runtime
3557 @opindex fnext-runtime
3558 Generate output compatible with the NeXT runtime. This is the default
3559 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3560 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3561 used.
3562
3563 @item -fno-nil-receivers
3564 @opindex fno-nil-receivers
3565 @opindex fnil-receivers
3566 Assume that all Objective-C message dispatches (@code{[receiver
3567 message:arg]}) in this translation unit ensure that the receiver is
3568 not @code{nil}. This allows for more efficient entry points in the
3569 runtime to be used. This option is only available in conjunction with
3570 the NeXT runtime and ABI version 0 or 1.
3571
3572 @item -fobjc-abi-version=@var{n}
3573 @opindex fobjc-abi-version
3574 Use version @var{n} of the Objective-C ABI for the selected runtime.
3575 This option is currently supported only for the NeXT runtime. In that
3576 case, Version 0 is the traditional (32-bit) ABI without support for
3577 properties and other Objective-C 2.0 additions. Version 1 is the
3578 traditional (32-bit) ABI with support for properties and other
3579 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3580 nothing is specified, the default is Version 0 on 32-bit target
3581 machines, and Version 2 on 64-bit target machines.
3582
3583 @item -fobjc-call-cxx-cdtors
3584 @opindex fobjc-call-cxx-cdtors
3585 For each Objective-C class, check if any of its instance variables is a
3586 C++ object with a non-trivial default constructor. If so, synthesize a
3587 special @code{- (id) .cxx_construct} instance method which runs
3588 non-trivial default constructors on any such instance variables, in order,
3589 and then return @code{self}. Similarly, check if any instance variable
3590 is a C++ object with a non-trivial destructor, and if so, synthesize a
3591 special @code{- (void) .cxx_destruct} method which runs
3592 all such default destructors, in reverse order.
3593
3594 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3595 methods thusly generated only operate on instance variables
3596 declared in the current Objective-C class, and not those inherited
3597 from superclasses. It is the responsibility of the Objective-C
3598 runtime to invoke all such methods in an object's inheritance
3599 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3600 by the runtime immediately after a new object instance is allocated;
3601 the @code{- (void) .cxx_destruct} methods are invoked immediately
3602 before the runtime deallocates an object instance.
3603
3604 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3605 support for invoking the @code{- (id) .cxx_construct} and
3606 @code{- (void) .cxx_destruct} methods.
3607
3608 @item -fobjc-direct-dispatch
3609 @opindex fobjc-direct-dispatch
3610 Allow fast jumps to the message dispatcher. On Darwin this is
3611 accomplished via the comm page.
3612
3613 @item -fobjc-exceptions
3614 @opindex fobjc-exceptions
3615 Enable syntactic support for structured exception handling in
3616 Objective-C, similar to what is offered by C++. This option
3617 is required to use the Objective-C keywords @code{@@try},
3618 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3619 @code{@@synchronized}. This option is available with both the GNU
3620 runtime and the NeXT runtime (but not available in conjunction with
3621 the NeXT runtime on Mac OS X 10.2 and earlier).
3622
3623 @item -fobjc-gc
3624 @opindex fobjc-gc
3625 Enable garbage collection (GC) in Objective-C and Objective-C++
3626 programs. This option is only available with the NeXT runtime; the
3627 GNU runtime has a different garbage collection implementation that
3628 does not require special compiler flags.
3629
3630 @item -fobjc-nilcheck
3631 @opindex fobjc-nilcheck
3632 For the NeXT runtime with version 2 of the ABI, check for a nil
3633 receiver in method invocations before doing the actual method call.
3634 This is the default and can be disabled using
3635 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3636 checked for nil in this way no matter what this flag is set to.
3637 Currently this flag does nothing when the GNU runtime, or an older
3638 version of the NeXT runtime ABI, is used.
3639
3640 @item -fobjc-std=objc1
3641 @opindex fobjc-std
3642 Conform to the language syntax of Objective-C 1.0, the language
3643 recognized by GCC 4.0. This only affects the Objective-C additions to
3644 the C/C++ language; it does not affect conformance to C/C++ standards,
3645 which is controlled by the separate C/C++ dialect option flags. When
3646 this option is used with the Objective-C or Objective-C++ compiler,
3647 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3648 This is useful if you need to make sure that your Objective-C code can
3649 be compiled with older versions of GCC@.
3650
3651 @item -freplace-objc-classes
3652 @opindex freplace-objc-classes
3653 Emit a special marker instructing @command{ld(1)} not to statically link in
3654 the resulting object file, and allow @command{dyld(1)} to load it in at
3655 run time instead. This is used in conjunction with the Fix-and-Continue
3656 debugging mode, where the object file in question may be recompiled and
3657 dynamically reloaded in the course of program execution, without the need
3658 to restart the program itself. Currently, Fix-and-Continue functionality
3659 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3660 and later.
3661
3662 @item -fzero-link
3663 @opindex fzero-link
3664 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3665 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3666 compile time) with static class references that get initialized at load time,
3667 which improves run-time performance. Specifying the @option{-fzero-link} flag
3668 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3669 to be retained. This is useful in Zero-Link debugging mode, since it allows
3670 for individual class implementations to be modified during program execution.
3671 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3672 regardless of command-line options.
3673
3674 @item -fno-local-ivars
3675 @opindex fno-local-ivars
3676 @opindex flocal-ivars
3677 By default instance variables in Objective-C can be accessed as if
3678 they were local variables from within the methods of the class they're
3679 declared in. This can lead to shadowing between instance variables
3680 and other variables declared either locally inside a class method or
3681 globally with the same name. Specifying the @option{-fno-local-ivars}
3682 flag disables this behavior thus avoiding variable shadowing issues.
3683
3684 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3685 @opindex fivar-visibility
3686 Set the default instance variable visibility to the specified option
3687 so that instance variables declared outside the scope of any access
3688 modifier directives default to the specified visibility.
3689
3690 @item -gen-decls
3691 @opindex gen-decls
3692 Dump interface declarations for all classes seen in the source file to a
3693 file named @file{@var{sourcename}.decl}.
3694
3695 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3696 @opindex Wassign-intercept
3697 @opindex Wno-assign-intercept
3698 Warn whenever an Objective-C assignment is being intercepted by the
3699 garbage collector.
3700
3701 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3702 @opindex Wno-protocol
3703 @opindex Wprotocol
3704 If a class is declared to implement a protocol, a warning is issued for
3705 every method in the protocol that is not implemented by the class. The
3706 default behavior is to issue a warning for every method not explicitly
3707 implemented in the class, even if a method implementation is inherited
3708 from the superclass. If you use the @option{-Wno-protocol} option, then
3709 methods inherited from the superclass are considered to be implemented,
3710 and no warning is issued for them.
3711
3712 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3713 @opindex Wselector
3714 @opindex Wno-selector
3715 Warn if multiple methods of different types for the same selector are
3716 found during compilation. The check is performed on the list of methods
3717 in the final stage of compilation. Additionally, a check is performed
3718 for each selector appearing in a @code{@@selector(@dots{})}
3719 expression, and a corresponding method for that selector has been found
3720 during compilation. Because these checks scan the method table only at
3721 the end of compilation, these warnings are not produced if the final
3722 stage of compilation is not reached, for example because an error is
3723 found during compilation, or because the @option{-fsyntax-only} option is
3724 being used.
3725
3726 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3727 @opindex Wstrict-selector-match
3728 @opindex Wno-strict-selector-match
3729 Warn if multiple methods with differing argument and/or return types are
3730 found for a given selector when attempting to send a message using this
3731 selector to a receiver of type @code{id} or @code{Class}. When this flag
3732 is off (which is the default behavior), the compiler omits such warnings
3733 if any differences found are confined to types that share the same size
3734 and alignment.
3735
3736 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3737 @opindex Wundeclared-selector
3738 @opindex Wno-undeclared-selector
3739 Warn if a @code{@@selector(@dots{})} expression referring to an
3740 undeclared selector is found. A selector is considered undeclared if no
3741 method with that name has been declared before the
3742 @code{@@selector(@dots{})} expression, either explicitly in an
3743 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3744 an @code{@@implementation} section. This option always performs its
3745 checks as soon as a @code{@@selector(@dots{})} expression is found,
3746 while @option{-Wselector} only performs its checks in the final stage of
3747 compilation. This also enforces the coding style convention
3748 that methods and selectors must be declared before being used.
3749
3750 @item -print-objc-runtime-info
3751 @opindex print-objc-runtime-info
3752 Generate C header describing the largest structure that is passed by
3753 value, if any.
3754
3755 @end table
3756
3757 @node Diagnostic Message Formatting Options
3758 @section Options to Control Diagnostic Messages Formatting
3759 @cindex options to control diagnostics formatting
3760 @cindex diagnostic messages
3761 @cindex message formatting
3762
3763 Traditionally, diagnostic messages have been formatted irrespective of
3764 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3765 options described below
3766 to control the formatting algorithm for diagnostic messages,
3767 e.g.@: how many characters per line, how often source location
3768 information should be reported. Note that some language front ends may not
3769 honor these options.
3770
3771 @table @gcctabopt
3772 @item -fmessage-length=@var{n}
3773 @opindex fmessage-length
3774 Try to format error messages so that they fit on lines of about
3775 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3776 done; each error message appears on a single line. This is the
3777 default for all front ends.
3778
3779 Note - this option also affects the display of the @samp{#error} and
3780 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3781 function/type/variable attribute. It does not however affect the
3782 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3783
3784 @item -fdiagnostics-show-location=once
3785 @opindex fdiagnostics-show-location
3786 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3787 reporter to emit source location information @emph{once}; that is, in
3788 case the message is too long to fit on a single physical line and has to
3789 be wrapped, the source location won't be emitted (as prefix) again,
3790 over and over, in subsequent continuation lines. This is the default
3791 behavior.
3792
3793 @item -fdiagnostics-show-location=every-line
3794 Only meaningful in line-wrapping mode. Instructs the diagnostic
3795 messages reporter to emit the same source location information (as
3796 prefix) for physical lines that result from the process of breaking
3797 a message which is too long to fit on a single line.
3798
3799 @item -fdiagnostics-color[=@var{WHEN}]
3800 @itemx -fno-diagnostics-color
3801 @opindex fdiagnostics-color
3802 @cindex highlight, color
3803 @vindex GCC_COLORS @r{environment variable}
3804 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3805 or @samp{auto}. The default depends on how the compiler has been configured,
3806 it can be any of the above @var{WHEN} options or also @samp{never}
3807 if @env{GCC_COLORS} environment variable isn't present in the environment,
3808 and @samp{auto} otherwise.
3809 @samp{auto} means to use color only when the standard error is a terminal.
3810 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3811 aliases for @option{-fdiagnostics-color=always} and
3812 @option{-fdiagnostics-color=never}, respectively.
3813
3814 The colors are defined by the environment variable @env{GCC_COLORS}.
3815 Its value is a colon-separated list of capabilities and Select Graphic
3816 Rendition (SGR) substrings. SGR commands are interpreted by the
3817 terminal or terminal emulator. (See the section in the documentation
3818 of your text terminal for permitted values and their meanings as
3819 character attributes.) These substring values are integers in decimal
3820 representation and can be concatenated with semicolons.
3821 Common values to concatenate include
3822 @samp{1} for bold,
3823 @samp{4} for underline,
3824 @samp{5} for blink,
3825 @samp{7} for inverse,
3826 @samp{39} for default foreground color,
3827 @samp{30} to @samp{37} for foreground colors,
3828 @samp{90} to @samp{97} for 16-color mode foreground colors,
3829 @samp{38;5;0} to @samp{38;5;255}
3830 for 88-color and 256-color modes foreground colors,
3831 @samp{49} for default background color,
3832 @samp{40} to @samp{47} for background colors,
3833 @samp{100} to @samp{107} for 16-color mode background colors,
3834 and @samp{48;5;0} to @samp{48;5;255}
3835 for 88-color and 256-color modes background colors.
3836
3837 The default @env{GCC_COLORS} is
3838 @smallexample
3839 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3840 quote=01:fixit-insert=32:fixit-delete=31:\
3841 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3842 type-diff=01;32
3843 @end smallexample
3844 @noindent
3845 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3846 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3847 @samp{01} is bold, and @samp{31} is red.
3848 Setting @env{GCC_COLORS} to the empty string disables colors.
3849 Supported capabilities are as follows.
3850
3851 @table @code
3852 @item error=
3853 @vindex error GCC_COLORS @r{capability}
3854 SGR substring for error: markers.
3855
3856 @item warning=
3857 @vindex warning GCC_COLORS @r{capability}
3858 SGR substring for warning: markers.
3859
3860 @item note=
3861 @vindex note GCC_COLORS @r{capability}
3862 SGR substring for note: markers.
3863
3864 @item range1=
3865 @vindex range1 GCC_COLORS @r{capability}
3866 SGR substring for first additional range.
3867
3868 @item range2=
3869 @vindex range2 GCC_COLORS @r{capability}
3870 SGR substring for second additional range.
3871
3872 @item locus=
3873 @vindex locus GCC_COLORS @r{capability}
3874 SGR substring for location information, @samp{file:line} or
3875 @samp{file:line:column} etc.
3876
3877 @item quote=
3878 @vindex quote GCC_COLORS @r{capability}
3879 SGR substring for information printed within quotes.
3880
3881 @item fixit-insert=
3882 @vindex fixit-insert GCC_COLORS @r{capability}
3883 SGR substring for fix-it hints suggesting text to
3884 be inserted or replaced.
3885
3886 @item fixit-delete=
3887 @vindex fixit-delete GCC_COLORS @r{capability}
3888 SGR substring for fix-it hints suggesting text to
3889 be deleted.
3890
3891 @item diff-filename=
3892 @vindex diff-filename GCC_COLORS @r{capability}
3893 SGR substring for filename headers within generated patches.
3894
3895 @item diff-hunk=
3896 @vindex diff-hunk GCC_COLORS @r{capability}
3897 SGR substring for the starts of hunks within generated patches.
3898
3899 @item diff-delete=
3900 @vindex diff-delete GCC_COLORS @r{capability}
3901 SGR substring for deleted lines within generated patches.
3902
3903 @item diff-insert=
3904 @vindex diff-insert GCC_COLORS @r{capability}
3905 SGR substring for inserted lines within generated patches.
3906
3907 @item type-diff=
3908 @vindex type-diff GCC_COLORS @r{capability}
3909 SGR substring for highlighting mismatching types within template
3910 arguments in the C++ frontend.
3911 @end table
3912
3913 @item -fdiagnostics-urls[=@var{WHEN}]
3914 @opindex fdiagnostics-urls
3915 @cindex urls
3916 Use escape sequences to embed URLs in diagnostics. For example, when
3917 @option{-fdiagnostics-show-option} emits text showing the command-line
3918 option controlling a diagnostic, embed a URL for documentation of that
3919 option.
3920
3921 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
3922 The default is @samp{auto}, which means to use URL escape sequences only
3923 when the standard error is a terminal.
3924
3925 @item -fno-diagnostics-show-option
3926 @opindex fno-diagnostics-show-option
3927 @opindex fdiagnostics-show-option
3928 By default, each diagnostic emitted includes text indicating the
3929 command-line option that directly controls the diagnostic (if such an
3930 option is known to the diagnostic machinery). Specifying the
3931 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3932
3933 @item -fno-diagnostics-show-caret
3934 @opindex fno-diagnostics-show-caret
3935 @opindex fdiagnostics-show-caret
3936 By default, each diagnostic emitted includes the original source line
3937 and a caret @samp{^} indicating the column. This option suppresses this
3938 information. The source line is truncated to @var{n} characters, if
3939 the @option{-fmessage-length=n} option is given. When the output is done
3940 to the terminal, the width is limited to the width given by the
3941 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3942
3943 @item -fno-diagnostics-show-labels
3944 @opindex fno-diagnostics-show-labels
3945 @opindex fdiagnostics-show-labels
3946 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3947 diagnostics can label ranges of source code with pertinent information, such
3948 as the types of expressions:
3949
3950 @smallexample
3951 printf ("foo %s bar", long_i + long_j);
3952 ~^ ~~~~~~~~~~~~~~~
3953 | |
3954 char * long int
3955 @end smallexample
3956
3957 This option suppresses the printing of these labels (in the example above,
3958 the vertical bars and the ``char *'' and ``long int'' text).
3959
3960 @item -fno-diagnostics-show-line-numbers
3961 @opindex fno-diagnostics-show-line-numbers
3962 @opindex fdiagnostics-show-line-numbers
3963 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3964 a left margin is printed, showing line numbers. This option suppresses this
3965 left margin.
3966
3967 @item -fdiagnostics-minimum-margin-width=@var{width}
3968 @opindex fdiagnostics-minimum-margin-width
3969 This option controls the minimum width of the left margin printed by
3970 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3971
3972 @item -fdiagnostics-parseable-fixits
3973 @opindex fdiagnostics-parseable-fixits
3974 Emit fix-it hints in a machine-parseable format, suitable for consumption
3975 by IDEs. For each fix-it, a line will be printed after the relevant
3976 diagnostic, starting with the string ``fix-it:''. For example:
3977
3978 @smallexample
3979 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3980 @end smallexample
3981
3982 The location is expressed as a half-open range, expressed as a count of
3983 bytes, starting at byte 1 for the initial column. In the above example,
3984 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3985 given string:
3986
3987 @smallexample
3988 00000000011111111112222222222
3989 12345678901234567890123456789
3990 gtk_widget_showall (dlg);
3991 ^^^^^^^^^^^^^^^^^^
3992 gtk_widget_show_all
3993 @end smallexample
3994
3995 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3996 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3997 (e.g. vertical tab as ``\013'').
3998
3999 An empty replacement string indicates that the given range is to be removed.
4000 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4001 be inserted at the given position.
4002
4003 @item -fdiagnostics-generate-patch
4004 @opindex fdiagnostics-generate-patch
4005 Print fix-it hints to stderr in unified diff format, after any diagnostics
4006 are printed. For example:
4007
4008 @smallexample
4009 --- test.c
4010 +++ test.c
4011 @@ -42,5 +42,5 @@
4012
4013 void show_cb(GtkDialog *dlg)
4014 @{
4015 - gtk_widget_showall(dlg);
4016 + gtk_widget_show_all(dlg);
4017 @}
4018
4019 @end smallexample
4020
4021 The diff may or may not be colorized, following the same rules
4022 as for diagnostics (see @option{-fdiagnostics-color}).
4023
4024 @item -fdiagnostics-show-template-tree
4025 @opindex fdiagnostics-show-template-tree
4026
4027 In the C++ frontend, when printing diagnostics showing mismatching
4028 template types, such as:
4029
4030 @smallexample
4031 could not convert 'std::map<int, std::vector<double> >()'
4032 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4033 @end smallexample
4034
4035 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4036 tree-like structure showing the common and differing parts of the types,
4037 such as:
4038
4039 @smallexample
4040 map<
4041 [...],
4042 vector<
4043 [double != float]>>
4044 @end smallexample
4045
4046 The parts that differ are highlighted with color (``double'' and
4047 ``float'' in this case).
4048
4049 @item -fno-elide-type
4050 @opindex fno-elide-type
4051 @opindex felide-type
4052 By default when the C++ frontend prints diagnostics showing mismatching
4053 template types, common parts of the types are printed as ``[...]'' to
4054 simplify the error message. For example:
4055
4056 @smallexample
4057 could not convert 'std::map<int, std::vector<double> >()'
4058 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4059 @end smallexample
4060
4061 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4062 This flag also affects the output of the
4063 @option{-fdiagnostics-show-template-tree} flag.
4064
4065 @item -fno-show-column
4066 @opindex fno-show-column
4067 @opindex fshow-column
4068 Do not print column numbers in diagnostics. This may be necessary if
4069 diagnostics are being scanned by a program that does not understand the
4070 column numbers, such as @command{dejagnu}.
4071
4072 @item -fdiagnostics-format=@var{FORMAT}
4073 @opindex fdiagnostics-format
4074 Select a different format for printing diagnostics.
4075 @var{FORMAT} is @samp{text} or @samp{json}.
4076 The default is @samp{text}.
4077
4078 The @samp{json} format consists of a top-level JSON array containing JSON
4079 objects representing the diagnostics.
4080
4081 The JSON is emitted as one line, without formatting; the examples below
4082 have been formatted for clarity.
4083
4084 Diagnostics can have child diagnostics. For example, this error and note:
4085
4086 @smallexample
4087 misleading-indentation.c:15:3: warning: this 'if' clause does not
4088 guard... [-Wmisleading-indentation]
4089 15 | if (flag)
4090 | ^~
4091 misleading-indentation.c:17:5: note: ...this statement, but the latter
4092 is misleadingly indented as if it were guarded by the 'if'
4093 17 | y = 2;
4094 | ^
4095 @end smallexample
4096
4097 @noindent
4098 might be printed in JSON form (after formatting) like this:
4099
4100 @smallexample
4101 [
4102 @{
4103 "kind": "warning",
4104 "locations": [
4105 @{
4106 "caret": @{
4107 "column": 3,
4108 "file": "misleading-indentation.c",
4109 "line": 15
4110 @},
4111 "finish": @{
4112 "column": 4,
4113 "file": "misleading-indentation.c",
4114 "line": 15
4115 @}
4116 @}
4117 ],
4118 "message": "this \u2018if\u2019 clause does not guard...",
4119 "option": "-Wmisleading-indentation",
4120 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4121 "children": [
4122 @{
4123 "kind": "note",
4124 "locations": [
4125 @{
4126 "caret": @{
4127 "column": 5,
4128 "file": "misleading-indentation.c",
4129 "line": 17
4130 @}
4131 @}
4132 ],
4133 "message": "...this statement, but the latter is @dots{}"
4134 @}
4135 ]
4136 @},
4137 @dots{}
4138 ]
4139 @end smallexample
4140
4141 @noindent
4142 where the @code{note} is a child of the @code{warning}.
4143
4144 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4145 an @code{option} key describing the command-line option controlling the
4146 warning.
4147
4148 A diagnostic can contain zero or more locations. Each location has up
4149 to three positions within it: a @code{caret} position and optional
4150 @code{start} and @code{finish} positions. A location can also have
4151 an optional @code{label} string. For example, this error:
4152
4153 @smallexample
4154 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4155 'struct s'@} and 'T' @{aka 'struct t'@})
4156 64 | return callee_4a () + callee_4b ();
4157 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4158 | | |
4159 | | T @{aka struct t@}
4160 | S @{aka struct s@}
4161 @end smallexample
4162
4163 @noindent
4164 has three locations. Its primary location is at the ``+'' token at column
4165 23. It has two secondary locations, describing the left and right-hand sides
4166 of the expression, which have labels. It might be printed in JSON form as:
4167
4168 @smallexample
4169 @{
4170 "children": [],
4171 "kind": "error",
4172 "locations": [
4173 @{
4174 "caret": @{
4175 "column": 23, "file": "bad-binary-ops.c", "line": 64
4176 @}
4177 @},
4178 @{
4179 "caret": @{
4180 "column": 10, "file": "bad-binary-ops.c", "line": 64
4181 @},
4182 "finish": @{
4183 "column": 21, "file": "bad-binary-ops.c", "line": 64
4184 @},
4185 "label": "S @{aka struct s@}"
4186 @},
4187 @{
4188 "caret": @{
4189 "column": 25, "file": "bad-binary-ops.c", "line": 64
4190 @},
4191 "finish": @{
4192 "column": 36, "file": "bad-binary-ops.c", "line": 64
4193 @},
4194 "label": "T @{aka struct t@}"
4195 @}
4196 ],
4197 "message": "invalid operands to binary + @dots{}"
4198 @}
4199 @end smallexample
4200
4201 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4202 consisting of half-open intervals, similar to the output of
4203 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4204 with a replacement fix-it hint:
4205
4206 @smallexample
4207 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4208 mean 'color'?
4209 8 | return ptr->colour;
4210 | ^~~~~~
4211 | color
4212 @end smallexample
4213
4214 @noindent
4215 might be printed in JSON form as:
4216
4217 @smallexample
4218 @{
4219 "children": [],
4220 "fixits": [
4221 @{
4222 "next": @{
4223 "column": 21,
4224 "file": "demo.c",
4225 "line": 8
4226 @},
4227 "start": @{
4228 "column": 15,
4229 "file": "demo.c",
4230 "line": 8
4231 @},
4232 "string": "color"
4233 @}
4234 ],
4235 "kind": "error",
4236 "locations": [
4237 @{
4238 "caret": @{
4239 "column": 15,
4240 "file": "demo.c",
4241 "line": 8
4242 @},
4243 "finish": @{
4244 "column": 20,
4245 "file": "demo.c",
4246 "line": 8
4247 @}
4248 @}
4249 ],
4250 "message": "\u2018struct s\u2019 has no member named @dots{}"
4251 @}
4252 @end smallexample
4253
4254 @noindent
4255 where the fix-it hint suggests replacing the text from @code{start} up
4256 to but not including @code{next} with @code{string}'s value. Deletions
4257 are expressed via an empty value for @code{string}, insertions by
4258 having @code{start} equal @code{next}.
4259
4260 @end table
4261
4262 @node Warning Options
4263 @section Options to Request or Suppress Warnings
4264 @cindex options to control warnings
4265 @cindex warning messages
4266 @cindex messages, warning
4267 @cindex suppressing warnings
4268
4269 Warnings are diagnostic messages that report constructions that
4270 are not inherently erroneous but that are risky or suggest there
4271 may have been an error.
4272
4273 The following language-independent options do not enable specific
4274 warnings but control the kinds of diagnostics produced by GCC@.
4275
4276 @table @gcctabopt
4277 @cindex syntax checking
4278 @item -fsyntax-only
4279 @opindex fsyntax-only
4280 Check the code for syntax errors, but don't do anything beyond that.
4281
4282 @item -fmax-errors=@var{n}
4283 @opindex fmax-errors
4284 Limits the maximum number of error messages to @var{n}, at which point
4285 GCC bails out rather than attempting to continue processing the source
4286 code. If @var{n} is 0 (the default), there is no limit on the number
4287 of error messages produced. If @option{-Wfatal-errors} is also
4288 specified, then @option{-Wfatal-errors} takes precedence over this
4289 option.
4290
4291 @item -w
4292 @opindex w
4293 Inhibit all warning messages.
4294
4295 @item -Werror
4296 @opindex Werror
4297 @opindex Wno-error
4298 Make all warnings into errors.
4299
4300 @item -Werror=
4301 @opindex Werror=
4302 @opindex Wno-error=
4303 Make the specified warning into an error. The specifier for a warning
4304 is appended; for example @option{-Werror=switch} turns the warnings
4305 controlled by @option{-Wswitch} into errors. This switch takes a
4306 negative form, to be used to negate @option{-Werror} for specific
4307 warnings; for example @option{-Wno-error=switch} makes
4308 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4309 is in effect.
4310
4311 The warning message for each controllable warning includes the
4312 option that controls the warning. That option can then be used with
4313 @option{-Werror=} and @option{-Wno-error=} as described above.
4314 (Printing of the option in the warning message can be disabled using the
4315 @option{-fno-diagnostics-show-option} flag.)
4316
4317 Note that specifying @option{-Werror=}@var{foo} automatically implies
4318 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4319 imply anything.
4320
4321 @item -Wfatal-errors
4322 @opindex Wfatal-errors
4323 @opindex Wno-fatal-errors
4324 This option causes the compiler to abort compilation on the first error
4325 occurred rather than trying to keep going and printing further error
4326 messages.
4327
4328 @end table
4329
4330 You can request many specific warnings with options beginning with
4331 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4332 implicit declarations. Each of these specific warning options also
4333 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4334 example, @option{-Wno-implicit}. This manual lists only one of the
4335 two forms, whichever is not the default. For further
4336 language-specific options also refer to @ref{C++ Dialect Options} and
4337 @ref{Objective-C and Objective-C++ Dialect Options}.
4338
4339 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4340 options, such as @option{-Wunused}, which may turn on further options,
4341 such as @option{-Wunused-value}. The combined effect of positive and
4342 negative forms is that more specific options have priority over less
4343 specific ones, independently of their position in the command-line. For
4344 options of the same specificity, the last one takes effect. Options
4345 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4346 as if they appeared at the end of the command-line.
4347
4348 When an unrecognized warning option is requested (e.g.,
4349 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4350 that the option is not recognized. However, if the @option{-Wno-} form
4351 is used, the behavior is slightly different: no diagnostic is
4352 produced for @option{-Wno-unknown-warning} unless other diagnostics
4353 are being produced. This allows the use of new @option{-Wno-} options
4354 with old compilers, but if something goes wrong, the compiler
4355 warns that an unrecognized option is present.
4356
4357 @table @gcctabopt
4358 @item -Wpedantic
4359 @itemx -pedantic
4360 @opindex pedantic
4361 @opindex Wpedantic
4362 @opindex Wno-pedantic
4363 Issue all the warnings demanded by strict ISO C and ISO C++;
4364 reject all programs that use forbidden extensions, and some other
4365 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4366 version of the ISO C standard specified by any @option{-std} option used.
4367
4368 Valid ISO C and ISO C++ programs should compile properly with or without
4369 this option (though a rare few require @option{-ansi} or a
4370 @option{-std} option specifying the required version of ISO C)@. However,
4371 without this option, certain GNU extensions and traditional C and C++
4372 features are supported as well. With this option, they are rejected.
4373
4374 @option{-Wpedantic} does not cause warning messages for use of the
4375 alternate keywords whose names begin and end with @samp{__}. This alternate
4376 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4377 i.e. @samp{__intN__}.
4378 Pedantic warnings are also disabled in the expression that follows
4379 @code{__extension__}. However, only system header files should use
4380 these escape routes; application programs should avoid them.
4381 @xref{Alternate Keywords}.
4382
4383 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4384 C conformance. They soon find that it does not do quite what they want:
4385 it finds some non-ISO practices, but not all---only those for which
4386 ISO C @emph{requires} a diagnostic, and some others for which
4387 diagnostics have been added.
4388
4389 A feature to report any failure to conform to ISO C might be useful in
4390 some instances, but would require considerable additional work and would
4391 be quite different from @option{-Wpedantic}. We don't have plans to
4392 support such a feature in the near future.
4393
4394 Where the standard specified with @option{-std} represents a GNU
4395 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4396 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4397 extended dialect is based. Warnings from @option{-Wpedantic} are given
4398 where they are required by the base standard. (It does not make sense
4399 for such warnings to be given only for features not in the specified GNU
4400 C dialect, since by definition the GNU dialects of C include all
4401 features the compiler supports with the given option, and there would be
4402 nothing to warn about.)
4403
4404 @item -pedantic-errors
4405 @opindex pedantic-errors
4406 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4407 requires a diagnostic, in some cases where there is undefined behavior
4408 at compile-time and in some other cases that do not prevent compilation
4409 of programs that are valid according to the standard. This is not
4410 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4411 by this option and not enabled by the latter and vice versa.
4412
4413 @item -Wall
4414 @opindex Wall
4415 @opindex Wno-all
4416 This enables all the warnings about constructions that some users
4417 consider questionable, and that are easy to avoid (or modify to
4418 prevent the warning), even in conjunction with macros. This also
4419 enables some language-specific warnings described in @ref{C++ Dialect
4420 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4421
4422 @option{-Wall} turns on the following warning flags:
4423
4424 @gccoptlist{-Waddress @gol
4425 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4426 -Wbool-compare @gol
4427 -Wbool-operation @gol
4428 -Wc++11-compat -Wc++14-compat @gol
4429 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4430 -Wchar-subscripts @gol
4431 -Wcomment @gol
4432 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4433 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4434 -Wenum-conversion @r{in C/ObjC;} @gol
4435 -Wformat @gol
4436 -Wint-in-bool-context @gol
4437 -Wimplicit @r{(C and Objective-C only)} @gol
4438 -Wimplicit-int @r{(C and Objective-C only)} @gol
4439 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4440 -Winit-self @r{(only for C++)} @gol
4441 -Wlogical-not-parentheses @gol
4442 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4443 -Wmaybe-uninitialized @gol
4444 -Wmemset-elt-size @gol
4445 -Wmemset-transposed-args @gol
4446 -Wmisleading-indentation @r{(only for C/C++)} @gol
4447 -Wmissing-attributes @gol
4448 -Wmissing-braces @r{(only for C/ObjC)} @gol
4449 -Wmultistatement-macros @gol
4450 -Wnarrowing @r{(only for C++)} @gol
4451 -Wnonnull @gol
4452 -Wnonnull-compare @gol
4453 -Wopenmp-simd @gol
4454 -Wparentheses @gol
4455 -Wpessimizing-move @r{(only for C++)} @gol
4456 -Wpointer-sign @gol
4457 -Wreorder @gol
4458 -Wrestrict @gol
4459 -Wreturn-type @gol
4460 -Wsequence-point @gol
4461 -Wsign-compare @r{(only in C++)} @gol
4462 -Wsizeof-pointer-div @gol
4463 -Wsizeof-pointer-memaccess @gol
4464 -Wstrict-aliasing @gol
4465 -Wstrict-overflow=1 @gol
4466 -Wswitch @gol
4467 -Wtautological-compare @gol
4468 -Wtrigraphs @gol
4469 -Wuninitialized @gol
4470 -Wunknown-pragmas @gol
4471 -Wunused-function @gol
4472 -Wunused-label @gol
4473 -Wunused-value @gol
4474 -Wunused-variable @gol
4475 -Wvolatile-register-var}
4476
4477 Note that some warning flags are not implied by @option{-Wall}. Some of
4478 them warn about constructions that users generally do not consider
4479 questionable, but which occasionally you might wish to check for;
4480 others warn about constructions that are necessary or hard to avoid in
4481 some cases, and there is no simple way to modify the code to suppress
4482 the warning. Some of them are enabled by @option{-Wextra} but many of
4483 them must be enabled individually.
4484
4485 @item -Wextra
4486 @opindex W
4487 @opindex Wextra
4488 @opindex Wno-extra
4489 This enables some extra warning flags that are not enabled by
4490 @option{-Wall}. (This option used to be called @option{-W}. The older
4491 name is still supported, but the newer name is more descriptive.)
4492
4493 @gccoptlist{-Wclobbered @gol
4494 -Wcast-function-type @gol
4495 -Wdeprecated-copy @r{(C++ only)} @gol
4496 -Wempty-body @gol
4497 -Wignored-qualifiers @gol
4498 -Wimplicit-fallthrough=3 @gol
4499 -Wmissing-field-initializers @gol
4500 -Wmissing-parameter-type @r{(C only)} @gol
4501 -Wold-style-declaration @r{(C only)} @gol
4502 -Woverride-init @gol
4503 -Wsign-compare @r{(C only)} @gol
4504 -Wstring-compare @gol
4505 -Wredundant-move @r{(only for C++)} @gol
4506 -Wtype-limits @gol
4507 -Wuninitialized @gol
4508 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4509 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4510 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4511
4512
4513 The option @option{-Wextra} also prints warning messages for the
4514 following cases:
4515
4516 @itemize @bullet
4517
4518 @item
4519 A pointer is compared against integer zero with @code{<}, @code{<=},
4520 @code{>}, or @code{>=}.
4521
4522 @item
4523 (C++ only) An enumerator and a non-enumerator both appear in a
4524 conditional expression.
4525
4526 @item
4527 (C++ only) Ambiguous virtual bases.
4528
4529 @item
4530 (C++ only) Subscripting an array that has been declared @code{register}.
4531
4532 @item
4533 (C++ only) Taking the address of a variable that has been declared
4534 @code{register}.
4535
4536 @item
4537 (C++ only) A base class is not initialized in the copy constructor
4538 of a derived class.
4539
4540 @end itemize
4541
4542 @item -Wchar-subscripts
4543 @opindex Wchar-subscripts
4544 @opindex Wno-char-subscripts
4545 Warn if an array subscript has type @code{char}. This is a common cause
4546 of error, as programmers often forget that this type is signed on some
4547 machines.
4548 This warning is enabled by @option{-Wall}.
4549
4550 @item -Wno-coverage-mismatch
4551 @opindex Wno-coverage-mismatch
4552 @opindex Wcoverage-mismatch
4553 Warn if feedback profiles do not match when using the
4554 @option{-fprofile-use} option.
4555 If a source file is changed between compiling with @option{-fprofile-generate}
4556 and with @option{-fprofile-use}, the files with the profile feedback can fail
4557 to match the source file and GCC cannot use the profile feedback
4558 information. By default, this warning is enabled and is treated as an
4559 error. @option{-Wno-coverage-mismatch} can be used to disable the
4560 warning or @option{-Wno-error=coverage-mismatch} can be used to
4561 disable the error. Disabling the error for this warning can result in
4562 poorly optimized code and is useful only in the
4563 case of very minor changes such as bug fixes to an existing code-base.
4564 Completely disabling the warning is not recommended.
4565
4566 @item -Wno-cpp
4567 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4568
4569 Suppress warning messages emitted by @code{#warning} directives.
4570
4571 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4572 @opindex Wdouble-promotion
4573 @opindex Wno-double-promotion
4574 Give a warning when a value of type @code{float} is implicitly
4575 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4576 floating-point unit implement @code{float} in hardware, but emulate
4577 @code{double} in software. On such a machine, doing computations
4578 using @code{double} values is much more expensive because of the
4579 overhead required for software emulation.
4580
4581 It is easy to accidentally do computations with @code{double} because
4582 floating-point literals are implicitly of type @code{double}. For
4583 example, in:
4584 @smallexample
4585 @group
4586 float area(float radius)
4587 @{
4588 return 3.14159 * radius * radius;
4589 @}
4590 @end group
4591 @end smallexample
4592 the compiler performs the entire computation with @code{double}
4593 because the floating-point literal is a @code{double}.
4594
4595 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4596 @opindex Wduplicate-decl-specifier
4597 @opindex Wno-duplicate-decl-specifier
4598 Warn if a declaration has duplicate @code{const}, @code{volatile},
4599 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4600 @option{-Wall}.
4601
4602 @item -Wformat
4603 @itemx -Wformat=@var{n}
4604 @opindex Wformat
4605 @opindex Wno-format
4606 @opindex ffreestanding
4607 @opindex fno-builtin
4608 @opindex Wformat=
4609 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4610 the arguments supplied have types appropriate to the format string
4611 specified, and that the conversions specified in the format string make
4612 sense. This includes standard functions, and others specified by format
4613 attributes (@pxref{Function Attributes}), in the @code{printf},
4614 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4615 not in the C standard) families (or other target-specific families).
4616 Which functions are checked without format attributes having been
4617 specified depends on the standard version selected, and such checks of
4618 functions without the attribute specified are disabled by
4619 @option{-ffreestanding} or @option{-fno-builtin}.
4620
4621 The formats are checked against the format features supported by GNU
4622 libc version 2.2. These include all ISO C90 and C99 features, as well
4623 as features from the Single Unix Specification and some BSD and GNU
4624 extensions. Other library implementations may not support all these
4625 features; GCC does not support warning about features that go beyond a
4626 particular library's limitations. However, if @option{-Wpedantic} is used
4627 with @option{-Wformat}, warnings are given about format features not
4628 in the selected standard version (but not for @code{strfmon} formats,
4629 since those are not in any version of the C standard). @xref{C Dialect
4630 Options,,Options Controlling C Dialect}.
4631
4632 @table @gcctabopt
4633 @item -Wformat=1
4634 @itemx -Wformat
4635 @opindex Wformat
4636 @opindex Wformat=1
4637 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4638 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4639 @option{-Wformat} also checks for null format arguments for several
4640 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4641 aspects of this level of format checking can be disabled by the
4642 options: @option{-Wno-format-contains-nul},
4643 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4644 @option{-Wformat} is enabled by @option{-Wall}.
4645
4646 @item -Wno-format-contains-nul
4647 @opindex Wno-format-contains-nul
4648 @opindex Wformat-contains-nul
4649 If @option{-Wformat} is specified, do not warn about format strings that
4650 contain NUL bytes.
4651
4652 @item -Wno-format-extra-args
4653 @opindex Wno-format-extra-args
4654 @opindex Wformat-extra-args
4655 If @option{-Wformat} is specified, do not warn about excess arguments to a
4656 @code{printf} or @code{scanf} format function. The C standard specifies
4657 that such arguments are ignored.
4658
4659 Where the unused arguments lie between used arguments that are
4660 specified with @samp{$} operand number specifications, normally
4661 warnings are still given, since the implementation could not know what
4662 type to pass to @code{va_arg} to skip the unused arguments. However,
4663 in the case of @code{scanf} formats, this option suppresses the
4664 warning if the unused arguments are all pointers, since the Single
4665 Unix Specification says that such unused arguments are allowed.
4666
4667 @item -Wformat-overflow
4668 @itemx -Wformat-overflow=@var{level}
4669 @opindex Wformat-overflow
4670 @opindex Wno-format-overflow
4671 Warn about calls to formatted input/output functions such as @code{sprintf}
4672 and @code{vsprintf} that might overflow the destination buffer. When the
4673 exact number of bytes written by a format directive cannot be determined
4674 at compile-time it is estimated based on heuristics that depend on the
4675 @var{level} argument and on optimization. While enabling optimization
4676 will in most cases improve the accuracy of the warning, it may also
4677 result in false positives.
4678
4679 @table @gcctabopt
4680 @item -Wformat-overflow
4681 @itemx -Wformat-overflow=1
4682 @opindex Wformat-overflow
4683 @opindex Wno-format-overflow
4684 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4685 employs a conservative approach that warns only about calls that most
4686 likely overflow the buffer. At this level, numeric arguments to format
4687 directives with unknown values are assumed to have the value of one, and
4688 strings of unknown length to be empty. Numeric arguments that are known
4689 to be bounded to a subrange of their type, or string arguments whose output
4690 is bounded either by their directive's precision or by a finite set of
4691 string literals, are assumed to take on the value within the range that
4692 results in the most bytes on output. For example, the call to @code{sprintf}
4693 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4694 the terminating NUL character (@code{'\0'}) appended by the function
4695 to the destination buffer will be written past its end. Increasing
4696 the size of the buffer by a single byte is sufficient to avoid the
4697 warning, though it may not be sufficient to avoid the overflow.
4698
4699 @smallexample
4700 void f (int a, int b)
4701 @{
4702 char buf [13];
4703 sprintf (buf, "a = %i, b = %i\n", a, b);
4704 @}
4705 @end smallexample
4706
4707 @item -Wformat-overflow=2
4708 Level @var{2} warns also about calls that might overflow the destination
4709 buffer given an argument of sufficient length or magnitude. At level
4710 @var{2}, unknown numeric arguments are assumed to have the minimum
4711 representable value for signed types with a precision greater than 1, and
4712 the maximum representable value otherwise. Unknown string arguments whose
4713 length cannot be assumed to be bounded either by the directive's precision,
4714 or by a finite set of string literals they may evaluate to, or the character
4715 array they may point to, are assumed to be 1 character long.
4716
4717 At level @var{2}, the call in the example above is again diagnosed, but
4718 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4719 @code{%i} directive will write some of its digits beyond the end of
4720 the destination buffer. To make the call safe regardless of the values
4721 of the two variables, the size of the destination buffer must be increased
4722 to at least 34 bytes. GCC includes the minimum size of the buffer in
4723 an informational note following the warning.
4724
4725 An alternative to increasing the size of the destination buffer is to
4726 constrain the range of formatted values. The maximum length of string
4727 arguments can be bounded by specifying the precision in the format
4728 directive. When numeric arguments of format directives can be assumed
4729 to be bounded by less than the precision of their type, choosing
4730 an appropriate length modifier to the format specifier will reduce
4731 the required buffer size. For example, if @var{a} and @var{b} in the
4732 example above can be assumed to be within the precision of
4733 the @code{short int} type then using either the @code{%hi} format
4734 directive or casting the argument to @code{short} reduces the maximum
4735 required size of the buffer to 24 bytes.
4736
4737 @smallexample
4738 void f (int a, int b)
4739 @{
4740 char buf [23];
4741 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4742 @}
4743 @end smallexample
4744 @end table
4745
4746 @item -Wno-format-zero-length
4747 @opindex Wno-format-zero-length
4748 @opindex Wformat-zero-length
4749 If @option{-Wformat} is specified, do not warn about zero-length formats.
4750 The C standard specifies that zero-length formats are allowed.
4751
4752
4753 @item -Wformat=2
4754 @opindex Wformat=2
4755 Enable @option{-Wformat} plus additional format checks. Currently
4756 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4757 -Wformat-y2k}.
4758
4759 @item -Wformat-nonliteral
4760 @opindex Wformat-nonliteral
4761 @opindex Wno-format-nonliteral
4762 If @option{-Wformat} is specified, also warn if the format string is not a
4763 string literal and so cannot be checked, unless the format function
4764 takes its format arguments as a @code{va_list}.
4765
4766 @item -Wformat-security
4767 @opindex Wformat-security
4768 @opindex Wno-format-security
4769 If @option{-Wformat} is specified, also warn about uses of format
4770 functions that represent possible security problems. At present, this
4771 warns about calls to @code{printf} and @code{scanf} functions where the
4772 format string is not a string literal and there are no format arguments,
4773 as in @code{printf (foo);}. This may be a security hole if the format
4774 string came from untrusted input and contains @samp{%n}. (This is
4775 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4776 in future warnings may be added to @option{-Wformat-security} that are not
4777 included in @option{-Wformat-nonliteral}.)
4778
4779 @item -Wformat-signedness
4780 @opindex Wformat-signedness
4781 @opindex Wno-format-signedness
4782 If @option{-Wformat} is specified, also warn if the format string
4783 requires an unsigned argument and the argument is signed and vice versa.
4784
4785 @item -Wformat-truncation
4786 @itemx -Wformat-truncation=@var{level}
4787 @opindex Wformat-truncation
4788 @opindex Wno-format-truncation
4789 Warn about calls to formatted input/output functions such as @code{snprintf}
4790 and @code{vsnprintf} that might result in output truncation. When the exact
4791 number of bytes written by a format directive cannot be determined at
4792 compile-time it is estimated based on heuristics that depend on
4793 the @var{level} argument and on optimization. While enabling optimization
4794 will in most cases improve the accuracy of the warning, it may also result
4795 in false positives. Except as noted otherwise, the option uses the same
4796 logic @option{-Wformat-overflow}.
4797
4798 @table @gcctabopt
4799 @item -Wformat-truncation
4800 @itemx -Wformat-truncation=1
4801 @opindex Wformat-truncation
4802 @opindex Wno-format-truncation
4803 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4804 employs a conservative approach that warns only about calls to bounded
4805 functions whose return value is unused and that will most likely result
4806 in output truncation.
4807
4808 @item -Wformat-truncation=2
4809 Level @var{2} warns also about calls to bounded functions whose return
4810 value is used and that might result in truncation given an argument of
4811 sufficient length or magnitude.
4812 @end table
4813
4814 @item -Wformat-y2k
4815 @opindex Wformat-y2k
4816 @opindex Wno-format-y2k
4817 If @option{-Wformat} is specified, also warn about @code{strftime}
4818 formats that may yield only a two-digit year.
4819 @end table
4820
4821 @item -Wnonnull
4822 @opindex Wnonnull
4823 @opindex Wno-nonnull
4824 Warn about passing a null pointer for arguments marked as
4825 requiring a non-null value by the @code{nonnull} function attribute.
4826
4827 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4828 can be disabled with the @option{-Wno-nonnull} option.
4829
4830 @item -Wnonnull-compare
4831 @opindex Wnonnull-compare
4832 @opindex Wno-nonnull-compare
4833 Warn when comparing an argument marked with the @code{nonnull}
4834 function attribute against null inside the function.
4835
4836 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4837 can be disabled with the @option{-Wno-nonnull-compare} option.
4838
4839 @item -Wnull-dereference
4840 @opindex Wnull-dereference
4841 @opindex Wno-null-dereference
4842 Warn if the compiler detects paths that trigger erroneous or
4843 undefined behavior due to dereferencing a null pointer. This option
4844 is only active when @option{-fdelete-null-pointer-checks} is active,
4845 which is enabled by optimizations in most targets. The precision of
4846 the warnings depends on the optimization options used.
4847
4848 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4849 @opindex Winaccessible-base
4850 @opindex Wno-inaccessible-base
4851 Warn when a base class is inaccessible in a class derived from it due to
4852 ambiguity. The warning is enabled by default. Note the warning for virtual
4853 bases is enabled by the @option{-Wextra} option.
4854 @smallexample
4855 @group
4856 struct A @{ int a; @};
4857
4858 struct B : A @{ @};
4859
4860 struct C : B, A @{ @};
4861 @end group
4862 @end smallexample
4863
4864 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4865 @opindex Winit-self
4866 @opindex Wno-init-self
4867 Warn about uninitialized variables that are initialized with themselves.
4868 Note this option can only be used with the @option{-Wuninitialized} option.
4869
4870 For example, GCC warns about @code{i} being uninitialized in the
4871 following snippet only when @option{-Winit-self} has been specified:
4872 @smallexample
4873 @group
4874 int f()
4875 @{
4876 int i = i;
4877 return i;
4878 @}
4879 @end group
4880 @end smallexample
4881
4882 This warning is enabled by @option{-Wall} in C++.
4883
4884 @item -Wimplicit-int @r{(C and Objective-C only)}
4885 @opindex Wimplicit-int
4886 @opindex Wno-implicit-int
4887 Warn when a declaration does not specify a type.
4888 This warning is enabled by @option{-Wall}.
4889
4890 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4891 @opindex Wimplicit-function-declaration
4892 @opindex Wno-implicit-function-declaration
4893 Give a warning whenever a function is used before being declared. In
4894 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4895 enabled by default and it is made into an error by
4896 @option{-pedantic-errors}. This warning is also enabled by
4897 @option{-Wall}.
4898
4899 @item -Wimplicit @r{(C and Objective-C only)}
4900 @opindex Wimplicit
4901 @opindex Wno-implicit
4902 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4903 This warning is enabled by @option{-Wall}.
4904
4905 @item -Wimplicit-fallthrough
4906 @opindex Wimplicit-fallthrough
4907 @opindex Wno-implicit-fallthrough
4908 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4909 and @option{-Wno-implicit-fallthrough} is the same as
4910 @option{-Wimplicit-fallthrough=0}.
4911
4912 @item -Wimplicit-fallthrough=@var{n}
4913 @opindex Wimplicit-fallthrough=
4914 Warn when a switch case falls through. For example:
4915
4916 @smallexample
4917 @group
4918 switch (cond)
4919 @{
4920 case 1:
4921 a = 1;
4922 break;
4923 case 2:
4924 a = 2;
4925 case 3:
4926 a = 3;
4927 break;
4928 @}
4929 @end group
4930 @end smallexample
4931
4932 This warning does not warn when the last statement of a case cannot
4933 fall through, e.g. when there is a return statement or a call to function
4934 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4935 also takes into account control flow statements, such as ifs, and only
4936 warns when appropriate. E.g.@:
4937
4938 @smallexample
4939 @group
4940 switch (cond)
4941 @{
4942 case 1:
4943 if (i > 3) @{
4944 bar (5);
4945 break;
4946 @} else if (i < 1) @{
4947 bar (0);
4948 @} else
4949 return;
4950 default:
4951 @dots{}
4952 @}
4953 @end group
4954 @end smallexample
4955
4956 Since there are occasions where a switch case fall through is desirable,
4957 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4958 to be used along with a null statement to suppress this warning that
4959 would normally occur:
4960
4961 @smallexample
4962 @group
4963 switch (cond)
4964 @{
4965 case 1:
4966 bar (0);
4967 __attribute__ ((fallthrough));
4968 default:
4969 @dots{}
4970 @}
4971 @end group
4972 @end smallexample
4973
4974 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4975 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4976 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4977 Instead of these attributes, it is also possible to add a fallthrough comment
4978 to silence the warning. The whole body of the C or C++ style comment should
4979 match the given regular expressions listed below. The option argument @var{n}
4980 specifies what kind of comments are accepted:
4981
4982 @itemize @bullet
4983
4984 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4985
4986 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4987 expression, any comment is used as fallthrough comment.
4988
4989 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4990 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4991
4992 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4993 following regular expressions:
4994
4995 @itemize @bullet
4996
4997 @item @code{-fallthrough}
4998
4999 @item @code{@@fallthrough@@}
5000
5001 @item @code{lint -fallthrough[ \t]*}
5002
5003 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
5004
5005 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5006
5007 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5008
5009 @end itemize
5010
5011 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
5012 following regular expressions:
5013
5014 @itemize @bullet
5015
5016 @item @code{-fallthrough}
5017
5018 @item @code{@@fallthrough@@}
5019
5020 @item @code{lint -fallthrough[ \t]*}
5021
5022 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5023
5024 @end itemize
5025
5026 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5027 fallthrough comments, only attributes disable the warning.
5028
5029 @end itemize
5030
5031 The comment needs to be followed after optional whitespace and other comments
5032 by @code{case} or @code{default} keywords or by a user label that precedes some
5033 @code{case} or @code{default} label.
5034
5035 @smallexample
5036 @group
5037 switch (cond)
5038 @{
5039 case 1:
5040 bar (0);
5041 /* FALLTHRU */
5042 default:
5043 @dots{}
5044 @}
5045 @end group
5046 @end smallexample
5047
5048 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5049
5050 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5051 @opindex Wif-not-aligned
5052 @opindex Wno-if-not-aligned
5053 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5054 should be issued. This is enabled by default.
5055 Use @option{-Wno-if-not-aligned} to disable it.
5056
5057 @item -Wignored-qualifiers @r{(C and C++ only)}
5058 @opindex Wignored-qualifiers
5059 @opindex Wno-ignored-qualifiers
5060 Warn if the return type of a function has a type qualifier
5061 such as @code{const}. For ISO C such a type qualifier has no effect,
5062 since the value returned by a function is not an lvalue.
5063 For C++, the warning is only emitted for scalar types or @code{void}.
5064 ISO C prohibits qualified @code{void} return types on function
5065 definitions, so such return types always receive a warning
5066 even without this option.
5067
5068 This warning is also enabled by @option{-Wextra}.
5069
5070 @item -Wignored-attributes @r{(C and C++ only)}
5071 @opindex Wignored-attributes
5072 @opindex Wno-ignored-attributes
5073 Warn when an attribute is ignored. This is different from the
5074 @option{-Wattributes} option in that it warns whenever the compiler decides
5075 to drop an attribute, not that the attribute is either unknown, used in a
5076 wrong place, etc. This warning is enabled by default.
5077
5078 @item -Wmain
5079 @opindex Wmain
5080 @opindex Wno-main
5081 Warn if the type of @code{main} is suspicious. @code{main} should be
5082 a function with external linkage, returning int, taking either zero
5083 arguments, two, or three arguments of appropriate types. This warning
5084 is enabled by default in C++ and is enabled by either @option{-Wall}
5085 or @option{-Wpedantic}.
5086
5087 @item -Wmisleading-indentation @r{(C and C++ only)}
5088 @opindex Wmisleading-indentation
5089 @opindex Wno-misleading-indentation
5090 Warn when the indentation of the code does not reflect the block structure.
5091 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5092 @code{for} clauses with a guarded statement that does not use braces,
5093 followed by an unguarded statement with the same indentation.
5094
5095 In the following example, the call to ``bar'' is misleadingly indented as
5096 if it were guarded by the ``if'' conditional.
5097
5098 @smallexample
5099 if (some_condition ())
5100 foo ();
5101 bar (); /* Gotcha: this is not guarded by the "if". */
5102 @end smallexample
5103
5104 In the case of mixed tabs and spaces, the warning uses the
5105 @option{-ftabstop=} option to determine if the statements line up
5106 (defaulting to 8).
5107
5108 The warning is not issued for code involving multiline preprocessor logic
5109 such as the following example.
5110
5111 @smallexample
5112 if (flagA)
5113 foo (0);
5114 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5115 if (flagB)
5116 #endif
5117 foo (1);
5118 @end smallexample
5119
5120 The warning is not issued after a @code{#line} directive, since this
5121 typically indicates autogenerated code, and no assumptions can be made
5122 about the layout of the file that the directive references.
5123
5124 This warning is enabled by @option{-Wall} in C and C++.
5125
5126 @item -Wmissing-attributes
5127 @opindex Wmissing-attributes
5128 @opindex Wno-missing-attributes
5129 Warn when a declaration of a function is missing one or more attributes
5130 that a related function is declared with and whose absence may adversely
5131 affect the correctness or efficiency of generated code. For example,
5132 the warning is issued for declarations of aliases that use attributes
5133 to specify less restrictive requirements than those of their targets.
5134 This typically represents a potential optimization opportunity.
5135 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5136 issued when the alias is more restrictive than the target, which could
5137 lead to incorrect code generation.
5138 Attributes considered include @code{alloc_align}, @code{alloc_size},
5139 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5140 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5141 @code{returns_nonnull}, and @code{returns_twice}.
5142
5143 In C++, the warning is issued when an explicit specialization of a primary
5144 template declared with attribute @code{alloc_align}, @code{alloc_size},
5145 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5146 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5147 @code{error}, and @code{warning} suppress the warning.
5148 (@pxref{Function Attributes}).
5149
5150 You can use the @code{copy} attribute to apply the same
5151 set of attributes to a declaration as that on another declaration without
5152 explicitly enumerating the attributes. This attribute can be applied
5153 to declarations of functions (@pxref{Common Function Attributes}),
5154 variables (@pxref{Common Variable Attributes}), or types
5155 (@pxref{Common Type Attributes}).
5156
5157 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5158
5159 For example, since the declaration of the primary function template
5160 below makes use of both attribute @code{malloc} and @code{alloc_size}
5161 the declaration of the explicit specialization of the template is
5162 diagnosed because it is missing one of the attributes.
5163
5164 @smallexample
5165 template <class T>
5166 T* __attribute__ ((malloc, alloc_size (1)))
5167 allocate (size_t);
5168
5169 template <>
5170 void* __attribute__ ((malloc)) // missing alloc_size
5171 allocate<void> (size_t);
5172 @end smallexample
5173
5174 @item -Wmissing-braces
5175 @opindex Wmissing-braces
5176 @opindex Wno-missing-braces
5177 Warn if an aggregate or union initializer is not fully bracketed. In
5178 the following example, the initializer for @code{a} is not fully
5179 bracketed, but that for @code{b} is fully bracketed. This warning is
5180 enabled by @option{-Wall} in C.
5181
5182 @smallexample
5183 int a[2][2] = @{ 0, 1, 2, 3 @};
5184 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5185 @end smallexample
5186
5187 This warning is enabled by @option{-Wall}.
5188
5189 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5190 @opindex Wmissing-include-dirs
5191 @opindex Wno-missing-include-dirs
5192 Warn if a user-supplied include directory does not exist.
5193
5194 @item -Wmissing-profile
5195 @opindex Wmissing-profile
5196 @opindex Wno-missing-profile
5197 Warn if feedback profiles are missing when using the
5198 @option{-fprofile-use} option.
5199 This option diagnoses those cases where a new function or a new file is added
5200 to the user code between compiling with @option{-fprofile-generate} and with
5201 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5202 profile feedback data files do not contain any profile feedback information for
5203 the newly added function or file respectively. Also, in the case when profile
5204 count data (.gcda) files are removed, GCC cannot use any profile feedback
5205 information. In all these cases, warnings are issued to inform the user that a
5206 profile generation step is due. @option{-Wno-missing-profile} can be used to
5207 disable the warning. Ignoring the warning can result in poorly optimized code.
5208 Completely disabling the warning is not recommended and should be done only
5209 when non-existent profile data is justified.
5210
5211 @item -Wmultistatement-macros
5212 @opindex Wmultistatement-macros
5213 @opindex Wno-multistatement-macros
5214 Warn about unsafe multiple statement macros that appear to be guarded
5215 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5216 @code{while}, in which only the first statement is actually guarded after
5217 the macro is expanded.
5218
5219 For example:
5220
5221 @smallexample
5222 #define DOIT x++; y++
5223 if (c)
5224 DOIT;
5225 @end smallexample
5226
5227 will increment @code{y} unconditionally, not just when @code{c} holds.
5228 The can usually be fixed by wrapping the macro in a do-while loop:
5229 @smallexample
5230 #define DOIT do @{ x++; y++; @} while (0)
5231 if (c)
5232 DOIT;
5233 @end smallexample
5234
5235 This warning is enabled by @option{-Wall} in C and C++.
5236
5237 @item -Wparentheses
5238 @opindex Wparentheses
5239 @opindex Wno-parentheses
5240 Warn if parentheses are omitted in certain contexts, such
5241 as when there is an assignment in a context where a truth value
5242 is expected, or when operators are nested whose precedence people
5243 often get confused about.
5244
5245 Also warn if a comparison like @code{x<=y<=z} appears; this is
5246 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5247 interpretation from that of ordinary mathematical notation.
5248
5249 Also warn for dangerous uses of the GNU extension to
5250 @code{?:} with omitted middle operand. When the condition
5251 in the @code{?}: operator is a boolean expression, the omitted value is
5252 always 1. Often programmers expect it to be a value computed
5253 inside the conditional expression instead.
5254
5255 For C++ this also warns for some cases of unnecessary parentheses in
5256 declarations, which can indicate an attempt at a function call instead
5257 of a declaration:
5258 @smallexample
5259 @{
5260 // Declares a local variable called mymutex.
5261 std::unique_lock<std::mutex> (mymutex);
5262 // User meant std::unique_lock<std::mutex> lock (mymutex);
5263 @}
5264 @end smallexample
5265
5266 This warning is enabled by @option{-Wall}.
5267
5268 @item -Wsequence-point
5269 @opindex Wsequence-point
5270 @opindex Wno-sequence-point
5271 Warn about code that may have undefined semantics because of violations
5272 of sequence point rules in the C and C++ standards.
5273
5274 The C and C++ standards define the order in which expressions in a C/C++
5275 program are evaluated in terms of @dfn{sequence points}, which represent
5276 a partial ordering between the execution of parts of the program: those
5277 executed before the sequence point, and those executed after it. These
5278 occur after the evaluation of a full expression (one which is not part
5279 of a larger expression), after the evaluation of the first operand of a
5280 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5281 function is called (but after the evaluation of its arguments and the
5282 expression denoting the called function), and in certain other places.
5283 Other than as expressed by the sequence point rules, the order of
5284 evaluation of subexpressions of an expression is not specified. All
5285 these rules describe only a partial order rather than a total order,
5286 since, for example, if two functions are called within one expression
5287 with no sequence point between them, the order in which the functions
5288 are called is not specified. However, the standards committee have
5289 ruled that function calls do not overlap.
5290
5291 It is not specified when between sequence points modifications to the
5292 values of objects take effect. Programs whose behavior depends on this
5293 have undefined behavior; the C and C++ standards specify that ``Between
5294 the previous and next sequence point an object shall have its stored
5295 value modified at most once by the evaluation of an expression.
5296 Furthermore, the prior value shall be read only to determine the value
5297 to be stored.''. If a program breaks these rules, the results on any
5298 particular implementation are entirely unpredictable.
5299
5300 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5301 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5302 diagnosed by this option, and it may give an occasional false positive
5303 result, but in general it has been found fairly effective at detecting
5304 this sort of problem in programs.
5305
5306 The C++17 standard will define the order of evaluation of operands in
5307 more cases: in particular it requires that the right-hand side of an
5308 assignment be evaluated before the left-hand side, so the above
5309 examples are no longer undefined. But this warning will still warn
5310 about them, to help people avoid writing code that is undefined in C
5311 and earlier revisions of C++.
5312
5313 The standard is worded confusingly, therefore there is some debate
5314 over the precise meaning of the sequence point rules in subtle cases.
5315 Links to discussions of the problem, including proposed formal
5316 definitions, may be found on the GCC readings page, at
5317 @uref{http://gcc.gnu.org/@/readings.html}.
5318
5319 This warning is enabled by @option{-Wall} for C and C++.
5320
5321 @item -Wno-return-local-addr
5322 @opindex Wno-return-local-addr
5323 @opindex Wreturn-local-addr
5324 Do not warn about returning a pointer (or in C++, a reference) to a
5325 variable that goes out of scope after the function returns.
5326
5327 @item -Wreturn-type
5328 @opindex Wreturn-type
5329 @opindex Wno-return-type
5330 Warn whenever a function is defined with a return type that defaults
5331 to @code{int}. Also warn about any @code{return} statement with no
5332 return value in a function whose return type is not @code{void}
5333 (falling off the end of the function body is considered returning
5334 without a value).
5335
5336 For C only, warn about a @code{return} statement with an expression in a
5337 function whose return type is @code{void}, unless the expression type is
5338 also @code{void}. As a GNU extension, the latter case is accepted
5339 without a warning unless @option{-Wpedantic} is used. Attempting
5340 to use the return value of a non-@code{void} function other than @code{main}
5341 that flows off the end by reaching the closing curly brace that terminates
5342 the function is undefined.
5343
5344 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5345 than @code{main} results in undefined behavior even when the value of
5346 the function is not used.
5347
5348 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5349
5350 @item -Wshift-count-negative
5351 @opindex Wshift-count-negative
5352 @opindex Wno-shift-count-negative
5353 Warn if shift count is negative. This warning is enabled by default.
5354
5355 @item -Wshift-count-overflow
5356 @opindex Wshift-count-overflow
5357 @opindex Wno-shift-count-overflow
5358 Warn if shift count >= width of type. This warning is enabled by default.
5359
5360 @item -Wshift-negative-value
5361 @opindex Wshift-negative-value
5362 @opindex Wno-shift-negative-value
5363 Warn if left shifting a negative value. This warning is enabled by
5364 @option{-Wextra} in C99 and C++11 modes (and newer).
5365
5366 @item -Wshift-overflow
5367 @itemx -Wshift-overflow=@var{n}
5368 @opindex Wshift-overflow
5369 @opindex Wno-shift-overflow
5370 Warn about left shift overflows. This warning is enabled by
5371 default in C99 and C++11 modes (and newer).
5372
5373 @table @gcctabopt
5374 @item -Wshift-overflow=1
5375 This is the warning level of @option{-Wshift-overflow} and is enabled
5376 by default in C99 and C++11 modes (and newer). This warning level does
5377 not warn about left-shifting 1 into the sign bit. (However, in C, such
5378 an overflow is still rejected in contexts where an integer constant expression
5379 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5380 shifts always wrap.
5381
5382 @item -Wshift-overflow=2
5383 This warning level also warns about left-shifting 1 into the sign bit,
5384 unless C++14 mode (or newer) is active.
5385 @end table
5386
5387 @item -Wswitch
5388 @opindex Wswitch
5389 @opindex Wno-switch
5390 Warn whenever a @code{switch} statement has an index of enumerated type
5391 and lacks a @code{case} for one or more of the named codes of that
5392 enumeration. (The presence of a @code{default} label prevents this
5393 warning.) @code{case} labels outside the enumeration range also
5394 provoke warnings when this option is used (even if there is a
5395 @code{default} label).
5396 This warning is enabled by @option{-Wall}.
5397
5398 @item -Wswitch-default
5399 @opindex Wswitch-default
5400 @opindex Wno-switch-default
5401 Warn whenever a @code{switch} statement does not have a @code{default}
5402 case.
5403
5404 @item -Wswitch-enum
5405 @opindex Wswitch-enum
5406 @opindex Wno-switch-enum
5407 Warn whenever a @code{switch} statement has an index of enumerated type
5408 and lacks a @code{case} for one or more of the named codes of that
5409 enumeration. @code{case} labels outside the enumeration range also
5410 provoke warnings when this option is used. The only difference
5411 between @option{-Wswitch} and this option is that this option gives a
5412 warning about an omitted enumeration code even if there is a
5413 @code{default} label.
5414
5415 @item -Wswitch-bool
5416 @opindex Wswitch-bool
5417 @opindex Wno-switch-bool
5418 Warn whenever a @code{switch} statement has an index of boolean type
5419 and the case values are outside the range of a boolean type.
5420 It is possible to suppress this warning by casting the controlling
5421 expression to a type other than @code{bool}. For example:
5422 @smallexample
5423 @group
5424 switch ((int) (a == 4))
5425 @{
5426 @dots{}
5427 @}
5428 @end group
5429 @end smallexample
5430 This warning is enabled by default for C and C++ programs.
5431
5432 @item -Wswitch-outside-range
5433 @opindex Wswitch-outside-range
5434 @opindex Wno-switch-outside-range
5435 Warn whenever a @code{switch} case has a value that is outside of its
5436 respective type range. This warning is enabled by default for
5437 C and C++ programs.
5438
5439 @item -Wswitch-unreachable
5440 @opindex Wswitch-unreachable
5441 @opindex Wno-switch-unreachable
5442 Warn whenever a @code{switch} statement contains statements between the
5443 controlling expression and the first case label, which will never be
5444 executed. For example:
5445 @smallexample
5446 @group
5447 switch (cond)
5448 @{
5449 i = 15;
5450 @dots{}
5451 case 5:
5452 @dots{}
5453 @}
5454 @end group
5455 @end smallexample
5456 @option{-Wswitch-unreachable} does not warn if the statement between the
5457 controlling expression and the first case label is just a declaration:
5458 @smallexample
5459 @group
5460 switch (cond)
5461 @{
5462 int i;
5463 @dots{}
5464 case 5:
5465 i = 5;
5466 @dots{}
5467 @}
5468 @end group
5469 @end smallexample
5470 This warning is enabled by default for C and C++ programs.
5471
5472 @item -Wsync-nand @r{(C and C++ only)}
5473 @opindex Wsync-nand
5474 @opindex Wno-sync-nand
5475 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5476 built-in functions are used. These functions changed semantics in GCC 4.4.
5477
5478 @item -Wunused-but-set-parameter
5479 @opindex Wunused-but-set-parameter
5480 @opindex Wno-unused-but-set-parameter
5481 Warn whenever a function parameter is assigned to, but otherwise unused
5482 (aside from its declaration).
5483
5484 To suppress this warning use the @code{unused} attribute
5485 (@pxref{Variable Attributes}).
5486
5487 This warning is also enabled by @option{-Wunused} together with
5488 @option{-Wextra}.
5489
5490 @item -Wunused-but-set-variable
5491 @opindex Wunused-but-set-variable
5492 @opindex Wno-unused-but-set-variable
5493 Warn whenever a local variable is assigned to, but otherwise unused
5494 (aside from its declaration).
5495 This warning is enabled by @option{-Wall}.
5496
5497 To suppress this warning use the @code{unused} attribute
5498 (@pxref{Variable Attributes}).
5499
5500 This warning is also enabled by @option{-Wunused}, which is enabled
5501 by @option{-Wall}.
5502
5503 @item -Wunused-function
5504 @opindex Wunused-function
5505 @opindex Wno-unused-function
5506 Warn whenever a static function is declared but not defined or a
5507 non-inline static function is unused.
5508 This warning is enabled by @option{-Wall}.
5509
5510 @item -Wunused-label
5511 @opindex Wunused-label
5512 @opindex Wno-unused-label
5513 Warn whenever a label is declared but not used.
5514 This warning is enabled by @option{-Wall}.
5515
5516 To suppress this warning use the @code{unused} attribute
5517 (@pxref{Variable Attributes}).
5518
5519 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5520 @opindex Wunused-local-typedefs
5521 @opindex Wno-unused-local-typedefs
5522 Warn when a typedef locally defined in a function is not used.
5523 This warning is enabled by @option{-Wall}.
5524
5525 @item -Wunused-parameter
5526 @opindex Wunused-parameter
5527 @opindex Wno-unused-parameter
5528 Warn whenever a function parameter is unused aside from its declaration.
5529
5530 To suppress this warning use the @code{unused} attribute
5531 (@pxref{Variable Attributes}).
5532
5533 @item -Wno-unused-result
5534 @opindex Wunused-result
5535 @opindex Wno-unused-result
5536 Do not warn if a caller of a function marked with attribute
5537 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5538 its return value. The default is @option{-Wunused-result}.
5539
5540 @item -Wunused-variable
5541 @opindex Wunused-variable
5542 @opindex Wno-unused-variable
5543 Warn whenever a local or static variable is unused aside from its
5544 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5545 but not for C++. This warning is enabled by @option{-Wall}.
5546
5547 To suppress this warning use the @code{unused} attribute
5548 (@pxref{Variable Attributes}).
5549
5550 @item -Wunused-const-variable
5551 @itemx -Wunused-const-variable=@var{n}
5552 @opindex Wunused-const-variable
5553 @opindex Wno-unused-const-variable
5554 Warn whenever a constant static variable is unused aside from its declaration.
5555 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5556 for C, but not for C++. In C this declares variable storage, but in C++ this
5557 is not an error since const variables take the place of @code{#define}s.
5558
5559 To suppress this warning use the @code{unused} attribute
5560 (@pxref{Variable Attributes}).
5561
5562 @table @gcctabopt
5563 @item -Wunused-const-variable=1
5564 This is the warning level that is enabled by @option{-Wunused-variable} for
5565 C. It warns only about unused static const variables defined in the main
5566 compilation unit, but not about static const variables declared in any
5567 header included.
5568
5569 @item -Wunused-const-variable=2
5570 This warning level also warns for unused constant static variables in
5571 headers (excluding system headers). This is the warning level of
5572 @option{-Wunused-const-variable} and must be explicitly requested since
5573 in C++ this isn't an error and in C it might be harder to clean up all
5574 headers included.
5575 @end table
5576
5577 @item -Wunused-value
5578 @opindex Wunused-value
5579 @opindex Wno-unused-value
5580 Warn whenever a statement computes a result that is explicitly not
5581 used. To suppress this warning cast the unused expression to
5582 @code{void}. This includes an expression-statement or the left-hand
5583 side of a comma expression that contains no side effects. For example,
5584 an expression such as @code{x[i,j]} causes a warning, while
5585 @code{x[(void)i,j]} does not.
5586
5587 This warning is enabled by @option{-Wall}.
5588
5589 @item -Wunused
5590 @opindex Wunused
5591 @opindex Wno-unused
5592 All the above @option{-Wunused} options combined.
5593
5594 In order to get a warning about an unused function parameter, you must
5595 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5596 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5597
5598 @item -Wuninitialized
5599 @opindex Wuninitialized
5600 @opindex Wno-uninitialized
5601 Warn if an automatic variable is used without first being initialized.
5602 In C++, warn if a non-static reference or non-static @code{const}
5603 member appears in a class without constructors.
5604
5605 If you want to warn about code that uses the uninitialized value of the
5606 variable in its own initializer, use the @option{-Winit-self} option.
5607
5608 These warnings occur for individual uninitialized elements of
5609 structure, union or array variables as well as for variables that are
5610 uninitialized as a whole. They do not occur for variables or elements
5611 declared @code{volatile}. Because these warnings depend on
5612 optimization, the exact variables or elements for which there are
5613 warnings depend on the precise optimization options and version of GCC
5614 used.
5615
5616 Note that there may be no warning about a variable that is used only
5617 to compute a value that itself is never used, because such
5618 computations may be deleted by data flow analysis before the warnings
5619 are printed.
5620
5621 @item -Winvalid-memory-model
5622 @opindex Winvalid-memory-model
5623 @opindex Wno-invalid-memory-model
5624 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5625 and the C11 atomic generic functions with a memory consistency argument
5626 that is either invalid for the operation or outside the range of values
5627 of the @code{memory_order} enumeration. For example, since the
5628 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5629 defined for the relaxed, release, and sequentially consistent memory
5630 orders the following code is diagnosed:
5631
5632 @smallexample
5633 void store (int *i)
5634 @{
5635 __atomic_store_n (i, 0, memory_order_consume);
5636 @}
5637 @end smallexample
5638
5639 @option{-Winvalid-memory-model} is enabled by default.
5640
5641 @item -Wmaybe-uninitialized
5642 @opindex Wmaybe-uninitialized
5643 @opindex Wno-maybe-uninitialized
5644 For an automatic (i.e.@: local) variable, if there exists a path from the
5645 function entry to a use of the variable that is initialized, but there exist
5646 some other paths for which the variable is not initialized, the compiler
5647 emits a warning if it cannot prove the uninitialized paths are not
5648 executed at run time.
5649
5650 These warnings are only possible in optimizing compilation, because otherwise
5651 GCC does not keep track of the state of variables.
5652
5653 These warnings are made optional because GCC may not be able to determine when
5654 the code is correct in spite of appearing to have an error. Here is one
5655 example of how this can happen:
5656
5657 @smallexample
5658 @group
5659 @{
5660 int x;
5661 switch (y)
5662 @{
5663 case 1: x = 1;
5664 break;
5665 case 2: x = 4;
5666 break;
5667 case 3: x = 5;
5668 @}
5669 foo (x);
5670 @}
5671 @end group
5672 @end smallexample
5673
5674 @noindent
5675 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5676 always initialized, but GCC doesn't know this. To suppress the
5677 warning, you need to provide a default case with assert(0) or
5678 similar code.
5679
5680 @cindex @code{longjmp} warnings
5681 This option also warns when a non-volatile automatic variable might be
5682 changed by a call to @code{longjmp}.
5683 The compiler sees only the calls to @code{setjmp}. It cannot know
5684 where @code{longjmp} will be called; in fact, a signal handler could
5685 call it at any point in the code. As a result, you may get a warning
5686 even when there is in fact no problem because @code{longjmp} cannot
5687 in fact be called at the place that would cause a problem.
5688
5689 Some spurious warnings can be avoided if you declare all the functions
5690 you use that never return as @code{noreturn}. @xref{Function
5691 Attributes}.
5692
5693 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5694
5695 @item -Wunknown-pragmas
5696 @opindex Wunknown-pragmas
5697 @opindex Wno-unknown-pragmas
5698 @cindex warning for unknown pragmas
5699 @cindex unknown pragmas, warning
5700 @cindex pragmas, warning of unknown
5701 Warn when a @code{#pragma} directive is encountered that is not understood by
5702 GCC@. If this command-line option is used, warnings are even issued
5703 for unknown pragmas in system header files. This is not the case if
5704 the warnings are only enabled by the @option{-Wall} command-line option.
5705
5706 @item -Wno-pragmas
5707 @opindex Wno-pragmas
5708 @opindex Wpragmas
5709 Do not warn about misuses of pragmas, such as incorrect parameters,
5710 invalid syntax, or conflicts between pragmas. See also
5711 @option{-Wunknown-pragmas}.
5712
5713 @item -Wno-prio-ctor-dtor
5714 @opindex Wno-prio-ctor-dtor
5715 @opindex Wprio-ctor-dtor
5716 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5717 The use of constructor and destructor attributes allow you to assign a
5718 priority to the constructor/destructor to control its order of execution
5719 before @code{main} is called or after it returns. The priority values must be
5720 greater than 100 as the compiler reserves priority values between 0--100 for
5721 the implementation.
5722
5723 @item -Wstrict-aliasing
5724 @opindex Wstrict-aliasing
5725 @opindex Wno-strict-aliasing
5726 This option is only active when @option{-fstrict-aliasing} is active.
5727 It warns about code that might break the strict aliasing rules that the
5728 compiler is using for optimization. The warning does not catch all
5729 cases, but does attempt to catch the more common pitfalls. It is
5730 included in @option{-Wall}.
5731 It is equivalent to @option{-Wstrict-aliasing=3}
5732
5733 @item -Wstrict-aliasing=n
5734 @opindex Wstrict-aliasing=n
5735 This option is only active when @option{-fstrict-aliasing} is active.
5736 It warns about code that might break the strict aliasing rules that the
5737 compiler is using for optimization.
5738 Higher levels correspond to higher accuracy (fewer false positives).
5739 Higher levels also correspond to more effort, similar to the way @option{-O}
5740 works.
5741 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5742
5743 Level 1: Most aggressive, quick, least accurate.
5744 Possibly useful when higher levels
5745 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5746 false negatives. However, it has many false positives.
5747 Warns for all pointer conversions between possibly incompatible types,
5748 even if never dereferenced. Runs in the front end only.
5749
5750 Level 2: Aggressive, quick, not too precise.
5751 May still have many false positives (not as many as level 1 though),
5752 and few false negatives (but possibly more than level 1).
5753 Unlike level 1, it only warns when an address is taken. Warns about
5754 incomplete types. Runs in the front end only.
5755
5756 Level 3 (default for @option{-Wstrict-aliasing}):
5757 Should have very few false positives and few false
5758 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5759 Takes care of the common pun+dereference pattern in the front end:
5760 @code{*(int*)&some_float}.
5761 If optimization is enabled, it also runs in the back end, where it deals
5762 with multiple statement cases using flow-sensitive points-to information.
5763 Only warns when the converted pointer is dereferenced.
5764 Does not warn about incomplete types.
5765
5766 @item -Wstrict-overflow
5767 @itemx -Wstrict-overflow=@var{n}
5768 @opindex Wstrict-overflow
5769 @opindex Wno-strict-overflow
5770 This option is only active when signed overflow is undefined.
5771 It warns about cases where the compiler optimizes based on the
5772 assumption that signed overflow does not occur. Note that it does not
5773 warn about all cases where the code might overflow: it only warns
5774 about cases where the compiler implements some optimization. Thus
5775 this warning depends on the optimization level.
5776
5777 An optimization that assumes that signed overflow does not occur is
5778 perfectly safe if the values of the variables involved are such that
5779 overflow never does, in fact, occur. Therefore this warning can
5780 easily give a false positive: a warning about code that is not
5781 actually a problem. To help focus on important issues, several
5782 warning levels are defined. No warnings are issued for the use of
5783 undefined signed overflow when estimating how many iterations a loop
5784 requires, in particular when determining whether a loop will be
5785 executed at all.
5786
5787 @table @gcctabopt
5788 @item -Wstrict-overflow=1
5789 Warn about cases that are both questionable and easy to avoid. For
5790 example the compiler simplifies
5791 @code{x + 1 > x} to @code{1}. This level of
5792 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5793 are not, and must be explicitly requested.
5794
5795 @item -Wstrict-overflow=2
5796 Also warn about other cases where a comparison is simplified to a
5797 constant. For example: @code{abs (x) >= 0}. This can only be
5798 simplified when signed integer overflow is undefined, because
5799 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5800 zero. @option{-Wstrict-overflow} (with no level) is the same as
5801 @option{-Wstrict-overflow=2}.
5802
5803 @item -Wstrict-overflow=3
5804 Also warn about other cases where a comparison is simplified. For
5805 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5806
5807 @item -Wstrict-overflow=4
5808 Also warn about other simplifications not covered by the above cases.
5809 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5810
5811 @item -Wstrict-overflow=5
5812 Also warn about cases where the compiler reduces the magnitude of a
5813 constant involved in a comparison. For example: @code{x + 2 > y} is
5814 simplified to @code{x + 1 >= y}. This is reported only at the
5815 highest warning level because this simplification applies to many
5816 comparisons, so this warning level gives a very large number of
5817 false positives.
5818 @end table
5819
5820 @item -Wstring-compare
5821 @opindex Wstring-compare
5822 @opindex Wno-string-compare
5823 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
5824 determined to be either zero or non-zero in tests for such equality
5825 owing to the length of one argument being greater than the size of
5826 the array the other argument is stored in (or the bound in the case
5827 of @code{strncmp}). Such calls could be mistakes. For example,
5828 the call to @code{strcmp} below is diagnosed because its result is
5829 necessarily non-zero irrespective of the contents of the array @code{a}.
5830
5831 @smallexample
5832 extern char a[4];
5833 void f (char *d)
5834 @{
5835 strcpy (d, "string");
5836 @dots{}
5837 if (0 == strcmp (a, d)) // cannot be true
5838 puts ("a and d are the same");
5839 @}
5840 @end smallexample
5841
5842 @option{-Wstring-compare} is enabled by @option{-Wextra}.
5843
5844 @item -Wstringop-overflow
5845 @itemx -Wstringop-overflow=@var{type}
5846 @opindex Wstringop-overflow
5847 @opindex Wno-stringop-overflow
5848 Warn for calls to string manipulation functions such as @code{memcpy} and
5849 @code{strcpy} that are determined to overflow the destination buffer. The
5850 optional argument is one greater than the type of Object Size Checking to
5851 perform to determine the size of the destination. @xref{Object Size Checking}.
5852 The argument is meaningful only for functions that operate on character arrays
5853 but not for raw memory functions like @code{memcpy} which always make use
5854 of Object Size type-0. The option also warns for calls that specify a size
5855 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5856 The option produces the best results with optimization enabled but can detect
5857 a small subset of simple buffer overflows even without optimization in
5858 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5859 correspond to the standard functions. In any case, the option warns about
5860 just a subset of buffer overflows detected by the corresponding overflow
5861 checking built-ins. For example, the option will issue a warning for
5862 the @code{strcpy} call below because it copies at least 5 characters
5863 (the string @code{"blue"} including the terminating NUL) into the buffer
5864 of size 4.
5865
5866 @smallexample
5867 enum Color @{ blue, purple, yellow @};
5868 const char* f (enum Color clr)
5869 @{
5870 static char buf [4];
5871 const char *str;
5872 switch (clr)
5873 @{
5874 case blue: str = "blue"; break;
5875 case purple: str = "purple"; break;
5876 case yellow: str = "yellow"; break;
5877 @}
5878
5879 return strcpy (buf, str); // warning here
5880 @}
5881 @end smallexample
5882
5883 Option @option{-Wstringop-overflow=2} is enabled by default.
5884
5885 @table @gcctabopt
5886 @item -Wstringop-overflow
5887 @itemx -Wstringop-overflow=1
5888 @opindex Wstringop-overflow
5889 @opindex Wno-stringop-overflow
5890 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5891 to determine the sizes of destination objects. This is the default setting
5892 of the option. At this setting the option will not warn for writes past
5893 the end of subobjects of larger objects accessed by pointers unless the
5894 size of the largest surrounding object is known. When the destination may
5895 be one of several objects it is assumed to be the largest one of them. On
5896 Linux systems, when optimization is enabled at this setting the option warns
5897 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5898 a non-zero value.
5899
5900 @item -Wstringop-overflow=2
5901 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5902 to determine the sizes of destination objects. At this setting the option
5903 will warn about overflows when writing to members of the largest complete
5904 objects whose exact size is known. It will, however, not warn for excessive
5905 writes to the same members of unknown objects referenced by pointers since
5906 they may point to arrays containing unknown numbers of elements.
5907
5908 @item -Wstringop-overflow=3
5909 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5910 to determine the sizes of destination objects. At this setting the option
5911 warns about overflowing the smallest object or data member. This is the
5912 most restrictive setting of the option that may result in warnings for safe
5913 code.
5914
5915 @item -Wstringop-overflow=4
5916 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5917 to determine the sizes of destination objects. At this setting the option
5918 will warn about overflowing any data members, and when the destination is
5919 one of several objects it uses the size of the largest of them to decide
5920 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5921 setting of the option may result in warnings for benign code.
5922 @end table
5923
5924 @item -Wstringop-truncation
5925 @opindex Wstringop-truncation
5926 @opindex Wno-stringop-truncation
5927 Warn for calls to bounded string manipulation functions such as @code{strncat},
5928 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5929 or leave the destination unchanged.
5930
5931 In the following example, the call to @code{strncat} specifies a bound that
5932 is less than the length of the source string. As a result, the copy of
5933 the source will be truncated and so the call is diagnosed. To avoid the
5934 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5935
5936 @smallexample
5937 void append (char *buf, size_t bufsize)
5938 @{
5939 strncat (buf, ".txt", 3);
5940 @}
5941 @end smallexample
5942
5943 As another example, the following call to @code{strncpy} results in copying
5944 to @code{d} just the characters preceding the terminating NUL, without
5945 appending the NUL to the end. Assuming the result of @code{strncpy} is
5946 necessarily a NUL-terminated string is a common mistake, and so the call
5947 is diagnosed. To avoid the warning when the result is not expected to be
5948 NUL-terminated, call @code{memcpy} instead.
5949
5950 @smallexample
5951 void copy (char *d, const char *s)
5952 @{
5953 strncpy (d, s, strlen (s));
5954 @}
5955 @end smallexample
5956
5957 In the following example, the call to @code{strncpy} specifies the size
5958 of the destination buffer as the bound. If the length of the source
5959 string is equal to or greater than this size the result of the copy will
5960 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5961 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5962 element of the buffer to @code{NUL}.
5963
5964 @smallexample
5965 void copy (const char *s)
5966 @{
5967 char buf[80];
5968 strncpy (buf, s, sizeof buf);
5969 @dots{}
5970 @}
5971 @end smallexample
5972
5973 In situations where a character array is intended to store a sequence
5974 of bytes with no terminating @code{NUL} such an array may be annotated
5975 with attribute @code{nonstring} to avoid this warning. Such arrays,
5976 however, are not suitable arguments to functions that expect
5977 @code{NUL}-terminated strings. To help detect accidental misuses of
5978 such arrays GCC issues warnings unless it can prove that the use is
5979 safe. @xref{Common Variable Attributes}.
5980
5981 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5982 @opindex Wsuggest-attribute=
5983 @opindex Wno-suggest-attribute=
5984 Warn for cases where adding an attribute may be beneficial. The
5985 attributes currently supported are listed below.
5986
5987 @table @gcctabopt
5988 @item -Wsuggest-attribute=pure
5989 @itemx -Wsuggest-attribute=const
5990 @itemx -Wsuggest-attribute=noreturn
5991 @itemx -Wmissing-noreturn
5992 @itemx -Wsuggest-attribute=malloc
5993 @opindex Wsuggest-attribute=pure
5994 @opindex Wno-suggest-attribute=pure
5995 @opindex Wsuggest-attribute=const
5996 @opindex Wno-suggest-attribute=const
5997 @opindex Wsuggest-attribute=noreturn
5998 @opindex Wno-suggest-attribute=noreturn
5999 @opindex Wmissing-noreturn
6000 @opindex Wno-missing-noreturn
6001 @opindex Wsuggest-attribute=malloc
6002 @opindex Wno-suggest-attribute=malloc
6003
6004 Warn about functions that might be candidates for attributes
6005 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
6006 only warns for functions visible in other compilation units or (in the case of
6007 @code{pure} and @code{const}) if it cannot prove that the function returns
6008 normally. A function returns normally if it doesn't contain an infinite loop or
6009 return abnormally by throwing, calling @code{abort} or trapping. This analysis
6010 requires option @option{-fipa-pure-const}, which is enabled by default at
6011 @option{-O} and higher. Higher optimization levels improve the accuracy
6012 of the analysis.
6013
6014 @item -Wsuggest-attribute=format
6015 @itemx -Wmissing-format-attribute
6016 @opindex Wsuggest-attribute=format
6017 @opindex Wmissing-format-attribute
6018 @opindex Wno-suggest-attribute=format
6019 @opindex Wno-missing-format-attribute
6020 @opindex Wformat
6021 @opindex Wno-format
6022
6023 Warn about function pointers that might be candidates for @code{format}
6024 attributes. Note these are only possible candidates, not absolute ones.
6025 GCC guesses that function pointers with @code{format} attributes that
6026 are used in assignment, initialization, parameter passing or return
6027 statements should have a corresponding @code{format} attribute in the
6028 resulting type. I.e.@: the left-hand side of the assignment or
6029 initialization, the type of the parameter variable, or the return type
6030 of the containing function respectively should also have a @code{format}
6031 attribute to avoid the warning.
6032
6033 GCC also warns about function definitions that might be
6034 candidates for @code{format} attributes. Again, these are only
6035 possible candidates. GCC guesses that @code{format} attributes
6036 might be appropriate for any function that calls a function like
6037 @code{vprintf} or @code{vscanf}, but this might not always be the
6038 case, and some functions for which @code{format} attributes are
6039 appropriate may not be detected.
6040
6041 @item -Wsuggest-attribute=cold
6042 @opindex Wsuggest-attribute=cold
6043 @opindex Wno-suggest-attribute=cold
6044
6045 Warn about functions that might be candidates for @code{cold} attribute. This
6046 is based on static detection and generally will only warn about functions which
6047 always leads to a call to another @code{cold} function such as wrappers of
6048 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6049 @end table
6050
6051 @item -Wsuggest-final-types
6052 @opindex Wno-suggest-final-types
6053 @opindex Wsuggest-final-types
6054 Warn about types with virtual methods where code quality would be improved
6055 if the type were declared with the C++11 @code{final} specifier,
6056 or, if possible,
6057 declared in an anonymous namespace. This allows GCC to more aggressively
6058 devirtualize the polymorphic calls. This warning is more effective with
6059 link-time optimization,
6060 where the information about the class hierarchy graph is
6061 more complete.
6062
6063 @item -Wsuggest-final-methods
6064 @opindex Wno-suggest-final-methods
6065 @opindex Wsuggest-final-methods
6066 Warn about virtual methods where code quality would be improved if the method
6067 were declared with the C++11 @code{final} specifier,
6068 or, if possible, its type were
6069 declared in an anonymous namespace or with the @code{final} specifier.
6070 This warning is
6071 more effective with link-time optimization, where the information about the
6072 class hierarchy graph is more complete. It is recommended to first consider
6073 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6074 annotations.
6075
6076 @item -Wsuggest-override
6077 Warn about overriding virtual functions that are not marked with the override
6078 keyword.
6079
6080 @item -Walloc-zero
6081 @opindex Wno-alloc-zero
6082 @opindex Walloc-zero
6083 Warn about calls to allocation functions decorated with attribute
6084 @code{alloc_size} that specify zero bytes, including those to the built-in
6085 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6086 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6087 when called with a zero size differs among implementations (and in the case
6088 of @code{realloc} has been deprecated) relying on it may result in subtle
6089 portability bugs and should be avoided.
6090
6091 @item -Walloc-size-larger-than=@var{byte-size}
6092 @opindex Walloc-size-larger-than=
6093 @opindex Wno-alloc-size-larger-than
6094 Warn about calls to functions decorated with attribute @code{alloc_size}
6095 that attempt to allocate objects larger than the specified number of bytes,
6096 or where the result of the size computation in an integer type with infinite
6097 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6098 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6099 Warnings controlled by the option can be disabled either by specifying
6100 @var{byte-size} of @samp{SIZE_MAX} or more or by
6101 @option{-Wno-alloc-size-larger-than}.
6102 @xref{Function Attributes}.
6103
6104 @item -Wno-alloc-size-larger-than
6105 @opindex Wno-alloc-size-larger-than
6106 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6107 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6108 larger.
6109
6110 @item -Walloca
6111 @opindex Wno-alloca
6112 @opindex Walloca
6113 This option warns on all uses of @code{alloca} in the source.
6114
6115 @item -Walloca-larger-than=@var{byte-size}
6116 @opindex Walloca-larger-than=
6117 @opindex Wno-alloca-larger-than
6118 This option warns on calls to @code{alloca} with an integer argument whose
6119 value is either zero, or that is not bounded by a controlling predicate
6120 that limits its value to at most @var{byte-size}. It also warns for calls
6121 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6122 types are considered unbounded even if they appear to be constrained to
6123 the expected range.
6124
6125 For example, a bounded case of @code{alloca} could be:
6126
6127 @smallexample
6128 void func (size_t n)
6129 @{
6130 void *p;
6131 if (n <= 1000)
6132 p = alloca (n);
6133 else
6134 p = malloc (n);
6135 f (p);
6136 @}
6137 @end smallexample
6138
6139 In the above example, passing @code{-Walloca-larger-than=1000} would not
6140 issue a warning because the call to @code{alloca} is known to be at most
6141 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6142 the compiler would emit a warning.
6143
6144 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6145 controlling predicate constraining its integer argument. For example:
6146
6147 @smallexample
6148 void func ()
6149 @{
6150 void *p = alloca (n);
6151 f (p);
6152 @}
6153 @end smallexample
6154
6155 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6156 a warning, but this time because of the lack of bounds checking.
6157
6158 Note, that even seemingly correct code involving signed integers could
6159 cause a warning:
6160
6161 @smallexample
6162 void func (signed int n)
6163 @{
6164 if (n < 500)
6165 @{
6166 p = alloca (n);
6167 f (p);
6168 @}
6169 @}
6170 @end smallexample
6171
6172 In the above example, @var{n} could be negative, causing a larger than
6173 expected argument to be implicitly cast into the @code{alloca} call.
6174
6175 This option also warns when @code{alloca} is used in a loop.
6176
6177 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6178 but is usually only effective when @option{-ftree-vrp} is active (default
6179 for @option{-O2} and above).
6180
6181 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6182
6183 @item -Wno-alloca-larger-than
6184 @opindex Wno-alloca-larger-than
6185 Disable @option{-Walloca-larger-than=} warnings. The option is
6186 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6187
6188 @item -Warray-bounds
6189 @itemx -Warray-bounds=@var{n}
6190 @opindex Wno-array-bounds
6191 @opindex Warray-bounds
6192 This option is only active when @option{-ftree-vrp} is active
6193 (default for @option{-O2} and above). It warns about subscripts to arrays
6194 that are always out of bounds. This warning is enabled by @option{-Wall}.
6195
6196 @table @gcctabopt
6197 @item -Warray-bounds=1
6198 This is the warning level of @option{-Warray-bounds} and is enabled
6199 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6200
6201 @item -Warray-bounds=2
6202 This warning level also warns about out of bounds access for
6203 arrays at the end of a struct and for arrays accessed through
6204 pointers. This warning level may give a larger number of
6205 false positives and is deactivated by default.
6206 @end table
6207
6208 @item -Wattribute-alias=@var{n}
6209 @itemx -Wno-attribute-alias
6210 @opindex Wattribute-alias
6211 @opindex Wno-attribute-alias
6212 Warn about declarations using the @code{alias} and similar attributes whose
6213 target is incompatible with the type of the alias.
6214 @xref{Function Attributes,,Declaring Attributes of Functions}.
6215
6216 @table @gcctabopt
6217 @item -Wattribute-alias=1
6218 The default warning level of the @option{-Wattribute-alias} option diagnoses
6219 incompatibilities between the type of the alias declaration and that of its
6220 target. Such incompatibilities are typically indicative of bugs.
6221
6222 @item -Wattribute-alias=2
6223
6224 At this level @option{-Wattribute-alias} also diagnoses cases where
6225 the attributes of the alias declaration are more restrictive than the
6226 attributes applied to its target. These mismatches can potentially
6227 result in incorrect code generation. In other cases they may be
6228 benign and could be resolved simply by adding the missing attribute to
6229 the target. For comparison, see the @option{-Wmissing-attributes}
6230 option, which controls diagnostics when the alias declaration is less
6231 restrictive than the target, rather than more restrictive.
6232
6233 Attributes considered include @code{alloc_align}, @code{alloc_size},
6234 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6235 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6236 @code{returns_nonnull}, and @code{returns_twice}.
6237 @end table
6238
6239 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6240 This is the default. You can disable these warnings with either
6241 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6242
6243 @item -Wbool-compare
6244 @opindex Wno-bool-compare
6245 @opindex Wbool-compare
6246 Warn about boolean expression compared with an integer value different from
6247 @code{true}/@code{false}. For instance, the following comparison is
6248 always false:
6249 @smallexample
6250 int n = 5;
6251 @dots{}
6252 if ((n > 1) == 2) @{ @dots{} @}
6253 @end smallexample
6254 This warning is enabled by @option{-Wall}.
6255
6256 @item -Wbool-operation
6257 @opindex Wno-bool-operation
6258 @opindex Wbool-operation
6259 Warn about suspicious operations on expressions of a boolean type. For
6260 instance, bitwise negation of a boolean is very likely a bug in the program.
6261 For C, this warning also warns about incrementing or decrementing a boolean,
6262 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6263 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6264
6265 This warning is enabled by @option{-Wall}.
6266
6267 @item -Wduplicated-branches
6268 @opindex Wno-duplicated-branches
6269 @opindex Wduplicated-branches
6270 Warn when an if-else has identical branches. This warning detects cases like
6271 @smallexample
6272 if (p != NULL)
6273 return 0;
6274 else
6275 return 0;
6276 @end smallexample
6277 It doesn't warn when both branches contain just a null statement. This warning
6278 also warn for conditional operators:
6279 @smallexample
6280 int i = x ? *p : *p;
6281 @end smallexample
6282
6283 @item -Wduplicated-cond
6284 @opindex Wno-duplicated-cond
6285 @opindex Wduplicated-cond
6286 Warn about duplicated conditions in an if-else-if chain. For instance,
6287 warn for the following code:
6288 @smallexample
6289 if (p->q != NULL) @{ @dots{} @}
6290 else if (p->q != NULL) @{ @dots{} @}
6291 @end smallexample
6292
6293 @item -Wframe-address
6294 @opindex Wno-frame-address
6295 @opindex Wframe-address
6296 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6297 is called with an argument greater than 0. Such calls may return indeterminate
6298 values or crash the program. The warning is included in @option{-Wall}.
6299
6300 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6301 @opindex Wno-discarded-qualifiers
6302 @opindex Wdiscarded-qualifiers
6303 Do not warn if type qualifiers on pointers are being discarded.
6304 Typically, the compiler warns if a @code{const char *} variable is
6305 passed to a function that takes a @code{char *} parameter. This option
6306 can be used to suppress such a warning.
6307
6308 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6309 @opindex Wno-discarded-array-qualifiers
6310 @opindex Wdiscarded-array-qualifiers
6311 Do not warn if type qualifiers on arrays which are pointer targets
6312 are being discarded. Typically, the compiler warns if a
6313 @code{const int (*)[]} variable is passed to a function that
6314 takes a @code{int (*)[]} parameter. This option can be used to
6315 suppress such a warning.
6316
6317 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6318 @opindex Wno-incompatible-pointer-types
6319 @opindex Wincompatible-pointer-types
6320 Do not warn when there is a conversion between pointers that have incompatible
6321 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6322 which warns for pointer argument passing or assignment with different
6323 signedness.
6324
6325 @item -Wno-int-conversion @r{(C and Objective-C only)}
6326 @opindex Wno-int-conversion
6327 @opindex Wint-conversion
6328 Do not warn about incompatible integer to pointer and pointer to integer
6329 conversions. This warning is about implicit conversions; for explicit
6330 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6331 @option{-Wno-pointer-to-int-cast} may be used.
6332
6333 @item -Wno-div-by-zero
6334 @opindex Wno-div-by-zero
6335 @opindex Wdiv-by-zero
6336 Do not warn about compile-time integer division by zero. Floating-point
6337 division by zero is not warned about, as it can be a legitimate way of
6338 obtaining infinities and NaNs.
6339
6340 @item -Wsystem-headers
6341 @opindex Wsystem-headers
6342 @opindex Wno-system-headers
6343 @cindex warnings from system headers
6344 @cindex system headers, warnings from
6345 Print warning messages for constructs found in system header files.
6346 Warnings from system headers are normally suppressed, on the assumption
6347 that they usually do not indicate real problems and would only make the
6348 compiler output harder to read. Using this command-line option tells
6349 GCC to emit warnings from system headers as if they occurred in user
6350 code. However, note that using @option{-Wall} in conjunction with this
6351 option does @emph{not} warn about unknown pragmas in system
6352 headers---for that, @option{-Wunknown-pragmas} must also be used.
6353
6354 @item -Wtautological-compare
6355 @opindex Wtautological-compare
6356 @opindex Wno-tautological-compare
6357 Warn if a self-comparison always evaluates to true or false. This
6358 warning detects various mistakes such as:
6359 @smallexample
6360 int i = 1;
6361 @dots{}
6362 if (i > i) @{ @dots{} @}
6363 @end smallexample
6364
6365 This warning also warns about bitwise comparisons that always evaluate
6366 to true or false, for instance:
6367 @smallexample
6368 if ((a & 16) == 10) @{ @dots{} @}
6369 @end smallexample
6370 will always be false.
6371
6372 This warning is enabled by @option{-Wall}.
6373
6374 @item -Wtrampolines
6375 @opindex Wtrampolines
6376 @opindex Wno-trampolines
6377 Warn about trampolines generated for pointers to nested functions.
6378 A trampoline is a small piece of data or code that is created at run
6379 time on the stack when the address of a nested function is taken, and is
6380 used to call the nested function indirectly. For some targets, it is
6381 made up of data only and thus requires no special treatment. But, for
6382 most targets, it is made up of code and thus requires the stack to be
6383 made executable in order for the program to work properly.
6384
6385 @item -Wfloat-equal
6386 @opindex Wfloat-equal
6387 @opindex Wno-float-equal
6388 Warn if floating-point values are used in equality comparisons.
6389
6390 The idea behind this is that sometimes it is convenient (for the
6391 programmer) to consider floating-point values as approximations to
6392 infinitely precise real numbers. If you are doing this, then you need
6393 to compute (by analyzing the code, or in some other way) the maximum or
6394 likely maximum error that the computation introduces, and allow for it
6395 when performing comparisons (and when producing output, but that's a
6396 different problem). In particular, instead of testing for equality, you
6397 should check to see whether the two values have ranges that overlap; and
6398 this is done with the relational operators, so equality comparisons are
6399 probably mistaken.
6400
6401 @item -Wtraditional @r{(C and Objective-C only)}
6402 @opindex Wtraditional
6403 @opindex Wno-traditional
6404 Warn about certain constructs that behave differently in traditional and
6405 ISO C@. Also warn about ISO C constructs that have no traditional C
6406 equivalent, and/or problematic constructs that should be avoided.
6407
6408 @itemize @bullet
6409 @item
6410 Macro parameters that appear within string literals in the macro body.
6411 In traditional C macro replacement takes place within string literals,
6412 but in ISO C it does not.
6413
6414 @item
6415 In traditional C, some preprocessor directives did not exist.
6416 Traditional preprocessors only considered a line to be a directive
6417 if the @samp{#} appeared in column 1 on the line. Therefore
6418 @option{-Wtraditional} warns about directives that traditional C
6419 understands but ignores because the @samp{#} does not appear as the
6420 first character on the line. It also suggests you hide directives like
6421 @code{#pragma} not understood by traditional C by indenting them. Some
6422 traditional implementations do not recognize @code{#elif}, so this option
6423 suggests avoiding it altogether.
6424
6425 @item
6426 A function-like macro that appears without arguments.
6427
6428 @item
6429 The unary plus operator.
6430
6431 @item
6432 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6433 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6434 constants.) Note, these suffixes appear in macros defined in the system
6435 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6436 Use of these macros in user code might normally lead to spurious
6437 warnings, however GCC's integrated preprocessor has enough context to
6438 avoid warning in these cases.
6439
6440 @item
6441 A function declared external in one block and then used after the end of
6442 the block.
6443
6444 @item
6445 A @code{switch} statement has an operand of type @code{long}.
6446
6447 @item
6448 A non-@code{static} function declaration follows a @code{static} one.
6449 This construct is not accepted by some traditional C compilers.
6450
6451 @item
6452 The ISO type of an integer constant has a different width or
6453 signedness from its traditional type. This warning is only issued if
6454 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6455 typically represent bit patterns, are not warned about.
6456
6457 @item
6458 Usage of ISO string concatenation is detected.
6459
6460 @item
6461 Initialization of automatic aggregates.
6462
6463 @item
6464 Identifier conflicts with labels. Traditional C lacks a separate
6465 namespace for labels.
6466
6467 @item
6468 Initialization of unions. If the initializer is zero, the warning is
6469 omitted. This is done under the assumption that the zero initializer in
6470 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6471 initializer warnings and relies on default initialization to zero in the
6472 traditional C case.
6473
6474 @item
6475 Conversions by prototypes between fixed/floating-point values and vice
6476 versa. The absence of these prototypes when compiling with traditional
6477 C causes serious problems. This is a subset of the possible
6478 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6479
6480 @item
6481 Use of ISO C style function definitions. This warning intentionally is
6482 @emph{not} issued for prototype declarations or variadic functions
6483 because these ISO C features appear in your code when using
6484 libiberty's traditional C compatibility macros, @code{PARAMS} and
6485 @code{VPARAMS}. This warning is also bypassed for nested functions
6486 because that feature is already a GCC extension and thus not relevant to
6487 traditional C compatibility.
6488 @end itemize
6489
6490 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6491 @opindex Wtraditional-conversion
6492 @opindex Wno-traditional-conversion
6493 Warn if a prototype causes a type conversion that is different from what
6494 would happen to the same argument in the absence of a prototype. This
6495 includes conversions of fixed point to floating and vice versa, and
6496 conversions changing the width or signedness of a fixed-point argument
6497 except when the same as the default promotion.
6498
6499 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6500 @opindex Wdeclaration-after-statement
6501 @opindex Wno-declaration-after-statement
6502 Warn when a declaration is found after a statement in a block. This
6503 construct, known from C++, was introduced with ISO C99 and is by default
6504 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6505
6506 @item -Wshadow
6507 @opindex Wshadow
6508 @opindex Wno-shadow
6509 Warn whenever a local variable or type declaration shadows another
6510 variable, parameter, type, class member (in C++), or instance variable
6511 (in Objective-C) or whenever a built-in function is shadowed. Note
6512 that in C++, the compiler warns if a local variable shadows an
6513 explicit typedef, but not if it shadows a struct/class/enum.
6514 Same as @option{-Wshadow=global}.
6515
6516 @item -Wno-shadow-ivar @r{(Objective-C only)}
6517 @opindex Wno-shadow-ivar
6518 @opindex Wshadow-ivar
6519 Do not warn whenever a local variable shadows an instance variable in an
6520 Objective-C method.
6521
6522 @item -Wshadow=global
6523 @opindex Wshadow=global
6524 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6525 This warning is enabled by @option{-Wshadow=global}.
6526
6527 @item -Wshadow=local
6528 @opindex Wshadow=local
6529 Warn when a local variable shadows another local variable or parameter.
6530 This warning is enabled by @option{-Wshadow=local}.
6531
6532 @item -Wshadow=compatible-local
6533 @opindex Wshadow=compatible-local
6534 Warn when a local variable shadows another local variable or parameter
6535 whose type is compatible with that of the shadowing variable. In C++,
6536 type compatibility here means the type of the shadowing variable can be
6537 converted to that of the shadowed variable. The creation of this flag
6538 (in addition to @option{-Wshadow=local}) is based on the idea that when
6539 a local variable shadows another one of incompatible type, it is most
6540 likely intentional, not a bug or typo, as shown in the following example:
6541
6542 @smallexample
6543 @group
6544 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6545 @{
6546 for (int i = 0; i < N; ++i)
6547 @{
6548 ...
6549 @}
6550 ...
6551 @}
6552 @end group
6553 @end smallexample
6554
6555 Since the two variable @code{i} in the example above have incompatible types,
6556 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6557 Because their types are incompatible, if a programmer accidentally uses one
6558 in place of the other, type checking will catch that and emit an error or
6559 warning. So not warning (about shadowing) in this case will not lead to
6560 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6561 possibly reduce the number of warnings triggered by intentional shadowing.
6562 Note that this does also mean that shadowing @code{const char *i} by
6563 @code{char *i} will not emit a warning.
6564
6565 This warning is enabled by @option{-Wshadow=compatible-local}.
6566
6567 @item -Wlarger-than=@var{byte-size}
6568 @opindex Wlarger-than=
6569 @opindex Wlarger-than-@var{byte-size}
6570 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6571 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6572 Warnings controlled by the option can be disabled either by specifying
6573 @var{byte-size} of @samp{SIZE_MAX} or more or by
6574 @option{-Wno-larger-than}.
6575
6576 @item -Wno-larger-than
6577 @opindex Wno-larger-than
6578 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6579 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6580
6581 @item -Wframe-larger-than=@var{byte-size}
6582 @opindex Wframe-larger-than=
6583 @opindex Wno-frame-larger-than
6584 Warn if the size of a function frame exceeds @var{byte-size}.
6585 The computation done to determine the stack frame size is approximate
6586 and not conservative.
6587 The actual requirements may be somewhat greater than @var{byte-size}
6588 even if you do not get a warning. In addition, any space allocated
6589 via @code{alloca}, variable-length arrays, or related constructs
6590 is not included by the compiler when determining
6591 whether or not to issue a warning.
6592 @option{-Wframe-larger-than=}@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-frame-larger-than}.
6596
6597 @item -Wno-frame-larger-than
6598 @opindex Wno-frame-larger-than
6599 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6600 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6601
6602 @item -Wno-free-nonheap-object
6603 @opindex Wno-free-nonheap-object
6604 @opindex Wfree-nonheap-object
6605 Do not warn when attempting to free an object that was not allocated
6606 on the heap.
6607
6608 @item -Wstack-usage=@var{byte-size}
6609 @opindex Wstack-usage
6610 @opindex Wno-stack-usage
6611 Warn if the stack usage of a function might exceed @var{byte-size}.
6612 The computation done to determine the stack usage is conservative.
6613 Any space allocated via @code{alloca}, variable-length arrays, or related
6614 constructs is included by the compiler when determining whether or not to
6615 issue a warning.
6616
6617 The message is in keeping with the output of @option{-fstack-usage}.
6618
6619 @itemize
6620 @item
6621 If the stack usage is fully static but exceeds the specified amount, it's:
6622
6623 @smallexample
6624 warning: stack usage is 1120 bytes
6625 @end smallexample
6626 @item
6627 If the stack usage is (partly) dynamic but bounded, it's:
6628
6629 @smallexample
6630 warning: stack usage might be 1648 bytes
6631 @end smallexample
6632 @item
6633 If the stack usage is (partly) dynamic and not bounded, it's:
6634
6635 @smallexample
6636 warning: stack usage might be unbounded
6637 @end smallexample
6638 @end itemize
6639
6640 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6641 Warnings controlled by the option can be disabled either by specifying
6642 @var{byte-size} of @samp{SIZE_MAX} or more or by
6643 @option{-Wno-stack-usage}.
6644
6645 @item -Wno-stack-usage
6646 @opindex Wno-stack-usage
6647 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6648 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6649
6650 @item -Wunsafe-loop-optimizations
6651 @opindex Wunsafe-loop-optimizations
6652 @opindex Wno-unsafe-loop-optimizations
6653 Warn if the loop cannot be optimized because the compiler cannot
6654 assume anything on the bounds of the loop indices. With
6655 @option{-funsafe-loop-optimizations} warn if the compiler makes
6656 such assumptions.
6657
6658 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6659 @opindex Wno-pedantic-ms-format
6660 @opindex Wpedantic-ms-format
6661 When used in combination with @option{-Wformat}
6662 and @option{-pedantic} without GNU extensions, this option
6663 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6664 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6665 which depend on the MS runtime.
6666
6667 @item -Waligned-new
6668 @opindex Waligned-new
6669 @opindex Wno-aligned-new
6670 Warn about a new-expression of a type that requires greater alignment
6671 than the @code{alignof(std::max_align_t)} but uses an allocation
6672 function without an explicit alignment parameter. This option is
6673 enabled by @option{-Wall}.
6674
6675 Normally this only warns about global allocation functions, but
6676 @option{-Waligned-new=all} also warns about class member allocation
6677 functions.
6678
6679 @item -Wplacement-new
6680 @itemx -Wplacement-new=@var{n}
6681 @opindex Wplacement-new
6682 @opindex Wno-placement-new
6683 Warn about placement new expressions with undefined behavior, such as
6684 constructing an object in a buffer that is smaller than the type of
6685 the object. For example, the placement new expression below is diagnosed
6686 because it attempts to construct an array of 64 integers in a buffer only
6687 64 bytes large.
6688 @smallexample
6689 char buf [64];
6690 new (buf) int[64];
6691 @end smallexample
6692 This warning is enabled by default.
6693
6694 @table @gcctabopt
6695 @item -Wplacement-new=1
6696 This is the default warning level of @option{-Wplacement-new}. At this
6697 level the warning is not issued for some strictly undefined constructs that
6698 GCC allows as extensions for compatibility with legacy code. For example,
6699 the following @code{new} expression is not diagnosed at this level even
6700 though it has undefined behavior according to the C++ standard because
6701 it writes past the end of the one-element array.
6702 @smallexample
6703 struct S @{ int n, a[1]; @};
6704 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6705 new (s->a)int [32]();
6706 @end smallexample
6707
6708 @item -Wplacement-new=2
6709 At this level, in addition to diagnosing all the same constructs as at level
6710 1, a diagnostic is also issued for placement new expressions that construct
6711 an object in the last member of structure whose type is an array of a single
6712 element and whose size is less than the size of the object being constructed.
6713 While the previous example would be diagnosed, the following construct makes
6714 use of the flexible member array extension to avoid the warning at level 2.
6715 @smallexample
6716 struct S @{ int n, a[]; @};
6717 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6718 new (s->a)int [32]();
6719 @end smallexample
6720
6721 @end table
6722
6723 @item -Wpointer-arith
6724 @opindex Wpointer-arith
6725 @opindex Wno-pointer-arith
6726 Warn about anything that depends on the ``size of'' a function type or
6727 of @code{void}. GNU C assigns these types a size of 1, for
6728 convenience in calculations with @code{void *} pointers and pointers
6729 to functions. In C++, warn also when an arithmetic operation involves
6730 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6731
6732 @item -Wpointer-compare
6733 @opindex Wpointer-compare
6734 @opindex Wno-pointer-compare
6735 Warn if a pointer is compared with a zero character constant. This usually
6736 means that the pointer was meant to be dereferenced. For example:
6737
6738 @smallexample
6739 const char *p = foo ();
6740 if (p == '\0')
6741 return 42;
6742 @end smallexample
6743
6744 Note that the code above is invalid in C++11.
6745
6746 This warning is enabled by default.
6747
6748 @item -Wtype-limits
6749 @opindex Wtype-limits
6750 @opindex Wno-type-limits
6751 Warn if a comparison is always true or always false due to the limited
6752 range of the data type, but do not warn for constant expressions. For
6753 example, warn if an unsigned variable is compared against zero with
6754 @code{<} or @code{>=}. This warning is also enabled by
6755 @option{-Wextra}.
6756
6757 @item -Wabsolute-value @r{(C and Objective-C only)}
6758 @opindex Wabsolute-value
6759 @opindex Wno-absolute-value
6760 Warn for calls to standard functions that compute the absolute value
6761 of an argument when a more appropriate standard function is available.
6762 For example, calling @code{abs(3.14)} triggers the warning because the
6763 appropriate function to call to compute the absolute value of a double
6764 argument is @code{fabs}. The option also triggers warnings when the
6765 argument in a call to such a function has an unsigned type. This
6766 warning can be suppressed with an explicit type cast and it is also
6767 enabled by @option{-Wextra}.
6768
6769 @include cppwarnopts.texi
6770
6771 @item -Wbad-function-cast @r{(C and Objective-C only)}
6772 @opindex Wbad-function-cast
6773 @opindex Wno-bad-function-cast
6774 Warn when a function call is cast to a non-matching type.
6775 For example, warn if a call to a function returning an integer type
6776 is cast to a pointer type.
6777
6778 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6779 @opindex Wc90-c99-compat
6780 @opindex Wno-c90-c99-compat
6781 Warn about features not present in ISO C90, but present in ISO C99.
6782 For instance, warn about use of variable length arrays, @code{long long}
6783 type, @code{bool} type, compound literals, designated initializers, and so
6784 on. This option is independent of the standards mode. Warnings are disabled
6785 in the expression that follows @code{__extension__}.
6786
6787 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6788 @opindex Wc99-c11-compat
6789 @opindex Wno-c99-c11-compat
6790 Warn about features not present in ISO C99, but present in ISO C11.
6791 For instance, warn about use of anonymous structures and unions,
6792 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6793 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6794 and so on. This option is independent of the standards mode. Warnings are
6795 disabled in the expression that follows @code{__extension__}.
6796
6797 @item -Wc++-compat @r{(C and Objective-C only)}
6798 @opindex Wc++-compat
6799 @opindex Wno-c++-compat
6800 Warn about ISO C constructs that are outside of the common subset of
6801 ISO C and ISO C++, e.g.@: request for implicit conversion from
6802 @code{void *} to a pointer to non-@code{void} type.
6803
6804 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6805 @opindex Wc++11-compat
6806 @opindex Wno-c++11-compat
6807 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6808 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6809 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6810 enabled by @option{-Wall}.
6811
6812 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6813 @opindex Wc++14-compat
6814 @opindex Wno-c++14-compat
6815 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6816 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6817
6818 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6819 @opindex Wc++17-compat
6820 @opindex Wno-c++17-compat
6821 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6822 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6823
6824 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
6825 @opindex Wc++20-compat
6826 @opindex Wno-c++20-compat
6827 Warn about C++ constructs whose meaning differs between ISO C++ 2017
6828 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
6829
6830 @item -Wcast-qual
6831 @opindex Wcast-qual
6832 @opindex Wno-cast-qual
6833 Warn whenever a pointer is cast so as to remove a type qualifier from
6834 the target type. For example, warn if a @code{const char *} is cast
6835 to an ordinary @code{char *}.
6836
6837 Also warn when making a cast that introduces a type qualifier in an
6838 unsafe way. For example, casting @code{char **} to @code{const char **}
6839 is unsafe, as in this example:
6840
6841 @smallexample
6842 /* p is char ** value. */
6843 const char **q = (const char **) p;
6844 /* Assignment of readonly string to const char * is OK. */
6845 *q = "string";
6846 /* Now char** pointer points to read-only memory. */
6847 **p = 'b';
6848 @end smallexample
6849
6850 @item -Wcast-align
6851 @opindex Wcast-align
6852 @opindex Wno-cast-align
6853 Warn whenever a pointer is cast such that the required alignment of the
6854 target is increased. For example, warn if a @code{char *} is cast to
6855 an @code{int *} on machines where integers can only be accessed at
6856 two- or four-byte boundaries.
6857
6858 @item -Wcast-align=strict
6859 @opindex Wcast-align=strict
6860 Warn whenever a pointer is cast such that the required alignment of the
6861 target is increased. For example, warn if a @code{char *} is cast to
6862 an @code{int *} regardless of the target machine.
6863
6864 @item -Wcast-function-type
6865 @opindex Wcast-function-type
6866 @opindex Wno-cast-function-type
6867 Warn when a function pointer is cast to an incompatible function pointer.
6868 In a cast involving function types with a variable argument list only
6869 the types of initial arguments that are provided are considered.
6870 Any parameter of pointer-type matches any other pointer-type. Any benign
6871 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6872 on ILP32 targets. Likewise type qualifiers are ignored. The function
6873 type @code{void (*) (void)} is special and matches everything, which can
6874 be used to suppress this warning.
6875 In a cast involving pointer to member types this warning warns whenever
6876 the type cast is changing the pointer to member type.
6877 This warning is enabled by @option{-Wextra}.
6878
6879 @item -Wwrite-strings
6880 @opindex Wwrite-strings
6881 @opindex Wno-write-strings
6882 When compiling C, give string constants the type @code{const
6883 char[@var{length}]} so that copying the address of one into a
6884 non-@code{const} @code{char *} pointer produces a warning. These
6885 warnings help you find at compile time code that can try to write
6886 into a string constant, but only if you have been very careful about
6887 using @code{const} in declarations and prototypes. Otherwise, it is
6888 just a nuisance. This is why we did not make @option{-Wall} request
6889 these warnings.
6890
6891 When compiling C++, warn about the deprecated conversion from string
6892 literals to @code{char *}. This warning is enabled by default for C++
6893 programs.
6894
6895 @item -Wcatch-value
6896 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6897 @opindex Wcatch-value
6898 @opindex Wno-catch-value
6899 Warn about catch handlers that do not catch via reference.
6900 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6901 warn about polymorphic class types that are caught by value.
6902 With @option{-Wcatch-value=2} warn about all class types that are caught
6903 by value. With @option{-Wcatch-value=3} warn about all types that are
6904 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6905
6906 @item -Wclobbered
6907 @opindex Wclobbered
6908 @opindex Wno-clobbered
6909 Warn for variables that might be changed by @code{longjmp} or
6910 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6911
6912 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6913 @opindex Wconditionally-supported
6914 @opindex Wno-conditionally-supported
6915 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6916
6917 @item -Wconversion
6918 @opindex Wconversion
6919 @opindex Wno-conversion
6920 Warn for implicit conversions that may alter a value. This includes
6921 conversions between real and integer, like @code{abs (x)} when
6922 @code{x} is @code{double}; conversions between signed and unsigned,
6923 like @code{unsigned ui = -1}; and conversions to smaller types, like
6924 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6925 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6926 changed by the conversion like in @code{abs (2.0)}. Warnings about
6927 conversions between signed and unsigned integers can be disabled by
6928 using @option{-Wno-sign-conversion}.
6929
6930 For C++, also warn for confusing overload resolution for user-defined
6931 conversions; and conversions that never use a type conversion
6932 operator: conversions to @code{void}, the same type, a base class or a
6933 reference to them. Warnings about conversions between signed and
6934 unsigned integers are disabled by default in C++ unless
6935 @option{-Wsign-conversion} is explicitly enabled.
6936
6937 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6938 @opindex Wconversion-null
6939 @opindex Wno-conversion-null
6940 Do not warn for conversions between @code{NULL} and non-pointer
6941 types. @option{-Wconversion-null} is enabled by default.
6942
6943 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6944 @opindex Wzero-as-null-pointer-constant
6945 @opindex Wno-zero-as-null-pointer-constant
6946 Warn when a literal @samp{0} is used as null pointer constant. This can
6947 be useful to facilitate the conversion to @code{nullptr} in C++11.
6948
6949 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6950 @opindex Wsubobject-linkage
6951 @opindex Wno-subobject-linkage
6952 Warn if a class type has a base or a field whose type uses the anonymous
6953 namespace or depends on a type with no linkage. If a type A depends on
6954 a type B with no or internal linkage, defining it in multiple
6955 translation units would be an ODR violation because the meaning of B
6956 is different in each translation unit. If A only appears in a single
6957 translation unit, the best way to silence the warning is to give it
6958 internal linkage by putting it in an anonymous namespace as well. The
6959 compiler doesn't give this warning for types defined in the main .C
6960 file, as those are unlikely to have multiple definitions.
6961 @option{-Wsubobject-linkage} is enabled by default.
6962
6963 @item -Wdangling-else
6964 @opindex Wdangling-else
6965 @opindex Wno-dangling-else
6966 Warn about constructions where there may be confusion to which
6967 @code{if} statement an @code{else} branch belongs. Here is an example of
6968 such a case:
6969
6970 @smallexample
6971 @group
6972 @{
6973 if (a)
6974 if (b)
6975 foo ();
6976 else
6977 bar ();
6978 @}
6979 @end group
6980 @end smallexample
6981
6982 In C/C++, every @code{else} branch belongs to the innermost possible
6983 @code{if} statement, which in this example is @code{if (b)}. This is
6984 often not what the programmer expected, as illustrated in the above
6985 example by indentation the programmer chose. When there is the
6986 potential for this confusion, GCC issues a warning when this flag
6987 is specified. To eliminate the warning, add explicit braces around
6988 the innermost @code{if} statement so there is no way the @code{else}
6989 can belong to the enclosing @code{if}. The resulting code
6990 looks like this:
6991
6992 @smallexample
6993 @group
6994 @{
6995 if (a)
6996 @{
6997 if (b)
6998 foo ();
6999 else
7000 bar ();
7001 @}
7002 @}
7003 @end group
7004 @end smallexample
7005
7006 This warning is enabled by @option{-Wparentheses}.
7007
7008 @item -Wdate-time
7009 @opindex Wdate-time
7010 @opindex Wno-date-time
7011 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
7012 are encountered as they might prevent bit-wise-identical reproducible
7013 compilations.
7014
7015 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
7016 @opindex Wdelete-incomplete
7017 @opindex Wno-delete-incomplete
7018 Warn when deleting a pointer to incomplete type, which may cause
7019 undefined behavior at runtime. This warning is enabled by default.
7020
7021 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
7022 @opindex Wuseless-cast
7023 @opindex Wno-useless-cast
7024 Warn when an expression is casted to its own type.
7025
7026 @item -Wempty-body
7027 @opindex Wempty-body
7028 @opindex Wno-empty-body
7029 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
7030 while} statement. This warning is also enabled by @option{-Wextra}.
7031
7032 @item -Wenum-compare
7033 @opindex Wenum-compare
7034 @opindex Wno-enum-compare
7035 Warn about a comparison between values of different enumerated types.
7036 In C++ enumerated type mismatches in conditional expressions are also
7037 diagnosed and the warning is enabled by default. In C this warning is
7038 enabled by @option{-Wall}.
7039
7040 @item -Wenum-conversion @r{(C, Objective-C only)}
7041 @opindex Wenum-conversion
7042 @opindex Wno-enum-conversion
7043 Warn when a value of enumerated type is implicitly converted to a
7044 different enumerated type. This warning is enabled by @option{-Wextra}.
7045
7046 @item -Wextra-semi @r{(C++, Objective-C++ only)}
7047 @opindex Wextra-semi
7048 @opindex Wno-extra-semi
7049 Warn about redundant semicolon after in-class function definition.
7050
7051 @item -Wjump-misses-init @r{(C, Objective-C only)}
7052 @opindex Wjump-misses-init
7053 @opindex Wno-jump-misses-init
7054 Warn if a @code{goto} statement or a @code{switch} statement jumps
7055 forward across the initialization of a variable, or jumps backward to a
7056 label after the variable has been initialized. This only warns about
7057 variables that are initialized when they are declared. This warning is
7058 only supported for C and Objective-C; in C++ this sort of branch is an
7059 error in any case.
7060
7061 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7062 can be disabled with the @option{-Wno-jump-misses-init} option.
7063
7064 @item -Wsign-compare
7065 @opindex Wsign-compare
7066 @opindex Wno-sign-compare
7067 @cindex warning for comparison of signed and unsigned values
7068 @cindex comparison of signed and unsigned values, warning
7069 @cindex signed and unsigned values, comparison warning
7070 Warn when a comparison between signed and unsigned values could produce
7071 an incorrect result when the signed value is converted to unsigned.
7072 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7073 also enabled by @option{-Wextra}.
7074
7075 @item -Wsign-conversion
7076 @opindex Wsign-conversion
7077 @opindex Wno-sign-conversion
7078 Warn for implicit conversions that may change the sign of an integer
7079 value, like assigning a signed integer expression to an unsigned
7080 integer variable. An explicit cast silences the warning. In C, this
7081 option is enabled also by @option{-Wconversion}.
7082
7083 @item -Wfloat-conversion
7084 @opindex Wfloat-conversion
7085 @opindex Wno-float-conversion
7086 Warn for implicit conversions that reduce the precision of a real value.
7087 This includes conversions from real to integer, and from higher precision
7088 real to lower precision real values. This option is also enabled by
7089 @option{-Wconversion}.
7090
7091 @item -Wno-scalar-storage-order
7092 @opindex Wno-scalar-storage-order
7093 @opindex Wscalar-storage-order
7094 Do not warn on suspicious constructs involving reverse scalar storage order.
7095
7096 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7097 @opindex Wsized-deallocation
7098 @opindex Wno-sized-deallocation
7099 Warn about a definition of an unsized deallocation function
7100 @smallexample
7101 void operator delete (void *) noexcept;
7102 void operator delete[] (void *) noexcept;
7103 @end smallexample
7104 without a definition of the corresponding sized deallocation function
7105 @smallexample
7106 void operator delete (void *, std::size_t) noexcept;
7107 void operator delete[] (void *, std::size_t) noexcept;
7108 @end smallexample
7109 or vice versa. Enabled by @option{-Wextra} along with
7110 @option{-fsized-deallocation}.
7111
7112 @item -Wsizeof-pointer-div
7113 @opindex Wsizeof-pointer-div
7114 @opindex Wno-sizeof-pointer-div
7115 Warn for suspicious divisions of two sizeof expressions that divide
7116 the pointer size by the element size, which is the usual way to compute
7117 the array size but won't work out correctly with pointers. This warning
7118 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7119 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7120
7121 @item -Wsizeof-pointer-memaccess
7122 @opindex Wsizeof-pointer-memaccess
7123 @opindex Wno-sizeof-pointer-memaccess
7124 Warn for suspicious length parameters to certain string and memory built-in
7125 functions if the argument uses @code{sizeof}. This warning triggers for
7126 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7127 an array, but a pointer, and suggests a possible fix, or about
7128 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7129 also warns about calls to bounded string copy functions like @code{strncat}
7130 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7131 the source array. For example, in the following function the call to
7132 @code{strncat} specifies the size of the source string as the bound. That
7133 is almost certainly a mistake and so the call is diagnosed.
7134 @smallexample
7135 void make_file (const char *name)
7136 @{
7137 char path[PATH_MAX];
7138 strncpy (path, name, sizeof path - 1);
7139 strncat (path, ".text", sizeof ".text");
7140 @dots{}
7141 @}
7142 @end smallexample
7143
7144 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7145
7146 @item -Wsizeof-array-argument
7147 @opindex Wsizeof-array-argument
7148 @opindex Wno-sizeof-array-argument
7149 Warn when the @code{sizeof} operator is applied to a parameter that is
7150 declared as an array in a function definition. This warning is enabled by
7151 default for C and C++ programs.
7152
7153 @item -Wmemset-elt-size
7154 @opindex Wmemset-elt-size
7155 @opindex Wno-memset-elt-size
7156 Warn for suspicious calls to the @code{memset} built-in function, if the
7157 first argument references an array, and the third argument is a number
7158 equal to the number of elements, but not equal to the size of the array
7159 in memory. This indicates that the user has omitted a multiplication by
7160 the element size. This warning is enabled by @option{-Wall}.
7161
7162 @item -Wmemset-transposed-args
7163 @opindex Wmemset-transposed-args
7164 @opindex Wno-memset-transposed-args
7165 Warn for suspicious calls to the @code{memset} built-in function where
7166 the second argument is not zero and the third argument is zero. For
7167 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7168 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7169 is only emitted if the third argument is a literal zero. Otherwise, if
7170 it is an expression that is folded to zero, or a cast of zero to some
7171 type, it is far less likely that the arguments have been mistakenly
7172 transposed and no warning is emitted. This warning is enabled
7173 by @option{-Wall}.
7174
7175 @item -Waddress
7176 @opindex Waddress
7177 @opindex Wno-address
7178 Warn about suspicious uses of memory addresses. These include using
7179 the address of a function in a conditional expression, such as
7180 @code{void func(void); if (func)}, and comparisons against the memory
7181 address of a string literal, such as @code{if (x == "abc")}. Such
7182 uses typically indicate a programmer error: the address of a function
7183 always evaluates to true, so their use in a conditional usually
7184 indicate that the programmer forgot the parentheses in a function
7185 call; and comparisons against string literals result in unspecified
7186 behavior and are not portable in C, so they usually indicate that the
7187 programmer intended to use @code{strcmp}. This warning is enabled by
7188 @option{-Wall}.
7189
7190 @item -Waddress-of-packed-member
7191 @opindex Waddress-of-packed-member
7192 @opindex Wno-address-of-packed-member
7193 Warn when the address of packed member of struct or union is taken,
7194 which usually results in an unaligned pointer value. This is
7195 enabled by default.
7196
7197 @item -Wlogical-op
7198 @opindex Wlogical-op
7199 @opindex Wno-logical-op
7200 Warn about suspicious uses of logical operators in expressions.
7201 This includes using logical operators in contexts where a
7202 bit-wise operator is likely to be expected. Also warns when
7203 the operands of a logical operator are the same:
7204 @smallexample
7205 extern int a;
7206 if (a < 0 && a < 0) @{ @dots{} @}
7207 @end smallexample
7208
7209 @item -Wlogical-not-parentheses
7210 @opindex Wlogical-not-parentheses
7211 @opindex Wno-logical-not-parentheses
7212 Warn about logical not used on the left hand side operand of a comparison.
7213 This option does not warn if the right operand is considered to be a boolean
7214 expression. Its purpose is to detect suspicious code like the following:
7215 @smallexample
7216 int a;
7217 @dots{}
7218 if (!a > 1) @{ @dots{} @}
7219 @end smallexample
7220
7221 It is possible to suppress the warning by wrapping the LHS into
7222 parentheses:
7223 @smallexample
7224 if ((!a) > 1) @{ @dots{} @}
7225 @end smallexample
7226
7227 This warning is enabled by @option{-Wall}.
7228
7229 @item -Waggregate-return
7230 @opindex Waggregate-return
7231 @opindex Wno-aggregate-return
7232 Warn if any functions that return structures or unions are defined or
7233 called. (In languages where you can return an array, this also elicits
7234 a warning.)
7235
7236 @item -Wno-aggressive-loop-optimizations
7237 @opindex Wno-aggressive-loop-optimizations
7238 @opindex Waggressive-loop-optimizations
7239 Warn if in a loop with constant number of iterations the compiler detects
7240 undefined behavior in some statement during one or more of the iterations.
7241
7242 @item -Wno-attributes
7243 @opindex Wno-attributes
7244 @opindex Wattributes
7245 Do not warn if an unexpected @code{__attribute__} is used, such as
7246 unrecognized attributes, function attributes applied to variables,
7247 etc. This does not stop errors for incorrect use of supported
7248 attributes.
7249
7250 @item -Wno-builtin-declaration-mismatch
7251 @opindex Wno-builtin-declaration-mismatch
7252 @opindex Wbuiltin-declaration-mismatch
7253 Warn if a built-in function is declared with an incompatible signature
7254 or as a non-function, or when a built-in function declared with a type
7255 that does not include a prototype is called with arguments whose promoted
7256 types do not match those expected by the function. When @option{-Wextra}
7257 is specified, also warn when a built-in function that takes arguments is
7258 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7259 warning is enabled by default. To avoid the warning include the appropriate
7260 header to bring the prototypes of built-in functions into scope.
7261
7262 For example, the call to @code{memset} below is diagnosed by the warning
7263 because the function expects a value of type @code{size_t} as its argument
7264 but the type of @code{32} is @code{int}. With @option{-Wextra},
7265 the declaration of the function is diagnosed as well.
7266 @smallexample
7267 extern void* memset ();
7268 void f (void *d)
7269 @{
7270 memset (d, '\0', 32);
7271 @}
7272 @end smallexample
7273
7274 @item -Wno-builtin-macro-redefined
7275 @opindex Wno-builtin-macro-redefined
7276 @opindex Wbuiltin-macro-redefined
7277 Do not warn if certain built-in macros are redefined. This suppresses
7278 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7279 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7280
7281 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7282 @opindex Wstrict-prototypes
7283 @opindex Wno-strict-prototypes
7284 Warn if a function is declared or defined without specifying the
7285 argument types. (An old-style function definition is permitted without
7286 a warning if preceded by a declaration that specifies the argument
7287 types.)
7288
7289 @item -Wold-style-declaration @r{(C and Objective-C only)}
7290 @opindex Wold-style-declaration
7291 @opindex Wno-old-style-declaration
7292 Warn for obsolescent usages, according to the C Standard, in a
7293 declaration. For example, warn if storage-class specifiers like
7294 @code{static} are not the first things in a declaration. This warning
7295 is also enabled by @option{-Wextra}.
7296
7297 @item -Wold-style-definition @r{(C and Objective-C only)}
7298 @opindex Wold-style-definition
7299 @opindex Wno-old-style-definition
7300 Warn if an old-style function definition is used. A warning is given
7301 even if there is a previous prototype.
7302
7303 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7304 @opindex Wmissing-parameter-type
7305 @opindex Wno-missing-parameter-type
7306 A function parameter is declared without a type specifier in K&R-style
7307 functions:
7308
7309 @smallexample
7310 void foo(bar) @{ @}
7311 @end smallexample
7312
7313 This warning is also enabled by @option{-Wextra}.
7314
7315 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7316 @opindex Wmissing-prototypes
7317 @opindex Wno-missing-prototypes
7318 Warn if a global function is defined without a previous prototype
7319 declaration. This warning is issued even if the definition itself
7320 provides a prototype. Use this option to detect global functions
7321 that do not have a matching prototype declaration in a header file.
7322 This option is not valid for C++ because all function declarations
7323 provide prototypes and a non-matching declaration declares an
7324 overload rather than conflict with an earlier declaration.
7325 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7326
7327 @item -Wmissing-declarations
7328 @opindex Wmissing-declarations
7329 @opindex Wno-missing-declarations
7330 Warn if a global function is defined without a previous declaration.
7331 Do so even if the definition itself provides a prototype.
7332 Use this option to detect global functions that are not declared in
7333 header files. In C, no warnings are issued for functions with previous
7334 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7335 missing prototypes. In C++, no warnings are issued for function templates,
7336 or for inline functions, or for functions in anonymous namespaces.
7337
7338 @item -Wmissing-field-initializers
7339 @opindex Wmissing-field-initializers
7340 @opindex Wno-missing-field-initializers
7341 @opindex W
7342 @opindex Wextra
7343 @opindex Wno-extra
7344 Warn if a structure's initializer has some fields missing. For
7345 example, the following code causes such a warning, because
7346 @code{x.h} is implicitly zero:
7347
7348 @smallexample
7349 struct s @{ int f, g, h; @};
7350 struct s x = @{ 3, 4 @};
7351 @end smallexample
7352
7353 This option does not warn about designated initializers, so the following
7354 modification does not trigger a warning:
7355
7356 @smallexample
7357 struct s @{ int f, g, h; @};
7358 struct s x = @{ .f = 3, .g = 4 @};
7359 @end smallexample
7360
7361 In C this option does not warn about the universal zero initializer
7362 @samp{@{ 0 @}}:
7363
7364 @smallexample
7365 struct s @{ int f, g, h; @};
7366 struct s x = @{ 0 @};
7367 @end smallexample
7368
7369 Likewise, in C++ this option does not warn about the empty @{ @}
7370 initializer, for example:
7371
7372 @smallexample
7373 struct s @{ int f, g, h; @};
7374 s x = @{ @};
7375 @end smallexample
7376
7377 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7378 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7379
7380 @item -Wno-multichar
7381 @opindex Wno-multichar
7382 @opindex Wmultichar
7383 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7384 Usually they indicate a typo in the user's code, as they have
7385 implementation-defined values, and should not be used in portable code.
7386
7387 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7388 @opindex Wnormalized=
7389 @opindex Wnormalized
7390 @opindex Wno-normalized
7391 @cindex NFC
7392 @cindex NFKC
7393 @cindex character set, input normalization
7394 In ISO C and ISO C++, two identifiers are different if they are
7395 different sequences of characters. However, sometimes when characters
7396 outside the basic ASCII character set are used, you can have two
7397 different character sequences that look the same. To avoid confusion,
7398 the ISO 10646 standard sets out some @dfn{normalization rules} which
7399 when applied ensure that two sequences that look the same are turned into
7400 the same sequence. GCC can warn you if you are using identifiers that
7401 have not been normalized; this option controls that warning.
7402
7403 There are four levels of warning supported by GCC@. The default is
7404 @option{-Wnormalized=nfc}, which warns about any identifier that is
7405 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7406 recommended form for most uses. It is equivalent to
7407 @option{-Wnormalized}.
7408
7409 Unfortunately, there are some characters allowed in identifiers by
7410 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7411 identifiers. That is, there's no way to use these symbols in portable
7412 ISO C or C++ and have all your identifiers in NFC@.
7413 @option{-Wnormalized=id} suppresses the warning for these characters.
7414 It is hoped that future versions of the standards involved will correct
7415 this, which is why this option is not the default.
7416
7417 You can switch the warning off for all characters by writing
7418 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7419 only do this if you are using some other normalization scheme (like
7420 ``D''), because otherwise you can easily create bugs that are
7421 literally impossible to see.
7422
7423 Some characters in ISO 10646 have distinct meanings but look identical
7424 in some fonts or display methodologies, especially once formatting has
7425 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7426 LETTER N'', displays just like a regular @code{n} that has been
7427 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7428 normalization scheme to convert all these into a standard form as
7429 well, and GCC warns if your code is not in NFKC if you use
7430 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7431 about every identifier that contains the letter O because it might be
7432 confused with the digit 0, and so is not the default, but may be
7433 useful as a local coding convention if the programming environment
7434 cannot be fixed to display these characters distinctly.
7435
7436 @item -Wno-attribute-warning
7437 @opindex Wno-attribute-warning
7438 @opindex Wattribute-warning
7439 Do not warn about usage of functions (@pxref{Function Attributes})
7440 declared with @code{warning} attribute. By default, this warning is
7441 enabled. @option{-Wno-attribute-warning} can be used to disable the
7442 warning or @option{-Wno-error=attribute-warning} can be used to
7443 disable the error when compiled with @option{-Werror} flag.
7444
7445 @item -Wno-deprecated
7446 @opindex Wno-deprecated
7447 @opindex Wdeprecated
7448 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7449
7450 @item -Wno-deprecated-declarations
7451 @opindex Wno-deprecated-declarations
7452 @opindex Wdeprecated-declarations
7453 Do not warn about uses of functions (@pxref{Function Attributes}),
7454 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7455 Attributes}) marked as deprecated by using the @code{deprecated}
7456 attribute.
7457
7458 @item -Wno-overflow
7459 @opindex Wno-overflow
7460 @opindex Woverflow
7461 Do not warn about compile-time overflow in constant expressions.
7462
7463 @item -Wno-odr
7464 @opindex Wno-odr
7465 @opindex Wodr
7466 Warn about One Definition Rule violations during link-time optimization.
7467 Enabled by default.
7468
7469 @item -Wopenmp-simd
7470 @opindex Wopenmp-simd
7471 @opindex Wno-openmp-simd
7472 Warn if the vectorizer cost model overrides the OpenMP
7473 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7474 option can be used to relax the cost model.
7475
7476 @item -Woverride-init @r{(C and Objective-C only)}
7477 @opindex Woverride-init
7478 @opindex Wno-override-init
7479 @opindex W
7480 @opindex Wextra
7481 @opindex Wno-extra
7482 Warn if an initialized field without side effects is overridden when
7483 using designated initializers (@pxref{Designated Inits, , Designated
7484 Initializers}).
7485
7486 This warning is included in @option{-Wextra}. To get other
7487 @option{-Wextra} warnings without this one, use @option{-Wextra
7488 -Wno-override-init}.
7489
7490 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7491 @opindex Woverride-init-side-effects
7492 @opindex Wno-override-init-side-effects
7493 Warn if an initialized field with side effects is overridden when
7494 using designated initializers (@pxref{Designated Inits, , Designated
7495 Initializers}). This warning is enabled by default.
7496
7497 @item -Wpacked
7498 @opindex Wpacked
7499 @opindex Wno-packed
7500 Warn if a structure is given the packed attribute, but the packed
7501 attribute has no effect on the layout or size of the structure.
7502 Such structures may be mis-aligned for little benefit. For
7503 instance, in this code, the variable @code{f.x} in @code{struct bar}
7504 is misaligned even though @code{struct bar} does not itself
7505 have the packed attribute:
7506
7507 @smallexample
7508 @group
7509 struct foo @{
7510 int x;
7511 char a, b, c, d;
7512 @} __attribute__((packed));
7513 struct bar @{
7514 char z;
7515 struct foo f;
7516 @};
7517 @end group
7518 @end smallexample
7519
7520 @item -Wpacked-bitfield-compat
7521 @opindex Wpacked-bitfield-compat
7522 @opindex Wno-packed-bitfield-compat
7523 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7524 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7525 the change can lead to differences in the structure layout. GCC
7526 informs you when the offset of such a field has changed in GCC 4.4.
7527 For example there is no longer a 4-bit padding between field @code{a}
7528 and @code{b} in this structure:
7529
7530 @smallexample
7531 struct foo
7532 @{
7533 char a:4;
7534 char b:8;
7535 @} __attribute__ ((packed));
7536 @end smallexample
7537
7538 This warning is enabled by default. Use
7539 @option{-Wno-packed-bitfield-compat} to disable this warning.
7540
7541 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7542 @opindex Wpacked-not-aligned
7543 @opindex Wno-packed-not-aligned
7544 Warn if a structure field with explicitly specified alignment in a
7545 packed struct or union is misaligned. For example, a warning will
7546 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7547 'struct S' is less than 8}, in this code:
7548
7549 @smallexample
7550 @group
7551 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7552 struct __attribute__ ((packed)) S @{
7553 struct S8 s8;
7554 @};
7555 @end group
7556 @end smallexample
7557
7558 This warning is enabled by @option{-Wall}.
7559
7560 @item -Wpadded
7561 @opindex Wpadded
7562 @opindex Wno-padded
7563 Warn if padding is included in a structure, either to align an element
7564 of the structure or to align the whole structure. Sometimes when this
7565 happens it is possible to rearrange the fields of the structure to
7566 reduce the padding and so make the structure smaller.
7567
7568 @item -Wredundant-decls
7569 @opindex Wredundant-decls
7570 @opindex Wno-redundant-decls
7571 Warn if anything is declared more than once in the same scope, even in
7572 cases where multiple declaration is valid and changes nothing.
7573
7574 @item -Wno-restrict
7575 @opindex Wrestrict
7576 @opindex Wno-restrict
7577 Warn when an object referenced by a @code{restrict}-qualified parameter
7578 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7579 argument, or when copies between such objects overlap. For example,
7580 the call to the @code{strcpy} function below attempts to truncate the string
7581 by replacing its initial characters with the last four. However, because
7582 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7583 the call is diagnosed.
7584
7585 @smallexample
7586 void foo (void)
7587 @{
7588 char a[] = "abcd1234";
7589 strcpy (a, a + 4);
7590 @dots{}
7591 @}
7592 @end smallexample
7593 The @option{-Wrestrict} option detects some instances of simple overlap
7594 even without optimization but works best at @option{-O2} and above. It
7595 is included in @option{-Wall}.
7596
7597 @item -Wnested-externs @r{(C and Objective-C only)}
7598 @opindex Wnested-externs
7599 @opindex Wno-nested-externs
7600 Warn if an @code{extern} declaration is encountered within a function.
7601
7602 @item -Wno-inherited-variadic-ctor
7603 @opindex Winherited-variadic-ctor
7604 @opindex Wno-inherited-variadic-ctor
7605 Suppress warnings about use of C++11 inheriting constructors when the
7606 base class inherited from has a C variadic constructor; the warning is
7607 on by default because the ellipsis is not inherited.
7608
7609 @item -Winline
7610 @opindex Winline
7611 @opindex Wno-inline
7612 Warn if a function that is declared as inline cannot be inlined.
7613 Even with this option, the compiler does not warn about failures to
7614 inline functions declared in system headers.
7615
7616 The compiler uses a variety of heuristics to determine whether or not
7617 to inline a function. For example, the compiler takes into account
7618 the size of the function being inlined and the amount of inlining
7619 that has already been done in the current function. Therefore,
7620 seemingly insignificant changes in the source program can cause the
7621 warnings produced by @option{-Winline} to appear or disappear.
7622
7623 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7624 @opindex Wno-invalid-offsetof
7625 @opindex Winvalid-offsetof
7626 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7627 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7628 to a non-standard-layout type is undefined. In existing C++ implementations,
7629 however, @code{offsetof} typically gives meaningful results.
7630 This flag is for users who are aware that they are
7631 writing nonportable code and who have deliberately chosen to ignore the
7632 warning about it.
7633
7634 The restrictions on @code{offsetof} may be relaxed in a future version
7635 of the C++ standard.
7636
7637 @item -Wint-in-bool-context
7638 @opindex Wint-in-bool-context
7639 @opindex Wno-int-in-bool-context
7640 Warn for suspicious use of integer values where boolean values are expected,
7641 such as conditional expressions (?:) using non-boolean integer constants in
7642 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7643 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7644 for all kinds of multiplications regardless of the data type.
7645 This warning is enabled by @option{-Wall}.
7646
7647 @item -Wno-int-to-pointer-cast
7648 @opindex Wno-int-to-pointer-cast
7649 @opindex Wint-to-pointer-cast
7650 Suppress warnings from casts to pointer type of an integer of a
7651 different size. In C++, casting to a pointer type of smaller size is
7652 an error. @option{Wint-to-pointer-cast} is enabled by default.
7653
7654
7655 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7656 @opindex Wno-pointer-to-int-cast
7657 @opindex Wpointer-to-int-cast
7658 Suppress warnings from casts from a pointer to an integer type of a
7659 different size.
7660
7661 @item -Winvalid-pch
7662 @opindex Winvalid-pch
7663 @opindex Wno-invalid-pch
7664 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7665 the search path but cannot be used.
7666
7667 @item -Wlong-long
7668 @opindex Wlong-long
7669 @opindex Wno-long-long
7670 Warn if @code{long long} type is used. This is enabled by either
7671 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7672 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7673
7674 @item -Wvariadic-macros
7675 @opindex Wvariadic-macros
7676 @opindex Wno-variadic-macros
7677 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7678 alternate syntax is used in ISO C99 mode. This is enabled by either
7679 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7680 messages, use @option{-Wno-variadic-macros}.
7681
7682 @item -Wvarargs
7683 @opindex Wvarargs
7684 @opindex Wno-varargs
7685 Warn upon questionable usage of the macros used to handle variable
7686 arguments like @code{va_start}. This is default. To inhibit the
7687 warning messages, use @option{-Wno-varargs}.
7688
7689 @item -Wvector-operation-performance
7690 @opindex Wvector-operation-performance
7691 @opindex Wno-vector-operation-performance
7692 Warn if vector operation is not implemented via SIMD capabilities of the
7693 architecture. Mainly useful for the performance tuning.
7694 Vector operation can be implemented @code{piecewise}, which means that the
7695 scalar operation is performed on every vector element;
7696 @code{in parallel}, which means that the vector operation is implemented
7697 using scalars of wider type, which normally is more performance efficient;
7698 and @code{as a single scalar}, which means that vector fits into a
7699 scalar type.
7700
7701 @item -Wno-virtual-move-assign
7702 @opindex Wvirtual-move-assign
7703 @opindex Wno-virtual-move-assign
7704 Suppress warnings about inheriting from a virtual base with a
7705 non-trivial C++11 move assignment operator. This is dangerous because
7706 if the virtual base is reachable along more than one path, it is
7707 moved multiple times, which can mean both objects end up in the
7708 moved-from state. If the move assignment operator is written to avoid
7709 moving from a moved-from object, this warning can be disabled.
7710
7711 @item -Wvla
7712 @opindex Wvla
7713 @opindex Wno-vla
7714 Warn if a variable-length array is used in the code.
7715 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7716 the variable-length array.
7717
7718 @item -Wvla-larger-than=@var{byte-size}
7719 @opindex Wvla-larger-than=
7720 @opindex Wno-vla-larger-than
7721 If this option is used, the compiler will warn for declarations of
7722 variable-length arrays whose size is either unbounded, or bounded
7723 by an argument that allows the array size to exceed @var{byte-size}
7724 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7725 works, but with variable-length arrays.
7726
7727 Note that GCC may optimize small variable-length arrays of a known
7728 value into plain arrays, so this warning may not get triggered for
7729 such arrays.
7730
7731 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7732 is typically only effective when @option{-ftree-vrp} is active (default
7733 for @option{-O2} and above).
7734
7735 See also @option{-Walloca-larger-than=@var{byte-size}}.
7736
7737 @item -Wno-vla-larger-than
7738 @opindex Wno-vla-larger-than
7739 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7740 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7741
7742 @item -Wvolatile-register-var
7743 @opindex Wvolatile-register-var
7744 @opindex Wno-volatile-register-var
7745 Warn if a register variable is declared volatile. The volatile
7746 modifier does not inhibit all optimizations that may eliminate reads
7747 and/or writes to register variables. This warning is enabled by
7748 @option{-Wall}.
7749
7750 @item -Wdisabled-optimization
7751 @opindex Wdisabled-optimization
7752 @opindex Wno-disabled-optimization
7753 Warn if a requested optimization pass is disabled. This warning does
7754 not generally indicate that there is anything wrong with your code; it
7755 merely indicates that GCC's optimizers are unable to handle the code
7756 effectively. Often, the problem is that your code is too big or too
7757 complex; GCC refuses to optimize programs when the optimization
7758 itself is likely to take inordinate amounts of time.
7759
7760 @item -Wpointer-sign @r{(C and Objective-C only)}
7761 @opindex Wpointer-sign
7762 @opindex Wno-pointer-sign
7763 Warn for pointer argument passing or assignment with different signedness.
7764 This option is only supported for C and Objective-C@. It is implied by
7765 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7766 @option{-Wno-pointer-sign}.
7767
7768 @item -Wstack-protector
7769 @opindex Wstack-protector
7770 @opindex Wno-stack-protector
7771 This option is only active when @option{-fstack-protector} is active. It
7772 warns about functions that are not protected against stack smashing.
7773
7774 @item -Woverlength-strings
7775 @opindex Woverlength-strings
7776 @opindex Wno-overlength-strings
7777 Warn about string constants that are longer than the ``minimum
7778 maximum'' length specified in the C standard. Modern compilers
7779 generally allow string constants that are much longer than the
7780 standard's minimum limit, but very portable programs should avoid
7781 using longer strings.
7782
7783 The limit applies @emph{after} string constant concatenation, and does
7784 not count the trailing NUL@. In C90, the limit was 509 characters; in
7785 C99, it was raised to 4095. C++98 does not specify a normative
7786 minimum maximum, so we do not diagnose overlength strings in C++@.
7787
7788 This option is implied by @option{-Wpedantic}, and can be disabled with
7789 @option{-Wno-overlength-strings}.
7790
7791 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7792 @opindex Wunsuffixed-float-constants
7793 @opindex Wno-unsuffixed-float-constants
7794
7795 Issue a warning for any floating constant that does not have
7796 a suffix. When used together with @option{-Wsystem-headers} it
7797 warns about such constants in system header files. This can be useful
7798 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7799 from the decimal floating-point extension to C99.
7800
7801 @item -Wno-designated-init @r{(C and Objective-C only)}
7802 Suppress warnings when a positional initializer is used to initialize
7803 a structure that has been marked with the @code{designated_init}
7804 attribute.
7805
7806 @item -Whsa
7807 Issue a warning when HSAIL cannot be emitted for the compiled function or
7808 OpenMP construct.
7809
7810 @end table
7811
7812 @node Debugging Options
7813 @section Options for Debugging Your Program
7814 @cindex options, debugging
7815 @cindex debugging information options
7816
7817 To tell GCC to emit extra information for use by a debugger, in almost
7818 all cases you need only to add @option{-g} to your other options.
7819
7820 GCC allows you to use @option{-g} with
7821 @option{-O}. The shortcuts taken by optimized code may occasionally
7822 be surprising: some variables you declared may not exist
7823 at all; flow of control may briefly move where you did not expect it;
7824 some statements may not be executed because they compute constant
7825 results or their values are already at hand; some statements may
7826 execute in different places because they have been moved out of loops.
7827 Nevertheless it is possible to debug optimized output. This makes
7828 it reasonable to use the optimizer for programs that might have bugs.
7829
7830 If you are not using some other optimization option, consider
7831 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7832 With no @option{-O} option at all, some compiler passes that collect
7833 information useful for debugging do not run at all, so that
7834 @option{-Og} may result in a better debugging experience.
7835
7836 @table @gcctabopt
7837 @item -g
7838 @opindex g
7839 Produce debugging information in the operating system's native format
7840 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7841 information.
7842
7843 On most systems that use stabs format, @option{-g} enables use of extra
7844 debugging information that only GDB can use; this extra information
7845 makes debugging work better in GDB but probably makes other debuggers
7846 crash or
7847 refuse to read the program. If you want to control for certain whether
7848 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7849 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7850
7851 @item -ggdb
7852 @opindex ggdb
7853 Produce debugging information for use by GDB@. This means to use the
7854 most expressive format available (DWARF, stabs, or the native format
7855 if neither of those are supported), including GDB extensions if at all
7856 possible.
7857
7858 @item -gdwarf
7859 @itemx -gdwarf-@var{version}
7860 @opindex gdwarf
7861 Produce debugging information in DWARF format (if that is supported).
7862 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7863 for most targets is 4. DWARF Version 5 is only experimental.
7864
7865 Note that with DWARF Version 2, some ports require and always
7866 use some non-conflicting DWARF 3 extensions in the unwind tables.
7867
7868 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7869 for maximum benefit.
7870
7871 GCC no longer supports DWARF Version 1, which is substantially
7872 different than Version 2 and later. For historical reasons, some
7873 other DWARF-related options such as
7874 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7875 in their names, but apply to all currently-supported versions of DWARF.
7876
7877 @item -gstabs
7878 @opindex gstabs
7879 Produce debugging information in stabs format (if that is supported),
7880 without GDB extensions. This is the format used by DBX on most BSD
7881 systems. On MIPS, Alpha and System V Release 4 systems this option
7882 produces stabs debugging output that is not understood by DBX@.
7883 On System V Release 4 systems this option requires the GNU assembler.
7884
7885 @item -gstabs+
7886 @opindex gstabs+
7887 Produce debugging information in stabs format (if that is supported),
7888 using GNU extensions understood only by the GNU debugger (GDB)@. The
7889 use of these extensions is likely to make other debuggers crash or
7890 refuse to read the program.
7891
7892 @item -gxcoff
7893 @opindex gxcoff
7894 Produce debugging information in XCOFF format (if that is supported).
7895 This is the format used by the DBX debugger on IBM RS/6000 systems.
7896
7897 @item -gxcoff+
7898 @opindex gxcoff+
7899 Produce debugging information in XCOFF format (if that is supported),
7900 using GNU extensions understood only by the GNU debugger (GDB)@. The
7901 use of these extensions is likely to make other debuggers crash or
7902 refuse to read the program, and may cause assemblers other than the GNU
7903 assembler (GAS) to fail with an error.
7904
7905 @item -gvms
7906 @opindex gvms
7907 Produce debugging information in Alpha/VMS debug format (if that is
7908 supported). This is the format used by DEBUG on Alpha/VMS systems.
7909
7910 @item -g@var{level}
7911 @itemx -ggdb@var{level}
7912 @itemx -gstabs@var{level}
7913 @itemx -gxcoff@var{level}
7914 @itemx -gvms@var{level}
7915 Request debugging information and also use @var{level} to specify how
7916 much information. The default level is 2.
7917
7918 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7919 @option{-g}.
7920
7921 Level 1 produces minimal information, enough for making backtraces in
7922 parts of the program that you don't plan to debug. This includes
7923 descriptions of functions and external variables, and line number
7924 tables, but no information about local variables.
7925
7926 Level 3 includes extra information, such as all the macro definitions
7927 present in the program. Some debuggers support macro expansion when
7928 you use @option{-g3}.
7929
7930 If you use multiple @option{-g} options, with or without level numbers,
7931 the last such option is the one that is effective.
7932
7933 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7934 confusion with @option{-gdwarf-@var{level}}.
7935 Instead use an additional @option{-g@var{level}} option to change the
7936 debug level for DWARF.
7937
7938 @item -fno-eliminate-unused-debug-symbols
7939 @opindex feliminate-unused-debug-symbols
7940 @opindex fno-eliminate-unused-debug-symbols
7941 By default, no debug information is produced for symbols that are not actually
7942 used. Use this option if you want debug information for all symbols.
7943
7944 @item -femit-class-debug-always
7945 @opindex femit-class-debug-always
7946 Instead of emitting debugging information for a C++ class in only one
7947 object file, emit it in all object files using the class. This option
7948 should be used only with debuggers that are unable to handle the way GCC
7949 normally emits debugging information for classes because using this
7950 option increases the size of debugging information by as much as a
7951 factor of two.
7952
7953 @item -fno-merge-debug-strings
7954 @opindex fmerge-debug-strings
7955 @opindex fno-merge-debug-strings
7956 Direct the linker to not merge together strings in the debugging
7957 information that are identical in different object files. Merging is
7958 not supported by all assemblers or linkers. Merging decreases the size
7959 of the debug information in the output file at the cost of increasing
7960 link processing time. Merging is enabled by default.
7961
7962 @item -fdebug-prefix-map=@var{old}=@var{new}
7963 @opindex fdebug-prefix-map
7964 When compiling files residing in directory @file{@var{old}}, record
7965 debugging information describing them as if the files resided in
7966 directory @file{@var{new}} instead. This can be used to replace a
7967 build-time path with an install-time path in the debug info. It can
7968 also be used to change an absolute path to a relative path by using
7969 @file{.} for @var{new}. This can give more reproducible builds, which
7970 are location independent, but may require an extra command to tell GDB
7971 where to find the source files. See also @option{-ffile-prefix-map}.
7972
7973 @item -fvar-tracking
7974 @opindex fvar-tracking
7975 Run variable tracking pass. It computes where variables are stored at each
7976 position in code. Better debugging information is then generated
7977 (if the debugging information format supports this information).
7978
7979 It is enabled by default when compiling with optimization (@option{-Os},
7980 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7981 the debug info format supports it.
7982
7983 @item -fvar-tracking-assignments
7984 @opindex fvar-tracking-assignments
7985 @opindex fno-var-tracking-assignments
7986 Annotate assignments to user variables early in the compilation and
7987 attempt to carry the annotations over throughout the compilation all the
7988 way to the end, in an attempt to improve debug information while
7989 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7990
7991 It can be enabled even if var-tracking is disabled, in which case
7992 annotations are created and maintained, but discarded at the end.
7993 By default, this flag is enabled together with @option{-fvar-tracking},
7994 except when selective scheduling is enabled.
7995
7996 @item -gsplit-dwarf
7997 @opindex gsplit-dwarf
7998 Separate as much DWARF debugging information as possible into a
7999 separate output file with the extension @file{.dwo}. This option allows
8000 the build system to avoid linking files with debug information. To
8001 be useful, this option requires a debugger capable of reading @file{.dwo}
8002 files.
8003
8004 @item -gdescribe-dies
8005 @opindex gdescribe-dies
8006 Add description attributes to some DWARF DIEs that have no name attribute,
8007 such as artificial variables, external references and call site
8008 parameter DIEs.
8009
8010 @item -gpubnames
8011 @opindex gpubnames
8012 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
8013
8014 @item -ggnu-pubnames
8015 @opindex ggnu-pubnames
8016 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
8017 suitable for conversion into a GDB@ index. This option is only useful
8018 with a linker that can produce GDB@ index version 7.
8019
8020 @item -fdebug-types-section
8021 @opindex fdebug-types-section
8022 @opindex fno-debug-types-section
8023 When using DWARF Version 4 or higher, type DIEs can be put into
8024 their own @code{.debug_types} section instead of making them part of the
8025 @code{.debug_info} section. It is more efficient to put them in a separate
8026 comdat section since the linker can then remove duplicates.
8027 But not all DWARF consumers support @code{.debug_types} sections yet
8028 and on some objects @code{.debug_types} produces larger instead of smaller
8029 debugging information.
8030
8031 @item -grecord-gcc-switches
8032 @itemx -gno-record-gcc-switches
8033 @opindex grecord-gcc-switches
8034 @opindex gno-record-gcc-switches
8035 This switch causes the command-line options used to invoke the
8036 compiler that may affect code generation to be appended to the
8037 DW_AT_producer attribute in DWARF debugging information. The options
8038 are concatenated with spaces separating them from each other and from
8039 the compiler version.
8040 It is enabled by default.
8041 See also @option{-frecord-gcc-switches} for another
8042 way of storing compiler options into the object file.
8043
8044 @item -gstrict-dwarf
8045 @opindex gstrict-dwarf
8046 Disallow using extensions of later DWARF standard version than selected
8047 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
8048 DWARF extensions from later standard versions is allowed.
8049
8050 @item -gno-strict-dwarf
8051 @opindex gno-strict-dwarf
8052 Allow using extensions of later DWARF standard version than selected with
8053 @option{-gdwarf-@var{version}}.
8054
8055 @item -gas-loc-support
8056 @opindex gas-loc-support
8057 Inform the compiler that the assembler supports @code{.loc} directives.
8058 It may then use them for the assembler to generate DWARF2+ line number
8059 tables.
8060
8061 This is generally desirable, because assembler-generated line-number
8062 tables are a lot more compact than those the compiler can generate
8063 itself.
8064
8065 This option will be enabled by default if, at GCC configure time, the
8066 assembler was found to support such directives.
8067
8068 @item -gno-as-loc-support
8069 @opindex gno-as-loc-support
8070 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8071 line number tables are to be generated.
8072
8073 @item -gas-locview-support
8074 @opindex gas-locview-support
8075 Inform the compiler that the assembler supports @code{view} assignment
8076 and reset assertion checking in @code{.loc} directives.
8077
8078 This option will be enabled by default if, at GCC configure time, the
8079 assembler was found to support them.
8080
8081 @item -gno-as-locview-support
8082 Force GCC to assign view numbers internally, if
8083 @option{-gvariable-location-views} are explicitly requested.
8084
8085 @item -gcolumn-info
8086 @itemx -gno-column-info
8087 @opindex gcolumn-info
8088 @opindex gno-column-info
8089 Emit location column information into DWARF debugging information, rather
8090 than just file and line.
8091 This option is enabled by default.
8092
8093 @item -gstatement-frontiers
8094 @itemx -gno-statement-frontiers
8095 @opindex gstatement-frontiers
8096 @opindex gno-statement-frontiers
8097 This option causes GCC to create markers in the internal representation
8098 at the beginning of statements, and to keep them roughly in place
8099 throughout compilation, using them to guide the output of @code{is_stmt}
8100 markers in the line number table. This is enabled by default when
8101 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8102 @dots{}), and outputting DWARF 2 debug information at the normal level.
8103
8104 @item -gvariable-location-views
8105 @itemx -gvariable-location-views=incompat5
8106 @itemx -gno-variable-location-views
8107 @opindex gvariable-location-views
8108 @opindex gvariable-location-views=incompat5
8109 @opindex gno-variable-location-views
8110 Augment variable location lists with progressive view numbers implied
8111 from the line number table. This enables debug information consumers to
8112 inspect state at certain points of the program, even if no instructions
8113 associated with the corresponding source locations are present at that
8114 point. If the assembler lacks support for view numbers in line number
8115 tables, this will cause the compiler to emit the line number table,
8116 which generally makes them somewhat less compact. The augmented line
8117 number tables and location lists are fully backward-compatible, so they
8118 can be consumed by debug information consumers that are not aware of
8119 these augmentations, but they won't derive any benefit from them either.
8120
8121 This is enabled by default when outputting DWARF 2 debug information at
8122 the normal level, as long as there is assembler support,
8123 @option{-fvar-tracking-assignments} is enabled and
8124 @option{-gstrict-dwarf} is not. When assembler support is not
8125 available, this may still be enabled, but it will force GCC to output
8126 internal line number tables, and if
8127 @option{-ginternal-reset-location-views} is not enabled, that will most
8128 certainly lead to silently mismatching location views.
8129
8130 There is a proposed representation for view numbers that is not backward
8131 compatible with the location list format introduced in DWARF 5, that can
8132 be enabled with @option{-gvariable-location-views=incompat5}. This
8133 option may be removed in the future, is only provided as a reference
8134 implementation of the proposed representation. Debug information
8135 consumers are not expected to support this extended format, and they
8136 would be rendered unable to decode location lists using it.
8137
8138 @item -ginternal-reset-location-views
8139 @itemx -gnointernal-reset-location-views
8140 @opindex ginternal-reset-location-views
8141 @opindex gno-internal-reset-location-views
8142 Attempt to determine location views that can be omitted from location
8143 view lists. This requires the compiler to have very accurate insn
8144 length estimates, which isn't always the case, and it may cause
8145 incorrect view lists to be generated silently when using an assembler
8146 that does not support location view lists. The GNU assembler will flag
8147 any such error as a @code{view number mismatch}. This is only enabled
8148 on ports that define a reliable estimation function.
8149
8150 @item -ginline-points
8151 @itemx -gno-inline-points
8152 @opindex ginline-points
8153 @opindex gno-inline-points
8154 Generate extended debug information for inlined functions. Location
8155 view tracking markers are inserted at inlined entry points, so that
8156 address and view numbers can be computed and output in debug
8157 information. This can be enabled independently of location views, in
8158 which case the view numbers won't be output, but it can only be enabled
8159 along with statement frontiers, and it is only enabled by default if
8160 location views are enabled.
8161
8162 @item -gz@r{[}=@var{type}@r{]}
8163 @opindex gz
8164 Produce compressed debug sections in DWARF format, if that is supported.
8165 If @var{type} is not given, the default type depends on the capabilities
8166 of the assembler and linker used. @var{type} may be one of
8167 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8168 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8169 compression in traditional GNU format). If the linker doesn't support
8170 writing compressed debug sections, the option is rejected. Otherwise,
8171 if the assembler does not support them, @option{-gz} is silently ignored
8172 when producing object files.
8173
8174 @item -femit-struct-debug-baseonly
8175 @opindex femit-struct-debug-baseonly
8176 Emit debug information for struct-like types
8177 only when the base name of the compilation source file
8178 matches the base name of file in which the struct is defined.
8179
8180 This option substantially reduces the size of debugging information,
8181 but at significant potential loss in type information to the debugger.
8182 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8183 See @option{-femit-struct-debug-detailed} for more detailed control.
8184
8185 This option works only with DWARF debug output.
8186
8187 @item -femit-struct-debug-reduced
8188 @opindex femit-struct-debug-reduced
8189 Emit debug information for struct-like types
8190 only when the base name of the compilation source file
8191 matches the base name of file in which the type is defined,
8192 unless the struct is a template or defined in a system header.
8193
8194 This option significantly reduces the size of debugging information,
8195 with some potential loss in type information to the debugger.
8196 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8197 See @option{-femit-struct-debug-detailed} for more detailed control.
8198
8199 This option works only with DWARF debug output.
8200
8201 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8202 @opindex femit-struct-debug-detailed
8203 Specify the struct-like types
8204 for which the compiler generates debug information.
8205 The intent is to reduce duplicate struct debug information
8206 between different object files within the same program.
8207
8208 This option is a detailed version of
8209 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8210 which serves for most needs.
8211
8212 A specification has the syntax@*
8213 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8214
8215 The optional first word limits the specification to
8216 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8217 A struct type is used directly when it is the type of a variable, member.
8218 Indirect uses arise through pointers to structs.
8219 That is, when use of an incomplete struct is valid, the use is indirect.
8220 An example is
8221 @samp{struct one direct; struct two * indirect;}.
8222
8223 The optional second word limits the specification to
8224 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8225 Generic structs are a bit complicated to explain.
8226 For C++, these are non-explicit specializations of template classes,
8227 or non-template classes within the above.
8228 Other programming languages have generics,
8229 but @option{-femit-struct-debug-detailed} does not yet implement them.
8230
8231 The third word specifies the source files for those
8232 structs for which the compiler should emit debug information.
8233 The values @samp{none} and @samp{any} have the normal meaning.
8234 The value @samp{base} means that
8235 the base of name of the file in which the type declaration appears
8236 must match the base of the name of the main compilation file.
8237 In practice, this means that when compiling @file{foo.c}, debug information
8238 is generated for types declared in that file and @file{foo.h},
8239 but not other header files.
8240 The value @samp{sys} means those types satisfying @samp{base}
8241 or declared in system or compiler headers.
8242
8243 You may need to experiment to determine the best settings for your application.
8244
8245 The default is @option{-femit-struct-debug-detailed=all}.
8246
8247 This option works only with DWARF debug output.
8248
8249 @item -fno-dwarf2-cfi-asm
8250 @opindex fdwarf2-cfi-asm
8251 @opindex fno-dwarf2-cfi-asm
8252 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8253 instead of using GAS @code{.cfi_*} directives.
8254
8255 @item -fno-eliminate-unused-debug-types
8256 @opindex feliminate-unused-debug-types
8257 @opindex fno-eliminate-unused-debug-types
8258 Normally, when producing DWARF output, GCC avoids producing debug symbol
8259 output for types that are nowhere used in the source file being compiled.
8260 Sometimes it is useful to have GCC emit debugging
8261 information for all types declared in a compilation
8262 unit, regardless of whether or not they are actually used
8263 in that compilation unit, for example
8264 if, in the debugger, you want to cast a value to a type that is
8265 not actually used in your program (but is declared). More often,
8266 however, this results in a significant amount of wasted space.
8267 @end table
8268
8269 @node Optimize Options
8270 @section Options That Control Optimization
8271 @cindex optimize options
8272 @cindex options, optimization
8273
8274 These options control various sorts of optimizations.
8275
8276 Without any optimization option, the compiler's goal is to reduce the
8277 cost of compilation and to make debugging produce the expected
8278 results. Statements are independent: if you stop the program with a
8279 breakpoint between statements, you can then assign a new value to any
8280 variable or change the program counter to any other statement in the
8281 function and get exactly the results you expect from the source
8282 code.
8283
8284 Turning on optimization flags makes the compiler attempt to improve
8285 the performance and/or code size at the expense of compilation time
8286 and possibly the ability to debug the program.
8287
8288 The compiler performs optimization based on the knowledge it has of the
8289 program. Compiling multiple files at once to a single output file mode allows
8290 the compiler to use information gained from all of the files when compiling
8291 each of them.
8292
8293 Not all optimizations are controlled directly by a flag. Only
8294 optimizations that have a flag are listed in this section.
8295
8296 Most optimizations are completely disabled at @option{-O0} or if an
8297 @option{-O} level is not set on the command line, even if individual
8298 optimization flags are specified. Similarly, @option{-Og} suppresses
8299 many optimization passes.
8300
8301 Depending on the target and how GCC was configured, a slightly different
8302 set of optimizations may be enabled at each @option{-O} level than
8303 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8304 to find out the exact set of optimizations that are enabled at each level.
8305 @xref{Overall Options}, for examples.
8306
8307 @table @gcctabopt
8308 @item -O
8309 @itemx -O1
8310 @opindex O
8311 @opindex O1
8312 Optimize. Optimizing compilation takes somewhat more time, and a lot
8313 more memory for a large function.
8314
8315 With @option{-O}, the compiler tries to reduce code size and execution
8316 time, without performing any optimizations that take a great deal of
8317 compilation time.
8318
8319 @c Note that in addition to the default_options_table list in opts.c,
8320 @c several optimization flags default to true but control optimization
8321 @c passes that are explicitly disabled at -O0.
8322
8323 @option{-O} turns on the following optimization flags:
8324
8325 @c Please keep the following list alphabetized.
8326 @gccoptlist{-fauto-inc-dec @gol
8327 -fbranch-count-reg @gol
8328 -fcombine-stack-adjustments @gol
8329 -fcompare-elim @gol
8330 -fcprop-registers @gol
8331 -fdce @gol
8332 -fdefer-pop @gol
8333 -fdelayed-branch @gol
8334 -fdse @gol
8335 -fforward-propagate @gol
8336 -fguess-branch-probability @gol
8337 -fif-conversion @gol
8338 -fif-conversion2 @gol
8339 -finline-functions-called-once @gol
8340 -fipa-profile @gol
8341 -fipa-pure-const @gol
8342 -fipa-reference @gol
8343 -fipa-reference-addressable @gol
8344 -fmerge-constants @gol
8345 -fmove-loop-invariants @gol
8346 -fomit-frame-pointer @gol
8347 -freorder-blocks @gol
8348 -fshrink-wrap @gol
8349 -fshrink-wrap-separate @gol
8350 -fsplit-wide-types @gol
8351 -fssa-backprop @gol
8352 -fssa-phiopt @gol
8353 -ftree-bit-ccp @gol
8354 -ftree-ccp @gol
8355 -ftree-ch @gol
8356 -ftree-coalesce-vars @gol
8357 -ftree-copy-prop @gol
8358 -ftree-dce @gol
8359 -ftree-dominator-opts @gol
8360 -ftree-dse @gol
8361 -ftree-forwprop @gol
8362 -ftree-fre @gol
8363 -ftree-phiprop @gol
8364 -ftree-pta @gol
8365 -ftree-scev-cprop @gol
8366 -ftree-sink @gol
8367 -ftree-slsr @gol
8368 -ftree-sra @gol
8369 -ftree-ter @gol
8370 -funit-at-a-time}
8371
8372 @item -O2
8373 @opindex O2
8374 Optimize even more. GCC performs nearly all supported optimizations
8375 that do not involve a space-speed tradeoff.
8376 As compared to @option{-O}, this option increases both compilation time
8377 and the performance of the generated code.
8378
8379 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8380 also turns on the following optimization flags:
8381
8382 @c Please keep the following list alphabetized!
8383 @gccoptlist{-falign-functions -falign-jumps @gol
8384 -falign-labels -falign-loops @gol
8385 -fcaller-saves @gol
8386 -fcode-hoisting @gol
8387 -fcrossjumping @gol
8388 -fcse-follow-jumps -fcse-skip-blocks @gol
8389 -fdelete-null-pointer-checks @gol
8390 -fdevirtualize -fdevirtualize-speculatively @gol
8391 -fexpensive-optimizations @gol
8392 -ffinite-loops @gol
8393 -fgcse -fgcse-lm @gol
8394 -fhoist-adjacent-loads @gol
8395 -finline-functions @gol
8396 -finline-small-functions @gol
8397 -findirect-inlining @gol
8398 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8399 -fipa-ra -fipa-sra -fipa-vrp @gol
8400 -fisolate-erroneous-paths-dereference @gol
8401 -flra-remat @gol
8402 -foptimize-sibling-calls @gol
8403 -foptimize-strlen @gol
8404 -fpartial-inlining @gol
8405 -fpeephole2 @gol
8406 -freorder-blocks-algorithm=stc @gol
8407 -freorder-blocks-and-partition -freorder-functions @gol
8408 -frerun-cse-after-loop @gol
8409 -fschedule-insns -fschedule-insns2 @gol
8410 -fsched-interblock -fsched-spec @gol
8411 -fstore-merging @gol
8412 -fstrict-aliasing @gol
8413 -fthread-jumps @gol
8414 -ftree-builtin-call-dce @gol
8415 -ftree-pre @gol
8416 -ftree-switch-conversion -ftree-tail-merge @gol
8417 -ftree-vrp}
8418
8419 Please note the warning under @option{-fgcse} about
8420 invoking @option{-O2} on programs that use computed gotos.
8421
8422 @item -O3
8423 @opindex O3
8424 Optimize yet more. @option{-O3} turns on all optimizations specified
8425 by @option{-O2} and also turns on the following optimization flags:
8426
8427 @c Please keep the following list alphabetized!
8428 @gccoptlist{-fgcse-after-reload @gol
8429 -fipa-cp-clone
8430 -floop-interchange @gol
8431 -floop-unroll-and-jam @gol
8432 -fpeel-loops @gol
8433 -fpredictive-commoning @gol
8434 -fsplit-paths @gol
8435 -ftree-loop-distribute-patterns @gol
8436 -ftree-loop-distribution @gol
8437 -ftree-loop-vectorize @gol
8438 -ftree-partial-pre @gol
8439 -ftree-slp-vectorize @gol
8440 -funswitch-loops @gol
8441 -fvect-cost-model @gol
8442 -fversion-loops-for-strides}
8443
8444 @item -O0
8445 @opindex O0
8446 Reduce compilation time and make debugging produce the expected
8447 results. This is the default.
8448
8449 @item -Os
8450 @opindex Os
8451 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8452 except those that often increase code size:
8453
8454 @gccoptlist{-falign-functions -falign-jumps @gol
8455 -falign-labels -falign-loops @gol
8456 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8457
8458 It also enables @option{-finline-functions}, causes the compiler to tune for
8459 code size rather than execution speed, and performs further optimizations
8460 designed to reduce code size.
8461
8462 @item -Ofast
8463 @opindex Ofast
8464 Disregard strict standards compliance. @option{-Ofast} enables all
8465 @option{-O3} optimizations. It also enables optimizations that are not
8466 valid for all standard-compliant programs.
8467 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
8468 and the Fortran-specific @option{-fstack-arrays}, unless
8469 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
8470
8471 @item -Og
8472 @opindex Og
8473 Optimize debugging experience. @option{-Og} should be the optimization
8474 level of choice for the standard edit-compile-debug cycle, offering
8475 a reasonable level of optimization while maintaining fast compilation
8476 and a good debugging experience. It is a better choice than @option{-O0}
8477 for producing debuggable code because some compiler passes
8478 that collect debug information are disabled at @option{-O0}.
8479
8480 Like @option{-O0}, @option{-Og} completely disables a number of
8481 optimization passes so that individual options controlling them have
8482 no effect. Otherwise @option{-Og} enables all @option{-O1}
8483 optimization flags except for those that may interfere with debugging:
8484
8485 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8486 -fdse -fif-conversion -fif-conversion2 @gol
8487 -finline-functions-called-once @gol
8488 -fmove-loop-invariants -fssa-phiopt @gol
8489 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
8490
8491 @end table
8492
8493 If you use multiple @option{-O} options, with or without level numbers,
8494 the last such option is the one that is effective.
8495
8496 Options of the form @option{-f@var{flag}} specify machine-independent
8497 flags. Most flags have both positive and negative forms; the negative
8498 form of @option{-ffoo} is @option{-fno-foo}. In the table
8499 below, only one of the forms is listed---the one you typically
8500 use. You can figure out the other form by either removing @samp{no-}
8501 or adding it.
8502
8503 The following options control specific optimizations. They are either
8504 activated by @option{-O} options or are related to ones that are. You
8505 can use the following flags in the rare cases when ``fine-tuning'' of
8506 optimizations to be performed is desired.
8507
8508 @table @gcctabopt
8509 @item -fno-defer-pop
8510 @opindex fno-defer-pop
8511 @opindex fdefer-pop
8512 For machines that must pop arguments after a function call, always pop
8513 the arguments as soon as each function returns.
8514 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8515 this allows the compiler to let arguments accumulate on the stack for several
8516 function calls and pop them all at once.
8517
8518 @item -fforward-propagate
8519 @opindex fforward-propagate
8520 Perform a forward propagation pass on RTL@. The pass tries to combine two
8521 instructions and checks if the result can be simplified. If loop unrolling
8522 is active, two passes are performed and the second is scheduled after
8523 loop unrolling.
8524
8525 This option is enabled by default at optimization levels @option{-O},
8526 @option{-O2}, @option{-O3}, @option{-Os}.
8527
8528 @item -ffp-contract=@var{style}
8529 @opindex ffp-contract
8530 @option{-ffp-contract=off} disables floating-point expression contraction.
8531 @option{-ffp-contract=fast} enables floating-point expression contraction
8532 such as forming of fused multiply-add operations if the target has
8533 native support for them.
8534 @option{-ffp-contract=on} enables floating-point expression contraction
8535 if allowed by the language standard. This is currently not implemented
8536 and treated equal to @option{-ffp-contract=off}.
8537
8538 The default is @option{-ffp-contract=fast}.
8539
8540 @item -fomit-frame-pointer
8541 @opindex fomit-frame-pointer
8542 Omit the frame pointer in functions that don't need one. This avoids the
8543 instructions to save, set up and restore the frame pointer; on many targets
8544 it also makes an extra register available.
8545
8546 On some targets this flag has no effect because the standard calling sequence
8547 always uses a frame pointer, so it cannot be omitted.
8548
8549 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8550 is used in all functions. Several targets always omit the frame pointer in
8551 leaf functions.
8552
8553 Enabled by default at @option{-O} and higher.
8554
8555 @item -foptimize-sibling-calls
8556 @opindex foptimize-sibling-calls
8557 Optimize sibling and tail recursive calls.
8558
8559 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8560
8561 @item -foptimize-strlen
8562 @opindex foptimize-strlen
8563 Optimize various standard C string functions (e.g.@: @code{strlen},
8564 @code{strchr} or @code{strcpy}) and
8565 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8566
8567 Enabled at levels @option{-O2}, @option{-O3}.
8568
8569 @item -fno-inline
8570 @opindex fno-inline
8571 @opindex finline
8572 Do not expand any functions inline apart from those marked with
8573 the @code{always_inline} attribute. This is the default when not
8574 optimizing.
8575
8576 Single functions can be exempted from inlining by marking them
8577 with the @code{noinline} attribute.
8578
8579 @item -finline-small-functions
8580 @opindex finline-small-functions
8581 Integrate functions into their callers when their body is smaller than expected
8582 function call code (so overall size of program gets smaller). The compiler
8583 heuristically decides which functions are simple enough to be worth integrating
8584 in this way. This inlining applies to all functions, even those not declared
8585 inline.
8586
8587 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8588
8589 @item -findirect-inlining
8590 @opindex findirect-inlining
8591 Inline also indirect calls that are discovered to be known at compile
8592 time thanks to previous inlining. This option has any effect only
8593 when inlining itself is turned on by the @option{-finline-functions}
8594 or @option{-finline-small-functions} options.
8595
8596 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8597
8598 @item -finline-functions
8599 @opindex finline-functions
8600 Consider all functions for inlining, even if they are not declared inline.
8601 The compiler heuristically decides which functions are worth integrating
8602 in this way.
8603
8604 If all calls to a given function are integrated, and the function is
8605 declared @code{static}, then the function is normally not output as
8606 assembler code in its own right.
8607
8608 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
8609 by @option{-fprofile-use} and @option{-fauto-profile}.
8610
8611 @item -finline-functions-called-once
8612 @opindex finline-functions-called-once
8613 Consider all @code{static} functions called once for inlining into their
8614 caller even if they are not marked @code{inline}. If a call to a given
8615 function is integrated, then the function is not output as assembler code
8616 in its own right.
8617
8618 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8619 but not @option{-Og}.
8620
8621 @item -fearly-inlining
8622 @opindex fearly-inlining
8623 Inline functions marked by @code{always_inline} and functions whose body seems
8624 smaller than the function call overhead early before doing
8625 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8626 makes profiling significantly cheaper and usually inlining faster on programs
8627 having large chains of nested wrapper functions.
8628
8629 Enabled by default.
8630
8631 @item -fipa-sra
8632 @opindex fipa-sra
8633 Perform interprocedural scalar replacement of aggregates, removal of
8634 unused parameters and replacement of parameters passed by reference
8635 by parameters passed by value.
8636
8637 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8638
8639 @item -finline-limit=@var{n}
8640 @opindex finline-limit
8641 By default, GCC limits the size of functions that can be inlined. This flag
8642 allows coarse control of this limit. @var{n} is the size of functions that
8643 can be inlined in number of pseudo instructions.
8644
8645 Inlining is actually controlled by a number of parameters, which may be
8646 specified individually by using @option{--param @var{name}=@var{value}}.
8647 The @option{-finline-limit=@var{n}} option sets some of these parameters
8648 as follows:
8649
8650 @table @gcctabopt
8651 @item max-inline-insns-single
8652 is set to @var{n}/2.
8653 @item max-inline-insns-auto
8654 is set to @var{n}/2.
8655 @end table
8656
8657 See below for a documentation of the individual
8658 parameters controlling inlining and for the defaults of these parameters.
8659
8660 @emph{Note:} there may be no value to @option{-finline-limit} that results
8661 in default behavior.
8662
8663 @emph{Note:} pseudo instruction represents, in this particular context, an
8664 abstract measurement of function's size. In no way does it represent a count
8665 of assembly instructions and as such its exact meaning might change from one
8666 release to an another.
8667
8668 @item -fno-keep-inline-dllexport
8669 @opindex fno-keep-inline-dllexport
8670 @opindex fkeep-inline-dllexport
8671 This is a more fine-grained version of @option{-fkeep-inline-functions},
8672 which applies only to functions that are declared using the @code{dllexport}
8673 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8674 Functions}.
8675
8676 @item -fkeep-inline-functions
8677 @opindex fkeep-inline-functions
8678 In C, emit @code{static} functions that are declared @code{inline}
8679 into the object file, even if the function has been inlined into all
8680 of its callers. This switch does not affect functions using the
8681 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8682 inline functions into the object file.
8683
8684 @item -fkeep-static-functions
8685 @opindex fkeep-static-functions
8686 Emit @code{static} functions into the object file, even if the function
8687 is never used.
8688
8689 @item -fkeep-static-consts
8690 @opindex fkeep-static-consts
8691 Emit variables declared @code{static const} when optimization isn't turned
8692 on, even if the variables aren't referenced.
8693
8694 GCC enables this option by default. If you want to force the compiler to
8695 check if a variable is referenced, regardless of whether or not
8696 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8697
8698 @item -fmerge-constants
8699 @opindex fmerge-constants
8700 Attempt to merge identical constants (string constants and floating-point
8701 constants) across compilation units.
8702
8703 This option is the default for optimized compilation if the assembler and
8704 linker support it. Use @option{-fno-merge-constants} to inhibit this
8705 behavior.
8706
8707 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8708
8709 @item -fmerge-all-constants
8710 @opindex fmerge-all-constants
8711 Attempt to merge identical constants and identical variables.
8712
8713 This option implies @option{-fmerge-constants}. In addition to
8714 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8715 arrays or initialized constant variables with integral or floating-point
8716 types. Languages like C or C++ require each variable, including multiple
8717 instances of the same variable in recursive calls, to have distinct locations,
8718 so using this option results in non-conforming
8719 behavior.
8720
8721 @item -fmodulo-sched
8722 @opindex fmodulo-sched
8723 Perform swing modulo scheduling immediately before the first scheduling
8724 pass. This pass looks at innermost loops and reorders their
8725 instructions by overlapping different iterations.
8726
8727 @item -fmodulo-sched-allow-regmoves
8728 @opindex fmodulo-sched-allow-regmoves
8729 Perform more aggressive SMS-based modulo scheduling with register moves
8730 allowed. By setting this flag certain anti-dependences edges are
8731 deleted, which triggers the generation of reg-moves based on the
8732 life-range analysis. This option is effective only with
8733 @option{-fmodulo-sched} enabled.
8734
8735 @item -fno-branch-count-reg
8736 @opindex fno-branch-count-reg
8737 @opindex fbranch-count-reg
8738 Disable the optimization pass that scans for opportunities to use
8739 ``decrement and branch'' instructions on a count register instead of
8740 instruction sequences that decrement a register, compare it against zero, and
8741 then branch based upon the result. This option is only meaningful on
8742 architectures that support such instructions, which include x86, PowerPC,
8743 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8744 doesn't remove the decrement and branch instructions from the generated
8745 instruction stream introduced by other optimization passes.
8746
8747 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8748 except for @option{-Og}.
8749
8750 @item -fno-function-cse
8751 @opindex fno-function-cse
8752 @opindex ffunction-cse
8753 Do not put function addresses in registers; make each instruction that
8754 calls a constant function contain the function's address explicitly.
8755
8756 This option results in less efficient code, but some strange hacks
8757 that alter the assembler output may be confused by the optimizations
8758 performed when this option is not used.
8759
8760 The default is @option{-ffunction-cse}
8761
8762 @item -fno-zero-initialized-in-bss
8763 @opindex fno-zero-initialized-in-bss
8764 @opindex fzero-initialized-in-bss
8765 If the target supports a BSS section, GCC by default puts variables that
8766 are initialized to zero into BSS@. This can save space in the resulting
8767 code.
8768
8769 This option turns off this behavior because some programs explicitly
8770 rely on variables going to the data section---e.g., so that the
8771 resulting executable can find the beginning of that section and/or make
8772 assumptions based on that.
8773
8774 The default is @option{-fzero-initialized-in-bss}.
8775
8776 @item -fthread-jumps
8777 @opindex fthread-jumps
8778 Perform optimizations that check to see if a jump branches to a
8779 location where another comparison subsumed by the first is found. If
8780 so, the first branch is redirected to either the destination of the
8781 second branch or a point immediately following it, depending on whether
8782 the condition is known to be true or false.
8783
8784 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8785
8786 @item -fsplit-wide-types
8787 @opindex fsplit-wide-types
8788 When using a type that occupies multiple registers, such as @code{long
8789 long} on a 32-bit system, split the registers apart and allocate them
8790 independently. This normally generates better code for those types,
8791 but may make debugging more difficult.
8792
8793 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8794 @option{-Os}.
8795
8796 @item -fsplit-wide-types-early
8797 @opindex fsplit-wide-types-early
8798 Fully split wide types early, instead of very late.
8799 This option has no effect unless @option{-fsplit-wide-types} is turned on.
8800
8801 This is the default on some targets.
8802
8803 @item -fcse-follow-jumps
8804 @opindex fcse-follow-jumps
8805 In common subexpression elimination (CSE), scan through jump instructions
8806 when the target of the jump is not reached by any other path. For
8807 example, when CSE encounters an @code{if} statement with an
8808 @code{else} clause, CSE follows the jump when the condition
8809 tested is false.
8810
8811 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8812
8813 @item -fcse-skip-blocks
8814 @opindex fcse-skip-blocks
8815 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8816 follow jumps that conditionally skip over blocks. When CSE
8817 encounters a simple @code{if} statement with no else clause,
8818 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8819 body of the @code{if}.
8820
8821 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8822
8823 @item -frerun-cse-after-loop
8824 @opindex frerun-cse-after-loop
8825 Re-run common subexpression elimination after loop optimizations are
8826 performed.
8827
8828 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8829
8830 @item -fgcse
8831 @opindex fgcse
8832 Perform a global common subexpression elimination pass.
8833 This pass also performs global constant and copy propagation.
8834
8835 @emph{Note:} When compiling a program using computed gotos, a GCC
8836 extension, you may get better run-time performance if you disable
8837 the global common subexpression elimination pass by adding
8838 @option{-fno-gcse} to the command line.
8839
8840 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8841
8842 @item -fgcse-lm
8843 @opindex fgcse-lm
8844 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8845 attempts to move loads that are only killed by stores into themselves. This
8846 allows a loop containing a load/store sequence to be changed to a load outside
8847 the loop, and a copy/store within the loop.
8848
8849 Enabled by default when @option{-fgcse} is enabled.
8850
8851 @item -fgcse-sm
8852 @opindex fgcse-sm
8853 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8854 global common subexpression elimination. This pass attempts to move
8855 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8856 loops containing a load/store sequence can be changed to a load before
8857 the loop and a store after the loop.
8858
8859 Not enabled at any optimization level.
8860
8861 @item -fgcse-las
8862 @opindex fgcse-las
8863 When @option{-fgcse-las} is enabled, the global common subexpression
8864 elimination pass eliminates redundant loads that come after stores to the
8865 same memory location (both partial and full redundancies).
8866
8867 Not enabled at any optimization level.
8868
8869 @item -fgcse-after-reload
8870 @opindex fgcse-after-reload
8871 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8872 pass is performed after reload. The purpose of this pass is to clean up
8873 redundant spilling.
8874
8875 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8876
8877 @item -faggressive-loop-optimizations
8878 @opindex faggressive-loop-optimizations
8879 This option tells the loop optimizer to use language constraints to
8880 derive bounds for the number of iterations of a loop. This assumes that
8881 loop code does not invoke undefined behavior by for example causing signed
8882 integer overflows or out-of-bound array accesses. The bounds for the
8883 number of iterations of a loop are used to guide loop unrolling and peeling
8884 and loop exit test optimizations.
8885 This option is enabled by default.
8886
8887 @item -funconstrained-commons
8888 @opindex funconstrained-commons
8889 This option tells the compiler that variables declared in common blocks
8890 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8891 prevents certain optimizations that depend on knowing the array bounds.
8892
8893 @item -fcrossjumping
8894 @opindex fcrossjumping
8895 Perform cross-jumping transformation.
8896 This transformation unifies equivalent code and saves code size. The
8897 resulting code may or may not perform better than without cross-jumping.
8898
8899 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8900
8901 @item -fauto-inc-dec
8902 @opindex fauto-inc-dec
8903 Combine increments or decrements of addresses with memory accesses.
8904 This pass is always skipped on architectures that do not have
8905 instructions to support this. Enabled by default at @option{-O} and
8906 higher on architectures that support this.
8907
8908 @item -fdce
8909 @opindex fdce
8910 Perform dead code elimination (DCE) on RTL@.
8911 Enabled by default at @option{-O} and higher.
8912
8913 @item -fdse
8914 @opindex fdse
8915 Perform dead store elimination (DSE) on RTL@.
8916 Enabled by default at @option{-O} and higher.
8917
8918 @item -fif-conversion
8919 @opindex fif-conversion
8920 Attempt to transform conditional jumps into branch-less equivalents. This
8921 includes use of conditional moves, min, max, set flags and abs instructions, and
8922 some tricks doable by standard arithmetics. The use of conditional execution
8923 on chips where it is available is controlled by @option{-fif-conversion2}.
8924
8925 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8926 not with @option{-Og}.
8927
8928 @item -fif-conversion2
8929 @opindex fif-conversion2
8930 Use conditional execution (where available) to transform conditional jumps into
8931 branch-less equivalents.
8932
8933 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8934 not with @option{-Og}.
8935
8936 @item -fdeclone-ctor-dtor
8937 @opindex fdeclone-ctor-dtor
8938 The C++ ABI requires multiple entry points for constructors and
8939 destructors: one for a base subobject, one for a complete object, and
8940 one for a virtual destructor that calls operator delete afterwards.
8941 For a hierarchy with virtual bases, the base and complete variants are
8942 clones, which means two copies of the function. With this option, the
8943 base and complete variants are changed to be thunks that call a common
8944 implementation.
8945
8946 Enabled by @option{-Os}.
8947
8948 @item -fdelete-null-pointer-checks
8949 @opindex fdelete-null-pointer-checks
8950 Assume that programs cannot safely dereference null pointers, and that
8951 no code or data element resides at address zero.
8952 This option enables simple constant
8953 folding optimizations at all optimization levels. In addition, other
8954 optimization passes in GCC use this flag to control global dataflow
8955 analyses that eliminate useless checks for null pointers; these assume
8956 that a memory access to address zero always results in a trap, so
8957 that if a pointer is checked after it has already been dereferenced,
8958 it cannot be null.
8959
8960 Note however that in some environments this assumption is not true.
8961 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8962 for programs that depend on that behavior.
8963
8964 This option is enabled by default on most targets. On Nios II ELF, it
8965 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8966
8967 Passes that use the dataflow information
8968 are enabled independently at different optimization levels.
8969
8970 @item -fdevirtualize
8971 @opindex fdevirtualize
8972 Attempt to convert calls to virtual functions to direct calls. This
8973 is done both within a procedure and interprocedurally as part of
8974 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8975 propagation (@option{-fipa-cp}).
8976 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8977
8978 @item -fdevirtualize-speculatively
8979 @opindex fdevirtualize-speculatively
8980 Attempt to convert calls to virtual functions to speculative direct calls.
8981 Based on the analysis of the type inheritance graph, determine for a given call
8982 the set of likely targets. If the set is small, preferably of size 1, change
8983 the call into a conditional deciding between direct and indirect calls. The
8984 speculative calls enable more optimizations, such as inlining. When they seem
8985 useless after further optimization, they are converted back into original form.
8986
8987 @item -fdevirtualize-at-ltrans
8988 @opindex fdevirtualize-at-ltrans
8989 Stream extra information needed for aggressive devirtualization when running
8990 the link-time optimizer in local transformation mode.
8991 This option enables more devirtualization but
8992 significantly increases the size of streamed data. For this reason it is
8993 disabled by default.
8994
8995 @item -fexpensive-optimizations
8996 @opindex fexpensive-optimizations
8997 Perform a number of minor optimizations that are relatively expensive.
8998
8999 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9000
9001 @item -free
9002 @opindex free
9003 Attempt to remove redundant extension instructions. This is especially
9004 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
9005 registers after writing to their lower 32-bit half.
9006
9007 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
9008 @option{-O3}, @option{-Os}.
9009
9010 @item -fno-lifetime-dse
9011 @opindex fno-lifetime-dse
9012 @opindex flifetime-dse
9013 In C++ the value of an object is only affected by changes within its
9014 lifetime: when the constructor begins, the object has an indeterminate
9015 value, and any changes during the lifetime of the object are dead when
9016 the object is destroyed. Normally dead store elimination will take
9017 advantage of this; if your code relies on the value of the object
9018 storage persisting beyond the lifetime of the object, you can use this
9019 flag to disable this optimization. To preserve stores before the
9020 constructor starts (e.g.@: because your operator new clears the object
9021 storage) but still treat the object as dead after the destructor you,
9022 can use @option{-flifetime-dse=1}. The default behavior can be
9023 explicitly selected with @option{-flifetime-dse=2}.
9024 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
9025
9026 @item -flive-range-shrinkage
9027 @opindex flive-range-shrinkage
9028 Attempt to decrease register pressure through register live range
9029 shrinkage. This is helpful for fast processors with small or moderate
9030 size register sets.
9031
9032 @item -fira-algorithm=@var{algorithm}
9033 @opindex fira-algorithm
9034 Use the specified coloring algorithm for the integrated register
9035 allocator. The @var{algorithm} argument can be @samp{priority}, which
9036 specifies Chow's priority coloring, or @samp{CB}, which specifies
9037 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
9038 for all architectures, but for those targets that do support it, it is
9039 the default because it generates better code.
9040
9041 @item -fira-region=@var{region}
9042 @opindex fira-region
9043 Use specified regions for the integrated register allocator. The
9044 @var{region} argument should be one of the following:
9045
9046 @table @samp
9047
9048 @item all
9049 Use all loops as register allocation regions.
9050 This can give the best results for machines with a small and/or
9051 irregular register set.
9052
9053 @item mixed
9054 Use all loops except for loops with small register pressure
9055 as the regions. This value usually gives
9056 the best results in most cases and for most architectures,
9057 and is enabled by default when compiling with optimization for speed
9058 (@option{-O}, @option{-O2}, @dots{}).
9059
9060 @item one
9061 Use all functions as a single region.
9062 This typically results in the smallest code size, and is enabled by default for
9063 @option{-Os} or @option{-O0}.
9064
9065 @end table
9066
9067 @item -fira-hoist-pressure
9068 @opindex fira-hoist-pressure
9069 Use IRA to evaluate register pressure in the code hoisting pass for
9070 decisions to hoist expressions. This option usually results in smaller
9071 code, but it can slow the compiler down.
9072
9073 This option is enabled at level @option{-Os} for all targets.
9074
9075 @item -fira-loop-pressure
9076 @opindex fira-loop-pressure
9077 Use IRA to evaluate register pressure in loops for decisions to move
9078 loop invariants. This option usually results in generation
9079 of faster and smaller code on machines with large register files (>= 32
9080 registers), but it can slow the compiler down.
9081
9082 This option is enabled at level @option{-O3} for some targets.
9083
9084 @item -fno-ira-share-save-slots
9085 @opindex fno-ira-share-save-slots
9086 @opindex fira-share-save-slots
9087 Disable sharing of stack slots used for saving call-used hard
9088 registers living through a call. Each hard register gets a
9089 separate stack slot, and as a result function stack frames are
9090 larger.
9091
9092 @item -fno-ira-share-spill-slots
9093 @opindex fno-ira-share-spill-slots
9094 @opindex fira-share-spill-slots
9095 Disable sharing of stack slots allocated for pseudo-registers. Each
9096 pseudo-register that does not get a hard register gets a separate
9097 stack slot, and as a result function stack frames are larger.
9098
9099 @item -flra-remat
9100 @opindex flra-remat
9101 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9102 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9103 values if it is profitable.
9104
9105 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9106
9107 @item -fdelayed-branch
9108 @opindex fdelayed-branch
9109 If supported for the target machine, attempt to reorder instructions
9110 to exploit instruction slots available after delayed branch
9111 instructions.
9112
9113 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9114 but not at @option{-Og}.
9115
9116 @item -fschedule-insns
9117 @opindex fschedule-insns
9118 If supported for the target machine, attempt to reorder instructions to
9119 eliminate execution stalls due to required data being unavailable. This
9120 helps machines that have slow floating point or memory load instructions
9121 by allowing other instructions to be issued until the result of the load
9122 or floating-point instruction is required.
9123
9124 Enabled at levels @option{-O2}, @option{-O3}.
9125
9126 @item -fschedule-insns2
9127 @opindex fschedule-insns2
9128 Similar to @option{-fschedule-insns}, but requests an additional pass of
9129 instruction scheduling after register allocation has been done. This is
9130 especially useful on machines with a relatively small number of
9131 registers and where memory load instructions take more than one cycle.
9132
9133 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9134
9135 @item -fno-sched-interblock
9136 @opindex fno-sched-interblock
9137 @opindex fsched-interblock
9138 Disable instruction scheduling across basic blocks, which
9139 is normally enabled when scheduling before register allocation, i.e.@:
9140 with @option{-fschedule-insns} or at @option{-O2} or higher.
9141
9142 @item -fno-sched-spec
9143 @opindex fno-sched-spec
9144 @opindex fsched-spec
9145 Disable speculative motion of non-load instructions, which
9146 is normally enabled when scheduling before register allocation, i.e.@:
9147 with @option{-fschedule-insns} or at @option{-O2} or higher.
9148
9149 @item -fsched-pressure
9150 @opindex fsched-pressure
9151 Enable register pressure sensitive insn scheduling before register
9152 allocation. This only makes sense when scheduling before register
9153 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9154 @option{-O2} or higher. Usage of this option can improve the
9155 generated code and decrease its size by preventing register pressure
9156 increase above the number of available hard registers and subsequent
9157 spills in register allocation.
9158
9159 @item -fsched-spec-load
9160 @opindex fsched-spec-load
9161 Allow speculative motion of some load instructions. This only makes
9162 sense when scheduling before register allocation, i.e.@: with
9163 @option{-fschedule-insns} or at @option{-O2} or higher.
9164
9165 @item -fsched-spec-load-dangerous
9166 @opindex fsched-spec-load-dangerous
9167 Allow speculative motion of more load instructions. This only makes
9168 sense when scheduling before register allocation, i.e.@: with
9169 @option{-fschedule-insns} or at @option{-O2} or higher.
9170
9171 @item -fsched-stalled-insns
9172 @itemx -fsched-stalled-insns=@var{n}
9173 @opindex fsched-stalled-insns
9174 Define how many insns (if any) can be moved prematurely from the queue
9175 of stalled insns into the ready list during the second scheduling pass.
9176 @option{-fno-sched-stalled-insns} means that no insns are moved
9177 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9178 on how many queued insns can be moved prematurely.
9179 @option{-fsched-stalled-insns} without a value is equivalent to
9180 @option{-fsched-stalled-insns=1}.
9181
9182 @item -fsched-stalled-insns-dep
9183 @itemx -fsched-stalled-insns-dep=@var{n}
9184 @opindex fsched-stalled-insns-dep
9185 Define how many insn groups (cycles) are examined for a dependency
9186 on a stalled insn that is a candidate for premature removal from the queue
9187 of stalled insns. This has an effect only during the second scheduling pass,
9188 and only if @option{-fsched-stalled-insns} is used.
9189 @option{-fno-sched-stalled-insns-dep} is equivalent to
9190 @option{-fsched-stalled-insns-dep=0}.
9191 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9192 @option{-fsched-stalled-insns-dep=1}.
9193
9194 @item -fsched2-use-superblocks
9195 @opindex fsched2-use-superblocks
9196 When scheduling after register allocation, use superblock scheduling.
9197 This allows motion across basic block boundaries,
9198 resulting in faster schedules. This option is experimental, as not all machine
9199 descriptions used by GCC model the CPU closely enough to avoid unreliable
9200 results from the algorithm.
9201
9202 This only makes sense when scheduling after register allocation, i.e.@: with
9203 @option{-fschedule-insns2} or at @option{-O2} or higher.
9204
9205 @item -fsched-group-heuristic
9206 @opindex fsched-group-heuristic
9207 Enable the group heuristic in the scheduler. This heuristic favors
9208 the instruction that belongs to a schedule group. This is enabled
9209 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9210 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9211
9212 @item -fsched-critical-path-heuristic
9213 @opindex fsched-critical-path-heuristic
9214 Enable the critical-path heuristic in the scheduler. This heuristic favors
9215 instructions on the critical path. This is enabled by default when
9216 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9217 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9218
9219 @item -fsched-spec-insn-heuristic
9220 @opindex fsched-spec-insn-heuristic
9221 Enable the speculative instruction heuristic in the scheduler. This
9222 heuristic favors speculative instructions with greater dependency weakness.
9223 This is enabled by default when scheduling is enabled, i.e.@:
9224 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9225 or at @option{-O2} or higher.
9226
9227 @item -fsched-rank-heuristic
9228 @opindex fsched-rank-heuristic
9229 Enable the rank heuristic in the scheduler. This heuristic favors
9230 the instruction belonging to a basic block with greater size or frequency.
9231 This is enabled by default when scheduling is enabled, i.e.@:
9232 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9233 at @option{-O2} or higher.
9234
9235 @item -fsched-last-insn-heuristic
9236 @opindex fsched-last-insn-heuristic
9237 Enable the last-instruction heuristic in the scheduler. This heuristic
9238 favors the instruction that is less dependent on the last instruction
9239 scheduled. This is enabled by default when scheduling is enabled,
9240 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9241 at @option{-O2} or higher.
9242
9243 @item -fsched-dep-count-heuristic
9244 @opindex fsched-dep-count-heuristic
9245 Enable the dependent-count heuristic in the scheduler. This heuristic
9246 favors the instruction that has more instructions depending on it.
9247 This is enabled by default when scheduling is enabled, i.e.@:
9248 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9249 at @option{-O2} or higher.
9250
9251 @item -freschedule-modulo-scheduled-loops
9252 @opindex freschedule-modulo-scheduled-loops
9253 Modulo scheduling is performed before traditional scheduling. If a loop
9254 is modulo scheduled, later scheduling passes may change its schedule.
9255 Use this option to control that behavior.
9256
9257 @item -fselective-scheduling
9258 @opindex fselective-scheduling
9259 Schedule instructions using selective scheduling algorithm. Selective
9260 scheduling runs instead of the first scheduler pass.
9261
9262 @item -fselective-scheduling2
9263 @opindex fselective-scheduling2
9264 Schedule instructions using selective scheduling algorithm. Selective
9265 scheduling runs instead of the second scheduler pass.
9266
9267 @item -fsel-sched-pipelining
9268 @opindex fsel-sched-pipelining
9269 Enable software pipelining of innermost loops during selective scheduling.
9270 This option has no effect unless one of @option{-fselective-scheduling} or
9271 @option{-fselective-scheduling2} is turned on.
9272
9273 @item -fsel-sched-pipelining-outer-loops
9274 @opindex fsel-sched-pipelining-outer-loops
9275 When pipelining loops during selective scheduling, also pipeline outer loops.
9276 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9277
9278 @item -fsemantic-interposition
9279 @opindex fsemantic-interposition
9280 Some object formats, like ELF, allow interposing of symbols by the
9281 dynamic linker.
9282 This means that for symbols exported from the DSO, the compiler cannot perform
9283 interprocedural propagation, inlining and other optimizations in anticipation
9284 that the function or variable in question may change. While this feature is
9285 useful, for example, to rewrite memory allocation functions by a debugging
9286 implementation, it is expensive in the terms of code quality.
9287 With @option{-fno-semantic-interposition} the compiler assumes that
9288 if interposition happens for functions the overwriting function will have
9289 precisely the same semantics (and side effects).
9290 Similarly if interposition happens
9291 for variables, the constructor of the variable will be the same. The flag
9292 has no effect for functions explicitly declared inline
9293 (where it is never allowed for interposition to change semantics)
9294 and for symbols explicitly declared weak.
9295
9296 @item -fshrink-wrap
9297 @opindex fshrink-wrap
9298 Emit function prologues only before parts of the function that need it,
9299 rather than at the top of the function. This flag is enabled by default at
9300 @option{-O} and higher.
9301
9302 @item -fshrink-wrap-separate
9303 @opindex fshrink-wrap-separate
9304 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9305 those parts are only executed when needed.
9306 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9307 is also turned on and the target supports this.
9308
9309 @item -fcaller-saves
9310 @opindex fcaller-saves
9311 Enable allocation of values to registers that are clobbered by
9312 function calls, by emitting extra instructions to save and restore the
9313 registers around such calls. Such allocation is done only when it
9314 seems to result in better code.
9315
9316 This option is always enabled by default on certain machines, usually
9317 those which have no call-preserved registers to use instead.
9318
9319 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9320
9321 @item -fcombine-stack-adjustments
9322 @opindex fcombine-stack-adjustments
9323 Tracks stack adjustments (pushes and pops) and stack memory references
9324 and then tries to find ways to combine them.
9325
9326 Enabled by default at @option{-O1} and higher.
9327
9328 @item -fipa-ra
9329 @opindex fipa-ra
9330 Use caller save registers for allocation if those registers are not used by
9331 any called function. In that case it is not necessary to save and restore
9332 them around calls. This is only possible if called functions are part of
9333 same compilation unit as current function and they are compiled before it.
9334
9335 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9336 is disabled if generated code will be instrumented for profiling
9337 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9338 exactly (this happens on targets that do not expose prologues
9339 and epilogues in RTL).
9340
9341 @item -fconserve-stack
9342 @opindex fconserve-stack
9343 Attempt to minimize stack usage. The compiler attempts to use less
9344 stack space, even if that makes the program slower. This option
9345 implies setting the @option{large-stack-frame} parameter to 100
9346 and the @option{large-stack-frame-growth} parameter to 400.
9347
9348 @item -ftree-reassoc
9349 @opindex ftree-reassoc
9350 Perform reassociation on trees. This flag is enabled by default
9351 at @option{-O} and higher.
9352
9353 @item -fcode-hoisting
9354 @opindex fcode-hoisting
9355 Perform code hoisting. Code hoisting tries to move the
9356 evaluation of expressions executed on all paths to the function exit
9357 as early as possible. This is especially useful as a code size
9358 optimization, but it often helps for code speed as well.
9359 This flag is enabled by default at @option{-O2} and higher.
9360
9361 @item -ftree-pre
9362 @opindex ftree-pre
9363 Perform partial redundancy elimination (PRE) on trees. This flag is
9364 enabled by default at @option{-O2} and @option{-O3}.
9365
9366 @item -ftree-partial-pre
9367 @opindex ftree-partial-pre
9368 Make partial redundancy elimination (PRE) more aggressive. This flag is
9369 enabled by default at @option{-O3}.
9370
9371 @item -ftree-forwprop
9372 @opindex ftree-forwprop
9373 Perform forward propagation on trees. This flag is enabled by default
9374 at @option{-O} and higher.
9375
9376 @item -ftree-fre
9377 @opindex ftree-fre
9378 Perform full redundancy elimination (FRE) on trees. The difference
9379 between FRE and PRE is that FRE only considers expressions
9380 that are computed on all paths leading to the redundant computation.
9381 This analysis is faster than PRE, though it exposes fewer redundancies.
9382 This flag is enabled by default at @option{-O} and higher.
9383
9384 @item -ftree-phiprop
9385 @opindex ftree-phiprop
9386 Perform hoisting of loads from conditional pointers on trees. This
9387 pass is enabled by default at @option{-O} and higher.
9388
9389 @item -fhoist-adjacent-loads
9390 @opindex fhoist-adjacent-loads
9391 Speculatively hoist loads from both branches of an if-then-else if the
9392 loads are from adjacent locations in the same structure and the target
9393 architecture has a conditional move instruction. This flag is enabled
9394 by default at @option{-O2} and higher.
9395
9396 @item -ftree-copy-prop
9397 @opindex ftree-copy-prop
9398 Perform copy propagation on trees. This pass eliminates unnecessary
9399 copy operations. This flag is enabled by default at @option{-O} and
9400 higher.
9401
9402 @item -fipa-pure-const
9403 @opindex fipa-pure-const
9404 Discover which functions are pure or constant.
9405 Enabled by default at @option{-O} and higher.
9406
9407 @item -fipa-reference
9408 @opindex fipa-reference
9409 Discover which static variables do not escape the
9410 compilation unit.
9411 Enabled by default at @option{-O} and higher.
9412
9413 @item -fipa-reference-addressable
9414 @opindex fipa-reference-addressable
9415 Discover read-only, write-only and non-addressable static variables.
9416 Enabled by default at @option{-O} and higher.
9417
9418 @item -fipa-stack-alignment
9419 @opindex fipa-stack-alignment
9420 Reduce stack alignment on call sites if possible.
9421 Enabled by default.
9422
9423 @item -fipa-pta
9424 @opindex fipa-pta
9425 Perform interprocedural pointer analysis and interprocedural modification
9426 and reference analysis. This option can cause excessive memory and
9427 compile-time usage on large compilation units. It is not enabled by
9428 default at any optimization level.
9429
9430 @item -fipa-profile
9431 @opindex fipa-profile
9432 Perform interprocedural profile propagation. The functions called only from
9433 cold functions are marked as cold. Also functions executed once (such as
9434 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9435 functions and loop less parts of functions executed once are then optimized for
9436 size.
9437 Enabled by default at @option{-O} and higher.
9438
9439 @item -fipa-cp
9440 @opindex fipa-cp
9441 Perform interprocedural constant propagation.
9442 This optimization analyzes the program to determine when values passed
9443 to functions are constants and then optimizes accordingly.
9444 This optimization can substantially increase performance
9445 if the application has constants passed to functions.
9446 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9447 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9448
9449 @item -fipa-cp-clone
9450 @opindex fipa-cp-clone
9451 Perform function cloning to make interprocedural constant propagation stronger.
9452 When enabled, interprocedural constant propagation performs function cloning
9453 when externally visible function can be called with constant arguments.
9454 Because this optimization can create multiple copies of functions,
9455 it may significantly increase code size
9456 (see @option{--param ipcp-unit-growth=@var{value}}).
9457 This flag is enabled by default at @option{-O3}.
9458 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9459
9460 @item -fipa-bit-cp
9461 @opindex fipa-bit-cp
9462 When enabled, perform interprocedural bitwise constant
9463 propagation. This flag is enabled by default at @option{-O2} and
9464 by @option{-fprofile-use} and @option{-fauto-profile}.
9465 It requires that @option{-fipa-cp} is enabled.
9466
9467 @item -fipa-vrp
9468 @opindex fipa-vrp
9469 When enabled, perform interprocedural propagation of value
9470 ranges. This flag is enabled by default at @option{-O2}. It requires
9471 that @option{-fipa-cp} is enabled.
9472
9473 @item -fipa-icf
9474 @opindex fipa-icf
9475 Perform Identical Code Folding for functions and read-only variables.
9476 The optimization reduces code size and may disturb unwind stacks by replacing
9477 a function by equivalent one with a different name. The optimization works
9478 more effectively with link-time optimization enabled.
9479
9480 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9481 works on different levels and thus the optimizations are not same - there are
9482 equivalences that are found only by GCC and equivalences found only by Gold.
9483
9484 This flag is enabled by default at @option{-O2} and @option{-Os}.
9485
9486 @item -flive-patching=@var{level}
9487 @opindex flive-patching
9488 Control GCC's optimizations to produce output suitable for live-patching.
9489
9490 If the compiler's optimization uses a function's body or information extracted
9491 from its body to optimize/change another function, the latter is called an
9492 impacted function of the former. If a function is patched, its impacted
9493 functions should be patched too.
9494
9495 The impacted functions are determined by the compiler's interprocedural
9496 optimizations. For example, a caller is impacted when inlining a function
9497 into its caller,
9498 cloning a function and changing its caller to call this new clone,
9499 or extracting a function's pureness/constness information to optimize
9500 its direct or indirect callers, etc.
9501
9502 Usually, the more IPA optimizations enabled, the larger the number of
9503 impacted functions for each function. In order to control the number of
9504 impacted functions and more easily compute the list of impacted function,
9505 IPA optimizations can be partially enabled at two different levels.
9506
9507 The @var{level} argument should be one of the following:
9508
9509 @table @samp
9510
9511 @item inline-clone
9512
9513 Only enable inlining and cloning optimizations, which includes inlining,
9514 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9515 As a result, when patching a function, all its callers and its clones'
9516 callers are impacted, therefore need to be patched as well.
9517
9518 @option{-flive-patching=inline-clone} disables the following optimization flags:
9519 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9520 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9521 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9522 -fipa-stack-alignment}
9523
9524 @item inline-only-static
9525
9526 Only enable inlining of static functions.
9527 As a result, when patching a static function, all its callers are impacted
9528 and so need to be patched as well.
9529
9530 In addition to all the flags that @option{-flive-patching=inline-clone}
9531 disables,
9532 @option{-flive-patching=inline-only-static} disables the following additional
9533 optimization flags:
9534 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9535
9536 @end table
9537
9538 When @option{-flive-patching} is specified without any value, the default value
9539 is @var{inline-clone}.
9540
9541 This flag is disabled by default.
9542
9543 Note that @option{-flive-patching} is not supported with link-time optimization
9544 (@option{-flto}).
9545
9546 @item -fisolate-erroneous-paths-dereference
9547 @opindex fisolate-erroneous-paths-dereference
9548 Detect paths that trigger erroneous or undefined behavior due to
9549 dereferencing a null pointer. Isolate those paths from the main control
9550 flow and turn the statement with erroneous or undefined behavior into a trap.
9551 This flag is enabled by default at @option{-O2} and higher and depends on
9552 @option{-fdelete-null-pointer-checks} also being enabled.
9553
9554 @item -fisolate-erroneous-paths-attribute
9555 @opindex fisolate-erroneous-paths-attribute
9556 Detect paths that trigger erroneous or undefined behavior due to a null value
9557 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9558 attribute. Isolate those paths from the main control flow and turn the
9559 statement with erroneous or undefined behavior into a trap. This is not
9560 currently enabled, but may be enabled by @option{-O2} in the future.
9561
9562 @item -ftree-sink
9563 @opindex ftree-sink
9564 Perform forward store motion on trees. This flag is
9565 enabled by default at @option{-O} and higher.
9566
9567 @item -ftree-bit-ccp
9568 @opindex ftree-bit-ccp
9569 Perform sparse conditional bit constant propagation on trees and propagate
9570 pointer alignment information.
9571 This pass only operates on local scalar variables and is enabled by default
9572 at @option{-O1} and higher, except for @option{-Og}.
9573 It requires that @option{-ftree-ccp} is enabled.
9574
9575 @item -ftree-ccp
9576 @opindex ftree-ccp
9577 Perform sparse conditional constant propagation (CCP) on trees. This
9578 pass only operates on local scalar variables and is enabled by default
9579 at @option{-O} and higher.
9580
9581 @item -fssa-backprop
9582 @opindex fssa-backprop
9583 Propagate information about uses of a value up the definition chain
9584 in order to simplify the definitions. For example, this pass strips
9585 sign operations if the sign of a value never matters. The flag is
9586 enabled by default at @option{-O} and higher.
9587
9588 @item -fssa-phiopt
9589 @opindex fssa-phiopt
9590 Perform pattern matching on SSA PHI nodes to optimize conditional
9591 code. This pass is enabled by default at @option{-O1} and higher,
9592 except for @option{-Og}.
9593
9594 @item -ftree-switch-conversion
9595 @opindex ftree-switch-conversion
9596 Perform conversion of simple initializations in a switch to
9597 initializations from a scalar array. This flag is enabled by default
9598 at @option{-O2} and higher.
9599
9600 @item -ftree-tail-merge
9601 @opindex ftree-tail-merge
9602 Look for identical code sequences. When found, replace one with a jump to the
9603 other. This optimization is known as tail merging or cross jumping. This flag
9604 is enabled by default at @option{-O2} and higher. The compilation time
9605 in this pass can
9606 be limited using @option{max-tail-merge-comparisons} parameter and
9607 @option{max-tail-merge-iterations} parameter.
9608
9609 @item -ftree-dce
9610 @opindex ftree-dce
9611 Perform dead code elimination (DCE) on trees. This flag is enabled by
9612 default at @option{-O} and higher.
9613
9614 @item -ftree-builtin-call-dce
9615 @opindex ftree-builtin-call-dce
9616 Perform conditional dead code elimination (DCE) for calls to built-in functions
9617 that may set @code{errno} but are otherwise free of side effects. This flag is
9618 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9619 specified.
9620
9621 @item -ffinite-loops
9622 @opindex ffinite-loops
9623 @opindex fno-finite-loops
9624 Assume that a loop with an exit will eventually take the exit and not loop
9625 indefinitely. This allows the compiler to remove loops that otherwise have
9626 no side-effects, not considering eventual endless looping as such.
9627
9628 This option is enabled by default at @option{-O2}.
9629
9630 @item -ftree-dominator-opts
9631 @opindex ftree-dominator-opts
9632 Perform a variety of simple scalar cleanups (constant/copy
9633 propagation, redundancy elimination, range propagation and expression
9634 simplification) based on a dominator tree traversal. This also
9635 performs jump threading (to reduce jumps to jumps). This flag is
9636 enabled by default at @option{-O} and higher.
9637
9638 @item -ftree-dse
9639 @opindex ftree-dse
9640 Perform dead store elimination (DSE) on trees. A dead store is a store into
9641 a memory location that is later overwritten by another store without
9642 any intervening loads. In this case the earlier store can be deleted. This
9643 flag is enabled by default at @option{-O} and higher.
9644
9645 @item -ftree-ch
9646 @opindex ftree-ch
9647 Perform loop header copying on trees. This is beneficial since it increases
9648 effectiveness of code motion optimizations. It also saves one jump. This flag
9649 is enabled by default at @option{-O} and higher. It is not enabled
9650 for @option{-Os}, since it usually increases code size.
9651
9652 @item -ftree-loop-optimize
9653 @opindex ftree-loop-optimize
9654 Perform loop optimizations on trees. This flag is enabled by default
9655 at @option{-O} and higher.
9656
9657 @item -ftree-loop-linear
9658 @itemx -floop-strip-mine
9659 @itemx -floop-block
9660 @opindex ftree-loop-linear
9661 @opindex floop-strip-mine
9662 @opindex floop-block
9663 Perform loop nest optimizations. Same as
9664 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9665 to be configured with @option{--with-isl} to enable the Graphite loop
9666 transformation infrastructure.
9667
9668 @item -fgraphite-identity
9669 @opindex fgraphite-identity
9670 Enable the identity transformation for graphite. For every SCoP we generate
9671 the polyhedral representation and transform it back to gimple. Using
9672 @option{-fgraphite-identity} we can check the costs or benefits of the
9673 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9674 are also performed by the code generator isl, like index splitting and
9675 dead code elimination in loops.
9676
9677 @item -floop-nest-optimize
9678 @opindex floop-nest-optimize
9679 Enable the isl based loop nest optimizer. This is a generic loop nest
9680 optimizer based on the Pluto optimization algorithms. It calculates a loop
9681 structure optimized for data-locality and parallelism. This option
9682 is experimental.
9683
9684 @item -floop-parallelize-all
9685 @opindex floop-parallelize-all
9686 Use the Graphite data dependence analysis to identify loops that can
9687 be parallelized. Parallelize all the loops that can be analyzed to
9688 not contain loop carried dependences without checking that it is
9689 profitable to parallelize the loops.
9690
9691 @item -ftree-coalesce-vars
9692 @opindex ftree-coalesce-vars
9693 While transforming the program out of the SSA representation, attempt to
9694 reduce copying by coalescing versions of different user-defined
9695 variables, instead of just compiler temporaries. This may severely
9696 limit the ability to debug an optimized program compiled with
9697 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9698 prevents SSA coalescing of user variables. This option is enabled by
9699 default if optimization is enabled, and it does very little otherwise.
9700
9701 @item -ftree-loop-if-convert
9702 @opindex ftree-loop-if-convert
9703 Attempt to transform conditional jumps in the innermost loops to
9704 branch-less equivalents. The intent is to remove control-flow from
9705 the innermost loops in order to improve the ability of the
9706 vectorization pass to handle these loops. This is enabled by default
9707 if vectorization is enabled.
9708
9709 @item -ftree-loop-distribution
9710 @opindex ftree-loop-distribution
9711 Perform loop distribution. This flag can improve cache performance on
9712 big loop bodies and allow further loop optimizations, like
9713 parallelization or vectorization, to take place. For example, the loop
9714 @smallexample
9715 DO I = 1, N
9716 A(I) = B(I) + C
9717 D(I) = E(I) * F
9718 ENDDO
9719 @end smallexample
9720 is transformed to
9721 @smallexample
9722 DO I = 1, N
9723 A(I) = B(I) + C
9724 ENDDO
9725 DO I = 1, N
9726 D(I) = E(I) * F
9727 ENDDO
9728 @end smallexample
9729 This flag is enabled by default at @option{-O3}.
9730 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9731
9732 @item -ftree-loop-distribute-patterns
9733 @opindex ftree-loop-distribute-patterns
9734 Perform loop distribution of patterns that can be code generated with
9735 calls to a library. This flag is enabled by default at @option{-O3}, and
9736 by @option{-fprofile-use} and @option{-fauto-profile}.
9737
9738 This pass distributes the initialization loops and generates a call to
9739 memset zero. For example, the loop
9740 @smallexample
9741 DO I = 1, N
9742 A(I) = 0
9743 B(I) = A(I) + I
9744 ENDDO
9745 @end smallexample
9746 is transformed to
9747 @smallexample
9748 DO I = 1, N
9749 A(I) = 0
9750 ENDDO
9751 DO I = 1, N
9752 B(I) = A(I) + I
9753 ENDDO
9754 @end smallexample
9755 and the initialization loop is transformed into a call to memset zero.
9756 This flag is enabled by default at @option{-O3}.
9757 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9758
9759 @item -floop-interchange
9760 @opindex floop-interchange
9761 Perform loop interchange outside of graphite. This flag can improve cache
9762 performance on loop nest and allow further loop optimizations, like
9763 vectorization, to take place. For example, the loop
9764 @smallexample
9765 for (int i = 0; i < N; i++)
9766 for (int j = 0; j < N; j++)
9767 for (int k = 0; k < N; k++)
9768 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9769 @end smallexample
9770 is transformed to
9771 @smallexample
9772 for (int i = 0; i < N; i++)
9773 for (int k = 0; k < N; k++)
9774 for (int j = 0; j < N; j++)
9775 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9776 @end smallexample
9777 This flag is enabled by default at @option{-O3}.
9778 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9779
9780 @item -floop-unroll-and-jam
9781 @opindex floop-unroll-and-jam
9782 Apply unroll and jam transformations on feasible loops. In a loop
9783 nest this unrolls the outer loop by some factor and fuses the resulting
9784 multiple inner loops. This flag is enabled by default at @option{-O3}.
9785 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9786
9787 @item -ftree-loop-im
9788 @opindex ftree-loop-im
9789 Perform loop invariant motion on trees. This pass moves only invariants that
9790 are hard to handle at RTL level (function calls, operations that expand to
9791 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9792 operands of conditions that are invariant out of the loop, so that we can use
9793 just trivial invariantness analysis in loop unswitching. The pass also includes
9794 store motion.
9795
9796 @item -ftree-loop-ivcanon
9797 @opindex ftree-loop-ivcanon
9798 Create a canonical counter for number of iterations in loops for which
9799 determining number of iterations requires complicated analysis. Later
9800 optimizations then may determine the number easily. Useful especially
9801 in connection with unrolling.
9802
9803 @item -ftree-scev-cprop
9804 @opindex ftree-scev-cprop
9805 Perform final value replacement. If a variable is modified in a loop
9806 in such a way that its value when exiting the loop can be determined using
9807 only its initial value and the number of loop iterations, replace uses of
9808 the final value by such a computation, provided it is sufficiently cheap.
9809 This reduces data dependencies and may allow further simplifications.
9810 Enabled by default at @option{-O} and higher.
9811
9812 @item -fivopts
9813 @opindex fivopts
9814 Perform induction variable optimizations (strength reduction, induction
9815 variable merging and induction variable elimination) on trees.
9816
9817 @item -ftree-parallelize-loops=n
9818 @opindex ftree-parallelize-loops
9819 Parallelize loops, i.e., split their iteration space to run in n threads.
9820 This is only possible for loops whose iterations are independent
9821 and can be arbitrarily reordered. The optimization is only
9822 profitable on multiprocessor machines, for loops that are CPU-intensive,
9823 rather than constrained e.g.@: by memory bandwidth. This option
9824 implies @option{-pthread}, and thus is only supported on targets
9825 that have support for @option{-pthread}.
9826
9827 @item -ftree-pta
9828 @opindex ftree-pta
9829 Perform function-local points-to analysis on trees. This flag is
9830 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9831
9832 @item -ftree-sra
9833 @opindex ftree-sra
9834 Perform scalar replacement of aggregates. This pass replaces structure
9835 references with scalars to prevent committing structures to memory too
9836 early. This flag is enabled by default at @option{-O1} and higher,
9837 except for @option{-Og}.
9838
9839 @item -fstore-merging
9840 @opindex fstore-merging
9841 Perform merging of narrow stores to consecutive memory addresses. This pass
9842 merges contiguous stores of immediate values narrower than a word into fewer
9843 wider stores to reduce the number of instructions. This is enabled by default
9844 at @option{-O2} and higher as well as @option{-Os}.
9845
9846 @item -ftree-ter
9847 @opindex ftree-ter
9848 Perform temporary expression replacement during the SSA->normal phase. Single
9849 use/single def temporaries are replaced at their use location with their
9850 defining expression. This results in non-GIMPLE code, but gives the expanders
9851 much more complex trees to work on resulting in better RTL generation. This is
9852 enabled by default at @option{-O} and higher.
9853
9854 @item -ftree-slsr
9855 @opindex ftree-slsr
9856 Perform straight-line strength reduction on trees. This recognizes related
9857 expressions involving multiplications and replaces them by less expensive
9858 calculations when possible. This is enabled by default at @option{-O} and
9859 higher.
9860
9861 @item -ftree-vectorize
9862 @opindex ftree-vectorize
9863 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9864 and @option{-ftree-slp-vectorize} if not explicitly specified.
9865
9866 @item -ftree-loop-vectorize
9867 @opindex ftree-loop-vectorize
9868 Perform loop vectorization on trees. This flag is enabled by default at
9869 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9870 and @option{-fauto-profile}.
9871
9872 @item -ftree-slp-vectorize
9873 @opindex ftree-slp-vectorize
9874 Perform basic block vectorization on trees. This flag is enabled by default at
9875 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9876 and @option{-fauto-profile}.
9877
9878 @item -fvect-cost-model=@var{model}
9879 @opindex fvect-cost-model
9880 Alter the cost model used for vectorization. The @var{model} argument
9881 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9882 With the @samp{unlimited} model the vectorized code-path is assumed
9883 to be profitable while with the @samp{dynamic} model a runtime check
9884 guards the vectorized code-path to enable it only for iteration
9885 counts that will likely execute faster than when executing the original
9886 scalar loop. The @samp{cheap} model disables vectorization of
9887 loops where doing so would be cost prohibitive for example due to
9888 required runtime checks for data dependence or alignment but otherwise
9889 is equal to the @samp{dynamic} model.
9890 The default cost model depends on other optimization flags and is
9891 either @samp{dynamic} or @samp{cheap}.
9892
9893 @item -fsimd-cost-model=@var{model}
9894 @opindex fsimd-cost-model
9895 Alter the cost model used for vectorization of loops marked with the OpenMP
9896 simd directive. The @var{model} argument should be one of
9897 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9898 have the same meaning as described in @option{-fvect-cost-model} and by
9899 default a cost model defined with @option{-fvect-cost-model} is used.
9900
9901 @item -ftree-vrp
9902 @opindex ftree-vrp
9903 Perform Value Range Propagation on trees. This is similar to the
9904 constant propagation pass, but instead of values, ranges of values are
9905 propagated. This allows the optimizers to remove unnecessary range
9906 checks like array bound checks and null pointer checks. This is
9907 enabled by default at @option{-O2} and higher. Null pointer check
9908 elimination is only done if @option{-fdelete-null-pointer-checks} is
9909 enabled.
9910
9911 @item -fsplit-paths
9912 @opindex fsplit-paths
9913 Split paths leading to loop backedges. This can improve dead code
9914 elimination and common subexpression elimination. This is enabled by
9915 default at @option{-O3} and above.
9916
9917 @item -fsplit-ivs-in-unroller
9918 @opindex fsplit-ivs-in-unroller
9919 Enables expression of values of induction variables in later iterations
9920 of the unrolled loop using the value in the first iteration. This breaks
9921 long dependency chains, thus improving efficiency of the scheduling passes.
9922
9923 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9924 same effect. However, that is not reliable in cases where the loop body
9925 is more complicated than a single basic block. It also does not work at all
9926 on some architectures due to restrictions in the CSE pass.
9927
9928 This optimization is enabled by default.
9929
9930 @item -fvariable-expansion-in-unroller
9931 @opindex fvariable-expansion-in-unroller
9932 With this option, the compiler creates multiple copies of some
9933 local variables when unrolling a loop, which can result in superior code.
9934
9935 This optimization is enabled by default for PowerPC targets, but disabled
9936 by default otherwise.
9937
9938 @item -fpartial-inlining
9939 @opindex fpartial-inlining
9940 Inline parts of functions. This option has any effect only
9941 when inlining itself is turned on by the @option{-finline-functions}
9942 or @option{-finline-small-functions} options.
9943
9944 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9945
9946 @item -fpredictive-commoning
9947 @opindex fpredictive-commoning
9948 Perform predictive commoning optimization, i.e., reusing computations
9949 (especially memory loads and stores) performed in previous
9950 iterations of loops.
9951
9952 This option is enabled at level @option{-O3}.
9953 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9954
9955 @item -fprefetch-loop-arrays
9956 @opindex fprefetch-loop-arrays
9957 If supported by the target machine, generate instructions to prefetch
9958 memory to improve the performance of loops that access large arrays.
9959
9960 This option may generate better or worse code; results are highly
9961 dependent on the structure of loops within the source code.
9962
9963 Disabled at level @option{-Os}.
9964
9965 @item -fno-printf-return-value
9966 @opindex fno-printf-return-value
9967 @opindex fprintf-return-value
9968 Do not substitute constants for known return value of formatted output
9969 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9970 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9971 transformation allows GCC to optimize or even eliminate branches based
9972 on the known return value of these functions called with arguments that
9973 are either constant, or whose values are known to be in a range that
9974 makes determining the exact return value possible. For example, when
9975 @option{-fprintf-return-value} is in effect, both the branch and the
9976 body of the @code{if} statement (but not the call to @code{snprint})
9977 can be optimized away when @code{i} is a 32-bit or smaller integer
9978 because the return value is guaranteed to be at most 8.
9979
9980 @smallexample
9981 char buf[9];
9982 if (snprintf (buf, "%08x", i) >= sizeof buf)
9983 @dots{}
9984 @end smallexample
9985
9986 The @option{-fprintf-return-value} option relies on other optimizations
9987 and yields best results with @option{-O2} and above. It works in tandem
9988 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9989 options. The @option{-fprintf-return-value} option is enabled by default.
9990
9991 @item -fno-peephole
9992 @itemx -fno-peephole2
9993 @opindex fno-peephole
9994 @opindex fpeephole
9995 @opindex fno-peephole2
9996 @opindex fpeephole2
9997 Disable any machine-specific peephole optimizations. The difference
9998 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9999 are implemented in the compiler; some targets use one, some use the
10000 other, a few use both.
10001
10002 @option{-fpeephole} is enabled by default.
10003 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10004
10005 @item -fno-guess-branch-probability
10006 @opindex fno-guess-branch-probability
10007 @opindex fguess-branch-probability
10008 Do not guess branch probabilities using heuristics.
10009
10010 GCC uses heuristics to guess branch probabilities if they are
10011 not provided by profiling feedback (@option{-fprofile-arcs}). These
10012 heuristics are based on the control flow graph. If some branch probabilities
10013 are specified by @code{__builtin_expect}, then the heuristics are
10014 used to guess branch probabilities for the rest of the control flow graph,
10015 taking the @code{__builtin_expect} info into account. The interactions
10016 between the heuristics and @code{__builtin_expect} can be complex, and in
10017 some cases, it may be useful to disable the heuristics so that the effects
10018 of @code{__builtin_expect} are easier to understand.
10019
10020 It is also possible to specify expected probability of the expression
10021 with @code{__builtin_expect_with_probability} built-in function.
10022
10023 The default is @option{-fguess-branch-probability} at levels
10024 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10025
10026 @item -freorder-blocks
10027 @opindex freorder-blocks
10028 Reorder basic blocks in the compiled function in order to reduce number of
10029 taken branches and improve code locality.
10030
10031 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10032
10033 @item -freorder-blocks-algorithm=@var{algorithm}
10034 @opindex freorder-blocks-algorithm
10035 Use the specified algorithm for basic block reordering. The
10036 @var{algorithm} argument can be @samp{simple}, which does not increase
10037 code size (except sometimes due to secondary effects like alignment),
10038 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
10039 put all often executed code together, minimizing the number of branches
10040 executed by making extra copies of code.
10041
10042 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
10043 @samp{stc} at levels @option{-O2}, @option{-O3}.
10044
10045 @item -freorder-blocks-and-partition
10046 @opindex freorder-blocks-and-partition
10047 In addition to reordering basic blocks in the compiled function, in order
10048 to reduce number of taken branches, partitions hot and cold basic blocks
10049 into separate sections of the assembly and @file{.o} files, to improve
10050 paging and cache locality performance.
10051
10052 This optimization is automatically turned off in the presence of
10053 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10054 section attribute and on any architecture that does not support named
10055 sections. When @option{-fsplit-stack} is used this option is not
10056 enabled by default (to avoid linker errors), but may be enabled
10057 explicitly (if using a working linker).
10058
10059 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10060
10061 @item -freorder-functions
10062 @opindex freorder-functions
10063 Reorder functions in the object file in order to
10064 improve code locality. This is implemented by using special
10065 subsections @code{.text.hot} for most frequently executed functions and
10066 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
10067 the linker so object file format must support named sections and linker must
10068 place them in a reasonable way.
10069
10070 This option isn't effective unless you either provide profile feedback
10071 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10072 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10073
10074 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10075
10076 @item -fstrict-aliasing
10077 @opindex fstrict-aliasing
10078 Allow the compiler to assume the strictest aliasing rules applicable to
10079 the language being compiled. For C (and C++), this activates
10080 optimizations based on the type of expressions. In particular, an
10081 object of one type is assumed never to reside at the same address as an
10082 object of a different type, unless the types are almost the same. For
10083 example, an @code{unsigned int} can alias an @code{int}, but not a
10084 @code{void*} or a @code{double}. A character type may alias any other
10085 type.
10086
10087 @anchor{Type-punning}Pay special attention to code like this:
10088 @smallexample
10089 union a_union @{
10090 int i;
10091 double d;
10092 @};
10093
10094 int f() @{
10095 union a_union t;
10096 t.d = 3.0;
10097 return t.i;
10098 @}
10099 @end smallexample
10100 The practice of reading from a different union member than the one most
10101 recently written to (called ``type-punning'') is common. Even with
10102 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10103 is accessed through the union type. So, the code above works as
10104 expected. @xref{Structures unions enumerations and bit-fields
10105 implementation}. However, this code might not:
10106 @smallexample
10107 int f() @{
10108 union a_union t;
10109 int* ip;
10110 t.d = 3.0;
10111 ip = &t.i;
10112 return *ip;
10113 @}
10114 @end smallexample
10115
10116 Similarly, access by taking the address, casting the resulting pointer
10117 and dereferencing the result has undefined behavior, even if the cast
10118 uses a union type, e.g.:
10119 @smallexample
10120 int f() @{
10121 double d = 3.0;
10122 return ((union a_union *) &d)->i;
10123 @}
10124 @end smallexample
10125
10126 The @option{-fstrict-aliasing} option is enabled at levels
10127 @option{-O2}, @option{-O3}, @option{-Os}.
10128
10129 @item -falign-functions
10130 @itemx -falign-functions=@var{n}
10131 @itemx -falign-functions=@var{n}:@var{m}
10132 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10133 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10134 @opindex falign-functions
10135 Align the start of functions to the next power-of-two greater than
10136 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10137 the first @var{m} bytes of the function can be fetched by the CPU
10138 without crossing an @var{n}-byte alignment boundary.
10139
10140 If @var{m} is not specified, it defaults to @var{n}.
10141
10142 Examples: @option{-falign-functions=32} aligns functions to the next
10143 32-byte boundary, @option{-falign-functions=24} aligns to the next
10144 32-byte boundary only if this can be done by skipping 23 bytes or less,
10145 @option{-falign-functions=32:7} aligns to the next
10146 32-byte boundary only if this can be done by skipping 6 bytes or less.
10147
10148 The second pair of @var{n2}:@var{m2} values allows you to specify
10149 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10150 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10151 otherwise aligns to the next 32-byte boundary if this can be done
10152 by skipping 2 bytes or less.
10153 If @var{m2} is not specified, it defaults to @var{n2}.
10154
10155 Some assemblers only support this flag when @var{n} is a power of two;
10156 in that case, it is rounded up.
10157
10158 @option{-fno-align-functions} and @option{-falign-functions=1} are
10159 equivalent and mean that functions are not aligned.
10160
10161 If @var{n} is not specified or is zero, use a machine-dependent default.
10162 The maximum allowed @var{n} option value is 65536.
10163
10164 Enabled at levels @option{-O2}, @option{-O3}.
10165
10166 @item -flimit-function-alignment
10167 If this option is enabled, the compiler tries to avoid unnecessarily
10168 overaligning functions. It attempts to instruct the assembler to align
10169 by the amount specified by @option{-falign-functions}, but not to
10170 skip more bytes than the size of the function.
10171
10172 @item -falign-labels
10173 @itemx -falign-labels=@var{n}
10174 @itemx -falign-labels=@var{n}:@var{m}
10175 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10176 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10177 @opindex falign-labels
10178 Align all branch targets to a power-of-two boundary.
10179
10180 Parameters of this option are analogous to the @option{-falign-functions} option.
10181 @option{-fno-align-labels} and @option{-falign-labels=1} are
10182 equivalent and mean that labels are not aligned.
10183
10184 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10185 are greater than this value, then their values are used instead.
10186
10187 If @var{n} is not specified or is zero, use a machine-dependent default
10188 which is very likely to be @samp{1}, meaning no alignment.
10189 The maximum allowed @var{n} option value is 65536.
10190
10191 Enabled at levels @option{-O2}, @option{-O3}.
10192
10193 @item -falign-loops
10194 @itemx -falign-loops=@var{n}
10195 @itemx -falign-loops=@var{n}:@var{m}
10196 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10197 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10198 @opindex falign-loops
10199 Align loops to a power-of-two boundary. If the loops are executed
10200 many times, this makes up for any execution of the dummy padding
10201 instructions.
10202
10203 Parameters of this option are analogous to the @option{-falign-functions} option.
10204 @option{-fno-align-loops} and @option{-falign-loops=1} are
10205 equivalent and mean that loops are not aligned.
10206 The maximum allowed @var{n} option value is 65536.
10207
10208 If @var{n} is not specified or is zero, use a machine-dependent default.
10209
10210 Enabled at levels @option{-O2}, @option{-O3}.
10211
10212 @item -falign-jumps
10213 @itemx -falign-jumps=@var{n}
10214 @itemx -falign-jumps=@var{n}:@var{m}
10215 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10216 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10217 @opindex falign-jumps
10218 Align branch targets to a power-of-two boundary, for branch targets
10219 where the targets can only be reached by jumping. In this case,
10220 no dummy operations need be executed.
10221
10222 Parameters of this option are analogous to the @option{-falign-functions} option.
10223 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10224 equivalent and mean that loops are not aligned.
10225
10226 If @var{n} is not specified or is zero, use a machine-dependent default.
10227 The maximum allowed @var{n} option value is 65536.
10228
10229 Enabled at levels @option{-O2}, @option{-O3}.
10230
10231 @item -fallow-store-data-races
10232 @opindex fallow-store-data-races
10233 Allow the compiler to introduce new data races on stores.
10234
10235 Enabled at level @option{-Ofast}.
10236
10237 @item -funit-at-a-time
10238 @opindex funit-at-a-time
10239 This option is left for compatibility reasons. @option{-funit-at-a-time}
10240 has no effect, while @option{-fno-unit-at-a-time} implies
10241 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10242
10243 Enabled by default.
10244
10245 @item -fno-toplevel-reorder
10246 @opindex fno-toplevel-reorder
10247 @opindex ftoplevel-reorder
10248 Do not reorder top-level functions, variables, and @code{asm}
10249 statements. Output them in the same order that they appear in the
10250 input file. When this option is used, unreferenced static variables
10251 are not removed. This option is intended to support existing code
10252 that relies on a particular ordering. For new code, it is better to
10253 use attributes when possible.
10254
10255 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10256 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10257 Additionally @option{-fno-toplevel-reorder} implies
10258 @option{-fno-section-anchors}.
10259
10260 @item -fweb
10261 @opindex fweb
10262 Constructs webs as commonly used for register allocation purposes and assign
10263 each web individual pseudo register. This allows the register allocation pass
10264 to operate on pseudos directly, but also strengthens several other optimization
10265 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10266 however, make debugging impossible, since variables no longer stay in a
10267 ``home register''.
10268
10269 Enabled by default with @option{-funroll-loops}.
10270
10271 @item -fwhole-program
10272 @opindex fwhole-program
10273 Assume that the current compilation unit represents the whole program being
10274 compiled. All public functions and variables with the exception of @code{main}
10275 and those merged by attribute @code{externally_visible} become static functions
10276 and in effect are optimized more aggressively by interprocedural optimizers.
10277
10278 This option should not be used in combination with @option{-flto}.
10279 Instead relying on a linker plugin should provide safer and more precise
10280 information.
10281
10282 @item -flto[=@var{n}]
10283 @opindex flto
10284 This option runs the standard link-time optimizer. When invoked
10285 with source code, it generates GIMPLE (one of GCC's internal
10286 representations) and writes it to special ELF sections in the object
10287 file. When the object files are linked together, all the function
10288 bodies are read from these ELF sections and instantiated as if they
10289 had been part of the same translation unit.
10290
10291 To use the link-time optimizer, @option{-flto} and optimization
10292 options should be specified at compile time and during the final link.
10293 It is recommended that you compile all the files participating in the
10294 same link with the same options and also specify those options at
10295 link time.
10296 For example:
10297
10298 @smallexample
10299 gcc -c -O2 -flto foo.c
10300 gcc -c -O2 -flto bar.c
10301 gcc -o myprog -flto -O2 foo.o bar.o
10302 @end smallexample
10303
10304 The first two invocations to GCC save a bytecode representation
10305 of GIMPLE into special ELF sections inside @file{foo.o} and
10306 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10307 @file{foo.o} and @file{bar.o}, merges the two files into a single
10308 internal image, and compiles the result as usual. Since both
10309 @file{foo.o} and @file{bar.o} are merged into a single image, this
10310 causes all the interprocedural analyses and optimizations in GCC to
10311 work across the two files as if they were a single one. This means,
10312 for example, that the inliner is able to inline functions in
10313 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10314
10315 Another (simpler) way to enable link-time optimization is:
10316
10317 @smallexample
10318 gcc -o myprog -flto -O2 foo.c bar.c
10319 @end smallexample
10320
10321 The above generates bytecode for @file{foo.c} and @file{bar.c},
10322 merges them together into a single GIMPLE representation and optimizes
10323 them as usual to produce @file{myprog}.
10324
10325 The important thing to keep in mind is that to enable link-time
10326 optimizations you need to use the GCC driver to perform the link step.
10327 GCC automatically performs link-time optimization if any of the
10328 objects involved were compiled with the @option{-flto} command-line option.
10329 You can always override
10330 the automatic decision to do link-time optimization
10331 by passing @option{-fno-lto} to the link command.
10332
10333 To make whole program optimization effective, it is necessary to make
10334 certain whole program assumptions. The compiler needs to know
10335 what functions and variables can be accessed by libraries and runtime
10336 outside of the link-time optimized unit. When supported by the linker,
10337 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10338 to the compiler about used and externally visible symbols. When
10339 the linker plugin is not available, @option{-fwhole-program} should be
10340 used to allow the compiler to make these assumptions, which leads
10341 to more aggressive optimization decisions.
10342
10343 When a file is compiled with @option{-flto} without
10344 @option{-fuse-linker-plugin}, the generated object file is larger than
10345 a regular object file because it contains GIMPLE bytecodes and the usual
10346 final code (see @option{-ffat-lto-objects}. This means that
10347 object files with LTO information can be linked as normal object
10348 files; if @option{-fno-lto} is passed to the linker, no
10349 interprocedural optimizations are applied. Note that when
10350 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10351 but you cannot perform a regular, non-LTO link on them.
10352
10353 When producing the final binary, GCC only
10354 applies link-time optimizations to those files that contain bytecode.
10355 Therefore, you can mix and match object files and libraries with
10356 GIMPLE bytecodes and final object code. GCC automatically selects
10357 which files to optimize in LTO mode and which files to link without
10358 further processing.
10359
10360 Generally, options specified at link time override those
10361 specified at compile time, although in some cases GCC attempts to infer
10362 link-time options from the settings used to compile the input files.
10363
10364 If you do not specify an optimization level option @option{-O} at
10365 link time, then GCC uses the highest optimization level
10366 used when compiling the object files. Note that it is generally
10367 ineffective to specify an optimization level option only at link time and
10368 not at compile time, for two reasons. First, compiling without
10369 optimization suppresses compiler passes that gather information
10370 needed for effective optimization at link time. Second, some early
10371 optimization passes can be performed only at compile time and
10372 not at link time.
10373
10374 There are some code generation flags preserved by GCC when
10375 generating bytecodes, as they need to be used during the final link.
10376 Currently, the following options and their settings are taken from
10377 the first object file that explicitly specifies them:
10378 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10379 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10380 and all the @option{-m} target flags.
10381
10382 Certain ABI-changing flags are required to match in all compilation units,
10383 and trying to override this at link time with a conflicting value
10384 is ignored. This includes options such as @option{-freg-struct-return}
10385 and @option{-fpcc-struct-return}.
10386
10387 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10388 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10389 are passed through to the link stage and merged conservatively for
10390 conflicting translation units. Specifically
10391 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10392 precedence; and for example @option{-ffp-contract=off} takes precedence
10393 over @option{-ffp-contract=fast}. You can override them at link time.
10394
10395 To enable debug info generation you need to supply @option{-g} at
10396 compile-time. If any of the input files at link time were built
10397 with debug info generation enabled the link will enable debug info
10398 generation as well. Any elaborate debug info settings
10399 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
10400 at the linker command line and mixing different settings in different
10401 translation units is discouraged.
10402
10403 If LTO encounters objects with C linkage declared with incompatible
10404 types in separate translation units to be linked together (undefined
10405 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10406 issued. The behavior is still undefined at run time. Similar
10407 diagnostics may be raised for other languages.
10408
10409 Another feature of LTO is that it is possible to apply interprocedural
10410 optimizations on files written in different languages:
10411
10412 @smallexample
10413 gcc -c -flto foo.c
10414 g++ -c -flto bar.cc
10415 gfortran -c -flto baz.f90
10416 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10417 @end smallexample
10418
10419 Notice that the final link is done with @command{g++} to get the C++
10420 runtime libraries and @option{-lgfortran} is added to get the Fortran
10421 runtime libraries. In general, when mixing languages in LTO mode, you
10422 should use the same link command options as when mixing languages in a
10423 regular (non-LTO) compilation.
10424
10425 If object files containing GIMPLE bytecode are stored in a library archive, say
10426 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10427 are using a linker with plugin support. To create static libraries suitable
10428 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10429 and @command{ranlib};
10430 to show the symbols of object files with GIMPLE bytecode, use
10431 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10432 and @command{nm} have been compiled with plugin support. At link time, use the
10433 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10434 the LTO optimization process:
10435
10436 @smallexample
10437 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10438 @end smallexample
10439
10440 With the linker plugin enabled, the linker extracts the needed
10441 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10442 to make them part of the aggregated GIMPLE image to be optimized.
10443
10444 If you are not using a linker with plugin support and/or do not
10445 enable the linker plugin, then the objects inside @file{libfoo.a}
10446 are extracted and linked as usual, but they do not participate
10447 in the LTO optimization process. In order to make a static library suitable
10448 for both LTO optimization and usual linkage, compile its object files with
10449 @option{-flto} @option{-ffat-lto-objects}.
10450
10451 Link-time optimizations do not require the presence of the whole program to
10452 operate. If the program does not require any symbols to be exported, it is
10453 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10454 the interprocedural optimizers to use more aggressive assumptions which may
10455 lead to improved optimization opportunities.
10456 Use of @option{-fwhole-program} is not needed when linker plugin is
10457 active (see @option{-fuse-linker-plugin}).
10458
10459 The current implementation of LTO makes no
10460 attempt to generate bytecode that is portable between different
10461 types of hosts. The bytecode files are versioned and there is a
10462 strict version check, so bytecode files generated in one version of
10463 GCC do not work with an older or newer version of GCC.
10464
10465 Link-time optimization does not work well with generation of debugging
10466 information on systems other than those using a combination of ELF and
10467 DWARF.
10468
10469 If you specify the optional @var{n}, the optimization and code
10470 generation done at link time is executed in parallel using @var{n}
10471 parallel jobs by utilizing an installed @command{make} program. The
10472 environment variable @env{MAKE} may be used to override the program
10473 used.
10474
10475 You can also specify @option{-flto=jobserver} to use GNU make's
10476 job server mode to determine the number of parallel jobs. This
10477 is useful when the Makefile calling GCC is already executing in parallel.
10478 You must prepend a @samp{+} to the command recipe in the parent Makefile
10479 for this to work. This option likely only works if @env{MAKE} is
10480 GNU make. Even without the option value, GCC tries to automatically
10481 detect a running GNU make's job server.
10482
10483 Use @option{-flto=auto} to use GNU make's job server, if available,
10484 or otherwise fall back to autodetection of the number of CPU threads
10485 present in your system.
10486
10487 @item -flto-partition=@var{alg}
10488 @opindex flto-partition
10489 Specify the partitioning algorithm used by the link-time optimizer.
10490 The value is either @samp{1to1} to specify a partitioning mirroring
10491 the original source files or @samp{balanced} to specify partitioning
10492 into equally sized chunks (whenever possible) or @samp{max} to create
10493 new partition for every symbol where possible. Specifying @samp{none}
10494 as an algorithm disables partitioning and streaming completely.
10495 The default value is @samp{balanced}. While @samp{1to1} can be used
10496 as an workaround for various code ordering issues, the @samp{max}
10497 partitioning is intended for internal testing only.
10498 The value @samp{one} specifies that exactly one partition should be
10499 used while the value @samp{none} bypasses partitioning and executes
10500 the link-time optimization step directly from the WPA phase.
10501
10502 @item -flto-compression-level=@var{n}
10503 @opindex flto-compression-level
10504 This option specifies the level of compression used for intermediate
10505 language written to LTO object files, and is only meaningful in
10506 conjunction with LTO mode (@option{-flto}). Valid
10507 values are 0 (no compression) to 9 (maximum compression). Values
10508 outside this range are clamped to either 0 or 9. If the option is not
10509 given, a default balanced compression setting is used.
10510
10511 @item -fuse-linker-plugin
10512 @opindex fuse-linker-plugin
10513 Enables the use of a linker plugin during link-time optimization. This
10514 option relies on plugin support in the linker, which is available in gold
10515 or in GNU ld 2.21 or newer.
10516
10517 This option enables the extraction of object files with GIMPLE bytecode out
10518 of library archives. This improves the quality of optimization by exposing
10519 more code to the link-time optimizer. This information specifies what
10520 symbols can be accessed externally (by non-LTO object or during dynamic
10521 linking). Resulting code quality improvements on binaries (and shared
10522 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10523 See @option{-flto} for a description of the effect of this flag and how to
10524 use it.
10525
10526 This option is enabled by default when LTO support in GCC is enabled
10527 and GCC was configured for use with
10528 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10529
10530 @item -ffat-lto-objects
10531 @opindex ffat-lto-objects
10532 Fat LTO objects are object files that contain both the intermediate language
10533 and the object code. This makes them usable for both LTO linking and normal
10534 linking. This option is effective only when compiling with @option{-flto}
10535 and is ignored at link time.
10536
10537 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10538 requires the complete toolchain to be aware of LTO. It requires a linker with
10539 linker plugin support for basic functionality. Additionally,
10540 @command{nm}, @command{ar} and @command{ranlib}
10541 need to support linker plugins to allow a full-featured build environment
10542 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10543 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10544 to these tools. With non fat LTO makefiles need to be modified to use them.
10545
10546 Note that modern binutils provide plugin auto-load mechanism.
10547 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10548 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10549 @command{gcc-ranlib}).
10550
10551 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10552 support.
10553
10554 @item -fcompare-elim
10555 @opindex fcompare-elim
10556 After register allocation and post-register allocation instruction splitting,
10557 identify arithmetic instructions that compute processor flags similar to a
10558 comparison operation based on that arithmetic. If possible, eliminate the
10559 explicit comparison operation.
10560
10561 This pass only applies to certain targets that cannot explicitly represent
10562 the comparison operation before register allocation is complete.
10563
10564 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10565
10566 @item -fcprop-registers
10567 @opindex fcprop-registers
10568 After register allocation and post-register allocation instruction splitting,
10569 perform a copy-propagation pass to try to reduce scheduling dependencies
10570 and occasionally eliminate the copy.
10571
10572 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10573
10574 @item -fprofile-correction
10575 @opindex fprofile-correction
10576 Profiles collected using an instrumented binary for multi-threaded programs may
10577 be inconsistent due to missed counter updates. When this option is specified,
10578 GCC uses heuristics to correct or smooth out such inconsistencies. By
10579 default, GCC emits an error message when an inconsistent profile is detected.
10580
10581 This option is enabled by @option{-fauto-profile}.
10582
10583 @item -fprofile-use
10584 @itemx -fprofile-use=@var{path}
10585 @opindex fprofile-use
10586 Enable profile feedback-directed optimizations,
10587 and the following optimizations, many of which
10588 are generally profitable only with profile feedback available:
10589
10590 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10591 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10592 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10593 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10594 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10595 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10596 -fprofile-reorder-functions}
10597
10598 Before you can use this option, you must first generate profiling information.
10599 @xref{Instrumentation Options}, for information about the
10600 @option{-fprofile-generate} option.
10601
10602 By default, GCC emits an error message if the feedback profiles do not
10603 match the source code. This error can be turned into a warning by using
10604 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10605 optimized code. Additionally, by default, GCC also emits a warning message if
10606 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10607
10608 If @var{path} is specified, GCC looks at the @var{path} to find
10609 the profile feedback data files. See @option{-fprofile-dir}.
10610
10611 @item -fauto-profile
10612 @itemx -fauto-profile=@var{path}
10613 @opindex fauto-profile
10614 Enable sampling-based feedback-directed optimizations,
10615 and the following optimizations,
10616 many of which are generally profitable only with profile feedback available:
10617
10618 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10619 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10620 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10621 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10622 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10623 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10624 -fprofile-correction}
10625
10626 @var{path} is the name of a file containing AutoFDO profile information.
10627 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10628
10629 Producing an AutoFDO profile data file requires running your program
10630 with the @command{perf} utility on a supported GNU/Linux target system.
10631 For more information, see @uref{https://perf.wiki.kernel.org/}.
10632
10633 E.g.
10634 @smallexample
10635 perf record -e br_inst_retired:near_taken -b -o perf.data \
10636 -- your_program
10637 @end smallexample
10638
10639 Then use the @command{create_gcov} tool to convert the raw profile data
10640 to a format that can be used by GCC.@ You must also supply the
10641 unstripped binary for your program to this tool.
10642 See @uref{https://github.com/google/autofdo}.
10643
10644 E.g.
10645 @smallexample
10646 create_gcov --binary=your_program.unstripped --profile=perf.data \
10647 --gcov=profile.afdo
10648 @end smallexample
10649 @end table
10650
10651 The following options control compiler behavior regarding floating-point
10652 arithmetic. These options trade off between speed and
10653 correctness. All must be specifically enabled.
10654
10655 @table @gcctabopt
10656 @item -ffloat-store
10657 @opindex ffloat-store
10658 Do not store floating-point variables in registers, and inhibit other
10659 options that might change whether a floating-point value is taken from a
10660 register or memory.
10661
10662 @cindex floating-point precision
10663 This option prevents undesirable excess precision on machines such as
10664 the 68000 where the floating registers (of the 68881) keep more
10665 precision than a @code{double} is supposed to have. Similarly for the
10666 x86 architecture. For most programs, the excess precision does only
10667 good, but a few programs rely on the precise definition of IEEE floating
10668 point. Use @option{-ffloat-store} for such programs, after modifying
10669 them to store all pertinent intermediate computations into variables.
10670
10671 @item -fexcess-precision=@var{style}
10672 @opindex fexcess-precision
10673 This option allows further control over excess precision on machines
10674 where floating-point operations occur in a format with more precision or
10675 range than the IEEE standard and interchange floating-point types. By
10676 default, @option{-fexcess-precision=fast} is in effect; this means that
10677 operations may be carried out in a wider precision than the types specified
10678 in the source if that would result in faster code, and it is unpredictable
10679 when rounding to the types specified in the source code takes place.
10680 When compiling C, if @option{-fexcess-precision=standard} is specified then
10681 excess precision follows the rules specified in ISO C99; in particular,
10682 both casts and assignments cause values to be rounded to their
10683 semantic types (whereas @option{-ffloat-store} only affects
10684 assignments). This option is enabled by default for C if a strict
10685 conformance option such as @option{-std=c99} is used.
10686 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10687 regardless of whether a strict conformance option is used.
10688
10689 @opindex mfpmath
10690 @option{-fexcess-precision=standard} is not implemented for languages
10691 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10692 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10693 semantics apply without excess precision, and in the latter, rounding
10694 is unpredictable.
10695
10696 @item -ffast-math
10697 @opindex ffast-math
10698 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10699 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10700 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10701 @option{-fexcess-precision=fast}.
10702
10703 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10704
10705 This option is not turned on by any @option{-O} option besides
10706 @option{-Ofast} since it can result in incorrect output for programs
10707 that depend on an exact implementation of IEEE or ISO rules/specifications
10708 for math functions. It may, however, yield faster code for programs
10709 that do not require the guarantees of these specifications.
10710
10711 @item -fno-math-errno
10712 @opindex fno-math-errno
10713 @opindex fmath-errno
10714 Do not set @code{errno} after calling math functions that are executed
10715 with a single instruction, e.g., @code{sqrt}. A program that relies on
10716 IEEE exceptions for math error handling may want to use this flag
10717 for speed while maintaining IEEE arithmetic compatibility.
10718
10719 This option is not turned on by any @option{-O} option since
10720 it can result in incorrect output for programs that depend on
10721 an exact implementation of IEEE or ISO rules/specifications for
10722 math functions. It may, however, yield faster code for programs
10723 that do not require the guarantees of these specifications.
10724
10725 The default is @option{-fmath-errno}.
10726
10727 On Darwin systems, the math library never sets @code{errno}. There is
10728 therefore no reason for the compiler to consider the possibility that
10729 it might, and @option{-fno-math-errno} is the default.
10730
10731 @item -funsafe-math-optimizations
10732 @opindex funsafe-math-optimizations
10733
10734 Allow optimizations for floating-point arithmetic that (a) assume
10735 that arguments and results are valid and (b) may violate IEEE or
10736 ANSI standards. When used at link time, it may include libraries
10737 or startup files that change the default FPU control word or other
10738 similar optimizations.
10739
10740 This option is not turned on by any @option{-O} option since
10741 it can result in incorrect output for programs that depend on
10742 an exact implementation of IEEE or ISO rules/specifications for
10743 math functions. It may, however, yield faster code for programs
10744 that do not require the guarantees of these specifications.
10745 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10746 @option{-fassociative-math} and @option{-freciprocal-math}.
10747
10748 The default is @option{-fno-unsafe-math-optimizations}.
10749
10750 @item -fassociative-math
10751 @opindex fassociative-math
10752
10753 Allow re-association of operands in series of floating-point operations.
10754 This violates the ISO C and C++ language standard by possibly changing
10755 computation result. NOTE: re-ordering may change the sign of zero as
10756 well as ignore NaNs and inhibit or create underflow or overflow (and
10757 thus cannot be used on code that relies on rounding behavior like
10758 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10759 and thus may not be used when ordered comparisons are required.
10760 This option requires that both @option{-fno-signed-zeros} and
10761 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10762 much sense with @option{-frounding-math}. For Fortran the option
10763 is automatically enabled when both @option{-fno-signed-zeros} and
10764 @option{-fno-trapping-math} are in effect.
10765
10766 The default is @option{-fno-associative-math}.
10767
10768 @item -freciprocal-math
10769 @opindex freciprocal-math
10770
10771 Allow the reciprocal of a value to be used instead of dividing by
10772 the value if this enables optimizations. For example @code{x / y}
10773 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10774 is subject to common subexpression elimination. Note that this loses
10775 precision and increases the number of flops operating on the value.
10776
10777 The default is @option{-fno-reciprocal-math}.
10778
10779 @item -ffinite-math-only
10780 @opindex ffinite-math-only
10781 Allow optimizations for floating-point arithmetic that assume
10782 that arguments and results are not NaNs or +-Infs.
10783
10784 This option is not turned on by any @option{-O} option since
10785 it can result in incorrect output for programs that depend on
10786 an exact implementation of IEEE or ISO rules/specifications for
10787 math functions. It may, however, yield faster code for programs
10788 that do not require the guarantees of these specifications.
10789
10790 The default is @option{-fno-finite-math-only}.
10791
10792 @item -fno-signed-zeros
10793 @opindex fno-signed-zeros
10794 @opindex fsigned-zeros
10795 Allow optimizations for floating-point arithmetic that ignore the
10796 signedness of zero. IEEE arithmetic specifies the behavior of
10797 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10798 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10799 This option implies that the sign of a zero result isn't significant.
10800
10801 The default is @option{-fsigned-zeros}.
10802
10803 @item -fno-trapping-math
10804 @opindex fno-trapping-math
10805 @opindex ftrapping-math
10806 Compile code assuming that floating-point operations cannot generate
10807 user-visible traps. These traps include division by zero, overflow,
10808 underflow, inexact result and invalid operation. This option requires
10809 that @option{-fno-signaling-nans} be in effect. Setting this option may
10810 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10811
10812 This option should never be turned on by any @option{-O} option since
10813 it can result in incorrect output for programs that depend on
10814 an exact implementation of IEEE or ISO rules/specifications for
10815 math functions.
10816
10817 The default is @option{-ftrapping-math}.
10818
10819 @item -frounding-math
10820 @opindex frounding-math
10821 Disable transformations and optimizations that assume default floating-point
10822 rounding behavior. This is round-to-zero for all floating point
10823 to integer conversions, and round-to-nearest for all other arithmetic
10824 truncations. This option should be specified for programs that change
10825 the FP rounding mode dynamically, or that may be executed with a
10826 non-default rounding mode. This option disables constant folding of
10827 floating-point expressions at compile time (which may be affected by
10828 rounding mode) and arithmetic transformations that are unsafe in the
10829 presence of sign-dependent rounding modes.
10830
10831 The default is @option{-fno-rounding-math}.
10832
10833 This option is experimental and does not currently guarantee to
10834 disable all GCC optimizations that are affected by rounding mode.
10835 Future versions of GCC may provide finer control of this setting
10836 using C99's @code{FENV_ACCESS} pragma. This command-line option
10837 will be used to specify the default state for @code{FENV_ACCESS}.
10838
10839 @item -fsignaling-nans
10840 @opindex fsignaling-nans
10841 Compile code assuming that IEEE signaling NaNs may generate user-visible
10842 traps during floating-point operations. Setting this option disables
10843 optimizations that may change the number of exceptions visible with
10844 signaling NaNs. This option implies @option{-ftrapping-math}.
10845
10846 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10847 be defined.
10848
10849 The default is @option{-fno-signaling-nans}.
10850
10851 This option is experimental and does not currently guarantee to
10852 disable all GCC optimizations that affect signaling NaN behavior.
10853
10854 @item -fno-fp-int-builtin-inexact
10855 @opindex fno-fp-int-builtin-inexact
10856 @opindex ffp-int-builtin-inexact
10857 Do not allow the built-in functions @code{ceil}, @code{floor},
10858 @code{round} and @code{trunc}, and their @code{float} and @code{long
10859 double} variants, to generate code that raises the ``inexact''
10860 floating-point exception for noninteger arguments. ISO C99 and C11
10861 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10862 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
10863 ISO C2X, does not allow these functions to do so.
10864
10865 The default is @option{-ffp-int-builtin-inexact}, allowing the
10866 exception to be raised, unless C2X or a later C standard is selected.
10867 This option does nothing unless @option{-ftrapping-math} is in effect.
10868
10869 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10870 generate a call to a library function then the ``inexact'' exception
10871 may be raised if the library implementation does not follow TS 18661.
10872
10873 @item -fsingle-precision-constant
10874 @opindex fsingle-precision-constant
10875 Treat floating-point constants as single precision instead of
10876 implicitly converting them to double-precision constants.
10877
10878 @item -fcx-limited-range
10879 @opindex fcx-limited-range
10880 When enabled, this option states that a range reduction step is not
10881 needed when performing complex division. Also, there is no checking
10882 whether the result of a complex multiplication or division is @code{NaN
10883 + I*NaN}, with an attempt to rescue the situation in that case. The
10884 default is @option{-fno-cx-limited-range}, but is enabled by
10885 @option{-ffast-math}.
10886
10887 This option controls the default setting of the ISO C99
10888 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10889 all languages.
10890
10891 @item -fcx-fortran-rules
10892 @opindex fcx-fortran-rules
10893 Complex multiplication and division follow Fortran rules. Range
10894 reduction is done as part of complex division, but there is no checking
10895 whether the result of a complex multiplication or division is @code{NaN
10896 + I*NaN}, with an attempt to rescue the situation in that case.
10897
10898 The default is @option{-fno-cx-fortran-rules}.
10899
10900 @end table
10901
10902 The following options control optimizations that may improve
10903 performance, but are not enabled by any @option{-O} options. This
10904 section includes experimental options that may produce broken code.
10905
10906 @table @gcctabopt
10907 @item -fbranch-probabilities
10908 @opindex fbranch-probabilities
10909 After running a program compiled with @option{-fprofile-arcs}
10910 (@pxref{Instrumentation Options}),
10911 you can compile it a second time using
10912 @option{-fbranch-probabilities}, to improve optimizations based on
10913 the number of times each branch was taken. When a program
10914 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10915 counts to a file called @file{@var{sourcename}.gcda} for each source
10916 file. The information in this data file is very dependent on the
10917 structure of the generated code, so you must use the same source code
10918 and the same optimization options for both compilations.
10919
10920 With @option{-fbranch-probabilities}, GCC puts a
10921 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10922 These can be used to improve optimization. Currently, they are only
10923 used in one place: in @file{reorg.c}, instead of guessing which path a
10924 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10925 exactly determine which path is taken more often.
10926
10927 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10928
10929 @item -fprofile-values
10930 @opindex fprofile-values
10931 If combined with @option{-fprofile-arcs}, it adds code so that some
10932 data about values of expressions in the program is gathered.
10933
10934 With @option{-fbranch-probabilities}, it reads back the data gathered
10935 from profiling values of expressions for usage in optimizations.
10936
10937 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10938 @option{-fauto-profile}.
10939
10940 @item -fprofile-reorder-functions
10941 @opindex fprofile-reorder-functions
10942 Function reordering based on profile instrumentation collects
10943 first time of execution of a function and orders these functions
10944 in ascending order.
10945
10946 Enabled with @option{-fprofile-use}.
10947
10948 @item -fvpt
10949 @opindex fvpt
10950 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10951 to add code to gather information about values of expressions.
10952
10953 With @option{-fbranch-probabilities}, it reads back the data gathered
10954 and actually performs the optimizations based on them.
10955 Currently the optimizations include specialization of division operations
10956 using the knowledge about the value of the denominator.
10957
10958 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10959
10960 @item -frename-registers
10961 @opindex frename-registers
10962 Attempt to avoid false dependencies in scheduled code by making use
10963 of registers left over after register allocation. This optimization
10964 most benefits processors with lots of registers. Depending on the
10965 debug information format adopted by the target, however, it can
10966 make debugging impossible, since variables no longer stay in
10967 a ``home register''.
10968
10969 Enabled by default with @option{-funroll-loops}.
10970
10971 @item -fschedule-fusion
10972 @opindex fschedule-fusion
10973 Performs a target dependent pass over the instruction stream to schedule
10974 instructions of same type together because target machine can execute them
10975 more efficiently if they are adjacent to each other in the instruction flow.
10976
10977 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10978
10979 @item -ftracer
10980 @opindex ftracer
10981 Perform tail duplication to enlarge superblock size. This transformation
10982 simplifies the control flow of the function allowing other optimizations to do
10983 a better job.
10984
10985 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10986
10987 @item -funroll-loops
10988 @opindex funroll-loops
10989 Unroll loops whose number of iterations can be determined at compile time or
10990 upon entry to the loop. @option{-funroll-loops} implies
10991 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10992 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10993 a small constant number of iterations). This option makes code larger, and may
10994 or may not make it run faster.
10995
10996 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10997
10998 @item -funroll-all-loops
10999 @opindex funroll-all-loops
11000 Unroll all loops, even if their number of iterations is uncertain when
11001 the loop is entered. This usually makes programs run more slowly.
11002 @option{-funroll-all-loops} implies the same options as
11003 @option{-funroll-loops}.
11004
11005 @item -fpeel-loops
11006 @opindex fpeel-loops
11007 Peels loops for which there is enough information that they do not
11008 roll much (from profile feedback or static analysis). It also turns on
11009 complete loop peeling (i.e.@: complete removal of loops with small constant
11010 number of iterations).
11011
11012 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
11013
11014 @item -fmove-loop-invariants
11015 @opindex fmove-loop-invariants
11016 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
11017 at level @option{-O1} and higher, except for @option{-Og}.
11018
11019 @item -fsplit-loops
11020 @opindex fsplit-loops
11021 Split a loop into two if it contains a condition that's always true
11022 for one side of the iteration space and false for the other.
11023
11024 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11025
11026 @item -funswitch-loops
11027 @opindex funswitch-loops
11028 Move branches with loop invariant conditions out of the loop, with duplicates
11029 of the loop on both branches (modified according to result of the condition).
11030
11031 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11032
11033 @item -fversion-loops-for-strides
11034 @opindex fversion-loops-for-strides
11035 If a loop iterates over an array with a variable stride, create another
11036 version of the loop that assumes the stride is always one. For example:
11037
11038 @smallexample
11039 for (int i = 0; i < n; ++i)
11040 x[i * stride] = @dots{};
11041 @end smallexample
11042
11043 becomes:
11044
11045 @smallexample
11046 if (stride == 1)
11047 for (int i = 0; i < n; ++i)
11048 x[i] = @dots{};
11049 else
11050 for (int i = 0; i < n; ++i)
11051 x[i * stride] = @dots{};
11052 @end smallexample
11053
11054 This is particularly useful for assumed-shape arrays in Fortran where
11055 (for example) it allows better vectorization assuming contiguous accesses.
11056 This flag is enabled by default at @option{-O3}.
11057 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11058
11059 @item -ffunction-sections
11060 @itemx -fdata-sections
11061 @opindex ffunction-sections
11062 @opindex fdata-sections
11063 Place each function or data item into its own section in the output
11064 file if the target supports arbitrary sections. The name of the
11065 function or the name of the data item determines the section's name
11066 in the output file.
11067
11068 Use these options on systems where the linker can perform optimizations to
11069 improve locality of reference in the instruction space. Most systems using the
11070 ELF object format have linkers with such optimizations. On AIX, the linker
11071 rearranges sections (CSECTs) based on the call graph. The performance impact
11072 varies.
11073
11074 Together with a linker garbage collection (linker @option{--gc-sections}
11075 option) these options may lead to smaller statically-linked executables (after
11076 stripping).
11077
11078 On ELF/DWARF systems these options do not degenerate the quality of the debug
11079 information. There could be issues with other object files/debug info formats.
11080
11081 Only use these options when there are significant benefits from doing so. When
11082 you specify these options, the assembler and linker create larger object and
11083 executable files and are also slower. These options affect code generation.
11084 They prevent optimizations by the compiler and assembler using relative
11085 locations inside a translation unit since the locations are unknown until
11086 link time. An example of such an optimization is relaxing calls to short call
11087 instructions.
11088
11089 @item -fstdarg-opt
11090 @opindex fstdarg-opt
11091 Optimize the prologue of variadic argument functions with respect to usage of
11092 those arguments.
11093
11094 @item -fsection-anchors
11095 @opindex fsection-anchors
11096 Try to reduce the number of symbolic address calculations by using
11097 shared ``anchor'' symbols to address nearby objects. This transformation
11098 can help to reduce the number of GOT entries and GOT accesses on some
11099 targets.
11100
11101 For example, the implementation of the following function @code{foo}:
11102
11103 @smallexample
11104 static int a, b, c;
11105 int foo (void) @{ return a + b + c; @}
11106 @end smallexample
11107
11108 @noindent
11109 usually calculates the addresses of all three variables, but if you
11110 compile it with @option{-fsection-anchors}, it accesses the variables
11111 from a common anchor point instead. The effect is similar to the
11112 following pseudocode (which isn't valid C):
11113
11114 @smallexample
11115 int foo (void)
11116 @{
11117 register int *xr = &x;
11118 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11119 @}
11120 @end smallexample
11121
11122 Not all targets support this option.
11123
11124 @item --param @var{name}=@var{value}
11125 @opindex param
11126 In some places, GCC uses various constants to control the amount of
11127 optimization that is done. For example, GCC does not inline functions
11128 that contain more than a certain number of instructions. You can
11129 control some of these constants on the command line using the
11130 @option{--param} option.
11131
11132 The names of specific parameters, and the meaning of the values, are
11133 tied to the internals of the compiler, and are subject to change
11134 without notice in future releases.
11135
11136 In order to get minimal, maximal and default value of a parameter,
11137 one can use @option{--help=param -Q} options.
11138
11139 In each case, the @var{value} is an integer. The allowable choices for
11140 @var{name} are:
11141
11142 @table @gcctabopt
11143 @item predictable-branch-outcome
11144 When branch is predicted to be taken with probability lower than this threshold
11145 (in percent), then it is considered well predictable.
11146
11147 @item max-rtl-if-conversion-insns
11148 RTL if-conversion tries to remove conditional branches around a block and
11149 replace them with conditionally executed instructions. This parameter
11150 gives the maximum number of instructions in a block which should be
11151 considered for if-conversion. The compiler will
11152 also use other heuristics to decide whether if-conversion is likely to be
11153 profitable.
11154
11155 @item max-rtl-if-conversion-predictable-cost
11156 @itemx max-rtl-if-conversion-unpredictable-cost
11157 RTL if-conversion will try to remove conditional branches around a block
11158 and replace them with conditionally executed instructions. These parameters
11159 give the maximum permissible cost for the sequence that would be generated
11160 by if-conversion depending on whether the branch is statically determined
11161 to be predictable or not. The units for this parameter are the same as
11162 those for the GCC internal seq_cost metric. The compiler will try to
11163 provide a reasonable default for this parameter using the BRANCH_COST
11164 target macro.
11165
11166 @item max-crossjump-edges
11167 The maximum number of incoming edges to consider for cross-jumping.
11168 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11169 the number of edges incoming to each block. Increasing values mean
11170 more aggressive optimization, making the compilation time increase with
11171 probably small improvement in executable size.
11172
11173 @item min-crossjump-insns
11174 The minimum number of instructions that must be matched at the end
11175 of two blocks before cross-jumping is performed on them. This
11176 value is ignored in the case where all instructions in the block being
11177 cross-jumped from are matched.
11178
11179 @item max-grow-copy-bb-insns
11180 The maximum code size expansion factor when copying basic blocks
11181 instead of jumping. The expansion is relative to a jump instruction.
11182
11183 @item max-goto-duplication-insns
11184 The maximum number of instructions to duplicate to a block that jumps
11185 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11186 passes, GCC factors computed gotos early in the compilation process,
11187 and unfactors them as late as possible. Only computed jumps at the
11188 end of a basic blocks with no more than max-goto-duplication-insns are
11189 unfactored.
11190
11191 @item max-delay-slot-insn-search
11192 The maximum number of instructions to consider when looking for an
11193 instruction to fill a delay slot. If more than this arbitrary number of
11194 instructions are searched, the time savings from filling the delay slot
11195 are minimal, so stop searching. Increasing values mean more
11196 aggressive optimization, making the compilation time increase with probably
11197 small improvement in execution time.
11198
11199 @item max-delay-slot-live-search
11200 When trying to fill delay slots, the maximum number of instructions to
11201 consider when searching for a block with valid live register
11202 information. Increasing this arbitrarily chosen value means more
11203 aggressive optimization, increasing the compilation time. This parameter
11204 should be removed when the delay slot code is rewritten to maintain the
11205 control-flow graph.
11206
11207 @item max-gcse-memory
11208 The approximate maximum amount of memory that can be allocated in
11209 order to perform the global common subexpression elimination
11210 optimization. If more memory than specified is required, the
11211 optimization is not done.
11212
11213 @item max-gcse-insertion-ratio
11214 If the ratio of expression insertions to deletions is larger than this value
11215 for any expression, then RTL PRE inserts or removes the expression and thus
11216 leaves partially redundant computations in the instruction stream.
11217
11218 @item max-pending-list-length
11219 The maximum number of pending dependencies scheduling allows
11220 before flushing the current state and starting over. Large functions
11221 with few branches or calls can create excessively large lists which
11222 needlessly consume memory and resources.
11223
11224 @item max-modulo-backtrack-attempts
11225 The maximum number of backtrack attempts the scheduler should make
11226 when modulo scheduling a loop. Larger values can exponentially increase
11227 compilation time.
11228
11229 @item max-inline-insns-single
11230 @item max-inline-insns-single-O2
11231 Several parameters control the tree inliner used in GCC@. This number sets the
11232 maximum number of instructions (counted in GCC's internal representation) in a
11233 single function that the tree inliner considers for inlining. This only
11234 affects functions declared inline and methods implemented in a class
11235 declaration (C++).
11236
11237 For functions compiled with optimization levels
11238 @option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-single} is
11239 applied. In other cases @option{max-inline-insns-single-O2} is applied.
11240
11241
11242 @item max-inline-insns-auto
11243 @item max-inline-insns-auto-O2
11244 When you use @option{-finline-functions} (included in @option{-O3}),
11245 a lot of functions that would otherwise not be considered for inlining
11246 by the compiler are investigated. To those functions, a different
11247 (more restrictive) limit compared to functions declared inline can
11248 be applied.
11249
11250 For functions compiled with optimization levels
11251 @option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-auto} is
11252 applied. In other cases @option{max-inline-insns-auto-O2} is applied.
11253
11254 @item max-inline-insns-small
11255 This is bound applied to calls which are considered relevant with
11256 @option{-finline-small-functions}.
11257
11258 @item max-inline-insns-size
11259 This is bound applied to calls which are optimized for size. Small growth
11260 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11261
11262 @item uninlined-function-insns
11263 Number of instructions accounted by inliner for function overhead such as
11264 function prologue and epilogue.
11265
11266 @item uninlined-function-time
11267 Extra time accounted by inliner for function overhead such as time needed to
11268 execute function prologue and epilogue
11269
11270 @item inline-heuristics-hint-percent
11271 @item inline-heuristics-hint-percent-O2
11272 The scale (in percents) applied to @option{inline-insns-single},
11273 @option{inline-insns-single-O2}, @option{inline-insns-auto},
11274 @option{inline-insns-auto-O2} when inline heuristics hints that inlining is
11275 very profitable (will enable later optimizations).
11276
11277 For functions compiled with optimization levels
11278 @option{-O3} and @option{-Ofast} parameter
11279 @option{inline-heuristics-hint-percent} is applied. In other cases
11280 @option{inline-heuristics-hint-percent-O2} is applied.
11281
11282 @item uninlined-thunk-insns
11283 @item uninlined-thunk-time
11284 Same as @option{--param uninlined-function-insns} and
11285 @option{--param uninlined-function-time} but applied to function thunks
11286
11287 @item inline-min-speedup
11288 @item inline-min-speedup-O2
11289 When estimated performance improvement of caller + callee runtime exceeds this
11290 threshold (in percent), the function can be inlined regardless of the limit on
11291 @option{--param max-inline-insns-single} and @option{--param
11292 max-inline-insns-auto}.
11293
11294 For functions compiled with optimization levels
11295 @option{-O3} and @option{-Ofast} parameter @option{inline-min-speedup} is
11296 applied. In other cases @option{inline-min-speedup-O2} is applied.
11297
11298 @item large-function-insns
11299 The limit specifying really large functions. For functions larger than this
11300 limit after inlining, inlining is constrained by
11301 @option{--param large-function-growth}. This parameter is useful primarily
11302 to avoid extreme compilation time caused by non-linear algorithms used by the
11303 back end.
11304
11305 @item large-function-growth
11306 Specifies maximal growth of large function caused by inlining in percents.
11307 For example, parameter value 100 limits large function growth to 2.0 times
11308 the original size.
11309
11310 @item large-unit-insns
11311 The limit specifying large translation unit. Growth caused by inlining of
11312 units larger than this limit is limited by @option{--param inline-unit-growth}.
11313 For small units this might be too tight.
11314 For example, consider a unit consisting of function A
11315 that is inline and B that just calls A three times. If B is small relative to
11316 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11317 large units consisting of small inlineable functions, however, the overall unit
11318 growth limit is needed to avoid exponential explosion of code size. Thus for
11319 smaller units, the size is increased to @option{--param large-unit-insns}
11320 before applying @option{--param inline-unit-growth}.
11321
11322 @item inline-unit-growth
11323 Specifies maximal overall growth of the compilation unit caused by inlining.
11324 For example, parameter value 20 limits unit growth to 1.2 times the original
11325 size. Cold functions (either marked cold via an attribute or by profile
11326 feedback) are not accounted into the unit size.
11327
11328 @item ipcp-unit-growth
11329 Specifies maximal overall growth of the compilation unit caused by
11330 interprocedural constant propagation. For example, parameter value 10 limits
11331 unit growth to 1.1 times the original size.
11332
11333 @item large-stack-frame
11334 The limit specifying large stack frames. While inlining the algorithm is trying
11335 to not grow past this limit too much.
11336
11337 @item large-stack-frame-growth
11338 Specifies maximal growth of large stack frames caused by inlining in percents.
11339 For example, parameter value 1000 limits large stack frame growth to 11 times
11340 the original size.
11341
11342 @item max-inline-insns-recursive
11343 @itemx max-inline-insns-recursive-auto
11344 Specifies the maximum number of instructions an out-of-line copy of a
11345 self-recursive inline
11346 function can grow into by performing recursive inlining.
11347
11348 @option{--param max-inline-insns-recursive} applies to functions
11349 declared inline.
11350 For functions not declared inline, recursive inlining
11351 happens only when @option{-finline-functions} (included in @option{-O3}) is
11352 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11353
11354 @item max-inline-recursive-depth
11355 @itemx max-inline-recursive-depth-auto
11356 Specifies the maximum recursion depth used for recursive inlining.
11357
11358 @option{--param max-inline-recursive-depth} applies to functions
11359 declared inline. For functions not declared inline, recursive inlining
11360 happens only when @option{-finline-functions} (included in @option{-O3}) is
11361 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11362
11363 @item min-inline-recursive-probability
11364 Recursive inlining is profitable only for function having deep recursion
11365 in average and can hurt for function having little recursion depth by
11366 increasing the prologue size or complexity of function body to other
11367 optimizers.
11368
11369 When profile feedback is available (see @option{-fprofile-generate}) the actual
11370 recursion depth can be guessed from the probability that function recurses
11371 via a given call expression. This parameter limits inlining only to call
11372 expressions whose probability exceeds the given threshold (in percents).
11373
11374 @item early-inlining-insns
11375 @item early-inlining-insns-O2
11376 Specify growth that the early inliner can make. In effect it increases
11377 the amount of inlining for code having a large abstraction penalty.
11378
11379 For functions compiled with optimization levels
11380 @option{-O3} and @option{-Ofast} parameter @option{early-inlining-insns} is
11381 applied. In other cases @option{early-inlining-insns-O2} is applied.
11382
11383 @item max-early-inliner-iterations
11384 Limit of iterations of the early inliner. This basically bounds
11385 the number of nested indirect calls the early inliner can resolve.
11386 Deeper chains are still handled by late inlining.
11387
11388 @item comdat-sharing-probability
11389 Probability (in percent) that C++ inline function with comdat visibility
11390 are shared across multiple compilation units.
11391
11392 @item profile-func-internal-id
11393 A parameter to control whether to use function internal id in profile
11394 database lookup. If the value is 0, the compiler uses an id that
11395 is based on function assembler name and filename, which makes old profile
11396 data more tolerant to source changes such as function reordering etc.
11397
11398 @item min-vect-loop-bound
11399 The minimum number of iterations under which loops are not vectorized
11400 when @option{-ftree-vectorize} is used. The number of iterations after
11401 vectorization needs to be greater than the value specified by this option
11402 to allow vectorization.
11403
11404 @item gcse-cost-distance-ratio
11405 Scaling factor in calculation of maximum distance an expression
11406 can be moved by GCSE optimizations. This is currently supported only in the
11407 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11408 is with simple expressions, i.e., the expressions that have cost
11409 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11410 hoisting of simple expressions.
11411
11412 @item gcse-unrestricted-cost
11413 Cost, roughly measured as the cost of a single typical machine
11414 instruction, at which GCSE optimizations do not constrain
11415 the distance an expression can travel. This is currently
11416 supported only in the code hoisting pass. The lesser the cost,
11417 the more aggressive code hoisting is. Specifying 0
11418 allows all expressions to travel unrestricted distances.
11419
11420 @item max-hoist-depth
11421 The depth of search in the dominator tree for expressions to hoist.
11422 This is used to avoid quadratic behavior in hoisting algorithm.
11423 The value of 0 does not limit on the search, but may slow down compilation
11424 of huge functions.
11425
11426 @item max-tail-merge-comparisons
11427 The maximum amount of similar bbs to compare a bb with. This is used to
11428 avoid quadratic behavior in tree tail merging.
11429
11430 @item max-tail-merge-iterations
11431 The maximum amount of iterations of the pass over the function. This is used to
11432 limit compilation time in tree tail merging.
11433
11434 @item store-merging-allow-unaligned
11435 Allow the store merging pass to introduce unaligned stores if it is legal to
11436 do so.
11437
11438 @item max-stores-to-merge
11439 The maximum number of stores to attempt to merge into wider stores in the store
11440 merging pass.
11441
11442 @item max-unrolled-insns
11443 The maximum number of instructions that a loop may have to be unrolled.
11444 If a loop is unrolled, this parameter also determines how many times
11445 the loop code is unrolled.
11446
11447 @item max-average-unrolled-insns
11448 The maximum number of instructions biased by probabilities of their execution
11449 that a loop may have to be unrolled. If a loop is unrolled,
11450 this parameter also determines how many times the loop code is unrolled.
11451
11452 @item max-unroll-times
11453 The maximum number of unrollings of a single loop.
11454
11455 @item max-peeled-insns
11456 The maximum number of instructions that a loop may have to be peeled.
11457 If a loop is peeled, this parameter also determines how many times
11458 the loop code is peeled.
11459
11460 @item max-peel-times
11461 The maximum number of peelings of a single loop.
11462
11463 @item max-peel-branches
11464 The maximum number of branches on the hot path through the peeled sequence.
11465
11466 @item max-completely-peeled-insns
11467 The maximum number of insns of a completely peeled loop.
11468
11469 @item max-completely-peel-times
11470 The maximum number of iterations of a loop to be suitable for complete peeling.
11471
11472 @item max-completely-peel-loop-nest-depth
11473 The maximum depth of a loop nest suitable for complete peeling.
11474
11475 @item max-unswitch-insns
11476 The maximum number of insns of an unswitched loop.
11477
11478 @item max-unswitch-level
11479 The maximum number of branches unswitched in a single loop.
11480
11481 @item lim-expensive
11482 The minimum cost of an expensive expression in the loop invariant motion.
11483
11484 @item iv-consider-all-candidates-bound
11485 Bound on number of candidates for induction variables, below which
11486 all candidates are considered for each use in induction variable
11487 optimizations. If there are more candidates than this,
11488 only the most relevant ones are considered to avoid quadratic time complexity.
11489
11490 @item iv-max-considered-uses
11491 The induction variable optimizations give up on loops that contain more
11492 induction variable uses.
11493
11494 @item iv-always-prune-cand-set-bound
11495 If the number of candidates in the set is smaller than this value,
11496 always try to remove unnecessary ivs from the set
11497 when adding a new one.
11498
11499 @item avg-loop-niter
11500 Average number of iterations of a loop.
11501
11502 @item dse-max-object-size
11503 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11504 Larger values may result in larger compilation times.
11505
11506 @item dse-max-alias-queries-per-store
11507 Maximum number of queries into the alias oracle per store.
11508 Larger values result in larger compilation times and may result in more
11509 removed dead stores.
11510
11511 @item scev-max-expr-size
11512 Bound on size of expressions used in the scalar evolutions analyzer.
11513 Large expressions slow the analyzer.
11514
11515 @item scev-max-expr-complexity
11516 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11517 Complex expressions slow the analyzer.
11518
11519 @item max-tree-if-conversion-phi-args
11520 Maximum number of arguments in a PHI supported by TREE if conversion
11521 unless the loop is marked with simd pragma.
11522
11523 @item vect-max-version-for-alignment-checks
11524 The maximum number of run-time checks that can be performed when
11525 doing loop versioning for alignment in the vectorizer.
11526
11527 @item vect-max-version-for-alias-checks
11528 The maximum number of run-time checks that can be performed when
11529 doing loop versioning for alias in the vectorizer.
11530
11531 @item vect-max-peeling-for-alignment
11532 The maximum number of loop peels to enhance access alignment
11533 for vectorizer. Value -1 means no limit.
11534
11535 @item max-iterations-to-track
11536 The maximum number of iterations of a loop the brute-force algorithm
11537 for analysis of the number of iterations of the loop tries to evaluate.
11538
11539 @item hot-bb-count-fraction
11540 The denominator n of fraction 1/n of the maximal execution count of a
11541 basic block in the entire program that a basic block needs to at least
11542 have in order to be considered hot. The default is 10000, which means
11543 that a basic block is considered hot if its execution count is greater
11544 than 1/10000 of the maximal execution count. 0 means that it is never
11545 considered hot. Used in non-LTO mode.
11546
11547 @item hot-bb-count-ws-permille
11548 The number of most executed permilles, ranging from 0 to 1000, of the
11549 profiled execution of the entire program to which the execution count
11550 of a basic block must be part of in order to be considered hot. The
11551 default is 990, which means that a basic block is considered hot if
11552 its execution count contributes to the upper 990 permilles, or 99.0%,
11553 of the profiled execution of the entire program. 0 means that it is
11554 never considered hot. Used in LTO mode.
11555
11556 @item hot-bb-frequency-fraction
11557 The denominator n of fraction 1/n of the execution frequency of the
11558 entry block of a function that a basic block of this function needs
11559 to at least have in order to be considered hot. The default is 1000,
11560 which means that a basic block is considered hot in a function if it
11561 is executed more frequently than 1/1000 of the frequency of the entry
11562 block of the function. 0 means that it is never considered hot.
11563
11564 @item unlikely-bb-count-fraction
11565 The denominator n of fraction 1/n of the number of profiled runs of
11566 the entire program below which the execution count of a basic block
11567 must be in order for the basic block to be considered unlikely executed.
11568 The default is 20, which means that a basic block is considered unlikely
11569 executed if it is executed in fewer than 1/20, or 5%, of the runs of
11570 the program. 0 means that it is always considered unlikely executed.
11571
11572 @item max-predicted-iterations
11573 The maximum number of loop iterations we predict statically. This is useful
11574 in cases where a function contains a single loop with known bound and
11575 another loop with unknown bound.
11576 The known number of iterations is predicted correctly, while
11577 the unknown number of iterations average to roughly 10. This means that the
11578 loop without bounds appears artificially cold relative to the other one.
11579
11580 @item builtin-expect-probability
11581 Control the probability of the expression having the specified value. This
11582 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11583
11584 @item builtin-string-cmp-inline-length
11585 The maximum length of a constant string for a builtin string cmp call
11586 eligible for inlining.
11587
11588 @item align-threshold
11589
11590 Select fraction of the maximal frequency of executions of a basic block in
11591 a function to align the basic block.
11592
11593 @item align-loop-iterations
11594
11595 A loop expected to iterate at least the selected number of iterations is
11596 aligned.
11597
11598 @item tracer-dynamic-coverage
11599 @itemx tracer-dynamic-coverage-feedback
11600
11601 This value is used to limit superblock formation once the given percentage of
11602 executed instructions is covered. This limits unnecessary code size
11603 expansion.
11604
11605 The @option{tracer-dynamic-coverage-feedback} parameter
11606 is used only when profile
11607 feedback is available. The real profiles (as opposed to statically estimated
11608 ones) are much less balanced allowing the threshold to be larger value.
11609
11610 @item tracer-max-code-growth
11611 Stop tail duplication once code growth has reached given percentage. This is
11612 a rather artificial limit, as most of the duplicates are eliminated later in
11613 cross jumping, so it may be set to much higher values than is the desired code
11614 growth.
11615
11616 @item tracer-min-branch-ratio
11617
11618 Stop reverse growth when the reverse probability of best edge is less than this
11619 threshold (in percent).
11620
11621 @item tracer-min-branch-probability
11622 @itemx tracer-min-branch-probability-feedback
11623
11624 Stop forward growth if the best edge has probability lower than this
11625 threshold.
11626
11627 Similarly to @option{tracer-dynamic-coverage} two parameters are
11628 provided. @option{tracer-min-branch-probability-feedback} is used for
11629 compilation with profile feedback and @option{tracer-min-branch-probability}
11630 compilation without. The value for compilation with profile feedback
11631 needs to be more conservative (higher) in order to make tracer
11632 effective.
11633
11634 @item stack-clash-protection-guard-size
11635 Specify the size of the operating system provided stack guard as
11636 2 raised to @var{num} bytes. Higher values may reduce the
11637 number of explicit probes, but a value larger than the operating system
11638 provided guard will leave code vulnerable to stack clash style attacks.
11639
11640 @item stack-clash-protection-probe-interval
11641 Stack clash protection involves probing stack space as it is allocated. This
11642 param controls the maximum distance between probes into the stack as 2 raised
11643 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11644 larger than the operating system provided guard will leave code vulnerable to
11645 stack clash style attacks.
11646
11647 @item max-cse-path-length
11648
11649 The maximum number of basic blocks on path that CSE considers.
11650
11651 @item max-cse-insns
11652 The maximum number of instructions CSE processes before flushing.
11653
11654 @item ggc-min-expand
11655
11656 GCC uses a garbage collector to manage its own memory allocation. This
11657 parameter specifies the minimum percentage by which the garbage
11658 collector's heap should be allowed to expand between collections.
11659 Tuning this may improve compilation speed; it has no effect on code
11660 generation.
11661
11662 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11663 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11664 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11665 GCC is not able to calculate RAM on a particular platform, the lower
11666 bound of 30% is used. Setting this parameter and
11667 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11668 every opportunity. This is extremely slow, but can be useful for
11669 debugging.
11670
11671 @item ggc-min-heapsize
11672
11673 Minimum size of the garbage collector's heap before it begins bothering
11674 to collect garbage. The first collection occurs after the heap expands
11675 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11676 tuning this may improve compilation speed, and has no effect on code
11677 generation.
11678
11679 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11680 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11681 with a lower bound of 4096 (four megabytes) and an upper bound of
11682 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11683 particular platform, the lower bound is used. Setting this parameter
11684 very large effectively disables garbage collection. Setting this
11685 parameter and @option{ggc-min-expand} to zero causes a full collection
11686 to occur at every opportunity.
11687
11688 @item max-reload-search-insns
11689 The maximum number of instruction reload should look backward for equivalent
11690 register. Increasing values mean more aggressive optimization, making the
11691 compilation time increase with probably slightly better performance.
11692
11693 @item max-cselib-memory-locations
11694 The maximum number of memory locations cselib should take into account.
11695 Increasing values mean more aggressive optimization, making the compilation time
11696 increase with probably slightly better performance.
11697
11698 @item max-sched-ready-insns
11699 The maximum number of instructions ready to be issued the scheduler should
11700 consider at any given time during the first scheduling pass. Increasing
11701 values mean more thorough searches, making the compilation time increase
11702 with probably little benefit.
11703
11704 @item max-sched-region-blocks
11705 The maximum number of blocks in a region to be considered for
11706 interblock scheduling.
11707
11708 @item max-pipeline-region-blocks
11709 The maximum number of blocks in a region to be considered for
11710 pipelining in the selective scheduler.
11711
11712 @item max-sched-region-insns
11713 The maximum number of insns in a region to be considered for
11714 interblock scheduling.
11715
11716 @item max-pipeline-region-insns
11717 The maximum number of insns in a region to be considered for
11718 pipelining in the selective scheduler.
11719
11720 @item min-spec-prob
11721 The minimum probability (in percents) of reaching a source block
11722 for interblock speculative scheduling.
11723
11724 @item max-sched-extend-regions-iters
11725 The maximum number of iterations through CFG to extend regions.
11726 A value of 0 disables region extensions.
11727
11728 @item max-sched-insn-conflict-delay
11729 The maximum conflict delay for an insn to be considered for speculative motion.
11730
11731 @item sched-spec-prob-cutoff
11732 The minimal probability of speculation success (in percents), so that
11733 speculative insns are scheduled.
11734
11735 @item sched-state-edge-prob-cutoff
11736 The minimum probability an edge must have for the scheduler to save its
11737 state across it.
11738
11739 @item sched-mem-true-dep-cost
11740 Minimal distance (in CPU cycles) between store and load targeting same
11741 memory locations.
11742
11743 @item selsched-max-lookahead
11744 The maximum size of the lookahead window of selective scheduling. It is a
11745 depth of search for available instructions.
11746
11747 @item selsched-max-sched-times
11748 The maximum number of times that an instruction is scheduled during
11749 selective scheduling. This is the limit on the number of iterations
11750 through which the instruction may be pipelined.
11751
11752 @item selsched-insns-to-rename
11753 The maximum number of best instructions in the ready list that are considered
11754 for renaming in the selective scheduler.
11755
11756 @item sms-min-sc
11757 The minimum value of stage count that swing modulo scheduler
11758 generates.
11759
11760 @item max-last-value-rtl
11761 The maximum size measured as number of RTLs that can be recorded in an expression
11762 in combiner for a pseudo register as last known value of that register.
11763
11764 @item max-combine-insns
11765 The maximum number of instructions the RTL combiner tries to combine.
11766
11767 @item integer-share-limit
11768 Small integer constants can use a shared data structure, reducing the
11769 compiler's memory usage and increasing its speed. This sets the maximum
11770 value of a shared integer constant.
11771
11772 @item ssp-buffer-size
11773 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11774 protection when @option{-fstack-protection} is used.
11775
11776 @item min-size-for-stack-sharing
11777 The minimum size of variables taking part in stack slot sharing when not
11778 optimizing.
11779
11780 @item max-jump-thread-duplication-stmts
11781 Maximum number of statements allowed in a block that needs to be
11782 duplicated when threading jumps.
11783
11784 @item max-fields-for-field-sensitive
11785 Maximum number of fields in a structure treated in
11786 a field sensitive manner during pointer analysis.
11787
11788 @item prefetch-latency
11789 Estimate on average number of instructions that are executed before
11790 prefetch finishes. The distance prefetched ahead is proportional
11791 to this constant. Increasing this number may also lead to less
11792 streams being prefetched (see @option{simultaneous-prefetches}).
11793
11794 @item simultaneous-prefetches
11795 Maximum number of prefetches that can run at the same time.
11796
11797 @item l1-cache-line-size
11798 The size of cache line in L1 data cache, in bytes.
11799
11800 @item l1-cache-size
11801 The size of L1 data cache, in kilobytes.
11802
11803 @item l2-cache-size
11804 The size of L2 data cache, in kilobytes.
11805
11806 @item prefetch-dynamic-strides
11807 Whether the loop array prefetch pass should issue software prefetch hints
11808 for strides that are non-constant. In some cases this may be
11809 beneficial, though the fact the stride is non-constant may make it
11810 hard to predict when there is clear benefit to issuing these hints.
11811
11812 Set to 1 if the prefetch hints should be issued for non-constant
11813 strides. Set to 0 if prefetch hints should be issued only for strides that
11814 are known to be constant and below @option{prefetch-minimum-stride}.
11815
11816 @item prefetch-minimum-stride
11817 Minimum constant stride, in bytes, to start using prefetch hints for. If
11818 the stride is less than this threshold, prefetch hints will not be issued.
11819
11820 This setting is useful for processors that have hardware prefetchers, in
11821 which case there may be conflicts between the hardware prefetchers and
11822 the software prefetchers. If the hardware prefetchers have a maximum
11823 stride they can handle, it should be used here to improve the use of
11824 software prefetchers.
11825
11826 A value of -1 means we don't have a threshold and therefore
11827 prefetch hints can be issued for any constant stride.
11828
11829 This setting is only useful for strides that are known and constant.
11830
11831 @item loop-interchange-max-num-stmts
11832 The maximum number of stmts in a loop to be interchanged.
11833
11834 @item loop-interchange-stride-ratio
11835 The minimum ratio between stride of two loops for interchange to be profitable.
11836
11837 @item min-insn-to-prefetch-ratio
11838 The minimum ratio between the number of instructions and the
11839 number of prefetches to enable prefetching in a loop.
11840
11841 @item prefetch-min-insn-to-mem-ratio
11842 The minimum ratio between the number of instructions and the
11843 number of memory references to enable prefetching in a loop.
11844
11845 @item use-canonical-types
11846 Whether the compiler should use the ``canonical'' type system.
11847 Should always be 1, which uses a more efficient internal
11848 mechanism for comparing types in C++ and Objective-C++. However, if
11849 bugs in the canonical type system are causing compilation failures,
11850 set this value to 0 to disable canonical types.
11851
11852 @item switch-conversion-max-branch-ratio
11853 Switch initialization conversion refuses to create arrays that are
11854 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11855 branches in the switch.
11856
11857 @item max-partial-antic-length
11858 Maximum length of the partial antic set computed during the tree
11859 partial redundancy elimination optimization (@option{-ftree-pre}) when
11860 optimizing at @option{-O3} and above. For some sorts of source code
11861 the enhanced partial redundancy elimination optimization can run away,
11862 consuming all of the memory available on the host machine. This
11863 parameter sets a limit on the length of the sets that are computed,
11864 which prevents the runaway behavior. Setting a value of 0 for
11865 this parameter allows an unlimited set length.
11866
11867 @item rpo-vn-max-loop-depth
11868 Maximum loop depth that is value-numbered optimistically.
11869 When the limit hits the innermost
11870 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11871 loop nest are value-numbered optimistically and the remaining ones not.
11872
11873 @item sccvn-max-alias-queries-per-access
11874 Maximum number of alias-oracle queries we perform when looking for
11875 redundancies for loads and stores. If this limit is hit the search
11876 is aborted and the load or store is not considered redundant. The
11877 number of queries is algorithmically limited to the number of
11878 stores on all paths from the load to the function entry.
11879
11880 @item ira-max-loops-num
11881 IRA uses regional register allocation by default. If a function
11882 contains more loops than the number given by this parameter, only at most
11883 the given number of the most frequently-executed loops form regions
11884 for regional register allocation.
11885
11886 @item ira-max-conflict-table-size
11887 Although IRA uses a sophisticated algorithm to compress the conflict
11888 table, the table can still require excessive amounts of memory for
11889 huge functions. If the conflict table for a function could be more
11890 than the size in MB given by this parameter, the register allocator
11891 instead uses a faster, simpler, and lower-quality
11892 algorithm that does not require building a pseudo-register conflict table.
11893
11894 @item ira-loop-reserved-regs
11895 IRA can be used to evaluate more accurate register pressure in loops
11896 for decisions to move loop invariants (see @option{-O3}). The number
11897 of available registers reserved for some other purposes is given
11898 by this parameter. Default of the parameter
11899 is the best found from numerous experiments.
11900
11901 @item lra-inheritance-ebb-probability-cutoff
11902 LRA tries to reuse values reloaded in registers in subsequent insns.
11903 This optimization is called inheritance. EBB is used as a region to
11904 do this optimization. The parameter defines a minimal fall-through
11905 edge probability in percentage used to add BB to inheritance EBB in
11906 LRA. The default value was chosen
11907 from numerous runs of SPEC2000 on x86-64.
11908
11909 @item loop-invariant-max-bbs-in-loop
11910 Loop invariant motion can be very expensive, both in compilation time and
11911 in amount of needed compile-time memory, with very large loops. Loops
11912 with more basic blocks than this parameter won't have loop invariant
11913 motion optimization performed on them.
11914
11915 @item loop-max-datarefs-for-datadeps
11916 Building data dependencies is expensive for very large loops. This
11917 parameter limits the number of data references in loops that are
11918 considered for data dependence analysis. These large loops are no
11919 handled by the optimizations using loop data dependencies.
11920
11921 @item max-vartrack-size
11922 Sets a maximum number of hash table slots to use during variable
11923 tracking dataflow analysis of any function. If this limit is exceeded
11924 with variable tracking at assignments enabled, analysis for that
11925 function is retried without it, after removing all debug insns from
11926 the function. If the limit is exceeded even without debug insns, var
11927 tracking analysis is completely disabled for the function. Setting
11928 the parameter to zero makes it unlimited.
11929
11930 @item max-vartrack-expr-depth
11931 Sets a maximum number of recursion levels when attempting to map
11932 variable names or debug temporaries to value expressions. This trades
11933 compilation time for more complete debug information. If this is set too
11934 low, value expressions that are available and could be represented in
11935 debug information may end up not being used; setting this higher may
11936 enable the compiler to find more complex debug expressions, but compile
11937 time and memory use may grow.
11938
11939 @item max-debug-marker-count
11940 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11941 markers) to avoid complexity explosion at inlining or expanding to RTL.
11942 If a function has more such gimple stmts than the set limit, such stmts
11943 will be dropped from the inlined copy of a function, and from its RTL
11944 expansion.
11945
11946 @item min-nondebug-insn-uid
11947 Use uids starting at this parameter for nondebug insns. The range below
11948 the parameter is reserved exclusively for debug insns created by
11949 @option{-fvar-tracking-assignments}, but debug insns may get
11950 (non-overlapping) uids above it if the reserved range is exhausted.
11951
11952 @item ipa-sra-ptr-growth-factor
11953 IPA-SRA replaces a pointer to an aggregate with one or more new
11954 parameters only when their cumulative size is less or equal to
11955 @option{ipa-sra-ptr-growth-factor} times the size of the original
11956 pointer parameter.
11957
11958 @item ipa-sra-max-replacements
11959 Maximum pieces of an aggregate that IPA-SRA tracks. As a
11960 consequence, it is also the maximum number of replacements of a formal
11961 parameter.
11962
11963 @item sra-max-scalarization-size-Ospeed
11964 @itemx sra-max-scalarization-size-Osize
11965 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11966 replace scalar parts of aggregates with uses of independent scalar
11967 variables. These parameters control the maximum size, in storage units,
11968 of aggregate which is considered for replacement when compiling for
11969 speed
11970 (@option{sra-max-scalarization-size-Ospeed}) or size
11971 (@option{sra-max-scalarization-size-Osize}) respectively.
11972
11973 @item tm-max-aggregate-size
11974 When making copies of thread-local variables in a transaction, this
11975 parameter specifies the size in bytes after which variables are
11976 saved with the logging functions as opposed to save/restore code
11977 sequence pairs. This option only applies when using
11978 @option{-fgnu-tm}.
11979
11980 @item graphite-max-nb-scop-params
11981 To avoid exponential effects in the Graphite loop transforms, the
11982 number of parameters in a Static Control Part (SCoP) is bounded.
11983 A value of zero can be used to lift
11984 the bound. A variable whose value is unknown at compilation time and
11985 defined outside a SCoP is a parameter of the SCoP.
11986
11987 @item loop-block-tile-size
11988 Loop blocking or strip mining transforms, enabled with
11989 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11990 loop in the loop nest by a given number of iterations. The strip
11991 length can be changed using the @option{loop-block-tile-size}
11992 parameter.
11993
11994 @item ipa-cp-value-list-size
11995 IPA-CP attempts to track all possible values and types passed to a function's
11996 parameter in order to propagate them and perform devirtualization.
11997 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11998 stores per one formal parameter of a function.
11999
12000 @item ipa-cp-eval-threshold
12001 IPA-CP calculates its own score of cloning profitability heuristics
12002 and performs those cloning opportunities with scores that exceed
12003 @option{ipa-cp-eval-threshold}.
12004
12005 @item ipa-cp-recursion-penalty
12006 Percentage penalty the recursive functions will receive when they
12007 are evaluated for cloning.
12008
12009 @item ipa-cp-single-call-penalty
12010 Percentage penalty functions containing a single call to another
12011 function will receive when they are evaluated for cloning.
12012
12013 @item ipa-max-agg-items
12014 IPA-CP is also capable to propagate a number of scalar values passed
12015 in an aggregate. @option{ipa-max-agg-items} controls the maximum
12016 number of such values per one parameter.
12017
12018 @item ipa-cp-loop-hint-bonus
12019 When IPA-CP determines that a cloning candidate would make the number
12020 of iterations of a loop known, it adds a bonus of
12021 @option{ipa-cp-loop-hint-bonus} to the profitability score of
12022 the candidate.
12023
12024 @item ipa-max-aa-steps
12025 During its analysis of function bodies, IPA-CP employs alias analysis
12026 in order to track values pointed to by function parameters. In order
12027 not spend too much time analyzing huge functions, it gives up and
12028 consider all memory clobbered after examining
12029 @option{ipa-max-aa-steps} statements modifying memory.
12030
12031 @item ipa-max-switch-predicate-bounds
12032 Maximal number of boundary endpoints of case ranges of switch statement.
12033 For switch exceeding this limit, IPA-CP will not construct cloning cost
12034 predicate, which is used to estimate cloning benefit, for default case
12035 of the switch statement.
12036
12037 @item ipa-max-param-expr-ops
12038 IPA-CP will analyze conditional statement that references some function
12039 parameter to estimate benefit for cloning upon certain constant value.
12040 But if number of operations in a parameter expression exceeds
12041 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
12042 one, and is not handled by IPA analysis.
12043
12044 @item lto-partitions
12045 Specify desired number of partitions produced during WHOPR compilation.
12046 The number of partitions should exceed the number of CPUs used for compilation.
12047
12048 @item lto-min-partition
12049 Size of minimal partition for WHOPR (in estimated instructions).
12050 This prevents expenses of splitting very small programs into too many
12051 partitions.
12052
12053 @item lto-max-partition
12054 Size of max partition for WHOPR (in estimated instructions).
12055 to provide an upper bound for individual size of partition.
12056 Meant to be used only with balanced partitioning.
12057
12058 @item lto-max-streaming-parallelism
12059 Maximal number of parallel processes used for LTO streaming.
12060
12061 @item cxx-max-namespaces-for-diagnostic-help
12062 The maximum number of namespaces to consult for suggestions when C++
12063 name lookup fails for an identifier.
12064
12065 @item sink-frequency-threshold
12066 The maximum relative execution frequency (in percents) of the target block
12067 relative to a statement's original block to allow statement sinking of a
12068 statement. Larger numbers result in more aggressive statement sinking.
12069 A small positive adjustment is applied for
12070 statements with memory operands as those are even more profitable so sink.
12071
12072 @item max-stores-to-sink
12073 The maximum number of conditional store pairs that can be sunk. Set to 0
12074 if either vectorization (@option{-ftree-vectorize}) or if-conversion
12075 (@option{-ftree-loop-if-convert}) is disabled.
12076
12077 @item case-values-threshold
12078 The smallest number of different values for which it is best to use a
12079 jump-table instead of a tree of conditional branches. If the value is
12080 0, use the default for the machine.
12081
12082 @item jump-table-max-growth-ratio-for-size
12083 The maximum code size growth ratio when expanding
12084 into a jump table (in percent). The parameter is used when
12085 optimizing for size.
12086
12087 @item jump-table-max-growth-ratio-for-speed
12088 The maximum code size growth ratio when expanding
12089 into a jump table (in percent). The parameter is used when
12090 optimizing for speed.
12091
12092 @item tree-reassoc-width
12093 Set the maximum number of instructions executed in parallel in
12094 reassociated tree. This parameter overrides target dependent
12095 heuristics used by default if has non zero value.
12096
12097 @item sched-pressure-algorithm
12098 Choose between the two available implementations of
12099 @option{-fsched-pressure}. Algorithm 1 is the original implementation
12100 and is the more likely to prevent instructions from being reordered.
12101 Algorithm 2 was designed to be a compromise between the relatively
12102 conservative approach taken by algorithm 1 and the rather aggressive
12103 approach taken by the default scheduler. It relies more heavily on
12104 having a regular register file and accurate register pressure classes.
12105 See @file{haifa-sched.c} in the GCC sources for more details.
12106
12107 The default choice depends on the target.
12108
12109 @item max-slsr-cand-scan
12110 Set the maximum number of existing candidates that are considered when
12111 seeking a basis for a new straight-line strength reduction candidate.
12112
12113 @item asan-globals
12114 Enable buffer overflow detection for global objects. This kind
12115 of protection is enabled by default if you are using
12116 @option{-fsanitize=address} option.
12117 To disable global objects protection use @option{--param asan-globals=0}.
12118
12119 @item asan-stack
12120 Enable buffer overflow detection for stack objects. This kind of
12121 protection is enabled by default when using @option{-fsanitize=address}.
12122 To disable stack protection use @option{--param asan-stack=0} option.
12123
12124 @item asan-instrument-reads
12125 Enable buffer overflow detection for memory reads. This kind of
12126 protection is enabled by default when using @option{-fsanitize=address}.
12127 To disable memory reads protection use
12128 @option{--param asan-instrument-reads=0}.
12129
12130 @item asan-instrument-writes
12131 Enable buffer overflow detection for memory writes. This kind of
12132 protection is enabled by default when using @option{-fsanitize=address}.
12133 To disable memory writes protection use
12134 @option{--param asan-instrument-writes=0} option.
12135
12136 @item asan-memintrin
12137 Enable detection for built-in functions. This kind of protection
12138 is enabled by default when using @option{-fsanitize=address}.
12139 To disable built-in functions protection use
12140 @option{--param asan-memintrin=0}.
12141
12142 @item asan-use-after-return
12143 Enable detection of use-after-return. This kind of protection
12144 is enabled by default when using the @option{-fsanitize=address} option.
12145 To disable it use @option{--param asan-use-after-return=0}.
12146
12147 Note: By default the check is disabled at run time. To enable it,
12148 add @code{detect_stack_use_after_return=1} to the environment variable
12149 @env{ASAN_OPTIONS}.
12150
12151 @item asan-instrumentation-with-call-threshold
12152 If number of memory accesses in function being instrumented
12153 is greater or equal to this number, use callbacks instead of inline checks.
12154 E.g. to disable inline code use
12155 @option{--param asan-instrumentation-with-call-threshold=0}.
12156
12157 @item use-after-scope-direct-emission-threshold
12158 If the size of a local variable in bytes is smaller or equal to this
12159 number, directly poison (or unpoison) shadow memory instead of using
12160 run-time callbacks.
12161
12162 @item max-fsm-thread-path-insns
12163 Maximum number of instructions to copy when duplicating blocks on a
12164 finite state automaton jump thread path.
12165
12166 @item max-fsm-thread-length
12167 Maximum number of basic blocks on a finite state automaton jump thread
12168 path.
12169
12170 @item max-fsm-thread-paths
12171 Maximum number of new jump thread paths to create for a finite state
12172 automaton.
12173
12174 @item parloops-chunk-size
12175 Chunk size of omp schedule for loops parallelized by parloops.
12176
12177 @item parloops-schedule
12178 Schedule type of omp schedule for loops parallelized by parloops (static,
12179 dynamic, guided, auto, runtime).
12180
12181 @item parloops-min-per-thread
12182 The minimum number of iterations per thread of an innermost parallelized
12183 loop for which the parallelized variant is preferred over the single threaded
12184 one. Note that for a parallelized loop nest the
12185 minimum number of iterations of the outermost loop per thread is two.
12186
12187 @item max-ssa-name-query-depth
12188 Maximum depth of recursion when querying properties of SSA names in things
12189 like fold routines. One level of recursion corresponds to following a
12190 use-def chain.
12191
12192 @item hsa-gen-debug-stores
12193 Enable emission of special debug stores within HSA kernels which are
12194 then read and reported by libgomp plugin. Generation of these stores
12195 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12196 enable it.
12197
12198 @item max-speculative-devirt-maydefs
12199 The maximum number of may-defs we analyze when looking for a must-def
12200 specifying the dynamic type of an object that invokes a virtual call
12201 we may be able to devirtualize speculatively.
12202
12203 @item max-vrp-switch-assertions
12204 The maximum number of assertions to add along the default edge of a switch
12205 statement during VRP.
12206
12207 @item unroll-jam-min-percent
12208 The minimum percentage of memory references that must be optimized
12209 away for the unroll-and-jam transformation to be considered profitable.
12210
12211 @item unroll-jam-max-unroll
12212 The maximum number of times the outer loop should be unrolled by
12213 the unroll-and-jam transformation.
12214
12215 @item max-rtl-if-conversion-unpredictable-cost
12216 Maximum permissible cost for the sequence that would be generated
12217 by the RTL if-conversion pass for a branch that is considered unpredictable.
12218
12219 @item max-variable-expansions-in-unroller
12220 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12221 of times that an individual variable will be expanded during loop unrolling.
12222
12223 @item tracer-min-branch-probability-feedback
12224 Stop forward growth if the probability of best edge is less than
12225 this threshold (in percent). Used when profile feedback is available.
12226
12227 @item partial-inlining-entry-probability
12228 Maximum probability of the entry BB of split region
12229 (in percent relative to entry BB of the function)
12230 to make partial inlining happen.
12231
12232 @item max-tracked-strlens
12233 Maximum number of strings for which strlen optimization pass will
12234 track string lengths.
12235
12236 @item gcse-after-reload-partial-fraction
12237 The threshold ratio for performing partial redundancy
12238 elimination after reload.
12239
12240 @item gcse-after-reload-critical-fraction
12241 The threshold ratio of critical edges execution count that
12242 permit performing redundancy elimination after reload.
12243
12244 @item max-loop-header-insns
12245 The maximum number of insns in loop header duplicated
12246 by the copy loop headers pass.
12247
12248 @item vect-epilogues-nomask
12249 Enable loop epilogue vectorization using smaller vector size.
12250
12251 @item slp-max-insns-in-bb
12252 Maximum number of instructions in basic block to be
12253 considered for SLP vectorization.
12254
12255 @item avoid-fma-max-bits
12256 Maximum number of bits for which we avoid creating FMAs.
12257
12258 @item sms-loop-average-count-threshold
12259 A threshold on the average loop count considered by the swing modulo scheduler.
12260
12261 @item sms-dfa-history
12262 The number of cycles the swing modulo scheduler considers when checking
12263 conflicts using DFA.
12264
12265 @item max-inline-insns-recursive-auto
12266 The maximum number of instructions non-inline function
12267 can grow to via recursive inlining.
12268
12269 @item graphite-allow-codegen-errors
12270 Whether codegen errors should be ICEs when @option{-fchecking}.
12271
12272 @item sms-max-ii-factor
12273 A factor for tuning the upper bound that swing modulo scheduler
12274 uses for scheduling a loop.
12275
12276 @item lra-max-considered-reload-pseudos
12277 The max number of reload pseudos which are considered during
12278 spilling a non-reload pseudo.
12279
12280 @item max-pow-sqrt-depth
12281 Maximum depth of sqrt chains to use when synthesizing exponentiation
12282 by a real constant.
12283
12284 @item max-dse-active-local-stores
12285 Maximum number of active local stores in RTL dead store elimination.
12286
12287 @item asan-instrument-allocas
12288 Enable asan allocas/VLAs protection.
12289
12290 @item max-iterations-computation-cost
12291 Bound on the cost of an expression to compute the number of iterations.
12292
12293 @item max-isl-operations
12294 Maximum number of isl operations, 0 means unlimited.
12295
12296 @item graphite-max-arrays-per-scop
12297 Maximum number of arrays per scop.
12298
12299 @item max-vartrack-reverse-op-size
12300 Max. size of loc list for which reverse ops should be added.
12301
12302 @item tracer-dynamic-coverage-feedback
12303 The percentage of function, weighted by execution frequency,
12304 that must be covered by trace formation.
12305 Used when profile feedback is available.
12306
12307 @item max-inline-recursive-depth-auto
12308 The maximum depth of recursive inlining for non-inline functions.
12309
12310 @item fsm-scale-path-stmts
12311 Scale factor to apply to the number of statements in a threading path
12312 when comparing to the number of (scaled) blocks.
12313
12314 @item fsm-maximum-phi-arguments
12315 Maximum number of arguments a PHI may have before the FSM threader
12316 will not try to thread through its block.
12317
12318 @item uninit-control-dep-attempts
12319 Maximum number of nested calls to search for control dependencies
12320 during uninitialized variable analysis.
12321
12322 @item max-once-peeled-insns
12323 The maximum number of insns of a peeled loop that rolls only once.
12324
12325 @item sra-max-scalarization-size-Osize
12326 Maximum size, in storage units, of an aggregate
12327 which should be considered for scalarization when compiling for size.
12328
12329 @item fsm-scale-path-blocks
12330 Scale factor to apply to the number of blocks in a threading path
12331 when comparing to the number of (scaled) statements.
12332
12333 @item sched-autopref-queue-depth
12334 Hardware autoprefetcher scheduler model control flag.
12335 Number of lookahead cycles the model looks into; at '
12336 ' only enable instruction sorting heuristic.
12337
12338 @item loop-versioning-max-inner-insns
12339 The maximum number of instructions that an inner loop can have
12340 before the loop versioning pass considers it too big to copy.
12341
12342 @item loop-versioning-max-outer-insns
12343 The maximum number of instructions that an outer loop can have
12344 before the loop versioning pass considers it too big to copy,
12345 discounting any instructions in inner loops that directly benefit
12346 from versioning.
12347
12348 @item ssa-name-def-chain-limit
12349 The maximum number of SSA_NAME assignments to follow in determining
12350 a property of a variable such as its value. This limits the number
12351 of iterations or recursive calls GCC performs when optimizing certain
12352 statements or when determining their validity prior to issuing
12353 diagnostics.
12354
12355 @end table
12356 @end table
12357
12358 @node Instrumentation Options
12359 @section Program Instrumentation Options
12360 @cindex instrumentation options
12361 @cindex program instrumentation options
12362 @cindex run-time error checking options
12363 @cindex profiling options
12364 @cindex options, program instrumentation
12365 @cindex options, run-time error checking
12366 @cindex options, profiling
12367
12368 GCC supports a number of command-line options that control adding
12369 run-time instrumentation to the code it normally generates.
12370 For example, one purpose of instrumentation is collect profiling
12371 statistics for use in finding program hot spots, code coverage
12372 analysis, or profile-guided optimizations.
12373 Another class of program instrumentation is adding run-time checking
12374 to detect programming errors like invalid pointer
12375 dereferences or out-of-bounds array accesses, as well as deliberately
12376 hostile attacks such as stack smashing or C++ vtable hijacking.
12377 There is also a general hook which can be used to implement other
12378 forms of tracing or function-level instrumentation for debug or
12379 program analysis purposes.
12380
12381 @table @gcctabopt
12382 @cindex @command{prof}
12383 @cindex @command{gprof}
12384 @item -p
12385 @itemx -pg
12386 @opindex p
12387 @opindex pg
12388 Generate extra code to write profile information suitable for the
12389 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12390 (for @option{-pg}). You must use this option when compiling
12391 the source files you want data about, and you must also use it when
12392 linking.
12393
12394 You can use the function attribute @code{no_instrument_function} to
12395 suppress profiling of individual functions when compiling with these options.
12396 @xref{Common Function Attributes}.
12397
12398 @item -fprofile-arcs
12399 @opindex fprofile-arcs
12400 Add code so that program flow @dfn{arcs} are instrumented. During
12401 execution the program records how many times each branch and call is
12402 executed and how many times it is taken or returns. On targets that support
12403 constructors with priority support, profiling properly handles constructors,
12404 destructors and C++ constructors (and destructors) of classes which are used
12405 as a type of a global variable.
12406
12407 When the compiled
12408 program exits it saves this data to a file called
12409 @file{@var{auxname}.gcda} for each source file. The data may be used for
12410 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12411 test coverage analysis (@option{-ftest-coverage}). Each object file's
12412 @var{auxname} is generated from the name of the output file, if
12413 explicitly specified and it is not the final executable, otherwise it is
12414 the basename of the source file. In both cases any suffix is removed
12415 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12416 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12417 @xref{Cross-profiling}.
12418
12419 @cindex @command{gcov}
12420 @item --coverage
12421 @opindex coverage
12422
12423 This option is used to compile and link code instrumented for coverage
12424 analysis. The option is a synonym for @option{-fprofile-arcs}
12425 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12426 linking). See the documentation for those options for more details.
12427
12428 @itemize
12429
12430 @item
12431 Compile the source files with @option{-fprofile-arcs} plus optimization
12432 and code generation options. For test coverage analysis, use the
12433 additional @option{-ftest-coverage} option. You do not need to profile
12434 every source file in a program.
12435
12436 @item
12437 Compile the source files additionally with @option{-fprofile-abs-path}
12438 to create absolute path names in the @file{.gcno} files. This allows
12439 @command{gcov} to find the correct sources in projects where compilations
12440 occur with different working directories.
12441
12442 @item
12443 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12444 (the latter implies the former).
12445
12446 @item
12447 Run the program on a representative workload to generate the arc profile
12448 information. This may be repeated any number of times. You can run
12449 concurrent instances of your program, and provided that the file system
12450 supports locking, the data files will be correctly updated. Unless
12451 a strict ISO C dialect option is in effect, @code{fork} calls are
12452 detected and correctly handled without double counting.
12453
12454 @item
12455 For profile-directed optimizations, compile the source files again with
12456 the same optimization and code generation options plus
12457 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12458 Control Optimization}).
12459
12460 @item
12461 For test coverage analysis, use @command{gcov} to produce human readable
12462 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12463 @command{gcov} documentation for further information.
12464
12465 @end itemize
12466
12467 With @option{-fprofile-arcs}, for each function of your program GCC
12468 creates a program flow graph, then finds a spanning tree for the graph.
12469 Only arcs that are not on the spanning tree have to be instrumented: the
12470 compiler adds code to count the number of times that these arcs are
12471 executed. When an arc is the only exit or only entrance to a block, the
12472 instrumentation code can be added to the block; otherwise, a new basic
12473 block must be created to hold the instrumentation code.
12474
12475 @need 2000
12476 @item -ftest-coverage
12477 @opindex ftest-coverage
12478 Produce a notes file that the @command{gcov} code-coverage utility
12479 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12480 show program coverage. Each source file's note file is called
12481 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12482 above for a description of @var{auxname} and instructions on how to
12483 generate test coverage data. Coverage data matches the source files
12484 more closely if you do not optimize.
12485
12486 @item -fprofile-abs-path
12487 @opindex fprofile-abs-path
12488 Automatically convert relative source file names to absolute path names
12489 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12490 sources in projects where compilations occur with different working
12491 directories.
12492
12493 @item -fprofile-dir=@var{path}
12494 @opindex fprofile-dir
12495
12496 Set the directory to search for the profile data files in to @var{path}.
12497 This option affects only the profile data generated by
12498 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12499 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12500 and its related options. Both absolute and relative paths can be used.
12501 By default, GCC uses the current directory as @var{path}, thus the
12502 profile data file appears in the same directory as the object file.
12503 In order to prevent the file name clashing, if the object file name is
12504 not an absolute path, we mangle the absolute path of the
12505 @file{@var{sourcename}.gcda} file and use it as the file name of a
12506 @file{.gcda} file. See similar option @option{-fprofile-note}.
12507
12508 When an executable is run in a massive parallel environment, it is recommended
12509 to save profile to different folders. That can be done with variables
12510 in @var{path} that are exported during run-time:
12511
12512 @table @gcctabopt
12513
12514 @item %p
12515 process ID.
12516
12517 @item %q@{VAR@}
12518 value of environment variable @var{VAR}
12519
12520 @end table
12521
12522 @item -fprofile-generate
12523 @itemx -fprofile-generate=@var{path}
12524 @opindex fprofile-generate
12525
12526 Enable options usually used for instrumenting application to produce
12527 profile useful for later recompilation with profile feedback based
12528 optimization. You must use @option{-fprofile-generate} both when
12529 compiling and when linking your program.
12530
12531 The following options are enabled:
12532 @option{-fprofile-arcs}, @option{-fprofile-values},
12533 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12534
12535 If @var{path} is specified, GCC looks at the @var{path} to find
12536 the profile feedback data files. See @option{-fprofile-dir}.
12537
12538 To optimize the program based on the collected profile information, use
12539 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12540
12541 @item -fprofile-note=@var{path}
12542 @opindex fprofile-note
12543
12544 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
12545 location. If you combine the option with multiple source files,
12546 the @file{.gcno} file will be overwritten.
12547
12548 @item -fprofile-update=@var{method}
12549 @opindex fprofile-update
12550
12551 Alter the update method for an application instrumented for profile
12552 feedback based optimization. The @var{method} argument should be one of
12553 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12554 The first one is useful for single-threaded applications,
12555 while the second one prevents profile corruption by emitting thread-safe code.
12556
12557 @strong{Warning:} When an application does not properly join all threads
12558 (or creates an detached thread), a profile file can be still corrupted.
12559
12560 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12561 when supported by a target, or to @samp{single} otherwise. The GCC driver
12562 automatically selects @samp{prefer-atomic} when @option{-pthread}
12563 is present in the command line.
12564
12565 @item -fprofile-filter-files=@var{regex}
12566 @opindex fprofile-filter-files
12567
12568 Instrument only functions from files where names match
12569 any regular expression (separated by a semi-colon).
12570
12571 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12572 only @file{main.c} and all C files starting with 'module'.
12573
12574 @item -fprofile-exclude-files=@var{regex}
12575 @opindex fprofile-exclude-files
12576
12577 Instrument only functions from files where names do not match
12578 all the regular expressions (separated by a semi-colon).
12579
12580 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12581 of all files that are located in @file{/usr/} folder.
12582
12583 @item -fsanitize=address
12584 @opindex fsanitize=address
12585 Enable AddressSanitizer, a fast memory error detector.
12586 Memory access instructions are instrumented to detect
12587 out-of-bounds and use-after-free bugs.
12588 The option enables @option{-fsanitize-address-use-after-scope}.
12589 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12590 more details. The run-time behavior can be influenced using the
12591 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12592 the available options are shown at startup of the instrumented program. See
12593 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12594 for a list of supported options.
12595 The option cannot be combined with @option{-fsanitize=thread}.
12596
12597 @item -fsanitize=kernel-address
12598 @opindex fsanitize=kernel-address
12599 Enable AddressSanitizer for Linux kernel.
12600 See @uref{https://github.com/google/kasan/wiki} for more details.
12601
12602 @item -fsanitize=pointer-compare
12603 @opindex fsanitize=pointer-compare
12604 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12605 The option must be combined with either @option{-fsanitize=kernel-address} or
12606 @option{-fsanitize=address}
12607 The option cannot be combined with @option{-fsanitize=thread}.
12608 Note: By default the check is disabled at run time. To enable it,
12609 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12610 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12611 invalid operation only when both pointers are non-null.
12612
12613 @item -fsanitize=pointer-subtract
12614 @opindex fsanitize=pointer-subtract
12615 Instrument subtraction with pointer operands.
12616 The option must be combined with either @option{-fsanitize=kernel-address} or
12617 @option{-fsanitize=address}
12618 The option cannot be combined with @option{-fsanitize=thread}.
12619 Note: By default the check is disabled at run time. To enable it,
12620 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12621 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12622 invalid operation only when both pointers are non-null.
12623
12624 @item -fsanitize=thread
12625 @opindex fsanitize=thread
12626 Enable ThreadSanitizer, a fast data race detector.
12627 Memory access instructions are instrumented to detect
12628 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12629 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12630 environment variable; see
12631 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12632 supported options.
12633 The option cannot be combined with @option{-fsanitize=address},
12634 @option{-fsanitize=leak}.
12635
12636 Note that sanitized atomic builtins cannot throw exceptions when
12637 operating on invalid memory addresses with non-call exceptions
12638 (@option{-fnon-call-exceptions}).
12639
12640 @item -fsanitize=leak
12641 @opindex fsanitize=leak
12642 Enable LeakSanitizer, a memory leak detector.
12643 This option only matters for linking of executables and
12644 the executable is linked against a library that overrides @code{malloc}
12645 and other allocator functions. See
12646 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12647 details. The run-time behavior can be influenced using the
12648 @env{LSAN_OPTIONS} environment variable.
12649 The option cannot be combined with @option{-fsanitize=thread}.
12650
12651 @item -fsanitize=undefined
12652 @opindex fsanitize=undefined
12653 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12654 Various computations are instrumented to detect undefined behavior
12655 at runtime. Current suboptions are:
12656
12657 @table @gcctabopt
12658
12659 @item -fsanitize=shift
12660 @opindex fsanitize=shift
12661 This option enables checking that the result of a shift operation is
12662 not undefined. Note that what exactly is considered undefined differs
12663 slightly between C and C++, as well as between ISO C90 and C99, etc.
12664 This option has two suboptions, @option{-fsanitize=shift-base} and
12665 @option{-fsanitize=shift-exponent}.
12666
12667 @item -fsanitize=shift-exponent
12668 @opindex fsanitize=shift-exponent
12669 This option enables checking that the second argument of a shift operation
12670 is not negative and is smaller than the precision of the promoted first
12671 argument.
12672
12673 @item -fsanitize=shift-base
12674 @opindex fsanitize=shift-base
12675 If the second argument of a shift operation is within range, check that the
12676 result of a shift operation is not undefined. Note that what exactly is
12677 considered undefined differs slightly between C and C++, as well as between
12678 ISO C90 and C99, etc.
12679
12680 @item -fsanitize=integer-divide-by-zero
12681 @opindex fsanitize=integer-divide-by-zero
12682 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12683
12684 @item -fsanitize=unreachable
12685 @opindex fsanitize=unreachable
12686 With this option, the compiler turns the @code{__builtin_unreachable}
12687 call into a diagnostics message call instead. When reaching the
12688 @code{__builtin_unreachable} call, the behavior is undefined.
12689
12690 @item -fsanitize=vla-bound
12691 @opindex fsanitize=vla-bound
12692 This option instructs the compiler to check that the size of a variable
12693 length array is positive.
12694
12695 @item -fsanitize=null
12696 @opindex fsanitize=null
12697 This option enables pointer checking. Particularly, the application
12698 built with this option turned on will issue an error message when it
12699 tries to dereference a NULL pointer, or if a reference (possibly an
12700 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12701 on an object pointed by a NULL pointer.
12702
12703 @item -fsanitize=return
12704 @opindex fsanitize=return
12705 This option enables return statement checking. Programs
12706 built with this option turned on will issue an error message
12707 when the end of a non-void function is reached without actually
12708 returning a value. This option works in C++ only.
12709
12710 @item -fsanitize=signed-integer-overflow
12711 @opindex fsanitize=signed-integer-overflow
12712 This option enables signed integer overflow checking. We check that
12713 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12714 does not overflow in the signed arithmetics. Note, integer promotion
12715 rules must be taken into account. That is, the following is not an
12716 overflow:
12717 @smallexample
12718 signed char a = SCHAR_MAX;
12719 a++;
12720 @end smallexample
12721
12722 @item -fsanitize=bounds
12723 @opindex fsanitize=bounds
12724 This option enables instrumentation of array bounds. Various out of bounds
12725 accesses are detected. Flexible array members, flexible array member-like
12726 arrays, and initializers of variables with static storage are not instrumented.
12727
12728 @item -fsanitize=bounds-strict
12729 @opindex fsanitize=bounds-strict
12730 This option enables strict instrumentation of array bounds. Most out of bounds
12731 accesses are detected, including flexible array members and flexible array
12732 member-like arrays. Initializers of variables with static storage are not
12733 instrumented.
12734
12735 @item -fsanitize=alignment
12736 @opindex fsanitize=alignment
12737
12738 This option enables checking of alignment of pointers when they are
12739 dereferenced, or when a reference is bound to insufficiently aligned target,
12740 or when a method or constructor is invoked on insufficiently aligned object.
12741
12742 @item -fsanitize=object-size
12743 @opindex fsanitize=object-size
12744 This option enables instrumentation of memory references using the
12745 @code{__builtin_object_size} function. Various out of bounds pointer
12746 accesses are detected.
12747
12748 @item -fsanitize=float-divide-by-zero
12749 @opindex fsanitize=float-divide-by-zero
12750 Detect floating-point division by zero. Unlike other similar options,
12751 @option{-fsanitize=float-divide-by-zero} is not enabled by
12752 @option{-fsanitize=undefined}, since floating-point division by zero can
12753 be a legitimate way of obtaining infinities and NaNs.
12754
12755 @item -fsanitize=float-cast-overflow
12756 @opindex fsanitize=float-cast-overflow
12757 This option enables floating-point type to integer conversion checking.
12758 We check that the result of the conversion does not overflow.
12759 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12760 not enabled by @option{-fsanitize=undefined}.
12761 This option does not work well with @code{FE_INVALID} exceptions enabled.
12762
12763 @item -fsanitize=nonnull-attribute
12764 @opindex fsanitize=nonnull-attribute
12765
12766 This option enables instrumentation of calls, checking whether null values
12767 are not passed to arguments marked as requiring a non-null value by the
12768 @code{nonnull} function attribute.
12769
12770 @item -fsanitize=returns-nonnull-attribute
12771 @opindex fsanitize=returns-nonnull-attribute
12772
12773 This option enables instrumentation of return statements in functions
12774 marked with @code{returns_nonnull} function attribute, to detect returning
12775 of null values from such functions.
12776
12777 @item -fsanitize=bool
12778 @opindex fsanitize=bool
12779
12780 This option enables instrumentation of loads from bool. If a value other
12781 than 0/1 is loaded, a run-time error is issued.
12782
12783 @item -fsanitize=enum
12784 @opindex fsanitize=enum
12785
12786 This option enables instrumentation of loads from an enum type. If
12787 a value outside the range of values for the enum type is loaded,
12788 a run-time error is issued.
12789
12790 @item -fsanitize=vptr
12791 @opindex fsanitize=vptr
12792
12793 This option enables instrumentation of C++ member function calls, member
12794 accesses and some conversions between pointers to base and derived classes,
12795 to verify the referenced object has the correct dynamic type.
12796
12797 @item -fsanitize=pointer-overflow
12798 @opindex fsanitize=pointer-overflow
12799
12800 This option enables instrumentation of pointer arithmetics. If the pointer
12801 arithmetics overflows, a run-time error is issued.
12802
12803 @item -fsanitize=builtin
12804 @opindex fsanitize=builtin
12805
12806 This option enables instrumentation of arguments to selected builtin
12807 functions. If an invalid value is passed to such arguments, a run-time
12808 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12809 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12810 by this option.
12811
12812 @end table
12813
12814 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12815 @option{-fsanitize=undefined} gives a diagnostic message.
12816 This currently works only for the C family of languages.
12817
12818 @item -fno-sanitize=all
12819 @opindex fno-sanitize=all
12820
12821 This option disables all previously enabled sanitizers.
12822 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12823 together.
12824
12825 @item -fasan-shadow-offset=@var{number}
12826 @opindex fasan-shadow-offset
12827 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12828 It is useful for experimenting with different shadow memory layouts in
12829 Kernel AddressSanitizer.
12830
12831 @item -fsanitize-sections=@var{s1},@var{s2},...
12832 @opindex fsanitize-sections
12833 Sanitize global variables in selected user-defined sections. @var{si} may
12834 contain wildcards.
12835
12836 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12837 @opindex fsanitize-recover
12838 @opindex fno-sanitize-recover
12839 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12840 mentioned in comma-separated list of @var{opts}. Enabling this option
12841 for a sanitizer component causes it to attempt to continue
12842 running the program as if no error happened. This means multiple
12843 runtime errors can be reported in a single program run, and the exit
12844 code of the program may indicate success even when errors
12845 have been reported. The @option{-fno-sanitize-recover=} option
12846 can be used to alter
12847 this behavior: only the first detected error is reported
12848 and program then exits with a non-zero exit code.
12849
12850 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12851 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12852 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12853 @option{-fsanitize=bounds-strict},
12854 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12855 For these sanitizers error recovery is turned on by default,
12856 except @option{-fsanitize=address}, for which this feature is experimental.
12857 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12858 accepted, the former enables recovery for all sanitizers that support it,
12859 the latter disables recovery for all sanitizers that support it.
12860
12861 Even if a recovery mode is turned on the compiler side, it needs to be also
12862 enabled on the runtime library side, otherwise the failures are still fatal.
12863 The runtime library defaults to @code{halt_on_error=0} for
12864 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12865 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12866 setting the @code{halt_on_error} flag in the corresponding environment variable.
12867
12868 Syntax without an explicit @var{opts} parameter is deprecated. It is
12869 equivalent to specifying an @var{opts} list of:
12870
12871 @smallexample
12872 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12873 @end smallexample
12874
12875 @item -fsanitize-address-use-after-scope
12876 @opindex fsanitize-address-use-after-scope
12877 Enable sanitization of local variables to detect use-after-scope bugs.
12878 The option sets @option{-fstack-reuse} to @samp{none}.
12879
12880 @item -fsanitize-undefined-trap-on-error
12881 @opindex fsanitize-undefined-trap-on-error
12882 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12883 report undefined behavior using @code{__builtin_trap} rather than
12884 a @code{libubsan} library routine. The advantage of this is that the
12885 @code{libubsan} library is not needed and is not linked in, so this
12886 is usable even in freestanding environments.
12887
12888 @item -fsanitize-coverage=trace-pc
12889 @opindex fsanitize-coverage=trace-pc
12890 Enable coverage-guided fuzzing code instrumentation.
12891 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12892
12893 @item -fsanitize-coverage=trace-cmp
12894 @opindex fsanitize-coverage=trace-cmp
12895 Enable dataflow guided fuzzing code instrumentation.
12896 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12897 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12898 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12899 variable or @code{__sanitizer_cov_trace_const_cmp1},
12900 @code{__sanitizer_cov_trace_const_cmp2},
12901 @code{__sanitizer_cov_trace_const_cmp4} or
12902 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12903 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12904 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12905 @code{__sanitizer_cov_trace_switch} for switch statements.
12906
12907 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12908 @opindex fcf-protection
12909 Enable code instrumentation of control-flow transfers to increase
12910 program security by checking that target addresses of control-flow
12911 transfer instructions (such as indirect function call, function return,
12912 indirect jump) are valid. This prevents diverting the flow of control
12913 to an unexpected target. This is intended to protect against such
12914 threats as Return-oriented Programming (ROP), and similarly
12915 call/jmp-oriented programming (COP/JOP).
12916
12917 The value @code{branch} tells the compiler to implement checking of
12918 validity of control-flow transfer at the point of indirect branch
12919 instructions, i.e.@: call/jmp instructions. The value @code{return}
12920 implements checking of validity at the point of returning from a
12921 function. The value @code{full} is an alias for specifying both
12922 @code{branch} and @code{return}. The value @code{none} turns off
12923 instrumentation.
12924
12925 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12926 used. The first bit of @code{__CET__} is set to 1 for the value
12927 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12928 the @code{return}.
12929
12930 You can also use the @code{nocf_check} attribute to identify
12931 which functions and calls should be skipped from instrumentation
12932 (@pxref{Function Attributes}).
12933
12934 Currently the x86 GNU/Linux target provides an implementation based
12935 on Intel Control-flow Enforcement Technology (CET).
12936
12937 @item -fstack-protector
12938 @opindex fstack-protector
12939 Emit extra code to check for buffer overflows, such as stack smashing
12940 attacks. This is done by adding a guard variable to functions with
12941 vulnerable objects. This includes functions that call @code{alloca}, and
12942 functions with buffers larger than 8 bytes. The guards are initialized
12943 when a function is entered and then checked when the function exits.
12944 If a guard check fails, an error message is printed and the program exits.
12945
12946 @item -fstack-protector-all
12947 @opindex fstack-protector-all
12948 Like @option{-fstack-protector} except that all functions are protected.
12949
12950 @item -fstack-protector-strong
12951 @opindex fstack-protector-strong
12952 Like @option{-fstack-protector} but includes additional functions to
12953 be protected --- those that have local array definitions, or have
12954 references to local frame addresses.
12955
12956 @item -fstack-protector-explicit
12957 @opindex fstack-protector-explicit
12958 Like @option{-fstack-protector} but only protects those functions which
12959 have the @code{stack_protect} attribute.
12960
12961 @item -fstack-check
12962 @opindex fstack-check
12963 Generate code to verify that you do not go beyond the boundary of the
12964 stack. You should specify this flag if you are running in an
12965 environment with multiple threads, but you only rarely need to specify it in
12966 a single-threaded environment since stack overflow is automatically
12967 detected on nearly all systems if there is only one stack.
12968
12969 Note that this switch does not actually cause checking to be done; the
12970 operating system or the language runtime must do that. The switch causes
12971 generation of code to ensure that they see the stack being extended.
12972
12973 You can additionally specify a string parameter: @samp{no} means no
12974 checking, @samp{generic} means force the use of old-style checking,
12975 @samp{specific} means use the best checking method and is equivalent
12976 to bare @option{-fstack-check}.
12977
12978 Old-style checking is a generic mechanism that requires no specific
12979 target support in the compiler but comes with the following drawbacks:
12980
12981 @enumerate
12982 @item
12983 Modified allocation strategy for large objects: they are always
12984 allocated dynamically if their size exceeds a fixed threshold. Note this
12985 may change the semantics of some code.
12986
12987 @item
12988 Fixed limit on the size of the static frame of functions: when it is
12989 topped by a particular function, stack checking is not reliable and
12990 a warning is issued by the compiler.
12991
12992 @item
12993 Inefficiency: because of both the modified allocation strategy and the
12994 generic implementation, code performance is hampered.
12995 @end enumerate
12996
12997 Note that old-style stack checking is also the fallback method for
12998 @samp{specific} if no target support has been added in the compiler.
12999
13000 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
13001 and stack overflows. @samp{specific} is an excellent choice when compiling
13002 Ada code. It is not generally sufficient to protect against stack-clash
13003 attacks. To protect against those you want @samp{-fstack-clash-protection}.
13004
13005 @item -fstack-clash-protection
13006 @opindex fstack-clash-protection
13007 Generate code to prevent stack clash style attacks. When this option is
13008 enabled, the compiler will only allocate one page of stack space at a time
13009 and each page is accessed immediately after allocation. Thus, it prevents
13010 allocations from jumping over any stack guard page provided by the
13011 operating system.
13012
13013 Most targets do not fully support stack clash protection. However, on
13014 those targets @option{-fstack-clash-protection} will protect dynamic stack
13015 allocations. @option{-fstack-clash-protection} may also provide limited
13016 protection for static stack allocations if the target supports
13017 @option{-fstack-check=specific}.
13018
13019 @item -fstack-limit-register=@var{reg}
13020 @itemx -fstack-limit-symbol=@var{sym}
13021 @itemx -fno-stack-limit
13022 @opindex fstack-limit-register
13023 @opindex fstack-limit-symbol
13024 @opindex fno-stack-limit
13025 Generate code to ensure that the stack does not grow beyond a certain value,
13026 either the value of a register or the address of a symbol. If a larger
13027 stack is required, a signal is raised at run time. For most targets,
13028 the signal is raised before the stack overruns the boundary, so
13029 it is possible to catch the signal without taking special precautions.
13030
13031 For instance, if the stack starts at absolute address @samp{0x80000000}
13032 and grows downwards, you can use the flags
13033 @option{-fstack-limit-symbol=__stack_limit} and
13034 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
13035 of 128KB@. Note that this may only work with the GNU linker.
13036
13037 You can locally override stack limit checking by using the
13038 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
13039
13040 @item -fsplit-stack
13041 @opindex fsplit-stack
13042 Generate code to automatically split the stack before it overflows.
13043 The resulting program has a discontiguous stack which can only
13044 overflow if the program is unable to allocate any more memory. This
13045 is most useful when running threaded programs, as it is no longer
13046 necessary to calculate a good stack size to use for each thread. This
13047 is currently only implemented for the x86 targets running
13048 GNU/Linux.
13049
13050 When code compiled with @option{-fsplit-stack} calls code compiled
13051 without @option{-fsplit-stack}, there may not be much stack space
13052 available for the latter code to run. If compiling all code,
13053 including library code, with @option{-fsplit-stack} is not an option,
13054 then the linker can fix up these calls so that the code compiled
13055 without @option{-fsplit-stack} always has a large stack. Support for
13056 this is implemented in the gold linker in GNU binutils release 2.21
13057 and later.
13058
13059 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
13060 @opindex fvtable-verify
13061 This option is only available when compiling C++ code.
13062 It turns on (or off, if using @option{-fvtable-verify=none}) the security
13063 feature that verifies at run time, for every virtual call, that
13064 the vtable pointer through which the call is made is valid for the type of
13065 the object, and has not been corrupted or overwritten. If an invalid vtable
13066 pointer is detected at run time, an error is reported and execution of the
13067 program is immediately halted.
13068
13069 This option causes run-time data structures to be built at program startup,
13070 which are used for verifying the vtable pointers.
13071 The options @samp{std} and @samp{preinit}
13072 control the timing of when these data structures are built. In both cases the
13073 data structures are built before execution reaches @code{main}. Using
13074 @option{-fvtable-verify=std} causes the data structures to be built after
13075 shared libraries have been loaded and initialized.
13076 @option{-fvtable-verify=preinit} causes them to be built before shared
13077 libraries have been loaded and initialized.
13078
13079 If this option appears multiple times in the command line with different
13080 values specified, @samp{none} takes highest priority over both @samp{std} and
13081 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
13082
13083 @item -fvtv-debug
13084 @opindex fvtv-debug
13085 When used in conjunction with @option{-fvtable-verify=std} or
13086 @option{-fvtable-verify=preinit}, causes debug versions of the
13087 runtime functions for the vtable verification feature to be called.
13088 This flag also causes the compiler to log information about which
13089 vtable pointers it finds for each class.
13090 This information is written to a file named @file{vtv_set_ptr_data.log}
13091 in the directory named by the environment variable @env{VTV_LOGS_DIR}
13092 if that is defined or the current working directory otherwise.
13093
13094 Note: This feature @emph{appends} data to the log file. If you want a fresh log
13095 file, be sure to delete any existing one.
13096
13097 @item -fvtv-counts
13098 @opindex fvtv-counts
13099 This is a debugging flag. When used in conjunction with
13100 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
13101 causes the compiler to keep track of the total number of virtual calls
13102 it encounters and the number of verifications it inserts. It also
13103 counts the number of calls to certain run-time library functions
13104 that it inserts and logs this information for each compilation unit.
13105 The compiler writes this information to a file named
13106 @file{vtv_count_data.log} in the directory named by the environment
13107 variable @env{VTV_LOGS_DIR} if that is defined or the current working
13108 directory otherwise. It also counts the size of the vtable pointer sets
13109 for each class, and writes this information to @file{vtv_class_set_sizes.log}
13110 in the same directory.
13111
13112 Note: This feature @emph{appends} data to the log files. To get fresh log
13113 files, be sure to delete any existing ones.
13114
13115 @item -finstrument-functions
13116 @opindex finstrument-functions
13117 Generate instrumentation calls for entry and exit to functions. Just
13118 after function entry and just before function exit, the following
13119 profiling functions are called with the address of the current
13120 function and its call site. (On some platforms,
13121 @code{__builtin_return_address} does not work beyond the current
13122 function, so the call site information may not be available to the
13123 profiling functions otherwise.)
13124
13125 @smallexample
13126 void __cyg_profile_func_enter (void *this_fn,
13127 void *call_site);
13128 void __cyg_profile_func_exit (void *this_fn,
13129 void *call_site);
13130 @end smallexample
13131
13132 The first argument is the address of the start of the current function,
13133 which may be looked up exactly in the symbol table.
13134
13135 This instrumentation is also done for functions expanded inline in other
13136 functions. The profiling calls indicate where, conceptually, the
13137 inline function is entered and exited. This means that addressable
13138 versions of such functions must be available. If all your uses of a
13139 function are expanded inline, this may mean an additional expansion of
13140 code size. If you use @code{extern inline} in your C code, an
13141 addressable version of such functions must be provided. (This is
13142 normally the case anyway, but if you get lucky and the optimizer always
13143 expands the functions inline, you might have gotten away without
13144 providing static copies.)
13145
13146 A function may be given the attribute @code{no_instrument_function}, in
13147 which case this instrumentation is not done. This can be used, for
13148 example, for the profiling functions listed above, high-priority
13149 interrupt routines, and any functions from which the profiling functions
13150 cannot safely be called (perhaps signal handlers, if the profiling
13151 routines generate output or allocate memory).
13152 @xref{Common Function Attributes}.
13153
13154 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13155 @opindex finstrument-functions-exclude-file-list
13156
13157 Set the list of functions that are excluded from instrumentation (see
13158 the description of @option{-finstrument-functions}). If the file that
13159 contains a function definition matches with one of @var{file}, then
13160 that function is not instrumented. The match is done on substrings:
13161 if the @var{file} parameter is a substring of the file name, it is
13162 considered to be a match.
13163
13164 For example:
13165
13166 @smallexample
13167 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13168 @end smallexample
13169
13170 @noindent
13171 excludes any inline function defined in files whose pathnames
13172 contain @file{/bits/stl} or @file{include/sys}.
13173
13174 If, for some reason, you want to include letter @samp{,} in one of
13175 @var{sym}, write @samp{\,}. For example,
13176 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13177 (note the single quote surrounding the option).
13178
13179 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13180 @opindex finstrument-functions-exclude-function-list
13181
13182 This is similar to @option{-finstrument-functions-exclude-file-list},
13183 but this option sets the list of function names to be excluded from
13184 instrumentation. The function name to be matched is its user-visible
13185 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13186 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
13187 match is done on substrings: if the @var{sym} parameter is a substring
13188 of the function name, it is considered to be a match. For C99 and C++
13189 extended identifiers, the function name must be given in UTF-8, not
13190 using universal character names.
13191
13192 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13193 @opindex fpatchable-function-entry
13194 Generate @var{N} NOPs right at the beginning
13195 of each function, with the function entry point before the @var{M}th NOP.
13196 If @var{M} is omitted, it defaults to @code{0} so the
13197 function entry points to the address just at the first NOP.
13198 The NOP instructions reserve extra space which can be used to patch in
13199 any desired instrumentation at run time, provided that the code segment
13200 is writable. The amount of space is controllable indirectly via
13201 the number of NOPs; the NOP instruction used corresponds to the instruction
13202 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13203 is target-specific and may also depend on the architecture variant and/or
13204 other compilation options.
13205
13206 For run-time identification, the starting addresses of these areas,
13207 which correspond to their respective function entries minus @var{M},
13208 are additionally collected in the @code{__patchable_function_entries}
13209 section of the resulting binary.
13210
13211 Note that the value of @code{__attribute__ ((patchable_function_entry
13212 (N,M)))} takes precedence over command-line option
13213 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13214 the area size or to remove it completely on a single function.
13215 If @code{N=0}, no pad location is recorded.
13216
13217 The NOP instructions are inserted at---and maybe before, depending on
13218 @var{M}---the function entry address, even before the prologue.
13219
13220 @end table
13221
13222
13223 @node Preprocessor Options
13224 @section Options Controlling the Preprocessor
13225 @cindex preprocessor options
13226 @cindex options, preprocessor
13227
13228 These options control the C preprocessor, which is run on each C source
13229 file before actual compilation.
13230
13231 If you use the @option{-E} option, nothing is done except preprocessing.
13232 Some of these options make sense only together with @option{-E} because
13233 they cause the preprocessor output to be unsuitable for actual
13234 compilation.
13235
13236 In addition to the options listed here, there are a number of options
13237 to control search paths for include files documented in
13238 @ref{Directory Options}.
13239 Options to control preprocessor diagnostics are listed in
13240 @ref{Warning Options}.
13241
13242 @table @gcctabopt
13243 @include cppopts.texi
13244
13245 @item -Wp,@var{option}
13246 @opindex Wp
13247 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13248 and pass @var{option} directly through to the preprocessor. If
13249 @var{option} contains commas, it is split into multiple options at the
13250 commas. However, many options are modified, translated or interpreted
13251 by the compiler driver before being passed to the preprocessor, and
13252 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13253 interface is undocumented and subject to change, so whenever possible
13254 you should avoid using @option{-Wp} and let the driver handle the
13255 options instead.
13256
13257 @item -Xpreprocessor @var{option}
13258 @opindex Xpreprocessor
13259 Pass @var{option} as an option to the preprocessor. You can use this to
13260 supply system-specific preprocessor options that GCC does not
13261 recognize.
13262
13263 If you want to pass an option that takes an argument, you must use
13264 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13265
13266 @item -no-integrated-cpp
13267 @opindex no-integrated-cpp
13268 Perform preprocessing as a separate pass before compilation.
13269 By default, GCC performs preprocessing as an integrated part of
13270 input tokenization and parsing.
13271 If this option is provided, the appropriate language front end
13272 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13273 and Objective-C, respectively) is instead invoked twice,
13274 once for preprocessing only and once for actual compilation
13275 of the preprocessed input.
13276 This option may be useful in conjunction with the @option{-B} or
13277 @option{-wrapper} options to specify an alternate preprocessor or
13278 perform additional processing of the program source between
13279 normal preprocessing and compilation.
13280
13281 @end table
13282
13283 @node Assembler Options
13284 @section Passing Options to the Assembler
13285
13286 @c prevent bad page break with this line
13287 You can pass options to the assembler.
13288
13289 @table @gcctabopt
13290 @item -Wa,@var{option}
13291 @opindex Wa
13292 Pass @var{option} as an option to the assembler. If @var{option}
13293 contains commas, it is split into multiple options at the commas.
13294
13295 @item -Xassembler @var{option}
13296 @opindex Xassembler
13297 Pass @var{option} as an option to the assembler. You can use this to
13298 supply system-specific assembler options that GCC does not
13299 recognize.
13300
13301 If you want to pass an option that takes an argument, you must use
13302 @option{-Xassembler} twice, once for the option and once for the argument.
13303
13304 @end table
13305
13306 @node Link Options
13307 @section Options for Linking
13308 @cindex link options
13309 @cindex options, linking
13310
13311 These options come into play when the compiler links object files into
13312 an executable output file. They are meaningless if the compiler is
13313 not doing a link step.
13314
13315 @table @gcctabopt
13316 @cindex file names
13317 @item @var{object-file-name}
13318 A file name that does not end in a special recognized suffix is
13319 considered to name an object file or library. (Object files are
13320 distinguished from libraries by the linker according to the file
13321 contents.) If linking is done, these object files are used as input
13322 to the linker.
13323
13324 @item -c
13325 @itemx -S
13326 @itemx -E
13327 @opindex c
13328 @opindex S
13329 @opindex E
13330 If any of these options is used, then the linker is not run, and
13331 object file names should not be used as arguments. @xref{Overall
13332 Options}.
13333
13334 @item -flinker-output=@var{type}
13335 @opindex flinker-output
13336 This option controls code generation of the link-time optimizer. By
13337 default the linker output is automatically determined by the linker
13338 plugin. For debugging the compiler and if incremental linking with a
13339 non-LTO object file is desired, it may be useful to control the type
13340 manually.
13341
13342 If @var{type} is @samp{exec}, code generation produces a static
13343 binary. In this case @option{-fpic} and @option{-fpie} are both
13344 disabled.
13345
13346 If @var{type} is @samp{dyn}, code generation produces a shared
13347 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13348 but not enabled automatically. This allows to build shared libraries
13349 without position-independent code on architectures where this is
13350 possible, i.e.@: on x86.
13351
13352 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
13353 executable. This results in similar optimizations as @samp{exec}
13354 except that @option{-fpie} is not disabled if specified at compilation
13355 time.
13356
13357 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
13358 done. The sections containing intermediate code for link-time optimization are
13359 merged, pre-optimized, and output to the resulting object file. In addition, if
13360 @option{-ffat-lto-objects} is specified, binary code is produced for future
13361 non-LTO linking. The object file produced by incremental linking is smaller
13362 than a static library produced from the same object files. At link time the
13363 result of incremental linking also loads faster than a static
13364 library assuming that the majority of objects in the library are used.
13365
13366 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13367 code generation is forced, a final binary is produced, and the intermediate
13368 code for later link-time optimization is stripped. When multiple object files
13369 are linked together the resulting code is better optimized than with
13370 link-time optimizations disabled (for example, cross-module inlining
13371 happens), but most of benefits of whole program optimizations are lost.
13372
13373 During the incremental link (by @option{-r}) the linker plugin defaults to
13374 @option{rel}. With current interfaces to GNU Binutils it is however not
13375 possible to incrementally link LTO objects and non-LTO objects into a single
13376 mixed object file. If any of object files in incremental link cannot
13377 be used for link-time optimization, the linker plugin issues a warning and
13378 uses @samp{nolto-rel}. To maintain whole program optimization, it is
13379 recommended to link such objects into static library instead. Alternatively it
13380 is possible to use H.J. Lu's binutils with support for mixed objects.
13381
13382 @item -fuse-ld=bfd
13383 @opindex fuse-ld=bfd
13384 Use the @command{bfd} linker instead of the default linker.
13385
13386 @item -fuse-ld=gold
13387 @opindex fuse-ld=gold
13388 Use the @command{gold} linker instead of the default linker.
13389
13390 @item -fuse-ld=lld
13391 @opindex fuse-ld=lld
13392 Use the LLVM @command{lld} linker instead of the default linker.
13393
13394 @cindex Libraries
13395 @item -l@var{library}
13396 @itemx -l @var{library}
13397 @opindex l
13398 Search the library named @var{library} when linking. (The second
13399 alternative with the library as a separate argument is only for
13400 POSIX compliance and is not recommended.)
13401
13402 The @option{-l} option is passed directly to the linker by GCC. Refer
13403 to your linker documentation for exact details. The general
13404 description below applies to the GNU linker.
13405
13406 The linker searches a standard list of directories for the library.
13407 The directories searched include several standard system directories
13408 plus any that you specify with @option{-L}.
13409
13410 Static libraries are archives of object files, and have file names
13411 like @file{lib@var{library}.a}. Some targets also support shared
13412 libraries, which typically have names like @file{lib@var{library}.so}.
13413 If both static and shared libraries are found, the linker gives
13414 preference to linking with the shared library unless the
13415 @option{-static} option is used.
13416
13417 It makes a difference where in the command you write this option; the
13418 linker searches and processes libraries and object files in the order they
13419 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13420 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13421 to functions in @samp{z}, those functions may not be loaded.
13422
13423 @item -lobjc
13424 @opindex lobjc
13425 You need this special case of the @option{-l} option in order to
13426 link an Objective-C or Objective-C++ program.
13427
13428 @item -nostartfiles
13429 @opindex nostartfiles
13430 Do not use the standard system startup files when linking.
13431 The standard system libraries are used normally, unless @option{-nostdlib},
13432 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13433
13434 @item -nodefaultlibs
13435 @opindex nodefaultlibs
13436 Do not use the standard system libraries when linking.
13437 Only the libraries you specify are passed to the linker, and options
13438 specifying linkage of the system libraries, such as @option{-static-libgcc}
13439 or @option{-shared-libgcc}, are ignored.
13440 The standard startup files are used normally, unless @option{-nostartfiles}
13441 is used.
13442
13443 The compiler may generate calls to @code{memcmp},
13444 @code{memset}, @code{memcpy} and @code{memmove}.
13445 These entries are usually resolved by entries in
13446 libc. These entry points should be supplied through some other
13447 mechanism when this option is specified.
13448
13449 @item -nolibc
13450 @opindex nolibc
13451 Do not use the C library or system libraries tightly coupled with it when
13452 linking. Still link with the startup files, @file{libgcc} or toolchain
13453 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13454 or @file{libstdc++} unless options preventing their inclusion are used as
13455 well. This typically removes @option{-lc} from the link command line, as well
13456 as system libraries that normally go with it and become meaningless when
13457 absence of a C library is assumed, for example @option{-lpthread} or
13458 @option{-lm} in some configurations. This is intended for bare-board
13459 targets when there is indeed no C library available.
13460
13461 @item -nostdlib
13462 @opindex nostdlib
13463 Do not use the standard system startup files or libraries when linking.
13464 No startup files and only the libraries you specify are passed to
13465 the linker, and options specifying linkage of the system libraries, such as
13466 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13467
13468 The compiler may generate calls to @code{memcmp}, @code{memset},
13469 @code{memcpy} and @code{memmove}.
13470 These entries are usually resolved by entries in
13471 libc. These entry points should be supplied through some other
13472 mechanism when this option is specified.
13473
13474 @cindex @option{-lgcc}, use with @option{-nostdlib}
13475 @cindex @option{-nostdlib} and unresolved references
13476 @cindex unresolved references and @option{-nostdlib}
13477 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13478 @cindex @option{-nodefaultlibs} and unresolved references
13479 @cindex unresolved references and @option{-nodefaultlibs}
13480 One of the standard libraries bypassed by @option{-nostdlib} and
13481 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13482 which GCC uses to overcome shortcomings of particular machines, or special
13483 needs for some languages.
13484 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13485 Collection (GCC) Internals},
13486 for more discussion of @file{libgcc.a}.)
13487 In most cases, you need @file{libgcc.a} even when you want to avoid
13488 other standard libraries. In other words, when you specify @option{-nostdlib}
13489 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13490 This ensures that you have no unresolved references to internal GCC
13491 library subroutines.
13492 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13493 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13494 GNU Compiler Collection (GCC) Internals}.)
13495
13496 @item -e @var{entry}
13497 @itemx --entry=@var{entry}
13498 @opindex e
13499 @opindex entry
13500
13501 Specify that the program entry point is @var{entry}. The argument is
13502 interpreted by the linker; the GNU linker accepts either a symbol name
13503 or an address.
13504
13505 @item -pie
13506 @opindex pie
13507 Produce a dynamically linked position independent executable on targets
13508 that support it. For predictable results, you must also specify the same
13509 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13510 or model suboptions) when you specify this linker option.
13511
13512 @item -no-pie
13513 @opindex no-pie
13514 Don't produce a dynamically linked position independent executable.
13515
13516 @item -static-pie
13517 @opindex static-pie
13518 Produce a static position independent executable on targets that support
13519 it. A static position independent executable is similar to a static
13520 executable, but can be loaded at any address without a dynamic linker.
13521 For predictable results, you must also specify the same set of options
13522 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13523 suboptions) when you specify this linker option.
13524
13525 @item -pthread
13526 @opindex pthread
13527 Link with the POSIX threads library. This option is supported on
13528 GNU/Linux targets, most other Unix derivatives, and also on
13529 x86 Cygwin and MinGW targets. On some targets this option also sets
13530 flags for the preprocessor, so it should be used consistently for both
13531 compilation and linking.
13532
13533 @item -r
13534 @opindex r
13535 Produce a relocatable object as output. This is also known as partial
13536 linking.
13537
13538 @item -rdynamic
13539 @opindex rdynamic
13540 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13541 that support it. This instructs the linker to add all symbols, not
13542 only used ones, to the dynamic symbol table. This option is needed
13543 for some uses of @code{dlopen} or to allow obtaining backtraces
13544 from within a program.
13545
13546 @item -s
13547 @opindex s
13548 Remove all symbol table and relocation information from the executable.
13549
13550 @item -static
13551 @opindex static
13552 On systems that support dynamic linking, this overrides @option{-pie}
13553 and prevents linking with the shared libraries. On other systems, this
13554 option has no effect.
13555
13556 @item -shared
13557 @opindex shared
13558 Produce a shared object which can then be linked with other objects to
13559 form an executable. Not all systems support this option. For predictable
13560 results, you must also specify the same set of options used for compilation
13561 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13562 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13563 needs to build supplementary stub code for constructors to work. On
13564 multi-libbed systems, @samp{gcc -shared} must select the correct support
13565 libraries to link against. Failing to supply the correct flags may lead
13566 to subtle defects. Supplying them in cases where they are not necessary
13567 is innocuous.}
13568
13569 @item -shared-libgcc
13570 @itemx -static-libgcc
13571 @opindex shared-libgcc
13572 @opindex static-libgcc
13573 On systems that provide @file{libgcc} as a shared library, these options
13574 force the use of either the shared or static version, respectively.
13575 If no shared version of @file{libgcc} was built when the compiler was
13576 configured, these options have no effect.
13577
13578 There are several situations in which an application should use the
13579 shared @file{libgcc} instead of the static version. The most common
13580 of these is when the application wishes to throw and catch exceptions
13581 across different shared libraries. In that case, each of the libraries
13582 as well as the application itself should use the shared @file{libgcc}.
13583
13584 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13585 whenever you build a shared library or a main executable, because C++
13586 programs typically use exceptions, so this is the right thing to do.
13587
13588 If, instead, you use the GCC driver to create shared libraries, you may
13589 find that they are not always linked with the shared @file{libgcc}.
13590 If GCC finds, at its configuration time, that you have a non-GNU linker
13591 or a GNU linker that does not support option @option{--eh-frame-hdr},
13592 it links the shared version of @file{libgcc} into shared libraries
13593 by default. Otherwise, it takes advantage of the linker and optimizes
13594 away the linking with the shared version of @file{libgcc}, linking with
13595 the static version of libgcc by default. This allows exceptions to
13596 propagate through such shared libraries, without incurring relocation
13597 costs at library load time.
13598
13599 However, if a library or main executable is supposed to throw or catch
13600 exceptions, you must link it using the G++ driver, or using the option
13601 @option{-shared-libgcc}, such that it is linked with the shared
13602 @file{libgcc}.
13603
13604 @item -static-libasan
13605 @opindex static-libasan
13606 When the @option{-fsanitize=address} option is used to link a program,
13607 the GCC driver automatically links against @option{libasan}. If
13608 @file{libasan} is available as a shared library, and the @option{-static}
13609 option is not used, then this links against the shared version of
13610 @file{libasan}. The @option{-static-libasan} option directs the GCC
13611 driver to link @file{libasan} statically, without necessarily linking
13612 other libraries statically.
13613
13614 @item -static-libtsan
13615 @opindex static-libtsan
13616 When the @option{-fsanitize=thread} option is used to link a program,
13617 the GCC driver automatically links against @option{libtsan}. If
13618 @file{libtsan} is available as a shared library, and the @option{-static}
13619 option is not used, then this links against the shared version of
13620 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13621 driver to link @file{libtsan} statically, without necessarily linking
13622 other libraries statically.
13623
13624 @item -static-liblsan
13625 @opindex static-liblsan
13626 When the @option{-fsanitize=leak} option is used to link a program,
13627 the GCC driver automatically links against @option{liblsan}. If
13628 @file{liblsan} is available as a shared library, and the @option{-static}
13629 option is not used, then this links against the shared version of
13630 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13631 driver to link @file{liblsan} statically, without necessarily linking
13632 other libraries statically.
13633
13634 @item -static-libubsan
13635 @opindex static-libubsan
13636 When the @option{-fsanitize=undefined} option is used to link a program,
13637 the GCC driver automatically links against @option{libubsan}. If
13638 @file{libubsan} is available as a shared library, and the @option{-static}
13639 option is not used, then this links against the shared version of
13640 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13641 driver to link @file{libubsan} statically, without necessarily linking
13642 other libraries statically.
13643
13644 @item -static-libstdc++
13645 @opindex static-libstdc++
13646 When the @command{g++} program is used to link a C++ program, it
13647 normally automatically links against @option{libstdc++}. If
13648 @file{libstdc++} is available as a shared library, and the
13649 @option{-static} option is not used, then this links against the
13650 shared version of @file{libstdc++}. That is normally fine. However, it
13651 is sometimes useful to freeze the version of @file{libstdc++} used by
13652 the program without going all the way to a fully static link. The
13653 @option{-static-libstdc++} option directs the @command{g++} driver to
13654 link @file{libstdc++} statically, without necessarily linking other
13655 libraries statically.
13656
13657 @item -symbolic
13658 @opindex symbolic
13659 Bind references to global symbols when building a shared object. Warn
13660 about any unresolved references (unless overridden by the link editor
13661 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13662 this option.
13663
13664 @item -T @var{script}
13665 @opindex T
13666 @cindex linker script
13667 Use @var{script} as the linker script. This option is supported by most
13668 systems using the GNU linker. On some targets, such as bare-board
13669 targets without an operating system, the @option{-T} option may be required
13670 when linking to avoid references to undefined symbols.
13671
13672 @item -Xlinker @var{option}
13673 @opindex Xlinker
13674 Pass @var{option} as an option to the linker. You can use this to
13675 supply system-specific linker options that GCC does not recognize.
13676
13677 If you want to pass an option that takes a separate argument, you must use
13678 @option{-Xlinker} twice, once for the option and once for the argument.
13679 For example, to pass @option{-assert definitions}, you must write
13680 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13681 @option{-Xlinker "-assert definitions"}, because this passes the entire
13682 string as a single argument, which is not what the linker expects.
13683
13684 When using the GNU linker, it is usually more convenient to pass
13685 arguments to linker options using the @option{@var{option}=@var{value}}
13686 syntax than as separate arguments. For example, you can specify
13687 @option{-Xlinker -Map=output.map} rather than
13688 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13689 this syntax for command-line options.
13690
13691 @item -Wl,@var{option}
13692 @opindex Wl
13693 Pass @var{option} as an option to the linker. If @var{option} contains
13694 commas, it is split into multiple options at the commas. You can use this
13695 syntax to pass an argument to the option.
13696 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13697 linker. When using the GNU linker, you can also get the same effect with
13698 @option{-Wl,-Map=output.map}.
13699
13700 @item -u @var{symbol}
13701 @opindex u
13702 Pretend the symbol @var{symbol} is undefined, to force linking of
13703 library modules to define it. You can use @option{-u} multiple times with
13704 different symbols to force loading of additional library modules.
13705
13706 @item -z @var{keyword}
13707 @opindex z
13708 @option{-z} is passed directly on to the linker along with the keyword
13709 @var{keyword}. See the section in the documentation of your linker for
13710 permitted values and their meanings.
13711 @end table
13712
13713 @node Directory Options
13714 @section Options for Directory Search
13715 @cindex directory options
13716 @cindex options, directory search
13717 @cindex search path
13718
13719 These options specify directories to search for header files, for
13720 libraries and for parts of the compiler:
13721
13722 @table @gcctabopt
13723 @include cppdiropts.texi
13724
13725 @item -iplugindir=@var{dir}
13726 @opindex iplugindir=
13727 Set the directory to search for plugins that are passed
13728 by @option{-fplugin=@var{name}} instead of
13729 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13730 to be used by the user, but only passed by the driver.
13731
13732 @item -L@var{dir}
13733 @opindex L
13734 Add directory @var{dir} to the list of directories to be searched
13735 for @option{-l}.
13736
13737 @item -B@var{prefix}
13738 @opindex B
13739 This option specifies where to find the executables, libraries,
13740 include files, and data files of the compiler itself.
13741
13742 The compiler driver program runs one or more of the subprograms
13743 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13744 @var{prefix} as a prefix for each program it tries to run, both with and
13745 without @samp{@var{machine}/@var{version}/} for the corresponding target
13746 machine and compiler version.
13747
13748 For each subprogram to be run, the compiler driver first tries the
13749 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13750 is not specified, the driver tries two standard prefixes,
13751 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13752 those results in a file name that is found, the unmodified program
13753 name is searched for using the directories specified in your
13754 @env{PATH} environment variable.
13755
13756 The compiler checks to see if the path provided by @option{-B}
13757 refers to a directory, and if necessary it adds a directory
13758 separator character at the end of the path.
13759
13760 @option{-B} prefixes that effectively specify directory names also apply
13761 to libraries in the linker, because the compiler translates these
13762 options into @option{-L} options for the linker. They also apply to
13763 include files in the preprocessor, because the compiler translates these
13764 options into @option{-isystem} options for the preprocessor. In this case,
13765 the compiler appends @samp{include} to the prefix.
13766
13767 The runtime support file @file{libgcc.a} can also be searched for using
13768 the @option{-B} prefix, if needed. If it is not found there, the two
13769 standard prefixes above are tried, and that is all. The file is left
13770 out of the link if it is not found by those means.
13771
13772 Another way to specify a prefix much like the @option{-B} prefix is to use
13773 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13774 Variables}.
13775
13776 As a special kludge, if the path provided by @option{-B} is
13777 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13778 9, then it is replaced by @file{[dir/]include}. This is to help
13779 with boot-strapping the compiler.
13780
13781 @item -no-canonical-prefixes
13782 @opindex no-canonical-prefixes
13783 Do not expand any symbolic links, resolve references to @samp{/../}
13784 or @samp{/./}, or make the path absolute when generating a relative
13785 prefix.
13786
13787 @item --sysroot=@var{dir}
13788 @opindex sysroot
13789 Use @var{dir} as the logical root directory for headers and libraries.
13790 For example, if the compiler normally searches for headers in
13791 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13792 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13793
13794 If you use both this option and the @option{-isysroot} option, then
13795 the @option{--sysroot} option applies to libraries, but the
13796 @option{-isysroot} option applies to header files.
13797
13798 The GNU linker (beginning with version 2.16) has the necessary support
13799 for this option. If your linker does not support this option, the
13800 header file aspect of @option{--sysroot} still works, but the
13801 library aspect does not.
13802
13803 @item --no-sysroot-suffix
13804 @opindex no-sysroot-suffix
13805 For some targets, a suffix is added to the root directory specified
13806 with @option{--sysroot}, depending on the other options used, so that
13807 headers may for example be found in
13808 @file{@var{dir}/@var{suffix}/usr/include} instead of
13809 @file{@var{dir}/usr/include}. This option disables the addition of
13810 such a suffix.
13811
13812 @end table
13813
13814 @node Code Gen Options
13815 @section Options for Code Generation Conventions
13816 @cindex code generation conventions
13817 @cindex options, code generation
13818 @cindex run-time options
13819
13820 These machine-independent options control the interface conventions
13821 used in code generation.
13822
13823 Most of them have both positive and negative forms; the negative form
13824 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13825 one of the forms is listed---the one that is not the default. You
13826 can figure out the other form by either removing @samp{no-} or adding
13827 it.
13828
13829 @table @gcctabopt
13830 @item -fstack-reuse=@var{reuse-level}
13831 @opindex fstack_reuse
13832 This option controls stack space reuse for user declared local/auto variables
13833 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13834 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13835 local variables and temporaries, @samp{named_vars} enables the reuse only for
13836 user defined local variables with names, and @samp{none} disables stack reuse
13837 completely. The default value is @samp{all}. The option is needed when the
13838 program extends the lifetime of a scoped local variable or a compiler generated
13839 temporary beyond the end point defined by the language. When a lifetime of
13840 a variable ends, and if the variable lives in memory, the optimizing compiler
13841 has the freedom to reuse its stack space with other temporaries or scoped
13842 local variables whose live range does not overlap with it. Legacy code extending
13843 local lifetime is likely to break with the stack reuse optimization.
13844
13845 For example,
13846
13847 @smallexample
13848 int *p;
13849 @{
13850 int local1;
13851
13852 p = &local1;
13853 local1 = 10;
13854 ....
13855 @}
13856 @{
13857 int local2;
13858 local2 = 20;
13859 ...
13860 @}
13861
13862 if (*p == 10) // out of scope use of local1
13863 @{
13864
13865 @}
13866 @end smallexample
13867
13868 Another example:
13869 @smallexample
13870
13871 struct A
13872 @{
13873 A(int k) : i(k), j(k) @{ @}
13874 int i;
13875 int j;
13876 @};
13877
13878 A *ap;
13879
13880 void foo(const A& ar)
13881 @{
13882 ap = &ar;
13883 @}
13884
13885 void bar()
13886 @{
13887 foo(A(10)); // temp object's lifetime ends when foo returns
13888
13889 @{
13890 A a(20);
13891 ....
13892 @}
13893 ap->i+= 10; // ap references out of scope temp whose space
13894 // is reused with a. What is the value of ap->i?
13895 @}
13896
13897 @end smallexample
13898
13899 The lifetime of a compiler generated temporary is well defined by the C++
13900 standard. When a lifetime of a temporary ends, and if the temporary lives
13901 in memory, the optimizing compiler has the freedom to reuse its stack
13902 space with other temporaries or scoped local variables whose live range
13903 does not overlap with it. However some of the legacy code relies on
13904 the behavior of older compilers in which temporaries' stack space is
13905 not reused, the aggressive stack reuse can lead to runtime errors. This
13906 option is used to control the temporary stack reuse optimization.
13907
13908 @item -ftrapv
13909 @opindex ftrapv
13910 This option generates traps for signed overflow on addition, subtraction,
13911 multiplication operations.
13912 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13913 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13914 @option{-fwrapv} being effective. Note that only active options override, so
13915 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13916 results in @option{-ftrapv} being effective.
13917
13918 @item -fwrapv
13919 @opindex fwrapv
13920 This option instructs the compiler to assume that signed arithmetic
13921 overflow of addition, subtraction and multiplication wraps around
13922 using twos-complement representation. This flag enables some optimizations
13923 and disables others.
13924 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13925 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13926 @option{-fwrapv} being effective. Note that only active options override, so
13927 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13928 results in @option{-ftrapv} being effective.
13929
13930 @item -fwrapv-pointer
13931 @opindex fwrapv-pointer
13932 This option instructs the compiler to assume that pointer arithmetic
13933 overflow on addition and subtraction wraps around using twos-complement
13934 representation. This flag disables some optimizations which assume
13935 pointer overflow is invalid.
13936
13937 @item -fstrict-overflow
13938 @opindex fstrict-overflow
13939 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13940 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13941
13942 @item -fexceptions
13943 @opindex fexceptions
13944 Enable exception handling. Generates extra code needed to propagate
13945 exceptions. For some targets, this implies GCC generates frame
13946 unwind information for all functions, which can produce significant data
13947 size overhead, although it does not affect execution. If you do not
13948 specify this option, GCC enables it by default for languages like
13949 C++ that normally require exception handling, and disables it for
13950 languages like C that do not normally require it. However, you may need
13951 to enable this option when compiling C code that needs to interoperate
13952 properly with exception handlers written in C++. You may also wish to
13953 disable this option if you are compiling older C++ programs that don't
13954 use exception handling.
13955
13956 @item -fnon-call-exceptions
13957 @opindex fnon-call-exceptions
13958 Generate code that allows trapping instructions to throw exceptions.
13959 Note that this requires platform-specific runtime support that does
13960 not exist everywhere. Moreover, it only allows @emph{trapping}
13961 instructions to throw exceptions, i.e.@: memory references or floating-point
13962 instructions. It does not allow exceptions to be thrown from
13963 arbitrary signal handlers such as @code{SIGALRM}.
13964
13965 @item -fdelete-dead-exceptions
13966 @opindex fdelete-dead-exceptions
13967 Consider that instructions that may throw exceptions but don't otherwise
13968 contribute to the execution of the program can be optimized away.
13969 This option is enabled by default for the Ada front end, as permitted by
13970 the Ada language specification.
13971 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13972
13973 @item -funwind-tables
13974 @opindex funwind-tables
13975 Similar to @option{-fexceptions}, except that it just generates any needed
13976 static data, but does not affect the generated code in any other way.
13977 You normally do not need to enable this option; instead, a language processor
13978 that needs this handling enables it on your behalf.
13979
13980 @item -fasynchronous-unwind-tables
13981 @opindex fasynchronous-unwind-tables
13982 Generate unwind table in DWARF format, if supported by target machine. The
13983 table is exact at each instruction boundary, so it can be used for stack
13984 unwinding from asynchronous events (such as debugger or garbage collector).
13985
13986 @item -fno-gnu-unique
13987 @opindex fno-gnu-unique
13988 @opindex fgnu-unique
13989 On systems with recent GNU assembler and C library, the C++ compiler
13990 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13991 of template static data members and static local variables in inline
13992 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13993 is necessary to avoid problems with a library used by two different
13994 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13995 therefore disagreeing with the other one about the binding of the
13996 symbol. But this causes @code{dlclose} to be ignored for affected
13997 DSOs; if your program relies on reinitialization of a DSO via
13998 @code{dlclose} and @code{dlopen}, you can use
13999 @option{-fno-gnu-unique}.
14000
14001 @item -fpcc-struct-return
14002 @opindex fpcc-struct-return
14003 Return ``short'' @code{struct} and @code{union} values in memory like
14004 longer ones, rather than in registers. This convention is less
14005 efficient, but it has the advantage of allowing intercallability between
14006 GCC-compiled files and files compiled with other compilers, particularly
14007 the Portable C Compiler (pcc).
14008
14009 The precise convention for returning structures in memory depends
14010 on the target configuration macros.
14011
14012 Short structures and unions are those whose size and alignment match
14013 that of some integer type.
14014
14015 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
14016 switch is not binary compatible with code compiled with the
14017 @option{-freg-struct-return} switch.
14018 Use it to conform to a non-default application binary interface.
14019
14020 @item -freg-struct-return
14021 @opindex freg-struct-return
14022 Return @code{struct} and @code{union} values in registers when possible.
14023 This is more efficient for small structures than
14024 @option{-fpcc-struct-return}.
14025
14026 If you specify neither @option{-fpcc-struct-return} nor
14027 @option{-freg-struct-return}, GCC defaults to whichever convention is
14028 standard for the target. If there is no standard convention, GCC
14029 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
14030 the principal compiler. In those cases, we can choose the standard, and
14031 we chose the more efficient register return alternative.
14032
14033 @strong{Warning:} code compiled with the @option{-freg-struct-return}
14034 switch is not binary compatible with code compiled with the
14035 @option{-fpcc-struct-return} switch.
14036 Use it to conform to a non-default application binary interface.
14037
14038 @item -fshort-enums
14039 @opindex fshort-enums
14040 Allocate to an @code{enum} type only as many bytes as it needs for the
14041 declared range of possible values. Specifically, the @code{enum} type
14042 is equivalent to the smallest integer type that has enough room.
14043
14044 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
14045 code that is not binary compatible with code generated without that switch.
14046 Use it to conform to a non-default application binary interface.
14047
14048 @item -fshort-wchar
14049 @opindex fshort-wchar
14050 Override the underlying type for @code{wchar_t} to be @code{short
14051 unsigned int} instead of the default for the target. This option is
14052 useful for building programs to run under WINE@.
14053
14054 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
14055 code that is not binary compatible with code generated without that switch.
14056 Use it to conform to a non-default application binary interface.
14057
14058 @item -fno-common
14059 @opindex fno-common
14060 @opindex fcommon
14061 @cindex tentative definitions
14062 In C code, this option controls the placement of global variables
14063 defined without an initializer, known as @dfn{tentative definitions}
14064 in the C standard. Tentative definitions are distinct from declarations
14065 of a variable with the @code{extern} keyword, which do not allocate storage.
14066
14067 Unix C compilers have traditionally allocated storage for
14068 uninitialized global variables in a common block. This allows the
14069 linker to resolve all tentative definitions of the same variable
14070 in different compilation units to the same object, or to a non-tentative
14071 definition.
14072 This is the behavior specified by @option{-fcommon}, and is the default for
14073 GCC on most targets.
14074 On the other hand, this behavior is not required by ISO
14075 C, and on some targets may carry a speed or code size penalty on
14076 variable references.
14077
14078 The @option{-fno-common} option specifies that the compiler should instead
14079 place uninitialized global variables in the BSS section of the object file.
14080 This inhibits the merging of tentative definitions by the linker so
14081 you get a multiple-definition error if the same
14082 variable is defined in more than one compilation unit.
14083 Compiling with @option{-fno-common} is useful on targets for which
14084 it provides better performance, or if you wish to verify that the
14085 program will work on other systems that always treat uninitialized
14086 variable definitions this way.
14087
14088 @item -fno-ident
14089 @opindex fno-ident
14090 @opindex fident
14091 Ignore the @code{#ident} directive.
14092
14093 @item -finhibit-size-directive
14094 @opindex finhibit-size-directive
14095 Don't output a @code{.size} assembler directive, or anything else that
14096 would cause trouble if the function is split in the middle, and the
14097 two halves are placed at locations far apart in memory. This option is
14098 used when compiling @file{crtstuff.c}; you should not need to use it
14099 for anything else.
14100
14101 @item -fverbose-asm
14102 @opindex fverbose-asm
14103 Put extra commentary information in the generated assembly code to
14104 make it more readable. This option is generally only of use to those
14105 who actually need to read the generated assembly code (perhaps while
14106 debugging the compiler itself).
14107
14108 @option{-fno-verbose-asm}, the default, causes the
14109 extra information to be omitted and is useful when comparing two assembler
14110 files.
14111
14112 The added comments include:
14113
14114 @itemize @bullet
14115
14116 @item
14117 information on the compiler version and command-line options,
14118
14119 @item
14120 the source code lines associated with the assembly instructions,
14121 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14122
14123 @item
14124 hints on which high-level expressions correspond to
14125 the various assembly instruction operands.
14126
14127 @end itemize
14128
14129 For example, given this C source file:
14130
14131 @smallexample
14132 int test (int n)
14133 @{
14134 int i;
14135 int total = 0;
14136
14137 for (i = 0; i < n; i++)
14138 total += i * i;
14139
14140 return total;
14141 @}
14142 @end smallexample
14143
14144 compiling to (x86_64) assembly via @option{-S} and emitting the result
14145 direct to stdout via @option{-o} @option{-}
14146
14147 @smallexample
14148 gcc -S test.c -fverbose-asm -Os -o -
14149 @end smallexample
14150
14151 gives output similar to this:
14152
14153 @smallexample
14154 .file "test.c"
14155 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14156 [...snip...]
14157 # options passed:
14158 [...snip...]
14159
14160 .text
14161 .globl test
14162 .type test, @@function
14163 test:
14164 .LFB0:
14165 .cfi_startproc
14166 # test.c:4: int total = 0;
14167 xorl %eax, %eax # <retval>
14168 # test.c:6: for (i = 0; i < n; i++)
14169 xorl %edx, %edx # i
14170 .L2:
14171 # test.c:6: for (i = 0; i < n; i++)
14172 cmpl %edi, %edx # n, i
14173 jge .L5 #,
14174 # test.c:7: total += i * i;
14175 movl %edx, %ecx # i, tmp92
14176 imull %edx, %ecx # i, tmp92
14177 # test.c:6: for (i = 0; i < n; i++)
14178 incl %edx # i
14179 # test.c:7: total += i * i;
14180 addl %ecx, %eax # tmp92, <retval>
14181 jmp .L2 #
14182 .L5:
14183 # test.c:10: @}
14184 ret
14185 .cfi_endproc
14186 .LFE0:
14187 .size test, .-test
14188 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14189 .section .note.GNU-stack,"",@@progbits
14190 @end smallexample
14191
14192 The comments are intended for humans rather than machines and hence the
14193 precise format of the comments is subject to change.
14194
14195 @item -frecord-gcc-switches
14196 @opindex frecord-gcc-switches
14197 This switch causes the command line used to invoke the
14198 compiler to be recorded into the object file that is being created.
14199 This switch is only implemented on some targets and the exact format
14200 of the recording is target and binary file format dependent, but it
14201 usually takes the form of a section containing ASCII text. This
14202 switch is related to the @option{-fverbose-asm} switch, but that
14203 switch only records information in the assembler output file as
14204 comments, so it never reaches the object file.
14205 See also @option{-grecord-gcc-switches} for another
14206 way of storing compiler options into the object file.
14207
14208 @item -fpic
14209 @opindex fpic
14210 @cindex global offset table
14211 @cindex PIC
14212 Generate position-independent code (PIC) suitable for use in a shared
14213 library, if supported for the target machine. Such code accesses all
14214 constant addresses through a global offset table (GOT)@. The dynamic
14215 loader resolves the GOT entries when the program starts (the dynamic
14216 loader is not part of GCC; it is part of the operating system). If
14217 the GOT size for the linked executable exceeds a machine-specific
14218 maximum size, you get an error message from the linker indicating that
14219 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14220 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14221 on the m68k and RS/6000. The x86 has no such limit.)
14222
14223 Position-independent code requires special support, and therefore works
14224 only on certain machines. For the x86, GCC supports PIC for System V
14225 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14226 position-independent.
14227
14228 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14229 are defined to 1.
14230
14231 @item -fPIC
14232 @opindex fPIC
14233 If supported for the target machine, emit position-independent code,
14234 suitable for dynamic linking and avoiding any limit on the size of the
14235 global offset table. This option makes a difference on AArch64, m68k,
14236 PowerPC and SPARC@.
14237
14238 Position-independent code requires special support, and therefore works
14239 only on certain machines.
14240
14241 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14242 are defined to 2.
14243
14244 @item -fpie
14245 @itemx -fPIE
14246 @opindex fpie
14247 @opindex fPIE
14248 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14249 generated position-independent code can be only linked into executables.
14250 Usually these options are used to compile code that will be linked using
14251 the @option{-pie} GCC option.
14252
14253 @option{-fpie} and @option{-fPIE} both define the macros
14254 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14255 for @option{-fpie} and 2 for @option{-fPIE}.
14256
14257 @item -fno-plt
14258 @opindex fno-plt
14259 @opindex fplt
14260 Do not use the PLT for external function calls in position-independent code.
14261 Instead, load the callee address at call sites from the GOT and branch to it.
14262 This leads to more efficient code by eliminating PLT stubs and exposing
14263 GOT loads to optimizations. On architectures such as 32-bit x86 where
14264 PLT stubs expect the GOT pointer in a specific register, this gives more
14265 register allocation freedom to the compiler.
14266 Lazy binding requires use of the PLT;
14267 with @option{-fno-plt} all external symbols are resolved at load time.
14268
14269 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14270 through the PLT for specific external functions.
14271
14272 In position-dependent code, a few targets also convert calls to
14273 functions that are marked to not use the PLT to use the GOT instead.
14274
14275 @item -fno-jump-tables
14276 @opindex fno-jump-tables
14277 @opindex fjump-tables
14278 Do not use jump tables for switch statements even where it would be
14279 more efficient than other code generation strategies. This option is
14280 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14281 building code that forms part of a dynamic linker and cannot
14282 reference the address of a jump table. On some targets, jump tables
14283 do not require a GOT and this option is not needed.
14284
14285 @item -ffixed-@var{reg}
14286 @opindex ffixed
14287 Treat the register named @var{reg} as a fixed register; generated code
14288 should never refer to it (except perhaps as a stack pointer, frame
14289 pointer or in some other fixed role).
14290
14291 @var{reg} must be the name of a register. The register names accepted
14292 are machine-specific and are defined in the @code{REGISTER_NAMES}
14293 macro in the machine description macro file.
14294
14295 This flag does not have a negative form, because it specifies a
14296 three-way choice.
14297
14298 @item -fcall-used-@var{reg}
14299 @opindex fcall-used
14300 Treat the register named @var{reg} as an allocable register that is
14301 clobbered by function calls. It may be allocated for temporaries or
14302 variables that do not live across a call. Functions compiled this way
14303 do not save and restore the register @var{reg}.
14304
14305 It is an error to use this flag with the frame pointer or stack pointer.
14306 Use of this flag for other registers that have fixed pervasive roles in
14307 the machine's execution model produces disastrous results.
14308
14309 This flag does not have a negative form, because it specifies a
14310 three-way choice.
14311
14312 @item -fcall-saved-@var{reg}
14313 @opindex fcall-saved
14314 Treat the register named @var{reg} as an allocable register saved by
14315 functions. It may be allocated even for temporaries or variables that
14316 live across a call. Functions compiled this way save and restore
14317 the register @var{reg} if they use it.
14318
14319 It is an error to use this flag with the frame pointer or stack pointer.
14320 Use of this flag for other registers that have fixed pervasive roles in
14321 the machine's execution model produces disastrous results.
14322
14323 A different sort of disaster results from the use of this flag for
14324 a register in which function values may be returned.
14325
14326 This flag does not have a negative form, because it specifies a
14327 three-way choice.
14328
14329 @item -fpack-struct[=@var{n}]
14330 @opindex fpack-struct
14331 Without a value specified, pack all structure members together without
14332 holes. When a value is specified (which must be a small power of two), pack
14333 structure members according to this value, representing the maximum
14334 alignment (that is, objects with default alignment requirements larger than
14335 this are output potentially unaligned at the next fitting location.
14336
14337 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14338 code that is not binary compatible with code generated without that switch.
14339 Additionally, it makes the code suboptimal.
14340 Use it to conform to a non-default application binary interface.
14341
14342 @item -fleading-underscore
14343 @opindex fleading-underscore
14344 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14345 change the way C symbols are represented in the object file. One use
14346 is to help link with legacy assembly code.
14347
14348 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14349 generate code that is not binary compatible with code generated without that
14350 switch. Use it to conform to a non-default application binary interface.
14351 Not all targets provide complete support for this switch.
14352
14353 @item -ftls-model=@var{model}
14354 @opindex ftls-model
14355 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14356 The @var{model} argument should be one of @samp{global-dynamic},
14357 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14358 Note that the choice is subject to optimization: the compiler may use
14359 a more efficient model for symbols not visible outside of the translation
14360 unit, or if @option{-fpic} is not given on the command line.
14361
14362 The default without @option{-fpic} is @samp{initial-exec}; with
14363 @option{-fpic} the default is @samp{global-dynamic}.
14364
14365 @item -ftrampolines
14366 @opindex ftrampolines
14367 For targets that normally need trampolines for nested functions, always
14368 generate them instead of using descriptors. Otherwise, for targets that
14369 do not need them, like for example HP-PA or IA-64, do nothing.
14370
14371 A trampoline is a small piece of code that is created at run time on the
14372 stack when the address of a nested function is taken, and is used to call
14373 the nested function indirectly. Therefore, it requires the stack to be
14374 made executable in order for the program to work properly.
14375
14376 @option{-fno-trampolines} is enabled by default on a language by language
14377 basis to let the compiler avoid generating them, if it computes that this
14378 is safe, and replace them with descriptors. Descriptors are made up of data
14379 only, but the generated code must be prepared to deal with them. As of this
14380 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14381
14382 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14383 @option{-fno-trampolines} are not binary compatible if nested functions are
14384 present. This option must therefore be used on a program-wide basis and be
14385 manipulated with extreme care.
14386
14387 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14388 @opindex fvisibility
14389 Set the default ELF image symbol visibility to the specified option---all
14390 symbols are marked with this unless overridden within the code.
14391 Using this feature can very substantially improve linking and
14392 load times of shared object libraries, produce more optimized
14393 code, provide near-perfect API export and prevent symbol clashes.
14394 It is @strong{strongly} recommended that you use this in any shared objects
14395 you distribute.
14396
14397 Despite the nomenclature, @samp{default} always means public; i.e.,
14398 available to be linked against from outside the shared object.
14399 @samp{protected} and @samp{internal} are pretty useless in real-world
14400 usage so the only other commonly used option is @samp{hidden}.
14401 The default if @option{-fvisibility} isn't specified is
14402 @samp{default}, i.e., make every symbol public.
14403
14404 A good explanation of the benefits offered by ensuring ELF
14405 symbols have the correct visibility is given by ``How To Write
14406 Shared Libraries'' by Ulrich Drepper (which can be found at
14407 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14408 solution made possible by this option to marking things hidden when
14409 the default is public is to make the default hidden and mark things
14410 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14411 and @code{__attribute__ ((visibility("default")))} instead of
14412 @code{__declspec(dllexport)} you get almost identical semantics with
14413 identical syntax. This is a great boon to those working with
14414 cross-platform projects.
14415
14416 For those adding visibility support to existing code, you may find
14417 @code{#pragma GCC visibility} of use. This works by you enclosing
14418 the declarations you wish to set visibility for with (for example)
14419 @code{#pragma GCC visibility push(hidden)} and
14420 @code{#pragma GCC visibility pop}.
14421 Bear in mind that symbol visibility should be viewed @strong{as
14422 part of the API interface contract} and thus all new code should
14423 always specify visibility when it is not the default; i.e., declarations
14424 only for use within the local DSO should @strong{always} be marked explicitly
14425 as hidden as so to avoid PLT indirection overheads---making this
14426 abundantly clear also aids readability and self-documentation of the code.
14427 Note that due to ISO C++ specification requirements, @code{operator new} and
14428 @code{operator delete} must always be of default visibility.
14429
14430 Be aware that headers from outside your project, in particular system
14431 headers and headers from any other library you use, may not be
14432 expecting to be compiled with visibility other than the default. You
14433 may need to explicitly say @code{#pragma GCC visibility push(default)}
14434 before including any such headers.
14435
14436 @code{extern} declarations are not affected by @option{-fvisibility}, so
14437 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14438 no modifications. However, this means that calls to @code{extern}
14439 functions with no explicit visibility use the PLT, so it is more
14440 effective to use @code{__attribute ((visibility))} and/or
14441 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14442 declarations should be treated as hidden.
14443
14444 Note that @option{-fvisibility} does affect C++ vague linkage
14445 entities. This means that, for instance, an exception class that is
14446 be thrown between DSOs must be explicitly marked with default
14447 visibility so that the @samp{type_info} nodes are unified between
14448 the DSOs.
14449
14450 An overview of these techniques, their benefits and how to use them
14451 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14452
14453 @item -fstrict-volatile-bitfields
14454 @opindex fstrict-volatile-bitfields
14455 This option should be used if accesses to volatile bit-fields (or other
14456 structure fields, although the compiler usually honors those types
14457 anyway) should use a single access of the width of the
14458 field's type, aligned to a natural alignment if possible. For
14459 example, targets with memory-mapped peripheral registers might require
14460 all such accesses to be 16 bits wide; with this flag you can
14461 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14462 is 16 bits on these targets) to force GCC to use 16-bit accesses
14463 instead of, perhaps, a more efficient 32-bit access.
14464
14465 If this option is disabled, the compiler uses the most efficient
14466 instruction. In the previous example, that might be a 32-bit load
14467 instruction, even though that accesses bytes that do not contain
14468 any portion of the bit-field, or memory-mapped registers unrelated to
14469 the one being updated.
14470
14471 In some cases, such as when the @code{packed} attribute is applied to a
14472 structure field, it may not be possible to access the field with a single
14473 read or write that is correctly aligned for the target machine. In this
14474 case GCC falls back to generating multiple accesses rather than code that
14475 will fault or truncate the result at run time.
14476
14477 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14478 not allowed to touch non bit-field members. It is therefore recommended
14479 to define all bits of the field's type as bit-field members.
14480
14481 The default value of this option is determined by the application binary
14482 interface for the target processor.
14483
14484 @item -fsync-libcalls
14485 @opindex fsync-libcalls
14486 This option controls whether any out-of-line instance of the @code{__sync}
14487 family of functions may be used to implement the C++11 @code{__atomic}
14488 family of functions.
14489
14490 The default value of this option is enabled, thus the only useful form
14491 of the option is @option{-fno-sync-libcalls}. This option is used in
14492 the implementation of the @file{libatomic} runtime library.
14493
14494 @end table
14495
14496 @node Developer Options
14497 @section GCC Developer Options
14498 @cindex developer options
14499 @cindex debugging GCC
14500 @cindex debug dump options
14501 @cindex dump options
14502 @cindex compilation statistics
14503
14504 This section describes command-line options that are primarily of
14505 interest to GCC developers, including options to support compiler
14506 testing and investigation of compiler bugs and compile-time
14507 performance problems. This includes options that produce debug dumps
14508 at various points in the compilation; that print statistics such as
14509 memory use and execution time; and that print information about GCC's
14510 configuration, such as where it searches for libraries. You should
14511 rarely need to use any of these options for ordinary compilation and
14512 linking tasks.
14513
14514 Many developer options that cause GCC to dump output to a file take an
14515 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14516 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14517 error.
14518
14519 If @samp{=@var{filename}} is omitted, a default dump file name is
14520 constructed by concatenating the base dump file name, a pass number,
14521 phase letter, and pass name. The base dump file name is the name of
14522 output file produced by the compiler if explicitly specified and not
14523 an executable; otherwise it is the source file name.
14524 The pass number is determined by the order passes are registered with
14525 the compiler's pass manager.
14526 This is generally the same as the order of execution, but passes
14527 registered by plugins, target-specific passes, or passes that are
14528 otherwise registered late are numbered higher than the pass named
14529 @samp{final}, even if they are executed earlier. The phase letter is
14530 one of @samp{i} (inter-procedural analysis), @samp{l}
14531 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14532 The files are created in the directory of the output file.
14533
14534 @table @gcctabopt
14535
14536 @item -d@var{letters}
14537 @itemx -fdump-rtl-@var{pass}
14538 @itemx -fdump-rtl-@var{pass}=@var{filename}
14539 @opindex d
14540 @opindex fdump-rtl-@var{pass}
14541 Says to make debugging dumps during compilation at times specified by
14542 @var{letters}. This is used for debugging the RTL-based passes of the
14543 compiler.
14544
14545 Some @option{-d@var{letters}} switches have different meaning when
14546 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14547 for information about preprocessor-specific dump options.
14548
14549 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14550 @option{-d} option @var{letters}. Here are the possible
14551 letters for use in @var{pass} and @var{letters}, and their meanings:
14552
14553 @table @gcctabopt
14554
14555 @item -fdump-rtl-alignments
14556 @opindex fdump-rtl-alignments
14557 Dump after branch alignments have been computed.
14558
14559 @item -fdump-rtl-asmcons
14560 @opindex fdump-rtl-asmcons
14561 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14562
14563 @item -fdump-rtl-auto_inc_dec
14564 @opindex fdump-rtl-auto_inc_dec
14565 Dump after auto-inc-dec discovery. This pass is only run on
14566 architectures that have auto inc or auto dec instructions.
14567
14568 @item -fdump-rtl-barriers
14569 @opindex fdump-rtl-barriers
14570 Dump after cleaning up the barrier instructions.
14571
14572 @item -fdump-rtl-bbpart
14573 @opindex fdump-rtl-bbpart
14574 Dump after partitioning hot and cold basic blocks.
14575
14576 @item -fdump-rtl-bbro
14577 @opindex fdump-rtl-bbro
14578 Dump after block reordering.
14579
14580 @item -fdump-rtl-btl1
14581 @itemx -fdump-rtl-btl2
14582 @opindex fdump-rtl-btl2
14583 @opindex fdump-rtl-btl2
14584 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14585 after the two branch
14586 target load optimization passes.
14587
14588 @item -fdump-rtl-bypass
14589 @opindex fdump-rtl-bypass
14590 Dump after jump bypassing and control flow optimizations.
14591
14592 @item -fdump-rtl-combine
14593 @opindex fdump-rtl-combine
14594 Dump after the RTL instruction combination pass.
14595
14596 @item -fdump-rtl-compgotos
14597 @opindex fdump-rtl-compgotos
14598 Dump after duplicating the computed gotos.
14599
14600 @item -fdump-rtl-ce1
14601 @itemx -fdump-rtl-ce2
14602 @itemx -fdump-rtl-ce3
14603 @opindex fdump-rtl-ce1
14604 @opindex fdump-rtl-ce2
14605 @opindex fdump-rtl-ce3
14606 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14607 @option{-fdump-rtl-ce3} enable dumping after the three
14608 if conversion passes.
14609
14610 @item -fdump-rtl-cprop_hardreg
14611 @opindex fdump-rtl-cprop_hardreg
14612 Dump after hard register copy propagation.
14613
14614 @item -fdump-rtl-csa
14615 @opindex fdump-rtl-csa
14616 Dump after combining stack adjustments.
14617
14618 @item -fdump-rtl-cse1
14619 @itemx -fdump-rtl-cse2
14620 @opindex fdump-rtl-cse1
14621 @opindex fdump-rtl-cse2
14622 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14623 the two common subexpression elimination passes.
14624
14625 @item -fdump-rtl-dce
14626 @opindex fdump-rtl-dce
14627 Dump after the standalone dead code elimination passes.
14628
14629 @item -fdump-rtl-dbr
14630 @opindex fdump-rtl-dbr
14631 Dump after delayed branch scheduling.
14632
14633 @item -fdump-rtl-dce1
14634 @itemx -fdump-rtl-dce2
14635 @opindex fdump-rtl-dce1
14636 @opindex fdump-rtl-dce2
14637 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14638 the two dead store elimination passes.
14639
14640 @item -fdump-rtl-eh
14641 @opindex fdump-rtl-eh
14642 Dump after finalization of EH handling code.
14643
14644 @item -fdump-rtl-eh_ranges
14645 @opindex fdump-rtl-eh_ranges
14646 Dump after conversion of EH handling range regions.
14647
14648 @item -fdump-rtl-expand
14649 @opindex fdump-rtl-expand
14650 Dump after RTL generation.
14651
14652 @item -fdump-rtl-fwprop1
14653 @itemx -fdump-rtl-fwprop2
14654 @opindex fdump-rtl-fwprop1
14655 @opindex fdump-rtl-fwprop2
14656 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14657 dumping after the two forward propagation passes.
14658
14659 @item -fdump-rtl-gcse1
14660 @itemx -fdump-rtl-gcse2
14661 @opindex fdump-rtl-gcse1
14662 @opindex fdump-rtl-gcse2
14663 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14664 after global common subexpression elimination.
14665
14666 @item -fdump-rtl-init-regs
14667 @opindex fdump-rtl-init-regs
14668 Dump after the initialization of the registers.
14669
14670 @item -fdump-rtl-initvals
14671 @opindex fdump-rtl-initvals
14672 Dump after the computation of the initial value sets.
14673
14674 @item -fdump-rtl-into_cfglayout
14675 @opindex fdump-rtl-into_cfglayout
14676 Dump after converting to cfglayout mode.
14677
14678 @item -fdump-rtl-ira
14679 @opindex fdump-rtl-ira
14680 Dump after iterated register allocation.
14681
14682 @item -fdump-rtl-jump
14683 @opindex fdump-rtl-jump
14684 Dump after the second jump optimization.
14685
14686 @item -fdump-rtl-loop2
14687 @opindex fdump-rtl-loop2
14688 @option{-fdump-rtl-loop2} enables dumping after the rtl
14689 loop optimization passes.
14690
14691 @item -fdump-rtl-mach
14692 @opindex fdump-rtl-mach
14693 Dump after performing the machine dependent reorganization pass, if that
14694 pass exists.
14695
14696 @item -fdump-rtl-mode_sw
14697 @opindex fdump-rtl-mode_sw
14698 Dump after removing redundant mode switches.
14699
14700 @item -fdump-rtl-rnreg
14701 @opindex fdump-rtl-rnreg
14702 Dump after register renumbering.
14703
14704 @item -fdump-rtl-outof_cfglayout
14705 @opindex fdump-rtl-outof_cfglayout
14706 Dump after converting from cfglayout mode.
14707
14708 @item -fdump-rtl-peephole2
14709 @opindex fdump-rtl-peephole2
14710 Dump after the peephole pass.
14711
14712 @item -fdump-rtl-postreload
14713 @opindex fdump-rtl-postreload
14714 Dump after post-reload optimizations.
14715
14716 @item -fdump-rtl-pro_and_epilogue
14717 @opindex fdump-rtl-pro_and_epilogue
14718 Dump after generating the function prologues and epilogues.
14719
14720 @item -fdump-rtl-sched1
14721 @itemx -fdump-rtl-sched2
14722 @opindex fdump-rtl-sched1
14723 @opindex fdump-rtl-sched2
14724 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14725 after the basic block scheduling passes.
14726
14727 @item -fdump-rtl-ree
14728 @opindex fdump-rtl-ree
14729 Dump after sign/zero extension elimination.
14730
14731 @item -fdump-rtl-seqabstr
14732 @opindex fdump-rtl-seqabstr
14733 Dump after common sequence discovery.
14734
14735 @item -fdump-rtl-shorten
14736 @opindex fdump-rtl-shorten
14737 Dump after shortening branches.
14738
14739 @item -fdump-rtl-sibling
14740 @opindex fdump-rtl-sibling
14741 Dump after sibling call optimizations.
14742
14743 @item -fdump-rtl-split1
14744 @itemx -fdump-rtl-split2
14745 @itemx -fdump-rtl-split3
14746 @itemx -fdump-rtl-split4
14747 @itemx -fdump-rtl-split5
14748 @opindex fdump-rtl-split1
14749 @opindex fdump-rtl-split2
14750 @opindex fdump-rtl-split3
14751 @opindex fdump-rtl-split4
14752 @opindex fdump-rtl-split5
14753 These options enable dumping after five rounds of
14754 instruction splitting.
14755
14756 @item -fdump-rtl-sms
14757 @opindex fdump-rtl-sms
14758 Dump after modulo scheduling. This pass is only run on some
14759 architectures.
14760
14761 @item -fdump-rtl-stack
14762 @opindex fdump-rtl-stack
14763 Dump after conversion from GCC's ``flat register file'' registers to the
14764 x87's stack-like registers. This pass is only run on x86 variants.
14765
14766 @item -fdump-rtl-subreg1
14767 @itemx -fdump-rtl-subreg2
14768 @opindex fdump-rtl-subreg1
14769 @opindex fdump-rtl-subreg2
14770 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14771 the two subreg expansion passes.
14772
14773 @item -fdump-rtl-unshare
14774 @opindex fdump-rtl-unshare
14775 Dump after all rtl has been unshared.
14776
14777 @item -fdump-rtl-vartrack
14778 @opindex fdump-rtl-vartrack
14779 Dump after variable tracking.
14780
14781 @item -fdump-rtl-vregs
14782 @opindex fdump-rtl-vregs
14783 Dump after converting virtual registers to hard registers.
14784
14785 @item -fdump-rtl-web
14786 @opindex fdump-rtl-web
14787 Dump after live range splitting.
14788
14789 @item -fdump-rtl-regclass
14790 @itemx -fdump-rtl-subregs_of_mode_init
14791 @itemx -fdump-rtl-subregs_of_mode_finish
14792 @itemx -fdump-rtl-dfinit
14793 @itemx -fdump-rtl-dfinish
14794 @opindex fdump-rtl-regclass
14795 @opindex fdump-rtl-subregs_of_mode_init
14796 @opindex fdump-rtl-subregs_of_mode_finish
14797 @opindex fdump-rtl-dfinit
14798 @opindex fdump-rtl-dfinish
14799 These dumps are defined but always produce empty files.
14800
14801 @item -da
14802 @itemx -fdump-rtl-all
14803 @opindex da
14804 @opindex fdump-rtl-all
14805 Produce all the dumps listed above.
14806
14807 @item -dA
14808 @opindex dA
14809 Annotate the assembler output with miscellaneous debugging information.
14810
14811 @item -dD
14812 @opindex dD
14813 Dump all macro definitions, at the end of preprocessing, in addition to
14814 normal output.
14815
14816 @item -dH
14817 @opindex dH
14818 Produce a core dump whenever an error occurs.
14819
14820 @item -dp
14821 @opindex dp
14822 Annotate the assembler output with a comment indicating which
14823 pattern and alternative is used. The length and cost of each instruction are
14824 also printed.
14825
14826 @item -dP
14827 @opindex dP
14828 Dump the RTL in the assembler output as a comment before each instruction.
14829 Also turns on @option{-dp} annotation.
14830
14831 @item -dx
14832 @opindex dx
14833 Just generate RTL for a function instead of compiling it. Usually used
14834 with @option{-fdump-rtl-expand}.
14835 @end table
14836
14837 @item -fdump-debug
14838 @opindex fdump-debug
14839 Dump debugging information generated during the debug
14840 generation phase.
14841
14842 @item -fdump-earlydebug
14843 @opindex fdump-earlydebug
14844 Dump debugging information generated during the early debug
14845 generation phase.
14846
14847 @item -fdump-noaddr
14848 @opindex fdump-noaddr
14849 When doing debugging dumps, suppress address output. This makes it more
14850 feasible to use diff on debugging dumps for compiler invocations with
14851 different compiler binaries and/or different
14852 text / bss / data / heap / stack / dso start locations.
14853
14854 @item -freport-bug
14855 @opindex freport-bug
14856 Collect and dump debug information into a temporary file if an
14857 internal compiler error (ICE) occurs.
14858
14859 @item -fdump-unnumbered
14860 @opindex fdump-unnumbered
14861 When doing debugging dumps, suppress instruction numbers and address output.
14862 This makes it more feasible to use diff on debugging dumps for compiler
14863 invocations with different options, in particular with and without
14864 @option{-g}.
14865
14866 @item -fdump-unnumbered-links
14867 @opindex fdump-unnumbered-links
14868 When doing debugging dumps (see @option{-d} option above), suppress
14869 instruction numbers for the links to the previous and next instructions
14870 in a sequence.
14871
14872 @item -fdump-ipa-@var{switch}
14873 @itemx -fdump-ipa-@var{switch}-@var{options}
14874 @opindex fdump-ipa
14875 Control the dumping at various stages of inter-procedural analysis
14876 language tree to a file. The file name is generated by appending a
14877 switch specific suffix to the source file name, and the file is created
14878 in the same directory as the output file. The following dumps are
14879 possible:
14880
14881 @table @samp
14882 @item all
14883 Enables all inter-procedural analysis dumps.
14884
14885 @item cgraph
14886 Dumps information about call-graph optimization, unused function removal,
14887 and inlining decisions.
14888
14889 @item inline
14890 Dump after function inlining.
14891
14892 @end table
14893
14894 Additionally, the options @option{-optimized}, @option{-missed},
14895 @option{-note}, and @option{-all} can be provided, with the same meaning
14896 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14897
14898 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14899 information on callsites that were inlined, along with callsites
14900 that were not inlined.
14901
14902 By default, the dump will contain messages about successful
14903 optimizations (equivalent to @option{-optimized}) together with
14904 low-level details about the analysis.
14905
14906 @item -fdump-lang-all
14907 @itemx -fdump-lang-@var{switch}
14908 @itemx -fdump-lang-@var{switch}-@var{options}
14909 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14910 @opindex fdump-lang-all
14911 @opindex fdump-lang
14912 Control the dumping of language-specific information. The @var{options}
14913 and @var{filename} portions behave as described in the
14914 @option{-fdump-tree} option. The following @var{switch} values are
14915 accepted:
14916
14917 @table @samp
14918 @item all
14919
14920 Enable all language-specific dumps.
14921
14922 @item class
14923 Dump class hierarchy information. Virtual table information is emitted
14924 unless '@option{slim}' is specified. This option is applicable to C++ only.
14925
14926 @item raw
14927 Dump the raw internal tree data. This option is applicable to C++ only.
14928
14929 @end table
14930
14931 @item -fdump-passes
14932 @opindex fdump-passes
14933 Print on @file{stderr} the list of optimization passes that are turned
14934 on and off by the current command-line options.
14935
14936 @item -fdump-statistics-@var{option}
14937 @opindex fdump-statistics
14938 Enable and control dumping of pass statistics in a separate file. The
14939 file name is generated by appending a suffix ending in
14940 @samp{.statistics} to the source file name, and the file is created in
14941 the same directory as the output file. If the @samp{-@var{option}}
14942 form is used, @samp{-stats} causes counters to be summed over the
14943 whole compilation unit while @samp{-details} dumps every event as
14944 the passes generate them. The default with no option is to sum
14945 counters for each function compiled.
14946
14947 @item -fdump-tree-all
14948 @itemx -fdump-tree-@var{switch}
14949 @itemx -fdump-tree-@var{switch}-@var{options}
14950 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14951 @opindex fdump-tree-all
14952 @opindex fdump-tree
14953 Control the dumping at various stages of processing the intermediate
14954 language tree to a file. If the @samp{-@var{options}}
14955 form is used, @var{options} is a list of @samp{-} separated options
14956 which control the details of the dump. Not all options are applicable
14957 to all dumps; those that are not meaningful are ignored. The
14958 following options are available
14959
14960 @table @samp
14961 @item address
14962 Print the address of each node. Usually this is not meaningful as it
14963 changes according to the environment and source file. Its primary use
14964 is for tying up a dump file with a debug environment.
14965 @item asmname
14966 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14967 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14968 use working backward from mangled names in the assembly file.
14969 @item slim
14970 When dumping front-end intermediate representations, inhibit dumping
14971 of members of a scope or body of a function merely because that scope
14972 has been reached. Only dump such items when they are directly reachable
14973 by some other path.
14974
14975 When dumping pretty-printed trees, this option inhibits dumping the
14976 bodies of control structures.
14977
14978 When dumping RTL, print the RTL in slim (condensed) form instead of
14979 the default LISP-like representation.
14980 @item raw
14981 Print a raw representation of the tree. By default, trees are
14982 pretty-printed into a C-like representation.
14983 @item details
14984 Enable more detailed dumps (not honored by every dump option). Also
14985 include information from the optimization passes.
14986 @item stats
14987 Enable dumping various statistics about the pass (not honored by every dump
14988 option).
14989 @item blocks
14990 Enable showing basic block boundaries (disabled in raw dumps).
14991 @item graph
14992 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14993 dump a representation of the control flow graph suitable for viewing with
14994 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14995 the file is pretty-printed as a subgraph, so that GraphViz can render them
14996 all in a single plot.
14997
14998 This option currently only works for RTL dumps, and the RTL is always
14999 dumped in slim form.
15000 @item vops
15001 Enable showing virtual operands for every statement.
15002 @item lineno
15003 Enable showing line numbers for statements.
15004 @item uid
15005 Enable showing the unique ID (@code{DECL_UID}) for each variable.
15006 @item verbose
15007 Enable showing the tree dump for each statement.
15008 @item eh
15009 Enable showing the EH region number holding each statement.
15010 @item scev
15011 Enable showing scalar evolution analysis details.
15012 @item optimized
15013 Enable showing optimization information (only available in certain
15014 passes).
15015 @item missed
15016 Enable showing missed optimization information (only available in certain
15017 passes).
15018 @item note
15019 Enable other detailed optimization information (only available in
15020 certain passes).
15021 @item all
15022 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
15023 and @option{lineno}.
15024 @item optall
15025 Turn on all optimization options, i.e., @option{optimized},
15026 @option{missed}, and @option{note}.
15027 @end table
15028
15029 To determine what tree dumps are available or find the dump for a pass
15030 of interest follow the steps below.
15031
15032 @enumerate
15033 @item
15034 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
15035 look for a code that corresponds to the pass you are interested in.
15036 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
15037 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
15038 The number at the end distinguishes distinct invocations of the same pass.
15039 @item
15040 To enable the creation of the dump file, append the pass code to
15041 the @option{-fdump-} option prefix and invoke GCC with it. For example,
15042 to enable the dump from the Early Value Range Propagation pass, invoke
15043 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
15044 specify the name of the dump file. If you don't specify one, GCC
15045 creates as described below.
15046 @item
15047 Find the pass dump in a file whose name is composed of three components
15048 separated by a period: the name of the source file GCC was invoked to
15049 compile, a numeric suffix indicating the pass number followed by the
15050 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
15051 and finally the pass code. For example, the Early VRP pass dump might
15052 be in a file named @file{myfile.c.038t.evrp} in the current working
15053 directory. Note that the numeric codes are not stable and may change
15054 from one version of GCC to another.
15055 @end enumerate
15056
15057 @item -fopt-info
15058 @itemx -fopt-info-@var{options}
15059 @itemx -fopt-info-@var{options}=@var{filename}
15060 @opindex fopt-info
15061 Controls optimization dumps from various optimization passes. If the
15062 @samp{-@var{options}} form is used, @var{options} is a list of
15063 @samp{-} separated option keywords to select the dump details and
15064 optimizations.
15065
15066 The @var{options} can be divided into three groups:
15067 @enumerate
15068 @item
15069 options describing what kinds of messages should be emitted,
15070 @item
15071 options describing the verbosity of the dump, and
15072 @item
15073 options describing which optimizations should be included.
15074 @end enumerate
15075 The options from each group can be freely mixed as they are
15076 non-overlapping. However, in case of any conflicts,
15077 the later options override the earlier options on the command
15078 line.
15079
15080 The following options control which kinds of messages should be emitted:
15081
15082 @table @samp
15083 @item optimized
15084 Print information when an optimization is successfully applied. It is
15085 up to a pass to decide which information is relevant. For example, the
15086 vectorizer passes print the source location of loops which are
15087 successfully vectorized.
15088 @item missed
15089 Print information about missed optimizations. Individual passes
15090 control which information to include in the output.
15091 @item note
15092 Print verbose information about optimizations, such as certain
15093 transformations, more detailed messages about decisions etc.
15094 @item all
15095 Print detailed optimization information. This includes
15096 @samp{optimized}, @samp{missed}, and @samp{note}.
15097 @end table
15098
15099 The following option controls the dump verbosity:
15100
15101 @table @samp
15102 @item internals
15103 By default, only ``high-level'' messages are emitted. This option enables
15104 additional, more detailed, messages, which are likely to only be of interest
15105 to GCC developers.
15106 @end table
15107
15108 One or more of the following option keywords can be used to describe a
15109 group of optimizations:
15110
15111 @table @samp
15112 @item ipa
15113 Enable dumps from all interprocedural optimizations.
15114 @item loop
15115 Enable dumps from all loop optimizations.
15116 @item inline
15117 Enable dumps from all inlining optimizations.
15118 @item omp
15119 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
15120 @item vec
15121 Enable dumps from all vectorization optimizations.
15122 @item optall
15123 Enable dumps from all optimizations. This is a superset of
15124 the optimization groups listed above.
15125 @end table
15126
15127 If @var{options} is
15128 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
15129 about successful optimizations from all the passes, omitting messages
15130 that are treated as ``internals''.
15131
15132 If the @var{filename} is provided, then the dumps from all the
15133 applicable optimizations are concatenated into the @var{filename}.
15134 Otherwise the dump is output onto @file{stderr}. Though multiple
15135 @option{-fopt-info} options are accepted, only one of them can include
15136 a @var{filename}. If other filenames are provided then all but the
15137 first such option are ignored.
15138
15139 Note that the output @var{filename} is overwritten
15140 in case of multiple translation units. If a combined output from
15141 multiple translation units is desired, @file{stderr} should be used
15142 instead.
15143
15144 In the following example, the optimization info is output to
15145 @file{stderr}:
15146
15147 @smallexample
15148 gcc -O3 -fopt-info
15149 @end smallexample
15150
15151 This example:
15152 @smallexample
15153 gcc -O3 -fopt-info-missed=missed.all
15154 @end smallexample
15155
15156 @noindent
15157 outputs missed optimization report from all the passes into
15158 @file{missed.all}, and this one:
15159
15160 @smallexample
15161 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15162 @end smallexample
15163
15164 @noindent
15165 prints information about missed optimization opportunities from
15166 vectorization passes on @file{stderr}.
15167 Note that @option{-fopt-info-vec-missed} is equivalent to
15168 @option{-fopt-info-missed-vec}. The order of the optimization group
15169 names and message types listed after @option{-fopt-info} does not matter.
15170
15171 As another example,
15172 @smallexample
15173 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15174 @end smallexample
15175
15176 @noindent
15177 outputs information about missed optimizations as well as
15178 optimized locations from all the inlining passes into
15179 @file{inline.txt}.
15180
15181 Finally, consider:
15182
15183 @smallexample
15184 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15185 @end smallexample
15186
15187 @noindent
15188 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15189 in conflict since only one output file is allowed. In this case, only
15190 the first option takes effect and the subsequent options are
15191 ignored. Thus only @file{vec.miss} is produced which contains
15192 dumps from the vectorizer about missed opportunities.
15193
15194 @item -fsave-optimization-record
15195 @opindex fsave-optimization-record
15196 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15197 were performed, for those optimizations that support @option{-fopt-info}.
15198
15199 This option is experimental and the format of the data within the
15200 compressed JSON file is subject to change.
15201
15202 It is roughly equivalent to a machine-readable version of
15203 @option{-fopt-info-all}, as a collection of messages with source file,
15204 line number and column number, with the following additional data for
15205 each message:
15206
15207 @itemize @bullet
15208
15209 @item
15210 the execution count of the code being optimized, along with metadata about
15211 whether this was from actual profile data, or just an estimate, allowing
15212 consumers to prioritize messages by code hotness,
15213
15214 @item
15215 the function name of the code being optimized, where applicable,
15216
15217 @item
15218 the ``inlining chain'' for the code being optimized, so that when
15219 a function is inlined into several different places (which might
15220 themselves be inlined), the reader can distinguish between the copies,
15221
15222 @item
15223 objects identifying those parts of the message that refer to expressions,
15224 statements or symbol-table nodes, which of these categories they are, and,
15225 when available, their source code location,
15226
15227 @item
15228 the GCC pass that emitted the message, and
15229
15230 @item
15231 the location in GCC's own code from which the message was emitted
15232
15233 @end itemize
15234
15235 Additionally, some messages are logically nested within other
15236 messages, reflecting implementation details of the optimization
15237 passes.
15238
15239 @item -fsched-verbose=@var{n}
15240 @opindex fsched-verbose
15241 On targets that use instruction scheduling, this option controls the
15242 amount of debugging output the scheduler prints to the dump files.
15243
15244 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15245 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15246 For @var{n} greater than one, it also output basic block probabilities,
15247 detailed ready list information and unit/insn info. For @var{n} greater
15248 than two, it includes RTL at abort point, control-flow and regions info.
15249 And for @var{n} over four, @option{-fsched-verbose} also includes
15250 dependence info.
15251
15252
15253
15254 @item -fenable-@var{kind}-@var{pass}
15255 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15256 @opindex fdisable-
15257 @opindex fenable-
15258
15259 This is a set of options that are used to explicitly disable/enable
15260 optimization passes. These options are intended for use for debugging GCC.
15261 Compiler users should use regular options for enabling/disabling
15262 passes instead.
15263
15264 @table @gcctabopt
15265
15266 @item -fdisable-ipa-@var{pass}
15267 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15268 statically invoked in the compiler multiple times, the pass name should be
15269 appended with a sequential number starting from 1.
15270
15271 @item -fdisable-rtl-@var{pass}
15272 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15273 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15274 statically invoked in the compiler multiple times, the pass name should be
15275 appended with a sequential number starting from 1. @var{range-list} is a
15276 comma-separated list of function ranges or assembler names. Each range is a number
15277 pair separated by a colon. The range is inclusive in both ends. If the range
15278 is trivial, the number pair can be simplified as a single number. If the
15279 function's call graph node's @var{uid} falls within one of the specified ranges,
15280 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15281 function header of a dump file, and the pass names can be dumped by using
15282 option @option{-fdump-passes}.
15283
15284 @item -fdisable-tree-@var{pass}
15285 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15286 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15287 option arguments.
15288
15289 @item -fenable-ipa-@var{pass}
15290 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15291 statically invoked in the compiler multiple times, the pass name should be
15292 appended with a sequential number starting from 1.
15293
15294 @item -fenable-rtl-@var{pass}
15295 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15296 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15297 description and examples.
15298
15299 @item -fenable-tree-@var{pass}
15300 @itemx -fenable-tree-@var{pass}=@var{range-list}
15301 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15302 of option arguments.
15303
15304 @end table
15305
15306 Here are some examples showing uses of these options.
15307
15308 @smallexample
15309
15310 # disable ccp1 for all functions
15311 -fdisable-tree-ccp1
15312 # disable complete unroll for function whose cgraph node uid is 1
15313 -fenable-tree-cunroll=1
15314 # disable gcse2 for functions at the following ranges [1,1],
15315 # [300,400], and [400,1000]
15316 # disable gcse2 for functions foo and foo2
15317 -fdisable-rtl-gcse2=foo,foo2
15318 # disable early inlining
15319 -fdisable-tree-einline
15320 # disable ipa inlining
15321 -fdisable-ipa-inline
15322 # enable tree full unroll
15323 -fenable-tree-unroll
15324
15325 @end smallexample
15326
15327 @item -fchecking
15328 @itemx -fchecking=@var{n}
15329 @opindex fchecking
15330 @opindex fno-checking
15331 Enable internal consistency checking. The default depends on
15332 the compiler configuration. @option{-fchecking=2} enables further
15333 internal consistency checking that might affect code generation.
15334
15335 @item -frandom-seed=@var{string}
15336 @opindex frandom-seed
15337 This option provides a seed that GCC uses in place of
15338 random numbers in generating certain symbol names
15339 that have to be different in every compiled file. It is also used to
15340 place unique stamps in coverage data files and the object files that
15341 produce them. You can use the @option{-frandom-seed} option to produce
15342 reproducibly identical object files.
15343
15344 The @var{string} can either be a number (decimal, octal or hex) or an
15345 arbitrary string (in which case it's converted to a number by
15346 computing CRC32).
15347
15348 The @var{string} should be different for every file you compile.
15349
15350 @item -save-temps
15351 @itemx -save-temps=cwd
15352 @opindex save-temps
15353 Store the usual ``temporary'' intermediate files permanently; place them
15354 in the current directory and name them based on the source file. Thus,
15355 compiling @file{foo.c} with @option{-c -save-temps} produces files
15356 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15357 preprocessed @file{foo.i} output file even though the compiler now
15358 normally uses an integrated preprocessor.
15359
15360 When used in combination with the @option{-x} command-line option,
15361 @option{-save-temps} is sensible enough to avoid over writing an
15362 input source file with the same extension as an intermediate file.
15363 The corresponding intermediate file may be obtained by renaming the
15364 source file before using @option{-save-temps}.
15365
15366 If you invoke GCC in parallel, compiling several different source
15367 files that share a common base name in different subdirectories or the
15368 same source file compiled for multiple output destinations, it is
15369 likely that the different parallel compilers will interfere with each
15370 other, and overwrite the temporary files. For instance:
15371
15372 @smallexample
15373 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15374 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15375 @end smallexample
15376
15377 may result in @file{foo.i} and @file{foo.o} being written to
15378 simultaneously by both compilers.
15379
15380 @item -save-temps=obj
15381 @opindex save-temps=obj
15382 Store the usual ``temporary'' intermediate files permanently. If the
15383 @option{-o} option is used, the temporary files are based on the
15384 object file. If the @option{-o} option is not used, the
15385 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15386
15387 For example:
15388
15389 @smallexample
15390 gcc -save-temps=obj -c foo.c
15391 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15392 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15393 @end smallexample
15394
15395 @noindent
15396 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15397 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15398 @file{dir2/yfoobar.o}.
15399
15400 @item -time@r{[}=@var{file}@r{]}
15401 @opindex time
15402 Report the CPU time taken by each subprocess in the compilation
15403 sequence. For C source files, this is the compiler proper and assembler
15404 (plus the linker if linking is done).
15405
15406 Without the specification of an output file, the output looks like this:
15407
15408 @smallexample
15409 # cc1 0.12 0.01
15410 # as 0.00 0.01
15411 @end smallexample
15412
15413 The first number on each line is the ``user time'', that is time spent
15414 executing the program itself. The second number is ``system time'',
15415 time spent executing operating system routines on behalf of the program.
15416 Both numbers are in seconds.
15417
15418 With the specification of an output file, the output is appended to the
15419 named file, and it looks like this:
15420
15421 @smallexample
15422 0.12 0.01 cc1 @var{options}
15423 0.00 0.01 as @var{options}
15424 @end smallexample
15425
15426 The ``user time'' and the ``system time'' are moved before the program
15427 name, and the options passed to the program are displayed, so that one
15428 can later tell what file was being compiled, and with which options.
15429
15430 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15431 @opindex fdump-final-insns
15432 Dump the final internal representation (RTL) to @var{file}. If the
15433 optional argument is omitted (or if @var{file} is @code{.}), the name
15434 of the dump file is determined by appending @code{.gkd} to the
15435 compilation output file name.
15436
15437 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15438 @opindex fcompare-debug
15439 @opindex fno-compare-debug
15440 If no error occurs during compilation, run the compiler a second time,
15441 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15442 passed to the second compilation. Dump the final internal
15443 representation in both compilations, and print an error if they differ.
15444
15445 If the equal sign is omitted, the default @option{-gtoggle} is used.
15446
15447 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15448 and nonzero, implicitly enables @option{-fcompare-debug}. If
15449 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15450 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15451 is used.
15452
15453 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15454 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15455 of the final representation and the second compilation, preventing even
15456 @env{GCC_COMPARE_DEBUG} from taking effect.
15457
15458 To verify full coverage during @option{-fcompare-debug} testing, set
15459 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15460 which GCC rejects as an invalid option in any actual compilation
15461 (rather than preprocessing, assembly or linking). To get just a
15462 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15463 not overridden} will do.
15464
15465 @item -fcompare-debug-second
15466 @opindex fcompare-debug-second
15467 This option is implicitly passed to the compiler for the second
15468 compilation requested by @option{-fcompare-debug}, along with options to
15469 silence warnings, and omitting other options that would cause the compiler
15470 to produce output to files or to standard output as a side effect. Dump
15471 files and preserved temporary files are renamed so as to contain the
15472 @code{.gk} additional extension during the second compilation, to avoid
15473 overwriting those generated by the first.
15474
15475 When this option is passed to the compiler driver, it causes the
15476 @emph{first} compilation to be skipped, which makes it useful for little
15477 other than debugging the compiler proper.
15478
15479 @item -gtoggle
15480 @opindex gtoggle
15481 Turn off generation of debug info, if leaving out this option
15482 generates it, or turn it on at level 2 otherwise. The position of this
15483 argument in the command line does not matter; it takes effect after all
15484 other options are processed, and it does so only once, no matter how
15485 many times it is given. This is mainly intended to be used with
15486 @option{-fcompare-debug}.
15487
15488 @item -fvar-tracking-assignments-toggle
15489 @opindex fvar-tracking-assignments-toggle
15490 @opindex fno-var-tracking-assignments-toggle
15491 Toggle @option{-fvar-tracking-assignments}, in the same way that
15492 @option{-gtoggle} toggles @option{-g}.
15493
15494 @item -Q
15495 @opindex Q
15496 Makes the compiler print out each function name as it is compiled, and
15497 print some statistics about each pass when it finishes.
15498
15499 @item -ftime-report
15500 @opindex ftime-report
15501 Makes the compiler print some statistics about the time consumed by each
15502 pass when it finishes.
15503
15504 @item -ftime-report-details
15505 @opindex ftime-report-details
15506 Record the time consumed by infrastructure parts separately for each pass.
15507
15508 @item -fira-verbose=@var{n}
15509 @opindex fira-verbose
15510 Control the verbosity of the dump file for the integrated register allocator.
15511 The default value is 5. If the value @var{n} is greater or equal to 10,
15512 the dump output is sent to stderr using the same format as @var{n} minus 10.
15513
15514 @item -flto-report
15515 @opindex flto-report
15516 Prints a report with internal details on the workings of the link-time
15517 optimizer. The contents of this report vary from version to version.
15518 It is meant to be useful to GCC developers when processing object
15519 files in LTO mode (via @option{-flto}).
15520
15521 Disabled by default.
15522
15523 @item -flto-report-wpa
15524 @opindex flto-report-wpa
15525 Like @option{-flto-report}, but only print for the WPA phase of link-time
15526 optimization.
15527
15528 @item -fmem-report
15529 @opindex fmem-report
15530 Makes the compiler print some statistics about permanent memory
15531 allocation when it finishes.
15532
15533 @item -fmem-report-wpa
15534 @opindex fmem-report-wpa
15535 Makes the compiler print some statistics about permanent memory
15536 allocation for the WPA phase only.
15537
15538 @item -fpre-ipa-mem-report
15539 @opindex fpre-ipa-mem-report
15540 @item -fpost-ipa-mem-report
15541 @opindex fpost-ipa-mem-report
15542 Makes the compiler print some statistics about permanent memory
15543 allocation before or after interprocedural optimization.
15544
15545 @item -fprofile-report
15546 @opindex fprofile-report
15547 Makes the compiler print some statistics about consistency of the
15548 (estimated) profile and effect of individual passes.
15549
15550 @item -fstack-usage
15551 @opindex fstack-usage
15552 Makes the compiler output stack usage information for the program, on a
15553 per-function basis. The filename for the dump is made by appending
15554 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15555 the output file, if explicitly specified and it is not an executable,
15556 otherwise it is the basename of the source file. An entry is made up
15557 of three fields:
15558
15559 @itemize
15560 @item
15561 The name of the function.
15562 @item
15563 A number of bytes.
15564 @item
15565 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15566 @end itemize
15567
15568 The qualifier @code{static} means that the function manipulates the stack
15569 statically: a fixed number of bytes are allocated for the frame on function
15570 entry and released on function exit; no stack adjustments are otherwise made
15571 in the function. The second field is this fixed number of bytes.
15572
15573 The qualifier @code{dynamic} means that the function manipulates the stack
15574 dynamically: in addition to the static allocation described above, stack
15575 adjustments are made in the body of the function, for example to push/pop
15576 arguments around function calls. If the qualifier @code{bounded} is also
15577 present, the amount of these adjustments is bounded at compile time and
15578 the second field is an upper bound of the total amount of stack used by
15579 the function. If it is not present, the amount of these adjustments is
15580 not bounded at compile time and the second field only represents the
15581 bounded part.
15582
15583 @item -fstats
15584 @opindex fstats
15585 Emit statistics about front-end processing at the end of the compilation.
15586 This option is supported only by the C++ front end, and
15587 the information is generally only useful to the G++ development team.
15588
15589 @item -fdbg-cnt-list
15590 @opindex fdbg-cnt-list
15591 Print the name and the counter upper bound for all debug counters.
15592
15593
15594 @item -fdbg-cnt=@var{counter-value-list}
15595 @opindex fdbg-cnt
15596 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15597 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15598 tuples which sets the lower and the upper bound of each debug
15599 counter @var{name}. The @var{lower_bound} is optional and is zero
15600 initialized if not set.
15601 All debug counters have the initial upper bound of @code{UINT_MAX};
15602 thus @code{dbg_cnt} returns true always unless the upper bound
15603 is set by this option.
15604 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15605 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15606 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15607
15608 @item -print-file-name=@var{library}
15609 @opindex print-file-name
15610 Print the full absolute name of the library file @var{library} that
15611 would be used when linking---and don't do anything else. With this
15612 option, GCC does not compile or link anything; it just prints the
15613 file name.
15614
15615 @item -print-multi-directory
15616 @opindex print-multi-directory
15617 Print the directory name corresponding to the multilib selected by any
15618 other switches present in the command line. This directory is supposed
15619 to exist in @env{GCC_EXEC_PREFIX}.
15620
15621 @item -print-multi-lib
15622 @opindex print-multi-lib
15623 Print the mapping from multilib directory names to compiler switches
15624 that enable them. The directory name is separated from the switches by
15625 @samp{;}, and each switch starts with an @samp{@@} instead of the
15626 @samp{-}, without spaces between multiple switches. This is supposed to
15627 ease shell processing.
15628
15629 @item -print-multi-os-directory
15630 @opindex print-multi-os-directory
15631 Print the path to OS libraries for the selected
15632 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15633 present in the @file{lib} subdirectory and no multilibs are used, this is
15634 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15635 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15636 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15637 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15638
15639 @item -print-multiarch
15640 @opindex print-multiarch
15641 Print the path to OS libraries for the selected multiarch,
15642 relative to some @file{lib} subdirectory.
15643
15644 @item -print-prog-name=@var{program}
15645 @opindex print-prog-name
15646 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15647
15648 @item -print-libgcc-file-name
15649 @opindex print-libgcc-file-name
15650 Same as @option{-print-file-name=libgcc.a}.
15651
15652 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15653 but you do want to link with @file{libgcc.a}. You can do:
15654
15655 @smallexample
15656 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15657 @end smallexample
15658
15659 @item -print-search-dirs
15660 @opindex print-search-dirs
15661 Print the name of the configured installation directory and a list of
15662 program and library directories @command{gcc} searches---and don't do anything else.
15663
15664 This is useful when @command{gcc} prints the error message
15665 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15666 To resolve this you either need to put @file{cpp0} and the other compiler
15667 components where @command{gcc} expects to find them, or you can set the environment
15668 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15669 Don't forget the trailing @samp{/}.
15670 @xref{Environment Variables}.
15671
15672 @item -print-sysroot
15673 @opindex print-sysroot
15674 Print the target sysroot directory that is used during
15675 compilation. This is the target sysroot specified either at configure
15676 time or using the @option{--sysroot} option, possibly with an extra
15677 suffix that depends on compilation options. If no target sysroot is
15678 specified, the option prints nothing.
15679
15680 @item -print-sysroot-headers-suffix
15681 @opindex print-sysroot-headers-suffix
15682 Print the suffix added to the target sysroot when searching for
15683 headers, or give an error if the compiler is not configured with such
15684 a suffix---and don't do anything else.
15685
15686 @item -dumpmachine
15687 @opindex dumpmachine
15688 Print the compiler's target machine (for example,
15689 @samp{i686-pc-linux-gnu})---and don't do anything else.
15690
15691 @item -dumpversion
15692 @opindex dumpversion
15693 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15694 anything else. This is the compiler version used in filesystem paths and
15695 specs. Depending on how the compiler has been configured it can be just
15696 a single number (major version), two numbers separated by a dot (major and
15697 minor version) or three numbers separated by dots (major, minor and patchlevel
15698 version).
15699
15700 @item -dumpfullversion
15701 @opindex dumpfullversion
15702 Print the full compiler version---and don't do anything else. The output is
15703 always three numbers separated by dots, major, minor and patchlevel version.
15704
15705 @item -dumpspecs
15706 @opindex dumpspecs
15707 Print the compiler's built-in specs---and don't do anything else. (This
15708 is used when GCC itself is being built.) @xref{Spec Files}.
15709 @end table
15710
15711 @node Submodel Options
15712 @section Machine-Dependent Options
15713 @cindex submodel options
15714 @cindex specifying hardware config
15715 @cindex hardware models and configurations, specifying
15716 @cindex target-dependent options
15717 @cindex machine-dependent options
15718
15719 Each target machine supported by GCC can have its own options---for
15720 example, to allow you to compile for a particular processor variant or
15721 ABI, or to control optimizations specific to that machine. By
15722 convention, the names of machine-specific options start with
15723 @samp{-m}.
15724
15725 Some configurations of the compiler also support additional target-specific
15726 options, usually for compatibility with other compilers on the same
15727 platform.
15728
15729 @c This list is ordered alphanumerically by subsection name.
15730 @c It should be the same order and spelling as these options are listed
15731 @c in Machine Dependent Options
15732
15733 @menu
15734 * AArch64 Options::
15735 * Adapteva Epiphany Options::
15736 * AMD GCN Options::
15737 * ARC Options::
15738 * ARM Options::
15739 * AVR Options::
15740 * Blackfin Options::
15741 * C6X Options::
15742 * CRIS Options::
15743 * CR16 Options::
15744 * C-SKY Options::
15745 * Darwin Options::
15746 * DEC Alpha Options::
15747 * eBPF Options::
15748 * FR30 Options::
15749 * FT32 Options::
15750 * FRV Options::
15751 * GNU/Linux Options::
15752 * H8/300 Options::
15753 * HPPA Options::
15754 * IA-64 Options::
15755 * LM32 Options::
15756 * M32C Options::
15757 * M32R/D Options::
15758 * M680x0 Options::
15759 * MCore Options::
15760 * MeP Options::
15761 * MicroBlaze Options::
15762 * MIPS Options::
15763 * MMIX Options::
15764 * MN10300 Options::
15765 * Moxie Options::
15766 * MSP430 Options::
15767 * NDS32 Options::
15768 * Nios II Options::
15769 * Nvidia PTX Options::
15770 * OpenRISC Options::
15771 * PDP-11 Options::
15772 * picoChip Options::
15773 * PowerPC Options::
15774 * PRU Options::
15775 * RISC-V Options::
15776 * RL78 Options::
15777 * RS/6000 and PowerPC Options::
15778 * RX Options::
15779 * S/390 and zSeries Options::
15780 * Score Options::
15781 * SH Options::
15782 * Solaris 2 Options::
15783 * SPARC Options::
15784 * System V Options::
15785 * TILE-Gx Options::
15786 * TILEPro Options::
15787 * V850 Options::
15788 * VAX Options::
15789 * Visium Options::
15790 * VMS Options::
15791 * VxWorks Options::
15792 * x86 Options::
15793 * x86 Windows Options::
15794 * Xstormy16 Options::
15795 * Xtensa Options::
15796 * zSeries Options::
15797 @end menu
15798
15799 @node AArch64 Options
15800 @subsection AArch64 Options
15801 @cindex AArch64 Options
15802
15803 These options are defined for AArch64 implementations:
15804
15805 @table @gcctabopt
15806
15807 @item -mabi=@var{name}
15808 @opindex mabi
15809 Generate code for the specified data model. Permissible values
15810 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15811 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15812 but long int and pointers are 64 bits.
15813
15814 The default depends on the specific target configuration. Note that
15815 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15816 entire program with the same ABI, and link with a compatible set of libraries.
15817
15818 @item -mbig-endian
15819 @opindex mbig-endian
15820 Generate big-endian code. This is the default when GCC is configured for an
15821 @samp{aarch64_be-*-*} target.
15822
15823 @item -mgeneral-regs-only
15824 @opindex mgeneral-regs-only
15825 Generate code which uses only the general-purpose registers. This will prevent
15826 the compiler from using floating-point and Advanced SIMD registers but will not
15827 impose any restrictions on the assembler.
15828
15829 @item -mlittle-endian
15830 @opindex mlittle-endian
15831 Generate little-endian code. This is the default when GCC is configured for an
15832 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15833
15834 @item -mcmodel=tiny
15835 @opindex mcmodel=tiny
15836 Generate code for the tiny code model. The program and its statically defined
15837 symbols must be within 1MB of each other. Programs can be statically or
15838 dynamically linked.
15839
15840 @item -mcmodel=small
15841 @opindex mcmodel=small
15842 Generate code for the small code model. The program and its statically defined
15843 symbols must be within 4GB of each other. Programs can be statically or
15844 dynamically linked. This is the default code model.
15845
15846 @item -mcmodel=large
15847 @opindex mcmodel=large
15848 Generate code for the large code model. This makes no assumptions about
15849 addresses and sizes of sections. Programs can be statically linked only.
15850
15851 @item -mstrict-align
15852 @itemx -mno-strict-align
15853 @opindex mstrict-align
15854 @opindex mno-strict-align
15855 Avoid or allow generating memory accesses that may not be aligned on a natural
15856 object boundary as described in the architecture specification.
15857
15858 @item -momit-leaf-frame-pointer
15859 @itemx -mno-omit-leaf-frame-pointer
15860 @opindex momit-leaf-frame-pointer
15861 @opindex mno-omit-leaf-frame-pointer
15862 Omit or keep the frame pointer in leaf functions. The former behavior is the
15863 default.
15864
15865 @item -mstack-protector-guard=@var{guard}
15866 @itemx -mstack-protector-guard-reg=@var{reg}
15867 @itemx -mstack-protector-guard-offset=@var{offset}
15868 @opindex mstack-protector-guard
15869 @opindex mstack-protector-guard-reg
15870 @opindex mstack-protector-guard-offset
15871 Generate stack protection code using canary at @var{guard}. Supported
15872 locations are @samp{global} for a global canary or @samp{sysreg} for a
15873 canary in an appropriate system register.
15874
15875 With the latter choice the options
15876 @option{-mstack-protector-guard-reg=@var{reg}} and
15877 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15878 which system register to use as base register for reading the canary,
15879 and from what offset from that base register. There is no default
15880 register or offset as this is entirely for use within the Linux
15881 kernel.
15882
15883 @item -mstack-protector-guard=@var{guard}
15884 @itemx -mstack-protector-guard-reg=@var{reg}
15885 @itemx -mstack-protector-guard-offset=@var{offset}
15886 @opindex mstack-protector-guard
15887 @opindex mstack-protector-guard-reg
15888 @opindex mstack-protector-guard-offset
15889 Generate stack protection code using canary at @var{guard}. Supported
15890 locations are @samp{global} for a global canary or @samp{sysreg} for a
15891 canary in an appropriate system register.
15892
15893 With the latter choice the options
15894 @option{-mstack-protector-guard-reg=@var{reg}} and
15895 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15896 which system register to use as base register for reading the canary,
15897 and from what offset from that base register. There is no default
15898 register or offset as this is entirely for use within the Linux
15899 kernel.
15900
15901 @item -mtls-dialect=desc
15902 @opindex mtls-dialect=desc
15903 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15904 of TLS variables. This is the default.
15905
15906 @item -mtls-dialect=traditional
15907 @opindex mtls-dialect=traditional
15908 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15909 of TLS variables.
15910
15911 @item -mtls-size=@var{size}
15912 @opindex mtls-size
15913 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15914 This option requires binutils 2.26 or newer.
15915
15916 @item -mfix-cortex-a53-835769
15917 @itemx -mno-fix-cortex-a53-835769
15918 @opindex mfix-cortex-a53-835769
15919 @opindex mno-fix-cortex-a53-835769
15920 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15921 This involves inserting a NOP instruction between memory instructions and
15922 64-bit integer multiply-accumulate instructions.
15923
15924 @item -mfix-cortex-a53-843419
15925 @itemx -mno-fix-cortex-a53-843419
15926 @opindex mfix-cortex-a53-843419
15927 @opindex mno-fix-cortex-a53-843419
15928 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15929 This erratum workaround is made at link time and this will only pass the
15930 corresponding flag to the linker.
15931
15932 @item -mlow-precision-recip-sqrt
15933 @itemx -mno-low-precision-recip-sqrt
15934 @opindex mlow-precision-recip-sqrt
15935 @opindex mno-low-precision-recip-sqrt
15936 Enable or disable the reciprocal square root approximation.
15937 This option only has an effect if @option{-ffast-math} or
15938 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15939 precision of reciprocal square root results to about 16 bits for
15940 single precision and to 32 bits for double precision.
15941
15942 @item -mlow-precision-sqrt
15943 @itemx -mno-low-precision-sqrt
15944 @opindex mlow-precision-sqrt
15945 @opindex mno-low-precision-sqrt
15946 Enable or disable the square root approximation.
15947 This option only has an effect if @option{-ffast-math} or
15948 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15949 precision of square root results to about 16 bits for
15950 single precision and to 32 bits for double precision.
15951 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15952
15953 @item -mlow-precision-div
15954 @itemx -mno-low-precision-div
15955 @opindex mlow-precision-div
15956 @opindex mno-low-precision-div
15957 Enable or disable the division approximation.
15958 This option only has an effect if @option{-ffast-math} or
15959 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15960 precision of division results to about 16 bits for
15961 single precision and to 32 bits for double precision.
15962
15963 @item -mtrack-speculation
15964 @itemx -mno-track-speculation
15965 Enable or disable generation of additional code to track speculative
15966 execution through conditional branches. The tracking state can then
15967 be used by the compiler when expanding calls to
15968 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15969 sequence to be generated.
15970
15971 @item -moutline-atomics
15972 @itemx -mno-outline-atomics
15973 Enable or disable calls to out-of-line helpers to implement atomic operations.
15974 These helpers will, at runtime, determine if the LSE instructions from
15975 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
15976 instructions that are present in the base ARMv8.0 ISA.
15977
15978 This option is only applicable when compiling for the base ARMv8.0
15979 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
15980 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
15981 used directly. The same applies when using @option{-mcpu=} when the
15982 selected cpu supports the @samp{lse} feature.
15983
15984 @item -march=@var{name}
15985 @opindex march
15986 Specify the name of the target architecture and, optionally, one or
15987 more feature modifiers. This option has the form
15988 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15989
15990 The permissible values for @var{arch} are @samp{armv8-a},
15991 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15992 @samp{armv8.5-a} or @var{native}.
15993
15994 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15995 support for the ARMv8.5-A architecture extensions.
15996
15997 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15998 support for the ARMv8.4-A architecture extensions.
15999
16000 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
16001 support for the ARMv8.3-A architecture extensions.
16002
16003 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
16004 support for the ARMv8.2-A architecture extensions.
16005
16006 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
16007 support for the ARMv8.1-A architecture extension. In particular, it
16008 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
16009
16010 The value @samp{native} is available on native AArch64 GNU/Linux and
16011 causes the compiler to pick the architecture of the host system. This
16012 option has no effect if the compiler is unable to recognize the
16013 architecture of the host system,
16014
16015 The permissible values for @var{feature} are listed in the sub-section
16016 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16017 Feature Modifiers}. Where conflicting feature modifiers are
16018 specified, the right-most feature is used.
16019
16020 GCC uses @var{name} to determine what kind of instructions it can emit
16021 when generating assembly code. If @option{-march} is specified
16022 without either of @option{-mtune} or @option{-mcpu} also being
16023 specified, the code is tuned to perform well across a range of target
16024 processors implementing the target architecture.
16025
16026 @item -mtune=@var{name}
16027 @opindex mtune
16028 Specify the name of the target processor for which GCC should tune the
16029 performance of the code. Permissible values for this option are:
16030 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16031 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16032 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
16033 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
16034 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
16035 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
16036 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
16037 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
16038 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
16039 @samp{thunderxt83}, @samp{thunderx2t99},
16040 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16041 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16042 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
16043 @samp{native}.
16044
16045 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16046 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16047 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
16048 should tune for a big.LITTLE system.
16049
16050 Additionally on native AArch64 GNU/Linux systems the value
16051 @samp{native} tunes performance to the host system. This option has no effect
16052 if the compiler is unable to recognize the processor of the host system.
16053
16054 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
16055 are specified, the code is tuned to perform well across a range
16056 of target processors.
16057
16058 This option cannot be suffixed by feature modifiers.
16059
16060 @item -mcpu=@var{name}
16061 @opindex mcpu
16062 Specify the name of the target processor, optionally suffixed by one
16063 or more feature modifiers. This option has the form
16064 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
16065 the permissible values for @var{cpu} are the same as those available
16066 for @option{-mtune}. The permissible values for @var{feature} are
16067 documented in the sub-section on
16068 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16069 Feature Modifiers}. Where conflicting feature modifiers are
16070 specified, the right-most feature is used.
16071
16072 GCC uses @var{name} to determine what kind of instructions it can emit when
16073 generating assembly code (as if by @option{-march}) and to determine
16074 the target processor for which to tune for performance (as if
16075 by @option{-mtune}). Where this option is used in conjunction
16076 with @option{-march} or @option{-mtune}, those options take precedence
16077 over the appropriate part of this option.
16078
16079 @item -moverride=@var{string}
16080 @opindex moverride
16081 Override tuning decisions made by the back-end in response to a
16082 @option{-mtune=} switch. The syntax, semantics, and accepted values
16083 for @var{string} in this option are not guaranteed to be consistent
16084 across releases.
16085
16086 This option is only intended to be useful when developing GCC.
16087
16088 @item -mverbose-cost-dump
16089 @opindex mverbose-cost-dump
16090 Enable verbose cost model dumping in the debug dump files. This option is
16091 provided for use in debugging the compiler.
16092
16093 @item -mpc-relative-literal-loads
16094 @itemx -mno-pc-relative-literal-loads
16095 @opindex mpc-relative-literal-loads
16096 @opindex mno-pc-relative-literal-loads
16097 Enable or disable PC-relative literal loads. With this option literal pools are
16098 accessed using a single instruction and emitted after each function. This
16099 limits the maximum size of functions to 1MB. This is enabled by default for
16100 @option{-mcmodel=tiny}.
16101
16102 @item -msign-return-address=@var{scope}
16103 @opindex msign-return-address
16104 Select the function scope on which return address signing will be applied.
16105 Permissible values are @samp{none}, which disables return address signing,
16106 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
16107 functions, and @samp{all}, which enables pointer signing for all functions. The
16108 default value is @samp{none}. This option has been deprecated by
16109 -mbranch-protection.
16110
16111 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
16112 @opindex mbranch-protection
16113 Select the branch protection features to use.
16114 @samp{none} is the default and turns off all types of branch protection.
16115 @samp{standard} turns on all types of branch protection features. If a feature
16116 has additional tuning options, then @samp{standard} sets it to its standard
16117 level.
16118 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
16119 level: signing functions that save the return address to memory (non-leaf
16120 functions will practically always do this) using the a-key. The optional
16121 argument @samp{leaf} can be used to extend the signing to include leaf
16122 functions. The optional argument @samp{b-key} can be used to sign the functions
16123 with the B-key instead of the A-key.
16124 @samp{bti} turns on branch target identification mechanism.
16125
16126 @item -msve-vector-bits=@var{bits}
16127 @opindex msve-vector-bits
16128 Specify the number of bits in an SVE vector register. This option only has
16129 an effect when SVE is enabled.
16130
16131 GCC supports two forms of SVE code generation: ``vector-length
16132 agnostic'' output that works with any size of vector register and
16133 ``vector-length specific'' output that allows GCC to make assumptions
16134 about the vector length when it is useful for optimization reasons.
16135 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
16136 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
16137 Specifying @samp{scalable} selects vector-length agnostic
16138 output. At present @samp{-msve-vector-bits=128} also generates vector-length
16139 agnostic output. All other values generate vector-length specific code.
16140 The behavior of these values may change in future releases and no value except
16141 @samp{scalable} should be relied on for producing code that is portable across
16142 different hardware SVE vector lengths.
16143
16144 The default is @samp{-msve-vector-bits=scalable}, which produces
16145 vector-length agnostic code.
16146 @end table
16147
16148 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16149 @anchor{aarch64-feature-modifiers}
16150 @cindex @option{-march} feature modifiers
16151 @cindex @option{-mcpu} feature modifiers
16152 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16153 the following and their inverses @option{no@var{feature}}:
16154
16155 @table @samp
16156 @item crc
16157 Enable CRC extension. This is on by default for
16158 @option{-march=armv8.1-a}.
16159 @item crypto
16160 Enable Crypto extension. This also enables Advanced SIMD and floating-point
16161 instructions.
16162 @item fp
16163 Enable floating-point instructions. This is on by default for all possible
16164 values for options @option{-march} and @option{-mcpu}.
16165 @item simd
16166 Enable Advanced SIMD instructions. This also enables floating-point
16167 instructions. This is on by default for all possible values for options
16168 @option{-march} and @option{-mcpu}.
16169 @item sve
16170 Enable Scalable Vector Extension instructions. This also enables Advanced
16171 SIMD and floating-point instructions.
16172 @item lse
16173 Enable Large System Extension instructions. This is on by default for
16174 @option{-march=armv8.1-a}.
16175 @item rdma
16176 Enable Round Double Multiply Accumulate instructions. This is on by default
16177 for @option{-march=armv8.1-a}.
16178 @item fp16
16179 Enable FP16 extension. This also enables floating-point instructions.
16180 @item fp16fml
16181 Enable FP16 fmla extension. This also enables FP16 extensions and
16182 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.
16183
16184 @item rcpc
16185 Enable the RcPc extension. This does not change code generation from GCC,
16186 but is passed on to the assembler, enabling inline asm statements to use
16187 instructions from the RcPc extension.
16188 @item dotprod
16189 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16190 @item aes
16191 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
16192 SIMD instructions.
16193 @item sha2
16194 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
16195 @item sha3
16196 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
16197 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16198 @item sm4
16199 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
16200 Use of this option with architectures prior to Armv8.2-A is not supported.
16201 @item profile
16202 Enable the Statistical Profiling extension. This option is only to enable the
16203 extension at the assembler level and does not affect code generation.
16204 @item rng
16205 Enable the Armv8.5-a Random Number instructions. This option is only to
16206 enable the extension at the assembler level and does not affect code
16207 generation.
16208 @item memtag
16209 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16210 enable the extension at the assembler level and does not affect code
16211 generation.
16212 @item sb
16213 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16214 enable the extension at the assembler level and does not affect code
16215 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16216 @item ssbs
16217 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16218 is only to enable the extension at the assembler level and does not affect code
16219 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16220 @item predres
16221 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16222 This option is only to enable the extension at the assembler level and does
16223 not affect code generation. This option is enabled by default for
16224 @item sve2
16225 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16226 instructions.
16227 @item sve2-bitperm
16228 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16229 @item sve2-sm4
16230 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16231 @item sve2-aes
16232 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16233 @item sve2-sha3
16234 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16235 @option{-march=armv8.5-a}.
16236 @item tme
16237 Enable the Transactional Memory Extension.
16238
16239 @end table
16240
16241 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16242 which implies @option{fp}.
16243 Conversely, @option{nofp} implies @option{nosimd}, which implies
16244 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16245
16246 @node Adapteva Epiphany Options
16247 @subsection Adapteva Epiphany Options
16248
16249 These @samp{-m} options are defined for Adapteva Epiphany:
16250
16251 @table @gcctabopt
16252 @item -mhalf-reg-file
16253 @opindex mhalf-reg-file
16254 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16255 That allows code to run on hardware variants that lack these registers.
16256
16257 @item -mprefer-short-insn-regs
16258 @opindex mprefer-short-insn-regs
16259 Preferentially allocate registers that allow short instruction generation.
16260 This can result in increased instruction count, so this may either reduce or
16261 increase overall code size.
16262
16263 @item -mbranch-cost=@var{num}
16264 @opindex mbranch-cost
16265 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16266 This cost is only a heuristic and is not guaranteed to produce
16267 consistent results across releases.
16268
16269 @item -mcmove
16270 @opindex mcmove
16271 Enable the generation of conditional moves.
16272
16273 @item -mnops=@var{num}
16274 @opindex mnops
16275 Emit @var{num} NOPs before every other generated instruction.
16276
16277 @item -mno-soft-cmpsf
16278 @opindex mno-soft-cmpsf
16279 @opindex msoft-cmpsf
16280 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16281 and test the flags. This is faster than a software comparison, but can
16282 get incorrect results in the presence of NaNs, or when two different small
16283 numbers are compared such that their difference is calculated as zero.
16284 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16285 software comparisons.
16286
16287 @item -mstack-offset=@var{num}
16288 @opindex mstack-offset
16289 Set the offset between the top of the stack and the stack pointer.
16290 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16291 can be used by leaf functions without stack allocation.
16292 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16293 Note also that this option changes the ABI; compiling a program with a
16294 different stack offset than the libraries have been compiled with
16295 generally does not work.
16296 This option can be useful if you want to evaluate if a different stack
16297 offset would give you better code, but to actually use a different stack
16298 offset to build working programs, it is recommended to configure the
16299 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16300
16301 @item -mno-round-nearest
16302 @opindex mno-round-nearest
16303 @opindex mround-nearest
16304 Make the scheduler assume that the rounding mode has been set to
16305 truncating. The default is @option{-mround-nearest}.
16306
16307 @item -mlong-calls
16308 @opindex mlong-calls
16309 If not otherwise specified by an attribute, assume all calls might be beyond
16310 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16311 function address into a register before performing a (otherwise direct) call.
16312 This is the default.
16313
16314 @item -mshort-calls
16315 @opindex short-calls
16316 If not otherwise specified by an attribute, assume all direct calls are
16317 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16318 for direct calls. The default is @option{-mlong-calls}.
16319
16320 @item -msmall16
16321 @opindex msmall16
16322 Assume addresses can be loaded as 16-bit unsigned values. This does not
16323 apply to function addresses for which @option{-mlong-calls} semantics
16324 are in effect.
16325
16326 @item -mfp-mode=@var{mode}
16327 @opindex mfp-mode
16328 Set the prevailing mode of the floating-point unit.
16329 This determines the floating-point mode that is provided and expected
16330 at function call and return time. Making this mode match the mode you
16331 predominantly need at function start can make your programs smaller and
16332 faster by avoiding unnecessary mode switches.
16333
16334 @var{mode} can be set to one the following values:
16335
16336 @table @samp
16337 @item caller
16338 Any mode at function entry is valid, and retained or restored when
16339 the function returns, and when it calls other functions.
16340 This mode is useful for compiling libraries or other compilation units
16341 you might want to incorporate into different programs with different
16342 prevailing FPU modes, and the convenience of being able to use a single
16343 object file outweighs the size and speed overhead for any extra
16344 mode switching that might be needed, compared with what would be needed
16345 with a more specific choice of prevailing FPU mode.
16346
16347 @item truncate
16348 This is the mode used for floating-point calculations with
16349 truncating (i.e.@: round towards zero) rounding mode. That includes
16350 conversion from floating point to integer.
16351
16352 @item round-nearest
16353 This is the mode used for floating-point calculations with
16354 round-to-nearest-or-even rounding mode.
16355
16356 @item int
16357 This is the mode used to perform integer calculations in the FPU, e.g.@:
16358 integer multiply, or integer multiply-and-accumulate.
16359 @end table
16360
16361 The default is @option{-mfp-mode=caller}
16362
16363 @item -mno-split-lohi
16364 @itemx -mno-postinc
16365 @itemx -mno-postmodify
16366 @opindex mno-split-lohi
16367 @opindex msplit-lohi
16368 @opindex mno-postinc
16369 @opindex mpostinc
16370 @opindex mno-postmodify
16371 @opindex mpostmodify
16372 Code generation tweaks that disable, respectively, splitting of 32-bit
16373 loads, generation of post-increment addresses, and generation of
16374 post-modify addresses. The defaults are @option{msplit-lohi},
16375 @option{-mpost-inc}, and @option{-mpost-modify}.
16376
16377 @item -mnovect-double
16378 @opindex mno-vect-double
16379 @opindex mvect-double
16380 Change the preferred SIMD mode to SImode. The default is
16381 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16382
16383 @item -max-vect-align=@var{num}
16384 @opindex max-vect-align
16385 The maximum alignment for SIMD vector mode types.
16386 @var{num} may be 4 or 8. The default is 8.
16387 Note that this is an ABI change, even though many library function
16388 interfaces are unaffected if they don't use SIMD vector modes
16389 in places that affect size and/or alignment of relevant types.
16390
16391 @item -msplit-vecmove-early
16392 @opindex msplit-vecmove-early
16393 Split vector moves into single word moves before reload. In theory this
16394 can give better register allocation, but so far the reverse seems to be
16395 generally the case.
16396
16397 @item -m1reg-@var{reg}
16398 @opindex m1reg-
16399 Specify a register to hold the constant @minus{}1, which makes loading small negative
16400 constants and certain bitmasks faster.
16401 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16402 which specify use of that register as a fixed register,
16403 and @samp{none}, which means that no register is used for this
16404 purpose. The default is @option{-m1reg-none}.
16405
16406 @end table
16407
16408 @node AMD GCN Options
16409 @subsection AMD GCN Options
16410 @cindex AMD GCN Options
16411
16412 These options are defined specifically for the AMD GCN port.
16413
16414 @table @gcctabopt
16415
16416 @item -march=@var{gpu}
16417 @opindex march
16418 @itemx -mtune=@var{gpu}
16419 @opindex mtune
16420 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16421 are
16422
16423 @table @samp
16424 @opindex fiji
16425 @item fiji
16426 Compile for GCN3 Fiji devices (gfx803).
16427
16428 @item gfx900
16429 Compile for GCN5 Vega 10 devices (gfx900).
16430
16431 @item gfx906
16432 Compile for GCN5 Vega 20 devices (gfx906).
16433
16434 @end table
16435
16436 @item -mstack-size=@var{bytes}
16437 @opindex mstack-size
16438 Specify how many @var{bytes} of stack space will be requested for each GPU
16439 thread (wave-front). Beware that there may be many threads and limited memory
16440 available. The size of the stack allocation may also have an impact on
16441 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16442 1MB otherwise.
16443
16444 @end table
16445
16446 @node ARC Options
16447 @subsection ARC Options
16448 @cindex ARC options
16449
16450 The following options control the architecture variant for which code
16451 is being compiled:
16452
16453 @c architecture variants
16454 @table @gcctabopt
16455
16456 @item -mbarrel-shifter
16457 @opindex mbarrel-shifter
16458 Generate instructions supported by barrel shifter. This is the default
16459 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16460
16461 @item -mjli-always
16462 @opindex mjli-alawys
16463 Force to call a function using jli_s instruction. This option is
16464 valid only for ARCv2 architecture.
16465
16466 @item -mcpu=@var{cpu}
16467 @opindex mcpu
16468 Set architecture type, register usage, and instruction scheduling
16469 parameters for @var{cpu}. There are also shortcut alias options
16470 available for backward compatibility and convenience. Supported
16471 values for @var{cpu} are
16472
16473 @table @samp
16474 @opindex mA6
16475 @opindex mARC600
16476 @item arc600
16477 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16478
16479 @item arc601
16480 @opindex mARC601
16481 Compile for ARC601. Alias: @option{-mARC601}.
16482
16483 @item arc700
16484 @opindex mA7
16485 @opindex mARC700
16486 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16487 This is the default when configured with @option{--with-cpu=arc700}@.
16488
16489 @item arcem
16490 Compile for ARC EM.
16491
16492 @item archs
16493 Compile for ARC HS.
16494
16495 @item em
16496 Compile for ARC EM CPU with no hardware extensions.
16497
16498 @item em4
16499 Compile for ARC EM4 CPU.
16500
16501 @item em4_dmips
16502 Compile for ARC EM4 DMIPS CPU.
16503
16504 @item em4_fpus
16505 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16506 extension.
16507
16508 @item em4_fpuda
16509 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16510 double assist instructions.
16511
16512 @item hs
16513 Compile for ARC HS CPU with no hardware extensions except the atomic
16514 instructions.
16515
16516 @item hs34
16517 Compile for ARC HS34 CPU.
16518
16519 @item hs38
16520 Compile for ARC HS38 CPU.
16521
16522 @item hs38_linux
16523 Compile for ARC HS38 CPU with all hardware extensions on.
16524
16525 @item arc600_norm
16526 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16527
16528 @item arc600_mul32x16
16529 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16530 instructions enabled.
16531
16532 @item arc600_mul64
16533 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16534 instructions enabled.
16535
16536 @item arc601_norm
16537 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16538
16539 @item arc601_mul32x16
16540 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16541 instructions enabled.
16542
16543 @item arc601_mul64
16544 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16545 instructions enabled.
16546
16547 @item nps400
16548 Compile for ARC 700 on NPS400 chip.
16549
16550 @item em_mini
16551 Compile for ARC EM minimalist configuration featuring reduced register
16552 set.
16553
16554 @end table
16555
16556 @item -mdpfp
16557 @opindex mdpfp
16558 @itemx -mdpfp-compact
16559 @opindex mdpfp-compact
16560 Generate double-precision FPX instructions, tuned for the compact
16561 implementation.
16562
16563 @item -mdpfp-fast
16564 @opindex mdpfp-fast
16565 Generate double-precision FPX instructions, tuned for the fast
16566 implementation.
16567
16568 @item -mno-dpfp-lrsr
16569 @opindex mno-dpfp-lrsr
16570 Disable @code{lr} and @code{sr} instructions from using FPX extension
16571 aux registers.
16572
16573 @item -mea
16574 @opindex mea
16575 Generate extended arithmetic instructions. Currently only
16576 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16577 supported. This is always enabled for @option{-mcpu=ARC700}.
16578
16579 @item -mno-mpy
16580 @opindex mno-mpy
16581 @opindex mmpy
16582 Do not generate @code{mpy}-family instructions for ARC700. This option is
16583 deprecated.
16584
16585 @item -mmul32x16
16586 @opindex mmul32x16
16587 Generate 32x16-bit multiply and multiply-accumulate instructions.
16588
16589 @item -mmul64
16590 @opindex mmul64
16591 Generate @code{mul64} and @code{mulu64} instructions.
16592 Only valid for @option{-mcpu=ARC600}.
16593
16594 @item -mnorm
16595 @opindex mnorm
16596 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16597 is in effect.
16598
16599 @item -mspfp
16600 @opindex mspfp
16601 @itemx -mspfp-compact
16602 @opindex mspfp-compact
16603 Generate single-precision FPX instructions, tuned for the compact
16604 implementation.
16605
16606 @item -mspfp-fast
16607 @opindex mspfp-fast
16608 Generate single-precision FPX instructions, tuned for the fast
16609 implementation.
16610
16611 @item -msimd
16612 @opindex msimd
16613 Enable generation of ARC SIMD instructions via target-specific
16614 builtins. Only valid for @option{-mcpu=ARC700}.
16615
16616 @item -msoft-float
16617 @opindex msoft-float
16618 This option ignored; it is provided for compatibility purposes only.
16619 Software floating-point code is emitted by default, and this default
16620 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16621 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16622 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16623
16624 @item -mswap
16625 @opindex mswap
16626 Generate @code{swap} instructions.
16627
16628 @item -matomic
16629 @opindex matomic
16630 This enables use of the locked load/store conditional extension to implement
16631 atomic memory built-in functions. Not available for ARC 6xx or ARC
16632 EM cores.
16633
16634 @item -mdiv-rem
16635 @opindex mdiv-rem
16636 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16637
16638 @item -mcode-density
16639 @opindex mcode-density
16640 Enable code density instructions for ARC EM.
16641 This option is on by default for ARC HS.
16642
16643 @item -mll64
16644 @opindex mll64
16645 Enable double load/store operations for ARC HS cores.
16646
16647 @item -mtp-regno=@var{regno}
16648 @opindex mtp-regno
16649 Specify thread pointer register number.
16650
16651 @item -mmpy-option=@var{multo}
16652 @opindex mmpy-option
16653 Compile ARCv2 code with a multiplier design option. You can specify
16654 the option using either a string or numeric value for @var{multo}.
16655 @samp{wlh1} is the default value. The recognized values are:
16656
16657 @table @samp
16658 @item 0
16659 @itemx none
16660 No multiplier available.
16661
16662 @item 1
16663 @itemx w
16664 16x16 multiplier, fully pipelined.
16665 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16666
16667 @item 2
16668 @itemx wlh1
16669 32x32 multiplier, fully
16670 pipelined (1 stage). The following instructions are additionally
16671 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16672
16673 @item 3
16674 @itemx wlh2
16675 32x32 multiplier, fully pipelined
16676 (2 stages). The following instructions are additionally enabled: @code{mpy},
16677 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16678
16679 @item 4
16680 @itemx wlh3
16681 Two 16x16 multipliers, blocking,
16682 sequential. The following instructions are additionally enabled: @code{mpy},
16683 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16684
16685 @item 5
16686 @itemx wlh4
16687 One 16x16 multiplier, blocking,
16688 sequential. The following instructions are additionally enabled: @code{mpy},
16689 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16690
16691 @item 6
16692 @itemx wlh5
16693 One 32x4 multiplier, blocking,
16694 sequential. The following instructions are additionally enabled: @code{mpy},
16695 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16696
16697 @item 7
16698 @itemx plus_dmpy
16699 ARC HS SIMD support.
16700
16701 @item 8
16702 @itemx plus_macd
16703 ARC HS SIMD support.
16704
16705 @item 9
16706 @itemx plus_qmacw
16707 ARC HS SIMD support.
16708
16709 @end table
16710
16711 This option is only available for ARCv2 cores@.
16712
16713 @item -mfpu=@var{fpu}
16714 @opindex mfpu
16715 Enables support for specific floating-point hardware extensions for ARCv2
16716 cores. Supported values for @var{fpu} are:
16717
16718 @table @samp
16719
16720 @item fpus
16721 Enables support for single-precision floating-point hardware
16722 extensions@.
16723
16724 @item fpud
16725 Enables support for double-precision floating-point hardware
16726 extensions. The single-precision floating-point extension is also
16727 enabled. Not available for ARC EM@.
16728
16729 @item fpuda
16730 Enables support for double-precision floating-point hardware
16731 extensions using double-precision assist instructions. The single-precision
16732 floating-point extension is also enabled. This option is
16733 only available for ARC EM@.
16734
16735 @item fpuda_div
16736 Enables support for double-precision floating-point hardware
16737 extensions using double-precision assist instructions.
16738 The single-precision floating-point, square-root, and divide
16739 extensions are also enabled. This option is
16740 only available for ARC EM@.
16741
16742 @item fpuda_fma
16743 Enables support for double-precision floating-point hardware
16744 extensions using double-precision assist instructions.
16745 The single-precision floating-point and fused multiply and add
16746 hardware extensions are also enabled. This option is
16747 only available for ARC EM@.
16748
16749 @item fpuda_all
16750 Enables support for double-precision floating-point hardware
16751 extensions using double-precision assist instructions.
16752 All single-precision floating-point hardware extensions are also
16753 enabled. This option is only available for ARC EM@.
16754
16755 @item fpus_div
16756 Enables support for single-precision floating-point, square-root and divide
16757 hardware extensions@.
16758
16759 @item fpud_div
16760 Enables support for double-precision floating-point, square-root and divide
16761 hardware extensions. This option
16762 includes option @samp{fpus_div}. Not available for ARC EM@.
16763
16764 @item fpus_fma
16765 Enables support for single-precision floating-point and
16766 fused multiply and add hardware extensions@.
16767
16768 @item fpud_fma
16769 Enables support for double-precision floating-point and
16770 fused multiply and add hardware extensions. This option
16771 includes option @samp{fpus_fma}. Not available for ARC EM@.
16772
16773 @item fpus_all
16774 Enables support for all single-precision floating-point hardware
16775 extensions@.
16776
16777 @item fpud_all
16778 Enables support for all single- and double-precision floating-point
16779 hardware extensions. Not available for ARC EM@.
16780
16781 @end table
16782
16783 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16784 @opindex mirq-ctrl-saved
16785 Specifies general-purposes registers that the processor automatically
16786 saves/restores on interrupt entry and exit. @var{register-range} is
16787 specified as two registers separated by a dash. The register range
16788 always starts with @code{r0}, the upper limit is @code{fp} register.
16789 @var{blink} and @var{lp_count} are optional. This option is only
16790 valid for ARC EM and ARC HS cores.
16791
16792 @item -mrgf-banked-regs=@var{number}
16793 @opindex mrgf-banked-regs
16794 Specifies the number of registers replicated in second register bank
16795 on entry to fast interrupt. Fast interrupts are interrupts with the
16796 highest priority level P0. These interrupts save only PC and STATUS32
16797 registers to avoid memory transactions during interrupt entry and exit
16798 sequences. Use this option when you are using fast interrupts in an
16799 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16800
16801 @item -mlpc-width=@var{width}
16802 @opindex mlpc-width
16803 Specify the width of the @code{lp_count} register. Valid values for
16804 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16805 fixed to 32 bits. If the width is less than 32, the compiler does not
16806 attempt to transform loops in your program to use the zero-delay loop
16807 mechanism unless it is known that the @code{lp_count} register can
16808 hold the required loop-counter value. Depending on the width
16809 specified, the compiler and run-time library might continue to use the
16810 loop mechanism for various needs. This option defines macro
16811 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16812
16813 @item -mrf16
16814 @opindex mrf16
16815 This option instructs the compiler to generate code for a 16-entry
16816 register file. This option defines the @code{__ARC_RF16__}
16817 preprocessor macro.
16818
16819 @item -mbranch-index
16820 @opindex mbranch-index
16821 Enable use of @code{bi} or @code{bih} instructions to implement jump
16822 tables.
16823
16824 @end table
16825
16826 The following options are passed through to the assembler, and also
16827 define preprocessor macro symbols.
16828
16829 @c Flags used by the assembler, but for which we define preprocessor
16830 @c macro symbols as well.
16831 @table @gcctabopt
16832 @item -mdsp-packa
16833 @opindex mdsp-packa
16834 Passed down to the assembler to enable the DSP Pack A extensions.
16835 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16836 deprecated.
16837
16838 @item -mdvbf
16839 @opindex mdvbf
16840 Passed down to the assembler to enable the dual Viterbi butterfly
16841 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16842 option is deprecated.
16843
16844 @c ARC700 4.10 extension instruction
16845 @item -mlock
16846 @opindex mlock
16847 Passed down to the assembler to enable the locked load/store
16848 conditional extension. Also sets the preprocessor symbol
16849 @code{__Xlock}.
16850
16851 @item -mmac-d16
16852 @opindex mmac-d16
16853 Passed down to the assembler. Also sets the preprocessor symbol
16854 @code{__Xxmac_d16}. This option is deprecated.
16855
16856 @item -mmac-24
16857 @opindex mmac-24
16858 Passed down to the assembler. Also sets the preprocessor symbol
16859 @code{__Xxmac_24}. This option is deprecated.
16860
16861 @c ARC700 4.10 extension instruction
16862 @item -mrtsc
16863 @opindex mrtsc
16864 Passed down to the assembler to enable the 64-bit time-stamp counter
16865 extension instruction. Also sets the preprocessor symbol
16866 @code{__Xrtsc}. This option is deprecated.
16867
16868 @c ARC700 4.10 extension instruction
16869 @item -mswape
16870 @opindex mswape
16871 Passed down to the assembler to enable the swap byte ordering
16872 extension instruction. Also sets the preprocessor symbol
16873 @code{__Xswape}.
16874
16875 @item -mtelephony
16876 @opindex mtelephony
16877 Passed down to the assembler to enable dual- and single-operand
16878 instructions for telephony. Also sets the preprocessor symbol
16879 @code{__Xtelephony}. This option is deprecated.
16880
16881 @item -mxy
16882 @opindex mxy
16883 Passed down to the assembler to enable the XY memory extension. Also
16884 sets the preprocessor symbol @code{__Xxy}.
16885
16886 @end table
16887
16888 The following options control how the assembly code is annotated:
16889
16890 @c Assembly annotation options
16891 @table @gcctabopt
16892 @item -misize
16893 @opindex misize
16894 Annotate assembler instructions with estimated addresses.
16895
16896 @item -mannotate-align
16897 @opindex mannotate-align
16898 Explain what alignment considerations lead to the decision to make an
16899 instruction short or long.
16900
16901 @end table
16902
16903 The following options are passed through to the linker:
16904
16905 @c options passed through to the linker
16906 @table @gcctabopt
16907 @item -marclinux
16908 @opindex marclinux
16909 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16910 This option is enabled by default in tool chains built for
16911 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16912 when profiling is not requested.
16913
16914 @item -marclinux_prof
16915 @opindex marclinux_prof
16916 Passed through to the linker, to specify use of the
16917 @code{arclinux_prof} emulation. This option is enabled by default in
16918 tool chains built for @w{@code{arc-linux-uclibc}} and
16919 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16920
16921 @end table
16922
16923 The following options control the semantics of generated code:
16924
16925 @c semantically relevant code generation options
16926 @table @gcctabopt
16927 @item -mlong-calls
16928 @opindex mlong-calls
16929 Generate calls as register indirect calls, thus providing access
16930 to the full 32-bit address range.
16931
16932 @item -mmedium-calls
16933 @opindex mmedium-calls
16934 Don't use less than 25-bit addressing range for calls, which is the
16935 offset available for an unconditional branch-and-link
16936 instruction. Conditional execution of function calls is suppressed, to
16937 allow use of the 25-bit range, rather than the 21-bit range with
16938 conditional branch-and-link. This is the default for tool chains built
16939 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16940
16941 @item -G @var{num}
16942 @opindex G
16943 Put definitions of externally-visible data in a small data section if
16944 that data is no bigger than @var{num} bytes. The default value of
16945 @var{num} is 4 for any ARC configuration, or 8 when we have double
16946 load/store operations.
16947
16948 @item -mno-sdata
16949 @opindex mno-sdata
16950 @opindex msdata
16951 Do not generate sdata references. This is the default for tool chains
16952 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16953 targets.
16954
16955 @item -mvolatile-cache
16956 @opindex mvolatile-cache
16957 Use ordinarily cached memory accesses for volatile references. This is the
16958 default.
16959
16960 @item -mno-volatile-cache
16961 @opindex mno-volatile-cache
16962 @opindex mvolatile-cache
16963 Enable cache bypass for volatile references.
16964
16965 @end table
16966
16967 The following options fine tune code generation:
16968 @c code generation tuning options
16969 @table @gcctabopt
16970 @item -malign-call
16971 @opindex malign-call
16972 Do alignment optimizations for call instructions.
16973
16974 @item -mauto-modify-reg
16975 @opindex mauto-modify-reg
16976 Enable the use of pre/post modify with register displacement.
16977
16978 @item -mbbit-peephole
16979 @opindex mbbit-peephole
16980 Enable bbit peephole2.
16981
16982 @item -mno-brcc
16983 @opindex mno-brcc
16984 This option disables a target-specific pass in @file{arc_reorg} to
16985 generate compare-and-branch (@code{br@var{cc}}) instructions.
16986 It has no effect on
16987 generation of these instructions driven by the combiner pass.
16988
16989 @item -mcase-vector-pcrel
16990 @opindex mcase-vector-pcrel
16991 Use PC-relative switch case tables to enable case table shortening.
16992 This is the default for @option{-Os}.
16993
16994 @item -mcompact-casesi
16995 @opindex mcompact-casesi
16996 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16997 and only available for ARCv1 cores. This option is deprecated.
16998
16999 @item -mno-cond-exec
17000 @opindex mno-cond-exec
17001 Disable the ARCompact-specific pass to generate conditional
17002 execution instructions.
17003
17004 Due to delay slot scheduling and interactions between operand numbers,
17005 literal sizes, instruction lengths, and the support for conditional execution,
17006 the target-independent pass to generate conditional execution is often lacking,
17007 so the ARC port has kept a special pass around that tries to find more
17008 conditional execution generation opportunities after register allocation,
17009 branch shortening, and delay slot scheduling have been done. This pass
17010 generally, but not always, improves performance and code size, at the cost of
17011 extra compilation time, which is why there is an option to switch it off.
17012 If you have a problem with call instructions exceeding their allowable
17013 offset range because they are conditionalized, you should consider using
17014 @option{-mmedium-calls} instead.
17015
17016 @item -mearly-cbranchsi
17017 @opindex mearly-cbranchsi
17018 Enable pre-reload use of the @code{cbranchsi} pattern.
17019
17020 @item -mexpand-adddi
17021 @opindex mexpand-adddi
17022 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
17023 @code{add.f}, @code{adc} etc. This option is deprecated.
17024
17025 @item -mindexed-loads
17026 @opindex mindexed-loads
17027 Enable the use of indexed loads. This can be problematic because some
17028 optimizers then assume that indexed stores exist, which is not
17029 the case.
17030
17031 @item -mlra
17032 @opindex mlra
17033 Enable Local Register Allocation. This is still experimental for ARC,
17034 so by default the compiler uses standard reload
17035 (i.e.@: @option{-mno-lra}).
17036
17037 @item -mlra-priority-none
17038 @opindex mlra-priority-none
17039 Don't indicate any priority for target registers.
17040
17041 @item -mlra-priority-compact
17042 @opindex mlra-priority-compact
17043 Indicate target register priority for r0..r3 / r12..r15.
17044
17045 @item -mlra-priority-noncompact
17046 @opindex mlra-priority-noncompact
17047 Reduce target register priority for r0..r3 / r12..r15.
17048
17049 @item -mmillicode
17050 @opindex mmillicode
17051 When optimizing for size (using @option{-Os}), prologues and epilogues
17052 that have to save or restore a large number of registers are often
17053 shortened by using call to a special function in libgcc; this is
17054 referred to as a @emph{millicode} call. As these calls can pose
17055 performance issues, and/or cause linking issues when linking in a
17056 nonstandard way, this option is provided to turn on or off millicode
17057 call generation.
17058
17059 @item -mcode-density-frame
17060 @opindex mcode-density-frame
17061 This option enable the compiler to emit @code{enter} and @code{leave}
17062 instructions. These instructions are only valid for CPUs with
17063 code-density feature.
17064
17065 @item -mmixed-code
17066 @opindex mmixed-code
17067 Tweak register allocation to help 16-bit instruction generation.
17068 This generally has the effect of decreasing the average instruction size
17069 while increasing the instruction count.
17070
17071 @item -mq-class
17072 @opindex mq-class
17073 Enable @samp{q} instruction alternatives.
17074 This is the default for @option{-Os}.
17075
17076 @item -mRcq
17077 @opindex mRcq
17078 Enable @samp{Rcq} constraint handling.
17079 Most short code generation depends on this.
17080 This is the default.
17081
17082 @item -mRcw
17083 @opindex mRcw
17084 Enable @samp{Rcw} constraint handling.
17085 Most ccfsm condexec mostly depends on this.
17086 This is the default.
17087
17088 @item -msize-level=@var{level}
17089 @opindex msize-level
17090 Fine-tune size optimization with regards to instruction lengths and alignment.
17091 The recognized values for @var{level} are:
17092 @table @samp
17093 @item 0
17094 No size optimization. This level is deprecated and treated like @samp{1}.
17095
17096 @item 1
17097 Short instructions are used opportunistically.
17098
17099 @item 2
17100 In addition, alignment of loops and of code after barriers are dropped.
17101
17102 @item 3
17103 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
17104
17105 @end table
17106
17107 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
17108 the behavior when this is not set is equivalent to level @samp{1}.
17109
17110 @item -mtune=@var{cpu}
17111 @opindex mtune
17112 Set instruction scheduling parameters for @var{cpu}, overriding any implied
17113 by @option{-mcpu=}.
17114
17115 Supported values for @var{cpu} are
17116
17117 @table @samp
17118 @item ARC600
17119 Tune for ARC600 CPU.
17120
17121 @item ARC601
17122 Tune for ARC601 CPU.
17123
17124 @item ARC700
17125 Tune for ARC700 CPU with standard multiplier block.
17126
17127 @item ARC700-xmac
17128 Tune for ARC700 CPU with XMAC block.
17129
17130 @item ARC725D
17131 Tune for ARC725D CPU.
17132
17133 @item ARC750D
17134 Tune for ARC750D CPU.
17135
17136 @end table
17137
17138 @item -mmultcost=@var{num}
17139 @opindex mmultcost
17140 Cost to assume for a multiply instruction, with @samp{4} being equal to a
17141 normal instruction.
17142
17143 @item -munalign-prob-threshold=@var{probability}
17144 @opindex munalign-prob-threshold
17145 Set probability threshold for unaligning branches.
17146 When tuning for @samp{ARC700} and optimizing for speed, branches without
17147 filled delay slot are preferably emitted unaligned and long, unless
17148 profiling indicates that the probability for the branch to be taken
17149 is below @var{probability}. @xref{Cross-profiling}.
17150 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
17151
17152 @end table
17153
17154 The following options are maintained for backward compatibility, but
17155 are now deprecated and will be removed in a future release:
17156
17157 @c Deprecated options
17158 @table @gcctabopt
17159
17160 @item -margonaut
17161 @opindex margonaut
17162 Obsolete FPX.
17163
17164 @item -mbig-endian
17165 @opindex mbig-endian
17166 @itemx -EB
17167 @opindex EB
17168 Compile code for big-endian targets. Use of these options is now
17169 deprecated. Big-endian code is supported by configuring GCC to build
17170 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17171 for which big endian is the default.
17172
17173 @item -mlittle-endian
17174 @opindex mlittle-endian
17175 @itemx -EL
17176 @opindex EL
17177 Compile code for little-endian targets. Use of these options is now
17178 deprecated. Little-endian code is supported by configuring GCC to build
17179 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17180 for which little endian is the default.
17181
17182 @item -mbarrel_shifter
17183 @opindex mbarrel_shifter
17184 Replaced by @option{-mbarrel-shifter}.
17185
17186 @item -mdpfp_compact
17187 @opindex mdpfp_compact
17188 Replaced by @option{-mdpfp-compact}.
17189
17190 @item -mdpfp_fast
17191 @opindex mdpfp_fast
17192 Replaced by @option{-mdpfp-fast}.
17193
17194 @item -mdsp_packa
17195 @opindex mdsp_packa
17196 Replaced by @option{-mdsp-packa}.
17197
17198 @item -mEA
17199 @opindex mEA
17200 Replaced by @option{-mea}.
17201
17202 @item -mmac_24
17203 @opindex mmac_24
17204 Replaced by @option{-mmac-24}.
17205
17206 @item -mmac_d16
17207 @opindex mmac_d16
17208 Replaced by @option{-mmac-d16}.
17209
17210 @item -mspfp_compact
17211 @opindex mspfp_compact
17212 Replaced by @option{-mspfp-compact}.
17213
17214 @item -mspfp_fast
17215 @opindex mspfp_fast
17216 Replaced by @option{-mspfp-fast}.
17217
17218 @item -mtune=@var{cpu}
17219 @opindex mtune
17220 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17221 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17222 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17223
17224 @item -multcost=@var{num}
17225 @opindex multcost
17226 Replaced by @option{-mmultcost}.
17227
17228 @end table
17229
17230 @node ARM Options
17231 @subsection ARM Options
17232 @cindex ARM options
17233
17234 These @samp{-m} options are defined for the ARM port:
17235
17236 @table @gcctabopt
17237 @item -mabi=@var{name}
17238 @opindex mabi
17239 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17240 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17241
17242 @item -mapcs-frame
17243 @opindex mapcs-frame
17244 Generate a stack frame that is compliant with the ARM Procedure Call
17245 Standard for all functions, even if this is not strictly necessary for
17246 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17247 with this option causes the stack frames not to be generated for
17248 leaf functions. The default is @option{-mno-apcs-frame}.
17249 This option is deprecated.
17250
17251 @item -mapcs
17252 @opindex mapcs
17253 This is a synonym for @option{-mapcs-frame} and is deprecated.
17254
17255 @ignore
17256 @c not currently implemented
17257 @item -mapcs-stack-check
17258 @opindex mapcs-stack-check
17259 Generate code to check the amount of stack space available upon entry to
17260 every function (that actually uses some stack space). If there is
17261 insufficient space available then either the function
17262 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17263 called, depending upon the amount of stack space required. The runtime
17264 system is required to provide these functions. The default is
17265 @option{-mno-apcs-stack-check}, since this produces smaller code.
17266
17267 @c not currently implemented
17268 @item -mapcs-reentrant
17269 @opindex mapcs-reentrant
17270 Generate reentrant, position-independent code. The default is
17271 @option{-mno-apcs-reentrant}.
17272 @end ignore
17273
17274 @item -mthumb-interwork
17275 @opindex mthumb-interwork
17276 Generate code that supports calling between the ARM and Thumb
17277 instruction sets. Without this option, on pre-v5 architectures, the
17278 two instruction sets cannot be reliably used inside one program. The
17279 default is @option{-mno-thumb-interwork}, since slightly larger code
17280 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17281 configurations this option is meaningless.
17282
17283 @item -mno-sched-prolog
17284 @opindex mno-sched-prolog
17285 @opindex msched-prolog
17286 Prevent the reordering of instructions in the function prologue, or the
17287 merging of those instruction with the instructions in the function's
17288 body. This means that all functions start with a recognizable set
17289 of instructions (or in fact one of a choice from a small set of
17290 different function prologues), and this information can be used to
17291 locate the start of functions inside an executable piece of code. The
17292 default is @option{-msched-prolog}.
17293
17294 @item -mfloat-abi=@var{name}
17295 @opindex mfloat-abi
17296 Specifies which floating-point ABI to use. Permissible values
17297 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17298
17299 Specifying @samp{soft} causes GCC to generate output containing
17300 library calls for floating-point operations.
17301 @samp{softfp} allows the generation of code using hardware floating-point
17302 instructions, but still uses the soft-float calling conventions.
17303 @samp{hard} allows generation of floating-point instructions
17304 and uses FPU-specific calling conventions.
17305
17306 The default depends on the specific target configuration. Note that
17307 the hard-float and soft-float ABIs are not link-compatible; you must
17308 compile your entire program with the same ABI, and link with a
17309 compatible set of libraries.
17310
17311 @item -mgeneral-regs-only
17312 @opindex mgeneral-regs-only
17313 Generate code which uses only the general-purpose registers. This will prevent
17314 the compiler from using floating-point and Advanced SIMD registers but will not
17315 impose any restrictions on the assembler.
17316
17317 @item -mlittle-endian
17318 @opindex mlittle-endian
17319 Generate code for a processor running in little-endian mode. This is
17320 the default for all standard configurations.
17321
17322 @item -mbig-endian
17323 @opindex mbig-endian
17324 Generate code for a processor running in big-endian mode; the default is
17325 to compile code for a little-endian processor.
17326
17327 @item -mbe8
17328 @itemx -mbe32
17329 @opindex mbe8
17330 When linking a big-endian image select between BE8 and BE32 formats.
17331 The option has no effect for little-endian images and is ignored. The
17332 default is dependent on the selected target architecture. For ARMv6
17333 and later architectures the default is BE8, for older architectures
17334 the default is BE32. BE32 format has been deprecated by ARM.
17335
17336 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17337 @opindex march
17338 This specifies the name of the target ARM architecture. GCC uses this
17339 name to determine what kind of instructions it can emit when generating
17340 assembly code. This option can be used in conjunction with or instead
17341 of the @option{-mcpu=} option.
17342
17343 Permissible names are:
17344 @samp{armv4t},
17345 @samp{armv5t}, @samp{armv5te},
17346 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17347 @samp{armv6z}, @samp{armv6zk},
17348 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17349 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17350 @samp{armv8.4-a},
17351 @samp{armv8.5-a},
17352 @samp{armv7-r},
17353 @samp{armv8-r},
17354 @samp{armv6-m}, @samp{armv6s-m},
17355 @samp{armv7-m}, @samp{armv7e-m},
17356 @samp{armv8-m.base}, @samp{armv8-m.main},
17357 @samp{iwmmxt} and @samp{iwmmxt2}.
17358
17359 Additionally, the following architectures, which lack support for the
17360 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17361
17362 Many of the architectures support extensions. These can be added by
17363 appending @samp{+@var{extension}} to the architecture name. Extension
17364 options are processed in order and capabilities accumulate. An extension
17365 will also enable any necessary base extensions
17366 upon which it depends. For example, the @samp{+crypto} extension
17367 will always enable the @samp{+simd} extension. The exception to the
17368 additive construction is for extensions that are prefixed with
17369 @samp{+no@dots{}}: these extensions disable the specified option and
17370 any other extensions that may depend on the presence of that
17371 extension.
17372
17373 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17374 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17375 entirely disabled by the @samp{+nofp} option that follows it.
17376
17377 Most extension names are generically named, but have an effect that is
17378 dependent upon the architecture to which it is applied. For example,
17379 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17380 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17381 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17382 variant for @samp{armv8-a}.
17383
17384 The table below lists the supported extensions for each architecture.
17385 Architectures not mentioned do not support any extensions.
17386
17387 @table @samp
17388 @item armv5te
17389 @itemx armv6
17390 @itemx armv6j
17391 @itemx armv6k
17392 @itemx armv6kz
17393 @itemx armv6t2
17394 @itemx armv6z
17395 @itemx armv6zk
17396 @table @samp
17397 @item +fp
17398 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17399 used as an alias for this extension.
17400
17401 @item +nofp
17402 Disable the floating-point instructions.
17403 @end table
17404
17405 @item armv7
17406 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17407 @table @samp
17408 @item +fp
17409 The VFPv3 floating-point instructions, with 16 double-precision
17410 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17411 for this extension. Note that floating-point is not supported by the
17412 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17413 ARMv7-R architectures.
17414
17415 @item +nofp
17416 Disable the floating-point instructions.
17417 @end table
17418
17419 @item armv7-a
17420 @table @samp
17421 @item +mp
17422 The multiprocessing extension.
17423
17424 @item +sec
17425 The security extension.
17426
17427 @item +fp
17428 The VFPv3 floating-point instructions, with 16 double-precision
17429 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17430 for this extension.
17431
17432 @item +simd
17433 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17434 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17435 for this extension.
17436
17437 @item +vfpv3
17438 The VFPv3 floating-point instructions, with 32 double-precision
17439 registers.
17440
17441 @item +vfpv3-d16-fp16
17442 The VFPv3 floating-point instructions, with 16 double-precision
17443 registers and the half-precision floating-point conversion operations.
17444
17445 @item +vfpv3-fp16
17446 The VFPv3 floating-point instructions, with 32 double-precision
17447 registers and the half-precision floating-point conversion operations.
17448
17449 @item +vfpv4-d16
17450 The VFPv4 floating-point instructions, with 16 double-precision
17451 registers.
17452
17453 @item +vfpv4
17454 The VFPv4 floating-point instructions, with 32 double-precision
17455 registers.
17456
17457 @item +neon-fp16
17458 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17459 the half-precision floating-point conversion operations.
17460
17461 @item +neon-vfpv4
17462 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17463
17464 @item +nosimd
17465 Disable the Advanced SIMD instructions (does not disable floating point).
17466
17467 @item +nofp
17468 Disable the floating-point and Advanced SIMD instructions.
17469 @end table
17470
17471 @item armv7ve
17472 The extended version of the ARMv7-A architecture with support for
17473 virtualization.
17474 @table @samp
17475 @item +fp
17476 The VFPv4 floating-point instructions, with 16 double-precision registers.
17477 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17478
17479 @item +simd
17480 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17481 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17482
17483 @item +vfpv3-d16
17484 The VFPv3 floating-point instructions, with 16 double-precision
17485 registers.
17486
17487 @item +vfpv3
17488 The VFPv3 floating-point instructions, with 32 double-precision
17489 registers.
17490
17491 @item +vfpv3-d16-fp16
17492 The VFPv3 floating-point instructions, with 16 double-precision
17493 registers and the half-precision floating-point conversion operations.
17494
17495 @item +vfpv3-fp16
17496 The VFPv3 floating-point instructions, with 32 double-precision
17497 registers and the half-precision floating-point conversion operations.
17498
17499 @item +vfpv4-d16
17500 The VFPv4 floating-point instructions, with 16 double-precision
17501 registers.
17502
17503 @item +vfpv4
17504 The VFPv4 floating-point instructions, with 32 double-precision
17505 registers.
17506
17507 @item +neon
17508 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17509 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17510
17511 @item +neon-fp16
17512 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17513 the half-precision floating-point conversion operations.
17514
17515 @item +nosimd
17516 Disable the Advanced SIMD instructions (does not disable floating point).
17517
17518 @item +nofp
17519 Disable the floating-point and Advanced SIMD instructions.
17520 @end table
17521
17522 @item armv8-a
17523 @table @samp
17524 @item +crc
17525 The Cyclic Redundancy Check (CRC) instructions.
17526 @item +simd
17527 The ARMv8-A Advanced SIMD and floating-point instructions.
17528 @item +crypto
17529 The cryptographic instructions.
17530 @item +nocrypto
17531 Disable the cryptographic instructions.
17532 @item +nofp
17533 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17534 @item +sb
17535 Speculation Barrier Instruction.
17536 @item +predres
17537 Execution and Data Prediction Restriction Instructions.
17538 @end table
17539
17540 @item armv8.1-a
17541 @table @samp
17542 @item +simd
17543 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17544
17545 @item +crypto
17546 The cryptographic instructions. This also enables the Advanced SIMD and
17547 floating-point instructions.
17548
17549 @item +nocrypto
17550 Disable the cryptographic instructions.
17551
17552 @item +nofp
17553 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17554
17555 @item +sb
17556 Speculation Barrier Instruction.
17557
17558 @item +predres
17559 Execution and Data Prediction Restriction Instructions.
17560 @end table
17561
17562 @item armv8.2-a
17563 @itemx armv8.3-a
17564 @table @samp
17565 @item +fp16
17566 The half-precision floating-point data processing instructions.
17567 This also enables the Advanced SIMD and floating-point instructions.
17568
17569 @item +fp16fml
17570 The half-precision floating-point fmla extension. This also enables
17571 the half-precision floating-point extension and Advanced SIMD and
17572 floating-point instructions.
17573
17574 @item +simd
17575 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17576
17577 @item +crypto
17578 The cryptographic instructions. This also enables the Advanced SIMD and
17579 floating-point instructions.
17580
17581 @item +dotprod
17582 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17583
17584 @item +nocrypto
17585 Disable the cryptographic extension.
17586
17587 @item +nofp
17588 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17589
17590 @item +sb
17591 Speculation Barrier Instruction.
17592
17593 @item +predres
17594 Execution and Data Prediction Restriction Instructions.
17595 @end table
17596
17597 @item armv8.4-a
17598 @table @samp
17599 @item +fp16
17600 The half-precision floating-point data processing instructions.
17601 This also enables the Advanced SIMD and floating-point instructions as well
17602 as the Dot Product extension and the half-precision floating-point fmla
17603 extension.
17604
17605 @item +simd
17606 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17607 Dot Product extension.
17608
17609 @item +crypto
17610 The cryptographic instructions. This also enables the Advanced SIMD and
17611 floating-point instructions as well as the Dot Product extension.
17612
17613 @item +nocrypto
17614 Disable the cryptographic extension.
17615
17616 @item +nofp
17617 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17618
17619 @item +sb
17620 Speculation Barrier Instruction.
17621
17622 @item +predres
17623 Execution and Data Prediction Restriction Instructions.
17624 @end table
17625
17626 @item armv8.5-a
17627 @table @samp
17628 @item +fp16
17629 The half-precision floating-point data processing instructions.
17630 This also enables the Advanced SIMD and floating-point instructions as well
17631 as the Dot Product extension and the half-precision floating-point fmla
17632 extension.
17633
17634 @item +simd
17635 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17636 Dot Product extension.
17637
17638 @item +crypto
17639 The cryptographic instructions. This also enables the Advanced SIMD and
17640 floating-point instructions as well as the Dot Product extension.
17641
17642 @item +nocrypto
17643 Disable the cryptographic extension.
17644
17645 @item +nofp
17646 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17647 @end table
17648
17649 @item armv7-r
17650 @table @samp
17651 @item +fp.sp
17652 The single-precision VFPv3 floating-point instructions. The extension
17653 @samp{+vfpv3xd} can be used as an alias for this extension.
17654
17655 @item +fp
17656 The VFPv3 floating-point instructions with 16 double-precision registers.
17657 The extension +vfpv3-d16 can be used as an alias for this extension.
17658
17659 @item +vfpv3xd-d16-fp16
17660 The single-precision VFPv3 floating-point instructions with 16 double-precision
17661 registers and the half-precision floating-point conversion operations.
17662
17663 @item +vfpv3-d16-fp16
17664 The VFPv3 floating-point instructions with 16 double-precision
17665 registers and the half-precision floating-point conversion operations.
17666
17667 @item +nofp
17668 Disable the floating-point extension.
17669
17670 @item +idiv
17671 The ARM-state integer division instructions.
17672
17673 @item +noidiv
17674 Disable the ARM-state integer division extension.
17675 @end table
17676
17677 @item armv7e-m
17678 @table @samp
17679 @item +fp
17680 The single-precision VFPv4 floating-point instructions.
17681
17682 @item +fpv5
17683 The single-precision FPv5 floating-point instructions.
17684
17685 @item +fp.dp
17686 The single- and double-precision FPv5 floating-point instructions.
17687
17688 @item +nofp
17689 Disable the floating-point extensions.
17690 @end table
17691
17692 @item armv8-m.main
17693 @table @samp
17694 @item +dsp
17695 The DSP instructions.
17696
17697 @item +nodsp
17698 Disable the DSP extension.
17699
17700 @item +fp
17701 The single-precision floating-point instructions.
17702
17703 @item +fp.dp
17704 The single- and double-precision floating-point instructions.
17705
17706 @item +nofp
17707 Disable the floating-point extension.
17708 @end table
17709
17710 @item armv8-r
17711 @table @samp
17712 @item +crc
17713 The Cyclic Redundancy Check (CRC) instructions.
17714 @item +fp.sp
17715 The single-precision FPv5 floating-point instructions.
17716 @item +simd
17717 The ARMv8-A Advanced SIMD and floating-point instructions.
17718 @item +crypto
17719 The cryptographic instructions.
17720 @item +nocrypto
17721 Disable the cryptographic instructions.
17722 @item +nofp
17723 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17724 @end table
17725
17726 @end table
17727
17728 @option{-march=native} causes the compiler to auto-detect the architecture
17729 of the build computer. At present, this feature is only supported on
17730 GNU/Linux, and not all architectures are recognized. If the auto-detect
17731 is unsuccessful the option has no effect.
17732
17733 @item -mtune=@var{name}
17734 @opindex mtune
17735 This option specifies the name of the target ARM processor for
17736 which GCC should tune the performance of the code.
17737 For some ARM implementations better performance can be obtained by using
17738 this option.
17739 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17740 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17741 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17742 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17743 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17744 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17745 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17746 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17747 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17748 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17749 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17750 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17751 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17752 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
17753 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17754 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17755 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17756 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17757 @samp{cortex-m35p},
17758 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17759 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17760 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17761 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17762 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17763
17764 Additionally, this option can specify that GCC should tune the performance
17765 of the code for a big.LITTLE system. Permissible names are:
17766 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17767 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17768 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17769 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17770
17771 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17772 performance for a blend of processors within architecture @var{arch}.
17773 The aim is to generate code that run well on the current most popular
17774 processors, balancing between optimizations that benefit some CPUs in the
17775 range, and avoiding performance pitfalls of other CPUs. The effects of
17776 this option may change in future GCC versions as CPU models come and go.
17777
17778 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17779 the extension options do not affect the tuning of the generated code.
17780
17781 @option{-mtune=native} causes the compiler to auto-detect the CPU
17782 of the build computer. At present, this feature is only supported on
17783 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17784 unsuccessful the option has no effect.
17785
17786 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17787 @opindex mcpu
17788 This specifies the name of the target ARM processor. GCC uses this name
17789 to derive the name of the target ARM architecture (as if specified
17790 by @option{-march}) and the ARM processor type for which to tune for
17791 performance (as if specified by @option{-mtune}). Where this option
17792 is used in conjunction with @option{-march} or @option{-mtune},
17793 those options take precedence over the appropriate part of this option.
17794
17795 Many of the supported CPUs implement optional architectural
17796 extensions. Where this is so the architectural extensions are
17797 normally enabled by default. If implementations that lack the
17798 extension exist, then the extension syntax can be used to disable
17799 those extensions that have been omitted. For floating-point and
17800 Advanced SIMD (Neon) instructions, the settings of the options
17801 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17802 floating-point and Advanced SIMD instructions will only be used if
17803 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17804 @option{-mfpu} other than @samp{auto} will override the available
17805 floating-point and SIMD extension instructions.
17806
17807 For example, @samp{cortex-a9} can be found in three major
17808 configurations: integer only, with just a floating-point unit or with
17809 floating-point and Advanced SIMD. The default is to enable all the
17810 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17811 be used to disable just the SIMD or both the SIMD and floating-point
17812 instructions respectively.
17813
17814 Permissible names for this option are the same as those for
17815 @option{-mtune}.
17816
17817 The following extension options are common to the listed CPUs:
17818
17819 @table @samp
17820 @item +nodsp
17821 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
17822
17823 @item +nofp
17824 Disables the floating-point instructions on @samp{arm9e},
17825 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17826 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17827 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17828 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
17829 Disables the floating-point and SIMD instructions on
17830 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17831 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17832 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17833 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17834 @samp{cortex-a53} and @samp{cortex-a55}.
17835
17836 @item +nofp.dp
17837 Disables the double-precision component of the floating-point instructions
17838 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17839 @samp{cortex-m7}.
17840
17841 @item +nosimd
17842 Disables the SIMD (but not floating-point) instructions on
17843 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17844 and @samp{cortex-a9}.
17845
17846 @item +crypto
17847 Enables the cryptographic instructions on @samp{cortex-a32},
17848 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17849 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17850 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17851 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17852 @samp{cortex-a75.cortex-a55}.
17853 @end table
17854
17855 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17856 VFPv3 with 16 double-precision registers. It supports the following
17857 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17858 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17859 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17860 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17861 the extensions to @option{-march=armv7-a}.
17862
17863 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17864 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17865 See @option{-mtune} for more information.
17866
17867 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17868 of the build computer. At present, this feature is only supported on
17869 GNU/Linux, and not all architectures are recognized. If the auto-detect
17870 is unsuccessful the option has no effect.
17871
17872 @item -mfpu=@var{name}
17873 @opindex mfpu
17874 This specifies what floating-point hardware (or hardware emulation) is
17875 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17876 @samp{vfpv3},
17877 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17878 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17879 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17880 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17881 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17882 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17883 is an alias for @samp{vfpv2}.
17884
17885 The setting @samp{auto} is the default and is special. It causes the
17886 compiler to select the floating-point and Advanced SIMD instructions
17887 based on the settings of @option{-mcpu} and @option{-march}.
17888
17889 If the selected floating-point hardware includes the NEON extension
17890 (e.g.@: @option{-mfpu=neon}), note that floating-point
17891 operations are not generated by GCC's auto-vectorization pass unless
17892 @option{-funsafe-math-optimizations} is also specified. This is
17893 because NEON hardware does not fully implement the IEEE 754 standard for
17894 floating-point arithmetic (in particular denormal values are treated as
17895 zero), so the use of NEON instructions may lead to a loss of precision.
17896
17897 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}).
17898
17899 @item -mfp16-format=@var{name}
17900 @opindex mfp16-format
17901 Specify the format of the @code{__fp16} half-precision floating-point type.
17902 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17903 the default is @samp{none}, in which case the @code{__fp16} type is not
17904 defined. @xref{Half-Precision}, for more information.
17905
17906 @item -mstructure-size-boundary=@var{n}
17907 @opindex mstructure-size-boundary
17908 The sizes of all structures and unions are rounded up to a multiple
17909 of the number of bits set by this option. Permissible values are 8, 32
17910 and 64. The default value varies for different toolchains. For the COFF
17911 targeted toolchain the default value is 8. A value of 64 is only allowed
17912 if the underlying ABI supports it.
17913
17914 Specifying a larger number can produce faster, more efficient code, but
17915 can also increase the size of the program. Different values are potentially
17916 incompatible. Code compiled with one value cannot necessarily expect to
17917 work with code or libraries compiled with another value, if they exchange
17918 information using structures or unions.
17919
17920 This option is deprecated.
17921
17922 @item -mabort-on-noreturn
17923 @opindex mabort-on-noreturn
17924 Generate a call to the function @code{abort} at the end of a
17925 @code{noreturn} function. It is executed if the function tries to
17926 return.
17927
17928 @item -mlong-calls
17929 @itemx -mno-long-calls
17930 @opindex mlong-calls
17931 @opindex mno-long-calls
17932 Tells the compiler to perform function calls by first loading the
17933 address of the function into a register and then performing a subroutine
17934 call on this register. This switch is needed if the target function
17935 lies outside of the 64-megabyte addressing range of the offset-based
17936 version of subroutine call instruction.
17937
17938 Even if this switch is enabled, not all function calls are turned
17939 into long calls. The heuristic is that static functions, functions
17940 that have the @code{short_call} attribute, functions that are inside
17941 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17942 definitions have already been compiled within the current compilation
17943 unit are not turned into long calls. The exceptions to this rule are
17944 that weak function definitions, functions with the @code{long_call}
17945 attribute or the @code{section} attribute, and functions that are within
17946 the scope of a @code{#pragma long_calls} directive are always
17947 turned into long calls.
17948
17949 This feature is not enabled by default. Specifying
17950 @option{-mno-long-calls} restores the default behavior, as does
17951 placing the function calls within the scope of a @code{#pragma
17952 long_calls_off} directive. Note these switches have no effect on how
17953 the compiler generates code to handle function calls via function
17954 pointers.
17955
17956 @item -msingle-pic-base
17957 @opindex msingle-pic-base
17958 Treat the register used for PIC addressing as read-only, rather than
17959 loading it in the prologue for each function. The runtime system is
17960 responsible for initializing this register with an appropriate value
17961 before execution begins.
17962
17963 @item -mpic-register=@var{reg}
17964 @opindex mpic-register
17965 Specify the register to be used for PIC addressing.
17966 For standard PIC base case, the default is any suitable register
17967 determined by compiler. For single PIC base case, the default is
17968 @samp{R9} if target is EABI based or stack-checking is enabled,
17969 otherwise the default is @samp{R10}.
17970
17971 @item -mpic-data-is-text-relative
17972 @opindex mpic-data-is-text-relative
17973 Assume that the displacement between the text and data segments is fixed
17974 at static link time. This permits using PC-relative addressing
17975 operations to access data known to be in the data segment. For
17976 non-VxWorks RTP targets, this option is enabled by default. When
17977 disabled on such targets, it will enable @option{-msingle-pic-base} by
17978 default.
17979
17980 @item -mpoke-function-name
17981 @opindex mpoke-function-name
17982 Write the name of each function into the text section, directly
17983 preceding the function prologue. The generated code is similar to this:
17984
17985 @smallexample
17986 t0
17987 .ascii "arm_poke_function_name", 0
17988 .align
17989 t1
17990 .word 0xff000000 + (t1 - t0)
17991 arm_poke_function_name
17992 mov ip, sp
17993 stmfd sp!, @{fp, ip, lr, pc@}
17994 sub fp, ip, #4
17995 @end smallexample
17996
17997 When performing a stack backtrace, code can inspect the value of
17998 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17999 location @code{pc - 12} and the top 8 bits are set, then we know that
18000 there is a function name embedded immediately preceding this location
18001 and has length @code{((pc[-3]) & 0xff000000)}.
18002
18003 @item -mthumb
18004 @itemx -marm
18005 @opindex marm
18006 @opindex mthumb
18007
18008 Select between generating code that executes in ARM and Thumb
18009 states. The default for most configurations is to generate code
18010 that executes in ARM state, but the default can be changed by
18011 configuring GCC with the @option{--with-mode=}@var{state}
18012 configure option.
18013
18014 You can also override the ARM and Thumb mode for each function
18015 by using the @code{target("thumb")} and @code{target("arm")} function attributes
18016 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
18017
18018 @item -mflip-thumb
18019 @opindex mflip-thumb
18020 Switch ARM/Thumb modes on alternating functions.
18021 This option is provided for regression testing of mixed Thumb/ARM code
18022 generation, and is not intended for ordinary use in compiling code.
18023
18024 @item -mtpcs-frame
18025 @opindex mtpcs-frame
18026 Generate a stack frame that is compliant with the Thumb Procedure Call
18027 Standard for all non-leaf functions. (A leaf function is one that does
18028 not call any other functions.) The default is @option{-mno-tpcs-frame}.
18029
18030 @item -mtpcs-leaf-frame
18031 @opindex mtpcs-leaf-frame
18032 Generate a stack frame that is compliant with the Thumb Procedure Call
18033 Standard for all leaf functions. (A leaf function is one that does
18034 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
18035
18036 @item -mcallee-super-interworking
18037 @opindex mcallee-super-interworking
18038 Gives all externally visible functions in the file being compiled an ARM
18039 instruction set header which switches to Thumb mode before executing the
18040 rest of the function. This allows these functions to be called from
18041 non-interworking code. This option is not valid in AAPCS configurations
18042 because interworking is enabled by default.
18043
18044 @item -mcaller-super-interworking
18045 @opindex mcaller-super-interworking
18046 Allows calls via function pointers (including virtual functions) to
18047 execute correctly regardless of whether the target code has been
18048 compiled for interworking or not. There is a small overhead in the cost
18049 of executing a function pointer if this option is enabled. This option
18050 is not valid in AAPCS configurations because interworking is enabled
18051 by default.
18052
18053 @item -mtp=@var{name}
18054 @opindex mtp
18055 Specify the access model for the thread local storage pointer. The valid
18056 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
18057 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
18058 (supported in the arm6k architecture), and @samp{auto}, which uses the
18059 best available method for the selected processor. The default setting is
18060 @samp{auto}.
18061
18062 @item -mtls-dialect=@var{dialect}
18063 @opindex mtls-dialect
18064 Specify the dialect to use for accessing thread local storage. Two
18065 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
18066 @samp{gnu} dialect selects the original GNU scheme for supporting
18067 local and global dynamic TLS models. The @samp{gnu2} dialect
18068 selects the GNU descriptor scheme, which provides better performance
18069 for shared libraries. The GNU descriptor scheme is compatible with
18070 the original scheme, but does require new assembler, linker and
18071 library support. Initial and local exec TLS models are unaffected by
18072 this option and always use the original scheme.
18073
18074 @item -mword-relocations
18075 @opindex mword-relocations
18076 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
18077 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
18078 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
18079 is specified. This option conflicts with @option{-mslow-flash-data}.
18080
18081 @item -mfix-cortex-m3-ldrd
18082 @opindex mfix-cortex-m3-ldrd
18083 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
18084 with overlapping destination and base registers are used. This option avoids
18085 generating these instructions. This option is enabled by default when
18086 @option{-mcpu=cortex-m3} is specified.
18087
18088 @item -munaligned-access
18089 @itemx -mno-unaligned-access
18090 @opindex munaligned-access
18091 @opindex mno-unaligned-access
18092 Enables (or disables) reading and writing of 16- and 32- bit values
18093 from addresses that are not 16- or 32- bit aligned. By default
18094 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
18095 ARMv8-M Baseline architectures, and enabled for all other
18096 architectures. If unaligned access is not enabled then words in packed
18097 data structures are accessed a byte at a time.
18098
18099 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
18100 generated object file to either true or false, depending upon the
18101 setting of this option. If unaligned access is enabled then the
18102 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
18103 defined.
18104
18105 @item -mneon-for-64bits
18106 @opindex mneon-for-64bits
18107 This option is deprecated and has no effect.
18108
18109 @item -mslow-flash-data
18110 @opindex mslow-flash-data
18111 Assume loading data from flash is slower than fetching instruction.
18112 Therefore literal load is minimized for better performance.
18113 This option is only supported when compiling for ARMv7 M-profile and
18114 off by default. It conflicts with @option{-mword-relocations}.
18115
18116 @item -masm-syntax-unified
18117 @opindex masm-syntax-unified
18118 Assume inline assembler is using unified asm syntax. The default is
18119 currently off which implies divided syntax. This option has no impact
18120 on Thumb2. However, this may change in future releases of GCC.
18121 Divided syntax should be considered deprecated.
18122
18123 @item -mrestrict-it
18124 @opindex mrestrict-it
18125 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
18126 IT blocks can only contain a single 16-bit instruction from a select
18127 set of instructions. This option is on by default for ARMv8-A Thumb mode.
18128
18129 @item -mprint-tune-info
18130 @opindex mprint-tune-info
18131 Print CPU tuning information as comment in assembler file. This is
18132 an option used only for regression testing of the compiler and not
18133 intended for ordinary use in compiling code. This option is disabled
18134 by default.
18135
18136 @item -mverbose-cost-dump
18137 @opindex mverbose-cost-dump
18138 Enable verbose cost model dumping in the debug dump files. This option is
18139 provided for use in debugging the compiler.
18140
18141 @item -mpure-code
18142 @opindex mpure-code
18143 Do not allow constant data to be placed in code sections.
18144 Additionally, when compiling for ELF object format give all text sections the
18145 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
18146 is only available when generating non-pic code for M-profile targets with the
18147 MOVT instruction.
18148
18149 @item -mcmse
18150 @opindex mcmse
18151 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
18152 Development Tools Engineering Specification", which can be found on
18153 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
18154
18155 @item -mfdpic
18156 @itemx -mno-fdpic
18157 @opindex mfdpic
18158 @opindex mno-fdpic
18159 Select the FDPIC ABI, which uses 64-bit function descriptors to
18160 represent pointers to functions. When the compiler is configured for
18161 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
18162 and implies @option{-fPIE} if none of the PIC/PIE-related options is
18163 provided. On other targets, it only enables the FDPIC-specific code
18164 generation features, and the user should explicitly provide the
18165 PIC/PIE-related options as needed.
18166
18167 Note that static linking is not supported because it would still
18168 involve the dynamic linker when the program self-relocates. If such
18169 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
18170
18171 The opposite @option{-mno-fdpic} option is useful (and required) to
18172 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
18173 toolchain as the one used to build the userland programs.
18174
18175 @end table
18176
18177 @node AVR Options
18178 @subsection AVR Options
18179 @cindex AVR Options
18180
18181 These options are defined for AVR implementations:
18182
18183 @table @gcctabopt
18184 @item -mmcu=@var{mcu}
18185 @opindex mmcu
18186 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18187
18188 The default for this option is@tie{}@samp{avr2}.
18189
18190 GCC supports the following AVR devices and ISAs:
18191
18192 @include avr-mmcu.texi
18193
18194 @item -mabsdata
18195 @opindex mabsdata
18196
18197 Assume that all data in static storage can be accessed by LDS / STS
18198 instructions. This option has only an effect on reduced Tiny devices like
18199 ATtiny40. See also the @code{absdata}
18200 @ref{AVR Variable Attributes,variable attribute}.
18201
18202 @item -maccumulate-args
18203 @opindex maccumulate-args
18204 Accumulate outgoing function arguments and acquire/release the needed
18205 stack space for outgoing function arguments once in function
18206 prologue/epilogue. Without this option, outgoing arguments are pushed
18207 before calling a function and popped afterwards.
18208
18209 Popping the arguments after the function call can be expensive on
18210 AVR so that accumulating the stack space might lead to smaller
18211 executables because arguments need not be removed from the
18212 stack after such a function call.
18213
18214 This option can lead to reduced code size for functions that perform
18215 several calls to functions that get their arguments on the stack like
18216 calls to printf-like functions.
18217
18218 @item -mbranch-cost=@var{cost}
18219 @opindex mbranch-cost
18220 Set the branch costs for conditional branch instructions to
18221 @var{cost}. Reasonable values for @var{cost} are small, non-negative
18222 integers. The default branch cost is 0.
18223
18224 @item -mcall-prologues
18225 @opindex mcall-prologues
18226 Functions prologues/epilogues are expanded as calls to appropriate
18227 subroutines. Code size is smaller.
18228
18229 @item -mgas-isr-prologues
18230 @opindex mgas-isr-prologues
18231 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18232 instruction supported by GNU Binutils.
18233 If this option is on, the feature can still be disabled for individual
18234 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18235 function attribute. This feature is activated per default
18236 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18237 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18238
18239 @item -mint8
18240 @opindex mint8
18241 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18242 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18243 and @code{long long} is 4 bytes. Please note that this option does not
18244 conform to the C standards, but it results in smaller code
18245 size.
18246
18247 @item -mmain-is-OS_task
18248 @opindex mmain-is-OS_task
18249 Do not save registers in @code{main}. The effect is the same like
18250 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18251 to @code{main}. It is activated per default if optimization is on.
18252
18253 @item -mn-flash=@var{num}
18254 @opindex mn-flash
18255 Assume that the flash memory has a size of
18256 @var{num} times 64@tie{}KiB.
18257
18258 @item -mno-interrupts
18259 @opindex mno-interrupts
18260 Generated code is not compatible with hardware interrupts.
18261 Code size is smaller.
18262
18263 @item -mrelax
18264 @opindex mrelax
18265 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18266 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18267 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18268 the assembler's command line and the @option{--relax} option to the
18269 linker's command line.
18270
18271 Jump relaxing is performed by the linker because jump offsets are not
18272 known before code is located. Therefore, the assembler code generated by the
18273 compiler is the same, but the instructions in the executable may
18274 differ from instructions in the assembler code.
18275
18276 Relaxing must be turned on if linker stubs are needed, see the
18277 section on @code{EIND} and linker stubs below.
18278
18279 @item -mrmw
18280 @opindex mrmw
18281 Assume that the device supports the Read-Modify-Write
18282 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18283
18284 @item -mshort-calls
18285 @opindex mshort-calls
18286
18287 Assume that @code{RJMP} and @code{RCALL} can target the whole
18288 program memory.
18289
18290 This option is used internally for multilib selection. It is
18291 not an optimization option, and you don't need to set it by hand.
18292
18293 @item -msp8
18294 @opindex msp8
18295 Treat the stack pointer register as an 8-bit register,
18296 i.e.@: assume the high byte of the stack pointer is zero.
18297 In general, you don't need to set this option by hand.
18298
18299 This option is used internally by the compiler to select and
18300 build multilibs for architectures @code{avr2} and @code{avr25}.
18301 These architectures mix devices with and without @code{SPH}.
18302 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18303 the compiler driver adds or removes this option from the compiler
18304 proper's command line, because the compiler then knows if the device
18305 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18306 register or not.
18307
18308 @item -mstrict-X
18309 @opindex mstrict-X
18310 Use address register @code{X} in a way proposed by the hardware. This means
18311 that @code{X} is only used in indirect, post-increment or
18312 pre-decrement addressing.
18313
18314 Without this option, the @code{X} register may be used in the same way
18315 as @code{Y} or @code{Z} which then is emulated by additional
18316 instructions.
18317 For example, loading a value with @code{X+const} addressing with a
18318 small non-negative @code{const < 64} to a register @var{Rn} is
18319 performed as
18320
18321 @example
18322 adiw r26, const ; X += const
18323 ld @var{Rn}, X ; @var{Rn} = *X
18324 sbiw r26, const ; X -= const
18325 @end example
18326
18327 @item -mtiny-stack
18328 @opindex mtiny-stack
18329 Only change the lower 8@tie{}bits of the stack pointer.
18330
18331 @item -mfract-convert-truncate
18332 @opindex mfract-convert-truncate
18333 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18334
18335 @item -nodevicelib
18336 @opindex nodevicelib
18337 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18338
18339 @item -Waddr-space-convert
18340 @opindex Waddr-space-convert
18341 @opindex Wno-addr-space-convert
18342 Warn about conversions between address spaces in the case where the
18343 resulting address space is not contained in the incoming address space.
18344
18345 @item -Wmisspelled-isr
18346 @opindex Wmisspelled-isr
18347 @opindex Wno-misspelled-isr
18348 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18349 Enabled by default.
18350 @end table
18351
18352 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18353 @cindex @code{EIND}
18354 Pointers in the implementation are 16@tie{}bits wide.
18355 The address of a function or label is represented as word address so
18356 that indirect jumps and calls can target any code address in the
18357 range of 64@tie{}Ki words.
18358
18359 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18360 bytes of program memory space, there is a special function register called
18361 @code{EIND} that serves as most significant part of the target address
18362 when @code{EICALL} or @code{EIJMP} instructions are used.
18363
18364 Indirect jumps and calls on these devices are handled as follows by
18365 the compiler and are subject to some limitations:
18366
18367 @itemize @bullet
18368
18369 @item
18370 The compiler never sets @code{EIND}.
18371
18372 @item
18373 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18374 instructions or might read @code{EIND} directly in order to emulate an
18375 indirect call/jump by means of a @code{RET} instruction.
18376
18377 @item
18378 The compiler assumes that @code{EIND} never changes during the startup
18379 code or during the application. In particular, @code{EIND} is not
18380 saved/restored in function or interrupt service routine
18381 prologue/epilogue.
18382
18383 @item
18384 For indirect calls to functions and computed goto, the linker
18385 generates @emph{stubs}. Stubs are jump pads sometimes also called
18386 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18387 The stub contains a direct jump to the desired address.
18388
18389 @item
18390 Linker relaxation must be turned on so that the linker generates
18391 the stubs correctly in all situations. See the compiler option
18392 @option{-mrelax} and the linker option @option{--relax}.
18393 There are corner cases where the linker is supposed to generate stubs
18394 but aborts without relaxation and without a helpful error message.
18395
18396 @item
18397 The default linker script is arranged for code with @code{EIND = 0}.
18398 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18399 linker script has to be used in order to place the sections whose
18400 name start with @code{.trampolines} into the segment where @code{EIND}
18401 points to.
18402
18403 @item
18404 The startup code from libgcc never sets @code{EIND}.
18405 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18406 For the impact of AVR-LibC on @code{EIND}, see the
18407 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18408
18409 @item
18410 It is legitimate for user-specific startup code to set up @code{EIND}
18411 early, for example by means of initialization code located in
18412 section @code{.init3}. Such code runs prior to general startup code
18413 that initializes RAM and calls constructors, but after the bit
18414 of startup code from AVR-LibC that sets @code{EIND} to the segment
18415 where the vector table is located.
18416 @example
18417 #include <avr/io.h>
18418
18419 static void
18420 __attribute__((section(".init3"),naked,used,no_instrument_function))
18421 init3_set_eind (void)
18422 @{
18423 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18424 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18425 @}
18426 @end example
18427
18428 @noindent
18429 The @code{__trampolines_start} symbol is defined in the linker script.
18430
18431 @item
18432 Stubs are generated automatically by the linker if
18433 the following two conditions are met:
18434 @itemize @minus
18435
18436 @item The address of a label is taken by means of the @code{gs} modifier
18437 (short for @emph{generate stubs}) like so:
18438 @example
18439 LDI r24, lo8(gs(@var{func}))
18440 LDI r25, hi8(gs(@var{func}))
18441 @end example
18442 @item The final location of that label is in a code segment
18443 @emph{outside} the segment where the stubs are located.
18444 @end itemize
18445
18446 @item
18447 The compiler emits such @code{gs} modifiers for code labels in the
18448 following situations:
18449 @itemize @minus
18450 @item Taking address of a function or code label.
18451 @item Computed goto.
18452 @item If prologue-save function is used, see @option{-mcall-prologues}
18453 command-line option.
18454 @item Switch/case dispatch tables. If you do not want such dispatch
18455 tables you can specify the @option{-fno-jump-tables} command-line option.
18456 @item C and C++ constructors/destructors called during startup/shutdown.
18457 @item If the tools hit a @code{gs()} modifier explained above.
18458 @end itemize
18459
18460 @item
18461 Jumping to non-symbolic addresses like so is @emph{not} supported:
18462
18463 @example
18464 int main (void)
18465 @{
18466 /* Call function at word address 0x2 */
18467 return ((int(*)(void)) 0x2)();
18468 @}
18469 @end example
18470
18471 Instead, a stub has to be set up, i.e.@: the function has to be called
18472 through a symbol (@code{func_4} in the example):
18473
18474 @example
18475 int main (void)
18476 @{
18477 extern int func_4 (void);
18478
18479 /* Call function at byte address 0x4 */
18480 return func_4();
18481 @}
18482 @end example
18483
18484 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18485 Alternatively, @code{func_4} can be defined in the linker script.
18486 @end itemize
18487
18488 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18489 @cindex @code{RAMPD}
18490 @cindex @code{RAMPX}
18491 @cindex @code{RAMPY}
18492 @cindex @code{RAMPZ}
18493 Some AVR devices support memories larger than the 64@tie{}KiB range
18494 that can be accessed with 16-bit pointers. To access memory locations
18495 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18496 register is used as high part of the address:
18497 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18498 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18499 register, respectively, to get a wide address. Similarly,
18500 @code{RAMPD} is used together with direct addressing.
18501
18502 @itemize
18503 @item
18504 The startup code initializes the @code{RAMP} special function
18505 registers with zero.
18506
18507 @item
18508 If a @ref{AVR Named Address Spaces,named address space} other than
18509 generic or @code{__flash} is used, then @code{RAMPZ} is set
18510 as needed before the operation.
18511
18512 @item
18513 If the device supports RAM larger than 64@tie{}KiB and the compiler
18514 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18515 is reset to zero after the operation.
18516
18517 @item
18518 If the device comes with a specific @code{RAMP} register, the ISR
18519 prologue/epilogue saves/restores that SFR and initializes it with
18520 zero in case the ISR code might (implicitly) use it.
18521
18522 @item
18523 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18524 If you use inline assembler to read from locations outside the
18525 16-bit address range and change one of the @code{RAMP} registers,
18526 you must reset it to zero after the access.
18527
18528 @end itemize
18529
18530 @subsubsection AVR Built-in Macros
18531
18532 GCC defines several built-in macros so that the user code can test
18533 for the presence or absence of features. Almost any of the following
18534 built-in macros are deduced from device capabilities and thus
18535 triggered by the @option{-mmcu=} command-line option.
18536
18537 For even more AVR-specific built-in macros see
18538 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18539
18540 @table @code
18541
18542 @item __AVR_ARCH__
18543 Build-in macro that resolves to a decimal number that identifies the
18544 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18545 Possible values are:
18546
18547 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18548 @code{4}, @code{5}, @code{51}, @code{6}
18549
18550 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18551 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18552
18553 respectively and
18554
18555 @code{100},
18556 @code{102}, @code{103}, @code{104},
18557 @code{105}, @code{106}, @code{107}
18558
18559 for @var{mcu}=@code{avrtiny},
18560 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18561 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18562 If @var{mcu} specifies a device, this built-in macro is set
18563 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18564 defined to @code{4}.
18565
18566 @item __AVR_@var{Device}__
18567 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18568 the device's name. For example, @option{-mmcu=atmega8} defines the
18569 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18570 @code{__AVR_ATtiny261A__}, etc.
18571
18572 The built-in macros' names follow
18573 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18574 the device name as from the AVR user manual. The difference between
18575 @var{Device} in the built-in macro and @var{device} in
18576 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18577
18578 If @var{device} is not a device but only a core architecture like
18579 @samp{avr51}, this macro is not defined.
18580
18581 @item __AVR_DEVICE_NAME__
18582 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18583 the device's name. For example, with @option{-mmcu=atmega8} the macro
18584 is defined to @code{atmega8}.
18585
18586 If @var{device} is not a device but only a core architecture like
18587 @samp{avr51}, this macro is not defined.
18588
18589 @item __AVR_XMEGA__
18590 The device / architecture belongs to the XMEGA family of devices.
18591
18592 @item __AVR_HAVE_ELPM__
18593 The device has the @code{ELPM} instruction.
18594
18595 @item __AVR_HAVE_ELPMX__
18596 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18597 R@var{n},Z+} instructions.
18598
18599 @item __AVR_HAVE_MOVW__
18600 The device has the @code{MOVW} instruction to perform 16-bit
18601 register-register moves.
18602
18603 @item __AVR_HAVE_LPMX__
18604 The device has the @code{LPM R@var{n},Z} and
18605 @code{LPM R@var{n},Z+} instructions.
18606
18607 @item __AVR_HAVE_MUL__
18608 The device has a hardware multiplier.
18609
18610 @item __AVR_HAVE_JMP_CALL__
18611 The device has the @code{JMP} and @code{CALL} instructions.
18612 This is the case for devices with more than 8@tie{}KiB of program
18613 memory.
18614
18615 @item __AVR_HAVE_EIJMP_EICALL__
18616 @itemx __AVR_3_BYTE_PC__
18617 The device has the @code{EIJMP} and @code{EICALL} instructions.
18618 This is the case for devices with more than 128@tie{}KiB of program memory.
18619 This also means that the program counter
18620 (PC) is 3@tie{}bytes wide.
18621
18622 @item __AVR_2_BYTE_PC__
18623 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18624 with up to 128@tie{}KiB of program memory.
18625
18626 @item __AVR_HAVE_8BIT_SP__
18627 @itemx __AVR_HAVE_16BIT_SP__
18628 The stack pointer (SP) register is treated as 8-bit respectively
18629 16-bit register by the compiler.
18630 The definition of these macros is affected by @option{-mtiny-stack}.
18631
18632 @item __AVR_HAVE_SPH__
18633 @itemx __AVR_SP8__
18634 The device has the SPH (high part of stack pointer) special function
18635 register or has an 8-bit stack pointer, respectively.
18636 The definition of these macros is affected by @option{-mmcu=} and
18637 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18638 by @option{-msp8}.
18639
18640 @item __AVR_HAVE_RAMPD__
18641 @itemx __AVR_HAVE_RAMPX__
18642 @itemx __AVR_HAVE_RAMPY__
18643 @itemx __AVR_HAVE_RAMPZ__
18644 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18645 @code{RAMPZ} special function register, respectively.
18646
18647 @item __NO_INTERRUPTS__
18648 This macro reflects the @option{-mno-interrupts} command-line option.
18649
18650 @item __AVR_ERRATA_SKIP__
18651 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18652 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18653 instructions because of a hardware erratum. Skip instructions are
18654 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18655 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18656 set.
18657
18658 @item __AVR_ISA_RMW__
18659 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18660
18661 @item __AVR_SFR_OFFSET__=@var{offset}
18662 Instructions that can address I/O special function registers directly
18663 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18664 address as if addressed by an instruction to access RAM like @code{LD}
18665 or @code{STS}. This offset depends on the device architecture and has
18666 to be subtracted from the RAM address in order to get the
18667 respective I/O@tie{}address.
18668
18669 @item __AVR_SHORT_CALLS__
18670 The @option{-mshort-calls} command line option is set.
18671
18672 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18673 Some devices support reading from flash memory by means of @code{LD*}
18674 instructions. The flash memory is seen in the data address space
18675 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18676 is not defined, this feature is not available. If defined,
18677 the address space is linear and there is no need to put
18678 @code{.rodata} into RAM. This is handled by the default linker
18679 description file, and is currently available for
18680 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18681 there is no need to use address spaces like @code{__flash} or
18682 features like attribute @code{progmem} and @code{pgm_read_*}.
18683
18684 @item __WITH_AVRLIBC__
18685 The compiler is configured to be used together with AVR-Libc.
18686 See the @option{--with-avrlibc} configure option.
18687
18688 @end table
18689
18690 @node Blackfin Options
18691 @subsection Blackfin Options
18692 @cindex Blackfin Options
18693
18694 @table @gcctabopt
18695 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18696 @opindex mcpu=
18697 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18698 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18699 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18700 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18701 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18702 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18703 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18704 @samp{bf561}, @samp{bf592}.
18705
18706 The optional @var{sirevision} specifies the silicon revision of the target
18707 Blackfin processor. Any workarounds available for the targeted silicon revision
18708 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18709 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18710 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18711 hexadecimal digits representing the major and minor numbers in the silicon
18712 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18713 is not defined. If @var{sirevision} is @samp{any}, the
18714 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18715 If this optional @var{sirevision} is not used, GCC assumes the latest known
18716 silicon revision of the targeted Blackfin processor.
18717
18718 GCC defines a preprocessor macro for the specified @var{cpu}.
18719 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18720 provided by libgloss to be linked in if @option{-msim} is not given.
18721
18722 Without this option, @samp{bf532} is used as the processor by default.
18723
18724 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18725 only the preprocessor macro is defined.
18726
18727 @item -msim
18728 @opindex msim
18729 Specifies that the program will be run on the simulator. This causes
18730 the simulator BSP provided by libgloss to be linked in. This option
18731 has effect only for @samp{bfin-elf} toolchain.
18732 Certain other options, such as @option{-mid-shared-library} and
18733 @option{-mfdpic}, imply @option{-msim}.
18734
18735 @item -momit-leaf-frame-pointer
18736 @opindex momit-leaf-frame-pointer
18737 Don't keep the frame pointer in a register for leaf functions. This
18738 avoids the instructions to save, set up and restore frame pointers and
18739 makes an extra register available in leaf functions.
18740
18741 @item -mspecld-anomaly
18742 @opindex mspecld-anomaly
18743 When enabled, the compiler ensures that the generated code does not
18744 contain speculative loads after jump instructions. If this option is used,
18745 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18746
18747 @item -mno-specld-anomaly
18748 @opindex mno-specld-anomaly
18749 @opindex mspecld-anomaly
18750 Don't generate extra code to prevent speculative loads from occurring.
18751
18752 @item -mcsync-anomaly
18753 @opindex mcsync-anomaly
18754 When enabled, the compiler ensures that the generated code does not
18755 contain CSYNC or SSYNC instructions too soon after conditional branches.
18756 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18757
18758 @item -mno-csync-anomaly
18759 @opindex mno-csync-anomaly
18760 @opindex mcsync-anomaly
18761 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18762 occurring too soon after a conditional branch.
18763
18764 @item -mlow64k
18765 @opindex mlow64k
18766 When enabled, the compiler is free to take advantage of the knowledge that
18767 the entire program fits into the low 64k of memory.
18768
18769 @item -mno-low64k
18770 @opindex mno-low64k
18771 Assume that the program is arbitrarily large. This is the default.
18772
18773 @item -mstack-check-l1
18774 @opindex mstack-check-l1
18775 Do stack checking using information placed into L1 scratchpad memory by the
18776 uClinux kernel.
18777
18778 @item -mid-shared-library
18779 @opindex mid-shared-library
18780 Generate code that supports shared libraries via the library ID method.
18781 This allows for execute in place and shared libraries in an environment
18782 without virtual memory management. This option implies @option{-fPIC}.
18783 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18784
18785 @item -mno-id-shared-library
18786 @opindex mno-id-shared-library
18787 @opindex mid-shared-library
18788 Generate code that doesn't assume ID-based shared libraries are being used.
18789 This is the default.
18790
18791 @item -mleaf-id-shared-library
18792 @opindex mleaf-id-shared-library
18793 Generate code that supports shared libraries via the library ID method,
18794 but assumes that this library or executable won't link against any other
18795 ID shared libraries. That allows the compiler to use faster code for jumps
18796 and calls.
18797
18798 @item -mno-leaf-id-shared-library
18799 @opindex mno-leaf-id-shared-library
18800 @opindex mleaf-id-shared-library
18801 Do not assume that the code being compiled won't link against any ID shared
18802 libraries. Slower code is generated for jump and call insns.
18803
18804 @item -mshared-library-id=n
18805 @opindex mshared-library-id
18806 Specifies the identification number of the ID-based shared library being
18807 compiled. Specifying a value of 0 generates more compact code; specifying
18808 other values forces the allocation of that number to the current
18809 library but is no more space- or time-efficient than omitting this option.
18810
18811 @item -msep-data
18812 @opindex msep-data
18813 Generate code that allows the data segment to be located in a different
18814 area of memory from the text segment. This allows for execute in place in
18815 an environment without virtual memory management by eliminating relocations
18816 against the text section.
18817
18818 @item -mno-sep-data
18819 @opindex mno-sep-data
18820 @opindex msep-data
18821 Generate code that assumes that the data segment follows the text segment.
18822 This is the default.
18823
18824 @item -mlong-calls
18825 @itemx -mno-long-calls
18826 @opindex mlong-calls
18827 @opindex mno-long-calls
18828 Tells the compiler to perform function calls by first loading the
18829 address of the function into a register and then performing a subroutine
18830 call on this register. This switch is needed if the target function
18831 lies outside of the 24-bit addressing range of the offset-based
18832 version of subroutine call instruction.
18833
18834 This feature is not enabled by default. Specifying
18835 @option{-mno-long-calls} restores the default behavior. Note these
18836 switches have no effect on how the compiler generates code to handle
18837 function calls via function pointers.
18838
18839 @item -mfast-fp
18840 @opindex mfast-fp
18841 Link with the fast floating-point library. This library relaxes some of
18842 the IEEE floating-point standard's rules for checking inputs against
18843 Not-a-Number (NAN), in the interest of performance.
18844
18845 @item -minline-plt
18846 @opindex minline-plt
18847 Enable inlining of PLT entries in function calls to functions that are
18848 not known to bind locally. It has no effect without @option{-mfdpic}.
18849
18850 @item -mmulticore
18851 @opindex mmulticore
18852 Build a standalone application for multicore Blackfin processors.
18853 This option causes proper start files and link scripts supporting
18854 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18855 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18856
18857 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18858 selects the one-application-per-core programming model. Without
18859 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18860 programming model is used. In this model, the main function of Core B
18861 should be named as @code{coreb_main}.
18862
18863 If this option is not used, the single-core application programming
18864 model is used.
18865
18866 @item -mcorea
18867 @opindex mcorea
18868 Build a standalone application for Core A of BF561 when using
18869 the one-application-per-core programming model. Proper start files
18870 and link scripts are used to support Core A, and the macro
18871 @code{__BFIN_COREA} is defined.
18872 This option can only be used in conjunction with @option{-mmulticore}.
18873
18874 @item -mcoreb
18875 @opindex mcoreb
18876 Build a standalone application for Core B of BF561 when using
18877 the one-application-per-core programming model. Proper start files
18878 and link scripts are used to support Core B, and the macro
18879 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18880 should be used instead of @code{main}.
18881 This option can only be used in conjunction with @option{-mmulticore}.
18882
18883 @item -msdram
18884 @opindex msdram
18885 Build a standalone application for SDRAM. Proper start files and
18886 link scripts are used to put the application into SDRAM, and the macro
18887 @code{__BFIN_SDRAM} is defined.
18888 The loader should initialize SDRAM before loading the application.
18889
18890 @item -micplb
18891 @opindex micplb
18892 Assume that ICPLBs are enabled at run time. This has an effect on certain
18893 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18894 are enabled; for standalone applications the default is off.
18895 @end table
18896
18897 @node C6X Options
18898 @subsection C6X Options
18899 @cindex C6X Options
18900
18901 @table @gcctabopt
18902 @item -march=@var{name}
18903 @opindex march
18904 This specifies the name of the target architecture. GCC uses this
18905 name to determine what kind of instructions it can emit when generating
18906 assembly code. Permissible names are: @samp{c62x},
18907 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18908
18909 @item -mbig-endian
18910 @opindex mbig-endian
18911 Generate code for a big-endian target.
18912
18913 @item -mlittle-endian
18914 @opindex mlittle-endian
18915 Generate code for a little-endian target. This is the default.
18916
18917 @item -msim
18918 @opindex msim
18919 Choose startup files and linker script suitable for the simulator.
18920
18921 @item -msdata=default
18922 @opindex msdata=default
18923 Put small global and static data in the @code{.neardata} section,
18924 which is pointed to by register @code{B14}. Put small uninitialized
18925 global and static data in the @code{.bss} section, which is adjacent
18926 to the @code{.neardata} section. Put small read-only data into the
18927 @code{.rodata} section. The corresponding sections used for large
18928 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18929
18930 @item -msdata=all
18931 @opindex msdata=all
18932 Put all data, not just small objects, into the sections reserved for
18933 small data, and use addressing relative to the @code{B14} register to
18934 access them.
18935
18936 @item -msdata=none
18937 @opindex msdata=none
18938 Make no use of the sections reserved for small data, and use absolute
18939 addresses to access all data. Put all initialized global and static
18940 data in the @code{.fardata} section, and all uninitialized data in the
18941 @code{.far} section. Put all constant data into the @code{.const}
18942 section.
18943 @end table
18944
18945 @node CRIS Options
18946 @subsection CRIS Options
18947 @cindex CRIS Options
18948
18949 These options are defined specifically for the CRIS ports.
18950
18951 @table @gcctabopt
18952 @item -march=@var{architecture-type}
18953 @itemx -mcpu=@var{architecture-type}
18954 @opindex march
18955 @opindex mcpu
18956 Generate code for the specified architecture. The choices for
18957 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18958 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18959 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18960 @samp{v10}.
18961
18962 @item -mtune=@var{architecture-type}
18963 @opindex mtune
18964 Tune to @var{architecture-type} everything applicable about the generated
18965 code, except for the ABI and the set of available instructions. The
18966 choices for @var{architecture-type} are the same as for
18967 @option{-march=@var{architecture-type}}.
18968
18969 @item -mmax-stack-frame=@var{n}
18970 @opindex mmax-stack-frame
18971 Warn when the stack frame of a function exceeds @var{n} bytes.
18972
18973 @item -metrax4
18974 @itemx -metrax100
18975 @opindex metrax4
18976 @opindex metrax100
18977 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18978 @option{-march=v3} and @option{-march=v8} respectively.
18979
18980 @item -mmul-bug-workaround
18981 @itemx -mno-mul-bug-workaround
18982 @opindex mmul-bug-workaround
18983 @opindex mno-mul-bug-workaround
18984 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18985 models where it applies. This option is active by default.
18986
18987 @item -mpdebug
18988 @opindex mpdebug
18989 Enable CRIS-specific verbose debug-related information in the assembly
18990 code. This option also has the effect of turning off the @samp{#NO_APP}
18991 formatted-code indicator to the assembler at the beginning of the
18992 assembly file.
18993
18994 @item -mcc-init
18995 @opindex mcc-init
18996 Do not use condition-code results from previous instruction; always emit
18997 compare and test instructions before use of condition codes.
18998
18999 @item -mno-side-effects
19000 @opindex mno-side-effects
19001 @opindex mside-effects
19002 Do not emit instructions with side effects in addressing modes other than
19003 post-increment.
19004
19005 @item -mstack-align
19006 @itemx -mno-stack-align
19007 @itemx -mdata-align
19008 @itemx -mno-data-align
19009 @itemx -mconst-align
19010 @itemx -mno-const-align
19011 @opindex mstack-align
19012 @opindex mno-stack-align
19013 @opindex mdata-align
19014 @opindex mno-data-align
19015 @opindex mconst-align
19016 @opindex mno-const-align
19017 These options (@samp{no-} options) arrange (eliminate arrangements) for the
19018 stack frame, individual data and constants to be aligned for the maximum
19019 single data access size for the chosen CPU model. The default is to
19020 arrange for 32-bit alignment. ABI details such as structure layout are
19021 not affected by these options.
19022
19023 @item -m32-bit
19024 @itemx -m16-bit
19025 @itemx -m8-bit
19026 @opindex m32-bit
19027 @opindex m16-bit
19028 @opindex m8-bit
19029 Similar to the stack- data- and const-align options above, these options
19030 arrange for stack frame, writable data and constants to all be 32-bit,
19031 16-bit or 8-bit aligned. The default is 32-bit alignment.
19032
19033 @item -mno-prologue-epilogue
19034 @itemx -mprologue-epilogue
19035 @opindex mno-prologue-epilogue
19036 @opindex mprologue-epilogue
19037 With @option{-mno-prologue-epilogue}, the normal function prologue and
19038 epilogue which set up the stack frame are omitted and no return
19039 instructions or return sequences are generated in the code. Use this
19040 option only together with visual inspection of the compiled code: no
19041 warnings or errors are generated when call-saved registers must be saved,
19042 or storage for local variables needs to be allocated.
19043
19044 @item -mno-gotplt
19045 @itemx -mgotplt
19046 @opindex mno-gotplt
19047 @opindex mgotplt
19048 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
19049 instruction sequences that load addresses for functions from the PLT part
19050 of the GOT rather than (traditional on other architectures) calls to the
19051 PLT@. The default is @option{-mgotplt}.
19052
19053 @item -melf
19054 @opindex melf
19055 Legacy no-op option only recognized with the cris-axis-elf and
19056 cris-axis-linux-gnu targets.
19057
19058 @item -mlinux
19059 @opindex mlinux
19060 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
19061
19062 @item -sim
19063 @opindex sim
19064 This option, recognized for the cris-axis-elf, arranges
19065 to link with input-output functions from a simulator library. Code,
19066 initialized data and zero-initialized data are allocated consecutively.
19067
19068 @item -sim2
19069 @opindex sim2
19070 Like @option{-sim}, but pass linker options to locate initialized data at
19071 0x40000000 and zero-initialized data at 0x80000000.
19072 @end table
19073
19074 @node CR16 Options
19075 @subsection CR16 Options
19076 @cindex CR16 Options
19077
19078 These options are defined specifically for the CR16 ports.
19079
19080 @table @gcctabopt
19081
19082 @item -mmac
19083 @opindex mmac
19084 Enable the use of multiply-accumulate instructions. Disabled by default.
19085
19086 @item -mcr16cplus
19087 @itemx -mcr16c
19088 @opindex mcr16cplus
19089 @opindex mcr16c
19090 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
19091 is default.
19092
19093 @item -msim
19094 @opindex msim
19095 Links the library libsim.a which is in compatible with simulator. Applicable
19096 to ELF compiler only.
19097
19098 @item -mint32
19099 @opindex mint32
19100 Choose integer type as 32-bit wide.
19101
19102 @item -mbit-ops
19103 @opindex mbit-ops
19104 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
19105
19106 @item -mdata-model=@var{model}
19107 @opindex mdata-model
19108 Choose a data model. The choices for @var{model} are @samp{near},
19109 @samp{far} or @samp{medium}. @samp{medium} is default.
19110 However, @samp{far} is not valid with @option{-mcr16c}, as the
19111 CR16C architecture does not support the far data model.
19112 @end table
19113
19114 @node C-SKY Options
19115 @subsection C-SKY Options
19116 @cindex C-SKY Options
19117
19118 GCC supports these options when compiling for C-SKY V2 processors.
19119
19120 @table @gcctabopt
19121
19122 @item -march=@var{arch}
19123 @opindex march=
19124 Specify the C-SKY target architecture. Valid values for @var{arch} are:
19125 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
19126 The default is @samp{ck810}.
19127
19128 @item -mcpu=@var{cpu}
19129 @opindex mcpu=
19130 Specify the C-SKY target processor. Valid values for @var{cpu} are:
19131 @samp{ck801}, @samp{ck801t},
19132 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
19133 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
19134 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
19135 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
19136 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
19137 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
19138 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
19139 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
19140 @samp{ck803eftr1}, @samp{ck803efhtr1},
19141 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
19142 @samp{ck803sef}, @samp{ck803seft},
19143 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
19144 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
19145 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
19146 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
19147
19148 @item -mbig-endian
19149 @opindex mbig-endian
19150 @itemx -EB
19151 @opindex EB
19152 @itemx -mlittle-endian
19153 @opindex mlittle-endian
19154 @itemx -EL
19155 @opindex EL
19156
19157 Select big- or little-endian code. The default is little-endian.
19158
19159 @item -mhard-float
19160 @opindex mhard-float
19161 @itemx -msoft-float
19162 @opindex msoft-float
19163
19164 Select hardware or software floating-point implementations.
19165 The default is soft float.
19166
19167 @item -mdouble-float
19168 @itemx -mno-double-float
19169 @opindex mdouble-float
19170 When @option{-mhard-float} is in effect, enable generation of
19171 double-precision float instructions. This is the default except
19172 when compiling for CK803.
19173
19174 @item -mfdivdu
19175 @itemx -mno-fdivdu
19176 @opindex mfdivdu
19177 When @option{-mhard-float} is in effect, enable generation of
19178 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
19179 This is the default except when compiling for CK803.
19180
19181 @item -mfpu=@var{fpu}
19182 @opindex mfpu=
19183 Select the floating-point processor. This option can only be used with
19184 @option{-mhard-float}.
19185 Values for @var{fpu} are
19186 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19187 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19188 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19189
19190 @item -melrw
19191 @itemx -mno-elrw
19192 @opindex melrw
19193 Enable the extended @code{lrw} instruction. This option defaults to on
19194 for CK801 and off otherwise.
19195
19196 @item -mistack
19197 @itemx -mno-istack
19198 @opindex mistack
19199 Enable interrupt stack instructions; the default is off.
19200
19201 The @option{-mistack} option is required to handle the
19202 @code{interrupt} and @code{isr} function attributes
19203 (@pxref{C-SKY Function Attributes}).
19204
19205 @item -mmp
19206 @opindex mmp
19207 Enable multiprocessor instructions; the default is off.
19208
19209 @item -mcp
19210 @opindex mcp
19211 Enable coprocessor instructions; the default is off.
19212
19213 @item -mcache
19214 @opindex mcache
19215 Enable coprocessor instructions; the default is off.
19216
19217 @item -msecurity
19218 @opindex msecurity
19219 Enable C-SKY security instructions; the default is off.
19220
19221 @item -mtrust
19222 @opindex mtrust
19223 Enable C-SKY trust instructions; the default is off.
19224
19225 @item -mdsp
19226 @opindex mdsp
19227 @itemx -medsp
19228 @opindex medsp
19229 @itemx -mvdsp
19230 @opindex mvdsp
19231 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19232 All of these options default to off.
19233
19234 @item -mdiv
19235 @itemx -mno-div
19236 @opindex mdiv
19237 Generate divide instructions. Default is off.
19238
19239 @item -msmart
19240 @itemx -mno-smart
19241 @opindex msmart
19242 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19243 use of 16-bit instructions. This option is ignored for CK801 where this
19244 is the required behavior, and it defaults to on for CK802.
19245 For other targets, the default is off.
19246
19247 @item -mhigh-registers
19248 @itemx -mno-high-registers
19249 @opindex mhigh-registers
19250 Generate code using the high registers numbered 16-31. This option
19251 is not supported on CK801, CK802, or CK803, and is enabled by default
19252 for other processors.
19253
19254 @item -manchor
19255 @itemx -mno-anchor
19256 @opindex manchor
19257 Generate code using global anchor symbol addresses.
19258
19259 @item -mpushpop
19260 @itemx -mno-pushpop
19261 @opindex mpushpop
19262 Generate code using @code{push} and @code{pop} instructions. This option
19263 defaults to on.
19264
19265 @item -mmultiple-stld
19266 @itemx -mstm
19267 @itemx -mno-multiple-stld
19268 @itemx -mno-stm
19269 @opindex mmultiple-stld
19270 Generate code using @code{stm} and @code{ldm} instructions. This option
19271 isn't supported on CK801 but is enabled by default on other processors.
19272
19273 @item -mconstpool
19274 @itemx -mno-constpool
19275 @opindex mconstpool
19276 Create constant pools in the compiler instead of deferring it to the
19277 assembler. This option is the default and required for correct code
19278 generation on CK801 and CK802, and is optional on other processors.
19279
19280 @item -mstack-size
19281 @item -mno-stack-size
19282 @opindex mstack-size
19283 Emit @code{.stack_size} directives for each function in the assembly
19284 output. This option defaults to off.
19285
19286 @item -mccrt
19287 @itemx -mno-ccrt
19288 @opindex mccrt
19289 Generate code for the C-SKY compiler runtime instead of libgcc. This
19290 option defaults to off.
19291
19292 @item -mbranch-cost=@var{n}
19293 @opindex mbranch-cost=
19294 Set the branch costs to roughly @code{n} instructions. The default is 1.
19295
19296 @item -msched-prolog
19297 @itemx -mno-sched-prolog
19298 @opindex msched-prolog
19299 Permit scheduling of function prologue and epilogue sequences. Using
19300 this option can result in code that is not compliant with the C-SKY V2 ABI
19301 prologue requirements and that cannot be debugged or backtraced.
19302 It is disabled by default.
19303
19304 @end table
19305
19306 @node Darwin Options
19307 @subsection Darwin Options
19308 @cindex Darwin options
19309
19310 These options are defined for all architectures running the Darwin operating
19311 system.
19312
19313 FSF GCC on Darwin does not create ``fat'' object files; it creates
19314 an object file for the single architecture that GCC was built to
19315 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19316 @option{-arch} options are used; it does so by running the compiler or
19317 linker multiple times and joining the results together with
19318 @file{lipo}.
19319
19320 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19321 @samp{i686}) is determined by the flags that specify the ISA
19322 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19323 @option{-force_cpusubtype_ALL} option can be used to override this.
19324
19325 The Darwin tools vary in their behavior when presented with an ISA
19326 mismatch. The assembler, @file{as}, only permits instructions to
19327 be used that are valid for the subtype of the file it is generating,
19328 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19329 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19330 and prints an error if asked to create a shared library with a less
19331 restrictive subtype than its input files (for instance, trying to put
19332 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19333 for executables, @command{ld}, quietly gives the executable the most
19334 restrictive subtype of any of its input files.
19335
19336 @table @gcctabopt
19337 @item -F@var{dir}
19338 @opindex F
19339 Add the framework directory @var{dir} to the head of the list of
19340 directories to be searched for header files. These directories are
19341 interleaved with those specified by @option{-I} options and are
19342 scanned in a left-to-right order.
19343
19344 A framework directory is a directory with frameworks in it. A
19345 framework is a directory with a @file{Headers} and/or
19346 @file{PrivateHeaders} directory contained directly in it that ends
19347 in @file{.framework}. The name of a framework is the name of this
19348 directory excluding the @file{.framework}. Headers associated with
19349 the framework are found in one of those two directories, with
19350 @file{Headers} being searched first. A subframework is a framework
19351 directory that is in a framework's @file{Frameworks} directory.
19352 Includes of subframework headers can only appear in a header of a
19353 framework that contains the subframework, or in a sibling subframework
19354 header. Two subframeworks are siblings if they occur in the same
19355 framework. A subframework should not have the same name as a
19356 framework; a warning is issued if this is violated. Currently a
19357 subframework cannot have subframeworks; in the future, the mechanism
19358 may be extended to support this. The standard frameworks can be found
19359 in @file{/System/Library/Frameworks} and
19360 @file{/Library/Frameworks}. An example include looks like
19361 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19362 the name of the framework and @file{header.h} is found in the
19363 @file{PrivateHeaders} or @file{Headers} directory.
19364
19365 @item -iframework@var{dir}
19366 @opindex iframework
19367 Like @option{-F} except the directory is a treated as a system
19368 directory. The main difference between this @option{-iframework} and
19369 @option{-F} is that with @option{-iframework} the compiler does not
19370 warn about constructs contained within header files found via
19371 @var{dir}. This option is valid only for the C family of languages.
19372
19373 @item -gused
19374 @opindex gused
19375 Emit debugging information for symbols that are used. For stabs
19376 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19377 This is by default ON@.
19378
19379 @item -gfull
19380 @opindex gfull
19381 Emit debugging information for all symbols and types.
19382
19383 @item -mmacosx-version-min=@var{version}
19384 The earliest version of MacOS X that this executable will run on
19385 is @var{version}. Typical values of @var{version} include @code{10.1},
19386 @code{10.2}, and @code{10.3.9}.
19387
19388 If the compiler was built to use the system's headers by default,
19389 then the default for this option is the system version on which the
19390 compiler is running, otherwise the default is to make choices that
19391 are compatible with as many systems and code bases as possible.
19392
19393 @item -mkernel
19394 @opindex mkernel
19395 Enable kernel development mode. The @option{-mkernel} option sets
19396 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19397 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19398 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19399 applicable. This mode also sets @option{-mno-altivec},
19400 @option{-msoft-float}, @option{-fno-builtin} and
19401 @option{-mlong-branch} for PowerPC targets.
19402
19403 @item -mone-byte-bool
19404 @opindex mone-byte-bool
19405 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19406 By default @code{sizeof(bool)} is @code{4} when compiling for
19407 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19408 option has no effect on x86.
19409
19410 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19411 to generate code that is not binary compatible with code generated
19412 without that switch. Using this switch may require recompiling all
19413 other modules in a program, including system libraries. Use this
19414 switch to conform to a non-default data model.
19415
19416 @item -mfix-and-continue
19417 @itemx -ffix-and-continue
19418 @itemx -findirect-data
19419 @opindex mfix-and-continue
19420 @opindex ffix-and-continue
19421 @opindex findirect-data
19422 Generate code suitable for fast turnaround development, such as to
19423 allow GDB to dynamically load @file{.o} files into already-running
19424 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19425 are provided for backwards compatibility.
19426
19427 @item -all_load
19428 @opindex all_load
19429 Loads all members of static archive libraries.
19430 See man ld(1) for more information.
19431
19432 @item -arch_errors_fatal
19433 @opindex arch_errors_fatal
19434 Cause the errors having to do with files that have the wrong architecture
19435 to be fatal.
19436
19437 @item -bind_at_load
19438 @opindex bind_at_load
19439 Causes the output file to be marked such that the dynamic linker will
19440 bind all undefined references when the file is loaded or launched.
19441
19442 @item -bundle
19443 @opindex bundle
19444 Produce a Mach-o bundle format file.
19445 See man ld(1) for more information.
19446
19447 @item -bundle_loader @var{executable}
19448 @opindex bundle_loader
19449 This option specifies the @var{executable} that will load the build
19450 output file being linked. See man ld(1) for more information.
19451
19452 @item -dynamiclib
19453 @opindex dynamiclib
19454 When passed this option, GCC produces a dynamic library instead of
19455 an executable when linking, using the Darwin @file{libtool} command.
19456
19457 @item -force_cpusubtype_ALL
19458 @opindex force_cpusubtype_ALL
19459 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19460 one controlled by the @option{-mcpu} or @option{-march} option.
19461
19462 @item -allowable_client @var{client_name}
19463 @itemx -client_name
19464 @itemx -compatibility_version
19465 @itemx -current_version
19466 @itemx -dead_strip
19467 @itemx -dependency-file
19468 @itemx -dylib_file
19469 @itemx -dylinker_install_name
19470 @itemx -dynamic
19471 @itemx -exported_symbols_list
19472 @itemx -filelist
19473 @need 800
19474 @itemx -flat_namespace
19475 @itemx -force_flat_namespace
19476 @itemx -headerpad_max_install_names
19477 @itemx -image_base
19478 @itemx -init
19479 @itemx -install_name
19480 @itemx -keep_private_externs
19481 @itemx -multi_module
19482 @itemx -multiply_defined
19483 @itemx -multiply_defined_unused
19484 @need 800
19485 @itemx -noall_load
19486 @itemx -no_dead_strip_inits_and_terms
19487 @itemx -nofixprebinding
19488 @itemx -nomultidefs
19489 @itemx -noprebind
19490 @itemx -noseglinkedit
19491 @itemx -pagezero_size
19492 @itemx -prebind
19493 @itemx -prebind_all_twolevel_modules
19494 @itemx -private_bundle
19495 @need 800
19496 @itemx -read_only_relocs
19497 @itemx -sectalign
19498 @itemx -sectobjectsymbols
19499 @itemx -whyload
19500 @itemx -seg1addr
19501 @itemx -sectcreate
19502 @itemx -sectobjectsymbols
19503 @itemx -sectorder
19504 @itemx -segaddr
19505 @itemx -segs_read_only_addr
19506 @need 800
19507 @itemx -segs_read_write_addr
19508 @itemx -seg_addr_table
19509 @itemx -seg_addr_table_filename
19510 @itemx -seglinkedit
19511 @itemx -segprot
19512 @itemx -segs_read_only_addr
19513 @itemx -segs_read_write_addr
19514 @itemx -single_module
19515 @itemx -static
19516 @itemx -sub_library
19517 @need 800
19518 @itemx -sub_umbrella
19519 @itemx -twolevel_namespace
19520 @itemx -umbrella
19521 @itemx -undefined
19522 @itemx -unexported_symbols_list
19523 @itemx -weak_reference_mismatches
19524 @itemx -whatsloaded
19525 @opindex allowable_client
19526 @opindex client_name
19527 @opindex compatibility_version
19528 @opindex current_version
19529 @opindex dead_strip
19530 @opindex dependency-file
19531 @opindex dylib_file
19532 @opindex dylinker_install_name
19533 @opindex dynamic
19534 @opindex exported_symbols_list
19535 @opindex filelist
19536 @opindex flat_namespace
19537 @opindex force_flat_namespace
19538 @opindex headerpad_max_install_names
19539 @opindex image_base
19540 @opindex init
19541 @opindex install_name
19542 @opindex keep_private_externs
19543 @opindex multi_module
19544 @opindex multiply_defined
19545 @opindex multiply_defined_unused
19546 @opindex noall_load
19547 @opindex no_dead_strip_inits_and_terms
19548 @opindex nofixprebinding
19549 @opindex nomultidefs
19550 @opindex noprebind
19551 @opindex noseglinkedit
19552 @opindex pagezero_size
19553 @opindex prebind
19554 @opindex prebind_all_twolevel_modules
19555 @opindex private_bundle
19556 @opindex read_only_relocs
19557 @opindex sectalign
19558 @opindex sectobjectsymbols
19559 @opindex whyload
19560 @opindex seg1addr
19561 @opindex sectcreate
19562 @opindex sectobjectsymbols
19563 @opindex sectorder
19564 @opindex segaddr
19565 @opindex segs_read_only_addr
19566 @opindex segs_read_write_addr
19567 @opindex seg_addr_table
19568 @opindex seg_addr_table_filename
19569 @opindex seglinkedit
19570 @opindex segprot
19571 @opindex segs_read_only_addr
19572 @opindex segs_read_write_addr
19573 @opindex single_module
19574 @opindex static
19575 @opindex sub_library
19576 @opindex sub_umbrella
19577 @opindex twolevel_namespace
19578 @opindex umbrella
19579 @opindex undefined
19580 @opindex unexported_symbols_list
19581 @opindex weak_reference_mismatches
19582 @opindex whatsloaded
19583 These options are passed to the Darwin linker. The Darwin linker man page
19584 describes them in detail.
19585 @end table
19586
19587 @node DEC Alpha Options
19588 @subsection DEC Alpha Options
19589
19590 These @samp{-m} options are defined for the DEC Alpha implementations:
19591
19592 @table @gcctabopt
19593 @item -mno-soft-float
19594 @itemx -msoft-float
19595 @opindex mno-soft-float
19596 @opindex msoft-float
19597 Use (do not use) the hardware floating-point instructions for
19598 floating-point operations. When @option{-msoft-float} is specified,
19599 functions in @file{libgcc.a} are used to perform floating-point
19600 operations. Unless they are replaced by routines that emulate the
19601 floating-point operations, or compiled in such a way as to call such
19602 emulations routines, these routines issue floating-point
19603 operations. If you are compiling for an Alpha without floating-point
19604 operations, you must ensure that the library is built so as not to call
19605 them.
19606
19607 Note that Alpha implementations without floating-point operations are
19608 required to have floating-point registers.
19609
19610 @item -mfp-reg
19611 @itemx -mno-fp-regs
19612 @opindex mfp-reg
19613 @opindex mno-fp-regs
19614 Generate code that uses (does not use) the floating-point register set.
19615 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19616 register set is not used, floating-point operands are passed in integer
19617 registers as if they were integers and floating-point results are passed
19618 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19619 so any function with a floating-point argument or return value called by code
19620 compiled with @option{-mno-fp-regs} must also be compiled with that
19621 option.
19622
19623 A typical use of this option is building a kernel that does not use,
19624 and hence need not save and restore, any floating-point registers.
19625
19626 @item -mieee
19627 @opindex mieee
19628 The Alpha architecture implements floating-point hardware optimized for
19629 maximum performance. It is mostly compliant with the IEEE floating-point
19630 standard. However, for full compliance, software assistance is
19631 required. This option generates code fully IEEE-compliant code
19632 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19633 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19634 defined during compilation. The resulting code is less efficient but is
19635 able to correctly support denormalized numbers and exceptional IEEE
19636 values such as not-a-number and plus/minus infinity. Other Alpha
19637 compilers call this option @option{-ieee_with_no_inexact}.
19638
19639 @item -mieee-with-inexact
19640 @opindex mieee-with-inexact
19641 This is like @option{-mieee} except the generated code also maintains
19642 the IEEE @var{inexact-flag}. Turning on this option causes the
19643 generated code to implement fully-compliant IEEE math. In addition to
19644 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19645 macro. On some Alpha implementations the resulting code may execute
19646 significantly slower than the code generated by default. Since there is
19647 very little code that depends on the @var{inexact-flag}, you should
19648 normally not specify this option. Other Alpha compilers call this
19649 option @option{-ieee_with_inexact}.
19650
19651 @item -mfp-trap-mode=@var{trap-mode}
19652 @opindex mfp-trap-mode
19653 This option controls what floating-point related traps are enabled.
19654 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19655 The trap mode can be set to one of four values:
19656
19657 @table @samp
19658 @item n
19659 This is the default (normal) setting. The only traps that are enabled
19660 are the ones that cannot be disabled in software (e.g., division by zero
19661 trap).
19662
19663 @item u
19664 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19665 as well.
19666
19667 @item su
19668 Like @samp{u}, but the instructions are marked to be safe for software
19669 completion (see Alpha architecture manual for details).
19670
19671 @item sui
19672 Like @samp{su}, but inexact traps are enabled as well.
19673 @end table
19674
19675 @item -mfp-rounding-mode=@var{rounding-mode}
19676 @opindex mfp-rounding-mode
19677 Selects the IEEE rounding mode. Other Alpha compilers call this option
19678 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19679 of:
19680
19681 @table @samp
19682 @item n
19683 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19684 the nearest machine number or towards the even machine number in case
19685 of a tie.
19686
19687 @item m
19688 Round towards minus infinity.
19689
19690 @item c
19691 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19692
19693 @item d
19694 Dynamic rounding mode. A field in the floating-point control register
19695 (@var{fpcr}, see Alpha architecture reference manual) controls the
19696 rounding mode in effect. The C library initializes this register for
19697 rounding towards plus infinity. Thus, unless your program modifies the
19698 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19699 @end table
19700
19701 @item -mtrap-precision=@var{trap-precision}
19702 @opindex mtrap-precision
19703 In the Alpha architecture, floating-point traps are imprecise. This
19704 means without software assistance it is impossible to recover from a
19705 floating trap and program execution normally needs to be terminated.
19706 GCC can generate code that can assist operating system trap handlers
19707 in determining the exact location that caused a floating-point trap.
19708 Depending on the requirements of an application, different levels of
19709 precisions can be selected:
19710
19711 @table @samp
19712 @item p
19713 Program precision. This option is the default and means a trap handler
19714 can only identify which program caused a floating-point exception.
19715
19716 @item f
19717 Function precision. The trap handler can determine the function that
19718 caused a floating-point exception.
19719
19720 @item i
19721 Instruction precision. The trap handler can determine the exact
19722 instruction that caused a floating-point exception.
19723 @end table
19724
19725 Other Alpha compilers provide the equivalent options called
19726 @option{-scope_safe} and @option{-resumption_safe}.
19727
19728 @item -mieee-conformant
19729 @opindex mieee-conformant
19730 This option marks the generated code as IEEE conformant. You must not
19731 use this option unless you also specify @option{-mtrap-precision=i} and either
19732 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19733 is to emit the line @samp{.eflag 48} in the function prologue of the
19734 generated assembly file.
19735
19736 @item -mbuild-constants
19737 @opindex mbuild-constants
19738 Normally GCC examines a 32- or 64-bit integer constant to
19739 see if it can construct it from smaller constants in two or three
19740 instructions. If it cannot, it outputs the constant as a literal and
19741 generates code to load it from the data segment at run time.
19742
19743 Use this option to require GCC to construct @emph{all} integer constants
19744 using code, even if it takes more instructions (the maximum is six).
19745
19746 You typically use this option to build a shared library dynamic
19747 loader. Itself a shared library, it must relocate itself in memory
19748 before it can find the variables and constants in its own data segment.
19749
19750 @item -mbwx
19751 @itemx -mno-bwx
19752 @itemx -mcix
19753 @itemx -mno-cix
19754 @itemx -mfix
19755 @itemx -mno-fix
19756 @itemx -mmax
19757 @itemx -mno-max
19758 @opindex mbwx
19759 @opindex mno-bwx
19760 @opindex mcix
19761 @opindex mno-cix
19762 @opindex mfix
19763 @opindex mno-fix
19764 @opindex mmax
19765 @opindex mno-max
19766 Indicate whether GCC should generate code to use the optional BWX,
19767 CIX, FIX and MAX instruction sets. The default is to use the instruction
19768 sets supported by the CPU type specified via @option{-mcpu=} option or that
19769 of the CPU on which GCC was built if none is specified.
19770
19771 @item -mfloat-vax
19772 @itemx -mfloat-ieee
19773 @opindex mfloat-vax
19774 @opindex mfloat-ieee
19775 Generate code that uses (does not use) VAX F and G floating-point
19776 arithmetic instead of IEEE single and double precision.
19777
19778 @item -mexplicit-relocs
19779 @itemx -mno-explicit-relocs
19780 @opindex mexplicit-relocs
19781 @opindex mno-explicit-relocs
19782 Older Alpha assemblers provided no way to generate symbol relocations
19783 except via assembler macros. Use of these macros does not allow
19784 optimal instruction scheduling. GNU binutils as of version 2.12
19785 supports a new syntax that allows the compiler to explicitly mark
19786 which relocations should apply to which instructions. This option
19787 is mostly useful for debugging, as GCC detects the capabilities of
19788 the assembler when it is built and sets the default accordingly.
19789
19790 @item -msmall-data
19791 @itemx -mlarge-data
19792 @opindex msmall-data
19793 @opindex mlarge-data
19794 When @option{-mexplicit-relocs} is in effect, static data is
19795 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19796 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19797 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19798 16-bit relocations off of the @code{$gp} register. This limits the
19799 size of the small data area to 64KB, but allows the variables to be
19800 directly accessed via a single instruction.
19801
19802 The default is @option{-mlarge-data}. With this option the data area
19803 is limited to just below 2GB@. Programs that require more than 2GB of
19804 data must use @code{malloc} or @code{mmap} to allocate the data in the
19805 heap instead of in the program's data segment.
19806
19807 When generating code for shared libraries, @option{-fpic} implies
19808 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19809
19810 @item -msmall-text
19811 @itemx -mlarge-text
19812 @opindex msmall-text
19813 @opindex mlarge-text
19814 When @option{-msmall-text} is used, the compiler assumes that the
19815 code of the entire program (or shared library) fits in 4MB, and is
19816 thus reachable with a branch instruction. When @option{-msmall-data}
19817 is used, the compiler can assume that all local symbols share the
19818 same @code{$gp} value, and thus reduce the number of instructions
19819 required for a function call from 4 to 1.
19820
19821 The default is @option{-mlarge-text}.
19822
19823 @item -mcpu=@var{cpu_type}
19824 @opindex mcpu
19825 Set the instruction set and instruction scheduling parameters for
19826 machine type @var{cpu_type}. You can specify either the @samp{EV}
19827 style name or the corresponding chip number. GCC supports scheduling
19828 parameters for the EV4, EV5 and EV6 family of processors and
19829 chooses the default values for the instruction set from the processor
19830 you specify. If you do not specify a processor type, GCC defaults
19831 to the processor on which the compiler was built.
19832
19833 Supported values for @var{cpu_type} are
19834
19835 @table @samp
19836 @item ev4
19837 @itemx ev45
19838 @itemx 21064
19839 Schedules as an EV4 and has no instruction set extensions.
19840
19841 @item ev5
19842 @itemx 21164
19843 Schedules as an EV5 and has no instruction set extensions.
19844
19845 @item ev56
19846 @itemx 21164a
19847 Schedules as an EV5 and supports the BWX extension.
19848
19849 @item pca56
19850 @itemx 21164pc
19851 @itemx 21164PC
19852 Schedules as an EV5 and supports the BWX and MAX extensions.
19853
19854 @item ev6
19855 @itemx 21264
19856 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19857
19858 @item ev67
19859 @itemx 21264a
19860 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19861 @end table
19862
19863 Native toolchains also support the value @samp{native},
19864 which selects the best architecture option for the host processor.
19865 @option{-mcpu=native} has no effect if GCC does not recognize
19866 the processor.
19867
19868 @item -mtune=@var{cpu_type}
19869 @opindex mtune
19870 Set only the instruction scheduling parameters for machine type
19871 @var{cpu_type}. The instruction set is not changed.
19872
19873 Native toolchains also support the value @samp{native},
19874 which selects the best architecture option for the host processor.
19875 @option{-mtune=native} has no effect if GCC does not recognize
19876 the processor.
19877
19878 @item -mmemory-latency=@var{time}
19879 @opindex mmemory-latency
19880 Sets the latency the scheduler should assume for typical memory
19881 references as seen by the application. This number is highly
19882 dependent on the memory access patterns used by the application
19883 and the size of the external cache on the machine.
19884
19885 Valid options for @var{time} are
19886
19887 @table @samp
19888 @item @var{number}
19889 A decimal number representing clock cycles.
19890
19891 @item L1
19892 @itemx L2
19893 @itemx L3
19894 @itemx main
19895 The compiler contains estimates of the number of clock cycles for
19896 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19897 (also called Dcache, Scache, and Bcache), as well as to main memory.
19898 Note that L3 is only valid for EV5.
19899
19900 @end table
19901 @end table
19902
19903 @node eBPF Options
19904 @subsection eBPF Options
19905 @cindex eBPF Options
19906
19907 @table @gcctabopt
19908 @item -mframe-limit=@var{bytes}
19909 This specifies the hard limit for frame sizes, in bytes. Currently,
19910 the value that can be specified should be less than or equal to
19911 @samp{32767}. Defaults to whatever limit is imposed by the version of
19912 the Linux kernel targeted.
19913
19914 @item -mkernel=@var{version}
19915 @opindex mkernel
19916 This specifies the minimum version of the kernel that will run the
19917 compiled program. GCC uses this version to determine which
19918 instructions to use, what kernel helpers to allow, etc. Currently,
19919 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
19920 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
19921 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
19922 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
19923 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
19924 @samp{5.2}, @samp{latest} and @samp{native}.
19925
19926 @item -mbig-endian
19927 @opindex mbig-endian
19928 Generate code for a big-endian target.
19929
19930 @item -mlittle-endian
19931 @opindex mlittle-endian
19932 Generate code for a little-endian target. This is the default.
19933 @end table
19934
19935 @node FR30 Options
19936 @subsection FR30 Options
19937 @cindex FR30 Options
19938
19939 These options are defined specifically for the FR30 port.
19940
19941 @table @gcctabopt
19942
19943 @item -msmall-model
19944 @opindex msmall-model
19945 Use the small address space model. This can produce smaller code, but
19946 it does assume that all symbolic values and addresses fit into a
19947 20-bit range.
19948
19949 @item -mno-lsim
19950 @opindex mno-lsim
19951 Assume that runtime support has been provided and so there is no need
19952 to include the simulator library (@file{libsim.a}) on the linker
19953 command line.
19954
19955 @end table
19956
19957 @node FT32 Options
19958 @subsection FT32 Options
19959 @cindex FT32 Options
19960
19961 These options are defined specifically for the FT32 port.
19962
19963 @table @gcctabopt
19964
19965 @item -msim
19966 @opindex msim
19967 Specifies that the program will be run on the simulator. This causes
19968 an alternate runtime startup and library to be linked.
19969 You must not use this option when generating programs that will run on
19970 real hardware; you must provide your own runtime library for whatever
19971 I/O functions are needed.
19972
19973 @item -mlra
19974 @opindex mlra
19975 Enable Local Register Allocation. This is still experimental for FT32,
19976 so by default the compiler uses standard reload.
19977
19978 @item -mnodiv
19979 @opindex mnodiv
19980 Do not use div and mod instructions.
19981
19982 @item -mft32b
19983 @opindex mft32b
19984 Enable use of the extended instructions of the FT32B processor.
19985
19986 @item -mcompress
19987 @opindex mcompress
19988 Compress all code using the Ft32B code compression scheme.
19989
19990 @item -mnopm
19991 @opindex mnopm
19992 Do not generate code that reads program memory.
19993
19994 @end table
19995
19996 @node FRV Options
19997 @subsection FRV Options
19998 @cindex FRV Options
19999
20000 @table @gcctabopt
20001 @item -mgpr-32
20002 @opindex mgpr-32
20003
20004 Only use the first 32 general-purpose registers.
20005
20006 @item -mgpr-64
20007 @opindex mgpr-64
20008
20009 Use all 64 general-purpose registers.
20010
20011 @item -mfpr-32
20012 @opindex mfpr-32
20013
20014 Use only the first 32 floating-point registers.
20015
20016 @item -mfpr-64
20017 @opindex mfpr-64
20018
20019 Use all 64 floating-point registers.
20020
20021 @item -mhard-float
20022 @opindex mhard-float
20023
20024 Use hardware instructions for floating-point operations.
20025
20026 @item -msoft-float
20027 @opindex msoft-float
20028
20029 Use library routines for floating-point operations.
20030
20031 @item -malloc-cc
20032 @opindex malloc-cc
20033
20034 Dynamically allocate condition code registers.
20035
20036 @item -mfixed-cc
20037 @opindex mfixed-cc
20038
20039 Do not try to dynamically allocate condition code registers, only
20040 use @code{icc0} and @code{fcc0}.
20041
20042 @item -mdword
20043 @opindex mdword
20044
20045 Change ABI to use double word insns.
20046
20047 @item -mno-dword
20048 @opindex mno-dword
20049 @opindex mdword
20050
20051 Do not use double word instructions.
20052
20053 @item -mdouble
20054 @opindex mdouble
20055
20056 Use floating-point double instructions.
20057
20058 @item -mno-double
20059 @opindex mno-double
20060
20061 Do not use floating-point double instructions.
20062
20063 @item -mmedia
20064 @opindex mmedia
20065
20066 Use media instructions.
20067
20068 @item -mno-media
20069 @opindex mno-media
20070
20071 Do not use media instructions.
20072
20073 @item -mmuladd
20074 @opindex mmuladd
20075
20076 Use multiply and add/subtract instructions.
20077
20078 @item -mno-muladd
20079 @opindex mno-muladd
20080
20081 Do not use multiply and add/subtract instructions.
20082
20083 @item -mfdpic
20084 @opindex mfdpic
20085
20086 Select the FDPIC ABI, which uses function descriptors to represent
20087 pointers to functions. Without any PIC/PIE-related options, it
20088 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
20089 assumes GOT entries and small data are within a 12-bit range from the
20090 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
20091 are computed with 32 bits.
20092 With a @samp{bfin-elf} target, this option implies @option{-msim}.
20093
20094 @item -minline-plt
20095 @opindex minline-plt
20096
20097 Enable inlining of PLT entries in function calls to functions that are
20098 not known to bind locally. It has no effect without @option{-mfdpic}.
20099 It's enabled by default if optimizing for speed and compiling for
20100 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
20101 optimization option such as @option{-O3} or above is present in the
20102 command line.
20103
20104 @item -mTLS
20105 @opindex mTLS
20106
20107 Assume a large TLS segment when generating thread-local code.
20108
20109 @item -mtls
20110 @opindex mtls
20111
20112 Do not assume a large TLS segment when generating thread-local code.
20113
20114 @item -mgprel-ro
20115 @opindex mgprel-ro
20116
20117 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
20118 that is known to be in read-only sections. It's enabled by default,
20119 except for @option{-fpic} or @option{-fpie}: even though it may help
20120 make the global offset table smaller, it trades 1 instruction for 4.
20121 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
20122 one of which may be shared by multiple symbols, and it avoids the need
20123 for a GOT entry for the referenced symbol, so it's more likely to be a
20124 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
20125
20126 @item -multilib-library-pic
20127 @opindex multilib-library-pic
20128
20129 Link with the (library, not FD) pic libraries. It's implied by
20130 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
20131 @option{-fpic} without @option{-mfdpic}. You should never have to use
20132 it explicitly.
20133
20134 @item -mlinked-fp
20135 @opindex mlinked-fp
20136
20137 Follow the EABI requirement of always creating a frame pointer whenever
20138 a stack frame is allocated. This option is enabled by default and can
20139 be disabled with @option{-mno-linked-fp}.
20140
20141 @item -mlong-calls
20142 @opindex mlong-calls
20143
20144 Use indirect addressing to call functions outside the current
20145 compilation unit. This allows the functions to be placed anywhere
20146 within the 32-bit address space.
20147
20148 @item -malign-labels
20149 @opindex malign-labels
20150
20151 Try to align labels to an 8-byte boundary by inserting NOPs into the
20152 previous packet. This option only has an effect when VLIW packing
20153 is enabled. It doesn't create new packets; it merely adds NOPs to
20154 existing ones.
20155
20156 @item -mlibrary-pic
20157 @opindex mlibrary-pic
20158
20159 Generate position-independent EABI code.
20160
20161 @item -macc-4
20162 @opindex macc-4
20163
20164 Use only the first four media accumulator registers.
20165
20166 @item -macc-8
20167 @opindex macc-8
20168
20169 Use all eight media accumulator registers.
20170
20171 @item -mpack
20172 @opindex mpack
20173
20174 Pack VLIW instructions.
20175
20176 @item -mno-pack
20177 @opindex mno-pack
20178
20179 Do not pack VLIW instructions.
20180
20181 @item -mno-eflags
20182 @opindex mno-eflags
20183
20184 Do not mark ABI switches in e_flags.
20185
20186 @item -mcond-move
20187 @opindex mcond-move
20188
20189 Enable the use of conditional-move instructions (default).
20190
20191 This switch is mainly for debugging the compiler and will likely be removed
20192 in a future version.
20193
20194 @item -mno-cond-move
20195 @opindex mno-cond-move
20196
20197 Disable the use of conditional-move instructions.
20198
20199 This switch is mainly for debugging the compiler and will likely be removed
20200 in a future version.
20201
20202 @item -mscc
20203 @opindex mscc
20204
20205 Enable the use of conditional set instructions (default).
20206
20207 This switch is mainly for debugging the compiler and will likely be removed
20208 in a future version.
20209
20210 @item -mno-scc
20211 @opindex mno-scc
20212
20213 Disable the use of conditional set instructions.
20214
20215 This switch is mainly for debugging the compiler and will likely be removed
20216 in a future version.
20217
20218 @item -mcond-exec
20219 @opindex mcond-exec
20220
20221 Enable the use of conditional execution (default).
20222
20223 This switch is mainly for debugging the compiler and will likely be removed
20224 in a future version.
20225
20226 @item -mno-cond-exec
20227 @opindex mno-cond-exec
20228
20229 Disable the use of conditional execution.
20230
20231 This switch is mainly for debugging the compiler and will likely be removed
20232 in a future version.
20233
20234 @item -mvliw-branch
20235 @opindex mvliw-branch
20236
20237 Run a pass to pack branches into VLIW instructions (default).
20238
20239 This switch is mainly for debugging the compiler and will likely be removed
20240 in a future version.
20241
20242 @item -mno-vliw-branch
20243 @opindex mno-vliw-branch
20244
20245 Do not run a pass to pack branches into VLIW instructions.
20246
20247 This switch is mainly for debugging the compiler and will likely be removed
20248 in a future version.
20249
20250 @item -mmulti-cond-exec
20251 @opindex mmulti-cond-exec
20252
20253 Enable optimization of @code{&&} and @code{||} in conditional execution
20254 (default).
20255
20256 This switch is mainly for debugging the compiler and will likely be removed
20257 in a future version.
20258
20259 @item -mno-multi-cond-exec
20260 @opindex mno-multi-cond-exec
20261
20262 Disable optimization of @code{&&} and @code{||} in conditional execution.
20263
20264 This switch is mainly for debugging the compiler and will likely be removed
20265 in a future version.
20266
20267 @item -mnested-cond-exec
20268 @opindex mnested-cond-exec
20269
20270 Enable nested conditional execution optimizations (default).
20271
20272 This switch is mainly for debugging the compiler and will likely be removed
20273 in a future version.
20274
20275 @item -mno-nested-cond-exec
20276 @opindex mno-nested-cond-exec
20277
20278 Disable nested conditional execution optimizations.
20279
20280 This switch is mainly for debugging the compiler and will likely be removed
20281 in a future version.
20282
20283 @item -moptimize-membar
20284 @opindex moptimize-membar
20285
20286 This switch removes redundant @code{membar} instructions from the
20287 compiler-generated code. It is enabled by default.
20288
20289 @item -mno-optimize-membar
20290 @opindex mno-optimize-membar
20291 @opindex moptimize-membar
20292
20293 This switch disables the automatic removal of redundant @code{membar}
20294 instructions from the generated code.
20295
20296 @item -mtomcat-stats
20297 @opindex mtomcat-stats
20298
20299 Cause gas to print out tomcat statistics.
20300
20301 @item -mcpu=@var{cpu}
20302 @opindex mcpu
20303
20304 Select the processor type for which to generate code. Possible values are
20305 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20306 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20307
20308 @end table
20309
20310 @node GNU/Linux Options
20311 @subsection GNU/Linux Options
20312
20313 These @samp{-m} options are defined for GNU/Linux targets:
20314
20315 @table @gcctabopt
20316 @item -mglibc
20317 @opindex mglibc
20318 Use the GNU C library. This is the default except
20319 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20320 @samp{*-*-linux-*android*} targets.
20321
20322 @item -muclibc
20323 @opindex muclibc
20324 Use uClibc C library. This is the default on
20325 @samp{*-*-linux-*uclibc*} targets.
20326
20327 @item -mmusl
20328 @opindex mmusl
20329 Use the musl C library. This is the default on
20330 @samp{*-*-linux-*musl*} targets.
20331
20332 @item -mbionic
20333 @opindex mbionic
20334 Use Bionic C library. This is the default on
20335 @samp{*-*-linux-*android*} targets.
20336
20337 @item -mandroid
20338 @opindex mandroid
20339 Compile code compatible with Android platform. This is the default on
20340 @samp{*-*-linux-*android*} targets.
20341
20342 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20343 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20344 this option makes the GCC driver pass Android-specific options to the linker.
20345 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20346 to be defined.
20347
20348 @item -tno-android-cc
20349 @opindex tno-android-cc
20350 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20351 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20352 @option{-fno-rtti} by default.
20353
20354 @item -tno-android-ld
20355 @opindex tno-android-ld
20356 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20357 linking options to the linker.
20358
20359 @end table
20360
20361 @node H8/300 Options
20362 @subsection H8/300 Options
20363
20364 These @samp{-m} options are defined for the H8/300 implementations:
20365
20366 @table @gcctabopt
20367 @item -mrelax
20368 @opindex mrelax
20369 Shorten some address references at link time, when possible; uses the
20370 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20371 ld, Using ld}, for a fuller description.
20372
20373 @item -mh
20374 @opindex mh
20375 Generate code for the H8/300H@.
20376
20377 @item -ms
20378 @opindex ms
20379 Generate code for the H8S@.
20380
20381 @item -mn
20382 @opindex mn
20383 Generate code for the H8S and H8/300H in the normal mode. This switch
20384 must be used either with @option{-mh} or @option{-ms}.
20385
20386 @item -ms2600
20387 @opindex ms2600
20388 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20389
20390 @item -mexr
20391 @opindex mexr
20392 Extended registers are stored on stack before execution of function
20393 with monitor attribute. Default option is @option{-mexr}.
20394 This option is valid only for H8S targets.
20395
20396 @item -mno-exr
20397 @opindex mno-exr
20398 @opindex mexr
20399 Extended registers are not stored on stack before execution of function
20400 with monitor attribute. Default option is @option{-mno-exr}.
20401 This option is valid only for H8S targets.
20402
20403 @item -mint32
20404 @opindex mint32
20405 Make @code{int} data 32 bits by default.
20406
20407 @item -malign-300
20408 @opindex malign-300
20409 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20410 The default for the H8/300H and H8S is to align longs and floats on
20411 4-byte boundaries.
20412 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20413 This option has no effect on the H8/300.
20414 @end table
20415
20416 @node HPPA Options
20417 @subsection HPPA Options
20418 @cindex HPPA Options
20419
20420 These @samp{-m} options are defined for the HPPA family of computers:
20421
20422 @table @gcctabopt
20423 @item -march=@var{architecture-type}
20424 @opindex march
20425 Generate code for the specified architecture. The choices for
20426 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20427 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20428 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20429 architecture option for your machine. Code compiled for lower numbered
20430 architectures runs on higher numbered architectures, but not the
20431 other way around.
20432
20433 @item -mpa-risc-1-0
20434 @itemx -mpa-risc-1-1
20435 @itemx -mpa-risc-2-0
20436 @opindex mpa-risc-1-0
20437 @opindex mpa-risc-1-1
20438 @opindex mpa-risc-2-0
20439 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20440
20441 @item -mcaller-copies
20442 @opindex mcaller-copies
20443 The caller copies function arguments passed by hidden reference. This
20444 option should be used with care as it is not compatible with the default
20445 32-bit runtime. However, only aggregates larger than eight bytes are
20446 passed by hidden reference and the option provides better compatibility
20447 with OpenMP.
20448
20449 @item -mjump-in-delay
20450 @opindex mjump-in-delay
20451 This option is ignored and provided for compatibility purposes only.
20452
20453 @item -mdisable-fpregs
20454 @opindex mdisable-fpregs
20455 Prevent floating-point registers from being used in any manner. This is
20456 necessary for compiling kernels that perform lazy context switching of
20457 floating-point registers. If you use this option and attempt to perform
20458 floating-point operations, the compiler aborts.
20459
20460 @item -mdisable-indexing
20461 @opindex mdisable-indexing
20462 Prevent the compiler from using indexing address modes. This avoids some
20463 rather obscure problems when compiling MIG generated code under MACH@.
20464
20465 @item -mno-space-regs
20466 @opindex mno-space-regs
20467 @opindex mspace-regs
20468 Generate code that assumes the target has no space registers. This allows
20469 GCC to generate faster indirect calls and use unscaled index address modes.
20470
20471 Such code is suitable for level 0 PA systems and kernels.
20472
20473 @item -mfast-indirect-calls
20474 @opindex mfast-indirect-calls
20475 Generate code that assumes calls never cross space boundaries. This
20476 allows GCC to emit code that performs faster indirect calls.
20477
20478 This option does not work in the presence of shared libraries or nested
20479 functions.
20480
20481 @item -mfixed-range=@var{register-range}
20482 @opindex mfixed-range
20483 Generate code treating the given register range as fixed registers.
20484 A fixed register is one that the register allocator cannot use. This is
20485 useful when compiling kernel code. A register range is specified as
20486 two registers separated by a dash. Multiple register ranges can be
20487 specified separated by a comma.
20488
20489 @item -mlong-load-store
20490 @opindex mlong-load-store
20491 Generate 3-instruction load and store sequences as sometimes required by
20492 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20493 the HP compilers.
20494
20495 @item -mportable-runtime
20496 @opindex mportable-runtime
20497 Use the portable calling conventions proposed by HP for ELF systems.
20498
20499 @item -mgas
20500 @opindex mgas
20501 Enable the use of assembler directives only GAS understands.
20502
20503 @item -mschedule=@var{cpu-type}
20504 @opindex mschedule
20505 Schedule code according to the constraints for the machine type
20506 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20507 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20508 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20509 proper scheduling option for your machine. The default scheduling is
20510 @samp{8000}.
20511
20512 @item -mlinker-opt
20513 @opindex mlinker-opt
20514 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20515 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20516 linkers in which they give bogus error messages when linking some programs.
20517
20518 @item -msoft-float
20519 @opindex msoft-float
20520 Generate output containing library calls for floating point.
20521 @strong{Warning:} the requisite libraries are not available for all HPPA
20522 targets. Normally the facilities of the machine's usual C compiler are
20523 used, but this cannot be done directly in cross-compilation. You must make
20524 your own arrangements to provide suitable library functions for
20525 cross-compilation.
20526
20527 @option{-msoft-float} changes the calling convention in the output file;
20528 therefore, it is only useful if you compile @emph{all} of a program with
20529 this option. In particular, you need to compile @file{libgcc.a}, the
20530 library that comes with GCC, with @option{-msoft-float} in order for
20531 this to work.
20532
20533 @item -msio
20534 @opindex msio
20535 Generate the predefine, @code{_SIO}, for server IO@. The default is
20536 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20537 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20538 options are available under HP-UX and HI-UX@.
20539
20540 @item -mgnu-ld
20541 @opindex mgnu-ld
20542 Use options specific to GNU @command{ld}.
20543 This passes @option{-shared} to @command{ld} when
20544 building a shared library. It is the default when GCC is configured,
20545 explicitly or implicitly, with the GNU linker. This option does not
20546 affect which @command{ld} is called; it only changes what parameters
20547 are passed to that @command{ld}.
20548 The @command{ld} that is called is determined by the
20549 @option{--with-ld} configure option, GCC's program search path, and
20550 finally by the user's @env{PATH}. The linker used by GCC can be printed
20551 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20552 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20553
20554 @item -mhp-ld
20555 @opindex mhp-ld
20556 Use options specific to HP @command{ld}.
20557 This passes @option{-b} to @command{ld} when building
20558 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20559 links. It is the default when GCC is configured, explicitly or
20560 implicitly, with the HP linker. This option does not affect
20561 which @command{ld} is called; it only changes what parameters are passed to that
20562 @command{ld}.
20563 The @command{ld} that is called is determined by the @option{--with-ld}
20564 configure option, GCC's program search path, and finally by the user's
20565 @env{PATH}. The linker used by GCC can be printed using @samp{which
20566 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20567 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20568
20569 @item -mlong-calls
20570 @opindex mno-long-calls
20571 @opindex mlong-calls
20572 Generate code that uses long call sequences. This ensures that a call
20573 is always able to reach linker generated stubs. The default is to generate
20574 long calls only when the distance from the call site to the beginning
20575 of the function or translation unit, as the case may be, exceeds a
20576 predefined limit set by the branch type being used. The limits for
20577 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20578 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20579 240,000 bytes.
20580
20581 Distances are measured from the beginning of functions when using the
20582 @option{-ffunction-sections} option, or when using the @option{-mgas}
20583 and @option{-mno-portable-runtime} options together under HP-UX with
20584 the SOM linker.
20585
20586 It is normally not desirable to use this option as it degrades
20587 performance. However, it may be useful in large applications,
20588 particularly when partial linking is used to build the application.
20589
20590 The types of long calls used depends on the capabilities of the
20591 assembler and linker, and the type of code being generated. The
20592 impact on systems that support long absolute calls, and long pic
20593 symbol-difference or pc-relative calls should be relatively small.
20594 However, an indirect call is used on 32-bit ELF systems in pic code
20595 and it is quite long.
20596
20597 @item -munix=@var{unix-std}
20598 @opindex march
20599 Generate compiler predefines and select a startfile for the specified
20600 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20601 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20602 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20603 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20604 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20605 and later.
20606
20607 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20608 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20609 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20610 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20611 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20612 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20613
20614 It is @emph{important} to note that this option changes the interfaces
20615 for various library routines. It also affects the operational behavior
20616 of the C library. Thus, @emph{extreme} care is needed in using this
20617 option.
20618
20619 Library code that is intended to operate with more than one UNIX
20620 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20621 as appropriate. Most GNU software doesn't provide this capability.
20622
20623 @item -nolibdld
20624 @opindex nolibdld
20625 Suppress the generation of link options to search libdld.sl when the
20626 @option{-static} option is specified on HP-UX 10 and later.
20627
20628 @item -static
20629 @opindex static
20630 The HP-UX implementation of setlocale in libc has a dependency on
20631 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20632 when the @option{-static} option is specified, special link options
20633 are needed to resolve this dependency.
20634
20635 On HP-UX 10 and later, the GCC driver adds the necessary options to
20636 link with libdld.sl when the @option{-static} option is specified.
20637 This causes the resulting binary to be dynamic. On the 64-bit port,
20638 the linkers generate dynamic binaries by default in any case. The
20639 @option{-nolibdld} option can be used to prevent the GCC driver from
20640 adding these link options.
20641
20642 @item -threads
20643 @opindex threads
20644 Add support for multithreading with the @dfn{dce thread} library
20645 under HP-UX@. This option sets flags for both the preprocessor and
20646 linker.
20647 @end table
20648
20649 @node IA-64 Options
20650 @subsection IA-64 Options
20651 @cindex IA-64 Options
20652
20653 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20654
20655 @table @gcctabopt
20656 @item -mbig-endian
20657 @opindex mbig-endian
20658 Generate code for a big-endian target. This is the default for HP-UX@.
20659
20660 @item -mlittle-endian
20661 @opindex mlittle-endian
20662 Generate code for a little-endian target. This is the default for AIX5
20663 and GNU/Linux.
20664
20665 @item -mgnu-as
20666 @itemx -mno-gnu-as
20667 @opindex mgnu-as
20668 @opindex mno-gnu-as
20669 Generate (or don't) code for the GNU assembler. This is the default.
20670 @c Also, this is the default if the configure option @option{--with-gnu-as}
20671 @c is used.
20672
20673 @item -mgnu-ld
20674 @itemx -mno-gnu-ld
20675 @opindex mgnu-ld
20676 @opindex mno-gnu-ld
20677 Generate (or don't) code for the GNU linker. This is the default.
20678 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20679 @c is used.
20680
20681 @item -mno-pic
20682 @opindex mno-pic
20683 Generate code that does not use a global pointer register. The result
20684 is not position independent code, and violates the IA-64 ABI@.
20685
20686 @item -mvolatile-asm-stop
20687 @itemx -mno-volatile-asm-stop
20688 @opindex mvolatile-asm-stop
20689 @opindex mno-volatile-asm-stop
20690 Generate (or don't) a stop bit immediately before and after volatile asm
20691 statements.
20692
20693 @item -mregister-names
20694 @itemx -mno-register-names
20695 @opindex mregister-names
20696 @opindex mno-register-names
20697 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20698 the stacked registers. This may make assembler output more readable.
20699
20700 @item -mno-sdata
20701 @itemx -msdata
20702 @opindex mno-sdata
20703 @opindex msdata
20704 Disable (or enable) optimizations that use the small data section. This may
20705 be useful for working around optimizer bugs.
20706
20707 @item -mconstant-gp
20708 @opindex mconstant-gp
20709 Generate code that uses a single constant global pointer value. This is
20710 useful when compiling kernel code.
20711
20712 @item -mauto-pic
20713 @opindex mauto-pic
20714 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20715 This is useful when compiling firmware code.
20716
20717 @item -minline-float-divide-min-latency
20718 @opindex minline-float-divide-min-latency
20719 Generate code for inline divides of floating-point values
20720 using the minimum latency algorithm.
20721
20722 @item -minline-float-divide-max-throughput
20723 @opindex minline-float-divide-max-throughput
20724 Generate code for inline divides of floating-point values
20725 using the maximum throughput algorithm.
20726
20727 @item -mno-inline-float-divide
20728 @opindex mno-inline-float-divide
20729 Do not generate inline code for divides of floating-point values.
20730
20731 @item -minline-int-divide-min-latency
20732 @opindex minline-int-divide-min-latency
20733 Generate code for inline divides of integer values
20734 using the minimum latency algorithm.
20735
20736 @item -minline-int-divide-max-throughput
20737 @opindex minline-int-divide-max-throughput
20738 Generate code for inline divides of integer values
20739 using the maximum throughput algorithm.
20740
20741 @item -mno-inline-int-divide
20742 @opindex mno-inline-int-divide
20743 @opindex minline-int-divide
20744 Do not generate inline code for divides of integer values.
20745
20746 @item -minline-sqrt-min-latency
20747 @opindex minline-sqrt-min-latency
20748 Generate code for inline square roots
20749 using the minimum latency algorithm.
20750
20751 @item -minline-sqrt-max-throughput
20752 @opindex minline-sqrt-max-throughput
20753 Generate code for inline square roots
20754 using the maximum throughput algorithm.
20755
20756 @item -mno-inline-sqrt
20757 @opindex mno-inline-sqrt
20758 Do not generate inline code for @code{sqrt}.
20759
20760 @item -mfused-madd
20761 @itemx -mno-fused-madd
20762 @opindex mfused-madd
20763 @opindex mno-fused-madd
20764 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20765 instructions. The default is to use these instructions.
20766
20767 @item -mno-dwarf2-asm
20768 @itemx -mdwarf2-asm
20769 @opindex mno-dwarf2-asm
20770 @opindex mdwarf2-asm
20771 Don't (or do) generate assembler code for the DWARF line number debugging
20772 info. This may be useful when not using the GNU assembler.
20773
20774 @item -mearly-stop-bits
20775 @itemx -mno-early-stop-bits
20776 @opindex mearly-stop-bits
20777 @opindex mno-early-stop-bits
20778 Allow stop bits to be placed earlier than immediately preceding the
20779 instruction that triggered the stop bit. This can improve instruction
20780 scheduling, but does not always do so.
20781
20782 @item -mfixed-range=@var{register-range}
20783 @opindex mfixed-range
20784 Generate code treating the given register range as fixed registers.
20785 A fixed register is one that the register allocator cannot use. This is
20786 useful when compiling kernel code. A register range is specified as
20787 two registers separated by a dash. Multiple register ranges can be
20788 specified separated by a comma.
20789
20790 @item -mtls-size=@var{tls-size}
20791 @opindex mtls-size
20792 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20793 64.
20794
20795 @item -mtune=@var{cpu-type}
20796 @opindex mtune
20797 Tune the instruction scheduling for a particular CPU, Valid values are
20798 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20799 and @samp{mckinley}.
20800
20801 @item -milp32
20802 @itemx -mlp64
20803 @opindex milp32
20804 @opindex mlp64
20805 Generate code for a 32-bit or 64-bit environment.
20806 The 32-bit environment sets int, long and pointer to 32 bits.
20807 The 64-bit environment sets int to 32 bits and long and pointer
20808 to 64 bits. These are HP-UX specific flags.
20809
20810 @item -mno-sched-br-data-spec
20811 @itemx -msched-br-data-spec
20812 @opindex mno-sched-br-data-spec
20813 @opindex msched-br-data-spec
20814 (Dis/En)able data speculative scheduling before reload.
20815 This results in generation of @code{ld.a} instructions and
20816 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20817 The default setting is disabled.
20818
20819 @item -msched-ar-data-spec
20820 @itemx -mno-sched-ar-data-spec
20821 @opindex msched-ar-data-spec
20822 @opindex mno-sched-ar-data-spec
20823 (En/Dis)able data speculative scheduling after reload.
20824 This results in generation of @code{ld.a} instructions and
20825 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20826 The default setting is enabled.
20827
20828 @item -mno-sched-control-spec
20829 @itemx -msched-control-spec
20830 @opindex mno-sched-control-spec
20831 @opindex msched-control-spec
20832 (Dis/En)able control speculative scheduling. This feature is
20833 available only during region scheduling (i.e.@: before reload).
20834 This results in generation of the @code{ld.s} instructions and
20835 the corresponding check instructions @code{chk.s}.
20836 The default setting is disabled.
20837
20838 @item -msched-br-in-data-spec
20839 @itemx -mno-sched-br-in-data-spec
20840 @opindex msched-br-in-data-spec
20841 @opindex mno-sched-br-in-data-spec
20842 (En/Dis)able speculative scheduling of the instructions that
20843 are dependent on the data speculative loads before reload.
20844 This is effective only with @option{-msched-br-data-spec} enabled.
20845 The default setting is enabled.
20846
20847 @item -msched-ar-in-data-spec
20848 @itemx -mno-sched-ar-in-data-spec
20849 @opindex msched-ar-in-data-spec
20850 @opindex mno-sched-ar-in-data-spec
20851 (En/Dis)able speculative scheduling of the instructions that
20852 are dependent on the data speculative loads after reload.
20853 This is effective only with @option{-msched-ar-data-spec} enabled.
20854 The default setting is enabled.
20855
20856 @item -msched-in-control-spec
20857 @itemx -mno-sched-in-control-spec
20858 @opindex msched-in-control-spec
20859 @opindex mno-sched-in-control-spec
20860 (En/Dis)able speculative scheduling of the instructions that
20861 are dependent on the control speculative loads.
20862 This is effective only with @option{-msched-control-spec} enabled.
20863 The default setting is enabled.
20864
20865 @item -mno-sched-prefer-non-data-spec-insns
20866 @itemx -msched-prefer-non-data-spec-insns
20867 @opindex mno-sched-prefer-non-data-spec-insns
20868 @opindex msched-prefer-non-data-spec-insns
20869 If enabled, data-speculative instructions are chosen for schedule
20870 only if there are no other choices at the moment. This makes
20871 the use of the data speculation much more conservative.
20872 The default setting is disabled.
20873
20874 @item -mno-sched-prefer-non-control-spec-insns
20875 @itemx -msched-prefer-non-control-spec-insns
20876 @opindex mno-sched-prefer-non-control-spec-insns
20877 @opindex msched-prefer-non-control-spec-insns
20878 If enabled, control-speculative instructions are chosen for schedule
20879 only if there are no other choices at the moment. This makes
20880 the use of the control speculation much more conservative.
20881 The default setting is disabled.
20882
20883 @item -mno-sched-count-spec-in-critical-path
20884 @itemx -msched-count-spec-in-critical-path
20885 @opindex mno-sched-count-spec-in-critical-path
20886 @opindex msched-count-spec-in-critical-path
20887 If enabled, speculative dependencies are considered during
20888 computation of the instructions priorities. This makes the use of the
20889 speculation a bit more conservative.
20890 The default setting is disabled.
20891
20892 @item -msched-spec-ldc
20893 @opindex msched-spec-ldc
20894 Use a simple data speculation check. This option is on by default.
20895
20896 @item -msched-control-spec-ldc
20897 @opindex msched-spec-ldc
20898 Use a simple check for control speculation. This option is on by default.
20899
20900 @item -msched-stop-bits-after-every-cycle
20901 @opindex msched-stop-bits-after-every-cycle
20902 Place a stop bit after every cycle when scheduling. This option is on
20903 by default.
20904
20905 @item -msched-fp-mem-deps-zero-cost
20906 @opindex msched-fp-mem-deps-zero-cost
20907 Assume that floating-point stores and loads are not likely to cause a conflict
20908 when placed into the same instruction group. This option is disabled by
20909 default.
20910
20911 @item -msel-sched-dont-check-control-spec
20912 @opindex msel-sched-dont-check-control-spec
20913 Generate checks for control speculation in selective scheduling.
20914 This flag is disabled by default.
20915
20916 @item -msched-max-memory-insns=@var{max-insns}
20917 @opindex msched-max-memory-insns
20918 Limit on the number of memory insns per instruction group, giving lower
20919 priority to subsequent memory insns attempting to schedule in the same
20920 instruction group. Frequently useful to prevent cache bank conflicts.
20921 The default value is 1.
20922
20923 @item -msched-max-memory-insns-hard-limit
20924 @opindex msched-max-memory-insns-hard-limit
20925 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20926 disallowing more than that number in an instruction group.
20927 Otherwise, the limit is ``soft'', meaning that non-memory operations
20928 are preferred when the limit is reached, but memory operations may still
20929 be scheduled.
20930
20931 @end table
20932
20933 @node LM32 Options
20934 @subsection LM32 Options
20935 @cindex LM32 options
20936
20937 These @option{-m} options are defined for the LatticeMico32 architecture:
20938
20939 @table @gcctabopt
20940 @item -mbarrel-shift-enabled
20941 @opindex mbarrel-shift-enabled
20942 Enable barrel-shift instructions.
20943
20944 @item -mdivide-enabled
20945 @opindex mdivide-enabled
20946 Enable divide and modulus instructions.
20947
20948 @item -mmultiply-enabled
20949 @opindex multiply-enabled
20950 Enable multiply instructions.
20951
20952 @item -msign-extend-enabled
20953 @opindex msign-extend-enabled
20954 Enable sign extend instructions.
20955
20956 @item -muser-enabled
20957 @opindex muser-enabled
20958 Enable user-defined instructions.
20959
20960 @end table
20961
20962 @node M32C Options
20963 @subsection M32C Options
20964 @cindex M32C options
20965
20966 @table @gcctabopt
20967 @item -mcpu=@var{name}
20968 @opindex mcpu=
20969 Select the CPU for which code is generated. @var{name} may be one of
20970 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20971 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20972 the M32C/80 series.
20973
20974 @item -msim
20975 @opindex msim
20976 Specifies that the program will be run on the simulator. This causes
20977 an alternate runtime library to be linked in which supports, for
20978 example, file I/O@. You must not use this option when generating
20979 programs that will run on real hardware; you must provide your own
20980 runtime library for whatever I/O functions are needed.
20981
20982 @item -memregs=@var{number}
20983 @opindex memregs=
20984 Specifies the number of memory-based pseudo-registers GCC uses
20985 during code generation. These pseudo-registers are used like real
20986 registers, so there is a tradeoff between GCC's ability to fit the
20987 code into available registers, and the performance penalty of using
20988 memory instead of registers. Note that all modules in a program must
20989 be compiled with the same value for this option. Because of that, you
20990 must not use this option with GCC's default runtime libraries.
20991
20992 @end table
20993
20994 @node M32R/D Options
20995 @subsection M32R/D Options
20996 @cindex M32R/D options
20997
20998 These @option{-m} options are defined for Renesas M32R/D architectures:
20999
21000 @table @gcctabopt
21001 @item -m32r2
21002 @opindex m32r2
21003 Generate code for the M32R/2@.
21004
21005 @item -m32rx
21006 @opindex m32rx
21007 Generate code for the M32R/X@.
21008
21009 @item -m32r
21010 @opindex m32r
21011 Generate code for the M32R@. This is the default.
21012
21013 @item -mmodel=small
21014 @opindex mmodel=small
21015 Assume all objects live in the lower 16MB of memory (so that their addresses
21016 can be loaded with the @code{ld24} instruction), and assume all subroutines
21017 are reachable with the @code{bl} instruction.
21018 This is the default.
21019
21020 The addressability of a particular object can be set with the
21021 @code{model} attribute.
21022
21023 @item -mmodel=medium
21024 @opindex mmodel=medium
21025 Assume objects may be anywhere in the 32-bit address space (the compiler
21026 generates @code{seth/add3} instructions to load their addresses), and
21027 assume all subroutines are reachable with the @code{bl} instruction.
21028
21029 @item -mmodel=large
21030 @opindex mmodel=large
21031 Assume objects may be anywhere in the 32-bit address space (the compiler
21032 generates @code{seth/add3} instructions to load their addresses), and
21033 assume subroutines may not be reachable with the @code{bl} instruction
21034 (the compiler generates the much slower @code{seth/add3/jl}
21035 instruction sequence).
21036
21037 @item -msdata=none
21038 @opindex msdata=none
21039 Disable use of the small data area. Variables are put into
21040 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
21041 @code{section} attribute has been specified).
21042 This is the default.
21043
21044 The small data area consists of sections @code{.sdata} and @code{.sbss}.
21045 Objects may be explicitly put in the small data area with the
21046 @code{section} attribute using one of these sections.
21047
21048 @item -msdata=sdata
21049 @opindex msdata=sdata
21050 Put small global and static data in the small data area, but do not
21051 generate special code to reference them.
21052
21053 @item -msdata=use
21054 @opindex msdata=use
21055 Put small global and static data in the small data area, and generate
21056 special instructions to reference them.
21057
21058 @item -G @var{num}
21059 @opindex G
21060 @cindex smaller data references
21061 Put global and static objects less than or equal to @var{num} bytes
21062 into the small data or BSS sections instead of the normal data or BSS
21063 sections. The default value of @var{num} is 8.
21064 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
21065 for this option to have any effect.
21066
21067 All modules should be compiled with the same @option{-G @var{num}} value.
21068 Compiling with different values of @var{num} may or may not work; if it
21069 doesn't the linker gives an error message---incorrect code is not
21070 generated.
21071
21072 @item -mdebug
21073 @opindex mdebug
21074 Makes the M32R-specific code in the compiler display some statistics
21075 that might help in debugging programs.
21076
21077 @item -malign-loops
21078 @opindex malign-loops
21079 Align all loops to a 32-byte boundary.
21080
21081 @item -mno-align-loops
21082 @opindex mno-align-loops
21083 Do not enforce a 32-byte alignment for loops. This is the default.
21084
21085 @item -missue-rate=@var{number}
21086 @opindex missue-rate=@var{number}
21087 Issue @var{number} instructions per cycle. @var{number} can only be 1
21088 or 2.
21089
21090 @item -mbranch-cost=@var{number}
21091 @opindex mbranch-cost=@var{number}
21092 @var{number} can only be 1 or 2. If it is 1 then branches are
21093 preferred over conditional code, if it is 2, then the opposite applies.
21094
21095 @item -mflush-trap=@var{number}
21096 @opindex mflush-trap=@var{number}
21097 Specifies the trap number to use to flush the cache. The default is
21098 12. Valid numbers are between 0 and 15 inclusive.
21099
21100 @item -mno-flush-trap
21101 @opindex mno-flush-trap
21102 Specifies that the cache cannot be flushed by using a trap.
21103
21104 @item -mflush-func=@var{name}
21105 @opindex mflush-func=@var{name}
21106 Specifies the name of the operating system function to call to flush
21107 the cache. The default is @samp{_flush_cache}, but a function call
21108 is only used if a trap is not available.
21109
21110 @item -mno-flush-func
21111 @opindex mno-flush-func
21112 Indicates that there is no OS function for flushing the cache.
21113
21114 @end table
21115
21116 @node M680x0 Options
21117 @subsection M680x0 Options
21118 @cindex M680x0 options
21119
21120 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
21121 The default settings depend on which architecture was selected when
21122 the compiler was configured; the defaults for the most common choices
21123 are given below.
21124
21125 @table @gcctabopt
21126 @item -march=@var{arch}
21127 @opindex march
21128 Generate code for a specific M680x0 or ColdFire instruction set
21129 architecture. Permissible values of @var{arch} for M680x0
21130 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
21131 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
21132 architectures are selected according to Freescale's ISA classification
21133 and the permissible values are: @samp{isaa}, @samp{isaaplus},
21134 @samp{isab} and @samp{isac}.
21135
21136 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
21137 code for a ColdFire target. The @var{arch} in this macro is one of the
21138 @option{-march} arguments given above.
21139
21140 When used together, @option{-march} and @option{-mtune} select code
21141 that runs on a family of similar processors but that is optimized
21142 for a particular microarchitecture.
21143
21144 @item -mcpu=@var{cpu}
21145 @opindex mcpu
21146 Generate code for a specific M680x0 or ColdFire processor.
21147 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
21148 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
21149 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
21150 below, which also classifies the CPUs into families:
21151
21152 @multitable @columnfractions 0.20 0.80
21153 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
21154 @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}
21155 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
21156 @item @samp{5206e} @tab @samp{5206e}
21157 @item @samp{5208} @tab @samp{5207} @samp{5208}
21158 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
21159 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
21160 @item @samp{5216} @tab @samp{5214} @samp{5216}
21161 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
21162 @item @samp{5225} @tab @samp{5224} @samp{5225}
21163 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
21164 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
21165 @item @samp{5249} @tab @samp{5249}
21166 @item @samp{5250} @tab @samp{5250}
21167 @item @samp{5271} @tab @samp{5270} @samp{5271}
21168 @item @samp{5272} @tab @samp{5272}
21169 @item @samp{5275} @tab @samp{5274} @samp{5275}
21170 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
21171 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
21172 @item @samp{5307} @tab @samp{5307}
21173 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
21174 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
21175 @item @samp{5407} @tab @samp{5407}
21176 @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}
21177 @end multitable
21178
21179 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
21180 @var{arch} is compatible with @var{cpu}. Other combinations of
21181 @option{-mcpu} and @option{-march} are rejected.
21182
21183 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
21184 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
21185 where the value of @var{family} is given by the table above.
21186
21187 @item -mtune=@var{tune}
21188 @opindex mtune
21189 Tune the code for a particular microarchitecture within the
21190 constraints set by @option{-march} and @option{-mcpu}.
21191 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
21192 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
21193 and @samp{cpu32}. The ColdFire microarchitectures
21194 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
21195
21196 You can also use @option{-mtune=68020-40} for code that needs
21197 to run relatively well on 68020, 68030 and 68040 targets.
21198 @option{-mtune=68020-60} is similar but includes 68060 targets
21199 as well. These two options select the same tuning decisions as
21200 @option{-m68020-40} and @option{-m68020-60} respectively.
21201
21202 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
21203 when tuning for 680x0 architecture @var{arch}. It also defines
21204 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
21205 option is used. If GCC is tuning for a range of architectures,
21206 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
21207 it defines the macros for every architecture in the range.
21208
21209 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
21210 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
21211 of the arguments given above.
21212
21213 @item -m68000
21214 @itemx -mc68000
21215 @opindex m68000
21216 @opindex mc68000
21217 Generate output for a 68000. This is the default
21218 when the compiler is configured for 68000-based systems.
21219 It is equivalent to @option{-march=68000}.
21220
21221 Use this option for microcontrollers with a 68000 or EC000 core,
21222 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21223
21224 @item -m68010
21225 @opindex m68010
21226 Generate output for a 68010. This is the default
21227 when the compiler is configured for 68010-based systems.
21228 It is equivalent to @option{-march=68010}.
21229
21230 @item -m68020
21231 @itemx -mc68020
21232 @opindex m68020
21233 @opindex mc68020
21234 Generate output for a 68020. This is the default
21235 when the compiler is configured for 68020-based systems.
21236 It is equivalent to @option{-march=68020}.
21237
21238 @item -m68030
21239 @opindex m68030
21240 Generate output for a 68030. This is the default when the compiler is
21241 configured for 68030-based systems. It is equivalent to
21242 @option{-march=68030}.
21243
21244 @item -m68040
21245 @opindex m68040
21246 Generate output for a 68040. This is the default when the compiler is
21247 configured for 68040-based systems. It is equivalent to
21248 @option{-march=68040}.
21249
21250 This option inhibits the use of 68881/68882 instructions that have to be
21251 emulated by software on the 68040. Use this option if your 68040 does not
21252 have code to emulate those instructions.
21253
21254 @item -m68060
21255 @opindex m68060
21256 Generate output for a 68060. This is the default when the compiler is
21257 configured for 68060-based systems. It is equivalent to
21258 @option{-march=68060}.
21259
21260 This option inhibits the use of 68020 and 68881/68882 instructions that
21261 have to be emulated by software on the 68060. Use this option if your 68060
21262 does not have code to emulate those instructions.
21263
21264 @item -mcpu32
21265 @opindex mcpu32
21266 Generate output for a CPU32. This is the default
21267 when the compiler is configured for CPU32-based systems.
21268 It is equivalent to @option{-march=cpu32}.
21269
21270 Use this option for microcontrollers with a
21271 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21272 68336, 68340, 68341, 68349 and 68360.
21273
21274 @item -m5200
21275 @opindex m5200
21276 Generate output for a 520X ColdFire CPU@. This is the default
21277 when the compiler is configured for 520X-based systems.
21278 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21279 in favor of that option.
21280
21281 Use this option for microcontroller with a 5200 core, including
21282 the MCF5202, MCF5203, MCF5204 and MCF5206.
21283
21284 @item -m5206e
21285 @opindex m5206e
21286 Generate output for a 5206e ColdFire CPU@. The option is now
21287 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21288
21289 @item -m528x
21290 @opindex m528x
21291 Generate output for a member of the ColdFire 528X family.
21292 The option is now deprecated in favor of the equivalent
21293 @option{-mcpu=528x}.
21294
21295 @item -m5307
21296 @opindex m5307
21297 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21298 in favor of the equivalent @option{-mcpu=5307}.
21299
21300 @item -m5407
21301 @opindex m5407
21302 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21303 in favor of the equivalent @option{-mcpu=5407}.
21304
21305 @item -mcfv4e
21306 @opindex mcfv4e
21307 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21308 This includes use of hardware floating-point instructions.
21309 The option is equivalent to @option{-mcpu=547x}, and is now
21310 deprecated in favor of that option.
21311
21312 @item -m68020-40
21313 @opindex m68020-40
21314 Generate output for a 68040, without using any of the new instructions.
21315 This results in code that can run relatively efficiently on either a
21316 68020/68881 or a 68030 or a 68040. The generated code does use the
21317 68881 instructions that are emulated on the 68040.
21318
21319 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21320
21321 @item -m68020-60
21322 @opindex m68020-60
21323 Generate output for a 68060, without using any of the new instructions.
21324 This results in code that can run relatively efficiently on either a
21325 68020/68881 or a 68030 or a 68040. The generated code does use the
21326 68881 instructions that are emulated on the 68060.
21327
21328 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21329
21330 @item -mhard-float
21331 @itemx -m68881
21332 @opindex mhard-float
21333 @opindex m68881
21334 Generate floating-point instructions. This is the default for 68020
21335 and above, and for ColdFire devices that have an FPU@. It defines the
21336 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21337 on ColdFire targets.
21338
21339 @item -msoft-float
21340 @opindex msoft-float
21341 Do not generate floating-point instructions; use library calls instead.
21342 This is the default for 68000, 68010, and 68832 targets. It is also
21343 the default for ColdFire devices that have no FPU.
21344
21345 @item -mdiv
21346 @itemx -mno-div
21347 @opindex mdiv
21348 @opindex mno-div
21349 Generate (do not generate) ColdFire hardware divide and remainder
21350 instructions. If @option{-march} is used without @option{-mcpu},
21351 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21352 architectures. Otherwise, the default is taken from the target CPU
21353 (either the default CPU, or the one specified by @option{-mcpu}). For
21354 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21355 @option{-mcpu=5206e}.
21356
21357 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21358
21359 @item -mshort
21360 @opindex mshort
21361 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21362 Additionally, parameters passed on the stack are also aligned to a
21363 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21364
21365 @item -mno-short
21366 @opindex mno-short
21367 Do not consider type @code{int} to be 16 bits wide. This is the default.
21368
21369 @item -mnobitfield
21370 @itemx -mno-bitfield
21371 @opindex mnobitfield
21372 @opindex mno-bitfield
21373 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21374 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21375
21376 @item -mbitfield
21377 @opindex mbitfield
21378 Do use the bit-field instructions. The @option{-m68020} option implies
21379 @option{-mbitfield}. This is the default if you use a configuration
21380 designed for a 68020.
21381
21382 @item -mrtd
21383 @opindex mrtd
21384 Use a different function-calling convention, in which functions
21385 that take a fixed number of arguments return with the @code{rtd}
21386 instruction, which pops their arguments while returning. This
21387 saves one instruction in the caller since there is no need to pop
21388 the arguments there.
21389
21390 This calling convention is incompatible with the one normally
21391 used on Unix, so you cannot use it if you need to call libraries
21392 compiled with the Unix compiler.
21393
21394 Also, you must provide function prototypes for all functions that
21395 take variable numbers of arguments (including @code{printf});
21396 otherwise incorrect code is generated for calls to those
21397 functions.
21398
21399 In addition, seriously incorrect code results if you call a
21400 function with too many arguments. (Normally, extra arguments are
21401 harmlessly ignored.)
21402
21403 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21404 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21405
21406 The default is @option{-mno-rtd}.
21407
21408 @item -malign-int
21409 @itemx -mno-align-int
21410 @opindex malign-int
21411 @opindex mno-align-int
21412 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21413 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21414 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21415 Aligning variables on 32-bit boundaries produces code that runs somewhat
21416 faster on processors with 32-bit busses at the expense of more memory.
21417
21418 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21419 aligns structures containing the above types differently than
21420 most published application binary interface specifications for the m68k.
21421
21422 @item -mpcrel
21423 @opindex mpcrel
21424 Use the pc-relative addressing mode of the 68000 directly, instead of
21425 using a global offset table. At present, this option implies @option{-fpic},
21426 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21427 not presently supported with @option{-mpcrel}, though this could be supported for
21428 68020 and higher processors.
21429
21430 @item -mno-strict-align
21431 @itemx -mstrict-align
21432 @opindex mno-strict-align
21433 @opindex mstrict-align
21434 Do not (do) assume that unaligned memory references are handled by
21435 the system.
21436
21437 @item -msep-data
21438 Generate code that allows the data segment to be located in a different
21439 area of memory from the text segment. This allows for execute-in-place in
21440 an environment without virtual memory management. This option implies
21441 @option{-fPIC}.
21442
21443 @item -mno-sep-data
21444 Generate code that assumes that the data segment follows the text segment.
21445 This is the default.
21446
21447 @item -mid-shared-library
21448 Generate code that supports shared libraries via the library ID method.
21449 This allows for execute-in-place and shared libraries in an environment
21450 without virtual memory management. This option implies @option{-fPIC}.
21451
21452 @item -mno-id-shared-library
21453 Generate code that doesn't assume ID-based shared libraries are being used.
21454 This is the default.
21455
21456 @item -mshared-library-id=n
21457 Specifies the identification number of the ID-based shared library being
21458 compiled. Specifying a value of 0 generates more compact code; specifying
21459 other values forces the allocation of that number to the current
21460 library, but is no more space- or time-efficient than omitting this option.
21461
21462 @item -mxgot
21463 @itemx -mno-xgot
21464 @opindex mxgot
21465 @opindex mno-xgot
21466 When generating position-independent code for ColdFire, generate code
21467 that works if the GOT has more than 8192 entries. This code is
21468 larger and slower than code generated without this option. On M680x0
21469 processors, this option is not needed; @option{-fPIC} suffices.
21470
21471 GCC normally uses a single instruction to load values from the GOT@.
21472 While this is relatively efficient, it only works if the GOT
21473 is smaller than about 64k. Anything larger causes the linker
21474 to report an error such as:
21475
21476 @cindex relocation truncated to fit (ColdFire)
21477 @smallexample
21478 relocation truncated to fit: R_68K_GOT16O foobar
21479 @end smallexample
21480
21481 If this happens, you should recompile your code with @option{-mxgot}.
21482 It should then work with very large GOTs. However, code generated with
21483 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21484 the value of a global symbol.
21485
21486 Note that some linkers, including newer versions of the GNU linker,
21487 can create multiple GOTs and sort GOT entries. If you have such a linker,
21488 you should only need to use @option{-mxgot} when compiling a single
21489 object file that accesses more than 8192 GOT entries. Very few do.
21490
21491 These options have no effect unless GCC is generating
21492 position-independent code.
21493
21494 @item -mlong-jump-table-offsets
21495 @opindex mlong-jump-table-offsets
21496 Use 32-bit offsets in @code{switch} tables. The default is to use
21497 16-bit offsets.
21498
21499 @end table
21500
21501 @node MCore Options
21502 @subsection MCore Options
21503 @cindex MCore options
21504
21505 These are the @samp{-m} options defined for the Motorola M*Core
21506 processors.
21507
21508 @table @gcctabopt
21509
21510 @item -mhardlit
21511 @itemx -mno-hardlit
21512 @opindex mhardlit
21513 @opindex mno-hardlit
21514 Inline constants into the code stream if it can be done in two
21515 instructions or less.
21516
21517 @item -mdiv
21518 @itemx -mno-div
21519 @opindex mdiv
21520 @opindex mno-div
21521 Use the divide instruction. (Enabled by default).
21522
21523 @item -mrelax-immediate
21524 @itemx -mno-relax-immediate
21525 @opindex mrelax-immediate
21526 @opindex mno-relax-immediate
21527 Allow arbitrary-sized immediates in bit operations.
21528
21529 @item -mwide-bitfields
21530 @itemx -mno-wide-bitfields
21531 @opindex mwide-bitfields
21532 @opindex mno-wide-bitfields
21533 Always treat bit-fields as @code{int}-sized.
21534
21535 @item -m4byte-functions
21536 @itemx -mno-4byte-functions
21537 @opindex m4byte-functions
21538 @opindex mno-4byte-functions
21539 Force all functions to be aligned to a 4-byte boundary.
21540
21541 @item -mcallgraph-data
21542 @itemx -mno-callgraph-data
21543 @opindex mcallgraph-data
21544 @opindex mno-callgraph-data
21545 Emit callgraph information.
21546
21547 @item -mslow-bytes
21548 @itemx -mno-slow-bytes
21549 @opindex mslow-bytes
21550 @opindex mno-slow-bytes
21551 Prefer word access when reading byte quantities.
21552
21553 @item -mlittle-endian
21554 @itemx -mbig-endian
21555 @opindex mlittle-endian
21556 @opindex mbig-endian
21557 Generate code for a little-endian target.
21558
21559 @item -m210
21560 @itemx -m340
21561 @opindex m210
21562 @opindex m340
21563 Generate code for the 210 processor.
21564
21565 @item -mno-lsim
21566 @opindex mno-lsim
21567 Assume that runtime support has been provided and so omit the
21568 simulator library (@file{libsim.a)} from the linker command line.
21569
21570 @item -mstack-increment=@var{size}
21571 @opindex mstack-increment
21572 Set the maximum amount for a single stack increment operation. Large
21573 values can increase the speed of programs that contain functions
21574 that need a large amount of stack space, but they can also trigger a
21575 segmentation fault if the stack is extended too much. The default
21576 value is 0x1000.
21577
21578 @end table
21579
21580 @node MeP Options
21581 @subsection MeP Options
21582 @cindex MeP options
21583
21584 @table @gcctabopt
21585
21586 @item -mabsdiff
21587 @opindex mabsdiff
21588 Enables the @code{abs} instruction, which is the absolute difference
21589 between two registers.
21590
21591 @item -mall-opts
21592 @opindex mall-opts
21593 Enables all the optional instructions---average, multiply, divide, bit
21594 operations, leading zero, absolute difference, min/max, clip, and
21595 saturation.
21596
21597
21598 @item -maverage
21599 @opindex maverage
21600 Enables the @code{ave} instruction, which computes the average of two
21601 registers.
21602
21603 @item -mbased=@var{n}
21604 @opindex mbased=
21605 Variables of size @var{n} bytes or smaller are placed in the
21606 @code{.based} section by default. Based variables use the @code{$tp}
21607 register as a base register, and there is a 128-byte limit to the
21608 @code{.based} section.
21609
21610 @item -mbitops
21611 @opindex mbitops
21612 Enables the bit operation instructions---bit test (@code{btstm}), set
21613 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21614 test-and-set (@code{tas}).
21615
21616 @item -mc=@var{name}
21617 @opindex mc=
21618 Selects which section constant data is placed in. @var{name} may
21619 be @samp{tiny}, @samp{near}, or @samp{far}.
21620
21621 @item -mclip
21622 @opindex mclip
21623 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21624 useful unless you also provide @option{-mminmax}.
21625
21626 @item -mconfig=@var{name}
21627 @opindex mconfig=
21628 Selects one of the built-in core configurations. Each MeP chip has
21629 one or more modules in it; each module has a core CPU and a variety of
21630 coprocessors, optional instructions, and peripherals. The
21631 @code{MeP-Integrator} tool, not part of GCC, provides these
21632 configurations through this option; using this option is the same as
21633 using all the corresponding command-line options. The default
21634 configuration is @samp{default}.
21635
21636 @item -mcop
21637 @opindex mcop
21638 Enables the coprocessor instructions. By default, this is a 32-bit
21639 coprocessor. Note that the coprocessor is normally enabled via the
21640 @option{-mconfig=} option.
21641
21642 @item -mcop32
21643 @opindex mcop32
21644 Enables the 32-bit coprocessor's instructions.
21645
21646 @item -mcop64
21647 @opindex mcop64
21648 Enables the 64-bit coprocessor's instructions.
21649
21650 @item -mivc2
21651 @opindex mivc2
21652 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21653
21654 @item -mdc
21655 @opindex mdc
21656 Causes constant variables to be placed in the @code{.near} section.
21657
21658 @item -mdiv
21659 @opindex mdiv
21660 Enables the @code{div} and @code{divu} instructions.
21661
21662 @item -meb
21663 @opindex meb
21664 Generate big-endian code.
21665
21666 @item -mel
21667 @opindex mel
21668 Generate little-endian code.
21669
21670 @item -mio-volatile
21671 @opindex mio-volatile
21672 Tells the compiler that any variable marked with the @code{io}
21673 attribute is to be considered volatile.
21674
21675 @item -ml
21676 @opindex ml
21677 Causes variables to be assigned to the @code{.far} section by default.
21678
21679 @item -mleadz
21680 @opindex mleadz
21681 Enables the @code{leadz} (leading zero) instruction.
21682
21683 @item -mm
21684 @opindex mm
21685 Causes variables to be assigned to the @code{.near} section by default.
21686
21687 @item -mminmax
21688 @opindex mminmax
21689 Enables the @code{min} and @code{max} instructions.
21690
21691 @item -mmult
21692 @opindex mmult
21693 Enables the multiplication and multiply-accumulate instructions.
21694
21695 @item -mno-opts
21696 @opindex mno-opts
21697 Disables all the optional instructions enabled by @option{-mall-opts}.
21698
21699 @item -mrepeat
21700 @opindex mrepeat
21701 Enables the @code{repeat} and @code{erepeat} instructions, used for
21702 low-overhead looping.
21703
21704 @item -ms
21705 @opindex ms
21706 Causes all variables to default to the @code{.tiny} section. Note
21707 that there is a 65536-byte limit to this section. Accesses to these
21708 variables use the @code{%gp} base register.
21709
21710 @item -msatur
21711 @opindex msatur
21712 Enables the saturation instructions. Note that the compiler does not
21713 currently generate these itself, but this option is included for
21714 compatibility with other tools, like @code{as}.
21715
21716 @item -msdram
21717 @opindex msdram
21718 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21719
21720 @item -msim
21721 @opindex msim
21722 Link the simulator run-time libraries.
21723
21724 @item -msimnovec
21725 @opindex msimnovec
21726 Link the simulator runtime libraries, excluding built-in support
21727 for reset and exception vectors and tables.
21728
21729 @item -mtf
21730 @opindex mtf
21731 Causes all functions to default to the @code{.far} section. Without
21732 this option, functions default to the @code{.near} section.
21733
21734 @item -mtiny=@var{n}
21735 @opindex mtiny=
21736 Variables that are @var{n} bytes or smaller are allocated to the
21737 @code{.tiny} section. These variables use the @code{$gp} base
21738 register. The default for this option is 4, but note that there's a
21739 65536-byte limit to the @code{.tiny} section.
21740
21741 @end table
21742
21743 @node MicroBlaze Options
21744 @subsection MicroBlaze Options
21745 @cindex MicroBlaze Options
21746
21747 @table @gcctabopt
21748
21749 @item -msoft-float
21750 @opindex msoft-float
21751 Use software emulation for floating point (default).
21752
21753 @item -mhard-float
21754 @opindex mhard-float
21755 Use hardware floating-point instructions.
21756
21757 @item -mmemcpy
21758 @opindex mmemcpy
21759 Do not optimize block moves, use @code{memcpy}.
21760
21761 @item -mno-clearbss
21762 @opindex mno-clearbss
21763 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21764
21765 @item -mcpu=@var{cpu-type}
21766 @opindex mcpu=
21767 Use features of, and schedule code for, the given CPU.
21768 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21769 where @var{X} is a major version, @var{YY} is the minor version, and
21770 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21771 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21772
21773 @item -mxl-soft-mul
21774 @opindex mxl-soft-mul
21775 Use software multiply emulation (default).
21776
21777 @item -mxl-soft-div
21778 @opindex mxl-soft-div
21779 Use software emulation for divides (default).
21780
21781 @item -mxl-barrel-shift
21782 @opindex mxl-barrel-shift
21783 Use the hardware barrel shifter.
21784
21785 @item -mxl-pattern-compare
21786 @opindex mxl-pattern-compare
21787 Use pattern compare instructions.
21788
21789 @item -msmall-divides
21790 @opindex msmall-divides
21791 Use table lookup optimization for small signed integer divisions.
21792
21793 @item -mxl-stack-check
21794 @opindex mxl-stack-check
21795 This option is deprecated. Use @option{-fstack-check} instead.
21796
21797 @item -mxl-gp-opt
21798 @opindex mxl-gp-opt
21799 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21800
21801 @item -mxl-multiply-high
21802 @opindex mxl-multiply-high
21803 Use multiply high instructions for high part of 32x32 multiply.
21804
21805 @item -mxl-float-convert
21806 @opindex mxl-float-convert
21807 Use hardware floating-point conversion instructions.
21808
21809 @item -mxl-float-sqrt
21810 @opindex mxl-float-sqrt
21811 Use hardware floating-point square root instruction.
21812
21813 @item -mbig-endian
21814 @opindex mbig-endian
21815 Generate code for a big-endian target.
21816
21817 @item -mlittle-endian
21818 @opindex mlittle-endian
21819 Generate code for a little-endian target.
21820
21821 @item -mxl-reorder
21822 @opindex mxl-reorder
21823 Use reorder instructions (swap and byte reversed load/store).
21824
21825 @item -mxl-mode-@var{app-model}
21826 Select application model @var{app-model}. Valid models are
21827 @table @samp
21828 @item executable
21829 normal executable (default), uses startup code @file{crt0.o}.
21830
21831 @item -mpic-data-is-text-relative
21832 @opindex mpic-data-is-text-relative
21833 Assume that the displacement between the text and data segments is fixed
21834 at static link time. This allows data to be referenced by offset from start of
21835 text address instead of GOT since PC-relative addressing is not supported.
21836
21837 @item xmdstub
21838 for use with Xilinx Microprocessor Debugger (XMD) based
21839 software intrusive debug agent called xmdstub. This uses startup file
21840 @file{crt1.o} and sets the start address of the program to 0x800.
21841
21842 @item bootstrap
21843 for applications that are loaded using a bootloader.
21844 This model uses startup file @file{crt2.o} which does not contain a processor
21845 reset vector handler. This is suitable for transferring control on a
21846 processor reset to the bootloader rather than the application.
21847
21848 @item novectors
21849 for applications that do not require any of the
21850 MicroBlaze vectors. This option may be useful for applications running
21851 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21852 @end table
21853
21854 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21855 @option{-mxl-mode-@var{app-model}}.
21856
21857 @end table
21858
21859 @node MIPS Options
21860 @subsection MIPS Options
21861 @cindex MIPS options
21862
21863 @table @gcctabopt
21864
21865 @item -EB
21866 @opindex EB
21867 Generate big-endian code.
21868
21869 @item -EL
21870 @opindex EL
21871 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21872 configurations.
21873
21874 @item -march=@var{arch}
21875 @opindex march
21876 Generate code that runs on @var{arch}, which can be the name of a
21877 generic MIPS ISA, or the name of a particular processor.
21878 The ISA names are:
21879 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21880 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21881 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21882 @samp{mips64r5} and @samp{mips64r6}.
21883 The processor names are:
21884 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21885 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21886 @samp{5kc}, @samp{5kf},
21887 @samp{20kc},
21888 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21889 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21890 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21891 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21892 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21893 @samp{i6400}, @samp{i6500},
21894 @samp{interaptiv},
21895 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21896 @samp{gs464e}, @samp{gs264e},
21897 @samp{m4k},
21898 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21899 @samp{m5100}, @samp{m5101},
21900 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21901 @samp{orion},
21902 @samp{p5600}, @samp{p6600},
21903 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21904 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21905 @samp{r6000}, @samp{r8000},
21906 @samp{rm7000}, @samp{rm9000},
21907 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21908 @samp{sb1},
21909 @samp{sr71000},
21910 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21911 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21912 @samp{xlr} and @samp{xlp}.
21913 The special value @samp{from-abi} selects the
21914 most compatible architecture for the selected ABI (that is,
21915 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21916
21917 The native Linux/GNU toolchain also supports the value @samp{native},
21918 which selects the best architecture option for the host processor.
21919 @option{-march=native} has no effect if GCC does not recognize
21920 the processor.
21921
21922 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21923 (for example, @option{-march=r2k}). Prefixes are optional, and
21924 @samp{vr} may be written @samp{r}.
21925
21926 Names of the form @samp{@var{n}f2_1} refer to processors with
21927 FPUs clocked at half the rate of the core, names of the form
21928 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21929 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21930 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21931 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21932 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21933 accepted as synonyms for @samp{@var{n}f1_1}.
21934
21935 GCC defines two macros based on the value of this option. The first
21936 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21937 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21938 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21939 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21940 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21941
21942 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21943 above. In other words, it has the full prefix and does not
21944 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21945 the macro names the resolved architecture (either @code{"mips1"} or
21946 @code{"mips3"}). It names the default architecture when no
21947 @option{-march} option is given.
21948
21949 @item -mtune=@var{arch}
21950 @opindex mtune
21951 Optimize for @var{arch}. Among other things, this option controls
21952 the way instructions are scheduled, and the perceived cost of arithmetic
21953 operations. The list of @var{arch} values is the same as for
21954 @option{-march}.
21955
21956 When this option is not used, GCC optimizes for the processor
21957 specified by @option{-march}. By using @option{-march} and
21958 @option{-mtune} together, it is possible to generate code that
21959 runs on a family of processors, but optimize the code for one
21960 particular member of that family.
21961
21962 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21963 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21964 @option{-march} ones described above.
21965
21966 @item -mips1
21967 @opindex mips1
21968 Equivalent to @option{-march=mips1}.
21969
21970 @item -mips2
21971 @opindex mips2
21972 Equivalent to @option{-march=mips2}.
21973
21974 @item -mips3
21975 @opindex mips3
21976 Equivalent to @option{-march=mips3}.
21977
21978 @item -mips4
21979 @opindex mips4
21980 Equivalent to @option{-march=mips4}.
21981
21982 @item -mips32
21983 @opindex mips32
21984 Equivalent to @option{-march=mips32}.
21985
21986 @item -mips32r3
21987 @opindex mips32r3
21988 Equivalent to @option{-march=mips32r3}.
21989
21990 @item -mips32r5
21991 @opindex mips32r5
21992 Equivalent to @option{-march=mips32r5}.
21993
21994 @item -mips32r6
21995 @opindex mips32r6
21996 Equivalent to @option{-march=mips32r6}.
21997
21998 @item -mips64
21999 @opindex mips64
22000 Equivalent to @option{-march=mips64}.
22001
22002 @item -mips64r2
22003 @opindex mips64r2
22004 Equivalent to @option{-march=mips64r2}.
22005
22006 @item -mips64r3
22007 @opindex mips64r3
22008 Equivalent to @option{-march=mips64r3}.
22009
22010 @item -mips64r5
22011 @opindex mips64r5
22012 Equivalent to @option{-march=mips64r5}.
22013
22014 @item -mips64r6
22015 @opindex mips64r6
22016 Equivalent to @option{-march=mips64r6}.
22017
22018 @item -mips16
22019 @itemx -mno-mips16
22020 @opindex mips16
22021 @opindex mno-mips16
22022 Generate (do not generate) MIPS16 code. If GCC is targeting a
22023 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
22024
22025 MIPS16 code generation can also be controlled on a per-function basis
22026 by means of @code{mips16} and @code{nomips16} attributes.
22027 @xref{Function Attributes}, for more information.
22028
22029 @item -mflip-mips16
22030 @opindex mflip-mips16
22031 Generate MIPS16 code on alternating functions. This option is provided
22032 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
22033 not intended for ordinary use in compiling user code.
22034
22035 @item -minterlink-compressed
22036 @itemx -mno-interlink-compressed
22037 @opindex minterlink-compressed
22038 @opindex mno-interlink-compressed
22039 Require (do not require) that code using the standard (uncompressed) MIPS ISA
22040 be link-compatible with MIPS16 and microMIPS code, and vice versa.
22041
22042 For example, code using the standard ISA encoding cannot jump directly
22043 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
22044 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
22045 knows that the target of the jump is not compressed.
22046
22047 @item -minterlink-mips16
22048 @itemx -mno-interlink-mips16
22049 @opindex minterlink-mips16
22050 @opindex mno-interlink-mips16
22051 Aliases of @option{-minterlink-compressed} and
22052 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
22053 and are retained for backwards compatibility.
22054
22055 @item -mabi=32
22056 @itemx -mabi=o64
22057 @itemx -mabi=n32
22058 @itemx -mabi=64
22059 @itemx -mabi=eabi
22060 @opindex mabi=32
22061 @opindex mabi=o64
22062 @opindex mabi=n32
22063 @opindex mabi=64
22064 @opindex mabi=eabi
22065 Generate code for the given ABI@.
22066
22067 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
22068 generates 64-bit code when you select a 64-bit architecture, but you
22069 can use @option{-mgp32} to get 32-bit code instead.
22070
22071 For information about the O64 ABI, see
22072 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
22073
22074 GCC supports a variant of the o32 ABI in which floating-point registers
22075 are 64 rather than 32 bits wide. You can select this combination with
22076 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
22077 and @code{mfhc1} instructions and is therefore only supported for
22078 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
22079
22080 The register assignments for arguments and return values remain the
22081 same, but each scalar value is passed in a single 64-bit register
22082 rather than a pair of 32-bit registers. For example, scalar
22083 floating-point values are returned in @samp{$f0} only, not a
22084 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
22085 remains the same in that the even-numbered double-precision registers
22086 are saved.
22087
22088 Two additional variants of the o32 ABI are supported to enable
22089 a transition from 32-bit to 64-bit registers. These are FPXX
22090 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
22091 The FPXX extension mandates that all code must execute correctly
22092 when run using 32-bit or 64-bit registers. The code can be interlinked
22093 with either FP32 or FP64, but not both.
22094 The FP64A extension is similar to the FP64 extension but forbids the
22095 use of odd-numbered single-precision registers. This can be used
22096 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
22097 processors and allows both FP32 and FP64A code to interlink and
22098 run in the same process without changing FPU modes.
22099
22100 @item -mabicalls
22101 @itemx -mno-abicalls
22102 @opindex mabicalls
22103 @opindex mno-abicalls
22104 Generate (do not generate) code that is suitable for SVR4-style
22105 dynamic objects. @option{-mabicalls} is the default for SVR4-based
22106 systems.
22107
22108 @item -mshared
22109 @itemx -mno-shared
22110 Generate (do not generate) code that is fully position-independent,
22111 and that can therefore be linked into shared libraries. This option
22112 only affects @option{-mabicalls}.
22113
22114 All @option{-mabicalls} code has traditionally been position-independent,
22115 regardless of options like @option{-fPIC} and @option{-fpic}. However,
22116 as an extension, the GNU toolchain allows executables to use absolute
22117 accesses for locally-binding symbols. It can also use shorter GP
22118 initialization sequences and generate direct calls to locally-defined
22119 functions. This mode is selected by @option{-mno-shared}.
22120
22121 @option{-mno-shared} depends on binutils 2.16 or higher and generates
22122 objects that can only be linked by the GNU linker. However, the option
22123 does not affect the ABI of the final executable; it only affects the ABI
22124 of relocatable objects. Using @option{-mno-shared} generally makes
22125 executables both smaller and quicker.
22126
22127 @option{-mshared} is the default.
22128
22129 @item -mplt
22130 @itemx -mno-plt
22131 @opindex mplt
22132 @opindex mno-plt
22133 Assume (do not assume) that the static and dynamic linkers
22134 support PLTs and copy relocations. This option only affects
22135 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
22136 has no effect without @option{-msym32}.
22137
22138 You can make @option{-mplt} the default by configuring
22139 GCC with @option{--with-mips-plt}. The default is
22140 @option{-mno-plt} otherwise.
22141
22142 @item -mxgot
22143 @itemx -mno-xgot
22144 @opindex mxgot
22145 @opindex mno-xgot
22146 Lift (do not lift) the usual restrictions on the size of the global
22147 offset table.
22148
22149 GCC normally uses a single instruction to load values from the GOT@.
22150 While this is relatively efficient, it only works if the GOT
22151 is smaller than about 64k. Anything larger causes the linker
22152 to report an error such as:
22153
22154 @cindex relocation truncated to fit (MIPS)
22155 @smallexample
22156 relocation truncated to fit: R_MIPS_GOT16 foobar
22157 @end smallexample
22158
22159 If this happens, you should recompile your code with @option{-mxgot}.
22160 This works with very large GOTs, although the code is also
22161 less efficient, since it takes three instructions to fetch the
22162 value of a global symbol.
22163
22164 Note that some linkers can create multiple GOTs. If you have such a
22165 linker, you should only need to use @option{-mxgot} when a single object
22166 file accesses more than 64k's worth of GOT entries. Very few do.
22167
22168 These options have no effect unless GCC is generating position
22169 independent code.
22170
22171 @item -mgp32
22172 @opindex mgp32
22173 Assume that general-purpose registers are 32 bits wide.
22174
22175 @item -mgp64
22176 @opindex mgp64
22177 Assume that general-purpose registers are 64 bits wide.
22178
22179 @item -mfp32
22180 @opindex mfp32
22181 Assume that floating-point registers are 32 bits wide.
22182
22183 @item -mfp64
22184 @opindex mfp64
22185 Assume that floating-point registers are 64 bits wide.
22186
22187 @item -mfpxx
22188 @opindex mfpxx
22189 Do not assume the width of floating-point registers.
22190
22191 @item -mhard-float
22192 @opindex mhard-float
22193 Use floating-point coprocessor instructions.
22194
22195 @item -msoft-float
22196 @opindex msoft-float
22197 Do not use floating-point coprocessor instructions. Implement
22198 floating-point calculations using library calls instead.
22199
22200 @item -mno-float
22201 @opindex mno-float
22202 Equivalent to @option{-msoft-float}, but additionally asserts that the
22203 program being compiled does not perform any floating-point operations.
22204 This option is presently supported only by some bare-metal MIPS
22205 configurations, where it may select a special set of libraries
22206 that lack all floating-point support (including, for example, the
22207 floating-point @code{printf} formats).
22208 If code compiled with @option{-mno-float} accidentally contains
22209 floating-point operations, it is likely to suffer a link-time
22210 or run-time failure.
22211
22212 @item -msingle-float
22213 @opindex msingle-float
22214 Assume that the floating-point coprocessor only supports single-precision
22215 operations.
22216
22217 @item -mdouble-float
22218 @opindex mdouble-float
22219 Assume that the floating-point coprocessor supports double-precision
22220 operations. This is the default.
22221
22222 @item -modd-spreg
22223 @itemx -mno-odd-spreg
22224 @opindex modd-spreg
22225 @opindex mno-odd-spreg
22226 Enable the use of odd-numbered single-precision floating-point registers
22227 for the o32 ABI. This is the default for processors that are known to
22228 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22229 is set by default.
22230
22231 @item -mabs=2008
22232 @itemx -mabs=legacy
22233 @opindex mabs=2008
22234 @opindex mabs=legacy
22235 These options control the treatment of the special not-a-number (NaN)
22236 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22237 @code{neg.@i{fmt}} machine instructions.
22238
22239 By default or when @option{-mabs=legacy} is used the legacy
22240 treatment is selected. In this case these instructions are considered
22241 arithmetic and avoided where correct operation is required and the
22242 input operand might be a NaN. A longer sequence of instructions that
22243 manipulate the sign bit of floating-point datum manually is used
22244 instead unless the @option{-ffinite-math-only} option has also been
22245 specified.
22246
22247 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
22248 this case these instructions are considered non-arithmetic and therefore
22249 operating correctly in all cases, including in particular where the
22250 input operand is a NaN. These instructions are therefore always used
22251 for the respective operations.
22252
22253 @item -mnan=2008
22254 @itemx -mnan=legacy
22255 @opindex mnan=2008
22256 @opindex mnan=legacy
22257 These options control the encoding of the special not-a-number (NaN)
22258 IEEE 754 floating-point data.
22259
22260 The @option{-mnan=legacy} option selects the legacy encoding. In this
22261 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22262 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22263 by the first bit of their trailing significand field being 1.
22264
22265 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
22266 this case qNaNs are denoted by the first bit of their trailing
22267 significand field being 1, whereas sNaNs are denoted by the first bit of
22268 their trailing significand field being 0.
22269
22270 The default is @option{-mnan=legacy} unless GCC has been configured with
22271 @option{--with-nan=2008}.
22272
22273 @item -mllsc
22274 @itemx -mno-llsc
22275 @opindex mllsc
22276 @opindex mno-llsc
22277 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22278 implement atomic memory built-in functions. When neither option is
22279 specified, GCC uses the instructions if the target architecture
22280 supports them.
22281
22282 @option{-mllsc} is useful if the runtime environment can emulate the
22283 instructions and @option{-mno-llsc} can be useful when compiling for
22284 nonstandard ISAs. You can make either option the default by
22285 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22286 respectively. @option{--with-llsc} is the default for some
22287 configurations; see the installation documentation for details.
22288
22289 @item -mdsp
22290 @itemx -mno-dsp
22291 @opindex mdsp
22292 @opindex mno-dsp
22293 Use (do not use) revision 1 of the MIPS DSP ASE@.
22294 @xref{MIPS DSP Built-in Functions}. This option defines the
22295 preprocessor macro @code{__mips_dsp}. It also defines
22296 @code{__mips_dsp_rev} to 1.
22297
22298 @item -mdspr2
22299 @itemx -mno-dspr2
22300 @opindex mdspr2
22301 @opindex mno-dspr2
22302 Use (do not use) revision 2 of the MIPS DSP ASE@.
22303 @xref{MIPS DSP Built-in Functions}. This option defines the
22304 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22305 It also defines @code{__mips_dsp_rev} to 2.
22306
22307 @item -msmartmips
22308 @itemx -mno-smartmips
22309 @opindex msmartmips
22310 @opindex mno-smartmips
22311 Use (do not use) the MIPS SmartMIPS ASE.
22312
22313 @item -mpaired-single
22314 @itemx -mno-paired-single
22315 @opindex mpaired-single
22316 @opindex mno-paired-single
22317 Use (do not use) paired-single floating-point instructions.
22318 @xref{MIPS Paired-Single Support}. This option requires
22319 hardware floating-point support to be enabled.
22320
22321 @item -mdmx
22322 @itemx -mno-mdmx
22323 @opindex mdmx
22324 @opindex mno-mdmx
22325 Use (do not use) MIPS Digital Media Extension instructions.
22326 This option can only be used when generating 64-bit code and requires
22327 hardware floating-point support to be enabled.
22328
22329 @item -mips3d
22330 @itemx -mno-mips3d
22331 @opindex mips3d
22332 @opindex mno-mips3d
22333 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22334 The option @option{-mips3d} implies @option{-mpaired-single}.
22335
22336 @item -mmicromips
22337 @itemx -mno-micromips
22338 @opindex mmicromips
22339 @opindex mno-mmicromips
22340 Generate (do not generate) microMIPS code.
22341
22342 MicroMIPS code generation can also be controlled on a per-function basis
22343 by means of @code{micromips} and @code{nomicromips} attributes.
22344 @xref{Function Attributes}, for more information.
22345
22346 @item -mmt
22347 @itemx -mno-mt
22348 @opindex mmt
22349 @opindex mno-mt
22350 Use (do not use) MT Multithreading instructions.
22351
22352 @item -mmcu
22353 @itemx -mno-mcu
22354 @opindex mmcu
22355 @opindex mno-mcu
22356 Use (do not use) the MIPS MCU ASE instructions.
22357
22358 @item -meva
22359 @itemx -mno-eva
22360 @opindex meva
22361 @opindex mno-eva
22362 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22363
22364 @item -mvirt
22365 @itemx -mno-virt
22366 @opindex mvirt
22367 @opindex mno-virt
22368 Use (do not use) the MIPS Virtualization (VZ) instructions.
22369
22370 @item -mxpa
22371 @itemx -mno-xpa
22372 @opindex mxpa
22373 @opindex mno-xpa
22374 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22375
22376 @item -mcrc
22377 @itemx -mno-crc
22378 @opindex mcrc
22379 @opindex mno-crc
22380 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22381
22382 @item -mginv
22383 @itemx -mno-ginv
22384 @opindex mginv
22385 @opindex mno-ginv
22386 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22387
22388 @item -mloongson-mmi
22389 @itemx -mno-loongson-mmi
22390 @opindex mloongson-mmi
22391 @opindex mno-loongson-mmi
22392 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22393
22394 @item -mloongson-ext
22395 @itemx -mno-loongson-ext
22396 @opindex mloongson-ext
22397 @opindex mno-loongson-ext
22398 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22399
22400 @item -mloongson-ext2
22401 @itemx -mno-loongson-ext2
22402 @opindex mloongson-ext2
22403 @opindex mno-loongson-ext2
22404 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22405
22406 @item -mlong64
22407 @opindex mlong64
22408 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22409 an explanation of the default and the way that the pointer size is
22410 determined.
22411
22412 @item -mlong32
22413 @opindex mlong32
22414 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22415
22416 The default size of @code{int}s, @code{long}s and pointers depends on
22417 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22418 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22419 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22420 or the same size as integer registers, whichever is smaller.
22421
22422 @item -msym32
22423 @itemx -mno-sym32
22424 @opindex msym32
22425 @opindex mno-sym32
22426 Assume (do not assume) that all symbols have 32-bit values, regardless
22427 of the selected ABI@. This option is useful in combination with
22428 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22429 to generate shorter and faster references to symbolic addresses.
22430
22431 @item -G @var{num}
22432 @opindex G
22433 Put definitions of externally-visible data in a small data section
22434 if that data is no bigger than @var{num} bytes. GCC can then generate
22435 more efficient accesses to the data; see @option{-mgpopt} for details.
22436
22437 The default @option{-G} option depends on the configuration.
22438
22439 @item -mlocal-sdata
22440 @itemx -mno-local-sdata
22441 @opindex mlocal-sdata
22442 @opindex mno-local-sdata
22443 Extend (do not extend) the @option{-G} behavior to local data too,
22444 such as to static variables in C@. @option{-mlocal-sdata} is the
22445 default for all configurations.
22446
22447 If the linker complains that an application is using too much small data,
22448 you might want to try rebuilding the less performance-critical parts with
22449 @option{-mno-local-sdata}. You might also want to build large
22450 libraries with @option{-mno-local-sdata}, so that the libraries leave
22451 more room for the main program.
22452
22453 @item -mextern-sdata
22454 @itemx -mno-extern-sdata
22455 @opindex mextern-sdata
22456 @opindex mno-extern-sdata
22457 Assume (do not assume) that externally-defined data is in
22458 a small data section if the size of that data is within the @option{-G} limit.
22459 @option{-mextern-sdata} is the default for all configurations.
22460
22461 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22462 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22463 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22464 is placed in a small data section. If @var{Var} is defined by another
22465 module, you must either compile that module with a high-enough
22466 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22467 definition. If @var{Var} is common, you must link the application
22468 with a high-enough @option{-G} setting.
22469
22470 The easiest way of satisfying these restrictions is to compile
22471 and link every module with the same @option{-G} option. However,
22472 you may wish to build a library that supports several different
22473 small data limits. You can do this by compiling the library with
22474 the highest supported @option{-G} setting and additionally using
22475 @option{-mno-extern-sdata} to stop the library from making assumptions
22476 about externally-defined data.
22477
22478 @item -mgpopt
22479 @itemx -mno-gpopt
22480 @opindex mgpopt
22481 @opindex mno-gpopt
22482 Use (do not use) GP-relative accesses for symbols that are known to be
22483 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22484 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22485 configurations.
22486
22487 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22488 might not hold the value of @code{_gp}. For example, if the code is
22489 part of a library that might be used in a boot monitor, programs that
22490 call boot monitor routines pass an unknown value in @code{$gp}.
22491 (In such situations, the boot monitor itself is usually compiled
22492 with @option{-G0}.)
22493
22494 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22495 @option{-mno-extern-sdata}.
22496
22497 @item -membedded-data
22498 @itemx -mno-embedded-data
22499 @opindex membedded-data
22500 @opindex mno-embedded-data
22501 Allocate variables to the read-only data section first if possible, then
22502 next in the small data section if possible, otherwise in data. This gives
22503 slightly slower code than the default, but reduces the amount of RAM required
22504 when executing, and thus may be preferred for some embedded systems.
22505
22506 @item -muninit-const-in-rodata
22507 @itemx -mno-uninit-const-in-rodata
22508 @opindex muninit-const-in-rodata
22509 @opindex mno-uninit-const-in-rodata
22510 Put uninitialized @code{const} variables in the read-only data section.
22511 This option is only meaningful in conjunction with @option{-membedded-data}.
22512
22513 @item -mcode-readable=@var{setting}
22514 @opindex mcode-readable
22515 Specify whether GCC may generate code that reads from executable sections.
22516 There are three possible settings:
22517
22518 @table @gcctabopt
22519 @item -mcode-readable=yes
22520 Instructions may freely access executable sections. This is the
22521 default setting.
22522
22523 @item -mcode-readable=pcrel
22524 MIPS16 PC-relative load instructions can access executable sections,
22525 but other instructions must not do so. This option is useful on 4KSc
22526 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22527 It is also useful on processors that can be configured to have a dual
22528 instruction/data SRAM interface and that, like the M4K, automatically
22529 redirect PC-relative loads to the instruction RAM.
22530
22531 @item -mcode-readable=no
22532 Instructions must not access executable sections. This option can be
22533 useful on targets that are configured to have a dual instruction/data
22534 SRAM interface but that (unlike the M4K) do not automatically redirect
22535 PC-relative loads to the instruction RAM.
22536 @end table
22537
22538 @item -msplit-addresses
22539 @itemx -mno-split-addresses
22540 @opindex msplit-addresses
22541 @opindex mno-split-addresses
22542 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22543 relocation operators. This option has been superseded by
22544 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22545
22546 @item -mexplicit-relocs
22547 @itemx -mno-explicit-relocs
22548 @opindex mexplicit-relocs
22549 @opindex mno-explicit-relocs
22550 Use (do not use) assembler relocation operators when dealing with symbolic
22551 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22552 is to use assembler macros instead.
22553
22554 @option{-mexplicit-relocs} is the default if GCC was configured
22555 to use an assembler that supports relocation operators.
22556
22557 @item -mcheck-zero-division
22558 @itemx -mno-check-zero-division
22559 @opindex mcheck-zero-division
22560 @opindex mno-check-zero-division
22561 Trap (do not trap) on integer division by zero.
22562
22563 The default is @option{-mcheck-zero-division}.
22564
22565 @item -mdivide-traps
22566 @itemx -mdivide-breaks
22567 @opindex mdivide-traps
22568 @opindex mdivide-breaks
22569 MIPS systems check for division by zero by generating either a
22570 conditional trap or a break instruction. Using traps results in
22571 smaller code, but is only supported on MIPS II and later. Also, some
22572 versions of the Linux kernel have a bug that prevents trap from
22573 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22574 allow conditional traps on architectures that support them and
22575 @option{-mdivide-breaks} to force the use of breaks.
22576
22577 The default is usually @option{-mdivide-traps}, but this can be
22578 overridden at configure time using @option{--with-divide=breaks}.
22579 Divide-by-zero checks can be completely disabled using
22580 @option{-mno-check-zero-division}.
22581
22582 @item -mload-store-pairs
22583 @itemx -mno-load-store-pairs
22584 @opindex mload-store-pairs
22585 @opindex mno-load-store-pairs
22586 Enable (disable) an optimization that pairs consecutive load or store
22587 instructions to enable load/store bonding. This option is enabled by
22588 default but only takes effect when the selected architecture is known
22589 to support bonding.
22590
22591 @item -mmemcpy
22592 @itemx -mno-memcpy
22593 @opindex mmemcpy
22594 @opindex mno-memcpy
22595 Force (do not force) the use of @code{memcpy} for non-trivial block
22596 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22597 most constant-sized copies.
22598
22599 @item -mlong-calls
22600 @itemx -mno-long-calls
22601 @opindex mlong-calls
22602 @opindex mno-long-calls
22603 Disable (do not disable) use of the @code{jal} instruction. Calling
22604 functions using @code{jal} is more efficient but requires the caller
22605 and callee to be in the same 256 megabyte segment.
22606
22607 This option has no effect on abicalls code. The default is
22608 @option{-mno-long-calls}.
22609
22610 @item -mmad
22611 @itemx -mno-mad
22612 @opindex mmad
22613 @opindex mno-mad
22614 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22615 instructions, as provided by the R4650 ISA@.
22616
22617 @item -mimadd
22618 @itemx -mno-imadd
22619 @opindex mimadd
22620 @opindex mno-imadd
22621 Enable (disable) use of the @code{madd} and @code{msub} integer
22622 instructions. The default is @option{-mimadd} on architectures
22623 that support @code{madd} and @code{msub} except for the 74k
22624 architecture where it was found to generate slower code.
22625
22626 @item -mfused-madd
22627 @itemx -mno-fused-madd
22628 @opindex mfused-madd
22629 @opindex mno-fused-madd
22630 Enable (disable) use of the floating-point multiply-accumulate
22631 instructions, when they are available. The default is
22632 @option{-mfused-madd}.
22633
22634 On the R8000 CPU when multiply-accumulate instructions are used,
22635 the intermediate product is calculated to infinite precision
22636 and is not subject to the FCSR Flush to Zero bit. This may be
22637 undesirable in some circumstances. On other processors the result
22638 is numerically identical to the equivalent computation using
22639 separate multiply, add, subtract and negate instructions.
22640
22641 @item -nocpp
22642 @opindex nocpp
22643 Tell the MIPS assembler to not run its preprocessor over user
22644 assembler files (with a @samp{.s} suffix) when assembling them.
22645
22646 @item -mfix-24k
22647 @itemx -mno-fix-24k
22648 @opindex mfix-24k
22649 @opindex mno-fix-24k
22650 Work around the 24K E48 (lost data on stores during refill) errata.
22651 The workarounds are implemented by the assembler rather than by GCC@.
22652
22653 @item -mfix-r4000
22654 @itemx -mno-fix-r4000
22655 @opindex mfix-r4000
22656 @opindex mno-fix-r4000
22657 Work around certain R4000 CPU errata:
22658 @itemize @minus
22659 @item
22660 A double-word or a variable shift may give an incorrect result if executed
22661 immediately after starting an integer division.
22662 @item
22663 A double-word or a variable shift may give an incorrect result if executed
22664 while an integer multiplication is in progress.
22665 @item
22666 An integer division may give an incorrect result if started in a delay slot
22667 of a taken branch or a jump.
22668 @end itemize
22669
22670 @item -mfix-r4400
22671 @itemx -mno-fix-r4400
22672 @opindex mfix-r4400
22673 @opindex mno-fix-r4400
22674 Work around certain R4400 CPU errata:
22675 @itemize @minus
22676 @item
22677 A double-word or a variable shift may give an incorrect result if executed
22678 immediately after starting an integer division.
22679 @end itemize
22680
22681 @item -mfix-r10000
22682 @itemx -mno-fix-r10000
22683 @opindex mfix-r10000
22684 @opindex mno-fix-r10000
22685 Work around certain R10000 errata:
22686 @itemize @minus
22687 @item
22688 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22689 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22690 @end itemize
22691
22692 This option can only be used if the target architecture supports
22693 branch-likely instructions. @option{-mfix-r10000} is the default when
22694 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22695 otherwise.
22696
22697 @item -mfix-r5900
22698 @itemx -mno-fix-r5900
22699 @opindex mfix-r5900
22700 Do not attempt to schedule the preceding instruction into the delay slot
22701 of a branch instruction placed at the end of a short loop of six
22702 instructions or fewer and always schedule a @code{nop} instruction there
22703 instead. The short loop bug under certain conditions causes loops to
22704 execute only once or twice, due to a hardware bug in the R5900 chip. The
22705 workaround is implemented by the assembler rather than by GCC@.
22706
22707 @item -mfix-rm7000
22708 @itemx -mno-fix-rm7000
22709 @opindex mfix-rm7000
22710 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22711 workarounds are implemented by the assembler rather than by GCC@.
22712
22713 @item -mfix-vr4120
22714 @itemx -mno-fix-vr4120
22715 @opindex mfix-vr4120
22716 Work around certain VR4120 errata:
22717 @itemize @minus
22718 @item
22719 @code{dmultu} does not always produce the correct result.
22720 @item
22721 @code{div} and @code{ddiv} do not always produce the correct result if one
22722 of the operands is negative.
22723 @end itemize
22724 The workarounds for the division errata rely on special functions in
22725 @file{libgcc.a}. At present, these functions are only provided by
22726 the @code{mips64vr*-elf} configurations.
22727
22728 Other VR4120 errata require a NOP to be inserted between certain pairs of
22729 instructions. These errata are handled by the assembler, not by GCC itself.
22730
22731 @item -mfix-vr4130
22732 @opindex mfix-vr4130
22733 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22734 workarounds are implemented by the assembler rather than by GCC,
22735 although GCC avoids using @code{mflo} and @code{mfhi} if the
22736 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22737 instructions are available instead.
22738
22739 @item -mfix-sb1
22740 @itemx -mno-fix-sb1
22741 @opindex mfix-sb1
22742 Work around certain SB-1 CPU core errata.
22743 (This flag currently works around the SB-1 revision 2
22744 ``F1'' and ``F2'' floating-point errata.)
22745
22746 @item -mr10k-cache-barrier=@var{setting}
22747 @opindex mr10k-cache-barrier
22748 Specify whether GCC should insert cache barriers to avoid the
22749 side effects of speculation on R10K processors.
22750
22751 In common with many processors, the R10K tries to predict the outcome
22752 of a conditional branch and speculatively executes instructions from
22753 the ``taken'' branch. It later aborts these instructions if the
22754 predicted outcome is wrong. However, on the R10K, even aborted
22755 instructions can have side effects.
22756
22757 This problem only affects kernel stores and, depending on the system,
22758 kernel loads. As an example, a speculatively-executed store may load
22759 the target memory into cache and mark the cache line as dirty, even if
22760 the store itself is later aborted. If a DMA operation writes to the
22761 same area of memory before the ``dirty'' line is flushed, the cached
22762 data overwrites the DMA-ed data. See the R10K processor manual
22763 for a full description, including other potential problems.
22764
22765 One workaround is to insert cache barrier instructions before every memory
22766 access that might be speculatively executed and that might have side
22767 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22768 controls GCC's implementation of this workaround. It assumes that
22769 aborted accesses to any byte in the following regions does not have
22770 side effects:
22771
22772 @enumerate
22773 @item
22774 the memory occupied by the current function's stack frame;
22775
22776 @item
22777 the memory occupied by an incoming stack argument;
22778
22779 @item
22780 the memory occupied by an object with a link-time-constant address.
22781 @end enumerate
22782
22783 It is the kernel's responsibility to ensure that speculative
22784 accesses to these regions are indeed safe.
22785
22786 If the input program contains a function declaration such as:
22787
22788 @smallexample
22789 void foo (void);
22790 @end smallexample
22791
22792 then the implementation of @code{foo} must allow @code{j foo} and
22793 @code{jal foo} to be executed speculatively. GCC honors this
22794 restriction for functions it compiles itself. It expects non-GCC
22795 functions (such as hand-written assembly code) to do the same.
22796
22797 The option has three forms:
22798
22799 @table @gcctabopt
22800 @item -mr10k-cache-barrier=load-store
22801 Insert a cache barrier before a load or store that might be
22802 speculatively executed and that might have side effects even
22803 if aborted.
22804
22805 @item -mr10k-cache-barrier=store
22806 Insert a cache barrier before a store that might be speculatively
22807 executed and that might have side effects even if aborted.
22808
22809 @item -mr10k-cache-barrier=none
22810 Disable the insertion of cache barriers. This is the default setting.
22811 @end table
22812
22813 @item -mflush-func=@var{func}
22814 @itemx -mno-flush-func
22815 @opindex mflush-func
22816 Specifies the function to call to flush the I and D caches, or to not
22817 call any such function. If called, the function must take the same
22818 arguments as the common @code{_flush_func}, that is, the address of the
22819 memory range for which the cache is being flushed, the size of the
22820 memory range, and the number 3 (to flush both caches). The default
22821 depends on the target GCC was configured for, but commonly is either
22822 @code{_flush_func} or @code{__cpu_flush}.
22823
22824 @item mbranch-cost=@var{num}
22825 @opindex mbranch-cost
22826 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22827 This cost is only a heuristic and is not guaranteed to produce
22828 consistent results across releases. A zero cost redundantly selects
22829 the default, which is based on the @option{-mtune} setting.
22830
22831 @item -mbranch-likely
22832 @itemx -mno-branch-likely
22833 @opindex mbranch-likely
22834 @opindex mno-branch-likely
22835 Enable or disable use of Branch Likely instructions, regardless of the
22836 default for the selected architecture. By default, Branch Likely
22837 instructions may be generated if they are supported by the selected
22838 architecture. An exception is for the MIPS32 and MIPS64 architectures
22839 and processors that implement those architectures; for those, Branch
22840 Likely instructions are not be generated by default because the MIPS32
22841 and MIPS64 architectures specifically deprecate their use.
22842
22843 @item -mcompact-branches=never
22844 @itemx -mcompact-branches=optimal
22845 @itemx -mcompact-branches=always
22846 @opindex mcompact-branches=never
22847 @opindex mcompact-branches=optimal
22848 @opindex mcompact-branches=always
22849 These options control which form of branches will be generated. The
22850 default is @option{-mcompact-branches=optimal}.
22851
22852 The @option{-mcompact-branches=never} option ensures that compact branch
22853 instructions will never be generated.
22854
22855 The @option{-mcompact-branches=always} option ensures that a compact
22856 branch instruction will be generated if available. If a compact branch
22857 instruction is not available, a delay slot form of the branch will be
22858 used instead.
22859
22860 This option is supported from MIPS Release 6 onwards.
22861
22862 The @option{-mcompact-branches=optimal} option will cause a delay slot
22863 branch to be used if one is available in the current ISA and the delay
22864 slot is successfully filled. If the delay slot is not filled, a compact
22865 branch will be chosen if one is available.
22866
22867 @item -mfp-exceptions
22868 @itemx -mno-fp-exceptions
22869 @opindex mfp-exceptions
22870 Specifies whether FP exceptions are enabled. This affects how
22871 FP instructions are scheduled for some processors.
22872 The default is that FP exceptions are
22873 enabled.
22874
22875 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22876 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22877 FP pipe.
22878
22879 @item -mvr4130-align
22880 @itemx -mno-vr4130-align
22881 @opindex mvr4130-align
22882 The VR4130 pipeline is two-way superscalar, but can only issue two
22883 instructions together if the first one is 8-byte aligned. When this
22884 option is enabled, GCC aligns pairs of instructions that it
22885 thinks should execute in parallel.
22886
22887 This option only has an effect when optimizing for the VR4130.
22888 It normally makes code faster, but at the expense of making it bigger.
22889 It is enabled by default at optimization level @option{-O3}.
22890
22891 @item -msynci
22892 @itemx -mno-synci
22893 @opindex msynci
22894 Enable (disable) generation of @code{synci} instructions on
22895 architectures that support it. The @code{synci} instructions (if
22896 enabled) are generated when @code{__builtin___clear_cache} is
22897 compiled.
22898
22899 This option defaults to @option{-mno-synci}, but the default can be
22900 overridden by configuring GCC with @option{--with-synci}.
22901
22902 When compiling code for single processor systems, it is generally safe
22903 to use @code{synci}. However, on many multi-core (SMP) systems, it
22904 does not invalidate the instruction caches on all cores and may lead
22905 to undefined behavior.
22906
22907 @item -mrelax-pic-calls
22908 @itemx -mno-relax-pic-calls
22909 @opindex mrelax-pic-calls
22910 Try to turn PIC calls that are normally dispatched via register
22911 @code{$25} into direct calls. This is only possible if the linker can
22912 resolve the destination at link time and if the destination is within
22913 range for a direct call.
22914
22915 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22916 an assembler and a linker that support the @code{.reloc} assembly
22917 directive and @option{-mexplicit-relocs} is in effect. With
22918 @option{-mno-explicit-relocs}, this optimization can be performed by the
22919 assembler and the linker alone without help from the compiler.
22920
22921 @item -mmcount-ra-address
22922 @itemx -mno-mcount-ra-address
22923 @opindex mmcount-ra-address
22924 @opindex mno-mcount-ra-address
22925 Emit (do not emit) code that allows @code{_mcount} to modify the
22926 calling function's return address. When enabled, this option extends
22927 the usual @code{_mcount} interface with a new @var{ra-address}
22928 parameter, which has type @code{intptr_t *} and is passed in register
22929 @code{$12}. @code{_mcount} can then modify the return address by
22930 doing both of the following:
22931 @itemize
22932 @item
22933 Returning the new address in register @code{$31}.
22934 @item
22935 Storing the new address in @code{*@var{ra-address}},
22936 if @var{ra-address} is nonnull.
22937 @end itemize
22938
22939 The default is @option{-mno-mcount-ra-address}.
22940
22941 @item -mframe-header-opt
22942 @itemx -mno-frame-header-opt
22943 @opindex mframe-header-opt
22944 Enable (disable) frame header optimization in the o32 ABI. When using the
22945 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22946 function to write out register arguments. When enabled, this optimization
22947 will suppress the allocation of the frame header if it can be determined that
22948 it is unused.
22949
22950 This optimization is off by default at all optimization levels.
22951
22952 @item -mlxc1-sxc1
22953 @itemx -mno-lxc1-sxc1
22954 @opindex mlxc1-sxc1
22955 When applicable, enable (disable) the generation of @code{lwxc1},
22956 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22957
22958 @item -mmadd4
22959 @itemx -mno-madd4
22960 @opindex mmadd4
22961 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22962 @code{madd.d} and related instructions. Enabled by default.
22963
22964 @end table
22965
22966 @node MMIX Options
22967 @subsection MMIX Options
22968 @cindex MMIX Options
22969
22970 These options are defined for the MMIX:
22971
22972 @table @gcctabopt
22973 @item -mlibfuncs
22974 @itemx -mno-libfuncs
22975 @opindex mlibfuncs
22976 @opindex mno-libfuncs
22977 Specify that intrinsic library functions are being compiled, passing all
22978 values in registers, no matter the size.
22979
22980 @item -mepsilon
22981 @itemx -mno-epsilon
22982 @opindex mepsilon
22983 @opindex mno-epsilon
22984 Generate floating-point comparison instructions that compare with respect
22985 to the @code{rE} epsilon register.
22986
22987 @item -mabi=mmixware
22988 @itemx -mabi=gnu
22989 @opindex mabi=mmixware
22990 @opindex mabi=gnu
22991 Generate code that passes function parameters and return values that (in
22992 the called function) are seen as registers @code{$0} and up, as opposed to
22993 the GNU ABI which uses global registers @code{$231} and up.
22994
22995 @item -mzero-extend
22996 @itemx -mno-zero-extend
22997 @opindex mzero-extend
22998 @opindex mno-zero-extend
22999 When reading data from memory in sizes shorter than 64 bits, use (do not
23000 use) zero-extending load instructions by default, rather than
23001 sign-extending ones.
23002
23003 @item -mknuthdiv
23004 @itemx -mno-knuthdiv
23005 @opindex mknuthdiv
23006 @opindex mno-knuthdiv
23007 Make the result of a division yielding a remainder have the same sign as
23008 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
23009 remainder follows the sign of the dividend. Both methods are
23010 arithmetically valid, the latter being almost exclusively used.
23011
23012 @item -mtoplevel-symbols
23013 @itemx -mno-toplevel-symbols
23014 @opindex mtoplevel-symbols
23015 @opindex mno-toplevel-symbols
23016 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
23017 code can be used with the @code{PREFIX} assembly directive.
23018
23019 @item -melf
23020 @opindex melf
23021 Generate an executable in the ELF format, rather than the default
23022 @samp{mmo} format used by the @command{mmix} simulator.
23023
23024 @item -mbranch-predict
23025 @itemx -mno-branch-predict
23026 @opindex mbranch-predict
23027 @opindex mno-branch-predict
23028 Use (do not use) the probable-branch instructions, when static branch
23029 prediction indicates a probable branch.
23030
23031 @item -mbase-addresses
23032 @itemx -mno-base-addresses
23033 @opindex mbase-addresses
23034 @opindex mno-base-addresses
23035 Generate (do not generate) code that uses @emph{base addresses}. Using a
23036 base address automatically generates a request (handled by the assembler
23037 and the linker) for a constant to be set up in a global register. The
23038 register is used for one or more base address requests within the range 0
23039 to 255 from the value held in the register. The generally leads to short
23040 and fast code, but the number of different data items that can be
23041 addressed is limited. This means that a program that uses lots of static
23042 data may require @option{-mno-base-addresses}.
23043
23044 @item -msingle-exit
23045 @itemx -mno-single-exit
23046 @opindex msingle-exit
23047 @opindex mno-single-exit
23048 Force (do not force) generated code to have a single exit point in each
23049 function.
23050 @end table
23051
23052 @node MN10300 Options
23053 @subsection MN10300 Options
23054 @cindex MN10300 options
23055
23056 These @option{-m} options are defined for Matsushita MN10300 architectures:
23057
23058 @table @gcctabopt
23059 @item -mmult-bug
23060 @opindex mmult-bug
23061 Generate code to avoid bugs in the multiply instructions for the MN10300
23062 processors. This is the default.
23063
23064 @item -mno-mult-bug
23065 @opindex mno-mult-bug
23066 Do not generate code to avoid bugs in the multiply instructions for the
23067 MN10300 processors.
23068
23069 @item -mam33
23070 @opindex mam33
23071 Generate code using features specific to the AM33 processor.
23072
23073 @item -mno-am33
23074 @opindex mno-am33
23075 Do not generate code using features specific to the AM33 processor. This
23076 is the default.
23077
23078 @item -mam33-2
23079 @opindex mam33-2
23080 Generate code using features specific to the AM33/2.0 processor.
23081
23082 @item -mam34
23083 @opindex mam34
23084 Generate code using features specific to the AM34 processor.
23085
23086 @item -mtune=@var{cpu-type}
23087 @opindex mtune
23088 Use the timing characteristics of the indicated CPU type when
23089 scheduling instructions. This does not change the targeted processor
23090 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
23091 @samp{am33-2} or @samp{am34}.
23092
23093 @item -mreturn-pointer-on-d0
23094 @opindex mreturn-pointer-on-d0
23095 When generating a function that returns a pointer, return the pointer
23096 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
23097 only in @code{a0}, and attempts to call such functions without a prototype
23098 result in errors. Note that this option is on by default; use
23099 @option{-mno-return-pointer-on-d0} to disable it.
23100
23101 @item -mno-crt0
23102 @opindex mno-crt0
23103 Do not link in the C run-time initialization object file.
23104
23105 @item -mrelax
23106 @opindex mrelax
23107 Indicate to the linker that it should perform a relaxation optimization pass
23108 to shorten branches, calls and absolute memory addresses. This option only
23109 has an effect when used on the command line for the final link step.
23110
23111 This option makes symbolic debugging impossible.
23112
23113 @item -mliw
23114 @opindex mliw
23115 Allow the compiler to generate @emph{Long Instruction Word}
23116 instructions if the target is the @samp{AM33} or later. This is the
23117 default. This option defines the preprocessor macro @code{__LIW__}.
23118
23119 @item -mno-liw
23120 @opindex mno-liw
23121 Do not allow the compiler to generate @emph{Long Instruction Word}
23122 instructions. This option defines the preprocessor macro
23123 @code{__NO_LIW__}.
23124
23125 @item -msetlb
23126 @opindex msetlb
23127 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
23128 instructions if the target is the @samp{AM33} or later. This is the
23129 default. This option defines the preprocessor macro @code{__SETLB__}.
23130
23131 @item -mno-setlb
23132 @opindex mno-setlb
23133 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
23134 instructions. This option defines the preprocessor macro
23135 @code{__NO_SETLB__}.
23136
23137 @end table
23138
23139 @node Moxie Options
23140 @subsection Moxie Options
23141 @cindex Moxie Options
23142
23143 @table @gcctabopt
23144
23145 @item -meb
23146 @opindex meb
23147 Generate big-endian code. This is the default for @samp{moxie-*-*}
23148 configurations.
23149
23150 @item -mel
23151 @opindex mel
23152 Generate little-endian code.
23153
23154 @item -mmul.x
23155 @opindex mmul.x
23156 Generate mul.x and umul.x instructions. This is the default for
23157 @samp{moxiebox-*-*} configurations.
23158
23159 @item -mno-crt0
23160 @opindex mno-crt0
23161 Do not link in the C run-time initialization object file.
23162
23163 @end table
23164
23165 @node MSP430 Options
23166 @subsection MSP430 Options
23167 @cindex MSP430 Options
23168
23169 These options are defined for the MSP430:
23170
23171 @table @gcctabopt
23172
23173 @item -masm-hex
23174 @opindex masm-hex
23175 Force assembly output to always use hex constants. Normally such
23176 constants are signed decimals, but this option is available for
23177 testsuite and/or aesthetic purposes.
23178
23179 @item -mmcu=
23180 @opindex mmcu=
23181 Select the MCU to target. This is used to create a C preprocessor
23182 symbol based upon the MCU name, converted to upper case and pre- and
23183 post-fixed with @samp{__}. This in turn is used by the
23184 @file{msp430.h} header file to select an MCU-specific supplementary
23185 header file.
23186
23187 The option also sets the ISA to use. If the MCU name is one that is
23188 known to only support the 430 ISA then that is selected, otherwise the
23189 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
23190 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
23191 name selects the 430X ISA.
23192
23193 In addition an MCU-specific linker script is added to the linker
23194 command line. The script's name is the name of the MCU with
23195 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
23196 command line defines the C preprocessor symbol @code{__XXX__} and
23197 cause the linker to search for a script called @file{xxx.ld}.
23198
23199 The ISA and hardware multiply supported for the different MCUs is hard-coded
23200 into GCC. However, an external @samp{devices.csv} file can be used to
23201 extend device support beyond those that have been hard-coded.
23202
23203 GCC searches for the @samp{devices.csv} file on the paths specified
23204 with the @code{-I} and @code{-L} options.
23205
23206 @item -mwarn-mcu
23207 @itemx -mno-warn-mcu
23208 @opindex mwarn-mcu
23209 @opindex mno-warn-mcu
23210 This option enables or disables warnings about conflicts between the
23211 MCU name specified by the @option{-mmcu} option and the ISA set by the
23212 @option{-mcpu} option and/or the hardware multiply support set by the
23213 @option{-mhwmult} option. It also toggles warnings about unrecognized
23214 MCU names. This option is on by default.
23215
23216 @item -mcpu=
23217 @opindex mcpu=
23218 Specifies the ISA to use. Accepted values are @samp{msp430},
23219 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
23220 @option{-mmcu=} option should be used to select the ISA.
23221
23222 @item -msim
23223 @opindex msim
23224 Link to the simulator runtime libraries and linker script. Overrides
23225 any scripts that would be selected by the @option{-mmcu=} option.
23226
23227 @item -mlarge
23228 @opindex mlarge
23229 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23230
23231 @item -msmall
23232 @opindex msmall
23233 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23234
23235 @item -mrelax
23236 @opindex mrelax
23237 This option is passed to the assembler and linker, and allows the
23238 linker to perform certain optimizations that cannot be done until
23239 the final link.
23240
23241 @item mhwmult=
23242 @opindex mhwmult=
23243 Describes the type of hardware multiply supported by the target.
23244 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23245 for the original 16-bit-only multiply supported by early MCUs.
23246 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23247 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23248 A value of @samp{auto} can also be given. This tells GCC to deduce
23249 the hardware multiply support based upon the MCU name provided by the
23250 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
23251 the MCU name is not recognized then no hardware multiply support is
23252 assumed. @code{auto} is the default setting.
23253
23254 Hardware multiplies are normally performed by calling a library
23255 routine. This saves space in the generated code. When compiling at
23256 @option{-O3} or higher however the hardware multiplier is invoked
23257 inline. This makes for bigger, but faster code.
23258
23259 The hardware multiply routines disable interrupts whilst running and
23260 restore the previous interrupt state when they finish. This makes
23261 them safe to use inside interrupt handlers as well as in normal code.
23262
23263 @item -minrt
23264 @opindex minrt
23265 Enable the use of a minimum runtime environment - no static
23266 initializers or constructors. This is intended for memory-constrained
23267 devices. The compiler includes special symbols in some objects
23268 that tell the linker and runtime which code fragments are required.
23269
23270 @item -mcode-region=
23271 @itemx -mdata-region=
23272 @opindex mcode-region
23273 @opindex mdata-region
23274 These options tell the compiler where to place functions and data that
23275 do not have one of the @code{lower}, @code{upper}, @code{either} or
23276 @code{section} attributes. Possible values are @code{lower},
23277 @code{upper}, @code{either} or @code{any}. The first three behave
23278 like the corresponding attribute. The fourth possible value -
23279 @code{any} - is the default. It leaves placement entirely up to the
23280 linker script and how it assigns the standard sections
23281 (@code{.text}, @code{.data}, etc) to the memory regions.
23282
23283 @item -msilicon-errata=
23284 @opindex msilicon-errata
23285 This option passes on a request to assembler to enable the fixes for
23286 the named silicon errata.
23287
23288 @item -msilicon-errata-warn=
23289 @opindex msilicon-errata-warn
23290 This option passes on a request to the assembler to enable warning
23291 messages when a silicon errata might need to be applied.
23292
23293 @item -mwarn-devices-csv
23294 @itemx -mno-warn-devices-csv
23295 @opindex mwarn-devices-csv
23296 @opindex mno-warn-devices-csv
23297 Warn if @samp{devices.csv} is not found or there are problem parsing it
23298 (default: on).
23299
23300 @end table
23301
23302 @node NDS32 Options
23303 @subsection NDS32 Options
23304 @cindex NDS32 Options
23305
23306 These options are defined for NDS32 implementations:
23307
23308 @table @gcctabopt
23309
23310 @item -mbig-endian
23311 @opindex mbig-endian
23312 Generate code in big-endian mode.
23313
23314 @item -mlittle-endian
23315 @opindex mlittle-endian
23316 Generate code in little-endian mode.
23317
23318 @item -mreduced-regs
23319 @opindex mreduced-regs
23320 Use reduced-set registers for register allocation.
23321
23322 @item -mfull-regs
23323 @opindex mfull-regs
23324 Use full-set registers for register allocation.
23325
23326 @item -mcmov
23327 @opindex mcmov
23328 Generate conditional move instructions.
23329
23330 @item -mno-cmov
23331 @opindex mno-cmov
23332 Do not generate conditional move instructions.
23333
23334 @item -mext-perf
23335 @opindex mext-perf
23336 Generate performance extension instructions.
23337
23338 @item -mno-ext-perf
23339 @opindex mno-ext-perf
23340 Do not generate performance extension instructions.
23341
23342 @item -mext-perf2
23343 @opindex mext-perf2
23344 Generate performance extension 2 instructions.
23345
23346 @item -mno-ext-perf2
23347 @opindex mno-ext-perf2
23348 Do not generate performance extension 2 instructions.
23349
23350 @item -mext-string
23351 @opindex mext-string
23352 Generate string extension instructions.
23353
23354 @item -mno-ext-string
23355 @opindex mno-ext-string
23356 Do not generate string extension instructions.
23357
23358 @item -mv3push
23359 @opindex mv3push
23360 Generate v3 push25/pop25 instructions.
23361
23362 @item -mno-v3push
23363 @opindex mno-v3push
23364 Do not generate v3 push25/pop25 instructions.
23365
23366 @item -m16-bit
23367 @opindex m16-bit
23368 Generate 16-bit instructions.
23369
23370 @item -mno-16-bit
23371 @opindex mno-16-bit
23372 Do not generate 16-bit instructions.
23373
23374 @item -misr-vector-size=@var{num}
23375 @opindex misr-vector-size
23376 Specify the size of each interrupt vector, which must be 4 or 16.
23377
23378 @item -mcache-block-size=@var{num}
23379 @opindex mcache-block-size
23380 Specify the size of each cache block,
23381 which must be a power of 2 between 4 and 512.
23382
23383 @item -march=@var{arch}
23384 @opindex march
23385 Specify the name of the target architecture.
23386
23387 @item -mcmodel=@var{code-model}
23388 @opindex mcmodel
23389 Set the code model to one of
23390 @table @asis
23391 @item @samp{small}
23392 All the data and read-only data segments must be within 512KB addressing space.
23393 The text segment must be within 16MB addressing space.
23394 @item @samp{medium}
23395 The data segment must be within 512KB while the read-only data segment can be
23396 within 4GB addressing space. The text segment should be still within 16MB
23397 addressing space.
23398 @item @samp{large}
23399 All the text and data segments can be within 4GB addressing space.
23400 @end table
23401
23402 @item -mctor-dtor
23403 @opindex mctor-dtor
23404 Enable constructor/destructor feature.
23405
23406 @item -mrelax
23407 @opindex mrelax
23408 Guide linker to relax instructions.
23409
23410 @end table
23411
23412 @node Nios II Options
23413 @subsection Nios II Options
23414 @cindex Nios II options
23415 @cindex Altera Nios II options
23416
23417 These are the options defined for the Altera Nios II processor.
23418
23419 @table @gcctabopt
23420
23421 @item -G @var{num}
23422 @opindex G
23423 @cindex smaller data references
23424 Put global and static objects less than or equal to @var{num} bytes
23425 into the small data or BSS sections instead of the normal data or BSS
23426 sections. The default value of @var{num} is 8.
23427
23428 @item -mgpopt=@var{option}
23429 @itemx -mgpopt
23430 @itemx -mno-gpopt
23431 @opindex mgpopt
23432 @opindex mno-gpopt
23433 Generate (do not generate) GP-relative accesses. The following
23434 @var{option} names are recognized:
23435
23436 @table @samp
23437
23438 @item none
23439 Do not generate GP-relative accesses.
23440
23441 @item local
23442 Generate GP-relative accesses for small data objects that are not
23443 external, weak, or uninitialized common symbols.
23444 Also use GP-relative addressing for objects that
23445 have been explicitly placed in a small data section via a @code{section}
23446 attribute.
23447
23448 @item global
23449 As for @samp{local}, but also generate GP-relative accesses for
23450 small data objects that are external, weak, or common. If you use this option,
23451 you must ensure that all parts of your program (including libraries) are
23452 compiled with the same @option{-G} setting.
23453
23454 @item data
23455 Generate GP-relative accesses for all data objects in the program. If you
23456 use this option, the entire data and BSS segments
23457 of your program must fit in 64K of memory and you must use an appropriate
23458 linker script to allocate them within the addressable range of the
23459 global pointer.
23460
23461 @item all
23462 Generate GP-relative addresses for function pointers as well as data
23463 pointers. If you use this option, the entire text, data, and BSS segments
23464 of your program must fit in 64K of memory and you must use an appropriate
23465 linker script to allocate them within the addressable range of the
23466 global pointer.
23467
23468 @end table
23469
23470 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23471 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23472
23473 The default is @option{-mgpopt} except when @option{-fpic} or
23474 @option{-fPIC} is specified to generate position-independent code.
23475 Note that the Nios II ABI does not permit GP-relative accesses from
23476 shared libraries.
23477
23478 You may need to specify @option{-mno-gpopt} explicitly when building
23479 programs that include large amounts of small data, including large
23480 GOT data sections. In this case, the 16-bit offset for GP-relative
23481 addressing may not be large enough to allow access to the entire
23482 small data section.
23483
23484 @item -mgprel-sec=@var{regexp}
23485 @opindex mgprel-sec
23486 This option specifies additional section names that can be accessed via
23487 GP-relative addressing. It is most useful in conjunction with
23488 @code{section} attributes on variable declarations
23489 (@pxref{Common Variable Attributes}) and a custom linker script.
23490 The @var{regexp} is a POSIX Extended Regular Expression.
23491
23492 This option does not affect the behavior of the @option{-G} option, and
23493 the specified sections are in addition to the standard @code{.sdata}
23494 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23495
23496 @item -mr0rel-sec=@var{regexp}
23497 @opindex mr0rel-sec
23498 This option specifies names of sections that can be accessed via a
23499 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23500 of the 32-bit address space. It is most useful in conjunction with
23501 @code{section} attributes on variable declarations
23502 (@pxref{Common Variable Attributes}) and a custom linker script.
23503 The @var{regexp} is a POSIX Extended Regular Expression.
23504
23505 In contrast to the use of GP-relative addressing for small data,
23506 zero-based addressing is never generated by default and there are no
23507 conventional section names used in standard linker scripts for sections
23508 in the low or high areas of memory.
23509
23510 @item -mel
23511 @itemx -meb
23512 @opindex mel
23513 @opindex meb
23514 Generate little-endian (default) or big-endian (experimental) code,
23515 respectively.
23516
23517 @item -march=@var{arch}
23518 @opindex march
23519 This specifies the name of the target Nios II architecture. GCC uses this
23520 name to determine what kind of instructions it can emit when generating
23521 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23522
23523 The preprocessor macro @code{__nios2_arch__} is available to programs,
23524 with value 1 or 2, indicating the targeted ISA level.
23525
23526 @item -mbypass-cache
23527 @itemx -mno-bypass-cache
23528 @opindex mno-bypass-cache
23529 @opindex mbypass-cache
23530 Force all load and store instructions to always bypass cache by
23531 using I/O variants of the instructions. The default is not to
23532 bypass the cache.
23533
23534 @item -mno-cache-volatile
23535 @itemx -mcache-volatile
23536 @opindex mcache-volatile
23537 @opindex mno-cache-volatile
23538 Volatile memory access bypass the cache using the I/O variants of
23539 the load and store instructions. The default is not to bypass the cache.
23540
23541 @item -mno-fast-sw-div
23542 @itemx -mfast-sw-div
23543 @opindex mno-fast-sw-div
23544 @opindex mfast-sw-div
23545 Do not use table-based fast divide for small numbers. The default
23546 is to use the fast divide at @option{-O3} and above.
23547
23548 @item -mno-hw-mul
23549 @itemx -mhw-mul
23550 @itemx -mno-hw-mulx
23551 @itemx -mhw-mulx
23552 @itemx -mno-hw-div
23553 @itemx -mhw-div
23554 @opindex mno-hw-mul
23555 @opindex mhw-mul
23556 @opindex mno-hw-mulx
23557 @opindex mhw-mulx
23558 @opindex mno-hw-div
23559 @opindex mhw-div
23560 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23561 instructions by the compiler. The default is to emit @code{mul}
23562 and not emit @code{div} and @code{mulx}.
23563
23564 @item -mbmx
23565 @itemx -mno-bmx
23566 @itemx -mcdx
23567 @itemx -mno-cdx
23568 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23569 CDX (code density) instructions. Enabling these instructions also
23570 requires @option{-march=r2}. Since these instructions are optional
23571 extensions to the R2 architecture, the default is not to emit them.
23572
23573 @item -mcustom-@var{insn}=@var{N}
23574 @itemx -mno-custom-@var{insn}
23575 @opindex mcustom-@var{insn}
23576 @opindex mno-custom-@var{insn}
23577 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23578 custom instruction with encoding @var{N} when generating code that uses
23579 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23580 instruction 253 for single-precision floating-point add operations instead
23581 of the default behavior of using a library call.
23582
23583 The following values of @var{insn} are supported. Except as otherwise
23584 noted, floating-point operations are expected to be implemented with
23585 normal IEEE 754 semantics and correspond directly to the C operators or the
23586 equivalent GCC built-in functions (@pxref{Other Builtins}).
23587
23588 Single-precision floating point:
23589 @table @asis
23590
23591 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23592 Binary arithmetic operations.
23593
23594 @item @samp{fnegs}
23595 Unary negation.
23596
23597 @item @samp{fabss}
23598 Unary absolute value.
23599
23600 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23601 Comparison operations.
23602
23603 @item @samp{fmins}, @samp{fmaxs}
23604 Floating-point minimum and maximum. These instructions are only
23605 generated if @option{-ffinite-math-only} is specified.
23606
23607 @item @samp{fsqrts}
23608 Unary square root operation.
23609
23610 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23611 Floating-point trigonometric and exponential functions. These instructions
23612 are only generated if @option{-funsafe-math-optimizations} is also specified.
23613
23614 @end table
23615
23616 Double-precision floating point:
23617 @table @asis
23618
23619 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23620 Binary arithmetic operations.
23621
23622 @item @samp{fnegd}
23623 Unary negation.
23624
23625 @item @samp{fabsd}
23626 Unary absolute value.
23627
23628 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23629 Comparison operations.
23630
23631 @item @samp{fmind}, @samp{fmaxd}
23632 Double-precision minimum and maximum. These instructions are only
23633 generated if @option{-ffinite-math-only} is specified.
23634
23635 @item @samp{fsqrtd}
23636 Unary square root operation.
23637
23638 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23639 Double-precision trigonometric and exponential functions. These instructions
23640 are only generated if @option{-funsafe-math-optimizations} is also specified.
23641
23642 @end table
23643
23644 Conversions:
23645 @table @asis
23646 @item @samp{fextsd}
23647 Conversion from single precision to double precision.
23648
23649 @item @samp{ftruncds}
23650 Conversion from double precision to single precision.
23651
23652 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23653 Conversion from floating point to signed or unsigned integer types, with
23654 truncation towards zero.
23655
23656 @item @samp{round}
23657 Conversion from single-precision floating point to signed integer,
23658 rounding to the nearest integer and ties away from zero.
23659 This corresponds to the @code{__builtin_lroundf} function when
23660 @option{-fno-math-errno} is used.
23661
23662 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23663 Conversion from signed or unsigned integer types to floating-point types.
23664
23665 @end table
23666
23667 In addition, all of the following transfer instructions for internal
23668 registers X and Y must be provided to use any of the double-precision
23669 floating-point instructions. Custom instructions taking two
23670 double-precision source operands expect the first operand in the
23671 64-bit register X. The other operand (or only operand of a unary
23672 operation) is given to the custom arithmetic instruction with the
23673 least significant half in source register @var{src1} and the most
23674 significant half in @var{src2}. A custom instruction that returns a
23675 double-precision result returns the most significant 32 bits in the
23676 destination register and the other half in 32-bit register Y.
23677 GCC automatically generates the necessary code sequences to write
23678 register X and/or read register Y when double-precision floating-point
23679 instructions are used.
23680
23681 @table @asis
23682
23683 @item @samp{fwrx}
23684 Write @var{src1} into the least significant half of X and @var{src2} into
23685 the most significant half of X.
23686
23687 @item @samp{fwry}
23688 Write @var{src1} into Y.
23689
23690 @item @samp{frdxhi}, @samp{frdxlo}
23691 Read the most or least (respectively) significant half of X and store it in
23692 @var{dest}.
23693
23694 @item @samp{frdy}
23695 Read the value of Y and store it into @var{dest}.
23696 @end table
23697
23698 Note that you can gain more local control over generation of Nios II custom
23699 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23700 and @code{target("no-custom-@var{insn}")} function attributes
23701 (@pxref{Function Attributes})
23702 or pragmas (@pxref{Function Specific Option Pragmas}).
23703
23704 @item -mcustom-fpu-cfg=@var{name}
23705 @opindex mcustom-fpu-cfg
23706
23707 This option enables a predefined, named set of custom instruction encodings
23708 (see @option{-mcustom-@var{insn}} above).
23709 Currently, the following sets are defined:
23710
23711 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23712 @gccoptlist{-mcustom-fmuls=252 @gol
23713 -mcustom-fadds=253 @gol
23714 -mcustom-fsubs=254 @gol
23715 -fsingle-precision-constant}
23716
23717 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23718 @gccoptlist{-mcustom-fmuls=252 @gol
23719 -mcustom-fadds=253 @gol
23720 -mcustom-fsubs=254 @gol
23721 -mcustom-fdivs=255 @gol
23722 -fsingle-precision-constant}
23723
23724 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23725 @gccoptlist{-mcustom-floatus=243 @gol
23726 -mcustom-fixsi=244 @gol
23727 -mcustom-floatis=245 @gol
23728 -mcustom-fcmpgts=246 @gol
23729 -mcustom-fcmples=249 @gol
23730 -mcustom-fcmpeqs=250 @gol
23731 -mcustom-fcmpnes=251 @gol
23732 -mcustom-fmuls=252 @gol
23733 -mcustom-fadds=253 @gol
23734 -mcustom-fsubs=254 @gol
23735 -mcustom-fdivs=255 @gol
23736 -fsingle-precision-constant}
23737
23738 Custom instruction assignments given by individual
23739 @option{-mcustom-@var{insn}=} options override those given by
23740 @option{-mcustom-fpu-cfg=}, regardless of the
23741 order of the options on the command line.
23742
23743 Note that you can gain more local control over selection of a FPU
23744 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23745 function attribute (@pxref{Function Attributes})
23746 or pragma (@pxref{Function Specific Option Pragmas}).
23747
23748 @end table
23749
23750 These additional @samp{-m} options are available for the Altera Nios II
23751 ELF (bare-metal) target:
23752
23753 @table @gcctabopt
23754
23755 @item -mhal
23756 @opindex mhal
23757 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23758 startup and termination code, and is typically used in conjunction with
23759 @option{-msys-crt0=} to specify the location of the alternate startup code
23760 provided by the HAL BSP.
23761
23762 @item -msmallc
23763 @opindex msmallc
23764 Link with a limited version of the C library, @option{-lsmallc}, rather than
23765 Newlib.
23766
23767 @item -msys-crt0=@var{startfile}
23768 @opindex msys-crt0
23769 @var{startfile} is the file name of the startfile (crt0) to use
23770 when linking. This option is only useful in conjunction with @option{-mhal}.
23771
23772 @item -msys-lib=@var{systemlib}
23773 @opindex msys-lib
23774 @var{systemlib} is the library name of the library that provides
23775 low-level system calls required by the C library,
23776 e.g.@: @code{read} and @code{write}.
23777 This option is typically used to link with a library provided by a HAL BSP.
23778
23779 @end table
23780
23781 @node Nvidia PTX Options
23782 @subsection Nvidia PTX Options
23783 @cindex Nvidia PTX options
23784 @cindex nvptx options
23785
23786 These options are defined for Nvidia PTX:
23787
23788 @table @gcctabopt
23789
23790 @item -m32
23791 @itemx -m64
23792 @opindex m32
23793 @opindex m64
23794 Generate code for 32-bit or 64-bit ABI.
23795
23796 @item -misa=@var{ISA-string}
23797 @opindex march
23798 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23799 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23800 @samp{sm_35}. The default ISA is sm_30.
23801
23802 @item -mmainkernel
23803 @opindex mmainkernel
23804 Link in code for a __main kernel. This is for stand-alone instead of
23805 offloading execution.
23806
23807 @item -moptimize
23808 @opindex moptimize
23809 Apply partitioned execution optimizations. This is the default when any
23810 level of optimization is selected.
23811
23812 @item -msoft-stack
23813 @opindex msoft-stack
23814 Generate code that does not use @code{.local} memory
23815 directly for stack storage. Instead, a per-warp stack pointer is
23816 maintained explicitly. This enables variable-length stack allocation (with
23817 variable-length arrays or @code{alloca}), and when global memory is used for
23818 underlying storage, makes it possible to access automatic variables from other
23819 threads, or with atomic instructions. This code generation variant is used
23820 for OpenMP offloading, but the option is exposed on its own for the purpose
23821 of testing the compiler; to generate code suitable for linking into programs
23822 using OpenMP offloading, use option @option{-mgomp}.
23823
23824 @item -muniform-simt
23825 @opindex muniform-simt
23826 Switch to code generation variant that allows to execute all threads in each
23827 warp, while maintaining memory state and side effects as if only one thread
23828 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23829 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23830 current lane index equals the master lane index), and the register being
23831 assigned is copied via a shuffle instruction from the master lane. Outside of
23832 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23833 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23834 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23835 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23836 with current lane index to compute the master lane index.
23837
23838 @item -mgomp
23839 @opindex mgomp
23840 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23841 @option{-muniform-simt} options, and selects corresponding multilib variant.
23842
23843 @end table
23844
23845 @node OpenRISC Options
23846 @subsection OpenRISC Options
23847 @cindex OpenRISC Options
23848
23849 These options are defined for OpenRISC:
23850
23851 @table @gcctabopt
23852
23853 @item -mboard=@var{name}
23854 @opindex mboard
23855 Configure a board specific runtime. This will be passed to the linker for
23856 newlib board library linking. The default is @code{or1ksim}.
23857
23858 @item -mnewlib
23859 @opindex mnewlib
23860 This option is ignored; it is for compatibility purposes only. This used to
23861 select linker and preprocessor options for use with newlib.
23862
23863 @item -msoft-div
23864 @itemx -mhard-div
23865 @opindex msoft-div
23866 @opindex mhard-div
23867 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
23868 This default is hardware divide.
23869
23870 @item -msoft-mul
23871 @itemx -mhard-mul
23872 @opindex msoft-mul
23873 @opindex mhard-mul
23874 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
23875 This default is hardware multiply.
23876
23877 @item -msoft-float
23878 @itemx -mhard-float
23879 @opindex msoft-float
23880 @opindex mhard-float
23881 Select software or hardware for floating point operations.
23882 The default is software.
23883
23884 @item -mdouble-float
23885 @opindex mdouble-float
23886 When @option{-mhard-float} is selected, enables generation of double-precision
23887 floating point instructions. By default functions from @file{libgcc} are used
23888 to perform double-precision floating point operations.
23889
23890 @item -munordered-float
23891 @opindex munordered-float
23892 When @option{-mhard-float} is selected, enables generation of unordered
23893 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
23894 functions from @file{libgcc} are used to perform unordered floating point
23895 compare and set flag operations.
23896
23897 @item -mcmov
23898 @opindex mcmov
23899 Enable generation of conditional move (@code{l.cmov}) instructions. By
23900 default the equivalent will be generated using using set and branch.
23901
23902 @item -mror
23903 @opindex mror
23904 Enable generation of rotate right (@code{l.ror}) instructions. By default
23905 functions from @file{libgcc} are used to perform rotate right operations.
23906
23907 @item -mrori
23908 @opindex mrori
23909 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
23910 By default functions from @file{libgcc} are used to perform rotate right with
23911 immediate operations.
23912
23913 @item -msext
23914 @opindex msext
23915 Enable generation of sign extension (@code{l.ext*}) instructions. By default
23916 memory loads are used to perform sign extension.
23917
23918 @item -msfimm
23919 @opindex msfimm
23920 Enable generation of compare and set flag with immediate (@code{l.sf*i})
23921 instructions. By default extra instructions will be generated to store the
23922 immediate to a register first.
23923
23924 @item -mshftimm
23925 @opindex mshftimm
23926 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
23927 @code{l.slli}) instructions. By default extra instructions will be generated
23928 to store the immediate to a register first.
23929
23930
23931 @end table
23932
23933 @node PDP-11 Options
23934 @subsection PDP-11 Options
23935 @cindex PDP-11 Options
23936
23937 These options are defined for the PDP-11:
23938
23939 @table @gcctabopt
23940 @item -mfpu
23941 @opindex mfpu
23942 Use hardware FPP floating point. This is the default. (FIS floating
23943 point on the PDP-11/40 is not supported.) Implies -m45.
23944
23945 @item -msoft-float
23946 @opindex msoft-float
23947 Do not use hardware floating point.
23948
23949 @item -mac0
23950 @opindex mac0
23951 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23952
23953 @item -mno-ac0
23954 @opindex mno-ac0
23955 Return floating-point results in memory. This is the default.
23956
23957 @item -m40
23958 @opindex m40
23959 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23960
23961 @item -m45
23962 @opindex m45
23963 Generate code for a PDP-11/45. This is the default.
23964
23965 @item -m10
23966 @opindex m10
23967 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23968
23969 @item -mint16
23970 @itemx -mno-int32
23971 @opindex mint16
23972 @opindex mno-int32
23973 Use 16-bit @code{int}. This is the default.
23974
23975 @item -mint32
23976 @itemx -mno-int16
23977 @opindex mint32
23978 @opindex mno-int16
23979 Use 32-bit @code{int}.
23980
23981 @item -msplit
23982 @opindex msplit
23983 Target has split instruction and data space. Implies -m45.
23984
23985 @item -munix-asm
23986 @opindex munix-asm
23987 Use Unix assembler syntax.
23988
23989 @item -mdec-asm
23990 @opindex mdec-asm
23991 Use DEC assembler syntax.
23992
23993 @item -mgnu-asm
23994 @opindex mgnu-asm
23995 Use GNU assembler syntax. This is the default.
23996
23997 @item -mlra
23998 @opindex mlra
23999 Use the new LRA register allocator. By default, the old ``reload''
24000 allocator is used.
24001 @end table
24002
24003 @node picoChip Options
24004 @subsection picoChip Options
24005 @cindex picoChip options
24006
24007 These @samp{-m} options are defined for picoChip implementations:
24008
24009 @table @gcctabopt
24010
24011 @item -mae=@var{ae_type}
24012 @opindex mcpu
24013 Set the instruction set, register set, and instruction scheduling
24014 parameters for array element type @var{ae_type}. Supported values
24015 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
24016
24017 @option{-mae=ANY} selects a completely generic AE type. Code
24018 generated with this option runs on any of the other AE types. The
24019 code is not as efficient as it would be if compiled for a specific
24020 AE type, and some types of operation (e.g., multiplication) do not
24021 work properly on all types of AE.
24022
24023 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
24024 for compiled code, and is the default.
24025
24026 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
24027 option may suffer from poor performance of byte (char) manipulation,
24028 since the DSP AE does not provide hardware support for byte load/stores.
24029
24030 @item -msymbol-as-address
24031 Enable the compiler to directly use a symbol name as an address in a
24032 load/store instruction, without first loading it into a
24033 register. Typically, the use of this option generates larger
24034 programs, which run faster than when the option isn't used. However, the
24035 results vary from program to program, so it is left as a user option,
24036 rather than being permanently enabled.
24037
24038 @item -mno-inefficient-warnings
24039 Disables warnings about the generation of inefficient code. These
24040 warnings can be generated, for example, when compiling code that
24041 performs byte-level memory operations on the MAC AE type. The MAC AE has
24042 no hardware support for byte-level memory operations, so all byte
24043 load/stores must be synthesized from word load/store operations. This is
24044 inefficient and a warning is generated to indicate
24045 that you should rewrite the code to avoid byte operations, or to target
24046 an AE type that has the necessary hardware support. This option disables
24047 these warnings.
24048
24049 @end table
24050
24051 @node PowerPC Options
24052 @subsection PowerPC Options
24053 @cindex PowerPC options
24054
24055 These are listed under @xref{RS/6000 and PowerPC Options}.
24056
24057 @node PRU Options
24058 @subsection PRU Options
24059 @cindex PRU Options
24060
24061 These command-line options are defined for PRU target:
24062
24063 @table @gcctabopt
24064 @item -minrt
24065 @opindex minrt
24066 Link with a minimum runtime environment, with no support for static
24067 initializers and constructors. Using this option can significantly reduce
24068 the size of the final ELF binary. Beware that the compiler could still
24069 generate code with static initializers and constructors. It is up to the
24070 programmer to ensure that the source program will not use those features.
24071
24072 @item -mmcu=@var{mcu}
24073 @opindex mmcu
24074 Specify the PRU MCU variant to use. Check Newlib for the exact list of
24075 supported MCUs.
24076
24077 @item -mno-relax
24078 @opindex mno-relax
24079 Make GCC pass the @option{--no-relax} command-line option to the linker
24080 instead of the @option{--relax} option.
24081
24082 @item -mloop
24083 @opindex mloop
24084 Allow (or do not allow) GCC to use the LOOP instruction.
24085
24086 @item -mabi=@var{variant}
24087 @opindex mabi
24088 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
24089 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
24090 more naturally with certain GCC assumptions. These are the differences:
24091
24092 @table @samp
24093 @item Function Pointer Size
24094 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
24095 supports only 32-bit data and code pointers.
24096
24097 @item Optional Return Value Pointer
24098 Function return values larger than 64 bits are passed by using a hidden
24099 pointer as the first argument of the function. TI ABI, though, mandates that
24100 the pointer can be NULL in case the caller is not using the returned value.
24101 GNU always passes and expects a valid return value pointer.
24102
24103 @end table
24104
24105 The current @option{-mabi=ti} implementation simply raises a compile error
24106 when any of the above code constructs is detected. As a consequence
24107 the standard C library cannot be built and it is omitted when linking with
24108 @option{-mabi=ti}.
24109
24110 Relaxation is a GNU feature and for safety reasons is disabled when using
24111 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
24112 instructions, so the GNU linker cannot adjust them when shortening adjacent
24113 LDI32 pseudo instructions.
24114
24115 @end table
24116
24117 @node RISC-V Options
24118 @subsection RISC-V Options
24119 @cindex RISC-V Options
24120
24121 These command-line options are defined for RISC-V targets:
24122
24123 @table @gcctabopt
24124 @item -mbranch-cost=@var{n}
24125 @opindex mbranch-cost
24126 Set the cost of branches to roughly @var{n} instructions.
24127
24128 @item -mplt
24129 @itemx -mno-plt
24130 @opindex plt
24131 When generating PIC code, do or don't allow the use of PLTs. Ignored for
24132 non-PIC. The default is @option{-mplt}.
24133
24134 @item -mabi=@var{ABI-string}
24135 @opindex mabi
24136 Specify integer and floating-point calling convention. @var{ABI-string}
24137 contains two parts: the size of integer types and the registers used for
24138 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
24139 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
24140 32-bit), and that floating-point values up to 64 bits wide are passed in F
24141 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
24142 allows the compiler to generate code that uses the F and D extensions but only
24143 allows floating-point values up to 32 bits long to be passed in registers; or
24144 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
24145 passed in registers.
24146
24147 The default for this argument is system dependent, users who want a specific
24148 calling convention should specify one explicitly. The valid calling
24149 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
24150 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
24151 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
24152 invalid because the ABI requires 64-bit values be passed in F registers, but F
24153 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
24154 only be used with the @samp{rv32e} architecture. This ABI is not well
24155 specified at present, and is subject to change.
24156
24157 @item -mfdiv
24158 @itemx -mno-fdiv
24159 @opindex mfdiv
24160 Do or don't use hardware floating-point divide and square root instructions.
24161 This requires the F or D extensions for floating-point registers. The default
24162 is to use them if the specified architecture has these instructions.
24163
24164 @item -mdiv
24165 @itemx -mno-div
24166 @opindex mdiv
24167 Do or don't use hardware instructions for integer division. This requires the
24168 M extension. The default is to use them if the specified architecture has
24169 these instructions.
24170
24171 @item -march=@var{ISA-string}
24172 @opindex march
24173 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
24174 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
24175 @samp{rv32imaf}.
24176
24177 @item -mtune=@var{processor-string}
24178 @opindex mtune
24179 Optimize the output for the given processor, specified by microarchitecture
24180 name. Permissible values for this option are: @samp{rocket},
24181 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
24182 and @samp{size}.
24183
24184 When @option{-mtune=} is not specified, the default is @samp{rocket}.
24185
24186 The @samp{size} choice is not intended for use by end-users. This is used
24187 when @option{-Os} is specified. It overrides the instruction cost info
24188 provided by @option{-mtune=}, but does not override the pipeline info. This
24189 helps reduce code size while still giving good performance.
24190
24191 @item -mpreferred-stack-boundary=@var{num}
24192 @opindex mpreferred-stack-boundary
24193 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24194 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24195 the default is 4 (16 bytes or 128-bits).
24196
24197 @strong{Warning:} If you use this switch, then you must build all modules with
24198 the same value, including any libraries. This includes the system libraries
24199 and startup modules.
24200
24201 @item -msmall-data-limit=@var{n}
24202 @opindex msmall-data-limit
24203 Put global and static data smaller than @var{n} bytes into a special section
24204 (on some targets).
24205
24206 @item -msave-restore
24207 @itemx -mno-save-restore
24208 @opindex msave-restore
24209 Do or don't use smaller but slower prologue and epilogue code that uses
24210 library function calls. The default is to use fast inline prologues and
24211 epilogues.
24212
24213 @item -mstrict-align
24214 @itemx -mno-strict-align
24215 @opindex mstrict-align
24216 Do not or do generate unaligned memory accesses. The default is set depending
24217 on whether the processor we are optimizing for supports fast unaligned access
24218 or not.
24219
24220 @item -mcmodel=medlow
24221 @opindex mcmodel=medlow
24222 Generate code for the medium-low code model. The program and its statically
24223 defined symbols must lie within a single 2 GiB address range and must lie
24224 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24225 statically or dynamically linked. This is the default code model.
24226
24227 @item -mcmodel=medany
24228 @opindex mcmodel=medany
24229 Generate code for the medium-any code model. The program and its statically
24230 defined symbols must be within any single 2 GiB address range. Programs can be
24231 statically or dynamically linked.
24232
24233 @item -mexplicit-relocs
24234 @itemx -mno-exlicit-relocs
24235 Use or do not use assembler relocation operators when dealing with symbolic
24236 addresses. The alternative is to use assembler macros instead, which may
24237 limit optimization.
24238
24239 @item -mrelax
24240 @itemx -mno-relax
24241 Take advantage of linker relaxations to reduce the number of instructions
24242 required to materialize symbol addresses. The default is to take advantage of
24243 linker relaxations.
24244
24245 @item -memit-attribute
24246 @itemx -mno-emit-attribute
24247 Emit (do not emit) RISC-V attribute to record extra information into ELF
24248 objects. This feature requires at least binutils 2.32.
24249
24250 @item -malign-data=@var{type}
24251 @opindex malign-data
24252 Control how GCC aligns variables and constants of array, structure, or union
24253 types. Supported values for @var{type} are @samp{xlen} which uses x register
24254 width as the alignment value, and @samp{natural} which uses natural alignment.
24255 @samp{xlen} is the default.
24256 @end table
24257
24258 @node RL78 Options
24259 @subsection RL78 Options
24260 @cindex RL78 Options
24261
24262 @table @gcctabopt
24263
24264 @item -msim
24265 @opindex msim
24266 Links in additional target libraries to support operation within a
24267 simulator.
24268
24269 @item -mmul=none
24270 @itemx -mmul=g10
24271 @itemx -mmul=g13
24272 @itemx -mmul=g14
24273 @itemx -mmul=rl78
24274 @opindex mmul
24275 Specifies the type of hardware multiplication and division support to
24276 be used. The simplest is @code{none}, which uses software for both
24277 multiplication and division. This is the default. The @code{g13}
24278 value is for the hardware multiply/divide peripheral found on the
24279 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24280 the multiplication and division instructions supported by the RL78/G14
24281 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24282 the value @code{mg10} is an alias for @code{none}.
24283
24284 In addition a C preprocessor macro is defined, based upon the setting
24285 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24286 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24287
24288 @item -mcpu=g10
24289 @itemx -mcpu=g13
24290 @itemx -mcpu=g14
24291 @itemx -mcpu=rl78
24292 @opindex mcpu
24293 Specifies the RL78 core to target. The default is the G14 core, also
24294 known as an S3 core or just RL78. The G13 or S2 core does not have
24295 multiply or divide instructions, instead it uses a hardware peripheral
24296 for these operations. The G10 or S1 core does not have register
24297 banks, so it uses a different calling convention.
24298
24299 If this option is set it also selects the type of hardware multiply
24300 support to use, unless this is overridden by an explicit
24301 @option{-mmul=none} option on the command line. Thus specifying
24302 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24303 peripheral and specifying @option{-mcpu=g10} disables the use of
24304 hardware multiplications altogether.
24305
24306 Note, although the RL78/G14 core is the default target, specifying
24307 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24308 change the behavior of the toolchain since it also enables G14
24309 hardware multiply support. If these options are not specified on the
24310 command line then software multiplication routines will be used even
24311 though the code targets the RL78 core. This is for backwards
24312 compatibility with older toolchains which did not have hardware
24313 multiply and divide support.
24314
24315 In addition a C preprocessor macro is defined, based upon the setting
24316 of this option. Possible values are: @code{__RL78_G10__},
24317 @code{__RL78_G13__} or @code{__RL78_G14__}.
24318
24319 @item -mg10
24320 @itemx -mg13
24321 @itemx -mg14
24322 @itemx -mrl78
24323 @opindex mg10
24324 @opindex mg13
24325 @opindex mg14
24326 @opindex mrl78
24327 These are aliases for the corresponding @option{-mcpu=} option. They
24328 are provided for backwards compatibility.
24329
24330 @item -mallregs
24331 @opindex mallregs
24332 Allow the compiler to use all of the available registers. By default
24333 registers @code{r24..r31} are reserved for use in interrupt handlers.
24334 With this option enabled these registers can be used in ordinary
24335 functions as well.
24336
24337 @item -m64bit-doubles
24338 @itemx -m32bit-doubles
24339 @opindex m64bit-doubles
24340 @opindex m32bit-doubles
24341 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24342 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24343 @option{-m32bit-doubles}.
24344
24345 @item -msave-mduc-in-interrupts
24346 @itemx -mno-save-mduc-in-interrupts
24347 @opindex msave-mduc-in-interrupts
24348 @opindex mno-save-mduc-in-interrupts
24349 Specifies that interrupt handler functions should preserve the
24350 MDUC registers. This is only necessary if normal code might use
24351 the MDUC registers, for example because it performs multiplication
24352 and division operations. The default is to ignore the MDUC registers
24353 as this makes the interrupt handlers faster. The target option -mg13
24354 needs to be passed for this to work as this feature is only available
24355 on the G13 target (S2 core). The MDUC registers will only be saved
24356 if the interrupt handler performs a multiplication or division
24357 operation or it calls another function.
24358
24359 @end table
24360
24361 @node RS/6000 and PowerPC Options
24362 @subsection IBM RS/6000 and PowerPC Options
24363 @cindex RS/6000 and PowerPC Options
24364 @cindex IBM RS/6000 and PowerPC Options
24365
24366 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24367 @table @gcctabopt
24368 @item -mpowerpc-gpopt
24369 @itemx -mno-powerpc-gpopt
24370 @itemx -mpowerpc-gfxopt
24371 @itemx -mno-powerpc-gfxopt
24372 @need 800
24373 @itemx -mpowerpc64
24374 @itemx -mno-powerpc64
24375 @itemx -mmfcrf
24376 @itemx -mno-mfcrf
24377 @itemx -mpopcntb
24378 @itemx -mno-popcntb
24379 @itemx -mpopcntd
24380 @itemx -mno-popcntd
24381 @itemx -mfprnd
24382 @itemx -mno-fprnd
24383 @need 800
24384 @itemx -mcmpb
24385 @itemx -mno-cmpb
24386 @itemx -mhard-dfp
24387 @itemx -mno-hard-dfp
24388 @opindex mpowerpc-gpopt
24389 @opindex mno-powerpc-gpopt
24390 @opindex mpowerpc-gfxopt
24391 @opindex mno-powerpc-gfxopt
24392 @opindex mpowerpc64
24393 @opindex mno-powerpc64
24394 @opindex mmfcrf
24395 @opindex mno-mfcrf
24396 @opindex mpopcntb
24397 @opindex mno-popcntb
24398 @opindex mpopcntd
24399 @opindex mno-popcntd
24400 @opindex mfprnd
24401 @opindex mno-fprnd
24402 @opindex mcmpb
24403 @opindex mno-cmpb
24404 @opindex mhard-dfp
24405 @opindex mno-hard-dfp
24406 You use these options to specify which instructions are available on the
24407 processor you are using. The default value of these options is
24408 determined when configuring GCC@. Specifying the
24409 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24410 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24411 rather than the options listed above.
24412
24413 Specifying @option{-mpowerpc-gpopt} allows
24414 GCC to use the optional PowerPC architecture instructions in the
24415 General Purpose group, including floating-point square root. Specifying
24416 @option{-mpowerpc-gfxopt} allows GCC to
24417 use the optional PowerPC architecture instructions in the Graphics
24418 group, including floating-point select.
24419
24420 The @option{-mmfcrf} option allows GCC to generate the move from
24421 condition register field instruction implemented on the POWER4
24422 processor and other processors that support the PowerPC V2.01
24423 architecture.
24424 The @option{-mpopcntb} option allows GCC to generate the popcount and
24425 double-precision FP reciprocal estimate instruction implemented on the
24426 POWER5 processor and other processors that support the PowerPC V2.02
24427 architecture.
24428 The @option{-mpopcntd} option allows GCC to generate the popcount
24429 instruction implemented on the POWER7 processor and other processors
24430 that support the PowerPC V2.06 architecture.
24431 The @option{-mfprnd} option allows GCC to generate the FP round to
24432 integer instructions implemented on the POWER5+ processor and other
24433 processors that support the PowerPC V2.03 architecture.
24434 The @option{-mcmpb} option allows GCC to generate the compare bytes
24435 instruction implemented on the POWER6 processor and other processors
24436 that support the PowerPC V2.05 architecture.
24437 The @option{-mhard-dfp} option allows GCC to generate the decimal
24438 floating-point instructions implemented on some POWER processors.
24439
24440 The @option{-mpowerpc64} option allows GCC to generate the additional
24441 64-bit instructions that are found in the full PowerPC64 architecture
24442 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24443 @option{-mno-powerpc64}.
24444
24445 @item -mcpu=@var{cpu_type}
24446 @opindex mcpu
24447 Set architecture type, register usage, and
24448 instruction scheduling parameters for machine type @var{cpu_type}.
24449 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24450 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24451 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24452 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24453 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24454 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24455 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24456 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24457 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24458 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24459 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24460 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24461
24462 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24463 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24464 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24465 architecture machine types, with an appropriate, generic processor
24466 model assumed for scheduling purposes.
24467
24468 Specifying @samp{native} as cpu type detects and selects the
24469 architecture option that corresponds to the host processor of the
24470 system performing the compilation.
24471 @option{-mcpu=native} has no effect if GCC does not recognize the
24472 processor.
24473
24474 The other options specify a specific processor. Code generated under
24475 those options runs best on that processor, and may not run at all on
24476 others.
24477
24478 The @option{-mcpu} options automatically enable or disable the
24479 following options:
24480
24481 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24482 -mpopcntb -mpopcntd -mpowerpc64 @gol
24483 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24484 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24485 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24486 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24487
24488 The particular options set for any particular CPU varies between
24489 compiler versions, depending on what setting seems to produce optimal
24490 code for that CPU; it doesn't necessarily reflect the actual hardware's
24491 capabilities. If you wish to set an individual option to a particular
24492 value, you may specify it after the @option{-mcpu} option, like
24493 @option{-mcpu=970 -mno-altivec}.
24494
24495 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24496 not enabled or disabled by the @option{-mcpu} option at present because
24497 AIX does not have full support for these options. You may still
24498 enable or disable them individually if you're sure it'll work in your
24499 environment.
24500
24501 @item -mtune=@var{cpu_type}
24502 @opindex mtune
24503 Set the instruction scheduling parameters for machine type
24504 @var{cpu_type}, but do not set the architecture type or register usage,
24505 as @option{-mcpu=@var{cpu_type}} does. The same
24506 values for @var{cpu_type} are used for @option{-mtune} as for
24507 @option{-mcpu}. If both are specified, the code generated uses the
24508 architecture and registers set by @option{-mcpu}, but the
24509 scheduling parameters set by @option{-mtune}.
24510
24511 @item -mcmodel=small
24512 @opindex mcmodel=small
24513 Generate PowerPC64 code for the small model: The TOC is limited to
24514 64k.
24515
24516 @item -mcmodel=medium
24517 @opindex mcmodel=medium
24518 Generate PowerPC64 code for the medium model: The TOC and other static
24519 data may be up to a total of 4G in size. This is the default for 64-bit
24520 Linux.
24521
24522 @item -mcmodel=large
24523 @opindex mcmodel=large
24524 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24525 in size. Other data and code is only limited by the 64-bit address
24526 space.
24527
24528 @item -maltivec
24529 @itemx -mno-altivec
24530 @opindex maltivec
24531 @opindex mno-altivec
24532 Generate code that uses (does not use) AltiVec instructions, and also
24533 enable the use of built-in functions that allow more direct access to
24534 the AltiVec instruction set. You may also need to set
24535 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24536 enhancements.
24537
24538 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24539 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24540 match array element order corresponding to the endianness of the
24541 target. That is, element zero identifies the leftmost element in a
24542 vector register when targeting a big-endian platform, and identifies
24543 the rightmost element in a vector register when targeting a
24544 little-endian platform.
24545
24546 @item -mvrsave
24547 @itemx -mno-vrsave
24548 @opindex mvrsave
24549 @opindex mno-vrsave
24550 Generate VRSAVE instructions when generating AltiVec code.
24551
24552 @item -msecure-plt
24553 @opindex msecure-plt
24554 Generate code that allows @command{ld} and @command{ld.so}
24555 to build executables and shared
24556 libraries with non-executable @code{.plt} and @code{.got} sections.
24557 This is a PowerPC
24558 32-bit SYSV ABI option.
24559
24560 @item -mbss-plt
24561 @opindex mbss-plt
24562 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24563 fills in, and
24564 requires @code{.plt} and @code{.got}
24565 sections that are both writable and executable.
24566 This is a PowerPC 32-bit SYSV ABI option.
24567
24568 @item -misel
24569 @itemx -mno-isel
24570 @opindex misel
24571 @opindex mno-isel
24572 This switch enables or disables the generation of ISEL instructions.
24573
24574 @item -mvsx
24575 @itemx -mno-vsx
24576 @opindex mvsx
24577 @opindex mno-vsx
24578 Generate code that uses (does not use) vector/scalar (VSX)
24579 instructions, and also enable the use of built-in functions that allow
24580 more direct access to the VSX instruction set.
24581
24582 @item -mcrypto
24583 @itemx -mno-crypto
24584 @opindex mcrypto
24585 @opindex mno-crypto
24586 Enable the use (disable) of the built-in functions that allow direct
24587 access to the cryptographic instructions that were added in version
24588 2.07 of the PowerPC ISA.
24589
24590 @item -mhtm
24591 @itemx -mno-htm
24592 @opindex mhtm
24593 @opindex mno-htm
24594 Enable (disable) the use of the built-in functions that allow direct
24595 access to the Hardware Transactional Memory (HTM) instructions that
24596 were added in version 2.07 of the PowerPC ISA.
24597
24598 @item -mpower8-fusion
24599 @itemx -mno-power8-fusion
24600 @opindex mpower8-fusion
24601 @opindex mno-power8-fusion
24602 Generate code that keeps (does not keeps) some integer operations
24603 adjacent so that the instructions can be fused together on power8 and
24604 later processors.
24605
24606 @item -mpower8-vector
24607 @itemx -mno-power8-vector
24608 @opindex mpower8-vector
24609 @opindex mno-power8-vector
24610 Generate code that uses (does not use) the vector and scalar
24611 instructions that were added in version 2.07 of the PowerPC ISA. Also
24612 enable the use of built-in functions that allow more direct access to
24613 the vector instructions.
24614
24615 @item -mquad-memory
24616 @itemx -mno-quad-memory
24617 @opindex mquad-memory
24618 @opindex mno-quad-memory
24619 Generate code that uses (does not use) the non-atomic quad word memory
24620 instructions. The @option{-mquad-memory} option requires use of
24621 64-bit mode.
24622
24623 @item -mquad-memory-atomic
24624 @itemx -mno-quad-memory-atomic
24625 @opindex mquad-memory-atomic
24626 @opindex mno-quad-memory-atomic
24627 Generate code that uses (does not use) the atomic quad word memory
24628 instructions. The @option{-mquad-memory-atomic} option requires use of
24629 64-bit mode.
24630
24631 @item -mfloat128
24632 @itemx -mno-float128
24633 @opindex mfloat128
24634 @opindex mno-float128
24635 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24636 and use either software emulation for IEEE 128-bit floating point or
24637 hardware instructions.
24638
24639 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24640 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24641 use the IEEE 128-bit floating point support. The IEEE 128-bit
24642 floating point support only works on PowerPC Linux systems.
24643
24644 The default for @option{-mfloat128} is enabled on PowerPC Linux
24645 systems using the VSX instruction set, and disabled on other systems.
24646
24647 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24648 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24649 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24650 floating point instructions. Otherwise, if you do not specify to
24651 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24652 system, IEEE 128-bit floating point will be done with software
24653 emulation.
24654
24655 @item -mfloat128-hardware
24656 @itemx -mno-float128-hardware
24657 @opindex mfloat128-hardware
24658 @opindex mno-float128-hardware
24659 Enable/disable using ISA 3.0 hardware instructions to support the
24660 @var{__float128} data type.
24661
24662 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24663 Linux systems using the ISA 3.0 instruction set, and disabled on other
24664 systems.
24665
24666 @item -m32
24667 @itemx -m64
24668 @opindex m32
24669 @opindex m64
24670 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24671 targets (including GNU/Linux). The 32-bit environment sets int, long
24672 and pointer to 32 bits and generates code that runs on any PowerPC
24673 variant. The 64-bit environment sets int to 32 bits and long and
24674 pointer to 64 bits, and generates code for PowerPC64, as for
24675 @option{-mpowerpc64}.
24676
24677 @item -mfull-toc
24678 @itemx -mno-fp-in-toc
24679 @itemx -mno-sum-in-toc
24680 @itemx -mminimal-toc
24681 @opindex mfull-toc
24682 @opindex mno-fp-in-toc
24683 @opindex mno-sum-in-toc
24684 @opindex mminimal-toc
24685 Modify generation of the TOC (Table Of Contents), which is created for
24686 every executable file. The @option{-mfull-toc} option is selected by
24687 default. In that case, GCC allocates at least one TOC entry for
24688 each unique non-automatic variable reference in your program. GCC
24689 also places floating-point constants in the TOC@. However, only
24690 16,384 entries are available in the TOC@.
24691
24692 If you receive a linker error message that saying you have overflowed
24693 the available TOC space, you can reduce the amount of TOC space used
24694 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24695 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24696 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24697 generate code to calculate the sum of an address and a constant at
24698 run time instead of putting that sum into the TOC@. You may specify one
24699 or both of these options. Each causes GCC to produce very slightly
24700 slower and larger code at the expense of conserving TOC space.
24701
24702 If you still run out of space in the TOC even when you specify both of
24703 these options, specify @option{-mminimal-toc} instead. This option causes
24704 GCC to make only one TOC entry for every file. When you specify this
24705 option, GCC produces code that is slower and larger but which
24706 uses extremely little TOC space. You may wish to use this option
24707 only on files that contain less frequently-executed code.
24708
24709 @item -maix64
24710 @itemx -maix32
24711 @opindex maix64
24712 @opindex maix32
24713 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24714 @code{long} type, and the infrastructure needed to support them.
24715 Specifying @option{-maix64} implies @option{-mpowerpc64},
24716 while @option{-maix32} disables the 64-bit ABI and
24717 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24718
24719 @item -mxl-compat
24720 @itemx -mno-xl-compat
24721 @opindex mxl-compat
24722 @opindex mno-xl-compat
24723 Produce code that conforms more closely to IBM XL compiler semantics
24724 when using AIX-compatible ABI@. Pass floating-point arguments to
24725 prototyped functions beyond the register save area (RSA) on the stack
24726 in addition to argument FPRs. Do not assume that most significant
24727 double in 128-bit long double value is properly rounded when comparing
24728 values and converting to double. Use XL symbol names for long double
24729 support routines.
24730
24731 The AIX calling convention was extended but not initially documented to
24732 handle an obscure K&R C case of calling a function that takes the
24733 address of its arguments with fewer arguments than declared. IBM XL
24734 compilers access floating-point arguments that do not fit in the
24735 RSA from the stack when a subroutine is compiled without
24736 optimization. Because always storing floating-point arguments on the
24737 stack is inefficient and rarely needed, this option is not enabled by
24738 default and only is necessary when calling subroutines compiled by IBM
24739 XL compilers without optimization.
24740
24741 @item -mpe
24742 @opindex mpe
24743 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24744 application written to use message passing with special startup code to
24745 enable the application to run. The system must have PE installed in the
24746 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24747 must be overridden with the @option{-specs=} option to specify the
24748 appropriate directory location. The Parallel Environment does not
24749 support threads, so the @option{-mpe} option and the @option{-pthread}
24750 option are incompatible.
24751
24752 @item -malign-natural
24753 @itemx -malign-power
24754 @opindex malign-natural
24755 @opindex malign-power
24756 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24757 @option{-malign-natural} overrides the ABI-defined alignment of larger
24758 types, such as floating-point doubles, on their natural size-based boundary.
24759 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24760 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24761
24762 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24763 is not supported.
24764
24765 @item -msoft-float
24766 @itemx -mhard-float
24767 @opindex msoft-float
24768 @opindex mhard-float
24769 Generate code that does not use (uses) the floating-point register set.
24770 Software floating-point emulation is provided if you use the
24771 @option{-msoft-float} option, and pass the option to GCC when linking.
24772
24773 @item -mmultiple
24774 @itemx -mno-multiple
24775 @opindex mmultiple
24776 @opindex mno-multiple
24777 Generate code that uses (does not use) the load multiple word
24778 instructions and the store multiple word instructions. These
24779 instructions are generated by default on POWER systems, and not
24780 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24781 PowerPC systems, since those instructions do not work when the
24782 processor is in little-endian mode. The exceptions are PPC740 and
24783 PPC750 which permit these instructions in little-endian mode.
24784
24785 @item -mupdate
24786 @itemx -mno-update
24787 @opindex mupdate
24788 @opindex mno-update
24789 Generate code that uses (does not use) the load or store instructions
24790 that update the base register to the address of the calculated memory
24791 location. These instructions are generated by default. If you use
24792 @option{-mno-update}, there is a small window between the time that the
24793 stack pointer is updated and the address of the previous frame is
24794 stored, which means code that walks the stack frame across interrupts or
24795 signals may get corrupted data.
24796
24797 @item -mavoid-indexed-addresses
24798 @itemx -mno-avoid-indexed-addresses
24799 @opindex mavoid-indexed-addresses
24800 @opindex mno-avoid-indexed-addresses
24801 Generate code that tries to avoid (not avoid) the use of indexed load
24802 or store instructions. These instructions can incur a performance
24803 penalty on Power6 processors in certain situations, such as when
24804 stepping through large arrays that cross a 16M boundary. This option
24805 is enabled by default when targeting Power6 and disabled otherwise.
24806
24807 @item -mfused-madd
24808 @itemx -mno-fused-madd
24809 @opindex mfused-madd
24810 @opindex mno-fused-madd
24811 Generate code that uses (does not use) the floating-point multiply and
24812 accumulate instructions. These instructions are generated by default
24813 if hardware floating point is used. The machine-dependent
24814 @option{-mfused-madd} option is now mapped to the machine-independent
24815 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24816 mapped to @option{-ffp-contract=off}.
24817
24818 @item -mmulhw
24819 @itemx -mno-mulhw
24820 @opindex mmulhw
24821 @opindex mno-mulhw
24822 Generate code that uses (does not use) the half-word multiply and
24823 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24824 These instructions are generated by default when targeting those
24825 processors.
24826
24827 @item -mdlmzb
24828 @itemx -mno-dlmzb
24829 @opindex mdlmzb
24830 @opindex mno-dlmzb
24831 Generate code that uses (does not use) the string-search @samp{dlmzb}
24832 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24833 generated by default when targeting those processors.
24834
24835 @item -mno-bit-align
24836 @itemx -mbit-align
24837 @opindex mno-bit-align
24838 @opindex mbit-align
24839 On System V.4 and embedded PowerPC systems do not (do) force structures
24840 and unions that contain bit-fields to be aligned to the base type of the
24841 bit-field.
24842
24843 For example, by default a structure containing nothing but 8
24844 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24845 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24846 the structure is aligned to a 1-byte boundary and is 1 byte in
24847 size.
24848
24849 @item -mno-strict-align
24850 @itemx -mstrict-align
24851 @opindex mno-strict-align
24852 @opindex mstrict-align
24853 On System V.4 and embedded PowerPC systems do not (do) assume that
24854 unaligned memory references are handled by the system.
24855
24856 @item -mrelocatable
24857 @itemx -mno-relocatable
24858 @opindex mrelocatable
24859 @opindex mno-relocatable
24860 Generate code that allows (does not allow) a static executable to be
24861 relocated to a different address at run time. A simple embedded
24862 PowerPC system loader should relocate the entire contents of
24863 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24864 a table of 32-bit addresses generated by this option. For this to
24865 work, all objects linked together must be compiled with
24866 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24867 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24868
24869 @item -mrelocatable-lib
24870 @itemx -mno-relocatable-lib
24871 @opindex mrelocatable-lib
24872 @opindex mno-relocatable-lib
24873 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24874 @code{.fixup} section to allow static executables to be relocated at
24875 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24876 alignment of @option{-mrelocatable}. Objects compiled with
24877 @option{-mrelocatable-lib} may be linked with objects compiled with
24878 any combination of the @option{-mrelocatable} options.
24879
24880 @item -mno-toc
24881 @itemx -mtoc
24882 @opindex mno-toc
24883 @opindex mtoc
24884 On System V.4 and embedded PowerPC systems do not (do) assume that
24885 register 2 contains a pointer to a global area pointing to the addresses
24886 used in the program.
24887
24888 @item -mlittle
24889 @itemx -mlittle-endian
24890 @opindex mlittle
24891 @opindex mlittle-endian
24892 On System V.4 and embedded PowerPC systems compile code for the
24893 processor in little-endian mode. The @option{-mlittle-endian} option is
24894 the same as @option{-mlittle}.
24895
24896 @item -mbig
24897 @itemx -mbig-endian
24898 @opindex mbig
24899 @opindex mbig-endian
24900 On System V.4 and embedded PowerPC systems compile code for the
24901 processor in big-endian mode. The @option{-mbig-endian} option is
24902 the same as @option{-mbig}.
24903
24904 @item -mdynamic-no-pic
24905 @opindex mdynamic-no-pic
24906 On Darwin and Mac OS X systems, compile code so that it is not
24907 relocatable, but that its external references are relocatable. The
24908 resulting code is suitable for applications, but not shared
24909 libraries.
24910
24911 @item -msingle-pic-base
24912 @opindex msingle-pic-base
24913 Treat the register used for PIC addressing as read-only, rather than
24914 loading it in the prologue for each function. The runtime system is
24915 responsible for initializing this register with an appropriate value
24916 before execution begins.
24917
24918 @item -mprioritize-restricted-insns=@var{priority}
24919 @opindex mprioritize-restricted-insns
24920 This option controls the priority that is assigned to
24921 dispatch-slot restricted instructions during the second scheduling
24922 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24923 or @samp{2} to assign no, highest, or second-highest (respectively)
24924 priority to dispatch-slot restricted
24925 instructions.
24926
24927 @item -msched-costly-dep=@var{dependence_type}
24928 @opindex msched-costly-dep
24929 This option controls which dependences are considered costly
24930 by the target during instruction scheduling. The argument
24931 @var{dependence_type} takes one of the following values:
24932
24933 @table @asis
24934 @item @samp{no}
24935 No dependence is costly.
24936
24937 @item @samp{all}
24938 All dependences are costly.
24939
24940 @item @samp{true_store_to_load}
24941 A true dependence from store to load is costly.
24942
24943 @item @samp{store_to_load}
24944 Any dependence from store to load is costly.
24945
24946 @item @var{number}
24947 Any dependence for which the latency is greater than or equal to
24948 @var{number} is costly.
24949 @end table
24950
24951 @item -minsert-sched-nops=@var{scheme}
24952 @opindex minsert-sched-nops
24953 This option controls which NOP insertion scheme is used during
24954 the second scheduling pass. The argument @var{scheme} takes one of the
24955 following values:
24956
24957 @table @asis
24958 @item @samp{no}
24959 Don't insert NOPs.
24960
24961 @item @samp{pad}
24962 Pad with NOPs any dispatch group that has vacant issue slots,
24963 according to the scheduler's grouping.
24964
24965 @item @samp{regroup_exact}
24966 Insert NOPs to force costly dependent insns into
24967 separate groups. Insert exactly as many NOPs as needed to force an insn
24968 to a new group, according to the estimated processor grouping.
24969
24970 @item @var{number}
24971 Insert NOPs to force costly dependent insns into
24972 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24973 @end table
24974
24975 @item -mcall-sysv
24976 @opindex mcall-sysv
24977 On System V.4 and embedded PowerPC systems compile code using calling
24978 conventions that adhere to the March 1995 draft of the System V
24979 Application Binary Interface, PowerPC processor supplement. This is the
24980 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24981
24982 @item -mcall-sysv-eabi
24983 @itemx -mcall-eabi
24984 @opindex mcall-sysv-eabi
24985 @opindex mcall-eabi
24986 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24987
24988 @item -mcall-sysv-noeabi
24989 @opindex mcall-sysv-noeabi
24990 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24991
24992 @item -mcall-aixdesc
24993 @opindex m
24994 On System V.4 and embedded PowerPC systems compile code for the AIX
24995 operating system.
24996
24997 @item -mcall-linux
24998 @opindex mcall-linux
24999 On System V.4 and embedded PowerPC systems compile code for the
25000 Linux-based GNU system.
25001
25002 @item -mcall-freebsd
25003 @opindex mcall-freebsd
25004 On System V.4 and embedded PowerPC systems compile code for the
25005 FreeBSD operating system.
25006
25007 @item -mcall-netbsd
25008 @opindex mcall-netbsd
25009 On System V.4 and embedded PowerPC systems compile code for the
25010 NetBSD operating system.
25011
25012 @item -mcall-openbsd
25013 @opindex mcall-netbsd
25014 On System V.4 and embedded PowerPC systems compile code for the
25015 OpenBSD operating system.
25016
25017 @item -mtraceback=@var{traceback_type}
25018 @opindex mtraceback
25019 Select the type of traceback table. Valid values for @var{traceback_type}
25020 are @samp{full}, @samp{part}, and @samp{no}.
25021
25022 @item -maix-struct-return
25023 @opindex maix-struct-return
25024 Return all structures in memory (as specified by the AIX ABI)@.
25025
25026 @item -msvr4-struct-return
25027 @opindex msvr4-struct-return
25028 Return structures smaller than 8 bytes in registers (as specified by the
25029 SVR4 ABI)@.
25030
25031 @item -mabi=@var{abi-type}
25032 @opindex mabi
25033 Extend the current ABI with a particular extension, or remove such extension.
25034 Valid values are @samp{altivec}, @samp{no-altivec},
25035 @samp{ibmlongdouble}, @samp{ieeelongdouble},
25036 @samp{elfv1}, @samp{elfv2}@.
25037
25038 @item -mabi=ibmlongdouble
25039 @opindex mabi=ibmlongdouble
25040 Change the current ABI to use IBM extended-precision long double.
25041 This is not likely to work if your system defaults to using IEEE
25042 extended-precision long double. If you change the long double type
25043 from IEEE extended-precision, the compiler will issue a warning unless
25044 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
25045 to be enabled.
25046
25047 @item -mabi=ieeelongdouble
25048 @opindex mabi=ieeelongdouble
25049 Change the current ABI to use IEEE extended-precision long double.
25050 This is not likely to work if your system defaults to using IBM
25051 extended-precision long double. If you change the long double type
25052 from IBM extended-precision, the compiler will issue a warning unless
25053 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
25054 to be enabled.
25055
25056 @item -mabi=elfv1
25057 @opindex mabi=elfv1
25058 Change the current ABI to use the ELFv1 ABI.
25059 This is the default ABI for big-endian PowerPC 64-bit Linux.
25060 Overriding the default ABI requires special system support and is
25061 likely to fail in spectacular ways.
25062
25063 @item -mabi=elfv2
25064 @opindex mabi=elfv2
25065 Change the current ABI to use the ELFv2 ABI.
25066 This is the default ABI for little-endian PowerPC 64-bit Linux.
25067 Overriding the default ABI requires special system support and is
25068 likely to fail in spectacular ways.
25069
25070 @item -mgnu-attribute
25071 @itemx -mno-gnu-attribute
25072 @opindex mgnu-attribute
25073 @opindex mno-gnu-attribute
25074 Emit .gnu_attribute assembly directives to set tag/value pairs in a
25075 .gnu.attributes section that specify ABI variations in function
25076 parameters or return values.
25077
25078 @item -mprototype
25079 @itemx -mno-prototype
25080 @opindex mprototype
25081 @opindex mno-prototype
25082 On System V.4 and embedded PowerPC systems assume that all calls to
25083 variable argument functions are properly prototyped. Otherwise, the
25084 compiler must insert an instruction before every non-prototyped call to
25085 set or clear bit 6 of the condition code register (@code{CR}) to
25086 indicate whether floating-point values are passed in the floating-point
25087 registers in case the function takes variable arguments. With
25088 @option{-mprototype}, only calls to prototyped variable argument functions
25089 set or clear the bit.
25090
25091 @item -msim
25092 @opindex msim
25093 On embedded PowerPC systems, assume that the startup module is called
25094 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
25095 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
25096 configurations.
25097
25098 @item -mmvme
25099 @opindex mmvme
25100 On embedded PowerPC systems, assume that the startup module is called
25101 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
25102 @file{libc.a}.
25103
25104 @item -mads
25105 @opindex mads
25106 On embedded PowerPC systems, assume that the startup module is called
25107 @file{crt0.o} and the standard C libraries are @file{libads.a} and
25108 @file{libc.a}.
25109
25110 @item -myellowknife
25111 @opindex myellowknife
25112 On embedded PowerPC systems, assume that the startup module is called
25113 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
25114 @file{libc.a}.
25115
25116 @item -mvxworks
25117 @opindex mvxworks
25118 On System V.4 and embedded PowerPC systems, specify that you are
25119 compiling for a VxWorks system.
25120
25121 @item -memb
25122 @opindex memb
25123 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
25124 header to indicate that @samp{eabi} extended relocations are used.
25125
25126 @item -meabi
25127 @itemx -mno-eabi
25128 @opindex meabi
25129 @opindex mno-eabi
25130 On System V.4 and embedded PowerPC systems do (do not) adhere to the
25131 Embedded Applications Binary Interface (EABI), which is a set of
25132 modifications to the System V.4 specifications. Selecting @option{-meabi}
25133 means that the stack is aligned to an 8-byte boundary, a function
25134 @code{__eabi} is called from @code{main} to set up the EABI
25135 environment, and the @option{-msdata} option can use both @code{r2} and
25136 @code{r13} to point to two separate small data areas. Selecting
25137 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
25138 no EABI initialization function is called from @code{main}, and the
25139 @option{-msdata} option only uses @code{r13} to point to a single
25140 small data area. The @option{-meabi} option is on by default if you
25141 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
25142
25143 @item -msdata=eabi
25144 @opindex msdata=eabi
25145 On System V.4 and embedded PowerPC systems, put small initialized
25146 @code{const} global and static data in the @code{.sdata2} section, which
25147 is pointed to by register @code{r2}. Put small initialized
25148 non-@code{const} global and static data in the @code{.sdata} section,
25149 which is pointed to by register @code{r13}. Put small uninitialized
25150 global and static data in the @code{.sbss} section, which is adjacent to
25151 the @code{.sdata} section. The @option{-msdata=eabi} option is
25152 incompatible with the @option{-mrelocatable} option. The
25153 @option{-msdata=eabi} option also sets the @option{-memb} option.
25154
25155 @item -msdata=sysv
25156 @opindex msdata=sysv
25157 On System V.4 and embedded PowerPC systems, put small global and static
25158 data in the @code{.sdata} section, which is pointed to by register
25159 @code{r13}. Put small uninitialized global and static data in the
25160 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
25161 The @option{-msdata=sysv} option is incompatible with the
25162 @option{-mrelocatable} option.
25163
25164 @item -msdata=default
25165 @itemx -msdata
25166 @opindex msdata=default
25167 @opindex msdata
25168 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
25169 compile code the same as @option{-msdata=eabi}, otherwise compile code the
25170 same as @option{-msdata=sysv}.
25171
25172 @item -msdata=data
25173 @opindex msdata=data
25174 On System V.4 and embedded PowerPC systems, put small global
25175 data in the @code{.sdata} section. Put small uninitialized global
25176 data in the @code{.sbss} section. Do not use register @code{r13}
25177 to address small data however. This is the default behavior unless
25178 other @option{-msdata} options are used.
25179
25180 @item -msdata=none
25181 @itemx -mno-sdata
25182 @opindex msdata=none
25183 @opindex mno-sdata
25184 On embedded PowerPC systems, put all initialized global and static data
25185 in the @code{.data} section, and all uninitialized data in the
25186 @code{.bss} section.
25187
25188 @item -mreadonly-in-sdata
25189 @opindex mreadonly-in-sdata
25190 @opindex mno-readonly-in-sdata
25191 Put read-only objects in the @code{.sdata} section as well. This is the
25192 default.
25193
25194 @item -mblock-move-inline-limit=@var{num}
25195 @opindex mblock-move-inline-limit
25196 Inline all block moves (such as calls to @code{memcpy} or structure
25197 copies) less than or equal to @var{num} bytes. The minimum value for
25198 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
25199 targets. The default value is target-specific.
25200
25201 @item -mblock-compare-inline-limit=@var{num}
25202 @opindex mblock-compare-inline-limit
25203 Generate non-looping inline code for all block compares (such as calls
25204 to @code{memcmp} or structure compares) less than or equal to @var{num}
25205 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25206 block compare is disabled. The default value is target-specific.
25207
25208 @item -mblock-compare-inline-loop-limit=@var{num}
25209 @opindex mblock-compare-inline-loop-limit
25210 Generate an inline expansion using loop code for all block compares that
25211 are less than or equal to @var{num} bytes, but greater than the limit
25212 for non-loop inline block compare expansion. If the block length is not
25213 constant, at most @var{num} bytes will be compared before @code{memcmp}
25214 is called to compare the remainder of the block. The default value is
25215 target-specific.
25216
25217 @item -mstring-compare-inline-limit=@var{num}
25218 @opindex mstring-compare-inline-limit
25219 Compare at most @var{num} string bytes with inline code.
25220 If the difference or end of string is not found at the
25221 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25222 take care of the rest of the comparison. The default is 64 bytes.
25223
25224 @item -G @var{num}
25225 @opindex G
25226 @cindex smaller data references (PowerPC)
25227 @cindex .sdata/.sdata2 references (PowerPC)
25228 On embedded PowerPC systems, put global and static items less than or
25229 equal to @var{num} bytes into the small data or BSS sections instead of
25230 the normal data or BSS section. By default, @var{num} is 8. The
25231 @option{-G @var{num}} switch is also passed to the linker.
25232 All modules should be compiled with the same @option{-G @var{num}} value.
25233
25234 @item -mregnames
25235 @itemx -mno-regnames
25236 @opindex mregnames
25237 @opindex mno-regnames
25238 On System V.4 and embedded PowerPC systems do (do not) emit register
25239 names in the assembly language output using symbolic forms.
25240
25241 @item -mlongcall
25242 @itemx -mno-longcall
25243 @opindex mlongcall
25244 @opindex mno-longcall
25245 By default assume that all calls are far away so that a longer and more
25246 expensive calling sequence is required. This is required for calls
25247 farther than 32 megabytes (33,554,432 bytes) from the current location.
25248 A short call is generated if the compiler knows
25249 the call cannot be that far away. This setting can be overridden by
25250 the @code{shortcall} function attribute, or by @code{#pragma
25251 longcall(0)}.
25252
25253 Some linkers are capable of detecting out-of-range calls and generating
25254 glue code on the fly. On these systems, long calls are unnecessary and
25255 generate slower code. As of this writing, the AIX linker can do this,
25256 as can the GNU linker for PowerPC/64. It is planned to add this feature
25257 to the GNU linker for 32-bit PowerPC systems as well.
25258
25259 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
25260 GCC can generate long calls using an inline PLT call sequence (see
25261 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
25262 ELFv1 (big-endian) do not support inline PLT calls.
25263
25264 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25265 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25266 addresses represent the callee and the branch island. The
25267 Darwin/PPC linker prefers the first address and generates a @code{bl
25268 callee} if the PPC @code{bl} instruction reaches the callee directly;
25269 otherwise, the linker generates @code{bl L42} to call the branch
25270 island. The branch island is appended to the body of the
25271 calling function; it computes the full 32-bit address of the callee
25272 and jumps to it.
25273
25274 On Mach-O (Darwin) systems, this option directs the compiler emit to
25275 the glue for every direct call, and the Darwin linker decides whether
25276 to use or discard it.
25277
25278 In the future, GCC may ignore all longcall specifications
25279 when the linker is known to generate glue.
25280
25281 @item -mpltseq
25282 @itemx -mno-pltseq
25283 @opindex mpltseq
25284 @opindex mno-pltseq
25285 Implement (do not implement) -fno-plt and long calls using an inline
25286 PLT call sequence that supports lazy linking and long calls to
25287 functions in dlopen'd shared libraries. Inline PLT calls are only
25288 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25289 linkers, and are enabled by default if the support is detected when
25290 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25291 configured with @option{--enable-secureplt}. @option{-mpltseq} code
25292 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25293 linked together.
25294
25295 @item -mtls-markers
25296 @itemx -mno-tls-markers
25297 @opindex mtls-markers
25298 @opindex mno-tls-markers
25299 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25300 specifying the function argument. The relocation allows the linker to
25301 reliably associate function call with argument setup instructions for
25302 TLS optimization, which in turn allows GCC to better schedule the
25303 sequence.
25304
25305 @item -mrecip
25306 @itemx -mno-recip
25307 @opindex mrecip
25308 This option enables use of the reciprocal estimate and
25309 reciprocal square root estimate instructions with additional
25310 Newton-Raphson steps to increase precision instead of doing a divide or
25311 square root and divide for floating-point arguments. You should use
25312 the @option{-ffast-math} option when using @option{-mrecip} (or at
25313 least @option{-funsafe-math-optimizations},
25314 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25315 @option{-fno-trapping-math}). Note that while the throughput of the
25316 sequence is generally higher than the throughput of the non-reciprocal
25317 instruction, the precision of the sequence can be decreased by up to 2
25318 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25319 roots.
25320
25321 @item -mrecip=@var{opt}
25322 @opindex mrecip=opt
25323 This option controls which reciprocal estimate instructions
25324 may be used. @var{opt} is a comma-separated list of options, which may
25325 be preceded by a @code{!} to invert the option:
25326
25327 @table @samp
25328
25329 @item all
25330 Enable all estimate instructions.
25331
25332 @item default
25333 Enable the default instructions, equivalent to @option{-mrecip}.
25334
25335 @item none
25336 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25337
25338 @item div
25339 Enable the reciprocal approximation instructions for both
25340 single and double precision.
25341
25342 @item divf
25343 Enable the single-precision reciprocal approximation instructions.
25344
25345 @item divd
25346 Enable the double-precision reciprocal approximation instructions.
25347
25348 @item rsqrt
25349 Enable the reciprocal square root approximation instructions for both
25350 single and double precision.
25351
25352 @item rsqrtf
25353 Enable the single-precision reciprocal square root approximation instructions.
25354
25355 @item rsqrtd
25356 Enable the double-precision reciprocal square root approximation instructions.
25357
25358 @end table
25359
25360 So, for example, @option{-mrecip=all,!rsqrtd} enables
25361 all of the reciprocal estimate instructions, except for the
25362 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25363 which handle the double-precision reciprocal square root calculations.
25364
25365 @item -mrecip-precision
25366 @itemx -mno-recip-precision
25367 @opindex mrecip-precision
25368 Assume (do not assume) that the reciprocal estimate instructions
25369 provide higher-precision estimates than is mandated by the PowerPC
25370 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25371 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25372 The double-precision square root estimate instructions are not generated by
25373 default on low-precision machines, since they do not provide an
25374 estimate that converges after three steps.
25375
25376 @item -mveclibabi=@var{type}
25377 @opindex mveclibabi
25378 Specifies the ABI type to use for vectorizing intrinsics using an
25379 external library. The only type supported at present is @samp{mass},
25380 which specifies to use IBM's Mathematical Acceleration Subsystem
25381 (MASS) libraries for vectorizing intrinsics using external libraries.
25382 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25383 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25384 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25385 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25386 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25387 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25388 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25389 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25390 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25391 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25392 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25393 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25394 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25395 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25396 for power7. Both @option{-ftree-vectorize} and
25397 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25398 libraries must be specified at link time.
25399
25400 @item -mfriz
25401 @itemx -mno-friz
25402 @opindex mfriz
25403 Generate (do not generate) the @code{friz} instruction when the
25404 @option{-funsafe-math-optimizations} option is used to optimize
25405 rounding of floating-point values to 64-bit integer and back to floating
25406 point. The @code{friz} instruction does not return the same value if
25407 the floating-point number is too large to fit in an integer.
25408
25409 @item -mpointers-to-nested-functions
25410 @itemx -mno-pointers-to-nested-functions
25411 @opindex mpointers-to-nested-functions
25412 Generate (do not generate) code to load up the static chain register
25413 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25414 systems where a function pointer points to a 3-word descriptor giving
25415 the function address, TOC value to be loaded in register @code{r2}, and
25416 static chain value to be loaded in register @code{r11}. The
25417 @option{-mpointers-to-nested-functions} is on by default. You cannot
25418 call through pointers to nested functions or pointers
25419 to functions compiled in other languages that use the static chain if
25420 you use @option{-mno-pointers-to-nested-functions}.
25421
25422 @item -msave-toc-indirect
25423 @itemx -mno-save-toc-indirect
25424 @opindex msave-toc-indirect
25425 Generate (do not generate) code to save the TOC value in the reserved
25426 stack location in the function prologue if the function calls through
25427 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25428 saved in the prologue, it is saved just before the call through the
25429 pointer. The @option{-mno-save-toc-indirect} option is the default.
25430
25431 @item -mcompat-align-parm
25432 @itemx -mno-compat-align-parm
25433 @opindex mcompat-align-parm
25434 Generate (do not generate) code to pass structure parameters with a
25435 maximum alignment of 64 bits, for compatibility with older versions
25436 of GCC.
25437
25438 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25439 structure parameter on a 128-bit boundary when that structure contained
25440 a member requiring 128-bit alignment. This is corrected in more
25441 recent versions of GCC. This option may be used to generate code
25442 that is compatible with functions compiled with older versions of
25443 GCC.
25444
25445 The @option{-mno-compat-align-parm} option is the default.
25446
25447 @item -mstack-protector-guard=@var{guard}
25448 @itemx -mstack-protector-guard-reg=@var{reg}
25449 @itemx -mstack-protector-guard-offset=@var{offset}
25450 @itemx -mstack-protector-guard-symbol=@var{symbol}
25451 @opindex mstack-protector-guard
25452 @opindex mstack-protector-guard-reg
25453 @opindex mstack-protector-guard-offset
25454 @opindex mstack-protector-guard-symbol
25455 Generate stack protection code using canary at @var{guard}. Supported
25456 locations are @samp{global} for global canary or @samp{tls} for per-thread
25457 canary in the TLS block (the default with GNU libc version 2.4 or later).
25458
25459 With the latter choice the options
25460 @option{-mstack-protector-guard-reg=@var{reg}} and
25461 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25462 which register to use as base register for reading the canary, and from what
25463 offset from that base register. The default for those is as specified in the
25464 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25465 the offset with a symbol reference to a canary in the TLS block.
25466
25467 @item -mpcrel
25468 @itemx -mno-pcrel
25469 @opindex mpcrel
25470 @opindex mno-pcrel
25471 Generate (do not generate) pc-relative addressing when the option
25472 @option{-mcpu=future} is used.
25473 @end table
25474
25475 @node RX Options
25476 @subsection RX Options
25477 @cindex RX Options
25478
25479 These command-line options are defined for RX targets:
25480
25481 @table @gcctabopt
25482 @item -m64bit-doubles
25483 @itemx -m32bit-doubles
25484 @opindex m64bit-doubles
25485 @opindex m32bit-doubles
25486 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25487 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25488 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25489 works on 32-bit values, which is why the default is
25490 @option{-m32bit-doubles}.
25491
25492 @item -fpu
25493 @itemx -nofpu
25494 @opindex fpu
25495 @opindex nofpu
25496 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25497 floating-point hardware. The default is enabled for the RX600
25498 series and disabled for the RX200 series.
25499
25500 Floating-point instructions are only generated for 32-bit floating-point
25501 values, however, so the FPU hardware is not used for doubles if the
25502 @option{-m64bit-doubles} option is used.
25503
25504 @emph{Note} If the @option{-fpu} option is enabled then
25505 @option{-funsafe-math-optimizations} is also enabled automatically.
25506 This is because the RX FPU instructions are themselves unsafe.
25507
25508 @item -mcpu=@var{name}
25509 @opindex mcpu
25510 Selects the type of RX CPU to be targeted. Currently three types are
25511 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25512 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25513
25514 The only difference between @samp{RX600} and @samp{RX610} is that the
25515 @samp{RX610} does not support the @code{MVTIPL} instruction.
25516
25517 The @samp{RX200} series does not have a hardware floating-point unit
25518 and so @option{-nofpu} is enabled by default when this type is
25519 selected.
25520
25521 @item -mbig-endian-data
25522 @itemx -mlittle-endian-data
25523 @opindex mbig-endian-data
25524 @opindex mlittle-endian-data
25525 Store data (but not code) in the big-endian format. The default is
25526 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25527 format.
25528
25529 @item -msmall-data-limit=@var{N}
25530 @opindex msmall-data-limit
25531 Specifies the maximum size in bytes of global and static variables
25532 which can be placed into the small data area. Using the small data
25533 area can lead to smaller and faster code, but the size of area is
25534 limited and it is up to the programmer to ensure that the area does
25535 not overflow. Also when the small data area is used one of the RX's
25536 registers (usually @code{r13}) is reserved for use pointing to this
25537 area, so it is no longer available for use by the compiler. This
25538 could result in slower and/or larger code if variables are pushed onto
25539 the stack instead of being held in this register.
25540
25541 Note, common variables (variables that have not been initialized) and
25542 constants are not placed into the small data area as they are assigned
25543 to other sections in the output executable.
25544
25545 The default value is zero, which disables this feature. Note, this
25546 feature is not enabled by default with higher optimization levels
25547 (@option{-O2} etc) because of the potentially detrimental effects of
25548 reserving a register. It is up to the programmer to experiment and
25549 discover whether this feature is of benefit to their program. See the
25550 description of the @option{-mpid} option for a description of how the
25551 actual register to hold the small data area pointer is chosen.
25552
25553 @item -msim
25554 @itemx -mno-sim
25555 @opindex msim
25556 @opindex mno-sim
25557 Use the simulator runtime. The default is to use the libgloss
25558 board-specific runtime.
25559
25560 @item -mas100-syntax
25561 @itemx -mno-as100-syntax
25562 @opindex mas100-syntax
25563 @opindex mno-as100-syntax
25564 When generating assembler output use a syntax that is compatible with
25565 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25566 assembler, but it has some restrictions so it is not generated by default.
25567
25568 @item -mmax-constant-size=@var{N}
25569 @opindex mmax-constant-size
25570 Specifies the maximum size, in bytes, of a constant that can be used as
25571 an operand in a RX instruction. Although the RX instruction set does
25572 allow constants of up to 4 bytes in length to be used in instructions,
25573 a longer value equates to a longer instruction. Thus in some
25574 circumstances it can be beneficial to restrict the size of constants
25575 that are used in instructions. Constants that are too big are instead
25576 placed into a constant pool and referenced via register indirection.
25577
25578 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25579 or 4 means that constants of any size are allowed.
25580
25581 @item -mrelax
25582 @opindex mrelax
25583 Enable linker relaxation. Linker relaxation is a process whereby the
25584 linker attempts to reduce the size of a program by finding shorter
25585 versions of various instructions. Disabled by default.
25586
25587 @item -mint-register=@var{N}
25588 @opindex mint-register
25589 Specify the number of registers to reserve for fast interrupt handler
25590 functions. The value @var{N} can be between 0 and 4. A value of 1
25591 means that register @code{r13} is reserved for the exclusive use
25592 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25593 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25594 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25595 A value of 0, the default, does not reserve any registers.
25596
25597 @item -msave-acc-in-interrupts
25598 @opindex msave-acc-in-interrupts
25599 Specifies that interrupt handler functions should preserve the
25600 accumulator register. This is only necessary if normal code might use
25601 the accumulator register, for example because it performs 64-bit
25602 multiplications. The default is to ignore the accumulator as this
25603 makes the interrupt handlers faster.
25604
25605 @item -mpid
25606 @itemx -mno-pid
25607 @opindex mpid
25608 @opindex mno-pid
25609 Enables the generation of position independent data. When enabled any
25610 access to constant data is done via an offset from a base address
25611 held in a register. This allows the location of constant data to be
25612 determined at run time without requiring the executable to be
25613 relocated, which is a benefit to embedded applications with tight
25614 memory constraints. Data that can be modified is not affected by this
25615 option.
25616
25617 Note, using this feature reserves a register, usually @code{r13}, for
25618 the constant data base address. This can result in slower and/or
25619 larger code, especially in complicated functions.
25620
25621 The actual register chosen to hold the constant data base address
25622 depends upon whether the @option{-msmall-data-limit} and/or the
25623 @option{-mint-register} command-line options are enabled. Starting
25624 with register @code{r13} and proceeding downwards, registers are
25625 allocated first to satisfy the requirements of @option{-mint-register},
25626 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25627 is possible for the small data area register to be @code{r8} if both
25628 @option{-mint-register=4} and @option{-mpid} are specified on the
25629 command line.
25630
25631 By default this feature is not enabled. The default can be restored
25632 via the @option{-mno-pid} command-line option.
25633
25634 @item -mno-warn-multiple-fast-interrupts
25635 @itemx -mwarn-multiple-fast-interrupts
25636 @opindex mno-warn-multiple-fast-interrupts
25637 @opindex mwarn-multiple-fast-interrupts
25638 Prevents GCC from issuing a warning message if it finds more than one
25639 fast interrupt handler when it is compiling a file. The default is to
25640 issue a warning for each extra fast interrupt handler found, as the RX
25641 only supports one such interrupt.
25642
25643 @item -mallow-string-insns
25644 @itemx -mno-allow-string-insns
25645 @opindex mallow-string-insns
25646 @opindex mno-allow-string-insns
25647 Enables or disables the use of the string manipulation instructions
25648 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25649 @code{SWHILE} and also the @code{RMPA} instruction. These
25650 instructions may prefetch data, which is not safe to do if accessing
25651 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25652 for more information).
25653
25654 The default is to allow these instructions, but it is not possible for
25655 GCC to reliably detect all circumstances where a string instruction
25656 might be used to access an I/O register, so their use cannot be
25657 disabled automatically. Instead it is reliant upon the programmer to
25658 use the @option{-mno-allow-string-insns} option if their program
25659 accesses I/O space.
25660
25661 When the instructions are enabled GCC defines the C preprocessor
25662 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25663 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25664
25665 @item -mjsr
25666 @itemx -mno-jsr
25667 @opindex mjsr
25668 @opindex mno-jsr
25669 Use only (or not only) @code{JSR} instructions to access functions.
25670 This option can be used when code size exceeds the range of @code{BSR}
25671 instructions. Note that @option{-mno-jsr} does not mean to not use
25672 @code{JSR} but instead means that any type of branch may be used.
25673 @end table
25674
25675 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25676 has special significance to the RX port when used with the
25677 @code{interrupt} function attribute. This attribute indicates a
25678 function intended to process fast interrupts. GCC ensures
25679 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25680 and/or @code{r13} and only provided that the normal use of the
25681 corresponding registers have been restricted via the
25682 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25683 options.
25684
25685 @node S/390 and zSeries Options
25686 @subsection S/390 and zSeries Options
25687 @cindex S/390 and zSeries Options
25688
25689 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25690
25691 @table @gcctabopt
25692 @item -mhard-float
25693 @itemx -msoft-float
25694 @opindex mhard-float
25695 @opindex msoft-float
25696 Use (do not use) the hardware floating-point instructions and registers
25697 for floating-point operations. When @option{-msoft-float} is specified,
25698 functions in @file{libgcc.a} are used to perform floating-point
25699 operations. When @option{-mhard-float} is specified, the compiler
25700 generates IEEE floating-point instructions. This is the default.
25701
25702 @item -mhard-dfp
25703 @itemx -mno-hard-dfp
25704 @opindex mhard-dfp
25705 @opindex mno-hard-dfp
25706 Use (do not use) the hardware decimal-floating-point instructions for
25707 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25708 specified, functions in @file{libgcc.a} are used to perform
25709 decimal-floating-point operations. When @option{-mhard-dfp} is
25710 specified, the compiler generates decimal-floating-point hardware
25711 instructions. This is the default for @option{-march=z9-ec} or higher.
25712
25713 @item -mlong-double-64
25714 @itemx -mlong-double-128
25715 @opindex mlong-double-64
25716 @opindex mlong-double-128
25717 These switches control the size of @code{long double} type. A size
25718 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25719 type. This is the default.
25720
25721 @item -mbackchain
25722 @itemx -mno-backchain
25723 @opindex mbackchain
25724 @opindex mno-backchain
25725 Store (do not store) the address of the caller's frame as backchain pointer
25726 into the callee's stack frame.
25727 A backchain may be needed to allow debugging using tools that do not understand
25728 DWARF call frame information.
25729 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25730 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25731 the backchain is placed into the topmost word of the 96/160 byte register
25732 save area.
25733
25734 In general, code compiled with @option{-mbackchain} is call-compatible with
25735 code compiled with @option{-mmo-backchain}; however, use of the backchain
25736 for debugging purposes usually requires that the whole binary is built with
25737 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25738 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25739 to build a linux kernel use @option{-msoft-float}.
25740
25741 The default is to not maintain the backchain.
25742
25743 @item -mpacked-stack
25744 @itemx -mno-packed-stack
25745 @opindex mpacked-stack
25746 @opindex mno-packed-stack
25747 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25748 specified, the compiler uses the all fields of the 96/160 byte register save
25749 area only for their default purpose; unused fields still take up stack space.
25750 When @option{-mpacked-stack} is specified, register save slots are densely
25751 packed at the top of the register save area; unused space is reused for other
25752 purposes, allowing for more efficient use of the available stack space.
25753 However, when @option{-mbackchain} is also in effect, the topmost word of
25754 the save area is always used to store the backchain, and the return address
25755 register is always saved two words below the backchain.
25756
25757 As long as the stack frame backchain is not used, code generated with
25758 @option{-mpacked-stack} is call-compatible with code generated with
25759 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25760 S/390 or zSeries generated code that uses the stack frame backchain at run
25761 time, not just for debugging purposes. Such code is not call-compatible
25762 with code compiled with @option{-mpacked-stack}. Also, note that the
25763 combination of @option{-mbackchain},
25764 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25765 to build a linux kernel use @option{-msoft-float}.
25766
25767 The default is to not use the packed stack layout.
25768
25769 @item -msmall-exec
25770 @itemx -mno-small-exec
25771 @opindex msmall-exec
25772 @opindex mno-small-exec
25773 Generate (or do not generate) code using the @code{bras} instruction
25774 to do subroutine calls.
25775 This only works reliably if the total executable size does not
25776 exceed 64k. The default is to use the @code{basr} instruction instead,
25777 which does not have this limitation.
25778
25779 @item -m64
25780 @itemx -m31
25781 @opindex m64
25782 @opindex m31
25783 When @option{-m31} is specified, generate code compliant to the
25784 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25785 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25786 particular to generate 64-bit instructions. For the @samp{s390}
25787 targets, the default is @option{-m31}, while the @samp{s390x}
25788 targets default to @option{-m64}.
25789
25790 @item -mzarch
25791 @itemx -mesa
25792 @opindex mzarch
25793 @opindex mesa
25794 When @option{-mzarch} is specified, generate code using the
25795 instructions available on z/Architecture.
25796 When @option{-mesa} is specified, generate code using the
25797 instructions available on ESA/390. Note that @option{-mesa} is
25798 not possible with @option{-m64}.
25799 When generating code compliant to the GNU/Linux for S/390 ABI,
25800 the default is @option{-mesa}. When generating code compliant
25801 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25802
25803 @item -mhtm
25804 @itemx -mno-htm
25805 @opindex mhtm
25806 @opindex mno-htm
25807 The @option{-mhtm} option enables a set of builtins making use of
25808 instructions available with the transactional execution facility
25809 introduced with the IBM zEnterprise EC12 machine generation
25810 @ref{S/390 System z Built-in Functions}.
25811 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25812
25813 @item -mvx
25814 @itemx -mno-vx
25815 @opindex mvx
25816 @opindex mno-vx
25817 When @option{-mvx} is specified, generate code using the instructions
25818 available with the vector extension facility introduced with the IBM
25819 z13 machine generation.
25820 This option changes the ABI for some vector type values with regard to
25821 alignment and calling conventions. In case vector type values are
25822 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25823 command will be added to mark the resulting binary with the ABI used.
25824 @option{-mvx} is enabled by default when using @option{-march=z13}.
25825
25826 @item -mzvector
25827 @itemx -mno-zvector
25828 @opindex mzvector
25829 @opindex mno-zvector
25830 The @option{-mzvector} option enables vector language extensions and
25831 builtins using instructions available with the vector extension
25832 facility introduced with the IBM z13 machine generation.
25833 This option adds support for @samp{vector} to be used as a keyword to
25834 define vector type variables and arguments. @samp{vector} is only
25835 available when GNU extensions are enabled. It will not be expanded
25836 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25837 In addition to the GCC low-level builtins @option{-mzvector} enables
25838 a set of builtins added for compatibility with AltiVec-style
25839 implementations like Power and Cell. In order to make use of these
25840 builtins the header file @file{vecintrin.h} needs to be included.
25841 @option{-mzvector} is disabled by default.
25842
25843 @item -mmvcle
25844 @itemx -mno-mvcle
25845 @opindex mmvcle
25846 @opindex mno-mvcle
25847 Generate (or do not generate) code using the @code{mvcle} instruction
25848 to perform block moves. When @option{-mno-mvcle} is specified,
25849 use a @code{mvc} loop instead. This is the default unless optimizing for
25850 size.
25851
25852 @item -mdebug
25853 @itemx -mno-debug
25854 @opindex mdebug
25855 @opindex mno-debug
25856 Print (or do not print) additional debug information when compiling.
25857 The default is to not print debug information.
25858
25859 @item -march=@var{cpu-type}
25860 @opindex march
25861 Generate code that runs on @var{cpu-type}, which is the name of a
25862 system representing a certain processor type. Possible values for
25863 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25864 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25865 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25866 @samp{z14}/@samp{arch12}, and @samp{native}.
25867
25868 The default is @option{-march=z900}.
25869
25870 Specifying @samp{native} as cpu type can be used to select the best
25871 architecture option for the host processor.
25872 @option{-march=native} has no effect if GCC does not recognize the
25873 processor.
25874
25875 @item -mtune=@var{cpu-type}
25876 @opindex mtune
25877 Tune to @var{cpu-type} everything applicable about the generated code,
25878 except for the ABI and the set of available instructions.
25879 The list of @var{cpu-type} values is the same as for @option{-march}.
25880 The default is the value used for @option{-march}.
25881
25882 @item -mtpf-trace
25883 @itemx -mno-tpf-trace
25884 @opindex mtpf-trace
25885 @opindex mno-tpf-trace
25886 Generate code that adds (does not add) in TPF OS specific branches to trace
25887 routines in the operating system. This option is off by default, even
25888 when compiling for the TPF OS@.
25889
25890 @item -mfused-madd
25891 @itemx -mno-fused-madd
25892 @opindex mfused-madd
25893 @opindex mno-fused-madd
25894 Generate code that uses (does not use) the floating-point multiply and
25895 accumulate instructions. These instructions are generated by default if
25896 hardware floating point is used.
25897
25898 @item -mwarn-framesize=@var{framesize}
25899 @opindex mwarn-framesize
25900 Emit a warning if the current function exceeds the given frame size. Because
25901 this is a compile-time check it doesn't need to be a real problem when the program
25902 runs. It is intended to identify functions that most probably cause
25903 a stack overflow. It is useful to be used in an environment with limited stack
25904 size e.g.@: the linux kernel.
25905
25906 @item -mwarn-dynamicstack
25907 @opindex mwarn-dynamicstack
25908 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25909 arrays. This is generally a bad idea with a limited stack size.
25910
25911 @item -mstack-guard=@var{stack-guard}
25912 @itemx -mstack-size=@var{stack-size}
25913 @opindex mstack-guard
25914 @opindex mstack-size
25915 If these options are provided the S/390 back end emits additional instructions in
25916 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25917 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25918 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25919 the frame size of the compiled function is chosen.
25920 These options are intended to be used to help debugging stack overflow problems.
25921 The additionally emitted code causes only little overhead and hence can also be
25922 used in production-like systems without greater performance degradation. The given
25923 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25924 @var{stack-guard} without exceeding 64k.
25925 In order to be efficient the extra code makes the assumption that the stack starts
25926 at an address aligned to the value given by @var{stack-size}.
25927 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25928
25929 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25930 @opindex mhotpatch
25931 If the hotpatch option is enabled, a ``hot-patching'' function
25932 prologue is generated for all functions in the compilation unit.
25933 The funtion label is prepended with the given number of two-byte
25934 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25935 the label, 2 * @var{post-halfwords} bytes are appended, using the
25936 largest NOP like instructions the architecture allows (maximum
25937 1000000).
25938
25939 If both arguments are zero, hotpatching is disabled.
25940
25941 This option can be overridden for individual functions with the
25942 @code{hotpatch} attribute.
25943 @end table
25944
25945 @node Score Options
25946 @subsection Score Options
25947 @cindex Score Options
25948
25949 These options are defined for Score implementations:
25950
25951 @table @gcctabopt
25952 @item -meb
25953 @opindex meb
25954 Compile code for big-endian mode. This is the default.
25955
25956 @item -mel
25957 @opindex mel
25958 Compile code for little-endian mode.
25959
25960 @item -mnhwloop
25961 @opindex mnhwloop
25962 Disable generation of @code{bcnz} instructions.
25963
25964 @item -muls
25965 @opindex muls
25966 Enable generation of unaligned load and store instructions.
25967
25968 @item -mmac
25969 @opindex mmac
25970 Enable the use of multiply-accumulate instructions. Disabled by default.
25971
25972 @item -mscore5
25973 @opindex mscore5
25974 Specify the SCORE5 as the target architecture.
25975
25976 @item -mscore5u
25977 @opindex mscore5u
25978 Specify the SCORE5U of the target architecture.
25979
25980 @item -mscore7
25981 @opindex mscore7
25982 Specify the SCORE7 as the target architecture. This is the default.
25983
25984 @item -mscore7d
25985 @opindex mscore7d
25986 Specify the SCORE7D as the target architecture.
25987 @end table
25988
25989 @node SH Options
25990 @subsection SH Options
25991
25992 These @samp{-m} options are defined for the SH implementations:
25993
25994 @table @gcctabopt
25995 @item -m1
25996 @opindex m1
25997 Generate code for the SH1.
25998
25999 @item -m2
26000 @opindex m2
26001 Generate code for the SH2.
26002
26003 @item -m2e
26004 Generate code for the SH2e.
26005
26006 @item -m2a-nofpu
26007 @opindex m2a-nofpu
26008 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
26009 that the floating-point unit is not used.
26010
26011 @item -m2a-single-only
26012 @opindex m2a-single-only
26013 Generate code for the SH2a-FPU, in such a way that no double-precision
26014 floating-point operations are used.
26015
26016 @item -m2a-single
26017 @opindex m2a-single
26018 Generate code for the SH2a-FPU assuming the floating-point unit is in
26019 single-precision mode by default.
26020
26021 @item -m2a
26022 @opindex m2a
26023 Generate code for the SH2a-FPU assuming the floating-point unit is in
26024 double-precision mode by default.
26025
26026 @item -m3
26027 @opindex m3
26028 Generate code for the SH3.
26029
26030 @item -m3e
26031 @opindex m3e
26032 Generate code for the SH3e.
26033
26034 @item -m4-nofpu
26035 @opindex m4-nofpu
26036 Generate code for the SH4 without a floating-point unit.
26037
26038 @item -m4-single-only
26039 @opindex m4-single-only
26040 Generate code for the SH4 with a floating-point unit that only
26041 supports single-precision arithmetic.
26042
26043 @item -m4-single
26044 @opindex m4-single
26045 Generate code for the SH4 assuming the floating-point unit is in
26046 single-precision mode by default.
26047
26048 @item -m4
26049 @opindex m4
26050 Generate code for the SH4.
26051
26052 @item -m4-100
26053 @opindex m4-100
26054 Generate code for SH4-100.
26055
26056 @item -m4-100-nofpu
26057 @opindex m4-100-nofpu
26058 Generate code for SH4-100 in such a way that the
26059 floating-point unit is not used.
26060
26061 @item -m4-100-single
26062 @opindex m4-100-single
26063 Generate code for SH4-100 assuming the floating-point unit is in
26064 single-precision mode by default.
26065
26066 @item -m4-100-single-only
26067 @opindex m4-100-single-only
26068 Generate code for SH4-100 in such a way that no double-precision
26069 floating-point operations are used.
26070
26071 @item -m4-200
26072 @opindex m4-200
26073 Generate code for SH4-200.
26074
26075 @item -m4-200-nofpu
26076 @opindex m4-200-nofpu
26077 Generate code for SH4-200 without in such a way that the
26078 floating-point unit is not used.
26079
26080 @item -m4-200-single
26081 @opindex m4-200-single
26082 Generate code for SH4-200 assuming the floating-point unit is in
26083 single-precision mode by default.
26084
26085 @item -m4-200-single-only
26086 @opindex m4-200-single-only
26087 Generate code for SH4-200 in such a way that no double-precision
26088 floating-point operations are used.
26089
26090 @item -m4-300
26091 @opindex m4-300
26092 Generate code for SH4-300.
26093
26094 @item -m4-300-nofpu
26095 @opindex m4-300-nofpu
26096 Generate code for SH4-300 without in such a way that the
26097 floating-point unit is not used.
26098
26099 @item -m4-300-single
26100 @opindex m4-300-single
26101 Generate code for SH4-300 in such a way that no double-precision
26102 floating-point operations are used.
26103
26104 @item -m4-300-single-only
26105 @opindex m4-300-single-only
26106 Generate code for SH4-300 in such a way that no double-precision
26107 floating-point operations are used.
26108
26109 @item -m4-340
26110 @opindex m4-340
26111 Generate code for SH4-340 (no MMU, no FPU).
26112
26113 @item -m4-500
26114 @opindex m4-500
26115 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
26116 assembler.
26117
26118 @item -m4a-nofpu
26119 @opindex m4a-nofpu
26120 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
26121 floating-point unit is not used.
26122
26123 @item -m4a-single-only
26124 @opindex m4a-single-only
26125 Generate code for the SH4a, in such a way that no double-precision
26126 floating-point operations are used.
26127
26128 @item -m4a-single
26129 @opindex m4a-single
26130 Generate code for the SH4a assuming the floating-point unit is in
26131 single-precision mode by default.
26132
26133 @item -m4a
26134 @opindex m4a
26135 Generate code for the SH4a.
26136
26137 @item -m4al
26138 @opindex m4al
26139 Same as @option{-m4a-nofpu}, except that it implicitly passes
26140 @option{-dsp} to the assembler. GCC doesn't generate any DSP
26141 instructions at the moment.
26142
26143 @item -mb
26144 @opindex mb
26145 Compile code for the processor in big-endian mode.
26146
26147 @item -ml
26148 @opindex ml
26149 Compile code for the processor in little-endian mode.
26150
26151 @item -mdalign
26152 @opindex mdalign
26153 Align doubles at 64-bit boundaries. Note that this changes the calling
26154 conventions, and thus some functions from the standard C library do
26155 not work unless you recompile it first with @option{-mdalign}.
26156
26157 @item -mrelax
26158 @opindex mrelax
26159 Shorten some address references at link time, when possible; uses the
26160 linker option @option{-relax}.
26161
26162 @item -mbigtable
26163 @opindex mbigtable
26164 Use 32-bit offsets in @code{switch} tables. The default is to use
26165 16-bit offsets.
26166
26167 @item -mbitops
26168 @opindex mbitops
26169 Enable the use of bit manipulation instructions on SH2A.
26170
26171 @item -mfmovd
26172 @opindex mfmovd
26173 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
26174 alignment constraints.
26175
26176 @item -mrenesas
26177 @opindex mrenesas
26178 Comply with the calling conventions defined by Renesas.
26179
26180 @item -mno-renesas
26181 @opindex mno-renesas
26182 Comply with the calling conventions defined for GCC before the Renesas
26183 conventions were available. This option is the default for all
26184 targets of the SH toolchain.
26185
26186 @item -mnomacsave
26187 @opindex mnomacsave
26188 Mark the @code{MAC} register as call-clobbered, even if
26189 @option{-mrenesas} is given.
26190
26191 @item -mieee
26192 @itemx -mno-ieee
26193 @opindex mieee
26194 @opindex mno-ieee
26195 Control the IEEE compliance of floating-point comparisons, which affects the
26196 handling of cases where the result of a comparison is unordered. By default
26197 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
26198 enabled @option{-mno-ieee} is implicitly set, which results in faster
26199 floating-point greater-equal and less-equal comparisons. The implicit settings
26200 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
26201
26202 @item -minline-ic_invalidate
26203 @opindex minline-ic_invalidate
26204 Inline code to invalidate instruction cache entries after setting up
26205 nested function trampolines.
26206 This option has no effect if @option{-musermode} is in effect and the selected
26207 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26208 instruction.
26209 If the selected code generation option does not allow the use of the @code{icbi}
26210 instruction, and @option{-musermode} is not in effect, the inlined code
26211 manipulates the instruction cache address array directly with an associative
26212 write. This not only requires privileged mode at run time, but it also
26213 fails if the cache line had been mapped via the TLB and has become unmapped.
26214
26215 @item -misize
26216 @opindex misize
26217 Dump instruction size and location in the assembly code.
26218
26219 @item -mpadstruct
26220 @opindex mpadstruct
26221 This option is deprecated. It pads structures to multiple of 4 bytes,
26222 which is incompatible with the SH ABI@.
26223
26224 @item -matomic-model=@var{model}
26225 @opindex matomic-model=@var{model}
26226 Sets the model of atomic operations and additional parameters as a comma
26227 separated list. For details on the atomic built-in functions see
26228 @ref{__atomic Builtins}. The following models and parameters are supported:
26229
26230 @table @samp
26231
26232 @item none
26233 Disable compiler generated atomic sequences and emit library calls for atomic
26234 operations. This is the default if the target is not @code{sh*-*-linux*}.
26235
26236 @item soft-gusa
26237 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26238 built-in functions. The generated atomic sequences require additional support
26239 from the interrupt/exception handling code of the system and are only suitable
26240 for SH3* and SH4* single-core systems. This option is enabled by default when
26241 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26242 this option also partially utilizes the hardware atomic instructions
26243 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26244 @samp{strict} is specified.
26245
26246 @item soft-tcb
26247 Generate software atomic sequences that use a variable in the thread control
26248 block. This is a variation of the gUSA sequences which can also be used on
26249 SH1* and SH2* targets. The generated atomic sequences require additional
26250 support from the interrupt/exception handling code of the system and are only
26251 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26252 parameter has to be specified as well.
26253
26254 @item soft-imask
26255 Generate software atomic sequences that temporarily disable interrupts by
26256 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26257 in privileged mode and is only suitable for single-core systems. Additional
26258 support from the interrupt/exception handling code of the system is not
26259 required. This model is enabled by default when the target is
26260 @code{sh*-*-linux*} and SH1* or SH2*.
26261
26262 @item hard-llcs
26263 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26264 instructions only. This is only available on SH4A and is suitable for
26265 multi-core systems. Since the hardware instructions support only 32 bit atomic
26266 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26267 Code compiled with this option is also compatible with other software
26268 atomic model interrupt/exception handling systems if executed on an SH4A
26269 system. Additional support from the interrupt/exception handling code of the
26270 system is not required for this model.
26271
26272 @item gbr-offset=
26273 This parameter specifies the offset in bytes of the variable in the thread
26274 control block structure that should be used by the generated atomic sequences
26275 when the @samp{soft-tcb} model has been selected. For other models this
26276 parameter is ignored. The specified value must be an integer multiple of four
26277 and in the range 0-1020.
26278
26279 @item strict
26280 This parameter prevents mixed usage of multiple atomic models, even if they
26281 are compatible, and makes the compiler generate atomic sequences of the
26282 specified model only.
26283
26284 @end table
26285
26286 @item -mtas
26287 @opindex mtas
26288 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26289 Notice that depending on the particular hardware and software configuration
26290 this can degrade overall performance due to the operand cache line flushes
26291 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26292 processors the @code{tas.b} instruction must be used with caution since it
26293 can result in data corruption for certain cache configurations.
26294
26295 @item -mprefergot
26296 @opindex mprefergot
26297 When generating position-independent code, emit function calls using
26298 the Global Offset Table instead of the Procedure Linkage Table.
26299
26300 @item -musermode
26301 @itemx -mno-usermode
26302 @opindex musermode
26303 @opindex mno-usermode
26304 Don't allow (allow) the compiler generating privileged mode code. Specifying
26305 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26306 inlined code would not work in user mode. @option{-musermode} is the default
26307 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26308 @option{-musermode} has no effect, since there is no user mode.
26309
26310 @item -multcost=@var{number}
26311 @opindex multcost=@var{number}
26312 Set the cost to assume for a multiply insn.
26313
26314 @item -mdiv=@var{strategy}
26315 @opindex mdiv=@var{strategy}
26316 Set the division strategy to be used for integer division operations.
26317 @var{strategy} can be one of:
26318
26319 @table @samp
26320
26321 @item call-div1
26322 Calls a library function that uses the single-step division instruction
26323 @code{div1} to perform the operation. Division by zero calculates an
26324 unspecified result and does not trap. This is the default except for SH4,
26325 SH2A and SHcompact.
26326
26327 @item call-fp
26328 Calls a library function that performs the operation in double precision
26329 floating point. Division by zero causes a floating-point exception. This is
26330 the default for SHcompact with FPU. Specifying this for targets that do not
26331 have a double precision FPU defaults to @code{call-div1}.
26332
26333 @item call-table
26334 Calls a library function that uses a lookup table for small divisors and
26335 the @code{div1} instruction with case distinction for larger divisors. Division
26336 by zero calculates an unspecified result and does not trap. This is the default
26337 for SH4. Specifying this for targets that do not have dynamic shift
26338 instructions defaults to @code{call-div1}.
26339
26340 @end table
26341
26342 When a division strategy has not been specified the default strategy is
26343 selected based on the current target. For SH2A the default strategy is to
26344 use the @code{divs} and @code{divu} instructions instead of library function
26345 calls.
26346
26347 @item -maccumulate-outgoing-args
26348 @opindex maccumulate-outgoing-args
26349 Reserve space once for outgoing arguments in the function prologue rather
26350 than around each call. Generally beneficial for performance and size. Also
26351 needed for unwinding to avoid changing the stack frame around conditional code.
26352
26353 @item -mdivsi3_libfunc=@var{name}
26354 @opindex mdivsi3_libfunc=@var{name}
26355 Set the name of the library function used for 32-bit signed division to
26356 @var{name}.
26357 This only affects the name used in the @samp{call} division strategies, and
26358 the compiler still expects the same sets of input/output/clobbered registers as
26359 if this option were not present.
26360
26361 @item -mfixed-range=@var{register-range}
26362 @opindex mfixed-range
26363 Generate code treating the given register range as fixed registers.
26364 A fixed register is one that the register allocator cannot use. This is
26365 useful when compiling kernel code. A register range is specified as
26366 two registers separated by a dash. Multiple register ranges can be
26367 specified separated by a comma.
26368
26369 @item -mbranch-cost=@var{num}
26370 @opindex mbranch-cost=@var{num}
26371 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26372 make the compiler try to generate more branch-free code if possible.
26373 If not specified the value is selected depending on the processor type that
26374 is being compiled for.
26375
26376 @item -mzdcbranch
26377 @itemx -mno-zdcbranch
26378 @opindex mzdcbranch
26379 @opindex mno-zdcbranch
26380 Assume (do not assume) that zero displacement conditional branch instructions
26381 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26382 compiler prefers zero displacement branch code sequences. This is
26383 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26384 disabled by specifying @option{-mno-zdcbranch}.
26385
26386 @item -mcbranch-force-delay-slot
26387 @opindex mcbranch-force-delay-slot
26388 Force the usage of delay slots for conditional branches, which stuffs the delay
26389 slot with a @code{nop} if a suitable instruction cannot be found. By default
26390 this option is disabled. It can be enabled to work around hardware bugs as
26391 found in the original SH7055.
26392
26393 @item -mfused-madd
26394 @itemx -mno-fused-madd
26395 @opindex mfused-madd
26396 @opindex mno-fused-madd
26397 Generate code that uses (does not use) the floating-point multiply and
26398 accumulate instructions. These instructions are generated by default
26399 if hardware floating point is used. The machine-dependent
26400 @option{-mfused-madd} option is now mapped to the machine-independent
26401 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26402 mapped to @option{-ffp-contract=off}.
26403
26404 @item -mfsca
26405 @itemx -mno-fsca
26406 @opindex mfsca
26407 @opindex mno-fsca
26408 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26409 and cosine approximations. The option @option{-mfsca} must be used in
26410 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26411 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26412 approximations even if @option{-funsafe-math-optimizations} is in effect.
26413
26414 @item -mfsrra
26415 @itemx -mno-fsrra
26416 @opindex mfsrra
26417 @opindex mno-fsrra
26418 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26419 reciprocal square root approximations. The option @option{-mfsrra} must be used
26420 in combination with @option{-funsafe-math-optimizations} and
26421 @option{-ffinite-math-only}. It is enabled by default when generating code for
26422 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26423 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26424 in effect.
26425
26426 @item -mpretend-cmove
26427 @opindex mpretend-cmove
26428 Prefer zero-displacement conditional branches for conditional move instruction
26429 patterns. This can result in faster code on the SH4 processor.
26430
26431 @item -mfdpic
26432 @opindex fdpic
26433 Generate code using the FDPIC ABI.
26434
26435 @end table
26436
26437 @node Solaris 2 Options
26438 @subsection Solaris 2 Options
26439 @cindex Solaris 2 options
26440
26441 These @samp{-m} options are supported on Solaris 2:
26442
26443 @table @gcctabopt
26444 @item -mclear-hwcap
26445 @opindex mclear-hwcap
26446 @option{-mclear-hwcap} tells the compiler to remove the hardware
26447 capabilities generated by the Solaris assembler. This is only necessary
26448 when object files use ISA extensions not supported by the current
26449 machine, but check at runtime whether or not to use them.
26450
26451 @item -mimpure-text
26452 @opindex mimpure-text
26453 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26454 the compiler to not pass @option{-z text} to the linker when linking a
26455 shared object. Using this option, you can link position-dependent
26456 code into a shared object.
26457
26458 @option{-mimpure-text} suppresses the ``relocations remain against
26459 allocatable but non-writable sections'' linker error message.
26460 However, the necessary relocations trigger copy-on-write, and the
26461 shared object is not actually shared across processes. Instead of
26462 using @option{-mimpure-text}, you should compile all source code with
26463 @option{-fpic} or @option{-fPIC}.
26464
26465 @end table
26466
26467 These switches are supported in addition to the above on Solaris 2:
26468
26469 @table @gcctabopt
26470 @item -pthreads
26471 @opindex pthreads
26472 This is a synonym for @option{-pthread}.
26473 @end table
26474
26475 @node SPARC Options
26476 @subsection SPARC Options
26477 @cindex SPARC options
26478
26479 These @samp{-m} options are supported on the SPARC:
26480
26481 @table @gcctabopt
26482 @item -mno-app-regs
26483 @itemx -mapp-regs
26484 @opindex mno-app-regs
26485 @opindex mapp-regs
26486 Specify @option{-mapp-regs} to generate output using the global registers
26487 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26488 global register 1, each global register 2 through 4 is then treated as an
26489 allocable register that is clobbered by function calls. This is the default.
26490
26491 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26492 specify @option{-mno-app-regs}. You should compile libraries and system
26493 software with this option.
26494
26495 @item -mflat
26496 @itemx -mno-flat
26497 @opindex mflat
26498 @opindex mno-flat
26499 With @option{-mflat}, the compiler does not generate save/restore instructions
26500 and uses a ``flat'' or single register window model. This model is compatible
26501 with the regular register window model. The local registers and the input
26502 registers (0--5) are still treated as ``call-saved'' registers and are
26503 saved on the stack as needed.
26504
26505 With @option{-mno-flat} (the default), the compiler generates save/restore
26506 instructions (except for leaf functions). This is the normal operating mode.
26507
26508 @item -mfpu
26509 @itemx -mhard-float
26510 @opindex mfpu
26511 @opindex mhard-float
26512 Generate output containing floating-point instructions. This is the
26513 default.
26514
26515 @item -mno-fpu
26516 @itemx -msoft-float
26517 @opindex mno-fpu
26518 @opindex msoft-float
26519 Generate output containing library calls for floating point.
26520 @strong{Warning:} the requisite libraries are not available for all SPARC
26521 targets. Normally the facilities of the machine's usual C compiler are
26522 used, but this cannot be done directly in cross-compilation. You must make
26523 your own arrangements to provide suitable library functions for
26524 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26525 @samp{sparclite-*-*} do provide software floating-point support.
26526
26527 @option{-msoft-float} changes the calling convention in the output file;
26528 therefore, it is only useful if you compile @emph{all} of a program with
26529 this option. In particular, you need to compile @file{libgcc.a}, the
26530 library that comes with GCC, with @option{-msoft-float} in order for
26531 this to work.
26532
26533 @item -mhard-quad-float
26534 @opindex mhard-quad-float
26535 Generate output containing quad-word (long double) floating-point
26536 instructions.
26537
26538 @item -msoft-quad-float
26539 @opindex msoft-quad-float
26540 Generate output containing library calls for quad-word (long double)
26541 floating-point instructions. The functions called are those specified
26542 in the SPARC ABI@. This is the default.
26543
26544 As of this writing, there are no SPARC implementations that have hardware
26545 support for the quad-word floating-point instructions. They all invoke
26546 a trap handler for one of these instructions, and then the trap handler
26547 emulates the effect of the instruction. Because of the trap handler overhead,
26548 this is much slower than calling the ABI library routines. Thus the
26549 @option{-msoft-quad-float} option is the default.
26550
26551 @item -mno-unaligned-doubles
26552 @itemx -munaligned-doubles
26553 @opindex mno-unaligned-doubles
26554 @opindex munaligned-doubles
26555 Assume that doubles have 8-byte alignment. This is the default.
26556
26557 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26558 alignment only if they are contained in another type, or if they have an
26559 absolute address. Otherwise, it assumes they have 4-byte alignment.
26560 Specifying this option avoids some rare compatibility problems with code
26561 generated by other compilers. It is not the default because it results
26562 in a performance loss, especially for floating-point code.
26563
26564 @item -muser-mode
26565 @itemx -mno-user-mode
26566 @opindex muser-mode
26567 @opindex mno-user-mode
26568 Do not generate code that can only run in supervisor mode. This is relevant
26569 only for the @code{casa} instruction emitted for the LEON3 processor. This
26570 is the default.
26571
26572 @item -mfaster-structs
26573 @itemx -mno-faster-structs
26574 @opindex mfaster-structs
26575 @opindex mno-faster-structs
26576 With @option{-mfaster-structs}, the compiler assumes that structures
26577 should have 8-byte alignment. This enables the use of pairs of
26578 @code{ldd} and @code{std} instructions for copies in structure
26579 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26580 However, the use of this changed alignment directly violates the SPARC
26581 ABI@. Thus, it's intended only for use on targets where the developer
26582 acknowledges that their resulting code is not directly in line with
26583 the rules of the ABI@.
26584
26585 @item -mstd-struct-return
26586 @itemx -mno-std-struct-return
26587 @opindex mstd-struct-return
26588 @opindex mno-std-struct-return
26589 With @option{-mstd-struct-return}, the compiler generates checking code
26590 in functions returning structures or unions to detect size mismatches
26591 between the two sides of function calls, as per the 32-bit ABI@.
26592
26593 The default is @option{-mno-std-struct-return}. This option has no effect
26594 in 64-bit mode.
26595
26596 @item -mlra
26597 @itemx -mno-lra
26598 @opindex mlra
26599 @opindex mno-lra
26600 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26601 so @option{-mno-lra} needs to be passed to get old Reload.
26602
26603 @item -mcpu=@var{cpu_type}
26604 @opindex mcpu
26605 Set the instruction set, register set, and instruction scheduling parameters
26606 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26607 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26608 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26609 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26610 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26611 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26612
26613 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26614 which selects the best architecture option for the host processor.
26615 @option{-mcpu=native} has no effect if GCC does not recognize
26616 the processor.
26617
26618 Default instruction scheduling parameters are used for values that select
26619 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26620 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26621
26622 Here is a list of each supported architecture and their supported
26623 implementations.
26624
26625 @table @asis
26626 @item v7
26627 cypress, leon3v7
26628
26629 @item v8
26630 supersparc, hypersparc, leon, leon3
26631
26632 @item sparclite
26633 f930, f934, sparclite86x
26634
26635 @item sparclet
26636 tsc701
26637
26638 @item v9
26639 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26640 niagara7, m8
26641 @end table
26642
26643 By default (unless configured otherwise), GCC generates code for the V7
26644 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26645 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26646 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26647 SPARCStation 1, 2, IPX etc.
26648
26649 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26650 architecture. The only difference from V7 code is that the compiler emits
26651 the integer multiply and integer divide instructions which exist in SPARC-V8
26652 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26653 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26654 2000 series.
26655
26656 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26657 the SPARC architecture. This adds the integer multiply, integer divide step
26658 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26659 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26660 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26661 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26662 MB86934 chip, which is the more recent SPARClite with FPU@.
26663
26664 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26665 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26666 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26667 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26668 optimizes it for the TEMIC SPARClet chip.
26669
26670 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26671 architecture. This adds 64-bit integer and floating-point move instructions,
26672 3 additional floating-point condition code registers and conditional move
26673 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26674 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26675 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26676 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26677 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26678 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26679 additionally optimizes it for Sun UltraSPARC T2 chips. With
26680 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26681 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26682 additionally optimizes it for Sun UltraSPARC T4 chips. With
26683 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26684 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26685 additionally optimizes it for Oracle M8 chips.
26686
26687 @item -mtune=@var{cpu_type}
26688 @opindex mtune
26689 Set the instruction scheduling parameters for machine type
26690 @var{cpu_type}, but do not set the instruction set or register set that the
26691 option @option{-mcpu=@var{cpu_type}} does.
26692
26693 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26694 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26695 that select a particular CPU implementation. Those are
26696 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26697 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26698 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26699 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26700 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26701 and GNU/Linux toolchains, @samp{native} can also be used.
26702
26703 @item -mv8plus
26704 @itemx -mno-v8plus
26705 @opindex mv8plus
26706 @opindex mno-v8plus
26707 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26708 difference from the V8 ABI is that the global and out registers are
26709 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26710 mode for all SPARC-V9 processors.
26711
26712 @item -mvis
26713 @itemx -mno-vis
26714 @opindex mvis
26715 @opindex mno-vis
26716 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26717 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26718
26719 @item -mvis2
26720 @itemx -mno-vis2
26721 @opindex mvis2
26722 @opindex mno-vis2
26723 With @option{-mvis2}, GCC generates code that takes advantage of
26724 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26725 default is @option{-mvis2} when targeting a cpu that supports such
26726 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26727 also sets @option{-mvis}.
26728
26729 @item -mvis3
26730 @itemx -mno-vis3
26731 @opindex mvis3
26732 @opindex mno-vis3
26733 With @option{-mvis3}, GCC generates code that takes advantage of
26734 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26735 default is @option{-mvis3} when targeting a cpu that supports such
26736 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26737 also sets @option{-mvis2} and @option{-mvis}.
26738
26739 @item -mvis4
26740 @itemx -mno-vis4
26741 @opindex mvis4
26742 @opindex mno-vis4
26743 With @option{-mvis4}, GCC generates code that takes advantage of
26744 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26745 default is @option{-mvis4} when targeting a cpu that supports such
26746 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26747 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26748
26749 @item -mvis4b
26750 @itemx -mno-vis4b
26751 @opindex mvis4b
26752 @opindex mno-vis4b
26753 With @option{-mvis4b}, GCC generates code that takes advantage of
26754 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26755 the additional VIS instructions introduced in the Oracle SPARC
26756 Architecture 2017. The default is @option{-mvis4b} when targeting a
26757 cpu that supports such instructions, such as m8 and later. Setting
26758 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26759 @option{-mvis2} and @option{-mvis}.
26760
26761 @item -mcbcond
26762 @itemx -mno-cbcond
26763 @opindex mcbcond
26764 @opindex mno-cbcond
26765 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26766 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26767 when targeting a CPU that supports such instructions, such as Niagara-4 and
26768 later.
26769
26770 @item -mfmaf
26771 @itemx -mno-fmaf
26772 @opindex mfmaf
26773 @opindex mno-fmaf
26774 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26775 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26776 when targeting a CPU that supports such instructions, such as Niagara-3 and
26777 later.
26778
26779 @item -mfsmuld
26780 @itemx -mno-fsmuld
26781 @opindex mfsmuld
26782 @opindex mno-fsmuld
26783 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26784 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26785 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26786 or V9 with FPU except @option{-mcpu=leon}.
26787
26788 @item -mpopc
26789 @itemx -mno-popc
26790 @opindex mpopc
26791 @opindex mno-popc
26792 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26793 Population Count instruction. The default is @option{-mpopc}
26794 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26795 later.
26796
26797 @item -msubxc
26798 @itemx -mno-subxc
26799 @opindex msubxc
26800 @opindex mno-subxc
26801 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26802 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26803 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26804 later.
26805
26806 @item -mfix-at697f
26807 @opindex mfix-at697f
26808 Enable the documented workaround for the single erratum of the Atmel AT697F
26809 processor (which corresponds to erratum #13 of the AT697E processor).
26810
26811 @item -mfix-ut699
26812 @opindex mfix-ut699
26813 Enable the documented workarounds for the floating-point errata and the data
26814 cache nullify errata of the UT699 processor.
26815
26816 @item -mfix-ut700
26817 @opindex mfix-ut700
26818 Enable the documented workaround for the back-to-back store errata of
26819 the UT699E/UT700 processor.
26820
26821 @item -mfix-gr712rc
26822 @opindex mfix-gr712rc
26823 Enable the documented workaround for the back-to-back store errata of
26824 the GR712RC processor.
26825 @end table
26826
26827 These @samp{-m} options are supported in addition to the above
26828 on SPARC-V9 processors in 64-bit environments:
26829
26830 @table @gcctabopt
26831 @item -m32
26832 @itemx -m64
26833 @opindex m32
26834 @opindex m64
26835 Generate code for a 32-bit or 64-bit environment.
26836 The 32-bit environment sets int, long and pointer to 32 bits.
26837 The 64-bit environment sets int to 32 bits and long and pointer
26838 to 64 bits.
26839
26840 @item -mcmodel=@var{which}
26841 @opindex mcmodel
26842 Set the code model to one of
26843
26844 @table @samp
26845 @item medlow
26846 The Medium/Low code model: 64-bit addresses, programs
26847 must be linked in the low 32 bits of memory. Programs can be statically
26848 or dynamically linked.
26849
26850 @item medmid
26851 The Medium/Middle code model: 64-bit addresses, programs
26852 must be linked in the low 44 bits of memory, the text and data segments must
26853 be less than 2GB in size and the data segment must be located within 2GB of
26854 the text segment.
26855
26856 @item medany
26857 The Medium/Anywhere code model: 64-bit addresses, programs
26858 may be linked anywhere in memory, the text and data segments must be less
26859 than 2GB in size and the data segment must be located within 2GB of the
26860 text segment.
26861
26862 @item embmedany
26863 The Medium/Anywhere code model for embedded systems:
26864 64-bit addresses, the text and data segments must be less than 2GB in
26865 size, both starting anywhere in memory (determined at link time). The
26866 global register %g4 points to the base of the data segment. Programs
26867 are statically linked and PIC is not supported.
26868 @end table
26869
26870 @item -mmemory-model=@var{mem-model}
26871 @opindex mmemory-model
26872 Set the memory model in force on the processor to one of
26873
26874 @table @samp
26875 @item default
26876 The default memory model for the processor and operating system.
26877
26878 @item rmo
26879 Relaxed Memory Order
26880
26881 @item pso
26882 Partial Store Order
26883
26884 @item tso
26885 Total Store Order
26886
26887 @item sc
26888 Sequential Consistency
26889 @end table
26890
26891 These memory models are formally defined in Appendix D of the SPARC-V9
26892 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26893
26894 @item -mstack-bias
26895 @itemx -mno-stack-bias
26896 @opindex mstack-bias
26897 @opindex mno-stack-bias
26898 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26899 frame pointer if present, are offset by @minus{}2047 which must be added back
26900 when making stack frame references. This is the default in 64-bit mode.
26901 Otherwise, assume no such offset is present.
26902 @end table
26903
26904 @node System V Options
26905 @subsection Options for System V
26906
26907 These additional options are available on System V Release 4 for
26908 compatibility with other compilers on those systems:
26909
26910 @table @gcctabopt
26911 @item -G
26912 @opindex G
26913 Create a shared object.
26914 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26915
26916 @item -Qy
26917 @opindex Qy
26918 Identify the versions of each tool used by the compiler, in a
26919 @code{.ident} assembler directive in the output.
26920
26921 @item -Qn
26922 @opindex Qn
26923 Refrain from adding @code{.ident} directives to the output file (this is
26924 the default).
26925
26926 @item -YP,@var{dirs}
26927 @opindex YP
26928 Search the directories @var{dirs}, and no others, for libraries
26929 specified with @option{-l}.
26930
26931 @item -Ym,@var{dir}
26932 @opindex Ym
26933 Look in the directory @var{dir} to find the M4 preprocessor.
26934 The assembler uses this option.
26935 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26936 @c the generic assembler that comes with Solaris takes just -Ym.
26937 @end table
26938
26939 @node TILE-Gx Options
26940 @subsection TILE-Gx Options
26941 @cindex TILE-Gx options
26942
26943 These @samp{-m} options are supported on the TILE-Gx:
26944
26945 @table @gcctabopt
26946 @item -mcmodel=small
26947 @opindex mcmodel=small
26948 Generate code for the small model. The distance for direct calls is
26949 limited to 500M in either direction. PC-relative addresses are 32
26950 bits. Absolute addresses support the full address range.
26951
26952 @item -mcmodel=large
26953 @opindex mcmodel=large
26954 Generate code for the large model. There is no limitation on call
26955 distance, pc-relative addresses, or absolute addresses.
26956
26957 @item -mcpu=@var{name}
26958 @opindex mcpu
26959 Selects the type of CPU to be targeted. Currently the only supported
26960 type is @samp{tilegx}.
26961
26962 @item -m32
26963 @itemx -m64
26964 @opindex m32
26965 @opindex m64
26966 Generate code for a 32-bit or 64-bit environment. The 32-bit
26967 environment sets int, long, and pointer to 32 bits. The 64-bit
26968 environment sets int to 32 bits and long and pointer to 64 bits.
26969
26970 @item -mbig-endian
26971 @itemx -mlittle-endian
26972 @opindex mbig-endian
26973 @opindex mlittle-endian
26974 Generate code in big/little endian mode, respectively.
26975 @end table
26976
26977 @node TILEPro Options
26978 @subsection TILEPro Options
26979 @cindex TILEPro options
26980
26981 These @samp{-m} options are supported on the TILEPro:
26982
26983 @table @gcctabopt
26984 @item -mcpu=@var{name}
26985 @opindex mcpu
26986 Selects the type of CPU to be targeted. Currently the only supported
26987 type is @samp{tilepro}.
26988
26989 @item -m32
26990 @opindex m32
26991 Generate code for a 32-bit environment, which sets int, long, and
26992 pointer to 32 bits. This is the only supported behavior so the flag
26993 is essentially ignored.
26994 @end table
26995
26996 @node V850 Options
26997 @subsection V850 Options
26998 @cindex V850 Options
26999
27000 These @samp{-m} options are defined for V850 implementations:
27001
27002 @table @gcctabopt
27003 @item -mlong-calls
27004 @itemx -mno-long-calls
27005 @opindex mlong-calls
27006 @opindex mno-long-calls
27007 Treat all calls as being far away (near). If calls are assumed to be
27008 far away, the compiler always loads the function's address into a
27009 register, and calls indirect through the pointer.
27010
27011 @item -mno-ep
27012 @itemx -mep
27013 @opindex mno-ep
27014 @opindex mep
27015 Do not optimize (do optimize) basic blocks that use the same index
27016 pointer 4 or more times to copy pointer into the @code{ep} register, and
27017 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
27018 option is on by default if you optimize.
27019
27020 @item -mno-prolog-function
27021 @itemx -mprolog-function
27022 @opindex mno-prolog-function
27023 @opindex mprolog-function
27024 Do not use (do use) external functions to save and restore registers
27025 at the prologue and epilogue of a function. The external functions
27026 are slower, but use less code space if more than one function saves
27027 the same number of registers. The @option{-mprolog-function} option
27028 is on by default if you optimize.
27029
27030 @item -mspace
27031 @opindex mspace
27032 Try to make the code as small as possible. At present, this just turns
27033 on the @option{-mep} and @option{-mprolog-function} options.
27034
27035 @item -mtda=@var{n}
27036 @opindex mtda
27037 Put static or global variables whose size is @var{n} bytes or less into
27038 the tiny data area that register @code{ep} points to. The tiny data
27039 area can hold up to 256 bytes in total (128 bytes for byte references).
27040
27041 @item -msda=@var{n}
27042 @opindex msda
27043 Put static or global variables whose size is @var{n} bytes or less into
27044 the small data area that register @code{gp} points to. The small data
27045 area can hold up to 64 kilobytes.
27046
27047 @item -mzda=@var{n}
27048 @opindex mzda
27049 Put static or global variables whose size is @var{n} bytes or less into
27050 the first 32 kilobytes of memory.
27051
27052 @item -mv850
27053 @opindex mv850
27054 Specify that the target processor is the V850.
27055
27056 @item -mv850e3v5
27057 @opindex mv850e3v5
27058 Specify that the target processor is the V850E3V5. The preprocessor
27059 constant @code{__v850e3v5__} is defined if this option is used.
27060
27061 @item -mv850e2v4
27062 @opindex mv850e2v4
27063 Specify that the target processor is the V850E3V5. This is an alias for
27064 the @option{-mv850e3v5} option.
27065
27066 @item -mv850e2v3
27067 @opindex mv850e2v3
27068 Specify that the target processor is the V850E2V3. The preprocessor
27069 constant @code{__v850e2v3__} is defined if this option is used.
27070
27071 @item -mv850e2
27072 @opindex mv850e2
27073 Specify that the target processor is the V850E2. The preprocessor
27074 constant @code{__v850e2__} is defined if this option is used.
27075
27076 @item -mv850e1
27077 @opindex mv850e1
27078 Specify that the target processor is the V850E1. The preprocessor
27079 constants @code{__v850e1__} and @code{__v850e__} are defined if
27080 this option is used.
27081
27082 @item -mv850es
27083 @opindex mv850es
27084 Specify that the target processor is the V850ES. This is an alias for
27085 the @option{-mv850e1} option.
27086
27087 @item -mv850e
27088 @opindex mv850e
27089 Specify that the target processor is the V850E@. The preprocessor
27090 constant @code{__v850e__} is defined if this option is used.
27091
27092 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
27093 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
27094 are defined then a default target processor is chosen and the
27095 relevant @samp{__v850*__} preprocessor constant is defined.
27096
27097 The preprocessor constants @code{__v850} and @code{__v851__} are always
27098 defined, regardless of which processor variant is the target.
27099
27100 @item -mdisable-callt
27101 @itemx -mno-disable-callt
27102 @opindex mdisable-callt
27103 @opindex mno-disable-callt
27104 This option suppresses generation of the @code{CALLT} instruction for the
27105 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27106 architecture.
27107
27108 This option is enabled by default when the RH850 ABI is
27109 in use (see @option{-mrh850-abi}), and disabled by default when the
27110 GCC ABI is in use. If @code{CALLT} instructions are being generated
27111 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27112
27113 @item -mrelax
27114 @itemx -mno-relax
27115 @opindex mrelax
27116 @opindex mno-relax
27117 Pass on (or do not pass on) the @option{-mrelax} command-line option
27118 to the assembler.
27119
27120 @item -mlong-jumps
27121 @itemx -mno-long-jumps
27122 @opindex mlong-jumps
27123 @opindex mno-long-jumps
27124 Disable (or re-enable) the generation of PC-relative jump instructions.
27125
27126 @item -msoft-float
27127 @itemx -mhard-float
27128 @opindex msoft-float
27129 @opindex mhard-float
27130 Disable (or re-enable) the generation of hardware floating point
27131 instructions. This option is only significant when the target
27132 architecture is @samp{V850E2V3} or higher. If hardware floating point
27133 instructions are being generated then the C preprocessor symbol
27134 @code{__FPU_OK__} is defined, otherwise the symbol
27135 @code{__NO_FPU__} is defined.
27136
27137 @item -mloop
27138 @opindex mloop
27139 Enables the use of the e3v5 LOOP instruction. The use of this
27140 instruction is not enabled by default when the e3v5 architecture is
27141 selected because its use is still experimental.
27142
27143 @item -mrh850-abi
27144 @itemx -mghs
27145 @opindex mrh850-abi
27146 @opindex mghs
27147 Enables support for the RH850 version of the V850 ABI. This is the
27148 default. With this version of the ABI the following rules apply:
27149
27150 @itemize
27151 @item
27152 Integer sized structures and unions are returned via a memory pointer
27153 rather than a register.
27154
27155 @item
27156 Large structures and unions (more than 8 bytes in size) are passed by
27157 value.
27158
27159 @item
27160 Functions are aligned to 16-bit boundaries.
27161
27162 @item
27163 The @option{-m8byte-align} command-line option is supported.
27164
27165 @item
27166 The @option{-mdisable-callt} command-line option is enabled by
27167 default. The @option{-mno-disable-callt} command-line option is not
27168 supported.
27169 @end itemize
27170
27171 When this version of the ABI is enabled the C preprocessor symbol
27172 @code{__V850_RH850_ABI__} is defined.
27173
27174 @item -mgcc-abi
27175 @opindex mgcc-abi
27176 Enables support for the old GCC version of the V850 ABI. With this
27177 version of the ABI the following rules apply:
27178
27179 @itemize
27180 @item
27181 Integer sized structures and unions are returned in register @code{r10}.
27182
27183 @item
27184 Large structures and unions (more than 8 bytes in size) are passed by
27185 reference.
27186
27187 @item
27188 Functions are aligned to 32-bit boundaries, unless optimizing for
27189 size.
27190
27191 @item
27192 The @option{-m8byte-align} command-line option is not supported.
27193
27194 @item
27195 The @option{-mdisable-callt} command-line option is supported but not
27196 enabled by default.
27197 @end itemize
27198
27199 When this version of the ABI is enabled the C preprocessor symbol
27200 @code{__V850_GCC_ABI__} is defined.
27201
27202 @item -m8byte-align
27203 @itemx -mno-8byte-align
27204 @opindex m8byte-align
27205 @opindex mno-8byte-align
27206 Enables support for @code{double} and @code{long long} types to be
27207 aligned on 8-byte boundaries. The default is to restrict the
27208 alignment of all objects to at most 4-bytes. When
27209 @option{-m8byte-align} is in effect the C preprocessor symbol
27210 @code{__V850_8BYTE_ALIGN__} is defined.
27211
27212 @item -mbig-switch
27213 @opindex mbig-switch
27214 Generate code suitable for big switch tables. Use this option only if
27215 the assembler/linker complain about out of range branches within a switch
27216 table.
27217
27218 @item -mapp-regs
27219 @opindex mapp-regs
27220 This option causes r2 and r5 to be used in the code generated by
27221 the compiler. This setting is the default.
27222
27223 @item -mno-app-regs
27224 @opindex mno-app-regs
27225 This option causes r2 and r5 to be treated as fixed registers.
27226
27227 @end table
27228
27229 @node VAX Options
27230 @subsection VAX Options
27231 @cindex VAX options
27232
27233 These @samp{-m} options are defined for the VAX:
27234
27235 @table @gcctabopt
27236 @item -munix
27237 @opindex munix
27238 Do not output certain jump instructions (@code{aobleq} and so on)
27239 that the Unix assembler for the VAX cannot handle across long
27240 ranges.
27241
27242 @item -mgnu
27243 @opindex mgnu
27244 Do output those jump instructions, on the assumption that the
27245 GNU assembler is being used.
27246
27247 @item -mg
27248 @opindex mg
27249 Output code for G-format floating-point numbers instead of D-format.
27250 @end table
27251
27252 @node Visium Options
27253 @subsection Visium Options
27254 @cindex Visium options
27255
27256 @table @gcctabopt
27257
27258 @item -mdebug
27259 @opindex mdebug
27260 A program which performs file I/O and is destined to run on an MCM target
27261 should be linked with this option. It causes the libraries libc.a and
27262 libdebug.a to be linked. The program should be run on the target under
27263 the control of the GDB remote debugging stub.
27264
27265 @item -msim
27266 @opindex msim
27267 A program which performs file I/O and is destined to run on the simulator
27268 should be linked with option. This causes libraries libc.a and libsim.a to
27269 be linked.
27270
27271 @item -mfpu
27272 @itemx -mhard-float
27273 @opindex mfpu
27274 @opindex mhard-float
27275 Generate code containing floating-point instructions. This is the
27276 default.
27277
27278 @item -mno-fpu
27279 @itemx -msoft-float
27280 @opindex mno-fpu
27281 @opindex msoft-float
27282 Generate code containing library calls for floating-point.
27283
27284 @option{-msoft-float} changes the calling convention in the output file;
27285 therefore, it is only useful if you compile @emph{all} of a program with
27286 this option. In particular, you need to compile @file{libgcc.a}, the
27287 library that comes with GCC, with @option{-msoft-float} in order for
27288 this to work.
27289
27290 @item -mcpu=@var{cpu_type}
27291 @opindex mcpu
27292 Set the instruction set, register set, and instruction scheduling parameters
27293 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27294 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27295
27296 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27297
27298 By default (unless configured otherwise), GCC generates code for the GR5
27299 variant of the Visium architecture.
27300
27301 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27302 architecture. The only difference from GR5 code is that the compiler will
27303 generate block move instructions.
27304
27305 @item -mtune=@var{cpu_type}
27306 @opindex mtune
27307 Set the instruction scheduling parameters for machine type @var{cpu_type},
27308 but do not set the instruction set or register set that the option
27309 @option{-mcpu=@var{cpu_type}} would.
27310
27311 @item -msv-mode
27312 @opindex msv-mode
27313 Generate code for the supervisor mode, where there are no restrictions on
27314 the access to general registers. This is the default.
27315
27316 @item -muser-mode
27317 @opindex muser-mode
27318 Generate code for the user mode, where the access to some general registers
27319 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27320 mode; on the GR6, only registers r29 to r31 are affected.
27321 @end table
27322
27323 @node VMS Options
27324 @subsection VMS Options
27325
27326 These @samp{-m} options are defined for the VMS implementations:
27327
27328 @table @gcctabopt
27329 @item -mvms-return-codes
27330 @opindex mvms-return-codes
27331 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27332 condition (e.g.@: error) codes.
27333
27334 @item -mdebug-main=@var{prefix}
27335 @opindex mdebug-main=@var{prefix}
27336 Flag the first routine whose name starts with @var{prefix} as the main
27337 routine for the debugger.
27338
27339 @item -mmalloc64
27340 @opindex mmalloc64
27341 Default to 64-bit memory allocation routines.
27342
27343 @item -mpointer-size=@var{size}
27344 @opindex mpointer-size=@var{size}
27345 Set the default size of pointers. Possible options for @var{size} are
27346 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27347 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27348 The later option disables @code{pragma pointer_size}.
27349 @end table
27350
27351 @node VxWorks Options
27352 @subsection VxWorks Options
27353 @cindex VxWorks Options
27354
27355 The options in this section are defined for all VxWorks targets.
27356 Options specific to the target hardware are listed with the other
27357 options for that target.
27358
27359 @table @gcctabopt
27360 @item -mrtp
27361 @opindex mrtp
27362 GCC can generate code for both VxWorks kernels and real time processes
27363 (RTPs). This option switches from the former to the latter. It also
27364 defines the preprocessor macro @code{__RTP__}.
27365
27366 @item -non-static
27367 @opindex non-static
27368 Link an RTP executable against shared libraries rather than static
27369 libraries. The options @option{-static} and @option{-shared} can
27370 also be used for RTPs (@pxref{Link Options}); @option{-static}
27371 is the default.
27372
27373 @item -Bstatic
27374 @itemx -Bdynamic
27375 @opindex Bstatic
27376 @opindex Bdynamic
27377 These options are passed down to the linker. They are defined for
27378 compatibility with Diab.
27379
27380 @item -Xbind-lazy
27381 @opindex Xbind-lazy
27382 Enable lazy binding of function calls. This option is equivalent to
27383 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27384
27385 @item -Xbind-now
27386 @opindex Xbind-now
27387 Disable lazy binding of function calls. This option is the default and
27388 is defined for compatibility with Diab.
27389 @end table
27390
27391 @node x86 Options
27392 @subsection x86 Options
27393 @cindex x86 Options
27394
27395 These @samp{-m} options are defined for the x86 family of computers.
27396
27397 @table @gcctabopt
27398
27399 @item -march=@var{cpu-type}
27400 @opindex march
27401 Generate instructions for the machine type @var{cpu-type}. In contrast to
27402 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27403 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27404 to generate code that may not run at all on processors other than the one
27405 indicated. Specifying @option{-march=@var{cpu-type}} implies
27406 @option{-mtune=@var{cpu-type}}.
27407
27408 The choices for @var{cpu-type} are:
27409
27410 @table @samp
27411 @item native
27412 This selects the CPU to generate code for at compilation time by determining
27413 the processor type of the compiling machine. Using @option{-march=native}
27414 enables all instruction subsets supported by the local machine (hence
27415 the result might not run on different machines). Using @option{-mtune=native}
27416 produces code optimized for the local machine under the constraints
27417 of the selected instruction set.
27418
27419 @item x86-64
27420 A generic CPU with 64-bit extensions.
27421
27422 @item i386
27423 Original Intel i386 CPU@.
27424
27425 @item i486
27426 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27427
27428 @item i586
27429 @itemx pentium
27430 Intel Pentium CPU with no MMX support.
27431
27432 @item lakemont
27433 Intel Lakemont MCU, based on Intel Pentium CPU.
27434
27435 @item pentium-mmx
27436 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27437
27438 @item pentiumpro
27439 Intel Pentium Pro CPU@.
27440
27441 @item i686
27442 When used with @option{-march}, the Pentium Pro
27443 instruction set is used, so the code runs on all i686 family chips.
27444 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27445
27446 @item pentium2
27447 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27448 support.
27449
27450 @item pentium3
27451 @itemx pentium3m
27452 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27453 set support.
27454
27455 @item pentium-m
27456 Intel Pentium M; low-power version of Intel Pentium III CPU
27457 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27458
27459 @item pentium4
27460 @itemx pentium4m
27461 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27462
27463 @item prescott
27464 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27465 set support.
27466
27467 @item nocona
27468 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27469 SSE2 and SSE3 instruction set support.
27470
27471 @item core2
27472 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27473 instruction set support.
27474
27475 @item nehalem
27476 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27477 SSE4.1, SSE4.2 and POPCNT instruction set support.
27478
27479 @item westmere
27480 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27481 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27482
27483 @item sandybridge
27484 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27485 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27486
27487 @item ivybridge
27488 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27489 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27490 instruction set support.
27491
27492 @item haswell
27493 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27494 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27495 BMI, BMI2 and F16C instruction set support.
27496
27497 @item broadwell
27498 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27499 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27500 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27501
27502 @item skylake
27503 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27504 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27505 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27506 XSAVES instruction set support.
27507
27508 @item bonnell
27509 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27510 instruction set support.
27511
27512 @item silvermont
27513 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27514 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27515
27516 @item goldmont
27517 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27518 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27519 instruction set support.
27520
27521 @item goldmont-plus
27522 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27523 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27524 PTWRITE, RDPID, SGX and UMIP instruction set support.
27525
27526 @item tremont
27527 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27528 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27529 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27530
27531 @item knl
27532 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27533 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27534 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27535 AVX512CD instruction set support.
27536
27537 @item knm
27538 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27539 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27540 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27541 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27542
27543 @item skylake-avx512
27544 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27545 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27546 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27547 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27548
27549 @item cannonlake
27550 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27551 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27552 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27553 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27554 AVX512IFMA, SHA and UMIP instruction set support.
27555
27556 @item icelake-client
27557 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27558 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27559 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27560 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27561 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27562 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27563
27564 @item icelake-server
27565 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27566 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27567 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27568 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27569 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27570 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27571 set support.
27572
27573 @item cascadelake
27574 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27575 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27576 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27577 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27578
27579 @item cooperlake
27580 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27581 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27582 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27583 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
27584 set support.
27585
27586 @item tigerlake
27587 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27588 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27589 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27590 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
27591 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
27592 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction
27593 set support.
27594
27595 @item k6
27596 AMD K6 CPU with MMX instruction set support.
27597
27598 @item k6-2
27599 @itemx k6-3
27600 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27601
27602 @item athlon
27603 @itemx athlon-tbird
27604 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27605 support.
27606
27607 @item athlon-4
27608 @itemx athlon-xp
27609 @itemx athlon-mp
27610 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27611 instruction set support.
27612
27613 @item k8
27614 @itemx opteron
27615 @itemx athlon64
27616 @itemx athlon-fx
27617 Processors based on the AMD K8 core with x86-64 instruction set support,
27618 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27619 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27620 instruction set extensions.)
27621
27622 @item k8-sse3
27623 @itemx opteron-sse3
27624 @itemx athlon64-sse3
27625 Improved versions of AMD K8 cores with SSE3 instruction set support.
27626
27627 @item amdfam10
27628 @itemx barcelona
27629 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27630 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27631 instruction set extensions.)
27632
27633 @item bdver1
27634 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27635 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27636 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27637 @item bdver2
27638 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27639 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27640 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27641 extensions.)
27642 @item bdver3
27643 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27644 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27645 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27646 64-bit instruction set extensions.
27647 @item bdver4
27648 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27649 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27650 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27651 SSE4.2, ABM and 64-bit instruction set extensions.
27652
27653 @item znver1
27654 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27655 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27656 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27657 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27658 instruction set extensions.
27659 @item znver2
27660 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27661 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27662 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27663 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27664 instruction set extensions.)
27665
27666
27667 @item btver1
27668 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27669 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27670 instruction set extensions.)
27671
27672 @item btver2
27673 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27674 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27675 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27676
27677 @item winchip-c6
27678 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27679 set support.
27680
27681 @item winchip2
27682 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27683 instruction set support.
27684
27685 @item c3
27686 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27687 (No scheduling is implemented for this chip.)
27688
27689 @item c3-2
27690 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27691 (No scheduling is implemented for this chip.)
27692
27693 @item c7
27694 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27695 (No scheduling is implemented for this chip.)
27696
27697 @item samuel-2
27698 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27699 (No scheduling is implemented for this chip.)
27700
27701 @item nehemiah
27702 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27703 (No scheduling is implemented for this chip.)
27704
27705 @item esther
27706 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27707 (No scheduling is implemented for this chip.)
27708
27709 @item eden-x2
27710 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27711 (No scheduling is implemented for this chip.)
27712
27713 @item eden-x4
27714 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27715 AVX and AVX2 instruction set support.
27716 (No scheduling is implemented for this chip.)
27717
27718 @item nano
27719 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27720 instruction set support.
27721 (No scheduling is implemented for this chip.)
27722
27723 @item nano-1000
27724 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27725 instruction set support.
27726 (No scheduling is implemented for this chip.)
27727
27728 @item nano-2000
27729 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27730 instruction set support.
27731 (No scheduling is implemented for this chip.)
27732
27733 @item nano-3000
27734 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27735 instruction set support.
27736 (No scheduling is implemented for this chip.)
27737
27738 @item nano-x2
27739 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27740 instruction set support.
27741 (No scheduling is implemented for this chip.)
27742
27743 @item nano-x4
27744 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27745 instruction set support.
27746 (No scheduling is implemented for this chip.)
27747
27748 @item geode
27749 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27750 @end table
27751
27752 @item -mtune=@var{cpu-type}
27753 @opindex mtune
27754 Tune to @var{cpu-type} everything applicable about the generated code, except
27755 for the ABI and the set of available instructions.
27756 While picking a specific @var{cpu-type} schedules things appropriately
27757 for that particular chip, the compiler does not generate any code that
27758 cannot run on the default machine type unless you use a
27759 @option{-march=@var{cpu-type}} option.
27760 For example, if GCC is configured for i686-pc-linux-gnu
27761 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27762 but still runs on i686 machines.
27763
27764 The choices for @var{cpu-type} are the same as for @option{-march}.
27765 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27766
27767 @table @samp
27768 @item generic
27769 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27770 If you know the CPU on which your code will run, then you should use
27771 the corresponding @option{-mtune} or @option{-march} option instead of
27772 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27773 of your application will have, then you should use this option.
27774
27775 As new processors are deployed in the marketplace, the behavior of this
27776 option will change. Therefore, if you upgrade to a newer version of
27777 GCC, code generation controlled by this option will change to reflect
27778 the processors
27779 that are most common at the time that version of GCC is released.
27780
27781 There is no @option{-march=generic} option because @option{-march}
27782 indicates the instruction set the compiler can use, and there is no
27783 generic instruction set applicable to all processors. In contrast,
27784 @option{-mtune} indicates the processor (or, in this case, collection of
27785 processors) for which the code is optimized.
27786
27787 @item intel
27788 Produce code optimized for the most current Intel processors, which are
27789 Haswell and Silvermont for this version of GCC. If you know the CPU
27790 on which your code will run, then you should use the corresponding
27791 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27792 But, if you want your application performs better on both Haswell and
27793 Silvermont, then you should use this option.
27794
27795 As new Intel processors are deployed in the marketplace, the behavior of
27796 this option will change. Therefore, if you upgrade to a newer version of
27797 GCC, code generation controlled by this option will change to reflect
27798 the most current Intel processors at the time that version of GCC is
27799 released.
27800
27801 There is no @option{-march=intel} option because @option{-march} indicates
27802 the instruction set the compiler can use, and there is no common
27803 instruction set applicable to all processors. In contrast,
27804 @option{-mtune} indicates the processor (or, in this case, collection of
27805 processors) for which the code is optimized.
27806 @end table
27807
27808 @item -mcpu=@var{cpu-type}
27809 @opindex mcpu
27810 A deprecated synonym for @option{-mtune}.
27811
27812 @item -mfpmath=@var{unit}
27813 @opindex mfpmath
27814 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27815 for @var{unit} are:
27816
27817 @table @samp
27818 @item 387
27819 Use the standard 387 floating-point coprocessor present on the majority of chips and
27820 emulated otherwise. Code compiled with this option runs almost everywhere.
27821 The temporary results are computed in 80-bit precision instead of the precision
27822 specified by the type, resulting in slightly different results compared to most
27823 of other chips. See @option{-ffloat-store} for more detailed description.
27824
27825 This is the default choice for non-Darwin x86-32 targets.
27826
27827 @item sse
27828 Use scalar floating-point instructions present in the SSE instruction set.
27829 This instruction set is supported by Pentium III and newer chips,
27830 and in the AMD line
27831 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27832 instruction set supports only single-precision arithmetic, thus the double and
27833 extended-precision arithmetic are still done using 387. A later version, present
27834 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27835 arithmetic too.
27836
27837 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27838 or @option{-msse2} switches to enable SSE extensions and make this option
27839 effective. For the x86-64 compiler, these extensions are enabled by default.
27840
27841 The resulting code should be considerably faster in the majority of cases and avoid
27842 the numerical instability problems of 387 code, but may break some existing
27843 code that expects temporaries to be 80 bits.
27844
27845 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27846 and the default choice for x86-32 targets with the SSE2 instruction set
27847 when @option{-ffast-math} is enabled.
27848
27849 @item sse,387
27850 @itemx sse+387
27851 @itemx both
27852 Attempt to utilize both instruction sets at once. This effectively doubles the
27853 amount of available registers, and on chips with separate execution units for
27854 387 and SSE the execution resources too. Use this option with care, as it is
27855 still experimental, because the GCC register allocator does not model separate
27856 functional units well, resulting in unstable performance.
27857 @end table
27858
27859 @item -masm=@var{dialect}
27860 @opindex masm=@var{dialect}
27861 Output assembly instructions using selected @var{dialect}. Also affects
27862 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27863 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27864 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27865 not support @samp{intel}.
27866
27867 @item -mieee-fp
27868 @itemx -mno-ieee-fp
27869 @opindex mieee-fp
27870 @opindex mno-ieee-fp
27871 Control whether or not the compiler uses IEEE floating-point
27872 comparisons. These correctly handle the case where the result of a
27873 comparison is unordered.
27874
27875 @item -m80387
27876 @itemx -mhard-float
27877 @opindex 80387
27878 @opindex mhard-float
27879 Generate output containing 80387 instructions for floating point.
27880
27881 @item -mno-80387
27882 @itemx -msoft-float
27883 @opindex no-80387
27884 @opindex msoft-float
27885 Generate output containing library calls for floating point.
27886
27887 @strong{Warning:} the requisite libraries are not part of GCC@.
27888 Normally the facilities of the machine's usual C compiler are used, but
27889 this cannot be done directly in cross-compilation. You must make your
27890 own arrangements to provide suitable library functions for
27891 cross-compilation.
27892
27893 On machines where a function returns floating-point results in the 80387
27894 register stack, some floating-point opcodes may be emitted even if
27895 @option{-msoft-float} is used.
27896
27897 @item -mno-fp-ret-in-387
27898 @opindex mno-fp-ret-in-387
27899 @opindex mfp-ret-in-387
27900 Do not use the FPU registers for return values of functions.
27901
27902 The usual calling convention has functions return values of types
27903 @code{float} and @code{double} in an FPU register, even if there
27904 is no FPU@. The idea is that the operating system should emulate
27905 an FPU@.
27906
27907 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27908 in ordinary CPU registers instead.
27909
27910 @item -mno-fancy-math-387
27911 @opindex mno-fancy-math-387
27912 @opindex mfancy-math-387
27913 Some 387 emulators do not support the @code{sin}, @code{cos} and
27914 @code{sqrt} instructions for the 387. Specify this option to avoid
27915 generating those instructions.
27916 This option is overridden when @option{-march}
27917 indicates that the target CPU always has an FPU and so the
27918 instruction does not need emulation. These
27919 instructions are not generated unless you also use the
27920 @option{-funsafe-math-optimizations} switch.
27921
27922 @item -malign-double
27923 @itemx -mno-align-double
27924 @opindex malign-double
27925 @opindex mno-align-double
27926 Control whether GCC aligns @code{double}, @code{long double}, and
27927 @code{long long} variables on a two-word boundary or a one-word
27928 boundary. Aligning @code{double} variables on a two-word boundary
27929 produces code that runs somewhat faster on a Pentium at the
27930 expense of more memory.
27931
27932 On x86-64, @option{-malign-double} is enabled by default.
27933
27934 @strong{Warning:} if you use the @option{-malign-double} switch,
27935 structures containing the above types are aligned differently than
27936 the published application binary interface specifications for the x86-32
27937 and are not binary compatible with structures in code compiled
27938 without that switch.
27939
27940 @item -m96bit-long-double
27941 @itemx -m128bit-long-double
27942 @opindex m96bit-long-double
27943 @opindex m128bit-long-double
27944 These switches control the size of @code{long double} type. The x86-32
27945 application binary interface specifies the size to be 96 bits,
27946 so @option{-m96bit-long-double} is the default in 32-bit mode.
27947
27948 Modern architectures (Pentium and newer) prefer @code{long double}
27949 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27950 conforming to the ABI, this is not possible. So specifying
27951 @option{-m128bit-long-double} aligns @code{long double}
27952 to a 16-byte boundary by padding the @code{long double} with an additional
27953 32-bit zero.
27954
27955 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27956 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27957
27958 Notice that neither of these options enable any extra precision over the x87
27959 standard of 80 bits for a @code{long double}.
27960
27961 @strong{Warning:} if you override the default value for your target ABI, this
27962 changes the size of
27963 structures and arrays containing @code{long double} variables,
27964 as well as modifying the function calling convention for functions taking
27965 @code{long double}. Hence they are not binary-compatible
27966 with code compiled without that switch.
27967
27968 @item -mlong-double-64
27969 @itemx -mlong-double-80
27970 @itemx -mlong-double-128
27971 @opindex mlong-double-64
27972 @opindex mlong-double-80
27973 @opindex mlong-double-128
27974 These switches control the size of @code{long double} type. A size
27975 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27976 type. This is the default for 32-bit Bionic C library. A size
27977 of 128 bits makes the @code{long double} type equivalent to the
27978 @code{__float128} type. This is the default for 64-bit Bionic C library.
27979
27980 @strong{Warning:} if you override the default value for your target ABI, this
27981 changes the size of
27982 structures and arrays containing @code{long double} variables,
27983 as well as modifying the function calling convention for functions taking
27984 @code{long double}. Hence they are not binary-compatible
27985 with code compiled without that switch.
27986
27987 @item -malign-data=@var{type}
27988 @opindex malign-data
27989 Control how GCC aligns variables. Supported values for @var{type} are
27990 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27991 and earlier, @samp{abi} uses alignment value as specified by the
27992 psABI, and @samp{cacheline} uses increased alignment value to match
27993 the cache line size. @samp{compat} is the default.
27994
27995 @item -mlarge-data-threshold=@var{threshold}
27996 @opindex mlarge-data-threshold
27997 When @option{-mcmodel=medium} is specified, data objects larger than
27998 @var{threshold} are placed in the large data section. This value must be the
27999 same across all objects linked into the binary, and defaults to 65535.
28000
28001 @item -mrtd
28002 @opindex mrtd
28003 Use a different function-calling convention, in which functions that
28004 take a fixed number of arguments return with the @code{ret @var{num}}
28005 instruction, which pops their arguments while returning. This saves one
28006 instruction in the caller since there is no need to pop the arguments
28007 there.
28008
28009 You can specify that an individual function is called with this calling
28010 sequence with the function attribute @code{stdcall}. You can also
28011 override the @option{-mrtd} option by using the function attribute
28012 @code{cdecl}. @xref{Function Attributes}.
28013
28014 @strong{Warning:} this calling convention is incompatible with the one
28015 normally used on Unix, so you cannot use it if you need to call
28016 libraries compiled with the Unix compiler.
28017
28018 Also, you must provide function prototypes for all functions that
28019 take variable numbers of arguments (including @code{printf});
28020 otherwise incorrect code is generated for calls to those
28021 functions.
28022
28023 In addition, seriously incorrect code results if you call a
28024 function with too many arguments. (Normally, extra arguments are
28025 harmlessly ignored.)
28026
28027 @item -mregparm=@var{num}
28028 @opindex mregparm
28029 Control how many registers are used to pass integer arguments. By
28030 default, no registers are used to pass arguments, and at most 3
28031 registers can be used. You can control this behavior for a specific
28032 function by using the function attribute @code{regparm}.
28033 @xref{Function Attributes}.
28034
28035 @strong{Warning:} if you use this switch, and
28036 @var{num} is nonzero, then you must build all modules with the same
28037 value, including any libraries. This includes the system libraries and
28038 startup modules.
28039
28040 @item -msseregparm
28041 @opindex msseregparm
28042 Use SSE register passing conventions for float and double arguments
28043 and return values. You can control this behavior for a specific
28044 function by using the function attribute @code{sseregparm}.
28045 @xref{Function Attributes}.
28046
28047 @strong{Warning:} if you use this switch then you must build all
28048 modules with the same value, including any libraries. This includes
28049 the system libraries and startup modules.
28050
28051 @item -mvect8-ret-in-mem
28052 @opindex mvect8-ret-in-mem
28053 Return 8-byte vectors in memory instead of MMX registers. This is the
28054 default on VxWorks to match the ABI of the Sun Studio compilers until
28055 version 12. @emph{Only} use this option if you need to remain
28056 compatible with existing code produced by those previous compiler
28057 versions or older versions of GCC@.
28058
28059 @item -mpc32
28060 @itemx -mpc64
28061 @itemx -mpc80
28062 @opindex mpc32
28063 @opindex mpc64
28064 @opindex mpc80
28065
28066 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
28067 is specified, the significands of results of floating-point operations are
28068 rounded to 24 bits (single precision); @option{-mpc64} rounds the
28069 significands of results of floating-point operations to 53 bits (double
28070 precision) and @option{-mpc80} rounds the significands of results of
28071 floating-point operations to 64 bits (extended double precision), which is
28072 the default. When this option is used, floating-point operations in higher
28073 precisions are not available to the programmer without setting the FPU
28074 control word explicitly.
28075
28076 Setting the rounding of floating-point operations to less than the default
28077 80 bits can speed some programs by 2% or more. Note that some mathematical
28078 libraries assume that extended-precision (80-bit) floating-point operations
28079 are enabled by default; routines in such libraries could suffer significant
28080 loss of accuracy, typically through so-called ``catastrophic cancellation'',
28081 when this option is used to set the precision to less than extended precision.
28082
28083 @item -mstackrealign
28084 @opindex mstackrealign
28085 Realign the stack at entry. On the x86, the @option{-mstackrealign}
28086 option generates an alternate prologue and epilogue that realigns the
28087 run-time stack if necessary. This supports mixing legacy codes that keep
28088 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
28089 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
28090 applicable to individual functions.
28091
28092 @item -mpreferred-stack-boundary=@var{num}
28093 @opindex mpreferred-stack-boundary
28094 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28095 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28096 the default is 4 (16 bytes or 128 bits).
28097
28098 @strong{Warning:} When generating code for the x86-64 architecture with
28099 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
28100 used to keep the stack boundary aligned to 8 byte boundary. Since
28101 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
28102 intended to be used in controlled environment where stack space is
28103 important limitation. This option leads to wrong code when functions
28104 compiled with 16 byte stack alignment (such as functions from a standard
28105 library) are called with misaligned stack. In this case, SSE
28106 instructions may lead to misaligned memory access traps. In addition,
28107 variable arguments are handled incorrectly for 16 byte aligned
28108 objects (including x87 long double and __int128), leading to wrong
28109 results. You must build all modules with
28110 @option{-mpreferred-stack-boundary=3}, including any libraries. This
28111 includes the system libraries and startup modules.
28112
28113 @item -mincoming-stack-boundary=@var{num}
28114 @opindex mincoming-stack-boundary
28115 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28116 boundary. If @option{-mincoming-stack-boundary} is not specified,
28117 the one specified by @option{-mpreferred-stack-boundary} is used.
28118
28119 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28120 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28121 suffer significant run time performance penalties. On Pentium III, the
28122 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28123 properly if it is not 16-byte aligned.
28124
28125 To ensure proper alignment of this values on the stack, the stack boundary
28126 must be as aligned as that required by any value stored on the stack.
28127 Further, every function must be generated such that it keeps the stack
28128 aligned. Thus calling a function compiled with a higher preferred
28129 stack boundary from a function compiled with a lower preferred stack
28130 boundary most likely misaligns the stack. It is recommended that
28131 libraries that use callbacks always use the default setting.
28132
28133 This extra alignment does consume extra stack space, and generally
28134 increases code size. Code that is sensitive to stack space usage, such
28135 as embedded systems and operating system kernels, may want to reduce the
28136 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28137
28138 @need 200
28139 @item -mmmx
28140 @opindex mmmx
28141 @need 200
28142 @itemx -msse
28143 @opindex msse
28144 @need 200
28145 @itemx -msse2
28146 @opindex msse2
28147 @need 200
28148 @itemx -msse3
28149 @opindex msse3
28150 @need 200
28151 @itemx -mssse3
28152 @opindex mssse3
28153 @need 200
28154 @itemx -msse4
28155 @opindex msse4
28156 @need 200
28157 @itemx -msse4a
28158 @opindex msse4a
28159 @need 200
28160 @itemx -msse4.1
28161 @opindex msse4.1
28162 @need 200
28163 @itemx -msse4.2
28164 @opindex msse4.2
28165 @need 200
28166 @itemx -mavx
28167 @opindex mavx
28168 @need 200
28169 @itemx -mavx2
28170 @opindex mavx2
28171 @need 200
28172 @itemx -mavx512f
28173 @opindex mavx512f
28174 @need 200
28175 @itemx -mavx512pf
28176 @opindex mavx512pf
28177 @need 200
28178 @itemx -mavx512er
28179 @opindex mavx512er
28180 @need 200
28181 @itemx -mavx512cd
28182 @opindex mavx512cd
28183 @need 200
28184 @itemx -mavx512vl
28185 @opindex mavx512vl
28186 @need 200
28187 @itemx -mavx512bw
28188 @opindex mavx512bw
28189 @need 200
28190 @itemx -mavx512dq
28191 @opindex mavx512dq
28192 @need 200
28193 @itemx -mavx512ifma
28194 @opindex mavx512ifma
28195 @need 200
28196 @itemx -mavx512vbmi
28197 @opindex mavx512vbmi
28198 @need 200
28199 @itemx -msha
28200 @opindex msha
28201 @need 200
28202 @itemx -maes
28203 @opindex maes
28204 @need 200
28205 @itemx -mpclmul
28206 @opindex mpclmul
28207 @need 200
28208 @itemx -mclflushopt
28209 @opindex mclflushopt
28210 @need 200
28211 @itemx -mclwb
28212 @opindex mclwb
28213 @need 200
28214 @itemx -mfsgsbase
28215 @opindex mfsgsbase
28216 @need 200
28217 @itemx -mptwrite
28218 @opindex mptwrite
28219 @need 200
28220 @itemx -mrdrnd
28221 @opindex mrdrnd
28222 @need 200
28223 @itemx -mf16c
28224 @opindex mf16c
28225 @need 200
28226 @itemx -mfma
28227 @opindex mfma
28228 @need 200
28229 @itemx -mpconfig
28230 @opindex mpconfig
28231 @need 200
28232 @itemx -mwbnoinvd
28233 @opindex mwbnoinvd
28234 @need 200
28235 @itemx -mfma4
28236 @opindex mfma4
28237 @need 200
28238 @itemx -mprfchw
28239 @opindex mprfchw
28240 @need 200
28241 @itemx -mrdpid
28242 @opindex mrdpid
28243 @need 200
28244 @itemx -mprefetchwt1
28245 @opindex mprefetchwt1
28246 @need 200
28247 @itemx -mrdseed
28248 @opindex mrdseed
28249 @need 200
28250 @itemx -msgx
28251 @opindex msgx
28252 @need 200
28253 @itemx -mxop
28254 @opindex mxop
28255 @need 200
28256 @itemx -mlwp
28257 @opindex mlwp
28258 @need 200
28259 @itemx -m3dnow
28260 @opindex m3dnow
28261 @need 200
28262 @itemx -m3dnowa
28263 @opindex m3dnowa
28264 @need 200
28265 @itemx -mpopcnt
28266 @opindex mpopcnt
28267 @need 200
28268 @itemx -mabm
28269 @opindex mabm
28270 @need 200
28271 @itemx -madx
28272 @opindex madx
28273 @need 200
28274 @itemx -mbmi
28275 @opindex mbmi
28276 @need 200
28277 @itemx -mbmi2
28278 @opindex mbmi2
28279 @need 200
28280 @itemx -mlzcnt
28281 @opindex mlzcnt
28282 @need 200
28283 @itemx -mfxsr
28284 @opindex mfxsr
28285 @need 200
28286 @itemx -mxsave
28287 @opindex mxsave
28288 @need 200
28289 @itemx -mxsaveopt
28290 @opindex mxsaveopt
28291 @need 200
28292 @itemx -mxsavec
28293 @opindex mxsavec
28294 @need 200
28295 @itemx -mxsaves
28296 @opindex mxsaves
28297 @need 200
28298 @itemx -mrtm
28299 @opindex mrtm
28300 @need 200
28301 @itemx -mhle
28302 @opindex mhle
28303 @need 200
28304 @itemx -mtbm
28305 @opindex mtbm
28306 @need 200
28307 @itemx -mmwaitx
28308 @opindex mmwaitx
28309 @need 200
28310 @itemx -mclzero
28311 @opindex mclzero
28312 @need 200
28313 @itemx -mpku
28314 @opindex mpku
28315 @need 200
28316 @itemx -mavx512vbmi2
28317 @opindex mavx512vbmi2
28318 @need 200
28319 @itemx -mavx512bf16
28320 @opindex mavx512bf16
28321 @need 200
28322 @itemx -mgfni
28323 @opindex mgfni
28324 @need 200
28325 @itemx -mvaes
28326 @opindex mvaes
28327 @need 200
28328 @itemx -mwaitpkg
28329 @opindex mwaitpkg
28330 @need 200
28331 @itemx -mvpclmulqdq
28332 @opindex mvpclmulqdq
28333 @need 200
28334 @itemx -mavx512bitalg
28335 @opindex mavx512bitalg
28336 @need 200
28337 @itemx -mmovdiri
28338 @opindex mmovdiri
28339 @need 200
28340 @itemx -mmovdir64b
28341 @opindex mmovdir64b
28342 @need 200
28343 @itemx -menqcmd
28344 @opindex menqcmd
28345 @need 200
28346 @itemx -mavx512vpopcntdq
28347 @opindex mavx512vpopcntdq
28348 @need 200
28349 @itemx -mavx512vp2intersect
28350 @opindex mavx512vp2intersect
28351 @need 200
28352 @itemx -mavx5124fmaps
28353 @opindex mavx5124fmaps
28354 @need 200
28355 @itemx -mavx512vnni
28356 @opindex mavx512vnni
28357 @need 200
28358 @itemx -mavx5124vnniw
28359 @opindex mavx5124vnniw
28360 @need 200
28361 @itemx -mcldemote
28362 @opindex mcldemote
28363 These switches enable the use of instructions in the MMX, SSE,
28364 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28365 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28366 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28367 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28368 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28369 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28370 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28371 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28372 extended instruction sets. Each has a corresponding @option{-mno-} option to
28373 disable use of these instructions.
28374
28375 These extensions are also available as built-in functions: see
28376 @ref{x86 Built-in Functions}, for details of the functions enabled and
28377 disabled by these switches.
28378
28379 To generate SSE/SSE2 instructions automatically from floating-point
28380 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28381
28382 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28383 generates new AVX instructions or AVX equivalence for all SSEx instructions
28384 when needed.
28385
28386 These options enable GCC to use these extended instructions in
28387 generated code, even without @option{-mfpmath=sse}. Applications that
28388 perform run-time CPU detection must compile separate files for each
28389 supported architecture, using the appropriate flags. In particular,
28390 the file containing the CPU detection code should be compiled without
28391 these options.
28392
28393 @item -mdump-tune-features
28394 @opindex mdump-tune-features
28395 This option instructs GCC to dump the names of the x86 performance
28396 tuning features and default settings. The names can be used in
28397 @option{-mtune-ctrl=@var{feature-list}}.
28398
28399 @item -mtune-ctrl=@var{feature-list}
28400 @opindex mtune-ctrl=@var{feature-list}
28401 This option is used to do fine grain control of x86 code generation features.
28402 @var{feature-list} is a comma separated list of @var{feature} names. See also
28403 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28404 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28405 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28406 developers. Using it may lead to code paths not covered by testing and can
28407 potentially result in compiler ICEs or runtime errors.
28408
28409 @item -mno-default
28410 @opindex mno-default
28411 This option instructs GCC to turn off all tunable features. See also
28412 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28413
28414 @item -mcld
28415 @opindex mcld
28416 This option instructs GCC to emit a @code{cld} instruction in the prologue
28417 of functions that use string instructions. String instructions depend on
28418 the DF flag to select between autoincrement or autodecrement mode. While the
28419 ABI specifies the DF flag to be cleared on function entry, some operating
28420 systems violate this specification by not clearing the DF flag in their
28421 exception dispatchers. The exception handler can be invoked with the DF flag
28422 set, which leads to wrong direction mode when string instructions are used.
28423 This option can be enabled by default on 32-bit x86 targets by configuring
28424 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28425 instructions can be suppressed with the @option{-mno-cld} compiler option
28426 in this case.
28427
28428 @item -mvzeroupper
28429 @opindex mvzeroupper
28430 This option instructs GCC to emit a @code{vzeroupper} instruction
28431 before a transfer of control flow out of the function to minimize
28432 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28433 intrinsics.
28434
28435 @item -mprefer-avx128
28436 @opindex mprefer-avx128
28437 This option instructs GCC to use 128-bit AVX instructions instead of
28438 256-bit AVX instructions in the auto-vectorizer.
28439
28440 @item -mprefer-vector-width=@var{opt}
28441 @opindex mprefer-vector-width
28442 This option instructs GCC to use @var{opt}-bit vector width in instructions
28443 instead of default on the selected platform.
28444
28445 @table @samp
28446 @item none
28447 No extra limitations applied to GCC other than defined by the selected platform.
28448
28449 @item 128
28450 Prefer 128-bit vector width for instructions.
28451
28452 @item 256
28453 Prefer 256-bit vector width for instructions.
28454
28455 @item 512
28456 Prefer 512-bit vector width for instructions.
28457 @end table
28458
28459 @item -mcx16
28460 @opindex mcx16
28461 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28462 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28463 objects. This is useful for atomic updates of data structures exceeding one
28464 machine word in size. The compiler uses this instruction to implement
28465 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28466 128-bit integers, a library call is always used.
28467
28468 @item -msahf
28469 @opindex msahf
28470 This option enables generation of @code{SAHF} instructions in 64-bit code.
28471 Early Intel Pentium 4 CPUs with Intel 64 support,
28472 prior to the introduction of Pentium 4 G1 step in December 2005,
28473 lacked the @code{LAHF} and @code{SAHF} instructions
28474 which are supported by AMD64.
28475 These are load and store instructions, respectively, for certain status flags.
28476 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28477 @code{drem}, and @code{remainder} built-in functions;
28478 see @ref{Other Builtins} for details.
28479
28480 @item -mmovbe
28481 @opindex mmovbe
28482 This option enables use of the @code{movbe} instruction to implement
28483 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28484
28485 @item -mshstk
28486 @opindex mshstk
28487 The @option{-mshstk} option enables shadow stack built-in functions
28488 from x86 Control-flow Enforcement Technology (CET).
28489
28490 @item -mcrc32
28491 @opindex mcrc32
28492 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28493 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28494 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28495
28496 @item -mrecip
28497 @opindex mrecip
28498 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28499 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28500 with an additional Newton-Raphson step
28501 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28502 (and their vectorized
28503 variants) for single-precision floating-point arguments. These instructions
28504 are generated only when @option{-funsafe-math-optimizations} is enabled
28505 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28506 Note that while the throughput of the sequence is higher than the throughput
28507 of the non-reciprocal instruction, the precision of the sequence can be
28508 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28509
28510 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28511 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28512 combination), and doesn't need @option{-mrecip}.
28513
28514 Also note that GCC emits the above sequence with additional Newton-Raphson step
28515 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28516 already with @option{-ffast-math} (or the above option combination), and
28517 doesn't need @option{-mrecip}.
28518
28519 @item -mrecip=@var{opt}
28520 @opindex mrecip=opt
28521 This option controls which reciprocal estimate instructions
28522 may be used. @var{opt} is a comma-separated list of options, which may
28523 be preceded by a @samp{!} to invert the option:
28524
28525 @table @samp
28526 @item all
28527 Enable all estimate instructions.
28528
28529 @item default
28530 Enable the default instructions, equivalent to @option{-mrecip}.
28531
28532 @item none
28533 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28534
28535 @item div
28536 Enable the approximation for scalar division.
28537
28538 @item vec-div
28539 Enable the approximation for vectorized division.
28540
28541 @item sqrt
28542 Enable the approximation for scalar square root.
28543
28544 @item vec-sqrt
28545 Enable the approximation for vectorized square root.
28546 @end table
28547
28548 So, for example, @option{-mrecip=all,!sqrt} enables
28549 all of the reciprocal approximations, except for square root.
28550
28551 @item -mveclibabi=@var{type}
28552 @opindex mveclibabi
28553 Specifies the ABI type to use for vectorizing intrinsics using an
28554 external library. Supported values for @var{type} are @samp{svml}
28555 for the Intel short
28556 vector math library and @samp{acml} for the AMD math core library.
28557 To use this option, both @option{-ftree-vectorize} and
28558 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28559 ABI-compatible library must be specified at link time.
28560
28561 GCC currently emits calls to @code{vmldExp2},
28562 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28563 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28564 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28565 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28566 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28567 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28568 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28569 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28570 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28571 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28572 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28573 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28574 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28575 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28576 when @option{-mveclibabi=acml} is used.
28577
28578 @item -mabi=@var{name}
28579 @opindex mabi
28580 Generate code for the specified calling convention. Permissible values
28581 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28582 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28583 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28584 You can control this behavior for specific functions by
28585 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28586 @xref{Function Attributes}.
28587
28588 @item -mforce-indirect-call
28589 @opindex mforce-indirect-call
28590 Force all calls to functions to be indirect. This is useful
28591 when using Intel Processor Trace where it generates more precise timing
28592 information for function calls.
28593
28594 @item -mmanual-endbr
28595 @opindex mmanual-endbr
28596 Insert ENDBR instruction at function entry only via the @code{cf_check}
28597 function attribute. This is useful when used with the option
28598 @option{-fcf-protection=branch} to control ENDBR insertion at the
28599 function entry.
28600
28601 @item -mcall-ms2sysv-xlogues
28602 @opindex mcall-ms2sysv-xlogues
28603 @opindex mno-call-ms2sysv-xlogues
28604 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28605 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28606 default, the code for saving and restoring these registers is emitted inline,
28607 resulting in fairly lengthy prologues and epilogues. Using
28608 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28609 use stubs in the static portion of libgcc to perform these saves and restores,
28610 thus reducing function size at the cost of a few extra instructions.
28611
28612 @item -mtls-dialect=@var{type}
28613 @opindex mtls-dialect
28614 Generate code to access thread-local storage using the @samp{gnu} or
28615 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28616 @samp{gnu2} is more efficient, but it may add compile- and run-time
28617 requirements that cannot be satisfied on all systems.
28618
28619 @item -mpush-args
28620 @itemx -mno-push-args
28621 @opindex mpush-args
28622 @opindex mno-push-args
28623 Use PUSH operations to store outgoing parameters. This method is shorter
28624 and usually equally fast as method using SUB/MOV operations and is enabled
28625 by default. In some cases disabling it may improve performance because of
28626 improved scheduling and reduced dependencies.
28627
28628 @item -maccumulate-outgoing-args
28629 @opindex maccumulate-outgoing-args
28630 If enabled, the maximum amount of space required for outgoing arguments is
28631 computed in the function prologue. This is faster on most modern CPUs
28632 because of reduced dependencies, improved scheduling and reduced stack usage
28633 when the preferred stack boundary is not equal to 2. The drawback is a notable
28634 increase in code size. This switch implies @option{-mno-push-args}.
28635
28636 @item -mthreads
28637 @opindex mthreads
28638 Support thread-safe exception handling on MinGW. Programs that rely
28639 on thread-safe exception handling must compile and link all code with the
28640 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28641 @option{-D_MT}; when linking, it links in a special thread helper library
28642 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28643
28644 @item -mms-bitfields
28645 @itemx -mno-ms-bitfields
28646 @opindex mms-bitfields
28647 @opindex mno-ms-bitfields
28648
28649 Enable/disable bit-field layout compatible with the native Microsoft
28650 Windows compiler.
28651
28652 If @code{packed} is used on a structure, or if bit-fields are used,
28653 it may be that the Microsoft ABI lays out the structure differently
28654 than the way GCC normally does. Particularly when moving packed
28655 data between functions compiled with GCC and the native Microsoft compiler
28656 (either via function call or as data in a file), it may be necessary to access
28657 either format.
28658
28659 This option is enabled by default for Microsoft Windows
28660 targets. This behavior can also be controlled locally by use of variable
28661 or type attributes. For more information, see @ref{x86 Variable Attributes}
28662 and @ref{x86 Type Attributes}.
28663
28664 The Microsoft structure layout algorithm is fairly simple with the exception
28665 of the bit-field packing.
28666 The padding and alignment of members of structures and whether a bit-field
28667 can straddle a storage-unit boundary are determine by these rules:
28668
28669 @enumerate
28670 @item Structure members are stored sequentially in the order in which they are
28671 declared: the first member has the lowest memory address and the last member
28672 the highest.
28673
28674 @item Every data object has an alignment requirement. The alignment requirement
28675 for all data except structures, unions, and arrays is either the size of the
28676 object or the current packing size (specified with either the
28677 @code{aligned} attribute or the @code{pack} pragma),
28678 whichever is less. For structures, unions, and arrays,
28679 the alignment requirement is the largest alignment requirement of its members.
28680 Every object is allocated an offset so that:
28681
28682 @smallexample
28683 offset % alignment_requirement == 0
28684 @end smallexample
28685
28686 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28687 unit if the integral types are the same size and if the next bit-field fits
28688 into the current allocation unit without crossing the boundary imposed by the
28689 common alignment requirements of the bit-fields.
28690 @end enumerate
28691
28692 MSVC interprets zero-length bit-fields in the following ways:
28693
28694 @enumerate
28695 @item If a zero-length bit-field is inserted between two bit-fields that
28696 are normally coalesced, the bit-fields are not coalesced.
28697
28698 For example:
28699
28700 @smallexample
28701 struct
28702 @{
28703 unsigned long bf_1 : 12;
28704 unsigned long : 0;
28705 unsigned long bf_2 : 12;
28706 @} t1;
28707 @end smallexample
28708
28709 @noindent
28710 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28711 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28712
28713 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28714 alignment of the zero-length bit-field is greater than the member that follows it,
28715 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28716
28717 For example:
28718
28719 @smallexample
28720 struct
28721 @{
28722 char foo : 4;
28723 short : 0;
28724 char bar;
28725 @} t2;
28726
28727 struct
28728 @{
28729 char foo : 4;
28730 short : 0;
28731 double bar;
28732 @} t3;
28733 @end smallexample
28734
28735 @noindent
28736 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28737 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28738 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28739 of the structure.
28740
28741 Taking this into account, it is important to note the following:
28742
28743 @enumerate
28744 @item If a zero-length bit-field follows a normal bit-field, the type of the
28745 zero-length bit-field may affect the alignment of the structure as whole. For
28746 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28747 normal bit-field, and is of type short.
28748
28749 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28750 still affect the alignment of the structure:
28751
28752 @smallexample
28753 struct
28754 @{
28755 char foo : 6;
28756 long : 0;
28757 @} t4;
28758 @end smallexample
28759
28760 @noindent
28761 Here, @code{t4} takes up 4 bytes.
28762 @end enumerate
28763
28764 @item Zero-length bit-fields following non-bit-field members are ignored:
28765
28766 @smallexample
28767 struct
28768 @{
28769 char foo;
28770 long : 0;
28771 char bar;
28772 @} t5;
28773 @end smallexample
28774
28775 @noindent
28776 Here, @code{t5} takes up 2 bytes.
28777 @end enumerate
28778
28779
28780 @item -mno-align-stringops
28781 @opindex mno-align-stringops
28782 @opindex malign-stringops
28783 Do not align the destination of inlined string operations. This switch reduces
28784 code size and improves performance in case the destination is already aligned,
28785 but GCC doesn't know about it.
28786
28787 @item -minline-all-stringops
28788 @opindex minline-all-stringops
28789 By default GCC inlines string operations only when the destination is
28790 known to be aligned to least a 4-byte boundary.
28791 This enables more inlining and increases code
28792 size, but may improve performance of code that depends on fast
28793 @code{memcpy} and @code{memset} for short lengths.
28794 The option enables inline expansion of @code{strlen} for all
28795 pointer alignments.
28796
28797 @item -minline-stringops-dynamically
28798 @opindex minline-stringops-dynamically
28799 For string operations of unknown size, use run-time checks with
28800 inline code for small blocks and a library call for large blocks.
28801
28802 @item -mstringop-strategy=@var{alg}
28803 @opindex mstringop-strategy=@var{alg}
28804 Override the internal decision heuristic for the particular algorithm to use
28805 for inlining string operations. The allowed values for @var{alg} are:
28806
28807 @table @samp
28808 @item rep_byte
28809 @itemx rep_4byte
28810 @itemx rep_8byte
28811 Expand using i386 @code{rep} prefix of the specified size.
28812
28813 @item byte_loop
28814 @itemx loop
28815 @itemx unrolled_loop
28816 Expand into an inline loop.
28817
28818 @item libcall
28819 Always use a library call.
28820 @end table
28821
28822 @item -mmemcpy-strategy=@var{strategy}
28823 @opindex mmemcpy-strategy=@var{strategy}
28824 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28825 should be inlined and what inline algorithm to use when the expected size
28826 of the copy operation is known. @var{strategy}
28827 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28828 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28829 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28830 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28831 in the list must be specified in increasing order. The minimal byte size for
28832 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28833 preceding range.
28834
28835 @item -mmemset-strategy=@var{strategy}
28836 @opindex mmemset-strategy=@var{strategy}
28837 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28838 @code{__builtin_memset} expansion.
28839
28840 @item -momit-leaf-frame-pointer
28841 @opindex momit-leaf-frame-pointer
28842 Don't keep the frame pointer in a register for leaf functions. This
28843 avoids the instructions to save, set up, and restore frame pointers and
28844 makes an extra register available in leaf functions. The option
28845 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28846 which might make debugging harder.
28847
28848 @item -mtls-direct-seg-refs
28849 @itemx -mno-tls-direct-seg-refs
28850 @opindex mtls-direct-seg-refs
28851 Controls whether TLS variables may be accessed with offsets from the
28852 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28853 or whether the thread base pointer must be added. Whether or not this
28854 is valid depends on the operating system, and whether it maps the
28855 segment to cover the entire TLS area.
28856
28857 For systems that use the GNU C Library, the default is on.
28858
28859 @item -msse2avx
28860 @itemx -mno-sse2avx
28861 @opindex msse2avx
28862 Specify that the assembler should encode SSE instructions with VEX
28863 prefix. The option @option{-mavx} turns this on by default.
28864
28865 @item -mfentry
28866 @itemx -mno-fentry
28867 @opindex mfentry
28868 If profiling is active (@option{-pg}), put the profiling
28869 counter call before the prologue.
28870 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28871 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28872
28873 @item -mrecord-mcount
28874 @itemx -mno-record-mcount
28875 @opindex mrecord-mcount
28876 If profiling is active (@option{-pg}), generate a __mcount_loc section
28877 that contains pointers to each profiling call. This is useful for
28878 automatically patching and out calls.
28879
28880 @item -mnop-mcount
28881 @itemx -mno-nop-mcount
28882 @opindex mnop-mcount
28883 If profiling is active (@option{-pg}), generate the calls to
28884 the profiling functions as NOPs. This is useful when they
28885 should be patched in later dynamically. This is likely only
28886 useful together with @option{-mrecord-mcount}.
28887
28888 @item -minstrument-return=@var{type}
28889 @opindex minstrument-return
28890 Instrument function exit in -pg -mfentry instrumented functions with
28891 call to specified function. This only instruments true returns ending
28892 with ret, but not sibling calls ending with jump. Valid types
28893 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28894 or @var{nop5} to generate a 5 byte nop.
28895
28896 @item -mrecord-return
28897 @itemx -mno-record-return
28898 @opindex mrecord-return
28899 Generate a __return_loc section pointing to all return instrumentation code.
28900
28901 @item -mfentry-name=@var{name}
28902 @opindex mfentry-name
28903 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28904
28905 @item -mfentry-section=@var{name}
28906 @opindex mfentry-section
28907 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28908
28909 @item -mskip-rax-setup
28910 @itemx -mno-skip-rax-setup
28911 @opindex mskip-rax-setup
28912 When generating code for the x86-64 architecture with SSE extensions
28913 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28914 register when there are no variable arguments passed in vector registers.
28915
28916 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28917 saving vector registers on stack when passing variable arguments, the
28918 impacts of this option are callees may waste some stack space,
28919 misbehave or jump to a random location. GCC 4.4 or newer don't have
28920 those issues, regardless the RAX register value.
28921
28922 @item -m8bit-idiv
28923 @itemx -mno-8bit-idiv
28924 @opindex m8bit-idiv
28925 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28926 much faster than 32-bit/64-bit integer divide. This option generates a
28927 run-time check. If both dividend and divisor are within range of 0
28928 to 255, 8-bit unsigned integer divide is used instead of
28929 32-bit/64-bit integer divide.
28930
28931 @item -mavx256-split-unaligned-load
28932 @itemx -mavx256-split-unaligned-store
28933 @opindex mavx256-split-unaligned-load
28934 @opindex mavx256-split-unaligned-store
28935 Split 32-byte AVX unaligned load and store.
28936
28937 @item -mstack-protector-guard=@var{guard}
28938 @itemx -mstack-protector-guard-reg=@var{reg}
28939 @itemx -mstack-protector-guard-offset=@var{offset}
28940 @opindex mstack-protector-guard
28941 @opindex mstack-protector-guard-reg
28942 @opindex mstack-protector-guard-offset
28943 Generate stack protection code using canary at @var{guard}. Supported
28944 locations are @samp{global} for global canary or @samp{tls} for per-thread
28945 canary in the TLS block (the default). This option has effect only when
28946 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28947
28948 With the latter choice the options
28949 @option{-mstack-protector-guard-reg=@var{reg}} and
28950 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28951 which segment register (@code{%fs} or @code{%gs}) to use as base register
28952 for reading the canary, and from what offset from that base register.
28953 The default for those is as specified in the relevant ABI.
28954
28955 @item -mgeneral-regs-only
28956 @opindex mgeneral-regs-only
28957 Generate code that uses only the general-purpose registers. This
28958 prevents the compiler from using floating-point, vector, mask and bound
28959 registers.
28960
28961 @item -mindirect-branch=@var{choice}
28962 @opindex mindirect-branch
28963 Convert indirect call and jump with @var{choice}. The default is
28964 @samp{keep}, which keeps indirect call and jump unmodified.
28965 @samp{thunk} converts indirect call and jump to call and return thunk.
28966 @samp{thunk-inline} converts indirect call and jump to inlined call
28967 and return thunk. @samp{thunk-extern} converts indirect call and jump
28968 to external call and return thunk provided in a separate object file.
28969 You can control this behavior for a specific function by using the
28970 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28971
28972 Note that @option{-mcmodel=large} is incompatible with
28973 @option{-mindirect-branch=thunk} and
28974 @option{-mindirect-branch=thunk-extern} since the thunk function may
28975 not be reachable in the large code model.
28976
28977 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28978 @option{-fcf-protection=branch} since the external thunk cannot be modified
28979 to disable control-flow check.
28980
28981 @item -mfunction-return=@var{choice}
28982 @opindex mfunction-return
28983 Convert function return with @var{choice}. The default is @samp{keep},
28984 which keeps function return unmodified. @samp{thunk} converts function
28985 return to call and return thunk. @samp{thunk-inline} converts function
28986 return to inlined call and return thunk. @samp{thunk-extern} converts
28987 function return to external call and return thunk provided in a separate
28988 object file. You can control this behavior for a specific function by
28989 using the function attribute @code{function_return}.
28990 @xref{Function Attributes}.
28991
28992 Note that @option{-mcmodel=large} is incompatible with
28993 @option{-mfunction-return=thunk} and
28994 @option{-mfunction-return=thunk-extern} since the thunk function may
28995 not be reachable in the large code model.
28996
28997
28998 @item -mindirect-branch-register
28999 @opindex mindirect-branch-register
29000 Force indirect call and jump via register.
29001
29002 @end table
29003
29004 These @samp{-m} switches are supported in addition to the above
29005 on x86-64 processors in 64-bit environments.
29006
29007 @table @gcctabopt
29008 @item -m32
29009 @itemx -m64
29010 @itemx -mx32
29011 @itemx -m16
29012 @itemx -miamcu
29013 @opindex m32
29014 @opindex m64
29015 @opindex mx32
29016 @opindex m16
29017 @opindex miamcu
29018 Generate code for a 16-bit, 32-bit or 64-bit environment.
29019 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
29020 to 32 bits, and
29021 generates code that runs on any i386 system.
29022
29023 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
29024 types to 64 bits, and generates code for the x86-64 architecture.
29025 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
29026 and @option{-mdynamic-no-pic} options.
29027
29028 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
29029 to 32 bits, and
29030 generates code for the x86-64 architecture.
29031
29032 The @option{-m16} option is the same as @option{-m32}, except for that
29033 it outputs the @code{.code16gcc} assembly directive at the beginning of
29034 the assembly output so that the binary can run in 16-bit mode.
29035
29036 The @option{-miamcu} option generates code which conforms to Intel MCU
29037 psABI. It requires the @option{-m32} option to be turned on.
29038
29039 @item -mno-red-zone
29040 @opindex mno-red-zone
29041 @opindex mred-zone
29042 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
29043 by the x86-64 ABI; it is a 128-byte area beyond the location of the
29044 stack pointer that is not modified by signal or interrupt handlers
29045 and therefore can be used for temporary data without adjusting the stack
29046 pointer. The flag @option{-mno-red-zone} disables this red zone.
29047
29048 @item -mcmodel=small
29049 @opindex mcmodel=small
29050 Generate code for the small code model: the program and its symbols must
29051 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
29052 Programs can be statically or dynamically linked. This is the default
29053 code model.
29054
29055 @item -mcmodel=kernel
29056 @opindex mcmodel=kernel
29057 Generate code for the kernel code model. The kernel runs in the
29058 negative 2 GB of the address space.
29059 This model has to be used for Linux kernel code.
29060
29061 @item -mcmodel=medium
29062 @opindex mcmodel=medium
29063 Generate code for the medium model: the program is linked in the lower 2
29064 GB of the address space. Small symbols are also placed there. Symbols
29065 with sizes larger than @option{-mlarge-data-threshold} are put into
29066 large data or BSS sections and can be located above 2GB. Programs can
29067 be statically or dynamically linked.
29068
29069 @item -mcmodel=large
29070 @opindex mcmodel=large
29071 Generate code for the large model. This model makes no assumptions
29072 about addresses and sizes of sections.
29073
29074 @item -maddress-mode=long
29075 @opindex maddress-mode=long
29076 Generate code for long address mode. This is only supported for 64-bit
29077 and x32 environments. It is the default address mode for 64-bit
29078 environments.
29079
29080 @item -maddress-mode=short
29081 @opindex maddress-mode=short
29082 Generate code for short address mode. This is only supported for 32-bit
29083 and x32 environments. It is the default address mode for 32-bit and
29084 x32 environments.
29085 @end table
29086
29087 @node x86 Windows Options
29088 @subsection x86 Windows Options
29089 @cindex x86 Windows Options
29090 @cindex Windows Options for x86
29091
29092 These additional options are available for Microsoft Windows targets:
29093
29094 @table @gcctabopt
29095 @item -mconsole
29096 @opindex mconsole
29097 This option
29098 specifies that a console application is to be generated, by
29099 instructing the linker to set the PE header subsystem type
29100 required for console applications.
29101 This option is available for Cygwin and MinGW targets and is
29102 enabled by default on those targets.
29103
29104 @item -mdll
29105 @opindex mdll
29106 This option is available for Cygwin and MinGW targets. It
29107 specifies that a DLL---a dynamic link library---is to be
29108 generated, enabling the selection of the required runtime
29109 startup object and entry point.
29110
29111 @item -mnop-fun-dllimport
29112 @opindex mnop-fun-dllimport
29113 This option is available for Cygwin and MinGW targets. It
29114 specifies that the @code{dllimport} attribute should be ignored.
29115
29116 @item -mthread
29117 @opindex mthread
29118 This option is available for MinGW targets. It specifies
29119 that MinGW-specific thread support is to be used.
29120
29121 @item -municode
29122 @opindex municode
29123 This option is available for MinGW-w64 targets. It causes
29124 the @code{UNICODE} preprocessor macro to be predefined, and
29125 chooses Unicode-capable runtime startup code.
29126
29127 @item -mwin32
29128 @opindex mwin32
29129 This option is available for Cygwin and MinGW targets. It
29130 specifies that the typical Microsoft Windows predefined macros are to
29131 be set in the pre-processor, but does not influence the choice
29132 of runtime library/startup code.
29133
29134 @item -mwindows
29135 @opindex mwindows
29136 This option is available for Cygwin and MinGW targets. It
29137 specifies that a GUI application is to be generated by
29138 instructing the linker to set the PE header subsystem type
29139 appropriately.
29140
29141 @item -fno-set-stack-executable
29142 @opindex fno-set-stack-executable
29143 @opindex fset-stack-executable
29144 This option is available for MinGW targets. It specifies that
29145 the executable flag for the stack used by nested functions isn't
29146 set. This is necessary for binaries running in kernel mode of
29147 Microsoft Windows, as there the User32 API, which is used to set executable
29148 privileges, isn't available.
29149
29150 @item -fwritable-relocated-rdata
29151 @opindex fno-writable-relocated-rdata
29152 @opindex fwritable-relocated-rdata
29153 This option is available for MinGW and Cygwin targets. It specifies
29154 that relocated-data in read-only section is put into the @code{.data}
29155 section. This is a necessary for older runtimes not supporting
29156 modification of @code{.rdata} sections for pseudo-relocation.
29157
29158 @item -mpe-aligned-commons
29159 @opindex mpe-aligned-commons
29160 This option is available for Cygwin and MinGW targets. It
29161 specifies that the GNU extension to the PE file format that
29162 permits the correct alignment of COMMON variables should be
29163 used when generating code. It is enabled by default if
29164 GCC detects that the target assembler found during configuration
29165 supports the feature.
29166 @end table
29167
29168 See also under @ref{x86 Options} for standard options.
29169
29170 @node Xstormy16 Options
29171 @subsection Xstormy16 Options
29172 @cindex Xstormy16 Options
29173
29174 These options are defined for Xstormy16:
29175
29176 @table @gcctabopt
29177 @item -msim
29178 @opindex msim
29179 Choose startup files and linker script suitable for the simulator.
29180 @end table
29181
29182 @node Xtensa Options
29183 @subsection Xtensa Options
29184 @cindex Xtensa Options
29185
29186 These options are supported for Xtensa targets:
29187
29188 @table @gcctabopt
29189 @item -mconst16
29190 @itemx -mno-const16
29191 @opindex mconst16
29192 @opindex mno-const16
29193 Enable or disable use of @code{CONST16} instructions for loading
29194 constant values. The @code{CONST16} instruction is currently not a
29195 standard option from Tensilica. When enabled, @code{CONST16}
29196 instructions are always used in place of the standard @code{L32R}
29197 instructions. The use of @code{CONST16} is enabled by default only if
29198 the @code{L32R} instruction is not available.
29199
29200 @item -mfused-madd
29201 @itemx -mno-fused-madd
29202 @opindex mfused-madd
29203 @opindex mno-fused-madd
29204 Enable or disable use of fused multiply/add and multiply/subtract
29205 instructions in the floating-point option. This has no effect if the
29206 floating-point option is not also enabled. Disabling fused multiply/add
29207 and multiply/subtract instructions forces the compiler to use separate
29208 instructions for the multiply and add/subtract operations. This may be
29209 desirable in some cases where strict IEEE 754-compliant results are
29210 required: the fused multiply add/subtract instructions do not round the
29211 intermediate result, thereby producing results with @emph{more} bits of
29212 precision than specified by the IEEE standard. Disabling fused multiply
29213 add/subtract instructions also ensures that the program output is not
29214 sensitive to the compiler's ability to combine multiply and add/subtract
29215 operations.
29216
29217 @item -mserialize-volatile
29218 @itemx -mno-serialize-volatile
29219 @opindex mserialize-volatile
29220 @opindex mno-serialize-volatile
29221 When this option is enabled, GCC inserts @code{MEMW} instructions before
29222 @code{volatile} memory references to guarantee sequential consistency.
29223 The default is @option{-mserialize-volatile}. Use
29224 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29225
29226 @item -mforce-no-pic
29227 @opindex mforce-no-pic
29228 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29229 position-independent code (PIC), this option disables PIC for compiling
29230 kernel code.
29231
29232 @item -mtext-section-literals
29233 @itemx -mno-text-section-literals
29234 @opindex mtext-section-literals
29235 @opindex mno-text-section-literals
29236 These options control the treatment of literal pools. The default is
29237 @option{-mno-text-section-literals}, which places literals in a separate
29238 section in the output file. This allows the literal pool to be placed
29239 in a data RAM/ROM, and it also allows the linker to combine literal
29240 pools from separate object files to remove redundant literals and
29241 improve code size. With @option{-mtext-section-literals}, the literals
29242 are interspersed in the text section in order to keep them as close as
29243 possible to their references. This may be necessary for large assembly
29244 files. Literals for each function are placed right before that function.
29245
29246 @item -mauto-litpools
29247 @itemx -mno-auto-litpools
29248 @opindex mauto-litpools
29249 @opindex mno-auto-litpools
29250 These options control the treatment of literal pools. The default is
29251 @option{-mno-auto-litpools}, which places literals in a separate
29252 section in the output file unless @option{-mtext-section-literals} is
29253 used. With @option{-mauto-litpools} the literals are interspersed in
29254 the text section by the assembler. Compiler does not produce explicit
29255 @code{.literal} directives and loads literals into registers with
29256 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29257 do relaxation and place literals as necessary. This option allows
29258 assembler to create several literal pools per function and assemble
29259 very big functions, which may not be possible with
29260 @option{-mtext-section-literals}.
29261
29262 @item -mtarget-align
29263 @itemx -mno-target-align
29264 @opindex mtarget-align
29265 @opindex mno-target-align
29266 When this option is enabled, GCC instructs the assembler to
29267 automatically align instructions to reduce branch penalties at the
29268 expense of some code density. The assembler attempts to widen density
29269 instructions to align branch targets and the instructions following call
29270 instructions. If there are not enough preceding safe density
29271 instructions to align a target, no widening is performed. The
29272 default is @option{-mtarget-align}. These options do not affect the
29273 treatment of auto-aligned instructions like @code{LOOP}, which the
29274 assembler always aligns, either by widening density instructions or
29275 by inserting NOP instructions.
29276
29277 @item -mlongcalls
29278 @itemx -mno-longcalls
29279 @opindex mlongcalls
29280 @opindex mno-longcalls
29281 When this option is enabled, GCC instructs the assembler to translate
29282 direct calls to indirect calls unless it can determine that the target
29283 of a direct call is in the range allowed by the call instruction. This
29284 translation typically occurs for calls to functions in other source
29285 files. Specifically, the assembler translates a direct @code{CALL}
29286 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29287 The default is @option{-mno-longcalls}. This option should be used in
29288 programs where the call target can potentially be out of range. This
29289 option is implemented in the assembler, not the compiler, so the
29290 assembly code generated by GCC still shows direct call
29291 instructions---look at the disassembled object code to see the actual
29292 instructions. Note that the assembler uses an indirect call for
29293 every cross-file call, not just those that really are out of range.
29294 @end table
29295
29296 @node zSeries Options
29297 @subsection zSeries Options
29298 @cindex zSeries options
29299
29300 These are listed under @xref{S/390 and zSeries Options}.
29301
29302
29303 @c man end
29304
29305 @node Spec Files
29306 @section Specifying Subprocesses and the Switches to Pass to Them
29307 @cindex Spec Files
29308
29309 @command{gcc} is a driver program. It performs its job by invoking a
29310 sequence of other programs to do the work of compiling, assembling and
29311 linking. GCC interprets its command-line parameters and uses these to
29312 deduce which programs it should invoke, and which command-line options
29313 it ought to place on their command lines. This behavior is controlled
29314 by @dfn{spec strings}. In most cases there is one spec string for each
29315 program that GCC can invoke, but a few programs have multiple spec
29316 strings to control their behavior. The spec strings built into GCC can
29317 be overridden by using the @option{-specs=} command-line switch to specify
29318 a spec file.
29319
29320 @dfn{Spec files} are plain-text files that are used to construct spec
29321 strings. They consist of a sequence of directives separated by blank
29322 lines. The type of directive is determined by the first non-whitespace
29323 character on the line, which can be one of the following:
29324
29325 @table @code
29326 @item %@var{command}
29327 Issues a @var{command} to the spec file processor. The commands that can
29328 appear here are:
29329
29330 @table @code
29331 @item %include <@var{file}>
29332 @cindex @code{%include}
29333 Search for @var{file} and insert its text at the current point in the
29334 specs file.
29335
29336 @item %include_noerr <@var{file}>
29337 @cindex @code{%include_noerr}
29338 Just like @samp{%include}, but do not generate an error message if the include
29339 file cannot be found.
29340
29341 @item %rename @var{old_name} @var{new_name}
29342 @cindex @code{%rename}
29343 Rename the spec string @var{old_name} to @var{new_name}.
29344
29345 @end table
29346
29347 @item *[@var{spec_name}]:
29348 This tells the compiler to create, override or delete the named spec
29349 string. All lines after this directive up to the next directive or
29350 blank line are considered to be the text for the spec string. If this
29351 results in an empty string then the spec is deleted. (Or, if the
29352 spec did not exist, then nothing happens.) Otherwise, if the spec
29353 does not currently exist a new spec is created. If the spec does
29354 exist then its contents are overridden by the text of this
29355 directive, unless the first character of that text is the @samp{+}
29356 character, in which case the text is appended to the spec.
29357
29358 @item [@var{suffix}]:
29359 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29360 and up to the next directive or blank line are considered to make up the
29361 spec string for the indicated suffix. When the compiler encounters an
29362 input file with the named suffix, it processes the spec string in
29363 order to work out how to compile that file. For example:
29364
29365 @smallexample
29366 .ZZ:
29367 z-compile -input %i
29368 @end smallexample
29369
29370 This says that any input file whose name ends in @samp{.ZZ} should be
29371 passed to the program @samp{z-compile}, which should be invoked with the
29372 command-line switch @option{-input} and with the result of performing the
29373 @samp{%i} substitution. (See below.)
29374
29375 As an alternative to providing a spec string, the text following a
29376 suffix directive can be one of the following:
29377
29378 @table @code
29379 @item @@@var{language}
29380 This says that the suffix is an alias for a known @var{language}. This is
29381 similar to using the @option{-x} command-line switch to GCC to specify a
29382 language explicitly. For example:
29383
29384 @smallexample
29385 .ZZ:
29386 @@c++
29387 @end smallexample
29388
29389 Says that .ZZ files are, in fact, C++ source files.
29390
29391 @item #@var{name}
29392 This causes an error messages saying:
29393
29394 @smallexample
29395 @var{name} compiler not installed on this system.
29396 @end smallexample
29397 @end table
29398
29399 GCC already has an extensive list of suffixes built into it.
29400 This directive adds an entry to the end of the list of suffixes, but
29401 since the list is searched from the end backwards, it is effectively
29402 possible to override earlier entries using this technique.
29403
29404 @end table
29405
29406 GCC has the following spec strings built into it. Spec files can
29407 override these strings or create their own. Note that individual
29408 targets can also add their own spec strings to this list.
29409
29410 @smallexample
29411 asm Options to pass to the assembler
29412 asm_final Options to pass to the assembler post-processor
29413 cpp Options to pass to the C preprocessor
29414 cc1 Options to pass to the C compiler
29415 cc1plus Options to pass to the C++ compiler
29416 endfile Object files to include at the end of the link
29417 link Options to pass to the linker
29418 lib Libraries to include on the command line to the linker
29419 libgcc Decides which GCC support library to pass to the linker
29420 linker Sets the name of the linker
29421 predefines Defines to be passed to the C preprocessor
29422 signed_char Defines to pass to CPP to say whether @code{char} is signed
29423 by default
29424 startfile Object files to include at the start of the link
29425 @end smallexample
29426
29427 Here is a small example of a spec file:
29428
29429 @smallexample
29430 %rename lib old_lib
29431
29432 *lib:
29433 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29434 @end smallexample
29435
29436 This example renames the spec called @samp{lib} to @samp{old_lib} and
29437 then overrides the previous definition of @samp{lib} with a new one.
29438 The new definition adds in some extra command-line options before
29439 including the text of the old definition.
29440
29441 @dfn{Spec strings} are a list of command-line options to be passed to their
29442 corresponding program. In addition, the spec strings can contain
29443 @samp{%}-prefixed sequences to substitute variable text or to
29444 conditionally insert text into the command line. Using these constructs
29445 it is possible to generate quite complex command lines.
29446
29447 Here is a table of all defined @samp{%}-sequences for spec
29448 strings. Note that spaces are not generated automatically around the
29449 results of expanding these sequences. Therefore you can concatenate them
29450 together or combine them with constant text in a single argument.
29451
29452 @table @code
29453 @item %%
29454 Substitute one @samp{%} into the program name or argument.
29455
29456 @item %i
29457 Substitute the name of the input file being processed.
29458
29459 @item %b
29460 Substitute the basename of the input file being processed.
29461 This is the substring up to (and not including) the last period
29462 and not including the directory.
29463
29464 @item %B
29465 This is the same as @samp{%b}, but include the file suffix (text after
29466 the last period).
29467
29468 @item %d
29469 Marks the argument containing or following the @samp{%d} as a
29470 temporary file name, so that that file is deleted if GCC exits
29471 successfully. Unlike @samp{%g}, this contributes no text to the
29472 argument.
29473
29474 @item %g@var{suffix}
29475 Substitute a file name that has suffix @var{suffix} and is chosen
29476 once per compilation, and mark the argument in the same way as
29477 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29478 name is now chosen in a way that is hard to predict even when previously
29479 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29480 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29481 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29482 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29483 was simply substituted with a file name chosen once per compilation,
29484 without regard to any appended suffix (which was therefore treated
29485 just like ordinary text), making such attacks more likely to succeed.
29486
29487 @item %u@var{suffix}
29488 Like @samp{%g}, but generates a new temporary file name
29489 each time it appears instead of once per compilation.
29490
29491 @item %U@var{suffix}
29492 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29493 new one if there is no such last file name. In the absence of any
29494 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29495 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29496 involves the generation of two distinct file names, one
29497 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29498 simply substituted with a file name chosen for the previous @samp{%u},
29499 without regard to any appended suffix.
29500
29501 @item %j@var{suffix}
29502 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29503 writable, and if @option{-save-temps} is not used;
29504 otherwise, substitute the name
29505 of a temporary file, just like @samp{%u}. This temporary file is not
29506 meant for communication between processes, but rather as a junk
29507 disposal mechanism.
29508
29509 @item %|@var{suffix}
29510 @itemx %m@var{suffix}
29511 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29512 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29513 all. These are the two most common ways to instruct a program that it
29514 should read from standard input or write to standard output. If you
29515 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29516 construct: see for example @file{gcc/fortran/lang-specs.h}.
29517
29518 @item %.@var{SUFFIX}
29519 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29520 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29521 terminated by the next space or %.
29522
29523 @item %w
29524 Marks the argument containing or following the @samp{%w} as the
29525 designated output file of this compilation. This puts the argument
29526 into the sequence of arguments that @samp{%o} substitutes.
29527
29528 @item %o
29529 Substitutes the names of all the output files, with spaces
29530 automatically placed around them. You should write spaces
29531 around the @samp{%o} as well or the results are undefined.
29532 @samp{%o} is for use in the specs for running the linker.
29533 Input files whose names have no recognized suffix are not compiled
29534 at all, but they are included among the output files, so they are
29535 linked.
29536
29537 @item %O
29538 Substitutes the suffix for object files. Note that this is
29539 handled specially when it immediately follows @samp{%g, %u, or %U},
29540 because of the need for those to form complete file names. The
29541 handling is such that @samp{%O} is treated exactly as if it had already
29542 been substituted, except that @samp{%g, %u, and %U} do not currently
29543 support additional @var{suffix} characters following @samp{%O} as they do
29544 following, for example, @samp{.o}.
29545
29546 @item %p
29547 Substitutes the standard macro predefinitions for the
29548 current target machine. Use this when running @command{cpp}.
29549
29550 @item %P
29551 Like @samp{%p}, but puts @samp{__} before and after the name of each
29552 predefined macro, except for macros that start with @samp{__} or with
29553 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29554 C@.
29555
29556 @item %I
29557 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29558 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29559 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29560 and @option{-imultilib} as necessary.
29561
29562 @item %s
29563 Current argument is the name of a library or startup file of some sort.
29564 Search for that file in a standard list of directories and substitute
29565 the full name found. The current working directory is included in the
29566 list of directories scanned.
29567
29568 @item %T
29569 Current argument is the name of a linker script. Search for that file
29570 in the current list of directories to scan for libraries. If the file
29571 is located insert a @option{--script} option into the command line
29572 followed by the full path name found. If the file is not found then
29573 generate an error message. Note: the current working directory is not
29574 searched.
29575
29576 @item %e@var{str}
29577 Print @var{str} as an error message. @var{str} is terminated by a newline.
29578 Use this when inconsistent options are detected.
29579
29580 @item %(@var{name})
29581 Substitute the contents of spec string @var{name} at this point.
29582
29583 @item %x@{@var{option}@}
29584 Accumulate an option for @samp{%X}.
29585
29586 @item %X
29587 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29588 spec string.
29589
29590 @item %Y
29591 Output the accumulated assembler options specified by @option{-Wa}.
29592
29593 @item %Z
29594 Output the accumulated preprocessor options specified by @option{-Wp}.
29595
29596 @item %a
29597 Process the @code{asm} spec. This is used to compute the
29598 switches to be passed to the assembler.
29599
29600 @item %A
29601 Process the @code{asm_final} spec. This is a spec string for
29602 passing switches to an assembler post-processor, if such a program is
29603 needed.
29604
29605 @item %l
29606 Process the @code{link} spec. This is the spec for computing the
29607 command line passed to the linker. Typically it makes use of the
29608 @samp{%L %G %S %D and %E} sequences.
29609
29610 @item %D
29611 Dump out a @option{-L} option for each directory that GCC believes might
29612 contain startup files. If the target supports multilibs then the
29613 current multilib directory is prepended to each of these paths.
29614
29615 @item %L
29616 Process the @code{lib} spec. This is a spec string for deciding which
29617 libraries are included on the command line to the linker.
29618
29619 @item %G
29620 Process the @code{libgcc} spec. This is a spec string for deciding
29621 which GCC support library is included on the command line to the linker.
29622
29623 @item %S
29624 Process the @code{startfile} spec. This is a spec for deciding which
29625 object files are the first ones passed to the linker. Typically
29626 this might be a file named @file{crt0.o}.
29627
29628 @item %E
29629 Process the @code{endfile} spec. This is a spec string that specifies
29630 the last object files that are passed to the linker.
29631
29632 @item %C
29633 Process the @code{cpp} spec. This is used to construct the arguments
29634 to be passed to the C preprocessor.
29635
29636 @item %1
29637 Process the @code{cc1} spec. This is used to construct the options to be
29638 passed to the actual C compiler (@command{cc1}).
29639
29640 @item %2
29641 Process the @code{cc1plus} spec. This is used to construct the options to be
29642 passed to the actual C++ compiler (@command{cc1plus}).
29643
29644 @item %*
29645 Substitute the variable part of a matched option. See below.
29646 Note that each comma in the substituted string is replaced by
29647 a single space.
29648
29649 @item %<S
29650 Remove all occurrences of @code{-S} from the command line. Note---this
29651 command is position dependent. @samp{%} commands in the spec string
29652 before this one see @code{-S}, @samp{%} commands in the spec string
29653 after this one do not.
29654
29655 @item %:@var{function}(@var{args})
29656 Call the named function @var{function}, passing it @var{args}.
29657 @var{args} is first processed as a nested spec string, then split
29658 into an argument vector in the usual fashion. The function returns
29659 a string which is processed as if it had appeared literally as part
29660 of the current spec.
29661
29662 The following built-in spec functions are provided:
29663
29664 @table @code
29665 @item @code{getenv}
29666 The @code{getenv} spec function takes two arguments: an environment
29667 variable name and a string. If the environment variable is not
29668 defined, a fatal error is issued. Otherwise, the return value is the
29669 value of the environment variable concatenated with the string. For
29670 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29671
29672 @smallexample
29673 %:getenv(TOPDIR /include)
29674 @end smallexample
29675
29676 expands to @file{/path/to/top/include}.
29677
29678 @item @code{if-exists}
29679 The @code{if-exists} spec function takes one argument, an absolute
29680 pathname to a file. If the file exists, @code{if-exists} returns the
29681 pathname. Here is a small example of its usage:
29682
29683 @smallexample
29684 *startfile:
29685 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29686 @end smallexample
29687
29688 @item @code{if-exists-else}
29689 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29690 spec function, except that it takes two arguments. The first argument is
29691 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29692 returns the pathname. If it does not exist, it returns the second argument.
29693 This way, @code{if-exists-else} can be used to select one file or another,
29694 based on the existence of the first. Here is a small example of its usage:
29695
29696 @smallexample
29697 *startfile:
29698 crt0%O%s %:if-exists(crti%O%s) \
29699 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29700 @end smallexample
29701
29702 @item @code{replace-outfile}
29703 The @code{replace-outfile} spec function takes two arguments. It looks for the
29704 first argument in the outfiles array and replaces it with the second argument. Here
29705 is a small example of its usage:
29706
29707 @smallexample
29708 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29709 @end smallexample
29710
29711 @item @code{remove-outfile}
29712 The @code{remove-outfile} spec function takes one argument. It looks for the
29713 first argument in the outfiles array and removes it. Here is a small example
29714 its usage:
29715
29716 @smallexample
29717 %:remove-outfile(-lm)
29718 @end smallexample
29719
29720 @item @code{pass-through-libs}
29721 The @code{pass-through-libs} spec function takes any number of arguments. It
29722 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29723 assumes are the names of linker input library archive files) and returns a
29724 result containing all the found arguments each prepended by
29725 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29726 intended to be passed to the LTO linker plugin.
29727
29728 @smallexample
29729 %:pass-through-libs(%G %L %G)
29730 @end smallexample
29731
29732 @item @code{print-asm-header}
29733 The @code{print-asm-header} function takes no arguments and simply
29734 prints a banner like:
29735
29736 @smallexample
29737 Assembler options
29738 =================
29739
29740 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29741 @end smallexample
29742
29743 It is used to separate compiler options from assembler options
29744 in the @option{--target-help} output.
29745 @end table
29746
29747 @item %@{S@}
29748 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29749 If that switch is not specified, this substitutes nothing. Note that
29750 the leading dash is omitted when specifying this option, and it is
29751 automatically inserted if the substitution is performed. Thus the spec
29752 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29753 and outputs the command-line option @option{-foo}.
29754
29755 @item %W@{S@}
29756 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29757 deleted on failure.
29758
29759 @item %@{S*@}
29760 Substitutes all the switches specified to GCC whose names start
29761 with @code{-S}, but which also take an argument. This is used for
29762 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29763 GCC considers @option{-o foo} as being
29764 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29765 text, including the space. Thus two arguments are generated.
29766
29767 @item %@{S*&T*@}
29768 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29769 (the order of @code{S} and @code{T} in the spec is not significant).
29770 There can be any number of ampersand-separated variables; for each the
29771 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29772
29773 @item %@{S:X@}
29774 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29775
29776 @item %@{!S:X@}
29777 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29778
29779 @item %@{S*:X@}
29780 Substitutes @code{X} if one or more switches whose names start with
29781 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29782 once, no matter how many such switches appeared. However, if @code{%*}
29783 appears somewhere in @code{X}, then @code{X} is substituted once
29784 for each matching switch, with the @code{%*} replaced by the part of
29785 that switch matching the @code{*}.
29786
29787 If @code{%*} appears as the last part of a spec sequence then a space
29788 is added after the end of the last substitution. If there is more
29789 text in the sequence, however, then a space is not generated. This
29790 allows the @code{%*} substitution to be used as part of a larger
29791 string. For example, a spec string like this:
29792
29793 @smallexample
29794 %@{mcu=*:--script=%*/memory.ld@}
29795 @end smallexample
29796
29797 @noindent
29798 when matching an option like @option{-mcu=newchip} produces:
29799
29800 @smallexample
29801 --script=newchip/memory.ld
29802 @end smallexample
29803
29804 @item %@{.S:X@}
29805 Substitutes @code{X}, if processing a file with suffix @code{S}.
29806
29807 @item %@{!.S:X@}
29808 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29809
29810 @item %@{,S:X@}
29811 Substitutes @code{X}, if processing a file for language @code{S}.
29812
29813 @item %@{!,S:X@}
29814 Substitutes @code{X}, if not processing a file for language @code{S}.
29815
29816 @item %@{S|P:X@}
29817 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29818 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29819 @code{*} sequences as well, although they have a stronger binding than
29820 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29821 alternatives must be starred, and only the first matching alternative
29822 is substituted.
29823
29824 For example, a spec string like this:
29825
29826 @smallexample
29827 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29828 @end smallexample
29829
29830 @noindent
29831 outputs the following command-line options from the following input
29832 command-line options:
29833
29834 @smallexample
29835 fred.c -foo -baz
29836 jim.d -bar -boggle
29837 -d fred.c -foo -baz -boggle
29838 -d jim.d -bar -baz -boggle
29839 @end smallexample
29840
29841 @item %@{S:X; T:Y; :D@}
29842
29843 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29844 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29845 be as many clauses as you need. This may be combined with @code{.},
29846 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29847
29848
29849 @end table
29850
29851 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29852 or similar construct can use a backslash to ignore the special meaning
29853 of the character following it, thus allowing literal matching of a
29854 character that is otherwise specially treated. For example,
29855 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29856 @option{-std=iso9899:1999} option is given.
29857
29858 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29859 construct may contain other nested @samp{%} constructs or spaces, or
29860 even newlines. They are processed as usual, as described above.
29861 Trailing white space in @code{X} is ignored. White space may also
29862 appear anywhere on the left side of the colon in these constructs,
29863 except between @code{.} or @code{*} and the corresponding word.
29864
29865 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29866 handled specifically in these constructs. If another value of
29867 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29868 @option{-W} switch is found later in the command line, the earlier
29869 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29870 just one letter, which passes all matching options.
29871
29872 The character @samp{|} at the beginning of the predicate text is used to
29873 indicate that a command should be piped to the following command, but
29874 only if @option{-pipe} is specified.
29875
29876 It is built into GCC which switches take arguments and which do not.
29877 (You might think it would be useful to generalize this to allow each
29878 compiler's spec to say which switches take arguments. But this cannot
29879 be done in a consistent fashion. GCC cannot even decide which input
29880 files have been specified without knowing which switches take arguments,
29881 and it must know which input files to compile in order to tell which
29882 compilers to run).
29883
29884 GCC also knows implicitly that arguments starting in @option{-l} are to be
29885 treated as compiler output files, and passed to the linker in their
29886 proper position among the other output files.
29887
29888 @node Environment Variables
29889 @section Environment Variables Affecting GCC
29890 @cindex environment variables
29891
29892 @c man begin ENVIRONMENT
29893 This section describes several environment variables that affect how GCC
29894 operates. Some of them work by specifying directories or prefixes to use
29895 when searching for various kinds of files. Some are used to specify other
29896 aspects of the compilation environment.
29897
29898 Note that you can also specify places to search using options such as
29899 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29900 take precedence over places specified using environment variables, which
29901 in turn take precedence over those specified by the configuration of GCC@.
29902 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29903 GNU Compiler Collection (GCC) Internals}.
29904
29905 @table @env
29906 @item LANG
29907 @itemx LC_CTYPE
29908 @c @itemx LC_COLLATE
29909 @itemx LC_MESSAGES
29910 @c @itemx LC_MONETARY
29911 @c @itemx LC_NUMERIC
29912 @c @itemx LC_TIME
29913 @itemx LC_ALL
29914 @findex LANG
29915 @findex LC_CTYPE
29916 @c @findex LC_COLLATE
29917 @findex LC_MESSAGES
29918 @c @findex LC_MONETARY
29919 @c @findex LC_NUMERIC
29920 @c @findex LC_TIME
29921 @findex LC_ALL
29922 @cindex locale
29923 These environment variables control the way that GCC uses
29924 localization information which allows GCC to work with different
29925 national conventions. GCC inspects the locale categories
29926 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29927 so. These locale categories can be set to any value supported by your
29928 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29929 Kingdom encoded in UTF-8.
29930
29931 The @env{LC_CTYPE} environment variable specifies character
29932 classification. GCC uses it to determine the character boundaries in
29933 a string; this is needed for some multibyte encodings that contain quote
29934 and escape characters that are otherwise interpreted as a string
29935 end or escape.
29936
29937 The @env{LC_MESSAGES} environment variable specifies the language to
29938 use in diagnostic messages.
29939
29940 If the @env{LC_ALL} environment variable is set, it overrides the value
29941 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29942 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29943 environment variable. If none of these variables are set, GCC
29944 defaults to traditional C English behavior.
29945
29946 @item TMPDIR
29947 @findex TMPDIR
29948 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29949 files. GCC uses temporary files to hold the output of one stage of
29950 compilation which is to be used as input to the next stage: for example,
29951 the output of the preprocessor, which is the input to the compiler
29952 proper.
29953
29954 @item GCC_COMPARE_DEBUG
29955 @findex GCC_COMPARE_DEBUG
29956 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29957 @option{-fcompare-debug} to the compiler driver. See the documentation
29958 of this option for more details.
29959
29960 @item GCC_EXEC_PREFIX
29961 @findex GCC_EXEC_PREFIX
29962 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29963 names of the subprograms executed by the compiler. No slash is added
29964 when this prefix is combined with the name of a subprogram, but you can
29965 specify a prefix that ends with a slash if you wish.
29966
29967 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29968 an appropriate prefix to use based on the pathname it is invoked with.
29969
29970 If GCC cannot find the subprogram using the specified prefix, it
29971 tries looking in the usual places for the subprogram.
29972
29973 The default value of @env{GCC_EXEC_PREFIX} is
29974 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29975 the installed compiler. In many cases @var{prefix} is the value
29976 of @code{prefix} when you ran the @file{configure} script.
29977
29978 Other prefixes specified with @option{-B} take precedence over this prefix.
29979
29980 This prefix is also used for finding files such as @file{crt0.o} that are
29981 used for linking.
29982
29983 In addition, the prefix is used in an unusual way in finding the
29984 directories to search for header files. For each of the standard
29985 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29986 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29987 replacing that beginning with the specified prefix to produce an
29988 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29989 @file{foo/bar} just before it searches the standard directory
29990 @file{/usr/local/lib/bar}.
29991 If a standard directory begins with the configured
29992 @var{prefix} then the value of @var{prefix} is replaced by
29993 @env{GCC_EXEC_PREFIX} when looking for header files.
29994
29995 @item COMPILER_PATH
29996 @findex COMPILER_PATH
29997 The value of @env{COMPILER_PATH} is a colon-separated list of
29998 directories, much like @env{PATH}. GCC tries the directories thus
29999 specified when searching for subprograms, if it cannot find the
30000 subprograms using @env{GCC_EXEC_PREFIX}.
30001
30002 @item LIBRARY_PATH
30003 @findex LIBRARY_PATH
30004 The value of @env{LIBRARY_PATH} is a colon-separated list of
30005 directories, much like @env{PATH}. When configured as a native compiler,
30006 GCC tries the directories thus specified when searching for special
30007 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
30008 using GCC also uses these directories when searching for ordinary
30009 libraries for the @option{-l} option (but directories specified with
30010 @option{-L} come first).
30011
30012 @item LANG
30013 @findex LANG
30014 @cindex locale definition
30015 This variable is used to pass locale information to the compiler. One way in
30016 which this information is used is to determine the character set to be used
30017 when character literals, string literals and comments are parsed in C and C++.
30018 When the compiler is configured to allow multibyte characters,
30019 the following values for @env{LANG} are recognized:
30020
30021 @table @samp
30022 @item C-JIS
30023 Recognize JIS characters.
30024 @item C-SJIS
30025 Recognize SJIS characters.
30026 @item C-EUCJP
30027 Recognize EUCJP characters.
30028 @end table
30029
30030 If @env{LANG} is not defined, or if it has some other value, then the
30031 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
30032 recognize and translate multibyte characters.
30033 @end table
30034
30035 @noindent
30036 Some additional environment variables affect the behavior of the
30037 preprocessor.
30038
30039 @include cppenv.texi
30040
30041 @c man end
30042
30043 @node Precompiled Headers
30044 @section Using Precompiled Headers
30045 @cindex precompiled headers
30046 @cindex speed of compilation
30047
30048 Often large projects have many header files that are included in every
30049 source file. The time the compiler takes to process these header files
30050 over and over again can account for nearly all of the time required to
30051 build the project. To make builds faster, GCC allows you to
30052 @dfn{precompile} a header file.
30053
30054 To create a precompiled header file, simply compile it as you would any
30055 other file, if necessary using the @option{-x} option to make the driver
30056 treat it as a C or C++ header file. You may want to use a
30057 tool like @command{make} to keep the precompiled header up-to-date when
30058 the headers it contains change.
30059
30060 A precompiled header file is searched for when @code{#include} is
30061 seen in the compilation. As it searches for the included file
30062 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
30063 compiler looks for a precompiled header in each directory just before it
30064 looks for the include file in that directory. The name searched for is
30065 the name specified in the @code{#include} with @samp{.gch} appended. If
30066 the precompiled header file cannot be used, it is ignored.
30067
30068 For instance, if you have @code{#include "all.h"}, and you have
30069 @file{all.h.gch} in the same directory as @file{all.h}, then the
30070 precompiled header file is used if possible, and the original
30071 header is used otherwise.
30072
30073 Alternatively, you might decide to put the precompiled header file in a
30074 directory and use @option{-I} to ensure that directory is searched
30075 before (or instead of) the directory containing the original header.
30076 Then, if you want to check that the precompiled header file is always
30077 used, you can put a file of the same name as the original header in this
30078 directory containing an @code{#error} command.
30079
30080 This also works with @option{-include}. So yet another way to use
30081 precompiled headers, good for projects not designed with precompiled
30082 header files in mind, is to simply take most of the header files used by
30083 a project, include them from another header file, precompile that header
30084 file, and @option{-include} the precompiled header. If the header files
30085 have guards against multiple inclusion, they are skipped because
30086 they've already been included (in the precompiled header).
30087
30088 If you need to precompile the same header file for different
30089 languages, targets, or compiler options, you can instead make a
30090 @emph{directory} named like @file{all.h.gch}, and put each precompiled
30091 header in the directory, perhaps using @option{-o}. It doesn't matter
30092 what you call the files in the directory; every precompiled header in
30093 the directory is considered. The first precompiled header
30094 encountered in the directory that is valid for this compilation is
30095 used; they're searched in no particular order.
30096
30097 There are many other possibilities, limited only by your imagination,
30098 good sense, and the constraints of your build system.
30099
30100 A precompiled header file can be used only when these conditions apply:
30101
30102 @itemize
30103 @item
30104 Only one precompiled header can be used in a particular compilation.
30105
30106 @item
30107 A precompiled header cannot be used once the first C token is seen. You
30108 can have preprocessor directives before a precompiled header; you cannot
30109 include a precompiled header from inside another header.
30110
30111 @item
30112 The precompiled header file must be produced for the same language as
30113 the current compilation. You cannot use a C precompiled header for a C++
30114 compilation.
30115
30116 @item
30117 The precompiled header file must have been produced by the same compiler
30118 binary as the current compilation is using.
30119
30120 @item
30121 Any macros defined before the precompiled header is included must
30122 either be defined in the same way as when the precompiled header was
30123 generated, or must not affect the precompiled header, which usually
30124 means that they don't appear in the precompiled header at all.
30125
30126 The @option{-D} option is one way to define a macro before a
30127 precompiled header is included; using a @code{#define} can also do it.
30128 There are also some options that define macros implicitly, like
30129 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30130 defined this way.
30131
30132 @item If debugging information is output when using the precompiled
30133 header, using @option{-g} or similar, the same kind of debugging information
30134 must have been output when building the precompiled header. However,
30135 a precompiled header built using @option{-g} can be used in a compilation
30136 when no debugging information is being output.
30137
30138 @item The same @option{-m} options must generally be used when building
30139 and using the precompiled header. @xref{Submodel Options},
30140 for any cases where this rule is relaxed.
30141
30142 @item Each of the following options must be the same when building and using
30143 the precompiled header:
30144
30145 @gccoptlist{-fexceptions}
30146
30147 @item
30148 Some other command-line options starting with @option{-f},
30149 @option{-p}, or @option{-O} must be defined in the same way as when
30150 the precompiled header was generated. At present, it's not clear
30151 which options are safe to change and which are not; the safest choice
30152 is to use exactly the same options when generating and using the
30153 precompiled header. The following are known to be safe:
30154
30155 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30156 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30157 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30158 -pedantic-errors}
30159
30160 @end itemize
30161
30162 For all of these except the last, the compiler automatically
30163 ignores the precompiled header if the conditions aren't met. If you
30164 find an option combination that doesn't work and doesn't cause the
30165 precompiled header to be ignored, please consider filing a bug report,
30166 see @ref{Bugs}.
30167
30168 If you do use differing options when generating and using the
30169 precompiled header, the actual behavior is a mixture of the
30170 behavior for the options. For instance, if you use @option{-g} to
30171 generate the precompiled header but not when using it, you may or may
30172 not get debugging information for routines in the precompiled header.