]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
PR c++/91338 - Implement P1161R3: Deprecate a[b,c].
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2019 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
9
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2019 Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below). A copy of the license is
19 included in the gfdl(7) man page.
20
21 (a) The FSF's Front-Cover Text is:
22
23 A GNU Manual
24
25 (b) The FSF's Back-Cover Text is:
26
27 You have freedom to copy and modify this GNU Manual, like GNU
28 software. Copies published by the Free Software Foundation raise
29 funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
42
43 Only the most useful options are listed here; see below for the
44 remainder. @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), dbx(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
62
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
68
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking. The ``overall options'' allow you to stop this
72 process at an intermediate stage. For example, the @option{-c} option
73 says not to run the linker. Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
76
77 Other options are passed on to one or more stages of processing. Some options
78 control the preprocessor and others the compiler itself. Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
81
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly. If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
88
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++}
98 instead. @xref{Invoking G++,,Compiling C++ Programs},
99 for information about the differences in behavior between @command{gcc}
100 and @code{g++} when compiling C++ programs.
101
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands. Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
108
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments. For the most part, the order
112 you use doesn't matter. Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified. Also,
115 the placement of the @option{-l} option is significant.
116
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}. This manual documents
122 only one of these two forms, whichever one is not the default.
123
124 Some options take one or more arguments typically separated either
125 by a space or by the equals sign (@samp{=}) from the option name.
126 Unless documented otherwise, an argument can be either numeric or
127 a string. Numeric arguments must typically be small unsigned decimal
128 or hexadecimal integers. Hexadecimal arguments must begin with
129 the @samp{0x} prefix. Arguments to options that specify a size
130 threshold of some sort may be arbitrarily large decimal or hexadecimal
131 integers followed by a byte size suffix designating a multiple of bytes
132 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
133 @code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and
134 @code{GiB} for gigabyte and gigibyte, and so on. Such arguments are
135 designated by @var{byte-size} in the following text. Refer to the NIST,
136 IEC, and other relevant national and international standards for the full
137 listing and explanation of the binary and decimal byte size prefixes.
138
139 @c man end
140
141 @xref{Option Index}, for an index to GCC's options.
142
143 @menu
144 * Option Summary:: Brief list of all options, without explanations.
145 * Overall Options:: Controlling the kind of output:
146 an executable, object files, assembler files,
147 or preprocessed source.
148 * Invoking G++:: Compiling C++ programs.
149 * C Dialect Options:: Controlling the variant of C language compiled.
150 * C++ Dialect Options:: Variations on C++.
151 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152 and Objective-C++.
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
154 be formatted.
155 * Warning Options:: How picky should the compiler be?
156 * Debugging Options:: Producing debuggable code.
157 * Optimize Options:: How much optimization?
158 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
159 * Preprocessor Options:: Controlling header files and macro definitions.
160 Also, getting dependency information for Make.
161 * Assembler Options:: Passing options to the assembler.
162 * Link Options:: Specifying libraries and so on.
163 * Directory Options:: Where to find header files and libraries.
164 Where to find the compiler executable files.
165 * Code Gen Options:: Specifying conventions for function calls, data layout
166 and register usage.
167 * Developer Options:: Printing GCC configuration info, statistics, and
168 debugging dumps.
169 * Submodel Options:: Target-specific options, such as compiling for a
170 specific processor variant.
171 * Spec Files:: How to pass switches to sub-processes.
172 * Environment Variables:: Env vars that affect GCC.
173 * Precompiled Headers:: Compiling a header once, and using it many times.
174 @end menu
175
176 @c man begin OPTIONS
177
178 @node Option Summary
179 @section Option Summary
180
181 Here is a summary of all the options, grouped by type. Explanations are
182 in the following sections.
183
184 @table @emph
185 @item Overall Options
186 @xref{Overall Options,,Options Controlling the Kind of Output}.
187 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
188 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
189 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
190 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
191 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
192 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
193
194 @item C Language Options
195 @xref{C Dialect Options,,Options Controlling C Dialect}.
196 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
197 -fpermitted-flt-eval-methods=@var{standard} @gol
198 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
199 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
200 -fhosted -ffreestanding @gol
201 -fopenacc -fopenacc-dim=@var{geom} @gol
202 -fopenmp -fopenmp-simd @gol
203 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
204 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
205 -fsigned-bitfields -fsigned-char @gol
206 -funsigned-bitfields -funsigned-char}
207
208 @item C++ Language Options
209 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
210 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
211 -faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol
212 -fconstexpr-depth=@var{n} -fconstexpr-cache-depth=@var{n} @gol
213 -fconstexpr-loop-limit=@var{n} -fconstexpr-ops-limit=@var{n} @gol
214 -fno-elide-constructors @gol
215 -fno-enforce-eh-specs @gol
216 -fno-gnu-keywords @gol
217 -fno-implicit-templates @gol
218 -fno-implicit-inline-templates @gol
219 -fno-implement-inlines -fms-extensions @gol
220 -fnew-inheriting-ctors @gol
221 -fnew-ttp-matching @gol
222 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
223 -fno-optional-diags -fpermissive @gol
224 -fno-pretty-templates @gol
225 -frepo -fno-rtti -fsized-deallocation @gol
226 -ftemplate-backtrace-limit=@var{n} @gol
227 -ftemplate-depth=@var{n} @gol
228 -fno-threadsafe-statics -fuse-cxa-atexit @gol
229 -fno-weak -nostdinc++ @gol
230 -fvisibility-inlines-hidden @gol
231 -fvisibility-ms-compat @gol
232 -fext-numeric-literals @gol
233 -Wabi=@var{n} -Wabi-tag -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}
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-format=@r{[}text@r{|}json@r{]} @gol
277 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
278 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
279 -fdiagnostics-minimum-margin-width=@var{width} @gol
280 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
281 -fdiagnostics-show-template-tree -fno-elide-type @gol
282 -fno-show-column}
283
284 @item Warning Options
285 @xref{Warning Options,,Options to Request or Suppress Warnings}.
286 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
287 -pedantic-errors @gol
288 -w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol
289 -Waggregate-return -Waligned-new @gol
290 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
291 -Walloca -Walloca-larger-than=@var{byte-size} @gol
292 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
293 -Wno-attributes -Wattribute-alias=@var{n} @gol
294 -Wbool-compare -Wbool-operation @gol
295 -Wno-builtin-declaration-mismatch @gol
296 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
297 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
298 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
299 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
300 -Wclobbered -Wcomment -Wconditionally-supported @gol
301 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
302 -Wdelete-incomplete @gol
303 -Wno-attribute-warning @gol
304 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
305 -Wdisabled-optimization @gol
306 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
307 -Wno-div-by-zero -Wdouble-promotion @gol
308 -Wduplicated-branches -Wduplicated-cond @gol
309 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
310 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
311 -Wfloat-equal -Wformat -Wformat=2 @gol
312 -Wno-format-contains-nul -Wno-format-extra-args @gol
313 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
314 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
315 -Wformat-y2k -Wframe-address @gol
316 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
317 -Wjump-misses-init @gol
318 -Whsa -Wif-not-aligned @gol
319 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
320 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
321 -Wimplicit-function-declaration -Wimplicit-int @gol
322 -Winaccessible-base @gol
323 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
324 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
325 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
326 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
327 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
328 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
329 -Wmissing-field-initializers -Wmissing-format-attribute @gol
330 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
331 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
332 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
333 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
334 -Woverride-init-side-effects -Woverlength-strings @gol
335 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
336 -Wparentheses -Wno-pedantic-ms-format @gol
337 -Wplacement-new -Wplacement-new=@var{n} @gol
338 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
339 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
340 -Wrestrict -Wno-return-local-addr @gol
341 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
342 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
343 -Wshift-overflow -Wshift-overflow=@var{n} @gol
344 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
345 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
346 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
347 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
348 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
349 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
350 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
351 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
352 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
353 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
354 -Wswitch-unreachable -Wsync-nand @gol
355 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
356 -Wtype-limits -Wundef @gol
357 -Wuninitialized -Wunknown-pragmas @gol
358 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
359 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
360 -Wunused-parameter -Wno-unused-result @gol
361 -Wunused-value -Wunused-variable @gol
362 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
363 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
364 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
365 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
366 -Wwrite-strings @gol
367 -Wzero-as-null-pointer-constant}
368
369 @item C and Objective-C-only Warning Options
370 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
371 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
372 -Wold-style-declaration -Wold-style-definition @gol
373 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
374 -Wdeclaration-after-statement -Wpointer-sign}
375
376 @item Debugging Options
377 @xref{Debugging Options,,Options for Debugging Your Program}.
378 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
379 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
380 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
381 -gas-loc-support -gno-as-loc-support @gol
382 -gas-locview-support -gno-as-locview-support @gol
383 -gcolumn-info -gno-column-info @gol
384 -gstatement-frontiers -gno-statement-frontiers @gol
385 -gvariable-location-views -gno-variable-location-views @gol
386 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
387 -ginline-points -gno-inline-points @gol
388 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
389 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
390 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
391 -fno-eliminate-unused-debug-types @gol
392 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
393 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
394 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
395 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
396 -fvar-tracking -fvar-tracking-assignments}
397
398 @item Optimization Options
399 @xref{Optimize Options,,Options that Control Optimization}.
400 @gccoptlist{-faggressive-loop-optimizations @gol
401 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
402 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
403 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
404 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
405 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
406 -fauto-inc-dec -fbranch-probabilities @gol
407 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
408 -fbtr-bb-exclusive -fcaller-saves @gol
409 -fcombine-stack-adjustments -fconserve-stack @gol
410 -fcompare-elim -fcprop-registers -fcrossjumping @gol
411 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
412 -fcx-limited-range @gol
413 -fdata-sections -fdce -fdelayed-branch @gol
414 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
415 -fdevirtualize-at-ltrans -fdse @gol
416 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
417 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
418 -ffinite-loops @gol
419 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
420 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
421 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
422 -fif-conversion2 -findirect-inlining @gol
423 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
424 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
425 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
426 -fipa-reference -fipa-reference-addressable @gol
427 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
428 -flive-patching=@var{level} @gol
429 -fira-region=@var{region} -fira-hoist-pressure @gol
430 -fira-loop-pressure -fno-ira-share-save-slots @gol
431 -fno-ira-share-spill-slots @gol
432 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
433 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
434 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
435 -floop-block -floop-interchange -floop-strip-mine @gol
436 -floop-unroll-and-jam -floop-nest-optimize @gol
437 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
438 -flto-partition=@var{alg} -fmerge-all-constants @gol
439 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
440 -fmove-loop-invariants -fno-branch-count-reg @gol
441 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
442 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
443 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
444 -fno-sched-spec -fno-signed-zeros @gol
445 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
446 -fomit-frame-pointer -foptimize-sibling-calls @gol
447 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
448 -fprefetch-loop-arrays @gol
449 -fprofile-correction @gol
450 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
451 -fprofile-reorder-functions @gol
452 -freciprocal-math -free -frename-registers -freorder-blocks @gol
453 -freorder-blocks-algorithm=@var{algorithm} @gol
454 -freorder-blocks-and-partition -freorder-functions @gol
455 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
456 -frounding-math -fsave-optimization-record @gol
457 -fsched2-use-superblocks -fsched-pressure @gol
458 -fsched-spec-load -fsched-spec-load-dangerous @gol
459 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
460 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
461 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
462 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
463 -fschedule-fusion @gol
464 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
465 -fselective-scheduling -fselective-scheduling2 @gol
466 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
467 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
468 -fsignaling-nans @gol
469 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
470 -fsplit-paths @gol
471 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
472 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
473 -fthread-jumps -ftracer -ftree-bit-ccp @gol
474 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
475 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
476 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
477 -ftree-loop-if-convert -ftree-loop-im @gol
478 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
479 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
480 -ftree-loop-vectorize @gol
481 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
482 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
483 -ftree-switch-conversion -ftree-tail-merge @gol
484 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
485 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
486 -funsafe-math-optimizations -funswitch-loops @gol
487 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
488 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
489 --param @var{name}=@var{value}
490 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
491
492 @item Program Instrumentation Options
493 @xref{Instrumentation Options,,Program Instrumentation Options}.
494 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
495 -fprofile-abs-path @gol
496 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
497 -fprofile-note=@var{path} -fprofile-update=@var{method} @gol
498 -fprofile-filter-files=@var{regex} -fprofile-exclude-files=@var{regex} @gol
499 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
500 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
501 -fsanitize-undefined-trap-on-error -fbounds-check @gol
502 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
503 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
504 -fstack-protector-explicit -fstack-check @gol
505 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
506 -fno-stack-limit -fsplit-stack @gol
507 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
508 -fvtv-counts -fvtv-debug @gol
509 -finstrument-functions @gol
510 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
511 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
512
513 @item Preprocessor Options
514 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
515 @gccoptlist{-A@var{question}=@var{answer} @gol
516 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
517 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
518 -dD -dI -dM -dN -dU @gol
519 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
520 -fexec-charset=@var{charset} -fextended-identifiers @gol
521 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
522 -fmax-include-depth=@var{depth} @gol
523 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
524 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
525 -fwide-exec-charset=@var{charset} -fworking-directory @gol
526 -H -imacros @var{file} -include @var{file} @gol
527 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
528 -no-integrated-cpp -P -pthread -remap @gol
529 -traditional -traditional-cpp -trigraphs @gol
530 -U@var{macro} -undef @gol
531 -Wp,@var{option} -Xpreprocessor @var{option}}
532
533 @item Assembler Options
534 @xref{Assembler Options,,Passing Options to the Assembler}.
535 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
536
537 @item Linker Options
538 @xref{Link Options,,Options for Linking}.
539 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
540 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
541 -e @var{entry} --entry=@var{entry} @gol
542 -pie -pthread -r -rdynamic @gol
543 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
544 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
545 -shared -shared-libgcc -symbolic @gol
546 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
547 -u @var{symbol} -z @var{keyword}}
548
549 @item Directory Options
550 @xref{Directory Options,,Options for Directory Search}.
551 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
552 -idirafter @var{dir} @gol
553 -imacros @var{file} -imultilib @var{dir} @gol
554 -iplugindir=@var{dir} -iprefix @var{file} @gol
555 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
556 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
557 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
558 -nostdinc -nostdinc++ --sysroot=@var{dir}}
559
560 @item Code Generation Options
561 @xref{Code Gen Options,,Options for Code Generation Conventions}.
562 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
563 -ffixed-@var{reg} -fexceptions @gol
564 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
565 -fasynchronous-unwind-tables @gol
566 -fno-gnu-unique @gol
567 -finhibit-size-directive -fno-common -fno-ident @gol
568 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
569 -fno-jump-tables @gol
570 -frecord-gcc-switches @gol
571 -freg-struct-return -fshort-enums -fshort-wchar @gol
572 -fverbose-asm -fpack-struct[=@var{n}] @gol
573 -fleading-underscore -ftls-model=@var{model} @gol
574 -fstack-reuse=@var{reuse_level} @gol
575 -ftrampolines -ftrapv -fwrapv @gol
576 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
577 -fstrict-volatile-bitfields -fsync-libcalls}
578
579 @item Developer Options
580 @xref{Developer Options,,GCC Developer Options}.
581 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
582 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
583 -fdbg-cnt=@var{counter-value-list} @gol
584 -fdisable-ipa-@var{pass_name} @gol
585 -fdisable-rtl-@var{pass_name} @gol
586 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
587 -fdisable-tree-@var{pass_name} @gol
588 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
589 -fdump-debug -fdump-earlydebug @gol
590 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
591 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
592 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
593 -fdump-lang-all @gol
594 -fdump-lang-@var{switch} @gol
595 -fdump-lang-@var{switch}-@var{options} @gol
596 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
597 -fdump-passes @gol
598 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
599 -fdump-statistics @gol
600 -fdump-tree-all @gol
601 -fdump-tree-@var{switch} @gol
602 -fdump-tree-@var{switch}-@var{options} @gol
603 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
604 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
605 -fenable-@var{kind}-@var{pass} @gol
606 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
607 -fira-verbose=@var{n} @gol
608 -flto-report -flto-report-wpa -fmem-report-wpa @gol
609 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
610 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
611 -fprofile-report @gol
612 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
613 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
614 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
615 -fvar-tracking-assignments-toggle -gtoggle @gol
616 -print-file-name=@var{library} -print-libgcc-file-name @gol
617 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
618 -print-prog-name=@var{program} -print-search-dirs -Q @gol
619 -print-sysroot -print-sysroot-headers-suffix @gol
620 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
621
622 @item Machine-Dependent Options
623 @xref{Submodel Options,,Machine-Dependent Options}.
624 @c This list is ordered alphanumerically by subsection name.
625 @c Try and put the significant identifier (CPU or system) first,
626 @c so users have a clue at guessing where the ones they want will be.
627
628 @emph{AArch64 Options}
629 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
630 -mgeneral-regs-only @gol
631 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
632 -mstrict-align -mno-strict-align @gol
633 -momit-leaf-frame-pointer @gol
634 -mtls-dialect=desc -mtls-dialect=traditional @gol
635 -mtls-size=@var{size} @gol
636 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
637 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
638 -mpc-relative-literal-loads @gol
639 -msign-return-address=@var{scope} @gol
640 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
641 +@var{b-key}]|@var{bti} @gol
642 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
643 -moverride=@var{string} -mverbose-cost-dump @gol
644 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
645 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation }
646
647 @emph{Adapteva Epiphany Options}
648 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
649 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
650 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
651 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
652 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
653 -msplit-vecmove-early -m1reg-@var{reg}}
654
655 @emph{AMD GCN Options}
656 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
657
658 @emph{ARC Options}
659 @gccoptlist{-mbarrel-shifter -mjli-always @gol
660 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
661 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
662 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
663 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
664 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
665 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
666 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
667 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
668 -mvolatile-cache -mtp-regno=@var{regno} @gol
669 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
670 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
671 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
672 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
673 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
674 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
675 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
676 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
677
678 @emph{ARM Options}
679 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
680 -mabi=@var{name} @gol
681 -mapcs-stack-check -mno-apcs-stack-check @gol
682 -mapcs-reentrant -mno-apcs-reentrant @gol
683 -mgeneral-regs-only @gol
684 -msched-prolog -mno-sched-prolog @gol
685 -mlittle-endian -mbig-endian @gol
686 -mbe8 -mbe32 @gol
687 -mfloat-abi=@var{name} @gol
688 -mfp16-format=@var{name}
689 -mthumb-interwork -mno-thumb-interwork @gol
690 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
691 -mtune=@var{name} -mprint-tune-info @gol
692 -mstructure-size-boundary=@var{n} @gol
693 -mabort-on-noreturn @gol
694 -mlong-calls -mno-long-calls @gol
695 -msingle-pic-base -mno-single-pic-base @gol
696 -mpic-register=@var{reg} @gol
697 -mnop-fun-dllimport @gol
698 -mpoke-function-name @gol
699 -mthumb -marm -mflip-thumb @gol
700 -mtpcs-frame -mtpcs-leaf-frame @gol
701 -mcaller-super-interworking -mcallee-super-interworking @gol
702 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
703 -mword-relocations @gol
704 -mfix-cortex-m3-ldrd @gol
705 -munaligned-access @gol
706 -mneon-for-64bits @gol
707 -mslow-flash-data @gol
708 -masm-syntax-unified @gol
709 -mrestrict-it @gol
710 -mverbose-cost-dump @gol
711 -mpure-code @gol
712 -mcmse}
713
714 @emph{AVR Options}
715 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
716 -mbranch-cost=@var{cost} @gol
717 -mcall-prologues -mgas-isr-prologues -mint8 @gol
718 -mn_flash=@var{size} -mno-interrupts @gol
719 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
720 -mfract-convert-truncate @gol
721 -mshort-calls -nodevicelib @gol
722 -Waddr-space-convert -Wmisspelled-isr}
723
724 @emph{Blackfin Options}
725 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
726 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
727 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
728 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
729 -mno-id-shared-library -mshared-library-id=@var{n} @gol
730 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
731 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
732 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
733 -micplb}
734
735 @emph{C6X Options}
736 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
737 -msim -msdata=@var{sdata-type}}
738
739 @emph{CRIS Options}
740 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
741 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
742 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
743 -mstack-align -mdata-align -mconst-align @gol
744 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
745 -melf -maout -melinux -mlinux -sim -sim2 @gol
746 -mmul-bug-workaround -mno-mul-bug-workaround}
747
748 @emph{CR16 Options}
749 @gccoptlist{-mmac @gol
750 -mcr16cplus -mcr16c @gol
751 -msim -mint32 -mbit-ops
752 -mdata-model=@var{model}}
753
754 @emph{C-SKY Options}
755 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
756 -mbig-endian -EB -mlittle-endian -EL @gol
757 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
758 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
759 -mdsp -medsp -mvdsp @gol
760 -mdiv -msmart -mhigh-registers -manchor @gol
761 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
762 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
763
764 @emph{Darwin Options}
765 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
766 -arch_only -bind_at_load -bundle -bundle_loader @gol
767 -client_name -compatibility_version -current_version @gol
768 -dead_strip @gol
769 -dependency-file -dylib_file -dylinker_install_name @gol
770 -dynamic -dynamiclib -exported_symbols_list @gol
771 -filelist -flat_namespace -force_cpusubtype_ALL @gol
772 -force_flat_namespace -headerpad_max_install_names @gol
773 -iframework @gol
774 -image_base -init -install_name -keep_private_externs @gol
775 -multi_module -multiply_defined -multiply_defined_unused @gol
776 -noall_load -no_dead_strip_inits_and_terms @gol
777 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
778 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
779 -private_bundle -read_only_relocs -sectalign @gol
780 -sectobjectsymbols -whyload -seg1addr @gol
781 -sectcreate -sectobjectsymbols -sectorder @gol
782 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
783 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
784 -segprot -segs_read_only_addr -segs_read_write_addr @gol
785 -single_module -static -sub_library -sub_umbrella @gol
786 -twolevel_namespace -umbrella -undefined @gol
787 -unexported_symbols_list -weak_reference_mismatches @gol
788 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
789 -mkernel -mone-byte-bool}
790
791 @emph{DEC Alpha Options}
792 @gccoptlist{-mno-fp-regs -msoft-float @gol
793 -mieee -mieee-with-inexact -mieee-conformant @gol
794 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
795 -mtrap-precision=@var{mode} -mbuild-constants @gol
796 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
797 -mbwx -mmax -mfix -mcix @gol
798 -mfloat-vax -mfloat-ieee @gol
799 -mexplicit-relocs -msmall-data -mlarge-data @gol
800 -msmall-text -mlarge-text @gol
801 -mmemory-latency=@var{time}}
802
803 @emph{FR30 Options}
804 @gccoptlist{-msmall-model -mno-lsim}
805
806 @emph{FT32 Options}
807 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
808
809 @emph{FRV Options}
810 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
811 -mhard-float -msoft-float @gol
812 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
813 -mdouble -mno-double @gol
814 -mmedia -mno-media -mmuladd -mno-muladd @gol
815 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
816 -mlinked-fp -mlong-calls -malign-labels @gol
817 -mlibrary-pic -macc-4 -macc-8 @gol
818 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
819 -moptimize-membar -mno-optimize-membar @gol
820 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
821 -mvliw-branch -mno-vliw-branch @gol
822 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
823 -mno-nested-cond-exec -mtomcat-stats @gol
824 -mTLS -mtls @gol
825 -mcpu=@var{cpu}}
826
827 @emph{GNU/Linux Options}
828 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
829 -tno-android-cc -tno-android-ld}
830
831 @emph{H8/300 Options}
832 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
833
834 @emph{HPPA Options}
835 @gccoptlist{-march=@var{architecture-type} @gol
836 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
837 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
838 -mfixed-range=@var{register-range} @gol
839 -mjump-in-delay -mlinker-opt -mlong-calls @gol
840 -mlong-load-store -mno-disable-fpregs @gol
841 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
842 -mno-jump-in-delay -mno-long-load-store @gol
843 -mno-portable-runtime -mno-soft-float @gol
844 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
845 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
846 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
847 -munix=@var{unix-std} -nolibdld -static -threads}
848
849 @emph{IA-64 Options}
850 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
851 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
852 -mconstant-gp -mauto-pic -mfused-madd @gol
853 -minline-float-divide-min-latency @gol
854 -minline-float-divide-max-throughput @gol
855 -mno-inline-float-divide @gol
856 -minline-int-divide-min-latency @gol
857 -minline-int-divide-max-throughput @gol
858 -mno-inline-int-divide @gol
859 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
860 -mno-inline-sqrt @gol
861 -mdwarf2-asm -mearly-stop-bits @gol
862 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
863 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
864 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
865 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
866 -msched-spec-ldc -msched-spec-control-ldc @gol
867 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
868 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
869 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
870 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
871
872 @emph{LM32 Options}
873 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
874 -msign-extend-enabled -muser-enabled}
875
876 @emph{M32R/D Options}
877 @gccoptlist{-m32r2 -m32rx -m32r @gol
878 -mdebug @gol
879 -malign-loops -mno-align-loops @gol
880 -missue-rate=@var{number} @gol
881 -mbranch-cost=@var{number} @gol
882 -mmodel=@var{code-size-model-type} @gol
883 -msdata=@var{sdata-type} @gol
884 -mno-flush-func -mflush-func=@var{name} @gol
885 -mno-flush-trap -mflush-trap=@var{number} @gol
886 -G @var{num}}
887
888 @emph{M32C Options}
889 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
890
891 @emph{M680x0 Options}
892 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
893 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
894 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
895 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
896 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
897 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
898 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
899 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
900 -mxgot -mno-xgot -mlong-jump-table-offsets}
901
902 @emph{MCore Options}
903 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
904 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
905 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
906 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
907 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
908
909 @emph{MeP Options}
910 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
911 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
912 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
913 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
914 -mtiny=@var{n}}
915
916 @emph{MicroBlaze Options}
917 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
918 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
919 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
920 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
921 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
922 -mpic-data-is-text-relative}
923
924 @emph{MIPS Options}
925 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
926 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
927 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
928 -mips16 -mno-mips16 -mflip-mips16 @gol
929 -minterlink-compressed -mno-interlink-compressed @gol
930 -minterlink-mips16 -mno-interlink-mips16 @gol
931 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
932 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
933 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
934 -mno-float -msingle-float -mdouble-float @gol
935 -modd-spreg -mno-odd-spreg @gol
936 -mabs=@var{mode} -mnan=@var{encoding} @gol
937 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
938 -mmcu -mmno-mcu @gol
939 -meva -mno-eva @gol
940 -mvirt -mno-virt @gol
941 -mxpa -mno-xpa @gol
942 -mcrc -mno-crc @gol
943 -mginv -mno-ginv @gol
944 -mmicromips -mno-micromips @gol
945 -mmsa -mno-msa @gol
946 -mloongson-mmi -mno-loongson-mmi @gol
947 -mloongson-ext -mno-loongson-ext @gol
948 -mloongson-ext2 -mno-loongson-ext2 @gol
949 -mfpu=@var{fpu-type} @gol
950 -msmartmips -mno-smartmips @gol
951 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
952 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
953 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
954 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
955 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
956 -membedded-data -mno-embedded-data @gol
957 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
958 -mcode-readable=@var{setting} @gol
959 -msplit-addresses -mno-split-addresses @gol
960 -mexplicit-relocs -mno-explicit-relocs @gol
961 -mcheck-zero-division -mno-check-zero-division @gol
962 -mdivide-traps -mdivide-breaks @gol
963 -mload-store-pairs -mno-load-store-pairs @gol
964 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
965 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
966 -mfix-24k -mno-fix-24k @gol
967 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
968 -mfix-r5900 -mno-fix-r5900 @gol
969 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
970 -mfix-vr4120 -mno-fix-vr4120 @gol
971 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
972 -mflush-func=@var{func} -mno-flush-func @gol
973 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
974 -mcompact-branches=@var{policy} @gol
975 -mfp-exceptions -mno-fp-exceptions @gol
976 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
977 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
978 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
979 -mframe-header-opt -mno-frame-header-opt}
980
981 @emph{MMIX Options}
982 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
983 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
984 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
985 -mno-base-addresses -msingle-exit -mno-single-exit}
986
987 @emph{MN10300 Options}
988 @gccoptlist{-mmult-bug -mno-mult-bug @gol
989 -mno-am33 -mam33 -mam33-2 -mam34 @gol
990 -mtune=@var{cpu-type} @gol
991 -mreturn-pointer-on-d0 @gol
992 -mno-crt0 -mrelax -mliw -msetlb}
993
994 @emph{Moxie Options}
995 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
996
997 @emph{MSP430 Options}
998 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
999 -mwarn-mcu @gol
1000 -mcode-region= -mdata-region= @gol
1001 -msilicon-errata= -msilicon-errata-warn= @gol
1002 -mhwmult= -minrt}
1003
1004 @emph{NDS32 Options}
1005 @gccoptlist{-mbig-endian -mlittle-endian @gol
1006 -mreduced-regs -mfull-regs @gol
1007 -mcmov -mno-cmov @gol
1008 -mext-perf -mno-ext-perf @gol
1009 -mext-perf2 -mno-ext-perf2 @gol
1010 -mext-string -mno-ext-string @gol
1011 -mv3push -mno-v3push @gol
1012 -m16bit -mno-16bit @gol
1013 -misr-vector-size=@var{num} @gol
1014 -mcache-block-size=@var{num} @gol
1015 -march=@var{arch} @gol
1016 -mcmodel=@var{code-model} @gol
1017 -mctor-dtor -mrelax}
1018
1019 @emph{Nios II Options}
1020 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1021 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1022 -mel -meb @gol
1023 -mno-bypass-cache -mbypass-cache @gol
1024 -mno-cache-volatile -mcache-volatile @gol
1025 -mno-fast-sw-div -mfast-sw-div @gol
1026 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1027 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1028 -mcustom-fpu-cfg=@var{name} @gol
1029 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1030 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1031
1032 @emph{Nvidia PTX Options}
1033 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1034
1035 @emph{OpenRISC Options}
1036 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1037 -msoft-mul -msoft-div @gol
1038 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1039 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1040
1041 @emph{PDP-11 Options}
1042 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1043 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1044 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1045
1046 @emph{picoChip Options}
1047 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1048 -msymbol-as-address -mno-inefficient-warnings}
1049
1050 @emph{PowerPC Options}
1051 See RS/6000 and PowerPC Options.
1052
1053 @emph{PRU Options}
1054 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1055 -mabi=@var{variant} @gol}
1056
1057 @emph{RISC-V Options}
1058 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1059 -mplt -mno-plt @gol
1060 -mabi=@var{ABI-string} @gol
1061 -mfdiv -mno-fdiv @gol
1062 -mdiv -mno-div @gol
1063 -march=@var{ISA-string} @gol
1064 -mtune=@var{processor-string} @gol
1065 -mpreferred-stack-boundary=@var{num} @gol
1066 -msmall-data-limit=@var{N-bytes} @gol
1067 -msave-restore -mno-save-restore @gol
1068 -mstrict-align -mno-strict-align @gol
1069 -mcmodel=medlow -mcmodel=medany @gol
1070 -mexplicit-relocs -mno-explicit-relocs @gol
1071 -mrelax -mno-relax @gol
1072 -mriscv-attribute -mmo-riscv-attribute @gol
1073 -malign-data=@var{type}}
1074
1075 @emph{RL78 Options}
1076 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1077 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1078 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1079
1080 @emph{RS/6000 and PowerPC Options}
1081 @gccoptlist{-mcpu=@var{cpu-type} @gol
1082 -mtune=@var{cpu-type} @gol
1083 -mcmodel=@var{code-model} @gol
1084 -mpowerpc64 @gol
1085 -maltivec -mno-altivec @gol
1086 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1087 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1088 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1089 -mfprnd -mno-fprnd @gol
1090 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1091 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1092 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1093 -malign-power -malign-natural @gol
1094 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1095 -mupdate -mno-update @gol
1096 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1097 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1098 -mstrict-align -mno-strict-align -mrelocatable @gol
1099 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1100 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1101 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1102 -mprioritize-restricted-insns=@var{priority} @gol
1103 -msched-costly-dep=@var{dependence_type} @gol
1104 -minsert-sched-nops=@var{scheme} @gol
1105 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1106 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1107 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1108 -mtraceback=@var{traceback_type} @gol
1109 -maix-struct-return -msvr4-struct-return @gol
1110 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1111 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1112 -mblock-move-inline-limit=@var{num} @gol
1113 -mblock-compare-inline-limit=@var{num} @gol
1114 -mblock-compare-inline-loop-limit=@var{num} @gol
1115 -mstring-compare-inline-limit=@var{num} @gol
1116 -misel -mno-isel @gol
1117 -mvrsave -mno-vrsave @gol
1118 -mmulhw -mno-mulhw @gol
1119 -mdlmzb -mno-dlmzb @gol
1120 -mprototype -mno-prototype @gol
1121 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1122 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1123 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1124 -mno-recip-precision @gol
1125 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1126 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1127 -msave-toc-indirect -mno-save-toc-indirect @gol
1128 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1129 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1130 -mquad-memory -mno-quad-memory @gol
1131 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1132 -mcompat-align-parm -mno-compat-align-parm @gol
1133 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1134 -mgnu-attribute -mno-gnu-attribute @gol
1135 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1136 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1137
1138 @emph{RX Options}
1139 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1140 -mcpu=@gol
1141 -mbig-endian-data -mlittle-endian-data @gol
1142 -msmall-data @gol
1143 -msim -mno-sim@gol
1144 -mas100-syntax -mno-as100-syntax@gol
1145 -mrelax@gol
1146 -mmax-constant-size=@gol
1147 -mint-register=@gol
1148 -mpid@gol
1149 -mallow-string-insns -mno-allow-string-insns@gol
1150 -mjsr@gol
1151 -mno-warn-multiple-fast-interrupts@gol
1152 -msave-acc-in-interrupts}
1153
1154 @emph{S/390 and zSeries Options}
1155 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1156 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1157 -mlong-double-64 -mlong-double-128 @gol
1158 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1159 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1160 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1161 -mhtm -mvx -mzvector @gol
1162 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1163 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1164 -mhotpatch=@var{halfwords},@var{halfwords}}
1165
1166 @emph{Score Options}
1167 @gccoptlist{-meb -mel @gol
1168 -mnhwloop @gol
1169 -muls @gol
1170 -mmac @gol
1171 -mscore5 -mscore5u -mscore7 -mscore7d}
1172
1173 @emph{SH Options}
1174 @gccoptlist{-m1 -m2 -m2e @gol
1175 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1176 -m3 -m3e @gol
1177 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1178 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1179 -mb -ml -mdalign -mrelax @gol
1180 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1181 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1182 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1183 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1184 -maccumulate-outgoing-args @gol
1185 -matomic-model=@var{atomic-model} @gol
1186 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1187 -mcbranch-force-delay-slot @gol
1188 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1189 -mpretend-cmove -mtas}
1190
1191 @emph{Solaris 2 Options}
1192 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1193 -pthreads}
1194
1195 @emph{SPARC Options}
1196 @gccoptlist{-mcpu=@var{cpu-type} @gol
1197 -mtune=@var{cpu-type} @gol
1198 -mcmodel=@var{code-model} @gol
1199 -mmemory-model=@var{mem-model} @gol
1200 -m32 -m64 -mapp-regs -mno-app-regs @gol
1201 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1202 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1203 -mhard-quad-float -msoft-quad-float @gol
1204 -mstack-bias -mno-stack-bias @gol
1205 -mstd-struct-return -mno-std-struct-return @gol
1206 -munaligned-doubles -mno-unaligned-doubles @gol
1207 -muser-mode -mno-user-mode @gol
1208 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1209 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1210 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1211 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1212 -mpopc -mno-popc -msubxc -mno-subxc @gol
1213 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1214 -mlra -mno-lra}
1215
1216 @emph{SPU Options}
1217 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1218 -msafe-dma -munsafe-dma @gol
1219 -mbranch-hints @gol
1220 -msmall-mem -mlarge-mem -mstdmain @gol
1221 -mfixed-range=@var{register-range} @gol
1222 -mea32 -mea64 @gol
1223 -maddress-space-conversion -mno-address-space-conversion @gol
1224 -mcache-size=@var{cache-size} @gol
1225 -matomic-updates -mno-atomic-updates}
1226
1227 @emph{System V Options}
1228 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1229
1230 @emph{TILE-Gx Options}
1231 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1232 -mcmodel=@var{code-model}}
1233
1234 @emph{TILEPro Options}
1235 @gccoptlist{-mcpu=@var{cpu} -m32}
1236
1237 @emph{V850 Options}
1238 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1239 -mprolog-function -mno-prolog-function -mspace @gol
1240 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1241 -mapp-regs -mno-app-regs @gol
1242 -mdisable-callt -mno-disable-callt @gol
1243 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1244 -mv850e -mv850 -mv850e3v5 @gol
1245 -mloop @gol
1246 -mrelax @gol
1247 -mlong-jumps @gol
1248 -msoft-float @gol
1249 -mhard-float @gol
1250 -mgcc-abi @gol
1251 -mrh850-abi @gol
1252 -mbig-switch}
1253
1254 @emph{VAX Options}
1255 @gccoptlist{-mg -mgnu -munix}
1256
1257 @emph{Visium Options}
1258 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1259 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1260
1261 @emph{VMS Options}
1262 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1263 -mpointer-size=@var{size}}
1264
1265 @emph{VxWorks Options}
1266 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1267 -Xbind-lazy -Xbind-now}
1268
1269 @emph{x86 Options}
1270 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1271 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1272 -mfpmath=@var{unit} @gol
1273 -masm=@var{dialect} -mno-fancy-math-387 @gol
1274 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1275 -mno-wide-multiply -mrtd -malign-double @gol
1276 -mpreferred-stack-boundary=@var{num} @gol
1277 -mincoming-stack-boundary=@var{num} @gol
1278 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1279 -mrecip -mrecip=@var{opt} @gol
1280 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1281 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1282 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1283 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1284 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1285 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1286 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1287 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1288 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1289 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1290 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1291 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1292 -mrdseed -msgx -mavx512vp2intersect@gol
1293 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1294 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1295 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1296 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1297 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1298 -mregparm=@var{num} -msseregparm @gol
1299 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1300 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1301 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1302 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1303 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1304 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1305 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1306 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1307 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1308 -mstack-protector-guard-reg=@var{reg} @gol
1309 -mstack-protector-guard-offset=@var{offset} @gol
1310 -mstack-protector-guard-symbol=@var{symbol} @gol
1311 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1312 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1313 -mindirect-branch-register}
1314
1315 @emph{x86 Windows Options}
1316 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1317 -mnop-fun-dllimport -mthread @gol
1318 -municode -mwin32 -mwindows -fno-set-stack-executable}
1319
1320 @emph{Xstormy16 Options}
1321 @gccoptlist{-msim}
1322
1323 @emph{Xtensa Options}
1324 @gccoptlist{-mconst16 -mno-const16 @gol
1325 -mfused-madd -mno-fused-madd @gol
1326 -mforce-no-pic @gol
1327 -mserialize-volatile -mno-serialize-volatile @gol
1328 -mtext-section-literals -mno-text-section-literals @gol
1329 -mauto-litpools -mno-auto-litpools @gol
1330 -mtarget-align -mno-target-align @gol
1331 -mlongcalls -mno-longcalls}
1332
1333 @emph{zSeries Options}
1334 See S/390 and zSeries Options.
1335 @end table
1336
1337
1338 @node Overall Options
1339 @section Options Controlling the Kind of Output
1340
1341 Compilation can involve up to four stages: preprocessing, compilation
1342 proper, assembly and linking, always in that order. GCC is capable of
1343 preprocessing and compiling several files either into several
1344 assembler input files, or into one assembler input file; then each
1345 assembler input file produces an object file, and linking combines all
1346 the object files (those newly compiled, and those specified as input)
1347 into an executable file.
1348
1349 @cindex file name suffix
1350 For any given input file, the file name suffix determines what kind of
1351 compilation is done:
1352
1353 @table @gcctabopt
1354 @item @var{file}.c
1355 C source code that must be preprocessed.
1356
1357 @item @var{file}.i
1358 C source code that should not be preprocessed.
1359
1360 @item @var{file}.ii
1361 C++ source code that should not be preprocessed.
1362
1363 @item @var{file}.m
1364 Objective-C source code. Note that you must link with the @file{libobjc}
1365 library to make an Objective-C program work.
1366
1367 @item @var{file}.mi
1368 Objective-C source code that should not be preprocessed.
1369
1370 @item @var{file}.mm
1371 @itemx @var{file}.M
1372 Objective-C++ source code. Note that you must link with the @file{libobjc}
1373 library to make an Objective-C++ program work. Note that @samp{.M} refers
1374 to a literal capital M@.
1375
1376 @item @var{file}.mii
1377 Objective-C++ source code that should not be preprocessed.
1378
1379 @item @var{file}.h
1380 C, C++, Objective-C or Objective-C++ header file to be turned into a
1381 precompiled header (default), or C, C++ header file to be turned into an
1382 Ada spec (via the @option{-fdump-ada-spec} switch).
1383
1384 @item @var{file}.cc
1385 @itemx @var{file}.cp
1386 @itemx @var{file}.cxx
1387 @itemx @var{file}.cpp
1388 @itemx @var{file}.CPP
1389 @itemx @var{file}.c++
1390 @itemx @var{file}.C
1391 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1392 the last two letters must both be literally @samp{x}. Likewise,
1393 @samp{.C} refers to a literal capital C@.
1394
1395 @item @var{file}.mm
1396 @itemx @var{file}.M
1397 Objective-C++ source code that must be preprocessed.
1398
1399 @item @var{file}.mii
1400 Objective-C++ source code that should not be preprocessed.
1401
1402 @item @var{file}.hh
1403 @itemx @var{file}.H
1404 @itemx @var{file}.hp
1405 @itemx @var{file}.hxx
1406 @itemx @var{file}.hpp
1407 @itemx @var{file}.HPP
1408 @itemx @var{file}.h++
1409 @itemx @var{file}.tcc
1410 C++ header file to be turned into a precompiled header or Ada spec.
1411
1412 @item @var{file}.f
1413 @itemx @var{file}.for
1414 @itemx @var{file}.ftn
1415 Fixed form Fortran source code that should not be preprocessed.
1416
1417 @item @var{file}.F
1418 @itemx @var{file}.FOR
1419 @itemx @var{file}.fpp
1420 @itemx @var{file}.FPP
1421 @itemx @var{file}.FTN
1422 Fixed form Fortran source code that must be preprocessed (with the traditional
1423 preprocessor).
1424
1425 @item @var{file}.f90
1426 @itemx @var{file}.f95
1427 @itemx @var{file}.f03
1428 @itemx @var{file}.f08
1429 Free form Fortran source code that should not be preprocessed.
1430
1431 @item @var{file}.F90
1432 @itemx @var{file}.F95
1433 @itemx @var{file}.F03
1434 @itemx @var{file}.F08
1435 Free form Fortran source code that must be preprocessed (with the
1436 traditional preprocessor).
1437
1438 @item @var{file}.go
1439 Go source code.
1440
1441 @item @var{file}.brig
1442 BRIG files (binary representation of HSAIL).
1443
1444 @item @var{file}.d
1445 D source code.
1446
1447 @item @var{file}.di
1448 D interface file.
1449
1450 @item @var{file}.dd
1451 D documentation code (Ddoc).
1452
1453 @item @var{file}.ads
1454 Ada source code file that contains a library unit declaration (a
1455 declaration of a package, subprogram, or generic, or a generic
1456 instantiation), or a library unit renaming declaration (a package,
1457 generic, or subprogram renaming declaration). Such files are also
1458 called @dfn{specs}.
1459
1460 @item @var{file}.adb
1461 Ada source code file containing a library unit body (a subprogram or
1462 package body). Such files are also called @dfn{bodies}.
1463
1464 @c GCC also knows about some suffixes for languages not yet included:
1465 @c Ratfor:
1466 @c @var{file}.r
1467
1468 @item @var{file}.s
1469 Assembler code.
1470
1471 @item @var{file}.S
1472 @itemx @var{file}.sx
1473 Assembler code that must be preprocessed.
1474
1475 @item @var{other}
1476 An object file to be fed straight into linking.
1477 Any file name with no recognized suffix is treated this way.
1478 @end table
1479
1480 @opindex x
1481 You can specify the input language explicitly with the @option{-x} option:
1482
1483 @table @gcctabopt
1484 @item -x @var{language}
1485 Specify explicitly the @var{language} for the following input files
1486 (rather than letting the compiler choose a default based on the file
1487 name suffix). This option applies to all following input files until
1488 the next @option{-x} option. Possible values for @var{language} are:
1489 @smallexample
1490 c c-header cpp-output
1491 c++ c++-header c++-cpp-output
1492 objective-c objective-c-header objective-c-cpp-output
1493 objective-c++ objective-c++-header objective-c++-cpp-output
1494 assembler assembler-with-cpp
1495 ada
1496 d
1497 f77 f77-cpp-input f95 f95-cpp-input
1498 go
1499 brig
1500 @end smallexample
1501
1502 @item -x none
1503 Turn off any specification of a language, so that subsequent files are
1504 handled according to their file name suffixes (as they are if @option{-x}
1505 has not been used at all).
1506 @end table
1507
1508 If you only want some of the stages of compilation, you can use
1509 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1510 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1511 @command{gcc} is to stop. Note that some combinations (for example,
1512 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1513
1514 @table @gcctabopt
1515 @item -c
1516 @opindex c
1517 Compile or assemble the source files, but do not link. The linking
1518 stage simply is not done. The ultimate output is in the form of an
1519 object file for each source file.
1520
1521 By default, the object file name for a source file is made by replacing
1522 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1523
1524 Unrecognized input files, not requiring compilation or assembly, are
1525 ignored.
1526
1527 @item -S
1528 @opindex S
1529 Stop after the stage of compilation proper; do not assemble. The output
1530 is in the form of an assembler code file for each non-assembler input
1531 file specified.
1532
1533 By default, the assembler file name for a source file is made by
1534 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1535
1536 Input files that don't require compilation are ignored.
1537
1538 @item -E
1539 @opindex E
1540 Stop after the preprocessing stage; do not run the compiler proper. The
1541 output is in the form of preprocessed source code, which is sent to the
1542 standard output.
1543
1544 Input files that don't require preprocessing are ignored.
1545
1546 @cindex output file option
1547 @item -o @var{file}
1548 @opindex o
1549 Place output in file @var{file}. This applies to whatever
1550 sort of output is being produced, whether it be an executable file,
1551 an object file, an assembler file or preprocessed C code.
1552
1553 If @option{-o} is not specified, the default is to put an executable
1554 file in @file{a.out}, the object file for
1555 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1556 assembler file in @file{@var{source}.s}, a precompiled header file in
1557 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1558 standard output.
1559
1560 @item -v
1561 @opindex v
1562 Print (on standard error output) the commands executed to run the stages
1563 of compilation. Also print the version number of the compiler driver
1564 program and of the preprocessor and the compiler proper.
1565
1566 @item -###
1567 @opindex ###
1568 Like @option{-v} except the commands are not executed and arguments
1569 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1570 This is useful for shell scripts to capture the driver-generated command lines.
1571
1572 @item --help
1573 @opindex help
1574 Print (on the standard output) a description of the command-line options
1575 understood by @command{gcc}. If the @option{-v} option is also specified
1576 then @option{--help} is also passed on to the various processes
1577 invoked by @command{gcc}, so that they can display the command-line options
1578 they accept. If the @option{-Wextra} option has also been specified
1579 (prior to the @option{--help} option), then command-line options that
1580 have no documentation associated with them are also displayed.
1581
1582 @item --target-help
1583 @opindex target-help
1584 Print (on the standard output) a description of target-specific command-line
1585 options for each tool. For some targets extra target-specific
1586 information may also be printed.
1587
1588 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1589 Print (on the standard output) a description of the command-line
1590 options understood by the compiler that fit into all specified classes
1591 and qualifiers. These are the supported classes:
1592
1593 @table @asis
1594 @item @samp{optimizers}
1595 Display all of the optimization options supported by the
1596 compiler.
1597
1598 @item @samp{warnings}
1599 Display all of the options controlling warning messages
1600 produced by the compiler.
1601
1602 @item @samp{target}
1603 Display target-specific options. Unlike the
1604 @option{--target-help} option however, target-specific options of the
1605 linker and assembler are not displayed. This is because those
1606 tools do not currently support the extended @option{--help=} syntax.
1607
1608 @item @samp{params}
1609 Display the values recognized by the @option{--param}
1610 option.
1611
1612 @item @var{language}
1613 Display the options supported for @var{language}, where
1614 @var{language} is the name of one of the languages supported in this
1615 version of GCC@.
1616
1617 @item @samp{common}
1618 Display the options that are common to all languages.
1619 @end table
1620
1621 These are the supported qualifiers:
1622
1623 @table @asis
1624 @item @samp{undocumented}
1625 Display only those options that are undocumented.
1626
1627 @item @samp{joined}
1628 Display options taking an argument that appears after an equal
1629 sign in the same continuous piece of text, such as:
1630 @samp{--help=target}.
1631
1632 @item @samp{separate}
1633 Display options taking an argument that appears as a separate word
1634 following the original option, such as: @samp{-o output-file}.
1635 @end table
1636
1637 Thus for example to display all the undocumented target-specific
1638 switches supported by the compiler, use:
1639
1640 @smallexample
1641 --help=target,undocumented
1642 @end smallexample
1643
1644 The sense of a qualifier can be inverted by prefixing it with the
1645 @samp{^} character, so for example to display all binary warning
1646 options (i.e., ones that are either on or off and that do not take an
1647 argument) that have a description, use:
1648
1649 @smallexample
1650 --help=warnings,^joined,^undocumented
1651 @end smallexample
1652
1653 The argument to @option{--help=} should not consist solely of inverted
1654 qualifiers.
1655
1656 Combining several classes is possible, although this usually
1657 restricts the output so much that there is nothing to display. One
1658 case where it does work, however, is when one of the classes is
1659 @var{target}. For example, to display all the target-specific
1660 optimization options, use:
1661
1662 @smallexample
1663 --help=target,optimizers
1664 @end smallexample
1665
1666 The @option{--help=} option can be repeated on the command line. Each
1667 successive use displays its requested class of options, skipping
1668 those that have already been displayed. If @option{--help} is also
1669 specified anywhere on the command line then this takes precedence
1670 over any @option{--help=} option.
1671
1672 If the @option{-Q} option appears on the command line before the
1673 @option{--help=} option, then the descriptive text displayed by
1674 @option{--help=} is changed. Instead of describing the displayed
1675 options, an indication is given as to whether the option is enabled,
1676 disabled or set to a specific value (assuming that the compiler
1677 knows this at the point where the @option{--help=} option is used).
1678
1679 Here is a truncated example from the ARM port of @command{gcc}:
1680
1681 @smallexample
1682 % gcc -Q -mabi=2 --help=target -c
1683 The following options are target specific:
1684 -mabi= 2
1685 -mabort-on-noreturn [disabled]
1686 -mapcs [disabled]
1687 @end smallexample
1688
1689 The output is sensitive to the effects of previous command-line
1690 options, so for example it is possible to find out which optimizations
1691 are enabled at @option{-O2} by using:
1692
1693 @smallexample
1694 -Q -O2 --help=optimizers
1695 @end smallexample
1696
1697 Alternatively you can discover which binary optimizations are enabled
1698 by @option{-O3} by using:
1699
1700 @smallexample
1701 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1702 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1703 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1704 @end smallexample
1705
1706 @item --version
1707 @opindex version
1708 Display the version number and copyrights of the invoked GCC@.
1709
1710 @item -pass-exit-codes
1711 @opindex pass-exit-codes
1712 Normally the @command{gcc} program exits with the code of 1 if any
1713 phase of the compiler returns a non-success return code. If you specify
1714 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1715 the numerically highest error produced by any phase returning an error
1716 indication. The C, C++, and Fortran front ends return 4 if an internal
1717 compiler error is encountered.
1718
1719 @item -pipe
1720 @opindex pipe
1721 Use pipes rather than temporary files for communication between the
1722 various stages of compilation. This fails to work on some systems where
1723 the assembler is unable to read from a pipe; but the GNU assembler has
1724 no trouble.
1725
1726 @item -specs=@var{file}
1727 @opindex specs
1728 Process @var{file} after the compiler reads in the standard @file{specs}
1729 file, in order to override the defaults which the @command{gcc} driver
1730 program uses when determining what switches to pass to @command{cc1},
1731 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1732 @option{-specs=@var{file}} can be specified on the command line, and they
1733 are processed in order, from left to right. @xref{Spec Files}, for
1734 information about the format of the @var{file}.
1735
1736 @item -wrapper
1737 @opindex wrapper
1738 Invoke all subcommands under a wrapper program. The name of the
1739 wrapper program and its parameters are passed as a comma separated
1740 list.
1741
1742 @smallexample
1743 gcc -c t.c -wrapper gdb,--args
1744 @end smallexample
1745
1746 @noindent
1747 This invokes all subprograms of @command{gcc} under
1748 @samp{gdb --args}, thus the invocation of @command{cc1} is
1749 @samp{gdb --args cc1 @dots{}}.
1750
1751 @item -ffile-prefix-map=@var{old}=@var{new}
1752 @opindex ffile-prefix-map
1753 When compiling files residing in directory @file{@var{old}}, record
1754 any references to them in the result of the compilation as if the
1755 files resided in directory @file{@var{new}} instead. Specifying this
1756 option is equivalent to specifying all the individual
1757 @option{-f*-prefix-map} options. This can be used to make reproducible
1758 builds that are location independent. See also
1759 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1760
1761 @item -fplugin=@var{name}.so
1762 @opindex fplugin
1763 Load the plugin code in file @var{name}.so, assumed to be a
1764 shared object to be dlopen'd by the compiler. The base name of
1765 the shared object file is used to identify the plugin for the
1766 purposes of argument parsing (See
1767 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1768 Each plugin should define the callback functions specified in the
1769 Plugins API.
1770
1771 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1772 @opindex fplugin-arg
1773 Define an argument called @var{key} with a value of @var{value}
1774 for the plugin called @var{name}.
1775
1776 @item -fdump-ada-spec@r{[}-slim@r{]}
1777 @opindex fdump-ada-spec
1778 For C and C++ source and include files, generate corresponding Ada specs.
1779 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1780 GNAT User's Guide}, which provides detailed documentation on this feature.
1781
1782 @item -fada-spec-parent=@var{unit}
1783 @opindex fada-spec-parent
1784 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1785 Ada specs as child units of parent @var{unit}.
1786
1787 @item -fdump-go-spec=@var{file}
1788 @opindex fdump-go-spec
1789 For input files in any language, generate corresponding Go
1790 declarations in @var{file}. This generates Go @code{const},
1791 @code{type}, @code{var}, and @code{func} declarations which may be a
1792 useful way to start writing a Go interface to code written in some
1793 other language.
1794
1795 @include @value{srcdir}/../libiberty/at-file.texi
1796 @end table
1797
1798 @node Invoking G++
1799 @section Compiling C++ Programs
1800
1801 @cindex suffixes for C++ source
1802 @cindex C++ source file suffixes
1803 C++ source files conventionally use one of the suffixes @samp{.C},
1804 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1805 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1806 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1807 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1808 files with these names and compiles them as C++ programs even if you
1809 call the compiler the same way as for compiling C programs (usually
1810 with the name @command{gcc}).
1811
1812 @findex g++
1813 @findex c++
1814 However, the use of @command{gcc} does not add the C++ library.
1815 @command{g++} is a program that calls GCC and automatically specifies linking
1816 against the C++ library. It treats @samp{.c},
1817 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1818 files unless @option{-x} is used. This program is also useful when
1819 precompiling a C header file with a @samp{.h} extension for use in C++
1820 compilations. On many systems, @command{g++} is also installed with
1821 the name @command{c++}.
1822
1823 @cindex invoking @command{g++}
1824 When you compile C++ programs, you may specify many of the same
1825 command-line options that you use for compiling programs in any
1826 language; or command-line options meaningful for C and related
1827 languages; or options that are meaningful only for C++ programs.
1828 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1829 explanations of options for languages related to C@.
1830 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1831 explanations of options that are meaningful only for C++ programs.
1832
1833 @node C Dialect Options
1834 @section Options Controlling C Dialect
1835 @cindex dialect options
1836 @cindex language dialect options
1837 @cindex options, dialect
1838
1839 The following options control the dialect of C (or languages derived
1840 from C, such as C++, Objective-C and Objective-C++) that the compiler
1841 accepts:
1842
1843 @table @gcctabopt
1844 @cindex ANSI support
1845 @cindex ISO support
1846 @item -ansi
1847 @opindex ansi
1848 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1849 equivalent to @option{-std=c++98}.
1850
1851 This turns off certain features of GCC that are incompatible with ISO
1852 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1853 such as the @code{asm} and @code{typeof} keywords, and
1854 predefined macros such as @code{unix} and @code{vax} that identify the
1855 type of system you are using. It also enables the undesirable and
1856 rarely used ISO trigraph feature. For the C compiler,
1857 it disables recognition of C++ style @samp{//} comments as well as
1858 the @code{inline} keyword.
1859
1860 The alternate keywords @code{__asm__}, @code{__extension__},
1861 @code{__inline__} and @code{__typeof__} continue to work despite
1862 @option{-ansi}. You would not want to use them in an ISO C program, of
1863 course, but it is useful to put them in header files that might be included
1864 in compilations done with @option{-ansi}. Alternate predefined macros
1865 such as @code{__unix__} and @code{__vax__} are also available, with or
1866 without @option{-ansi}.
1867
1868 The @option{-ansi} option does not cause non-ISO programs to be
1869 rejected gratuitously. For that, @option{-Wpedantic} is required in
1870 addition to @option{-ansi}. @xref{Warning Options}.
1871
1872 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1873 option is used. Some header files may notice this macro and refrain
1874 from declaring certain functions or defining certain macros that the
1875 ISO standard doesn't call for; this is to avoid interfering with any
1876 programs that might use these names for other things.
1877
1878 Functions that are normally built in but do not have semantics
1879 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1880 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1881 built-in functions provided by GCC}, for details of the functions
1882 affected.
1883
1884 @item -std=
1885 @opindex std
1886 Determine the language standard. @xref{Standards,,Language Standards
1887 Supported by GCC}, for details of these standard versions. This option
1888 is currently only supported when compiling C or C++.
1889
1890 The compiler can accept several base standards, such as @samp{c90} or
1891 @samp{c++98}, and GNU dialects of those standards, such as
1892 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1893 compiler accepts all programs following that standard plus those
1894 using GNU extensions that do not contradict it. For example,
1895 @option{-std=c90} turns off certain features of GCC that are
1896 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1897 keywords, but not other GNU extensions that do not have a meaning in
1898 ISO C90, such as omitting the middle term of a @code{?:}
1899 expression. On the other hand, when a GNU dialect of a standard is
1900 specified, all features supported by the compiler are enabled, even when
1901 those features change the meaning of the base standard. As a result, some
1902 strict-conforming programs may be rejected. The particular standard
1903 is used by @option{-Wpedantic} to identify which features are GNU
1904 extensions given that version of the standard. For example
1905 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1906 comments, while @option{-std=gnu99 -Wpedantic} does not.
1907
1908 A value for this option must be provided; possible values are
1909
1910 @table @samp
1911 @item c90
1912 @itemx c89
1913 @itemx iso9899:1990
1914 Support all ISO C90 programs (certain GNU extensions that conflict
1915 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1916
1917 @item iso9899:199409
1918 ISO C90 as modified in amendment 1.
1919
1920 @item c99
1921 @itemx c9x
1922 @itemx iso9899:1999
1923 @itemx iso9899:199x
1924 ISO C99. This standard is substantially completely supported, modulo
1925 bugs and floating-point issues
1926 (mainly but not entirely relating to optional C99 features from
1927 Annexes F and G). See
1928 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1929 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1930
1931 @item c11
1932 @itemx c1x
1933 @itemx iso9899:2011
1934 ISO C11, the 2011 revision of the ISO C standard. This standard is
1935 substantially completely supported, modulo bugs, floating-point issues
1936 (mainly but not entirely relating to optional C11 features from
1937 Annexes F and G) and the optional Annexes K (Bounds-checking
1938 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1939
1940 @item c17
1941 @itemx c18
1942 @itemx iso9899:2017
1943 @itemx iso9899:2018
1944 ISO C17, the 2017 revision of the ISO C standard
1945 (published in 2018). This standard is
1946 same as C11 except for corrections of defects (all of which are also
1947 applied with @option{-std=c11}) and a new value of
1948 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1949
1950 @item c2x
1951 The next version of the ISO C standard, still under development. The
1952 support for this version is experimental and incomplete.
1953
1954 @item gnu90
1955 @itemx gnu89
1956 GNU dialect of ISO C90 (including some C99 features).
1957
1958 @item gnu99
1959 @itemx gnu9x
1960 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1961
1962 @item gnu11
1963 @itemx gnu1x
1964 GNU dialect of ISO C11.
1965 The name @samp{gnu1x} is deprecated.
1966
1967 @item gnu17
1968 @itemx gnu18
1969 GNU dialect of ISO C17. This is the default for C code.
1970
1971 @item gnu2x
1972 The next version of the ISO C standard, still under development, plus
1973 GNU extensions. The support for this version is experimental and
1974 incomplete.
1975
1976 @item c++98
1977 @itemx c++03
1978 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1979 additional defect reports. Same as @option{-ansi} for C++ code.
1980
1981 @item gnu++98
1982 @itemx gnu++03
1983 GNU dialect of @option{-std=c++98}.
1984
1985 @item c++11
1986 @itemx c++0x
1987 The 2011 ISO C++ standard plus amendments.
1988 The name @samp{c++0x} is deprecated.
1989
1990 @item gnu++11
1991 @itemx gnu++0x
1992 GNU dialect of @option{-std=c++11}.
1993 The name @samp{gnu++0x} is deprecated.
1994
1995 @item c++14
1996 @itemx c++1y
1997 The 2014 ISO C++ standard plus amendments.
1998 The name @samp{c++1y} is deprecated.
1999
2000 @item gnu++14
2001 @itemx gnu++1y
2002 GNU dialect of @option{-std=c++14}.
2003 This is the default for C++ code.
2004 The name @samp{gnu++1y} is deprecated.
2005
2006 @item c++17
2007 @itemx c++1z
2008 The 2017 ISO C++ standard plus amendments.
2009 The name @samp{c++1z} is deprecated.
2010
2011 @item gnu++17
2012 @itemx gnu++1z
2013 GNU dialect of @option{-std=c++17}.
2014 The name @samp{gnu++1z} is deprecated.
2015
2016 @item c++2a
2017 The next revision of the ISO C++ standard, tentatively planned for
2018 2020. Support is highly experimental, and will almost certainly
2019 change in incompatible ways in future releases.
2020
2021 @item gnu++2a
2022 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2023 and will almost certainly change in incompatible ways in future
2024 releases.
2025 @end table
2026
2027 @item -fgnu89-inline
2028 @opindex fgnu89-inline
2029 The option @option{-fgnu89-inline} tells GCC to use the traditional
2030 GNU semantics for @code{inline} functions when in C99 mode.
2031 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2032 Using this option is roughly equivalent to adding the
2033 @code{gnu_inline} function attribute to all inline functions
2034 (@pxref{Function Attributes}).
2035
2036 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2037 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2038 specifies the default behavior).
2039 This option is not supported in @option{-std=c90} or
2040 @option{-std=gnu90} mode.
2041
2042 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2043 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2044 in effect for @code{inline} functions. @xref{Common Predefined
2045 Macros,,,cpp,The C Preprocessor}.
2046
2047 @item -fpermitted-flt-eval-methods=@var{style}
2048 @opindex fpermitted-flt-eval-methods
2049 @opindex fpermitted-flt-eval-methods=c11
2050 @opindex fpermitted-flt-eval-methods=ts-18661-3
2051 ISO/IEC TS 18661-3 defines new permissible values for
2052 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2053 a semantic type that is an interchange or extended format should be
2054 evaluated to the precision and range of that type. These new values are
2055 a superset of those permitted under C99/C11, which does not specify the
2056 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2057 conforming to C11 may not have been written expecting the possibility of
2058 the new values.
2059
2060 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2061 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2062 or the extended set of values specified in ISO/IEC TS 18661-3.
2063
2064 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2065
2066 The default when in a standards compliant mode (@option{-std=c11} or similar)
2067 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2068 dialect (@option{-std=gnu11} or similar) is
2069 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2070
2071 @item -aux-info @var{filename}
2072 @opindex aux-info
2073 Output to the given filename prototyped declarations for all functions
2074 declared and/or defined in a translation unit, including those in header
2075 files. This option is silently ignored in any language other than C@.
2076
2077 Besides declarations, the file indicates, in comments, the origin of
2078 each declaration (source file and line), whether the declaration was
2079 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2080 @samp{O} for old, respectively, in the first character after the line
2081 number and the colon), and whether it came from a declaration or a
2082 definition (@samp{C} or @samp{F}, respectively, in the following
2083 character). In the case of function definitions, a K&R-style list of
2084 arguments followed by their declarations is also provided, inside
2085 comments, after the declaration.
2086
2087 @item -fallow-parameterless-variadic-functions
2088 @opindex fallow-parameterless-variadic-functions
2089 Accept variadic functions without named parameters.
2090
2091 Although it is possible to define such a function, this is not very
2092 useful as it is not possible to read the arguments. This is only
2093 supported for C as this construct is allowed by C++.
2094
2095 @item -fno-asm
2096 @opindex fno-asm
2097 @opindex fasm
2098 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2099 keyword, so that code can use these words as identifiers. You can use
2100 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2101 instead. @option{-ansi} implies @option{-fno-asm}.
2102
2103 In C++, this switch only affects the @code{typeof} keyword, since
2104 @code{asm} and @code{inline} are standard keywords. You may want to
2105 use the @option{-fno-gnu-keywords} flag instead, which has the same
2106 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2107 switch only affects the @code{asm} and @code{typeof} keywords, since
2108 @code{inline} is a standard keyword in ISO C99.
2109
2110 @item -fno-builtin
2111 @itemx -fno-builtin-@var{function}
2112 @opindex fno-builtin
2113 @opindex fbuiltin
2114 @cindex built-in functions
2115 Don't recognize built-in functions that do not begin with
2116 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2117 functions provided by GCC}, for details of the functions affected,
2118 including those which are not built-in functions when @option{-ansi} or
2119 @option{-std} options for strict ISO C conformance are used because they
2120 do not have an ISO standard meaning.
2121
2122 GCC normally generates special code to handle certain built-in functions
2123 more efficiently; for instance, calls to @code{alloca} may become single
2124 instructions which adjust the stack directly, and calls to @code{memcpy}
2125 may become inline copy loops. The resulting code is often both smaller
2126 and faster, but since the function calls no longer appear as such, you
2127 cannot set a breakpoint on those calls, nor can you change the behavior
2128 of the functions by linking with a different library. In addition,
2129 when a function is recognized as a built-in function, GCC may use
2130 information about that function to warn about problems with calls to
2131 that function, or to generate more efficient code, even if the
2132 resulting code still contains calls to that function. For example,
2133 warnings are given with @option{-Wformat} for bad calls to
2134 @code{printf} when @code{printf} is built in and @code{strlen} is
2135 known not to modify global memory.
2136
2137 With the @option{-fno-builtin-@var{function}} option
2138 only the built-in function @var{function} is
2139 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2140 function is named that is not built-in in this version of GCC, this
2141 option is ignored. There is no corresponding
2142 @option{-fbuiltin-@var{function}} option; if you wish to enable
2143 built-in functions selectively when using @option{-fno-builtin} or
2144 @option{-ffreestanding}, you may define macros such as:
2145
2146 @smallexample
2147 #define abs(n) __builtin_abs ((n))
2148 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2149 @end smallexample
2150
2151 @item -fgimple
2152 @opindex fgimple
2153
2154 Enable parsing of function definitions marked with @code{__GIMPLE}.
2155 This is an experimental feature that allows unit testing of GIMPLE
2156 passes.
2157
2158 @item -fhosted
2159 @opindex fhosted
2160 @cindex hosted environment
2161
2162 Assert that compilation targets a hosted environment. This implies
2163 @option{-fbuiltin}. A hosted environment is one in which the
2164 entire standard library is available, and in which @code{main} has a return
2165 type of @code{int}. Examples are nearly everything except a kernel.
2166 This is equivalent to @option{-fno-freestanding}.
2167
2168 @item -ffreestanding
2169 @opindex ffreestanding
2170 @cindex hosted environment
2171
2172 Assert that compilation targets a freestanding environment. This
2173 implies @option{-fno-builtin}. A freestanding environment
2174 is one in which the standard library may not exist, and program startup may
2175 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2176 This is equivalent to @option{-fno-hosted}.
2177
2178 @xref{Standards,,Language Standards Supported by GCC}, for details of
2179 freestanding and hosted environments.
2180
2181 @item -fopenacc
2182 @opindex fopenacc
2183 @cindex OpenACC accelerator programming
2184 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2185 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2186 compiler generates accelerated code according to the OpenACC Application
2187 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2188 implies @option{-pthread}, and thus is only supported on targets that
2189 have support for @option{-pthread}.
2190
2191 @item -fopenacc-dim=@var{geom}
2192 @opindex fopenacc-dim
2193 @cindex OpenACC accelerator programming
2194 Specify default compute dimensions for parallel offload regions that do
2195 not explicitly specify. The @var{geom} value is a triple of
2196 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2197 can be omitted, to use a target-specific default value.
2198
2199 @item -fopenmp
2200 @opindex fopenmp
2201 @cindex OpenMP parallel
2202 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2203 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2204 compiler generates parallel code according to the OpenMP Application
2205 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2206 implies @option{-pthread}, and thus is only supported on targets that
2207 have support for @option{-pthread}. @option{-fopenmp} implies
2208 @option{-fopenmp-simd}.
2209
2210 @item -fopenmp-simd
2211 @opindex fopenmp-simd
2212 @cindex OpenMP SIMD
2213 @cindex SIMD
2214 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2215 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2216 are ignored.
2217
2218 @item -fgnu-tm
2219 @opindex fgnu-tm
2220 When the option @option{-fgnu-tm} is specified, the compiler
2221 generates code for the Linux variant of Intel's current Transactional
2222 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2223 an experimental feature whose interface may change in future versions
2224 of GCC, as the official specification changes. Please note that not
2225 all architectures are supported for this feature.
2226
2227 For more information on GCC's support for transactional memory,
2228 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2229 Transactional Memory Library}.
2230
2231 Note that the transactional memory feature is not supported with
2232 non-call exceptions (@option{-fnon-call-exceptions}).
2233
2234 @item -fms-extensions
2235 @opindex fms-extensions
2236 Accept some non-standard constructs used in Microsoft header files.
2237
2238 In C++ code, this allows member names in structures to be similar
2239 to previous types declarations.
2240
2241 @smallexample
2242 typedef int UOW;
2243 struct ABC @{
2244 UOW UOW;
2245 @};
2246 @end smallexample
2247
2248 Some cases of unnamed fields in structures and unions are only
2249 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2250 fields within structs/unions}, for details.
2251
2252 Note that this option is off for all targets except for x86
2253 targets using ms-abi.
2254
2255 @item -fplan9-extensions
2256 @opindex fplan9-extensions
2257 Accept some non-standard constructs used in Plan 9 code.
2258
2259 This enables @option{-fms-extensions}, permits passing pointers to
2260 structures with anonymous fields to functions that expect pointers to
2261 elements of the type of the field, and permits referring to anonymous
2262 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2263 struct/union fields within structs/unions}, for details. This is only
2264 supported for C, not C++.
2265
2266 @item -fcond-mismatch
2267 @opindex fcond-mismatch
2268 Allow conditional expressions with mismatched types in the second and
2269 third arguments. The value of such an expression is void. This option
2270 is not supported for C++.
2271
2272 @item -flax-vector-conversions
2273 @opindex flax-vector-conversions
2274 Allow implicit conversions between vectors with differing numbers of
2275 elements and/or incompatible element types. This option should not be
2276 used for new code.
2277
2278 @item -funsigned-char
2279 @opindex funsigned-char
2280 Let the type @code{char} be unsigned, like @code{unsigned char}.
2281
2282 Each kind of machine has a default for what @code{char} should
2283 be. It is either like @code{unsigned char} by default or like
2284 @code{signed char} by default.
2285
2286 Ideally, a portable program should always use @code{signed char} or
2287 @code{unsigned char} when it depends on the signedness of an object.
2288 But many programs have been written to use plain @code{char} and
2289 expect it to be signed, or expect it to be unsigned, depending on the
2290 machines they were written for. This option, and its inverse, let you
2291 make such a program work with the opposite default.
2292
2293 The type @code{char} is always a distinct type from each of
2294 @code{signed char} or @code{unsigned char}, even though its behavior
2295 is always just like one of those two.
2296
2297 @item -fsigned-char
2298 @opindex fsigned-char
2299 Let the type @code{char} be signed, like @code{signed char}.
2300
2301 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2302 the negative form of @option{-funsigned-char}. Likewise, the option
2303 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2304
2305 @item -fsigned-bitfields
2306 @itemx -funsigned-bitfields
2307 @itemx -fno-signed-bitfields
2308 @itemx -fno-unsigned-bitfields
2309 @opindex fsigned-bitfields
2310 @opindex funsigned-bitfields
2311 @opindex fno-signed-bitfields
2312 @opindex fno-unsigned-bitfields
2313 These options control whether a bit-field is signed or unsigned, when the
2314 declaration does not use either @code{signed} or @code{unsigned}. By
2315 default, such a bit-field is signed, because this is consistent: the
2316 basic integer types such as @code{int} are signed types.
2317
2318 @item -fsso-struct=@var{endianness}
2319 @opindex fsso-struct
2320 Set the default scalar storage order of structures and unions to the
2321 specified endianness. The accepted values are @samp{big-endian},
2322 @samp{little-endian} and @samp{native} for the native endianness of
2323 the target (the default). This option is not supported for C++.
2324
2325 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2326 code that is not binary compatible with code generated without it if the
2327 specified endianness is not the native endianness of the target.
2328 @end table
2329
2330 @node C++ Dialect Options
2331 @section Options Controlling C++ Dialect
2332
2333 @cindex compiler options, C++
2334 @cindex C++ options, command-line
2335 @cindex options, C++
2336 This section describes the command-line options that are only meaningful
2337 for C++ programs. You can also use most of the GNU compiler options
2338 regardless of what language your program is in. For example, you
2339 might compile a file @file{firstClass.C} like this:
2340
2341 @smallexample
2342 g++ -g -fstrict-enums -O -c firstClass.C
2343 @end smallexample
2344
2345 @noindent
2346 In this example, only @option{-fstrict-enums} is an option meant
2347 only for C++ programs; you can use the other options with any
2348 language supported by GCC@.
2349
2350 Some options for compiling C programs, such as @option{-std}, are also
2351 relevant for C++ programs.
2352 @xref{C Dialect Options,,Options Controlling C Dialect}.
2353
2354 Here is a list of options that are @emph{only} for compiling C++ programs:
2355
2356 @table @gcctabopt
2357
2358 @item -fabi-version=@var{n}
2359 @opindex fabi-version
2360 Use version @var{n} of the C++ ABI@. The default is version 0.
2361
2362 Version 0 refers to the version conforming most closely to
2363 the C++ ABI specification. Therefore, the ABI obtained using version 0
2364 will change in different versions of G++ as ABI bugs are fixed.
2365
2366 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2367
2368 Version 2 is the version of the C++ ABI that first appeared in G++
2369 3.4, and was the default through G++ 4.9.
2370
2371 Version 3 corrects an error in mangling a constant address as a
2372 template argument.
2373
2374 Version 4, which first appeared in G++ 4.5, implements a standard
2375 mangling for vector types.
2376
2377 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2378 attribute const/volatile on function pointer types, decltype of a
2379 plain decl, and use of a function parameter in the declaration of
2380 another parameter.
2381
2382 Version 6, which first appeared in G++ 4.7, corrects the promotion
2383 behavior of C++11 scoped enums and the mangling of template argument
2384 packs, const/static_cast, prefix ++ and --, and a class scope function
2385 used as a template argument.
2386
2387 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2388 builtin type and corrects the mangling of lambdas in default argument
2389 scope.
2390
2391 Version 8, which first appeared in G++ 4.9, corrects the substitution
2392 behavior of function types with function-cv-qualifiers.
2393
2394 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2395 @code{nullptr_t}.
2396
2397 Version 10, which first appeared in G++ 6.1, adds mangling of
2398 attributes that affect type identity, such as ia32 calling convention
2399 attributes (e.g.@: @samp{stdcall}).
2400
2401 Version 11, which first appeared in G++ 7, corrects the mangling of
2402 sizeof... expressions and operator names. For multiple entities with
2403 the same name within a function, that are declared in different scopes,
2404 the mangling now changes starting with the twelfth occurrence. It also
2405 implies @option{-fnew-inheriting-ctors}.
2406
2407 Version 12, which first appeared in G++ 8, corrects the calling
2408 conventions for empty classes on the x86_64 target and for classes
2409 with only deleted copy/move constructors. It accidentally changes the
2410 calling convention for classes with a deleted copy constructor and a
2411 trivial move constructor.
2412
2413 Version 13, which first appeared in G++ 8.2, fixes the accidental
2414 change in version 12.
2415
2416 See also @option{-Wabi}.
2417
2418 @item -fabi-compat-version=@var{n}
2419 @opindex fabi-compat-version
2420 On targets that support strong aliases, G++
2421 works around mangling changes by creating an alias with the correct
2422 mangled name when defining a symbol with an incorrect mangled name.
2423 This switch specifies which ABI version to use for the alias.
2424
2425 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2426 compatibility). If another ABI version is explicitly selected, this
2427 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2428 use @option{-fabi-compat-version=2}.
2429
2430 If this option is not provided but @option{-Wabi=@var{n}} is, that
2431 version is used for compatibility aliases. If this option is provided
2432 along with @option{-Wabi} (without the version), the version from this
2433 option is used for the warning.
2434
2435 @item -fno-access-control
2436 @opindex fno-access-control
2437 @opindex faccess-control
2438 Turn off all access checking. This switch is mainly useful for working
2439 around bugs in the access control code.
2440
2441 @item -faligned-new
2442 @opindex faligned-new
2443 Enable support for C++17 @code{new} of types that require more
2444 alignment than @code{void* ::operator new(std::size_t)} provides. A
2445 numeric argument such as @code{-faligned-new=32} can be used to
2446 specify how much alignment (in bytes) is provided by that function,
2447 but few users will need to override the default of
2448 @code{alignof(std::max_align_t)}.
2449
2450 This flag is enabled by default for @option{-std=c++17}.
2451
2452 @item -fchar8_t
2453 @itemx -fno-char8_t
2454 @opindex fchar8_t
2455 @opindex fno-char8_t
2456 Enable support for @code{char8_t} as adopted for C++2a. This includes
2457 the addition of a new @code{char8_t} fundamental type, changes to the
2458 types of UTF-8 string and character literals, new signatures for
2459 user-defined literals, associated standard library updates, and new
2460 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2461
2462 This option enables functions to be overloaded for ordinary and UTF-8
2463 strings:
2464
2465 @smallexample
2466 int f(const char *); // #1
2467 int f(const char8_t *); // #2
2468 int v1 = f("text"); // Calls #1
2469 int v2 = f(u8"text"); // Calls #2
2470 @end smallexample
2471
2472 @noindent
2473 and introduces new signatures for user-defined literals:
2474
2475 @smallexample
2476 int operator""_udl1(char8_t);
2477 int v3 = u8'x'_udl1;
2478 int operator""_udl2(const char8_t*, std::size_t);
2479 int v4 = u8"text"_udl2;
2480 template<typename T, T...> int operator""_udl3();
2481 int v5 = u8"text"_udl3;
2482 @end smallexample
2483
2484 @noindent
2485 The change to the types of UTF-8 string and character literals introduces
2486 incompatibilities with ISO C++11 and later standards. For example, the
2487 following code is well-formed under ISO C++11, but is ill-formed when
2488 @option{-fchar8_t} is specified.
2489
2490 @smallexample
2491 char ca[] = u8"xx"; // error: char-array initialized from wide
2492 // string
2493 const char *cp = u8"xx";// error: invalid conversion from
2494 // `const char8_t*' to `const char*'
2495 int f(const char*);
2496 auto v = f(u8"xx"); // error: invalid conversion from
2497 // `const char8_t*' to `const char*'
2498 std::string s@{u8"xx"@}; // error: no matching function for call to
2499 // `std::basic_string<char>::basic_string()'
2500 using namespace std::literals;
2501 s = u8"xx"s; // error: conversion from
2502 // `basic_string<char8_t>' to non-scalar
2503 // type `basic_string<char>' requested
2504 @end smallexample
2505
2506 @item -fcheck-new
2507 @opindex fcheck-new
2508 Check that the pointer returned by @code{operator new} is non-null
2509 before attempting to modify the storage allocated. This check is
2510 normally unnecessary because the C++ standard specifies that
2511 @code{operator new} only returns @code{0} if it is declared
2512 @code{throw()}, in which case the compiler always checks the
2513 return value even without this option. In all other cases, when
2514 @code{operator new} has a non-empty exception specification, memory
2515 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2516 @samp{new (nothrow)}.
2517
2518 @item -fconcepts
2519 @opindex fconcepts
2520 Enable support for the C++ Extensions for Concepts Technical
2521 Specification, ISO 19217 (2015), which allows code like
2522
2523 @smallexample
2524 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2525 template <Addable T> T add (T a, T b) @{ return a + b; @}
2526 @end smallexample
2527
2528 @item -fconstexpr-depth=@var{n}
2529 @opindex fconstexpr-depth
2530 Set the maximum nested evaluation depth for C++11 constexpr functions
2531 to @var{n}. A limit is needed to detect endless recursion during
2532 constant expression evaluation. The minimum specified by the standard
2533 is 512.
2534
2535 @item -fconstexpr-cache-depth=@var{n}
2536 @opindex fconstexpr-cache-depth
2537 Set the maximum level of nested evaluation depth for C++11 constexpr
2538 functions that will be cached to @var{n}. This is a heuristic that
2539 trades off compilation speed (when the cache avoids repeated
2540 calculations) against memory consumption (when the cache grows very
2541 large from highly recursive evaluations). The default is 8. Very few
2542 users are likely to want to adjust it, but if your code does heavy
2543 constexpr calculations you might want to experiment to find which
2544 value works best for you.
2545
2546 @item -fconstexpr-loop-limit=@var{n}
2547 @opindex fconstexpr-loop-limit
2548 Set the maximum number of iterations for a loop in C++14 constexpr functions
2549 to @var{n}. A limit is needed to detect infinite loops during
2550 constant expression evaluation. The default is 262144 (1<<18).
2551
2552 @item -fconstexpr-ops-limit=@var{n}
2553 @opindex fconstexpr-ops-limit
2554 Set the maximum number of operations during a single constexpr evaluation.
2555 Even when number of iterations of a single loop is limited with the above limit,
2556 if there are several nested loops and each of them has many iterations but still
2557 smaller than the above limit, or if in a body of some loop or even outside
2558 of a loop too many expressions need to be evaluated, the resulting constexpr
2559 evaluation might take too long.
2560 The default is 33554432 (1<<25).
2561
2562 @item -fdeduce-init-list
2563 @opindex fdeduce-init-list
2564 Enable deduction of a template type parameter as
2565 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2566
2567 @smallexample
2568 template <class T> auto forward(T t) -> decltype (realfn (t))
2569 @{
2570 return realfn (t);
2571 @}
2572
2573 void f()
2574 @{
2575 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2576 @}
2577 @end smallexample
2578
2579 This deduction was implemented as a possible extension to the
2580 originally proposed semantics for the C++11 standard, but was not part
2581 of the final standard, so it is disabled by default. This option is
2582 deprecated, and may be removed in a future version of G++.
2583
2584 @item -fno-elide-constructors
2585 @opindex fno-elide-constructors
2586 @opindex felide-constructors
2587 The C++ standard allows an implementation to omit creating a temporary
2588 that is only used to initialize another object of the same type.
2589 Specifying this option disables that optimization, and forces G++ to
2590 call the copy constructor in all cases. This option also causes G++
2591 to call trivial member functions which otherwise would be expanded inline.
2592
2593 In C++17, the compiler is required to omit these temporaries, but this
2594 option still affects trivial member functions.
2595
2596 @item -fno-enforce-eh-specs
2597 @opindex fno-enforce-eh-specs
2598 @opindex fenforce-eh-specs
2599 Don't generate code to check for violation of exception specifications
2600 at run time. This option violates the C++ standard, but may be useful
2601 for reducing code size in production builds, much like defining
2602 @code{NDEBUG}. This does not give user code permission to throw
2603 exceptions in violation of the exception specifications; the compiler
2604 still optimizes based on the specifications, so throwing an
2605 unexpected exception results in undefined behavior at run time.
2606
2607 @item -fextern-tls-init
2608 @itemx -fno-extern-tls-init
2609 @opindex fextern-tls-init
2610 @opindex fno-extern-tls-init
2611 The C++11 and OpenMP standards allow @code{thread_local} and
2612 @code{threadprivate} variables to have dynamic (runtime)
2613 initialization. To support this, any use of such a variable goes
2614 through a wrapper function that performs any necessary initialization.
2615 When the use and definition of the variable are in the same
2616 translation unit, this overhead can be optimized away, but when the
2617 use is in a different translation unit there is significant overhead
2618 even if the variable doesn't actually need dynamic initialization. If
2619 the programmer can be sure that no use of the variable in a
2620 non-defining TU needs to trigger dynamic initialization (either
2621 because the variable is statically initialized, or a use of the
2622 variable in the defining TU will be executed before any uses in
2623 another TU), they can avoid this overhead with the
2624 @option{-fno-extern-tls-init} option.
2625
2626 On targets that support symbol aliases, the default is
2627 @option{-fextern-tls-init}. On targets that do not support symbol
2628 aliases, the default is @option{-fno-extern-tls-init}.
2629
2630 @item -fno-gnu-keywords
2631 @opindex fno-gnu-keywords
2632 @opindex fgnu-keywords
2633 Do not recognize @code{typeof} as a keyword, so that code can use this
2634 word as an identifier. You can use the keyword @code{__typeof__} instead.
2635 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2636 @option{-std=c++98}, @option{-std=c++11}, etc.
2637
2638 @item -fno-implicit-templates
2639 @opindex fno-implicit-templates
2640 @opindex fimplicit-templates
2641 Never emit code for non-inline templates that are instantiated
2642 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2643 If you use this option, you must take care to structure your code to
2644 include all the necessary explicit instantiations to avoid getting
2645 undefined symbols at link time.
2646 @xref{Template Instantiation}, for more information.
2647
2648 @item -fno-implicit-inline-templates
2649 @opindex fno-implicit-inline-templates
2650 @opindex fimplicit-inline-templates
2651 Don't emit code for implicit instantiations of inline templates, either.
2652 The default is to handle inlines differently so that compiles with and
2653 without optimization need the same set of explicit instantiations.
2654
2655 @item -fno-implement-inlines
2656 @opindex fno-implement-inlines
2657 @opindex fimplement-inlines
2658 To save space, do not emit out-of-line copies of inline functions
2659 controlled by @code{#pragma implementation}. This causes linker
2660 errors if these functions are not inlined everywhere they are called.
2661
2662 @item -fms-extensions
2663 @opindex fms-extensions
2664 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2665 int and getting a pointer to member function via non-standard syntax.
2666
2667 @item -fnew-inheriting-ctors
2668 @opindex fnew-inheriting-ctors
2669 Enable the P0136 adjustment to the semantics of C++11 constructor
2670 inheritance. This is part of C++17 but also considered to be a Defect
2671 Report against C++11 and C++14. This flag is enabled by default
2672 unless @option{-fabi-version=10} or lower is specified.
2673
2674 @item -fnew-ttp-matching
2675 @opindex fnew-ttp-matching
2676 Enable the P0522 resolution to Core issue 150, template template
2677 parameters and default arguments: this allows a template with default
2678 template arguments as an argument for a template template parameter
2679 with fewer template parameters. This flag is enabled by default for
2680 @option{-std=c++17}.
2681
2682 @item -fno-nonansi-builtins
2683 @opindex fno-nonansi-builtins
2684 @opindex fnonansi-builtins
2685 Disable built-in declarations of functions that are not mandated by
2686 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2687 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2688
2689 @item -fnothrow-opt
2690 @opindex fnothrow-opt
2691 Treat a @code{throw()} exception specification as if it were a
2692 @code{noexcept} specification to reduce or eliminate the text size
2693 overhead relative to a function with no exception specification. If
2694 the function has local variables of types with non-trivial
2695 destructors, the exception specification actually makes the
2696 function smaller because the EH cleanups for those variables can be
2697 optimized away. The semantic effect is that an exception thrown out of
2698 a function with such an exception specification results in a call
2699 to @code{terminate} rather than @code{unexpected}.
2700
2701 @item -fno-operator-names
2702 @opindex fno-operator-names
2703 @opindex foperator-names
2704 Do not treat the operator name keywords @code{and}, @code{bitand},
2705 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2706 synonyms as keywords.
2707
2708 @item -fno-optional-diags
2709 @opindex fno-optional-diags
2710 @opindex foptional-diags
2711 Disable diagnostics that the standard says a compiler does not need to
2712 issue. Currently, the only such diagnostic issued by G++ is the one for
2713 a name having multiple meanings within a class.
2714
2715 @item -fpermissive
2716 @opindex fpermissive
2717 Downgrade some diagnostics about nonconformant code from errors to
2718 warnings. Thus, using @option{-fpermissive} allows some
2719 nonconforming code to compile.
2720
2721 @item -fno-pretty-templates
2722 @opindex fno-pretty-templates
2723 @opindex fpretty-templates
2724 When an error message refers to a specialization of a function
2725 template, the compiler normally prints the signature of the
2726 template followed by the template arguments and any typedefs or
2727 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2728 rather than @code{void f(int)}) so that it's clear which template is
2729 involved. When an error message refers to a specialization of a class
2730 template, the compiler omits any template arguments that match
2731 the default template arguments for that template. If either of these
2732 behaviors make it harder to understand the error message rather than
2733 easier, you can use @option{-fno-pretty-templates} to disable them.
2734
2735 @item -frepo
2736 @opindex frepo
2737 Enable automatic template instantiation at link time. This option also
2738 implies @option{-fno-implicit-templates}. @xref{Template
2739 Instantiation}, for more information.
2740
2741 @item -fno-rtti
2742 @opindex fno-rtti
2743 @opindex frtti
2744 Disable generation of information about every class with virtual
2745 functions for use by the C++ run-time type identification features
2746 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2747 of the language, you can save some space by using this flag. Note that
2748 exception handling uses the same information, but G++ generates it as
2749 needed. The @code{dynamic_cast} operator can still be used for casts that
2750 do not require run-time type information, i.e.@: casts to @code{void *} or to
2751 unambiguous base classes.
2752
2753 Mixing code compiled with @option{-frtti} with that compiled with
2754 @option{-fno-rtti} may not work. For example, programs may
2755 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2756 for a class compiled with @option{-frtti}.
2757
2758 @item -fsized-deallocation
2759 @opindex fsized-deallocation
2760 Enable the built-in global declarations
2761 @smallexample
2762 void operator delete (void *, std::size_t) noexcept;
2763 void operator delete[] (void *, std::size_t) noexcept;
2764 @end smallexample
2765 as introduced in C++14. This is useful for user-defined replacement
2766 deallocation functions that, for example, use the size of the object
2767 to make deallocation faster. Enabled by default under
2768 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2769 warns about places that might want to add a definition.
2770
2771 @item -fstrict-enums
2772 @opindex fstrict-enums
2773 Allow the compiler to optimize using the assumption that a value of
2774 enumerated type can only be one of the values of the enumeration (as
2775 defined in the C++ standard; basically, a value that can be
2776 represented in the minimum number of bits needed to represent all the
2777 enumerators). This assumption may not be valid if the program uses a
2778 cast to convert an arbitrary integer value to the enumerated type.
2779
2780 @item -fstrong-eval-order
2781 @opindex fstrong-eval-order
2782 Evaluate member access, array subscripting, and shift expressions in
2783 left-to-right order, and evaluate assignment in right-to-left order,
2784 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2785 @option{-fstrong-eval-order=some} enables just the ordering of member
2786 access and shift expressions, and is the default without
2787 @option{-std=c++17}.
2788
2789 @item -ftemplate-backtrace-limit=@var{n}
2790 @opindex ftemplate-backtrace-limit
2791 Set the maximum number of template instantiation notes for a single
2792 warning or error to @var{n}. The default value is 10.
2793
2794 @item -ftemplate-depth=@var{n}
2795 @opindex ftemplate-depth
2796 Set the maximum instantiation depth for template classes to @var{n}.
2797 A limit on the template instantiation depth is needed to detect
2798 endless recursions during template class instantiation. ANSI/ISO C++
2799 conforming programs must not rely on a maximum depth greater than 17
2800 (changed to 1024 in C++11). The default value is 900, as the compiler
2801 can run out of stack space before hitting 1024 in some situations.
2802
2803 @item -fno-threadsafe-statics
2804 @opindex fno-threadsafe-statics
2805 @opindex fthreadsafe-statics
2806 Do not emit the extra code to use the routines specified in the C++
2807 ABI for thread-safe initialization of local statics. You can use this
2808 option to reduce code size slightly in code that doesn't need to be
2809 thread-safe.
2810
2811 @item -fuse-cxa-atexit
2812 @opindex fuse-cxa-atexit
2813 Register destructors for objects with static storage duration with the
2814 @code{__cxa_atexit} function rather than the @code{atexit} function.
2815 This option is required for fully standards-compliant handling of static
2816 destructors, but only works if your C library supports
2817 @code{__cxa_atexit}.
2818
2819 @item -fno-use-cxa-get-exception-ptr
2820 @opindex fno-use-cxa-get-exception-ptr
2821 @opindex fuse-cxa-get-exception-ptr
2822 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2823 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2824 if the runtime routine is not available.
2825
2826 @item -fvisibility-inlines-hidden
2827 @opindex fvisibility-inlines-hidden
2828 This switch declares that the user does not attempt to compare
2829 pointers to inline functions or methods where the addresses of the two functions
2830 are taken in different shared objects.
2831
2832 The effect of this is that GCC may, effectively, mark inline methods with
2833 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2834 appear in the export table of a DSO and do not require a PLT indirection
2835 when used within the DSO@. Enabling this option can have a dramatic effect
2836 on load and link times of a DSO as it massively reduces the size of the
2837 dynamic export table when the library makes heavy use of templates.
2838
2839 The behavior of this switch is not quite the same as marking the
2840 methods as hidden directly, because it does not affect static variables
2841 local to the function or cause the compiler to deduce that
2842 the function is defined in only one shared object.
2843
2844 You may mark a method as having a visibility explicitly to negate the
2845 effect of the switch for that method. For example, if you do want to
2846 compare pointers to a particular inline method, you might mark it as
2847 having default visibility. Marking the enclosing class with explicit
2848 visibility has no effect.
2849
2850 Explicitly instantiated inline methods are unaffected by this option
2851 as their linkage might otherwise cross a shared library boundary.
2852 @xref{Template Instantiation}.
2853
2854 @item -fvisibility-ms-compat
2855 @opindex fvisibility-ms-compat
2856 This flag attempts to use visibility settings to make GCC's C++
2857 linkage model compatible with that of Microsoft Visual Studio.
2858
2859 The flag makes these changes to GCC's linkage model:
2860
2861 @enumerate
2862 @item
2863 It sets the default visibility to @code{hidden}, like
2864 @option{-fvisibility=hidden}.
2865
2866 @item
2867 Types, but not their members, are not hidden by default.
2868
2869 @item
2870 The One Definition Rule is relaxed for types without explicit
2871 visibility specifications that are defined in more than one
2872 shared object: those declarations are permitted if they are
2873 permitted when this option is not used.
2874 @end enumerate
2875
2876 In new code it is better to use @option{-fvisibility=hidden} and
2877 export those classes that are intended to be externally visible.
2878 Unfortunately it is possible for code to rely, perhaps accidentally,
2879 on the Visual Studio behavior.
2880
2881 Among the consequences of these changes are that static data members
2882 of the same type with the same name but defined in different shared
2883 objects are different, so changing one does not change the other;
2884 and that pointers to function members defined in different shared
2885 objects may not compare equal. When this flag is given, it is a
2886 violation of the ODR to define types with the same name differently.
2887
2888 @item -fno-weak
2889 @opindex fno-weak
2890 @opindex fweak
2891 Do not use weak symbol support, even if it is provided by the linker.
2892 By default, G++ uses weak symbols if they are available. This
2893 option exists only for testing, and should not be used by end-users;
2894 it results in inferior code and has no benefits. This option may
2895 be removed in a future release of G++.
2896
2897 @item -nostdinc++
2898 @opindex nostdinc++
2899 Do not search for header files in the standard directories specific to
2900 C++, but do still search the other standard directories. (This option
2901 is used when building the C++ library.)
2902 @end table
2903
2904 In addition, these optimization, warning, and code generation options
2905 have meanings only for C++ programs:
2906
2907 @table @gcctabopt
2908 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2909 @opindex Wabi
2910 @opindex Wno-abi
2911 Warn when G++ it generates code that is probably not compatible with
2912 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2913 ABI with each major release, normally @option{-Wabi} will warn only if
2914 there is a check added later in a release series for an ABI issue
2915 discovered since the initial release. @option{-Wabi} will warn about
2916 more things if an older ABI version is selected (with
2917 @option{-fabi-version=@var{n}}).
2918
2919 @option{-Wabi} can also be used with an explicit version number to
2920 warn about compatibility with a particular @option{-fabi-version}
2921 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2922 @option{-fabi-version=2}.
2923
2924 If an explicit version number is provided and
2925 @option{-fabi-compat-version} is not specified, the version number
2926 from this option is used for compatibility aliases. If no explicit
2927 version number is provided with this option, but
2928 @option{-fabi-compat-version} is specified, that version number is
2929 used for ABI warnings.
2930
2931 Although an effort has been made to warn about
2932 all such cases, there are probably some cases that are not warned about,
2933 even though G++ is generating incompatible code. There may also be
2934 cases where warnings are emitted even though the code that is generated
2935 is compatible.
2936
2937 You should rewrite your code to avoid these warnings if you are
2938 concerned about the fact that code generated by G++ may not be binary
2939 compatible with code generated by other compilers.
2940
2941 Known incompatibilities in @option{-fabi-version=2} (which was the
2942 default from GCC 3.4 to 4.9) include:
2943
2944 @itemize @bullet
2945
2946 @item
2947 A template with a non-type template parameter of reference type was
2948 mangled incorrectly:
2949 @smallexample
2950 extern int N;
2951 template <int &> struct S @{@};
2952 void n (S<N>) @{2@}
2953 @end smallexample
2954
2955 This was fixed in @option{-fabi-version=3}.
2956
2957 @item
2958 SIMD vector types declared using @code{__attribute ((vector_size))} were
2959 mangled in a non-standard way that does not allow for overloading of
2960 functions taking vectors of different sizes.
2961
2962 The mangling was changed in @option{-fabi-version=4}.
2963
2964 @item
2965 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2966 qualifiers, and @code{decltype} of a plain declaration was folded away.
2967
2968 These mangling issues were fixed in @option{-fabi-version=5}.
2969
2970 @item
2971 Scoped enumerators passed as arguments to a variadic function are
2972 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2973 On most targets this does not actually affect the parameter passing
2974 ABI, as there is no way to pass an argument smaller than @code{int}.
2975
2976 Also, the ABI changed the mangling of template argument packs,
2977 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2978 a class scope function used as a template argument.
2979
2980 These issues were corrected in @option{-fabi-version=6}.
2981
2982 @item
2983 Lambdas in default argument scope were mangled incorrectly, and the
2984 ABI changed the mangling of @code{nullptr_t}.
2985
2986 These issues were corrected in @option{-fabi-version=7}.
2987
2988 @item
2989 When mangling a function type with function-cv-qualifiers, the
2990 un-qualified function type was incorrectly treated as a substitution
2991 candidate.
2992
2993 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2994
2995 @item
2996 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2997 unaligned accesses. Note that this did not affect the ABI of a
2998 function with a @code{nullptr_t} parameter, as parameters have a
2999 minimum alignment.
3000
3001 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
3002
3003 @item
3004 Target-specific attributes that affect the identity of a type, such as
3005 ia32 calling conventions on a function type (stdcall, regparm, etc.),
3006 did not affect the mangled name, leading to name collisions when
3007 function pointers were used as template arguments.
3008
3009 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
3010
3011 @end itemize
3012
3013 It also warns about psABI-related changes. The known psABI changes at this
3014 point include:
3015
3016 @itemize @bullet
3017
3018 @item
3019 For SysV/x86-64, unions with @code{long double} members are
3020 passed in memory as specified in psABI. For example:
3021
3022 @smallexample
3023 union U @{
3024 long double ld;
3025 int i;
3026 @};
3027 @end smallexample
3028
3029 @noindent
3030 @code{union U} is always passed in memory.
3031
3032 @end itemize
3033
3034 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3035 @opindex Wabi-tag
3036 @opindex Wabi-tag
3037 Warn when a type with an ABI tag is used in a context that does not
3038 have that ABI tag. See @ref{C++ Attributes} for more information
3039 about ABI tags.
3040
3041 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3042 @opindex Wcomma-subscript
3043 @opindex Wno-comma-subscript
3044 Warn about uses of a comma expression within a subscripting expression.
3045 This usage was deprecated in C++2a. However, a comma expression wrapped
3046 in @code{( )} is not deprecated. Example:
3047
3048 @smallexample
3049 @group
3050 void f(int *a, int b, int c) @{
3051 a[b,c]; // deprecated
3052 a[(b,c)]; // OK
3053 @}
3054 @end group
3055 @end smallexample
3056
3057 Enabled by default with @option{-std=c++2a}.
3058
3059 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3060 @opindex Wctor-dtor-privacy
3061 @opindex Wno-ctor-dtor-privacy
3062 Warn when a class seems unusable because all the constructors or
3063 destructors in that class are private, and it has neither friends nor
3064 public static member functions. Also warn if there are no non-private
3065 methods, and there's at least one private member function that isn't
3066 a constructor or destructor.
3067
3068 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3069 @opindex Wdelete-non-virtual-dtor
3070 @opindex Wno-delete-non-virtual-dtor
3071 Warn when @code{delete} is used to destroy an instance of a class that
3072 has virtual functions and non-virtual destructor. It is unsafe to delete
3073 an instance of a derived class through a pointer to a base class if the
3074 base class does not have a virtual destructor. This warning is enabled
3075 by @option{-Wall}.
3076
3077 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3078 @opindex Wdeprecated-copy
3079 @opindex Wno-deprecated-copy
3080 Warn that the implicit declaration of a copy constructor or copy
3081 assignment operator is deprecated if the class has a user-provided
3082 copy constructor or copy assignment operator, in C++11 and up. This
3083 warning is enabled by @option{-Wextra}. With
3084 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3085 user-provided destructor.
3086
3087 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3088 @opindex Winit-list-lifetime
3089 @opindex Wno-init-list-lifetime
3090 Do not warn about uses of @code{std::initializer_list} that are likely
3091 to result in dangling pointers. Since the underlying array for an
3092 @code{initializer_list} is handled like a normal C++ temporary object,
3093 it is easy to inadvertently keep a pointer to the array past the end
3094 of the array's lifetime. For example:
3095
3096 @itemize @bullet
3097 @item
3098 If a function returns a temporary @code{initializer_list}, or a local
3099 @code{initializer_list} variable, the array's lifetime ends at the end
3100 of the return statement, so the value returned has a dangling pointer.
3101
3102 @item
3103 If a new-expression creates an @code{initializer_list}, the array only
3104 lives until the end of the enclosing full-expression, so the
3105 @code{initializer_list} in the heap has a dangling pointer.
3106
3107 @item
3108 When an @code{initializer_list} variable is assigned from a
3109 brace-enclosed initializer list, the temporary array created for the
3110 right side of the assignment only lives until the end of the
3111 full-expression, so at the next statement the @code{initializer_list}
3112 variable has a dangling pointer.
3113
3114 @smallexample
3115 // li's initial underlying array lives as long as li
3116 std::initializer_list<int> li = @{ 1,2,3 @};
3117 // assignment changes li to point to a temporary array
3118 li = @{ 4, 5 @};
3119 // now the temporary is gone and li has a dangling pointer
3120 int i = li.begin()[0] // undefined behavior
3121 @end smallexample
3122
3123 @item
3124 When a list constructor stores the @code{begin} pointer from the
3125 @code{initializer_list} argument, this doesn't extend the lifetime of
3126 the array, so if a class variable is constructed from a temporary
3127 @code{initializer_list}, the pointer is left dangling by the end of
3128 the variable declaration statement.
3129
3130 @end itemize
3131
3132 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3133 @opindex Wliteral-suffix
3134 @opindex Wno-literal-suffix
3135 Warn when a string or character literal is followed by a ud-suffix which does
3136 not begin with an underscore. As a conforming extension, GCC treats such
3137 suffixes as separate preprocessing tokens in order to maintain backwards
3138 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3139 For example:
3140
3141 @smallexample
3142 #define __STDC_FORMAT_MACROS
3143 #include <inttypes.h>
3144 #include <stdio.h>
3145
3146 int main() @{
3147 int64_t i64 = 123;
3148 printf("My int64: %" PRId64"\n", i64);
3149 @}
3150 @end smallexample
3151
3152 In this case, @code{PRId64} is treated as a separate preprocessing token.
3153
3154 Additionally, warn when a user-defined literal operator is declared with
3155 a literal suffix identifier that doesn't begin with an underscore. Literal
3156 suffix identifiers that don't begin with an underscore are reserved for
3157 future standardization.
3158
3159 This warning is enabled by default.
3160
3161 @item -Wlto-type-mismatch
3162 @opindex Wlto-type-mismatch
3163 @opindex Wno-lto-type-mismatch
3164
3165 During the link-time optimization warn about type mismatches in
3166 global declarations from different compilation units.
3167 Requires @option{-flto} to be enabled. Enabled by default.
3168
3169 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3170 @opindex Wnarrowing
3171 @opindex Wno-narrowing
3172 For C++11 and later standards, narrowing conversions are diagnosed by default,
3173 as required by the standard. A narrowing conversion from a constant produces
3174 an error, and a narrowing conversion from a non-constant produces a warning,
3175 but @option{-Wno-narrowing} suppresses the diagnostic.
3176 Note that this does not affect the meaning of well-formed code;
3177 narrowing conversions are still considered ill-formed in SFINAE contexts.
3178
3179 With @option{-Wnarrowing} in C++98, warn when a narrowing
3180 conversion prohibited by C++11 occurs within
3181 @samp{@{ @}}, e.g.
3182
3183 @smallexample
3184 int i = @{ 2.2 @}; // error: narrowing from double to int
3185 @end smallexample
3186
3187 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3188
3189 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3190 @opindex Wnoexcept
3191 @opindex Wno-noexcept
3192 Warn when a noexcept-expression evaluates to false because of a call
3193 to a function that does not have a non-throwing exception
3194 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3195 the compiler to never throw an exception.
3196
3197 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3198 @opindex Wnoexcept-type
3199 @opindex Wno-noexcept-type
3200 Warn if the C++17 feature making @code{noexcept} part of a function
3201 type changes the mangled name of a symbol relative to C++14. Enabled
3202 by @option{-Wabi} and @option{-Wc++17-compat}.
3203
3204 As an example:
3205
3206 @smallexample
3207 template <class T> void f(T t) @{ t(); @};
3208 void g() noexcept;
3209 void h() @{ f(g); @}
3210 @end smallexample
3211
3212 @noindent
3213 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3214 C++17 it calls @code{f<void(*)()noexcept>}.
3215
3216 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3217 @opindex Wclass-memaccess
3218 @opindex Wno-class-memaccess
3219 Warn when the destination of a call to a raw memory function such as
3220 @code{memset} or @code{memcpy} is an object of class type, and when writing
3221 into such an object might bypass the class non-trivial or deleted constructor
3222 or copy assignment, violate const-correctness or encapsulation, or corrupt
3223 virtual table pointers. Modifying the representation of such objects may
3224 violate invariants maintained by member functions of the class. For example,
3225 the call to @code{memset} below is undefined because it modifies a non-trivial
3226 class object and is, therefore, diagnosed. The safe way to either initialize
3227 or clear the storage of objects of such types is by using the appropriate
3228 constructor or assignment operator, if one is available.
3229 @smallexample
3230 std::string str = "abc";
3231 memset (&str, 0, sizeof str);
3232 @end smallexample
3233 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3234 Explicitly casting the pointer to the class object to @code{void *} or
3235 to a type that can be safely accessed by the raw memory function suppresses
3236 the warning.
3237
3238 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3239 @opindex Wnon-virtual-dtor
3240 @opindex Wno-non-virtual-dtor
3241 Warn when a class has virtual functions and an accessible non-virtual
3242 destructor itself or in an accessible polymorphic base class, in which
3243 case it is possible but unsafe to delete an instance of a derived
3244 class through a pointer to the class itself or base class. This
3245 warning is automatically enabled if @option{-Weffc++} is specified.
3246
3247 @item -Wregister @r{(C++ and Objective-C++ only)}
3248 @opindex Wregister
3249 @opindex Wno-register
3250 Warn on uses of the @code{register} storage class specifier, except
3251 when it is part of the GNU @ref{Explicit Register Variables} extension.
3252 The use of the @code{register} keyword as storage class specifier has
3253 been deprecated in C++11 and removed in C++17.
3254 Enabled by default with @option{-std=c++17}.
3255
3256 @item -Wreorder @r{(C++ and Objective-C++ only)}
3257 @opindex Wreorder
3258 @opindex Wno-reorder
3259 @cindex reordering, warning
3260 @cindex warning for reordering of member initializers
3261 Warn when the order of member initializers given in the code does not
3262 match the order in which they must be executed. For instance:
3263
3264 @smallexample
3265 struct A @{
3266 int i;
3267 int j;
3268 A(): j (0), i (1) @{ @}
3269 @};
3270 @end smallexample
3271
3272 @noindent
3273 The compiler rearranges the member initializers for @code{i}
3274 and @code{j} to match the declaration order of the members, emitting
3275 a warning to that effect. This warning is enabled by @option{-Wall}.
3276
3277 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3278 @opindex Wpessimizing-move
3279 @opindex Wno-pessimizing-move
3280 This warning warns when a call to @code{std::move} prevents copy
3281 elision. A typical scenario when copy elision can occur is when returning in
3282 a function with a class return type, when the expression being returned is the
3283 name of a non-volatile automatic object, and is not a function parameter, and
3284 has the same type as the function return type.
3285
3286 @smallexample
3287 struct T @{
3288 @dots{}
3289 @};
3290 T fn()
3291 @{
3292 T t;
3293 @dots{}
3294 return std::move (t);
3295 @}
3296 @end smallexample
3297
3298 But in this example, the @code{std::move} call prevents copy elision.
3299
3300 This warning is enabled by @option{-Wall}.
3301
3302 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3303 @opindex Wredundant-move
3304 @opindex Wno-redundant-move
3305 This warning warns about redundant calls to @code{std::move}; that is, when
3306 a move operation would have been performed even without the @code{std::move}
3307 call. This happens because the compiler is forced to treat the object as if
3308 it were an rvalue in certain situations such as returning a local variable,
3309 where copy elision isn't applicable. Consider:
3310
3311 @smallexample
3312 struct T @{
3313 @dots{}
3314 @};
3315 T fn(T t)
3316 @{
3317 @dots{}
3318 return std::move (t);
3319 @}
3320 @end smallexample
3321
3322 Here, the @code{std::move} call is redundant. Because G++ implements Core
3323 Issue 1579, another example is:
3324
3325 @smallexample
3326 struct T @{ // convertible to U
3327 @dots{}
3328 @};
3329 struct U @{
3330 @dots{}
3331 @};
3332 U fn()
3333 @{
3334 T t;
3335 @dots{}
3336 return std::move (t);
3337 @}
3338 @end smallexample
3339 In this example, copy elision isn't applicable because the type of the
3340 expression being returned and the function return type differ, yet G++
3341 treats the return value as if it were designated by an rvalue.
3342
3343 This warning is enabled by @option{-Wextra}.
3344
3345 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3346 @opindex fext-numeric-literals
3347 @opindex fno-ext-numeric-literals
3348 Accept imaginary, fixed-point, or machine-defined
3349 literal number suffixes as GNU extensions.
3350 When this option is turned off these suffixes are treated
3351 as C++11 user-defined literal numeric suffixes.
3352 This is on by default for all pre-C++11 dialects and all GNU dialects:
3353 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3354 @option{-std=gnu++14}.
3355 This option is off by default
3356 for ISO C++11 onwards (@option{-std=c++11}, ...).
3357 @end table
3358
3359 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3360
3361 @table @gcctabopt
3362 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3363 @opindex Weffc++
3364 @opindex Wno-effc++
3365 Warn about violations of the following style guidelines from Scott Meyers'
3366 @cite{Effective C++} series of books:
3367
3368 @itemize @bullet
3369 @item
3370 Define a copy constructor and an assignment operator for classes
3371 with dynamically-allocated memory.
3372
3373 @item
3374 Prefer initialization to assignment in constructors.
3375
3376 @item
3377 Have @code{operator=} return a reference to @code{*this}.
3378
3379 @item
3380 Don't try to return a reference when you must return an object.
3381
3382 @item
3383 Distinguish between prefix and postfix forms of increment and
3384 decrement operators.
3385
3386 @item
3387 Never overload @code{&&}, @code{||}, or @code{,}.
3388
3389 @end itemize
3390
3391 This option also enables @option{-Wnon-virtual-dtor}, which is also
3392 one of the effective C++ recommendations. However, the check is
3393 extended to warn about the lack of virtual destructor in accessible
3394 non-polymorphic bases classes too.
3395
3396 When selecting this option, be aware that the standard library
3397 headers do not obey all of these guidelines; use @samp{grep -v}
3398 to filter out those warnings.
3399
3400 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3401 @opindex Wstrict-null-sentinel
3402 @opindex Wno-strict-null-sentinel
3403 Warn about the use of an uncasted @code{NULL} as sentinel. When
3404 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3405 to @code{__null}. Although it is a null pointer constant rather than a
3406 null pointer, it is guaranteed to be of the same size as a pointer.
3407 But this use is not portable across different compilers.
3408
3409 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3410 @opindex Wno-non-template-friend
3411 @opindex Wnon-template-friend
3412 Disable warnings when non-template friend functions are declared
3413 within a template. In very old versions of GCC that predate implementation
3414 of the ISO standard, declarations such as
3415 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3416 could be interpreted as a particular specialization of a template
3417 function; the warning exists to diagnose compatibility problems,
3418 and is enabled by default.
3419
3420 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3421 @opindex Wold-style-cast
3422 @opindex Wno-old-style-cast
3423 Warn if an old-style (C-style) cast to a non-void type is used within
3424 a C++ program. The new-style casts (@code{dynamic_cast},
3425 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3426 less vulnerable to unintended effects and much easier to search for.
3427
3428 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3429 @opindex Woverloaded-virtual
3430 @opindex Wno-overloaded-virtual
3431 @cindex overloaded virtual function, warning
3432 @cindex warning for overloaded virtual function
3433 Warn when a function declaration hides virtual functions from a
3434 base class. For example, in:
3435
3436 @smallexample
3437 struct A @{
3438 virtual void f();
3439 @};
3440
3441 struct B: public A @{
3442 void f(int);
3443 @};
3444 @end smallexample
3445
3446 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3447 like:
3448
3449 @smallexample
3450 B* b;
3451 b->f();
3452 @end smallexample
3453
3454 @noindent
3455 fails to compile.
3456
3457 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3458 @opindex Wno-pmf-conversions
3459 @opindex Wpmf-conversions
3460 Disable the diagnostic for converting a bound pointer to member function
3461 to a plain pointer.
3462
3463 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3464 @opindex Wsign-promo
3465 @opindex Wno-sign-promo
3466 Warn when overload resolution chooses a promotion from unsigned or
3467 enumerated type to a signed type, over a conversion to an unsigned type of
3468 the same size. Previous versions of G++ tried to preserve
3469 unsignedness, but the standard mandates the current behavior.
3470
3471 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3472 @opindex Wtemplates
3473 @opindex Wno-templates
3474 Warn when a primary template declaration is encountered. Some coding
3475 rules disallow templates, and this may be used to enforce that rule.
3476 The warning is inactive inside a system header file, such as the STL, so
3477 one can still use the STL. One may also instantiate or specialize
3478 templates.
3479
3480 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3481 @opindex Wmultiple-inheritance
3482 @opindex Wno-multiple-inheritance
3483 Warn when a class is defined with multiple direct base classes. Some
3484 coding rules disallow multiple inheritance, and this may be used to
3485 enforce that rule. The warning is inactive inside a system header file,
3486 such as the STL, so one can still use the STL. One may also define
3487 classes that indirectly use multiple inheritance.
3488
3489 @item -Wvirtual-inheritance
3490 @opindex Wvirtual-inheritance
3491 @opindex Wno-virtual-inheritance
3492 Warn when a class is defined with a virtual direct base class. Some
3493 coding rules disallow multiple inheritance, and this may be used to
3494 enforce that rule. The warning is inactive inside a system header file,
3495 such as the STL, so one can still use the STL. One may also define
3496 classes that indirectly use virtual inheritance.
3497
3498 @item -Wnamespaces
3499 @opindex Wnamespaces
3500 @opindex Wno-namespaces
3501 Warn when a namespace definition is opened. Some coding rules disallow
3502 namespaces, and this may be used to enforce that rule. The warning is
3503 inactive inside a system header file, such as the STL, so one can still
3504 use the STL. One may also use using directives and qualified names.
3505
3506 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3507 @opindex Wterminate
3508 @opindex Wno-terminate
3509 Disable the warning about a throw-expression that will immediately
3510 result in a call to @code{terminate}.
3511
3512 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3513 @opindex Wno-class-conversion
3514 @opindex Wclass-conversion
3515 Disable the warning about the case when a conversion function converts an
3516 object to the same type, to a base class of that type, or to void; such
3517 a conversion function will never be called.
3518 @end table
3519
3520 @node Objective-C and Objective-C++ Dialect Options
3521 @section Options Controlling Objective-C and Objective-C++ Dialects
3522
3523 @cindex compiler options, Objective-C and Objective-C++
3524 @cindex Objective-C and Objective-C++ options, command-line
3525 @cindex options, Objective-C and Objective-C++
3526 (NOTE: This manual does not describe the Objective-C and Objective-C++
3527 languages themselves. @xref{Standards,,Language Standards
3528 Supported by GCC}, for references.)
3529
3530 This section describes the command-line options that are only meaningful
3531 for Objective-C and Objective-C++ programs. You can also use most of
3532 the language-independent GNU compiler options.
3533 For example, you might compile a file @file{some_class.m} like this:
3534
3535 @smallexample
3536 gcc -g -fgnu-runtime -O -c some_class.m
3537 @end smallexample
3538
3539 @noindent
3540 In this example, @option{-fgnu-runtime} is an option meant only for
3541 Objective-C and Objective-C++ programs; you can use the other options with
3542 any language supported by GCC@.
3543
3544 Note that since Objective-C is an extension of the C language, Objective-C
3545 compilations may also use options specific to the C front-end (e.g.,
3546 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3547 C++-specific options (e.g., @option{-Wabi}).
3548
3549 Here is a list of options that are @emph{only} for compiling Objective-C
3550 and Objective-C++ programs:
3551
3552 @table @gcctabopt
3553 @item -fconstant-string-class=@var{class-name}
3554 @opindex fconstant-string-class
3555 Use @var{class-name} as the name of the class to instantiate for each
3556 literal string specified with the syntax @code{@@"@dots{}"}. The default
3557 class name is @code{NXConstantString} if the GNU runtime is being used, and
3558 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3559 @option{-fconstant-cfstrings} option, if also present, overrides the
3560 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3561 to be laid out as constant CoreFoundation strings.
3562
3563 @item -fgnu-runtime
3564 @opindex fgnu-runtime
3565 Generate object code compatible with the standard GNU Objective-C
3566 runtime. This is the default for most types of systems.
3567
3568 @item -fnext-runtime
3569 @opindex fnext-runtime
3570 Generate output compatible with the NeXT runtime. This is the default
3571 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3572 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3573 used.
3574
3575 @item -fno-nil-receivers
3576 @opindex fno-nil-receivers
3577 @opindex fnil-receivers
3578 Assume that all Objective-C message dispatches (@code{[receiver
3579 message:arg]}) in this translation unit ensure that the receiver is
3580 not @code{nil}. This allows for more efficient entry points in the
3581 runtime to be used. This option is only available in conjunction with
3582 the NeXT runtime and ABI version 0 or 1.
3583
3584 @item -fobjc-abi-version=@var{n}
3585 @opindex fobjc-abi-version
3586 Use version @var{n} of the Objective-C ABI for the selected runtime.
3587 This option is currently supported only for the NeXT runtime. In that
3588 case, Version 0 is the traditional (32-bit) ABI without support for
3589 properties and other Objective-C 2.0 additions. Version 1 is the
3590 traditional (32-bit) ABI with support for properties and other
3591 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3592 nothing is specified, the default is Version 0 on 32-bit target
3593 machines, and Version 2 on 64-bit target machines.
3594
3595 @item -fobjc-call-cxx-cdtors
3596 @opindex fobjc-call-cxx-cdtors
3597 For each Objective-C class, check if any of its instance variables is a
3598 C++ object with a non-trivial default constructor. If so, synthesize a
3599 special @code{- (id) .cxx_construct} instance method which runs
3600 non-trivial default constructors on any such instance variables, in order,
3601 and then return @code{self}. Similarly, check if any instance variable
3602 is a C++ object with a non-trivial destructor, and if so, synthesize a
3603 special @code{- (void) .cxx_destruct} method which runs
3604 all such default destructors, in reverse order.
3605
3606 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3607 methods thusly generated only operate on instance variables
3608 declared in the current Objective-C class, and not those inherited
3609 from superclasses. It is the responsibility of the Objective-C
3610 runtime to invoke all such methods in an object's inheritance
3611 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3612 by the runtime immediately after a new object instance is allocated;
3613 the @code{- (void) .cxx_destruct} methods are invoked immediately
3614 before the runtime deallocates an object instance.
3615
3616 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3617 support for invoking the @code{- (id) .cxx_construct} and
3618 @code{- (void) .cxx_destruct} methods.
3619
3620 @item -fobjc-direct-dispatch
3621 @opindex fobjc-direct-dispatch
3622 Allow fast jumps to the message dispatcher. On Darwin this is
3623 accomplished via the comm page.
3624
3625 @item -fobjc-exceptions
3626 @opindex fobjc-exceptions
3627 Enable syntactic support for structured exception handling in
3628 Objective-C, similar to what is offered by C++. This option
3629 is required to use the Objective-C keywords @code{@@try},
3630 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3631 @code{@@synchronized}. This option is available with both the GNU
3632 runtime and the NeXT runtime (but not available in conjunction with
3633 the NeXT runtime on Mac OS X 10.2 and earlier).
3634
3635 @item -fobjc-gc
3636 @opindex fobjc-gc
3637 Enable garbage collection (GC) in Objective-C and Objective-C++
3638 programs. This option is only available with the NeXT runtime; the
3639 GNU runtime has a different garbage collection implementation that
3640 does not require special compiler flags.
3641
3642 @item -fobjc-nilcheck
3643 @opindex fobjc-nilcheck
3644 For the NeXT runtime with version 2 of the ABI, check for a nil
3645 receiver in method invocations before doing the actual method call.
3646 This is the default and can be disabled using
3647 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3648 checked for nil in this way no matter what this flag is set to.
3649 Currently this flag does nothing when the GNU runtime, or an older
3650 version of the NeXT runtime ABI, is used.
3651
3652 @item -fobjc-std=objc1
3653 @opindex fobjc-std
3654 Conform to the language syntax of Objective-C 1.0, the language
3655 recognized by GCC 4.0. This only affects the Objective-C additions to
3656 the C/C++ language; it does not affect conformance to C/C++ standards,
3657 which is controlled by the separate C/C++ dialect option flags. When
3658 this option is used with the Objective-C or Objective-C++ compiler,
3659 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3660 This is useful if you need to make sure that your Objective-C code can
3661 be compiled with older versions of GCC@.
3662
3663 @item -freplace-objc-classes
3664 @opindex freplace-objc-classes
3665 Emit a special marker instructing @command{ld(1)} not to statically link in
3666 the resulting object file, and allow @command{dyld(1)} to load it in at
3667 run time instead. This is used in conjunction with the Fix-and-Continue
3668 debugging mode, where the object file in question may be recompiled and
3669 dynamically reloaded in the course of program execution, without the need
3670 to restart the program itself. Currently, Fix-and-Continue functionality
3671 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3672 and later.
3673
3674 @item -fzero-link
3675 @opindex fzero-link
3676 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3677 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3678 compile time) with static class references that get initialized at load time,
3679 which improves run-time performance. Specifying the @option{-fzero-link} flag
3680 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3681 to be retained. This is useful in Zero-Link debugging mode, since it allows
3682 for individual class implementations to be modified during program execution.
3683 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3684 regardless of command-line options.
3685
3686 @item -fno-local-ivars
3687 @opindex fno-local-ivars
3688 @opindex flocal-ivars
3689 By default instance variables in Objective-C can be accessed as if
3690 they were local variables from within the methods of the class they're
3691 declared in. This can lead to shadowing between instance variables
3692 and other variables declared either locally inside a class method or
3693 globally with the same name. Specifying the @option{-fno-local-ivars}
3694 flag disables this behavior thus avoiding variable shadowing issues.
3695
3696 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3697 @opindex fivar-visibility
3698 Set the default instance variable visibility to the specified option
3699 so that instance variables declared outside the scope of any access
3700 modifier directives default to the specified visibility.
3701
3702 @item -gen-decls
3703 @opindex gen-decls
3704 Dump interface declarations for all classes seen in the source file to a
3705 file named @file{@var{sourcename}.decl}.
3706
3707 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3708 @opindex Wassign-intercept
3709 @opindex Wno-assign-intercept
3710 Warn whenever an Objective-C assignment is being intercepted by the
3711 garbage collector.
3712
3713 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3714 @opindex Wno-protocol
3715 @opindex Wprotocol
3716 If a class is declared to implement a protocol, a warning is issued for
3717 every method in the protocol that is not implemented by the class. The
3718 default behavior is to issue a warning for every method not explicitly
3719 implemented in the class, even if a method implementation is inherited
3720 from the superclass. If you use the @option{-Wno-protocol} option, then
3721 methods inherited from the superclass are considered to be implemented,
3722 and no warning is issued for them.
3723
3724 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3725 @opindex Wselector
3726 @opindex Wno-selector
3727 Warn if multiple methods of different types for the same selector are
3728 found during compilation. The check is performed on the list of methods
3729 in the final stage of compilation. Additionally, a check is performed
3730 for each selector appearing in a @code{@@selector(@dots{})}
3731 expression, and a corresponding method for that selector has been found
3732 during compilation. Because these checks scan the method table only at
3733 the end of compilation, these warnings are not produced if the final
3734 stage of compilation is not reached, for example because an error is
3735 found during compilation, or because the @option{-fsyntax-only} option is
3736 being used.
3737
3738 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3739 @opindex Wstrict-selector-match
3740 @opindex Wno-strict-selector-match
3741 Warn if multiple methods with differing argument and/or return types are
3742 found for a given selector when attempting to send a message using this
3743 selector to a receiver of type @code{id} or @code{Class}. When this flag
3744 is off (which is the default behavior), the compiler omits such warnings
3745 if any differences found are confined to types that share the same size
3746 and alignment.
3747
3748 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3749 @opindex Wundeclared-selector
3750 @opindex Wno-undeclared-selector
3751 Warn if a @code{@@selector(@dots{})} expression referring to an
3752 undeclared selector is found. A selector is considered undeclared if no
3753 method with that name has been declared before the
3754 @code{@@selector(@dots{})} expression, either explicitly in an
3755 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3756 an @code{@@implementation} section. This option always performs its
3757 checks as soon as a @code{@@selector(@dots{})} expression is found,
3758 while @option{-Wselector} only performs its checks in the final stage of
3759 compilation. This also enforces the coding style convention
3760 that methods and selectors must be declared before being used.
3761
3762 @item -print-objc-runtime-info
3763 @opindex print-objc-runtime-info
3764 Generate C header describing the largest structure that is passed by
3765 value, if any.
3766
3767 @end table
3768
3769 @node Diagnostic Message Formatting Options
3770 @section Options to Control Diagnostic Messages Formatting
3771 @cindex options to control diagnostics formatting
3772 @cindex diagnostic messages
3773 @cindex message formatting
3774
3775 Traditionally, diagnostic messages have been formatted irrespective of
3776 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3777 options described below
3778 to control the formatting algorithm for diagnostic messages,
3779 e.g.@: how many characters per line, how often source location
3780 information should be reported. Note that some language front ends may not
3781 honor these options.
3782
3783 @table @gcctabopt
3784 @item -fmessage-length=@var{n}
3785 @opindex fmessage-length
3786 Try to format error messages so that they fit on lines of about
3787 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3788 done; each error message appears on a single line. This is the
3789 default for all front ends.
3790
3791 Note - this option also affects the display of the @samp{#error} and
3792 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3793 function/type/variable attribute. It does not however affect the
3794 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3795
3796 @item -fdiagnostics-show-location=once
3797 @opindex fdiagnostics-show-location
3798 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3799 reporter to emit source location information @emph{once}; that is, in
3800 case the message is too long to fit on a single physical line and has to
3801 be wrapped, the source location won't be emitted (as prefix) again,
3802 over and over, in subsequent continuation lines. This is the default
3803 behavior.
3804
3805 @item -fdiagnostics-show-location=every-line
3806 Only meaningful in line-wrapping mode. Instructs the diagnostic
3807 messages reporter to emit the same source location information (as
3808 prefix) for physical lines that result from the process of breaking
3809 a message which is too long to fit on a single line.
3810
3811 @item -fdiagnostics-color[=@var{WHEN}]
3812 @itemx -fno-diagnostics-color
3813 @opindex fdiagnostics-color
3814 @cindex highlight, color
3815 @vindex GCC_COLORS @r{environment variable}
3816 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3817 or @samp{auto}. The default depends on how the compiler has been configured,
3818 it can be any of the above @var{WHEN} options or also @samp{never}
3819 if @env{GCC_COLORS} environment variable isn't present in the environment,
3820 and @samp{auto} otherwise.
3821 @samp{auto} means to use color only when the standard error is a terminal.
3822 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3823 aliases for @option{-fdiagnostics-color=always} and
3824 @option{-fdiagnostics-color=never}, respectively.
3825
3826 The colors are defined by the environment variable @env{GCC_COLORS}.
3827 Its value is a colon-separated list of capabilities and Select Graphic
3828 Rendition (SGR) substrings. SGR commands are interpreted by the
3829 terminal or terminal emulator. (See the section in the documentation
3830 of your text terminal for permitted values and their meanings as
3831 character attributes.) These substring values are integers in decimal
3832 representation and can be concatenated with semicolons.
3833 Common values to concatenate include
3834 @samp{1} for bold,
3835 @samp{4} for underline,
3836 @samp{5} for blink,
3837 @samp{7} for inverse,
3838 @samp{39} for default foreground color,
3839 @samp{30} to @samp{37} for foreground colors,
3840 @samp{90} to @samp{97} for 16-color mode foreground colors,
3841 @samp{38;5;0} to @samp{38;5;255}
3842 for 88-color and 256-color modes foreground colors,
3843 @samp{49} for default background color,
3844 @samp{40} to @samp{47} for background colors,
3845 @samp{100} to @samp{107} for 16-color mode background colors,
3846 and @samp{48;5;0} to @samp{48;5;255}
3847 for 88-color and 256-color modes background colors.
3848
3849 The default @env{GCC_COLORS} is
3850 @smallexample
3851 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3852 quote=01:fixit-insert=32:fixit-delete=31:\
3853 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3854 type-diff=01;32
3855 @end smallexample
3856 @noindent
3857 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3858 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3859 @samp{01} is bold, and @samp{31} is red.
3860 Setting @env{GCC_COLORS} to the empty string disables colors.
3861 Supported capabilities are as follows.
3862
3863 @table @code
3864 @item error=
3865 @vindex error GCC_COLORS @r{capability}
3866 SGR substring for error: markers.
3867
3868 @item warning=
3869 @vindex warning GCC_COLORS @r{capability}
3870 SGR substring for warning: markers.
3871
3872 @item note=
3873 @vindex note GCC_COLORS @r{capability}
3874 SGR substring for note: markers.
3875
3876 @item range1=
3877 @vindex range1 GCC_COLORS @r{capability}
3878 SGR substring for first additional range.
3879
3880 @item range2=
3881 @vindex range2 GCC_COLORS @r{capability}
3882 SGR substring for second additional range.
3883
3884 @item locus=
3885 @vindex locus GCC_COLORS @r{capability}
3886 SGR substring for location information, @samp{file:line} or
3887 @samp{file:line:column} etc.
3888
3889 @item quote=
3890 @vindex quote GCC_COLORS @r{capability}
3891 SGR substring for information printed within quotes.
3892
3893 @item fixit-insert=
3894 @vindex fixit-insert GCC_COLORS @r{capability}
3895 SGR substring for fix-it hints suggesting text to
3896 be inserted or replaced.
3897
3898 @item fixit-delete=
3899 @vindex fixit-delete GCC_COLORS @r{capability}
3900 SGR substring for fix-it hints suggesting text to
3901 be deleted.
3902
3903 @item diff-filename=
3904 @vindex diff-filename GCC_COLORS @r{capability}
3905 SGR substring for filename headers within generated patches.
3906
3907 @item diff-hunk=
3908 @vindex diff-hunk GCC_COLORS @r{capability}
3909 SGR substring for the starts of hunks within generated patches.
3910
3911 @item diff-delete=
3912 @vindex diff-delete GCC_COLORS @r{capability}
3913 SGR substring for deleted lines within generated patches.
3914
3915 @item diff-insert=
3916 @vindex diff-insert GCC_COLORS @r{capability}
3917 SGR substring for inserted lines within generated patches.
3918
3919 @item type-diff=
3920 @vindex type-diff GCC_COLORS @r{capability}
3921 SGR substring for highlighting mismatching types within template
3922 arguments in the C++ frontend.
3923 @end table
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 "children": [
4121 @{
4122 "kind": "note",
4123 "locations": [
4124 @{
4125 "caret": @{
4126 "column": 5,
4127 "file": "misleading-indentation.c",
4128 "line": 17
4129 @}
4130 @}
4131 ],
4132 "message": "...this statement, but the latter is @dots{}"
4133 @}
4134 ]
4135 @},
4136 @dots{}
4137 ]
4138 @end smallexample
4139
4140 @noindent
4141 where the @code{note} is a child of the @code{warning}.
4142
4143 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4144 an @code{option} key describing the command-line option controlling the
4145 warning.
4146
4147 A diagnostic can contain zero or more locations. Each location has up
4148 to three positions within it: a @code{caret} position and optional
4149 @code{start} and @code{finish} positions. A location can also have
4150 an optional @code{label} string. For example, this error:
4151
4152 @smallexample
4153 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4154 'struct s'@} and 'T' @{aka 'struct t'@})
4155 64 | return callee_4a () + callee_4b ();
4156 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4157 | | |
4158 | | T @{aka struct t@}
4159 | S @{aka struct s@}
4160 @end smallexample
4161
4162 @noindent
4163 has three locations. Its primary location is at the ``+'' token at column
4164 23. It has two secondary locations, describing the left and right-hand sides
4165 of the expression, which have labels. It might be printed in JSON form as:
4166
4167 @smallexample
4168 @{
4169 "children": [],
4170 "kind": "error",
4171 "locations": [
4172 @{
4173 "caret": @{
4174 "column": 23, "file": "bad-binary-ops.c", "line": 64
4175 @}
4176 @},
4177 @{
4178 "caret": @{
4179 "column": 10, "file": "bad-binary-ops.c", "line": 64
4180 @},
4181 "finish": @{
4182 "column": 21, "file": "bad-binary-ops.c", "line": 64
4183 @},
4184 "label": "S @{aka struct s@}"
4185 @},
4186 @{
4187 "caret": @{
4188 "column": 25, "file": "bad-binary-ops.c", "line": 64
4189 @},
4190 "finish": @{
4191 "column": 36, "file": "bad-binary-ops.c", "line": 64
4192 @},
4193 "label": "T @{aka struct t@}"
4194 @}
4195 ],
4196 "message": "invalid operands to binary + @dots{}"
4197 @}
4198 @end smallexample
4199
4200 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4201 consisting of half-open intervals, similar to the output of
4202 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4203 with a replacement fix-it hint:
4204
4205 @smallexample
4206 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4207 mean 'color'?
4208 8 | return ptr->colour;
4209 | ^~~~~~
4210 | color
4211 @end smallexample
4212
4213 @noindent
4214 might be printed in JSON form as:
4215
4216 @smallexample
4217 @{
4218 "children": [],
4219 "fixits": [
4220 @{
4221 "next": @{
4222 "column": 21,
4223 "file": "demo.c",
4224 "line": 8
4225 @},
4226 "start": @{
4227 "column": 15,
4228 "file": "demo.c",
4229 "line": 8
4230 @},
4231 "string": "color"
4232 @}
4233 ],
4234 "kind": "error",
4235 "locations": [
4236 @{
4237 "caret": @{
4238 "column": 15,
4239 "file": "demo.c",
4240 "line": 8
4241 @},
4242 "finish": @{
4243 "column": 20,
4244 "file": "demo.c",
4245 "line": 8
4246 @}
4247 @}
4248 ],
4249 "message": "\u2018struct s\u2019 has no member named @dots{}"
4250 @}
4251 @end smallexample
4252
4253 @noindent
4254 where the fix-it hint suggests replacing the text from @code{start} up
4255 to but not including @code{next} with @code{string}'s value. Deletions
4256 are expressed via an empty value for @code{string}, insertions by
4257 having @code{start} equal @code{next}.
4258
4259 @end table
4260
4261 @node Warning Options
4262 @section Options to Request or Suppress Warnings
4263 @cindex options to control warnings
4264 @cindex warning messages
4265 @cindex messages, warning
4266 @cindex suppressing warnings
4267
4268 Warnings are diagnostic messages that report constructions that
4269 are not inherently erroneous but that are risky or suggest there
4270 may have been an error.
4271
4272 The following language-independent options do not enable specific
4273 warnings but control the kinds of diagnostics produced by GCC@.
4274
4275 @table @gcctabopt
4276 @cindex syntax checking
4277 @item -fsyntax-only
4278 @opindex fsyntax-only
4279 Check the code for syntax errors, but don't do anything beyond that.
4280
4281 @item -fmax-errors=@var{n}
4282 @opindex fmax-errors
4283 Limits the maximum number of error messages to @var{n}, at which point
4284 GCC bails out rather than attempting to continue processing the source
4285 code. If @var{n} is 0 (the default), there is no limit on the number
4286 of error messages produced. If @option{-Wfatal-errors} is also
4287 specified, then @option{-Wfatal-errors} takes precedence over this
4288 option.
4289
4290 @item -w
4291 @opindex w
4292 Inhibit all warning messages.
4293
4294 @item -Werror
4295 @opindex Werror
4296 @opindex Wno-error
4297 Make all warnings into errors.
4298
4299 @item -Werror=
4300 @opindex Werror=
4301 @opindex Wno-error=
4302 Make the specified warning into an error. The specifier for a warning
4303 is appended; for example @option{-Werror=switch} turns the warnings
4304 controlled by @option{-Wswitch} into errors. This switch takes a
4305 negative form, to be used to negate @option{-Werror} for specific
4306 warnings; for example @option{-Wno-error=switch} makes
4307 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4308 is in effect.
4309
4310 The warning message for each controllable warning includes the
4311 option that controls the warning. That option can then be used with
4312 @option{-Werror=} and @option{-Wno-error=} as described above.
4313 (Printing of the option in the warning message can be disabled using the
4314 @option{-fno-diagnostics-show-option} flag.)
4315
4316 Note that specifying @option{-Werror=}@var{foo} automatically implies
4317 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4318 imply anything.
4319
4320 @item -Wfatal-errors
4321 @opindex Wfatal-errors
4322 @opindex Wno-fatal-errors
4323 This option causes the compiler to abort compilation on the first error
4324 occurred rather than trying to keep going and printing further error
4325 messages.
4326
4327 @end table
4328
4329 You can request many specific warnings with options beginning with
4330 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4331 implicit declarations. Each of these specific warning options also
4332 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4333 example, @option{-Wno-implicit}. This manual lists only one of the
4334 two forms, whichever is not the default. For further
4335 language-specific options also refer to @ref{C++ Dialect Options} and
4336 @ref{Objective-C and Objective-C++ Dialect Options}.
4337
4338 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4339 options, such as @option{-Wunused}, which may turn on further options,
4340 such as @option{-Wunused-value}. The combined effect of positive and
4341 negative forms is that more specific options have priority over less
4342 specific ones, independently of their position in the command-line. For
4343 options of the same specificity, the last one takes effect. Options
4344 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4345 as if they appeared at the end of the command-line.
4346
4347 When an unrecognized warning option is requested (e.g.,
4348 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4349 that the option is not recognized. However, if the @option{-Wno-} form
4350 is used, the behavior is slightly different: no diagnostic is
4351 produced for @option{-Wno-unknown-warning} unless other diagnostics
4352 are being produced. This allows the use of new @option{-Wno-} options
4353 with old compilers, but if something goes wrong, the compiler
4354 warns that an unrecognized option is present.
4355
4356 @table @gcctabopt
4357 @item -Wpedantic
4358 @itemx -pedantic
4359 @opindex pedantic
4360 @opindex Wpedantic
4361 @opindex Wno-pedantic
4362 Issue all the warnings demanded by strict ISO C and ISO C++;
4363 reject all programs that use forbidden extensions, and some other
4364 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4365 version of the ISO C standard specified by any @option{-std} option used.
4366
4367 Valid ISO C and ISO C++ programs should compile properly with or without
4368 this option (though a rare few require @option{-ansi} or a
4369 @option{-std} option specifying the required version of ISO C)@. However,
4370 without this option, certain GNU extensions and traditional C and C++
4371 features are supported as well. With this option, they are rejected.
4372
4373 @option{-Wpedantic} does not cause warning messages for use of the
4374 alternate keywords whose names begin and end with @samp{__}. This alternate
4375 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4376 i.e. @samp{__intN__}.
4377 Pedantic warnings are also disabled in the expression that follows
4378 @code{__extension__}. However, only system header files should use
4379 these escape routes; application programs should avoid them.
4380 @xref{Alternate Keywords}.
4381
4382 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4383 C conformance. They soon find that it does not do quite what they want:
4384 it finds some non-ISO practices, but not all---only those for which
4385 ISO C @emph{requires} a diagnostic, and some others for which
4386 diagnostics have been added.
4387
4388 A feature to report any failure to conform to ISO C might be useful in
4389 some instances, but would require considerable additional work and would
4390 be quite different from @option{-Wpedantic}. We don't have plans to
4391 support such a feature in the near future.
4392
4393 Where the standard specified with @option{-std} represents a GNU
4394 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4395 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4396 extended dialect is based. Warnings from @option{-Wpedantic} are given
4397 where they are required by the base standard. (It does not make sense
4398 for such warnings to be given only for features not in the specified GNU
4399 C dialect, since by definition the GNU dialects of C include all
4400 features the compiler supports with the given option, and there would be
4401 nothing to warn about.)
4402
4403 @item -pedantic-errors
4404 @opindex pedantic-errors
4405 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4406 requires a diagnostic, in some cases where there is undefined behavior
4407 at compile-time and in some other cases that do not prevent compilation
4408 of programs that are valid according to the standard. This is not
4409 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4410 by this option and not enabled by the latter and vice versa.
4411
4412 @item -Wall
4413 @opindex Wall
4414 @opindex Wno-all
4415 This enables all the warnings about constructions that some users
4416 consider questionable, and that are easy to avoid (or modify to
4417 prevent the warning), even in conjunction with macros. This also
4418 enables some language-specific warnings described in @ref{C++ Dialect
4419 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4420
4421 @option{-Wall} turns on the following warning flags:
4422
4423 @gccoptlist{-Waddress @gol
4424 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4425 -Wbool-compare @gol
4426 -Wbool-operation @gol
4427 -Wc++11-compat -Wc++14-compat @gol
4428 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4429 -Wchar-subscripts @gol
4430 -Wcomment @gol
4431 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4432 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4433 -Wformat @gol
4434 -Wint-in-bool-context @gol
4435 -Wimplicit @r{(C and Objective-C only)} @gol
4436 -Wimplicit-int @r{(C and Objective-C only)} @gol
4437 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4438 -Winit-self @r{(only for C++)} @gol
4439 -Wlogical-not-parentheses @gol
4440 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4441 -Wmaybe-uninitialized @gol
4442 -Wmemset-elt-size @gol
4443 -Wmemset-transposed-args @gol
4444 -Wmisleading-indentation @r{(only for C/C++)} @gol
4445 -Wmissing-attributes @gol
4446 -Wmissing-braces @r{(only for C/ObjC)} @gol
4447 -Wmultistatement-macros @gol
4448 -Wnarrowing @r{(only for C++)} @gol
4449 -Wnonnull @gol
4450 -Wnonnull-compare @gol
4451 -Wopenmp-simd @gol
4452 -Wparentheses @gol
4453 -Wpessimizing-move @r{(only for C++)} @gol
4454 -Wpointer-sign @gol
4455 -Wreorder @gol
4456 -Wrestrict @gol
4457 -Wreturn-type @gol
4458 -Wsequence-point @gol
4459 -Wsign-compare @r{(only in C++)} @gol
4460 -Wsizeof-pointer-div @gol
4461 -Wsizeof-pointer-memaccess @gol
4462 -Wstrict-aliasing @gol
4463 -Wstrict-overflow=1 @gol
4464 -Wswitch @gol
4465 -Wtautological-compare @gol
4466 -Wtrigraphs @gol
4467 -Wuninitialized @gol
4468 -Wunknown-pragmas @gol
4469 -Wunused-function @gol
4470 -Wunused-label @gol
4471 -Wunused-value @gol
4472 -Wunused-variable @gol
4473 -Wvolatile-register-var}
4474
4475 Note that some warning flags are not implied by @option{-Wall}. Some of
4476 them warn about constructions that users generally do not consider
4477 questionable, but which occasionally you might wish to check for;
4478 others warn about constructions that are necessary or hard to avoid in
4479 some cases, and there is no simple way to modify the code to suppress
4480 the warning. Some of them are enabled by @option{-Wextra} but many of
4481 them must be enabled individually.
4482
4483 @item -Wextra
4484 @opindex W
4485 @opindex Wextra
4486 @opindex Wno-extra
4487 This enables some extra warning flags that are not enabled by
4488 @option{-Wall}. (This option used to be called @option{-W}. The older
4489 name is still supported, but the newer name is more descriptive.)
4490
4491 @gccoptlist{-Wclobbered @gol
4492 -Wcast-function-type @gol
4493 -Wdeprecated-copy @r{(C++ only)} @gol
4494 -Wempty-body @gol
4495 -Wignored-qualifiers @gol
4496 -Wimplicit-fallthrough=3 @gol
4497 -Wmissing-field-initializers @gol
4498 -Wmissing-parameter-type @r{(C only)} @gol
4499 -Wold-style-declaration @r{(C only)} @gol
4500 -Woverride-init @gol
4501 -Wsign-compare @r{(C only)} @gol
4502 -Wredundant-move @r{(only for C++)} @gol
4503 -Wtype-limits @gol
4504 -Wuninitialized @gol
4505 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4506 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4507 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4508
4509
4510 The option @option{-Wextra} also prints warning messages for the
4511 following cases:
4512
4513 @itemize @bullet
4514
4515 @item
4516 A pointer is compared against integer zero with @code{<}, @code{<=},
4517 @code{>}, or @code{>=}.
4518
4519 @item
4520 (C++ only) An enumerator and a non-enumerator both appear in a
4521 conditional expression.
4522
4523 @item
4524 (C++ only) Ambiguous virtual bases.
4525
4526 @item
4527 (C++ only) Subscripting an array that has been declared @code{register}.
4528
4529 @item
4530 (C++ only) Taking the address of a variable that has been declared
4531 @code{register}.
4532
4533 @item
4534 (C++ only) A base class is not initialized in the copy constructor
4535 of a derived class.
4536
4537 @end itemize
4538
4539 @item -Wchar-subscripts
4540 @opindex Wchar-subscripts
4541 @opindex Wno-char-subscripts
4542 Warn if an array subscript has type @code{char}. This is a common cause
4543 of error, as programmers often forget that this type is signed on some
4544 machines.
4545 This warning is enabled by @option{-Wall}.
4546
4547 @item -Wno-coverage-mismatch
4548 @opindex Wno-coverage-mismatch
4549 @opindex Wcoverage-mismatch
4550 Warn if feedback profiles do not match when using the
4551 @option{-fprofile-use} option.
4552 If a source file is changed between compiling with @option{-fprofile-generate}
4553 and with @option{-fprofile-use}, the files with the profile feedback can fail
4554 to match the source file and GCC cannot use the profile feedback
4555 information. By default, this warning is enabled and is treated as an
4556 error. @option{-Wno-coverage-mismatch} can be used to disable the
4557 warning or @option{-Wno-error=coverage-mismatch} can be used to
4558 disable the error. Disabling the error for this warning can result in
4559 poorly optimized code and is useful only in the
4560 case of very minor changes such as bug fixes to an existing code-base.
4561 Completely disabling the warning is not recommended.
4562
4563 @item -Wno-cpp
4564 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4565
4566 Suppress warning messages emitted by @code{#warning} directives.
4567
4568 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4569 @opindex Wdouble-promotion
4570 @opindex Wno-double-promotion
4571 Give a warning when a value of type @code{float} is implicitly
4572 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4573 floating-point unit implement @code{float} in hardware, but emulate
4574 @code{double} in software. On such a machine, doing computations
4575 using @code{double} values is much more expensive because of the
4576 overhead required for software emulation.
4577
4578 It is easy to accidentally do computations with @code{double} because
4579 floating-point literals are implicitly of type @code{double}. For
4580 example, in:
4581 @smallexample
4582 @group
4583 float area(float radius)
4584 @{
4585 return 3.14159 * radius * radius;
4586 @}
4587 @end group
4588 @end smallexample
4589 the compiler performs the entire computation with @code{double}
4590 because the floating-point literal is a @code{double}.
4591
4592 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4593 @opindex Wduplicate-decl-specifier
4594 @opindex Wno-duplicate-decl-specifier
4595 Warn if a declaration has duplicate @code{const}, @code{volatile},
4596 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4597 @option{-Wall}.
4598
4599 @item -Wformat
4600 @itemx -Wformat=@var{n}
4601 @opindex Wformat
4602 @opindex Wno-format
4603 @opindex ffreestanding
4604 @opindex fno-builtin
4605 @opindex Wformat=
4606 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4607 the arguments supplied have types appropriate to the format string
4608 specified, and that the conversions specified in the format string make
4609 sense. This includes standard functions, and others specified by format
4610 attributes (@pxref{Function Attributes}), in the @code{printf},
4611 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4612 not in the C standard) families (or other target-specific families).
4613 Which functions are checked without format attributes having been
4614 specified depends on the standard version selected, and such checks of
4615 functions without the attribute specified are disabled by
4616 @option{-ffreestanding} or @option{-fno-builtin}.
4617
4618 The formats are checked against the format features supported by GNU
4619 libc version 2.2. These include all ISO C90 and C99 features, as well
4620 as features from the Single Unix Specification and some BSD and GNU
4621 extensions. Other library implementations may not support all these
4622 features; GCC does not support warning about features that go beyond a
4623 particular library's limitations. However, if @option{-Wpedantic} is used
4624 with @option{-Wformat}, warnings are given about format features not
4625 in the selected standard version (but not for @code{strfmon} formats,
4626 since those are not in any version of the C standard). @xref{C Dialect
4627 Options,,Options Controlling C Dialect}.
4628
4629 @table @gcctabopt
4630 @item -Wformat=1
4631 @itemx -Wformat
4632 @opindex Wformat
4633 @opindex Wformat=1
4634 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4635 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4636 @option{-Wformat} also checks for null format arguments for several
4637 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4638 aspects of this level of format checking can be disabled by the
4639 options: @option{-Wno-format-contains-nul},
4640 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4641 @option{-Wformat} is enabled by @option{-Wall}.
4642
4643 @item -Wno-format-contains-nul
4644 @opindex Wno-format-contains-nul
4645 @opindex Wformat-contains-nul
4646 If @option{-Wformat} is specified, do not warn about format strings that
4647 contain NUL bytes.
4648
4649 @item -Wno-format-extra-args
4650 @opindex Wno-format-extra-args
4651 @opindex Wformat-extra-args
4652 If @option{-Wformat} is specified, do not warn about excess arguments to a
4653 @code{printf} or @code{scanf} format function. The C standard specifies
4654 that such arguments are ignored.
4655
4656 Where the unused arguments lie between used arguments that are
4657 specified with @samp{$} operand number specifications, normally
4658 warnings are still given, since the implementation could not know what
4659 type to pass to @code{va_arg} to skip the unused arguments. However,
4660 in the case of @code{scanf} formats, this option suppresses the
4661 warning if the unused arguments are all pointers, since the Single
4662 Unix Specification says that such unused arguments are allowed.
4663
4664 @item -Wformat-overflow
4665 @itemx -Wformat-overflow=@var{level}
4666 @opindex Wformat-overflow
4667 @opindex Wno-format-overflow
4668 Warn about calls to formatted input/output functions such as @code{sprintf}
4669 and @code{vsprintf} that might overflow the destination buffer. When the
4670 exact number of bytes written by a format directive cannot be determined
4671 at compile-time it is estimated based on heuristics that depend on the
4672 @var{level} argument and on optimization. While enabling optimization
4673 will in most cases improve the accuracy of the warning, it may also
4674 result in false positives.
4675
4676 @table @gcctabopt
4677 @item -Wformat-overflow
4678 @itemx -Wformat-overflow=1
4679 @opindex Wformat-overflow
4680 @opindex Wno-format-overflow
4681 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4682 employs a conservative approach that warns only about calls that most
4683 likely overflow the buffer. At this level, numeric arguments to format
4684 directives with unknown values are assumed to have the value of one, and
4685 strings of unknown length to be empty. Numeric arguments that are known
4686 to be bounded to a subrange of their type, or string arguments whose output
4687 is bounded either by their directive's precision or by a finite set of
4688 string literals, are assumed to take on the value within the range that
4689 results in the most bytes on output. For example, the call to @code{sprintf}
4690 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4691 the terminating NUL character (@code{'\0'}) appended by the function
4692 to the destination buffer will be written past its end. Increasing
4693 the size of the buffer by a single byte is sufficient to avoid the
4694 warning, though it may not be sufficient to avoid the overflow.
4695
4696 @smallexample
4697 void f (int a, int b)
4698 @{
4699 char buf [13];
4700 sprintf (buf, "a = %i, b = %i\n", a, b);
4701 @}
4702 @end smallexample
4703
4704 @item -Wformat-overflow=2
4705 Level @var{2} warns also about calls that might overflow the destination
4706 buffer given an argument of sufficient length or magnitude. At level
4707 @var{2}, unknown numeric arguments are assumed to have the minimum
4708 representable value for signed types with a precision greater than 1, and
4709 the maximum representable value otherwise. Unknown string arguments whose
4710 length cannot be assumed to be bounded either by the directive's precision,
4711 or by a finite set of string literals they may evaluate to, or the character
4712 array they may point to, are assumed to be 1 character long.
4713
4714 At level @var{2}, the call in the example above is again diagnosed, but
4715 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4716 @code{%i} directive will write some of its digits beyond the end of
4717 the destination buffer. To make the call safe regardless of the values
4718 of the two variables, the size of the destination buffer must be increased
4719 to at least 34 bytes. GCC includes the minimum size of the buffer in
4720 an informational note following the warning.
4721
4722 An alternative to increasing the size of the destination buffer is to
4723 constrain the range of formatted values. The maximum length of string
4724 arguments can be bounded by specifying the precision in the format
4725 directive. When numeric arguments of format directives can be assumed
4726 to be bounded by less than the precision of their type, choosing
4727 an appropriate length modifier to the format specifier will reduce
4728 the required buffer size. For example, if @var{a} and @var{b} in the
4729 example above can be assumed to be within the precision of
4730 the @code{short int} type then using either the @code{%hi} format
4731 directive or casting the argument to @code{short} reduces the maximum
4732 required size of the buffer to 24 bytes.
4733
4734 @smallexample
4735 void f (int a, int b)
4736 @{
4737 char buf [23];
4738 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4739 @}
4740 @end smallexample
4741 @end table
4742
4743 @item -Wno-format-zero-length
4744 @opindex Wno-format-zero-length
4745 @opindex Wformat-zero-length
4746 If @option{-Wformat} is specified, do not warn about zero-length formats.
4747 The C standard specifies that zero-length formats are allowed.
4748
4749
4750 @item -Wformat=2
4751 @opindex Wformat=2
4752 Enable @option{-Wformat} plus additional format checks. Currently
4753 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4754 -Wformat-y2k}.
4755
4756 @item -Wformat-nonliteral
4757 @opindex Wformat-nonliteral
4758 @opindex Wno-format-nonliteral
4759 If @option{-Wformat} is specified, also warn if the format string is not a
4760 string literal and so cannot be checked, unless the format function
4761 takes its format arguments as a @code{va_list}.
4762
4763 @item -Wformat-security
4764 @opindex Wformat-security
4765 @opindex Wno-format-security
4766 If @option{-Wformat} is specified, also warn about uses of format
4767 functions that represent possible security problems. At present, this
4768 warns about calls to @code{printf} and @code{scanf} functions where the
4769 format string is not a string literal and there are no format arguments,
4770 as in @code{printf (foo);}. This may be a security hole if the format
4771 string came from untrusted input and contains @samp{%n}. (This is
4772 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4773 in future warnings may be added to @option{-Wformat-security} that are not
4774 included in @option{-Wformat-nonliteral}.)
4775
4776 @item -Wformat-signedness
4777 @opindex Wformat-signedness
4778 @opindex Wno-format-signedness
4779 If @option{-Wformat} is specified, also warn if the format string
4780 requires an unsigned argument and the argument is signed and vice versa.
4781
4782 @item -Wformat-truncation
4783 @itemx -Wformat-truncation=@var{level}
4784 @opindex Wformat-truncation
4785 @opindex Wno-format-truncation
4786 Warn about calls to formatted input/output functions such as @code{snprintf}
4787 and @code{vsnprintf} that might result in output truncation. When the exact
4788 number of bytes written by a format directive cannot be determined at
4789 compile-time it is estimated based on heuristics that depend on
4790 the @var{level} argument and on optimization. While enabling optimization
4791 will in most cases improve the accuracy of the warning, it may also result
4792 in false positives. Except as noted otherwise, the option uses the same
4793 logic @option{-Wformat-overflow}.
4794
4795 @table @gcctabopt
4796 @item -Wformat-truncation
4797 @itemx -Wformat-truncation=1
4798 @opindex Wformat-truncation
4799 @opindex Wno-format-truncation
4800 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4801 employs a conservative approach that warns only about calls to bounded
4802 functions whose return value is unused and that will most likely result
4803 in output truncation.
4804
4805 @item -Wformat-truncation=2
4806 Level @var{2} warns also about calls to bounded functions whose return
4807 value is used and that might result in truncation given an argument of
4808 sufficient length or magnitude.
4809 @end table
4810
4811 @item -Wformat-y2k
4812 @opindex Wformat-y2k
4813 @opindex Wno-format-y2k
4814 If @option{-Wformat} is specified, also warn about @code{strftime}
4815 formats that may yield only a two-digit year.
4816 @end table
4817
4818 @item -Wnonnull
4819 @opindex Wnonnull
4820 @opindex Wno-nonnull
4821 Warn about passing a null pointer for arguments marked as
4822 requiring a non-null value by the @code{nonnull} function attribute.
4823
4824 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4825 can be disabled with the @option{-Wno-nonnull} option.
4826
4827 @item -Wnonnull-compare
4828 @opindex Wnonnull-compare
4829 @opindex Wno-nonnull-compare
4830 Warn when comparing an argument marked with the @code{nonnull}
4831 function attribute against null inside the function.
4832
4833 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4834 can be disabled with the @option{-Wno-nonnull-compare} option.
4835
4836 @item -Wnull-dereference
4837 @opindex Wnull-dereference
4838 @opindex Wno-null-dereference
4839 Warn if the compiler detects paths that trigger erroneous or
4840 undefined behavior due to dereferencing a null pointer. This option
4841 is only active when @option{-fdelete-null-pointer-checks} is active,
4842 which is enabled by optimizations in most targets. The precision of
4843 the warnings depends on the optimization options used.
4844
4845 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4846 @opindex Winaccessible-base
4847 @opindex Wno-inaccessible-base
4848 Warn when a base class is inaccessible in a class derived from it due to
4849 ambiguity. The warning is enabled by default. Note the warning for virtual
4850 bases is enabled by the @option{-Wextra} option.
4851 @smallexample
4852 @group
4853 struct A @{ int a; @};
4854
4855 struct B : A @{ @};
4856
4857 struct C : B, A @{ @};
4858 @end group
4859 @end smallexample
4860
4861 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4862 @opindex Winit-self
4863 @opindex Wno-init-self
4864 Warn about uninitialized variables that are initialized with themselves.
4865 Note this option can only be used with the @option{-Wuninitialized} option.
4866
4867 For example, GCC warns about @code{i} being uninitialized in the
4868 following snippet only when @option{-Winit-self} has been specified:
4869 @smallexample
4870 @group
4871 int f()
4872 @{
4873 int i = i;
4874 return i;
4875 @}
4876 @end group
4877 @end smallexample
4878
4879 This warning is enabled by @option{-Wall} in C++.
4880
4881 @item -Wimplicit-int @r{(C and Objective-C only)}
4882 @opindex Wimplicit-int
4883 @opindex Wno-implicit-int
4884 Warn when a declaration does not specify a type.
4885 This warning is enabled by @option{-Wall}.
4886
4887 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4888 @opindex Wimplicit-function-declaration
4889 @opindex Wno-implicit-function-declaration
4890 Give a warning whenever a function is used before being declared. In
4891 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4892 enabled by default and it is made into an error by
4893 @option{-pedantic-errors}. This warning is also enabled by
4894 @option{-Wall}.
4895
4896 @item -Wimplicit @r{(C and Objective-C only)}
4897 @opindex Wimplicit
4898 @opindex Wno-implicit
4899 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4900 This warning is enabled by @option{-Wall}.
4901
4902 @item -Wimplicit-fallthrough
4903 @opindex Wimplicit-fallthrough
4904 @opindex Wno-implicit-fallthrough
4905 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4906 and @option{-Wno-implicit-fallthrough} is the same as
4907 @option{-Wimplicit-fallthrough=0}.
4908
4909 @item -Wimplicit-fallthrough=@var{n}
4910 @opindex Wimplicit-fallthrough=
4911 Warn when a switch case falls through. For example:
4912
4913 @smallexample
4914 @group
4915 switch (cond)
4916 @{
4917 case 1:
4918 a = 1;
4919 break;
4920 case 2:
4921 a = 2;
4922 case 3:
4923 a = 3;
4924 break;
4925 @}
4926 @end group
4927 @end smallexample
4928
4929 This warning does not warn when the last statement of a case cannot
4930 fall through, e.g. when there is a return statement or a call to function
4931 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4932 also takes into account control flow statements, such as ifs, and only
4933 warns when appropriate. E.g.@:
4934
4935 @smallexample
4936 @group
4937 switch (cond)
4938 @{
4939 case 1:
4940 if (i > 3) @{
4941 bar (5);
4942 break;
4943 @} else if (i < 1) @{
4944 bar (0);
4945 @} else
4946 return;
4947 default:
4948 @dots{}
4949 @}
4950 @end group
4951 @end smallexample
4952
4953 Since there are occasions where a switch case fall through is desirable,
4954 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4955 to be used along with a null statement to suppress this warning that
4956 would normally occur:
4957
4958 @smallexample
4959 @group
4960 switch (cond)
4961 @{
4962 case 1:
4963 bar (0);
4964 __attribute__ ((fallthrough));
4965 default:
4966 @dots{}
4967 @}
4968 @end group
4969 @end smallexample
4970
4971 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4972 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4973 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4974 Instead of these attributes, it is also possible to add a fallthrough comment
4975 to silence the warning. The whole body of the C or C++ style comment should
4976 match the given regular expressions listed below. The option argument @var{n}
4977 specifies what kind of comments are accepted:
4978
4979 @itemize @bullet
4980
4981 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4982
4983 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4984 expression, any comment is used as fallthrough comment.
4985
4986 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4987 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4988
4989 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4990 following regular expressions:
4991
4992 @itemize @bullet
4993
4994 @item @code{-fallthrough}
4995
4996 @item @code{@@fallthrough@@}
4997
4998 @item @code{lint -fallthrough[ \t]*}
4999
5000 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
5001
5002 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5003
5004 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5005
5006 @end itemize
5007
5008 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
5009 following regular expressions:
5010
5011 @itemize @bullet
5012
5013 @item @code{-fallthrough}
5014
5015 @item @code{@@fallthrough@@}
5016
5017 @item @code{lint -fallthrough[ \t]*}
5018
5019 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5020
5021 @end itemize
5022
5023 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5024 fallthrough comments, only attributes disable the warning.
5025
5026 @end itemize
5027
5028 The comment needs to be followed after optional whitespace and other comments
5029 by @code{case} or @code{default} keywords or by a user label that precedes some
5030 @code{case} or @code{default} label.
5031
5032 @smallexample
5033 @group
5034 switch (cond)
5035 @{
5036 case 1:
5037 bar (0);
5038 /* FALLTHRU */
5039 default:
5040 @dots{}
5041 @}
5042 @end group
5043 @end smallexample
5044
5045 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5046
5047 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5048 @opindex Wif-not-aligned
5049 @opindex Wno-if-not-aligned
5050 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5051 should be issued. This is enabled by default.
5052 Use @option{-Wno-if-not-aligned} to disable it.
5053
5054 @item -Wignored-qualifiers @r{(C and C++ only)}
5055 @opindex Wignored-qualifiers
5056 @opindex Wno-ignored-qualifiers
5057 Warn if the return type of a function has a type qualifier
5058 such as @code{const}. For ISO C such a type qualifier has no effect,
5059 since the value returned by a function is not an lvalue.
5060 For C++, the warning is only emitted for scalar types or @code{void}.
5061 ISO C prohibits qualified @code{void} return types on function
5062 definitions, so such return types always receive a warning
5063 even without this option.
5064
5065 This warning is also enabled by @option{-Wextra}.
5066
5067 @item -Wignored-attributes @r{(C and C++ only)}
5068 @opindex Wignored-attributes
5069 @opindex Wno-ignored-attributes
5070 Warn when an attribute is ignored. This is different from the
5071 @option{-Wattributes} option in that it warns whenever the compiler decides
5072 to drop an attribute, not that the attribute is either unknown, used in a
5073 wrong place, etc. This warning is enabled by default.
5074
5075 @item -Wmain
5076 @opindex Wmain
5077 @opindex Wno-main
5078 Warn if the type of @code{main} is suspicious. @code{main} should be
5079 a function with external linkage, returning int, taking either zero
5080 arguments, two, or three arguments of appropriate types. This warning
5081 is enabled by default in C++ and is enabled by either @option{-Wall}
5082 or @option{-Wpedantic}.
5083
5084 @item -Wmisleading-indentation @r{(C and C++ only)}
5085 @opindex Wmisleading-indentation
5086 @opindex Wno-misleading-indentation
5087 Warn when the indentation of the code does not reflect the block structure.
5088 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5089 @code{for} clauses with a guarded statement that does not use braces,
5090 followed by an unguarded statement with the same indentation.
5091
5092 In the following example, the call to ``bar'' is misleadingly indented as
5093 if it were guarded by the ``if'' conditional.
5094
5095 @smallexample
5096 if (some_condition ())
5097 foo ();
5098 bar (); /* Gotcha: this is not guarded by the "if". */
5099 @end smallexample
5100
5101 In the case of mixed tabs and spaces, the warning uses the
5102 @option{-ftabstop=} option to determine if the statements line up
5103 (defaulting to 8).
5104
5105 The warning is not issued for code involving multiline preprocessor logic
5106 such as the following example.
5107
5108 @smallexample
5109 if (flagA)
5110 foo (0);
5111 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5112 if (flagB)
5113 #endif
5114 foo (1);
5115 @end smallexample
5116
5117 The warning is not issued after a @code{#line} directive, since this
5118 typically indicates autogenerated code, and no assumptions can be made
5119 about the layout of the file that the directive references.
5120
5121 This warning is enabled by @option{-Wall} in C and C++.
5122
5123 @item -Wmissing-attributes
5124 @opindex Wmissing-attributes
5125 @opindex Wno-missing-attributes
5126 Warn when a declaration of a function is missing one or more attributes
5127 that a related function is declared with and whose absence may adversely
5128 affect the correctness or efficiency of generated code. For example,
5129 the warning is issued for declarations of aliases that use attributes
5130 to specify less restrictive requirements than those of their targets.
5131 This typically represents a potential optimization opportunity.
5132 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5133 issued when the alias is more restrictive than the target, which could
5134 lead to incorrect code generation.
5135 Attributes considered include @code{alloc_align}, @code{alloc_size},
5136 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5137 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5138 @code{returns_nonnull}, and @code{returns_twice}.
5139
5140 In C++, the warning is issued when an explicit specialization of a primary
5141 template declared with attribute @code{alloc_align}, @code{alloc_size},
5142 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5143 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5144 @code{error}, and @code{warning} suppress the warning.
5145 (@pxref{Function Attributes}).
5146
5147 You can use the @code{copy} attribute to apply the same
5148 set of attributes to a declaration as that on another declaration without
5149 explicitly enumerating the attributes. This attribute can be applied
5150 to declarations of functions (@pxref{Common Function Attributes}),
5151 variables (@pxref{Common Variable Attributes}), or types
5152 (@pxref{Common Type Attributes}).
5153
5154 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5155
5156 For example, since the declaration of the primary function template
5157 below makes use of both attribute @code{malloc} and @code{alloc_size}
5158 the declaration of the explicit specialization of the template is
5159 diagnosed because it is missing one of the attributes.
5160
5161 @smallexample
5162 template <class T>
5163 T* __attribute__ ((malloc, alloc_size (1)))
5164 allocate (size_t);
5165
5166 template <>
5167 void* __attribute__ ((malloc)) // missing alloc_size
5168 allocate<void> (size_t);
5169 @end smallexample
5170
5171 @item -Wmissing-braces
5172 @opindex Wmissing-braces
5173 @opindex Wno-missing-braces
5174 Warn if an aggregate or union initializer is not fully bracketed. In
5175 the following example, the initializer for @code{a} is not fully
5176 bracketed, but that for @code{b} is fully bracketed. This warning is
5177 enabled by @option{-Wall} in C.
5178
5179 @smallexample
5180 int a[2][2] = @{ 0, 1, 2, 3 @};
5181 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5182 @end smallexample
5183
5184 This warning is enabled by @option{-Wall}.
5185
5186 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5187 @opindex Wmissing-include-dirs
5188 @opindex Wno-missing-include-dirs
5189 Warn if a user-supplied include directory does not exist.
5190
5191 @item -Wmissing-profile
5192 @opindex Wmissing-profile
5193 @opindex Wno-missing-profile
5194 Warn if feedback profiles are missing when using the
5195 @option{-fprofile-use} option.
5196 This option diagnoses those cases where a new function or a new file is added
5197 to the user code between compiling with @option{-fprofile-generate} and with
5198 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5199 profile feedback data files do not contain any profile feedback information for
5200 the newly added function or file respectively. Also, in the case when profile
5201 count data (.gcda) files are removed, GCC cannot use any profile feedback
5202 information. In all these cases, warnings are issued to inform the user that a
5203 profile generation step is due. @option{-Wno-missing-profile} can be used to
5204 disable the warning. Ignoring the warning can result in poorly optimized code.
5205 Completely disabling the warning is not recommended and should be done only
5206 when non-existent profile data is justified.
5207
5208 @item -Wmultistatement-macros
5209 @opindex Wmultistatement-macros
5210 @opindex Wno-multistatement-macros
5211 Warn about unsafe multiple statement macros that appear to be guarded
5212 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5213 @code{while}, in which only the first statement is actually guarded after
5214 the macro is expanded.
5215
5216 For example:
5217
5218 @smallexample
5219 #define DOIT x++; y++
5220 if (c)
5221 DOIT;
5222 @end smallexample
5223
5224 will increment @code{y} unconditionally, not just when @code{c} holds.
5225 The can usually be fixed by wrapping the macro in a do-while loop:
5226 @smallexample
5227 #define DOIT do @{ x++; y++; @} while (0)
5228 if (c)
5229 DOIT;
5230 @end smallexample
5231
5232 This warning is enabled by @option{-Wall} in C and C++.
5233
5234 @item -Wparentheses
5235 @opindex Wparentheses
5236 @opindex Wno-parentheses
5237 Warn if parentheses are omitted in certain contexts, such
5238 as when there is an assignment in a context where a truth value
5239 is expected, or when operators are nested whose precedence people
5240 often get confused about.
5241
5242 Also warn if a comparison like @code{x<=y<=z} appears; this is
5243 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5244 interpretation from that of ordinary mathematical notation.
5245
5246 Also warn for dangerous uses of the GNU extension to
5247 @code{?:} with omitted middle operand. When the condition
5248 in the @code{?}: operator is a boolean expression, the omitted value is
5249 always 1. Often programmers expect it to be a value computed
5250 inside the conditional expression instead.
5251
5252 For C++ this also warns for some cases of unnecessary parentheses in
5253 declarations, which can indicate an attempt at a function call instead
5254 of a declaration:
5255 @smallexample
5256 @{
5257 // Declares a local variable called mymutex.
5258 std::unique_lock<std::mutex> (mymutex);
5259 // User meant std::unique_lock<std::mutex> lock (mymutex);
5260 @}
5261 @end smallexample
5262
5263 This warning is enabled by @option{-Wall}.
5264
5265 @item -Wsequence-point
5266 @opindex Wsequence-point
5267 @opindex Wno-sequence-point
5268 Warn about code that may have undefined semantics because of violations
5269 of sequence point rules in the C and C++ standards.
5270
5271 The C and C++ standards define the order in which expressions in a C/C++
5272 program are evaluated in terms of @dfn{sequence points}, which represent
5273 a partial ordering between the execution of parts of the program: those
5274 executed before the sequence point, and those executed after it. These
5275 occur after the evaluation of a full expression (one which is not part
5276 of a larger expression), after the evaluation of the first operand of a
5277 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5278 function is called (but after the evaluation of its arguments and the
5279 expression denoting the called function), and in certain other places.
5280 Other than as expressed by the sequence point rules, the order of
5281 evaluation of subexpressions of an expression is not specified. All
5282 these rules describe only a partial order rather than a total order,
5283 since, for example, if two functions are called within one expression
5284 with no sequence point between them, the order in which the functions
5285 are called is not specified. However, the standards committee have
5286 ruled that function calls do not overlap.
5287
5288 It is not specified when between sequence points modifications to the
5289 values of objects take effect. Programs whose behavior depends on this
5290 have undefined behavior; the C and C++ standards specify that ``Between
5291 the previous and next sequence point an object shall have its stored
5292 value modified at most once by the evaluation of an expression.
5293 Furthermore, the prior value shall be read only to determine the value
5294 to be stored.''. If a program breaks these rules, the results on any
5295 particular implementation are entirely unpredictable.
5296
5297 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5298 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5299 diagnosed by this option, and it may give an occasional false positive
5300 result, but in general it has been found fairly effective at detecting
5301 this sort of problem in programs.
5302
5303 The C++17 standard will define the order of evaluation of operands in
5304 more cases: in particular it requires that the right-hand side of an
5305 assignment be evaluated before the left-hand side, so the above
5306 examples are no longer undefined. But this warning will still warn
5307 about them, to help people avoid writing code that is undefined in C
5308 and earlier revisions of C++.
5309
5310 The standard is worded confusingly, therefore there is some debate
5311 over the precise meaning of the sequence point rules in subtle cases.
5312 Links to discussions of the problem, including proposed formal
5313 definitions, may be found on the GCC readings page, at
5314 @uref{http://gcc.gnu.org/@/readings.html}.
5315
5316 This warning is enabled by @option{-Wall} for C and C++.
5317
5318 @item -Wno-return-local-addr
5319 @opindex Wno-return-local-addr
5320 @opindex Wreturn-local-addr
5321 Do not warn about returning a pointer (or in C++, a reference) to a
5322 variable that goes out of scope after the function returns.
5323
5324 @item -Wreturn-type
5325 @opindex Wreturn-type
5326 @opindex Wno-return-type
5327 Warn whenever a function is defined with a return type that defaults
5328 to @code{int}. Also warn about any @code{return} statement with no
5329 return value in a function whose return type is not @code{void}
5330 (falling off the end of the function body is considered returning
5331 without a value).
5332
5333 For C only, warn about a @code{return} statement with an expression in a
5334 function whose return type is @code{void}, unless the expression type is
5335 also @code{void}. As a GNU extension, the latter case is accepted
5336 without a warning unless @option{-Wpedantic} is used. Attempting
5337 to use the return value of a non-@code{void} function other than @code{main}
5338 that flows off the end by reaching the closing curly brace that terminates
5339 the function is undefined.
5340
5341 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5342 than @code{main} results in undefined behavior even when the value of
5343 the function is not used.
5344
5345 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5346
5347 @item -Wshift-count-negative
5348 @opindex Wshift-count-negative
5349 @opindex Wno-shift-count-negative
5350 Warn if shift count is negative. This warning is enabled by default.
5351
5352 @item -Wshift-count-overflow
5353 @opindex Wshift-count-overflow
5354 @opindex Wno-shift-count-overflow
5355 Warn if shift count >= width of type. This warning is enabled by default.
5356
5357 @item -Wshift-negative-value
5358 @opindex Wshift-negative-value
5359 @opindex Wno-shift-negative-value
5360 Warn if left shifting a negative value. This warning is enabled by
5361 @option{-Wextra} in C99 and C++11 modes (and newer).
5362
5363 @item -Wshift-overflow
5364 @itemx -Wshift-overflow=@var{n}
5365 @opindex Wshift-overflow
5366 @opindex Wno-shift-overflow
5367 Warn about left shift overflows. This warning is enabled by
5368 default in C99 and C++11 modes (and newer).
5369
5370 @table @gcctabopt
5371 @item -Wshift-overflow=1
5372 This is the warning level of @option{-Wshift-overflow} and is enabled
5373 by default in C99 and C++11 modes (and newer). This warning level does
5374 not warn about left-shifting 1 into the sign bit. (However, in C, such
5375 an overflow is still rejected in contexts where an integer constant expression
5376 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5377 shifts always wrap.
5378
5379 @item -Wshift-overflow=2
5380 This warning level also warns about left-shifting 1 into the sign bit,
5381 unless C++14 mode (or newer) is active.
5382 @end table
5383
5384 @item -Wswitch
5385 @opindex Wswitch
5386 @opindex Wno-switch
5387 Warn whenever a @code{switch} statement has an index of enumerated type
5388 and lacks a @code{case} for one or more of the named codes of that
5389 enumeration. (The presence of a @code{default} label prevents this
5390 warning.) @code{case} labels outside the enumeration range also
5391 provoke warnings when this option is used (even if there is a
5392 @code{default} label).
5393 This warning is enabled by @option{-Wall}.
5394
5395 @item -Wswitch-default
5396 @opindex Wswitch-default
5397 @opindex Wno-switch-default
5398 Warn whenever a @code{switch} statement does not have a @code{default}
5399 case.
5400
5401 @item -Wswitch-enum
5402 @opindex Wswitch-enum
5403 @opindex Wno-switch-enum
5404 Warn whenever a @code{switch} statement has an index of enumerated type
5405 and lacks a @code{case} for one or more of the named codes of that
5406 enumeration. @code{case} labels outside the enumeration range also
5407 provoke warnings when this option is used. The only difference
5408 between @option{-Wswitch} and this option is that this option gives a
5409 warning about an omitted enumeration code even if there is a
5410 @code{default} label.
5411
5412 @item -Wswitch-bool
5413 @opindex Wswitch-bool
5414 @opindex Wno-switch-bool
5415 Warn whenever a @code{switch} statement has an index of boolean type
5416 and the case values are outside the range of a boolean type.
5417 It is possible to suppress this warning by casting the controlling
5418 expression to a type other than @code{bool}. For example:
5419 @smallexample
5420 @group
5421 switch ((int) (a == 4))
5422 @{
5423 @dots{}
5424 @}
5425 @end group
5426 @end smallexample
5427 This warning is enabled by default for C and C++ programs.
5428
5429 @item -Wswitch-outside-range
5430 @opindex Wswitch-outside-range
5431 @opindex Wno-switch-outside-range
5432 Warn whenever a @code{switch} case has a value that is outside of its
5433 respective type range. This warning is enabled by default for
5434 C and C++ programs.
5435
5436 @item -Wswitch-unreachable
5437 @opindex Wswitch-unreachable
5438 @opindex Wno-switch-unreachable
5439 Warn whenever a @code{switch} statement contains statements between the
5440 controlling expression and the first case label, which will never be
5441 executed. For example:
5442 @smallexample
5443 @group
5444 switch (cond)
5445 @{
5446 i = 15;
5447 @dots{}
5448 case 5:
5449 @dots{}
5450 @}
5451 @end group
5452 @end smallexample
5453 @option{-Wswitch-unreachable} does not warn if the statement between the
5454 controlling expression and the first case label is just a declaration:
5455 @smallexample
5456 @group
5457 switch (cond)
5458 @{
5459 int i;
5460 @dots{}
5461 case 5:
5462 i = 5;
5463 @dots{}
5464 @}
5465 @end group
5466 @end smallexample
5467 This warning is enabled by default for C and C++ programs.
5468
5469 @item -Wsync-nand @r{(C and C++ only)}
5470 @opindex Wsync-nand
5471 @opindex Wno-sync-nand
5472 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5473 built-in functions are used. These functions changed semantics in GCC 4.4.
5474
5475 @item -Wunused-but-set-parameter
5476 @opindex Wunused-but-set-parameter
5477 @opindex Wno-unused-but-set-parameter
5478 Warn whenever a function parameter is assigned to, but otherwise unused
5479 (aside from its declaration).
5480
5481 To suppress this warning use the @code{unused} attribute
5482 (@pxref{Variable Attributes}).
5483
5484 This warning is also enabled by @option{-Wunused} together with
5485 @option{-Wextra}.
5486
5487 @item -Wunused-but-set-variable
5488 @opindex Wunused-but-set-variable
5489 @opindex Wno-unused-but-set-variable
5490 Warn whenever a local variable is assigned to, but otherwise unused
5491 (aside from its declaration).
5492 This warning is enabled by @option{-Wall}.
5493
5494 To suppress this warning use the @code{unused} attribute
5495 (@pxref{Variable Attributes}).
5496
5497 This warning is also enabled by @option{-Wunused}, which is enabled
5498 by @option{-Wall}.
5499
5500 @item -Wunused-function
5501 @opindex Wunused-function
5502 @opindex Wno-unused-function
5503 Warn whenever a static function is declared but not defined or a
5504 non-inline static function is unused.
5505 This warning is enabled by @option{-Wall}.
5506
5507 @item -Wunused-label
5508 @opindex Wunused-label
5509 @opindex Wno-unused-label
5510 Warn whenever a label is declared but not used.
5511 This warning is enabled by @option{-Wall}.
5512
5513 To suppress this warning use the @code{unused} attribute
5514 (@pxref{Variable Attributes}).
5515
5516 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5517 @opindex Wunused-local-typedefs
5518 @opindex Wno-unused-local-typedefs
5519 Warn when a typedef locally defined in a function is not used.
5520 This warning is enabled by @option{-Wall}.
5521
5522 @item -Wunused-parameter
5523 @opindex Wunused-parameter
5524 @opindex Wno-unused-parameter
5525 Warn whenever a function parameter is unused aside from its declaration.
5526
5527 To suppress this warning use the @code{unused} attribute
5528 (@pxref{Variable Attributes}).
5529
5530 @item -Wno-unused-result
5531 @opindex Wunused-result
5532 @opindex Wno-unused-result
5533 Do not warn if a caller of a function marked with attribute
5534 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5535 its return value. The default is @option{-Wunused-result}.
5536
5537 @item -Wunused-variable
5538 @opindex Wunused-variable
5539 @opindex Wno-unused-variable
5540 Warn whenever a local or static variable is unused aside from its
5541 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5542 but not for C++. This warning is enabled by @option{-Wall}.
5543
5544 To suppress this warning use the @code{unused} attribute
5545 (@pxref{Variable Attributes}).
5546
5547 @item -Wunused-const-variable
5548 @itemx -Wunused-const-variable=@var{n}
5549 @opindex Wunused-const-variable
5550 @opindex Wno-unused-const-variable
5551 Warn whenever a constant static variable is unused aside from its declaration.
5552 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5553 for C, but not for C++. In C this declares variable storage, but in C++ this
5554 is not an error since const variables take the place of @code{#define}s.
5555
5556 To suppress this warning use the @code{unused} attribute
5557 (@pxref{Variable Attributes}).
5558
5559 @table @gcctabopt
5560 @item -Wunused-const-variable=1
5561 This is the warning level that is enabled by @option{-Wunused-variable} for
5562 C. It warns only about unused static const variables defined in the main
5563 compilation unit, but not about static const variables declared in any
5564 header included.
5565
5566 @item -Wunused-const-variable=2
5567 This warning level also warns for unused constant static variables in
5568 headers (excluding system headers). This is the warning level of
5569 @option{-Wunused-const-variable} and must be explicitly requested since
5570 in C++ this isn't an error and in C it might be harder to clean up all
5571 headers included.
5572 @end table
5573
5574 @item -Wunused-value
5575 @opindex Wunused-value
5576 @opindex Wno-unused-value
5577 Warn whenever a statement computes a result that is explicitly not
5578 used. To suppress this warning cast the unused expression to
5579 @code{void}. This includes an expression-statement or the left-hand
5580 side of a comma expression that contains no side effects. For example,
5581 an expression such as @code{x[i,j]} causes a warning, while
5582 @code{x[(void)i,j]} does not.
5583
5584 This warning is enabled by @option{-Wall}.
5585
5586 @item -Wunused
5587 @opindex Wunused
5588 @opindex Wno-unused
5589 All the above @option{-Wunused} options combined.
5590
5591 In order to get a warning about an unused function parameter, you must
5592 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5593 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5594
5595 @item -Wuninitialized
5596 @opindex Wuninitialized
5597 @opindex Wno-uninitialized
5598 Warn if an automatic variable is used without first being initialized
5599 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5600 warn if a non-static reference or non-static @code{const} member
5601 appears in a class without constructors.
5602
5603 If you want to warn about code that uses the uninitialized value of the
5604 variable in its own initializer, use the @option{-Winit-self} option.
5605
5606 These warnings occur for individual uninitialized or clobbered
5607 elements of structure, union or array variables as well as for
5608 variables that are uninitialized or clobbered as a whole. They do
5609 not occur for variables or elements declared @code{volatile}. Because
5610 these warnings depend on optimization, the exact variables or elements
5611 for which there are warnings depends on the precise optimization
5612 options and version of GCC used.
5613
5614 Note that there may be no warning about a variable that is used only
5615 to compute a value that itself is never used, because such
5616 computations may be deleted by data flow analysis before the warnings
5617 are printed.
5618
5619 @item -Winvalid-memory-model
5620 @opindex Winvalid-memory-model
5621 @opindex Wno-invalid-memory-model
5622 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5623 and the C11 atomic generic functions with a memory consistency argument
5624 that is either invalid for the operation or outside the range of values
5625 of the @code{memory_order} enumeration. For example, since the
5626 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5627 defined for the relaxed, release, and sequentially consistent memory
5628 orders the following code is diagnosed:
5629
5630 @smallexample
5631 void store (int *i)
5632 @{
5633 __atomic_store_n (i, 0, memory_order_consume);
5634 @}
5635 @end smallexample
5636
5637 @option{-Winvalid-memory-model} is enabled by default.
5638
5639 @item -Wmaybe-uninitialized
5640 @opindex Wmaybe-uninitialized
5641 @opindex Wno-maybe-uninitialized
5642 For an automatic (i.e.@: local) variable, if there exists a path from the
5643 function entry to a use of the variable that is initialized, but there exist
5644 some other paths for which the variable is not initialized, the compiler
5645 emits a warning if it cannot prove the uninitialized paths are not
5646 executed at run time.
5647
5648 These warnings are only possible in optimizing compilation, because otherwise
5649 GCC does not keep track of the state of variables.
5650
5651 These warnings are made optional because GCC may not be able to determine when
5652 the code is correct in spite of appearing to have an error. Here is one
5653 example of how this can happen:
5654
5655 @smallexample
5656 @group
5657 @{
5658 int x;
5659 switch (y)
5660 @{
5661 case 1: x = 1;
5662 break;
5663 case 2: x = 4;
5664 break;
5665 case 3: x = 5;
5666 @}
5667 foo (x);
5668 @}
5669 @end group
5670 @end smallexample
5671
5672 @noindent
5673 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5674 always initialized, but GCC doesn't know this. To suppress the
5675 warning, you need to provide a default case with assert(0) or
5676 similar code.
5677
5678 @cindex @code{longjmp} warnings
5679 This option also warns when a non-volatile automatic variable might be
5680 changed by a call to @code{longjmp}.
5681 The compiler sees only the calls to @code{setjmp}. It cannot know
5682 where @code{longjmp} will be called; in fact, a signal handler could
5683 call it at any point in the code. As a result, you may get a warning
5684 even when there is in fact no problem because @code{longjmp} cannot
5685 in fact be called at the place that would cause a problem.
5686
5687 Some spurious warnings can be avoided if you declare all the functions
5688 you use that never return as @code{noreturn}. @xref{Function
5689 Attributes}.
5690
5691 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5692
5693 @item -Wunknown-pragmas
5694 @opindex Wunknown-pragmas
5695 @opindex Wno-unknown-pragmas
5696 @cindex warning for unknown pragmas
5697 @cindex unknown pragmas, warning
5698 @cindex pragmas, warning of unknown
5699 Warn when a @code{#pragma} directive is encountered that is not understood by
5700 GCC@. If this command-line option is used, warnings are even issued
5701 for unknown pragmas in system header files. This is not the case if
5702 the warnings are only enabled by the @option{-Wall} command-line option.
5703
5704 @item -Wno-pragmas
5705 @opindex Wno-pragmas
5706 @opindex Wpragmas
5707 Do not warn about misuses of pragmas, such as incorrect parameters,
5708 invalid syntax, or conflicts between pragmas. See also
5709 @option{-Wunknown-pragmas}.
5710
5711 @item -Wno-prio-ctor-dtor
5712 @opindex Wno-prio-ctor-dtor
5713 @opindex Wprio-ctor-dtor
5714 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5715 The use of constructor and destructor attributes allow you to assign a
5716 priority to the constructor/destructor to control its order of execution
5717 before @code{main} is called or after it returns. The priority values must be
5718 greater than 100 as the compiler reserves priority values between 0--100 for
5719 the implementation.
5720
5721 @item -Wstrict-aliasing
5722 @opindex Wstrict-aliasing
5723 @opindex Wno-strict-aliasing
5724 This option is only active when @option{-fstrict-aliasing} is active.
5725 It warns about code that might break the strict aliasing rules that the
5726 compiler is using for optimization. The warning does not catch all
5727 cases, but does attempt to catch the more common pitfalls. It is
5728 included in @option{-Wall}.
5729 It is equivalent to @option{-Wstrict-aliasing=3}
5730
5731 @item -Wstrict-aliasing=n
5732 @opindex Wstrict-aliasing=n
5733 This option is only active when @option{-fstrict-aliasing} is active.
5734 It warns about code that might break the strict aliasing rules that the
5735 compiler is using for optimization.
5736 Higher levels correspond to higher accuracy (fewer false positives).
5737 Higher levels also correspond to more effort, similar to the way @option{-O}
5738 works.
5739 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5740
5741 Level 1: Most aggressive, quick, least accurate.
5742 Possibly useful when higher levels
5743 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5744 false negatives. However, it has many false positives.
5745 Warns for all pointer conversions between possibly incompatible types,
5746 even if never dereferenced. Runs in the front end only.
5747
5748 Level 2: Aggressive, quick, not too precise.
5749 May still have many false positives (not as many as level 1 though),
5750 and few false negatives (but possibly more than level 1).
5751 Unlike level 1, it only warns when an address is taken. Warns about
5752 incomplete types. Runs in the front end only.
5753
5754 Level 3 (default for @option{-Wstrict-aliasing}):
5755 Should have very few false positives and few false
5756 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5757 Takes care of the common pun+dereference pattern in the front end:
5758 @code{*(int*)&some_float}.
5759 If optimization is enabled, it also runs in the back end, where it deals
5760 with multiple statement cases using flow-sensitive points-to information.
5761 Only warns when the converted pointer is dereferenced.
5762 Does not warn about incomplete types.
5763
5764 @item -Wstrict-overflow
5765 @itemx -Wstrict-overflow=@var{n}
5766 @opindex Wstrict-overflow
5767 @opindex Wno-strict-overflow
5768 This option is only active when signed overflow is undefined.
5769 It warns about cases where the compiler optimizes based on the
5770 assumption that signed overflow does not occur. Note that it does not
5771 warn about all cases where the code might overflow: it only warns
5772 about cases where the compiler implements some optimization. Thus
5773 this warning depends on the optimization level.
5774
5775 An optimization that assumes that signed overflow does not occur is
5776 perfectly safe if the values of the variables involved are such that
5777 overflow never does, in fact, occur. Therefore this warning can
5778 easily give a false positive: a warning about code that is not
5779 actually a problem. To help focus on important issues, several
5780 warning levels are defined. No warnings are issued for the use of
5781 undefined signed overflow when estimating how many iterations a loop
5782 requires, in particular when determining whether a loop will be
5783 executed at all.
5784
5785 @table @gcctabopt
5786 @item -Wstrict-overflow=1
5787 Warn about cases that are both questionable and easy to avoid. For
5788 example the compiler simplifies
5789 @code{x + 1 > x} to @code{1}. This level of
5790 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5791 are not, and must be explicitly requested.
5792
5793 @item -Wstrict-overflow=2
5794 Also warn about other cases where a comparison is simplified to a
5795 constant. For example: @code{abs (x) >= 0}. This can only be
5796 simplified when signed integer overflow is undefined, because
5797 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5798 zero. @option{-Wstrict-overflow} (with no level) is the same as
5799 @option{-Wstrict-overflow=2}.
5800
5801 @item -Wstrict-overflow=3
5802 Also warn about other cases where a comparison is simplified. For
5803 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5804
5805 @item -Wstrict-overflow=4
5806 Also warn about other simplifications not covered by the above cases.
5807 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5808
5809 @item -Wstrict-overflow=5
5810 Also warn about cases where the compiler reduces the magnitude of a
5811 constant involved in a comparison. For example: @code{x + 2 > y} is
5812 simplified to @code{x + 1 >= y}. This is reported only at the
5813 highest warning level because this simplification applies to many
5814 comparisons, so this warning level gives a very large number of
5815 false positives.
5816 @end table
5817
5818 @item -Wstringop-overflow
5819 @itemx -Wstringop-overflow=@var{type}
5820 @opindex Wstringop-overflow
5821 @opindex Wno-stringop-overflow
5822 Warn for calls to string manipulation functions such as @code{memcpy} and
5823 @code{strcpy} that are determined to overflow the destination buffer. The
5824 optional argument is one greater than the type of Object Size Checking to
5825 perform to determine the size of the destination. @xref{Object Size Checking}.
5826 The argument is meaningful only for functions that operate on character arrays
5827 but not for raw memory functions like @code{memcpy} which always make use
5828 of Object Size type-0. The option also warns for calls that specify a size
5829 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5830 The option produces the best results with optimization enabled but can detect
5831 a small subset of simple buffer overflows even without optimization in
5832 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5833 correspond to the standard functions. In any case, the option warns about
5834 just a subset of buffer overflows detected by the corresponding overflow
5835 checking built-ins. For example, the option will issue a warning for
5836 the @code{strcpy} call below because it copies at least 5 characters
5837 (the string @code{"blue"} including the terminating NUL) into the buffer
5838 of size 4.
5839
5840 @smallexample
5841 enum Color @{ blue, purple, yellow @};
5842 const char* f (enum Color clr)
5843 @{
5844 static char buf [4];
5845 const char *str;
5846 switch (clr)
5847 @{
5848 case blue: str = "blue"; break;
5849 case purple: str = "purple"; break;
5850 case yellow: str = "yellow"; break;
5851 @}
5852
5853 return strcpy (buf, str); // warning here
5854 @}
5855 @end smallexample
5856
5857 Option @option{-Wstringop-overflow=2} is enabled by default.
5858
5859 @table @gcctabopt
5860 @item -Wstringop-overflow
5861 @itemx -Wstringop-overflow=1
5862 @opindex Wstringop-overflow
5863 @opindex Wno-stringop-overflow
5864 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5865 to determine the sizes of destination objects. This is the default setting
5866 of the option. At this setting the option will not warn for writes past
5867 the end of subobjects of larger objects accessed by pointers unless the
5868 size of the largest surrounding object is known. When the destination may
5869 be one of several objects it is assumed to be the largest one of them. On
5870 Linux systems, when optimization is enabled at this setting the option warns
5871 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5872 a non-zero value.
5873
5874 @item -Wstringop-overflow=2
5875 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5876 to determine the sizes of destination objects. At this setting the option
5877 will warn about overflows when writing to members of the largest complete
5878 objects whose exact size is known. It will, however, not warn for excessive
5879 writes to the same members of unknown objects referenced by pointers since
5880 they may point to arrays containing unknown numbers of elements.
5881
5882 @item -Wstringop-overflow=3
5883 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5884 to determine the sizes of destination objects. At this setting the option
5885 warns about overflowing the smallest object or data member. This is the
5886 most restrictive setting of the option that may result in warnings for safe
5887 code.
5888
5889 @item -Wstringop-overflow=4
5890 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5891 to determine the sizes of destination objects. At this setting the option
5892 will warn about overflowing any data members, and when the destination is
5893 one of several objects it uses the size of the largest of them to decide
5894 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5895 setting of the option may result in warnings for benign code.
5896 @end table
5897
5898 @item -Wstringop-truncation
5899 @opindex Wstringop-truncation
5900 @opindex Wno-stringop-truncation
5901 Warn for calls to bounded string manipulation functions such as @code{strncat},
5902 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5903 or leave the destination unchanged.
5904
5905 In the following example, the call to @code{strncat} specifies a bound that
5906 is less than the length of the source string. As a result, the copy of
5907 the source will be truncated and so the call is diagnosed. To avoid the
5908 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5909
5910 @smallexample
5911 void append (char *buf, size_t bufsize)
5912 @{
5913 strncat (buf, ".txt", 3);
5914 @}
5915 @end smallexample
5916
5917 As another example, the following call to @code{strncpy} results in copying
5918 to @code{d} just the characters preceding the terminating NUL, without
5919 appending the NUL to the end. Assuming the result of @code{strncpy} is
5920 necessarily a NUL-terminated string is a common mistake, and so the call
5921 is diagnosed. To avoid the warning when the result is not expected to be
5922 NUL-terminated, call @code{memcpy} instead.
5923
5924 @smallexample
5925 void copy (char *d, const char *s)
5926 @{
5927 strncpy (d, s, strlen (s));
5928 @}
5929 @end smallexample
5930
5931 In the following example, the call to @code{strncpy} specifies the size
5932 of the destination buffer as the bound. If the length of the source
5933 string is equal to or greater than this size the result of the copy will
5934 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5935 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5936 element of the buffer to @code{NUL}.
5937
5938 @smallexample
5939 void copy (const char *s)
5940 @{
5941 char buf[80];
5942 strncpy (buf, s, sizeof buf);
5943 @dots{}
5944 @}
5945 @end smallexample
5946
5947 In situations where a character array is intended to store a sequence
5948 of bytes with no terminating @code{NUL} such an array may be annotated
5949 with attribute @code{nonstring} to avoid this warning. Such arrays,
5950 however, are not suitable arguments to functions that expect
5951 @code{NUL}-terminated strings. To help detect accidental misuses of
5952 such arrays GCC issues warnings unless it can prove that the use is
5953 safe. @xref{Common Variable Attributes}.
5954
5955 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5956 @opindex Wsuggest-attribute=
5957 @opindex Wno-suggest-attribute=
5958 Warn for cases where adding an attribute may be beneficial. The
5959 attributes currently supported are listed below.
5960
5961 @table @gcctabopt
5962 @item -Wsuggest-attribute=pure
5963 @itemx -Wsuggest-attribute=const
5964 @itemx -Wsuggest-attribute=noreturn
5965 @itemx -Wmissing-noreturn
5966 @itemx -Wsuggest-attribute=malloc
5967 @opindex Wsuggest-attribute=pure
5968 @opindex Wno-suggest-attribute=pure
5969 @opindex Wsuggest-attribute=const
5970 @opindex Wno-suggest-attribute=const
5971 @opindex Wsuggest-attribute=noreturn
5972 @opindex Wno-suggest-attribute=noreturn
5973 @opindex Wmissing-noreturn
5974 @opindex Wno-missing-noreturn
5975 @opindex Wsuggest-attribute=malloc
5976 @opindex Wno-suggest-attribute=malloc
5977
5978 Warn about functions that might be candidates for attributes
5979 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5980 only warns for functions visible in other compilation units or (in the case of
5981 @code{pure} and @code{const}) if it cannot prove that the function returns
5982 normally. A function returns normally if it doesn't contain an infinite loop or
5983 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5984 requires option @option{-fipa-pure-const}, which is enabled by default at
5985 @option{-O} and higher. Higher optimization levels improve the accuracy
5986 of the analysis.
5987
5988 @item -Wsuggest-attribute=format
5989 @itemx -Wmissing-format-attribute
5990 @opindex Wsuggest-attribute=format
5991 @opindex Wmissing-format-attribute
5992 @opindex Wno-suggest-attribute=format
5993 @opindex Wno-missing-format-attribute
5994 @opindex Wformat
5995 @opindex Wno-format
5996
5997 Warn about function pointers that might be candidates for @code{format}
5998 attributes. Note these are only possible candidates, not absolute ones.
5999 GCC guesses that function pointers with @code{format} attributes that
6000 are used in assignment, initialization, parameter passing or return
6001 statements should have a corresponding @code{format} attribute in the
6002 resulting type. I.e.@: the left-hand side of the assignment or
6003 initialization, the type of the parameter variable, or the return type
6004 of the containing function respectively should also have a @code{format}
6005 attribute to avoid the warning.
6006
6007 GCC also warns about function definitions that might be
6008 candidates for @code{format} attributes. Again, these are only
6009 possible candidates. GCC guesses that @code{format} attributes
6010 might be appropriate for any function that calls a function like
6011 @code{vprintf} or @code{vscanf}, but this might not always be the
6012 case, and some functions for which @code{format} attributes are
6013 appropriate may not be detected.
6014
6015 @item -Wsuggest-attribute=cold
6016 @opindex Wsuggest-attribute=cold
6017 @opindex Wno-suggest-attribute=cold
6018
6019 Warn about functions that might be candidates for @code{cold} attribute. This
6020 is based on static detection and generally will only warn about functions which
6021 always leads to a call to another @code{cold} function such as wrappers of
6022 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6023 @end table
6024
6025 @item -Wsuggest-final-types
6026 @opindex Wno-suggest-final-types
6027 @opindex Wsuggest-final-types
6028 Warn about types with virtual methods where code quality would be improved
6029 if the type were declared with the C++11 @code{final} specifier,
6030 or, if possible,
6031 declared in an anonymous namespace. This allows GCC to more aggressively
6032 devirtualize the polymorphic calls. This warning is more effective with
6033 link-time optimization,
6034 where the information about the class hierarchy graph is
6035 more complete.
6036
6037 @item -Wsuggest-final-methods
6038 @opindex Wno-suggest-final-methods
6039 @opindex Wsuggest-final-methods
6040 Warn about virtual methods where code quality would be improved if the method
6041 were declared with the C++11 @code{final} specifier,
6042 or, if possible, its type were
6043 declared in an anonymous namespace or with the @code{final} specifier.
6044 This warning is
6045 more effective with link-time optimization, where the information about the
6046 class hierarchy graph is more complete. It is recommended to first consider
6047 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6048 annotations.
6049
6050 @item -Wsuggest-override
6051 Warn about overriding virtual functions that are not marked with the override
6052 keyword.
6053
6054 @item -Walloc-zero
6055 @opindex Wno-alloc-zero
6056 @opindex Walloc-zero
6057 Warn about calls to allocation functions decorated with attribute
6058 @code{alloc_size} that specify zero bytes, including those to the built-in
6059 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6060 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6061 when called with a zero size differs among implementations (and in the case
6062 of @code{realloc} has been deprecated) relying on it may result in subtle
6063 portability bugs and should be avoided.
6064
6065 @item -Walloc-size-larger-than=@var{byte-size}
6066 @opindex Walloc-size-larger-than=
6067 @opindex Wno-alloc-size-larger-than
6068 Warn about calls to functions decorated with attribute @code{alloc_size}
6069 that attempt to allocate objects larger than the specified number of bytes,
6070 or where the result of the size computation in an integer type with infinite
6071 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6072 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6073 Warnings controlled by the option can be disabled either by specifying
6074 @var{byte-size} of @samp{SIZE_MAX} or more or by
6075 @option{-Wno-alloc-size-larger-than}.
6076 @xref{Function Attributes}.
6077
6078 @item -Wno-alloc-size-larger-than
6079 @opindex Wno-alloc-size-larger-than
6080 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6081 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6082 larger.
6083
6084 @item -Walloca
6085 @opindex Wno-alloca
6086 @opindex Walloca
6087 This option warns on all uses of @code{alloca} in the source.
6088
6089 @item -Walloca-larger-than=@var{byte-size}
6090 @opindex Walloca-larger-than=
6091 @opindex Wno-alloca-larger-than
6092 This option warns on calls to @code{alloca} with an integer argument whose
6093 value is either zero, or that is not bounded by a controlling predicate
6094 that limits its value to at most @var{byte-size}. It also warns for calls
6095 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6096 types are considered unbounded even if they appear to be constrained to
6097 the expected range.
6098
6099 For example, a bounded case of @code{alloca} could be:
6100
6101 @smallexample
6102 void func (size_t n)
6103 @{
6104 void *p;
6105 if (n <= 1000)
6106 p = alloca (n);
6107 else
6108 p = malloc (n);
6109 f (p);
6110 @}
6111 @end smallexample
6112
6113 In the above example, passing @code{-Walloca-larger-than=1000} would not
6114 issue a warning because the call to @code{alloca} is known to be at most
6115 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6116 the compiler would emit a warning.
6117
6118 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6119 controlling predicate constraining its integer argument. For example:
6120
6121 @smallexample
6122 void func ()
6123 @{
6124 void *p = alloca (n);
6125 f (p);
6126 @}
6127 @end smallexample
6128
6129 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6130 a warning, but this time because of the lack of bounds checking.
6131
6132 Note, that even seemingly correct code involving signed integers could
6133 cause a warning:
6134
6135 @smallexample
6136 void func (signed int n)
6137 @{
6138 if (n < 500)
6139 @{
6140 p = alloca (n);
6141 f (p);
6142 @}
6143 @}
6144 @end smallexample
6145
6146 In the above example, @var{n} could be negative, causing a larger than
6147 expected argument to be implicitly cast into the @code{alloca} call.
6148
6149 This option also warns when @code{alloca} is used in a loop.
6150
6151 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6152 but is usually only effective when @option{-ftree-vrp} is active (default
6153 for @option{-O2} and above).
6154
6155 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6156
6157 @item -Wno-alloca-larger-than
6158 @opindex Wno-alloca-larger-than
6159 Disable @option{-Walloca-larger-than=} warnings. The option is
6160 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6161
6162 @item -Warray-bounds
6163 @itemx -Warray-bounds=@var{n}
6164 @opindex Wno-array-bounds
6165 @opindex Warray-bounds
6166 This option is only active when @option{-ftree-vrp} is active
6167 (default for @option{-O2} and above). It warns about subscripts to arrays
6168 that are always out of bounds. This warning is enabled by @option{-Wall}.
6169
6170 @table @gcctabopt
6171 @item -Warray-bounds=1
6172 This is the warning level of @option{-Warray-bounds} and is enabled
6173 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6174
6175 @item -Warray-bounds=2
6176 This warning level also warns about out of bounds access for
6177 arrays at the end of a struct and for arrays accessed through
6178 pointers. This warning level may give a larger number of
6179 false positives and is deactivated by default.
6180 @end table
6181
6182 @item -Wattribute-alias=@var{n}
6183 @itemx -Wno-attribute-alias
6184 @opindex Wattribute-alias
6185 @opindex Wno-attribute-alias
6186 Warn about declarations using the @code{alias} and similar attributes whose
6187 target is incompatible with the type of the alias.
6188 @xref{Function Attributes,,Declaring Attributes of Functions}.
6189
6190 @table @gcctabopt
6191 @item -Wattribute-alias=1
6192 The default warning level of the @option{-Wattribute-alias} option diagnoses
6193 incompatibilities between the type of the alias declaration and that of its
6194 target. Such incompatibilities are typically indicative of bugs.
6195
6196 @item -Wattribute-alias=2
6197
6198 At this level @option{-Wattribute-alias} also diagnoses cases where
6199 the attributes of the alias declaration are more restrictive than the
6200 attributes applied to its target. These mismatches can potentially
6201 result in incorrect code generation. In other cases they may be
6202 benign and could be resolved simply by adding the missing attribute to
6203 the target. For comparison, see the @option{-Wmissing-attributes}
6204 option, which controls diagnostics when the alias declaration is less
6205 restrictive than the target, rather than more restrictive.
6206
6207 Attributes considered include @code{alloc_align}, @code{alloc_size},
6208 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6209 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6210 @code{returns_nonnull}, and @code{returns_twice}.
6211 @end table
6212
6213 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6214 This is the default. You can disable these warnings with either
6215 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6216
6217 @item -Wbool-compare
6218 @opindex Wno-bool-compare
6219 @opindex Wbool-compare
6220 Warn about boolean expression compared with an integer value different from
6221 @code{true}/@code{false}. For instance, the following comparison is
6222 always false:
6223 @smallexample
6224 int n = 5;
6225 @dots{}
6226 if ((n > 1) == 2) @{ @dots{} @}
6227 @end smallexample
6228 This warning is enabled by @option{-Wall}.
6229
6230 @item -Wbool-operation
6231 @opindex Wno-bool-operation
6232 @opindex Wbool-operation
6233 Warn about suspicious operations on expressions of a boolean type. For
6234 instance, bitwise negation of a boolean is very likely a bug in the program.
6235 For C, this warning also warns about incrementing or decrementing a boolean,
6236 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6237 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6238
6239 This warning is enabled by @option{-Wall}.
6240
6241 @item -Wduplicated-branches
6242 @opindex Wno-duplicated-branches
6243 @opindex Wduplicated-branches
6244 Warn when an if-else has identical branches. This warning detects cases like
6245 @smallexample
6246 if (p != NULL)
6247 return 0;
6248 else
6249 return 0;
6250 @end smallexample
6251 It doesn't warn when both branches contain just a null statement. This warning
6252 also warn for conditional operators:
6253 @smallexample
6254 int i = x ? *p : *p;
6255 @end smallexample
6256
6257 @item -Wduplicated-cond
6258 @opindex Wno-duplicated-cond
6259 @opindex Wduplicated-cond
6260 Warn about duplicated conditions in an if-else-if chain. For instance,
6261 warn for the following code:
6262 @smallexample
6263 if (p->q != NULL) @{ @dots{} @}
6264 else if (p->q != NULL) @{ @dots{} @}
6265 @end smallexample
6266
6267 @item -Wframe-address
6268 @opindex Wno-frame-address
6269 @opindex Wframe-address
6270 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6271 is called with an argument greater than 0. Such calls may return indeterminate
6272 values or crash the program. The warning is included in @option{-Wall}.
6273
6274 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6275 @opindex Wno-discarded-qualifiers
6276 @opindex Wdiscarded-qualifiers
6277 Do not warn if type qualifiers on pointers are being discarded.
6278 Typically, the compiler warns if a @code{const char *} variable is
6279 passed to a function that takes a @code{char *} parameter. This option
6280 can be used to suppress such a warning.
6281
6282 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6283 @opindex Wno-discarded-array-qualifiers
6284 @opindex Wdiscarded-array-qualifiers
6285 Do not warn if type qualifiers on arrays which are pointer targets
6286 are being discarded. Typically, the compiler warns if a
6287 @code{const int (*)[]} variable is passed to a function that
6288 takes a @code{int (*)[]} parameter. This option can be used to
6289 suppress such a warning.
6290
6291 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6292 @opindex Wno-incompatible-pointer-types
6293 @opindex Wincompatible-pointer-types
6294 Do not warn when there is a conversion between pointers that have incompatible
6295 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6296 which warns for pointer argument passing or assignment with different
6297 signedness.
6298
6299 @item -Wno-int-conversion @r{(C and Objective-C only)}
6300 @opindex Wno-int-conversion
6301 @opindex Wint-conversion
6302 Do not warn about incompatible integer to pointer and pointer to integer
6303 conversions. This warning is about implicit conversions; for explicit
6304 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6305 @option{-Wno-pointer-to-int-cast} may be used.
6306
6307 @item -Wno-div-by-zero
6308 @opindex Wno-div-by-zero
6309 @opindex Wdiv-by-zero
6310 Do not warn about compile-time integer division by zero. Floating-point
6311 division by zero is not warned about, as it can be a legitimate way of
6312 obtaining infinities and NaNs.
6313
6314 @item -Wsystem-headers
6315 @opindex Wsystem-headers
6316 @opindex Wno-system-headers
6317 @cindex warnings from system headers
6318 @cindex system headers, warnings from
6319 Print warning messages for constructs found in system header files.
6320 Warnings from system headers are normally suppressed, on the assumption
6321 that they usually do not indicate real problems and would only make the
6322 compiler output harder to read. Using this command-line option tells
6323 GCC to emit warnings from system headers as if they occurred in user
6324 code. However, note that using @option{-Wall} in conjunction with this
6325 option does @emph{not} warn about unknown pragmas in system
6326 headers---for that, @option{-Wunknown-pragmas} must also be used.
6327
6328 @item -Wtautological-compare
6329 @opindex Wtautological-compare
6330 @opindex Wno-tautological-compare
6331 Warn if a self-comparison always evaluates to true or false. This
6332 warning detects various mistakes such as:
6333 @smallexample
6334 int i = 1;
6335 @dots{}
6336 if (i > i) @{ @dots{} @}
6337 @end smallexample
6338
6339 This warning also warns about bitwise comparisons that always evaluate
6340 to true or false, for instance:
6341 @smallexample
6342 if ((a & 16) == 10) @{ @dots{} @}
6343 @end smallexample
6344 will always be false.
6345
6346 This warning is enabled by @option{-Wall}.
6347
6348 @item -Wtrampolines
6349 @opindex Wtrampolines
6350 @opindex Wno-trampolines
6351 Warn about trampolines generated for pointers to nested functions.
6352 A trampoline is a small piece of data or code that is created at run
6353 time on the stack when the address of a nested function is taken, and is
6354 used to call the nested function indirectly. For some targets, it is
6355 made up of data only and thus requires no special treatment. But, for
6356 most targets, it is made up of code and thus requires the stack to be
6357 made executable in order for the program to work properly.
6358
6359 @item -Wfloat-equal
6360 @opindex Wfloat-equal
6361 @opindex Wno-float-equal
6362 Warn if floating-point values are used in equality comparisons.
6363
6364 The idea behind this is that sometimes it is convenient (for the
6365 programmer) to consider floating-point values as approximations to
6366 infinitely precise real numbers. If you are doing this, then you need
6367 to compute (by analyzing the code, or in some other way) the maximum or
6368 likely maximum error that the computation introduces, and allow for it
6369 when performing comparisons (and when producing output, but that's a
6370 different problem). In particular, instead of testing for equality, you
6371 should check to see whether the two values have ranges that overlap; and
6372 this is done with the relational operators, so equality comparisons are
6373 probably mistaken.
6374
6375 @item -Wtraditional @r{(C and Objective-C only)}
6376 @opindex Wtraditional
6377 @opindex Wno-traditional
6378 Warn about certain constructs that behave differently in traditional and
6379 ISO C@. Also warn about ISO C constructs that have no traditional C
6380 equivalent, and/or problematic constructs that should be avoided.
6381
6382 @itemize @bullet
6383 @item
6384 Macro parameters that appear within string literals in the macro body.
6385 In traditional C macro replacement takes place within string literals,
6386 but in ISO C it does not.
6387
6388 @item
6389 In traditional C, some preprocessor directives did not exist.
6390 Traditional preprocessors only considered a line to be a directive
6391 if the @samp{#} appeared in column 1 on the line. Therefore
6392 @option{-Wtraditional} warns about directives that traditional C
6393 understands but ignores because the @samp{#} does not appear as the
6394 first character on the line. It also suggests you hide directives like
6395 @code{#pragma} not understood by traditional C by indenting them. Some
6396 traditional implementations do not recognize @code{#elif}, so this option
6397 suggests avoiding it altogether.
6398
6399 @item
6400 A function-like macro that appears without arguments.
6401
6402 @item
6403 The unary plus operator.
6404
6405 @item
6406 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6407 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6408 constants.) Note, these suffixes appear in macros defined in the system
6409 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6410 Use of these macros in user code might normally lead to spurious
6411 warnings, however GCC's integrated preprocessor has enough context to
6412 avoid warning in these cases.
6413
6414 @item
6415 A function declared external in one block and then used after the end of
6416 the block.
6417
6418 @item
6419 A @code{switch} statement has an operand of type @code{long}.
6420
6421 @item
6422 A non-@code{static} function declaration follows a @code{static} one.
6423 This construct is not accepted by some traditional C compilers.
6424
6425 @item
6426 The ISO type of an integer constant has a different width or
6427 signedness from its traditional type. This warning is only issued if
6428 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6429 typically represent bit patterns, are not warned about.
6430
6431 @item
6432 Usage of ISO string concatenation is detected.
6433
6434 @item
6435 Initialization of automatic aggregates.
6436
6437 @item
6438 Identifier conflicts with labels. Traditional C lacks a separate
6439 namespace for labels.
6440
6441 @item
6442 Initialization of unions. If the initializer is zero, the warning is
6443 omitted. This is done under the assumption that the zero initializer in
6444 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6445 initializer warnings and relies on default initialization to zero in the
6446 traditional C case.
6447
6448 @item
6449 Conversions by prototypes between fixed/floating-point values and vice
6450 versa. The absence of these prototypes when compiling with traditional
6451 C causes serious problems. This is a subset of the possible
6452 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6453
6454 @item
6455 Use of ISO C style function definitions. This warning intentionally is
6456 @emph{not} issued for prototype declarations or variadic functions
6457 because these ISO C features appear in your code when using
6458 libiberty's traditional C compatibility macros, @code{PARAMS} and
6459 @code{VPARAMS}. This warning is also bypassed for nested functions
6460 because that feature is already a GCC extension and thus not relevant to
6461 traditional C compatibility.
6462 @end itemize
6463
6464 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6465 @opindex Wtraditional-conversion
6466 @opindex Wno-traditional-conversion
6467 Warn if a prototype causes a type conversion that is different from what
6468 would happen to the same argument in the absence of a prototype. This
6469 includes conversions of fixed point to floating and vice versa, and
6470 conversions changing the width or signedness of a fixed-point argument
6471 except when the same as the default promotion.
6472
6473 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6474 @opindex Wdeclaration-after-statement
6475 @opindex Wno-declaration-after-statement
6476 Warn when a declaration is found after a statement in a block. This
6477 construct, known from C++, was introduced with ISO C99 and is by default
6478 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6479
6480 @item -Wshadow
6481 @opindex Wshadow
6482 @opindex Wno-shadow
6483 Warn whenever a local variable or type declaration shadows another
6484 variable, parameter, type, class member (in C++), or instance variable
6485 (in Objective-C) or whenever a built-in function is shadowed. Note
6486 that in C++, the compiler warns if a local variable shadows an
6487 explicit typedef, but not if it shadows a struct/class/enum.
6488 Same as @option{-Wshadow=global}.
6489
6490 @item -Wno-shadow-ivar @r{(Objective-C only)}
6491 @opindex Wno-shadow-ivar
6492 @opindex Wshadow-ivar
6493 Do not warn whenever a local variable shadows an instance variable in an
6494 Objective-C method.
6495
6496 @item -Wshadow=global
6497 @opindex Wshadow=local
6498 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6499
6500 @item -Wshadow=local
6501 @opindex Wshadow=local
6502 Warn when a local variable shadows another local variable or parameter.
6503 This warning is enabled by @option{-Wshadow=global}.
6504
6505 @item -Wshadow=compatible-local
6506 @opindex Wshadow=compatible-local
6507 Warn when a local variable shadows another local variable or parameter
6508 whose type is compatible with that of the shadowing variable. In C++,
6509 type compatibility here means the type of the shadowing variable can be
6510 converted to that of the shadowed variable. The creation of this flag
6511 (in addition to @option{-Wshadow=local}) is based on the idea that when
6512 a local variable shadows another one of incompatible type, it is most
6513 likely intentional, not a bug or typo, as shown in the following example:
6514
6515 @smallexample
6516 @group
6517 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6518 @{
6519 for (int i = 0; i < N; ++i)
6520 @{
6521 ...
6522 @}
6523 ...
6524 @}
6525 @end group
6526 @end smallexample
6527
6528 Since the two variable @code{i} in the example above have incompatible types,
6529 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6530 Because their types are incompatible, if a programmer accidentally uses one
6531 in place of the other, type checking will catch that and emit an error or
6532 warning. So not warning (about shadowing) in this case will not lead to
6533 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6534 possibly reduce the number of warnings triggered by intentional shadowing.
6535
6536 This warning is enabled by @option{-Wshadow=local}.
6537
6538 @item -Wlarger-than=@var{byte-size}
6539 @opindex Wlarger-than=
6540 @opindex Wlarger-than-@var{byte-size}
6541 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6542 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6543 Warnings controlled by the option can be disabled either by specifying
6544 @var{byte-size} of @samp{SIZE_MAX} or more or by
6545 @option{-Wno-larger-than}.
6546
6547 @item -Wno-larger-than
6548 @opindex Wno-larger-than
6549 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6550 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6551
6552 @item -Wframe-larger-than=@var{byte-size}
6553 @opindex Wframe-larger-than=
6554 @opindex Wno-frame-larger-than
6555 Warn if the size of a function frame exceeds @var{byte-size}.
6556 The computation done to determine the stack frame size is approximate
6557 and not conservative.
6558 The actual requirements may be somewhat greater than @var{byte-size}
6559 even if you do not get a warning. In addition, any space allocated
6560 via @code{alloca}, variable-length arrays, or related constructs
6561 is not included by the compiler when determining
6562 whether or not to issue a warning.
6563 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6564 Warnings controlled by the option can be disabled either by specifying
6565 @var{byte-size} of @samp{SIZE_MAX} or more or by
6566 @option{-Wno-frame-larger-than}.
6567
6568 @item -Wno-frame-larger-than
6569 @opindex Wno-frame-larger-than
6570 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6571 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6572
6573 @item -Wno-free-nonheap-object
6574 @opindex Wno-free-nonheap-object
6575 @opindex Wfree-nonheap-object
6576 Do not warn when attempting to free an object that was not allocated
6577 on the heap.
6578
6579 @item -Wstack-usage=@var{byte-size}
6580 @opindex Wstack-usage
6581 @opindex Wno-stack-usage
6582 Warn if the stack usage of a function might exceed @var{byte-size}.
6583 The computation done to determine the stack usage is conservative.
6584 Any space allocated via @code{alloca}, variable-length arrays, or related
6585 constructs is included by the compiler when determining whether or not to
6586 issue a warning.
6587
6588 The message is in keeping with the output of @option{-fstack-usage}.
6589
6590 @itemize
6591 @item
6592 If the stack usage is fully static but exceeds the specified amount, it's:
6593
6594 @smallexample
6595 warning: stack usage is 1120 bytes
6596 @end smallexample
6597 @item
6598 If the stack usage is (partly) dynamic but bounded, it's:
6599
6600 @smallexample
6601 warning: stack usage might be 1648 bytes
6602 @end smallexample
6603 @item
6604 If the stack usage is (partly) dynamic and not bounded, it's:
6605
6606 @smallexample
6607 warning: stack usage might be unbounded
6608 @end smallexample
6609 @end itemize
6610
6611 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6612 Warnings controlled by the option can be disabled either by specifying
6613 @var{byte-size} of @samp{SIZE_MAX} or more or by
6614 @option{-Wno-stack-usage}.
6615
6616 @item -Wno-stack-usage
6617 @opindex Wno-stack-usage
6618 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6619 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6620
6621 @item -Wunsafe-loop-optimizations
6622 @opindex Wunsafe-loop-optimizations
6623 @opindex Wno-unsafe-loop-optimizations
6624 Warn if the loop cannot be optimized because the compiler cannot
6625 assume anything on the bounds of the loop indices. With
6626 @option{-funsafe-loop-optimizations} warn if the compiler makes
6627 such assumptions.
6628
6629 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6630 @opindex Wno-pedantic-ms-format
6631 @opindex Wpedantic-ms-format
6632 When used in combination with @option{-Wformat}
6633 and @option{-pedantic} without GNU extensions, this option
6634 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6635 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6636 which depend on the MS runtime.
6637
6638 @item -Waligned-new
6639 @opindex Waligned-new
6640 @opindex Wno-aligned-new
6641 Warn about a new-expression of a type that requires greater alignment
6642 than the @code{alignof(std::max_align_t)} but uses an allocation
6643 function without an explicit alignment parameter. This option is
6644 enabled by @option{-Wall}.
6645
6646 Normally this only warns about global allocation functions, but
6647 @option{-Waligned-new=all} also warns about class member allocation
6648 functions.
6649
6650 @item -Wplacement-new
6651 @itemx -Wplacement-new=@var{n}
6652 @opindex Wplacement-new
6653 @opindex Wno-placement-new
6654 Warn about placement new expressions with undefined behavior, such as
6655 constructing an object in a buffer that is smaller than the type of
6656 the object. For example, the placement new expression below is diagnosed
6657 because it attempts to construct an array of 64 integers in a buffer only
6658 64 bytes large.
6659 @smallexample
6660 char buf [64];
6661 new (buf) int[64];
6662 @end smallexample
6663 This warning is enabled by default.
6664
6665 @table @gcctabopt
6666 @item -Wplacement-new=1
6667 This is the default warning level of @option{-Wplacement-new}. At this
6668 level the warning is not issued for some strictly undefined constructs that
6669 GCC allows as extensions for compatibility with legacy code. For example,
6670 the following @code{new} expression is not diagnosed at this level even
6671 though it has undefined behavior according to the C++ standard because
6672 it writes past the end of the one-element array.
6673 @smallexample
6674 struct S @{ int n, a[1]; @};
6675 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6676 new (s->a)int [32]();
6677 @end smallexample
6678
6679 @item -Wplacement-new=2
6680 At this level, in addition to diagnosing all the same constructs as at level
6681 1, a diagnostic is also issued for placement new expressions that construct
6682 an object in the last member of structure whose type is an array of a single
6683 element and whose size is less than the size of the object being constructed.
6684 While the previous example would be diagnosed, the following construct makes
6685 use of the flexible member array extension to avoid the warning at level 2.
6686 @smallexample
6687 struct S @{ int n, a[]; @};
6688 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6689 new (s->a)int [32]();
6690 @end smallexample
6691
6692 @end table
6693
6694 @item -Wpointer-arith
6695 @opindex Wpointer-arith
6696 @opindex Wno-pointer-arith
6697 Warn about anything that depends on the ``size of'' a function type or
6698 of @code{void}. GNU C assigns these types a size of 1, for
6699 convenience in calculations with @code{void *} pointers and pointers
6700 to functions. In C++, warn also when an arithmetic operation involves
6701 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6702
6703 @item -Wpointer-compare
6704 @opindex Wpointer-compare
6705 @opindex Wno-pointer-compare
6706 Warn if a pointer is compared with a zero character constant. This usually
6707 means that the pointer was meant to be dereferenced. For example:
6708
6709 @smallexample
6710 const char *p = foo ();
6711 if (p == '\0')
6712 return 42;
6713 @end smallexample
6714
6715 Note that the code above is invalid in C++11.
6716
6717 This warning is enabled by default.
6718
6719 @item -Wtype-limits
6720 @opindex Wtype-limits
6721 @opindex Wno-type-limits
6722 Warn if a comparison is always true or always false due to the limited
6723 range of the data type, but do not warn for constant expressions. For
6724 example, warn if an unsigned variable is compared against zero with
6725 @code{<} or @code{>=}. This warning is also enabled by
6726 @option{-Wextra}.
6727
6728 @item -Wabsolute-value @r{(C and Objective-C only)}
6729 @opindex Wabsolute-value
6730 @opindex Wno-absolute-value
6731 Warn for calls to standard functions that compute the absolute value
6732 of an argument when a more appropriate standard function is available.
6733 For example, calling @code{abs(3.14)} triggers the warning because the
6734 appropriate function to call to compute the absolute value of a double
6735 argument is @code{fabs}. The option also triggers warnings when the
6736 argument in a call to such a function has an unsigned type. This
6737 warning can be suppressed with an explicit type cast and it is also
6738 enabled by @option{-Wextra}.
6739
6740 @include cppwarnopts.texi
6741
6742 @item -Wbad-function-cast @r{(C and Objective-C only)}
6743 @opindex Wbad-function-cast
6744 @opindex Wno-bad-function-cast
6745 Warn when a function call is cast to a non-matching type.
6746 For example, warn if a call to a function returning an integer type
6747 is cast to a pointer type.
6748
6749 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6750 @opindex Wc90-c99-compat
6751 @opindex Wno-c90-c99-compat
6752 Warn about features not present in ISO C90, but present in ISO C99.
6753 For instance, warn about use of variable length arrays, @code{long long}
6754 type, @code{bool} type, compound literals, designated initializers, and so
6755 on. This option is independent of the standards mode. Warnings are disabled
6756 in the expression that follows @code{__extension__}.
6757
6758 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6759 @opindex Wc99-c11-compat
6760 @opindex Wno-c99-c11-compat
6761 Warn about features not present in ISO C99, but present in ISO C11.
6762 For instance, warn about use of anonymous structures and unions,
6763 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6764 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6765 and so on. This option is independent of the standards mode. Warnings are
6766 disabled in the expression that follows @code{__extension__}.
6767
6768 @item -Wc++-compat @r{(C and Objective-C only)}
6769 @opindex Wc++-compat
6770 @opindex Wno-c++-compat
6771 Warn about ISO C constructs that are outside of the common subset of
6772 ISO C and ISO C++, e.g.@: request for implicit conversion from
6773 @code{void *} to a pointer to non-@code{void} type.
6774
6775 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6776 @opindex Wc++11-compat
6777 @opindex Wno-c++11-compat
6778 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6779 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6780 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6781 enabled by @option{-Wall}.
6782
6783 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6784 @opindex Wc++14-compat
6785 @opindex Wno-c++14-compat
6786 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6787 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6788
6789 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6790 @opindex Wc++17-compat
6791 @opindex Wno-c++17-compat
6792 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6793 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6794
6795 @item -Wcast-qual
6796 @opindex Wcast-qual
6797 @opindex Wno-cast-qual
6798 Warn whenever a pointer is cast so as to remove a type qualifier from
6799 the target type. For example, warn if a @code{const char *} is cast
6800 to an ordinary @code{char *}.
6801
6802 Also warn when making a cast that introduces a type qualifier in an
6803 unsafe way. For example, casting @code{char **} to @code{const char **}
6804 is unsafe, as in this example:
6805
6806 @smallexample
6807 /* p is char ** value. */
6808 const char **q = (const char **) p;
6809 /* Assignment of readonly string to const char * is OK. */
6810 *q = "string";
6811 /* Now char** pointer points to read-only memory. */
6812 **p = 'b';
6813 @end smallexample
6814
6815 @item -Wcast-align
6816 @opindex Wcast-align
6817 @opindex Wno-cast-align
6818 Warn whenever a pointer is cast such that the required alignment of the
6819 target is increased. For example, warn if a @code{char *} is cast to
6820 an @code{int *} on machines where integers can only be accessed at
6821 two- or four-byte boundaries.
6822
6823 @item -Wcast-align=strict
6824 @opindex Wcast-align=strict
6825 Warn whenever a pointer is cast such that the required alignment of the
6826 target is increased. For example, warn if a @code{char *} is cast to
6827 an @code{int *} regardless of the target machine.
6828
6829 @item -Wcast-function-type
6830 @opindex Wcast-function-type
6831 @opindex Wno-cast-function-type
6832 Warn when a function pointer is cast to an incompatible function pointer.
6833 In a cast involving function types with a variable argument list only
6834 the types of initial arguments that are provided are considered.
6835 Any parameter of pointer-type matches any other pointer-type. Any benign
6836 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6837 on ILP32 targets. Likewise type qualifiers are ignored. The function
6838 type @code{void (*) (void)} is special and matches everything, which can
6839 be used to suppress this warning.
6840 In a cast involving pointer to member types this warning warns whenever
6841 the type cast is changing the pointer to member type.
6842 This warning is enabled by @option{-Wextra}.
6843
6844 @item -Wwrite-strings
6845 @opindex Wwrite-strings
6846 @opindex Wno-write-strings
6847 When compiling C, give string constants the type @code{const
6848 char[@var{length}]} so that copying the address of one into a
6849 non-@code{const} @code{char *} pointer produces a warning. These
6850 warnings help you find at compile time code that can try to write
6851 into a string constant, but only if you have been very careful about
6852 using @code{const} in declarations and prototypes. Otherwise, it is
6853 just a nuisance. This is why we did not make @option{-Wall} request
6854 these warnings.
6855
6856 When compiling C++, warn about the deprecated conversion from string
6857 literals to @code{char *}. This warning is enabled by default for C++
6858 programs.
6859
6860 @item -Wcatch-value
6861 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6862 @opindex Wcatch-value
6863 @opindex Wno-catch-value
6864 Warn about catch handlers that do not catch via reference.
6865 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6866 warn about polymorphic class types that are caught by value.
6867 With @option{-Wcatch-value=2} warn about all class types that are caught
6868 by value. With @option{-Wcatch-value=3} warn about all types that are
6869 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6870
6871 @item -Wclobbered
6872 @opindex Wclobbered
6873 @opindex Wno-clobbered
6874 Warn for variables that might be changed by @code{longjmp} or
6875 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6876
6877 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6878 @opindex Wconditionally-supported
6879 @opindex Wno-conditionally-supported
6880 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6881
6882 @item -Wconversion
6883 @opindex Wconversion
6884 @opindex Wno-conversion
6885 Warn for implicit conversions that may alter a value. This includes
6886 conversions between real and integer, like @code{abs (x)} when
6887 @code{x} is @code{double}; conversions between signed and unsigned,
6888 like @code{unsigned ui = -1}; and conversions to smaller types, like
6889 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6890 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6891 changed by the conversion like in @code{abs (2.0)}. Warnings about
6892 conversions between signed and unsigned integers can be disabled by
6893 using @option{-Wno-sign-conversion}.
6894
6895 For C++, also warn for confusing overload resolution for user-defined
6896 conversions; and conversions that never use a type conversion
6897 operator: conversions to @code{void}, the same type, a base class or a
6898 reference to them. Warnings about conversions between signed and
6899 unsigned integers are disabled by default in C++ unless
6900 @option{-Wsign-conversion} is explicitly enabled.
6901
6902 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6903 @opindex Wconversion-null
6904 @opindex Wno-conversion-null
6905 Do not warn for conversions between @code{NULL} and non-pointer
6906 types. @option{-Wconversion-null} is enabled by default.
6907
6908 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6909 @opindex Wzero-as-null-pointer-constant
6910 @opindex Wno-zero-as-null-pointer-constant
6911 Warn when a literal @samp{0} is used as null pointer constant. This can
6912 be useful to facilitate the conversion to @code{nullptr} in C++11.
6913
6914 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6915 @opindex Wsubobject-linkage
6916 @opindex Wno-subobject-linkage
6917 Warn if a class type has a base or a field whose type uses the anonymous
6918 namespace or depends on a type with no linkage. If a type A depends on
6919 a type B with no or internal linkage, defining it in multiple
6920 translation units would be an ODR violation because the meaning of B
6921 is different in each translation unit. If A only appears in a single
6922 translation unit, the best way to silence the warning is to give it
6923 internal linkage by putting it in an anonymous namespace as well. The
6924 compiler doesn't give this warning for types defined in the main .C
6925 file, as those are unlikely to have multiple definitions.
6926 @option{-Wsubobject-linkage} is enabled by default.
6927
6928 @item -Wdangling-else
6929 @opindex Wdangling-else
6930 @opindex Wno-dangling-else
6931 Warn about constructions where there may be confusion to which
6932 @code{if} statement an @code{else} branch belongs. Here is an example of
6933 such a case:
6934
6935 @smallexample
6936 @group
6937 @{
6938 if (a)
6939 if (b)
6940 foo ();
6941 else
6942 bar ();
6943 @}
6944 @end group
6945 @end smallexample
6946
6947 In C/C++, every @code{else} branch belongs to the innermost possible
6948 @code{if} statement, which in this example is @code{if (b)}. This is
6949 often not what the programmer expected, as illustrated in the above
6950 example by indentation the programmer chose. When there is the
6951 potential for this confusion, GCC issues a warning when this flag
6952 is specified. To eliminate the warning, add explicit braces around
6953 the innermost @code{if} statement so there is no way the @code{else}
6954 can belong to the enclosing @code{if}. The resulting code
6955 looks like this:
6956
6957 @smallexample
6958 @group
6959 @{
6960 if (a)
6961 @{
6962 if (b)
6963 foo ();
6964 else
6965 bar ();
6966 @}
6967 @}
6968 @end group
6969 @end smallexample
6970
6971 This warning is enabled by @option{-Wparentheses}.
6972
6973 @item -Wdate-time
6974 @opindex Wdate-time
6975 @opindex Wno-date-time
6976 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6977 are encountered as they might prevent bit-wise-identical reproducible
6978 compilations.
6979
6980 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6981 @opindex Wdelete-incomplete
6982 @opindex Wno-delete-incomplete
6983 Warn when deleting a pointer to incomplete type, which may cause
6984 undefined behavior at runtime. This warning is enabled by default.
6985
6986 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6987 @opindex Wuseless-cast
6988 @opindex Wno-useless-cast
6989 Warn when an expression is casted to its own type.
6990
6991 @item -Wempty-body
6992 @opindex Wempty-body
6993 @opindex Wno-empty-body
6994 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6995 while} statement. This warning is also enabled by @option{-Wextra}.
6996
6997 @item -Wenum-compare
6998 @opindex Wenum-compare
6999 @opindex Wno-enum-compare
7000 Warn about a comparison between values of different enumerated types.
7001 In C++ enumerated type mismatches in conditional expressions are also
7002 diagnosed and the warning is enabled by default. In C this warning is
7003 enabled by @option{-Wall}.
7004
7005 @item -Wextra-semi @r{(C++, Objective-C++ only)}
7006 @opindex Wextra-semi
7007 @opindex Wno-extra-semi
7008 Warn about redundant semicolon after in-class function definition.
7009
7010 @item -Wjump-misses-init @r{(C, Objective-C only)}
7011 @opindex Wjump-misses-init
7012 @opindex Wno-jump-misses-init
7013 Warn if a @code{goto} statement or a @code{switch} statement jumps
7014 forward across the initialization of a variable, or jumps backward to a
7015 label after the variable has been initialized. This only warns about
7016 variables that are initialized when they are declared. This warning is
7017 only supported for C and Objective-C; in C++ this sort of branch is an
7018 error in any case.
7019
7020 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7021 can be disabled with the @option{-Wno-jump-misses-init} option.
7022
7023 @item -Wsign-compare
7024 @opindex Wsign-compare
7025 @opindex Wno-sign-compare
7026 @cindex warning for comparison of signed and unsigned values
7027 @cindex comparison of signed and unsigned values, warning
7028 @cindex signed and unsigned values, comparison warning
7029 Warn when a comparison between signed and unsigned values could produce
7030 an incorrect result when the signed value is converted to unsigned.
7031 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7032 also enabled by @option{-Wextra}.
7033
7034 @item -Wsign-conversion
7035 @opindex Wsign-conversion
7036 @opindex Wno-sign-conversion
7037 Warn for implicit conversions that may change the sign of an integer
7038 value, like assigning a signed integer expression to an unsigned
7039 integer variable. An explicit cast silences the warning. In C, this
7040 option is enabled also by @option{-Wconversion}.
7041
7042 @item -Wfloat-conversion
7043 @opindex Wfloat-conversion
7044 @opindex Wno-float-conversion
7045 Warn for implicit conversions that reduce the precision of a real value.
7046 This includes conversions from real to integer, and from higher precision
7047 real to lower precision real values. This option is also enabled by
7048 @option{-Wconversion}.
7049
7050 @item -Wno-scalar-storage-order
7051 @opindex Wno-scalar-storage-order
7052 @opindex Wscalar-storage-order
7053 Do not warn on suspicious constructs involving reverse scalar storage order.
7054
7055 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7056 @opindex Wsized-deallocation
7057 @opindex Wno-sized-deallocation
7058 Warn about a definition of an unsized deallocation function
7059 @smallexample
7060 void operator delete (void *) noexcept;
7061 void operator delete[] (void *) noexcept;
7062 @end smallexample
7063 without a definition of the corresponding sized deallocation function
7064 @smallexample
7065 void operator delete (void *, std::size_t) noexcept;
7066 void operator delete[] (void *, std::size_t) noexcept;
7067 @end smallexample
7068 or vice versa. Enabled by @option{-Wextra} along with
7069 @option{-fsized-deallocation}.
7070
7071 @item -Wsizeof-pointer-div
7072 @opindex Wsizeof-pointer-div
7073 @opindex Wno-sizeof-pointer-div
7074 Warn for suspicious divisions of two sizeof expressions that divide
7075 the pointer size by the element size, which is the usual way to compute
7076 the array size but won't work out correctly with pointers. This warning
7077 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7078 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7079
7080 @item -Wsizeof-pointer-memaccess
7081 @opindex Wsizeof-pointer-memaccess
7082 @opindex Wno-sizeof-pointer-memaccess
7083 Warn for suspicious length parameters to certain string and memory built-in
7084 functions if the argument uses @code{sizeof}. This warning triggers for
7085 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7086 an array, but a pointer, and suggests a possible fix, or about
7087 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7088 also warns about calls to bounded string copy functions like @code{strncat}
7089 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7090 the source array. For example, in the following function the call to
7091 @code{strncat} specifies the size of the source string as the bound. That
7092 is almost certainly a mistake and so the call is diagnosed.
7093 @smallexample
7094 void make_file (const char *name)
7095 @{
7096 char path[PATH_MAX];
7097 strncpy (path, name, sizeof path - 1);
7098 strncat (path, ".text", sizeof ".text");
7099 @dots{}
7100 @}
7101 @end smallexample
7102
7103 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7104
7105 @item -Wsizeof-array-argument
7106 @opindex Wsizeof-array-argument
7107 @opindex Wno-sizeof-array-argument
7108 Warn when the @code{sizeof} operator is applied to a parameter that is
7109 declared as an array in a function definition. This warning is enabled by
7110 default for C and C++ programs.
7111
7112 @item -Wmemset-elt-size
7113 @opindex Wmemset-elt-size
7114 @opindex Wno-memset-elt-size
7115 Warn for suspicious calls to the @code{memset} built-in function, if the
7116 first argument references an array, and the third argument is a number
7117 equal to the number of elements, but not equal to the size of the array
7118 in memory. This indicates that the user has omitted a multiplication by
7119 the element size. This warning is enabled by @option{-Wall}.
7120
7121 @item -Wmemset-transposed-args
7122 @opindex Wmemset-transposed-args
7123 @opindex Wno-memset-transposed-args
7124 Warn for suspicious calls to the @code{memset} built-in function where
7125 the second argument is not zero and the third argument is zero. For
7126 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7127 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7128 is only emitted if the third argument is a literal zero. Otherwise, if
7129 it is an expression that is folded to zero, or a cast of zero to some
7130 type, it is far less likely that the arguments have been mistakenly
7131 transposed and no warning is emitted. This warning is enabled
7132 by @option{-Wall}.
7133
7134 @item -Waddress
7135 @opindex Waddress
7136 @opindex Wno-address
7137 Warn about suspicious uses of memory addresses. These include using
7138 the address of a function in a conditional expression, such as
7139 @code{void func(void); if (func)}, and comparisons against the memory
7140 address of a string literal, such as @code{if (x == "abc")}. Such
7141 uses typically indicate a programmer error: the address of a function
7142 always evaluates to true, so their use in a conditional usually
7143 indicate that the programmer forgot the parentheses in a function
7144 call; and comparisons against string literals result in unspecified
7145 behavior and are not portable in C, so they usually indicate that the
7146 programmer intended to use @code{strcmp}. This warning is enabled by
7147 @option{-Wall}.
7148
7149 @item -Waddress-of-packed-member
7150 @opindex Waddress-of-packed-member
7151 @opindex Wno-address-of-packed-member
7152 Warn when the address of packed member of struct or union is taken,
7153 which usually results in an unaligned pointer value. This is
7154 enabled by default.
7155
7156 @item -Wlogical-op
7157 @opindex Wlogical-op
7158 @opindex Wno-logical-op
7159 Warn about suspicious uses of logical operators in expressions.
7160 This includes using logical operators in contexts where a
7161 bit-wise operator is likely to be expected. Also warns when
7162 the operands of a logical operator are the same:
7163 @smallexample
7164 extern int a;
7165 if (a < 0 && a < 0) @{ @dots{} @}
7166 @end smallexample
7167
7168 @item -Wlogical-not-parentheses
7169 @opindex Wlogical-not-parentheses
7170 @opindex Wno-logical-not-parentheses
7171 Warn about logical not used on the left hand side operand of a comparison.
7172 This option does not warn if the right operand is considered to be a boolean
7173 expression. Its purpose is to detect suspicious code like the following:
7174 @smallexample
7175 int a;
7176 @dots{}
7177 if (!a > 1) @{ @dots{} @}
7178 @end smallexample
7179
7180 It is possible to suppress the warning by wrapping the LHS into
7181 parentheses:
7182 @smallexample
7183 if ((!a) > 1) @{ @dots{} @}
7184 @end smallexample
7185
7186 This warning is enabled by @option{-Wall}.
7187
7188 @item -Waggregate-return
7189 @opindex Waggregate-return
7190 @opindex Wno-aggregate-return
7191 Warn if any functions that return structures or unions are defined or
7192 called. (In languages where you can return an array, this also elicits
7193 a warning.)
7194
7195 @item -Wno-aggressive-loop-optimizations
7196 @opindex Wno-aggressive-loop-optimizations
7197 @opindex Waggressive-loop-optimizations
7198 Warn if in a loop with constant number of iterations the compiler detects
7199 undefined behavior in some statement during one or more of the iterations.
7200
7201 @item -Wno-attributes
7202 @opindex Wno-attributes
7203 @opindex Wattributes
7204 Do not warn if an unexpected @code{__attribute__} is used, such as
7205 unrecognized attributes, function attributes applied to variables,
7206 etc. This does not stop errors for incorrect use of supported
7207 attributes.
7208
7209 @item -Wno-builtin-declaration-mismatch
7210 @opindex Wno-builtin-declaration-mismatch
7211 @opindex Wbuiltin-declaration-mismatch
7212 Warn if a built-in function is declared with an incompatible signature
7213 or as a non-function, or when a built-in function declared with a type
7214 that does not include a prototype is called with arguments whose promoted
7215 types do not match those expected by the function. When @option{-Wextra}
7216 is specified, also warn when a built-in function that takes arguments is
7217 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7218 warning is enabled by default. To avoid the warning include the appropriate
7219 header to bring the prototypes of built-in functions into scope.
7220
7221 For example, the call to @code{memset} below is diagnosed by the warning
7222 because the function expects a value of type @code{size_t} as its argument
7223 but the type of @code{32} is @code{int}. With @option{-Wextra},
7224 the declaration of the function is diagnosed as well.
7225 @smallexample
7226 extern void* memset ();
7227 void f (void *d)
7228 @{
7229 memset (d, '\0', 32);
7230 @}
7231 @end smallexample
7232
7233 @item -Wno-builtin-macro-redefined
7234 @opindex Wno-builtin-macro-redefined
7235 @opindex Wbuiltin-macro-redefined
7236 Do not warn if certain built-in macros are redefined. This suppresses
7237 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7238 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7239
7240 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7241 @opindex Wstrict-prototypes
7242 @opindex Wno-strict-prototypes
7243 Warn if a function is declared or defined without specifying the
7244 argument types. (An old-style function definition is permitted without
7245 a warning if preceded by a declaration that specifies the argument
7246 types.)
7247
7248 @item -Wold-style-declaration @r{(C and Objective-C only)}
7249 @opindex Wold-style-declaration
7250 @opindex Wno-old-style-declaration
7251 Warn for obsolescent usages, according to the C Standard, in a
7252 declaration. For example, warn if storage-class specifiers like
7253 @code{static} are not the first things in a declaration. This warning
7254 is also enabled by @option{-Wextra}.
7255
7256 @item -Wold-style-definition @r{(C and Objective-C only)}
7257 @opindex Wold-style-definition
7258 @opindex Wno-old-style-definition
7259 Warn if an old-style function definition is used. A warning is given
7260 even if there is a previous prototype.
7261
7262 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7263 @opindex Wmissing-parameter-type
7264 @opindex Wno-missing-parameter-type
7265 A function parameter is declared without a type specifier in K&R-style
7266 functions:
7267
7268 @smallexample
7269 void foo(bar) @{ @}
7270 @end smallexample
7271
7272 This warning is also enabled by @option{-Wextra}.
7273
7274 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7275 @opindex Wmissing-prototypes
7276 @opindex Wno-missing-prototypes
7277 Warn if a global function is defined without a previous prototype
7278 declaration. This warning is issued even if the definition itself
7279 provides a prototype. Use this option to detect global functions
7280 that do not have a matching prototype declaration in a header file.
7281 This option is not valid for C++ because all function declarations
7282 provide prototypes and a non-matching declaration declares an
7283 overload rather than conflict with an earlier declaration.
7284 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7285
7286 @item -Wmissing-declarations
7287 @opindex Wmissing-declarations
7288 @opindex Wno-missing-declarations
7289 Warn if a global function is defined without a previous declaration.
7290 Do so even if the definition itself provides a prototype.
7291 Use this option to detect global functions that are not declared in
7292 header files. In C, no warnings are issued for functions with previous
7293 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7294 missing prototypes. In C++, no warnings are issued for function templates,
7295 or for inline functions, or for functions in anonymous namespaces.
7296
7297 @item -Wmissing-field-initializers
7298 @opindex Wmissing-field-initializers
7299 @opindex Wno-missing-field-initializers
7300 @opindex W
7301 @opindex Wextra
7302 @opindex Wno-extra
7303 Warn if a structure's initializer has some fields missing. For
7304 example, the following code causes such a warning, because
7305 @code{x.h} is implicitly zero:
7306
7307 @smallexample
7308 struct s @{ int f, g, h; @};
7309 struct s x = @{ 3, 4 @};
7310 @end smallexample
7311
7312 This option does not warn about designated initializers, so the following
7313 modification does not trigger a warning:
7314
7315 @smallexample
7316 struct s @{ int f, g, h; @};
7317 struct s x = @{ .f = 3, .g = 4 @};
7318 @end smallexample
7319
7320 In C this option does not warn about the universal zero initializer
7321 @samp{@{ 0 @}}:
7322
7323 @smallexample
7324 struct s @{ int f, g, h; @};
7325 struct s x = @{ 0 @};
7326 @end smallexample
7327
7328 Likewise, in C++ this option does not warn about the empty @{ @}
7329 initializer, for example:
7330
7331 @smallexample
7332 struct s @{ int f, g, h; @};
7333 s x = @{ @};
7334 @end smallexample
7335
7336 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7337 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7338
7339 @item -Wno-multichar
7340 @opindex Wno-multichar
7341 @opindex Wmultichar
7342 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7343 Usually they indicate a typo in the user's code, as they have
7344 implementation-defined values, and should not be used in portable code.
7345
7346 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7347 @opindex Wnormalized=
7348 @opindex Wnormalized
7349 @opindex Wno-normalized
7350 @cindex NFC
7351 @cindex NFKC
7352 @cindex character set, input normalization
7353 In ISO C and ISO C++, two identifiers are different if they are
7354 different sequences of characters. However, sometimes when characters
7355 outside the basic ASCII character set are used, you can have two
7356 different character sequences that look the same. To avoid confusion,
7357 the ISO 10646 standard sets out some @dfn{normalization rules} which
7358 when applied ensure that two sequences that look the same are turned into
7359 the same sequence. GCC can warn you if you are using identifiers that
7360 have not been normalized; this option controls that warning.
7361
7362 There are four levels of warning supported by GCC@. The default is
7363 @option{-Wnormalized=nfc}, which warns about any identifier that is
7364 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7365 recommended form for most uses. It is equivalent to
7366 @option{-Wnormalized}.
7367
7368 Unfortunately, there are some characters allowed in identifiers by
7369 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7370 identifiers. That is, there's no way to use these symbols in portable
7371 ISO C or C++ and have all your identifiers in NFC@.
7372 @option{-Wnormalized=id} suppresses the warning for these characters.
7373 It is hoped that future versions of the standards involved will correct
7374 this, which is why this option is not the default.
7375
7376 You can switch the warning off for all characters by writing
7377 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7378 only do this if you are using some other normalization scheme (like
7379 ``D''), because otherwise you can easily create bugs that are
7380 literally impossible to see.
7381
7382 Some characters in ISO 10646 have distinct meanings but look identical
7383 in some fonts or display methodologies, especially once formatting has
7384 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7385 LETTER N'', displays just like a regular @code{n} that has been
7386 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7387 normalization scheme to convert all these into a standard form as
7388 well, and GCC warns if your code is not in NFKC if you use
7389 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7390 about every identifier that contains the letter O because it might be
7391 confused with the digit 0, and so is not the default, but may be
7392 useful as a local coding convention if the programming environment
7393 cannot be fixed to display these characters distinctly.
7394
7395 @item -Wno-attribute-warning
7396 @opindex Wno-attribute-warning
7397 @opindex Wattribute-warning
7398 Do not warn about usage of functions (@pxref{Function Attributes})
7399 declared with @code{warning} attribute. By default, this warning is
7400 enabled. @option{-Wno-attribute-warning} can be used to disable the
7401 warning or @option{-Wno-error=attribute-warning} can be used to
7402 disable the error when compiled with @option{-Werror} flag.
7403
7404 @item -Wno-deprecated
7405 @opindex Wno-deprecated
7406 @opindex Wdeprecated
7407 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7408
7409 @item -Wno-deprecated-declarations
7410 @opindex Wno-deprecated-declarations
7411 @opindex Wdeprecated-declarations
7412 Do not warn about uses of functions (@pxref{Function Attributes}),
7413 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7414 Attributes}) marked as deprecated by using the @code{deprecated}
7415 attribute.
7416
7417 @item -Wno-overflow
7418 @opindex Wno-overflow
7419 @opindex Woverflow
7420 Do not warn about compile-time overflow in constant expressions.
7421
7422 @item -Wno-odr
7423 @opindex Wno-odr
7424 @opindex Wodr
7425 Warn about One Definition Rule violations during link-time optimization.
7426 Enabled by default.
7427
7428 @item -Wopenmp-simd
7429 @opindex Wopenmp-simd
7430 @opindex Wno-openmp-simd
7431 Warn if the vectorizer cost model overrides the OpenMP
7432 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7433 option can be used to relax the cost model.
7434
7435 @item -Woverride-init @r{(C and Objective-C only)}
7436 @opindex Woverride-init
7437 @opindex Wno-override-init
7438 @opindex W
7439 @opindex Wextra
7440 @opindex Wno-extra
7441 Warn if an initialized field without side effects is overridden when
7442 using designated initializers (@pxref{Designated Inits, , Designated
7443 Initializers}).
7444
7445 This warning is included in @option{-Wextra}. To get other
7446 @option{-Wextra} warnings without this one, use @option{-Wextra
7447 -Wno-override-init}.
7448
7449 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7450 @opindex Woverride-init-side-effects
7451 @opindex Wno-override-init-side-effects
7452 Warn if an initialized field with side effects is overridden when
7453 using designated initializers (@pxref{Designated Inits, , Designated
7454 Initializers}). This warning is enabled by default.
7455
7456 @item -Wpacked
7457 @opindex Wpacked
7458 @opindex Wno-packed
7459 Warn if a structure is given the packed attribute, but the packed
7460 attribute has no effect on the layout or size of the structure.
7461 Such structures may be mis-aligned for little benefit. For
7462 instance, in this code, the variable @code{f.x} in @code{struct bar}
7463 is misaligned even though @code{struct bar} does not itself
7464 have the packed attribute:
7465
7466 @smallexample
7467 @group
7468 struct foo @{
7469 int x;
7470 char a, b, c, d;
7471 @} __attribute__((packed));
7472 struct bar @{
7473 char z;
7474 struct foo f;
7475 @};
7476 @end group
7477 @end smallexample
7478
7479 @item -Wpacked-bitfield-compat
7480 @opindex Wpacked-bitfield-compat
7481 @opindex Wno-packed-bitfield-compat
7482 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7483 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7484 the change can lead to differences in the structure layout. GCC
7485 informs you when the offset of such a field has changed in GCC 4.4.
7486 For example there is no longer a 4-bit padding between field @code{a}
7487 and @code{b} in this structure:
7488
7489 @smallexample
7490 struct foo
7491 @{
7492 char a:4;
7493 char b:8;
7494 @} __attribute__ ((packed));
7495 @end smallexample
7496
7497 This warning is enabled by default. Use
7498 @option{-Wno-packed-bitfield-compat} to disable this warning.
7499
7500 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7501 @opindex Wpacked-not-aligned
7502 @opindex Wno-packed-not-aligned
7503 Warn if a structure field with explicitly specified alignment in a
7504 packed struct or union is misaligned. For example, a warning will
7505 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7506 'struct S' is less than 8}, in this code:
7507
7508 @smallexample
7509 @group
7510 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7511 struct __attribute__ ((packed)) S @{
7512 struct S8 s8;
7513 @};
7514 @end group
7515 @end smallexample
7516
7517 This warning is enabled by @option{-Wall}.
7518
7519 @item -Wpadded
7520 @opindex Wpadded
7521 @opindex Wno-padded
7522 Warn if padding is included in a structure, either to align an element
7523 of the structure or to align the whole structure. Sometimes when this
7524 happens it is possible to rearrange the fields of the structure to
7525 reduce the padding and so make the structure smaller.
7526
7527 @item -Wredundant-decls
7528 @opindex Wredundant-decls
7529 @opindex Wno-redundant-decls
7530 Warn if anything is declared more than once in the same scope, even in
7531 cases where multiple declaration is valid and changes nothing.
7532
7533 @item -Wno-restrict
7534 @opindex Wrestrict
7535 @opindex Wno-restrict
7536 Warn when an object referenced by a @code{restrict}-qualified parameter
7537 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7538 argument, or when copies between such objects overlap. For example,
7539 the call to the @code{strcpy} function below attempts to truncate the string
7540 by replacing its initial characters with the last four. However, because
7541 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7542 the call is diagnosed.
7543
7544 @smallexample
7545 void foo (void)
7546 @{
7547 char a[] = "abcd1234";
7548 strcpy (a, a + 4);
7549 @dots{}
7550 @}
7551 @end smallexample
7552 The @option{-Wrestrict} option detects some instances of simple overlap
7553 even without optimization but works best at @option{-O2} and above. It
7554 is included in @option{-Wall}.
7555
7556 @item -Wnested-externs @r{(C and Objective-C only)}
7557 @opindex Wnested-externs
7558 @opindex Wno-nested-externs
7559 Warn if an @code{extern} declaration is encountered within a function.
7560
7561 @item -Wno-inherited-variadic-ctor
7562 @opindex Winherited-variadic-ctor
7563 @opindex Wno-inherited-variadic-ctor
7564 Suppress warnings about use of C++11 inheriting constructors when the
7565 base class inherited from has a C variadic constructor; the warning is
7566 on by default because the ellipsis is not inherited.
7567
7568 @item -Winline
7569 @opindex Winline
7570 @opindex Wno-inline
7571 Warn if a function that is declared as inline cannot be inlined.
7572 Even with this option, the compiler does not warn about failures to
7573 inline functions declared in system headers.
7574
7575 The compiler uses a variety of heuristics to determine whether or not
7576 to inline a function. For example, the compiler takes into account
7577 the size of the function being inlined and the amount of inlining
7578 that has already been done in the current function. Therefore,
7579 seemingly insignificant changes in the source program can cause the
7580 warnings produced by @option{-Winline} to appear or disappear.
7581
7582 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7583 @opindex Wno-invalid-offsetof
7584 @opindex Winvalid-offsetof
7585 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7586 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7587 to a non-standard-layout type is undefined. In existing C++ implementations,
7588 however, @code{offsetof} typically gives meaningful results.
7589 This flag is for users who are aware that they are
7590 writing nonportable code and who have deliberately chosen to ignore the
7591 warning about it.
7592
7593 The restrictions on @code{offsetof} may be relaxed in a future version
7594 of the C++ standard.
7595
7596 @item -Wint-in-bool-context
7597 @opindex Wint-in-bool-context
7598 @opindex Wno-int-in-bool-context
7599 Warn for suspicious use of integer values where boolean values are expected,
7600 such as conditional expressions (?:) using non-boolean integer constants in
7601 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7602 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7603 for all kinds of multiplications regardless of the data type.
7604 This warning is enabled by @option{-Wall}.
7605
7606 @item -Wno-int-to-pointer-cast
7607 @opindex Wno-int-to-pointer-cast
7608 @opindex Wint-to-pointer-cast
7609 Suppress warnings from casts to pointer type of an integer of a
7610 different size. In C++, casting to a pointer type of smaller size is
7611 an error. @option{Wint-to-pointer-cast} is enabled by default.
7612
7613
7614 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7615 @opindex Wno-pointer-to-int-cast
7616 @opindex Wpointer-to-int-cast
7617 Suppress warnings from casts from a pointer to an integer type of a
7618 different size.
7619
7620 @item -Winvalid-pch
7621 @opindex Winvalid-pch
7622 @opindex Wno-invalid-pch
7623 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7624 the search path but cannot be used.
7625
7626 @item -Wlong-long
7627 @opindex Wlong-long
7628 @opindex Wno-long-long
7629 Warn if @code{long long} type is used. This is enabled by either
7630 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7631 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7632
7633 @item -Wvariadic-macros
7634 @opindex Wvariadic-macros
7635 @opindex Wno-variadic-macros
7636 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7637 alternate syntax is used in ISO C99 mode. This is enabled by either
7638 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7639 messages, use @option{-Wno-variadic-macros}.
7640
7641 @item -Wvarargs
7642 @opindex Wvarargs
7643 @opindex Wno-varargs
7644 Warn upon questionable usage of the macros used to handle variable
7645 arguments like @code{va_start}. This is default. To inhibit the
7646 warning messages, use @option{-Wno-varargs}.
7647
7648 @item -Wvector-operation-performance
7649 @opindex Wvector-operation-performance
7650 @opindex Wno-vector-operation-performance
7651 Warn if vector operation is not implemented via SIMD capabilities of the
7652 architecture. Mainly useful for the performance tuning.
7653 Vector operation can be implemented @code{piecewise}, which means that the
7654 scalar operation is performed on every vector element;
7655 @code{in parallel}, which means that the vector operation is implemented
7656 using scalars of wider type, which normally is more performance efficient;
7657 and @code{as a single scalar}, which means that vector fits into a
7658 scalar type.
7659
7660 @item -Wno-virtual-move-assign
7661 @opindex Wvirtual-move-assign
7662 @opindex Wno-virtual-move-assign
7663 Suppress warnings about inheriting from a virtual base with a
7664 non-trivial C++11 move assignment operator. This is dangerous because
7665 if the virtual base is reachable along more than one path, it is
7666 moved multiple times, which can mean both objects end up in the
7667 moved-from state. If the move assignment operator is written to avoid
7668 moving from a moved-from object, this warning can be disabled.
7669
7670 @item -Wvla
7671 @opindex Wvla
7672 @opindex Wno-vla
7673 Warn if a variable-length array is used in the code.
7674 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7675 the variable-length array.
7676
7677 @item -Wvla-larger-than=@var{byte-size}
7678 @opindex Wvla-larger-than=
7679 @opindex Wno-vla-larger-than
7680 If this option is used, the compiler will warn for declarations of
7681 variable-length arrays whose size is either unbounded, or bounded
7682 by an argument that allows the array size to exceed @var{byte-size}
7683 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7684 works, but with variable-length arrays.
7685
7686 Note that GCC may optimize small variable-length arrays of a known
7687 value into plain arrays, so this warning may not get triggered for
7688 such arrays.
7689
7690 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7691 is typically only effective when @option{-ftree-vrp} is active (default
7692 for @option{-O2} and above).
7693
7694 See also @option{-Walloca-larger-than=@var{byte-size}}.
7695
7696 @item -Wno-vla-larger-than
7697 @opindex Wno-vla-larger-than
7698 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7699 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7700
7701 @item -Wvolatile-register-var
7702 @opindex Wvolatile-register-var
7703 @opindex Wno-volatile-register-var
7704 Warn if a register variable is declared volatile. The volatile
7705 modifier does not inhibit all optimizations that may eliminate reads
7706 and/or writes to register variables. This warning is enabled by
7707 @option{-Wall}.
7708
7709 @item -Wdisabled-optimization
7710 @opindex Wdisabled-optimization
7711 @opindex Wno-disabled-optimization
7712 Warn if a requested optimization pass is disabled. This warning does
7713 not generally indicate that there is anything wrong with your code; it
7714 merely indicates that GCC's optimizers are unable to handle the code
7715 effectively. Often, the problem is that your code is too big or too
7716 complex; GCC refuses to optimize programs when the optimization
7717 itself is likely to take inordinate amounts of time.
7718
7719 @item -Wpointer-sign @r{(C and Objective-C only)}
7720 @opindex Wpointer-sign
7721 @opindex Wno-pointer-sign
7722 Warn for pointer argument passing or assignment with different signedness.
7723 This option is only supported for C and Objective-C@. It is implied by
7724 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7725 @option{-Wno-pointer-sign}.
7726
7727 @item -Wstack-protector
7728 @opindex Wstack-protector
7729 @opindex Wno-stack-protector
7730 This option is only active when @option{-fstack-protector} is active. It
7731 warns about functions that are not protected against stack smashing.
7732
7733 @item -Woverlength-strings
7734 @opindex Woverlength-strings
7735 @opindex Wno-overlength-strings
7736 Warn about string constants that are longer than the ``minimum
7737 maximum'' length specified in the C standard. Modern compilers
7738 generally allow string constants that are much longer than the
7739 standard's minimum limit, but very portable programs should avoid
7740 using longer strings.
7741
7742 The limit applies @emph{after} string constant concatenation, and does
7743 not count the trailing NUL@. In C90, the limit was 509 characters; in
7744 C99, it was raised to 4095. C++98 does not specify a normative
7745 minimum maximum, so we do not diagnose overlength strings in C++@.
7746
7747 This option is implied by @option{-Wpedantic}, and can be disabled with
7748 @option{-Wno-overlength-strings}.
7749
7750 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7751 @opindex Wunsuffixed-float-constants
7752 @opindex Wno-unsuffixed-float-constants
7753
7754 Issue a warning for any floating constant that does not have
7755 a suffix. When used together with @option{-Wsystem-headers} it
7756 warns about such constants in system header files. This can be useful
7757 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7758 from the decimal floating-point extension to C99.
7759
7760 @item -Wno-designated-init @r{(C and Objective-C only)}
7761 Suppress warnings when a positional initializer is used to initialize
7762 a structure that has been marked with the @code{designated_init}
7763 attribute.
7764
7765 @item -Whsa
7766 Issue a warning when HSAIL cannot be emitted for the compiled function or
7767 OpenMP construct.
7768
7769 @end table
7770
7771 @node Debugging Options
7772 @section Options for Debugging Your Program
7773 @cindex options, debugging
7774 @cindex debugging information options
7775
7776 To tell GCC to emit extra information for use by a debugger, in almost
7777 all cases you need only to add @option{-g} to your other options.
7778
7779 GCC allows you to use @option{-g} with
7780 @option{-O}. The shortcuts taken by optimized code may occasionally
7781 be surprising: some variables you declared may not exist
7782 at all; flow of control may briefly move where you did not expect it;
7783 some statements may not be executed because they compute constant
7784 results or their values are already at hand; some statements may
7785 execute in different places because they have been moved out of loops.
7786 Nevertheless it is possible to debug optimized output. This makes
7787 it reasonable to use the optimizer for programs that might have bugs.
7788
7789 If you are not using some other optimization option, consider
7790 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7791 With no @option{-O} option at all, some compiler passes that collect
7792 information useful for debugging do not run at all, so that
7793 @option{-Og} may result in a better debugging experience.
7794
7795 @table @gcctabopt
7796 @item -g
7797 @opindex g
7798 Produce debugging information in the operating system's native format
7799 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7800 information.
7801
7802 On most systems that use stabs format, @option{-g} enables use of extra
7803 debugging information that only GDB can use; this extra information
7804 makes debugging work better in GDB but probably makes other debuggers
7805 crash or
7806 refuse to read the program. If you want to control for certain whether
7807 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7808 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7809
7810 @item -ggdb
7811 @opindex ggdb
7812 Produce debugging information for use by GDB@. This means to use the
7813 most expressive format available (DWARF, stabs, or the native format
7814 if neither of those are supported), including GDB extensions if at all
7815 possible.
7816
7817 @item -gdwarf
7818 @itemx -gdwarf-@var{version}
7819 @opindex gdwarf
7820 Produce debugging information in DWARF format (if that is supported).
7821 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7822 for most targets is 4. DWARF Version 5 is only experimental.
7823
7824 Note that with DWARF Version 2, some ports require and always
7825 use some non-conflicting DWARF 3 extensions in the unwind tables.
7826
7827 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7828 for maximum benefit.
7829
7830 GCC no longer supports DWARF Version 1, which is substantially
7831 different than Version 2 and later. For historical reasons, some
7832 other DWARF-related options such as
7833 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7834 in their names, but apply to all currently-supported versions of DWARF.
7835
7836 @item -gstabs
7837 @opindex gstabs
7838 Produce debugging information in stabs format (if that is supported),
7839 without GDB extensions. This is the format used by DBX on most BSD
7840 systems. On MIPS, Alpha and System V Release 4 systems this option
7841 produces stabs debugging output that is not understood by DBX@.
7842 On System V Release 4 systems this option requires the GNU assembler.
7843
7844 @item -gstabs+
7845 @opindex gstabs+
7846 Produce debugging information in stabs format (if that is supported),
7847 using GNU extensions understood only by the GNU debugger (GDB)@. The
7848 use of these extensions is likely to make other debuggers crash or
7849 refuse to read the program.
7850
7851 @item -gxcoff
7852 @opindex gxcoff
7853 Produce debugging information in XCOFF format (if that is supported).
7854 This is the format used by the DBX debugger on IBM RS/6000 systems.
7855
7856 @item -gxcoff+
7857 @opindex gxcoff+
7858 Produce debugging information in XCOFF format (if that is supported),
7859 using GNU extensions understood only by the GNU debugger (GDB)@. The
7860 use of these extensions is likely to make other debuggers crash or
7861 refuse to read the program, and may cause assemblers other than the GNU
7862 assembler (GAS) to fail with an error.
7863
7864 @item -gvms
7865 @opindex gvms
7866 Produce debugging information in Alpha/VMS debug format (if that is
7867 supported). This is the format used by DEBUG on Alpha/VMS systems.
7868
7869 @item -g@var{level}
7870 @itemx -ggdb@var{level}
7871 @itemx -gstabs@var{level}
7872 @itemx -gxcoff@var{level}
7873 @itemx -gvms@var{level}
7874 Request debugging information and also use @var{level} to specify how
7875 much information. The default level is 2.
7876
7877 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7878 @option{-g}.
7879
7880 Level 1 produces minimal information, enough for making backtraces in
7881 parts of the program that you don't plan to debug. This includes
7882 descriptions of functions and external variables, and line number
7883 tables, but no information about local variables.
7884
7885 Level 3 includes extra information, such as all the macro definitions
7886 present in the program. Some debuggers support macro expansion when
7887 you use @option{-g3}.
7888
7889 If you use multiple @option{-g} options, with or without level numbers,
7890 the last such option is the one that is effective.
7891
7892 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7893 confusion with @option{-gdwarf-@var{level}}.
7894 Instead use an additional @option{-g@var{level}} option to change the
7895 debug level for DWARF.
7896
7897 @item -fno-eliminate-unused-debug-symbols
7898 @opindex feliminate-unused-debug-symbols
7899 @opindex fno-eliminate-unused-debug-symbols
7900 By default, no debug information is produced for symbols that are not actually
7901 used. Use this option if you want debug information for all symbols.
7902
7903 @item -femit-class-debug-always
7904 @opindex femit-class-debug-always
7905 Instead of emitting debugging information for a C++ class in only one
7906 object file, emit it in all object files using the class. This option
7907 should be used only with debuggers that are unable to handle the way GCC
7908 normally emits debugging information for classes because using this
7909 option increases the size of debugging information by as much as a
7910 factor of two.
7911
7912 @item -fno-merge-debug-strings
7913 @opindex fmerge-debug-strings
7914 @opindex fno-merge-debug-strings
7915 Direct the linker to not merge together strings in the debugging
7916 information that are identical in different object files. Merging is
7917 not supported by all assemblers or linkers. Merging decreases the size
7918 of the debug information in the output file at the cost of increasing
7919 link processing time. Merging is enabled by default.
7920
7921 @item -fdebug-prefix-map=@var{old}=@var{new}
7922 @opindex fdebug-prefix-map
7923 When compiling files residing in directory @file{@var{old}}, record
7924 debugging information describing them as if the files resided in
7925 directory @file{@var{new}} instead. This can be used to replace a
7926 build-time path with an install-time path in the debug info. It can
7927 also be used to change an absolute path to a relative path by using
7928 @file{.} for @var{new}. This can give more reproducible builds, which
7929 are location independent, but may require an extra command to tell GDB
7930 where to find the source files. See also @option{-ffile-prefix-map}.
7931
7932 @item -fvar-tracking
7933 @opindex fvar-tracking
7934 Run variable tracking pass. It computes where variables are stored at each
7935 position in code. Better debugging information is then generated
7936 (if the debugging information format supports this information).
7937
7938 It is enabled by default when compiling with optimization (@option{-Os},
7939 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7940 the debug info format supports it.
7941
7942 @item -fvar-tracking-assignments
7943 @opindex fvar-tracking-assignments
7944 @opindex fno-var-tracking-assignments
7945 Annotate assignments to user variables early in the compilation and
7946 attempt to carry the annotations over throughout the compilation all the
7947 way to the end, in an attempt to improve debug information while
7948 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7949
7950 It can be enabled even if var-tracking is disabled, in which case
7951 annotations are created and maintained, but discarded at the end.
7952 By default, this flag is enabled together with @option{-fvar-tracking},
7953 except when selective scheduling is enabled.
7954
7955 @item -gsplit-dwarf
7956 @opindex gsplit-dwarf
7957 Separate as much DWARF debugging information as possible into a
7958 separate output file with the extension @file{.dwo}. This option allows
7959 the build system to avoid linking files with debug information. To
7960 be useful, this option requires a debugger capable of reading @file{.dwo}
7961 files.
7962
7963 @item -gdescribe-dies
7964 @opindex gdescribe-dies
7965 Add description attributes to some DWARF DIEs that have no name attribute,
7966 such as artificial variables, external references and call site
7967 parameter DIEs.
7968
7969 @item -gpubnames
7970 @opindex gpubnames
7971 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7972
7973 @item -ggnu-pubnames
7974 @opindex ggnu-pubnames
7975 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7976 suitable for conversion into a GDB@ index. This option is only useful
7977 with a linker that can produce GDB@ index version 7.
7978
7979 @item -fdebug-types-section
7980 @opindex fdebug-types-section
7981 @opindex fno-debug-types-section
7982 When using DWARF Version 4 or higher, type DIEs can be put into
7983 their own @code{.debug_types} section instead of making them part of the
7984 @code{.debug_info} section. It is more efficient to put them in a separate
7985 comdat section since the linker can then remove duplicates.
7986 But not all DWARF consumers support @code{.debug_types} sections yet
7987 and on some objects @code{.debug_types} produces larger instead of smaller
7988 debugging information.
7989
7990 @item -grecord-gcc-switches
7991 @itemx -gno-record-gcc-switches
7992 @opindex grecord-gcc-switches
7993 @opindex gno-record-gcc-switches
7994 This switch causes the command-line options used to invoke the
7995 compiler that may affect code generation to be appended to the
7996 DW_AT_producer attribute in DWARF debugging information. The options
7997 are concatenated with spaces separating them from each other and from
7998 the compiler version.
7999 It is enabled by default.
8000 See also @option{-frecord-gcc-switches} for another
8001 way of storing compiler options into the object file.
8002
8003 @item -gstrict-dwarf
8004 @opindex gstrict-dwarf
8005 Disallow using extensions of later DWARF standard version than selected
8006 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
8007 DWARF extensions from later standard versions is allowed.
8008
8009 @item -gno-strict-dwarf
8010 @opindex gno-strict-dwarf
8011 Allow using extensions of later DWARF standard version than selected with
8012 @option{-gdwarf-@var{version}}.
8013
8014 @item -gas-loc-support
8015 @opindex gas-loc-support
8016 Inform the compiler that the assembler supports @code{.loc} directives.
8017 It may then use them for the assembler to generate DWARF2+ line number
8018 tables.
8019
8020 This is generally desirable, because assembler-generated line-number
8021 tables are a lot more compact than those the compiler can generate
8022 itself.
8023
8024 This option will be enabled by default if, at GCC configure time, the
8025 assembler was found to support such directives.
8026
8027 @item -gno-as-loc-support
8028 @opindex gno-as-loc-support
8029 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8030 line number tables are to be generated.
8031
8032 @item -gas-locview-support
8033 @opindex gas-locview-support
8034 Inform the compiler that the assembler supports @code{view} assignment
8035 and reset assertion checking in @code{.loc} directives.
8036
8037 This option will be enabled by default if, at GCC configure time, the
8038 assembler was found to support them.
8039
8040 @item -gno-as-locview-support
8041 Force GCC to assign view numbers internally, if
8042 @option{-gvariable-location-views} are explicitly requested.
8043
8044 @item -gcolumn-info
8045 @itemx -gno-column-info
8046 @opindex gcolumn-info
8047 @opindex gno-column-info
8048 Emit location column information into DWARF debugging information, rather
8049 than just file and line.
8050 This option is enabled by default.
8051
8052 @item -gstatement-frontiers
8053 @itemx -gno-statement-frontiers
8054 @opindex gstatement-frontiers
8055 @opindex gno-statement-frontiers
8056 This option causes GCC to create markers in the internal representation
8057 at the beginning of statements, and to keep them roughly in place
8058 throughout compilation, using them to guide the output of @code{is_stmt}
8059 markers in the line number table. This is enabled by default when
8060 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8061 @dots{}), and outputting DWARF 2 debug information at the normal level.
8062
8063 @item -gvariable-location-views
8064 @itemx -gvariable-location-views=incompat5
8065 @itemx -gno-variable-location-views
8066 @opindex gvariable-location-views
8067 @opindex gvariable-location-views=incompat5
8068 @opindex gno-variable-location-views
8069 Augment variable location lists with progressive view numbers implied
8070 from the line number table. This enables debug information consumers to
8071 inspect state at certain points of the program, even if no instructions
8072 associated with the corresponding source locations are present at that
8073 point. If the assembler lacks support for view numbers in line number
8074 tables, this will cause the compiler to emit the line number table,
8075 which generally makes them somewhat less compact. The augmented line
8076 number tables and location lists are fully backward-compatible, so they
8077 can be consumed by debug information consumers that are not aware of
8078 these augmentations, but they won't derive any benefit from them either.
8079
8080 This is enabled by default when outputting DWARF 2 debug information at
8081 the normal level, as long as there is assembler support,
8082 @option{-fvar-tracking-assignments} is enabled and
8083 @option{-gstrict-dwarf} is not. When assembler support is not
8084 available, this may still be enabled, but it will force GCC to output
8085 internal line number tables, and if
8086 @option{-ginternal-reset-location-views} is not enabled, that will most
8087 certainly lead to silently mismatching location views.
8088
8089 There is a proposed representation for view numbers that is not backward
8090 compatible with the location list format introduced in DWARF 5, that can
8091 be enabled with @option{-gvariable-location-views=incompat5}. This
8092 option may be removed in the future, is only provided as a reference
8093 implementation of the proposed representation. Debug information
8094 consumers are not expected to support this extended format, and they
8095 would be rendered unable to decode location lists using it.
8096
8097 @item -ginternal-reset-location-views
8098 @itemx -gnointernal-reset-location-views
8099 @opindex ginternal-reset-location-views
8100 @opindex gno-internal-reset-location-views
8101 Attempt to determine location views that can be omitted from location
8102 view lists. This requires the compiler to have very accurate insn
8103 length estimates, which isn't always the case, and it may cause
8104 incorrect view lists to be generated silently when using an assembler
8105 that does not support location view lists. The GNU assembler will flag
8106 any such error as a @code{view number mismatch}. This is only enabled
8107 on ports that define a reliable estimation function.
8108
8109 @item -ginline-points
8110 @itemx -gno-inline-points
8111 @opindex ginline-points
8112 @opindex gno-inline-points
8113 Generate extended debug information for inlined functions. Location
8114 view tracking markers are inserted at inlined entry points, so that
8115 address and view numbers can be computed and output in debug
8116 information. This can be enabled independently of location views, in
8117 which case the view numbers won't be output, but it can only be enabled
8118 along with statement frontiers, and it is only enabled by default if
8119 location views are enabled.
8120
8121 @item -gz@r{[}=@var{type}@r{]}
8122 @opindex gz
8123 Produce compressed debug sections in DWARF format, if that is supported.
8124 If @var{type} is not given, the default type depends on the capabilities
8125 of the assembler and linker used. @var{type} may be one of
8126 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8127 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8128 compression in traditional GNU format). If the linker doesn't support
8129 writing compressed debug sections, the option is rejected. Otherwise,
8130 if the assembler does not support them, @option{-gz} is silently ignored
8131 when producing object files.
8132
8133 @item -femit-struct-debug-baseonly
8134 @opindex femit-struct-debug-baseonly
8135 Emit debug information for struct-like types
8136 only when the base name of the compilation source file
8137 matches the base name of file in which the struct is defined.
8138
8139 This option substantially reduces the size of debugging information,
8140 but at significant potential loss in type information to the debugger.
8141 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8142 See @option{-femit-struct-debug-detailed} for more detailed control.
8143
8144 This option works only with DWARF debug output.
8145
8146 @item -femit-struct-debug-reduced
8147 @opindex femit-struct-debug-reduced
8148 Emit debug information for struct-like types
8149 only when the base name of the compilation source file
8150 matches the base name of file in which the type is defined,
8151 unless the struct is a template or defined in a system header.
8152
8153 This option significantly reduces the size of debugging information,
8154 with some potential loss in type information to the debugger.
8155 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8156 See @option{-femit-struct-debug-detailed} for more detailed control.
8157
8158 This option works only with DWARF debug output.
8159
8160 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8161 @opindex femit-struct-debug-detailed
8162 Specify the struct-like types
8163 for which the compiler generates debug information.
8164 The intent is to reduce duplicate struct debug information
8165 between different object files within the same program.
8166
8167 This option is a detailed version of
8168 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8169 which serves for most needs.
8170
8171 A specification has the syntax@*
8172 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8173
8174 The optional first word limits the specification to
8175 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8176 A struct type is used directly when it is the type of a variable, member.
8177 Indirect uses arise through pointers to structs.
8178 That is, when use of an incomplete struct is valid, the use is indirect.
8179 An example is
8180 @samp{struct one direct; struct two * indirect;}.
8181
8182 The optional second word limits the specification to
8183 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8184 Generic structs are a bit complicated to explain.
8185 For C++, these are non-explicit specializations of template classes,
8186 or non-template classes within the above.
8187 Other programming languages have generics,
8188 but @option{-femit-struct-debug-detailed} does not yet implement them.
8189
8190 The third word specifies the source files for those
8191 structs for which the compiler should emit debug information.
8192 The values @samp{none} and @samp{any} have the normal meaning.
8193 The value @samp{base} means that
8194 the base of name of the file in which the type declaration appears
8195 must match the base of the name of the main compilation file.
8196 In practice, this means that when compiling @file{foo.c}, debug information
8197 is generated for types declared in that file and @file{foo.h},
8198 but not other header files.
8199 The value @samp{sys} means those types satisfying @samp{base}
8200 or declared in system or compiler headers.
8201
8202 You may need to experiment to determine the best settings for your application.
8203
8204 The default is @option{-femit-struct-debug-detailed=all}.
8205
8206 This option works only with DWARF debug output.
8207
8208 @item -fno-dwarf2-cfi-asm
8209 @opindex fdwarf2-cfi-asm
8210 @opindex fno-dwarf2-cfi-asm
8211 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8212 instead of using GAS @code{.cfi_*} directives.
8213
8214 @item -fno-eliminate-unused-debug-types
8215 @opindex feliminate-unused-debug-types
8216 @opindex fno-eliminate-unused-debug-types
8217 Normally, when producing DWARF output, GCC avoids producing debug symbol
8218 output for types that are nowhere used in the source file being compiled.
8219 Sometimes it is useful to have GCC emit debugging
8220 information for all types declared in a compilation
8221 unit, regardless of whether or not they are actually used
8222 in that compilation unit, for example
8223 if, in the debugger, you want to cast a value to a type that is
8224 not actually used in your program (but is declared). More often,
8225 however, this results in a significant amount of wasted space.
8226 @end table
8227
8228 @node Optimize Options
8229 @section Options That Control Optimization
8230 @cindex optimize options
8231 @cindex options, optimization
8232
8233 These options control various sorts of optimizations.
8234
8235 Without any optimization option, the compiler's goal is to reduce the
8236 cost of compilation and to make debugging produce the expected
8237 results. Statements are independent: if you stop the program with a
8238 breakpoint between statements, you can then assign a new value to any
8239 variable or change the program counter to any other statement in the
8240 function and get exactly the results you expect from the source
8241 code.
8242
8243 Turning on optimization flags makes the compiler attempt to improve
8244 the performance and/or code size at the expense of compilation time
8245 and possibly the ability to debug the program.
8246
8247 The compiler performs optimization based on the knowledge it has of the
8248 program. Compiling multiple files at once to a single output file mode allows
8249 the compiler to use information gained from all of the files when compiling
8250 each of them.
8251
8252 Not all optimizations are controlled directly by a flag. Only
8253 optimizations that have a flag are listed in this section.
8254
8255 Most optimizations are completely disabled at @option{-O0} or if an
8256 @option{-O} level is not set on the command line, even if individual
8257 optimization flags are specified. Similarly, @option{-Og} suppresses
8258 many optimization passes.
8259
8260 Depending on the target and how GCC was configured, a slightly different
8261 set of optimizations may be enabled at each @option{-O} level than
8262 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8263 to find out the exact set of optimizations that are enabled at each level.
8264 @xref{Overall Options}, for examples.
8265
8266 @table @gcctabopt
8267 @item -O
8268 @itemx -O1
8269 @opindex O
8270 @opindex O1
8271 Optimize. Optimizing compilation takes somewhat more time, and a lot
8272 more memory for a large function.
8273
8274 With @option{-O}, the compiler tries to reduce code size and execution
8275 time, without performing any optimizations that take a great deal of
8276 compilation time.
8277
8278 @c Note that in addition to the default_options_table list in opts.c,
8279 @c several optimization flags default to true but control optimization
8280 @c passes that are explicitly disabled at -O0.
8281
8282 @option{-O} turns on the following optimization flags:
8283
8284 @c Please keep the following list alphabetized.
8285 @gccoptlist{-fauto-inc-dec @gol
8286 -fbranch-count-reg @gol
8287 -fcombine-stack-adjustments @gol
8288 -fcompare-elim @gol
8289 -fcprop-registers @gol
8290 -fdce @gol
8291 -fdefer-pop @gol
8292 -fdelayed-branch @gol
8293 -fdse @gol
8294 -fforward-propagate @gol
8295 -fguess-branch-probability @gol
8296 -fif-conversion @gol
8297 -fif-conversion2 @gol
8298 -finline-functions-called-once @gol
8299 -fipa-profile @gol
8300 -fipa-pure-const @gol
8301 -fipa-reference @gol
8302 -fipa-reference-addressable @gol
8303 -fmerge-constants @gol
8304 -fmove-loop-invariants @gol
8305 -fomit-frame-pointer @gol
8306 -freorder-blocks @gol
8307 -fshrink-wrap @gol
8308 -fshrink-wrap-separate @gol
8309 -fsplit-wide-types @gol
8310 -fssa-backprop @gol
8311 -fssa-phiopt @gol
8312 -ftree-bit-ccp @gol
8313 -ftree-ccp @gol
8314 -ftree-ch @gol
8315 -ftree-coalesce-vars @gol
8316 -ftree-copy-prop @gol
8317 -ftree-dce @gol
8318 -ftree-dominator-opts @gol
8319 -ftree-dse @gol
8320 -ftree-forwprop @gol
8321 -ftree-fre @gol
8322 -ftree-phiprop @gol
8323 -ftree-pta @gol
8324 -ftree-scev-cprop @gol
8325 -ftree-sink @gol
8326 -ftree-slsr @gol
8327 -ftree-sra @gol
8328 -ftree-ter @gol
8329 -funit-at-a-time}
8330
8331 @item -O2
8332 @opindex O2
8333 Optimize even more. GCC performs nearly all supported optimizations
8334 that do not involve a space-speed tradeoff.
8335 As compared to @option{-O}, this option increases both compilation time
8336 and the performance of the generated code.
8337
8338 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8339 also turns on the following optimization flags:
8340
8341 @c Please keep the following list alphabetized!
8342 @gccoptlist{-falign-functions -falign-jumps @gol
8343 -falign-labels -falign-loops @gol
8344 -fcaller-saves @gol
8345 -fcode-hoisting @gol
8346 -fcrossjumping @gol
8347 -fcse-follow-jumps -fcse-skip-blocks @gol
8348 -fdelete-null-pointer-checks @gol
8349 -fdevirtualize -fdevirtualize-speculatively @gol
8350 -fexpensive-optimizations @gol
8351 -ffinite-loops @gol
8352 -fgcse -fgcse-lm @gol
8353 -fhoist-adjacent-loads @gol
8354 -finline-small-functions @gol
8355 -findirect-inlining @gol
8356 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8357 -fipa-ra -fipa-sra -fipa-vrp @gol
8358 -fisolate-erroneous-paths-dereference @gol
8359 -flra-remat @gol
8360 -foptimize-sibling-calls @gol
8361 -foptimize-strlen @gol
8362 -fpartial-inlining @gol
8363 -fpeephole2 @gol
8364 -freorder-blocks-algorithm=stc @gol
8365 -freorder-blocks-and-partition -freorder-functions @gol
8366 -frerun-cse-after-loop @gol
8367 -fschedule-insns -fschedule-insns2 @gol
8368 -fsched-interblock -fsched-spec @gol
8369 -fstore-merging @gol
8370 -fstrict-aliasing @gol
8371 -fthread-jumps @gol
8372 -ftree-builtin-call-dce @gol
8373 -ftree-pre @gol
8374 -ftree-switch-conversion -ftree-tail-merge @gol
8375 -ftree-vrp}
8376
8377 Please note the warning under @option{-fgcse} about
8378 invoking @option{-O2} on programs that use computed gotos.
8379
8380 @item -O3
8381 @opindex O3
8382 Optimize yet more. @option{-O3} turns on all optimizations specified
8383 by @option{-O2} and also turns on the following optimization flags:
8384
8385 @c Please keep the following list alphabetized!
8386 @gccoptlist{-fgcse-after-reload @gol
8387 -finline-functions @gol
8388 -fipa-cp-clone
8389 -floop-interchange @gol
8390 -floop-unroll-and-jam @gol
8391 -fpeel-loops @gol
8392 -fpredictive-commoning @gol
8393 -fsplit-paths @gol
8394 -ftree-loop-distribute-patterns @gol
8395 -ftree-loop-distribution @gol
8396 -ftree-loop-vectorize @gol
8397 -ftree-partial-pre @gol
8398 -ftree-slp-vectorize @gol
8399 -funswitch-loops @gol
8400 -fvect-cost-model @gol
8401 -fversion-loops-for-strides}
8402
8403 @item -O0
8404 @opindex O0
8405 Reduce compilation time and make debugging produce the expected
8406 results. This is the default.
8407
8408 @item -Os
8409 @opindex Os
8410 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8411 except those that often increase code size:
8412
8413 @gccoptlist{-falign-functions -falign-jumps @gol
8414 -falign-labels -falign-loops @gol
8415 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8416
8417 It also enables @option{-finline-functions}, causes the compiler to tune for
8418 code size rather than execution speed, and performs further optimizations
8419 designed to reduce code size.
8420
8421 @item -Ofast
8422 @opindex Ofast
8423 Disregard strict standards compliance. @option{-Ofast} enables all
8424 @option{-O3} optimizations. It also enables optimizations that are not
8425 valid for all standard-compliant programs.
8426 It turns on @option{-ffast-math} and the Fortran-specific
8427 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8428 specified, and @option{-fno-protect-parens}.
8429
8430 @item -Og
8431 @opindex Og
8432 Optimize debugging experience. @option{-Og} should be the optimization
8433 level of choice for the standard edit-compile-debug cycle, offering
8434 a reasonable level of optimization while maintaining fast compilation
8435 and a good debugging experience. It is a better choice than @option{-O0}
8436 for producing debuggable code because some compiler passes
8437 that collect debug information are disabled at @option{-O0}.
8438
8439 Like @option{-O0}, @option{-Og} completely disables a number of
8440 optimization passes so that individual options controlling them have
8441 no effect. Otherwise @option{-Og} enables all @option{-O1}
8442 optimization flags except for those that may interfere with debugging:
8443
8444 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8445 -fdse -fif-conversion -fif-conversion2 @gol
8446 -finline-functions-called-once @gol
8447 -fmove-loop-invariants -fssa-phiopt @gol
8448 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
8449
8450 @end table
8451
8452 If you use multiple @option{-O} options, with or without level numbers,
8453 the last such option is the one that is effective.
8454
8455 Options of the form @option{-f@var{flag}} specify machine-independent
8456 flags. Most flags have both positive and negative forms; the negative
8457 form of @option{-ffoo} is @option{-fno-foo}. In the table
8458 below, only one of the forms is listed---the one you typically
8459 use. You can figure out the other form by either removing @samp{no-}
8460 or adding it.
8461
8462 The following options control specific optimizations. They are either
8463 activated by @option{-O} options or are related to ones that are. You
8464 can use the following flags in the rare cases when ``fine-tuning'' of
8465 optimizations to be performed is desired.
8466
8467 @table @gcctabopt
8468 @item -fno-defer-pop
8469 @opindex fno-defer-pop
8470 @opindex fdefer-pop
8471 For machines that must pop arguments after a function call, always pop
8472 the arguments as soon as each function returns.
8473 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8474 this allows the compiler to let arguments accumulate on the stack for several
8475 function calls and pop them all at once.
8476
8477 @item -fforward-propagate
8478 @opindex fforward-propagate
8479 Perform a forward propagation pass on RTL@. The pass tries to combine two
8480 instructions and checks if the result can be simplified. If loop unrolling
8481 is active, two passes are performed and the second is scheduled after
8482 loop unrolling.
8483
8484 This option is enabled by default at optimization levels @option{-O},
8485 @option{-O2}, @option{-O3}, @option{-Os}.
8486
8487 @item -ffp-contract=@var{style}
8488 @opindex ffp-contract
8489 @option{-ffp-contract=off} disables floating-point expression contraction.
8490 @option{-ffp-contract=fast} enables floating-point expression contraction
8491 such as forming of fused multiply-add operations if the target has
8492 native support for them.
8493 @option{-ffp-contract=on} enables floating-point expression contraction
8494 if allowed by the language standard. This is currently not implemented
8495 and treated equal to @option{-ffp-contract=off}.
8496
8497 The default is @option{-ffp-contract=fast}.
8498
8499 @item -fomit-frame-pointer
8500 @opindex fomit-frame-pointer
8501 Omit the frame pointer in functions that don't need one. This avoids the
8502 instructions to save, set up and restore the frame pointer; on many targets
8503 it also makes an extra register available.
8504
8505 On some targets this flag has no effect because the standard calling sequence
8506 always uses a frame pointer, so it cannot be omitted.
8507
8508 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8509 is used in all functions. Several targets always omit the frame pointer in
8510 leaf functions.
8511
8512 Enabled by default at @option{-O} and higher.
8513
8514 @item -foptimize-sibling-calls
8515 @opindex foptimize-sibling-calls
8516 Optimize sibling and tail recursive calls.
8517
8518 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8519
8520 @item -foptimize-strlen
8521 @opindex foptimize-strlen
8522 Optimize various standard C string functions (e.g.@: @code{strlen},
8523 @code{strchr} or @code{strcpy}) and
8524 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8525
8526 Enabled at levels @option{-O2}, @option{-O3}.
8527
8528 @item -fno-inline
8529 @opindex fno-inline
8530 @opindex finline
8531 Do not expand any functions inline apart from those marked with
8532 the @code{always_inline} attribute. This is the default when not
8533 optimizing.
8534
8535 Single functions can be exempted from inlining by marking them
8536 with the @code{noinline} attribute.
8537
8538 @item -finline-small-functions
8539 @opindex finline-small-functions
8540 Integrate functions into their callers when their body is smaller than expected
8541 function call code (so overall size of program gets smaller). The compiler
8542 heuristically decides which functions are simple enough to be worth integrating
8543 in this way. This inlining applies to all functions, even those not declared
8544 inline.
8545
8546 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8547
8548 @item -findirect-inlining
8549 @opindex findirect-inlining
8550 Inline also indirect calls that are discovered to be known at compile
8551 time thanks to previous inlining. This option has any effect only
8552 when inlining itself is turned on by the @option{-finline-functions}
8553 or @option{-finline-small-functions} options.
8554
8555 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8556
8557 @item -finline-functions
8558 @opindex finline-functions
8559 Consider all functions for inlining, even if they are not declared inline.
8560 The compiler heuristically decides which functions are worth integrating
8561 in this way.
8562
8563 If all calls to a given function are integrated, and the function is
8564 declared @code{static}, then the function is normally not output as
8565 assembler code in its own right.
8566
8567 Enabled at levels @option{-O3}, @option{-Os}. Also enabled
8568 by @option{-fprofile-use} and @option{-fauto-profile}.
8569
8570 @item -finline-functions-called-once
8571 @opindex finline-functions-called-once
8572 Consider all @code{static} functions called once for inlining into their
8573 caller even if they are not marked @code{inline}. If a call to a given
8574 function is integrated, then the function is not output as assembler code
8575 in its own right.
8576
8577 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8578 but not @option{-Og}.
8579
8580 @item -fearly-inlining
8581 @opindex fearly-inlining
8582 Inline functions marked by @code{always_inline} and functions whose body seems
8583 smaller than the function call overhead early before doing
8584 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8585 makes profiling significantly cheaper and usually inlining faster on programs
8586 having large chains of nested wrapper functions.
8587
8588 Enabled by default.
8589
8590 @item -fipa-sra
8591 @opindex fipa-sra
8592 Perform interprocedural scalar replacement of aggregates, removal of
8593 unused parameters and replacement of parameters passed by reference
8594 by parameters passed by value.
8595
8596 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8597
8598 @item -finline-limit=@var{n}
8599 @opindex finline-limit
8600 By default, GCC limits the size of functions that can be inlined. This flag
8601 allows coarse control of this limit. @var{n} is the size of functions that
8602 can be inlined in number of pseudo instructions.
8603
8604 Inlining is actually controlled by a number of parameters, which may be
8605 specified individually by using @option{--param @var{name}=@var{value}}.
8606 The @option{-finline-limit=@var{n}} option sets some of these parameters
8607 as follows:
8608
8609 @table @gcctabopt
8610 @item max-inline-insns-single
8611 is set to @var{n}/2.
8612 @item max-inline-insns-auto
8613 is set to @var{n}/2.
8614 @end table
8615
8616 See below for a documentation of the individual
8617 parameters controlling inlining and for the defaults of these parameters.
8618
8619 @emph{Note:} there may be no value to @option{-finline-limit} that results
8620 in default behavior.
8621
8622 @emph{Note:} pseudo instruction represents, in this particular context, an
8623 abstract measurement of function's size. In no way does it represent a count
8624 of assembly instructions and as such its exact meaning might change from one
8625 release to an another.
8626
8627 @item -fno-keep-inline-dllexport
8628 @opindex fno-keep-inline-dllexport
8629 @opindex fkeep-inline-dllexport
8630 This is a more fine-grained version of @option{-fkeep-inline-functions},
8631 which applies only to functions that are declared using the @code{dllexport}
8632 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8633 Functions}.
8634
8635 @item -fkeep-inline-functions
8636 @opindex fkeep-inline-functions
8637 In C, emit @code{static} functions that are declared @code{inline}
8638 into the object file, even if the function has been inlined into all
8639 of its callers. This switch does not affect functions using the
8640 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8641 inline functions into the object file.
8642
8643 @item -fkeep-static-functions
8644 @opindex fkeep-static-functions
8645 Emit @code{static} functions into the object file, even if the function
8646 is never used.
8647
8648 @item -fkeep-static-consts
8649 @opindex fkeep-static-consts
8650 Emit variables declared @code{static const} when optimization isn't turned
8651 on, even if the variables aren't referenced.
8652
8653 GCC enables this option by default. If you want to force the compiler to
8654 check if a variable is referenced, regardless of whether or not
8655 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8656
8657 @item -fmerge-constants
8658 @opindex fmerge-constants
8659 Attempt to merge identical constants (string constants and floating-point
8660 constants) across compilation units.
8661
8662 This option is the default for optimized compilation if the assembler and
8663 linker support it. Use @option{-fno-merge-constants} to inhibit this
8664 behavior.
8665
8666 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8667
8668 @item -fmerge-all-constants
8669 @opindex fmerge-all-constants
8670 Attempt to merge identical constants and identical variables.
8671
8672 This option implies @option{-fmerge-constants}. In addition to
8673 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8674 arrays or initialized constant variables with integral or floating-point
8675 types. Languages like C or C++ require each variable, including multiple
8676 instances of the same variable in recursive calls, to have distinct locations,
8677 so using this option results in non-conforming
8678 behavior.
8679
8680 @item -fmodulo-sched
8681 @opindex fmodulo-sched
8682 Perform swing modulo scheduling immediately before the first scheduling
8683 pass. This pass looks at innermost loops and reorders their
8684 instructions by overlapping different iterations.
8685
8686 @item -fmodulo-sched-allow-regmoves
8687 @opindex fmodulo-sched-allow-regmoves
8688 Perform more aggressive SMS-based modulo scheduling with register moves
8689 allowed. By setting this flag certain anti-dependences edges are
8690 deleted, which triggers the generation of reg-moves based on the
8691 life-range analysis. This option is effective only with
8692 @option{-fmodulo-sched} enabled.
8693
8694 @item -fno-branch-count-reg
8695 @opindex fno-branch-count-reg
8696 @opindex fbranch-count-reg
8697 Disable the optimization pass that scans for opportunities to use
8698 ``decrement and branch'' instructions on a count register instead of
8699 instruction sequences that decrement a register, compare it against zero, and
8700 then branch based upon the result. This option is only meaningful on
8701 architectures that support such instructions, which include x86, PowerPC,
8702 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8703 doesn't remove the decrement and branch instructions from the generated
8704 instruction stream introduced by other optimization passes.
8705
8706 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8707 except for @option{-Og}.
8708
8709 @item -fno-function-cse
8710 @opindex fno-function-cse
8711 @opindex ffunction-cse
8712 Do not put function addresses in registers; make each instruction that
8713 calls a constant function contain the function's address explicitly.
8714
8715 This option results in less efficient code, but some strange hacks
8716 that alter the assembler output may be confused by the optimizations
8717 performed when this option is not used.
8718
8719 The default is @option{-ffunction-cse}
8720
8721 @item -fno-zero-initialized-in-bss
8722 @opindex fno-zero-initialized-in-bss
8723 @opindex fzero-initialized-in-bss
8724 If the target supports a BSS section, GCC by default puts variables that
8725 are initialized to zero into BSS@. This can save space in the resulting
8726 code.
8727
8728 This option turns off this behavior because some programs explicitly
8729 rely on variables going to the data section---e.g., so that the
8730 resulting executable can find the beginning of that section and/or make
8731 assumptions based on that.
8732
8733 The default is @option{-fzero-initialized-in-bss}.
8734
8735 @item -fthread-jumps
8736 @opindex fthread-jumps
8737 Perform optimizations that check to see if a jump branches to a
8738 location where another comparison subsumed by the first is found. If
8739 so, the first branch is redirected to either the destination of the
8740 second branch or a point immediately following it, depending on whether
8741 the condition is known to be true or false.
8742
8743 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8744
8745 @item -fsplit-wide-types
8746 @opindex fsplit-wide-types
8747 When using a type that occupies multiple registers, such as @code{long
8748 long} on a 32-bit system, split the registers apart and allocate them
8749 independently. This normally generates better code for those types,
8750 but may make debugging more difficult.
8751
8752 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8753 @option{-Os}.
8754
8755 @item -fsplit-wide-types-early
8756 @opindex fsplit-wide-types-early
8757 Fully split wide types early, instead of very late.
8758 This option has no effect unless @option{-fsplit-wide-types} is turned on.
8759
8760 This is the default on some targets.
8761
8762 @item -fcse-follow-jumps
8763 @opindex fcse-follow-jumps
8764 In common subexpression elimination (CSE), scan through jump instructions
8765 when the target of the jump is not reached by any other path. For
8766 example, when CSE encounters an @code{if} statement with an
8767 @code{else} clause, CSE follows the jump when the condition
8768 tested is false.
8769
8770 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8771
8772 @item -fcse-skip-blocks
8773 @opindex fcse-skip-blocks
8774 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8775 follow jumps that conditionally skip over blocks. When CSE
8776 encounters a simple @code{if} statement with no else clause,
8777 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8778 body of the @code{if}.
8779
8780 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8781
8782 @item -frerun-cse-after-loop
8783 @opindex frerun-cse-after-loop
8784 Re-run common subexpression elimination after loop optimizations are
8785 performed.
8786
8787 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8788
8789 @item -fgcse
8790 @opindex fgcse
8791 Perform a global common subexpression elimination pass.
8792 This pass also performs global constant and copy propagation.
8793
8794 @emph{Note:} When compiling a program using computed gotos, a GCC
8795 extension, you may get better run-time performance if you disable
8796 the global common subexpression elimination pass by adding
8797 @option{-fno-gcse} to the command line.
8798
8799 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8800
8801 @item -fgcse-lm
8802 @opindex fgcse-lm
8803 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8804 attempts to move loads that are only killed by stores into themselves. This
8805 allows a loop containing a load/store sequence to be changed to a load outside
8806 the loop, and a copy/store within the loop.
8807
8808 Enabled by default when @option{-fgcse} is enabled.
8809
8810 @item -fgcse-sm
8811 @opindex fgcse-sm
8812 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8813 global common subexpression elimination. This pass attempts to move
8814 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8815 loops containing a load/store sequence can be changed to a load before
8816 the loop and a store after the loop.
8817
8818 Not enabled at any optimization level.
8819
8820 @item -fgcse-las
8821 @opindex fgcse-las
8822 When @option{-fgcse-las} is enabled, the global common subexpression
8823 elimination pass eliminates redundant loads that come after stores to the
8824 same memory location (both partial and full redundancies).
8825
8826 Not enabled at any optimization level.
8827
8828 @item -fgcse-after-reload
8829 @opindex fgcse-after-reload
8830 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8831 pass is performed after reload. The purpose of this pass is to clean up
8832 redundant spilling.
8833
8834 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8835
8836 @item -faggressive-loop-optimizations
8837 @opindex faggressive-loop-optimizations
8838 This option tells the loop optimizer to use language constraints to
8839 derive bounds for the number of iterations of a loop. This assumes that
8840 loop code does not invoke undefined behavior by for example causing signed
8841 integer overflows or out-of-bound array accesses. The bounds for the
8842 number of iterations of a loop are used to guide loop unrolling and peeling
8843 and loop exit test optimizations.
8844 This option is enabled by default.
8845
8846 @item -funconstrained-commons
8847 @opindex funconstrained-commons
8848 This option tells the compiler that variables declared in common blocks
8849 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8850 prevents certain optimizations that depend on knowing the array bounds.
8851
8852 @item -fcrossjumping
8853 @opindex fcrossjumping
8854 Perform cross-jumping transformation.
8855 This transformation unifies equivalent code and saves code size. The
8856 resulting code may or may not perform better than without cross-jumping.
8857
8858 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8859
8860 @item -fauto-inc-dec
8861 @opindex fauto-inc-dec
8862 Combine increments or decrements of addresses with memory accesses.
8863 This pass is always skipped on architectures that do not have
8864 instructions to support this. Enabled by default at @option{-O} and
8865 higher on architectures that support this.
8866
8867 @item -fdce
8868 @opindex fdce
8869 Perform dead code elimination (DCE) on RTL@.
8870 Enabled by default at @option{-O} and higher.
8871
8872 @item -fdse
8873 @opindex fdse
8874 Perform dead store elimination (DSE) on RTL@.
8875 Enabled by default at @option{-O} and higher.
8876
8877 @item -fif-conversion
8878 @opindex fif-conversion
8879 Attempt to transform conditional jumps into branch-less equivalents. This
8880 includes use of conditional moves, min, max, set flags and abs instructions, and
8881 some tricks doable by standard arithmetics. The use of conditional execution
8882 on chips where it is available is controlled by @option{-fif-conversion2}.
8883
8884 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8885 not with @option{-Og}.
8886
8887 @item -fif-conversion2
8888 @opindex fif-conversion2
8889 Use conditional execution (where available) to transform conditional jumps into
8890 branch-less equivalents.
8891
8892 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8893 not with @option{-Og}.
8894
8895 @item -fdeclone-ctor-dtor
8896 @opindex fdeclone-ctor-dtor
8897 The C++ ABI requires multiple entry points for constructors and
8898 destructors: one for a base subobject, one for a complete object, and
8899 one for a virtual destructor that calls operator delete afterwards.
8900 For a hierarchy with virtual bases, the base and complete variants are
8901 clones, which means two copies of the function. With this option, the
8902 base and complete variants are changed to be thunks that call a common
8903 implementation.
8904
8905 Enabled by @option{-Os}.
8906
8907 @item -fdelete-null-pointer-checks
8908 @opindex fdelete-null-pointer-checks
8909 Assume that programs cannot safely dereference null pointers, and that
8910 no code or data element resides at address zero.
8911 This option enables simple constant
8912 folding optimizations at all optimization levels. In addition, other
8913 optimization passes in GCC use this flag to control global dataflow
8914 analyses that eliminate useless checks for null pointers; these assume
8915 that a memory access to address zero always results in a trap, so
8916 that if a pointer is checked after it has already been dereferenced,
8917 it cannot be null.
8918
8919 Note however that in some environments this assumption is not true.
8920 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8921 for programs that depend on that behavior.
8922
8923 This option is enabled by default on most targets. On Nios II ELF, it
8924 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8925
8926 Passes that use the dataflow information
8927 are enabled independently at different optimization levels.
8928
8929 @item -fdevirtualize
8930 @opindex fdevirtualize
8931 Attempt to convert calls to virtual functions to direct calls. This
8932 is done both within a procedure and interprocedurally as part of
8933 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8934 propagation (@option{-fipa-cp}).
8935 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8936
8937 @item -fdevirtualize-speculatively
8938 @opindex fdevirtualize-speculatively
8939 Attempt to convert calls to virtual functions to speculative direct calls.
8940 Based on the analysis of the type inheritance graph, determine for a given call
8941 the set of likely targets. If the set is small, preferably of size 1, change
8942 the call into a conditional deciding between direct and indirect calls. The
8943 speculative calls enable more optimizations, such as inlining. When they seem
8944 useless after further optimization, they are converted back into original form.
8945
8946 @item -fdevirtualize-at-ltrans
8947 @opindex fdevirtualize-at-ltrans
8948 Stream extra information needed for aggressive devirtualization when running
8949 the link-time optimizer in local transformation mode.
8950 This option enables more devirtualization but
8951 significantly increases the size of streamed data. For this reason it is
8952 disabled by default.
8953
8954 @item -fexpensive-optimizations
8955 @opindex fexpensive-optimizations
8956 Perform a number of minor optimizations that are relatively expensive.
8957
8958 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8959
8960 @item -free
8961 @opindex free
8962 Attempt to remove redundant extension instructions. This is especially
8963 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8964 registers after writing to their lower 32-bit half.
8965
8966 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8967 @option{-O3}, @option{-Os}.
8968
8969 @item -fno-lifetime-dse
8970 @opindex fno-lifetime-dse
8971 @opindex flifetime-dse
8972 In C++ the value of an object is only affected by changes within its
8973 lifetime: when the constructor begins, the object has an indeterminate
8974 value, and any changes during the lifetime of the object are dead when
8975 the object is destroyed. Normally dead store elimination will take
8976 advantage of this; if your code relies on the value of the object
8977 storage persisting beyond the lifetime of the object, you can use this
8978 flag to disable this optimization. To preserve stores before the
8979 constructor starts (e.g.@: because your operator new clears the object
8980 storage) but still treat the object as dead after the destructor you,
8981 can use @option{-flifetime-dse=1}. The default behavior can be
8982 explicitly selected with @option{-flifetime-dse=2}.
8983 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8984
8985 @item -flive-range-shrinkage
8986 @opindex flive-range-shrinkage
8987 Attempt to decrease register pressure through register live range
8988 shrinkage. This is helpful for fast processors with small or moderate
8989 size register sets.
8990
8991 @item -fira-algorithm=@var{algorithm}
8992 @opindex fira-algorithm
8993 Use the specified coloring algorithm for the integrated register
8994 allocator. The @var{algorithm} argument can be @samp{priority}, which
8995 specifies Chow's priority coloring, or @samp{CB}, which specifies
8996 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8997 for all architectures, but for those targets that do support it, it is
8998 the default because it generates better code.
8999
9000 @item -fira-region=@var{region}
9001 @opindex fira-region
9002 Use specified regions for the integrated register allocator. The
9003 @var{region} argument should be one of the following:
9004
9005 @table @samp
9006
9007 @item all
9008 Use all loops as register allocation regions.
9009 This can give the best results for machines with a small and/or
9010 irregular register set.
9011
9012 @item mixed
9013 Use all loops except for loops with small register pressure
9014 as the regions. This value usually gives
9015 the best results in most cases and for most architectures,
9016 and is enabled by default when compiling with optimization for speed
9017 (@option{-O}, @option{-O2}, @dots{}).
9018
9019 @item one
9020 Use all functions as a single region.
9021 This typically results in the smallest code size, and is enabled by default for
9022 @option{-Os} or @option{-O0}.
9023
9024 @end table
9025
9026 @item -fira-hoist-pressure
9027 @opindex fira-hoist-pressure
9028 Use IRA to evaluate register pressure in the code hoisting pass for
9029 decisions to hoist expressions. This option usually results in smaller
9030 code, but it can slow the compiler down.
9031
9032 This option is enabled at level @option{-Os} for all targets.
9033
9034 @item -fira-loop-pressure
9035 @opindex fira-loop-pressure
9036 Use IRA to evaluate register pressure in loops for decisions to move
9037 loop invariants. This option usually results in generation
9038 of faster and smaller code on machines with large register files (>= 32
9039 registers), but it can slow the compiler down.
9040
9041 This option is enabled at level @option{-O3} for some targets.
9042
9043 @item -fno-ira-share-save-slots
9044 @opindex fno-ira-share-save-slots
9045 @opindex fira-share-save-slots
9046 Disable sharing of stack slots used for saving call-used hard
9047 registers living through a call. Each hard register gets a
9048 separate stack slot, and as a result function stack frames are
9049 larger.
9050
9051 @item -fno-ira-share-spill-slots
9052 @opindex fno-ira-share-spill-slots
9053 @opindex fira-share-spill-slots
9054 Disable sharing of stack slots allocated for pseudo-registers. Each
9055 pseudo-register that does not get a hard register gets a separate
9056 stack slot, and as a result function stack frames are larger.
9057
9058 @item -flra-remat
9059 @opindex flra-remat
9060 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9061 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9062 values if it is profitable.
9063
9064 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9065
9066 @item -fdelayed-branch
9067 @opindex fdelayed-branch
9068 If supported for the target machine, attempt to reorder instructions
9069 to exploit instruction slots available after delayed branch
9070 instructions.
9071
9072 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9073 but not at @option{-Og}.
9074
9075 @item -fschedule-insns
9076 @opindex fschedule-insns
9077 If supported for the target machine, attempt to reorder instructions to
9078 eliminate execution stalls due to required data being unavailable. This
9079 helps machines that have slow floating point or memory load instructions
9080 by allowing other instructions to be issued until the result of the load
9081 or floating-point instruction is required.
9082
9083 Enabled at levels @option{-O2}, @option{-O3}.
9084
9085 @item -fschedule-insns2
9086 @opindex fschedule-insns2
9087 Similar to @option{-fschedule-insns}, but requests an additional pass of
9088 instruction scheduling after register allocation has been done. This is
9089 especially useful on machines with a relatively small number of
9090 registers and where memory load instructions take more than one cycle.
9091
9092 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9093
9094 @item -fno-sched-interblock
9095 @opindex fno-sched-interblock
9096 @opindex fsched-interblock
9097 Disable instruction scheduling across basic blocks, which
9098 is normally enabled when scheduling before register allocation, i.e.@:
9099 with @option{-fschedule-insns} or at @option{-O2} or higher.
9100
9101 @item -fno-sched-spec
9102 @opindex fno-sched-spec
9103 @opindex fsched-spec
9104 Disable speculative motion of non-load instructions, which
9105 is normally enabled when scheduling before register allocation, i.e.@:
9106 with @option{-fschedule-insns} or at @option{-O2} or higher.
9107
9108 @item -fsched-pressure
9109 @opindex fsched-pressure
9110 Enable register pressure sensitive insn scheduling before register
9111 allocation. This only makes sense when scheduling before register
9112 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9113 @option{-O2} or higher. Usage of this option can improve the
9114 generated code and decrease its size by preventing register pressure
9115 increase above the number of available hard registers and subsequent
9116 spills in register allocation.
9117
9118 @item -fsched-spec-load
9119 @opindex fsched-spec-load
9120 Allow speculative motion of some load instructions. This only makes
9121 sense when scheduling before register allocation, i.e.@: with
9122 @option{-fschedule-insns} or at @option{-O2} or higher.
9123
9124 @item -fsched-spec-load-dangerous
9125 @opindex fsched-spec-load-dangerous
9126 Allow speculative motion of more load instructions. This only makes
9127 sense when scheduling before register allocation, i.e.@: with
9128 @option{-fschedule-insns} or at @option{-O2} or higher.
9129
9130 @item -fsched-stalled-insns
9131 @itemx -fsched-stalled-insns=@var{n}
9132 @opindex fsched-stalled-insns
9133 Define how many insns (if any) can be moved prematurely from the queue
9134 of stalled insns into the ready list during the second scheduling pass.
9135 @option{-fno-sched-stalled-insns} means that no insns are moved
9136 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9137 on how many queued insns can be moved prematurely.
9138 @option{-fsched-stalled-insns} without a value is equivalent to
9139 @option{-fsched-stalled-insns=1}.
9140
9141 @item -fsched-stalled-insns-dep
9142 @itemx -fsched-stalled-insns-dep=@var{n}
9143 @opindex fsched-stalled-insns-dep
9144 Define how many insn groups (cycles) are examined for a dependency
9145 on a stalled insn that is a candidate for premature removal from the queue
9146 of stalled insns. This has an effect only during the second scheduling pass,
9147 and only if @option{-fsched-stalled-insns} is used.
9148 @option{-fno-sched-stalled-insns-dep} is equivalent to
9149 @option{-fsched-stalled-insns-dep=0}.
9150 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9151 @option{-fsched-stalled-insns-dep=1}.
9152
9153 @item -fsched2-use-superblocks
9154 @opindex fsched2-use-superblocks
9155 When scheduling after register allocation, use superblock scheduling.
9156 This allows motion across basic block boundaries,
9157 resulting in faster schedules. This option is experimental, as not all machine
9158 descriptions used by GCC model the CPU closely enough to avoid unreliable
9159 results from the algorithm.
9160
9161 This only makes sense when scheduling after register allocation, i.e.@: with
9162 @option{-fschedule-insns2} or at @option{-O2} or higher.
9163
9164 @item -fsched-group-heuristic
9165 @opindex fsched-group-heuristic
9166 Enable the group heuristic in the scheduler. This heuristic favors
9167 the instruction that belongs to a schedule group. This is enabled
9168 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9169 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9170
9171 @item -fsched-critical-path-heuristic
9172 @opindex fsched-critical-path-heuristic
9173 Enable the critical-path heuristic in the scheduler. This heuristic favors
9174 instructions on the critical path. This is enabled by default when
9175 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9176 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9177
9178 @item -fsched-spec-insn-heuristic
9179 @opindex fsched-spec-insn-heuristic
9180 Enable the speculative instruction heuristic in the scheduler. This
9181 heuristic favors speculative instructions with greater dependency weakness.
9182 This is enabled by default when scheduling is enabled, i.e.@:
9183 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9184 or at @option{-O2} or higher.
9185
9186 @item -fsched-rank-heuristic
9187 @opindex fsched-rank-heuristic
9188 Enable the rank heuristic in the scheduler. This heuristic favors
9189 the instruction belonging to a basic block with greater size or frequency.
9190 This is enabled by default when scheduling is enabled, i.e.@:
9191 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9192 at @option{-O2} or higher.
9193
9194 @item -fsched-last-insn-heuristic
9195 @opindex fsched-last-insn-heuristic
9196 Enable the last-instruction heuristic in the scheduler. This heuristic
9197 favors the instruction that is less dependent on the last instruction
9198 scheduled. This is enabled by default when scheduling is enabled,
9199 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9200 at @option{-O2} or higher.
9201
9202 @item -fsched-dep-count-heuristic
9203 @opindex fsched-dep-count-heuristic
9204 Enable the dependent-count heuristic in the scheduler. This heuristic
9205 favors the instruction that has more instructions depending on it.
9206 This is enabled by default when scheduling is enabled, i.e.@:
9207 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9208 at @option{-O2} or higher.
9209
9210 @item -freschedule-modulo-scheduled-loops
9211 @opindex freschedule-modulo-scheduled-loops
9212 Modulo scheduling is performed before traditional scheduling. If a loop
9213 is modulo scheduled, later scheduling passes may change its schedule.
9214 Use this option to control that behavior.
9215
9216 @item -fselective-scheduling
9217 @opindex fselective-scheduling
9218 Schedule instructions using selective scheduling algorithm. Selective
9219 scheduling runs instead of the first scheduler pass.
9220
9221 @item -fselective-scheduling2
9222 @opindex fselective-scheduling2
9223 Schedule instructions using selective scheduling algorithm. Selective
9224 scheduling runs instead of the second scheduler pass.
9225
9226 @item -fsel-sched-pipelining
9227 @opindex fsel-sched-pipelining
9228 Enable software pipelining of innermost loops during selective scheduling.
9229 This option has no effect unless one of @option{-fselective-scheduling} or
9230 @option{-fselective-scheduling2} is turned on.
9231
9232 @item -fsel-sched-pipelining-outer-loops
9233 @opindex fsel-sched-pipelining-outer-loops
9234 When pipelining loops during selective scheduling, also pipeline outer loops.
9235 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9236
9237 @item -fsemantic-interposition
9238 @opindex fsemantic-interposition
9239 Some object formats, like ELF, allow interposing of symbols by the
9240 dynamic linker.
9241 This means that for symbols exported from the DSO, the compiler cannot perform
9242 interprocedural propagation, inlining and other optimizations in anticipation
9243 that the function or variable in question may change. While this feature is
9244 useful, for example, to rewrite memory allocation functions by a debugging
9245 implementation, it is expensive in the terms of code quality.
9246 With @option{-fno-semantic-interposition} the compiler assumes that
9247 if interposition happens for functions the overwriting function will have
9248 precisely the same semantics (and side effects).
9249 Similarly if interposition happens
9250 for variables, the constructor of the variable will be the same. The flag
9251 has no effect for functions explicitly declared inline
9252 (where it is never allowed for interposition to change semantics)
9253 and for symbols explicitly declared weak.
9254
9255 @item -fshrink-wrap
9256 @opindex fshrink-wrap
9257 Emit function prologues only before parts of the function that need it,
9258 rather than at the top of the function. This flag is enabled by default at
9259 @option{-O} and higher.
9260
9261 @item -fshrink-wrap-separate
9262 @opindex fshrink-wrap-separate
9263 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9264 those parts are only executed when needed.
9265 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9266 is also turned on and the target supports this.
9267
9268 @item -fcaller-saves
9269 @opindex fcaller-saves
9270 Enable allocation of values to registers that are clobbered by
9271 function calls, by emitting extra instructions to save and restore the
9272 registers around such calls. Such allocation is done only when it
9273 seems to result in better code.
9274
9275 This option is always enabled by default on certain machines, usually
9276 those which have no call-preserved registers to use instead.
9277
9278 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9279
9280 @item -fcombine-stack-adjustments
9281 @opindex fcombine-stack-adjustments
9282 Tracks stack adjustments (pushes and pops) and stack memory references
9283 and then tries to find ways to combine them.
9284
9285 Enabled by default at @option{-O1} and higher.
9286
9287 @item -fipa-ra
9288 @opindex fipa-ra
9289 Use caller save registers for allocation if those registers are not used by
9290 any called function. In that case it is not necessary to save and restore
9291 them around calls. This is only possible if called functions are part of
9292 same compilation unit as current function and they are compiled before it.
9293
9294 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9295 is disabled if generated code will be instrumented for profiling
9296 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9297 exactly (this happens on targets that do not expose prologues
9298 and epilogues in RTL).
9299
9300 @item -fconserve-stack
9301 @opindex fconserve-stack
9302 Attempt to minimize stack usage. The compiler attempts to use less
9303 stack space, even if that makes the program slower. This option
9304 implies setting the @option{large-stack-frame} parameter to 100
9305 and the @option{large-stack-frame-growth} parameter to 400.
9306
9307 @item -ftree-reassoc
9308 @opindex ftree-reassoc
9309 Perform reassociation on trees. This flag is enabled by default
9310 at @option{-O} and higher.
9311
9312 @item -fcode-hoisting
9313 @opindex fcode-hoisting
9314 Perform code hoisting. Code hoisting tries to move the
9315 evaluation of expressions executed on all paths to the function exit
9316 as early as possible. This is especially useful as a code size
9317 optimization, but it often helps for code speed as well.
9318 This flag is enabled by default at @option{-O2} and higher.
9319
9320 @item -ftree-pre
9321 @opindex ftree-pre
9322 Perform partial redundancy elimination (PRE) on trees. This flag is
9323 enabled by default at @option{-O2} and @option{-O3}.
9324
9325 @item -ftree-partial-pre
9326 @opindex ftree-partial-pre
9327 Make partial redundancy elimination (PRE) more aggressive. This flag is
9328 enabled by default at @option{-O3}.
9329
9330 @item -ftree-forwprop
9331 @opindex ftree-forwprop
9332 Perform forward propagation on trees. This flag is enabled by default
9333 at @option{-O} and higher.
9334
9335 @item -ftree-fre
9336 @opindex ftree-fre
9337 Perform full redundancy elimination (FRE) on trees. The difference
9338 between FRE and PRE is that FRE only considers expressions
9339 that are computed on all paths leading to the redundant computation.
9340 This analysis is faster than PRE, though it exposes fewer redundancies.
9341 This flag is enabled by default at @option{-O} and higher.
9342
9343 @item -ftree-phiprop
9344 @opindex ftree-phiprop
9345 Perform hoisting of loads from conditional pointers on trees. This
9346 pass is enabled by default at @option{-O} and higher.
9347
9348 @item -fhoist-adjacent-loads
9349 @opindex fhoist-adjacent-loads
9350 Speculatively hoist loads from both branches of an if-then-else if the
9351 loads are from adjacent locations in the same structure and the target
9352 architecture has a conditional move instruction. This flag is enabled
9353 by default at @option{-O2} and higher.
9354
9355 @item -ftree-copy-prop
9356 @opindex ftree-copy-prop
9357 Perform copy propagation on trees. This pass eliminates unnecessary
9358 copy operations. This flag is enabled by default at @option{-O} and
9359 higher.
9360
9361 @item -fipa-pure-const
9362 @opindex fipa-pure-const
9363 Discover which functions are pure or constant.
9364 Enabled by default at @option{-O} and higher.
9365
9366 @item -fipa-reference
9367 @opindex fipa-reference
9368 Discover which static variables do not escape the
9369 compilation unit.
9370 Enabled by default at @option{-O} and higher.
9371
9372 @item -fipa-reference-addressable
9373 @opindex fipa-reference-addressable
9374 Discover read-only, write-only and non-addressable static variables.
9375 Enabled by default at @option{-O} and higher.
9376
9377 @item -fipa-stack-alignment
9378 @opindex fipa-stack-alignment
9379 Reduce stack alignment on call sites if possible.
9380 Enabled by default.
9381
9382 @item -fipa-pta
9383 @opindex fipa-pta
9384 Perform interprocedural pointer analysis and interprocedural modification
9385 and reference analysis. This option can cause excessive memory and
9386 compile-time usage on large compilation units. It is not enabled by
9387 default at any optimization level.
9388
9389 @item -fipa-profile
9390 @opindex fipa-profile
9391 Perform interprocedural profile propagation. The functions called only from
9392 cold functions are marked as cold. Also functions executed once (such as
9393 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9394 functions and loop less parts of functions executed once are then optimized for
9395 size.
9396 Enabled by default at @option{-O} and higher.
9397
9398 @item -fipa-cp
9399 @opindex fipa-cp
9400 Perform interprocedural constant propagation.
9401 This optimization analyzes the program to determine when values passed
9402 to functions are constants and then optimizes accordingly.
9403 This optimization can substantially increase performance
9404 if the application has constants passed to functions.
9405 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9406 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9407
9408 @item -fipa-cp-clone
9409 @opindex fipa-cp-clone
9410 Perform function cloning to make interprocedural constant propagation stronger.
9411 When enabled, interprocedural constant propagation performs function cloning
9412 when externally visible function can be called with constant arguments.
9413 Because this optimization can create multiple copies of functions,
9414 it may significantly increase code size
9415 (see @option{--param ipcp-unit-growth=@var{value}}).
9416 This flag is enabled by default at @option{-O3}.
9417 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9418
9419 @item -fipa-bit-cp
9420 @opindex fipa-bit-cp
9421 When enabled, perform interprocedural bitwise constant
9422 propagation. This flag is enabled by default at @option{-O2} and
9423 by @option{-fprofile-use} and @option{-fauto-profile}.
9424 It requires that @option{-fipa-cp} is enabled.
9425
9426 @item -fipa-vrp
9427 @opindex fipa-vrp
9428 When enabled, perform interprocedural propagation of value
9429 ranges. This flag is enabled by default at @option{-O2}. It requires
9430 that @option{-fipa-cp} is enabled.
9431
9432 @item -fipa-icf
9433 @opindex fipa-icf
9434 Perform Identical Code Folding for functions and read-only variables.
9435 The optimization reduces code size and may disturb unwind stacks by replacing
9436 a function by equivalent one with a different name. The optimization works
9437 more effectively with link-time optimization enabled.
9438
9439 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9440 works on different levels and thus the optimizations are not same - there are
9441 equivalences that are found only by GCC and equivalences found only by Gold.
9442
9443 This flag is enabled by default at @option{-O2} and @option{-Os}.
9444
9445 @item -flive-patching=@var{level}
9446 @opindex flive-patching
9447 Control GCC's optimizations to produce output suitable for live-patching.
9448
9449 If the compiler's optimization uses a function's body or information extracted
9450 from its body to optimize/change another function, the latter is called an
9451 impacted function of the former. If a function is patched, its impacted
9452 functions should be patched too.
9453
9454 The impacted functions are determined by the compiler's interprocedural
9455 optimizations. For example, a caller is impacted when inlining a function
9456 into its caller,
9457 cloning a function and changing its caller to call this new clone,
9458 or extracting a function's pureness/constness information to optimize
9459 its direct or indirect callers, etc.
9460
9461 Usually, the more IPA optimizations enabled, the larger the number of
9462 impacted functions for each function. In order to control the number of
9463 impacted functions and more easily compute the list of impacted function,
9464 IPA optimizations can be partially enabled at two different levels.
9465
9466 The @var{level} argument should be one of the following:
9467
9468 @table @samp
9469
9470 @item inline-clone
9471
9472 Only enable inlining and cloning optimizations, which includes inlining,
9473 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9474 As a result, when patching a function, all its callers and its clones'
9475 callers are impacted, therefore need to be patched as well.
9476
9477 @option{-flive-patching=inline-clone} disables the following optimization flags:
9478 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9479 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9480 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9481 -fipa-stack-alignment}
9482
9483 @item inline-only-static
9484
9485 Only enable inlining of static functions.
9486 As a result, when patching a static function, all its callers are impacted
9487 and so need to be patched as well.
9488
9489 In addition to all the flags that @option{-flive-patching=inline-clone}
9490 disables,
9491 @option{-flive-patching=inline-only-static} disables the following additional
9492 optimization flags:
9493 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9494
9495 @end table
9496
9497 When @option{-flive-patching} is specified without any value, the default value
9498 is @var{inline-clone}.
9499
9500 This flag is disabled by default.
9501
9502 Note that @option{-flive-patching} is not supported with link-time optimization
9503 (@option{-flto}).
9504
9505 @item -fisolate-erroneous-paths-dereference
9506 @opindex fisolate-erroneous-paths-dereference
9507 Detect paths that trigger erroneous or undefined behavior due to
9508 dereferencing a null pointer. Isolate those paths from the main control
9509 flow and turn the statement with erroneous or undefined behavior into a trap.
9510 This flag is enabled by default at @option{-O2} and higher and depends on
9511 @option{-fdelete-null-pointer-checks} also being enabled.
9512
9513 @item -fisolate-erroneous-paths-attribute
9514 @opindex fisolate-erroneous-paths-attribute
9515 Detect paths that trigger erroneous or undefined behavior due to a null value
9516 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9517 attribute. Isolate those paths from the main control flow and turn the
9518 statement with erroneous or undefined behavior into a trap. This is not
9519 currently enabled, but may be enabled by @option{-O2} in the future.
9520
9521 @item -ftree-sink
9522 @opindex ftree-sink
9523 Perform forward store motion on trees. This flag is
9524 enabled by default at @option{-O} and higher.
9525
9526 @item -ftree-bit-ccp
9527 @opindex ftree-bit-ccp
9528 Perform sparse conditional bit constant propagation on trees and propagate
9529 pointer alignment information.
9530 This pass only operates on local scalar variables and is enabled by default
9531 at @option{-O1} and higher, except for @option{-Og}.
9532 It requires that @option{-ftree-ccp} is enabled.
9533
9534 @item -ftree-ccp
9535 @opindex ftree-ccp
9536 Perform sparse conditional constant propagation (CCP) on trees. This
9537 pass only operates on local scalar variables and is enabled by default
9538 at @option{-O} and higher.
9539
9540 @item -fssa-backprop
9541 @opindex fssa-backprop
9542 Propagate information about uses of a value up the definition chain
9543 in order to simplify the definitions. For example, this pass strips
9544 sign operations if the sign of a value never matters. The flag is
9545 enabled by default at @option{-O} and higher.
9546
9547 @item -fssa-phiopt
9548 @opindex fssa-phiopt
9549 Perform pattern matching on SSA PHI nodes to optimize conditional
9550 code. This pass is enabled by default at @option{-O1} and higher,
9551 except for @option{-Og}.
9552
9553 @item -ftree-switch-conversion
9554 @opindex ftree-switch-conversion
9555 Perform conversion of simple initializations in a switch to
9556 initializations from a scalar array. This flag is enabled by default
9557 at @option{-O2} and higher.
9558
9559 @item -ftree-tail-merge
9560 @opindex ftree-tail-merge
9561 Look for identical code sequences. When found, replace one with a jump to the
9562 other. This optimization is known as tail merging or cross jumping. This flag
9563 is enabled by default at @option{-O2} and higher. The compilation time
9564 in this pass can
9565 be limited using @option{max-tail-merge-comparisons} parameter and
9566 @option{max-tail-merge-iterations} parameter.
9567
9568 @item -ftree-dce
9569 @opindex ftree-dce
9570 Perform dead code elimination (DCE) on trees. This flag is enabled by
9571 default at @option{-O} and higher.
9572
9573 @item -ftree-builtin-call-dce
9574 @opindex ftree-builtin-call-dce
9575 Perform conditional dead code elimination (DCE) for calls to built-in functions
9576 that may set @code{errno} but are otherwise free of side effects. This flag is
9577 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9578 specified.
9579
9580 @item -ffinite-loops
9581 @opindex ffinite-loops
9582 @opindex fno-finite-loops
9583 Assume that a loop with an exit will eventually take the exit and not loop
9584 indefinitely. This allows the compiler to remove loops that otherwise have
9585 no side-effects, not considering eventual endless looping as such.
9586
9587 This option is enabled by default at @option{-O2}.
9588
9589 @item -ftree-dominator-opts
9590 @opindex ftree-dominator-opts
9591 Perform a variety of simple scalar cleanups (constant/copy
9592 propagation, redundancy elimination, range propagation and expression
9593 simplification) based on a dominator tree traversal. This also
9594 performs jump threading (to reduce jumps to jumps). This flag is
9595 enabled by default at @option{-O} and higher.
9596
9597 @item -ftree-dse
9598 @opindex ftree-dse
9599 Perform dead store elimination (DSE) on trees. A dead store is a store into
9600 a memory location that is later overwritten by another store without
9601 any intervening loads. In this case the earlier store can be deleted. This
9602 flag is enabled by default at @option{-O} and higher.
9603
9604 @item -ftree-ch
9605 @opindex ftree-ch
9606 Perform loop header copying on trees. This is beneficial since it increases
9607 effectiveness of code motion optimizations. It also saves one jump. This flag
9608 is enabled by default at @option{-O} and higher. It is not enabled
9609 for @option{-Os}, since it usually increases code size.
9610
9611 @item -ftree-loop-optimize
9612 @opindex ftree-loop-optimize
9613 Perform loop optimizations on trees. This flag is enabled by default
9614 at @option{-O} and higher.
9615
9616 @item -ftree-loop-linear
9617 @itemx -floop-strip-mine
9618 @itemx -floop-block
9619 @opindex ftree-loop-linear
9620 @opindex floop-strip-mine
9621 @opindex floop-block
9622 Perform loop nest optimizations. Same as
9623 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9624 to be configured with @option{--with-isl} to enable the Graphite loop
9625 transformation infrastructure.
9626
9627 @item -fgraphite-identity
9628 @opindex fgraphite-identity
9629 Enable the identity transformation for graphite. For every SCoP we generate
9630 the polyhedral representation and transform it back to gimple. Using
9631 @option{-fgraphite-identity} we can check the costs or benefits of the
9632 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9633 are also performed by the code generator isl, like index splitting and
9634 dead code elimination in loops.
9635
9636 @item -floop-nest-optimize
9637 @opindex floop-nest-optimize
9638 Enable the isl based loop nest optimizer. This is a generic loop nest
9639 optimizer based on the Pluto optimization algorithms. It calculates a loop
9640 structure optimized for data-locality and parallelism. This option
9641 is experimental.
9642
9643 @item -floop-parallelize-all
9644 @opindex floop-parallelize-all
9645 Use the Graphite data dependence analysis to identify loops that can
9646 be parallelized. Parallelize all the loops that can be analyzed to
9647 not contain loop carried dependences without checking that it is
9648 profitable to parallelize the loops.
9649
9650 @item -ftree-coalesce-vars
9651 @opindex ftree-coalesce-vars
9652 While transforming the program out of the SSA representation, attempt to
9653 reduce copying by coalescing versions of different user-defined
9654 variables, instead of just compiler temporaries. This may severely
9655 limit the ability to debug an optimized program compiled with
9656 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9657 prevents SSA coalescing of user variables. This option is enabled by
9658 default if optimization is enabled, and it does very little otherwise.
9659
9660 @item -ftree-loop-if-convert
9661 @opindex ftree-loop-if-convert
9662 Attempt to transform conditional jumps in the innermost loops to
9663 branch-less equivalents. The intent is to remove control-flow from
9664 the innermost loops in order to improve the ability of the
9665 vectorization pass to handle these loops. This is enabled by default
9666 if vectorization is enabled.
9667
9668 @item -ftree-loop-distribution
9669 @opindex ftree-loop-distribution
9670 Perform loop distribution. This flag can improve cache performance on
9671 big loop bodies and allow further loop optimizations, like
9672 parallelization or vectorization, to take place. For example, the loop
9673 @smallexample
9674 DO I = 1, N
9675 A(I) = B(I) + C
9676 D(I) = E(I) * F
9677 ENDDO
9678 @end smallexample
9679 is transformed to
9680 @smallexample
9681 DO I = 1, N
9682 A(I) = B(I) + C
9683 ENDDO
9684 DO I = 1, N
9685 D(I) = E(I) * F
9686 ENDDO
9687 @end smallexample
9688 This flag is enabled by default at @option{-O3}.
9689 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9690
9691 @item -ftree-loop-distribute-patterns
9692 @opindex ftree-loop-distribute-patterns
9693 Perform loop distribution of patterns that can be code generated with
9694 calls to a library. This flag is enabled by default at @option{-O3}, and
9695 by @option{-fprofile-use} and @option{-fauto-profile}.
9696
9697 This pass distributes the initialization loops and generates a call to
9698 memset zero. For example, the loop
9699 @smallexample
9700 DO I = 1, N
9701 A(I) = 0
9702 B(I) = A(I) + I
9703 ENDDO
9704 @end smallexample
9705 is transformed to
9706 @smallexample
9707 DO I = 1, N
9708 A(I) = 0
9709 ENDDO
9710 DO I = 1, N
9711 B(I) = A(I) + I
9712 ENDDO
9713 @end smallexample
9714 and the initialization loop is transformed into a call to memset zero.
9715 This flag is enabled by default at @option{-O3}.
9716 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9717
9718 @item -floop-interchange
9719 @opindex floop-interchange
9720 Perform loop interchange outside of graphite. This flag can improve cache
9721 performance on loop nest and allow further loop optimizations, like
9722 vectorization, to take place. For example, the loop
9723 @smallexample
9724 for (int i = 0; i < N; i++)
9725 for (int j = 0; j < N; j++)
9726 for (int k = 0; k < N; k++)
9727 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9728 @end smallexample
9729 is transformed to
9730 @smallexample
9731 for (int i = 0; i < N; i++)
9732 for (int k = 0; k < N; k++)
9733 for (int j = 0; j < N; j++)
9734 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9735 @end smallexample
9736 This flag is enabled by default at @option{-O3}.
9737 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9738
9739 @item -floop-unroll-and-jam
9740 @opindex floop-unroll-and-jam
9741 Apply unroll and jam transformations on feasible loops. In a loop
9742 nest this unrolls the outer loop by some factor and fuses the resulting
9743 multiple inner loops. This flag is enabled by default at @option{-O3}.
9744 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9745
9746 @item -ftree-loop-im
9747 @opindex ftree-loop-im
9748 Perform loop invariant motion on trees. This pass moves only invariants that
9749 are hard to handle at RTL level (function calls, operations that expand to
9750 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9751 operands of conditions that are invariant out of the loop, so that we can use
9752 just trivial invariantness analysis in loop unswitching. The pass also includes
9753 store motion.
9754
9755 @item -ftree-loop-ivcanon
9756 @opindex ftree-loop-ivcanon
9757 Create a canonical counter for number of iterations in loops for which
9758 determining number of iterations requires complicated analysis. Later
9759 optimizations then may determine the number easily. Useful especially
9760 in connection with unrolling.
9761
9762 @item -ftree-scev-cprop
9763 @opindex ftree-scev-cprop
9764 Perform final value replacement. If a variable is modified in a loop
9765 in such a way that its value when exiting the loop can be determined using
9766 only its initial value and the number of loop iterations, replace uses of
9767 the final value by such a computation, provided it is sufficiently cheap.
9768 This reduces data dependencies and may allow further simplifications.
9769 Enabled by default at @option{-O} and higher.
9770
9771 @item -fivopts
9772 @opindex fivopts
9773 Perform induction variable optimizations (strength reduction, induction
9774 variable merging and induction variable elimination) on trees.
9775
9776 @item -ftree-parallelize-loops=n
9777 @opindex ftree-parallelize-loops
9778 Parallelize loops, i.e., split their iteration space to run in n threads.
9779 This is only possible for loops whose iterations are independent
9780 and can be arbitrarily reordered. The optimization is only
9781 profitable on multiprocessor machines, for loops that are CPU-intensive,
9782 rather than constrained e.g.@: by memory bandwidth. This option
9783 implies @option{-pthread}, and thus is only supported on targets
9784 that have support for @option{-pthread}.
9785
9786 @item -ftree-pta
9787 @opindex ftree-pta
9788 Perform function-local points-to analysis on trees. This flag is
9789 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9790
9791 @item -ftree-sra
9792 @opindex ftree-sra
9793 Perform scalar replacement of aggregates. This pass replaces structure
9794 references with scalars to prevent committing structures to memory too
9795 early. This flag is enabled by default at @option{-O1} and higher,
9796 except for @option{-Og}.
9797
9798 @item -fstore-merging
9799 @opindex fstore-merging
9800 Perform merging of narrow stores to consecutive memory addresses. This pass
9801 merges contiguous stores of immediate values narrower than a word into fewer
9802 wider stores to reduce the number of instructions. This is enabled by default
9803 at @option{-O2} and higher as well as @option{-Os}.
9804
9805 @item -ftree-ter
9806 @opindex ftree-ter
9807 Perform temporary expression replacement during the SSA->normal phase. Single
9808 use/single def temporaries are replaced at their use location with their
9809 defining expression. This results in non-GIMPLE code, but gives the expanders
9810 much more complex trees to work on resulting in better RTL generation. This is
9811 enabled by default at @option{-O} and higher.
9812
9813 @item -ftree-slsr
9814 @opindex ftree-slsr
9815 Perform straight-line strength reduction on trees. This recognizes related
9816 expressions involving multiplications and replaces them by less expensive
9817 calculations when possible. This is enabled by default at @option{-O} and
9818 higher.
9819
9820 @item -ftree-vectorize
9821 @opindex ftree-vectorize
9822 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9823 and @option{-ftree-slp-vectorize} if not explicitly specified.
9824
9825 @item -ftree-loop-vectorize
9826 @opindex ftree-loop-vectorize
9827 Perform loop vectorization on trees. This flag is enabled by default at
9828 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9829 and @option{-fauto-profile}.
9830
9831 @item -ftree-slp-vectorize
9832 @opindex ftree-slp-vectorize
9833 Perform basic block vectorization on trees. This flag is enabled by default at
9834 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9835 and @option{-fauto-profile}.
9836
9837 @item -fvect-cost-model=@var{model}
9838 @opindex fvect-cost-model
9839 Alter the cost model used for vectorization. The @var{model} argument
9840 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9841 With the @samp{unlimited} model the vectorized code-path is assumed
9842 to be profitable while with the @samp{dynamic} model a runtime check
9843 guards the vectorized code-path to enable it only for iteration
9844 counts that will likely execute faster than when executing the original
9845 scalar loop. The @samp{cheap} model disables vectorization of
9846 loops where doing so would be cost prohibitive for example due to
9847 required runtime checks for data dependence or alignment but otherwise
9848 is equal to the @samp{dynamic} model.
9849 The default cost model depends on other optimization flags and is
9850 either @samp{dynamic} or @samp{cheap}.
9851
9852 @item -fsimd-cost-model=@var{model}
9853 @opindex fsimd-cost-model
9854 Alter the cost model used for vectorization of loops marked with the OpenMP
9855 simd directive. The @var{model} argument should be one of
9856 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9857 have the same meaning as described in @option{-fvect-cost-model} and by
9858 default a cost model defined with @option{-fvect-cost-model} is used.
9859
9860 @item -ftree-vrp
9861 @opindex ftree-vrp
9862 Perform Value Range Propagation on trees. This is similar to the
9863 constant propagation pass, but instead of values, ranges of values are
9864 propagated. This allows the optimizers to remove unnecessary range
9865 checks like array bound checks and null pointer checks. This is
9866 enabled by default at @option{-O2} and higher. Null pointer check
9867 elimination is only done if @option{-fdelete-null-pointer-checks} is
9868 enabled.
9869
9870 @item -fsplit-paths
9871 @opindex fsplit-paths
9872 Split paths leading to loop backedges. This can improve dead code
9873 elimination and common subexpression elimination. This is enabled by
9874 default at @option{-O3} and above.
9875
9876 @item -fsplit-ivs-in-unroller
9877 @opindex fsplit-ivs-in-unroller
9878 Enables expression of values of induction variables in later iterations
9879 of the unrolled loop using the value in the first iteration. This breaks
9880 long dependency chains, thus improving efficiency of the scheduling passes.
9881
9882 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9883 same effect. However, that is not reliable in cases where the loop body
9884 is more complicated than a single basic block. It also does not work at all
9885 on some architectures due to restrictions in the CSE pass.
9886
9887 This optimization is enabled by default.
9888
9889 @item -fvariable-expansion-in-unroller
9890 @opindex fvariable-expansion-in-unroller
9891 With this option, the compiler creates multiple copies of some
9892 local variables when unrolling a loop, which can result in superior code.
9893
9894 This optimization is enabled by default for PowerPC targets, but disabled
9895 by default otherwise.
9896
9897 @item -fpartial-inlining
9898 @opindex fpartial-inlining
9899 Inline parts of functions. This option has any effect only
9900 when inlining itself is turned on by the @option{-finline-functions}
9901 or @option{-finline-small-functions} options.
9902
9903 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9904
9905 @item -fpredictive-commoning
9906 @opindex fpredictive-commoning
9907 Perform predictive commoning optimization, i.e., reusing computations
9908 (especially memory loads and stores) performed in previous
9909 iterations of loops.
9910
9911 This option is enabled at level @option{-O3}.
9912 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9913
9914 @item -fprefetch-loop-arrays
9915 @opindex fprefetch-loop-arrays
9916 If supported by the target machine, generate instructions to prefetch
9917 memory to improve the performance of loops that access large arrays.
9918
9919 This option may generate better or worse code; results are highly
9920 dependent on the structure of loops within the source code.
9921
9922 Disabled at level @option{-Os}.
9923
9924 @item -fno-printf-return-value
9925 @opindex fno-printf-return-value
9926 @opindex fprintf-return-value
9927 Do not substitute constants for known return value of formatted output
9928 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9929 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9930 transformation allows GCC to optimize or even eliminate branches based
9931 on the known return value of these functions called with arguments that
9932 are either constant, or whose values are known to be in a range that
9933 makes determining the exact return value possible. For example, when
9934 @option{-fprintf-return-value} is in effect, both the branch and the
9935 body of the @code{if} statement (but not the call to @code{snprint})
9936 can be optimized away when @code{i} is a 32-bit or smaller integer
9937 because the return value is guaranteed to be at most 8.
9938
9939 @smallexample
9940 char buf[9];
9941 if (snprintf (buf, "%08x", i) >= sizeof buf)
9942 @dots{}
9943 @end smallexample
9944
9945 The @option{-fprintf-return-value} option relies on other optimizations
9946 and yields best results with @option{-O2} and above. It works in tandem
9947 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9948 options. The @option{-fprintf-return-value} option is enabled by default.
9949
9950 @item -fno-peephole
9951 @itemx -fno-peephole2
9952 @opindex fno-peephole
9953 @opindex fpeephole
9954 @opindex fno-peephole2
9955 @opindex fpeephole2
9956 Disable any machine-specific peephole optimizations. The difference
9957 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9958 are implemented in the compiler; some targets use one, some use the
9959 other, a few use both.
9960
9961 @option{-fpeephole} is enabled by default.
9962 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9963
9964 @item -fno-guess-branch-probability
9965 @opindex fno-guess-branch-probability
9966 @opindex fguess-branch-probability
9967 Do not guess branch probabilities using heuristics.
9968
9969 GCC uses heuristics to guess branch probabilities if they are
9970 not provided by profiling feedback (@option{-fprofile-arcs}). These
9971 heuristics are based on the control flow graph. If some branch probabilities
9972 are specified by @code{__builtin_expect}, then the heuristics are
9973 used to guess branch probabilities for the rest of the control flow graph,
9974 taking the @code{__builtin_expect} info into account. The interactions
9975 between the heuristics and @code{__builtin_expect} can be complex, and in
9976 some cases, it may be useful to disable the heuristics so that the effects
9977 of @code{__builtin_expect} are easier to understand.
9978
9979 It is also possible to specify expected probability of the expression
9980 with @code{__builtin_expect_with_probability} built-in function.
9981
9982 The default is @option{-fguess-branch-probability} at levels
9983 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9984
9985 @item -freorder-blocks
9986 @opindex freorder-blocks
9987 Reorder basic blocks in the compiled function in order to reduce number of
9988 taken branches and improve code locality.
9989
9990 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9991
9992 @item -freorder-blocks-algorithm=@var{algorithm}
9993 @opindex freorder-blocks-algorithm
9994 Use the specified algorithm for basic block reordering. The
9995 @var{algorithm} argument can be @samp{simple}, which does not increase
9996 code size (except sometimes due to secondary effects like alignment),
9997 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9998 put all often executed code together, minimizing the number of branches
9999 executed by making extra copies of code.
10000
10001 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
10002 @samp{stc} at levels @option{-O2}, @option{-O3}.
10003
10004 @item -freorder-blocks-and-partition
10005 @opindex freorder-blocks-and-partition
10006 In addition to reordering basic blocks in the compiled function, in order
10007 to reduce number of taken branches, partitions hot and cold basic blocks
10008 into separate sections of the assembly and @file{.o} files, to improve
10009 paging and cache locality performance.
10010
10011 This optimization is automatically turned off in the presence of
10012 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10013 section attribute and on any architecture that does not support named
10014 sections. When @option{-fsplit-stack} is used this option is not
10015 enabled by default (to avoid linker errors), but may be enabled
10016 explicitly (if using a working linker).
10017
10018 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10019
10020 @item -freorder-functions
10021 @opindex freorder-functions
10022 Reorder functions in the object file in order to
10023 improve code locality. This is implemented by using special
10024 subsections @code{.text.hot} for most frequently executed functions and
10025 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
10026 the linker so object file format must support named sections and linker must
10027 place them in a reasonable way.
10028
10029 This option isn't effective unless you either provide profile feedback
10030 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10031 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10032
10033 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10034
10035 @item -fstrict-aliasing
10036 @opindex fstrict-aliasing
10037 Allow the compiler to assume the strictest aliasing rules applicable to
10038 the language being compiled. For C (and C++), this activates
10039 optimizations based on the type of expressions. In particular, an
10040 object of one type is assumed never to reside at the same address as an
10041 object of a different type, unless the types are almost the same. For
10042 example, an @code{unsigned int} can alias an @code{int}, but not a
10043 @code{void*} or a @code{double}. A character type may alias any other
10044 type.
10045
10046 @anchor{Type-punning}Pay special attention to code like this:
10047 @smallexample
10048 union a_union @{
10049 int i;
10050 double d;
10051 @};
10052
10053 int f() @{
10054 union a_union t;
10055 t.d = 3.0;
10056 return t.i;
10057 @}
10058 @end smallexample
10059 The practice of reading from a different union member than the one most
10060 recently written to (called ``type-punning'') is common. Even with
10061 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10062 is accessed through the union type. So, the code above works as
10063 expected. @xref{Structures unions enumerations and bit-fields
10064 implementation}. However, this code might not:
10065 @smallexample
10066 int f() @{
10067 union a_union t;
10068 int* ip;
10069 t.d = 3.0;
10070 ip = &t.i;
10071 return *ip;
10072 @}
10073 @end smallexample
10074
10075 Similarly, access by taking the address, casting the resulting pointer
10076 and dereferencing the result has undefined behavior, even if the cast
10077 uses a union type, e.g.:
10078 @smallexample
10079 int f() @{
10080 double d = 3.0;
10081 return ((union a_union *) &d)->i;
10082 @}
10083 @end smallexample
10084
10085 The @option{-fstrict-aliasing} option is enabled at levels
10086 @option{-O2}, @option{-O3}, @option{-Os}.
10087
10088 @item -falign-functions
10089 @itemx -falign-functions=@var{n}
10090 @itemx -falign-functions=@var{n}:@var{m}
10091 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10092 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10093 @opindex falign-functions
10094 Align the start of functions to the next power-of-two greater than
10095 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10096 the first @var{m} bytes of the function can be fetched by the CPU
10097 without crossing an @var{n}-byte alignment boundary.
10098
10099 If @var{m} is not specified, it defaults to @var{n}.
10100
10101 Examples: @option{-falign-functions=32} aligns functions to the next
10102 32-byte boundary, @option{-falign-functions=24} aligns to the next
10103 32-byte boundary only if this can be done by skipping 23 bytes or less,
10104 @option{-falign-functions=32:7} aligns to the next
10105 32-byte boundary only if this can be done by skipping 6 bytes or less.
10106
10107 The second pair of @var{n2}:@var{m2} values allows you to specify
10108 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10109 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10110 otherwise aligns to the next 32-byte boundary if this can be done
10111 by skipping 2 bytes or less.
10112 If @var{m2} is not specified, it defaults to @var{n2}.
10113
10114 Some assemblers only support this flag when @var{n} is a power of two;
10115 in that case, it is rounded up.
10116
10117 @option{-fno-align-functions} and @option{-falign-functions=1} are
10118 equivalent and mean that functions are not aligned.
10119
10120 If @var{n} is not specified or is zero, use a machine-dependent default.
10121 The maximum allowed @var{n} option value is 65536.
10122
10123 Enabled at levels @option{-O2}, @option{-O3}.
10124
10125 @item -flimit-function-alignment
10126 If this option is enabled, the compiler tries to avoid unnecessarily
10127 overaligning functions. It attempts to instruct the assembler to align
10128 by the amount specified by @option{-falign-functions}, but not to
10129 skip more bytes than the size of the function.
10130
10131 @item -falign-labels
10132 @itemx -falign-labels=@var{n}
10133 @itemx -falign-labels=@var{n}:@var{m}
10134 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10135 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10136 @opindex falign-labels
10137 Align all branch targets to a power-of-two boundary.
10138
10139 Parameters of this option are analogous to the @option{-falign-functions} option.
10140 @option{-fno-align-labels} and @option{-falign-labels=1} are
10141 equivalent and mean that labels are not aligned.
10142
10143 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10144 are greater than this value, then their values are used instead.
10145
10146 If @var{n} is not specified or is zero, use a machine-dependent default
10147 which is very likely to be @samp{1}, meaning no alignment.
10148 The maximum allowed @var{n} option value is 65536.
10149
10150 Enabled at levels @option{-O2}, @option{-O3}.
10151
10152 @item -falign-loops
10153 @itemx -falign-loops=@var{n}
10154 @itemx -falign-loops=@var{n}:@var{m}
10155 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10156 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10157 @opindex falign-loops
10158 Align loops to a power-of-two boundary. If the loops are executed
10159 many times, this makes up for any execution of the dummy padding
10160 instructions.
10161
10162 Parameters of this option are analogous to the @option{-falign-functions} option.
10163 @option{-fno-align-loops} and @option{-falign-loops=1} are
10164 equivalent and mean that loops are not aligned.
10165 The maximum allowed @var{n} option value is 65536.
10166
10167 If @var{n} is not specified or is zero, use a machine-dependent default.
10168
10169 Enabled at levels @option{-O2}, @option{-O3}.
10170
10171 @item -falign-jumps
10172 @itemx -falign-jumps=@var{n}
10173 @itemx -falign-jumps=@var{n}:@var{m}
10174 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10175 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10176 @opindex falign-jumps
10177 Align branch targets to a power-of-two boundary, for branch targets
10178 where the targets can only be reached by jumping. In this case,
10179 no dummy operations need be executed.
10180
10181 Parameters of this option are analogous to the @option{-falign-functions} option.
10182 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10183 equivalent and mean that loops are not aligned.
10184
10185 If @var{n} is not specified or is zero, use a machine-dependent default.
10186 The maximum allowed @var{n} option value is 65536.
10187
10188 Enabled at levels @option{-O2}, @option{-O3}.
10189
10190 @item -funit-at-a-time
10191 @opindex funit-at-a-time
10192 This option is left for compatibility reasons. @option{-funit-at-a-time}
10193 has no effect, while @option{-fno-unit-at-a-time} implies
10194 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10195
10196 Enabled by default.
10197
10198 @item -fno-toplevel-reorder
10199 @opindex fno-toplevel-reorder
10200 @opindex ftoplevel-reorder
10201 Do not reorder top-level functions, variables, and @code{asm}
10202 statements. Output them in the same order that they appear in the
10203 input file. When this option is used, unreferenced static variables
10204 are not removed. This option is intended to support existing code
10205 that relies on a particular ordering. For new code, it is better to
10206 use attributes when possible.
10207
10208 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10209 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10210 Additionally @option{-fno-toplevel-reorder} implies
10211 @option{-fno-section-anchors}.
10212
10213 @item -fweb
10214 @opindex fweb
10215 Constructs webs as commonly used for register allocation purposes and assign
10216 each web individual pseudo register. This allows the register allocation pass
10217 to operate on pseudos directly, but also strengthens several other optimization
10218 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10219 however, make debugging impossible, since variables no longer stay in a
10220 ``home register''.
10221
10222 Enabled by default with @option{-funroll-loops}.
10223
10224 @item -fwhole-program
10225 @opindex fwhole-program
10226 Assume that the current compilation unit represents the whole program being
10227 compiled. All public functions and variables with the exception of @code{main}
10228 and those merged by attribute @code{externally_visible} become static functions
10229 and in effect are optimized more aggressively by interprocedural optimizers.
10230
10231 This option should not be used in combination with @option{-flto}.
10232 Instead relying on a linker plugin should provide safer and more precise
10233 information.
10234
10235 @item -flto[=@var{n}]
10236 @opindex flto
10237 This option runs the standard link-time optimizer. When invoked
10238 with source code, it generates GIMPLE (one of GCC's internal
10239 representations) and writes it to special ELF sections in the object
10240 file. When the object files are linked together, all the function
10241 bodies are read from these ELF sections and instantiated as if they
10242 had been part of the same translation unit.
10243
10244 To use the link-time optimizer, @option{-flto} and optimization
10245 options should be specified at compile time and during the final link.
10246 It is recommended that you compile all the files participating in the
10247 same link with the same options and also specify those options at
10248 link time.
10249 For example:
10250
10251 @smallexample
10252 gcc -c -O2 -flto foo.c
10253 gcc -c -O2 -flto bar.c
10254 gcc -o myprog -flto -O2 foo.o bar.o
10255 @end smallexample
10256
10257 The first two invocations to GCC save a bytecode representation
10258 of GIMPLE into special ELF sections inside @file{foo.o} and
10259 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10260 @file{foo.o} and @file{bar.o}, merges the two files into a single
10261 internal image, and compiles the result as usual. Since both
10262 @file{foo.o} and @file{bar.o} are merged into a single image, this
10263 causes all the interprocedural analyses and optimizations in GCC to
10264 work across the two files as if they were a single one. This means,
10265 for example, that the inliner is able to inline functions in
10266 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10267
10268 Another (simpler) way to enable link-time optimization is:
10269
10270 @smallexample
10271 gcc -o myprog -flto -O2 foo.c bar.c
10272 @end smallexample
10273
10274 The above generates bytecode for @file{foo.c} and @file{bar.c},
10275 merges them together into a single GIMPLE representation and optimizes
10276 them as usual to produce @file{myprog}.
10277
10278 The important thing to keep in mind is that to enable link-time
10279 optimizations you need to use the GCC driver to perform the link step.
10280 GCC automatically performs link-time optimization if any of the
10281 objects involved were compiled with the @option{-flto} command-line option.
10282 You can always override
10283 the automatic decision to do link-time optimization
10284 by passing @option{-fno-lto} to the link command.
10285
10286 To make whole program optimization effective, it is necessary to make
10287 certain whole program assumptions. The compiler needs to know
10288 what functions and variables can be accessed by libraries and runtime
10289 outside of the link-time optimized unit. When supported by the linker,
10290 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10291 to the compiler about used and externally visible symbols. When
10292 the linker plugin is not available, @option{-fwhole-program} should be
10293 used to allow the compiler to make these assumptions, which leads
10294 to more aggressive optimization decisions.
10295
10296 When a file is compiled with @option{-flto} without
10297 @option{-fuse-linker-plugin}, the generated object file is larger than
10298 a regular object file because it contains GIMPLE bytecodes and the usual
10299 final code (see @option{-ffat-lto-objects}. This means that
10300 object files with LTO information can be linked as normal object
10301 files; if @option{-fno-lto} is passed to the linker, no
10302 interprocedural optimizations are applied. Note that when
10303 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10304 but you cannot perform a regular, non-LTO link on them.
10305
10306 When producing the final binary, GCC only
10307 applies link-time optimizations to those files that contain bytecode.
10308 Therefore, you can mix and match object files and libraries with
10309 GIMPLE bytecodes and final object code. GCC automatically selects
10310 which files to optimize in LTO mode and which files to link without
10311 further processing.
10312
10313 Generally, options specified at link time override those
10314 specified at compile time, although in some cases GCC attempts to infer
10315 link-time options from the settings used to compile the input files.
10316
10317 If you do not specify an optimization level option @option{-O} at
10318 link time, then GCC uses the highest optimization level
10319 used when compiling the object files. Note that it is generally
10320 ineffective to specify an optimization level option only at link time and
10321 not at compile time, for two reasons. First, compiling without
10322 optimization suppresses compiler passes that gather information
10323 needed for effective optimization at link time. Second, some early
10324 optimization passes can be performed only at compile time and
10325 not at link time.
10326
10327 There are some code generation flags preserved by GCC when
10328 generating bytecodes, as they need to be used during the final link.
10329 Currently, the following options and their settings are taken from
10330 the first object file that explicitly specifies them:
10331 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10332 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10333 and all the @option{-m} target flags.
10334
10335 Certain ABI-changing flags are required to match in all compilation units,
10336 and trying to override this at link time with a conflicting value
10337 is ignored. This includes options such as @option{-freg-struct-return}
10338 and @option{-fpcc-struct-return}.
10339
10340 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10341 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10342 are passed through to the link stage and merged conservatively for
10343 conflicting translation units. Specifically
10344 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10345 precedence; and for example @option{-ffp-contract=off} takes precedence
10346 over @option{-ffp-contract=fast}. You can override them at link time.
10347
10348 If LTO encounters objects with C linkage declared with incompatible
10349 types in separate translation units to be linked together (undefined
10350 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10351 issued. The behavior is still undefined at run time. Similar
10352 diagnostics may be raised for other languages.
10353
10354 Another feature of LTO is that it is possible to apply interprocedural
10355 optimizations on files written in different languages:
10356
10357 @smallexample
10358 gcc -c -flto foo.c
10359 g++ -c -flto bar.cc
10360 gfortran -c -flto baz.f90
10361 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10362 @end smallexample
10363
10364 Notice that the final link is done with @command{g++} to get the C++
10365 runtime libraries and @option{-lgfortran} is added to get the Fortran
10366 runtime libraries. In general, when mixing languages in LTO mode, you
10367 should use the same link command options as when mixing languages in a
10368 regular (non-LTO) compilation.
10369
10370 If object files containing GIMPLE bytecode are stored in a library archive, say
10371 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10372 are using a linker with plugin support. To create static libraries suitable
10373 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10374 and @command{ranlib};
10375 to show the symbols of object files with GIMPLE bytecode, use
10376 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10377 and @command{nm} have been compiled with plugin support. At link time, use the
10378 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10379 the LTO optimization process:
10380
10381 @smallexample
10382 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10383 @end smallexample
10384
10385 With the linker plugin enabled, the linker extracts the needed
10386 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10387 to make them part of the aggregated GIMPLE image to be optimized.
10388
10389 If you are not using a linker with plugin support and/or do not
10390 enable the linker plugin, then the objects inside @file{libfoo.a}
10391 are extracted and linked as usual, but they do not participate
10392 in the LTO optimization process. In order to make a static library suitable
10393 for both LTO optimization and usual linkage, compile its object files with
10394 @option{-flto} @option{-ffat-lto-objects}.
10395
10396 Link-time optimizations do not require the presence of the whole program to
10397 operate. If the program does not require any symbols to be exported, it is
10398 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10399 the interprocedural optimizers to use more aggressive assumptions which may
10400 lead to improved optimization opportunities.
10401 Use of @option{-fwhole-program} is not needed when linker plugin is
10402 active (see @option{-fuse-linker-plugin}).
10403
10404 The current implementation of LTO makes no
10405 attempt to generate bytecode that is portable between different
10406 types of hosts. The bytecode files are versioned and there is a
10407 strict version check, so bytecode files generated in one version of
10408 GCC do not work with an older or newer version of GCC.
10409
10410 Link-time optimization does not work well with generation of debugging
10411 information on systems other than those using a combination of ELF and
10412 DWARF.
10413
10414 If you specify the optional @var{n}, the optimization and code
10415 generation done at link time is executed in parallel using @var{n}
10416 parallel jobs by utilizing an installed @command{make} program. The
10417 environment variable @env{MAKE} may be used to override the program
10418 used. The default value for @var{n} is automatically detected based
10419 on number of cores.
10420
10421 You can also specify @option{-flto=jobserver} to use GNU make's
10422 job server mode to determine the number of parallel jobs. This
10423 is useful when the Makefile calling GCC is already executing in parallel.
10424 You must prepend a @samp{+} to the command recipe in the parent Makefile
10425 for this to work. This option likely only works if @env{MAKE} is
10426 GNU make.
10427
10428 @item -flto-partition=@var{alg}
10429 @opindex flto-partition
10430 Specify the partitioning algorithm used by the link-time optimizer.
10431 The value is either @samp{1to1} to specify a partitioning mirroring
10432 the original source files or @samp{balanced} to specify partitioning
10433 into equally sized chunks (whenever possible) or @samp{max} to create
10434 new partition for every symbol where possible. Specifying @samp{none}
10435 as an algorithm disables partitioning and streaming completely.
10436 The default value is @samp{balanced}. While @samp{1to1} can be used
10437 as an workaround for various code ordering issues, the @samp{max}
10438 partitioning is intended for internal testing only.
10439 The value @samp{one} specifies that exactly one partition should be
10440 used while the value @samp{none} bypasses partitioning and executes
10441 the link-time optimization step directly from the WPA phase.
10442
10443 @item -flto-compression-level=@var{n}
10444 @opindex flto-compression-level
10445 This option specifies the level of compression used for intermediate
10446 language written to LTO object files, and is only meaningful in
10447 conjunction with LTO mode (@option{-flto}). Valid
10448 values are 0 (no compression) to 9 (maximum compression). Values
10449 outside this range are clamped to either 0 or 9. If the option is not
10450 given, a default balanced compression setting is used.
10451
10452 @item -fuse-linker-plugin
10453 @opindex fuse-linker-plugin
10454 Enables the use of a linker plugin during link-time optimization. This
10455 option relies on plugin support in the linker, which is available in gold
10456 or in GNU ld 2.21 or newer.
10457
10458 This option enables the extraction of object files with GIMPLE bytecode out
10459 of library archives. This improves the quality of optimization by exposing
10460 more code to the link-time optimizer. This information specifies what
10461 symbols can be accessed externally (by non-LTO object or during dynamic
10462 linking). Resulting code quality improvements on binaries (and shared
10463 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10464 See @option{-flto} for a description of the effect of this flag and how to
10465 use it.
10466
10467 This option is enabled by default when LTO support in GCC is enabled
10468 and GCC was configured for use with
10469 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10470
10471 @item -ffat-lto-objects
10472 @opindex ffat-lto-objects
10473 Fat LTO objects are object files that contain both the intermediate language
10474 and the object code. This makes them usable for both LTO linking and normal
10475 linking. This option is effective only when compiling with @option{-flto}
10476 and is ignored at link time.
10477
10478 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10479 requires the complete toolchain to be aware of LTO. It requires a linker with
10480 linker plugin support for basic functionality. Additionally,
10481 @command{nm}, @command{ar} and @command{ranlib}
10482 need to support linker plugins to allow a full-featured build environment
10483 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10484 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10485 to these tools. With non fat LTO makefiles need to be modified to use them.
10486
10487 Note that modern binutils provide plugin auto-load mechanism.
10488 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10489 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10490 @command{gcc-ranlib}).
10491
10492 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10493 support.
10494
10495 @item -fcompare-elim
10496 @opindex fcompare-elim
10497 After register allocation and post-register allocation instruction splitting,
10498 identify arithmetic instructions that compute processor flags similar to a
10499 comparison operation based on that arithmetic. If possible, eliminate the
10500 explicit comparison operation.
10501
10502 This pass only applies to certain targets that cannot explicitly represent
10503 the comparison operation before register allocation is complete.
10504
10505 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10506
10507 @item -fcprop-registers
10508 @opindex fcprop-registers
10509 After register allocation and post-register allocation instruction splitting,
10510 perform a copy-propagation pass to try to reduce scheduling dependencies
10511 and occasionally eliminate the copy.
10512
10513 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10514
10515 @item -fprofile-correction
10516 @opindex fprofile-correction
10517 Profiles collected using an instrumented binary for multi-threaded programs may
10518 be inconsistent due to missed counter updates. When this option is specified,
10519 GCC uses heuristics to correct or smooth out such inconsistencies. By
10520 default, GCC emits an error message when an inconsistent profile is detected.
10521
10522 This option is enabled by @option{-fauto-profile}.
10523
10524 @item -fprofile-use
10525 @itemx -fprofile-use=@var{path}
10526 @opindex fprofile-use
10527 Enable profile feedback-directed optimizations,
10528 and the following optimizations, many of which
10529 are generally profitable only with profile feedback available:
10530
10531 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10532 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10533 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10534 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10535 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10536 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10537 -fprofile-reorder-functions}
10538
10539 Before you can use this option, you must first generate profiling information.
10540 @xref{Instrumentation Options}, for information about the
10541 @option{-fprofile-generate} option.
10542
10543 By default, GCC emits an error message if the feedback profiles do not
10544 match the source code. This error can be turned into a warning by using
10545 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10546 optimized code. Additionally, by default, GCC also emits a warning message if
10547 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10548
10549 If @var{path} is specified, GCC looks at the @var{path} to find
10550 the profile feedback data files. See @option{-fprofile-dir}.
10551
10552 @item -fauto-profile
10553 @itemx -fauto-profile=@var{path}
10554 @opindex fauto-profile
10555 Enable sampling-based feedback-directed optimizations,
10556 and the following optimizations,
10557 many of which are generally profitable only with profile feedback available:
10558
10559 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10560 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10561 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10562 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10563 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10564 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10565 -fprofile-correction}
10566
10567 @var{path} is the name of a file containing AutoFDO profile information.
10568 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10569
10570 Producing an AutoFDO profile data file requires running your program
10571 with the @command{perf} utility on a supported GNU/Linux target system.
10572 For more information, see @uref{https://perf.wiki.kernel.org/}.
10573
10574 E.g.
10575 @smallexample
10576 perf record -e br_inst_retired:near_taken -b -o perf.data \
10577 -- your_program
10578 @end smallexample
10579
10580 Then use the @command{create_gcov} tool to convert the raw profile data
10581 to a format that can be used by GCC.@ You must also supply the
10582 unstripped binary for your program to this tool.
10583 See @uref{https://github.com/google/autofdo}.
10584
10585 E.g.
10586 @smallexample
10587 create_gcov --binary=your_program.unstripped --profile=perf.data \
10588 --gcov=profile.afdo
10589 @end smallexample
10590 @end table
10591
10592 The following options control compiler behavior regarding floating-point
10593 arithmetic. These options trade off between speed and
10594 correctness. All must be specifically enabled.
10595
10596 @table @gcctabopt
10597 @item -ffloat-store
10598 @opindex ffloat-store
10599 Do not store floating-point variables in registers, and inhibit other
10600 options that might change whether a floating-point value is taken from a
10601 register or memory.
10602
10603 @cindex floating-point precision
10604 This option prevents undesirable excess precision on machines such as
10605 the 68000 where the floating registers (of the 68881) keep more
10606 precision than a @code{double} is supposed to have. Similarly for the
10607 x86 architecture. For most programs, the excess precision does only
10608 good, but a few programs rely on the precise definition of IEEE floating
10609 point. Use @option{-ffloat-store} for such programs, after modifying
10610 them to store all pertinent intermediate computations into variables.
10611
10612 @item -fexcess-precision=@var{style}
10613 @opindex fexcess-precision
10614 This option allows further control over excess precision on machines
10615 where floating-point operations occur in a format with more precision or
10616 range than the IEEE standard and interchange floating-point types. By
10617 default, @option{-fexcess-precision=fast} is in effect; this means that
10618 operations may be carried out in a wider precision than the types specified
10619 in the source if that would result in faster code, and it is unpredictable
10620 when rounding to the types specified in the source code takes place.
10621 When compiling C, if @option{-fexcess-precision=standard} is specified then
10622 excess precision follows the rules specified in ISO C99; in particular,
10623 both casts and assignments cause values to be rounded to their
10624 semantic types (whereas @option{-ffloat-store} only affects
10625 assignments). This option is enabled by default for C if a strict
10626 conformance option such as @option{-std=c99} is used.
10627 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10628 regardless of whether a strict conformance option is used.
10629
10630 @opindex mfpmath
10631 @option{-fexcess-precision=standard} is not implemented for languages
10632 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10633 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10634 semantics apply without excess precision, and in the latter, rounding
10635 is unpredictable.
10636
10637 @item -ffast-math
10638 @opindex ffast-math
10639 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10640 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10641 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10642 @option{-fexcess-precision=fast}.
10643
10644 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10645
10646 This option is not turned on by any @option{-O} option besides
10647 @option{-Ofast} since it can result in incorrect output for programs
10648 that depend on an exact implementation of IEEE or ISO rules/specifications
10649 for math functions. It may, however, yield faster code for programs
10650 that do not require the guarantees of these specifications.
10651
10652 @item -fno-math-errno
10653 @opindex fno-math-errno
10654 @opindex fmath-errno
10655 Do not set @code{errno} after calling math functions that are executed
10656 with a single instruction, e.g., @code{sqrt}. A program that relies on
10657 IEEE exceptions for math error handling may want to use this flag
10658 for speed while maintaining IEEE arithmetic compatibility.
10659
10660 This option is not turned on by any @option{-O} option since
10661 it can result in incorrect output for programs that depend on
10662 an exact implementation of IEEE or ISO rules/specifications for
10663 math functions. It may, however, yield faster code for programs
10664 that do not require the guarantees of these specifications.
10665
10666 The default is @option{-fmath-errno}.
10667
10668 On Darwin systems, the math library never sets @code{errno}. There is
10669 therefore no reason for the compiler to consider the possibility that
10670 it might, and @option{-fno-math-errno} is the default.
10671
10672 @item -funsafe-math-optimizations
10673 @opindex funsafe-math-optimizations
10674
10675 Allow optimizations for floating-point arithmetic that (a) assume
10676 that arguments and results are valid and (b) may violate IEEE or
10677 ANSI standards. When used at link time, it may include libraries
10678 or startup files that change the default FPU control word or other
10679 similar optimizations.
10680
10681 This option is not turned on by any @option{-O} option since
10682 it can result in incorrect output for programs that depend on
10683 an exact implementation of IEEE or ISO rules/specifications for
10684 math functions. It may, however, yield faster code for programs
10685 that do not require the guarantees of these specifications.
10686 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10687 @option{-fassociative-math} and @option{-freciprocal-math}.
10688
10689 The default is @option{-fno-unsafe-math-optimizations}.
10690
10691 @item -fassociative-math
10692 @opindex fassociative-math
10693
10694 Allow re-association of operands in series of floating-point operations.
10695 This violates the ISO C and C++ language standard by possibly changing
10696 computation result. NOTE: re-ordering may change the sign of zero as
10697 well as ignore NaNs and inhibit or create underflow or overflow (and
10698 thus cannot be used on code that relies on rounding behavior like
10699 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10700 and thus may not be used when ordered comparisons are required.
10701 This option requires that both @option{-fno-signed-zeros} and
10702 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10703 much sense with @option{-frounding-math}. For Fortran the option
10704 is automatically enabled when both @option{-fno-signed-zeros} and
10705 @option{-fno-trapping-math} are in effect.
10706
10707 The default is @option{-fno-associative-math}.
10708
10709 @item -freciprocal-math
10710 @opindex freciprocal-math
10711
10712 Allow the reciprocal of a value to be used instead of dividing by
10713 the value if this enables optimizations. For example @code{x / y}
10714 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10715 is subject to common subexpression elimination. Note that this loses
10716 precision and increases the number of flops operating on the value.
10717
10718 The default is @option{-fno-reciprocal-math}.
10719
10720 @item -ffinite-math-only
10721 @opindex ffinite-math-only
10722 Allow optimizations for floating-point arithmetic that assume
10723 that arguments and results are not NaNs or +-Infs.
10724
10725 This option is not turned on by any @option{-O} option since
10726 it can result in incorrect output for programs that depend on
10727 an exact implementation of IEEE or ISO rules/specifications for
10728 math functions. It may, however, yield faster code for programs
10729 that do not require the guarantees of these specifications.
10730
10731 The default is @option{-fno-finite-math-only}.
10732
10733 @item -fno-signed-zeros
10734 @opindex fno-signed-zeros
10735 @opindex fsigned-zeros
10736 Allow optimizations for floating-point arithmetic that ignore the
10737 signedness of zero. IEEE arithmetic specifies the behavior of
10738 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10739 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10740 This option implies that the sign of a zero result isn't significant.
10741
10742 The default is @option{-fsigned-zeros}.
10743
10744 @item -fno-trapping-math
10745 @opindex fno-trapping-math
10746 @opindex ftrapping-math
10747 Compile code assuming that floating-point operations cannot generate
10748 user-visible traps. These traps include division by zero, overflow,
10749 underflow, inexact result and invalid operation. This option requires
10750 that @option{-fno-signaling-nans} be in effect. Setting this option may
10751 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10752
10753 This option should never be turned on by any @option{-O} option since
10754 it can result in incorrect output for programs that depend on
10755 an exact implementation of IEEE or ISO rules/specifications for
10756 math functions.
10757
10758 The default is @option{-ftrapping-math}.
10759
10760 @item -frounding-math
10761 @opindex frounding-math
10762 Disable transformations and optimizations that assume default floating-point
10763 rounding behavior. This is round-to-zero for all floating point
10764 to integer conversions, and round-to-nearest for all other arithmetic
10765 truncations. This option should be specified for programs that change
10766 the FP rounding mode dynamically, or that may be executed with a
10767 non-default rounding mode. This option disables constant folding of
10768 floating-point expressions at compile time (which may be affected by
10769 rounding mode) and arithmetic transformations that are unsafe in the
10770 presence of sign-dependent rounding modes.
10771
10772 The default is @option{-fno-rounding-math}.
10773
10774 This option is experimental and does not currently guarantee to
10775 disable all GCC optimizations that are affected by rounding mode.
10776 Future versions of GCC may provide finer control of this setting
10777 using C99's @code{FENV_ACCESS} pragma. This command-line option
10778 will be used to specify the default state for @code{FENV_ACCESS}.
10779
10780 @item -fsignaling-nans
10781 @opindex fsignaling-nans
10782 Compile code assuming that IEEE signaling NaNs may generate user-visible
10783 traps during floating-point operations. Setting this option disables
10784 optimizations that may change the number of exceptions visible with
10785 signaling NaNs. This option implies @option{-ftrapping-math}.
10786
10787 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10788 be defined.
10789
10790 The default is @option{-fno-signaling-nans}.
10791
10792 This option is experimental and does not currently guarantee to
10793 disable all GCC optimizations that affect signaling NaN behavior.
10794
10795 @item -fno-fp-int-builtin-inexact
10796 @opindex fno-fp-int-builtin-inexact
10797 @opindex ffp-int-builtin-inexact
10798 Do not allow the built-in functions @code{ceil}, @code{floor},
10799 @code{round} and @code{trunc}, and their @code{float} and @code{long
10800 double} variants, to generate code that raises the ``inexact''
10801 floating-point exception for noninteger arguments. ISO C99 and C11
10802 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10803 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10804 functions to do so.
10805
10806 The default is @option{-ffp-int-builtin-inexact}, allowing the
10807 exception to be raised. This option does nothing unless
10808 @option{-ftrapping-math} is in effect.
10809
10810 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10811 generate a call to a library function then the ``inexact'' exception
10812 may be raised if the library implementation does not follow TS 18661.
10813
10814 @item -fsingle-precision-constant
10815 @opindex fsingle-precision-constant
10816 Treat floating-point constants as single precision instead of
10817 implicitly converting them to double-precision constants.
10818
10819 @item -fcx-limited-range
10820 @opindex fcx-limited-range
10821 When enabled, this option states that a range reduction step is not
10822 needed when performing complex division. Also, there is no checking
10823 whether the result of a complex multiplication or division is @code{NaN
10824 + I*NaN}, with an attempt to rescue the situation in that case. The
10825 default is @option{-fno-cx-limited-range}, but is enabled by
10826 @option{-ffast-math}.
10827
10828 This option controls the default setting of the ISO C99
10829 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10830 all languages.
10831
10832 @item -fcx-fortran-rules
10833 @opindex fcx-fortran-rules
10834 Complex multiplication and division follow Fortran rules. Range
10835 reduction is done as part of complex division, but there is no checking
10836 whether the result of a complex multiplication or division is @code{NaN
10837 + I*NaN}, with an attempt to rescue the situation in that case.
10838
10839 The default is @option{-fno-cx-fortran-rules}.
10840
10841 @end table
10842
10843 The following options control optimizations that may improve
10844 performance, but are not enabled by any @option{-O} options. This
10845 section includes experimental options that may produce broken code.
10846
10847 @table @gcctabopt
10848 @item -fbranch-probabilities
10849 @opindex fbranch-probabilities
10850 After running a program compiled with @option{-fprofile-arcs}
10851 (@pxref{Instrumentation Options}),
10852 you can compile it a second time using
10853 @option{-fbranch-probabilities}, to improve optimizations based on
10854 the number of times each branch was taken. When a program
10855 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10856 counts to a file called @file{@var{sourcename}.gcda} for each source
10857 file. The information in this data file is very dependent on the
10858 structure of the generated code, so you must use the same source code
10859 and the same optimization options for both compilations.
10860
10861 With @option{-fbranch-probabilities}, GCC puts a
10862 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10863 These can be used to improve optimization. Currently, they are only
10864 used in one place: in @file{reorg.c}, instead of guessing which path a
10865 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10866 exactly determine which path is taken more often.
10867
10868 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10869
10870 @item -fprofile-values
10871 @opindex fprofile-values
10872 If combined with @option{-fprofile-arcs}, it adds code so that some
10873 data about values of expressions in the program is gathered.
10874
10875 With @option{-fbranch-probabilities}, it reads back the data gathered
10876 from profiling values of expressions for usage in optimizations.
10877
10878 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10879 @option{-fauto-profile}.
10880
10881 @item -fprofile-reorder-functions
10882 @opindex fprofile-reorder-functions
10883 Function reordering based on profile instrumentation collects
10884 first time of execution of a function and orders these functions
10885 in ascending order.
10886
10887 Enabled with @option{-fprofile-use}.
10888
10889 @item -fvpt
10890 @opindex fvpt
10891 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10892 to add code to gather information about values of expressions.
10893
10894 With @option{-fbranch-probabilities}, it reads back the data gathered
10895 and actually performs the optimizations based on them.
10896 Currently the optimizations include specialization of division operations
10897 using the knowledge about the value of the denominator.
10898
10899 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10900
10901 @item -frename-registers
10902 @opindex frename-registers
10903 Attempt to avoid false dependencies in scheduled code by making use
10904 of registers left over after register allocation. This optimization
10905 most benefits processors with lots of registers. Depending on the
10906 debug information format adopted by the target, however, it can
10907 make debugging impossible, since variables no longer stay in
10908 a ``home register''.
10909
10910 Enabled by default with @option{-funroll-loops}.
10911
10912 @item -fschedule-fusion
10913 @opindex fschedule-fusion
10914 Performs a target dependent pass over the instruction stream to schedule
10915 instructions of same type together because target machine can execute them
10916 more efficiently if they are adjacent to each other in the instruction flow.
10917
10918 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10919
10920 @item -ftracer
10921 @opindex ftracer
10922 Perform tail duplication to enlarge superblock size. This transformation
10923 simplifies the control flow of the function allowing other optimizations to do
10924 a better job.
10925
10926 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10927
10928 @item -funroll-loops
10929 @opindex funroll-loops
10930 Unroll loops whose number of iterations can be determined at compile time or
10931 upon entry to the loop. @option{-funroll-loops} implies
10932 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10933 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10934 a small constant number of iterations). This option makes code larger, and may
10935 or may not make it run faster.
10936
10937 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10938
10939 @item -funroll-all-loops
10940 @opindex funroll-all-loops
10941 Unroll all loops, even if their number of iterations is uncertain when
10942 the loop is entered. This usually makes programs run more slowly.
10943 @option{-funroll-all-loops} implies the same options as
10944 @option{-funroll-loops}.
10945
10946 @item -fpeel-loops
10947 @opindex fpeel-loops
10948 Peels loops for which there is enough information that they do not
10949 roll much (from profile feedback or static analysis). It also turns on
10950 complete loop peeling (i.e.@: complete removal of loops with small constant
10951 number of iterations).
10952
10953 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10954
10955 @item -fmove-loop-invariants
10956 @opindex fmove-loop-invariants
10957 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10958 at level @option{-O1} and higher, except for @option{-Og}.
10959
10960 @item -fsplit-loops
10961 @opindex fsplit-loops
10962 Split a loop into two if it contains a condition that's always true
10963 for one side of the iteration space and false for the other.
10964
10965 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10966
10967 @item -funswitch-loops
10968 @opindex funswitch-loops
10969 Move branches with loop invariant conditions out of the loop, with duplicates
10970 of the loop on both branches (modified according to result of the condition).
10971
10972 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10973
10974 @item -fversion-loops-for-strides
10975 @opindex fversion-loops-for-strides
10976 If a loop iterates over an array with a variable stride, create another
10977 version of the loop that assumes the stride is always one. For example:
10978
10979 @smallexample
10980 for (int i = 0; i < n; ++i)
10981 x[i * stride] = @dots{};
10982 @end smallexample
10983
10984 becomes:
10985
10986 @smallexample
10987 if (stride == 1)
10988 for (int i = 0; i < n; ++i)
10989 x[i] = @dots{};
10990 else
10991 for (int i = 0; i < n; ++i)
10992 x[i * stride] = @dots{};
10993 @end smallexample
10994
10995 This is particularly useful for assumed-shape arrays in Fortran where
10996 (for example) it allows better vectorization assuming contiguous accesses.
10997 This flag is enabled by default at @option{-O3}.
10998 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10999
11000 @item -ffunction-sections
11001 @itemx -fdata-sections
11002 @opindex ffunction-sections
11003 @opindex fdata-sections
11004 Place each function or data item into its own section in the output
11005 file if the target supports arbitrary sections. The name of the
11006 function or the name of the data item determines the section's name
11007 in the output file.
11008
11009 Use these options on systems where the linker can perform optimizations to
11010 improve locality of reference in the instruction space. Most systems using the
11011 ELF object format have linkers with such optimizations. On AIX, the linker
11012 rearranges sections (CSECTs) based on the call graph. The performance impact
11013 varies.
11014
11015 Together with a linker garbage collection (linker @option{--gc-sections}
11016 option) these options may lead to smaller statically-linked executables (after
11017 stripping).
11018
11019 On ELF/DWARF systems these options do not degenerate the quality of the debug
11020 information. There could be issues with other object files/debug info formats.
11021
11022 Only use these options when there are significant benefits from doing so. When
11023 you specify these options, the assembler and linker create larger object and
11024 executable files and are also slower. These options affect code generation.
11025 They prevent optimizations by the compiler and assembler using relative
11026 locations inside a translation unit since the locations are unknown until
11027 link time. An example of such an optimization is relaxing calls to short call
11028 instructions.
11029
11030 @item -fbranch-target-load-optimize
11031 @opindex fbranch-target-load-optimize
11032 Perform branch target register load optimization before prologue / epilogue
11033 threading.
11034 The use of target registers can typically be exposed only during reload,
11035 thus hoisting loads out of loops and doing inter-block scheduling needs
11036 a separate optimization pass.
11037
11038 @item -fbranch-target-load-optimize2
11039 @opindex fbranch-target-load-optimize2
11040 Perform branch target register load optimization after prologue / epilogue
11041 threading.
11042
11043 @item -fbtr-bb-exclusive
11044 @opindex fbtr-bb-exclusive
11045 When performing branch target register load optimization, don't reuse
11046 branch target registers within any basic block.
11047
11048 @item -fstdarg-opt
11049 @opindex fstdarg-opt
11050 Optimize the prologue of variadic argument functions with respect to usage of
11051 those arguments.
11052
11053 @item -fsection-anchors
11054 @opindex fsection-anchors
11055 Try to reduce the number of symbolic address calculations by using
11056 shared ``anchor'' symbols to address nearby objects. This transformation
11057 can help to reduce the number of GOT entries and GOT accesses on some
11058 targets.
11059
11060 For example, the implementation of the following function @code{foo}:
11061
11062 @smallexample
11063 static int a, b, c;
11064 int foo (void) @{ return a + b + c; @}
11065 @end smallexample
11066
11067 @noindent
11068 usually calculates the addresses of all three variables, but if you
11069 compile it with @option{-fsection-anchors}, it accesses the variables
11070 from a common anchor point instead. The effect is similar to the
11071 following pseudocode (which isn't valid C):
11072
11073 @smallexample
11074 int foo (void)
11075 @{
11076 register int *xr = &x;
11077 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11078 @}
11079 @end smallexample
11080
11081 Not all targets support this option.
11082
11083 @item --param @var{name}=@var{value}
11084 @opindex param
11085 In some places, GCC uses various constants to control the amount of
11086 optimization that is done. For example, GCC does not inline functions
11087 that contain more than a certain number of instructions. You can
11088 control some of these constants on the command line using the
11089 @option{--param} option.
11090
11091 The names of specific parameters, and the meaning of the values, are
11092 tied to the internals of the compiler, and are subject to change
11093 without notice in future releases.
11094
11095 In order to get minimal, maximal and default value of a parameter,
11096 one can use @option{--help=param -Q} options.
11097
11098 In each case, the @var{value} is an integer. The allowable choices for
11099 @var{name} are:
11100
11101 @table @gcctabopt
11102 @item predictable-branch-outcome
11103 When branch is predicted to be taken with probability lower than this threshold
11104 (in percent), then it is considered well predictable.
11105
11106 @item max-rtl-if-conversion-insns
11107 RTL if-conversion tries to remove conditional branches around a block and
11108 replace them with conditionally executed instructions. This parameter
11109 gives the maximum number of instructions in a block which should be
11110 considered for if-conversion. The compiler will
11111 also use other heuristics to decide whether if-conversion is likely to be
11112 profitable.
11113
11114 @item max-rtl-if-conversion-predictable-cost
11115 @itemx max-rtl-if-conversion-unpredictable-cost
11116 RTL if-conversion will try to remove conditional branches around a block
11117 and replace them with conditionally executed instructions. These parameters
11118 give the maximum permissible cost for the sequence that would be generated
11119 by if-conversion depending on whether the branch is statically determined
11120 to be predictable or not. The units for this parameter are the same as
11121 those for the GCC internal seq_cost metric. The compiler will try to
11122 provide a reasonable default for this parameter using the BRANCH_COST
11123 target macro.
11124
11125 @item max-crossjump-edges
11126 The maximum number of incoming edges to consider for cross-jumping.
11127 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11128 the number of edges incoming to each block. Increasing values mean
11129 more aggressive optimization, making the compilation time increase with
11130 probably small improvement in executable size.
11131
11132 @item min-crossjump-insns
11133 The minimum number of instructions that must be matched at the end
11134 of two blocks before cross-jumping is performed on them. This
11135 value is ignored in the case where all instructions in the block being
11136 cross-jumped from are matched.
11137
11138 @item max-grow-copy-bb-insns
11139 The maximum code size expansion factor when copying basic blocks
11140 instead of jumping. The expansion is relative to a jump instruction.
11141
11142 @item max-goto-duplication-insns
11143 The maximum number of instructions to duplicate to a block that jumps
11144 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11145 passes, GCC factors computed gotos early in the compilation process,
11146 and unfactors them as late as possible. Only computed jumps at the
11147 end of a basic blocks with no more than max-goto-duplication-insns are
11148 unfactored.
11149
11150 @item max-delay-slot-insn-search
11151 The maximum number of instructions to consider when looking for an
11152 instruction to fill a delay slot. If more than this arbitrary number of
11153 instructions are searched, the time savings from filling the delay slot
11154 are minimal, so stop searching. Increasing values mean more
11155 aggressive optimization, making the compilation time increase with probably
11156 small improvement in execution time.
11157
11158 @item max-delay-slot-live-search
11159 When trying to fill delay slots, the maximum number of instructions to
11160 consider when searching for a block with valid live register
11161 information. Increasing this arbitrarily chosen value means more
11162 aggressive optimization, increasing the compilation time. This parameter
11163 should be removed when the delay slot code is rewritten to maintain the
11164 control-flow graph.
11165
11166 @item max-gcse-memory
11167 The approximate maximum amount of memory that can be allocated in
11168 order to perform the global common subexpression elimination
11169 optimization. If more memory than specified is required, the
11170 optimization is not done.
11171
11172 @item max-gcse-insertion-ratio
11173 If the ratio of expression insertions to deletions is larger than this value
11174 for any expression, then RTL PRE inserts or removes the expression and thus
11175 leaves partially redundant computations in the instruction stream.
11176
11177 @item max-pending-list-length
11178 The maximum number of pending dependencies scheduling allows
11179 before flushing the current state and starting over. Large functions
11180 with few branches or calls can create excessively large lists which
11181 needlessly consume memory and resources.
11182
11183 @item max-modulo-backtrack-attempts
11184 The maximum number of backtrack attempts the scheduler should make
11185 when modulo scheduling a loop. Larger values can exponentially increase
11186 compilation time.
11187
11188 @item max-inline-insns-single
11189 Several parameters control the tree inliner used in GCC@.
11190 This number sets the maximum number of instructions (counted in GCC's
11191 internal representation) in a single function that the tree inliner
11192 considers for inlining. This only affects functions declared
11193 inline and methods implemented in a class declaration (C++).
11194
11195 @item max-inline-insns-auto
11196 When you use @option{-finline-functions} (included in @option{-O3}),
11197 a lot of functions that would otherwise not be considered for inlining
11198 by the compiler are investigated. To those functions, a different
11199 (more restrictive) limit compared to functions declared inline can
11200 be applied.
11201
11202 @item max-inline-insns-small
11203 This is bound applied to calls which are considered relevant with
11204 @option{-finline-small-functions}.
11205
11206 @item max-inline-insns-size
11207 This is bound applied to calls which are optimized for size. Small growth
11208 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11209
11210 @item uninlined-function-insns
11211 Number of instructions accounted by inliner for function overhead such as
11212 function prologue and epilogue.
11213
11214 @item uninlined-function-time
11215 Extra time accounted by inliner for function overhead such as time needed to
11216 execute function prologue and epilogue
11217
11218 @item uninlined-thunk-insns
11219 @item uninlined-thunk-time
11220 Same as @option{--param uninlined-function-insns} and
11221 @option{--param uninlined-function-time} but applied to function thunks
11222
11223 @item inline-min-speedup
11224 When estimated performance improvement of caller + callee runtime exceeds this
11225 threshold (in percent), the function can be inlined regardless of the limit on
11226 @option{--param max-inline-insns-single} and @option{--param
11227 max-inline-insns-auto}.
11228
11229 @item large-function-insns
11230 The limit specifying really large functions. For functions larger than this
11231 limit after inlining, inlining is constrained by
11232 @option{--param large-function-growth}. This parameter is useful primarily
11233 to avoid extreme compilation time caused by non-linear algorithms used by the
11234 back end.
11235
11236 @item large-function-growth
11237 Specifies maximal growth of large function caused by inlining in percents.
11238 For example, parameter value 100 limits large function growth to 2.0 times
11239 the original size.
11240
11241 @item large-unit-insns
11242 The limit specifying large translation unit. Growth caused by inlining of
11243 units larger than this limit is limited by @option{--param inline-unit-growth}.
11244 For small units this might be too tight.
11245 For example, consider a unit consisting of function A
11246 that is inline and B that just calls A three times. If B is small relative to
11247 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11248 large units consisting of small inlineable functions, however, the overall unit
11249 growth limit is needed to avoid exponential explosion of code size. Thus for
11250 smaller units, the size is increased to @option{--param large-unit-insns}
11251 before applying @option{--param inline-unit-growth}.
11252
11253 @item inline-unit-growth
11254 Specifies maximal overall growth of the compilation unit caused by inlining.
11255 For example, parameter value 20 limits unit growth to 1.2 times the original
11256 size. Cold functions (either marked cold via an attribute or by profile
11257 feedback) are not accounted into the unit size.
11258
11259 @item ipcp-unit-growth
11260 Specifies maximal overall growth of the compilation unit caused by
11261 interprocedural constant propagation. For example, parameter value 10 limits
11262 unit growth to 1.1 times the original size.
11263
11264 @item large-stack-frame
11265 The limit specifying large stack frames. While inlining the algorithm is trying
11266 to not grow past this limit too much.
11267
11268 @item large-stack-frame-growth
11269 Specifies maximal growth of large stack frames caused by inlining in percents.
11270 For example, parameter value 1000 limits large stack frame growth to 11 times
11271 the original size.
11272
11273 @item max-inline-insns-recursive
11274 @itemx max-inline-insns-recursive-auto
11275 Specifies the maximum number of instructions an out-of-line copy of a
11276 self-recursive inline
11277 function can grow into by performing recursive inlining.
11278
11279 @option{--param max-inline-insns-recursive} applies to functions
11280 declared inline.
11281 For functions not declared inline, recursive inlining
11282 happens only when @option{-finline-functions} (included in @option{-O3}) is
11283 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11284
11285 @item max-inline-recursive-depth
11286 @itemx max-inline-recursive-depth-auto
11287 Specifies the maximum recursion depth used for recursive inlining.
11288
11289 @option{--param max-inline-recursive-depth} applies to functions
11290 declared inline. For functions not declared inline, recursive inlining
11291 happens only when @option{-finline-functions} (included in @option{-O3}) is
11292 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11293
11294 @item min-inline-recursive-probability
11295 Recursive inlining is profitable only for function having deep recursion
11296 in average and can hurt for function having little recursion depth by
11297 increasing the prologue size or complexity of function body to other
11298 optimizers.
11299
11300 When profile feedback is available (see @option{-fprofile-generate}) the actual
11301 recursion depth can be guessed from the probability that function recurses
11302 via a given call expression. This parameter limits inlining only to call
11303 expressions whose probability exceeds the given threshold (in percents).
11304
11305 @item early-inlining-insns
11306 Specify growth that the early inliner can make. In effect it increases
11307 the amount of inlining for code having a large abstraction penalty.
11308
11309 @item max-early-inliner-iterations
11310 Limit of iterations of the early inliner. This basically bounds
11311 the number of nested indirect calls the early inliner can resolve.
11312 Deeper chains are still handled by late inlining.
11313
11314 @item comdat-sharing-probability
11315 Probability (in percent) that C++ inline function with comdat visibility
11316 are shared across multiple compilation units.
11317
11318 @item profile-func-internal-id
11319 A parameter to control whether to use function internal id in profile
11320 database lookup. If the value is 0, the compiler uses an id that
11321 is based on function assembler name and filename, which makes old profile
11322 data more tolerant to source changes such as function reordering etc.
11323
11324 @item min-vect-loop-bound
11325 The minimum number of iterations under which loops are not vectorized
11326 when @option{-ftree-vectorize} is used. The number of iterations after
11327 vectorization needs to be greater than the value specified by this option
11328 to allow vectorization.
11329
11330 @item gcse-cost-distance-ratio
11331 Scaling factor in calculation of maximum distance an expression
11332 can be moved by GCSE optimizations. This is currently supported only in the
11333 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11334 is with simple expressions, i.e., the expressions that have cost
11335 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11336 hoisting of simple expressions.
11337
11338 @item gcse-unrestricted-cost
11339 Cost, roughly measured as the cost of a single typical machine
11340 instruction, at which GCSE optimizations do not constrain
11341 the distance an expression can travel. This is currently
11342 supported only in the code hoisting pass. The lesser the cost,
11343 the more aggressive code hoisting is. Specifying 0
11344 allows all expressions to travel unrestricted distances.
11345
11346 @item max-hoist-depth
11347 The depth of search in the dominator tree for expressions to hoist.
11348 This is used to avoid quadratic behavior in hoisting algorithm.
11349 The value of 0 does not limit on the search, but may slow down compilation
11350 of huge functions.
11351
11352 @item max-tail-merge-comparisons
11353 The maximum amount of similar bbs to compare a bb with. This is used to
11354 avoid quadratic behavior in tree tail merging.
11355
11356 @item max-tail-merge-iterations
11357 The maximum amount of iterations of the pass over the function. This is used to
11358 limit compilation time in tree tail merging.
11359
11360 @item store-merging-allow-unaligned
11361 Allow the store merging pass to introduce unaligned stores if it is legal to
11362 do so.
11363
11364 @item max-stores-to-merge
11365 The maximum number of stores to attempt to merge into wider stores in the store
11366 merging pass.
11367
11368 @item max-unrolled-insns
11369 The maximum number of instructions that a loop may have to be unrolled.
11370 If a loop is unrolled, this parameter also determines how many times
11371 the loop code is unrolled.
11372
11373 @item max-average-unrolled-insns
11374 The maximum number of instructions biased by probabilities of their execution
11375 that a loop may have to be unrolled. If a loop is unrolled,
11376 this parameter also determines how many times the loop code is unrolled.
11377
11378 @item max-unroll-times
11379 The maximum number of unrollings of a single loop.
11380
11381 @item max-peeled-insns
11382 The maximum number of instructions that a loop may have to be peeled.
11383 If a loop is peeled, this parameter also determines how many times
11384 the loop code is peeled.
11385
11386 @item max-peel-times
11387 The maximum number of peelings of a single loop.
11388
11389 @item max-peel-branches
11390 The maximum number of branches on the hot path through the peeled sequence.
11391
11392 @item max-completely-peeled-insns
11393 The maximum number of insns of a completely peeled loop.
11394
11395 @item max-completely-peel-times
11396 The maximum number of iterations of a loop to be suitable for complete peeling.
11397
11398 @item max-completely-peel-loop-nest-depth
11399 The maximum depth of a loop nest suitable for complete peeling.
11400
11401 @item max-unswitch-insns
11402 The maximum number of insns of an unswitched loop.
11403
11404 @item max-unswitch-level
11405 The maximum number of branches unswitched in a single loop.
11406
11407 @item lim-expensive
11408 The minimum cost of an expensive expression in the loop invariant motion.
11409
11410 @item iv-consider-all-candidates-bound
11411 Bound on number of candidates for induction variables, below which
11412 all candidates are considered for each use in induction variable
11413 optimizations. If there are more candidates than this,
11414 only the most relevant ones are considered to avoid quadratic time complexity.
11415
11416 @item iv-max-considered-uses
11417 The induction variable optimizations give up on loops that contain more
11418 induction variable uses.
11419
11420 @item iv-always-prune-cand-set-bound
11421 If the number of candidates in the set is smaller than this value,
11422 always try to remove unnecessary ivs from the set
11423 when adding a new one.
11424
11425 @item avg-loop-niter
11426 Average number of iterations of a loop.
11427
11428 @item dse-max-object-size
11429 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11430 Larger values may result in larger compilation times.
11431
11432 @item dse-max-alias-queries-per-store
11433 Maximum number of queries into the alias oracle per store.
11434 Larger values result in larger compilation times and may result in more
11435 removed dead stores.
11436
11437 @item scev-max-expr-size
11438 Bound on size of expressions used in the scalar evolutions analyzer.
11439 Large expressions slow the analyzer.
11440
11441 @item scev-max-expr-complexity
11442 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11443 Complex expressions slow the analyzer.
11444
11445 @item max-tree-if-conversion-phi-args
11446 Maximum number of arguments in a PHI supported by TREE if conversion
11447 unless the loop is marked with simd pragma.
11448
11449 @item vect-max-version-for-alignment-checks
11450 The maximum number of run-time checks that can be performed when
11451 doing loop versioning for alignment in the vectorizer.
11452
11453 @item vect-max-version-for-alias-checks
11454 The maximum number of run-time checks that can be performed when
11455 doing loop versioning for alias in the vectorizer.
11456
11457 @item vect-max-peeling-for-alignment
11458 The maximum number of loop peels to enhance access alignment
11459 for vectorizer. Value -1 means no limit.
11460
11461 @item max-iterations-to-track
11462 The maximum number of iterations of a loop the brute-force algorithm
11463 for analysis of the number of iterations of the loop tries to evaluate.
11464
11465 @item hot-bb-count-fraction
11466 The denominator n of fraction 1/n of the maximal execution count of a
11467 basic block in the entire program that a basic block needs to at least
11468 have in order to be considered hot. The default is 10000, which means
11469 that a basic block is considered hot if its execution count is greater
11470 than 1/10000 of the maximal execution count. 0 means that it is never
11471 considered hot. Used in non-LTO mode.
11472
11473 @item hot-bb-count-ws-permille
11474 The number of most executed permilles, ranging from 0 to 1000, of the
11475 profiled execution of the entire program to which the execution count
11476 of a basic block must be part of in order to be considered hot. The
11477 default is 990, which means that a basic block is considered hot if
11478 its execution count contributes to the upper 990 permilles, or 99.0%,
11479 of the profiled execution of the entire program. 0 means that it is
11480 never considered hot. Used in LTO mode.
11481
11482 @item hot-bb-frequency-fraction
11483 The denominator n of fraction 1/n of the execution frequency of the
11484 entry block of a function that a basic block of this function needs
11485 to at least have in order to be considered hot. The default is 1000,
11486 which means that a basic block is considered hot in a function if it
11487 is executed more frequently than 1/1000 of the frequency of the entry
11488 block of the function. 0 means that it is never considered hot.
11489
11490 @item unlikely-bb-count-fraction
11491 The denominator n of fraction 1/n of the number of profiled runs of
11492 the entire program below which the execution count of a basic block
11493 must be in order for the basic block to be considered unlikely executed.
11494 The default is 20, which means that a basic block is considered unlikely
11495 executed if it is executed in fewer than 1/20, or 5%, of the runs of
11496 the program. 0 means that it is always considered unlikely executed.
11497
11498 @item max-predicted-iterations
11499 The maximum number of loop iterations we predict statically. This is useful
11500 in cases where a function contains a single loop with known bound and
11501 another loop with unknown bound.
11502 The known number of iterations is predicted correctly, while
11503 the unknown number of iterations average to roughly 10. This means that the
11504 loop without bounds appears artificially cold relative to the other one.
11505
11506 @item builtin-expect-probability
11507 Control the probability of the expression having the specified value. This
11508 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11509
11510 @item builtin-string-cmp-inline-length
11511 The maximum length of a constant string for a builtin string cmp call
11512 eligible for inlining.
11513
11514 @item align-threshold
11515
11516 Select fraction of the maximal frequency of executions of a basic block in
11517 a function to align the basic block.
11518
11519 @item align-loop-iterations
11520
11521 A loop expected to iterate at least the selected number of iterations is
11522 aligned.
11523
11524 @item tracer-dynamic-coverage
11525 @itemx tracer-dynamic-coverage-feedback
11526
11527 This value is used to limit superblock formation once the given percentage of
11528 executed instructions is covered. This limits unnecessary code size
11529 expansion.
11530
11531 The @option{tracer-dynamic-coverage-feedback} parameter
11532 is used only when profile
11533 feedback is available. The real profiles (as opposed to statically estimated
11534 ones) are much less balanced allowing the threshold to be larger value.
11535
11536 @item tracer-max-code-growth
11537 Stop tail duplication once code growth has reached given percentage. This is
11538 a rather artificial limit, as most of the duplicates are eliminated later in
11539 cross jumping, so it may be set to much higher values than is the desired code
11540 growth.
11541
11542 @item tracer-min-branch-ratio
11543
11544 Stop reverse growth when the reverse probability of best edge is less than this
11545 threshold (in percent).
11546
11547 @item tracer-min-branch-probability
11548 @itemx tracer-min-branch-probability-feedback
11549
11550 Stop forward growth if the best edge has probability lower than this
11551 threshold.
11552
11553 Similarly to @option{tracer-dynamic-coverage} two parameters are
11554 provided. @option{tracer-min-branch-probability-feedback} is used for
11555 compilation with profile feedback and @option{tracer-min-branch-probability}
11556 compilation without. The value for compilation with profile feedback
11557 needs to be more conservative (higher) in order to make tracer
11558 effective.
11559
11560 @item stack-clash-protection-guard-size
11561 Specify the size of the operating system provided stack guard as
11562 2 raised to @var{num} bytes. Higher values may reduce the
11563 number of explicit probes, but a value larger than the operating system
11564 provided guard will leave code vulnerable to stack clash style attacks.
11565
11566 @item stack-clash-protection-probe-interval
11567 Stack clash protection involves probing stack space as it is allocated. This
11568 param controls the maximum distance between probes into the stack as 2 raised
11569 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11570 larger than the operating system provided guard will leave code vulnerable to
11571 stack clash style attacks.
11572
11573 @item max-cse-path-length
11574
11575 The maximum number of basic blocks on path that CSE considers.
11576
11577 @item max-cse-insns
11578 The maximum number of instructions CSE processes before flushing.
11579
11580 @item ggc-min-expand
11581
11582 GCC uses a garbage collector to manage its own memory allocation. This
11583 parameter specifies the minimum percentage by which the garbage
11584 collector's heap should be allowed to expand between collections.
11585 Tuning this may improve compilation speed; it has no effect on code
11586 generation.
11587
11588 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11589 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11590 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11591 GCC is not able to calculate RAM on a particular platform, the lower
11592 bound of 30% is used. Setting this parameter and
11593 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11594 every opportunity. This is extremely slow, but can be useful for
11595 debugging.
11596
11597 @item ggc-min-heapsize
11598
11599 Minimum size of the garbage collector's heap before it begins bothering
11600 to collect garbage. The first collection occurs after the heap expands
11601 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11602 tuning this may improve compilation speed, and has no effect on code
11603 generation.
11604
11605 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11606 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11607 with a lower bound of 4096 (four megabytes) and an upper bound of
11608 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11609 particular platform, the lower bound is used. Setting this parameter
11610 very large effectively disables garbage collection. Setting this
11611 parameter and @option{ggc-min-expand} to zero causes a full collection
11612 to occur at every opportunity.
11613
11614 @item max-reload-search-insns
11615 The maximum number of instruction reload should look backward for equivalent
11616 register. Increasing values mean more aggressive optimization, making the
11617 compilation time increase with probably slightly better performance.
11618
11619 @item max-cselib-memory-locations
11620 The maximum number of memory locations cselib should take into account.
11621 Increasing values mean more aggressive optimization, making the compilation time
11622 increase with probably slightly better performance.
11623
11624 @item max-sched-ready-insns
11625 The maximum number of instructions ready to be issued the scheduler should
11626 consider at any given time during the first scheduling pass. Increasing
11627 values mean more thorough searches, making the compilation time increase
11628 with probably little benefit.
11629
11630 @item max-sched-region-blocks
11631 The maximum number of blocks in a region to be considered for
11632 interblock scheduling.
11633
11634 @item max-pipeline-region-blocks
11635 The maximum number of blocks in a region to be considered for
11636 pipelining in the selective scheduler.
11637
11638 @item max-sched-region-insns
11639 The maximum number of insns in a region to be considered for
11640 interblock scheduling.
11641
11642 @item max-pipeline-region-insns
11643 The maximum number of insns in a region to be considered for
11644 pipelining in the selective scheduler.
11645
11646 @item min-spec-prob
11647 The minimum probability (in percents) of reaching a source block
11648 for interblock speculative scheduling.
11649
11650 @item max-sched-extend-regions-iters
11651 The maximum number of iterations through CFG to extend regions.
11652 A value of 0 disables region extensions.
11653
11654 @item max-sched-insn-conflict-delay
11655 The maximum conflict delay for an insn to be considered for speculative motion.
11656
11657 @item sched-spec-prob-cutoff
11658 The minimal probability of speculation success (in percents), so that
11659 speculative insns are scheduled.
11660
11661 @item sched-state-edge-prob-cutoff
11662 The minimum probability an edge must have for the scheduler to save its
11663 state across it.
11664
11665 @item sched-mem-true-dep-cost
11666 Minimal distance (in CPU cycles) between store and load targeting same
11667 memory locations.
11668
11669 @item selsched-max-lookahead
11670 The maximum size of the lookahead window of selective scheduling. It is a
11671 depth of search for available instructions.
11672
11673 @item selsched-max-sched-times
11674 The maximum number of times that an instruction is scheduled during
11675 selective scheduling. This is the limit on the number of iterations
11676 through which the instruction may be pipelined.
11677
11678 @item selsched-insns-to-rename
11679 The maximum number of best instructions in the ready list that are considered
11680 for renaming in the selective scheduler.
11681
11682 @item sms-min-sc
11683 The minimum value of stage count that swing modulo scheduler
11684 generates.
11685
11686 @item max-last-value-rtl
11687 The maximum size measured as number of RTLs that can be recorded in an expression
11688 in combiner for a pseudo register as last known value of that register.
11689
11690 @item max-combine-insns
11691 The maximum number of instructions the RTL combiner tries to combine.
11692
11693 @item integer-share-limit
11694 Small integer constants can use a shared data structure, reducing the
11695 compiler's memory usage and increasing its speed. This sets the maximum
11696 value of a shared integer constant.
11697
11698 @item ssp-buffer-size
11699 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11700 protection when @option{-fstack-protection} is used.
11701
11702 @item min-size-for-stack-sharing
11703 The minimum size of variables taking part in stack slot sharing when not
11704 optimizing.
11705
11706 @item max-jump-thread-duplication-stmts
11707 Maximum number of statements allowed in a block that needs to be
11708 duplicated when threading jumps.
11709
11710 @item max-fields-for-field-sensitive
11711 Maximum number of fields in a structure treated in
11712 a field sensitive manner during pointer analysis.
11713
11714 @item prefetch-latency
11715 Estimate on average number of instructions that are executed before
11716 prefetch finishes. The distance prefetched ahead is proportional
11717 to this constant. Increasing this number may also lead to less
11718 streams being prefetched (see @option{simultaneous-prefetches}).
11719
11720 @item simultaneous-prefetches
11721 Maximum number of prefetches that can run at the same time.
11722
11723 @item l1-cache-line-size
11724 The size of cache line in L1 data cache, in bytes.
11725
11726 @item l1-cache-size
11727 The size of L1 data cache, in kilobytes.
11728
11729 @item l2-cache-size
11730 The size of L2 data cache, in kilobytes.
11731
11732 @item prefetch-dynamic-strides
11733 Whether the loop array prefetch pass should issue software prefetch hints
11734 for strides that are non-constant. In some cases this may be
11735 beneficial, though the fact the stride is non-constant may make it
11736 hard to predict when there is clear benefit to issuing these hints.
11737
11738 Set to 1 if the prefetch hints should be issued for non-constant
11739 strides. Set to 0 if prefetch hints should be issued only for strides that
11740 are known to be constant and below @option{prefetch-minimum-stride}.
11741
11742 @item prefetch-minimum-stride
11743 Minimum constant stride, in bytes, to start using prefetch hints for. If
11744 the stride is less than this threshold, prefetch hints will not be issued.
11745
11746 This setting is useful for processors that have hardware prefetchers, in
11747 which case there may be conflicts between the hardware prefetchers and
11748 the software prefetchers. If the hardware prefetchers have a maximum
11749 stride they can handle, it should be used here to improve the use of
11750 software prefetchers.
11751
11752 A value of -1 means we don't have a threshold and therefore
11753 prefetch hints can be issued for any constant stride.
11754
11755 This setting is only useful for strides that are known and constant.
11756
11757 @item loop-interchange-max-num-stmts
11758 The maximum number of stmts in a loop to be interchanged.
11759
11760 @item loop-interchange-stride-ratio
11761 The minimum ratio between stride of two loops for interchange to be profitable.
11762
11763 @item min-insn-to-prefetch-ratio
11764 The minimum ratio between the number of instructions and the
11765 number of prefetches to enable prefetching in a loop.
11766
11767 @item prefetch-min-insn-to-mem-ratio
11768 The minimum ratio between the number of instructions and the
11769 number of memory references to enable prefetching in a loop.
11770
11771 @item use-canonical-types
11772 Whether the compiler should use the ``canonical'' type system.
11773 Should always be 1, which uses a more efficient internal
11774 mechanism for comparing types in C++ and Objective-C++. However, if
11775 bugs in the canonical type system are causing compilation failures,
11776 set this value to 0 to disable canonical types.
11777
11778 @item switch-conversion-max-branch-ratio
11779 Switch initialization conversion refuses to create arrays that are
11780 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11781 branches in the switch.
11782
11783 @item max-partial-antic-length
11784 Maximum length of the partial antic set computed during the tree
11785 partial redundancy elimination optimization (@option{-ftree-pre}) when
11786 optimizing at @option{-O3} and above. For some sorts of source code
11787 the enhanced partial redundancy elimination optimization can run away,
11788 consuming all of the memory available on the host machine. This
11789 parameter sets a limit on the length of the sets that are computed,
11790 which prevents the runaway behavior. Setting a value of 0 for
11791 this parameter allows an unlimited set length.
11792
11793 @item rpo-vn-max-loop-depth
11794 Maximum loop depth that is value-numbered optimistically.
11795 When the limit hits the innermost
11796 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11797 loop nest are value-numbered optimistically and the remaining ones not.
11798
11799 @item sccvn-max-alias-queries-per-access
11800 Maximum number of alias-oracle queries we perform when looking for
11801 redundancies for loads and stores. If this limit is hit the search
11802 is aborted and the load or store is not considered redundant. The
11803 number of queries is algorithmically limited to the number of
11804 stores on all paths from the load to the function entry.
11805
11806 @item ira-max-loops-num
11807 IRA uses regional register allocation by default. If a function
11808 contains more loops than the number given by this parameter, only at most
11809 the given number of the most frequently-executed loops form regions
11810 for regional register allocation.
11811
11812 @item ira-max-conflict-table-size
11813 Although IRA uses a sophisticated algorithm to compress the conflict
11814 table, the table can still require excessive amounts of memory for
11815 huge functions. If the conflict table for a function could be more
11816 than the size in MB given by this parameter, the register allocator
11817 instead uses a faster, simpler, and lower-quality
11818 algorithm that does not require building a pseudo-register conflict table.
11819
11820 @item ira-loop-reserved-regs
11821 IRA can be used to evaluate more accurate register pressure in loops
11822 for decisions to move loop invariants (see @option{-O3}). The number
11823 of available registers reserved for some other purposes is given
11824 by this parameter. Default of the parameter
11825 is the best found from numerous experiments.
11826
11827 @item lra-inheritance-ebb-probability-cutoff
11828 LRA tries to reuse values reloaded in registers in subsequent insns.
11829 This optimization is called inheritance. EBB is used as a region to
11830 do this optimization. The parameter defines a minimal fall-through
11831 edge probability in percentage used to add BB to inheritance EBB in
11832 LRA. The default value was chosen
11833 from numerous runs of SPEC2000 on x86-64.
11834
11835 @item loop-invariant-max-bbs-in-loop
11836 Loop invariant motion can be very expensive, both in compilation time and
11837 in amount of needed compile-time memory, with very large loops. Loops
11838 with more basic blocks than this parameter won't have loop invariant
11839 motion optimization performed on them.
11840
11841 @item loop-max-datarefs-for-datadeps
11842 Building data dependencies is expensive for very large loops. This
11843 parameter limits the number of data references in loops that are
11844 considered for data dependence analysis. These large loops are no
11845 handled by the optimizations using loop data dependencies.
11846
11847 @item max-vartrack-size
11848 Sets a maximum number of hash table slots to use during variable
11849 tracking dataflow analysis of any function. If this limit is exceeded
11850 with variable tracking at assignments enabled, analysis for that
11851 function is retried without it, after removing all debug insns from
11852 the function. If the limit is exceeded even without debug insns, var
11853 tracking analysis is completely disabled for the function. Setting
11854 the parameter to zero makes it unlimited.
11855
11856 @item max-vartrack-expr-depth
11857 Sets a maximum number of recursion levels when attempting to map
11858 variable names or debug temporaries to value expressions. This trades
11859 compilation time for more complete debug information. If this is set too
11860 low, value expressions that are available and could be represented in
11861 debug information may end up not being used; setting this higher may
11862 enable the compiler to find more complex debug expressions, but compile
11863 time and memory use may grow.
11864
11865 @item max-debug-marker-count
11866 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11867 markers) to avoid complexity explosion at inlining or expanding to RTL.
11868 If a function has more such gimple stmts than the set limit, such stmts
11869 will be dropped from the inlined copy of a function, and from its RTL
11870 expansion.
11871
11872 @item min-nondebug-insn-uid
11873 Use uids starting at this parameter for nondebug insns. The range below
11874 the parameter is reserved exclusively for debug insns created by
11875 @option{-fvar-tracking-assignments}, but debug insns may get
11876 (non-overlapping) uids above it if the reserved range is exhausted.
11877
11878 @item ipa-sra-ptr-growth-factor
11879 IPA-SRA replaces a pointer to an aggregate with one or more new
11880 parameters only when their cumulative size is less or equal to
11881 @option{ipa-sra-ptr-growth-factor} times the size of the original
11882 pointer parameter.
11883
11884 @item sra-max-scalarization-size-Ospeed
11885 @itemx sra-max-scalarization-size-Osize
11886 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11887 replace scalar parts of aggregates with uses of independent scalar
11888 variables. These parameters control the maximum size, in storage units,
11889 of aggregate which is considered for replacement when compiling for
11890 speed
11891 (@option{sra-max-scalarization-size-Ospeed}) or size
11892 (@option{sra-max-scalarization-size-Osize}) respectively.
11893
11894 @item tm-max-aggregate-size
11895 When making copies of thread-local variables in a transaction, this
11896 parameter specifies the size in bytes after which variables are
11897 saved with the logging functions as opposed to save/restore code
11898 sequence pairs. This option only applies when using
11899 @option{-fgnu-tm}.
11900
11901 @item graphite-max-nb-scop-params
11902 To avoid exponential effects in the Graphite loop transforms, the
11903 number of parameters in a Static Control Part (SCoP) is bounded.
11904 A value of zero can be used to lift
11905 the bound. A variable whose value is unknown at compilation time and
11906 defined outside a SCoP is a parameter of the SCoP.
11907
11908 @item loop-block-tile-size
11909 Loop blocking or strip mining transforms, enabled with
11910 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11911 loop in the loop nest by a given number of iterations. The strip
11912 length can be changed using the @option{loop-block-tile-size}
11913 parameter.
11914
11915 @item ipa-cp-value-list-size
11916 IPA-CP attempts to track all possible values and types passed to a function's
11917 parameter in order to propagate them and perform devirtualization.
11918 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11919 stores per one formal parameter of a function.
11920
11921 @item ipa-cp-eval-threshold
11922 IPA-CP calculates its own score of cloning profitability heuristics
11923 and performs those cloning opportunities with scores that exceed
11924 @option{ipa-cp-eval-threshold}.
11925
11926 @item ipa-cp-recursion-penalty
11927 Percentage penalty the recursive functions will receive when they
11928 are evaluated for cloning.
11929
11930 @item ipa-cp-single-call-penalty
11931 Percentage penalty functions containing a single call to another
11932 function will receive when they are evaluated for cloning.
11933
11934 @item ipa-max-agg-items
11935 IPA-CP is also capable to propagate a number of scalar values passed
11936 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11937 number of such values per one parameter.
11938
11939 @item ipa-cp-loop-hint-bonus
11940 When IPA-CP determines that a cloning candidate would make the number
11941 of iterations of a loop known, it adds a bonus of
11942 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11943 the candidate.
11944
11945 @item ipa-max-aa-steps
11946 During its analysis of function bodies, IPA-CP employs alias analysis
11947 in order to track values pointed to by function parameters. In order
11948 not spend too much time analyzing huge functions, it gives up and
11949 consider all memory clobbered after examining
11950 @option{ipa-max-aa-steps} statements modifying memory.
11951
11952 @item lto-partitions
11953 Specify desired number of partitions produced during WHOPR compilation.
11954 The number of partitions should exceed the number of CPUs used for compilation.
11955
11956 @item lto-min-partition
11957 Size of minimal partition for WHOPR (in estimated instructions).
11958 This prevents expenses of splitting very small programs into too many
11959 partitions.
11960
11961 @item lto-max-partition
11962 Size of max partition for WHOPR (in estimated instructions).
11963 to provide an upper bound for individual size of partition.
11964 Meant to be used only with balanced partitioning.
11965
11966 @item lto-max-streaming-parallelism
11967 Maximal number of parallel processes used for LTO streaming.
11968
11969 @item cxx-max-namespaces-for-diagnostic-help
11970 The maximum number of namespaces to consult for suggestions when C++
11971 name lookup fails for an identifier.
11972
11973 @item sink-frequency-threshold
11974 The maximum relative execution frequency (in percents) of the target block
11975 relative to a statement's original block to allow statement sinking of a
11976 statement. Larger numbers result in more aggressive statement sinking.
11977 A small positive adjustment is applied for
11978 statements with memory operands as those are even more profitable so sink.
11979
11980 @item max-stores-to-sink
11981 The maximum number of conditional store pairs that can be sunk. Set to 0
11982 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11983 (@option{-ftree-loop-if-convert}) is disabled.
11984
11985 @item allow-store-data-races
11986 Allow optimizers to introduce new data races on stores.
11987 Set to 1 to allow, otherwise to 0.
11988
11989 @item case-values-threshold
11990 The smallest number of different values for which it is best to use a
11991 jump-table instead of a tree of conditional branches. If the value is
11992 0, use the default for the machine.
11993
11994 @item jump-table-max-growth-ratio-for-size
11995 The maximum code size growth ratio when expanding
11996 into a jump table (in percent). The parameter is used when
11997 optimizing for size.
11998
11999 @item jump-table-max-growth-ratio-for-speed
12000 The maximum code size growth ratio when expanding
12001 into a jump table (in percent). The parameter is used when
12002 optimizing for speed.
12003
12004 @item tree-reassoc-width
12005 Set the maximum number of instructions executed in parallel in
12006 reassociated tree. This parameter overrides target dependent
12007 heuristics used by default if has non zero value.
12008
12009 @item sched-pressure-algorithm
12010 Choose between the two available implementations of
12011 @option{-fsched-pressure}. Algorithm 1 is the original implementation
12012 and is the more likely to prevent instructions from being reordered.
12013 Algorithm 2 was designed to be a compromise between the relatively
12014 conservative approach taken by algorithm 1 and the rather aggressive
12015 approach taken by the default scheduler. It relies more heavily on
12016 having a regular register file and accurate register pressure classes.
12017 See @file{haifa-sched.c} in the GCC sources for more details.
12018
12019 The default choice depends on the target.
12020
12021 @item max-slsr-cand-scan
12022 Set the maximum number of existing candidates that are considered when
12023 seeking a basis for a new straight-line strength reduction candidate.
12024
12025 @item asan-globals
12026 Enable buffer overflow detection for global objects. This kind
12027 of protection is enabled by default if you are using
12028 @option{-fsanitize=address} option.
12029 To disable global objects protection use @option{--param asan-globals=0}.
12030
12031 @item asan-stack
12032 Enable buffer overflow detection for stack objects. This kind of
12033 protection is enabled by default when using @option{-fsanitize=address}.
12034 To disable stack protection use @option{--param asan-stack=0} option.
12035
12036 @item asan-instrument-reads
12037 Enable buffer overflow detection for memory reads. This kind of
12038 protection is enabled by default when using @option{-fsanitize=address}.
12039 To disable memory reads protection use
12040 @option{--param asan-instrument-reads=0}.
12041
12042 @item asan-instrument-writes
12043 Enable buffer overflow detection for memory writes. This kind of
12044 protection is enabled by default when using @option{-fsanitize=address}.
12045 To disable memory writes protection use
12046 @option{--param asan-instrument-writes=0} option.
12047
12048 @item asan-memintrin
12049 Enable detection for built-in functions. This kind of protection
12050 is enabled by default when using @option{-fsanitize=address}.
12051 To disable built-in functions protection use
12052 @option{--param asan-memintrin=0}.
12053
12054 @item asan-use-after-return
12055 Enable detection of use-after-return. This kind of protection
12056 is enabled by default when using the @option{-fsanitize=address} option.
12057 To disable it use @option{--param asan-use-after-return=0}.
12058
12059 Note: By default the check is disabled at run time. To enable it,
12060 add @code{detect_stack_use_after_return=1} to the environment variable
12061 @env{ASAN_OPTIONS}.
12062
12063 @item asan-instrumentation-with-call-threshold
12064 If number of memory accesses in function being instrumented
12065 is greater or equal to this number, use callbacks instead of inline checks.
12066 E.g. to disable inline code use
12067 @option{--param asan-instrumentation-with-call-threshold=0}.
12068
12069 @item use-after-scope-direct-emission-threshold
12070 If the size of a local variable in bytes is smaller or equal to this
12071 number, directly poison (or unpoison) shadow memory instead of using
12072 run-time callbacks.
12073
12074 @item max-fsm-thread-path-insns
12075 Maximum number of instructions to copy when duplicating blocks on a
12076 finite state automaton jump thread path.
12077
12078 @item max-fsm-thread-length
12079 Maximum number of basic blocks on a finite state automaton jump thread
12080 path.
12081
12082 @item max-fsm-thread-paths
12083 Maximum number of new jump thread paths to create for a finite state
12084 automaton.
12085
12086 @item parloops-chunk-size
12087 Chunk size of omp schedule for loops parallelized by parloops.
12088
12089 @item parloops-schedule
12090 Schedule type of omp schedule for loops parallelized by parloops (static,
12091 dynamic, guided, auto, runtime).
12092
12093 @item parloops-min-per-thread
12094 The minimum number of iterations per thread of an innermost parallelized
12095 loop for which the parallelized variant is preferred over the single threaded
12096 one. Note that for a parallelized loop nest the
12097 minimum number of iterations of the outermost loop per thread is two.
12098
12099 @item max-ssa-name-query-depth
12100 Maximum depth of recursion when querying properties of SSA names in things
12101 like fold routines. One level of recursion corresponds to following a
12102 use-def chain.
12103
12104 @item hsa-gen-debug-stores
12105 Enable emission of special debug stores within HSA kernels which are
12106 then read and reported by libgomp plugin. Generation of these stores
12107 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12108 enable it.
12109
12110 @item max-speculative-devirt-maydefs
12111 The maximum number of may-defs we analyze when looking for a must-def
12112 specifying the dynamic type of an object that invokes a virtual call
12113 we may be able to devirtualize speculatively.
12114
12115 @item max-vrp-switch-assertions
12116 The maximum number of assertions to add along the default edge of a switch
12117 statement during VRP.
12118
12119 @item unroll-jam-min-percent
12120 The minimum percentage of memory references that must be optimized
12121 away for the unroll-and-jam transformation to be considered profitable.
12122
12123 @item unroll-jam-max-unroll
12124 The maximum number of times the outer loop should be unrolled by
12125 the unroll-and-jam transformation.
12126
12127 @item max-rtl-if-conversion-unpredictable-cost
12128 Maximum permissible cost for the sequence that would be generated
12129 by the RTL if-conversion pass for a branch that is considered unpredictable.
12130
12131 @item max-variable-expansions-in-unroller
12132 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12133 of times that an individual variable will be expanded during loop unrolling.
12134
12135 @item tracer-min-branch-probability-feedback
12136 Stop forward growth if the probability of best edge is less than
12137 this threshold (in percent). Used when profile feedback is available.
12138
12139 @item partial-inlining-entry-probability
12140 Maximum probability of the entry BB of split region
12141 (in percent relative to entry BB of the function)
12142 to make partial inlining happen.
12143
12144 @item max-tracked-strlens
12145 Maximum number of strings for which strlen optimization pass will
12146 track string lengths.
12147
12148 @item gcse-after-reload-partial-fraction
12149 The threshold ratio for performing partial redundancy
12150 elimination after reload.
12151
12152 @item gcse-after-reload-critical-fraction
12153 The threshold ratio of critical edges execution count that
12154 permit performing redundancy elimination after reload.
12155
12156 @item max-loop-header-insns
12157 The maximum number of insns in loop header duplicated
12158 by the copy loop headers pass.
12159
12160 @item vect-epilogues-nomask
12161 Enable loop epilogue vectorization using smaller vector size.
12162
12163 @item slp-max-insns-in-bb
12164 Maximum number of instructions in basic block to be
12165 considered for SLP vectorization.
12166
12167 @item avoid-fma-max-bits
12168 Maximum number of bits for which we avoid creating FMAs.
12169
12170 @item sms-loop-average-count-threshold
12171 A threshold on the average loop count considered by the swing modulo scheduler.
12172
12173 @item sms-dfa-history
12174 The number of cycles the swing modulo scheduler considers when checking
12175 conflicts using DFA.
12176
12177 @item max-inline-insns-recursive-auto
12178 The maximum number of instructions non-inline function
12179 can grow to via recursive inlining.
12180
12181 @item graphite-allow-codegen-errors
12182 Whether codegen errors should be ICEs when @option{-fchecking}.
12183
12184 @item sms-max-ii-factor
12185 A factor for tuning the upper bound that swing modulo scheduler
12186 uses for scheduling a loop.
12187
12188 @item lra-max-considered-reload-pseudos
12189 The max number of reload pseudos which are considered during
12190 spilling a non-reload pseudo.
12191
12192 @item max-pow-sqrt-depth
12193 Maximum depth of sqrt chains to use when synthesizing exponentiation
12194 by a real constant.
12195
12196 @item max-dse-active-local-stores
12197 Maximum number of active local stores in RTL dead store elimination.
12198
12199 @item asan-instrument-allocas
12200 Enable asan allocas/VLAs protection.
12201
12202 @item max-iterations-computation-cost
12203 Bound on the cost of an expression to compute the number of iterations.
12204
12205 @item max-isl-operations
12206 Maximum number of isl operations, 0 means unlimited.
12207
12208 @item graphite-max-arrays-per-scop
12209 Maximum number of arrays per scop.
12210
12211 @item max-vartrack-reverse-op-size
12212 Max. size of loc list for which reverse ops should be added.
12213
12214 @item tracer-dynamic-coverage-feedback
12215 The percentage of function, weighted by execution frequency,
12216 that must be covered by trace formation.
12217 Used when profile feedback is available.
12218
12219 @item max-inline-recursive-depth-auto
12220 The maximum depth of recursive inlining for non-inline functions.
12221
12222 @item fsm-scale-path-stmts
12223 Scale factor to apply to the number of statements in a threading path
12224 when comparing to the number of (scaled) blocks.
12225
12226 @item fsm-maximum-phi-arguments
12227 Maximum number of arguments a PHI may have before the FSM threader
12228 will not try to thread through its block.
12229
12230 @item uninit-control-dep-attempts
12231 Maximum number of nested calls to search for control dependencies
12232 during uninitialized variable analysis.
12233
12234 @item max-once-peeled-insns
12235 The maximum number of insns of a peeled loop that rolls only once.
12236
12237 @item sra-max-scalarization-size-Osize
12238 Maximum size, in storage units, of an aggregate
12239 which should be considered for scalarization when compiling for size.
12240
12241 @item fsm-scale-path-blocks
12242 Scale factor to apply to the number of blocks in a threading path
12243 when comparing to the number of (scaled) statements.
12244
12245 @item sched-autopref-queue-depth
12246 Hardware autoprefetcher scheduler model control flag.
12247 Number of lookahead cycles the model looks into; at '
12248 ' only enable instruction sorting heuristic.
12249
12250 @item loop-versioning-max-inner-insns
12251 The maximum number of instructions that an inner loop can have
12252 before the loop versioning pass considers it too big to copy.
12253
12254 @item loop-versioning-max-outer-insns
12255 The maximum number of instructions that an outer loop can have
12256 before the loop versioning pass considers it too big to copy,
12257 discounting any instructions in inner loops that directly benefit
12258 from versioning.
12259
12260 @item ssa-name-def-chain-limit
12261 The maximum number of SSA_NAME assignments to follow in determining
12262 a property of a variable such as its value. This limits the number
12263 of iterations or recursive calls GCC performs when optimizing certain
12264 statements or when determining their validity prior to issuing
12265 diagnostics.
12266
12267 @end table
12268 @end table
12269
12270 @node Instrumentation Options
12271 @section Program Instrumentation Options
12272 @cindex instrumentation options
12273 @cindex program instrumentation options
12274 @cindex run-time error checking options
12275 @cindex profiling options
12276 @cindex options, program instrumentation
12277 @cindex options, run-time error checking
12278 @cindex options, profiling
12279
12280 GCC supports a number of command-line options that control adding
12281 run-time instrumentation to the code it normally generates.
12282 For example, one purpose of instrumentation is collect profiling
12283 statistics for use in finding program hot spots, code coverage
12284 analysis, or profile-guided optimizations.
12285 Another class of program instrumentation is adding run-time checking
12286 to detect programming errors like invalid pointer
12287 dereferences or out-of-bounds array accesses, as well as deliberately
12288 hostile attacks such as stack smashing or C++ vtable hijacking.
12289 There is also a general hook which can be used to implement other
12290 forms of tracing or function-level instrumentation for debug or
12291 program analysis purposes.
12292
12293 @table @gcctabopt
12294 @cindex @command{prof}
12295 @cindex @command{gprof}
12296 @item -p
12297 @itemx -pg
12298 @opindex p
12299 @opindex pg
12300 Generate extra code to write profile information suitable for the
12301 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12302 (for @option{-pg}). You must use this option when compiling
12303 the source files you want data about, and you must also use it when
12304 linking.
12305
12306 You can use the function attribute @code{no_instrument_function} to
12307 suppress profiling of individual functions when compiling with these options.
12308 @xref{Common Function Attributes}.
12309
12310 @item -fprofile-arcs
12311 @opindex fprofile-arcs
12312 Add code so that program flow @dfn{arcs} are instrumented. During
12313 execution the program records how many times each branch and call is
12314 executed and how many times it is taken or returns. On targets that support
12315 constructors with priority support, profiling properly handles constructors,
12316 destructors and C++ constructors (and destructors) of classes which are used
12317 as a type of a global variable.
12318
12319 When the compiled
12320 program exits it saves this data to a file called
12321 @file{@var{auxname}.gcda} for each source file. The data may be used for
12322 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12323 test coverage analysis (@option{-ftest-coverage}). Each object file's
12324 @var{auxname} is generated from the name of the output file, if
12325 explicitly specified and it is not the final executable, otherwise it is
12326 the basename of the source file. In both cases any suffix is removed
12327 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12328 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12329 @xref{Cross-profiling}.
12330
12331 @cindex @command{gcov}
12332 @item --coverage
12333 @opindex coverage
12334
12335 This option is used to compile and link code instrumented for coverage
12336 analysis. The option is a synonym for @option{-fprofile-arcs}
12337 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12338 linking). See the documentation for those options for more details.
12339
12340 @itemize
12341
12342 @item
12343 Compile the source files with @option{-fprofile-arcs} plus optimization
12344 and code generation options. For test coverage analysis, use the
12345 additional @option{-ftest-coverage} option. You do not need to profile
12346 every source file in a program.
12347
12348 @item
12349 Compile the source files additionally with @option{-fprofile-abs-path}
12350 to create absolute path names in the @file{.gcno} files. This allows
12351 @command{gcov} to find the correct sources in projects where compilations
12352 occur with different working directories.
12353
12354 @item
12355 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12356 (the latter implies the former).
12357
12358 @item
12359 Run the program on a representative workload to generate the arc profile
12360 information. This may be repeated any number of times. You can run
12361 concurrent instances of your program, and provided that the file system
12362 supports locking, the data files will be correctly updated. Unless
12363 a strict ISO C dialect option is in effect, @code{fork} calls are
12364 detected and correctly handled without double counting.
12365
12366 @item
12367 For profile-directed optimizations, compile the source files again with
12368 the same optimization and code generation options plus
12369 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12370 Control Optimization}).
12371
12372 @item
12373 For test coverage analysis, use @command{gcov} to produce human readable
12374 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12375 @command{gcov} documentation for further information.
12376
12377 @end itemize
12378
12379 With @option{-fprofile-arcs}, for each function of your program GCC
12380 creates a program flow graph, then finds a spanning tree for the graph.
12381 Only arcs that are not on the spanning tree have to be instrumented: the
12382 compiler adds code to count the number of times that these arcs are
12383 executed. When an arc is the only exit or only entrance to a block, the
12384 instrumentation code can be added to the block; otherwise, a new basic
12385 block must be created to hold the instrumentation code.
12386
12387 @need 2000
12388 @item -ftest-coverage
12389 @opindex ftest-coverage
12390 Produce a notes file that the @command{gcov} code-coverage utility
12391 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12392 show program coverage. Each source file's note file is called
12393 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12394 above for a description of @var{auxname} and instructions on how to
12395 generate test coverage data. Coverage data matches the source files
12396 more closely if you do not optimize.
12397
12398 @item -fprofile-abs-path
12399 @opindex fprofile-abs-path
12400 Automatically convert relative source file names to absolute path names
12401 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12402 sources in projects where compilations occur with different working
12403 directories.
12404
12405 @item -fprofile-dir=@var{path}
12406 @opindex fprofile-dir
12407
12408 Set the directory to search for the profile data files in to @var{path}.
12409 This option affects only the profile data generated by
12410 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12411 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12412 and its related options. Both absolute and relative paths can be used.
12413 By default, GCC uses the current directory as @var{path}, thus the
12414 profile data file appears in the same directory as the object file.
12415 In order to prevent the file name clashing, if the object file name is
12416 not an absolute path, we mangle the absolute path of the
12417 @file{@var{sourcename}.gcda} file and use it as the file name of a
12418 @file{.gcda} file. See similar option @option{-fprofile-note}.
12419
12420 When an executable is run in a massive parallel environment, it is recommended
12421 to save profile to different folders. That can be done with variables
12422 in @var{path} that are exported during run-time:
12423
12424 @table @gcctabopt
12425
12426 @item %p
12427 process ID.
12428
12429 @item %q@{VAR@}
12430 value of environment variable @var{VAR}
12431
12432 @end table
12433
12434 @item -fprofile-generate
12435 @itemx -fprofile-generate=@var{path}
12436 @opindex fprofile-generate
12437
12438 Enable options usually used for instrumenting application to produce
12439 profile useful for later recompilation with profile feedback based
12440 optimization. You must use @option{-fprofile-generate} both when
12441 compiling and when linking your program.
12442
12443 The following options are enabled:
12444 @option{-fprofile-arcs}, @option{-fprofile-values},
12445 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12446
12447 If @var{path} is specified, GCC looks at the @var{path} to find
12448 the profile feedback data files. See @option{-fprofile-dir}.
12449
12450 To optimize the program based on the collected profile information, use
12451 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12452
12453 @item -fprofile-note=@var{path}
12454 @opindex fprofile-note
12455
12456 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
12457 location. If you combine the option with multiple source files,
12458 the @file{.gcno} file will be overwritten.
12459
12460 @item -fprofile-update=@var{method}
12461 @opindex fprofile-update
12462
12463 Alter the update method for an application instrumented for profile
12464 feedback based optimization. The @var{method} argument should be one of
12465 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12466 The first one is useful for single-threaded applications,
12467 while the second one prevents profile corruption by emitting thread-safe code.
12468
12469 @strong{Warning:} When an application does not properly join all threads
12470 (or creates an detached thread), a profile file can be still corrupted.
12471
12472 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12473 when supported by a target, or to @samp{single} otherwise. The GCC driver
12474 automatically selects @samp{prefer-atomic} when @option{-pthread}
12475 is present in the command line.
12476
12477 @item -fprofile-filter-files=@var{regex}
12478 @opindex fprofile-filter-files
12479
12480 Instrument only functions from files where names match
12481 any regular expression (separated by a semi-colon).
12482
12483 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12484 only @file{main.c} and all C files starting with 'module'.
12485
12486 @item -fprofile-exclude-files=@var{regex}
12487 @opindex fprofile-exclude-files
12488
12489 Instrument only functions from files where names do not match
12490 all the regular expressions (separated by a semi-colon).
12491
12492 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12493 of all files that are located in @file{/usr/} folder.
12494
12495 @item -fsanitize=address
12496 @opindex fsanitize=address
12497 Enable AddressSanitizer, a fast memory error detector.
12498 Memory access instructions are instrumented to detect
12499 out-of-bounds and use-after-free bugs.
12500 The option enables @option{-fsanitize-address-use-after-scope}.
12501 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12502 more details. The run-time behavior can be influenced using the
12503 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12504 the available options are shown at startup of the instrumented program. See
12505 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12506 for a list of supported options.
12507 The option cannot be combined with @option{-fsanitize=thread}.
12508
12509 @item -fsanitize=kernel-address
12510 @opindex fsanitize=kernel-address
12511 Enable AddressSanitizer for Linux kernel.
12512 See @uref{https://github.com/google/kasan/wiki} for more details.
12513
12514 @item -fsanitize=pointer-compare
12515 @opindex fsanitize=pointer-compare
12516 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12517 The option must be combined with either @option{-fsanitize=kernel-address} or
12518 @option{-fsanitize=address}
12519 The option cannot be combined with @option{-fsanitize=thread}.
12520 Note: By default the check is disabled at run time. To enable it,
12521 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12522 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12523 invalid operation only when both pointers are non-null.
12524
12525 @item -fsanitize=pointer-subtract
12526 @opindex fsanitize=pointer-subtract
12527 Instrument subtraction with pointer operands.
12528 The option must be combined with either @option{-fsanitize=kernel-address} or
12529 @option{-fsanitize=address}
12530 The option cannot be combined with @option{-fsanitize=thread}.
12531 Note: By default the check is disabled at run time. To enable it,
12532 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12533 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12534 invalid operation only when both pointers are non-null.
12535
12536 @item -fsanitize=thread
12537 @opindex fsanitize=thread
12538 Enable ThreadSanitizer, a fast data race detector.
12539 Memory access instructions are instrumented to detect
12540 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12541 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12542 environment variable; see
12543 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12544 supported options.
12545 The option cannot be combined with @option{-fsanitize=address},
12546 @option{-fsanitize=leak}.
12547
12548 Note that sanitized atomic builtins cannot throw exceptions when
12549 operating on invalid memory addresses with non-call exceptions
12550 (@option{-fnon-call-exceptions}).
12551
12552 @item -fsanitize=leak
12553 @opindex fsanitize=leak
12554 Enable LeakSanitizer, a memory leak detector.
12555 This option only matters for linking of executables and
12556 the executable is linked against a library that overrides @code{malloc}
12557 and other allocator functions. See
12558 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12559 details. The run-time behavior can be influenced using the
12560 @env{LSAN_OPTIONS} environment variable.
12561 The option cannot be combined with @option{-fsanitize=thread}.
12562
12563 @item -fsanitize=undefined
12564 @opindex fsanitize=undefined
12565 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12566 Various computations are instrumented to detect undefined behavior
12567 at runtime. Current suboptions are:
12568
12569 @table @gcctabopt
12570
12571 @item -fsanitize=shift
12572 @opindex fsanitize=shift
12573 This option enables checking that the result of a shift operation is
12574 not undefined. Note that what exactly is considered undefined differs
12575 slightly between C and C++, as well as between ISO C90 and C99, etc.
12576 This option has two suboptions, @option{-fsanitize=shift-base} and
12577 @option{-fsanitize=shift-exponent}.
12578
12579 @item -fsanitize=shift-exponent
12580 @opindex fsanitize=shift-exponent
12581 This option enables checking that the second argument of a shift operation
12582 is not negative and is smaller than the precision of the promoted first
12583 argument.
12584
12585 @item -fsanitize=shift-base
12586 @opindex fsanitize=shift-base
12587 If the second argument of a shift operation is within range, check that the
12588 result of a shift operation is not undefined. Note that what exactly is
12589 considered undefined differs slightly between C and C++, as well as between
12590 ISO C90 and C99, etc.
12591
12592 @item -fsanitize=integer-divide-by-zero
12593 @opindex fsanitize=integer-divide-by-zero
12594 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12595
12596 @item -fsanitize=unreachable
12597 @opindex fsanitize=unreachable
12598 With this option, the compiler turns the @code{__builtin_unreachable}
12599 call into a diagnostics message call instead. When reaching the
12600 @code{__builtin_unreachable} call, the behavior is undefined.
12601
12602 @item -fsanitize=vla-bound
12603 @opindex fsanitize=vla-bound
12604 This option instructs the compiler to check that the size of a variable
12605 length array is positive.
12606
12607 @item -fsanitize=null
12608 @opindex fsanitize=null
12609 This option enables pointer checking. Particularly, the application
12610 built with this option turned on will issue an error message when it
12611 tries to dereference a NULL pointer, or if a reference (possibly an
12612 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12613 on an object pointed by a NULL pointer.
12614
12615 @item -fsanitize=return
12616 @opindex fsanitize=return
12617 This option enables return statement checking. Programs
12618 built with this option turned on will issue an error message
12619 when the end of a non-void function is reached without actually
12620 returning a value. This option works in C++ only.
12621
12622 @item -fsanitize=signed-integer-overflow
12623 @opindex fsanitize=signed-integer-overflow
12624 This option enables signed integer overflow checking. We check that
12625 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12626 does not overflow in the signed arithmetics. Note, integer promotion
12627 rules must be taken into account. That is, the following is not an
12628 overflow:
12629 @smallexample
12630 signed char a = SCHAR_MAX;
12631 a++;
12632 @end smallexample
12633
12634 @item -fsanitize=bounds
12635 @opindex fsanitize=bounds
12636 This option enables instrumentation of array bounds. Various out of bounds
12637 accesses are detected. Flexible array members, flexible array member-like
12638 arrays, and initializers of variables with static storage are not instrumented.
12639
12640 @item -fsanitize=bounds-strict
12641 @opindex fsanitize=bounds-strict
12642 This option enables strict instrumentation of array bounds. Most out of bounds
12643 accesses are detected, including flexible array members and flexible array
12644 member-like arrays. Initializers of variables with static storage are not
12645 instrumented.
12646
12647 @item -fsanitize=alignment
12648 @opindex fsanitize=alignment
12649
12650 This option enables checking of alignment of pointers when they are
12651 dereferenced, or when a reference is bound to insufficiently aligned target,
12652 or when a method or constructor is invoked on insufficiently aligned object.
12653
12654 @item -fsanitize=object-size
12655 @opindex fsanitize=object-size
12656 This option enables instrumentation of memory references using the
12657 @code{__builtin_object_size} function. Various out of bounds pointer
12658 accesses are detected.
12659
12660 @item -fsanitize=float-divide-by-zero
12661 @opindex fsanitize=float-divide-by-zero
12662 Detect floating-point division by zero. Unlike other similar options,
12663 @option{-fsanitize=float-divide-by-zero} is not enabled by
12664 @option{-fsanitize=undefined}, since floating-point division by zero can
12665 be a legitimate way of obtaining infinities and NaNs.
12666
12667 @item -fsanitize=float-cast-overflow
12668 @opindex fsanitize=float-cast-overflow
12669 This option enables floating-point type to integer conversion checking.
12670 We check that the result of the conversion does not overflow.
12671 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12672 not enabled by @option{-fsanitize=undefined}.
12673 This option does not work well with @code{FE_INVALID} exceptions enabled.
12674
12675 @item -fsanitize=nonnull-attribute
12676 @opindex fsanitize=nonnull-attribute
12677
12678 This option enables instrumentation of calls, checking whether null values
12679 are not passed to arguments marked as requiring a non-null value by the
12680 @code{nonnull} function attribute.
12681
12682 @item -fsanitize=returns-nonnull-attribute
12683 @opindex fsanitize=returns-nonnull-attribute
12684
12685 This option enables instrumentation of return statements in functions
12686 marked with @code{returns_nonnull} function attribute, to detect returning
12687 of null values from such functions.
12688
12689 @item -fsanitize=bool
12690 @opindex fsanitize=bool
12691
12692 This option enables instrumentation of loads from bool. If a value other
12693 than 0/1 is loaded, a run-time error is issued.
12694
12695 @item -fsanitize=enum
12696 @opindex fsanitize=enum
12697
12698 This option enables instrumentation of loads from an enum type. If
12699 a value outside the range of values for the enum type is loaded,
12700 a run-time error is issued.
12701
12702 @item -fsanitize=vptr
12703 @opindex fsanitize=vptr
12704
12705 This option enables instrumentation of C++ member function calls, member
12706 accesses and some conversions between pointers to base and derived classes,
12707 to verify the referenced object has the correct dynamic type.
12708
12709 @item -fsanitize=pointer-overflow
12710 @opindex fsanitize=pointer-overflow
12711
12712 This option enables instrumentation of pointer arithmetics. If the pointer
12713 arithmetics overflows, a run-time error is issued.
12714
12715 @item -fsanitize=builtin
12716 @opindex fsanitize=builtin
12717
12718 This option enables instrumentation of arguments to selected builtin
12719 functions. If an invalid value is passed to such arguments, a run-time
12720 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12721 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12722 by this option.
12723
12724 @end table
12725
12726 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12727 @option{-fsanitize=undefined} gives a diagnostic message.
12728 This currently works only for the C family of languages.
12729
12730 @item -fno-sanitize=all
12731 @opindex fno-sanitize=all
12732
12733 This option disables all previously enabled sanitizers.
12734 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12735 together.
12736
12737 @item -fasan-shadow-offset=@var{number}
12738 @opindex fasan-shadow-offset
12739 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12740 It is useful for experimenting with different shadow memory layouts in
12741 Kernel AddressSanitizer.
12742
12743 @item -fsanitize-sections=@var{s1},@var{s2},...
12744 @opindex fsanitize-sections
12745 Sanitize global variables in selected user-defined sections. @var{si} may
12746 contain wildcards.
12747
12748 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12749 @opindex fsanitize-recover
12750 @opindex fno-sanitize-recover
12751 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12752 mentioned in comma-separated list of @var{opts}. Enabling this option
12753 for a sanitizer component causes it to attempt to continue
12754 running the program as if no error happened. This means multiple
12755 runtime errors can be reported in a single program run, and the exit
12756 code of the program may indicate success even when errors
12757 have been reported. The @option{-fno-sanitize-recover=} option
12758 can be used to alter
12759 this behavior: only the first detected error is reported
12760 and program then exits with a non-zero exit code.
12761
12762 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12763 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12764 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12765 @option{-fsanitize=bounds-strict},
12766 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12767 For these sanitizers error recovery is turned on by default,
12768 except @option{-fsanitize=address}, for which this feature is experimental.
12769 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12770 accepted, the former enables recovery for all sanitizers that support it,
12771 the latter disables recovery for all sanitizers that support it.
12772
12773 Even if a recovery mode is turned on the compiler side, it needs to be also
12774 enabled on the runtime library side, otherwise the failures are still fatal.
12775 The runtime library defaults to @code{halt_on_error=0} for
12776 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12777 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12778 setting the @code{halt_on_error} flag in the corresponding environment variable.
12779
12780 Syntax without an explicit @var{opts} parameter is deprecated. It is
12781 equivalent to specifying an @var{opts} list of:
12782
12783 @smallexample
12784 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12785 @end smallexample
12786
12787 @item -fsanitize-address-use-after-scope
12788 @opindex fsanitize-address-use-after-scope
12789 Enable sanitization of local variables to detect use-after-scope bugs.
12790 The option sets @option{-fstack-reuse} to @samp{none}.
12791
12792 @item -fsanitize-undefined-trap-on-error
12793 @opindex fsanitize-undefined-trap-on-error
12794 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12795 report undefined behavior using @code{__builtin_trap} rather than
12796 a @code{libubsan} library routine. The advantage of this is that the
12797 @code{libubsan} library is not needed and is not linked in, so this
12798 is usable even in freestanding environments.
12799
12800 @item -fsanitize-coverage=trace-pc
12801 @opindex fsanitize-coverage=trace-pc
12802 Enable coverage-guided fuzzing code instrumentation.
12803 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12804
12805 @item -fsanitize-coverage=trace-cmp
12806 @opindex fsanitize-coverage=trace-cmp
12807 Enable dataflow guided fuzzing code instrumentation.
12808 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12809 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12810 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12811 variable or @code{__sanitizer_cov_trace_const_cmp1},
12812 @code{__sanitizer_cov_trace_const_cmp2},
12813 @code{__sanitizer_cov_trace_const_cmp4} or
12814 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12815 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12816 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12817 @code{__sanitizer_cov_trace_switch} for switch statements.
12818
12819 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12820 @opindex fcf-protection
12821 Enable code instrumentation of control-flow transfers to increase
12822 program security by checking that target addresses of control-flow
12823 transfer instructions (such as indirect function call, function return,
12824 indirect jump) are valid. This prevents diverting the flow of control
12825 to an unexpected target. This is intended to protect against such
12826 threats as Return-oriented Programming (ROP), and similarly
12827 call/jmp-oriented programming (COP/JOP).
12828
12829 The value @code{branch} tells the compiler to implement checking of
12830 validity of control-flow transfer at the point of indirect branch
12831 instructions, i.e.@: call/jmp instructions. The value @code{return}
12832 implements checking of validity at the point of returning from a
12833 function. The value @code{full} is an alias for specifying both
12834 @code{branch} and @code{return}. The value @code{none} turns off
12835 instrumentation.
12836
12837 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12838 used. The first bit of @code{__CET__} is set to 1 for the value
12839 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12840 the @code{return}.
12841
12842 You can also use the @code{nocf_check} attribute to identify
12843 which functions and calls should be skipped from instrumentation
12844 (@pxref{Function Attributes}).
12845
12846 Currently the x86 GNU/Linux target provides an implementation based
12847 on Intel Control-flow Enforcement Technology (CET).
12848
12849 @item -fstack-protector
12850 @opindex fstack-protector
12851 Emit extra code to check for buffer overflows, such as stack smashing
12852 attacks. This is done by adding a guard variable to functions with
12853 vulnerable objects. This includes functions that call @code{alloca}, and
12854 functions with buffers larger than 8 bytes. The guards are initialized
12855 when a function is entered and then checked when the function exits.
12856 If a guard check fails, an error message is printed and the program exits.
12857
12858 @item -fstack-protector-all
12859 @opindex fstack-protector-all
12860 Like @option{-fstack-protector} except that all functions are protected.
12861
12862 @item -fstack-protector-strong
12863 @opindex fstack-protector-strong
12864 Like @option{-fstack-protector} but includes additional functions to
12865 be protected --- those that have local array definitions, or have
12866 references to local frame addresses.
12867
12868 @item -fstack-protector-explicit
12869 @opindex fstack-protector-explicit
12870 Like @option{-fstack-protector} but only protects those functions which
12871 have the @code{stack_protect} attribute.
12872
12873 @item -fstack-check
12874 @opindex fstack-check
12875 Generate code to verify that you do not go beyond the boundary of the
12876 stack. You should specify this flag if you are running in an
12877 environment with multiple threads, but you only rarely need to specify it in
12878 a single-threaded environment since stack overflow is automatically
12879 detected on nearly all systems if there is only one stack.
12880
12881 Note that this switch does not actually cause checking to be done; the
12882 operating system or the language runtime must do that. The switch causes
12883 generation of code to ensure that they see the stack being extended.
12884
12885 You can additionally specify a string parameter: @samp{no} means no
12886 checking, @samp{generic} means force the use of old-style checking,
12887 @samp{specific} means use the best checking method and is equivalent
12888 to bare @option{-fstack-check}.
12889
12890 Old-style checking is a generic mechanism that requires no specific
12891 target support in the compiler but comes with the following drawbacks:
12892
12893 @enumerate
12894 @item
12895 Modified allocation strategy for large objects: they are always
12896 allocated dynamically if their size exceeds a fixed threshold. Note this
12897 may change the semantics of some code.
12898
12899 @item
12900 Fixed limit on the size of the static frame of functions: when it is
12901 topped by a particular function, stack checking is not reliable and
12902 a warning is issued by the compiler.
12903
12904 @item
12905 Inefficiency: because of both the modified allocation strategy and the
12906 generic implementation, code performance is hampered.
12907 @end enumerate
12908
12909 Note that old-style stack checking is also the fallback method for
12910 @samp{specific} if no target support has been added in the compiler.
12911
12912 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12913 and stack overflows. @samp{specific} is an excellent choice when compiling
12914 Ada code. It is not generally sufficient to protect against stack-clash
12915 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12916
12917 @item -fstack-clash-protection
12918 @opindex fstack-clash-protection
12919 Generate code to prevent stack clash style attacks. When this option is
12920 enabled, the compiler will only allocate one page of stack space at a time
12921 and each page is accessed immediately after allocation. Thus, it prevents
12922 allocations from jumping over any stack guard page provided by the
12923 operating system.
12924
12925 Most targets do not fully support stack clash protection. However, on
12926 those targets @option{-fstack-clash-protection} will protect dynamic stack
12927 allocations. @option{-fstack-clash-protection} may also provide limited
12928 protection for static stack allocations if the target supports
12929 @option{-fstack-check=specific}.
12930
12931 @item -fstack-limit-register=@var{reg}
12932 @itemx -fstack-limit-symbol=@var{sym}
12933 @itemx -fno-stack-limit
12934 @opindex fstack-limit-register
12935 @opindex fstack-limit-symbol
12936 @opindex fno-stack-limit
12937 Generate code to ensure that the stack does not grow beyond a certain value,
12938 either the value of a register or the address of a symbol. If a larger
12939 stack is required, a signal is raised at run time. For most targets,
12940 the signal is raised before the stack overruns the boundary, so
12941 it is possible to catch the signal without taking special precautions.
12942
12943 For instance, if the stack starts at absolute address @samp{0x80000000}
12944 and grows downwards, you can use the flags
12945 @option{-fstack-limit-symbol=__stack_limit} and
12946 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12947 of 128KB@. Note that this may only work with the GNU linker.
12948
12949 You can locally override stack limit checking by using the
12950 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12951
12952 @item -fsplit-stack
12953 @opindex fsplit-stack
12954 Generate code to automatically split the stack before it overflows.
12955 The resulting program has a discontiguous stack which can only
12956 overflow if the program is unable to allocate any more memory. This
12957 is most useful when running threaded programs, as it is no longer
12958 necessary to calculate a good stack size to use for each thread. This
12959 is currently only implemented for the x86 targets running
12960 GNU/Linux.
12961
12962 When code compiled with @option{-fsplit-stack} calls code compiled
12963 without @option{-fsplit-stack}, there may not be much stack space
12964 available for the latter code to run. If compiling all code,
12965 including library code, with @option{-fsplit-stack} is not an option,
12966 then the linker can fix up these calls so that the code compiled
12967 without @option{-fsplit-stack} always has a large stack. Support for
12968 this is implemented in the gold linker in GNU binutils release 2.21
12969 and later.
12970
12971 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12972 @opindex fvtable-verify
12973 This option is only available when compiling C++ code.
12974 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12975 feature that verifies at run time, for every virtual call, that
12976 the vtable pointer through which the call is made is valid for the type of
12977 the object, and has not been corrupted or overwritten. If an invalid vtable
12978 pointer is detected at run time, an error is reported and execution of the
12979 program is immediately halted.
12980
12981 This option causes run-time data structures to be built at program startup,
12982 which are used for verifying the vtable pointers.
12983 The options @samp{std} and @samp{preinit}
12984 control the timing of when these data structures are built. In both cases the
12985 data structures are built before execution reaches @code{main}. Using
12986 @option{-fvtable-verify=std} causes the data structures to be built after
12987 shared libraries have been loaded and initialized.
12988 @option{-fvtable-verify=preinit} causes them to be built before shared
12989 libraries have been loaded and initialized.
12990
12991 If this option appears multiple times in the command line with different
12992 values specified, @samp{none} takes highest priority over both @samp{std} and
12993 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12994
12995 @item -fvtv-debug
12996 @opindex fvtv-debug
12997 When used in conjunction with @option{-fvtable-verify=std} or
12998 @option{-fvtable-verify=preinit}, causes debug versions of the
12999 runtime functions for the vtable verification feature to be called.
13000 This flag also causes the compiler to log information about which
13001 vtable pointers it finds for each class.
13002 This information is written to a file named @file{vtv_set_ptr_data.log}
13003 in the directory named by the environment variable @env{VTV_LOGS_DIR}
13004 if that is defined or the current working directory otherwise.
13005
13006 Note: This feature @emph{appends} data to the log file. If you want a fresh log
13007 file, be sure to delete any existing one.
13008
13009 @item -fvtv-counts
13010 @opindex fvtv-counts
13011 This is a debugging flag. When used in conjunction with
13012 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
13013 causes the compiler to keep track of the total number of virtual calls
13014 it encounters and the number of verifications it inserts. It also
13015 counts the number of calls to certain run-time library functions
13016 that it inserts and logs this information for each compilation unit.
13017 The compiler writes this information to a file named
13018 @file{vtv_count_data.log} in the directory named by the environment
13019 variable @env{VTV_LOGS_DIR} if that is defined or the current working
13020 directory otherwise. It also counts the size of the vtable pointer sets
13021 for each class, and writes this information to @file{vtv_class_set_sizes.log}
13022 in the same directory.
13023
13024 Note: This feature @emph{appends} data to the log files. To get fresh log
13025 files, be sure to delete any existing ones.
13026
13027 @item -finstrument-functions
13028 @opindex finstrument-functions
13029 Generate instrumentation calls for entry and exit to functions. Just
13030 after function entry and just before function exit, the following
13031 profiling functions are called with the address of the current
13032 function and its call site. (On some platforms,
13033 @code{__builtin_return_address} does not work beyond the current
13034 function, so the call site information may not be available to the
13035 profiling functions otherwise.)
13036
13037 @smallexample
13038 void __cyg_profile_func_enter (void *this_fn,
13039 void *call_site);
13040 void __cyg_profile_func_exit (void *this_fn,
13041 void *call_site);
13042 @end smallexample
13043
13044 The first argument is the address of the start of the current function,
13045 which may be looked up exactly in the symbol table.
13046
13047 This instrumentation is also done for functions expanded inline in other
13048 functions. The profiling calls indicate where, conceptually, the
13049 inline function is entered and exited. This means that addressable
13050 versions of such functions must be available. If all your uses of a
13051 function are expanded inline, this may mean an additional expansion of
13052 code size. If you use @code{extern inline} in your C code, an
13053 addressable version of such functions must be provided. (This is
13054 normally the case anyway, but if you get lucky and the optimizer always
13055 expands the functions inline, you might have gotten away without
13056 providing static copies.)
13057
13058 A function may be given the attribute @code{no_instrument_function}, in
13059 which case this instrumentation is not done. This can be used, for
13060 example, for the profiling functions listed above, high-priority
13061 interrupt routines, and any functions from which the profiling functions
13062 cannot safely be called (perhaps signal handlers, if the profiling
13063 routines generate output or allocate memory).
13064 @xref{Common Function Attributes}.
13065
13066 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13067 @opindex finstrument-functions-exclude-file-list
13068
13069 Set the list of functions that are excluded from instrumentation (see
13070 the description of @option{-finstrument-functions}). If the file that
13071 contains a function definition matches with one of @var{file}, then
13072 that function is not instrumented. The match is done on substrings:
13073 if the @var{file} parameter is a substring of the file name, it is
13074 considered to be a match.
13075
13076 For example:
13077
13078 @smallexample
13079 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13080 @end smallexample
13081
13082 @noindent
13083 excludes any inline function defined in files whose pathnames
13084 contain @file{/bits/stl} or @file{include/sys}.
13085
13086 If, for some reason, you want to include letter @samp{,} in one of
13087 @var{sym}, write @samp{\,}. For example,
13088 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13089 (note the single quote surrounding the option).
13090
13091 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13092 @opindex finstrument-functions-exclude-function-list
13093
13094 This is similar to @option{-finstrument-functions-exclude-file-list},
13095 but this option sets the list of function names to be excluded from
13096 instrumentation. The function name to be matched is its user-visible
13097 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13098 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
13099 match is done on substrings: if the @var{sym} parameter is a substring
13100 of the function name, it is considered to be a match. For C99 and C++
13101 extended identifiers, the function name must be given in UTF-8, not
13102 using universal character names.
13103
13104 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13105 @opindex fpatchable-function-entry
13106 Generate @var{N} NOPs right at the beginning
13107 of each function, with the function entry point before the @var{M}th NOP.
13108 If @var{M} is omitted, it defaults to @code{0} so the
13109 function entry points to the address just at the first NOP.
13110 The NOP instructions reserve extra space which can be used to patch in
13111 any desired instrumentation at run time, provided that the code segment
13112 is writable. The amount of space is controllable indirectly via
13113 the number of NOPs; the NOP instruction used corresponds to the instruction
13114 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13115 is target-specific and may also depend on the architecture variant and/or
13116 other compilation options.
13117
13118 For run-time identification, the starting addresses of these areas,
13119 which correspond to their respective function entries minus @var{M},
13120 are additionally collected in the @code{__patchable_function_entries}
13121 section of the resulting binary.
13122
13123 Note that the value of @code{__attribute__ ((patchable_function_entry
13124 (N,M)))} takes precedence over command-line option
13125 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13126 the area size or to remove it completely on a single function.
13127 If @code{N=0}, no pad location is recorded.
13128
13129 The NOP instructions are inserted at---and maybe before, depending on
13130 @var{M}---the function entry address, even before the prologue.
13131
13132 @end table
13133
13134
13135 @node Preprocessor Options
13136 @section Options Controlling the Preprocessor
13137 @cindex preprocessor options
13138 @cindex options, preprocessor
13139
13140 These options control the C preprocessor, which is run on each C source
13141 file before actual compilation.
13142
13143 If you use the @option{-E} option, nothing is done except preprocessing.
13144 Some of these options make sense only together with @option{-E} because
13145 they cause the preprocessor output to be unsuitable for actual
13146 compilation.
13147
13148 In addition to the options listed here, there are a number of options
13149 to control search paths for include files documented in
13150 @ref{Directory Options}.
13151 Options to control preprocessor diagnostics are listed in
13152 @ref{Warning Options}.
13153
13154 @table @gcctabopt
13155 @include cppopts.texi
13156
13157 @item -Wp,@var{option}
13158 @opindex Wp
13159 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13160 and pass @var{option} directly through to the preprocessor. If
13161 @var{option} contains commas, it is split into multiple options at the
13162 commas. However, many options are modified, translated or interpreted
13163 by the compiler driver before being passed to the preprocessor, and
13164 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13165 interface is undocumented and subject to change, so whenever possible
13166 you should avoid using @option{-Wp} and let the driver handle the
13167 options instead.
13168
13169 @item -Xpreprocessor @var{option}
13170 @opindex Xpreprocessor
13171 Pass @var{option} as an option to the preprocessor. You can use this to
13172 supply system-specific preprocessor options that GCC does not
13173 recognize.
13174
13175 If you want to pass an option that takes an argument, you must use
13176 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13177
13178 @item -no-integrated-cpp
13179 @opindex no-integrated-cpp
13180 Perform preprocessing as a separate pass before compilation.
13181 By default, GCC performs preprocessing as an integrated part of
13182 input tokenization and parsing.
13183 If this option is provided, the appropriate language front end
13184 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13185 and Objective-C, respectively) is instead invoked twice,
13186 once for preprocessing only and once for actual compilation
13187 of the preprocessed input.
13188 This option may be useful in conjunction with the @option{-B} or
13189 @option{-wrapper} options to specify an alternate preprocessor or
13190 perform additional processing of the program source between
13191 normal preprocessing and compilation.
13192
13193 @end table
13194
13195 @node Assembler Options
13196 @section Passing Options to the Assembler
13197
13198 @c prevent bad page break with this line
13199 You can pass options to the assembler.
13200
13201 @table @gcctabopt
13202 @item -Wa,@var{option}
13203 @opindex Wa
13204 Pass @var{option} as an option to the assembler. If @var{option}
13205 contains commas, it is split into multiple options at the commas.
13206
13207 @item -Xassembler @var{option}
13208 @opindex Xassembler
13209 Pass @var{option} as an option to the assembler. You can use this to
13210 supply system-specific assembler options that GCC does not
13211 recognize.
13212
13213 If you want to pass an option that takes an argument, you must use
13214 @option{-Xassembler} twice, once for the option and once for the argument.
13215
13216 @end table
13217
13218 @node Link Options
13219 @section Options for Linking
13220 @cindex link options
13221 @cindex options, linking
13222
13223 These options come into play when the compiler links object files into
13224 an executable output file. They are meaningless if the compiler is
13225 not doing a link step.
13226
13227 @table @gcctabopt
13228 @cindex file names
13229 @item @var{object-file-name}
13230 A file name that does not end in a special recognized suffix is
13231 considered to name an object file or library. (Object files are
13232 distinguished from libraries by the linker according to the file
13233 contents.) If linking is done, these object files are used as input
13234 to the linker.
13235
13236 @item -c
13237 @itemx -S
13238 @itemx -E
13239 @opindex c
13240 @opindex S
13241 @opindex E
13242 If any of these options is used, then the linker is not run, and
13243 object file names should not be used as arguments. @xref{Overall
13244 Options}.
13245
13246 @item -flinker-output=@var{type}
13247 @opindex flinker-output
13248 This option controls code generation of the link-time optimizer. By
13249 default the linker output is automatically determined by the linker
13250 plugin. For debugging the compiler and if incremental linking with a
13251 non-LTO object file is desired, it may be useful to control the type
13252 manually.
13253
13254 If @var{type} is @samp{exec}, code generation produces a static
13255 binary. In this case @option{-fpic} and @option{-fpie} are both
13256 disabled.
13257
13258 If @var{type} is @samp{dyn}, code generation produces a shared
13259 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13260 but not enabled automatically. This allows to build shared libraries
13261 without position-independent code on architectures where this is
13262 possible, i.e.@: on x86.
13263
13264 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
13265 executable. This results in similar optimizations as @samp{exec}
13266 except that @option{-fpie} is not disabled if specified at compilation
13267 time.
13268
13269 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
13270 done. The sections containing intermediate code for link-time optimization are
13271 merged, pre-optimized, and output to the resulting object file. In addition, if
13272 @option{-ffat-lto-objects} is specified, binary code is produced for future
13273 non-LTO linking. The object file produced by incremental linking is smaller
13274 than a static library produced from the same object files. At link time the
13275 result of incremental linking also loads faster than a static
13276 library assuming that the majority of objects in the library are used.
13277
13278 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13279 code generation is forced, a final binary is produced, and the intermediate
13280 code for later link-time optimization is stripped. When multiple object files
13281 are linked together the resulting code is better optimized than with
13282 link-time optimizations disabled (for example, cross-module inlining
13283 happens), but most of benefits of whole program optimizations are lost.
13284
13285 During the incremental link (by @option{-r}) the linker plugin defaults to
13286 @option{rel}. With current interfaces to GNU Binutils it is however not
13287 possible to incrementally link LTO objects and non-LTO objects into a single
13288 mixed object file. If any of object files in incremental link cannot
13289 be used for link-time optimization, the linker plugin issues a warning and
13290 uses @samp{nolto-rel}. To maintain whole program optimization, it is
13291 recommended to link such objects into static library instead. Alternatively it
13292 is possible to use H.J. Lu's binutils with support for mixed objects.
13293
13294 @item -fuse-ld=bfd
13295 @opindex fuse-ld=bfd
13296 Use the @command{bfd} linker instead of the default linker.
13297
13298 @item -fuse-ld=gold
13299 @opindex fuse-ld=gold
13300 Use the @command{gold} linker instead of the default linker.
13301
13302 @item -fuse-ld=lld
13303 @opindex fuse-ld=lld
13304 Use the LLVM @command{lld} linker instead of the default linker.
13305
13306 @cindex Libraries
13307 @item -l@var{library}
13308 @itemx -l @var{library}
13309 @opindex l
13310 Search the library named @var{library} when linking. (The second
13311 alternative with the library as a separate argument is only for
13312 POSIX compliance and is not recommended.)
13313
13314 The @option{-l} option is passed directly to the linker by GCC. Refer
13315 to your linker documentation for exact details. The general
13316 description below applies to the GNU linker.
13317
13318 The linker searches a standard list of directories for the library.
13319 The directories searched include several standard system directories
13320 plus any that you specify with @option{-L}.
13321
13322 Static libraries are archives of object files, and have file names
13323 like @file{lib@var{library}.a}. Some targets also support shared
13324 libraries, which typically have names like @file{lib@var{library}.so}.
13325 If both static and shared libraries are found, the linker gives
13326 preference to linking with the shared library unless the
13327 @option{-static} option is used.
13328
13329 It makes a difference where in the command you write this option; the
13330 linker searches and processes libraries and object files in the order they
13331 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13332 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13333 to functions in @samp{z}, those functions may not be loaded.
13334
13335 @item -lobjc
13336 @opindex lobjc
13337 You need this special case of the @option{-l} option in order to
13338 link an Objective-C or Objective-C++ program.
13339
13340 @item -nostartfiles
13341 @opindex nostartfiles
13342 Do not use the standard system startup files when linking.
13343 The standard system libraries are used normally, unless @option{-nostdlib},
13344 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13345
13346 @item -nodefaultlibs
13347 @opindex nodefaultlibs
13348 Do not use the standard system libraries when linking.
13349 Only the libraries you specify are passed to the linker, and options
13350 specifying linkage of the system libraries, such as @option{-static-libgcc}
13351 or @option{-shared-libgcc}, are ignored.
13352 The standard startup files are used normally, unless @option{-nostartfiles}
13353 is used.
13354
13355 The compiler may generate calls to @code{memcmp},
13356 @code{memset}, @code{memcpy} and @code{memmove}.
13357 These entries are usually resolved by entries in
13358 libc. These entry points should be supplied through some other
13359 mechanism when this option is specified.
13360
13361 @item -nolibc
13362 @opindex nolibc
13363 Do not use the C library or system libraries tightly coupled with it when
13364 linking. Still link with the startup files, @file{libgcc} or toolchain
13365 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13366 or @file{libstdc++} unless options preventing their inclusion are used as
13367 well. This typically removes @option{-lc} from the link command line, as well
13368 as system libraries that normally go with it and become meaningless when
13369 absence of a C library is assumed, for example @option{-lpthread} or
13370 @option{-lm} in some configurations. This is intended for bare-board
13371 targets when there is indeed no C library available.
13372
13373 @item -nostdlib
13374 @opindex nostdlib
13375 Do not use the standard system startup files or libraries when linking.
13376 No startup files and only the libraries you specify are passed to
13377 the linker, and options specifying linkage of the system libraries, such as
13378 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13379
13380 The compiler may generate calls to @code{memcmp}, @code{memset},
13381 @code{memcpy} and @code{memmove}.
13382 These entries are usually resolved by entries in
13383 libc. These entry points should be supplied through some other
13384 mechanism when this option is specified.
13385
13386 @cindex @option{-lgcc}, use with @option{-nostdlib}
13387 @cindex @option{-nostdlib} and unresolved references
13388 @cindex unresolved references and @option{-nostdlib}
13389 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13390 @cindex @option{-nodefaultlibs} and unresolved references
13391 @cindex unresolved references and @option{-nodefaultlibs}
13392 One of the standard libraries bypassed by @option{-nostdlib} and
13393 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13394 which GCC uses to overcome shortcomings of particular machines, or special
13395 needs for some languages.
13396 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13397 Collection (GCC) Internals},
13398 for more discussion of @file{libgcc.a}.)
13399 In most cases, you need @file{libgcc.a} even when you want to avoid
13400 other standard libraries. In other words, when you specify @option{-nostdlib}
13401 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13402 This ensures that you have no unresolved references to internal GCC
13403 library subroutines.
13404 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13405 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13406 GNU Compiler Collection (GCC) Internals}.)
13407
13408 @item -e @var{entry}
13409 @itemx --entry=@var{entry}
13410 @opindex e
13411 @opindex entry
13412
13413 Specify that the program entry point is @var{entry}. The argument is
13414 interpreted by the linker; the GNU linker accepts either a symbol name
13415 or an address.
13416
13417 @item -pie
13418 @opindex pie
13419 Produce a dynamically linked position independent executable on targets
13420 that support it. For predictable results, you must also specify the same
13421 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13422 or model suboptions) when you specify this linker option.
13423
13424 @item -no-pie
13425 @opindex no-pie
13426 Don't produce a dynamically linked position independent executable.
13427
13428 @item -static-pie
13429 @opindex static-pie
13430 Produce a static position independent executable on targets that support
13431 it. A static position independent executable is similar to a static
13432 executable, but can be loaded at any address without a dynamic linker.
13433 For predictable results, you must also specify the same set of options
13434 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13435 suboptions) when you specify this linker option.
13436
13437 @item -pthread
13438 @opindex pthread
13439 Link with the POSIX threads library. This option is supported on
13440 GNU/Linux targets, most other Unix derivatives, and also on
13441 x86 Cygwin and MinGW targets. On some targets this option also sets
13442 flags for the preprocessor, so it should be used consistently for both
13443 compilation and linking.
13444
13445 @item -r
13446 @opindex r
13447 Produce a relocatable object as output. This is also known as partial
13448 linking.
13449
13450 @item -rdynamic
13451 @opindex rdynamic
13452 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13453 that support it. This instructs the linker to add all symbols, not
13454 only used ones, to the dynamic symbol table. This option is needed
13455 for some uses of @code{dlopen} or to allow obtaining backtraces
13456 from within a program.
13457
13458 @item -s
13459 @opindex s
13460 Remove all symbol table and relocation information from the executable.
13461
13462 @item -static
13463 @opindex static
13464 On systems that support dynamic linking, this overrides @option{-pie}
13465 and prevents linking with the shared libraries. On other systems, this
13466 option has no effect.
13467
13468 @item -shared
13469 @opindex shared
13470 Produce a shared object which can then be linked with other objects to
13471 form an executable. Not all systems support this option. For predictable
13472 results, you must also specify the same set of options used for compilation
13473 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13474 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13475 needs to build supplementary stub code for constructors to work. On
13476 multi-libbed systems, @samp{gcc -shared} must select the correct support
13477 libraries to link against. Failing to supply the correct flags may lead
13478 to subtle defects. Supplying them in cases where they are not necessary
13479 is innocuous.}
13480
13481 @item -shared-libgcc
13482 @itemx -static-libgcc
13483 @opindex shared-libgcc
13484 @opindex static-libgcc
13485 On systems that provide @file{libgcc} as a shared library, these options
13486 force the use of either the shared or static version, respectively.
13487 If no shared version of @file{libgcc} was built when the compiler was
13488 configured, these options have no effect.
13489
13490 There are several situations in which an application should use the
13491 shared @file{libgcc} instead of the static version. The most common
13492 of these is when the application wishes to throw and catch exceptions
13493 across different shared libraries. In that case, each of the libraries
13494 as well as the application itself should use the shared @file{libgcc}.
13495
13496 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13497 whenever you build a shared library or a main executable, because C++
13498 programs typically use exceptions, so this is the right thing to do.
13499
13500 If, instead, you use the GCC driver to create shared libraries, you may
13501 find that they are not always linked with the shared @file{libgcc}.
13502 If GCC finds, at its configuration time, that you have a non-GNU linker
13503 or a GNU linker that does not support option @option{--eh-frame-hdr},
13504 it links the shared version of @file{libgcc} into shared libraries
13505 by default. Otherwise, it takes advantage of the linker and optimizes
13506 away the linking with the shared version of @file{libgcc}, linking with
13507 the static version of libgcc by default. This allows exceptions to
13508 propagate through such shared libraries, without incurring relocation
13509 costs at library load time.
13510
13511 However, if a library or main executable is supposed to throw or catch
13512 exceptions, you must link it using the G++ driver, or using the option
13513 @option{-shared-libgcc}, such that it is linked with the shared
13514 @file{libgcc}.
13515
13516 @item -static-libasan
13517 @opindex static-libasan
13518 When the @option{-fsanitize=address} option is used to link a program,
13519 the GCC driver automatically links against @option{libasan}. If
13520 @file{libasan} is available as a shared library, and the @option{-static}
13521 option is not used, then this links against the shared version of
13522 @file{libasan}. The @option{-static-libasan} option directs the GCC
13523 driver to link @file{libasan} statically, without necessarily linking
13524 other libraries statically.
13525
13526 @item -static-libtsan
13527 @opindex static-libtsan
13528 When the @option{-fsanitize=thread} option is used to link a program,
13529 the GCC driver automatically links against @option{libtsan}. If
13530 @file{libtsan} is available as a shared library, and the @option{-static}
13531 option is not used, then this links against the shared version of
13532 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13533 driver to link @file{libtsan} statically, without necessarily linking
13534 other libraries statically.
13535
13536 @item -static-liblsan
13537 @opindex static-liblsan
13538 When the @option{-fsanitize=leak} option is used to link a program,
13539 the GCC driver automatically links against @option{liblsan}. If
13540 @file{liblsan} is available as a shared library, and the @option{-static}
13541 option is not used, then this links against the shared version of
13542 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13543 driver to link @file{liblsan} statically, without necessarily linking
13544 other libraries statically.
13545
13546 @item -static-libubsan
13547 @opindex static-libubsan
13548 When the @option{-fsanitize=undefined} option is used to link a program,
13549 the GCC driver automatically links against @option{libubsan}. If
13550 @file{libubsan} is available as a shared library, and the @option{-static}
13551 option is not used, then this links against the shared version of
13552 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13553 driver to link @file{libubsan} statically, without necessarily linking
13554 other libraries statically.
13555
13556 @item -static-libstdc++
13557 @opindex static-libstdc++
13558 When the @command{g++} program is used to link a C++ program, it
13559 normally automatically links against @option{libstdc++}. If
13560 @file{libstdc++} is available as a shared library, and the
13561 @option{-static} option is not used, then this links against the
13562 shared version of @file{libstdc++}. That is normally fine. However, it
13563 is sometimes useful to freeze the version of @file{libstdc++} used by
13564 the program without going all the way to a fully static link. The
13565 @option{-static-libstdc++} option directs the @command{g++} driver to
13566 link @file{libstdc++} statically, without necessarily linking other
13567 libraries statically.
13568
13569 @item -symbolic
13570 @opindex symbolic
13571 Bind references to global symbols when building a shared object. Warn
13572 about any unresolved references (unless overridden by the link editor
13573 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13574 this option.
13575
13576 @item -T @var{script}
13577 @opindex T
13578 @cindex linker script
13579 Use @var{script} as the linker script. This option is supported by most
13580 systems using the GNU linker. On some targets, such as bare-board
13581 targets without an operating system, the @option{-T} option may be required
13582 when linking to avoid references to undefined symbols.
13583
13584 @item -Xlinker @var{option}
13585 @opindex Xlinker
13586 Pass @var{option} as an option to the linker. You can use this to
13587 supply system-specific linker options that GCC does not recognize.
13588
13589 If you want to pass an option that takes a separate argument, you must use
13590 @option{-Xlinker} twice, once for the option and once for the argument.
13591 For example, to pass @option{-assert definitions}, you must write
13592 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13593 @option{-Xlinker "-assert definitions"}, because this passes the entire
13594 string as a single argument, which is not what the linker expects.
13595
13596 When using the GNU linker, it is usually more convenient to pass
13597 arguments to linker options using the @option{@var{option}=@var{value}}
13598 syntax than as separate arguments. For example, you can specify
13599 @option{-Xlinker -Map=output.map} rather than
13600 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13601 this syntax for command-line options.
13602
13603 @item -Wl,@var{option}
13604 @opindex Wl
13605 Pass @var{option} as an option to the linker. If @var{option} contains
13606 commas, it is split into multiple options at the commas. You can use this
13607 syntax to pass an argument to the option.
13608 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13609 linker. When using the GNU linker, you can also get the same effect with
13610 @option{-Wl,-Map=output.map}.
13611
13612 @item -u @var{symbol}
13613 @opindex u
13614 Pretend the symbol @var{symbol} is undefined, to force linking of
13615 library modules to define it. You can use @option{-u} multiple times with
13616 different symbols to force loading of additional library modules.
13617
13618 @item -z @var{keyword}
13619 @opindex z
13620 @option{-z} is passed directly on to the linker along with the keyword
13621 @var{keyword}. See the section in the documentation of your linker for
13622 permitted values and their meanings.
13623 @end table
13624
13625 @node Directory Options
13626 @section Options for Directory Search
13627 @cindex directory options
13628 @cindex options, directory search
13629 @cindex search path
13630
13631 These options specify directories to search for header files, for
13632 libraries and for parts of the compiler:
13633
13634 @table @gcctabopt
13635 @include cppdiropts.texi
13636
13637 @item -iplugindir=@var{dir}
13638 @opindex iplugindir=
13639 Set the directory to search for plugins that are passed
13640 by @option{-fplugin=@var{name}} instead of
13641 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13642 to be used by the user, but only passed by the driver.
13643
13644 @item -L@var{dir}
13645 @opindex L
13646 Add directory @var{dir} to the list of directories to be searched
13647 for @option{-l}.
13648
13649 @item -B@var{prefix}
13650 @opindex B
13651 This option specifies where to find the executables, libraries,
13652 include files, and data files of the compiler itself.
13653
13654 The compiler driver program runs one or more of the subprograms
13655 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13656 @var{prefix} as a prefix for each program it tries to run, both with and
13657 without @samp{@var{machine}/@var{version}/} for the corresponding target
13658 machine and compiler version.
13659
13660 For each subprogram to be run, the compiler driver first tries the
13661 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13662 is not specified, the driver tries two standard prefixes,
13663 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13664 those results in a file name that is found, the unmodified program
13665 name is searched for using the directories specified in your
13666 @env{PATH} environment variable.
13667
13668 The compiler checks to see if the path provided by @option{-B}
13669 refers to a directory, and if necessary it adds a directory
13670 separator character at the end of the path.
13671
13672 @option{-B} prefixes that effectively specify directory names also apply
13673 to libraries in the linker, because the compiler translates these
13674 options into @option{-L} options for the linker. They also apply to
13675 include files in the preprocessor, because the compiler translates these
13676 options into @option{-isystem} options for the preprocessor. In this case,
13677 the compiler appends @samp{include} to the prefix.
13678
13679 The runtime support file @file{libgcc.a} can also be searched for using
13680 the @option{-B} prefix, if needed. If it is not found there, the two
13681 standard prefixes above are tried, and that is all. The file is left
13682 out of the link if it is not found by those means.
13683
13684 Another way to specify a prefix much like the @option{-B} prefix is to use
13685 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13686 Variables}.
13687
13688 As a special kludge, if the path provided by @option{-B} is
13689 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13690 9, then it is replaced by @file{[dir/]include}. This is to help
13691 with boot-strapping the compiler.
13692
13693 @item -no-canonical-prefixes
13694 @opindex no-canonical-prefixes
13695 Do not expand any symbolic links, resolve references to @samp{/../}
13696 or @samp{/./}, or make the path absolute when generating a relative
13697 prefix.
13698
13699 @item --sysroot=@var{dir}
13700 @opindex sysroot
13701 Use @var{dir} as the logical root directory for headers and libraries.
13702 For example, if the compiler normally searches for headers in
13703 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13704 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13705
13706 If you use both this option and the @option{-isysroot} option, then
13707 the @option{--sysroot} option applies to libraries, but the
13708 @option{-isysroot} option applies to header files.
13709
13710 The GNU linker (beginning with version 2.16) has the necessary support
13711 for this option. If your linker does not support this option, the
13712 header file aspect of @option{--sysroot} still works, but the
13713 library aspect does not.
13714
13715 @item --no-sysroot-suffix
13716 @opindex no-sysroot-suffix
13717 For some targets, a suffix is added to the root directory specified
13718 with @option{--sysroot}, depending on the other options used, so that
13719 headers may for example be found in
13720 @file{@var{dir}/@var{suffix}/usr/include} instead of
13721 @file{@var{dir}/usr/include}. This option disables the addition of
13722 such a suffix.
13723
13724 @end table
13725
13726 @node Code Gen Options
13727 @section Options for Code Generation Conventions
13728 @cindex code generation conventions
13729 @cindex options, code generation
13730 @cindex run-time options
13731
13732 These machine-independent options control the interface conventions
13733 used in code generation.
13734
13735 Most of them have both positive and negative forms; the negative form
13736 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13737 one of the forms is listed---the one that is not the default. You
13738 can figure out the other form by either removing @samp{no-} or adding
13739 it.
13740
13741 @table @gcctabopt
13742 @item -fstack-reuse=@var{reuse-level}
13743 @opindex fstack_reuse
13744 This option controls stack space reuse for user declared local/auto variables
13745 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13746 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13747 local variables and temporaries, @samp{named_vars} enables the reuse only for
13748 user defined local variables with names, and @samp{none} disables stack reuse
13749 completely. The default value is @samp{all}. The option is needed when the
13750 program extends the lifetime of a scoped local variable or a compiler generated
13751 temporary beyond the end point defined by the language. When a lifetime of
13752 a variable ends, and if the variable lives in memory, the optimizing compiler
13753 has the freedom to reuse its stack space with other temporaries or scoped
13754 local variables whose live range does not overlap with it. Legacy code extending
13755 local lifetime is likely to break with the stack reuse optimization.
13756
13757 For example,
13758
13759 @smallexample
13760 int *p;
13761 @{
13762 int local1;
13763
13764 p = &local1;
13765 local1 = 10;
13766 ....
13767 @}
13768 @{
13769 int local2;
13770 local2 = 20;
13771 ...
13772 @}
13773
13774 if (*p == 10) // out of scope use of local1
13775 @{
13776
13777 @}
13778 @end smallexample
13779
13780 Another example:
13781 @smallexample
13782
13783 struct A
13784 @{
13785 A(int k) : i(k), j(k) @{ @}
13786 int i;
13787 int j;
13788 @};
13789
13790 A *ap;
13791
13792 void foo(const A& ar)
13793 @{
13794 ap = &ar;
13795 @}
13796
13797 void bar()
13798 @{
13799 foo(A(10)); // temp object's lifetime ends when foo returns
13800
13801 @{
13802 A a(20);
13803 ....
13804 @}
13805 ap->i+= 10; // ap references out of scope temp whose space
13806 // is reused with a. What is the value of ap->i?
13807 @}
13808
13809 @end smallexample
13810
13811 The lifetime of a compiler generated temporary is well defined by the C++
13812 standard. When a lifetime of a temporary ends, and if the temporary lives
13813 in memory, the optimizing compiler has the freedom to reuse its stack
13814 space with other temporaries or scoped local variables whose live range
13815 does not overlap with it. However some of the legacy code relies on
13816 the behavior of older compilers in which temporaries' stack space is
13817 not reused, the aggressive stack reuse can lead to runtime errors. This
13818 option is used to control the temporary stack reuse optimization.
13819
13820 @item -ftrapv
13821 @opindex ftrapv
13822 This option generates traps for signed overflow on addition, subtraction,
13823 multiplication operations.
13824 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13825 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13826 @option{-fwrapv} being effective. Note that only active options override, so
13827 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13828 results in @option{-ftrapv} being effective.
13829
13830 @item -fwrapv
13831 @opindex fwrapv
13832 This option instructs the compiler to assume that signed arithmetic
13833 overflow of addition, subtraction and multiplication wraps around
13834 using twos-complement representation. This flag enables some optimizations
13835 and disables others.
13836 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13837 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13838 @option{-fwrapv} being effective. Note that only active options override, so
13839 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13840 results in @option{-ftrapv} being effective.
13841
13842 @item -fwrapv-pointer
13843 @opindex fwrapv-pointer
13844 This option instructs the compiler to assume that pointer arithmetic
13845 overflow on addition and subtraction wraps around using twos-complement
13846 representation. This flag disables some optimizations which assume
13847 pointer overflow is invalid.
13848
13849 @item -fstrict-overflow
13850 @opindex fstrict-overflow
13851 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13852 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13853
13854 @item -fexceptions
13855 @opindex fexceptions
13856 Enable exception handling. Generates extra code needed to propagate
13857 exceptions. For some targets, this implies GCC generates frame
13858 unwind information for all functions, which can produce significant data
13859 size overhead, although it does not affect execution. If you do not
13860 specify this option, GCC enables it by default for languages like
13861 C++ that normally require exception handling, and disables it for
13862 languages like C that do not normally require it. However, you may need
13863 to enable this option when compiling C code that needs to interoperate
13864 properly with exception handlers written in C++. You may also wish to
13865 disable this option if you are compiling older C++ programs that don't
13866 use exception handling.
13867
13868 @item -fnon-call-exceptions
13869 @opindex fnon-call-exceptions
13870 Generate code that allows trapping instructions to throw exceptions.
13871 Note that this requires platform-specific runtime support that does
13872 not exist everywhere. Moreover, it only allows @emph{trapping}
13873 instructions to throw exceptions, i.e.@: memory references or floating-point
13874 instructions. It does not allow exceptions to be thrown from
13875 arbitrary signal handlers such as @code{SIGALRM}.
13876
13877 @item -fdelete-dead-exceptions
13878 @opindex fdelete-dead-exceptions
13879 Consider that instructions that may throw exceptions but don't otherwise
13880 contribute to the execution of the program can be optimized away.
13881 This option is enabled by default for the Ada front end, as permitted by
13882 the Ada language specification.
13883 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13884
13885 @item -funwind-tables
13886 @opindex funwind-tables
13887 Similar to @option{-fexceptions}, except that it just generates any needed
13888 static data, but does not affect the generated code in any other way.
13889 You normally do not need to enable this option; instead, a language processor
13890 that needs this handling enables it on your behalf.
13891
13892 @item -fasynchronous-unwind-tables
13893 @opindex fasynchronous-unwind-tables
13894 Generate unwind table in DWARF format, if supported by target machine. The
13895 table is exact at each instruction boundary, so it can be used for stack
13896 unwinding from asynchronous events (such as debugger or garbage collector).
13897
13898 @item -fno-gnu-unique
13899 @opindex fno-gnu-unique
13900 @opindex fgnu-unique
13901 On systems with recent GNU assembler and C library, the C++ compiler
13902 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13903 of template static data members and static local variables in inline
13904 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13905 is necessary to avoid problems with a library used by two different
13906 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13907 therefore disagreeing with the other one about the binding of the
13908 symbol. But this causes @code{dlclose} to be ignored for affected
13909 DSOs; if your program relies on reinitialization of a DSO via
13910 @code{dlclose} and @code{dlopen}, you can use
13911 @option{-fno-gnu-unique}.
13912
13913 @item -fpcc-struct-return
13914 @opindex fpcc-struct-return
13915 Return ``short'' @code{struct} and @code{union} values in memory like
13916 longer ones, rather than in registers. This convention is less
13917 efficient, but it has the advantage of allowing intercallability between
13918 GCC-compiled files and files compiled with other compilers, particularly
13919 the Portable C Compiler (pcc).
13920
13921 The precise convention for returning structures in memory depends
13922 on the target configuration macros.
13923
13924 Short structures and unions are those whose size and alignment match
13925 that of some integer type.
13926
13927 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13928 switch is not binary compatible with code compiled with the
13929 @option{-freg-struct-return} switch.
13930 Use it to conform to a non-default application binary interface.
13931
13932 @item -freg-struct-return
13933 @opindex freg-struct-return
13934 Return @code{struct} and @code{union} values in registers when possible.
13935 This is more efficient for small structures than
13936 @option{-fpcc-struct-return}.
13937
13938 If you specify neither @option{-fpcc-struct-return} nor
13939 @option{-freg-struct-return}, GCC defaults to whichever convention is
13940 standard for the target. If there is no standard convention, GCC
13941 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13942 the principal compiler. In those cases, we can choose the standard, and
13943 we chose the more efficient register return alternative.
13944
13945 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13946 switch is not binary compatible with code compiled with the
13947 @option{-fpcc-struct-return} switch.
13948 Use it to conform to a non-default application binary interface.
13949
13950 @item -fshort-enums
13951 @opindex fshort-enums
13952 Allocate to an @code{enum} type only as many bytes as it needs for the
13953 declared range of possible values. Specifically, the @code{enum} type
13954 is equivalent to the smallest integer type that has enough room.
13955
13956 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13957 code that is not binary compatible with code generated without that switch.
13958 Use it to conform to a non-default application binary interface.
13959
13960 @item -fshort-wchar
13961 @opindex fshort-wchar
13962 Override the underlying type for @code{wchar_t} to be @code{short
13963 unsigned int} instead of the default for the target. This option is
13964 useful for building programs to run under WINE@.
13965
13966 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13967 code that is not binary compatible with code generated without that switch.
13968 Use it to conform to a non-default application binary interface.
13969
13970 @item -fno-common
13971 @opindex fno-common
13972 @opindex fcommon
13973 @cindex tentative definitions
13974 In C code, this option controls the placement of global variables
13975 defined without an initializer, known as @dfn{tentative definitions}
13976 in the C standard. Tentative definitions are distinct from declarations
13977 of a variable with the @code{extern} keyword, which do not allocate storage.
13978
13979 Unix C compilers have traditionally allocated storage for
13980 uninitialized global variables in a common block. This allows the
13981 linker to resolve all tentative definitions of the same variable
13982 in different compilation units to the same object, or to a non-tentative
13983 definition.
13984 This is the behavior specified by @option{-fcommon}, and is the default for
13985 GCC on most targets.
13986 On the other hand, this behavior is not required by ISO
13987 C, and on some targets may carry a speed or code size penalty on
13988 variable references.
13989
13990 The @option{-fno-common} option specifies that the compiler should instead
13991 place uninitialized global variables in the BSS section of the object file.
13992 This inhibits the merging of tentative definitions by the linker so
13993 you get a multiple-definition error if the same
13994 variable is defined in more than one compilation unit.
13995 Compiling with @option{-fno-common} is useful on targets for which
13996 it provides better performance, or if you wish to verify that the
13997 program will work on other systems that always treat uninitialized
13998 variable definitions this way.
13999
14000 @item -fno-ident
14001 @opindex fno-ident
14002 @opindex fident
14003 Ignore the @code{#ident} directive.
14004
14005 @item -finhibit-size-directive
14006 @opindex finhibit-size-directive
14007 Don't output a @code{.size} assembler directive, or anything else that
14008 would cause trouble if the function is split in the middle, and the
14009 two halves are placed at locations far apart in memory. This option is
14010 used when compiling @file{crtstuff.c}; you should not need to use it
14011 for anything else.
14012
14013 @item -fverbose-asm
14014 @opindex fverbose-asm
14015 Put extra commentary information in the generated assembly code to
14016 make it more readable. This option is generally only of use to those
14017 who actually need to read the generated assembly code (perhaps while
14018 debugging the compiler itself).
14019
14020 @option{-fno-verbose-asm}, the default, causes the
14021 extra information to be omitted and is useful when comparing two assembler
14022 files.
14023
14024 The added comments include:
14025
14026 @itemize @bullet
14027
14028 @item
14029 information on the compiler version and command-line options,
14030
14031 @item
14032 the source code lines associated with the assembly instructions,
14033 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14034
14035 @item
14036 hints on which high-level expressions correspond to
14037 the various assembly instruction operands.
14038
14039 @end itemize
14040
14041 For example, given this C source file:
14042
14043 @smallexample
14044 int test (int n)
14045 @{
14046 int i;
14047 int total = 0;
14048
14049 for (i = 0; i < n; i++)
14050 total += i * i;
14051
14052 return total;
14053 @}
14054 @end smallexample
14055
14056 compiling to (x86_64) assembly via @option{-S} and emitting the result
14057 direct to stdout via @option{-o} @option{-}
14058
14059 @smallexample
14060 gcc -S test.c -fverbose-asm -Os -o -
14061 @end smallexample
14062
14063 gives output similar to this:
14064
14065 @smallexample
14066 .file "test.c"
14067 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14068 [...snip...]
14069 # options passed:
14070 [...snip...]
14071
14072 .text
14073 .globl test
14074 .type test, @@function
14075 test:
14076 .LFB0:
14077 .cfi_startproc
14078 # test.c:4: int total = 0;
14079 xorl %eax, %eax # <retval>
14080 # test.c:6: for (i = 0; i < n; i++)
14081 xorl %edx, %edx # i
14082 .L2:
14083 # test.c:6: for (i = 0; i < n; i++)
14084 cmpl %edi, %edx # n, i
14085 jge .L5 #,
14086 # test.c:7: total += i * i;
14087 movl %edx, %ecx # i, tmp92
14088 imull %edx, %ecx # i, tmp92
14089 # test.c:6: for (i = 0; i < n; i++)
14090 incl %edx # i
14091 # test.c:7: total += i * i;
14092 addl %ecx, %eax # tmp92, <retval>
14093 jmp .L2 #
14094 .L5:
14095 # test.c:10: @}
14096 ret
14097 .cfi_endproc
14098 .LFE0:
14099 .size test, .-test
14100 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14101 .section .note.GNU-stack,"",@@progbits
14102 @end smallexample
14103
14104 The comments are intended for humans rather than machines and hence the
14105 precise format of the comments is subject to change.
14106
14107 @item -frecord-gcc-switches
14108 @opindex frecord-gcc-switches
14109 This switch causes the command line used to invoke the
14110 compiler to be recorded into the object file that is being created.
14111 This switch is only implemented on some targets and the exact format
14112 of the recording is target and binary file format dependent, but it
14113 usually takes the form of a section containing ASCII text. This
14114 switch is related to the @option{-fverbose-asm} switch, but that
14115 switch only records information in the assembler output file as
14116 comments, so it never reaches the object file.
14117 See also @option{-grecord-gcc-switches} for another
14118 way of storing compiler options into the object file.
14119
14120 @item -fpic
14121 @opindex fpic
14122 @cindex global offset table
14123 @cindex PIC
14124 Generate position-independent code (PIC) suitable for use in a shared
14125 library, if supported for the target machine. Such code accesses all
14126 constant addresses through a global offset table (GOT)@. The dynamic
14127 loader resolves the GOT entries when the program starts (the dynamic
14128 loader is not part of GCC; it is part of the operating system). If
14129 the GOT size for the linked executable exceeds a machine-specific
14130 maximum size, you get an error message from the linker indicating that
14131 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14132 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14133 on the m68k and RS/6000. The x86 has no such limit.)
14134
14135 Position-independent code requires special support, and therefore works
14136 only on certain machines. For the x86, GCC supports PIC for System V
14137 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14138 position-independent.
14139
14140 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14141 are defined to 1.
14142
14143 @item -fPIC
14144 @opindex fPIC
14145 If supported for the target machine, emit position-independent code,
14146 suitable for dynamic linking and avoiding any limit on the size of the
14147 global offset table. This option makes a difference on AArch64, m68k,
14148 PowerPC and SPARC@.
14149
14150 Position-independent code requires special support, and therefore works
14151 only on certain machines.
14152
14153 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14154 are defined to 2.
14155
14156 @item -fpie
14157 @itemx -fPIE
14158 @opindex fpie
14159 @opindex fPIE
14160 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14161 generated position-independent code can be only linked into executables.
14162 Usually these options are used to compile code that will be linked using
14163 the @option{-pie} GCC option.
14164
14165 @option{-fpie} and @option{-fPIE} both define the macros
14166 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14167 for @option{-fpie} and 2 for @option{-fPIE}.
14168
14169 @item -fno-plt
14170 @opindex fno-plt
14171 @opindex fplt
14172 Do not use the PLT for external function calls in position-independent code.
14173 Instead, load the callee address at call sites from the GOT and branch to it.
14174 This leads to more efficient code by eliminating PLT stubs and exposing
14175 GOT loads to optimizations. On architectures such as 32-bit x86 where
14176 PLT stubs expect the GOT pointer in a specific register, this gives more
14177 register allocation freedom to the compiler.
14178 Lazy binding requires use of the PLT;
14179 with @option{-fno-plt} all external symbols are resolved at load time.
14180
14181 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14182 through the PLT for specific external functions.
14183
14184 In position-dependent code, a few targets also convert calls to
14185 functions that are marked to not use the PLT to use the GOT instead.
14186
14187 @item -fno-jump-tables
14188 @opindex fno-jump-tables
14189 @opindex fjump-tables
14190 Do not use jump tables for switch statements even where it would be
14191 more efficient than other code generation strategies. This option is
14192 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14193 building code that forms part of a dynamic linker and cannot
14194 reference the address of a jump table. On some targets, jump tables
14195 do not require a GOT and this option is not needed.
14196
14197 @item -ffixed-@var{reg}
14198 @opindex ffixed
14199 Treat the register named @var{reg} as a fixed register; generated code
14200 should never refer to it (except perhaps as a stack pointer, frame
14201 pointer or in some other fixed role).
14202
14203 @var{reg} must be the name of a register. The register names accepted
14204 are machine-specific and are defined in the @code{REGISTER_NAMES}
14205 macro in the machine description macro file.
14206
14207 This flag does not have a negative form, because it specifies a
14208 three-way choice.
14209
14210 @item -fcall-used-@var{reg}
14211 @opindex fcall-used
14212 Treat the register named @var{reg} as an allocable register that is
14213 clobbered by function calls. It may be allocated for temporaries or
14214 variables that do not live across a call. Functions compiled this way
14215 do not save and restore the register @var{reg}.
14216
14217 It is an error to use this flag with the frame pointer or stack pointer.
14218 Use of this flag for other registers that have fixed pervasive roles in
14219 the machine's execution model produces disastrous results.
14220
14221 This flag does not have a negative form, because it specifies a
14222 three-way choice.
14223
14224 @item -fcall-saved-@var{reg}
14225 @opindex fcall-saved
14226 Treat the register named @var{reg} as an allocable register saved by
14227 functions. It may be allocated even for temporaries or variables that
14228 live across a call. Functions compiled this way save and restore
14229 the register @var{reg} if they use it.
14230
14231 It is an error to use this flag with the frame pointer or stack pointer.
14232 Use of this flag for other registers that have fixed pervasive roles in
14233 the machine's execution model produces disastrous results.
14234
14235 A different sort of disaster results from the use of this flag for
14236 a register in which function values may be returned.
14237
14238 This flag does not have a negative form, because it specifies a
14239 three-way choice.
14240
14241 @item -fpack-struct[=@var{n}]
14242 @opindex fpack-struct
14243 Without a value specified, pack all structure members together without
14244 holes. When a value is specified (which must be a small power of two), pack
14245 structure members according to this value, representing the maximum
14246 alignment (that is, objects with default alignment requirements larger than
14247 this are output potentially unaligned at the next fitting location.
14248
14249 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14250 code that is not binary compatible with code generated without that switch.
14251 Additionally, it makes the code suboptimal.
14252 Use it to conform to a non-default application binary interface.
14253
14254 @item -fleading-underscore
14255 @opindex fleading-underscore
14256 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14257 change the way C symbols are represented in the object file. One use
14258 is to help link with legacy assembly code.
14259
14260 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14261 generate code that is not binary compatible with code generated without that
14262 switch. Use it to conform to a non-default application binary interface.
14263 Not all targets provide complete support for this switch.
14264
14265 @item -ftls-model=@var{model}
14266 @opindex ftls-model
14267 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14268 The @var{model} argument should be one of @samp{global-dynamic},
14269 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14270 Note that the choice is subject to optimization: the compiler may use
14271 a more efficient model for symbols not visible outside of the translation
14272 unit, or if @option{-fpic} is not given on the command line.
14273
14274 The default without @option{-fpic} is @samp{initial-exec}; with
14275 @option{-fpic} the default is @samp{global-dynamic}.
14276
14277 @item -ftrampolines
14278 @opindex ftrampolines
14279 For targets that normally need trampolines for nested functions, always
14280 generate them instead of using descriptors. Otherwise, for targets that
14281 do not need them, like for example HP-PA or IA-64, do nothing.
14282
14283 A trampoline is a small piece of code that is created at run time on the
14284 stack when the address of a nested function is taken, and is used to call
14285 the nested function indirectly. Therefore, it requires the stack to be
14286 made executable in order for the program to work properly.
14287
14288 @option{-fno-trampolines} is enabled by default on a language by language
14289 basis to let the compiler avoid generating them, if it computes that this
14290 is safe, and replace them with descriptors. Descriptors are made up of data
14291 only, but the generated code must be prepared to deal with them. As of this
14292 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14293
14294 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14295 @option{-fno-trampolines} are not binary compatible if nested functions are
14296 present. This option must therefore be used on a program-wide basis and be
14297 manipulated with extreme care.
14298
14299 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14300 @opindex fvisibility
14301 Set the default ELF image symbol visibility to the specified option---all
14302 symbols are marked with this unless overridden within the code.
14303 Using this feature can very substantially improve linking and
14304 load times of shared object libraries, produce more optimized
14305 code, provide near-perfect API export and prevent symbol clashes.
14306 It is @strong{strongly} recommended that you use this in any shared objects
14307 you distribute.
14308
14309 Despite the nomenclature, @samp{default} always means public; i.e.,
14310 available to be linked against from outside the shared object.
14311 @samp{protected} and @samp{internal} are pretty useless in real-world
14312 usage so the only other commonly used option is @samp{hidden}.
14313 The default if @option{-fvisibility} isn't specified is
14314 @samp{default}, i.e., make every symbol public.
14315
14316 A good explanation of the benefits offered by ensuring ELF
14317 symbols have the correct visibility is given by ``How To Write
14318 Shared Libraries'' by Ulrich Drepper (which can be found at
14319 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14320 solution made possible by this option to marking things hidden when
14321 the default is public is to make the default hidden and mark things
14322 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14323 and @code{__attribute__ ((visibility("default")))} instead of
14324 @code{__declspec(dllexport)} you get almost identical semantics with
14325 identical syntax. This is a great boon to those working with
14326 cross-platform projects.
14327
14328 For those adding visibility support to existing code, you may find
14329 @code{#pragma GCC visibility} of use. This works by you enclosing
14330 the declarations you wish to set visibility for with (for example)
14331 @code{#pragma GCC visibility push(hidden)} and
14332 @code{#pragma GCC visibility pop}.
14333 Bear in mind that symbol visibility should be viewed @strong{as
14334 part of the API interface contract} and thus all new code should
14335 always specify visibility when it is not the default; i.e., declarations
14336 only for use within the local DSO should @strong{always} be marked explicitly
14337 as hidden as so to avoid PLT indirection overheads---making this
14338 abundantly clear also aids readability and self-documentation of the code.
14339 Note that due to ISO C++ specification requirements, @code{operator new} and
14340 @code{operator delete} must always be of default visibility.
14341
14342 Be aware that headers from outside your project, in particular system
14343 headers and headers from any other library you use, may not be
14344 expecting to be compiled with visibility other than the default. You
14345 may need to explicitly say @code{#pragma GCC visibility push(default)}
14346 before including any such headers.
14347
14348 @code{extern} declarations are not affected by @option{-fvisibility}, so
14349 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14350 no modifications. However, this means that calls to @code{extern}
14351 functions with no explicit visibility use the PLT, so it is more
14352 effective to use @code{__attribute ((visibility))} and/or
14353 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14354 declarations should be treated as hidden.
14355
14356 Note that @option{-fvisibility} does affect C++ vague linkage
14357 entities. This means that, for instance, an exception class that is
14358 be thrown between DSOs must be explicitly marked with default
14359 visibility so that the @samp{type_info} nodes are unified between
14360 the DSOs.
14361
14362 An overview of these techniques, their benefits and how to use them
14363 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14364
14365 @item -fstrict-volatile-bitfields
14366 @opindex fstrict-volatile-bitfields
14367 This option should be used if accesses to volatile bit-fields (or other
14368 structure fields, although the compiler usually honors those types
14369 anyway) should use a single access of the width of the
14370 field's type, aligned to a natural alignment if possible. For
14371 example, targets with memory-mapped peripheral registers might require
14372 all such accesses to be 16 bits wide; with this flag you can
14373 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14374 is 16 bits on these targets) to force GCC to use 16-bit accesses
14375 instead of, perhaps, a more efficient 32-bit access.
14376
14377 If this option is disabled, the compiler uses the most efficient
14378 instruction. In the previous example, that might be a 32-bit load
14379 instruction, even though that accesses bytes that do not contain
14380 any portion of the bit-field, or memory-mapped registers unrelated to
14381 the one being updated.
14382
14383 In some cases, such as when the @code{packed} attribute is applied to a
14384 structure field, it may not be possible to access the field with a single
14385 read or write that is correctly aligned for the target machine. In this
14386 case GCC falls back to generating multiple accesses rather than code that
14387 will fault or truncate the result at run time.
14388
14389 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14390 not allowed to touch non bit-field members. It is therefore recommended
14391 to define all bits of the field's type as bit-field members.
14392
14393 The default value of this option is determined by the application binary
14394 interface for the target processor.
14395
14396 @item -fsync-libcalls
14397 @opindex fsync-libcalls
14398 This option controls whether any out-of-line instance of the @code{__sync}
14399 family of functions may be used to implement the C++11 @code{__atomic}
14400 family of functions.
14401
14402 The default value of this option is enabled, thus the only useful form
14403 of the option is @option{-fno-sync-libcalls}. This option is used in
14404 the implementation of the @file{libatomic} runtime library.
14405
14406 @end table
14407
14408 @node Developer Options
14409 @section GCC Developer Options
14410 @cindex developer options
14411 @cindex debugging GCC
14412 @cindex debug dump options
14413 @cindex dump options
14414 @cindex compilation statistics
14415
14416 This section describes command-line options that are primarily of
14417 interest to GCC developers, including options to support compiler
14418 testing and investigation of compiler bugs and compile-time
14419 performance problems. This includes options that produce debug dumps
14420 at various points in the compilation; that print statistics such as
14421 memory use and execution time; and that print information about GCC's
14422 configuration, such as where it searches for libraries. You should
14423 rarely need to use any of these options for ordinary compilation and
14424 linking tasks.
14425
14426 Many developer options that cause GCC to dump output to a file take an
14427 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14428 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14429 error.
14430
14431 If @samp{=@var{filename}} is omitted, a default dump file name is
14432 constructed by concatenating the base dump file name, a pass number,
14433 phase letter, and pass name. The base dump file name is the name of
14434 output file produced by the compiler if explicitly specified and not
14435 an executable; otherwise it is the source file name.
14436 The pass number is determined by the order passes are registered with
14437 the compiler's pass manager.
14438 This is generally the same as the order of execution, but passes
14439 registered by plugins, target-specific passes, or passes that are
14440 otherwise registered late are numbered higher than the pass named
14441 @samp{final}, even if they are executed earlier. The phase letter is
14442 one of @samp{i} (inter-procedural analysis), @samp{l}
14443 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14444 The files are created in the directory of the output file.
14445
14446 @table @gcctabopt
14447
14448 @item -d@var{letters}
14449 @itemx -fdump-rtl-@var{pass}
14450 @itemx -fdump-rtl-@var{pass}=@var{filename}
14451 @opindex d
14452 @opindex fdump-rtl-@var{pass}
14453 Says to make debugging dumps during compilation at times specified by
14454 @var{letters}. This is used for debugging the RTL-based passes of the
14455 compiler.
14456
14457 Some @option{-d@var{letters}} switches have different meaning when
14458 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14459 for information about preprocessor-specific dump options.
14460
14461 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14462 @option{-d} option @var{letters}. Here are the possible
14463 letters for use in @var{pass} and @var{letters}, and their meanings:
14464
14465 @table @gcctabopt
14466
14467 @item -fdump-rtl-alignments
14468 @opindex fdump-rtl-alignments
14469 Dump after branch alignments have been computed.
14470
14471 @item -fdump-rtl-asmcons
14472 @opindex fdump-rtl-asmcons
14473 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14474
14475 @item -fdump-rtl-auto_inc_dec
14476 @opindex fdump-rtl-auto_inc_dec
14477 Dump after auto-inc-dec discovery. This pass is only run on
14478 architectures that have auto inc or auto dec instructions.
14479
14480 @item -fdump-rtl-barriers
14481 @opindex fdump-rtl-barriers
14482 Dump after cleaning up the barrier instructions.
14483
14484 @item -fdump-rtl-bbpart
14485 @opindex fdump-rtl-bbpart
14486 Dump after partitioning hot and cold basic blocks.
14487
14488 @item -fdump-rtl-bbro
14489 @opindex fdump-rtl-bbro
14490 Dump after block reordering.
14491
14492 @item -fdump-rtl-btl1
14493 @itemx -fdump-rtl-btl2
14494 @opindex fdump-rtl-btl2
14495 @opindex fdump-rtl-btl2
14496 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14497 after the two branch
14498 target load optimization passes.
14499
14500 @item -fdump-rtl-bypass
14501 @opindex fdump-rtl-bypass
14502 Dump after jump bypassing and control flow optimizations.
14503
14504 @item -fdump-rtl-combine
14505 @opindex fdump-rtl-combine
14506 Dump after the RTL instruction combination pass.
14507
14508 @item -fdump-rtl-compgotos
14509 @opindex fdump-rtl-compgotos
14510 Dump after duplicating the computed gotos.
14511
14512 @item -fdump-rtl-ce1
14513 @itemx -fdump-rtl-ce2
14514 @itemx -fdump-rtl-ce3
14515 @opindex fdump-rtl-ce1
14516 @opindex fdump-rtl-ce2
14517 @opindex fdump-rtl-ce3
14518 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14519 @option{-fdump-rtl-ce3} enable dumping after the three
14520 if conversion passes.
14521
14522 @item -fdump-rtl-cprop_hardreg
14523 @opindex fdump-rtl-cprop_hardreg
14524 Dump after hard register copy propagation.
14525
14526 @item -fdump-rtl-csa
14527 @opindex fdump-rtl-csa
14528 Dump after combining stack adjustments.
14529
14530 @item -fdump-rtl-cse1
14531 @itemx -fdump-rtl-cse2
14532 @opindex fdump-rtl-cse1
14533 @opindex fdump-rtl-cse2
14534 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14535 the two common subexpression elimination passes.
14536
14537 @item -fdump-rtl-dce
14538 @opindex fdump-rtl-dce
14539 Dump after the standalone dead code elimination passes.
14540
14541 @item -fdump-rtl-dbr
14542 @opindex fdump-rtl-dbr
14543 Dump after delayed branch scheduling.
14544
14545 @item -fdump-rtl-dce1
14546 @itemx -fdump-rtl-dce2
14547 @opindex fdump-rtl-dce1
14548 @opindex fdump-rtl-dce2
14549 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14550 the two dead store elimination passes.
14551
14552 @item -fdump-rtl-eh
14553 @opindex fdump-rtl-eh
14554 Dump after finalization of EH handling code.
14555
14556 @item -fdump-rtl-eh_ranges
14557 @opindex fdump-rtl-eh_ranges
14558 Dump after conversion of EH handling range regions.
14559
14560 @item -fdump-rtl-expand
14561 @opindex fdump-rtl-expand
14562 Dump after RTL generation.
14563
14564 @item -fdump-rtl-fwprop1
14565 @itemx -fdump-rtl-fwprop2
14566 @opindex fdump-rtl-fwprop1
14567 @opindex fdump-rtl-fwprop2
14568 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14569 dumping after the two forward propagation passes.
14570
14571 @item -fdump-rtl-gcse1
14572 @itemx -fdump-rtl-gcse2
14573 @opindex fdump-rtl-gcse1
14574 @opindex fdump-rtl-gcse2
14575 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14576 after global common subexpression elimination.
14577
14578 @item -fdump-rtl-init-regs
14579 @opindex fdump-rtl-init-regs
14580 Dump after the initialization of the registers.
14581
14582 @item -fdump-rtl-initvals
14583 @opindex fdump-rtl-initvals
14584 Dump after the computation of the initial value sets.
14585
14586 @item -fdump-rtl-into_cfglayout
14587 @opindex fdump-rtl-into_cfglayout
14588 Dump after converting to cfglayout mode.
14589
14590 @item -fdump-rtl-ira
14591 @opindex fdump-rtl-ira
14592 Dump after iterated register allocation.
14593
14594 @item -fdump-rtl-jump
14595 @opindex fdump-rtl-jump
14596 Dump after the second jump optimization.
14597
14598 @item -fdump-rtl-loop2
14599 @opindex fdump-rtl-loop2
14600 @option{-fdump-rtl-loop2} enables dumping after the rtl
14601 loop optimization passes.
14602
14603 @item -fdump-rtl-mach
14604 @opindex fdump-rtl-mach
14605 Dump after performing the machine dependent reorganization pass, if that
14606 pass exists.
14607
14608 @item -fdump-rtl-mode_sw
14609 @opindex fdump-rtl-mode_sw
14610 Dump after removing redundant mode switches.
14611
14612 @item -fdump-rtl-rnreg
14613 @opindex fdump-rtl-rnreg
14614 Dump after register renumbering.
14615
14616 @item -fdump-rtl-outof_cfglayout
14617 @opindex fdump-rtl-outof_cfglayout
14618 Dump after converting from cfglayout mode.
14619
14620 @item -fdump-rtl-peephole2
14621 @opindex fdump-rtl-peephole2
14622 Dump after the peephole pass.
14623
14624 @item -fdump-rtl-postreload
14625 @opindex fdump-rtl-postreload
14626 Dump after post-reload optimizations.
14627
14628 @item -fdump-rtl-pro_and_epilogue
14629 @opindex fdump-rtl-pro_and_epilogue
14630 Dump after generating the function prologues and epilogues.
14631
14632 @item -fdump-rtl-sched1
14633 @itemx -fdump-rtl-sched2
14634 @opindex fdump-rtl-sched1
14635 @opindex fdump-rtl-sched2
14636 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14637 after the basic block scheduling passes.
14638
14639 @item -fdump-rtl-ree
14640 @opindex fdump-rtl-ree
14641 Dump after sign/zero extension elimination.
14642
14643 @item -fdump-rtl-seqabstr
14644 @opindex fdump-rtl-seqabstr
14645 Dump after common sequence discovery.
14646
14647 @item -fdump-rtl-shorten
14648 @opindex fdump-rtl-shorten
14649 Dump after shortening branches.
14650
14651 @item -fdump-rtl-sibling
14652 @opindex fdump-rtl-sibling
14653 Dump after sibling call optimizations.
14654
14655 @item -fdump-rtl-split1
14656 @itemx -fdump-rtl-split2
14657 @itemx -fdump-rtl-split3
14658 @itemx -fdump-rtl-split4
14659 @itemx -fdump-rtl-split5
14660 @opindex fdump-rtl-split1
14661 @opindex fdump-rtl-split2
14662 @opindex fdump-rtl-split3
14663 @opindex fdump-rtl-split4
14664 @opindex fdump-rtl-split5
14665 These options enable dumping after five rounds of
14666 instruction splitting.
14667
14668 @item -fdump-rtl-sms
14669 @opindex fdump-rtl-sms
14670 Dump after modulo scheduling. This pass is only run on some
14671 architectures.
14672
14673 @item -fdump-rtl-stack
14674 @opindex fdump-rtl-stack
14675 Dump after conversion from GCC's ``flat register file'' registers to the
14676 x87's stack-like registers. This pass is only run on x86 variants.
14677
14678 @item -fdump-rtl-subreg1
14679 @itemx -fdump-rtl-subreg2
14680 @opindex fdump-rtl-subreg1
14681 @opindex fdump-rtl-subreg2
14682 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14683 the two subreg expansion passes.
14684
14685 @item -fdump-rtl-unshare
14686 @opindex fdump-rtl-unshare
14687 Dump after all rtl has been unshared.
14688
14689 @item -fdump-rtl-vartrack
14690 @opindex fdump-rtl-vartrack
14691 Dump after variable tracking.
14692
14693 @item -fdump-rtl-vregs
14694 @opindex fdump-rtl-vregs
14695 Dump after converting virtual registers to hard registers.
14696
14697 @item -fdump-rtl-web
14698 @opindex fdump-rtl-web
14699 Dump after live range splitting.
14700
14701 @item -fdump-rtl-regclass
14702 @itemx -fdump-rtl-subregs_of_mode_init
14703 @itemx -fdump-rtl-subregs_of_mode_finish
14704 @itemx -fdump-rtl-dfinit
14705 @itemx -fdump-rtl-dfinish
14706 @opindex fdump-rtl-regclass
14707 @opindex fdump-rtl-subregs_of_mode_init
14708 @opindex fdump-rtl-subregs_of_mode_finish
14709 @opindex fdump-rtl-dfinit
14710 @opindex fdump-rtl-dfinish
14711 These dumps are defined but always produce empty files.
14712
14713 @item -da
14714 @itemx -fdump-rtl-all
14715 @opindex da
14716 @opindex fdump-rtl-all
14717 Produce all the dumps listed above.
14718
14719 @item -dA
14720 @opindex dA
14721 Annotate the assembler output with miscellaneous debugging information.
14722
14723 @item -dD
14724 @opindex dD
14725 Dump all macro definitions, at the end of preprocessing, in addition to
14726 normal output.
14727
14728 @item -dH
14729 @opindex dH
14730 Produce a core dump whenever an error occurs.
14731
14732 @item -dp
14733 @opindex dp
14734 Annotate the assembler output with a comment indicating which
14735 pattern and alternative is used. The length and cost of each instruction are
14736 also printed.
14737
14738 @item -dP
14739 @opindex dP
14740 Dump the RTL in the assembler output as a comment before each instruction.
14741 Also turns on @option{-dp} annotation.
14742
14743 @item -dx
14744 @opindex dx
14745 Just generate RTL for a function instead of compiling it. Usually used
14746 with @option{-fdump-rtl-expand}.
14747 @end table
14748
14749 @item -fdump-debug
14750 @opindex fdump-debug
14751 Dump debugging information generated during the debug
14752 generation phase.
14753
14754 @item -fdump-earlydebug
14755 @opindex fdump-earlydebug
14756 Dump debugging information generated during the early debug
14757 generation phase.
14758
14759 @item -fdump-noaddr
14760 @opindex fdump-noaddr
14761 When doing debugging dumps, suppress address output. This makes it more
14762 feasible to use diff on debugging dumps for compiler invocations with
14763 different compiler binaries and/or different
14764 text / bss / data / heap / stack / dso start locations.
14765
14766 @item -freport-bug
14767 @opindex freport-bug
14768 Collect and dump debug information into a temporary file if an
14769 internal compiler error (ICE) occurs.
14770
14771 @item -fdump-unnumbered
14772 @opindex fdump-unnumbered
14773 When doing debugging dumps, suppress instruction numbers and address output.
14774 This makes it more feasible to use diff on debugging dumps for compiler
14775 invocations with different options, in particular with and without
14776 @option{-g}.
14777
14778 @item -fdump-unnumbered-links
14779 @opindex fdump-unnumbered-links
14780 When doing debugging dumps (see @option{-d} option above), suppress
14781 instruction numbers for the links to the previous and next instructions
14782 in a sequence.
14783
14784 @item -fdump-ipa-@var{switch}
14785 @itemx -fdump-ipa-@var{switch}-@var{options}
14786 @opindex fdump-ipa
14787 Control the dumping at various stages of inter-procedural analysis
14788 language tree to a file. The file name is generated by appending a
14789 switch specific suffix to the source file name, and the file is created
14790 in the same directory as the output file. The following dumps are
14791 possible:
14792
14793 @table @samp
14794 @item all
14795 Enables all inter-procedural analysis dumps.
14796
14797 @item cgraph
14798 Dumps information about call-graph optimization, unused function removal,
14799 and inlining decisions.
14800
14801 @item inline
14802 Dump after function inlining.
14803
14804 @end table
14805
14806 Additionally, the options @option{-optimized}, @option{-missed},
14807 @option{-note}, and @option{-all} can be provided, with the same meaning
14808 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14809
14810 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14811 information on callsites that were inlined, along with callsites
14812 that were not inlined.
14813
14814 By default, the dump will contain messages about successful
14815 optimizations (equivalent to @option{-optimized}) together with
14816 low-level details about the analysis.
14817
14818 @item -fdump-lang-all
14819 @itemx -fdump-lang-@var{switch}
14820 @itemx -fdump-lang-@var{switch}-@var{options}
14821 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14822 @opindex fdump-lang-all
14823 @opindex fdump-lang
14824 Control the dumping of language-specific information. The @var{options}
14825 and @var{filename} portions behave as described in the
14826 @option{-fdump-tree} option. The following @var{switch} values are
14827 accepted:
14828
14829 @table @samp
14830 @item all
14831
14832 Enable all language-specific dumps.
14833
14834 @item class
14835 Dump class hierarchy information. Virtual table information is emitted
14836 unless '@option{slim}' is specified. This option is applicable to C++ only.
14837
14838 @item raw
14839 Dump the raw internal tree data. This option is applicable to C++ only.
14840
14841 @end table
14842
14843 @item -fdump-passes
14844 @opindex fdump-passes
14845 Print on @file{stderr} the list of optimization passes that are turned
14846 on and off by the current command-line options.
14847
14848 @item -fdump-statistics-@var{option}
14849 @opindex fdump-statistics
14850 Enable and control dumping of pass statistics in a separate file. The
14851 file name is generated by appending a suffix ending in
14852 @samp{.statistics} to the source file name, and the file is created in
14853 the same directory as the output file. If the @samp{-@var{option}}
14854 form is used, @samp{-stats} causes counters to be summed over the
14855 whole compilation unit while @samp{-details} dumps every event as
14856 the passes generate them. The default with no option is to sum
14857 counters for each function compiled.
14858
14859 @item -fdump-tree-all
14860 @itemx -fdump-tree-@var{switch}
14861 @itemx -fdump-tree-@var{switch}-@var{options}
14862 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14863 @opindex fdump-tree-all
14864 @opindex fdump-tree
14865 Control the dumping at various stages of processing the intermediate
14866 language tree to a file. If the @samp{-@var{options}}
14867 form is used, @var{options} is a list of @samp{-} separated options
14868 which control the details of the dump. Not all options are applicable
14869 to all dumps; those that are not meaningful are ignored. The
14870 following options are available
14871
14872 @table @samp
14873 @item address
14874 Print the address of each node. Usually this is not meaningful as it
14875 changes according to the environment and source file. Its primary use
14876 is for tying up a dump file with a debug environment.
14877 @item asmname
14878 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14879 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14880 use working backward from mangled names in the assembly file.
14881 @item slim
14882 When dumping front-end intermediate representations, inhibit dumping
14883 of members of a scope or body of a function merely because that scope
14884 has been reached. Only dump such items when they are directly reachable
14885 by some other path.
14886
14887 When dumping pretty-printed trees, this option inhibits dumping the
14888 bodies of control structures.
14889
14890 When dumping RTL, print the RTL in slim (condensed) form instead of
14891 the default LISP-like representation.
14892 @item raw
14893 Print a raw representation of the tree. By default, trees are
14894 pretty-printed into a C-like representation.
14895 @item details
14896 Enable more detailed dumps (not honored by every dump option). Also
14897 include information from the optimization passes.
14898 @item stats
14899 Enable dumping various statistics about the pass (not honored by every dump
14900 option).
14901 @item blocks
14902 Enable showing basic block boundaries (disabled in raw dumps).
14903 @item graph
14904 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14905 dump a representation of the control flow graph suitable for viewing with
14906 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14907 the file is pretty-printed as a subgraph, so that GraphViz can render them
14908 all in a single plot.
14909
14910 This option currently only works for RTL dumps, and the RTL is always
14911 dumped in slim form.
14912 @item vops
14913 Enable showing virtual operands for every statement.
14914 @item lineno
14915 Enable showing line numbers for statements.
14916 @item uid
14917 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14918 @item verbose
14919 Enable showing the tree dump for each statement.
14920 @item eh
14921 Enable showing the EH region number holding each statement.
14922 @item scev
14923 Enable showing scalar evolution analysis details.
14924 @item optimized
14925 Enable showing optimization information (only available in certain
14926 passes).
14927 @item missed
14928 Enable showing missed optimization information (only available in certain
14929 passes).
14930 @item note
14931 Enable other detailed optimization information (only available in
14932 certain passes).
14933 @item all
14934 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14935 and @option{lineno}.
14936 @item optall
14937 Turn on all optimization options, i.e., @option{optimized},
14938 @option{missed}, and @option{note}.
14939 @end table
14940
14941 To determine what tree dumps are available or find the dump for a pass
14942 of interest follow the steps below.
14943
14944 @enumerate
14945 @item
14946 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14947 look for a code that corresponds to the pass you are interested in.
14948 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14949 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14950 The number at the end distinguishes distinct invocations of the same pass.
14951 @item
14952 To enable the creation of the dump file, append the pass code to
14953 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14954 to enable the dump from the Early Value Range Propagation pass, invoke
14955 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14956 specify the name of the dump file. If you don't specify one, GCC
14957 creates as described below.
14958 @item
14959 Find the pass dump in a file whose name is composed of three components
14960 separated by a period: the name of the source file GCC was invoked to
14961 compile, a numeric suffix indicating the pass number followed by the
14962 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14963 and finally the pass code. For example, the Early VRP pass dump might
14964 be in a file named @file{myfile.c.038t.evrp} in the current working
14965 directory. Note that the numeric codes are not stable and may change
14966 from one version of GCC to another.
14967 @end enumerate
14968
14969 @item -fopt-info
14970 @itemx -fopt-info-@var{options}
14971 @itemx -fopt-info-@var{options}=@var{filename}
14972 @opindex fopt-info
14973 Controls optimization dumps from various optimization passes. If the
14974 @samp{-@var{options}} form is used, @var{options} is a list of
14975 @samp{-} separated option keywords to select the dump details and
14976 optimizations.
14977
14978 The @var{options} can be divided into three groups:
14979 @enumerate
14980 @item
14981 options describing what kinds of messages should be emitted,
14982 @item
14983 options describing the verbosity of the dump, and
14984 @item
14985 options describing which optimizations should be included.
14986 @end enumerate
14987 The options from each group can be freely mixed as they are
14988 non-overlapping. However, in case of any conflicts,
14989 the later options override the earlier options on the command
14990 line.
14991
14992 The following options control which kinds of messages should be emitted:
14993
14994 @table @samp
14995 @item optimized
14996 Print information when an optimization is successfully applied. It is
14997 up to a pass to decide which information is relevant. For example, the
14998 vectorizer passes print the source location of loops which are
14999 successfully vectorized.
15000 @item missed
15001 Print information about missed optimizations. Individual passes
15002 control which information to include in the output.
15003 @item note
15004 Print verbose information about optimizations, such as certain
15005 transformations, more detailed messages about decisions etc.
15006 @item all
15007 Print detailed optimization information. This includes
15008 @samp{optimized}, @samp{missed}, and @samp{note}.
15009 @end table
15010
15011 The following option controls the dump verbosity:
15012
15013 @table @samp
15014 @item internals
15015 By default, only ``high-level'' messages are emitted. This option enables
15016 additional, more detailed, messages, which are likely to only be of interest
15017 to GCC developers.
15018 @end table
15019
15020 One or more of the following option keywords can be used to describe a
15021 group of optimizations:
15022
15023 @table @samp
15024 @item ipa
15025 Enable dumps from all interprocedural optimizations.
15026 @item loop
15027 Enable dumps from all loop optimizations.
15028 @item inline
15029 Enable dumps from all inlining optimizations.
15030 @item omp
15031 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
15032 @item vec
15033 Enable dumps from all vectorization optimizations.
15034 @item optall
15035 Enable dumps from all optimizations. This is a superset of
15036 the optimization groups listed above.
15037 @end table
15038
15039 If @var{options} is
15040 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
15041 about successful optimizations from all the passes, omitting messages
15042 that are treated as ``internals''.
15043
15044 If the @var{filename} is provided, then the dumps from all the
15045 applicable optimizations are concatenated into the @var{filename}.
15046 Otherwise the dump is output onto @file{stderr}. Though multiple
15047 @option{-fopt-info} options are accepted, only one of them can include
15048 a @var{filename}. If other filenames are provided then all but the
15049 first such option are ignored.
15050
15051 Note that the output @var{filename} is overwritten
15052 in case of multiple translation units. If a combined output from
15053 multiple translation units is desired, @file{stderr} should be used
15054 instead.
15055
15056 In the following example, the optimization info is output to
15057 @file{stderr}:
15058
15059 @smallexample
15060 gcc -O3 -fopt-info
15061 @end smallexample
15062
15063 This example:
15064 @smallexample
15065 gcc -O3 -fopt-info-missed=missed.all
15066 @end smallexample
15067
15068 @noindent
15069 outputs missed optimization report from all the passes into
15070 @file{missed.all}, and this one:
15071
15072 @smallexample
15073 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15074 @end smallexample
15075
15076 @noindent
15077 prints information about missed optimization opportunities from
15078 vectorization passes on @file{stderr}.
15079 Note that @option{-fopt-info-vec-missed} is equivalent to
15080 @option{-fopt-info-missed-vec}. The order of the optimization group
15081 names and message types listed after @option{-fopt-info} does not matter.
15082
15083 As another example,
15084 @smallexample
15085 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15086 @end smallexample
15087
15088 @noindent
15089 outputs information about missed optimizations as well as
15090 optimized locations from all the inlining passes into
15091 @file{inline.txt}.
15092
15093 Finally, consider:
15094
15095 @smallexample
15096 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15097 @end smallexample
15098
15099 @noindent
15100 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15101 in conflict since only one output file is allowed. In this case, only
15102 the first option takes effect and the subsequent options are
15103 ignored. Thus only @file{vec.miss} is produced which contains
15104 dumps from the vectorizer about missed opportunities.
15105
15106 @item -fsave-optimization-record
15107 @opindex fsave-optimization-record
15108 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15109 were performed, for those optimizations that support @option{-fopt-info}.
15110
15111 This option is experimental and the format of the data within the
15112 compressed JSON file is subject to change.
15113
15114 It is roughly equivalent to a machine-readable version of
15115 @option{-fopt-info-all}, as a collection of messages with source file,
15116 line number and column number, with the following additional data for
15117 each message:
15118
15119 @itemize @bullet
15120
15121 @item
15122 the execution count of the code being optimized, along with metadata about
15123 whether this was from actual profile data, or just an estimate, allowing
15124 consumers to prioritize messages by code hotness,
15125
15126 @item
15127 the function name of the code being optimized, where applicable,
15128
15129 @item
15130 the ``inlining chain'' for the code being optimized, so that when
15131 a function is inlined into several different places (which might
15132 themselves be inlined), the reader can distinguish between the copies,
15133
15134 @item
15135 objects identifying those parts of the message that refer to expressions,
15136 statements or symbol-table nodes, which of these categories they are, and,
15137 when available, their source code location,
15138
15139 @item
15140 the GCC pass that emitted the message, and
15141
15142 @item
15143 the location in GCC's own code from which the message was emitted
15144
15145 @end itemize
15146
15147 Additionally, some messages are logically nested within other
15148 messages, reflecting implementation details of the optimization
15149 passes.
15150
15151 @item -fsched-verbose=@var{n}
15152 @opindex fsched-verbose
15153 On targets that use instruction scheduling, this option controls the
15154 amount of debugging output the scheduler prints to the dump files.
15155
15156 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15157 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15158 For @var{n} greater than one, it also output basic block probabilities,
15159 detailed ready list information and unit/insn info. For @var{n} greater
15160 than two, it includes RTL at abort point, control-flow and regions info.
15161 And for @var{n} over four, @option{-fsched-verbose} also includes
15162 dependence info.
15163
15164
15165
15166 @item -fenable-@var{kind}-@var{pass}
15167 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15168 @opindex fdisable-
15169 @opindex fenable-
15170
15171 This is a set of options that are used to explicitly disable/enable
15172 optimization passes. These options are intended for use for debugging GCC.
15173 Compiler users should use regular options for enabling/disabling
15174 passes instead.
15175
15176 @table @gcctabopt
15177
15178 @item -fdisable-ipa-@var{pass}
15179 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15180 statically invoked in the compiler multiple times, the pass name should be
15181 appended with a sequential number starting from 1.
15182
15183 @item -fdisable-rtl-@var{pass}
15184 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15185 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15186 statically invoked in the compiler multiple times, the pass name should be
15187 appended with a sequential number starting from 1. @var{range-list} is a
15188 comma-separated list of function ranges or assembler names. Each range is a number
15189 pair separated by a colon. The range is inclusive in both ends. If the range
15190 is trivial, the number pair can be simplified as a single number. If the
15191 function's call graph node's @var{uid} falls within one of the specified ranges,
15192 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15193 function header of a dump file, and the pass names can be dumped by using
15194 option @option{-fdump-passes}.
15195
15196 @item -fdisable-tree-@var{pass}
15197 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15198 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15199 option arguments.
15200
15201 @item -fenable-ipa-@var{pass}
15202 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15203 statically invoked in the compiler multiple times, the pass name should be
15204 appended with a sequential number starting from 1.
15205
15206 @item -fenable-rtl-@var{pass}
15207 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15208 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15209 description and examples.
15210
15211 @item -fenable-tree-@var{pass}
15212 @itemx -fenable-tree-@var{pass}=@var{range-list}
15213 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15214 of option arguments.
15215
15216 @end table
15217
15218 Here are some examples showing uses of these options.
15219
15220 @smallexample
15221
15222 # disable ccp1 for all functions
15223 -fdisable-tree-ccp1
15224 # disable complete unroll for function whose cgraph node uid is 1
15225 -fenable-tree-cunroll=1
15226 # disable gcse2 for functions at the following ranges [1,1],
15227 # [300,400], and [400,1000]
15228 # disable gcse2 for functions foo and foo2
15229 -fdisable-rtl-gcse2=foo,foo2
15230 # disable early inlining
15231 -fdisable-tree-einline
15232 # disable ipa inlining
15233 -fdisable-ipa-inline
15234 # enable tree full unroll
15235 -fenable-tree-unroll
15236
15237 @end smallexample
15238
15239 @item -fchecking
15240 @itemx -fchecking=@var{n}
15241 @opindex fchecking
15242 @opindex fno-checking
15243 Enable internal consistency checking. The default depends on
15244 the compiler configuration. @option{-fchecking=2} enables further
15245 internal consistency checking that might affect code generation.
15246
15247 @item -frandom-seed=@var{string}
15248 @opindex frandom-seed
15249 This option provides a seed that GCC uses in place of
15250 random numbers in generating certain symbol names
15251 that have to be different in every compiled file. It is also used to
15252 place unique stamps in coverage data files and the object files that
15253 produce them. You can use the @option{-frandom-seed} option to produce
15254 reproducibly identical object files.
15255
15256 The @var{string} can either be a number (decimal, octal or hex) or an
15257 arbitrary string (in which case it's converted to a number by
15258 computing CRC32).
15259
15260 The @var{string} should be different for every file you compile.
15261
15262 @item -save-temps
15263 @itemx -save-temps=cwd
15264 @opindex save-temps
15265 Store the usual ``temporary'' intermediate files permanently; place them
15266 in the current directory and name them based on the source file. Thus,
15267 compiling @file{foo.c} with @option{-c -save-temps} produces files
15268 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15269 preprocessed @file{foo.i} output file even though the compiler now
15270 normally uses an integrated preprocessor.
15271
15272 When used in combination with the @option{-x} command-line option,
15273 @option{-save-temps} is sensible enough to avoid over writing an
15274 input source file with the same extension as an intermediate file.
15275 The corresponding intermediate file may be obtained by renaming the
15276 source file before using @option{-save-temps}.
15277
15278 If you invoke GCC in parallel, compiling several different source
15279 files that share a common base name in different subdirectories or the
15280 same source file compiled for multiple output destinations, it is
15281 likely that the different parallel compilers will interfere with each
15282 other, and overwrite the temporary files. For instance:
15283
15284 @smallexample
15285 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15286 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15287 @end smallexample
15288
15289 may result in @file{foo.i} and @file{foo.o} being written to
15290 simultaneously by both compilers.
15291
15292 @item -save-temps=obj
15293 @opindex save-temps=obj
15294 Store the usual ``temporary'' intermediate files permanently. If the
15295 @option{-o} option is used, the temporary files are based on the
15296 object file. If the @option{-o} option is not used, the
15297 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15298
15299 For example:
15300
15301 @smallexample
15302 gcc -save-temps=obj -c foo.c
15303 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15304 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15305 @end smallexample
15306
15307 @noindent
15308 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15309 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15310 @file{dir2/yfoobar.o}.
15311
15312 @item -time@r{[}=@var{file}@r{]}
15313 @opindex time
15314 Report the CPU time taken by each subprocess in the compilation
15315 sequence. For C source files, this is the compiler proper and assembler
15316 (plus the linker if linking is done).
15317
15318 Without the specification of an output file, the output looks like this:
15319
15320 @smallexample
15321 # cc1 0.12 0.01
15322 # as 0.00 0.01
15323 @end smallexample
15324
15325 The first number on each line is the ``user time'', that is time spent
15326 executing the program itself. The second number is ``system time'',
15327 time spent executing operating system routines on behalf of the program.
15328 Both numbers are in seconds.
15329
15330 With the specification of an output file, the output is appended to the
15331 named file, and it looks like this:
15332
15333 @smallexample
15334 0.12 0.01 cc1 @var{options}
15335 0.00 0.01 as @var{options}
15336 @end smallexample
15337
15338 The ``user time'' and the ``system time'' are moved before the program
15339 name, and the options passed to the program are displayed, so that one
15340 can later tell what file was being compiled, and with which options.
15341
15342 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15343 @opindex fdump-final-insns
15344 Dump the final internal representation (RTL) to @var{file}. If the
15345 optional argument is omitted (or if @var{file} is @code{.}), the name
15346 of the dump file is determined by appending @code{.gkd} to the
15347 compilation output file name.
15348
15349 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15350 @opindex fcompare-debug
15351 @opindex fno-compare-debug
15352 If no error occurs during compilation, run the compiler a second time,
15353 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15354 passed to the second compilation. Dump the final internal
15355 representation in both compilations, and print an error if they differ.
15356
15357 If the equal sign is omitted, the default @option{-gtoggle} is used.
15358
15359 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15360 and nonzero, implicitly enables @option{-fcompare-debug}. If
15361 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15362 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15363 is used.
15364
15365 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15366 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15367 of the final representation and the second compilation, preventing even
15368 @env{GCC_COMPARE_DEBUG} from taking effect.
15369
15370 To verify full coverage during @option{-fcompare-debug} testing, set
15371 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15372 which GCC rejects as an invalid option in any actual compilation
15373 (rather than preprocessing, assembly or linking). To get just a
15374 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15375 not overridden} will do.
15376
15377 @item -fcompare-debug-second
15378 @opindex fcompare-debug-second
15379 This option is implicitly passed to the compiler for the second
15380 compilation requested by @option{-fcompare-debug}, along with options to
15381 silence warnings, and omitting other options that would cause the compiler
15382 to produce output to files or to standard output as a side effect. Dump
15383 files and preserved temporary files are renamed so as to contain the
15384 @code{.gk} additional extension during the second compilation, to avoid
15385 overwriting those generated by the first.
15386
15387 When this option is passed to the compiler driver, it causes the
15388 @emph{first} compilation to be skipped, which makes it useful for little
15389 other than debugging the compiler proper.
15390
15391 @item -gtoggle
15392 @opindex gtoggle
15393 Turn off generation of debug info, if leaving out this option
15394 generates it, or turn it on at level 2 otherwise. The position of this
15395 argument in the command line does not matter; it takes effect after all
15396 other options are processed, and it does so only once, no matter how
15397 many times it is given. This is mainly intended to be used with
15398 @option{-fcompare-debug}.
15399
15400 @item -fvar-tracking-assignments-toggle
15401 @opindex fvar-tracking-assignments-toggle
15402 @opindex fno-var-tracking-assignments-toggle
15403 Toggle @option{-fvar-tracking-assignments}, in the same way that
15404 @option{-gtoggle} toggles @option{-g}.
15405
15406 @item -Q
15407 @opindex Q
15408 Makes the compiler print out each function name as it is compiled, and
15409 print some statistics about each pass when it finishes.
15410
15411 @item -ftime-report
15412 @opindex ftime-report
15413 Makes the compiler print some statistics about the time consumed by each
15414 pass when it finishes.
15415
15416 @item -ftime-report-details
15417 @opindex ftime-report-details
15418 Record the time consumed by infrastructure parts separately for each pass.
15419
15420 @item -fira-verbose=@var{n}
15421 @opindex fira-verbose
15422 Control the verbosity of the dump file for the integrated register allocator.
15423 The default value is 5. If the value @var{n} is greater or equal to 10,
15424 the dump output is sent to stderr using the same format as @var{n} minus 10.
15425
15426 @item -flto-report
15427 @opindex flto-report
15428 Prints a report with internal details on the workings of the link-time
15429 optimizer. The contents of this report vary from version to version.
15430 It is meant to be useful to GCC developers when processing object
15431 files in LTO mode (via @option{-flto}).
15432
15433 Disabled by default.
15434
15435 @item -flto-report-wpa
15436 @opindex flto-report-wpa
15437 Like @option{-flto-report}, but only print for the WPA phase of link-time
15438 optimization.
15439
15440 @item -fmem-report
15441 @opindex fmem-report
15442 Makes the compiler print some statistics about permanent memory
15443 allocation when it finishes.
15444
15445 @item -fmem-report-wpa
15446 @opindex fmem-report-wpa
15447 Makes the compiler print some statistics about permanent memory
15448 allocation for the WPA phase only.
15449
15450 @item -fpre-ipa-mem-report
15451 @opindex fpre-ipa-mem-report
15452 @item -fpost-ipa-mem-report
15453 @opindex fpost-ipa-mem-report
15454 Makes the compiler print some statistics about permanent memory
15455 allocation before or after interprocedural optimization.
15456
15457 @item -fprofile-report
15458 @opindex fprofile-report
15459 Makes the compiler print some statistics about consistency of the
15460 (estimated) profile and effect of individual passes.
15461
15462 @item -fstack-usage
15463 @opindex fstack-usage
15464 Makes the compiler output stack usage information for the program, on a
15465 per-function basis. The filename for the dump is made by appending
15466 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15467 the output file, if explicitly specified and it is not an executable,
15468 otherwise it is the basename of the source file. An entry is made up
15469 of three fields:
15470
15471 @itemize
15472 @item
15473 The name of the function.
15474 @item
15475 A number of bytes.
15476 @item
15477 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15478 @end itemize
15479
15480 The qualifier @code{static} means that the function manipulates the stack
15481 statically: a fixed number of bytes are allocated for the frame on function
15482 entry and released on function exit; no stack adjustments are otherwise made
15483 in the function. The second field is this fixed number of bytes.
15484
15485 The qualifier @code{dynamic} means that the function manipulates the stack
15486 dynamically: in addition to the static allocation described above, stack
15487 adjustments are made in the body of the function, for example to push/pop
15488 arguments around function calls. If the qualifier @code{bounded} is also
15489 present, the amount of these adjustments is bounded at compile time and
15490 the second field is an upper bound of the total amount of stack used by
15491 the function. If it is not present, the amount of these adjustments is
15492 not bounded at compile time and the second field only represents the
15493 bounded part.
15494
15495 @item -fstats
15496 @opindex fstats
15497 Emit statistics about front-end processing at the end of the compilation.
15498 This option is supported only by the C++ front end, and
15499 the information is generally only useful to the G++ development team.
15500
15501 @item -fdbg-cnt-list
15502 @opindex fdbg-cnt-list
15503 Print the name and the counter upper bound for all debug counters.
15504
15505
15506 @item -fdbg-cnt=@var{counter-value-list}
15507 @opindex fdbg-cnt
15508 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15509 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15510 tuples which sets the lower and the upper bound of each debug
15511 counter @var{name}. The @var{lower_bound} is optional and is zero
15512 initialized if not set.
15513 All debug counters have the initial upper bound of @code{UINT_MAX};
15514 thus @code{dbg_cnt} returns true always unless the upper bound
15515 is set by this option.
15516 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15517 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15518 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15519
15520 @item -print-file-name=@var{library}
15521 @opindex print-file-name
15522 Print the full absolute name of the library file @var{library} that
15523 would be used when linking---and don't do anything else. With this
15524 option, GCC does not compile or link anything; it just prints the
15525 file name.
15526
15527 @item -print-multi-directory
15528 @opindex print-multi-directory
15529 Print the directory name corresponding to the multilib selected by any
15530 other switches present in the command line. This directory is supposed
15531 to exist in @env{GCC_EXEC_PREFIX}.
15532
15533 @item -print-multi-lib
15534 @opindex print-multi-lib
15535 Print the mapping from multilib directory names to compiler switches
15536 that enable them. The directory name is separated from the switches by
15537 @samp{;}, and each switch starts with an @samp{@@} instead of the
15538 @samp{-}, without spaces between multiple switches. This is supposed to
15539 ease shell processing.
15540
15541 @item -print-multi-os-directory
15542 @opindex print-multi-os-directory
15543 Print the path to OS libraries for the selected
15544 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15545 present in the @file{lib} subdirectory and no multilibs are used, this is
15546 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15547 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15548 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15549 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15550
15551 @item -print-multiarch
15552 @opindex print-multiarch
15553 Print the path to OS libraries for the selected multiarch,
15554 relative to some @file{lib} subdirectory.
15555
15556 @item -print-prog-name=@var{program}
15557 @opindex print-prog-name
15558 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15559
15560 @item -print-libgcc-file-name
15561 @opindex print-libgcc-file-name
15562 Same as @option{-print-file-name=libgcc.a}.
15563
15564 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15565 but you do want to link with @file{libgcc.a}. You can do:
15566
15567 @smallexample
15568 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15569 @end smallexample
15570
15571 @item -print-search-dirs
15572 @opindex print-search-dirs
15573 Print the name of the configured installation directory and a list of
15574 program and library directories @command{gcc} searches---and don't do anything else.
15575
15576 This is useful when @command{gcc} prints the error message
15577 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15578 To resolve this you either need to put @file{cpp0} and the other compiler
15579 components where @command{gcc} expects to find them, or you can set the environment
15580 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15581 Don't forget the trailing @samp{/}.
15582 @xref{Environment Variables}.
15583
15584 @item -print-sysroot
15585 @opindex print-sysroot
15586 Print the target sysroot directory that is used during
15587 compilation. This is the target sysroot specified either at configure
15588 time or using the @option{--sysroot} option, possibly with an extra
15589 suffix that depends on compilation options. If no target sysroot is
15590 specified, the option prints nothing.
15591
15592 @item -print-sysroot-headers-suffix
15593 @opindex print-sysroot-headers-suffix
15594 Print the suffix added to the target sysroot when searching for
15595 headers, or give an error if the compiler is not configured with such
15596 a suffix---and don't do anything else.
15597
15598 @item -dumpmachine
15599 @opindex dumpmachine
15600 Print the compiler's target machine (for example,
15601 @samp{i686-pc-linux-gnu})---and don't do anything else.
15602
15603 @item -dumpversion
15604 @opindex dumpversion
15605 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15606 anything else. This is the compiler version used in filesystem paths and
15607 specs. Depending on how the compiler has been configured it can be just
15608 a single number (major version), two numbers separated by a dot (major and
15609 minor version) or three numbers separated by dots (major, minor and patchlevel
15610 version).
15611
15612 @item -dumpfullversion
15613 @opindex dumpfullversion
15614 Print the full compiler version---and don't do anything else. The output is
15615 always three numbers separated by dots, major, minor and patchlevel version.
15616
15617 @item -dumpspecs
15618 @opindex dumpspecs
15619 Print the compiler's built-in specs---and don't do anything else. (This
15620 is used when GCC itself is being built.) @xref{Spec Files}.
15621 @end table
15622
15623 @node Submodel Options
15624 @section Machine-Dependent Options
15625 @cindex submodel options
15626 @cindex specifying hardware config
15627 @cindex hardware models and configurations, specifying
15628 @cindex target-dependent options
15629 @cindex machine-dependent options
15630
15631 Each target machine supported by GCC can have its own options---for
15632 example, to allow you to compile for a particular processor variant or
15633 ABI, or to control optimizations specific to that machine. By
15634 convention, the names of machine-specific options start with
15635 @samp{-m}.
15636
15637 Some configurations of the compiler also support additional target-specific
15638 options, usually for compatibility with other compilers on the same
15639 platform.
15640
15641 @c This list is ordered alphanumerically by subsection name.
15642 @c It should be the same order and spelling as these options are listed
15643 @c in Machine Dependent Options
15644
15645 @menu
15646 * AArch64 Options::
15647 * Adapteva Epiphany Options::
15648 * AMD GCN Options::
15649 * ARC Options::
15650 * ARM Options::
15651 * AVR Options::
15652 * Blackfin Options::
15653 * C6X Options::
15654 * CRIS Options::
15655 * CR16 Options::
15656 * C-SKY Options::
15657 * Darwin Options::
15658 * DEC Alpha Options::
15659 * FR30 Options::
15660 * FT32 Options::
15661 * FRV Options::
15662 * GNU/Linux Options::
15663 * H8/300 Options::
15664 * HPPA Options::
15665 * IA-64 Options::
15666 * LM32 Options::
15667 * M32C Options::
15668 * M32R/D Options::
15669 * M680x0 Options::
15670 * MCore Options::
15671 * MeP Options::
15672 * MicroBlaze Options::
15673 * MIPS Options::
15674 * MMIX Options::
15675 * MN10300 Options::
15676 * Moxie Options::
15677 * MSP430 Options::
15678 * NDS32 Options::
15679 * Nios II Options::
15680 * Nvidia PTX Options::
15681 * OpenRISC Options::
15682 * PDP-11 Options::
15683 * picoChip Options::
15684 * PowerPC Options::
15685 * PRU Options::
15686 * RISC-V Options::
15687 * RL78 Options::
15688 * RS/6000 and PowerPC Options::
15689 * RX Options::
15690 * S/390 and zSeries Options::
15691 * Score Options::
15692 * SH Options::
15693 * Solaris 2 Options::
15694 * SPARC Options::
15695 * SPU Options::
15696 * System V Options::
15697 * TILE-Gx Options::
15698 * TILEPro Options::
15699 * V850 Options::
15700 * VAX Options::
15701 * Visium Options::
15702 * VMS Options::
15703 * VxWorks Options::
15704 * x86 Options::
15705 * x86 Windows Options::
15706 * Xstormy16 Options::
15707 * Xtensa Options::
15708 * zSeries Options::
15709 @end menu
15710
15711 @node AArch64 Options
15712 @subsection AArch64 Options
15713 @cindex AArch64 Options
15714
15715 These options are defined for AArch64 implementations:
15716
15717 @table @gcctabopt
15718
15719 @item -mabi=@var{name}
15720 @opindex mabi
15721 Generate code for the specified data model. Permissible values
15722 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15723 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15724 but long int and pointers are 64 bits.
15725
15726 The default depends on the specific target configuration. Note that
15727 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15728 entire program with the same ABI, and link with a compatible set of libraries.
15729
15730 @item -mbig-endian
15731 @opindex mbig-endian
15732 Generate big-endian code. This is the default when GCC is configured for an
15733 @samp{aarch64_be-*-*} target.
15734
15735 @item -mgeneral-regs-only
15736 @opindex mgeneral-regs-only
15737 Generate code which uses only the general-purpose registers. This will prevent
15738 the compiler from using floating-point and Advanced SIMD registers but will not
15739 impose any restrictions on the assembler.
15740
15741 @item -mlittle-endian
15742 @opindex mlittle-endian
15743 Generate little-endian code. This is the default when GCC is configured for an
15744 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15745
15746 @item -mcmodel=tiny
15747 @opindex mcmodel=tiny
15748 Generate code for the tiny code model. The program and its statically defined
15749 symbols must be within 1MB of each other. Programs can be statically or
15750 dynamically linked.
15751
15752 @item -mcmodel=small
15753 @opindex mcmodel=small
15754 Generate code for the small code model. The program and its statically defined
15755 symbols must be within 4GB of each other. Programs can be statically or
15756 dynamically linked. This is the default code model.
15757
15758 @item -mcmodel=large
15759 @opindex mcmodel=large
15760 Generate code for the large code model. This makes no assumptions about
15761 addresses and sizes of sections. Programs can be statically linked only.
15762
15763 @item -mstrict-align
15764 @itemx -mno-strict-align
15765 @opindex mstrict-align
15766 @opindex mno-strict-align
15767 Avoid or allow generating memory accesses that may not be aligned on a natural
15768 object boundary as described in the architecture specification.
15769
15770 @item -momit-leaf-frame-pointer
15771 @itemx -mno-omit-leaf-frame-pointer
15772 @opindex momit-leaf-frame-pointer
15773 @opindex mno-omit-leaf-frame-pointer
15774 Omit or keep the frame pointer in leaf functions. The former behavior is the
15775 default.
15776
15777 @item -mstack-protector-guard=@var{guard}
15778 @itemx -mstack-protector-guard-reg=@var{reg}
15779 @itemx -mstack-protector-guard-offset=@var{offset}
15780 @opindex mstack-protector-guard
15781 @opindex mstack-protector-guard-reg
15782 @opindex mstack-protector-guard-offset
15783 Generate stack protection code using canary at @var{guard}. Supported
15784 locations are @samp{global} for a global canary or @samp{sysreg} for a
15785 canary in an appropriate system register.
15786
15787 With the latter choice the options
15788 @option{-mstack-protector-guard-reg=@var{reg}} and
15789 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15790 which system register to use as base register for reading the canary,
15791 and from what offset from that base register. There is no default
15792 register or offset as this is entirely for use within the Linux
15793 kernel.
15794
15795 @item -mstack-protector-guard=@var{guard}
15796 @itemx -mstack-protector-guard-reg=@var{reg}
15797 @itemx -mstack-protector-guard-offset=@var{offset}
15798 @opindex mstack-protector-guard
15799 @opindex mstack-protector-guard-reg
15800 @opindex mstack-protector-guard-offset
15801 Generate stack protection code using canary at @var{guard}. Supported
15802 locations are @samp{global} for a global canary or @samp{sysreg} for a
15803 canary in an appropriate system register.
15804
15805 With the latter choice the options
15806 @option{-mstack-protector-guard-reg=@var{reg}} and
15807 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15808 which system register to use as base register for reading the canary,
15809 and from what offset from that base register. There is no default
15810 register or offset as this is entirely for use within the Linux
15811 kernel.
15812
15813 @item -mtls-dialect=desc
15814 @opindex mtls-dialect=desc
15815 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15816 of TLS variables. This is the default.
15817
15818 @item -mtls-dialect=traditional
15819 @opindex mtls-dialect=traditional
15820 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15821 of TLS variables.
15822
15823 @item -mtls-size=@var{size}
15824 @opindex mtls-size
15825 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15826 This option requires binutils 2.26 or newer.
15827
15828 @item -mfix-cortex-a53-835769
15829 @itemx -mno-fix-cortex-a53-835769
15830 @opindex mfix-cortex-a53-835769
15831 @opindex mno-fix-cortex-a53-835769
15832 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15833 This involves inserting a NOP instruction between memory instructions and
15834 64-bit integer multiply-accumulate instructions.
15835
15836 @item -mfix-cortex-a53-843419
15837 @itemx -mno-fix-cortex-a53-843419
15838 @opindex mfix-cortex-a53-843419
15839 @opindex mno-fix-cortex-a53-843419
15840 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15841 This erratum workaround is made at link time and this will only pass the
15842 corresponding flag to the linker.
15843
15844 @item -mlow-precision-recip-sqrt
15845 @itemx -mno-low-precision-recip-sqrt
15846 @opindex mlow-precision-recip-sqrt
15847 @opindex mno-low-precision-recip-sqrt
15848 Enable or disable the reciprocal square root approximation.
15849 This option only has an effect if @option{-ffast-math} or
15850 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15851 precision of reciprocal square root results to about 16 bits for
15852 single precision and to 32 bits for double precision.
15853
15854 @item -mlow-precision-sqrt
15855 @itemx -mno-low-precision-sqrt
15856 @opindex mlow-precision-sqrt
15857 @opindex mno-low-precision-sqrt
15858 Enable or disable the square root approximation.
15859 This option only has an effect if @option{-ffast-math} or
15860 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15861 precision of square root results to about 16 bits for
15862 single precision and to 32 bits for double precision.
15863 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15864
15865 @item -mlow-precision-div
15866 @itemx -mno-low-precision-div
15867 @opindex mlow-precision-div
15868 @opindex mno-low-precision-div
15869 Enable or disable the division approximation.
15870 This option only has an effect if @option{-ffast-math} or
15871 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15872 precision of division results to about 16 bits for
15873 single precision and to 32 bits for double precision.
15874
15875 @item -mtrack-speculation
15876 @itemx -mno-track-speculation
15877 Enable or disable generation of additional code to track speculative
15878 execution through conditional branches. The tracking state can then
15879 be used by the compiler when expanding calls to
15880 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15881 sequence to be generated.
15882
15883 @item -march=@var{name}
15884 @opindex march
15885 Specify the name of the target architecture and, optionally, one or
15886 more feature modifiers. This option has the form
15887 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15888
15889 The permissible values for @var{arch} are @samp{armv8-a},
15890 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15891 @samp{armv8.5-a} or @var{native}.
15892
15893 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15894 support for the ARMv8.5-A architecture extensions.
15895
15896 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15897 support for the ARMv8.4-A architecture extensions.
15898
15899 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15900 support for the ARMv8.3-A architecture extensions.
15901
15902 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15903 support for the ARMv8.2-A architecture extensions.
15904
15905 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15906 support for the ARMv8.1-A architecture extension. In particular, it
15907 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15908
15909 The value @samp{native} is available on native AArch64 GNU/Linux and
15910 causes the compiler to pick the architecture of the host system. This
15911 option has no effect if the compiler is unable to recognize the
15912 architecture of the host system,
15913
15914 The permissible values for @var{feature} are listed in the sub-section
15915 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15916 Feature Modifiers}. Where conflicting feature modifiers are
15917 specified, the right-most feature is used.
15918
15919 GCC uses @var{name} to determine what kind of instructions it can emit
15920 when generating assembly code. If @option{-march} is specified
15921 without either of @option{-mtune} or @option{-mcpu} also being
15922 specified, the code is tuned to perform well across a range of target
15923 processors implementing the target architecture.
15924
15925 @item -mtune=@var{name}
15926 @opindex mtune
15927 Specify the name of the target processor for which GCC should tune the
15928 performance of the code. Permissible values for this option are:
15929 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15930 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15931 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15932 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
15933 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
15934 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
15935 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
15936 @samp{thunderxt83}, @samp{thunderx2t99},
15937 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15938 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15939 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15940 @samp{native}.
15941
15942 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15943 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15944 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15945 should tune for a big.LITTLE system.
15946
15947 Additionally on native AArch64 GNU/Linux systems the value
15948 @samp{native} tunes performance to the host system. This option has no effect
15949 if the compiler is unable to recognize the processor of the host system.
15950
15951 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15952 are specified, the code is tuned to perform well across a range
15953 of target processors.
15954
15955 This option cannot be suffixed by feature modifiers.
15956
15957 @item -mcpu=@var{name}
15958 @opindex mcpu
15959 Specify the name of the target processor, optionally suffixed by one
15960 or more feature modifiers. This option has the form
15961 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15962 the permissible values for @var{cpu} are the same as those available
15963 for @option{-mtune}. The permissible values for @var{feature} are
15964 documented in the sub-section on
15965 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15966 Feature Modifiers}. Where conflicting feature modifiers are
15967 specified, the right-most feature is used.
15968
15969 GCC uses @var{name} to determine what kind of instructions it can emit when
15970 generating assembly code (as if by @option{-march}) and to determine
15971 the target processor for which to tune for performance (as if
15972 by @option{-mtune}). Where this option is used in conjunction
15973 with @option{-march} or @option{-mtune}, those options take precedence
15974 over the appropriate part of this option.
15975
15976 @item -moverride=@var{string}
15977 @opindex moverride
15978 Override tuning decisions made by the back-end in response to a
15979 @option{-mtune=} switch. The syntax, semantics, and accepted values
15980 for @var{string} in this option are not guaranteed to be consistent
15981 across releases.
15982
15983 This option is only intended to be useful when developing GCC.
15984
15985 @item -mverbose-cost-dump
15986 @opindex mverbose-cost-dump
15987 Enable verbose cost model dumping in the debug dump files. This option is
15988 provided for use in debugging the compiler.
15989
15990 @item -mpc-relative-literal-loads
15991 @itemx -mno-pc-relative-literal-loads
15992 @opindex mpc-relative-literal-loads
15993 @opindex mno-pc-relative-literal-loads
15994 Enable or disable PC-relative literal loads. With this option literal pools are
15995 accessed using a single instruction and emitted after each function. This
15996 limits the maximum size of functions to 1MB. This is enabled by default for
15997 @option{-mcmodel=tiny}.
15998
15999 @item -msign-return-address=@var{scope}
16000 @opindex msign-return-address
16001 Select the function scope on which return address signing will be applied.
16002 Permissible values are @samp{none}, which disables return address signing,
16003 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
16004 functions, and @samp{all}, which enables pointer signing for all functions. The
16005 default value is @samp{none}. This option has been deprecated by
16006 -mbranch-protection.
16007
16008 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
16009 @opindex mbranch-protection
16010 Select the branch protection features to use.
16011 @samp{none} is the default and turns off all types of branch protection.
16012 @samp{standard} turns on all types of branch protection features. If a feature
16013 has additional tuning options, then @samp{standard} sets it to its standard
16014 level.
16015 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
16016 level: signing functions that save the return address to memory (non-leaf
16017 functions will practically always do this) using the a-key. The optional
16018 argument @samp{leaf} can be used to extend the signing to include leaf
16019 functions. The optional argument @samp{b-key} can be used to sign the functions
16020 with the B-key instead of the A-key.
16021 @samp{bti} turns on branch target identification mechanism.
16022
16023 @item -msve-vector-bits=@var{bits}
16024 @opindex msve-vector-bits
16025 Specify the number of bits in an SVE vector register. This option only has
16026 an effect when SVE is enabled.
16027
16028 GCC supports two forms of SVE code generation: ``vector-length
16029 agnostic'' output that works with any size of vector register and
16030 ``vector-length specific'' output that allows GCC to make assumptions
16031 about the vector length when it is useful for optimization reasons.
16032 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
16033 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
16034 Specifying @samp{scalable} selects vector-length agnostic
16035 output. At present @samp{-msve-vector-bits=128} also generates vector-length
16036 agnostic output. All other values generate vector-length specific code.
16037 The behavior of these values may change in future releases and no value except
16038 @samp{scalable} should be relied on for producing code that is portable across
16039 different hardware SVE vector lengths.
16040
16041 The default is @samp{-msve-vector-bits=scalable}, which produces
16042 vector-length agnostic code.
16043 @end table
16044
16045 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16046 @anchor{aarch64-feature-modifiers}
16047 @cindex @option{-march} feature modifiers
16048 @cindex @option{-mcpu} feature modifiers
16049 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16050 the following and their inverses @option{no@var{feature}}:
16051
16052 @table @samp
16053 @item crc
16054 Enable CRC extension. This is on by default for
16055 @option{-march=armv8.1-a}.
16056 @item crypto
16057 Enable Crypto extension. This also enables Advanced SIMD and floating-point
16058 instructions.
16059 @item fp
16060 Enable floating-point instructions. This is on by default for all possible
16061 values for options @option{-march} and @option{-mcpu}.
16062 @item simd
16063 Enable Advanced SIMD instructions. This also enables floating-point
16064 instructions. This is on by default for all possible values for options
16065 @option{-march} and @option{-mcpu}.
16066 @item sve
16067 Enable Scalable Vector Extension instructions. This also enables Advanced
16068 SIMD and floating-point instructions.
16069 @item lse
16070 Enable Large System Extension instructions. This is on by default for
16071 @option{-march=armv8.1-a}.
16072 @item rdma
16073 Enable Round Double Multiply Accumulate instructions. This is on by default
16074 for @option{-march=armv8.1-a}.
16075 @item fp16
16076 Enable FP16 extension. This also enables floating-point instructions.
16077 @item fp16fml
16078 Enable FP16 fmla extension. This also enables FP16 extensions and
16079 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.
16080
16081 @item rcpc
16082 Enable the RcPc extension. This does not change code generation from GCC,
16083 but is passed on to the assembler, enabling inline asm statements to use
16084 instructions from the RcPc extension.
16085 @item dotprod
16086 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16087 @item aes
16088 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
16089 SIMD instructions.
16090 @item sha2
16091 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
16092 @item sha3
16093 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
16094 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16095 @item sm4
16096 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
16097 Use of this option with architectures prior to Armv8.2-A is not supported.
16098 @item profile
16099 Enable the Statistical Profiling extension. This option is only to enable the
16100 extension at the assembler level and does not affect code generation.
16101 @item rng
16102 Enable the Armv8.5-a Random Number instructions. This option is only to
16103 enable the extension at the assembler level and does not affect code
16104 generation.
16105 @item memtag
16106 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16107 enable the extension at the assembler level and does not affect code
16108 generation.
16109 @item sb
16110 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16111 enable the extension at the assembler level and does not affect code
16112 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16113 @item ssbs
16114 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16115 is only to enable the extension at the assembler level and does not affect code
16116 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16117 @item predres
16118 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16119 This option is only to enable the extension at the assembler level and does
16120 not affect code generation. This option is enabled by default for
16121 @item sve2
16122 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16123 instructions.
16124 @item sve2-bitperm
16125 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16126 @item sve2-sm4
16127 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16128 @item sve2-aes
16129 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16130 @item sve2-sha3
16131 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16132 @option{-march=armv8.5-a}.
16133 @item tme
16134 Enable the Transactional Memory Extension.
16135
16136 @end table
16137
16138 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16139 which implies @option{fp}.
16140 Conversely, @option{nofp} implies @option{nosimd}, which implies
16141 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16142
16143 @node Adapteva Epiphany Options
16144 @subsection Adapteva Epiphany Options
16145
16146 These @samp{-m} options are defined for Adapteva Epiphany:
16147
16148 @table @gcctabopt
16149 @item -mhalf-reg-file
16150 @opindex mhalf-reg-file
16151 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16152 That allows code to run on hardware variants that lack these registers.
16153
16154 @item -mprefer-short-insn-regs
16155 @opindex mprefer-short-insn-regs
16156 Preferentially allocate registers that allow short instruction generation.
16157 This can result in increased instruction count, so this may either reduce or
16158 increase overall code size.
16159
16160 @item -mbranch-cost=@var{num}
16161 @opindex mbranch-cost
16162 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16163 This cost is only a heuristic and is not guaranteed to produce
16164 consistent results across releases.
16165
16166 @item -mcmove
16167 @opindex mcmove
16168 Enable the generation of conditional moves.
16169
16170 @item -mnops=@var{num}
16171 @opindex mnops
16172 Emit @var{num} NOPs before every other generated instruction.
16173
16174 @item -mno-soft-cmpsf
16175 @opindex mno-soft-cmpsf
16176 @opindex msoft-cmpsf
16177 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16178 and test the flags. This is faster than a software comparison, but can
16179 get incorrect results in the presence of NaNs, or when two different small
16180 numbers are compared such that their difference is calculated as zero.
16181 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16182 software comparisons.
16183
16184 @item -mstack-offset=@var{num}
16185 @opindex mstack-offset
16186 Set the offset between the top of the stack and the stack pointer.
16187 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16188 can be used by leaf functions without stack allocation.
16189 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16190 Note also that this option changes the ABI; compiling a program with a
16191 different stack offset than the libraries have been compiled with
16192 generally does not work.
16193 This option can be useful if you want to evaluate if a different stack
16194 offset would give you better code, but to actually use a different stack
16195 offset to build working programs, it is recommended to configure the
16196 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16197
16198 @item -mno-round-nearest
16199 @opindex mno-round-nearest
16200 @opindex mround-nearest
16201 Make the scheduler assume that the rounding mode has been set to
16202 truncating. The default is @option{-mround-nearest}.
16203
16204 @item -mlong-calls
16205 @opindex mlong-calls
16206 If not otherwise specified by an attribute, assume all calls might be beyond
16207 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16208 function address into a register before performing a (otherwise direct) call.
16209 This is the default.
16210
16211 @item -mshort-calls
16212 @opindex short-calls
16213 If not otherwise specified by an attribute, assume all direct calls are
16214 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16215 for direct calls. The default is @option{-mlong-calls}.
16216
16217 @item -msmall16
16218 @opindex msmall16
16219 Assume addresses can be loaded as 16-bit unsigned values. This does not
16220 apply to function addresses for which @option{-mlong-calls} semantics
16221 are in effect.
16222
16223 @item -mfp-mode=@var{mode}
16224 @opindex mfp-mode
16225 Set the prevailing mode of the floating-point unit.
16226 This determines the floating-point mode that is provided and expected
16227 at function call and return time. Making this mode match the mode you
16228 predominantly need at function start can make your programs smaller and
16229 faster by avoiding unnecessary mode switches.
16230
16231 @var{mode} can be set to one the following values:
16232
16233 @table @samp
16234 @item caller
16235 Any mode at function entry is valid, and retained or restored when
16236 the function returns, and when it calls other functions.
16237 This mode is useful for compiling libraries or other compilation units
16238 you might want to incorporate into different programs with different
16239 prevailing FPU modes, and the convenience of being able to use a single
16240 object file outweighs the size and speed overhead for any extra
16241 mode switching that might be needed, compared with what would be needed
16242 with a more specific choice of prevailing FPU mode.
16243
16244 @item truncate
16245 This is the mode used for floating-point calculations with
16246 truncating (i.e.@: round towards zero) rounding mode. That includes
16247 conversion from floating point to integer.
16248
16249 @item round-nearest
16250 This is the mode used for floating-point calculations with
16251 round-to-nearest-or-even rounding mode.
16252
16253 @item int
16254 This is the mode used to perform integer calculations in the FPU, e.g.@:
16255 integer multiply, or integer multiply-and-accumulate.
16256 @end table
16257
16258 The default is @option{-mfp-mode=caller}
16259
16260 @item -mno-split-lohi
16261 @itemx -mno-postinc
16262 @itemx -mno-postmodify
16263 @opindex mno-split-lohi
16264 @opindex msplit-lohi
16265 @opindex mno-postinc
16266 @opindex mpostinc
16267 @opindex mno-postmodify
16268 @opindex mpostmodify
16269 Code generation tweaks that disable, respectively, splitting of 32-bit
16270 loads, generation of post-increment addresses, and generation of
16271 post-modify addresses. The defaults are @option{msplit-lohi},
16272 @option{-mpost-inc}, and @option{-mpost-modify}.
16273
16274 @item -mnovect-double
16275 @opindex mno-vect-double
16276 @opindex mvect-double
16277 Change the preferred SIMD mode to SImode. The default is
16278 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16279
16280 @item -max-vect-align=@var{num}
16281 @opindex max-vect-align
16282 The maximum alignment for SIMD vector mode types.
16283 @var{num} may be 4 or 8. The default is 8.
16284 Note that this is an ABI change, even though many library function
16285 interfaces are unaffected if they don't use SIMD vector modes
16286 in places that affect size and/or alignment of relevant types.
16287
16288 @item -msplit-vecmove-early
16289 @opindex msplit-vecmove-early
16290 Split vector moves into single word moves before reload. In theory this
16291 can give better register allocation, but so far the reverse seems to be
16292 generally the case.
16293
16294 @item -m1reg-@var{reg}
16295 @opindex m1reg-
16296 Specify a register to hold the constant @minus{}1, which makes loading small negative
16297 constants and certain bitmasks faster.
16298 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16299 which specify use of that register as a fixed register,
16300 and @samp{none}, which means that no register is used for this
16301 purpose. The default is @option{-m1reg-none}.
16302
16303 @end table
16304
16305 @node AMD GCN Options
16306 @subsection AMD GCN Options
16307 @cindex AMD GCN Options
16308
16309 These options are defined specifically for the AMD GCN port.
16310
16311 @table @gcctabopt
16312
16313 @item -march=@var{gpu}
16314 @opindex march
16315 @itemx -mtune=@var{gpu}
16316 @opindex mtune
16317 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16318 are
16319
16320 @table @samp
16321 @opindex fiji
16322 @item fiji
16323 Compile for GCN3 Fiji devices (gfx803).
16324
16325 @item gfx900
16326 Compile for GCN5 Vega 10 devices (gfx900).
16327
16328 @item gfx906
16329 Compile for GCN5 Vega 20 devices (gfx906).
16330
16331 @end table
16332
16333 @item -mstack-size=@var{bytes}
16334 @opindex mstack-size
16335 Specify how many @var{bytes} of stack space will be requested for each GPU
16336 thread (wave-front). Beware that there may be many threads and limited memory
16337 available. The size of the stack allocation may also have an impact on
16338 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16339 1MB otherwise.
16340
16341 @end table
16342
16343 @node ARC Options
16344 @subsection ARC Options
16345 @cindex ARC options
16346
16347 The following options control the architecture variant for which code
16348 is being compiled:
16349
16350 @c architecture variants
16351 @table @gcctabopt
16352
16353 @item -mbarrel-shifter
16354 @opindex mbarrel-shifter
16355 Generate instructions supported by barrel shifter. This is the default
16356 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16357
16358 @item -mjli-always
16359 @opindex mjli-alawys
16360 Force to call a function using jli_s instruction. This option is
16361 valid only for ARCv2 architecture.
16362
16363 @item -mcpu=@var{cpu}
16364 @opindex mcpu
16365 Set architecture type, register usage, and instruction scheduling
16366 parameters for @var{cpu}. There are also shortcut alias options
16367 available for backward compatibility and convenience. Supported
16368 values for @var{cpu} are
16369
16370 @table @samp
16371 @opindex mA6
16372 @opindex mARC600
16373 @item arc600
16374 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16375
16376 @item arc601
16377 @opindex mARC601
16378 Compile for ARC601. Alias: @option{-mARC601}.
16379
16380 @item arc700
16381 @opindex mA7
16382 @opindex mARC700
16383 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16384 This is the default when configured with @option{--with-cpu=arc700}@.
16385
16386 @item arcem
16387 Compile for ARC EM.
16388
16389 @item archs
16390 Compile for ARC HS.
16391
16392 @item em
16393 Compile for ARC EM CPU with no hardware extensions.
16394
16395 @item em4
16396 Compile for ARC EM4 CPU.
16397
16398 @item em4_dmips
16399 Compile for ARC EM4 DMIPS CPU.
16400
16401 @item em4_fpus
16402 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16403 extension.
16404
16405 @item em4_fpuda
16406 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16407 double assist instructions.
16408
16409 @item hs
16410 Compile for ARC HS CPU with no hardware extensions except the atomic
16411 instructions.
16412
16413 @item hs34
16414 Compile for ARC HS34 CPU.
16415
16416 @item hs38
16417 Compile for ARC HS38 CPU.
16418
16419 @item hs38_linux
16420 Compile for ARC HS38 CPU with all hardware extensions on.
16421
16422 @item arc600_norm
16423 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16424
16425 @item arc600_mul32x16
16426 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16427 instructions enabled.
16428
16429 @item arc600_mul64
16430 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16431 instructions enabled.
16432
16433 @item arc601_norm
16434 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16435
16436 @item arc601_mul32x16
16437 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16438 instructions enabled.
16439
16440 @item arc601_mul64
16441 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16442 instructions enabled.
16443
16444 @item nps400
16445 Compile for ARC 700 on NPS400 chip.
16446
16447 @item em_mini
16448 Compile for ARC EM minimalist configuration featuring reduced register
16449 set.
16450
16451 @end table
16452
16453 @item -mdpfp
16454 @opindex mdpfp
16455 @itemx -mdpfp-compact
16456 @opindex mdpfp-compact
16457 Generate double-precision FPX instructions, tuned for the compact
16458 implementation.
16459
16460 @item -mdpfp-fast
16461 @opindex mdpfp-fast
16462 Generate double-precision FPX instructions, tuned for the fast
16463 implementation.
16464
16465 @item -mno-dpfp-lrsr
16466 @opindex mno-dpfp-lrsr
16467 Disable @code{lr} and @code{sr} instructions from using FPX extension
16468 aux registers.
16469
16470 @item -mea
16471 @opindex mea
16472 Generate extended arithmetic instructions. Currently only
16473 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16474 supported. This is always enabled for @option{-mcpu=ARC700}.
16475
16476 @item -mno-mpy
16477 @opindex mno-mpy
16478 @opindex mmpy
16479 Do not generate @code{mpy}-family instructions for ARC700. This option is
16480 deprecated.
16481
16482 @item -mmul32x16
16483 @opindex mmul32x16
16484 Generate 32x16-bit multiply and multiply-accumulate instructions.
16485
16486 @item -mmul64
16487 @opindex mmul64
16488 Generate @code{mul64} and @code{mulu64} instructions.
16489 Only valid for @option{-mcpu=ARC600}.
16490
16491 @item -mnorm
16492 @opindex mnorm
16493 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16494 is in effect.
16495
16496 @item -mspfp
16497 @opindex mspfp
16498 @itemx -mspfp-compact
16499 @opindex mspfp-compact
16500 Generate single-precision FPX instructions, tuned for the compact
16501 implementation.
16502
16503 @item -mspfp-fast
16504 @opindex mspfp-fast
16505 Generate single-precision FPX instructions, tuned for the fast
16506 implementation.
16507
16508 @item -msimd
16509 @opindex msimd
16510 Enable generation of ARC SIMD instructions via target-specific
16511 builtins. Only valid for @option{-mcpu=ARC700}.
16512
16513 @item -msoft-float
16514 @opindex msoft-float
16515 This option ignored; it is provided for compatibility purposes only.
16516 Software floating-point code is emitted by default, and this default
16517 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16518 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16519 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16520
16521 @item -mswap
16522 @opindex mswap
16523 Generate @code{swap} instructions.
16524
16525 @item -matomic
16526 @opindex matomic
16527 This enables use of the locked load/store conditional extension to implement
16528 atomic memory built-in functions. Not available for ARC 6xx or ARC
16529 EM cores.
16530
16531 @item -mdiv-rem
16532 @opindex mdiv-rem
16533 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16534
16535 @item -mcode-density
16536 @opindex mcode-density
16537 Enable code density instructions for ARC EM.
16538 This option is on by default for ARC HS.
16539
16540 @item -mll64
16541 @opindex mll64
16542 Enable double load/store operations for ARC HS cores.
16543
16544 @item -mtp-regno=@var{regno}
16545 @opindex mtp-regno
16546 Specify thread pointer register number.
16547
16548 @item -mmpy-option=@var{multo}
16549 @opindex mmpy-option
16550 Compile ARCv2 code with a multiplier design option. You can specify
16551 the option using either a string or numeric value for @var{multo}.
16552 @samp{wlh1} is the default value. The recognized values are:
16553
16554 @table @samp
16555 @item 0
16556 @itemx none
16557 No multiplier available.
16558
16559 @item 1
16560 @itemx w
16561 16x16 multiplier, fully pipelined.
16562 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16563
16564 @item 2
16565 @itemx wlh1
16566 32x32 multiplier, fully
16567 pipelined (1 stage). The following instructions are additionally
16568 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16569
16570 @item 3
16571 @itemx wlh2
16572 32x32 multiplier, fully pipelined
16573 (2 stages). The following instructions are additionally enabled: @code{mpy},
16574 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16575
16576 @item 4
16577 @itemx wlh3
16578 Two 16x16 multipliers, blocking,
16579 sequential. The following instructions are additionally enabled: @code{mpy},
16580 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16581
16582 @item 5
16583 @itemx wlh4
16584 One 16x16 multiplier, blocking,
16585 sequential. The following instructions are additionally enabled: @code{mpy},
16586 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16587
16588 @item 6
16589 @itemx wlh5
16590 One 32x4 multiplier, blocking,
16591 sequential. The following instructions are additionally enabled: @code{mpy},
16592 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16593
16594 @item 7
16595 @itemx plus_dmpy
16596 ARC HS SIMD support.
16597
16598 @item 8
16599 @itemx plus_macd
16600 ARC HS SIMD support.
16601
16602 @item 9
16603 @itemx plus_qmacw
16604 ARC HS SIMD support.
16605
16606 @end table
16607
16608 This option is only available for ARCv2 cores@.
16609
16610 @item -mfpu=@var{fpu}
16611 @opindex mfpu
16612 Enables support for specific floating-point hardware extensions for ARCv2
16613 cores. Supported values for @var{fpu} are:
16614
16615 @table @samp
16616
16617 @item fpus
16618 Enables support for single-precision floating-point hardware
16619 extensions@.
16620
16621 @item fpud
16622 Enables support for double-precision floating-point hardware
16623 extensions. The single-precision floating-point extension is also
16624 enabled. Not available for ARC EM@.
16625
16626 @item fpuda
16627 Enables support for double-precision floating-point hardware
16628 extensions using double-precision assist instructions. The single-precision
16629 floating-point extension is also enabled. This option is
16630 only available for ARC EM@.
16631
16632 @item fpuda_div
16633 Enables support for double-precision floating-point hardware
16634 extensions using double-precision assist instructions.
16635 The single-precision floating-point, square-root, and divide
16636 extensions are also enabled. This option is
16637 only available for ARC EM@.
16638
16639 @item fpuda_fma
16640 Enables support for double-precision floating-point hardware
16641 extensions using double-precision assist instructions.
16642 The single-precision floating-point and fused multiply and add
16643 hardware extensions are also enabled. This option is
16644 only available for ARC EM@.
16645
16646 @item fpuda_all
16647 Enables support for double-precision floating-point hardware
16648 extensions using double-precision assist instructions.
16649 All single-precision floating-point hardware extensions are also
16650 enabled. This option is only available for ARC EM@.
16651
16652 @item fpus_div
16653 Enables support for single-precision floating-point, square-root and divide
16654 hardware extensions@.
16655
16656 @item fpud_div
16657 Enables support for double-precision floating-point, square-root and divide
16658 hardware extensions. This option
16659 includes option @samp{fpus_div}. Not available for ARC EM@.
16660
16661 @item fpus_fma
16662 Enables support for single-precision floating-point and
16663 fused multiply and add hardware extensions@.
16664
16665 @item fpud_fma
16666 Enables support for double-precision floating-point and
16667 fused multiply and add hardware extensions. This option
16668 includes option @samp{fpus_fma}. Not available for ARC EM@.
16669
16670 @item fpus_all
16671 Enables support for all single-precision floating-point hardware
16672 extensions@.
16673
16674 @item fpud_all
16675 Enables support for all single- and double-precision floating-point
16676 hardware extensions. Not available for ARC EM@.
16677
16678 @end table
16679
16680 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16681 @opindex mirq-ctrl-saved
16682 Specifies general-purposes registers that the processor automatically
16683 saves/restores on interrupt entry and exit. @var{register-range} is
16684 specified as two registers separated by a dash. The register range
16685 always starts with @code{r0}, the upper limit is @code{fp} register.
16686 @var{blink} and @var{lp_count} are optional. This option is only
16687 valid for ARC EM and ARC HS cores.
16688
16689 @item -mrgf-banked-regs=@var{number}
16690 @opindex mrgf-banked-regs
16691 Specifies the number of registers replicated in second register bank
16692 on entry to fast interrupt. Fast interrupts are interrupts with the
16693 highest priority level P0. These interrupts save only PC and STATUS32
16694 registers to avoid memory transactions during interrupt entry and exit
16695 sequences. Use this option when you are using fast interrupts in an
16696 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16697
16698 @item -mlpc-width=@var{width}
16699 @opindex mlpc-width
16700 Specify the width of the @code{lp_count} register. Valid values for
16701 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16702 fixed to 32 bits. If the width is less than 32, the compiler does not
16703 attempt to transform loops in your program to use the zero-delay loop
16704 mechanism unless it is known that the @code{lp_count} register can
16705 hold the required loop-counter value. Depending on the width
16706 specified, the compiler and run-time library might continue to use the
16707 loop mechanism for various needs. This option defines macro
16708 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16709
16710 @item -mrf16
16711 @opindex mrf16
16712 This option instructs the compiler to generate code for a 16-entry
16713 register file. This option defines the @code{__ARC_RF16__}
16714 preprocessor macro.
16715
16716 @item -mbranch-index
16717 @opindex mbranch-index
16718 Enable use of @code{bi} or @code{bih} instructions to implement jump
16719 tables.
16720
16721 @end table
16722
16723 The following options are passed through to the assembler, and also
16724 define preprocessor macro symbols.
16725
16726 @c Flags used by the assembler, but for which we define preprocessor
16727 @c macro symbols as well.
16728 @table @gcctabopt
16729 @item -mdsp-packa
16730 @opindex mdsp-packa
16731 Passed down to the assembler to enable the DSP Pack A extensions.
16732 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16733 deprecated.
16734
16735 @item -mdvbf
16736 @opindex mdvbf
16737 Passed down to the assembler to enable the dual Viterbi butterfly
16738 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16739 option is deprecated.
16740
16741 @c ARC700 4.10 extension instruction
16742 @item -mlock
16743 @opindex mlock
16744 Passed down to the assembler to enable the locked load/store
16745 conditional extension. Also sets the preprocessor symbol
16746 @code{__Xlock}.
16747
16748 @item -mmac-d16
16749 @opindex mmac-d16
16750 Passed down to the assembler. Also sets the preprocessor symbol
16751 @code{__Xxmac_d16}. This option is deprecated.
16752
16753 @item -mmac-24
16754 @opindex mmac-24
16755 Passed down to the assembler. Also sets the preprocessor symbol
16756 @code{__Xxmac_24}. This option is deprecated.
16757
16758 @c ARC700 4.10 extension instruction
16759 @item -mrtsc
16760 @opindex mrtsc
16761 Passed down to the assembler to enable the 64-bit time-stamp counter
16762 extension instruction. Also sets the preprocessor symbol
16763 @code{__Xrtsc}. This option is deprecated.
16764
16765 @c ARC700 4.10 extension instruction
16766 @item -mswape
16767 @opindex mswape
16768 Passed down to the assembler to enable the swap byte ordering
16769 extension instruction. Also sets the preprocessor symbol
16770 @code{__Xswape}.
16771
16772 @item -mtelephony
16773 @opindex mtelephony
16774 Passed down to the assembler to enable dual- and single-operand
16775 instructions for telephony. Also sets the preprocessor symbol
16776 @code{__Xtelephony}. This option is deprecated.
16777
16778 @item -mxy
16779 @opindex mxy
16780 Passed down to the assembler to enable the XY memory extension. Also
16781 sets the preprocessor symbol @code{__Xxy}.
16782
16783 @end table
16784
16785 The following options control how the assembly code is annotated:
16786
16787 @c Assembly annotation options
16788 @table @gcctabopt
16789 @item -misize
16790 @opindex misize
16791 Annotate assembler instructions with estimated addresses.
16792
16793 @item -mannotate-align
16794 @opindex mannotate-align
16795 Explain what alignment considerations lead to the decision to make an
16796 instruction short or long.
16797
16798 @end table
16799
16800 The following options are passed through to the linker:
16801
16802 @c options passed through to the linker
16803 @table @gcctabopt
16804 @item -marclinux
16805 @opindex marclinux
16806 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16807 This option is enabled by default in tool chains built for
16808 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16809 when profiling is not requested.
16810
16811 @item -marclinux_prof
16812 @opindex marclinux_prof
16813 Passed through to the linker, to specify use of the
16814 @code{arclinux_prof} emulation. This option is enabled by default in
16815 tool chains built for @w{@code{arc-linux-uclibc}} and
16816 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16817
16818 @end table
16819
16820 The following options control the semantics of generated code:
16821
16822 @c semantically relevant code generation options
16823 @table @gcctabopt
16824 @item -mlong-calls
16825 @opindex mlong-calls
16826 Generate calls as register indirect calls, thus providing access
16827 to the full 32-bit address range.
16828
16829 @item -mmedium-calls
16830 @opindex mmedium-calls
16831 Don't use less than 25-bit addressing range for calls, which is the
16832 offset available for an unconditional branch-and-link
16833 instruction. Conditional execution of function calls is suppressed, to
16834 allow use of the 25-bit range, rather than the 21-bit range with
16835 conditional branch-and-link. This is the default for tool chains built
16836 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16837
16838 @item -G @var{num}
16839 @opindex G
16840 Put definitions of externally-visible data in a small data section if
16841 that data is no bigger than @var{num} bytes. The default value of
16842 @var{num} is 4 for any ARC configuration, or 8 when we have double
16843 load/store operations.
16844
16845 @item -mno-sdata
16846 @opindex mno-sdata
16847 @opindex msdata
16848 Do not generate sdata references. This is the default for tool chains
16849 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16850 targets.
16851
16852 @item -mvolatile-cache
16853 @opindex mvolatile-cache
16854 Use ordinarily cached memory accesses for volatile references. This is the
16855 default.
16856
16857 @item -mno-volatile-cache
16858 @opindex mno-volatile-cache
16859 @opindex mvolatile-cache
16860 Enable cache bypass for volatile references.
16861
16862 @end table
16863
16864 The following options fine tune code generation:
16865 @c code generation tuning options
16866 @table @gcctabopt
16867 @item -malign-call
16868 @opindex malign-call
16869 Do alignment optimizations for call instructions.
16870
16871 @item -mauto-modify-reg
16872 @opindex mauto-modify-reg
16873 Enable the use of pre/post modify with register displacement.
16874
16875 @item -mbbit-peephole
16876 @opindex mbbit-peephole
16877 Enable bbit peephole2.
16878
16879 @item -mno-brcc
16880 @opindex mno-brcc
16881 This option disables a target-specific pass in @file{arc_reorg} to
16882 generate compare-and-branch (@code{br@var{cc}}) instructions.
16883 It has no effect on
16884 generation of these instructions driven by the combiner pass.
16885
16886 @item -mcase-vector-pcrel
16887 @opindex mcase-vector-pcrel
16888 Use PC-relative switch case tables to enable case table shortening.
16889 This is the default for @option{-Os}.
16890
16891 @item -mcompact-casesi
16892 @opindex mcompact-casesi
16893 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16894 and only available for ARCv1 cores. This option is deprecated.
16895
16896 @item -mno-cond-exec
16897 @opindex mno-cond-exec
16898 Disable the ARCompact-specific pass to generate conditional
16899 execution instructions.
16900
16901 Due to delay slot scheduling and interactions between operand numbers,
16902 literal sizes, instruction lengths, and the support for conditional execution,
16903 the target-independent pass to generate conditional execution is often lacking,
16904 so the ARC port has kept a special pass around that tries to find more
16905 conditional execution generation opportunities after register allocation,
16906 branch shortening, and delay slot scheduling have been done. This pass
16907 generally, but not always, improves performance and code size, at the cost of
16908 extra compilation time, which is why there is an option to switch it off.
16909 If you have a problem with call instructions exceeding their allowable
16910 offset range because they are conditionalized, you should consider using
16911 @option{-mmedium-calls} instead.
16912
16913 @item -mearly-cbranchsi
16914 @opindex mearly-cbranchsi
16915 Enable pre-reload use of the @code{cbranchsi} pattern.
16916
16917 @item -mexpand-adddi
16918 @opindex mexpand-adddi
16919 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16920 @code{add.f}, @code{adc} etc. This option is deprecated.
16921
16922 @item -mindexed-loads
16923 @opindex mindexed-loads
16924 Enable the use of indexed loads. This can be problematic because some
16925 optimizers then assume that indexed stores exist, which is not
16926 the case.
16927
16928 @item -mlra
16929 @opindex mlra
16930 Enable Local Register Allocation. This is still experimental for ARC,
16931 so by default the compiler uses standard reload
16932 (i.e.@: @option{-mno-lra}).
16933
16934 @item -mlra-priority-none
16935 @opindex mlra-priority-none
16936 Don't indicate any priority for target registers.
16937
16938 @item -mlra-priority-compact
16939 @opindex mlra-priority-compact
16940 Indicate target register priority for r0..r3 / r12..r15.
16941
16942 @item -mlra-priority-noncompact
16943 @opindex mlra-priority-noncompact
16944 Reduce target register priority for r0..r3 / r12..r15.
16945
16946 @item -mmillicode
16947 @opindex mmillicode
16948 When optimizing for size (using @option{-Os}), prologues and epilogues
16949 that have to save or restore a large number of registers are often
16950 shortened by using call to a special function in libgcc; this is
16951 referred to as a @emph{millicode} call. As these calls can pose
16952 performance issues, and/or cause linking issues when linking in a
16953 nonstandard way, this option is provided to turn on or off millicode
16954 call generation.
16955
16956 @item -mcode-density-frame
16957 @opindex mcode-density-frame
16958 This option enable the compiler to emit @code{enter} and @code{leave}
16959 instructions. These instructions are only valid for CPUs with
16960 code-density feature.
16961
16962 @item -mmixed-code
16963 @opindex mmixed-code
16964 Tweak register allocation to help 16-bit instruction generation.
16965 This generally has the effect of decreasing the average instruction size
16966 while increasing the instruction count.
16967
16968 @item -mq-class
16969 @opindex mq-class
16970 Enable @samp{q} instruction alternatives.
16971 This is the default for @option{-Os}.
16972
16973 @item -mRcq
16974 @opindex mRcq
16975 Enable @samp{Rcq} constraint handling.
16976 Most short code generation depends on this.
16977 This is the default.
16978
16979 @item -mRcw
16980 @opindex mRcw
16981 Enable @samp{Rcw} constraint handling.
16982 Most ccfsm condexec mostly depends on this.
16983 This is the default.
16984
16985 @item -msize-level=@var{level}
16986 @opindex msize-level
16987 Fine-tune size optimization with regards to instruction lengths and alignment.
16988 The recognized values for @var{level} are:
16989 @table @samp
16990 @item 0
16991 No size optimization. This level is deprecated and treated like @samp{1}.
16992
16993 @item 1
16994 Short instructions are used opportunistically.
16995
16996 @item 2
16997 In addition, alignment of loops and of code after barriers are dropped.
16998
16999 @item 3
17000 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
17001
17002 @end table
17003
17004 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
17005 the behavior when this is not set is equivalent to level @samp{1}.
17006
17007 @item -mtune=@var{cpu}
17008 @opindex mtune
17009 Set instruction scheduling parameters for @var{cpu}, overriding any implied
17010 by @option{-mcpu=}.
17011
17012 Supported values for @var{cpu} are
17013
17014 @table @samp
17015 @item ARC600
17016 Tune for ARC600 CPU.
17017
17018 @item ARC601
17019 Tune for ARC601 CPU.
17020
17021 @item ARC700
17022 Tune for ARC700 CPU with standard multiplier block.
17023
17024 @item ARC700-xmac
17025 Tune for ARC700 CPU with XMAC block.
17026
17027 @item ARC725D
17028 Tune for ARC725D CPU.
17029
17030 @item ARC750D
17031 Tune for ARC750D CPU.
17032
17033 @end table
17034
17035 @item -mmultcost=@var{num}
17036 @opindex mmultcost
17037 Cost to assume for a multiply instruction, with @samp{4} being equal to a
17038 normal instruction.
17039
17040 @item -munalign-prob-threshold=@var{probability}
17041 @opindex munalign-prob-threshold
17042 Set probability threshold for unaligning branches.
17043 When tuning for @samp{ARC700} and optimizing for speed, branches without
17044 filled delay slot are preferably emitted unaligned and long, unless
17045 profiling indicates that the probability for the branch to be taken
17046 is below @var{probability}. @xref{Cross-profiling}.
17047 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
17048
17049 @end table
17050
17051 The following options are maintained for backward compatibility, but
17052 are now deprecated and will be removed in a future release:
17053
17054 @c Deprecated options
17055 @table @gcctabopt
17056
17057 @item -margonaut
17058 @opindex margonaut
17059 Obsolete FPX.
17060
17061 @item -mbig-endian
17062 @opindex mbig-endian
17063 @itemx -EB
17064 @opindex EB
17065 Compile code for big-endian targets. Use of these options is now
17066 deprecated. Big-endian code is supported by configuring GCC to build
17067 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17068 for which big endian is the default.
17069
17070 @item -mlittle-endian
17071 @opindex mlittle-endian
17072 @itemx -EL
17073 @opindex EL
17074 Compile code for little-endian targets. Use of these options is now
17075 deprecated. Little-endian code is supported by configuring GCC to build
17076 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17077 for which little endian is the default.
17078
17079 @item -mbarrel_shifter
17080 @opindex mbarrel_shifter
17081 Replaced by @option{-mbarrel-shifter}.
17082
17083 @item -mdpfp_compact
17084 @opindex mdpfp_compact
17085 Replaced by @option{-mdpfp-compact}.
17086
17087 @item -mdpfp_fast
17088 @opindex mdpfp_fast
17089 Replaced by @option{-mdpfp-fast}.
17090
17091 @item -mdsp_packa
17092 @opindex mdsp_packa
17093 Replaced by @option{-mdsp-packa}.
17094
17095 @item -mEA
17096 @opindex mEA
17097 Replaced by @option{-mea}.
17098
17099 @item -mmac_24
17100 @opindex mmac_24
17101 Replaced by @option{-mmac-24}.
17102
17103 @item -mmac_d16
17104 @opindex mmac_d16
17105 Replaced by @option{-mmac-d16}.
17106
17107 @item -mspfp_compact
17108 @opindex mspfp_compact
17109 Replaced by @option{-mspfp-compact}.
17110
17111 @item -mspfp_fast
17112 @opindex mspfp_fast
17113 Replaced by @option{-mspfp-fast}.
17114
17115 @item -mtune=@var{cpu}
17116 @opindex mtune
17117 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17118 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17119 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17120
17121 @item -multcost=@var{num}
17122 @opindex multcost
17123 Replaced by @option{-mmultcost}.
17124
17125 @end table
17126
17127 @node ARM Options
17128 @subsection ARM Options
17129 @cindex ARM options
17130
17131 These @samp{-m} options are defined for the ARM port:
17132
17133 @table @gcctabopt
17134 @item -mabi=@var{name}
17135 @opindex mabi
17136 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17137 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17138
17139 @item -mapcs-frame
17140 @opindex mapcs-frame
17141 Generate a stack frame that is compliant with the ARM Procedure Call
17142 Standard for all functions, even if this is not strictly necessary for
17143 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17144 with this option causes the stack frames not to be generated for
17145 leaf functions. The default is @option{-mno-apcs-frame}.
17146 This option is deprecated.
17147
17148 @item -mapcs
17149 @opindex mapcs
17150 This is a synonym for @option{-mapcs-frame} and is deprecated.
17151
17152 @ignore
17153 @c not currently implemented
17154 @item -mapcs-stack-check
17155 @opindex mapcs-stack-check
17156 Generate code to check the amount of stack space available upon entry to
17157 every function (that actually uses some stack space). If there is
17158 insufficient space available then either the function
17159 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17160 called, depending upon the amount of stack space required. The runtime
17161 system is required to provide these functions. The default is
17162 @option{-mno-apcs-stack-check}, since this produces smaller code.
17163
17164 @c not currently implemented
17165 @item -mapcs-reentrant
17166 @opindex mapcs-reentrant
17167 Generate reentrant, position-independent code. The default is
17168 @option{-mno-apcs-reentrant}.
17169 @end ignore
17170
17171 @item -mthumb-interwork
17172 @opindex mthumb-interwork
17173 Generate code that supports calling between the ARM and Thumb
17174 instruction sets. Without this option, on pre-v5 architectures, the
17175 two instruction sets cannot be reliably used inside one program. The
17176 default is @option{-mno-thumb-interwork}, since slightly larger code
17177 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17178 configurations this option is meaningless.
17179
17180 @item -mno-sched-prolog
17181 @opindex mno-sched-prolog
17182 @opindex msched-prolog
17183 Prevent the reordering of instructions in the function prologue, or the
17184 merging of those instruction with the instructions in the function's
17185 body. This means that all functions start with a recognizable set
17186 of instructions (or in fact one of a choice from a small set of
17187 different function prologues), and this information can be used to
17188 locate the start of functions inside an executable piece of code. The
17189 default is @option{-msched-prolog}.
17190
17191 @item -mfloat-abi=@var{name}
17192 @opindex mfloat-abi
17193 Specifies which floating-point ABI to use. Permissible values
17194 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17195
17196 Specifying @samp{soft} causes GCC to generate output containing
17197 library calls for floating-point operations.
17198 @samp{softfp} allows the generation of code using hardware floating-point
17199 instructions, but still uses the soft-float calling conventions.
17200 @samp{hard} allows generation of floating-point instructions
17201 and uses FPU-specific calling conventions.
17202
17203 The default depends on the specific target configuration. Note that
17204 the hard-float and soft-float ABIs are not link-compatible; you must
17205 compile your entire program with the same ABI, and link with a
17206 compatible set of libraries.
17207
17208 @item -mgeneral-regs-only
17209 @opindex mgeneral-regs-only
17210 Generate code which uses only the general-purpose registers. This will prevent
17211 the compiler from using floating-point and Advanced SIMD registers but will not
17212 impose any restrictions on the assembler.
17213
17214 @item -mlittle-endian
17215 @opindex mlittle-endian
17216 Generate code for a processor running in little-endian mode. This is
17217 the default for all standard configurations.
17218
17219 @item -mbig-endian
17220 @opindex mbig-endian
17221 Generate code for a processor running in big-endian mode; the default is
17222 to compile code for a little-endian processor.
17223
17224 @item -mbe8
17225 @itemx -mbe32
17226 @opindex mbe8
17227 When linking a big-endian image select between BE8 and BE32 formats.
17228 The option has no effect for little-endian images and is ignored. The
17229 default is dependent on the selected target architecture. For ARMv6
17230 and later architectures the default is BE8, for older architectures
17231 the default is BE32. BE32 format has been deprecated by ARM.
17232
17233 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17234 @opindex march
17235 This specifies the name of the target ARM architecture. GCC uses this
17236 name to determine what kind of instructions it can emit when generating
17237 assembly code. This option can be used in conjunction with or instead
17238 of the @option{-mcpu=} option.
17239
17240 Permissible names are:
17241 @samp{armv4t},
17242 @samp{armv5t}, @samp{armv5te},
17243 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17244 @samp{armv6z}, @samp{armv6zk},
17245 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17246 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17247 @samp{armv8.4-a},
17248 @samp{armv8.5-a},
17249 @samp{armv7-r},
17250 @samp{armv8-r},
17251 @samp{armv6-m}, @samp{armv6s-m},
17252 @samp{armv7-m}, @samp{armv7e-m},
17253 @samp{armv8-m.base}, @samp{armv8-m.main},
17254 @samp{iwmmxt} and @samp{iwmmxt2}.
17255
17256 Additionally, the following architectures, which lack support for the
17257 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17258
17259 Many of the architectures support extensions. These can be added by
17260 appending @samp{+@var{extension}} to the architecture name. Extension
17261 options are processed in order and capabilities accumulate. An extension
17262 will also enable any necessary base extensions
17263 upon which it depends. For example, the @samp{+crypto} extension
17264 will always enable the @samp{+simd} extension. The exception to the
17265 additive construction is for extensions that are prefixed with
17266 @samp{+no@dots{}}: these extensions disable the specified option and
17267 any other extensions that may depend on the presence of that
17268 extension.
17269
17270 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17271 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17272 entirely disabled by the @samp{+nofp} option that follows it.
17273
17274 Most extension names are generically named, but have an effect that is
17275 dependent upon the architecture to which it is applied. For example,
17276 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17277 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17278 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17279 variant for @samp{armv8-a}.
17280
17281 The table below lists the supported extensions for each architecture.
17282 Architectures not mentioned do not support any extensions.
17283
17284 @table @samp
17285 @item armv5te
17286 @itemx armv6
17287 @itemx armv6j
17288 @itemx armv6k
17289 @itemx armv6kz
17290 @itemx armv6t2
17291 @itemx armv6z
17292 @itemx armv6zk
17293 @table @samp
17294 @item +fp
17295 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17296 used as an alias for this extension.
17297
17298 @item +nofp
17299 Disable the floating-point instructions.
17300 @end table
17301
17302 @item armv7
17303 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17304 @table @samp
17305 @item +fp
17306 The VFPv3 floating-point instructions, with 16 double-precision
17307 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17308 for this extension. Note that floating-point is not supported by the
17309 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17310 ARMv7-R architectures.
17311
17312 @item +nofp
17313 Disable the floating-point instructions.
17314 @end table
17315
17316 @item armv7-a
17317 @table @samp
17318 @item +mp
17319 The multiprocessing extension.
17320
17321 @item +sec
17322 The security extension.
17323
17324 @item +fp
17325 The VFPv3 floating-point instructions, with 16 double-precision
17326 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17327 for this extension.
17328
17329 @item +simd
17330 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17331 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17332 for this extension.
17333
17334 @item +vfpv3
17335 The VFPv3 floating-point instructions, with 32 double-precision
17336 registers.
17337
17338 @item +vfpv3-d16-fp16
17339 The VFPv3 floating-point instructions, with 16 double-precision
17340 registers and the half-precision floating-point conversion operations.
17341
17342 @item +vfpv3-fp16
17343 The VFPv3 floating-point instructions, with 32 double-precision
17344 registers and the half-precision floating-point conversion operations.
17345
17346 @item +vfpv4-d16
17347 The VFPv4 floating-point instructions, with 16 double-precision
17348 registers.
17349
17350 @item +vfpv4
17351 The VFPv4 floating-point instructions, with 32 double-precision
17352 registers.
17353
17354 @item +neon-fp16
17355 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17356 the half-precision floating-point conversion operations.
17357
17358 @item +neon-vfpv4
17359 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17360
17361 @item +nosimd
17362 Disable the Advanced SIMD instructions (does not disable floating point).
17363
17364 @item +nofp
17365 Disable the floating-point and Advanced SIMD instructions.
17366 @end table
17367
17368 @item armv7ve
17369 The extended version of the ARMv7-A architecture with support for
17370 virtualization.
17371 @table @samp
17372 @item +fp
17373 The VFPv4 floating-point instructions, with 16 double-precision registers.
17374 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17375
17376 @item +simd
17377 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17378 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17379
17380 @item +vfpv3-d16
17381 The VFPv3 floating-point instructions, with 16 double-precision
17382 registers.
17383
17384 @item +vfpv3
17385 The VFPv3 floating-point instructions, with 32 double-precision
17386 registers.
17387
17388 @item +vfpv3-d16-fp16
17389 The VFPv3 floating-point instructions, with 16 double-precision
17390 registers and the half-precision floating-point conversion operations.
17391
17392 @item +vfpv3-fp16
17393 The VFPv3 floating-point instructions, with 32 double-precision
17394 registers and the half-precision floating-point conversion operations.
17395
17396 @item +vfpv4-d16
17397 The VFPv4 floating-point instructions, with 16 double-precision
17398 registers.
17399
17400 @item +vfpv4
17401 The VFPv4 floating-point instructions, with 32 double-precision
17402 registers.
17403
17404 @item +neon
17405 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17406 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17407
17408 @item +neon-fp16
17409 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17410 the half-precision floating-point conversion operations.
17411
17412 @item +nosimd
17413 Disable the Advanced SIMD instructions (does not disable floating point).
17414
17415 @item +nofp
17416 Disable the floating-point and Advanced SIMD instructions.
17417 @end table
17418
17419 @item armv8-a
17420 @table @samp
17421 @item +crc
17422 The Cyclic Redundancy Check (CRC) instructions.
17423 @item +simd
17424 The ARMv8-A Advanced SIMD and floating-point instructions.
17425 @item +crypto
17426 The cryptographic instructions.
17427 @item +nocrypto
17428 Disable the cryptographic instructions.
17429 @item +nofp
17430 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17431 @item +sb
17432 Speculation Barrier Instruction.
17433 @item +predres
17434 Execution and Data Prediction Restriction Instructions.
17435 @end table
17436
17437 @item armv8.1-a
17438 @table @samp
17439 @item +simd
17440 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17441
17442 @item +crypto
17443 The cryptographic instructions. This also enables the Advanced SIMD and
17444 floating-point instructions.
17445
17446 @item +nocrypto
17447 Disable the cryptographic instructions.
17448
17449 @item +nofp
17450 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17451
17452 @item +sb
17453 Speculation Barrier Instruction.
17454
17455 @item +predres
17456 Execution and Data Prediction Restriction Instructions.
17457 @end table
17458
17459 @item armv8.2-a
17460 @itemx armv8.3-a
17461 @table @samp
17462 @item +fp16
17463 The half-precision floating-point data processing instructions.
17464 This also enables the Advanced SIMD and floating-point instructions.
17465
17466 @item +fp16fml
17467 The half-precision floating-point fmla extension. This also enables
17468 the half-precision floating-point extension and Advanced SIMD and
17469 floating-point instructions.
17470
17471 @item +simd
17472 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17473
17474 @item +crypto
17475 The cryptographic instructions. This also enables the Advanced SIMD and
17476 floating-point instructions.
17477
17478 @item +dotprod
17479 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17480
17481 @item +nocrypto
17482 Disable the cryptographic extension.
17483
17484 @item +nofp
17485 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17486
17487 @item +sb
17488 Speculation Barrier Instruction.
17489
17490 @item +predres
17491 Execution and Data Prediction Restriction Instructions.
17492 @end table
17493
17494 @item armv8.4-a
17495 @table @samp
17496 @item +fp16
17497 The half-precision floating-point data processing instructions.
17498 This also enables the Advanced SIMD and floating-point instructions as well
17499 as the Dot Product extension and the half-precision floating-point fmla
17500 extension.
17501
17502 @item +simd
17503 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17504 Dot Product extension.
17505
17506 @item +crypto
17507 The cryptographic instructions. This also enables the Advanced SIMD and
17508 floating-point instructions as well as the Dot Product extension.
17509
17510 @item +nocrypto
17511 Disable the cryptographic extension.
17512
17513 @item +nofp
17514 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17515
17516 @item +sb
17517 Speculation Barrier Instruction.
17518
17519 @item +predres
17520 Execution and Data Prediction Restriction Instructions.
17521 @end table
17522
17523 @item armv8.5-a
17524 @table @samp
17525 @item +fp16
17526 The half-precision floating-point data processing instructions.
17527 This also enables the Advanced SIMD and floating-point instructions as well
17528 as the Dot Product extension and the half-precision floating-point fmla
17529 extension.
17530
17531 @item +simd
17532 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17533 Dot Product extension.
17534
17535 @item +crypto
17536 The cryptographic instructions. This also enables the Advanced SIMD and
17537 floating-point instructions as well as the Dot Product extension.
17538
17539 @item +nocrypto
17540 Disable the cryptographic extension.
17541
17542 @item +nofp
17543 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17544 @end table
17545
17546 @item armv7-r
17547 @table @samp
17548 @item +fp.sp
17549 The single-precision VFPv3 floating-point instructions. The extension
17550 @samp{+vfpv3xd} can be used as an alias for this extension.
17551
17552 @item +fp
17553 The VFPv3 floating-point instructions with 16 double-precision registers.
17554 The extension +vfpv3-d16 can be used as an alias for this extension.
17555
17556 @item +vfpv3xd-d16-fp16
17557 The single-precision VFPv3 floating-point instructions with 16 double-precision
17558 registers and the half-precision floating-point conversion operations.
17559
17560 @item +vfpv3-d16-fp16
17561 The VFPv3 floating-point instructions with 16 double-precision
17562 registers and the half-precision floating-point conversion operations.
17563
17564 @item +nofp
17565 Disable the floating-point extension.
17566
17567 @item +idiv
17568 The ARM-state integer division instructions.
17569
17570 @item +noidiv
17571 Disable the ARM-state integer division extension.
17572 @end table
17573
17574 @item armv7e-m
17575 @table @samp
17576 @item +fp
17577 The single-precision VFPv4 floating-point instructions.
17578
17579 @item +fpv5
17580 The single-precision FPv5 floating-point instructions.
17581
17582 @item +fp.dp
17583 The single- and double-precision FPv5 floating-point instructions.
17584
17585 @item +nofp
17586 Disable the floating-point extensions.
17587 @end table
17588
17589 @item armv8-m.main
17590 @table @samp
17591 @item +dsp
17592 The DSP instructions.
17593
17594 @item +nodsp
17595 Disable the DSP extension.
17596
17597 @item +fp
17598 The single-precision floating-point instructions.
17599
17600 @item +fp.dp
17601 The single- and double-precision floating-point instructions.
17602
17603 @item +nofp
17604 Disable the floating-point extension.
17605 @end table
17606
17607 @item armv8-r
17608 @table @samp
17609 @item +crc
17610 The Cyclic Redundancy Check (CRC) instructions.
17611 @item +fp.sp
17612 The single-precision FPv5 floating-point instructions.
17613 @item +simd
17614 The ARMv8-A Advanced SIMD and floating-point instructions.
17615 @item +crypto
17616 The cryptographic instructions.
17617 @item +nocrypto
17618 Disable the cryptographic instructions.
17619 @item +nofp
17620 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17621 @end table
17622
17623 @end table
17624
17625 @option{-march=native} causes the compiler to auto-detect the architecture
17626 of the build computer. At present, this feature is only supported on
17627 GNU/Linux, and not all architectures are recognized. If the auto-detect
17628 is unsuccessful the option has no effect.
17629
17630 @item -mtune=@var{name}
17631 @opindex mtune
17632 This option specifies the name of the target ARM processor for
17633 which GCC should tune the performance of the code.
17634 For some ARM implementations better performance can be obtained by using
17635 this option.
17636 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17637 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17638 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17639 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17640 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17641 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17642 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17643 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17644 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17645 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17646 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17647 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17648 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17649 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17650 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17651 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17652 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17653 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17654 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17655 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17656 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17657 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17658
17659 Additionally, this option can specify that GCC should tune the performance
17660 of the code for a big.LITTLE system. Permissible names are:
17661 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17662 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17663 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17664 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17665
17666 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17667 performance for a blend of processors within architecture @var{arch}.
17668 The aim is to generate code that run well on the current most popular
17669 processors, balancing between optimizations that benefit some CPUs in the
17670 range, and avoiding performance pitfalls of other CPUs. The effects of
17671 this option may change in future GCC versions as CPU models come and go.
17672
17673 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17674 the extension options do not affect the tuning of the generated code.
17675
17676 @option{-mtune=native} causes the compiler to auto-detect the CPU
17677 of the build computer. At present, this feature is only supported on
17678 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17679 unsuccessful the option has no effect.
17680
17681 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17682 @opindex mcpu
17683 This specifies the name of the target ARM processor. GCC uses this name
17684 to derive the name of the target ARM architecture (as if specified
17685 by @option{-march}) and the ARM processor type for which to tune for
17686 performance (as if specified by @option{-mtune}). Where this option
17687 is used in conjunction with @option{-march} or @option{-mtune},
17688 those options take precedence over the appropriate part of this option.
17689
17690 Many of the supported CPUs implement optional architectural
17691 extensions. Where this is so the architectural extensions are
17692 normally enabled by default. If implementations that lack the
17693 extension exist, then the extension syntax can be used to disable
17694 those extensions that have been omitted. For floating-point and
17695 Advanced SIMD (Neon) instructions, the settings of the options
17696 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17697 floating-point and Advanced SIMD instructions will only be used if
17698 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17699 @option{-mfpu} other than @samp{auto} will override the available
17700 floating-point and SIMD extension instructions.
17701
17702 For example, @samp{cortex-a9} can be found in three major
17703 configurations: integer only, with just a floating-point unit or with
17704 floating-point and Advanced SIMD. The default is to enable all the
17705 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17706 be used to disable just the SIMD or both the SIMD and floating-point
17707 instructions respectively.
17708
17709 Permissible names for this option are the same as those for
17710 @option{-mtune}.
17711
17712 The following extension options are common to the listed CPUs:
17713
17714 @table @samp
17715 @item +nodsp
17716 Disable the DSP instructions on @samp{cortex-m33}.
17717
17718 @item +nofp
17719 Disables the floating-point instructions on @samp{arm9e},
17720 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17721 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17722 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17723 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17724 Disables the floating-point and SIMD instructions on
17725 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17726 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17727 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17728 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17729 @samp{cortex-a53} and @samp{cortex-a55}.
17730
17731 @item +nofp.dp
17732 Disables the double-precision component of the floating-point instructions
17733 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17734 @samp{cortex-m7}.
17735
17736 @item +nosimd
17737 Disables the SIMD (but not floating-point) instructions on
17738 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17739 and @samp{cortex-a9}.
17740
17741 @item +crypto
17742 Enables the cryptographic instructions on @samp{cortex-a32},
17743 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17744 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17745 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17746 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17747 @samp{cortex-a75.cortex-a55}.
17748 @end table
17749
17750 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17751 VFPv3 with 16 double-precision registers. It supports the following
17752 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17753 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17754 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17755 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17756 the extensions to @option{-march=armv7-a}.
17757
17758 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17759 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17760 See @option{-mtune} for more information.
17761
17762 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17763 of the build computer. At present, this feature is only supported on
17764 GNU/Linux, and not all architectures are recognized. If the auto-detect
17765 is unsuccessful the option has no effect.
17766
17767 @item -mfpu=@var{name}
17768 @opindex mfpu
17769 This specifies what floating-point hardware (or hardware emulation) is
17770 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17771 @samp{vfpv3},
17772 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17773 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17774 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17775 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17776 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17777 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17778 is an alias for @samp{vfpv2}.
17779
17780 The setting @samp{auto} is the default and is special. It causes the
17781 compiler to select the floating-point and Advanced SIMD instructions
17782 based on the settings of @option{-mcpu} and @option{-march}.
17783
17784 If the selected floating-point hardware includes the NEON extension
17785 (e.g.@: @option{-mfpu=neon}), note that floating-point
17786 operations are not generated by GCC's auto-vectorization pass unless
17787 @option{-funsafe-math-optimizations} is also specified. This is
17788 because NEON hardware does not fully implement the IEEE 754 standard for
17789 floating-point arithmetic (in particular denormal values are treated as
17790 zero), so the use of NEON instructions may lead to a loss of precision.
17791
17792 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}).
17793
17794 @item -mfp16-format=@var{name}
17795 @opindex mfp16-format
17796 Specify the format of the @code{__fp16} half-precision floating-point type.
17797 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17798 the default is @samp{none}, in which case the @code{__fp16} type is not
17799 defined. @xref{Half-Precision}, for more information.
17800
17801 @item -mstructure-size-boundary=@var{n}
17802 @opindex mstructure-size-boundary
17803 The sizes of all structures and unions are rounded up to a multiple
17804 of the number of bits set by this option. Permissible values are 8, 32
17805 and 64. The default value varies for different toolchains. For the COFF
17806 targeted toolchain the default value is 8. A value of 64 is only allowed
17807 if the underlying ABI supports it.
17808
17809 Specifying a larger number can produce faster, more efficient code, but
17810 can also increase the size of the program. Different values are potentially
17811 incompatible. Code compiled with one value cannot necessarily expect to
17812 work with code or libraries compiled with another value, if they exchange
17813 information using structures or unions.
17814
17815 This option is deprecated.
17816
17817 @item -mabort-on-noreturn
17818 @opindex mabort-on-noreturn
17819 Generate a call to the function @code{abort} at the end of a
17820 @code{noreturn} function. It is executed if the function tries to
17821 return.
17822
17823 @item -mlong-calls
17824 @itemx -mno-long-calls
17825 @opindex mlong-calls
17826 @opindex mno-long-calls
17827 Tells the compiler to perform function calls by first loading the
17828 address of the function into a register and then performing a subroutine
17829 call on this register. This switch is needed if the target function
17830 lies outside of the 64-megabyte addressing range of the offset-based
17831 version of subroutine call instruction.
17832
17833 Even if this switch is enabled, not all function calls are turned
17834 into long calls. The heuristic is that static functions, functions
17835 that have the @code{short_call} attribute, functions that are inside
17836 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17837 definitions have already been compiled within the current compilation
17838 unit are not turned into long calls. The exceptions to this rule are
17839 that weak function definitions, functions with the @code{long_call}
17840 attribute or the @code{section} attribute, and functions that are within
17841 the scope of a @code{#pragma long_calls} directive are always
17842 turned into long calls.
17843
17844 This feature is not enabled by default. Specifying
17845 @option{-mno-long-calls} restores the default behavior, as does
17846 placing the function calls within the scope of a @code{#pragma
17847 long_calls_off} directive. Note these switches have no effect on how
17848 the compiler generates code to handle function calls via function
17849 pointers.
17850
17851 @item -msingle-pic-base
17852 @opindex msingle-pic-base
17853 Treat the register used for PIC addressing as read-only, rather than
17854 loading it in the prologue for each function. The runtime system is
17855 responsible for initializing this register with an appropriate value
17856 before execution begins.
17857
17858 @item -mpic-register=@var{reg}
17859 @opindex mpic-register
17860 Specify the register to be used for PIC addressing.
17861 For standard PIC base case, the default is any suitable register
17862 determined by compiler. For single PIC base case, the default is
17863 @samp{R9} if target is EABI based or stack-checking is enabled,
17864 otherwise the default is @samp{R10}.
17865
17866 @item -mpic-data-is-text-relative
17867 @opindex mpic-data-is-text-relative
17868 Assume that the displacement between the text and data segments is fixed
17869 at static link time. This permits using PC-relative addressing
17870 operations to access data known to be in the data segment. For
17871 non-VxWorks RTP targets, this option is enabled by default. When
17872 disabled on such targets, it will enable @option{-msingle-pic-base} by
17873 default.
17874
17875 @item -mpoke-function-name
17876 @opindex mpoke-function-name
17877 Write the name of each function into the text section, directly
17878 preceding the function prologue. The generated code is similar to this:
17879
17880 @smallexample
17881 t0
17882 .ascii "arm_poke_function_name", 0
17883 .align
17884 t1
17885 .word 0xff000000 + (t1 - t0)
17886 arm_poke_function_name
17887 mov ip, sp
17888 stmfd sp!, @{fp, ip, lr, pc@}
17889 sub fp, ip, #4
17890 @end smallexample
17891
17892 When performing a stack backtrace, code can inspect the value of
17893 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17894 location @code{pc - 12} and the top 8 bits are set, then we know that
17895 there is a function name embedded immediately preceding this location
17896 and has length @code{((pc[-3]) & 0xff000000)}.
17897
17898 @item -mthumb
17899 @itemx -marm
17900 @opindex marm
17901 @opindex mthumb
17902
17903 Select between generating code that executes in ARM and Thumb
17904 states. The default for most configurations is to generate code
17905 that executes in ARM state, but the default can be changed by
17906 configuring GCC with the @option{--with-mode=}@var{state}
17907 configure option.
17908
17909 You can also override the ARM and Thumb mode for each function
17910 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17911 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17912
17913 @item -mflip-thumb
17914 @opindex mflip-thumb
17915 Switch ARM/Thumb modes on alternating functions.
17916 This option is provided for regression testing of mixed Thumb/ARM code
17917 generation, and is not intended for ordinary use in compiling code.
17918
17919 @item -mtpcs-frame
17920 @opindex mtpcs-frame
17921 Generate a stack frame that is compliant with the Thumb Procedure Call
17922 Standard for all non-leaf functions. (A leaf function is one that does
17923 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17924
17925 @item -mtpcs-leaf-frame
17926 @opindex mtpcs-leaf-frame
17927 Generate a stack frame that is compliant with the Thumb Procedure Call
17928 Standard for all leaf functions. (A leaf function is one that does
17929 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17930
17931 @item -mcallee-super-interworking
17932 @opindex mcallee-super-interworking
17933 Gives all externally visible functions in the file being compiled an ARM
17934 instruction set header which switches to Thumb mode before executing the
17935 rest of the function. This allows these functions to be called from
17936 non-interworking code. This option is not valid in AAPCS configurations
17937 because interworking is enabled by default.
17938
17939 @item -mcaller-super-interworking
17940 @opindex mcaller-super-interworking
17941 Allows calls via function pointers (including virtual functions) to
17942 execute correctly regardless of whether the target code has been
17943 compiled for interworking or not. There is a small overhead in the cost
17944 of executing a function pointer if this option is enabled. This option
17945 is not valid in AAPCS configurations because interworking is enabled
17946 by default.
17947
17948 @item -mtp=@var{name}
17949 @opindex mtp
17950 Specify the access model for the thread local storage pointer. The valid
17951 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17952 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17953 (supported in the arm6k architecture), and @samp{auto}, which uses the
17954 best available method for the selected processor. The default setting is
17955 @samp{auto}.
17956
17957 @item -mtls-dialect=@var{dialect}
17958 @opindex mtls-dialect
17959 Specify the dialect to use for accessing thread local storage. Two
17960 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17961 @samp{gnu} dialect selects the original GNU scheme for supporting
17962 local and global dynamic TLS models. The @samp{gnu2} dialect
17963 selects the GNU descriptor scheme, which provides better performance
17964 for shared libraries. The GNU descriptor scheme is compatible with
17965 the original scheme, but does require new assembler, linker and
17966 library support. Initial and local exec TLS models are unaffected by
17967 this option and always use the original scheme.
17968
17969 @item -mword-relocations
17970 @opindex mword-relocations
17971 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17972 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17973 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17974 is specified. This option conflicts with @option{-mslow-flash-data}.
17975
17976 @item -mfix-cortex-m3-ldrd
17977 @opindex mfix-cortex-m3-ldrd
17978 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17979 with overlapping destination and base registers are used. This option avoids
17980 generating these instructions. This option is enabled by default when
17981 @option{-mcpu=cortex-m3} is specified.
17982
17983 @item -munaligned-access
17984 @itemx -mno-unaligned-access
17985 @opindex munaligned-access
17986 @opindex mno-unaligned-access
17987 Enables (or disables) reading and writing of 16- and 32- bit values
17988 from addresses that are not 16- or 32- bit aligned. By default
17989 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17990 ARMv8-M Baseline architectures, and enabled for all other
17991 architectures. If unaligned access is not enabled then words in packed
17992 data structures are accessed a byte at a time.
17993
17994 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17995 generated object file to either true or false, depending upon the
17996 setting of this option. If unaligned access is enabled then the
17997 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17998 defined.
17999
18000 @item -mneon-for-64bits
18001 @opindex mneon-for-64bits
18002 Enables using Neon to handle scalar 64-bits operations. This is
18003 disabled by default since the cost of moving data from core registers
18004 to Neon is high.
18005
18006 @item -mslow-flash-data
18007 @opindex mslow-flash-data
18008 Assume loading data from flash is slower than fetching instruction.
18009 Therefore literal load is minimized for better performance.
18010 This option is only supported when compiling for ARMv7 M-profile and
18011 off by default. It conflicts with @option{-mword-relocations}.
18012
18013 @item -masm-syntax-unified
18014 @opindex masm-syntax-unified
18015 Assume inline assembler is using unified asm syntax. The default is
18016 currently off which implies divided syntax. This option has no impact
18017 on Thumb2. However, this may change in future releases of GCC.
18018 Divided syntax should be considered deprecated.
18019
18020 @item -mrestrict-it
18021 @opindex mrestrict-it
18022 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
18023 IT blocks can only contain a single 16-bit instruction from a select
18024 set of instructions. This option is on by default for ARMv8-A Thumb mode.
18025
18026 @item -mprint-tune-info
18027 @opindex mprint-tune-info
18028 Print CPU tuning information as comment in assembler file. This is
18029 an option used only for regression testing of the compiler and not
18030 intended for ordinary use in compiling code. This option is disabled
18031 by default.
18032
18033 @item -mverbose-cost-dump
18034 @opindex mverbose-cost-dump
18035 Enable verbose cost model dumping in the debug dump files. This option is
18036 provided for use in debugging the compiler.
18037
18038 @item -mpure-code
18039 @opindex mpure-code
18040 Do not allow constant data to be placed in code sections.
18041 Additionally, when compiling for ELF object format give all text sections the
18042 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
18043 is only available when generating non-pic code for M-profile targets with the
18044 MOVT instruction.
18045
18046 @item -mcmse
18047 @opindex mcmse
18048 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
18049 Development Tools Engineering Specification", which can be found on
18050 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
18051 @end table
18052
18053 @node AVR Options
18054 @subsection AVR Options
18055 @cindex AVR Options
18056
18057 These options are defined for AVR implementations:
18058
18059 @table @gcctabopt
18060 @item -mmcu=@var{mcu}
18061 @opindex mmcu
18062 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18063
18064 The default for this option is@tie{}@samp{avr2}.
18065
18066 GCC supports the following AVR devices and ISAs:
18067
18068 @include avr-mmcu.texi
18069
18070 @item -mabsdata
18071 @opindex mabsdata
18072
18073 Assume that all data in static storage can be accessed by LDS / STS
18074 instructions. This option has only an effect on reduced Tiny devices like
18075 ATtiny40. See also the @code{absdata}
18076 @ref{AVR Variable Attributes,variable attribute}.
18077
18078 @item -maccumulate-args
18079 @opindex maccumulate-args
18080 Accumulate outgoing function arguments and acquire/release the needed
18081 stack space for outgoing function arguments once in function
18082 prologue/epilogue. Without this option, outgoing arguments are pushed
18083 before calling a function and popped afterwards.
18084
18085 Popping the arguments after the function call can be expensive on
18086 AVR so that accumulating the stack space might lead to smaller
18087 executables because arguments need not be removed from the
18088 stack after such a function call.
18089
18090 This option can lead to reduced code size for functions that perform
18091 several calls to functions that get their arguments on the stack like
18092 calls to printf-like functions.
18093
18094 @item -mbranch-cost=@var{cost}
18095 @opindex mbranch-cost
18096 Set the branch costs for conditional branch instructions to
18097 @var{cost}. Reasonable values for @var{cost} are small, non-negative
18098 integers. The default branch cost is 0.
18099
18100 @item -mcall-prologues
18101 @opindex mcall-prologues
18102 Functions prologues/epilogues are expanded as calls to appropriate
18103 subroutines. Code size is smaller.
18104
18105 @item -mgas-isr-prologues
18106 @opindex mgas-isr-prologues
18107 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18108 instruction supported by GNU Binutils.
18109 If this option is on, the feature can still be disabled for individual
18110 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18111 function attribute. This feature is activated per default
18112 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18113 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18114
18115 @item -mint8
18116 @opindex mint8
18117 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18118 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18119 and @code{long long} is 4 bytes. Please note that this option does not
18120 conform to the C standards, but it results in smaller code
18121 size.
18122
18123 @item -mmain-is-OS_task
18124 @opindex mmain-is-OS_task
18125 Do not save registers in @code{main}. The effect is the same like
18126 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18127 to @code{main}. It is activated per default if optimization is on.
18128
18129 @item -mn-flash=@var{num}
18130 @opindex mn-flash
18131 Assume that the flash memory has a size of
18132 @var{num} times 64@tie{}KiB.
18133
18134 @item -mno-interrupts
18135 @opindex mno-interrupts
18136 Generated code is not compatible with hardware interrupts.
18137 Code size is smaller.
18138
18139 @item -mrelax
18140 @opindex mrelax
18141 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18142 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18143 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18144 the assembler's command line and the @option{--relax} option to the
18145 linker's command line.
18146
18147 Jump relaxing is performed by the linker because jump offsets are not
18148 known before code is located. Therefore, the assembler code generated by the
18149 compiler is the same, but the instructions in the executable may
18150 differ from instructions in the assembler code.
18151
18152 Relaxing must be turned on if linker stubs are needed, see the
18153 section on @code{EIND} and linker stubs below.
18154
18155 @item -mrmw
18156 @opindex mrmw
18157 Assume that the device supports the Read-Modify-Write
18158 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18159
18160 @item -mshort-calls
18161 @opindex mshort-calls
18162
18163 Assume that @code{RJMP} and @code{RCALL} can target the whole
18164 program memory.
18165
18166 This option is used internally for multilib selection. It is
18167 not an optimization option, and you don't need to set it by hand.
18168
18169 @item -msp8
18170 @opindex msp8
18171 Treat the stack pointer register as an 8-bit register,
18172 i.e.@: assume the high byte of the stack pointer is zero.
18173 In general, you don't need to set this option by hand.
18174
18175 This option is used internally by the compiler to select and
18176 build multilibs for architectures @code{avr2} and @code{avr25}.
18177 These architectures mix devices with and without @code{SPH}.
18178 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18179 the compiler driver adds or removes this option from the compiler
18180 proper's command line, because the compiler then knows if the device
18181 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18182 register or not.
18183
18184 @item -mstrict-X
18185 @opindex mstrict-X
18186 Use address register @code{X} in a way proposed by the hardware. This means
18187 that @code{X} is only used in indirect, post-increment or
18188 pre-decrement addressing.
18189
18190 Without this option, the @code{X} register may be used in the same way
18191 as @code{Y} or @code{Z} which then is emulated by additional
18192 instructions.
18193 For example, loading a value with @code{X+const} addressing with a
18194 small non-negative @code{const < 64} to a register @var{Rn} is
18195 performed as
18196
18197 @example
18198 adiw r26, const ; X += const
18199 ld @var{Rn}, X ; @var{Rn} = *X
18200 sbiw r26, const ; X -= const
18201 @end example
18202
18203 @item -mtiny-stack
18204 @opindex mtiny-stack
18205 Only change the lower 8@tie{}bits of the stack pointer.
18206
18207 @item -mfract-convert-truncate
18208 @opindex mfract-convert-truncate
18209 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18210
18211 @item -nodevicelib
18212 @opindex nodevicelib
18213 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18214
18215 @item -Waddr-space-convert
18216 @opindex Waddr-space-convert
18217 @opindex Wno-addr-space-convert
18218 Warn about conversions between address spaces in the case where the
18219 resulting address space is not contained in the incoming address space.
18220
18221 @item -Wmisspelled-isr
18222 @opindex Wmisspelled-isr
18223 @opindex Wno-misspelled-isr
18224 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18225 Enabled by default.
18226 @end table
18227
18228 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18229 @cindex @code{EIND}
18230 Pointers in the implementation are 16@tie{}bits wide.
18231 The address of a function or label is represented as word address so
18232 that indirect jumps and calls can target any code address in the
18233 range of 64@tie{}Ki words.
18234
18235 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18236 bytes of program memory space, there is a special function register called
18237 @code{EIND} that serves as most significant part of the target address
18238 when @code{EICALL} or @code{EIJMP} instructions are used.
18239
18240 Indirect jumps and calls on these devices are handled as follows by
18241 the compiler and are subject to some limitations:
18242
18243 @itemize @bullet
18244
18245 @item
18246 The compiler never sets @code{EIND}.
18247
18248 @item
18249 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18250 instructions or might read @code{EIND} directly in order to emulate an
18251 indirect call/jump by means of a @code{RET} instruction.
18252
18253 @item
18254 The compiler assumes that @code{EIND} never changes during the startup
18255 code or during the application. In particular, @code{EIND} is not
18256 saved/restored in function or interrupt service routine
18257 prologue/epilogue.
18258
18259 @item
18260 For indirect calls to functions and computed goto, the linker
18261 generates @emph{stubs}. Stubs are jump pads sometimes also called
18262 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18263 The stub contains a direct jump to the desired address.
18264
18265 @item
18266 Linker relaxation must be turned on so that the linker generates
18267 the stubs correctly in all situations. See the compiler option
18268 @option{-mrelax} and the linker option @option{--relax}.
18269 There are corner cases where the linker is supposed to generate stubs
18270 but aborts without relaxation and without a helpful error message.
18271
18272 @item
18273 The default linker script is arranged for code with @code{EIND = 0}.
18274 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18275 linker script has to be used in order to place the sections whose
18276 name start with @code{.trampolines} into the segment where @code{EIND}
18277 points to.
18278
18279 @item
18280 The startup code from libgcc never sets @code{EIND}.
18281 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18282 For the impact of AVR-LibC on @code{EIND}, see the
18283 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18284
18285 @item
18286 It is legitimate for user-specific startup code to set up @code{EIND}
18287 early, for example by means of initialization code located in
18288 section @code{.init3}. Such code runs prior to general startup code
18289 that initializes RAM and calls constructors, but after the bit
18290 of startup code from AVR-LibC that sets @code{EIND} to the segment
18291 where the vector table is located.
18292 @example
18293 #include <avr/io.h>
18294
18295 static void
18296 __attribute__((section(".init3"),naked,used,no_instrument_function))
18297 init3_set_eind (void)
18298 @{
18299 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18300 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18301 @}
18302 @end example
18303
18304 @noindent
18305 The @code{__trampolines_start} symbol is defined in the linker script.
18306
18307 @item
18308 Stubs are generated automatically by the linker if
18309 the following two conditions are met:
18310 @itemize @minus
18311
18312 @item The address of a label is taken by means of the @code{gs} modifier
18313 (short for @emph{generate stubs}) like so:
18314 @example
18315 LDI r24, lo8(gs(@var{func}))
18316 LDI r25, hi8(gs(@var{func}))
18317 @end example
18318 @item The final location of that label is in a code segment
18319 @emph{outside} the segment where the stubs are located.
18320 @end itemize
18321
18322 @item
18323 The compiler emits such @code{gs} modifiers for code labels in the
18324 following situations:
18325 @itemize @minus
18326 @item Taking address of a function or code label.
18327 @item Computed goto.
18328 @item If prologue-save function is used, see @option{-mcall-prologues}
18329 command-line option.
18330 @item Switch/case dispatch tables. If you do not want such dispatch
18331 tables you can specify the @option{-fno-jump-tables} command-line option.
18332 @item C and C++ constructors/destructors called during startup/shutdown.
18333 @item If the tools hit a @code{gs()} modifier explained above.
18334 @end itemize
18335
18336 @item
18337 Jumping to non-symbolic addresses like so is @emph{not} supported:
18338
18339 @example
18340 int main (void)
18341 @{
18342 /* Call function at word address 0x2 */
18343 return ((int(*)(void)) 0x2)();
18344 @}
18345 @end example
18346
18347 Instead, a stub has to be set up, i.e.@: the function has to be called
18348 through a symbol (@code{func_4} in the example):
18349
18350 @example
18351 int main (void)
18352 @{
18353 extern int func_4 (void);
18354
18355 /* Call function at byte address 0x4 */
18356 return func_4();
18357 @}
18358 @end example
18359
18360 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18361 Alternatively, @code{func_4} can be defined in the linker script.
18362 @end itemize
18363
18364 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18365 @cindex @code{RAMPD}
18366 @cindex @code{RAMPX}
18367 @cindex @code{RAMPY}
18368 @cindex @code{RAMPZ}
18369 Some AVR devices support memories larger than the 64@tie{}KiB range
18370 that can be accessed with 16-bit pointers. To access memory locations
18371 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18372 register is used as high part of the address:
18373 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18374 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18375 register, respectively, to get a wide address. Similarly,
18376 @code{RAMPD} is used together with direct addressing.
18377
18378 @itemize
18379 @item
18380 The startup code initializes the @code{RAMP} special function
18381 registers with zero.
18382
18383 @item
18384 If a @ref{AVR Named Address Spaces,named address space} other than
18385 generic or @code{__flash} is used, then @code{RAMPZ} is set
18386 as needed before the operation.
18387
18388 @item
18389 If the device supports RAM larger than 64@tie{}KiB and the compiler
18390 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18391 is reset to zero after the operation.
18392
18393 @item
18394 If the device comes with a specific @code{RAMP} register, the ISR
18395 prologue/epilogue saves/restores that SFR and initializes it with
18396 zero in case the ISR code might (implicitly) use it.
18397
18398 @item
18399 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18400 If you use inline assembler to read from locations outside the
18401 16-bit address range and change one of the @code{RAMP} registers,
18402 you must reset it to zero after the access.
18403
18404 @end itemize
18405
18406 @subsubsection AVR Built-in Macros
18407
18408 GCC defines several built-in macros so that the user code can test
18409 for the presence or absence of features. Almost any of the following
18410 built-in macros are deduced from device capabilities and thus
18411 triggered by the @option{-mmcu=} command-line option.
18412
18413 For even more AVR-specific built-in macros see
18414 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18415
18416 @table @code
18417
18418 @item __AVR_ARCH__
18419 Build-in macro that resolves to a decimal number that identifies the
18420 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18421 Possible values are:
18422
18423 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18424 @code{4}, @code{5}, @code{51}, @code{6}
18425
18426 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18427 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18428
18429 respectively and
18430
18431 @code{100},
18432 @code{102}, @code{103}, @code{104},
18433 @code{105}, @code{106}, @code{107}
18434
18435 for @var{mcu}=@code{avrtiny},
18436 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18437 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18438 If @var{mcu} specifies a device, this built-in macro is set
18439 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18440 defined to @code{4}.
18441
18442 @item __AVR_@var{Device}__
18443 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18444 the device's name. For example, @option{-mmcu=atmega8} defines the
18445 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18446 @code{__AVR_ATtiny261A__}, etc.
18447
18448 The built-in macros' names follow
18449 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18450 the device name as from the AVR user manual. The difference between
18451 @var{Device} in the built-in macro and @var{device} in
18452 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18453
18454 If @var{device} is not a device but only a core architecture like
18455 @samp{avr51}, this macro is not defined.
18456
18457 @item __AVR_DEVICE_NAME__
18458 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18459 the device's name. For example, with @option{-mmcu=atmega8} the macro
18460 is defined to @code{atmega8}.
18461
18462 If @var{device} is not a device but only a core architecture like
18463 @samp{avr51}, this macro is not defined.
18464
18465 @item __AVR_XMEGA__
18466 The device / architecture belongs to the XMEGA family of devices.
18467
18468 @item __AVR_HAVE_ELPM__
18469 The device has the @code{ELPM} instruction.
18470
18471 @item __AVR_HAVE_ELPMX__
18472 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18473 R@var{n},Z+} instructions.
18474
18475 @item __AVR_HAVE_MOVW__
18476 The device has the @code{MOVW} instruction to perform 16-bit
18477 register-register moves.
18478
18479 @item __AVR_HAVE_LPMX__
18480 The device has the @code{LPM R@var{n},Z} and
18481 @code{LPM R@var{n},Z+} instructions.
18482
18483 @item __AVR_HAVE_MUL__
18484 The device has a hardware multiplier.
18485
18486 @item __AVR_HAVE_JMP_CALL__
18487 The device has the @code{JMP} and @code{CALL} instructions.
18488 This is the case for devices with more than 8@tie{}KiB of program
18489 memory.
18490
18491 @item __AVR_HAVE_EIJMP_EICALL__
18492 @itemx __AVR_3_BYTE_PC__
18493 The device has the @code{EIJMP} and @code{EICALL} instructions.
18494 This is the case for devices with more than 128@tie{}KiB of program memory.
18495 This also means that the program counter
18496 (PC) is 3@tie{}bytes wide.
18497
18498 @item __AVR_2_BYTE_PC__
18499 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18500 with up to 128@tie{}KiB of program memory.
18501
18502 @item __AVR_HAVE_8BIT_SP__
18503 @itemx __AVR_HAVE_16BIT_SP__
18504 The stack pointer (SP) register is treated as 8-bit respectively
18505 16-bit register by the compiler.
18506 The definition of these macros is affected by @option{-mtiny-stack}.
18507
18508 @item __AVR_HAVE_SPH__
18509 @itemx __AVR_SP8__
18510 The device has the SPH (high part of stack pointer) special function
18511 register or has an 8-bit stack pointer, respectively.
18512 The definition of these macros is affected by @option{-mmcu=} and
18513 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18514 by @option{-msp8}.
18515
18516 @item __AVR_HAVE_RAMPD__
18517 @itemx __AVR_HAVE_RAMPX__
18518 @itemx __AVR_HAVE_RAMPY__
18519 @itemx __AVR_HAVE_RAMPZ__
18520 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18521 @code{RAMPZ} special function register, respectively.
18522
18523 @item __NO_INTERRUPTS__
18524 This macro reflects the @option{-mno-interrupts} command-line option.
18525
18526 @item __AVR_ERRATA_SKIP__
18527 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18528 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18529 instructions because of a hardware erratum. Skip instructions are
18530 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18531 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18532 set.
18533
18534 @item __AVR_ISA_RMW__
18535 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18536
18537 @item __AVR_SFR_OFFSET__=@var{offset}
18538 Instructions that can address I/O special function registers directly
18539 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18540 address as if addressed by an instruction to access RAM like @code{LD}
18541 or @code{STS}. This offset depends on the device architecture and has
18542 to be subtracted from the RAM address in order to get the
18543 respective I/O@tie{}address.
18544
18545 @item __AVR_SHORT_CALLS__
18546 The @option{-mshort-calls} command line option is set.
18547
18548 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18549 Some devices support reading from flash memory by means of @code{LD*}
18550 instructions. The flash memory is seen in the data address space
18551 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18552 is not defined, this feature is not available. If defined,
18553 the address space is linear and there is no need to put
18554 @code{.rodata} into RAM. This is handled by the default linker
18555 description file, and is currently available for
18556 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18557 there is no need to use address spaces like @code{__flash} or
18558 features like attribute @code{progmem} and @code{pgm_read_*}.
18559
18560 @item __WITH_AVRLIBC__
18561 The compiler is configured to be used together with AVR-Libc.
18562 See the @option{--with-avrlibc} configure option.
18563
18564 @end table
18565
18566 @node Blackfin Options
18567 @subsection Blackfin Options
18568 @cindex Blackfin Options
18569
18570 @table @gcctabopt
18571 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18572 @opindex mcpu=
18573 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18574 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18575 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18576 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18577 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18578 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18579 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18580 @samp{bf561}, @samp{bf592}.
18581
18582 The optional @var{sirevision} specifies the silicon revision of the target
18583 Blackfin processor. Any workarounds available for the targeted silicon revision
18584 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18585 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18586 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18587 hexadecimal digits representing the major and minor numbers in the silicon
18588 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18589 is not defined. If @var{sirevision} is @samp{any}, the
18590 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18591 If this optional @var{sirevision} is not used, GCC assumes the latest known
18592 silicon revision of the targeted Blackfin processor.
18593
18594 GCC defines a preprocessor macro for the specified @var{cpu}.
18595 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18596 provided by libgloss to be linked in if @option{-msim} is not given.
18597
18598 Without this option, @samp{bf532} is used as the processor by default.
18599
18600 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18601 only the preprocessor macro is defined.
18602
18603 @item -msim
18604 @opindex msim
18605 Specifies that the program will be run on the simulator. This causes
18606 the simulator BSP provided by libgloss to be linked in. This option
18607 has effect only for @samp{bfin-elf} toolchain.
18608 Certain other options, such as @option{-mid-shared-library} and
18609 @option{-mfdpic}, imply @option{-msim}.
18610
18611 @item -momit-leaf-frame-pointer
18612 @opindex momit-leaf-frame-pointer
18613 Don't keep the frame pointer in a register for leaf functions. This
18614 avoids the instructions to save, set up and restore frame pointers and
18615 makes an extra register available in leaf functions.
18616
18617 @item -mspecld-anomaly
18618 @opindex mspecld-anomaly
18619 When enabled, the compiler ensures that the generated code does not
18620 contain speculative loads after jump instructions. If this option is used,
18621 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18622
18623 @item -mno-specld-anomaly
18624 @opindex mno-specld-anomaly
18625 @opindex mspecld-anomaly
18626 Don't generate extra code to prevent speculative loads from occurring.
18627
18628 @item -mcsync-anomaly
18629 @opindex mcsync-anomaly
18630 When enabled, the compiler ensures that the generated code does not
18631 contain CSYNC or SSYNC instructions too soon after conditional branches.
18632 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18633
18634 @item -mno-csync-anomaly
18635 @opindex mno-csync-anomaly
18636 @opindex mcsync-anomaly
18637 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18638 occurring too soon after a conditional branch.
18639
18640 @item -mlow64k
18641 @opindex mlow64k
18642 When enabled, the compiler is free to take advantage of the knowledge that
18643 the entire program fits into the low 64k of memory.
18644
18645 @item -mno-low64k
18646 @opindex mno-low64k
18647 Assume that the program is arbitrarily large. This is the default.
18648
18649 @item -mstack-check-l1
18650 @opindex mstack-check-l1
18651 Do stack checking using information placed into L1 scratchpad memory by the
18652 uClinux kernel.
18653
18654 @item -mid-shared-library
18655 @opindex mid-shared-library
18656 Generate code that supports shared libraries via the library ID method.
18657 This allows for execute in place and shared libraries in an environment
18658 without virtual memory management. This option implies @option{-fPIC}.
18659 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18660
18661 @item -mno-id-shared-library
18662 @opindex mno-id-shared-library
18663 @opindex mid-shared-library
18664 Generate code that doesn't assume ID-based shared libraries are being used.
18665 This is the default.
18666
18667 @item -mleaf-id-shared-library
18668 @opindex mleaf-id-shared-library
18669 Generate code that supports shared libraries via the library ID method,
18670 but assumes that this library or executable won't link against any other
18671 ID shared libraries. That allows the compiler to use faster code for jumps
18672 and calls.
18673
18674 @item -mno-leaf-id-shared-library
18675 @opindex mno-leaf-id-shared-library
18676 @opindex mleaf-id-shared-library
18677 Do not assume that the code being compiled won't link against any ID shared
18678 libraries. Slower code is generated for jump and call insns.
18679
18680 @item -mshared-library-id=n
18681 @opindex mshared-library-id
18682 Specifies the identification number of the ID-based shared library being
18683 compiled. Specifying a value of 0 generates more compact code; specifying
18684 other values forces the allocation of that number to the current
18685 library but is no more space- or time-efficient than omitting this option.
18686
18687 @item -msep-data
18688 @opindex msep-data
18689 Generate code that allows the data segment to be located in a different
18690 area of memory from the text segment. This allows for execute in place in
18691 an environment without virtual memory management by eliminating relocations
18692 against the text section.
18693
18694 @item -mno-sep-data
18695 @opindex mno-sep-data
18696 @opindex msep-data
18697 Generate code that assumes that the data segment follows the text segment.
18698 This is the default.
18699
18700 @item -mlong-calls
18701 @itemx -mno-long-calls
18702 @opindex mlong-calls
18703 @opindex mno-long-calls
18704 Tells the compiler to perform function calls by first loading the
18705 address of the function into a register and then performing a subroutine
18706 call on this register. This switch is needed if the target function
18707 lies outside of the 24-bit addressing range of the offset-based
18708 version of subroutine call instruction.
18709
18710 This feature is not enabled by default. Specifying
18711 @option{-mno-long-calls} restores the default behavior. Note these
18712 switches have no effect on how the compiler generates code to handle
18713 function calls via function pointers.
18714
18715 @item -mfast-fp
18716 @opindex mfast-fp
18717 Link with the fast floating-point library. This library relaxes some of
18718 the IEEE floating-point standard's rules for checking inputs against
18719 Not-a-Number (NAN), in the interest of performance.
18720
18721 @item -minline-plt
18722 @opindex minline-plt
18723 Enable inlining of PLT entries in function calls to functions that are
18724 not known to bind locally. It has no effect without @option{-mfdpic}.
18725
18726 @item -mmulticore
18727 @opindex mmulticore
18728 Build a standalone application for multicore Blackfin processors.
18729 This option causes proper start files and link scripts supporting
18730 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18731 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18732
18733 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18734 selects the one-application-per-core programming model. Without
18735 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18736 programming model is used. In this model, the main function of Core B
18737 should be named as @code{coreb_main}.
18738
18739 If this option is not used, the single-core application programming
18740 model is used.
18741
18742 @item -mcorea
18743 @opindex mcorea
18744 Build a standalone application for Core A of BF561 when using
18745 the one-application-per-core programming model. Proper start files
18746 and link scripts are used to support Core A, and the macro
18747 @code{__BFIN_COREA} is defined.
18748 This option can only be used in conjunction with @option{-mmulticore}.
18749
18750 @item -mcoreb
18751 @opindex mcoreb
18752 Build a standalone application for Core B of BF561 when using
18753 the one-application-per-core programming model. Proper start files
18754 and link scripts are used to support Core B, and the macro
18755 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18756 should be used instead of @code{main}.
18757 This option can only be used in conjunction with @option{-mmulticore}.
18758
18759 @item -msdram
18760 @opindex msdram
18761 Build a standalone application for SDRAM. Proper start files and
18762 link scripts are used to put the application into SDRAM, and the macro
18763 @code{__BFIN_SDRAM} is defined.
18764 The loader should initialize SDRAM before loading the application.
18765
18766 @item -micplb
18767 @opindex micplb
18768 Assume that ICPLBs are enabled at run time. This has an effect on certain
18769 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18770 are enabled; for standalone applications the default is off.
18771 @end table
18772
18773 @node C6X Options
18774 @subsection C6X Options
18775 @cindex C6X Options
18776
18777 @table @gcctabopt
18778 @item -march=@var{name}
18779 @opindex march
18780 This specifies the name of the target architecture. GCC uses this
18781 name to determine what kind of instructions it can emit when generating
18782 assembly code. Permissible names are: @samp{c62x},
18783 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18784
18785 @item -mbig-endian
18786 @opindex mbig-endian
18787 Generate code for a big-endian target.
18788
18789 @item -mlittle-endian
18790 @opindex mlittle-endian
18791 Generate code for a little-endian target. This is the default.
18792
18793 @item -msim
18794 @opindex msim
18795 Choose startup files and linker script suitable for the simulator.
18796
18797 @item -msdata=default
18798 @opindex msdata=default
18799 Put small global and static data in the @code{.neardata} section,
18800 which is pointed to by register @code{B14}. Put small uninitialized
18801 global and static data in the @code{.bss} section, which is adjacent
18802 to the @code{.neardata} section. Put small read-only data into the
18803 @code{.rodata} section. The corresponding sections used for large
18804 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18805
18806 @item -msdata=all
18807 @opindex msdata=all
18808 Put all data, not just small objects, into the sections reserved for
18809 small data, and use addressing relative to the @code{B14} register to
18810 access them.
18811
18812 @item -msdata=none
18813 @opindex msdata=none
18814 Make no use of the sections reserved for small data, and use absolute
18815 addresses to access all data. Put all initialized global and static
18816 data in the @code{.fardata} section, and all uninitialized data in the
18817 @code{.far} section. Put all constant data into the @code{.const}
18818 section.
18819 @end table
18820
18821 @node CRIS Options
18822 @subsection CRIS Options
18823 @cindex CRIS Options
18824
18825 These options are defined specifically for the CRIS ports.
18826
18827 @table @gcctabopt
18828 @item -march=@var{architecture-type}
18829 @itemx -mcpu=@var{architecture-type}
18830 @opindex march
18831 @opindex mcpu
18832 Generate code for the specified architecture. The choices for
18833 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18834 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18835 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18836 @samp{v10}.
18837
18838 @item -mtune=@var{architecture-type}
18839 @opindex mtune
18840 Tune to @var{architecture-type} everything applicable about the generated
18841 code, except for the ABI and the set of available instructions. The
18842 choices for @var{architecture-type} are the same as for
18843 @option{-march=@var{architecture-type}}.
18844
18845 @item -mmax-stack-frame=@var{n}
18846 @opindex mmax-stack-frame
18847 Warn when the stack frame of a function exceeds @var{n} bytes.
18848
18849 @item -metrax4
18850 @itemx -metrax100
18851 @opindex metrax4
18852 @opindex metrax100
18853 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18854 @option{-march=v3} and @option{-march=v8} respectively.
18855
18856 @item -mmul-bug-workaround
18857 @itemx -mno-mul-bug-workaround
18858 @opindex mmul-bug-workaround
18859 @opindex mno-mul-bug-workaround
18860 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18861 models where it applies. This option is active by default.
18862
18863 @item -mpdebug
18864 @opindex mpdebug
18865 Enable CRIS-specific verbose debug-related information in the assembly
18866 code. This option also has the effect of turning off the @samp{#NO_APP}
18867 formatted-code indicator to the assembler at the beginning of the
18868 assembly file.
18869
18870 @item -mcc-init
18871 @opindex mcc-init
18872 Do not use condition-code results from previous instruction; always emit
18873 compare and test instructions before use of condition codes.
18874
18875 @item -mno-side-effects
18876 @opindex mno-side-effects
18877 @opindex mside-effects
18878 Do not emit instructions with side effects in addressing modes other than
18879 post-increment.
18880
18881 @item -mstack-align
18882 @itemx -mno-stack-align
18883 @itemx -mdata-align
18884 @itemx -mno-data-align
18885 @itemx -mconst-align
18886 @itemx -mno-const-align
18887 @opindex mstack-align
18888 @opindex mno-stack-align
18889 @opindex mdata-align
18890 @opindex mno-data-align
18891 @opindex mconst-align
18892 @opindex mno-const-align
18893 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18894 stack frame, individual data and constants to be aligned for the maximum
18895 single data access size for the chosen CPU model. The default is to
18896 arrange for 32-bit alignment. ABI details such as structure layout are
18897 not affected by these options.
18898
18899 @item -m32-bit
18900 @itemx -m16-bit
18901 @itemx -m8-bit
18902 @opindex m32-bit
18903 @opindex m16-bit
18904 @opindex m8-bit
18905 Similar to the stack- data- and const-align options above, these options
18906 arrange for stack frame, writable data and constants to all be 32-bit,
18907 16-bit or 8-bit aligned. The default is 32-bit alignment.
18908
18909 @item -mno-prologue-epilogue
18910 @itemx -mprologue-epilogue
18911 @opindex mno-prologue-epilogue
18912 @opindex mprologue-epilogue
18913 With @option{-mno-prologue-epilogue}, the normal function prologue and
18914 epilogue which set up the stack frame are omitted and no return
18915 instructions or return sequences are generated in the code. Use this
18916 option only together with visual inspection of the compiled code: no
18917 warnings or errors are generated when call-saved registers must be saved,
18918 or storage for local variables needs to be allocated.
18919
18920 @item -mno-gotplt
18921 @itemx -mgotplt
18922 @opindex mno-gotplt
18923 @opindex mgotplt
18924 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18925 instruction sequences that load addresses for functions from the PLT part
18926 of the GOT rather than (traditional on other architectures) calls to the
18927 PLT@. The default is @option{-mgotplt}.
18928
18929 @item -melf
18930 @opindex melf
18931 Legacy no-op option only recognized with the cris-axis-elf and
18932 cris-axis-linux-gnu targets.
18933
18934 @item -mlinux
18935 @opindex mlinux
18936 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18937
18938 @item -sim
18939 @opindex sim
18940 This option, recognized for the cris-axis-elf, arranges
18941 to link with input-output functions from a simulator library. Code,
18942 initialized data and zero-initialized data are allocated consecutively.
18943
18944 @item -sim2
18945 @opindex sim2
18946 Like @option{-sim}, but pass linker options to locate initialized data at
18947 0x40000000 and zero-initialized data at 0x80000000.
18948 @end table
18949
18950 @node CR16 Options
18951 @subsection CR16 Options
18952 @cindex CR16 Options
18953
18954 These options are defined specifically for the CR16 ports.
18955
18956 @table @gcctabopt
18957
18958 @item -mmac
18959 @opindex mmac
18960 Enable the use of multiply-accumulate instructions. Disabled by default.
18961
18962 @item -mcr16cplus
18963 @itemx -mcr16c
18964 @opindex mcr16cplus
18965 @opindex mcr16c
18966 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18967 is default.
18968
18969 @item -msim
18970 @opindex msim
18971 Links the library libsim.a which is in compatible with simulator. Applicable
18972 to ELF compiler only.
18973
18974 @item -mint32
18975 @opindex mint32
18976 Choose integer type as 32-bit wide.
18977
18978 @item -mbit-ops
18979 @opindex mbit-ops
18980 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18981
18982 @item -mdata-model=@var{model}
18983 @opindex mdata-model
18984 Choose a data model. The choices for @var{model} are @samp{near},
18985 @samp{far} or @samp{medium}. @samp{medium} is default.
18986 However, @samp{far} is not valid with @option{-mcr16c}, as the
18987 CR16C architecture does not support the far data model.
18988 @end table
18989
18990 @node C-SKY Options
18991 @subsection C-SKY Options
18992 @cindex C-SKY Options
18993
18994 GCC supports these options when compiling for C-SKY V2 processors.
18995
18996 @table @gcctabopt
18997
18998 @item -march=@var{arch}
18999 @opindex march=
19000 Specify the C-SKY target architecture. Valid values for @var{arch} are:
19001 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
19002 The default is @samp{ck810}.
19003
19004 @item -mcpu=@var{cpu}
19005 @opindex mcpu=
19006 Specify the C-SKY target processor. Valid values for @var{cpu} are:
19007 @samp{ck801}, @samp{ck801t},
19008 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
19009 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
19010 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
19011 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
19012 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
19013 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
19014 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
19015 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
19016 @samp{ck803eftr1}, @samp{ck803efhtr1},
19017 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
19018 @samp{ck803sef}, @samp{ck803seft},
19019 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
19020 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
19021 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
19022 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
19023
19024 @item -mbig-endian
19025 @opindex mbig-endian
19026 @itemx -EB
19027 @opindex EB
19028 @itemx -mlittle-endian
19029 @opindex mlittle-endian
19030 @itemx -EL
19031 @opindex EL
19032
19033 Select big- or little-endian code. The default is little-endian.
19034
19035 @item -mhard-float
19036 @opindex mhard-float
19037 @itemx -msoft-float
19038 @opindex msoft-float
19039
19040 Select hardware or software floating-point implementations.
19041 The default is soft float.
19042
19043 @item -mdouble-float
19044 @itemx -mno-double-float
19045 @opindex mdouble-float
19046 When @option{-mhard-float} is in effect, enable generation of
19047 double-precision float instructions. This is the default except
19048 when compiling for CK803.
19049
19050 @item -mfdivdu
19051 @itemx -mno-fdivdu
19052 @opindex mfdivdu
19053 When @option{-mhard-float} is in effect, enable generation of
19054 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
19055 This is the default except when compiling for CK803.
19056
19057 @item -mfpu=@var{fpu}
19058 @opindex mfpu=
19059 Select the floating-point processor. This option can only be used with
19060 @option{-mhard-float}.
19061 Values for @var{fpu} are
19062 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19063 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19064 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19065
19066 @item -melrw
19067 @itemx -mno-elrw
19068 @opindex melrw
19069 Enable the extended @code{lrw} instruction. This option defaults to on
19070 for CK801 and off otherwise.
19071
19072 @item -mistack
19073 @itemx -mno-istack
19074 @opindex mistack
19075 Enable interrupt stack instructions; the default is off.
19076
19077 The @option{-mistack} option is required to handle the
19078 @code{interrupt} and @code{isr} function attributes
19079 (@pxref{C-SKY Function Attributes}).
19080
19081 @item -mmp
19082 @opindex mmp
19083 Enable multiprocessor instructions; the default is off.
19084
19085 @item -mcp
19086 @opindex mcp
19087 Enable coprocessor instructions; the default is off.
19088
19089 @item -mcache
19090 @opindex mcache
19091 Enable coprocessor instructions; the default is off.
19092
19093 @item -msecurity
19094 @opindex msecurity
19095 Enable C-SKY security instructions; the default is off.
19096
19097 @item -mtrust
19098 @opindex mtrust
19099 Enable C-SKY trust instructions; the default is off.
19100
19101 @item -mdsp
19102 @opindex mdsp
19103 @itemx -medsp
19104 @opindex medsp
19105 @itemx -mvdsp
19106 @opindex mvdsp
19107 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19108 All of these options default to off.
19109
19110 @item -mdiv
19111 @itemx -mno-div
19112 @opindex mdiv
19113 Generate divide instructions. Default is off.
19114
19115 @item -msmart
19116 @itemx -mno-smart
19117 @opindex msmart
19118 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19119 use of 16-bit instructions. This option is ignored for CK801 where this
19120 is the required behavior, and it defaults to on for CK802.
19121 For other targets, the default is off.
19122
19123 @item -mhigh-registers
19124 @itemx -mno-high-registers
19125 @opindex mhigh-registers
19126 Generate code using the high registers numbered 16-31. This option
19127 is not supported on CK801, CK802, or CK803, and is enabled by default
19128 for other processors.
19129
19130 @item -manchor
19131 @itemx -mno-anchor
19132 @opindex manchor
19133 Generate code using global anchor symbol addresses.
19134
19135 @item -mpushpop
19136 @itemx -mno-pushpop
19137 @opindex mpushpop
19138 Generate code using @code{push} and @code{pop} instructions. This option
19139 defaults to on.
19140
19141 @item -mmultiple-stld
19142 @itemx -mstm
19143 @itemx -mno-multiple-stld
19144 @itemx -mno-stm
19145 @opindex mmultiple-stld
19146 Generate code using @code{stm} and @code{ldm} instructions. This option
19147 isn't supported on CK801 but is enabled by default on other processors.
19148
19149 @item -mconstpool
19150 @itemx -mno-constpool
19151 @opindex mconstpool
19152 Create constant pools in the compiler instead of deferring it to the
19153 assembler. This option is the default and required for correct code
19154 generation on CK801 and CK802, and is optional on other processors.
19155
19156 @item -mstack-size
19157 @item -mno-stack-size
19158 @opindex mstack-size
19159 Emit @code{.stack_size} directives for each function in the assembly
19160 output. This option defaults to off.
19161
19162 @item -mccrt
19163 @itemx -mno-ccrt
19164 @opindex mccrt
19165 Generate code for the C-SKY compiler runtime instead of libgcc. This
19166 option defaults to off.
19167
19168 @item -mbranch-cost=@var{n}
19169 @opindex mbranch-cost=
19170 Set the branch costs to roughly @code{n} instructions. The default is 1.
19171
19172 @item -msched-prolog
19173 @itemx -mno-sched-prolog
19174 @opindex msched-prolog
19175 Permit scheduling of function prologue and epilogue sequences. Using
19176 this option can result in code that is not compliant with the C-SKY V2 ABI
19177 prologue requirements and that cannot be debugged or backtraced.
19178 It is disabled by default.
19179
19180 @end table
19181
19182 @node Darwin Options
19183 @subsection Darwin Options
19184 @cindex Darwin options
19185
19186 These options are defined for all architectures running the Darwin operating
19187 system.
19188
19189 FSF GCC on Darwin does not create ``fat'' object files; it creates
19190 an object file for the single architecture that GCC was built to
19191 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19192 @option{-arch} options are used; it does so by running the compiler or
19193 linker multiple times and joining the results together with
19194 @file{lipo}.
19195
19196 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19197 @samp{i686}) is determined by the flags that specify the ISA
19198 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19199 @option{-force_cpusubtype_ALL} option can be used to override this.
19200
19201 The Darwin tools vary in their behavior when presented with an ISA
19202 mismatch. The assembler, @file{as}, only permits instructions to
19203 be used that are valid for the subtype of the file it is generating,
19204 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19205 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19206 and prints an error if asked to create a shared library with a less
19207 restrictive subtype than its input files (for instance, trying to put
19208 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19209 for executables, @command{ld}, quietly gives the executable the most
19210 restrictive subtype of any of its input files.
19211
19212 @table @gcctabopt
19213 @item -F@var{dir}
19214 @opindex F
19215 Add the framework directory @var{dir} to the head of the list of
19216 directories to be searched for header files. These directories are
19217 interleaved with those specified by @option{-I} options and are
19218 scanned in a left-to-right order.
19219
19220 A framework directory is a directory with frameworks in it. A
19221 framework is a directory with a @file{Headers} and/or
19222 @file{PrivateHeaders} directory contained directly in it that ends
19223 in @file{.framework}. The name of a framework is the name of this
19224 directory excluding the @file{.framework}. Headers associated with
19225 the framework are found in one of those two directories, with
19226 @file{Headers} being searched first. A subframework is a framework
19227 directory that is in a framework's @file{Frameworks} directory.
19228 Includes of subframework headers can only appear in a header of a
19229 framework that contains the subframework, or in a sibling subframework
19230 header. Two subframeworks are siblings if they occur in the same
19231 framework. A subframework should not have the same name as a
19232 framework; a warning is issued if this is violated. Currently a
19233 subframework cannot have subframeworks; in the future, the mechanism
19234 may be extended to support this. The standard frameworks can be found
19235 in @file{/System/Library/Frameworks} and
19236 @file{/Library/Frameworks}. An example include looks like
19237 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19238 the name of the framework and @file{header.h} is found in the
19239 @file{PrivateHeaders} or @file{Headers} directory.
19240
19241 @item -iframework@var{dir}
19242 @opindex iframework
19243 Like @option{-F} except the directory is a treated as a system
19244 directory. The main difference between this @option{-iframework} and
19245 @option{-F} is that with @option{-iframework} the compiler does not
19246 warn about constructs contained within header files found via
19247 @var{dir}. This option is valid only for the C family of languages.
19248
19249 @item -gused
19250 @opindex gused
19251 Emit debugging information for symbols that are used. For stabs
19252 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19253 This is by default ON@.
19254
19255 @item -gfull
19256 @opindex gfull
19257 Emit debugging information for all symbols and types.
19258
19259 @item -mmacosx-version-min=@var{version}
19260 The earliest version of MacOS X that this executable will run on
19261 is @var{version}. Typical values of @var{version} include @code{10.1},
19262 @code{10.2}, and @code{10.3.9}.
19263
19264 If the compiler was built to use the system's headers by default,
19265 then the default for this option is the system version on which the
19266 compiler is running, otherwise the default is to make choices that
19267 are compatible with as many systems and code bases as possible.
19268
19269 @item -mkernel
19270 @opindex mkernel
19271 Enable kernel development mode. The @option{-mkernel} option sets
19272 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19273 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19274 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19275 applicable. This mode also sets @option{-mno-altivec},
19276 @option{-msoft-float}, @option{-fno-builtin} and
19277 @option{-mlong-branch} for PowerPC targets.
19278
19279 @item -mone-byte-bool
19280 @opindex mone-byte-bool
19281 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19282 By default @code{sizeof(bool)} is @code{4} when compiling for
19283 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19284 option has no effect on x86.
19285
19286 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19287 to generate code that is not binary compatible with code generated
19288 without that switch. Using this switch may require recompiling all
19289 other modules in a program, including system libraries. Use this
19290 switch to conform to a non-default data model.
19291
19292 @item -mfix-and-continue
19293 @itemx -ffix-and-continue
19294 @itemx -findirect-data
19295 @opindex mfix-and-continue
19296 @opindex ffix-and-continue
19297 @opindex findirect-data
19298 Generate code suitable for fast turnaround development, such as to
19299 allow GDB to dynamically load @file{.o} files into already-running
19300 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19301 are provided for backwards compatibility.
19302
19303 @item -all_load
19304 @opindex all_load
19305 Loads all members of static archive libraries.
19306 See man ld(1) for more information.
19307
19308 @item -arch_errors_fatal
19309 @opindex arch_errors_fatal
19310 Cause the errors having to do with files that have the wrong architecture
19311 to be fatal.
19312
19313 @item -bind_at_load
19314 @opindex bind_at_load
19315 Causes the output file to be marked such that the dynamic linker will
19316 bind all undefined references when the file is loaded or launched.
19317
19318 @item -bundle
19319 @opindex bundle
19320 Produce a Mach-o bundle format file.
19321 See man ld(1) for more information.
19322
19323 @item -bundle_loader @var{executable}
19324 @opindex bundle_loader
19325 This option specifies the @var{executable} that will load the build
19326 output file being linked. See man ld(1) for more information.
19327
19328 @item -dynamiclib
19329 @opindex dynamiclib
19330 When passed this option, GCC produces a dynamic library instead of
19331 an executable when linking, using the Darwin @file{libtool} command.
19332
19333 @item -force_cpusubtype_ALL
19334 @opindex force_cpusubtype_ALL
19335 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19336 one controlled by the @option{-mcpu} or @option{-march} option.
19337
19338 @item -allowable_client @var{client_name}
19339 @itemx -client_name
19340 @itemx -compatibility_version
19341 @itemx -current_version
19342 @itemx -dead_strip
19343 @itemx -dependency-file
19344 @itemx -dylib_file
19345 @itemx -dylinker_install_name
19346 @itemx -dynamic
19347 @itemx -exported_symbols_list
19348 @itemx -filelist
19349 @need 800
19350 @itemx -flat_namespace
19351 @itemx -force_flat_namespace
19352 @itemx -headerpad_max_install_names
19353 @itemx -image_base
19354 @itemx -init
19355 @itemx -install_name
19356 @itemx -keep_private_externs
19357 @itemx -multi_module
19358 @itemx -multiply_defined
19359 @itemx -multiply_defined_unused
19360 @need 800
19361 @itemx -noall_load
19362 @itemx -no_dead_strip_inits_and_terms
19363 @itemx -nofixprebinding
19364 @itemx -nomultidefs
19365 @itemx -noprebind
19366 @itemx -noseglinkedit
19367 @itemx -pagezero_size
19368 @itemx -prebind
19369 @itemx -prebind_all_twolevel_modules
19370 @itemx -private_bundle
19371 @need 800
19372 @itemx -read_only_relocs
19373 @itemx -sectalign
19374 @itemx -sectobjectsymbols
19375 @itemx -whyload
19376 @itemx -seg1addr
19377 @itemx -sectcreate
19378 @itemx -sectobjectsymbols
19379 @itemx -sectorder
19380 @itemx -segaddr
19381 @itemx -segs_read_only_addr
19382 @need 800
19383 @itemx -segs_read_write_addr
19384 @itemx -seg_addr_table
19385 @itemx -seg_addr_table_filename
19386 @itemx -seglinkedit
19387 @itemx -segprot
19388 @itemx -segs_read_only_addr
19389 @itemx -segs_read_write_addr
19390 @itemx -single_module
19391 @itemx -static
19392 @itemx -sub_library
19393 @need 800
19394 @itemx -sub_umbrella
19395 @itemx -twolevel_namespace
19396 @itemx -umbrella
19397 @itemx -undefined
19398 @itemx -unexported_symbols_list
19399 @itemx -weak_reference_mismatches
19400 @itemx -whatsloaded
19401 @opindex allowable_client
19402 @opindex client_name
19403 @opindex compatibility_version
19404 @opindex current_version
19405 @opindex dead_strip
19406 @opindex dependency-file
19407 @opindex dylib_file
19408 @opindex dylinker_install_name
19409 @opindex dynamic
19410 @opindex exported_symbols_list
19411 @opindex filelist
19412 @opindex flat_namespace
19413 @opindex force_flat_namespace
19414 @opindex headerpad_max_install_names
19415 @opindex image_base
19416 @opindex init
19417 @opindex install_name
19418 @opindex keep_private_externs
19419 @opindex multi_module
19420 @opindex multiply_defined
19421 @opindex multiply_defined_unused
19422 @opindex noall_load
19423 @opindex no_dead_strip_inits_and_terms
19424 @opindex nofixprebinding
19425 @opindex nomultidefs
19426 @opindex noprebind
19427 @opindex noseglinkedit
19428 @opindex pagezero_size
19429 @opindex prebind
19430 @opindex prebind_all_twolevel_modules
19431 @opindex private_bundle
19432 @opindex read_only_relocs
19433 @opindex sectalign
19434 @opindex sectobjectsymbols
19435 @opindex whyload
19436 @opindex seg1addr
19437 @opindex sectcreate
19438 @opindex sectobjectsymbols
19439 @opindex sectorder
19440 @opindex segaddr
19441 @opindex segs_read_only_addr
19442 @opindex segs_read_write_addr
19443 @opindex seg_addr_table
19444 @opindex seg_addr_table_filename
19445 @opindex seglinkedit
19446 @opindex segprot
19447 @opindex segs_read_only_addr
19448 @opindex segs_read_write_addr
19449 @opindex single_module
19450 @opindex static
19451 @opindex sub_library
19452 @opindex sub_umbrella
19453 @opindex twolevel_namespace
19454 @opindex umbrella
19455 @opindex undefined
19456 @opindex unexported_symbols_list
19457 @opindex weak_reference_mismatches
19458 @opindex whatsloaded
19459 These options are passed to the Darwin linker. The Darwin linker man page
19460 describes them in detail.
19461 @end table
19462
19463 @node DEC Alpha Options
19464 @subsection DEC Alpha Options
19465
19466 These @samp{-m} options are defined for the DEC Alpha implementations:
19467
19468 @table @gcctabopt
19469 @item -mno-soft-float
19470 @itemx -msoft-float
19471 @opindex mno-soft-float
19472 @opindex msoft-float
19473 Use (do not use) the hardware floating-point instructions for
19474 floating-point operations. When @option{-msoft-float} is specified,
19475 functions in @file{libgcc.a} are used to perform floating-point
19476 operations. Unless they are replaced by routines that emulate the
19477 floating-point operations, or compiled in such a way as to call such
19478 emulations routines, these routines issue floating-point
19479 operations. If you are compiling for an Alpha without floating-point
19480 operations, you must ensure that the library is built so as not to call
19481 them.
19482
19483 Note that Alpha implementations without floating-point operations are
19484 required to have floating-point registers.
19485
19486 @item -mfp-reg
19487 @itemx -mno-fp-regs
19488 @opindex mfp-reg
19489 @opindex mno-fp-regs
19490 Generate code that uses (does not use) the floating-point register set.
19491 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19492 register set is not used, floating-point operands are passed in integer
19493 registers as if they were integers and floating-point results are passed
19494 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19495 so any function with a floating-point argument or return value called by code
19496 compiled with @option{-mno-fp-regs} must also be compiled with that
19497 option.
19498
19499 A typical use of this option is building a kernel that does not use,
19500 and hence need not save and restore, any floating-point registers.
19501
19502 @item -mieee
19503 @opindex mieee
19504 The Alpha architecture implements floating-point hardware optimized for
19505 maximum performance. It is mostly compliant with the IEEE floating-point
19506 standard. However, for full compliance, software assistance is
19507 required. This option generates code fully IEEE-compliant code
19508 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19509 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19510 defined during compilation. The resulting code is less efficient but is
19511 able to correctly support denormalized numbers and exceptional IEEE
19512 values such as not-a-number and plus/minus infinity. Other Alpha
19513 compilers call this option @option{-ieee_with_no_inexact}.
19514
19515 @item -mieee-with-inexact
19516 @opindex mieee-with-inexact
19517 This is like @option{-mieee} except the generated code also maintains
19518 the IEEE @var{inexact-flag}. Turning on this option causes the
19519 generated code to implement fully-compliant IEEE math. In addition to
19520 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19521 macro. On some Alpha implementations the resulting code may execute
19522 significantly slower than the code generated by default. Since there is
19523 very little code that depends on the @var{inexact-flag}, you should
19524 normally not specify this option. Other Alpha compilers call this
19525 option @option{-ieee_with_inexact}.
19526
19527 @item -mfp-trap-mode=@var{trap-mode}
19528 @opindex mfp-trap-mode
19529 This option controls what floating-point related traps are enabled.
19530 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19531 The trap mode can be set to one of four values:
19532
19533 @table @samp
19534 @item n
19535 This is the default (normal) setting. The only traps that are enabled
19536 are the ones that cannot be disabled in software (e.g., division by zero
19537 trap).
19538
19539 @item u
19540 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19541 as well.
19542
19543 @item su
19544 Like @samp{u}, but the instructions are marked to be safe for software
19545 completion (see Alpha architecture manual for details).
19546
19547 @item sui
19548 Like @samp{su}, but inexact traps are enabled as well.
19549 @end table
19550
19551 @item -mfp-rounding-mode=@var{rounding-mode}
19552 @opindex mfp-rounding-mode
19553 Selects the IEEE rounding mode. Other Alpha compilers call this option
19554 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19555 of:
19556
19557 @table @samp
19558 @item n
19559 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19560 the nearest machine number or towards the even machine number in case
19561 of a tie.
19562
19563 @item m
19564 Round towards minus infinity.
19565
19566 @item c
19567 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19568
19569 @item d
19570 Dynamic rounding mode. A field in the floating-point control register
19571 (@var{fpcr}, see Alpha architecture reference manual) controls the
19572 rounding mode in effect. The C library initializes this register for
19573 rounding towards plus infinity. Thus, unless your program modifies the
19574 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19575 @end table
19576
19577 @item -mtrap-precision=@var{trap-precision}
19578 @opindex mtrap-precision
19579 In the Alpha architecture, floating-point traps are imprecise. This
19580 means without software assistance it is impossible to recover from a
19581 floating trap and program execution normally needs to be terminated.
19582 GCC can generate code that can assist operating system trap handlers
19583 in determining the exact location that caused a floating-point trap.
19584 Depending on the requirements of an application, different levels of
19585 precisions can be selected:
19586
19587 @table @samp
19588 @item p
19589 Program precision. This option is the default and means a trap handler
19590 can only identify which program caused a floating-point exception.
19591
19592 @item f
19593 Function precision. The trap handler can determine the function that
19594 caused a floating-point exception.
19595
19596 @item i
19597 Instruction precision. The trap handler can determine the exact
19598 instruction that caused a floating-point exception.
19599 @end table
19600
19601 Other Alpha compilers provide the equivalent options called
19602 @option{-scope_safe} and @option{-resumption_safe}.
19603
19604 @item -mieee-conformant
19605 @opindex mieee-conformant
19606 This option marks the generated code as IEEE conformant. You must not
19607 use this option unless you also specify @option{-mtrap-precision=i} and either
19608 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19609 is to emit the line @samp{.eflag 48} in the function prologue of the
19610 generated assembly file.
19611
19612 @item -mbuild-constants
19613 @opindex mbuild-constants
19614 Normally GCC examines a 32- or 64-bit integer constant to
19615 see if it can construct it from smaller constants in two or three
19616 instructions. If it cannot, it outputs the constant as a literal and
19617 generates code to load it from the data segment at run time.
19618
19619 Use this option to require GCC to construct @emph{all} integer constants
19620 using code, even if it takes more instructions (the maximum is six).
19621
19622 You typically use this option to build a shared library dynamic
19623 loader. Itself a shared library, it must relocate itself in memory
19624 before it can find the variables and constants in its own data segment.
19625
19626 @item -mbwx
19627 @itemx -mno-bwx
19628 @itemx -mcix
19629 @itemx -mno-cix
19630 @itemx -mfix
19631 @itemx -mno-fix
19632 @itemx -mmax
19633 @itemx -mno-max
19634 @opindex mbwx
19635 @opindex mno-bwx
19636 @opindex mcix
19637 @opindex mno-cix
19638 @opindex mfix
19639 @opindex mno-fix
19640 @opindex mmax
19641 @opindex mno-max
19642 Indicate whether GCC should generate code to use the optional BWX,
19643 CIX, FIX and MAX instruction sets. The default is to use the instruction
19644 sets supported by the CPU type specified via @option{-mcpu=} option or that
19645 of the CPU on which GCC was built if none is specified.
19646
19647 @item -mfloat-vax
19648 @itemx -mfloat-ieee
19649 @opindex mfloat-vax
19650 @opindex mfloat-ieee
19651 Generate code that uses (does not use) VAX F and G floating-point
19652 arithmetic instead of IEEE single and double precision.
19653
19654 @item -mexplicit-relocs
19655 @itemx -mno-explicit-relocs
19656 @opindex mexplicit-relocs
19657 @opindex mno-explicit-relocs
19658 Older Alpha assemblers provided no way to generate symbol relocations
19659 except via assembler macros. Use of these macros does not allow
19660 optimal instruction scheduling. GNU binutils as of version 2.12
19661 supports a new syntax that allows the compiler to explicitly mark
19662 which relocations should apply to which instructions. This option
19663 is mostly useful for debugging, as GCC detects the capabilities of
19664 the assembler when it is built and sets the default accordingly.
19665
19666 @item -msmall-data
19667 @itemx -mlarge-data
19668 @opindex msmall-data
19669 @opindex mlarge-data
19670 When @option{-mexplicit-relocs} is in effect, static data is
19671 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19672 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19673 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19674 16-bit relocations off of the @code{$gp} register. This limits the
19675 size of the small data area to 64KB, but allows the variables to be
19676 directly accessed via a single instruction.
19677
19678 The default is @option{-mlarge-data}. With this option the data area
19679 is limited to just below 2GB@. Programs that require more than 2GB of
19680 data must use @code{malloc} or @code{mmap} to allocate the data in the
19681 heap instead of in the program's data segment.
19682
19683 When generating code for shared libraries, @option{-fpic} implies
19684 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19685
19686 @item -msmall-text
19687 @itemx -mlarge-text
19688 @opindex msmall-text
19689 @opindex mlarge-text
19690 When @option{-msmall-text} is used, the compiler assumes that the
19691 code of the entire program (or shared library) fits in 4MB, and is
19692 thus reachable with a branch instruction. When @option{-msmall-data}
19693 is used, the compiler can assume that all local symbols share the
19694 same @code{$gp} value, and thus reduce the number of instructions
19695 required for a function call from 4 to 1.
19696
19697 The default is @option{-mlarge-text}.
19698
19699 @item -mcpu=@var{cpu_type}
19700 @opindex mcpu
19701 Set the instruction set and instruction scheduling parameters for
19702 machine type @var{cpu_type}. You can specify either the @samp{EV}
19703 style name or the corresponding chip number. GCC supports scheduling
19704 parameters for the EV4, EV5 and EV6 family of processors and
19705 chooses the default values for the instruction set from the processor
19706 you specify. If you do not specify a processor type, GCC defaults
19707 to the processor on which the compiler was built.
19708
19709 Supported values for @var{cpu_type} are
19710
19711 @table @samp
19712 @item ev4
19713 @itemx ev45
19714 @itemx 21064
19715 Schedules as an EV4 and has no instruction set extensions.
19716
19717 @item ev5
19718 @itemx 21164
19719 Schedules as an EV5 and has no instruction set extensions.
19720
19721 @item ev56
19722 @itemx 21164a
19723 Schedules as an EV5 and supports the BWX extension.
19724
19725 @item pca56
19726 @itemx 21164pc
19727 @itemx 21164PC
19728 Schedules as an EV5 and supports the BWX and MAX extensions.
19729
19730 @item ev6
19731 @itemx 21264
19732 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19733
19734 @item ev67
19735 @itemx 21264a
19736 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19737 @end table
19738
19739 Native toolchains also support the value @samp{native},
19740 which selects the best architecture option for the host processor.
19741 @option{-mcpu=native} has no effect if GCC does not recognize
19742 the processor.
19743
19744 @item -mtune=@var{cpu_type}
19745 @opindex mtune
19746 Set only the instruction scheduling parameters for machine type
19747 @var{cpu_type}. The instruction set is not changed.
19748
19749 Native toolchains also support the value @samp{native},
19750 which selects the best architecture option for the host processor.
19751 @option{-mtune=native} has no effect if GCC does not recognize
19752 the processor.
19753
19754 @item -mmemory-latency=@var{time}
19755 @opindex mmemory-latency
19756 Sets the latency the scheduler should assume for typical memory
19757 references as seen by the application. This number is highly
19758 dependent on the memory access patterns used by the application
19759 and the size of the external cache on the machine.
19760
19761 Valid options for @var{time} are
19762
19763 @table @samp
19764 @item @var{number}
19765 A decimal number representing clock cycles.
19766
19767 @item L1
19768 @itemx L2
19769 @itemx L3
19770 @itemx main
19771 The compiler contains estimates of the number of clock cycles for
19772 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19773 (also called Dcache, Scache, and Bcache), as well as to main memory.
19774 Note that L3 is only valid for EV5.
19775
19776 @end table
19777 @end table
19778
19779 @node FR30 Options
19780 @subsection FR30 Options
19781 @cindex FR30 Options
19782
19783 These options are defined specifically for the FR30 port.
19784
19785 @table @gcctabopt
19786
19787 @item -msmall-model
19788 @opindex msmall-model
19789 Use the small address space model. This can produce smaller code, but
19790 it does assume that all symbolic values and addresses fit into a
19791 20-bit range.
19792
19793 @item -mno-lsim
19794 @opindex mno-lsim
19795 Assume that runtime support has been provided and so there is no need
19796 to include the simulator library (@file{libsim.a}) on the linker
19797 command line.
19798
19799 @end table
19800
19801 @node FT32 Options
19802 @subsection FT32 Options
19803 @cindex FT32 Options
19804
19805 These options are defined specifically for the FT32 port.
19806
19807 @table @gcctabopt
19808
19809 @item -msim
19810 @opindex msim
19811 Specifies that the program will be run on the simulator. This causes
19812 an alternate runtime startup and library to be linked.
19813 You must not use this option when generating programs that will run on
19814 real hardware; you must provide your own runtime library for whatever
19815 I/O functions are needed.
19816
19817 @item -mlra
19818 @opindex mlra
19819 Enable Local Register Allocation. This is still experimental for FT32,
19820 so by default the compiler uses standard reload.
19821
19822 @item -mnodiv
19823 @opindex mnodiv
19824 Do not use div and mod instructions.
19825
19826 @item -mft32b
19827 @opindex mft32b
19828 Enable use of the extended instructions of the FT32B processor.
19829
19830 @item -mcompress
19831 @opindex mcompress
19832 Compress all code using the Ft32B code compression scheme.
19833
19834 @item -mnopm
19835 @opindex mnopm
19836 Do not generate code that reads program memory.
19837
19838 @end table
19839
19840 @node FRV Options
19841 @subsection FRV Options
19842 @cindex FRV Options
19843
19844 @table @gcctabopt
19845 @item -mgpr-32
19846 @opindex mgpr-32
19847
19848 Only use the first 32 general-purpose registers.
19849
19850 @item -mgpr-64
19851 @opindex mgpr-64
19852
19853 Use all 64 general-purpose registers.
19854
19855 @item -mfpr-32
19856 @opindex mfpr-32
19857
19858 Use only the first 32 floating-point registers.
19859
19860 @item -mfpr-64
19861 @opindex mfpr-64
19862
19863 Use all 64 floating-point registers.
19864
19865 @item -mhard-float
19866 @opindex mhard-float
19867
19868 Use hardware instructions for floating-point operations.
19869
19870 @item -msoft-float
19871 @opindex msoft-float
19872
19873 Use library routines for floating-point operations.
19874
19875 @item -malloc-cc
19876 @opindex malloc-cc
19877
19878 Dynamically allocate condition code registers.
19879
19880 @item -mfixed-cc
19881 @opindex mfixed-cc
19882
19883 Do not try to dynamically allocate condition code registers, only
19884 use @code{icc0} and @code{fcc0}.
19885
19886 @item -mdword
19887 @opindex mdword
19888
19889 Change ABI to use double word insns.
19890
19891 @item -mno-dword
19892 @opindex mno-dword
19893 @opindex mdword
19894
19895 Do not use double word instructions.
19896
19897 @item -mdouble
19898 @opindex mdouble
19899
19900 Use floating-point double instructions.
19901
19902 @item -mno-double
19903 @opindex mno-double
19904
19905 Do not use floating-point double instructions.
19906
19907 @item -mmedia
19908 @opindex mmedia
19909
19910 Use media instructions.
19911
19912 @item -mno-media
19913 @opindex mno-media
19914
19915 Do not use media instructions.
19916
19917 @item -mmuladd
19918 @opindex mmuladd
19919
19920 Use multiply and add/subtract instructions.
19921
19922 @item -mno-muladd
19923 @opindex mno-muladd
19924
19925 Do not use multiply and add/subtract instructions.
19926
19927 @item -mfdpic
19928 @opindex mfdpic
19929
19930 Select the FDPIC ABI, which uses function descriptors to represent
19931 pointers to functions. Without any PIC/PIE-related options, it
19932 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19933 assumes GOT entries and small data are within a 12-bit range from the
19934 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19935 are computed with 32 bits.
19936 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19937
19938 @item -minline-plt
19939 @opindex minline-plt
19940
19941 Enable inlining of PLT entries in function calls to functions that are
19942 not known to bind locally. It has no effect without @option{-mfdpic}.
19943 It's enabled by default if optimizing for speed and compiling for
19944 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19945 optimization option such as @option{-O3} or above is present in the
19946 command line.
19947
19948 @item -mTLS
19949 @opindex mTLS
19950
19951 Assume a large TLS segment when generating thread-local code.
19952
19953 @item -mtls
19954 @opindex mtls
19955
19956 Do not assume a large TLS segment when generating thread-local code.
19957
19958 @item -mgprel-ro
19959 @opindex mgprel-ro
19960
19961 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19962 that is known to be in read-only sections. It's enabled by default,
19963 except for @option{-fpic} or @option{-fpie}: even though it may help
19964 make the global offset table smaller, it trades 1 instruction for 4.
19965 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19966 one of which may be shared by multiple symbols, and it avoids the need
19967 for a GOT entry for the referenced symbol, so it's more likely to be a
19968 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19969
19970 @item -multilib-library-pic
19971 @opindex multilib-library-pic
19972
19973 Link with the (library, not FD) pic libraries. It's implied by
19974 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19975 @option{-fpic} without @option{-mfdpic}. You should never have to use
19976 it explicitly.
19977
19978 @item -mlinked-fp
19979 @opindex mlinked-fp
19980
19981 Follow the EABI requirement of always creating a frame pointer whenever
19982 a stack frame is allocated. This option is enabled by default and can
19983 be disabled with @option{-mno-linked-fp}.
19984
19985 @item -mlong-calls
19986 @opindex mlong-calls
19987
19988 Use indirect addressing to call functions outside the current
19989 compilation unit. This allows the functions to be placed anywhere
19990 within the 32-bit address space.
19991
19992 @item -malign-labels
19993 @opindex malign-labels
19994
19995 Try to align labels to an 8-byte boundary by inserting NOPs into the
19996 previous packet. This option only has an effect when VLIW packing
19997 is enabled. It doesn't create new packets; it merely adds NOPs to
19998 existing ones.
19999
20000 @item -mlibrary-pic
20001 @opindex mlibrary-pic
20002
20003 Generate position-independent EABI code.
20004
20005 @item -macc-4
20006 @opindex macc-4
20007
20008 Use only the first four media accumulator registers.
20009
20010 @item -macc-8
20011 @opindex macc-8
20012
20013 Use all eight media accumulator registers.
20014
20015 @item -mpack
20016 @opindex mpack
20017
20018 Pack VLIW instructions.
20019
20020 @item -mno-pack
20021 @opindex mno-pack
20022
20023 Do not pack VLIW instructions.
20024
20025 @item -mno-eflags
20026 @opindex mno-eflags
20027
20028 Do not mark ABI switches in e_flags.
20029
20030 @item -mcond-move
20031 @opindex mcond-move
20032
20033 Enable the use of conditional-move instructions (default).
20034
20035 This switch is mainly for debugging the compiler and will likely be removed
20036 in a future version.
20037
20038 @item -mno-cond-move
20039 @opindex mno-cond-move
20040
20041 Disable the use of conditional-move instructions.
20042
20043 This switch is mainly for debugging the compiler and will likely be removed
20044 in a future version.
20045
20046 @item -mscc
20047 @opindex mscc
20048
20049 Enable the use of conditional set instructions (default).
20050
20051 This switch is mainly for debugging the compiler and will likely be removed
20052 in a future version.
20053
20054 @item -mno-scc
20055 @opindex mno-scc
20056
20057 Disable the use of conditional set instructions.
20058
20059 This switch is mainly for debugging the compiler and will likely be removed
20060 in a future version.
20061
20062 @item -mcond-exec
20063 @opindex mcond-exec
20064
20065 Enable the use of conditional execution (default).
20066
20067 This switch is mainly for debugging the compiler and will likely be removed
20068 in a future version.
20069
20070 @item -mno-cond-exec
20071 @opindex mno-cond-exec
20072
20073 Disable the use of conditional execution.
20074
20075 This switch is mainly for debugging the compiler and will likely be removed
20076 in a future version.
20077
20078 @item -mvliw-branch
20079 @opindex mvliw-branch
20080
20081 Run a pass to pack branches into VLIW instructions (default).
20082
20083 This switch is mainly for debugging the compiler and will likely be removed
20084 in a future version.
20085
20086 @item -mno-vliw-branch
20087 @opindex mno-vliw-branch
20088
20089 Do not run a pass to pack branches into VLIW instructions.
20090
20091 This switch is mainly for debugging the compiler and will likely be removed
20092 in a future version.
20093
20094 @item -mmulti-cond-exec
20095 @opindex mmulti-cond-exec
20096
20097 Enable optimization of @code{&&} and @code{||} in conditional execution
20098 (default).
20099
20100 This switch is mainly for debugging the compiler and will likely be removed
20101 in a future version.
20102
20103 @item -mno-multi-cond-exec
20104 @opindex mno-multi-cond-exec
20105
20106 Disable optimization of @code{&&} and @code{||} in conditional execution.
20107
20108 This switch is mainly for debugging the compiler and will likely be removed
20109 in a future version.
20110
20111 @item -mnested-cond-exec
20112 @opindex mnested-cond-exec
20113
20114 Enable nested conditional execution optimizations (default).
20115
20116 This switch is mainly for debugging the compiler and will likely be removed
20117 in a future version.
20118
20119 @item -mno-nested-cond-exec
20120 @opindex mno-nested-cond-exec
20121
20122 Disable nested conditional execution optimizations.
20123
20124 This switch is mainly for debugging the compiler and will likely be removed
20125 in a future version.
20126
20127 @item -moptimize-membar
20128 @opindex moptimize-membar
20129
20130 This switch removes redundant @code{membar} instructions from the
20131 compiler-generated code. It is enabled by default.
20132
20133 @item -mno-optimize-membar
20134 @opindex mno-optimize-membar
20135 @opindex moptimize-membar
20136
20137 This switch disables the automatic removal of redundant @code{membar}
20138 instructions from the generated code.
20139
20140 @item -mtomcat-stats
20141 @opindex mtomcat-stats
20142
20143 Cause gas to print out tomcat statistics.
20144
20145 @item -mcpu=@var{cpu}
20146 @opindex mcpu
20147
20148 Select the processor type for which to generate code. Possible values are
20149 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20150 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20151
20152 @end table
20153
20154 @node GNU/Linux Options
20155 @subsection GNU/Linux Options
20156
20157 These @samp{-m} options are defined for GNU/Linux targets:
20158
20159 @table @gcctabopt
20160 @item -mglibc
20161 @opindex mglibc
20162 Use the GNU C library. This is the default except
20163 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20164 @samp{*-*-linux-*android*} targets.
20165
20166 @item -muclibc
20167 @opindex muclibc
20168 Use uClibc C library. This is the default on
20169 @samp{*-*-linux-*uclibc*} targets.
20170
20171 @item -mmusl
20172 @opindex mmusl
20173 Use the musl C library. This is the default on
20174 @samp{*-*-linux-*musl*} targets.
20175
20176 @item -mbionic
20177 @opindex mbionic
20178 Use Bionic C library. This is the default on
20179 @samp{*-*-linux-*android*} targets.
20180
20181 @item -mandroid
20182 @opindex mandroid
20183 Compile code compatible with Android platform. This is the default on
20184 @samp{*-*-linux-*android*} targets.
20185
20186 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20187 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20188 this option makes the GCC driver pass Android-specific options to the linker.
20189 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20190 to be defined.
20191
20192 @item -tno-android-cc
20193 @opindex tno-android-cc
20194 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20195 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20196 @option{-fno-rtti} by default.
20197
20198 @item -tno-android-ld
20199 @opindex tno-android-ld
20200 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20201 linking options to the linker.
20202
20203 @end table
20204
20205 @node H8/300 Options
20206 @subsection H8/300 Options
20207
20208 These @samp{-m} options are defined for the H8/300 implementations:
20209
20210 @table @gcctabopt
20211 @item -mrelax
20212 @opindex mrelax
20213 Shorten some address references at link time, when possible; uses the
20214 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20215 ld, Using ld}, for a fuller description.
20216
20217 @item -mh
20218 @opindex mh
20219 Generate code for the H8/300H@.
20220
20221 @item -ms
20222 @opindex ms
20223 Generate code for the H8S@.
20224
20225 @item -mn
20226 @opindex mn
20227 Generate code for the H8S and H8/300H in the normal mode. This switch
20228 must be used either with @option{-mh} or @option{-ms}.
20229
20230 @item -ms2600
20231 @opindex ms2600
20232 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20233
20234 @item -mexr
20235 @opindex mexr
20236 Extended registers are stored on stack before execution of function
20237 with monitor attribute. Default option is @option{-mexr}.
20238 This option is valid only for H8S targets.
20239
20240 @item -mno-exr
20241 @opindex mno-exr
20242 @opindex mexr
20243 Extended registers are not stored on stack before execution of function
20244 with monitor attribute. Default option is @option{-mno-exr}.
20245 This option is valid only for H8S targets.
20246
20247 @item -mint32
20248 @opindex mint32
20249 Make @code{int} data 32 bits by default.
20250
20251 @item -malign-300
20252 @opindex malign-300
20253 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20254 The default for the H8/300H and H8S is to align longs and floats on
20255 4-byte boundaries.
20256 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20257 This option has no effect on the H8/300.
20258 @end table
20259
20260 @node HPPA Options
20261 @subsection HPPA Options
20262 @cindex HPPA Options
20263
20264 These @samp{-m} options are defined for the HPPA family of computers:
20265
20266 @table @gcctabopt
20267 @item -march=@var{architecture-type}
20268 @opindex march
20269 Generate code for the specified architecture. The choices for
20270 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20271 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20272 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20273 architecture option for your machine. Code compiled for lower numbered
20274 architectures runs on higher numbered architectures, but not the
20275 other way around.
20276
20277 @item -mpa-risc-1-0
20278 @itemx -mpa-risc-1-1
20279 @itemx -mpa-risc-2-0
20280 @opindex mpa-risc-1-0
20281 @opindex mpa-risc-1-1
20282 @opindex mpa-risc-2-0
20283 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20284
20285 @item -mcaller-copies
20286 @opindex mcaller-copies
20287 The caller copies function arguments passed by hidden reference. This
20288 option should be used with care as it is not compatible with the default
20289 32-bit runtime. However, only aggregates larger than eight bytes are
20290 passed by hidden reference and the option provides better compatibility
20291 with OpenMP.
20292
20293 @item -mjump-in-delay
20294 @opindex mjump-in-delay
20295 This option is ignored and provided for compatibility purposes only.
20296
20297 @item -mdisable-fpregs
20298 @opindex mdisable-fpregs
20299 Prevent floating-point registers from being used in any manner. This is
20300 necessary for compiling kernels that perform lazy context switching of
20301 floating-point registers. If you use this option and attempt to perform
20302 floating-point operations, the compiler aborts.
20303
20304 @item -mdisable-indexing
20305 @opindex mdisable-indexing
20306 Prevent the compiler from using indexing address modes. This avoids some
20307 rather obscure problems when compiling MIG generated code under MACH@.
20308
20309 @item -mno-space-regs
20310 @opindex mno-space-regs
20311 @opindex mspace-regs
20312 Generate code that assumes the target has no space registers. This allows
20313 GCC to generate faster indirect calls and use unscaled index address modes.
20314
20315 Such code is suitable for level 0 PA systems and kernels.
20316
20317 @item -mfast-indirect-calls
20318 @opindex mfast-indirect-calls
20319 Generate code that assumes calls never cross space boundaries. This
20320 allows GCC to emit code that performs faster indirect calls.
20321
20322 This option does not work in the presence of shared libraries or nested
20323 functions.
20324
20325 @item -mfixed-range=@var{register-range}
20326 @opindex mfixed-range
20327 Generate code treating the given register range as fixed registers.
20328 A fixed register is one that the register allocator cannot use. This is
20329 useful when compiling kernel code. A register range is specified as
20330 two registers separated by a dash. Multiple register ranges can be
20331 specified separated by a comma.
20332
20333 @item -mlong-load-store
20334 @opindex mlong-load-store
20335 Generate 3-instruction load and store sequences as sometimes required by
20336 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20337 the HP compilers.
20338
20339 @item -mportable-runtime
20340 @opindex mportable-runtime
20341 Use the portable calling conventions proposed by HP for ELF systems.
20342
20343 @item -mgas
20344 @opindex mgas
20345 Enable the use of assembler directives only GAS understands.
20346
20347 @item -mschedule=@var{cpu-type}
20348 @opindex mschedule
20349 Schedule code according to the constraints for the machine type
20350 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20351 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20352 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20353 proper scheduling option for your machine. The default scheduling is
20354 @samp{8000}.
20355
20356 @item -mlinker-opt
20357 @opindex mlinker-opt
20358 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20359 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20360 linkers in which they give bogus error messages when linking some programs.
20361
20362 @item -msoft-float
20363 @opindex msoft-float
20364 Generate output containing library calls for floating point.
20365 @strong{Warning:} the requisite libraries are not available for all HPPA
20366 targets. Normally the facilities of the machine's usual C compiler are
20367 used, but this cannot be done directly in cross-compilation. You must make
20368 your own arrangements to provide suitable library functions for
20369 cross-compilation.
20370
20371 @option{-msoft-float} changes the calling convention in the output file;
20372 therefore, it is only useful if you compile @emph{all} of a program with
20373 this option. In particular, you need to compile @file{libgcc.a}, the
20374 library that comes with GCC, with @option{-msoft-float} in order for
20375 this to work.
20376
20377 @item -msio
20378 @opindex msio
20379 Generate the predefine, @code{_SIO}, for server IO@. The default is
20380 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20381 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20382 options are available under HP-UX and HI-UX@.
20383
20384 @item -mgnu-ld
20385 @opindex mgnu-ld
20386 Use options specific to GNU @command{ld}.
20387 This passes @option{-shared} to @command{ld} when
20388 building a shared library. It is the default when GCC is configured,
20389 explicitly or implicitly, with the GNU linker. This option does not
20390 affect which @command{ld} is called; it only changes what parameters
20391 are passed to that @command{ld}.
20392 The @command{ld} that is called is determined by the
20393 @option{--with-ld} configure option, GCC's program search path, and
20394 finally by the user's @env{PATH}. The linker used by GCC can be printed
20395 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20396 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20397
20398 @item -mhp-ld
20399 @opindex mhp-ld
20400 Use options specific to HP @command{ld}.
20401 This passes @option{-b} to @command{ld} when building
20402 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20403 links. It is the default when GCC is configured, explicitly or
20404 implicitly, with the HP linker. This option does not affect
20405 which @command{ld} is called; it only changes what parameters are passed to that
20406 @command{ld}.
20407 The @command{ld} that is called is determined by the @option{--with-ld}
20408 configure option, GCC's program search path, and finally by the user's
20409 @env{PATH}. The linker used by GCC can be printed using @samp{which
20410 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20411 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20412
20413 @item -mlong-calls
20414 @opindex mno-long-calls
20415 @opindex mlong-calls
20416 Generate code that uses long call sequences. This ensures that a call
20417 is always able to reach linker generated stubs. The default is to generate
20418 long calls only when the distance from the call site to the beginning
20419 of the function or translation unit, as the case may be, exceeds a
20420 predefined limit set by the branch type being used. The limits for
20421 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20422 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20423 240,000 bytes.
20424
20425 Distances are measured from the beginning of functions when using the
20426 @option{-ffunction-sections} option, or when using the @option{-mgas}
20427 and @option{-mno-portable-runtime} options together under HP-UX with
20428 the SOM linker.
20429
20430 It is normally not desirable to use this option as it degrades
20431 performance. However, it may be useful in large applications,
20432 particularly when partial linking is used to build the application.
20433
20434 The types of long calls used depends on the capabilities of the
20435 assembler and linker, and the type of code being generated. The
20436 impact on systems that support long absolute calls, and long pic
20437 symbol-difference or pc-relative calls should be relatively small.
20438 However, an indirect call is used on 32-bit ELF systems in pic code
20439 and it is quite long.
20440
20441 @item -munix=@var{unix-std}
20442 @opindex march
20443 Generate compiler predefines and select a startfile for the specified
20444 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20445 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20446 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20447 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20448 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20449 and later.
20450
20451 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20452 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20453 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20454 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20455 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20456 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20457
20458 It is @emph{important} to note that this option changes the interfaces
20459 for various library routines. It also affects the operational behavior
20460 of the C library. Thus, @emph{extreme} care is needed in using this
20461 option.
20462
20463 Library code that is intended to operate with more than one UNIX
20464 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20465 as appropriate. Most GNU software doesn't provide this capability.
20466
20467 @item -nolibdld
20468 @opindex nolibdld
20469 Suppress the generation of link options to search libdld.sl when the
20470 @option{-static} option is specified on HP-UX 10 and later.
20471
20472 @item -static
20473 @opindex static
20474 The HP-UX implementation of setlocale in libc has a dependency on
20475 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20476 when the @option{-static} option is specified, special link options
20477 are needed to resolve this dependency.
20478
20479 On HP-UX 10 and later, the GCC driver adds the necessary options to
20480 link with libdld.sl when the @option{-static} option is specified.
20481 This causes the resulting binary to be dynamic. On the 64-bit port,
20482 the linkers generate dynamic binaries by default in any case. The
20483 @option{-nolibdld} option can be used to prevent the GCC driver from
20484 adding these link options.
20485
20486 @item -threads
20487 @opindex threads
20488 Add support for multithreading with the @dfn{dce thread} library
20489 under HP-UX@. This option sets flags for both the preprocessor and
20490 linker.
20491 @end table
20492
20493 @node IA-64 Options
20494 @subsection IA-64 Options
20495 @cindex IA-64 Options
20496
20497 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20498
20499 @table @gcctabopt
20500 @item -mbig-endian
20501 @opindex mbig-endian
20502 Generate code for a big-endian target. This is the default for HP-UX@.
20503
20504 @item -mlittle-endian
20505 @opindex mlittle-endian
20506 Generate code for a little-endian target. This is the default for AIX5
20507 and GNU/Linux.
20508
20509 @item -mgnu-as
20510 @itemx -mno-gnu-as
20511 @opindex mgnu-as
20512 @opindex mno-gnu-as
20513 Generate (or don't) code for the GNU assembler. This is the default.
20514 @c Also, this is the default if the configure option @option{--with-gnu-as}
20515 @c is used.
20516
20517 @item -mgnu-ld
20518 @itemx -mno-gnu-ld
20519 @opindex mgnu-ld
20520 @opindex mno-gnu-ld
20521 Generate (or don't) code for the GNU linker. This is the default.
20522 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20523 @c is used.
20524
20525 @item -mno-pic
20526 @opindex mno-pic
20527 Generate code that does not use a global pointer register. The result
20528 is not position independent code, and violates the IA-64 ABI@.
20529
20530 @item -mvolatile-asm-stop
20531 @itemx -mno-volatile-asm-stop
20532 @opindex mvolatile-asm-stop
20533 @opindex mno-volatile-asm-stop
20534 Generate (or don't) a stop bit immediately before and after volatile asm
20535 statements.
20536
20537 @item -mregister-names
20538 @itemx -mno-register-names
20539 @opindex mregister-names
20540 @opindex mno-register-names
20541 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20542 the stacked registers. This may make assembler output more readable.
20543
20544 @item -mno-sdata
20545 @itemx -msdata
20546 @opindex mno-sdata
20547 @opindex msdata
20548 Disable (or enable) optimizations that use the small data section. This may
20549 be useful for working around optimizer bugs.
20550
20551 @item -mconstant-gp
20552 @opindex mconstant-gp
20553 Generate code that uses a single constant global pointer value. This is
20554 useful when compiling kernel code.
20555
20556 @item -mauto-pic
20557 @opindex mauto-pic
20558 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20559 This is useful when compiling firmware code.
20560
20561 @item -minline-float-divide-min-latency
20562 @opindex minline-float-divide-min-latency
20563 Generate code for inline divides of floating-point values
20564 using the minimum latency algorithm.
20565
20566 @item -minline-float-divide-max-throughput
20567 @opindex minline-float-divide-max-throughput
20568 Generate code for inline divides of floating-point values
20569 using the maximum throughput algorithm.
20570
20571 @item -mno-inline-float-divide
20572 @opindex mno-inline-float-divide
20573 Do not generate inline code for divides of floating-point values.
20574
20575 @item -minline-int-divide-min-latency
20576 @opindex minline-int-divide-min-latency
20577 Generate code for inline divides of integer values
20578 using the minimum latency algorithm.
20579
20580 @item -minline-int-divide-max-throughput
20581 @opindex minline-int-divide-max-throughput
20582 Generate code for inline divides of integer values
20583 using the maximum throughput algorithm.
20584
20585 @item -mno-inline-int-divide
20586 @opindex mno-inline-int-divide
20587 @opindex minline-int-divide
20588 Do not generate inline code for divides of integer values.
20589
20590 @item -minline-sqrt-min-latency
20591 @opindex minline-sqrt-min-latency
20592 Generate code for inline square roots
20593 using the minimum latency algorithm.
20594
20595 @item -minline-sqrt-max-throughput
20596 @opindex minline-sqrt-max-throughput
20597 Generate code for inline square roots
20598 using the maximum throughput algorithm.
20599
20600 @item -mno-inline-sqrt
20601 @opindex mno-inline-sqrt
20602 Do not generate inline code for @code{sqrt}.
20603
20604 @item -mfused-madd
20605 @itemx -mno-fused-madd
20606 @opindex mfused-madd
20607 @opindex mno-fused-madd
20608 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20609 instructions. The default is to use these instructions.
20610
20611 @item -mno-dwarf2-asm
20612 @itemx -mdwarf2-asm
20613 @opindex mno-dwarf2-asm
20614 @opindex mdwarf2-asm
20615 Don't (or do) generate assembler code for the DWARF line number debugging
20616 info. This may be useful when not using the GNU assembler.
20617
20618 @item -mearly-stop-bits
20619 @itemx -mno-early-stop-bits
20620 @opindex mearly-stop-bits
20621 @opindex mno-early-stop-bits
20622 Allow stop bits to be placed earlier than immediately preceding the
20623 instruction that triggered the stop bit. This can improve instruction
20624 scheduling, but does not always do so.
20625
20626 @item -mfixed-range=@var{register-range}
20627 @opindex mfixed-range
20628 Generate code treating the given register range as fixed registers.
20629 A fixed register is one that the register allocator cannot use. This is
20630 useful when compiling kernel code. A register range is specified as
20631 two registers separated by a dash. Multiple register ranges can be
20632 specified separated by a comma.
20633
20634 @item -mtls-size=@var{tls-size}
20635 @opindex mtls-size
20636 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20637 64.
20638
20639 @item -mtune=@var{cpu-type}
20640 @opindex mtune
20641 Tune the instruction scheduling for a particular CPU, Valid values are
20642 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20643 and @samp{mckinley}.
20644
20645 @item -milp32
20646 @itemx -mlp64
20647 @opindex milp32
20648 @opindex mlp64
20649 Generate code for a 32-bit or 64-bit environment.
20650 The 32-bit environment sets int, long and pointer to 32 bits.
20651 The 64-bit environment sets int to 32 bits and long and pointer
20652 to 64 bits. These are HP-UX specific flags.
20653
20654 @item -mno-sched-br-data-spec
20655 @itemx -msched-br-data-spec
20656 @opindex mno-sched-br-data-spec
20657 @opindex msched-br-data-spec
20658 (Dis/En)able data speculative scheduling before reload.
20659 This results in generation of @code{ld.a} instructions and
20660 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20661 The default setting is disabled.
20662
20663 @item -msched-ar-data-spec
20664 @itemx -mno-sched-ar-data-spec
20665 @opindex msched-ar-data-spec
20666 @opindex mno-sched-ar-data-spec
20667 (En/Dis)able data speculative scheduling after reload.
20668 This results in generation of @code{ld.a} instructions and
20669 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20670 The default setting is enabled.
20671
20672 @item -mno-sched-control-spec
20673 @itemx -msched-control-spec
20674 @opindex mno-sched-control-spec
20675 @opindex msched-control-spec
20676 (Dis/En)able control speculative scheduling. This feature is
20677 available only during region scheduling (i.e.@: before reload).
20678 This results in generation of the @code{ld.s} instructions and
20679 the corresponding check instructions @code{chk.s}.
20680 The default setting is disabled.
20681
20682 @item -msched-br-in-data-spec
20683 @itemx -mno-sched-br-in-data-spec
20684 @opindex msched-br-in-data-spec
20685 @opindex mno-sched-br-in-data-spec
20686 (En/Dis)able speculative scheduling of the instructions that
20687 are dependent on the data speculative loads before reload.
20688 This is effective only with @option{-msched-br-data-spec} enabled.
20689 The default setting is enabled.
20690
20691 @item -msched-ar-in-data-spec
20692 @itemx -mno-sched-ar-in-data-spec
20693 @opindex msched-ar-in-data-spec
20694 @opindex mno-sched-ar-in-data-spec
20695 (En/Dis)able speculative scheduling of the instructions that
20696 are dependent on the data speculative loads after reload.
20697 This is effective only with @option{-msched-ar-data-spec} enabled.
20698 The default setting is enabled.
20699
20700 @item -msched-in-control-spec
20701 @itemx -mno-sched-in-control-spec
20702 @opindex msched-in-control-spec
20703 @opindex mno-sched-in-control-spec
20704 (En/Dis)able speculative scheduling of the instructions that
20705 are dependent on the control speculative loads.
20706 This is effective only with @option{-msched-control-spec} enabled.
20707 The default setting is enabled.
20708
20709 @item -mno-sched-prefer-non-data-spec-insns
20710 @itemx -msched-prefer-non-data-spec-insns
20711 @opindex mno-sched-prefer-non-data-spec-insns
20712 @opindex msched-prefer-non-data-spec-insns
20713 If enabled, data-speculative instructions are chosen for schedule
20714 only if there are no other choices at the moment. This makes
20715 the use of the data speculation much more conservative.
20716 The default setting is disabled.
20717
20718 @item -mno-sched-prefer-non-control-spec-insns
20719 @itemx -msched-prefer-non-control-spec-insns
20720 @opindex mno-sched-prefer-non-control-spec-insns
20721 @opindex msched-prefer-non-control-spec-insns
20722 If enabled, control-speculative instructions are chosen for schedule
20723 only if there are no other choices at the moment. This makes
20724 the use of the control speculation much more conservative.
20725 The default setting is disabled.
20726
20727 @item -mno-sched-count-spec-in-critical-path
20728 @itemx -msched-count-spec-in-critical-path
20729 @opindex mno-sched-count-spec-in-critical-path
20730 @opindex msched-count-spec-in-critical-path
20731 If enabled, speculative dependencies are considered during
20732 computation of the instructions priorities. This makes the use of the
20733 speculation a bit more conservative.
20734 The default setting is disabled.
20735
20736 @item -msched-spec-ldc
20737 @opindex msched-spec-ldc
20738 Use a simple data speculation check. This option is on by default.
20739
20740 @item -msched-control-spec-ldc
20741 @opindex msched-spec-ldc
20742 Use a simple check for control speculation. This option is on by default.
20743
20744 @item -msched-stop-bits-after-every-cycle
20745 @opindex msched-stop-bits-after-every-cycle
20746 Place a stop bit after every cycle when scheduling. This option is on
20747 by default.
20748
20749 @item -msched-fp-mem-deps-zero-cost
20750 @opindex msched-fp-mem-deps-zero-cost
20751 Assume that floating-point stores and loads are not likely to cause a conflict
20752 when placed into the same instruction group. This option is disabled by
20753 default.
20754
20755 @item -msel-sched-dont-check-control-spec
20756 @opindex msel-sched-dont-check-control-spec
20757 Generate checks for control speculation in selective scheduling.
20758 This flag is disabled by default.
20759
20760 @item -msched-max-memory-insns=@var{max-insns}
20761 @opindex msched-max-memory-insns
20762 Limit on the number of memory insns per instruction group, giving lower
20763 priority to subsequent memory insns attempting to schedule in the same
20764 instruction group. Frequently useful to prevent cache bank conflicts.
20765 The default value is 1.
20766
20767 @item -msched-max-memory-insns-hard-limit
20768 @opindex msched-max-memory-insns-hard-limit
20769 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20770 disallowing more than that number in an instruction group.
20771 Otherwise, the limit is ``soft'', meaning that non-memory operations
20772 are preferred when the limit is reached, but memory operations may still
20773 be scheduled.
20774
20775 @end table
20776
20777 @node LM32 Options
20778 @subsection LM32 Options
20779 @cindex LM32 options
20780
20781 These @option{-m} options are defined for the LatticeMico32 architecture:
20782
20783 @table @gcctabopt
20784 @item -mbarrel-shift-enabled
20785 @opindex mbarrel-shift-enabled
20786 Enable barrel-shift instructions.
20787
20788 @item -mdivide-enabled
20789 @opindex mdivide-enabled
20790 Enable divide and modulus instructions.
20791
20792 @item -mmultiply-enabled
20793 @opindex multiply-enabled
20794 Enable multiply instructions.
20795
20796 @item -msign-extend-enabled
20797 @opindex msign-extend-enabled
20798 Enable sign extend instructions.
20799
20800 @item -muser-enabled
20801 @opindex muser-enabled
20802 Enable user-defined instructions.
20803
20804 @end table
20805
20806 @node M32C Options
20807 @subsection M32C Options
20808 @cindex M32C options
20809
20810 @table @gcctabopt
20811 @item -mcpu=@var{name}
20812 @opindex mcpu=
20813 Select the CPU for which code is generated. @var{name} may be one of
20814 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20815 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20816 the M32C/80 series.
20817
20818 @item -msim
20819 @opindex msim
20820 Specifies that the program will be run on the simulator. This causes
20821 an alternate runtime library to be linked in which supports, for
20822 example, file I/O@. You must not use this option when generating
20823 programs that will run on real hardware; you must provide your own
20824 runtime library for whatever I/O functions are needed.
20825
20826 @item -memregs=@var{number}
20827 @opindex memregs=
20828 Specifies the number of memory-based pseudo-registers GCC uses
20829 during code generation. These pseudo-registers are used like real
20830 registers, so there is a tradeoff between GCC's ability to fit the
20831 code into available registers, and the performance penalty of using
20832 memory instead of registers. Note that all modules in a program must
20833 be compiled with the same value for this option. Because of that, you
20834 must not use this option with GCC's default runtime libraries.
20835
20836 @end table
20837
20838 @node M32R/D Options
20839 @subsection M32R/D Options
20840 @cindex M32R/D options
20841
20842 These @option{-m} options are defined for Renesas M32R/D architectures:
20843
20844 @table @gcctabopt
20845 @item -m32r2
20846 @opindex m32r2
20847 Generate code for the M32R/2@.
20848
20849 @item -m32rx
20850 @opindex m32rx
20851 Generate code for the M32R/X@.
20852
20853 @item -m32r
20854 @opindex m32r
20855 Generate code for the M32R@. This is the default.
20856
20857 @item -mmodel=small
20858 @opindex mmodel=small
20859 Assume all objects live in the lower 16MB of memory (so that their addresses
20860 can be loaded with the @code{ld24} instruction), and assume all subroutines
20861 are reachable with the @code{bl} instruction.
20862 This is the default.
20863
20864 The addressability of a particular object can be set with the
20865 @code{model} attribute.
20866
20867 @item -mmodel=medium
20868 @opindex mmodel=medium
20869 Assume objects may be anywhere in the 32-bit address space (the compiler
20870 generates @code{seth/add3} instructions to load their addresses), and
20871 assume all subroutines are reachable with the @code{bl} instruction.
20872
20873 @item -mmodel=large
20874 @opindex mmodel=large
20875 Assume objects may be anywhere in the 32-bit address space (the compiler
20876 generates @code{seth/add3} instructions to load their addresses), and
20877 assume subroutines may not be reachable with the @code{bl} instruction
20878 (the compiler generates the much slower @code{seth/add3/jl}
20879 instruction sequence).
20880
20881 @item -msdata=none
20882 @opindex msdata=none
20883 Disable use of the small data area. Variables are put into
20884 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20885 @code{section} attribute has been specified).
20886 This is the default.
20887
20888 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20889 Objects may be explicitly put in the small data area with the
20890 @code{section} attribute using one of these sections.
20891
20892 @item -msdata=sdata
20893 @opindex msdata=sdata
20894 Put small global and static data in the small data area, but do not
20895 generate special code to reference them.
20896
20897 @item -msdata=use
20898 @opindex msdata=use
20899 Put small global and static data in the small data area, and generate
20900 special instructions to reference them.
20901
20902 @item -G @var{num}
20903 @opindex G
20904 @cindex smaller data references
20905 Put global and static objects less than or equal to @var{num} bytes
20906 into the small data or BSS sections instead of the normal data or BSS
20907 sections. The default value of @var{num} is 8.
20908 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20909 for this option to have any effect.
20910
20911 All modules should be compiled with the same @option{-G @var{num}} value.
20912 Compiling with different values of @var{num} may or may not work; if it
20913 doesn't the linker gives an error message---incorrect code is not
20914 generated.
20915
20916 @item -mdebug
20917 @opindex mdebug
20918 Makes the M32R-specific code in the compiler display some statistics
20919 that might help in debugging programs.
20920
20921 @item -malign-loops
20922 @opindex malign-loops
20923 Align all loops to a 32-byte boundary.
20924
20925 @item -mno-align-loops
20926 @opindex mno-align-loops
20927 Do not enforce a 32-byte alignment for loops. This is the default.
20928
20929 @item -missue-rate=@var{number}
20930 @opindex missue-rate=@var{number}
20931 Issue @var{number} instructions per cycle. @var{number} can only be 1
20932 or 2.
20933
20934 @item -mbranch-cost=@var{number}
20935 @opindex mbranch-cost=@var{number}
20936 @var{number} can only be 1 or 2. If it is 1 then branches are
20937 preferred over conditional code, if it is 2, then the opposite applies.
20938
20939 @item -mflush-trap=@var{number}
20940 @opindex mflush-trap=@var{number}
20941 Specifies the trap number to use to flush the cache. The default is
20942 12. Valid numbers are between 0 and 15 inclusive.
20943
20944 @item -mno-flush-trap
20945 @opindex mno-flush-trap
20946 Specifies that the cache cannot be flushed by using a trap.
20947
20948 @item -mflush-func=@var{name}
20949 @opindex mflush-func=@var{name}
20950 Specifies the name of the operating system function to call to flush
20951 the cache. The default is @samp{_flush_cache}, but a function call
20952 is only used if a trap is not available.
20953
20954 @item -mno-flush-func
20955 @opindex mno-flush-func
20956 Indicates that there is no OS function for flushing the cache.
20957
20958 @end table
20959
20960 @node M680x0 Options
20961 @subsection M680x0 Options
20962 @cindex M680x0 options
20963
20964 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20965 The default settings depend on which architecture was selected when
20966 the compiler was configured; the defaults for the most common choices
20967 are given below.
20968
20969 @table @gcctabopt
20970 @item -march=@var{arch}
20971 @opindex march
20972 Generate code for a specific M680x0 or ColdFire instruction set
20973 architecture. Permissible values of @var{arch} for M680x0
20974 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20975 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20976 architectures are selected according to Freescale's ISA classification
20977 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20978 @samp{isab} and @samp{isac}.
20979
20980 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20981 code for a ColdFire target. The @var{arch} in this macro is one of the
20982 @option{-march} arguments given above.
20983
20984 When used together, @option{-march} and @option{-mtune} select code
20985 that runs on a family of similar processors but that is optimized
20986 for a particular microarchitecture.
20987
20988 @item -mcpu=@var{cpu}
20989 @opindex mcpu
20990 Generate code for a specific M680x0 or ColdFire processor.
20991 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20992 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20993 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20994 below, which also classifies the CPUs into families:
20995
20996 @multitable @columnfractions 0.20 0.80
20997 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20998 @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}
20999 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
21000 @item @samp{5206e} @tab @samp{5206e}
21001 @item @samp{5208} @tab @samp{5207} @samp{5208}
21002 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
21003 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
21004 @item @samp{5216} @tab @samp{5214} @samp{5216}
21005 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
21006 @item @samp{5225} @tab @samp{5224} @samp{5225}
21007 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
21008 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
21009 @item @samp{5249} @tab @samp{5249}
21010 @item @samp{5250} @tab @samp{5250}
21011 @item @samp{5271} @tab @samp{5270} @samp{5271}
21012 @item @samp{5272} @tab @samp{5272}
21013 @item @samp{5275} @tab @samp{5274} @samp{5275}
21014 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
21015 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
21016 @item @samp{5307} @tab @samp{5307}
21017 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
21018 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
21019 @item @samp{5407} @tab @samp{5407}
21020 @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}
21021 @end multitable
21022
21023 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
21024 @var{arch} is compatible with @var{cpu}. Other combinations of
21025 @option{-mcpu} and @option{-march} are rejected.
21026
21027 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
21028 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
21029 where the value of @var{family} is given by the table above.
21030
21031 @item -mtune=@var{tune}
21032 @opindex mtune
21033 Tune the code for a particular microarchitecture within the
21034 constraints set by @option{-march} and @option{-mcpu}.
21035 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
21036 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
21037 and @samp{cpu32}. The ColdFire microarchitectures
21038 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
21039
21040 You can also use @option{-mtune=68020-40} for code that needs
21041 to run relatively well on 68020, 68030 and 68040 targets.
21042 @option{-mtune=68020-60} is similar but includes 68060 targets
21043 as well. These two options select the same tuning decisions as
21044 @option{-m68020-40} and @option{-m68020-60} respectively.
21045
21046 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
21047 when tuning for 680x0 architecture @var{arch}. It also defines
21048 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
21049 option is used. If GCC is tuning for a range of architectures,
21050 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
21051 it defines the macros for every architecture in the range.
21052
21053 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
21054 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
21055 of the arguments given above.
21056
21057 @item -m68000
21058 @itemx -mc68000
21059 @opindex m68000
21060 @opindex mc68000
21061 Generate output for a 68000. This is the default
21062 when the compiler is configured for 68000-based systems.
21063 It is equivalent to @option{-march=68000}.
21064
21065 Use this option for microcontrollers with a 68000 or EC000 core,
21066 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21067
21068 @item -m68010
21069 @opindex m68010
21070 Generate output for a 68010. This is the default
21071 when the compiler is configured for 68010-based systems.
21072 It is equivalent to @option{-march=68010}.
21073
21074 @item -m68020
21075 @itemx -mc68020
21076 @opindex m68020
21077 @opindex mc68020
21078 Generate output for a 68020. This is the default
21079 when the compiler is configured for 68020-based systems.
21080 It is equivalent to @option{-march=68020}.
21081
21082 @item -m68030
21083 @opindex m68030
21084 Generate output for a 68030. This is the default when the compiler is
21085 configured for 68030-based systems. It is equivalent to
21086 @option{-march=68030}.
21087
21088 @item -m68040
21089 @opindex m68040
21090 Generate output for a 68040. This is the default when the compiler is
21091 configured for 68040-based systems. It is equivalent to
21092 @option{-march=68040}.
21093
21094 This option inhibits the use of 68881/68882 instructions that have to be
21095 emulated by software on the 68040. Use this option if your 68040 does not
21096 have code to emulate those instructions.
21097
21098 @item -m68060
21099 @opindex m68060
21100 Generate output for a 68060. This is the default when the compiler is
21101 configured for 68060-based systems. It is equivalent to
21102 @option{-march=68060}.
21103
21104 This option inhibits the use of 68020 and 68881/68882 instructions that
21105 have to be emulated by software on the 68060. Use this option if your 68060
21106 does not have code to emulate those instructions.
21107
21108 @item -mcpu32
21109 @opindex mcpu32
21110 Generate output for a CPU32. This is the default
21111 when the compiler is configured for CPU32-based systems.
21112 It is equivalent to @option{-march=cpu32}.
21113
21114 Use this option for microcontrollers with a
21115 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21116 68336, 68340, 68341, 68349 and 68360.
21117
21118 @item -m5200
21119 @opindex m5200
21120 Generate output for a 520X ColdFire CPU@. This is the default
21121 when the compiler is configured for 520X-based systems.
21122 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21123 in favor of that option.
21124
21125 Use this option for microcontroller with a 5200 core, including
21126 the MCF5202, MCF5203, MCF5204 and MCF5206.
21127
21128 @item -m5206e
21129 @opindex m5206e
21130 Generate output for a 5206e ColdFire CPU@. The option is now
21131 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21132
21133 @item -m528x
21134 @opindex m528x
21135 Generate output for a member of the ColdFire 528X family.
21136 The option is now deprecated in favor of the equivalent
21137 @option{-mcpu=528x}.
21138
21139 @item -m5307
21140 @opindex m5307
21141 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21142 in favor of the equivalent @option{-mcpu=5307}.
21143
21144 @item -m5407
21145 @opindex m5407
21146 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21147 in favor of the equivalent @option{-mcpu=5407}.
21148
21149 @item -mcfv4e
21150 @opindex mcfv4e
21151 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21152 This includes use of hardware floating-point instructions.
21153 The option is equivalent to @option{-mcpu=547x}, and is now
21154 deprecated in favor of that option.
21155
21156 @item -m68020-40
21157 @opindex m68020-40
21158 Generate output for a 68040, without using any of the new instructions.
21159 This results in code that can run relatively efficiently on either a
21160 68020/68881 or a 68030 or a 68040. The generated code does use the
21161 68881 instructions that are emulated on the 68040.
21162
21163 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21164
21165 @item -m68020-60
21166 @opindex m68020-60
21167 Generate output for a 68060, without using any of the new instructions.
21168 This results in code that can run relatively efficiently on either a
21169 68020/68881 or a 68030 or a 68040. The generated code does use the
21170 68881 instructions that are emulated on the 68060.
21171
21172 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21173
21174 @item -mhard-float
21175 @itemx -m68881
21176 @opindex mhard-float
21177 @opindex m68881
21178 Generate floating-point instructions. This is the default for 68020
21179 and above, and for ColdFire devices that have an FPU@. It defines the
21180 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21181 on ColdFire targets.
21182
21183 @item -msoft-float
21184 @opindex msoft-float
21185 Do not generate floating-point instructions; use library calls instead.
21186 This is the default for 68000, 68010, and 68832 targets. It is also
21187 the default for ColdFire devices that have no FPU.
21188
21189 @item -mdiv
21190 @itemx -mno-div
21191 @opindex mdiv
21192 @opindex mno-div
21193 Generate (do not generate) ColdFire hardware divide and remainder
21194 instructions. If @option{-march} is used without @option{-mcpu},
21195 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21196 architectures. Otherwise, the default is taken from the target CPU
21197 (either the default CPU, or the one specified by @option{-mcpu}). For
21198 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21199 @option{-mcpu=5206e}.
21200
21201 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21202
21203 @item -mshort
21204 @opindex mshort
21205 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21206 Additionally, parameters passed on the stack are also aligned to a
21207 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21208
21209 @item -mno-short
21210 @opindex mno-short
21211 Do not consider type @code{int} to be 16 bits wide. This is the default.
21212
21213 @item -mnobitfield
21214 @itemx -mno-bitfield
21215 @opindex mnobitfield
21216 @opindex mno-bitfield
21217 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21218 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21219
21220 @item -mbitfield
21221 @opindex mbitfield
21222 Do use the bit-field instructions. The @option{-m68020} option implies
21223 @option{-mbitfield}. This is the default if you use a configuration
21224 designed for a 68020.
21225
21226 @item -mrtd
21227 @opindex mrtd
21228 Use a different function-calling convention, in which functions
21229 that take a fixed number of arguments return with the @code{rtd}
21230 instruction, which pops their arguments while returning. This
21231 saves one instruction in the caller since there is no need to pop
21232 the arguments there.
21233
21234 This calling convention is incompatible with the one normally
21235 used on Unix, so you cannot use it if you need to call libraries
21236 compiled with the Unix compiler.
21237
21238 Also, you must provide function prototypes for all functions that
21239 take variable numbers of arguments (including @code{printf});
21240 otherwise incorrect code is generated for calls to those
21241 functions.
21242
21243 In addition, seriously incorrect code results if you call a
21244 function with too many arguments. (Normally, extra arguments are
21245 harmlessly ignored.)
21246
21247 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21248 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21249
21250 The default is @option{-mno-rtd}.
21251
21252 @item -malign-int
21253 @itemx -mno-align-int
21254 @opindex malign-int
21255 @opindex mno-align-int
21256 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21257 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21258 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21259 Aligning variables on 32-bit boundaries produces code that runs somewhat
21260 faster on processors with 32-bit busses at the expense of more memory.
21261
21262 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21263 aligns structures containing the above types differently than
21264 most published application binary interface specifications for the m68k.
21265
21266 @item -mpcrel
21267 @opindex mpcrel
21268 Use the pc-relative addressing mode of the 68000 directly, instead of
21269 using a global offset table. At present, this option implies @option{-fpic},
21270 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21271 not presently supported with @option{-mpcrel}, though this could be supported for
21272 68020 and higher processors.
21273
21274 @item -mno-strict-align
21275 @itemx -mstrict-align
21276 @opindex mno-strict-align
21277 @opindex mstrict-align
21278 Do not (do) assume that unaligned memory references are handled by
21279 the system.
21280
21281 @item -msep-data
21282 Generate code that allows the data segment to be located in a different
21283 area of memory from the text segment. This allows for execute-in-place in
21284 an environment without virtual memory management. This option implies
21285 @option{-fPIC}.
21286
21287 @item -mno-sep-data
21288 Generate code that assumes that the data segment follows the text segment.
21289 This is the default.
21290
21291 @item -mid-shared-library
21292 Generate code that supports shared libraries via the library ID method.
21293 This allows for execute-in-place and shared libraries in an environment
21294 without virtual memory management. This option implies @option{-fPIC}.
21295
21296 @item -mno-id-shared-library
21297 Generate code that doesn't assume ID-based shared libraries are being used.
21298 This is the default.
21299
21300 @item -mshared-library-id=n
21301 Specifies the identification number of the ID-based shared library being
21302 compiled. Specifying a value of 0 generates more compact code; specifying
21303 other values forces the allocation of that number to the current
21304 library, but is no more space- or time-efficient than omitting this option.
21305
21306 @item -mxgot
21307 @itemx -mno-xgot
21308 @opindex mxgot
21309 @opindex mno-xgot
21310 When generating position-independent code for ColdFire, generate code
21311 that works if the GOT has more than 8192 entries. This code is
21312 larger and slower than code generated without this option. On M680x0
21313 processors, this option is not needed; @option{-fPIC} suffices.
21314
21315 GCC normally uses a single instruction to load values from the GOT@.
21316 While this is relatively efficient, it only works if the GOT
21317 is smaller than about 64k. Anything larger causes the linker
21318 to report an error such as:
21319
21320 @cindex relocation truncated to fit (ColdFire)
21321 @smallexample
21322 relocation truncated to fit: R_68K_GOT16O foobar
21323 @end smallexample
21324
21325 If this happens, you should recompile your code with @option{-mxgot}.
21326 It should then work with very large GOTs. However, code generated with
21327 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21328 the value of a global symbol.
21329
21330 Note that some linkers, including newer versions of the GNU linker,
21331 can create multiple GOTs and sort GOT entries. If you have such a linker,
21332 you should only need to use @option{-mxgot} when compiling a single
21333 object file that accesses more than 8192 GOT entries. Very few do.
21334
21335 These options have no effect unless GCC is generating
21336 position-independent code.
21337
21338 @item -mlong-jump-table-offsets
21339 @opindex mlong-jump-table-offsets
21340 Use 32-bit offsets in @code{switch} tables. The default is to use
21341 16-bit offsets.
21342
21343 @end table
21344
21345 @node MCore Options
21346 @subsection MCore Options
21347 @cindex MCore options
21348
21349 These are the @samp{-m} options defined for the Motorola M*Core
21350 processors.
21351
21352 @table @gcctabopt
21353
21354 @item -mhardlit
21355 @itemx -mno-hardlit
21356 @opindex mhardlit
21357 @opindex mno-hardlit
21358 Inline constants into the code stream if it can be done in two
21359 instructions or less.
21360
21361 @item -mdiv
21362 @itemx -mno-div
21363 @opindex mdiv
21364 @opindex mno-div
21365 Use the divide instruction. (Enabled by default).
21366
21367 @item -mrelax-immediate
21368 @itemx -mno-relax-immediate
21369 @opindex mrelax-immediate
21370 @opindex mno-relax-immediate
21371 Allow arbitrary-sized immediates in bit operations.
21372
21373 @item -mwide-bitfields
21374 @itemx -mno-wide-bitfields
21375 @opindex mwide-bitfields
21376 @opindex mno-wide-bitfields
21377 Always treat bit-fields as @code{int}-sized.
21378
21379 @item -m4byte-functions
21380 @itemx -mno-4byte-functions
21381 @opindex m4byte-functions
21382 @opindex mno-4byte-functions
21383 Force all functions to be aligned to a 4-byte boundary.
21384
21385 @item -mcallgraph-data
21386 @itemx -mno-callgraph-data
21387 @opindex mcallgraph-data
21388 @opindex mno-callgraph-data
21389 Emit callgraph information.
21390
21391 @item -mslow-bytes
21392 @itemx -mno-slow-bytes
21393 @opindex mslow-bytes
21394 @opindex mno-slow-bytes
21395 Prefer word access when reading byte quantities.
21396
21397 @item -mlittle-endian
21398 @itemx -mbig-endian
21399 @opindex mlittle-endian
21400 @opindex mbig-endian
21401 Generate code for a little-endian target.
21402
21403 @item -m210
21404 @itemx -m340
21405 @opindex m210
21406 @opindex m340
21407 Generate code for the 210 processor.
21408
21409 @item -mno-lsim
21410 @opindex mno-lsim
21411 Assume that runtime support has been provided and so omit the
21412 simulator library (@file{libsim.a)} from the linker command line.
21413
21414 @item -mstack-increment=@var{size}
21415 @opindex mstack-increment
21416 Set the maximum amount for a single stack increment operation. Large
21417 values can increase the speed of programs that contain functions
21418 that need a large amount of stack space, but they can also trigger a
21419 segmentation fault if the stack is extended too much. The default
21420 value is 0x1000.
21421
21422 @end table
21423
21424 @node MeP Options
21425 @subsection MeP Options
21426 @cindex MeP options
21427
21428 @table @gcctabopt
21429
21430 @item -mabsdiff
21431 @opindex mabsdiff
21432 Enables the @code{abs} instruction, which is the absolute difference
21433 between two registers.
21434
21435 @item -mall-opts
21436 @opindex mall-opts
21437 Enables all the optional instructions---average, multiply, divide, bit
21438 operations, leading zero, absolute difference, min/max, clip, and
21439 saturation.
21440
21441
21442 @item -maverage
21443 @opindex maverage
21444 Enables the @code{ave} instruction, which computes the average of two
21445 registers.
21446
21447 @item -mbased=@var{n}
21448 @opindex mbased=
21449 Variables of size @var{n} bytes or smaller are placed in the
21450 @code{.based} section by default. Based variables use the @code{$tp}
21451 register as a base register, and there is a 128-byte limit to the
21452 @code{.based} section.
21453
21454 @item -mbitops
21455 @opindex mbitops
21456 Enables the bit operation instructions---bit test (@code{btstm}), set
21457 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21458 test-and-set (@code{tas}).
21459
21460 @item -mc=@var{name}
21461 @opindex mc=
21462 Selects which section constant data is placed in. @var{name} may
21463 be @samp{tiny}, @samp{near}, or @samp{far}.
21464
21465 @item -mclip
21466 @opindex mclip
21467 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21468 useful unless you also provide @option{-mminmax}.
21469
21470 @item -mconfig=@var{name}
21471 @opindex mconfig=
21472 Selects one of the built-in core configurations. Each MeP chip has
21473 one or more modules in it; each module has a core CPU and a variety of
21474 coprocessors, optional instructions, and peripherals. The
21475 @code{MeP-Integrator} tool, not part of GCC, provides these
21476 configurations through this option; using this option is the same as
21477 using all the corresponding command-line options. The default
21478 configuration is @samp{default}.
21479
21480 @item -mcop
21481 @opindex mcop
21482 Enables the coprocessor instructions. By default, this is a 32-bit
21483 coprocessor. Note that the coprocessor is normally enabled via the
21484 @option{-mconfig=} option.
21485
21486 @item -mcop32
21487 @opindex mcop32
21488 Enables the 32-bit coprocessor's instructions.
21489
21490 @item -mcop64
21491 @opindex mcop64
21492 Enables the 64-bit coprocessor's instructions.
21493
21494 @item -mivc2
21495 @opindex mivc2
21496 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21497
21498 @item -mdc
21499 @opindex mdc
21500 Causes constant variables to be placed in the @code{.near} section.
21501
21502 @item -mdiv
21503 @opindex mdiv
21504 Enables the @code{div} and @code{divu} instructions.
21505
21506 @item -meb
21507 @opindex meb
21508 Generate big-endian code.
21509
21510 @item -mel
21511 @opindex mel
21512 Generate little-endian code.
21513
21514 @item -mio-volatile
21515 @opindex mio-volatile
21516 Tells the compiler that any variable marked with the @code{io}
21517 attribute is to be considered volatile.
21518
21519 @item -ml
21520 @opindex ml
21521 Causes variables to be assigned to the @code{.far} section by default.
21522
21523 @item -mleadz
21524 @opindex mleadz
21525 Enables the @code{leadz} (leading zero) instruction.
21526
21527 @item -mm
21528 @opindex mm
21529 Causes variables to be assigned to the @code{.near} section by default.
21530
21531 @item -mminmax
21532 @opindex mminmax
21533 Enables the @code{min} and @code{max} instructions.
21534
21535 @item -mmult
21536 @opindex mmult
21537 Enables the multiplication and multiply-accumulate instructions.
21538
21539 @item -mno-opts
21540 @opindex mno-opts
21541 Disables all the optional instructions enabled by @option{-mall-opts}.
21542
21543 @item -mrepeat
21544 @opindex mrepeat
21545 Enables the @code{repeat} and @code{erepeat} instructions, used for
21546 low-overhead looping.
21547
21548 @item -ms
21549 @opindex ms
21550 Causes all variables to default to the @code{.tiny} section. Note
21551 that there is a 65536-byte limit to this section. Accesses to these
21552 variables use the @code{%gp} base register.
21553
21554 @item -msatur
21555 @opindex msatur
21556 Enables the saturation instructions. Note that the compiler does not
21557 currently generate these itself, but this option is included for
21558 compatibility with other tools, like @code{as}.
21559
21560 @item -msdram
21561 @opindex msdram
21562 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21563
21564 @item -msim
21565 @opindex msim
21566 Link the simulator run-time libraries.
21567
21568 @item -msimnovec
21569 @opindex msimnovec
21570 Link the simulator runtime libraries, excluding built-in support
21571 for reset and exception vectors and tables.
21572
21573 @item -mtf
21574 @opindex mtf
21575 Causes all functions to default to the @code{.far} section. Without
21576 this option, functions default to the @code{.near} section.
21577
21578 @item -mtiny=@var{n}
21579 @opindex mtiny=
21580 Variables that are @var{n} bytes or smaller are allocated to the
21581 @code{.tiny} section. These variables use the @code{$gp} base
21582 register. The default for this option is 4, but note that there's a
21583 65536-byte limit to the @code{.tiny} section.
21584
21585 @end table
21586
21587 @node MicroBlaze Options
21588 @subsection MicroBlaze Options
21589 @cindex MicroBlaze Options
21590
21591 @table @gcctabopt
21592
21593 @item -msoft-float
21594 @opindex msoft-float
21595 Use software emulation for floating point (default).
21596
21597 @item -mhard-float
21598 @opindex mhard-float
21599 Use hardware floating-point instructions.
21600
21601 @item -mmemcpy
21602 @opindex mmemcpy
21603 Do not optimize block moves, use @code{memcpy}.
21604
21605 @item -mno-clearbss
21606 @opindex mno-clearbss
21607 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21608
21609 @item -mcpu=@var{cpu-type}
21610 @opindex mcpu=
21611 Use features of, and schedule code for, the given CPU.
21612 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21613 where @var{X} is a major version, @var{YY} is the minor version, and
21614 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21615 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21616
21617 @item -mxl-soft-mul
21618 @opindex mxl-soft-mul
21619 Use software multiply emulation (default).
21620
21621 @item -mxl-soft-div
21622 @opindex mxl-soft-div
21623 Use software emulation for divides (default).
21624
21625 @item -mxl-barrel-shift
21626 @opindex mxl-barrel-shift
21627 Use the hardware barrel shifter.
21628
21629 @item -mxl-pattern-compare
21630 @opindex mxl-pattern-compare
21631 Use pattern compare instructions.
21632
21633 @item -msmall-divides
21634 @opindex msmall-divides
21635 Use table lookup optimization for small signed integer divisions.
21636
21637 @item -mxl-stack-check
21638 @opindex mxl-stack-check
21639 This option is deprecated. Use @option{-fstack-check} instead.
21640
21641 @item -mxl-gp-opt
21642 @opindex mxl-gp-opt
21643 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21644
21645 @item -mxl-multiply-high
21646 @opindex mxl-multiply-high
21647 Use multiply high instructions for high part of 32x32 multiply.
21648
21649 @item -mxl-float-convert
21650 @opindex mxl-float-convert
21651 Use hardware floating-point conversion instructions.
21652
21653 @item -mxl-float-sqrt
21654 @opindex mxl-float-sqrt
21655 Use hardware floating-point square root instruction.
21656
21657 @item -mbig-endian
21658 @opindex mbig-endian
21659 Generate code for a big-endian target.
21660
21661 @item -mlittle-endian
21662 @opindex mlittle-endian
21663 Generate code for a little-endian target.
21664
21665 @item -mxl-reorder
21666 @opindex mxl-reorder
21667 Use reorder instructions (swap and byte reversed load/store).
21668
21669 @item -mxl-mode-@var{app-model}
21670 Select application model @var{app-model}. Valid models are
21671 @table @samp
21672 @item executable
21673 normal executable (default), uses startup code @file{crt0.o}.
21674
21675 @item -mpic-data-is-text-relative
21676 @opindex mpic-data-is-text-relative
21677 Assume that the displacement between the text and data segments is fixed
21678 at static link time. This allows data to be referenced by offset from start of
21679 text address instead of GOT since PC-relative addressing is not supported.
21680
21681 @item xmdstub
21682 for use with Xilinx Microprocessor Debugger (XMD) based
21683 software intrusive debug agent called xmdstub. This uses startup file
21684 @file{crt1.o} and sets the start address of the program to 0x800.
21685
21686 @item bootstrap
21687 for applications that are loaded using a bootloader.
21688 This model uses startup file @file{crt2.o} which does not contain a processor
21689 reset vector handler. This is suitable for transferring control on a
21690 processor reset to the bootloader rather than the application.
21691
21692 @item novectors
21693 for applications that do not require any of the
21694 MicroBlaze vectors. This option may be useful for applications running
21695 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21696 @end table
21697
21698 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21699 @option{-mxl-mode-@var{app-model}}.
21700
21701 @end table
21702
21703 @node MIPS Options
21704 @subsection MIPS Options
21705 @cindex MIPS options
21706
21707 @table @gcctabopt
21708
21709 @item -EB
21710 @opindex EB
21711 Generate big-endian code.
21712
21713 @item -EL
21714 @opindex EL
21715 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21716 configurations.
21717
21718 @item -march=@var{arch}
21719 @opindex march
21720 Generate code that runs on @var{arch}, which can be the name of a
21721 generic MIPS ISA, or the name of a particular processor.
21722 The ISA names are:
21723 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21724 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21725 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21726 @samp{mips64r5} and @samp{mips64r6}.
21727 The processor names are:
21728 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21729 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21730 @samp{5kc}, @samp{5kf},
21731 @samp{20kc},
21732 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21733 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21734 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21735 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21736 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21737 @samp{i6400}, @samp{i6500},
21738 @samp{interaptiv},
21739 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21740 @samp{gs464e}, @samp{gs264e},
21741 @samp{m4k},
21742 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21743 @samp{m5100}, @samp{m5101},
21744 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21745 @samp{orion},
21746 @samp{p5600}, @samp{p6600},
21747 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21748 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21749 @samp{r6000}, @samp{r8000},
21750 @samp{rm7000}, @samp{rm9000},
21751 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21752 @samp{sb1},
21753 @samp{sr71000},
21754 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21755 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21756 @samp{xlr} and @samp{xlp}.
21757 The special value @samp{from-abi} selects the
21758 most compatible architecture for the selected ABI (that is,
21759 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21760
21761 The native Linux/GNU toolchain also supports the value @samp{native},
21762 which selects the best architecture option for the host processor.
21763 @option{-march=native} has no effect if GCC does not recognize
21764 the processor.
21765
21766 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21767 (for example, @option{-march=r2k}). Prefixes are optional, and
21768 @samp{vr} may be written @samp{r}.
21769
21770 Names of the form @samp{@var{n}f2_1} refer to processors with
21771 FPUs clocked at half the rate of the core, names of the form
21772 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21773 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21774 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21775 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21776 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21777 accepted as synonyms for @samp{@var{n}f1_1}.
21778
21779 GCC defines two macros based on the value of this option. The first
21780 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21781 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21782 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21783 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21784 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21785
21786 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21787 above. In other words, it has the full prefix and does not
21788 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21789 the macro names the resolved architecture (either @code{"mips1"} or
21790 @code{"mips3"}). It names the default architecture when no
21791 @option{-march} option is given.
21792
21793 @item -mtune=@var{arch}
21794 @opindex mtune
21795 Optimize for @var{arch}. Among other things, this option controls
21796 the way instructions are scheduled, and the perceived cost of arithmetic
21797 operations. The list of @var{arch} values is the same as for
21798 @option{-march}.
21799
21800 When this option is not used, GCC optimizes for the processor
21801 specified by @option{-march}. By using @option{-march} and
21802 @option{-mtune} together, it is possible to generate code that
21803 runs on a family of processors, but optimize the code for one
21804 particular member of that family.
21805
21806 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21807 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21808 @option{-march} ones described above.
21809
21810 @item -mips1
21811 @opindex mips1
21812 Equivalent to @option{-march=mips1}.
21813
21814 @item -mips2
21815 @opindex mips2
21816 Equivalent to @option{-march=mips2}.
21817
21818 @item -mips3
21819 @opindex mips3
21820 Equivalent to @option{-march=mips3}.
21821
21822 @item -mips4
21823 @opindex mips4
21824 Equivalent to @option{-march=mips4}.
21825
21826 @item -mips32
21827 @opindex mips32
21828 Equivalent to @option{-march=mips32}.
21829
21830 @item -mips32r3
21831 @opindex mips32r3
21832 Equivalent to @option{-march=mips32r3}.
21833
21834 @item -mips32r5
21835 @opindex mips32r5
21836 Equivalent to @option{-march=mips32r5}.
21837
21838 @item -mips32r6
21839 @opindex mips32r6
21840 Equivalent to @option{-march=mips32r6}.
21841
21842 @item -mips64
21843 @opindex mips64
21844 Equivalent to @option{-march=mips64}.
21845
21846 @item -mips64r2
21847 @opindex mips64r2
21848 Equivalent to @option{-march=mips64r2}.
21849
21850 @item -mips64r3
21851 @opindex mips64r3
21852 Equivalent to @option{-march=mips64r3}.
21853
21854 @item -mips64r5
21855 @opindex mips64r5
21856 Equivalent to @option{-march=mips64r5}.
21857
21858 @item -mips64r6
21859 @opindex mips64r6
21860 Equivalent to @option{-march=mips64r6}.
21861
21862 @item -mips16
21863 @itemx -mno-mips16
21864 @opindex mips16
21865 @opindex mno-mips16
21866 Generate (do not generate) MIPS16 code. If GCC is targeting a
21867 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21868
21869 MIPS16 code generation can also be controlled on a per-function basis
21870 by means of @code{mips16} and @code{nomips16} attributes.
21871 @xref{Function Attributes}, for more information.
21872
21873 @item -mflip-mips16
21874 @opindex mflip-mips16
21875 Generate MIPS16 code on alternating functions. This option is provided
21876 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21877 not intended for ordinary use in compiling user code.
21878
21879 @item -minterlink-compressed
21880 @itemx -mno-interlink-compressed
21881 @opindex minterlink-compressed
21882 @opindex mno-interlink-compressed
21883 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21884 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21885
21886 For example, code using the standard ISA encoding cannot jump directly
21887 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21888 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21889 knows that the target of the jump is not compressed.
21890
21891 @item -minterlink-mips16
21892 @itemx -mno-interlink-mips16
21893 @opindex minterlink-mips16
21894 @opindex mno-interlink-mips16
21895 Aliases of @option{-minterlink-compressed} and
21896 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21897 and are retained for backwards compatibility.
21898
21899 @item -mabi=32
21900 @itemx -mabi=o64
21901 @itemx -mabi=n32
21902 @itemx -mabi=64
21903 @itemx -mabi=eabi
21904 @opindex mabi=32
21905 @opindex mabi=o64
21906 @opindex mabi=n32
21907 @opindex mabi=64
21908 @opindex mabi=eabi
21909 Generate code for the given ABI@.
21910
21911 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21912 generates 64-bit code when you select a 64-bit architecture, but you
21913 can use @option{-mgp32} to get 32-bit code instead.
21914
21915 For information about the O64 ABI, see
21916 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21917
21918 GCC supports a variant of the o32 ABI in which floating-point registers
21919 are 64 rather than 32 bits wide. You can select this combination with
21920 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21921 and @code{mfhc1} instructions and is therefore only supported for
21922 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21923
21924 The register assignments for arguments and return values remain the
21925 same, but each scalar value is passed in a single 64-bit register
21926 rather than a pair of 32-bit registers. For example, scalar
21927 floating-point values are returned in @samp{$f0} only, not a
21928 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21929 remains the same in that the even-numbered double-precision registers
21930 are saved.
21931
21932 Two additional variants of the o32 ABI are supported to enable
21933 a transition from 32-bit to 64-bit registers. These are FPXX
21934 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21935 The FPXX extension mandates that all code must execute correctly
21936 when run using 32-bit or 64-bit registers. The code can be interlinked
21937 with either FP32 or FP64, but not both.
21938 The FP64A extension is similar to the FP64 extension but forbids the
21939 use of odd-numbered single-precision registers. This can be used
21940 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21941 processors and allows both FP32 and FP64A code to interlink and
21942 run in the same process without changing FPU modes.
21943
21944 @item -mabicalls
21945 @itemx -mno-abicalls
21946 @opindex mabicalls
21947 @opindex mno-abicalls
21948 Generate (do not generate) code that is suitable for SVR4-style
21949 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21950 systems.
21951
21952 @item -mshared
21953 @itemx -mno-shared
21954 Generate (do not generate) code that is fully position-independent,
21955 and that can therefore be linked into shared libraries. This option
21956 only affects @option{-mabicalls}.
21957
21958 All @option{-mabicalls} code has traditionally been position-independent,
21959 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21960 as an extension, the GNU toolchain allows executables to use absolute
21961 accesses for locally-binding symbols. It can also use shorter GP
21962 initialization sequences and generate direct calls to locally-defined
21963 functions. This mode is selected by @option{-mno-shared}.
21964
21965 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21966 objects that can only be linked by the GNU linker. However, the option
21967 does not affect the ABI of the final executable; it only affects the ABI
21968 of relocatable objects. Using @option{-mno-shared} generally makes
21969 executables both smaller and quicker.
21970
21971 @option{-mshared} is the default.
21972
21973 @item -mplt
21974 @itemx -mno-plt
21975 @opindex mplt
21976 @opindex mno-plt
21977 Assume (do not assume) that the static and dynamic linkers
21978 support PLTs and copy relocations. This option only affects
21979 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21980 has no effect without @option{-msym32}.
21981
21982 You can make @option{-mplt} the default by configuring
21983 GCC with @option{--with-mips-plt}. The default is
21984 @option{-mno-plt} otherwise.
21985
21986 @item -mxgot
21987 @itemx -mno-xgot
21988 @opindex mxgot
21989 @opindex mno-xgot
21990 Lift (do not lift) the usual restrictions on the size of the global
21991 offset table.
21992
21993 GCC normally uses a single instruction to load values from the GOT@.
21994 While this is relatively efficient, it only works if the GOT
21995 is smaller than about 64k. Anything larger causes the linker
21996 to report an error such as:
21997
21998 @cindex relocation truncated to fit (MIPS)
21999 @smallexample
22000 relocation truncated to fit: R_MIPS_GOT16 foobar
22001 @end smallexample
22002
22003 If this happens, you should recompile your code with @option{-mxgot}.
22004 This works with very large GOTs, although the code is also
22005 less efficient, since it takes three instructions to fetch the
22006 value of a global symbol.
22007
22008 Note that some linkers can create multiple GOTs. If you have such a
22009 linker, you should only need to use @option{-mxgot} when a single object
22010 file accesses more than 64k's worth of GOT entries. Very few do.
22011
22012 These options have no effect unless GCC is generating position
22013 independent code.
22014
22015 @item -mgp32
22016 @opindex mgp32
22017 Assume that general-purpose registers are 32 bits wide.
22018
22019 @item -mgp64
22020 @opindex mgp64
22021 Assume that general-purpose registers are 64 bits wide.
22022
22023 @item -mfp32
22024 @opindex mfp32
22025 Assume that floating-point registers are 32 bits wide.
22026
22027 @item -mfp64
22028 @opindex mfp64
22029 Assume that floating-point registers are 64 bits wide.
22030
22031 @item -mfpxx
22032 @opindex mfpxx
22033 Do not assume the width of floating-point registers.
22034
22035 @item -mhard-float
22036 @opindex mhard-float
22037 Use floating-point coprocessor instructions.
22038
22039 @item -msoft-float
22040 @opindex msoft-float
22041 Do not use floating-point coprocessor instructions. Implement
22042 floating-point calculations using library calls instead.
22043
22044 @item -mno-float
22045 @opindex mno-float
22046 Equivalent to @option{-msoft-float}, but additionally asserts that the
22047 program being compiled does not perform any floating-point operations.
22048 This option is presently supported only by some bare-metal MIPS
22049 configurations, where it may select a special set of libraries
22050 that lack all floating-point support (including, for example, the
22051 floating-point @code{printf} formats).
22052 If code compiled with @option{-mno-float} accidentally contains
22053 floating-point operations, it is likely to suffer a link-time
22054 or run-time failure.
22055
22056 @item -msingle-float
22057 @opindex msingle-float
22058 Assume that the floating-point coprocessor only supports single-precision
22059 operations.
22060
22061 @item -mdouble-float
22062 @opindex mdouble-float
22063 Assume that the floating-point coprocessor supports double-precision
22064 operations. This is the default.
22065
22066 @item -modd-spreg
22067 @itemx -mno-odd-spreg
22068 @opindex modd-spreg
22069 @opindex mno-odd-spreg
22070 Enable the use of odd-numbered single-precision floating-point registers
22071 for the o32 ABI. This is the default for processors that are known to
22072 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22073 is set by default.
22074
22075 @item -mabs=2008
22076 @itemx -mabs=legacy
22077 @opindex mabs=2008
22078 @opindex mabs=legacy
22079 These options control the treatment of the special not-a-number (NaN)
22080 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22081 @code{neg.@i{fmt}} machine instructions.
22082
22083 By default or when @option{-mabs=legacy} is used the legacy
22084 treatment is selected. In this case these instructions are considered
22085 arithmetic and avoided where correct operation is required and the
22086 input operand might be a NaN. A longer sequence of instructions that
22087 manipulate the sign bit of floating-point datum manually is used
22088 instead unless the @option{-ffinite-math-only} option has also been
22089 specified.
22090
22091 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
22092 this case these instructions are considered non-arithmetic and therefore
22093 operating correctly in all cases, including in particular where the
22094 input operand is a NaN. These instructions are therefore always used
22095 for the respective operations.
22096
22097 @item -mnan=2008
22098 @itemx -mnan=legacy
22099 @opindex mnan=2008
22100 @opindex mnan=legacy
22101 These options control the encoding of the special not-a-number (NaN)
22102 IEEE 754 floating-point data.
22103
22104 The @option{-mnan=legacy} option selects the legacy encoding. In this
22105 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22106 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22107 by the first bit of their trailing significand field being 1.
22108
22109 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
22110 this case qNaNs are denoted by the first bit of their trailing
22111 significand field being 1, whereas sNaNs are denoted by the first bit of
22112 their trailing significand field being 0.
22113
22114 The default is @option{-mnan=legacy} unless GCC has been configured with
22115 @option{--with-nan=2008}.
22116
22117 @item -mllsc
22118 @itemx -mno-llsc
22119 @opindex mllsc
22120 @opindex mno-llsc
22121 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22122 implement atomic memory built-in functions. When neither option is
22123 specified, GCC uses the instructions if the target architecture
22124 supports them.
22125
22126 @option{-mllsc} is useful if the runtime environment can emulate the
22127 instructions and @option{-mno-llsc} can be useful when compiling for
22128 nonstandard ISAs. You can make either option the default by
22129 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22130 respectively. @option{--with-llsc} is the default for some
22131 configurations; see the installation documentation for details.
22132
22133 @item -mdsp
22134 @itemx -mno-dsp
22135 @opindex mdsp
22136 @opindex mno-dsp
22137 Use (do not use) revision 1 of the MIPS DSP ASE@.
22138 @xref{MIPS DSP Built-in Functions}. This option defines the
22139 preprocessor macro @code{__mips_dsp}. It also defines
22140 @code{__mips_dsp_rev} to 1.
22141
22142 @item -mdspr2
22143 @itemx -mno-dspr2
22144 @opindex mdspr2
22145 @opindex mno-dspr2
22146 Use (do not use) revision 2 of the MIPS DSP ASE@.
22147 @xref{MIPS DSP Built-in Functions}. This option defines the
22148 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22149 It also defines @code{__mips_dsp_rev} to 2.
22150
22151 @item -msmartmips
22152 @itemx -mno-smartmips
22153 @opindex msmartmips
22154 @opindex mno-smartmips
22155 Use (do not use) the MIPS SmartMIPS ASE.
22156
22157 @item -mpaired-single
22158 @itemx -mno-paired-single
22159 @opindex mpaired-single
22160 @opindex mno-paired-single
22161 Use (do not use) paired-single floating-point instructions.
22162 @xref{MIPS Paired-Single Support}. This option requires
22163 hardware floating-point support to be enabled.
22164
22165 @item -mdmx
22166 @itemx -mno-mdmx
22167 @opindex mdmx
22168 @opindex mno-mdmx
22169 Use (do not use) MIPS Digital Media Extension instructions.
22170 This option can only be used when generating 64-bit code and requires
22171 hardware floating-point support to be enabled.
22172
22173 @item -mips3d
22174 @itemx -mno-mips3d
22175 @opindex mips3d
22176 @opindex mno-mips3d
22177 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22178 The option @option{-mips3d} implies @option{-mpaired-single}.
22179
22180 @item -mmicromips
22181 @itemx -mno-micromips
22182 @opindex mmicromips
22183 @opindex mno-mmicromips
22184 Generate (do not generate) microMIPS code.
22185
22186 MicroMIPS code generation can also be controlled on a per-function basis
22187 by means of @code{micromips} and @code{nomicromips} attributes.
22188 @xref{Function Attributes}, for more information.
22189
22190 @item -mmt
22191 @itemx -mno-mt
22192 @opindex mmt
22193 @opindex mno-mt
22194 Use (do not use) MT Multithreading instructions.
22195
22196 @item -mmcu
22197 @itemx -mno-mcu
22198 @opindex mmcu
22199 @opindex mno-mcu
22200 Use (do not use) the MIPS MCU ASE instructions.
22201
22202 @item -meva
22203 @itemx -mno-eva
22204 @opindex meva
22205 @opindex mno-eva
22206 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22207
22208 @item -mvirt
22209 @itemx -mno-virt
22210 @opindex mvirt
22211 @opindex mno-virt
22212 Use (do not use) the MIPS Virtualization (VZ) instructions.
22213
22214 @item -mxpa
22215 @itemx -mno-xpa
22216 @opindex mxpa
22217 @opindex mno-xpa
22218 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22219
22220 @item -mcrc
22221 @itemx -mno-crc
22222 @opindex mcrc
22223 @opindex mno-crc
22224 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22225
22226 @item -mginv
22227 @itemx -mno-ginv
22228 @opindex mginv
22229 @opindex mno-ginv
22230 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22231
22232 @item -mloongson-mmi
22233 @itemx -mno-loongson-mmi
22234 @opindex mloongson-mmi
22235 @opindex mno-loongson-mmi
22236 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22237
22238 @item -mloongson-ext
22239 @itemx -mno-loongson-ext
22240 @opindex mloongson-ext
22241 @opindex mno-loongson-ext
22242 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22243
22244 @item -mloongson-ext2
22245 @itemx -mno-loongson-ext2
22246 @opindex mloongson-ext2
22247 @opindex mno-loongson-ext2
22248 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22249
22250 @item -mlong64
22251 @opindex mlong64
22252 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22253 an explanation of the default and the way that the pointer size is
22254 determined.
22255
22256 @item -mlong32
22257 @opindex mlong32
22258 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22259
22260 The default size of @code{int}s, @code{long}s and pointers depends on
22261 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22262 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22263 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22264 or the same size as integer registers, whichever is smaller.
22265
22266 @item -msym32
22267 @itemx -mno-sym32
22268 @opindex msym32
22269 @opindex mno-sym32
22270 Assume (do not assume) that all symbols have 32-bit values, regardless
22271 of the selected ABI@. This option is useful in combination with
22272 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22273 to generate shorter and faster references to symbolic addresses.
22274
22275 @item -G @var{num}
22276 @opindex G
22277 Put definitions of externally-visible data in a small data section
22278 if that data is no bigger than @var{num} bytes. GCC can then generate
22279 more efficient accesses to the data; see @option{-mgpopt} for details.
22280
22281 The default @option{-G} option depends on the configuration.
22282
22283 @item -mlocal-sdata
22284 @itemx -mno-local-sdata
22285 @opindex mlocal-sdata
22286 @opindex mno-local-sdata
22287 Extend (do not extend) the @option{-G} behavior to local data too,
22288 such as to static variables in C@. @option{-mlocal-sdata} is the
22289 default for all configurations.
22290
22291 If the linker complains that an application is using too much small data,
22292 you might want to try rebuilding the less performance-critical parts with
22293 @option{-mno-local-sdata}. You might also want to build large
22294 libraries with @option{-mno-local-sdata}, so that the libraries leave
22295 more room for the main program.
22296
22297 @item -mextern-sdata
22298 @itemx -mno-extern-sdata
22299 @opindex mextern-sdata
22300 @opindex mno-extern-sdata
22301 Assume (do not assume) that externally-defined data is in
22302 a small data section if the size of that data is within the @option{-G} limit.
22303 @option{-mextern-sdata} is the default for all configurations.
22304
22305 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22306 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22307 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22308 is placed in a small data section. If @var{Var} is defined by another
22309 module, you must either compile that module with a high-enough
22310 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22311 definition. If @var{Var} is common, you must link the application
22312 with a high-enough @option{-G} setting.
22313
22314 The easiest way of satisfying these restrictions is to compile
22315 and link every module with the same @option{-G} option. However,
22316 you may wish to build a library that supports several different
22317 small data limits. You can do this by compiling the library with
22318 the highest supported @option{-G} setting and additionally using
22319 @option{-mno-extern-sdata} to stop the library from making assumptions
22320 about externally-defined data.
22321
22322 @item -mgpopt
22323 @itemx -mno-gpopt
22324 @opindex mgpopt
22325 @opindex mno-gpopt
22326 Use (do not use) GP-relative accesses for symbols that are known to be
22327 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22328 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22329 configurations.
22330
22331 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22332 might not hold the value of @code{_gp}. For example, if the code is
22333 part of a library that might be used in a boot monitor, programs that
22334 call boot monitor routines pass an unknown value in @code{$gp}.
22335 (In such situations, the boot monitor itself is usually compiled
22336 with @option{-G0}.)
22337
22338 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22339 @option{-mno-extern-sdata}.
22340
22341 @item -membedded-data
22342 @itemx -mno-embedded-data
22343 @opindex membedded-data
22344 @opindex mno-embedded-data
22345 Allocate variables to the read-only data section first if possible, then
22346 next in the small data section if possible, otherwise in data. This gives
22347 slightly slower code than the default, but reduces the amount of RAM required
22348 when executing, and thus may be preferred for some embedded systems.
22349
22350 @item -muninit-const-in-rodata
22351 @itemx -mno-uninit-const-in-rodata
22352 @opindex muninit-const-in-rodata
22353 @opindex mno-uninit-const-in-rodata
22354 Put uninitialized @code{const} variables in the read-only data section.
22355 This option is only meaningful in conjunction with @option{-membedded-data}.
22356
22357 @item -mcode-readable=@var{setting}
22358 @opindex mcode-readable
22359 Specify whether GCC may generate code that reads from executable sections.
22360 There are three possible settings:
22361
22362 @table @gcctabopt
22363 @item -mcode-readable=yes
22364 Instructions may freely access executable sections. This is the
22365 default setting.
22366
22367 @item -mcode-readable=pcrel
22368 MIPS16 PC-relative load instructions can access executable sections,
22369 but other instructions must not do so. This option is useful on 4KSc
22370 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22371 It is also useful on processors that can be configured to have a dual
22372 instruction/data SRAM interface and that, like the M4K, automatically
22373 redirect PC-relative loads to the instruction RAM.
22374
22375 @item -mcode-readable=no
22376 Instructions must not access executable sections. This option can be
22377 useful on targets that are configured to have a dual instruction/data
22378 SRAM interface but that (unlike the M4K) do not automatically redirect
22379 PC-relative loads to the instruction RAM.
22380 @end table
22381
22382 @item -msplit-addresses
22383 @itemx -mno-split-addresses
22384 @opindex msplit-addresses
22385 @opindex mno-split-addresses
22386 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22387 relocation operators. This option has been superseded by
22388 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22389
22390 @item -mexplicit-relocs
22391 @itemx -mno-explicit-relocs
22392 @opindex mexplicit-relocs
22393 @opindex mno-explicit-relocs
22394 Use (do not use) assembler relocation operators when dealing with symbolic
22395 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22396 is to use assembler macros instead.
22397
22398 @option{-mexplicit-relocs} is the default if GCC was configured
22399 to use an assembler that supports relocation operators.
22400
22401 @item -mcheck-zero-division
22402 @itemx -mno-check-zero-division
22403 @opindex mcheck-zero-division
22404 @opindex mno-check-zero-division
22405 Trap (do not trap) on integer division by zero.
22406
22407 The default is @option{-mcheck-zero-division}.
22408
22409 @item -mdivide-traps
22410 @itemx -mdivide-breaks
22411 @opindex mdivide-traps
22412 @opindex mdivide-breaks
22413 MIPS systems check for division by zero by generating either a
22414 conditional trap or a break instruction. Using traps results in
22415 smaller code, but is only supported on MIPS II and later. Also, some
22416 versions of the Linux kernel have a bug that prevents trap from
22417 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22418 allow conditional traps on architectures that support them and
22419 @option{-mdivide-breaks} to force the use of breaks.
22420
22421 The default is usually @option{-mdivide-traps}, but this can be
22422 overridden at configure time using @option{--with-divide=breaks}.
22423 Divide-by-zero checks can be completely disabled using
22424 @option{-mno-check-zero-division}.
22425
22426 @item -mload-store-pairs
22427 @itemx -mno-load-store-pairs
22428 @opindex mload-store-pairs
22429 @opindex mno-load-store-pairs
22430 Enable (disable) an optimization that pairs consecutive load or store
22431 instructions to enable load/store bonding. This option is enabled by
22432 default but only takes effect when the selected architecture is known
22433 to support bonding.
22434
22435 @item -mmemcpy
22436 @itemx -mno-memcpy
22437 @opindex mmemcpy
22438 @opindex mno-memcpy
22439 Force (do not force) the use of @code{memcpy} for non-trivial block
22440 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22441 most constant-sized copies.
22442
22443 @item -mlong-calls
22444 @itemx -mno-long-calls
22445 @opindex mlong-calls
22446 @opindex mno-long-calls
22447 Disable (do not disable) use of the @code{jal} instruction. Calling
22448 functions using @code{jal} is more efficient but requires the caller
22449 and callee to be in the same 256 megabyte segment.
22450
22451 This option has no effect on abicalls code. The default is
22452 @option{-mno-long-calls}.
22453
22454 @item -mmad
22455 @itemx -mno-mad
22456 @opindex mmad
22457 @opindex mno-mad
22458 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22459 instructions, as provided by the R4650 ISA@.
22460
22461 @item -mimadd
22462 @itemx -mno-imadd
22463 @opindex mimadd
22464 @opindex mno-imadd
22465 Enable (disable) use of the @code{madd} and @code{msub} integer
22466 instructions. The default is @option{-mimadd} on architectures
22467 that support @code{madd} and @code{msub} except for the 74k
22468 architecture where it was found to generate slower code.
22469
22470 @item -mfused-madd
22471 @itemx -mno-fused-madd
22472 @opindex mfused-madd
22473 @opindex mno-fused-madd
22474 Enable (disable) use of the floating-point multiply-accumulate
22475 instructions, when they are available. The default is
22476 @option{-mfused-madd}.
22477
22478 On the R8000 CPU when multiply-accumulate instructions are used,
22479 the intermediate product is calculated to infinite precision
22480 and is not subject to the FCSR Flush to Zero bit. This may be
22481 undesirable in some circumstances. On other processors the result
22482 is numerically identical to the equivalent computation using
22483 separate multiply, add, subtract and negate instructions.
22484
22485 @item -nocpp
22486 @opindex nocpp
22487 Tell the MIPS assembler to not run its preprocessor over user
22488 assembler files (with a @samp{.s} suffix) when assembling them.
22489
22490 @item -mfix-24k
22491 @itemx -mno-fix-24k
22492 @opindex mfix-24k
22493 @opindex mno-fix-24k
22494 Work around the 24K E48 (lost data on stores during refill) errata.
22495 The workarounds are implemented by the assembler rather than by GCC@.
22496
22497 @item -mfix-r4000
22498 @itemx -mno-fix-r4000
22499 @opindex mfix-r4000
22500 @opindex mno-fix-r4000
22501 Work around certain R4000 CPU errata:
22502 @itemize @minus
22503 @item
22504 A double-word or a variable shift may give an incorrect result if executed
22505 immediately after starting an integer division.
22506 @item
22507 A double-word or a variable shift may give an incorrect result if executed
22508 while an integer multiplication is in progress.
22509 @item
22510 An integer division may give an incorrect result if started in a delay slot
22511 of a taken branch or a jump.
22512 @end itemize
22513
22514 @item -mfix-r4400
22515 @itemx -mno-fix-r4400
22516 @opindex mfix-r4400
22517 @opindex mno-fix-r4400
22518 Work around certain R4400 CPU errata:
22519 @itemize @minus
22520 @item
22521 A double-word or a variable shift may give an incorrect result if executed
22522 immediately after starting an integer division.
22523 @end itemize
22524
22525 @item -mfix-r10000
22526 @itemx -mno-fix-r10000
22527 @opindex mfix-r10000
22528 @opindex mno-fix-r10000
22529 Work around certain R10000 errata:
22530 @itemize @minus
22531 @item
22532 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22533 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22534 @end itemize
22535
22536 This option can only be used if the target architecture supports
22537 branch-likely instructions. @option{-mfix-r10000} is the default when
22538 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22539 otherwise.
22540
22541 @item -mfix-r5900
22542 @itemx -mno-fix-r5900
22543 @opindex mfix-r5900
22544 Do not attempt to schedule the preceding instruction into the delay slot
22545 of a branch instruction placed at the end of a short loop of six
22546 instructions or fewer and always schedule a @code{nop} instruction there
22547 instead. The short loop bug under certain conditions causes loops to
22548 execute only once or twice, due to a hardware bug in the R5900 chip. The
22549 workaround is implemented by the assembler rather than by GCC@.
22550
22551 @item -mfix-rm7000
22552 @itemx -mno-fix-rm7000
22553 @opindex mfix-rm7000
22554 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22555 workarounds are implemented by the assembler rather than by GCC@.
22556
22557 @item -mfix-vr4120
22558 @itemx -mno-fix-vr4120
22559 @opindex mfix-vr4120
22560 Work around certain VR4120 errata:
22561 @itemize @minus
22562 @item
22563 @code{dmultu} does not always produce the correct result.
22564 @item
22565 @code{div} and @code{ddiv} do not always produce the correct result if one
22566 of the operands is negative.
22567 @end itemize
22568 The workarounds for the division errata rely on special functions in
22569 @file{libgcc.a}. At present, these functions are only provided by
22570 the @code{mips64vr*-elf} configurations.
22571
22572 Other VR4120 errata require a NOP to be inserted between certain pairs of
22573 instructions. These errata are handled by the assembler, not by GCC itself.
22574
22575 @item -mfix-vr4130
22576 @opindex mfix-vr4130
22577 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22578 workarounds are implemented by the assembler rather than by GCC,
22579 although GCC avoids using @code{mflo} and @code{mfhi} if the
22580 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22581 instructions are available instead.
22582
22583 @item -mfix-sb1
22584 @itemx -mno-fix-sb1
22585 @opindex mfix-sb1
22586 Work around certain SB-1 CPU core errata.
22587 (This flag currently works around the SB-1 revision 2
22588 ``F1'' and ``F2'' floating-point errata.)
22589
22590 @item -mr10k-cache-barrier=@var{setting}
22591 @opindex mr10k-cache-barrier
22592 Specify whether GCC should insert cache barriers to avoid the
22593 side effects of speculation on R10K processors.
22594
22595 In common with many processors, the R10K tries to predict the outcome
22596 of a conditional branch and speculatively executes instructions from
22597 the ``taken'' branch. It later aborts these instructions if the
22598 predicted outcome is wrong. However, on the R10K, even aborted
22599 instructions can have side effects.
22600
22601 This problem only affects kernel stores and, depending on the system,
22602 kernel loads. As an example, a speculatively-executed store may load
22603 the target memory into cache and mark the cache line as dirty, even if
22604 the store itself is later aborted. If a DMA operation writes to the
22605 same area of memory before the ``dirty'' line is flushed, the cached
22606 data overwrites the DMA-ed data. See the R10K processor manual
22607 for a full description, including other potential problems.
22608
22609 One workaround is to insert cache barrier instructions before every memory
22610 access that might be speculatively executed and that might have side
22611 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22612 controls GCC's implementation of this workaround. It assumes that
22613 aborted accesses to any byte in the following regions does not have
22614 side effects:
22615
22616 @enumerate
22617 @item
22618 the memory occupied by the current function's stack frame;
22619
22620 @item
22621 the memory occupied by an incoming stack argument;
22622
22623 @item
22624 the memory occupied by an object with a link-time-constant address.
22625 @end enumerate
22626
22627 It is the kernel's responsibility to ensure that speculative
22628 accesses to these regions are indeed safe.
22629
22630 If the input program contains a function declaration such as:
22631
22632 @smallexample
22633 void foo (void);
22634 @end smallexample
22635
22636 then the implementation of @code{foo} must allow @code{j foo} and
22637 @code{jal foo} to be executed speculatively. GCC honors this
22638 restriction for functions it compiles itself. It expects non-GCC
22639 functions (such as hand-written assembly code) to do the same.
22640
22641 The option has three forms:
22642
22643 @table @gcctabopt
22644 @item -mr10k-cache-barrier=load-store
22645 Insert a cache barrier before a load or store that might be
22646 speculatively executed and that might have side effects even
22647 if aborted.
22648
22649 @item -mr10k-cache-barrier=store
22650 Insert a cache barrier before a store that might be speculatively
22651 executed and that might have side effects even if aborted.
22652
22653 @item -mr10k-cache-barrier=none
22654 Disable the insertion of cache barriers. This is the default setting.
22655 @end table
22656
22657 @item -mflush-func=@var{func}
22658 @itemx -mno-flush-func
22659 @opindex mflush-func
22660 Specifies the function to call to flush the I and D caches, or to not
22661 call any such function. If called, the function must take the same
22662 arguments as the common @code{_flush_func}, that is, the address of the
22663 memory range for which the cache is being flushed, the size of the
22664 memory range, and the number 3 (to flush both caches). The default
22665 depends on the target GCC was configured for, but commonly is either
22666 @code{_flush_func} or @code{__cpu_flush}.
22667
22668 @item mbranch-cost=@var{num}
22669 @opindex mbranch-cost
22670 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22671 This cost is only a heuristic and is not guaranteed to produce
22672 consistent results across releases. A zero cost redundantly selects
22673 the default, which is based on the @option{-mtune} setting.
22674
22675 @item -mbranch-likely
22676 @itemx -mno-branch-likely
22677 @opindex mbranch-likely
22678 @opindex mno-branch-likely
22679 Enable or disable use of Branch Likely instructions, regardless of the
22680 default for the selected architecture. By default, Branch Likely
22681 instructions may be generated if they are supported by the selected
22682 architecture. An exception is for the MIPS32 and MIPS64 architectures
22683 and processors that implement those architectures; for those, Branch
22684 Likely instructions are not be generated by default because the MIPS32
22685 and MIPS64 architectures specifically deprecate their use.
22686
22687 @item -mcompact-branches=never
22688 @itemx -mcompact-branches=optimal
22689 @itemx -mcompact-branches=always
22690 @opindex mcompact-branches=never
22691 @opindex mcompact-branches=optimal
22692 @opindex mcompact-branches=always
22693 These options control which form of branches will be generated. The
22694 default is @option{-mcompact-branches=optimal}.
22695
22696 The @option{-mcompact-branches=never} option ensures that compact branch
22697 instructions will never be generated.
22698
22699 The @option{-mcompact-branches=always} option ensures that a compact
22700 branch instruction will be generated if available. If a compact branch
22701 instruction is not available, a delay slot form of the branch will be
22702 used instead.
22703
22704 This option is supported from MIPS Release 6 onwards.
22705
22706 The @option{-mcompact-branches=optimal} option will cause a delay slot
22707 branch to be used if one is available in the current ISA and the delay
22708 slot is successfully filled. If the delay slot is not filled, a compact
22709 branch will be chosen if one is available.
22710
22711 @item -mfp-exceptions
22712 @itemx -mno-fp-exceptions
22713 @opindex mfp-exceptions
22714 Specifies whether FP exceptions are enabled. This affects how
22715 FP instructions are scheduled for some processors.
22716 The default is that FP exceptions are
22717 enabled.
22718
22719 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22720 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22721 FP pipe.
22722
22723 @item -mvr4130-align
22724 @itemx -mno-vr4130-align
22725 @opindex mvr4130-align
22726 The VR4130 pipeline is two-way superscalar, but can only issue two
22727 instructions together if the first one is 8-byte aligned. When this
22728 option is enabled, GCC aligns pairs of instructions that it
22729 thinks should execute in parallel.
22730
22731 This option only has an effect when optimizing for the VR4130.
22732 It normally makes code faster, but at the expense of making it bigger.
22733 It is enabled by default at optimization level @option{-O3}.
22734
22735 @item -msynci
22736 @itemx -mno-synci
22737 @opindex msynci
22738 Enable (disable) generation of @code{synci} instructions on
22739 architectures that support it. The @code{synci} instructions (if
22740 enabled) are generated when @code{__builtin___clear_cache} is
22741 compiled.
22742
22743 This option defaults to @option{-mno-synci}, but the default can be
22744 overridden by configuring GCC with @option{--with-synci}.
22745
22746 When compiling code for single processor systems, it is generally safe
22747 to use @code{synci}. However, on many multi-core (SMP) systems, it
22748 does not invalidate the instruction caches on all cores and may lead
22749 to undefined behavior.
22750
22751 @item -mrelax-pic-calls
22752 @itemx -mno-relax-pic-calls
22753 @opindex mrelax-pic-calls
22754 Try to turn PIC calls that are normally dispatched via register
22755 @code{$25} into direct calls. This is only possible if the linker can
22756 resolve the destination at link time and if the destination is within
22757 range for a direct call.
22758
22759 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22760 an assembler and a linker that support the @code{.reloc} assembly
22761 directive and @option{-mexplicit-relocs} is in effect. With
22762 @option{-mno-explicit-relocs}, this optimization can be performed by the
22763 assembler and the linker alone without help from the compiler.
22764
22765 @item -mmcount-ra-address
22766 @itemx -mno-mcount-ra-address
22767 @opindex mmcount-ra-address
22768 @opindex mno-mcount-ra-address
22769 Emit (do not emit) code that allows @code{_mcount} to modify the
22770 calling function's return address. When enabled, this option extends
22771 the usual @code{_mcount} interface with a new @var{ra-address}
22772 parameter, which has type @code{intptr_t *} and is passed in register
22773 @code{$12}. @code{_mcount} can then modify the return address by
22774 doing both of the following:
22775 @itemize
22776 @item
22777 Returning the new address in register @code{$31}.
22778 @item
22779 Storing the new address in @code{*@var{ra-address}},
22780 if @var{ra-address} is nonnull.
22781 @end itemize
22782
22783 The default is @option{-mno-mcount-ra-address}.
22784
22785 @item -mframe-header-opt
22786 @itemx -mno-frame-header-opt
22787 @opindex mframe-header-opt
22788 Enable (disable) frame header optimization in the o32 ABI. When using the
22789 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22790 function to write out register arguments. When enabled, this optimization
22791 will suppress the allocation of the frame header if it can be determined that
22792 it is unused.
22793
22794 This optimization is off by default at all optimization levels.
22795
22796 @item -mlxc1-sxc1
22797 @itemx -mno-lxc1-sxc1
22798 @opindex mlxc1-sxc1
22799 When applicable, enable (disable) the generation of @code{lwxc1},
22800 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22801
22802 @item -mmadd4
22803 @itemx -mno-madd4
22804 @opindex mmadd4
22805 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22806 @code{madd.d} and related instructions. Enabled by default.
22807
22808 @end table
22809
22810 @node MMIX Options
22811 @subsection MMIX Options
22812 @cindex MMIX Options
22813
22814 These options are defined for the MMIX:
22815
22816 @table @gcctabopt
22817 @item -mlibfuncs
22818 @itemx -mno-libfuncs
22819 @opindex mlibfuncs
22820 @opindex mno-libfuncs
22821 Specify that intrinsic library functions are being compiled, passing all
22822 values in registers, no matter the size.
22823
22824 @item -mepsilon
22825 @itemx -mno-epsilon
22826 @opindex mepsilon
22827 @opindex mno-epsilon
22828 Generate floating-point comparison instructions that compare with respect
22829 to the @code{rE} epsilon register.
22830
22831 @item -mabi=mmixware
22832 @itemx -mabi=gnu
22833 @opindex mabi=mmixware
22834 @opindex mabi=gnu
22835 Generate code that passes function parameters and return values that (in
22836 the called function) are seen as registers @code{$0} and up, as opposed to
22837 the GNU ABI which uses global registers @code{$231} and up.
22838
22839 @item -mzero-extend
22840 @itemx -mno-zero-extend
22841 @opindex mzero-extend
22842 @opindex mno-zero-extend
22843 When reading data from memory in sizes shorter than 64 bits, use (do not
22844 use) zero-extending load instructions by default, rather than
22845 sign-extending ones.
22846
22847 @item -mknuthdiv
22848 @itemx -mno-knuthdiv
22849 @opindex mknuthdiv
22850 @opindex mno-knuthdiv
22851 Make the result of a division yielding a remainder have the same sign as
22852 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22853 remainder follows the sign of the dividend. Both methods are
22854 arithmetically valid, the latter being almost exclusively used.
22855
22856 @item -mtoplevel-symbols
22857 @itemx -mno-toplevel-symbols
22858 @opindex mtoplevel-symbols
22859 @opindex mno-toplevel-symbols
22860 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22861 code can be used with the @code{PREFIX} assembly directive.
22862
22863 @item -melf
22864 @opindex melf
22865 Generate an executable in the ELF format, rather than the default
22866 @samp{mmo} format used by the @command{mmix} simulator.
22867
22868 @item -mbranch-predict
22869 @itemx -mno-branch-predict
22870 @opindex mbranch-predict
22871 @opindex mno-branch-predict
22872 Use (do not use) the probable-branch instructions, when static branch
22873 prediction indicates a probable branch.
22874
22875 @item -mbase-addresses
22876 @itemx -mno-base-addresses
22877 @opindex mbase-addresses
22878 @opindex mno-base-addresses
22879 Generate (do not generate) code that uses @emph{base addresses}. Using a
22880 base address automatically generates a request (handled by the assembler
22881 and the linker) for a constant to be set up in a global register. The
22882 register is used for one or more base address requests within the range 0
22883 to 255 from the value held in the register. The generally leads to short
22884 and fast code, but the number of different data items that can be
22885 addressed is limited. This means that a program that uses lots of static
22886 data may require @option{-mno-base-addresses}.
22887
22888 @item -msingle-exit
22889 @itemx -mno-single-exit
22890 @opindex msingle-exit
22891 @opindex mno-single-exit
22892 Force (do not force) generated code to have a single exit point in each
22893 function.
22894 @end table
22895
22896 @node MN10300 Options
22897 @subsection MN10300 Options
22898 @cindex MN10300 options
22899
22900 These @option{-m} options are defined for Matsushita MN10300 architectures:
22901
22902 @table @gcctabopt
22903 @item -mmult-bug
22904 @opindex mmult-bug
22905 Generate code to avoid bugs in the multiply instructions for the MN10300
22906 processors. This is the default.
22907
22908 @item -mno-mult-bug
22909 @opindex mno-mult-bug
22910 Do not generate code to avoid bugs in the multiply instructions for the
22911 MN10300 processors.
22912
22913 @item -mam33
22914 @opindex mam33
22915 Generate code using features specific to the AM33 processor.
22916
22917 @item -mno-am33
22918 @opindex mno-am33
22919 Do not generate code using features specific to the AM33 processor. This
22920 is the default.
22921
22922 @item -mam33-2
22923 @opindex mam33-2
22924 Generate code using features specific to the AM33/2.0 processor.
22925
22926 @item -mam34
22927 @opindex mam34
22928 Generate code using features specific to the AM34 processor.
22929
22930 @item -mtune=@var{cpu-type}
22931 @opindex mtune
22932 Use the timing characteristics of the indicated CPU type when
22933 scheduling instructions. This does not change the targeted processor
22934 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22935 @samp{am33-2} or @samp{am34}.
22936
22937 @item -mreturn-pointer-on-d0
22938 @opindex mreturn-pointer-on-d0
22939 When generating a function that returns a pointer, return the pointer
22940 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22941 only in @code{a0}, and attempts to call such functions without a prototype
22942 result in errors. Note that this option is on by default; use
22943 @option{-mno-return-pointer-on-d0} to disable it.
22944
22945 @item -mno-crt0
22946 @opindex mno-crt0
22947 Do not link in the C run-time initialization object file.
22948
22949 @item -mrelax
22950 @opindex mrelax
22951 Indicate to the linker that it should perform a relaxation optimization pass
22952 to shorten branches, calls and absolute memory addresses. This option only
22953 has an effect when used on the command line for the final link step.
22954
22955 This option makes symbolic debugging impossible.
22956
22957 @item -mliw
22958 @opindex mliw
22959 Allow the compiler to generate @emph{Long Instruction Word}
22960 instructions if the target is the @samp{AM33} or later. This is the
22961 default. This option defines the preprocessor macro @code{__LIW__}.
22962
22963 @item -mno-liw
22964 @opindex mno-liw
22965 Do not allow the compiler to generate @emph{Long Instruction Word}
22966 instructions. This option defines the preprocessor macro
22967 @code{__NO_LIW__}.
22968
22969 @item -msetlb
22970 @opindex msetlb
22971 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22972 instructions if the target is the @samp{AM33} or later. This is the
22973 default. This option defines the preprocessor macro @code{__SETLB__}.
22974
22975 @item -mno-setlb
22976 @opindex mno-setlb
22977 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22978 instructions. This option defines the preprocessor macro
22979 @code{__NO_SETLB__}.
22980
22981 @end table
22982
22983 @node Moxie Options
22984 @subsection Moxie Options
22985 @cindex Moxie Options
22986
22987 @table @gcctabopt
22988
22989 @item -meb
22990 @opindex meb
22991 Generate big-endian code. This is the default for @samp{moxie-*-*}
22992 configurations.
22993
22994 @item -mel
22995 @opindex mel
22996 Generate little-endian code.
22997
22998 @item -mmul.x
22999 @opindex mmul.x
23000 Generate mul.x and umul.x instructions. This is the default for
23001 @samp{moxiebox-*-*} configurations.
23002
23003 @item -mno-crt0
23004 @opindex mno-crt0
23005 Do not link in the C run-time initialization object file.
23006
23007 @end table
23008
23009 @node MSP430 Options
23010 @subsection MSP430 Options
23011 @cindex MSP430 Options
23012
23013 These options are defined for the MSP430:
23014
23015 @table @gcctabopt
23016
23017 @item -masm-hex
23018 @opindex masm-hex
23019 Force assembly output to always use hex constants. Normally such
23020 constants are signed decimals, but this option is available for
23021 testsuite and/or aesthetic purposes.
23022
23023 @item -mmcu=
23024 @opindex mmcu=
23025 Select the MCU to target. This is used to create a C preprocessor
23026 symbol based upon the MCU name, converted to upper case and pre- and
23027 post-fixed with @samp{__}. This in turn is used by the
23028 @file{msp430.h} header file to select an MCU-specific supplementary
23029 header file.
23030
23031 The option also sets the ISA to use. If the MCU name is one that is
23032 known to only support the 430 ISA then that is selected, otherwise the
23033 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
23034 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
23035 name selects the 430X ISA.
23036
23037 In addition an MCU-specific linker script is added to the linker
23038 command line. The script's name is the name of the MCU with
23039 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
23040 command line defines the C preprocessor symbol @code{__XXX__} and
23041 cause the linker to search for a script called @file{xxx.ld}.
23042
23043 This option is also passed on to the assembler.
23044
23045 @item -mwarn-mcu
23046 @itemx -mno-warn-mcu
23047 @opindex mwarn-mcu
23048 @opindex mno-warn-mcu
23049 This option enables or disables warnings about conflicts between the
23050 MCU name specified by the @option{-mmcu} option and the ISA set by the
23051 @option{-mcpu} option and/or the hardware multiply support set by the
23052 @option{-mhwmult} option. It also toggles warnings about unrecognized
23053 MCU names. This option is on by default.
23054
23055 @item -mcpu=
23056 @opindex mcpu=
23057 Specifies the ISA to use. Accepted values are @samp{msp430},
23058 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
23059 @option{-mmcu=} option should be used to select the ISA.
23060
23061 @item -msim
23062 @opindex msim
23063 Link to the simulator runtime libraries and linker script. Overrides
23064 any scripts that would be selected by the @option{-mmcu=} option.
23065
23066 @item -mlarge
23067 @opindex mlarge
23068 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23069
23070 @item -msmall
23071 @opindex msmall
23072 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23073
23074 @item -mrelax
23075 @opindex mrelax
23076 This option is passed to the assembler and linker, and allows the
23077 linker to perform certain optimizations that cannot be done until
23078 the final link.
23079
23080 @item mhwmult=
23081 @opindex mhwmult=
23082 Describes the type of hardware multiply supported by the target.
23083 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23084 for the original 16-bit-only multiply supported by early MCUs.
23085 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23086 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23087 A value of @samp{auto} can also be given. This tells GCC to deduce
23088 the hardware multiply support based upon the MCU name provided by the
23089 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
23090 the MCU name is not recognized then no hardware multiply support is
23091 assumed. @code{auto} is the default setting.
23092
23093 Hardware multiplies are normally performed by calling a library
23094 routine. This saves space in the generated code. When compiling at
23095 @option{-O3} or higher however the hardware multiplier is invoked
23096 inline. This makes for bigger, but faster code.
23097
23098 The hardware multiply routines disable interrupts whilst running and
23099 restore the previous interrupt state when they finish. This makes
23100 them safe to use inside interrupt handlers as well as in normal code.
23101
23102 @item -minrt
23103 @opindex minrt
23104 Enable the use of a minimum runtime environment - no static
23105 initializers or constructors. This is intended for memory-constrained
23106 devices. The compiler includes special symbols in some objects
23107 that tell the linker and runtime which code fragments are required.
23108
23109 @item -mcode-region=
23110 @itemx -mdata-region=
23111 @opindex mcode-region
23112 @opindex mdata-region
23113 These options tell the compiler where to place functions and data that
23114 do not have one of the @code{lower}, @code{upper}, @code{either} or
23115 @code{section} attributes. Possible values are @code{lower},
23116 @code{upper}, @code{either} or @code{any}. The first three behave
23117 like the corresponding attribute. The fourth possible value -
23118 @code{any} - is the default. It leaves placement entirely up to the
23119 linker script and how it assigns the standard sections
23120 (@code{.text}, @code{.data}, etc) to the memory regions.
23121
23122 @item -msilicon-errata=
23123 @opindex msilicon-errata
23124 This option passes on a request to assembler to enable the fixes for
23125 the named silicon errata.
23126
23127 @item -msilicon-errata-warn=
23128 @opindex msilicon-errata-warn
23129 This option passes on a request to the assembler to enable warning
23130 messages when a silicon errata might need to be applied.
23131
23132 @end table
23133
23134 @node NDS32 Options
23135 @subsection NDS32 Options
23136 @cindex NDS32 Options
23137
23138 These options are defined for NDS32 implementations:
23139
23140 @table @gcctabopt
23141
23142 @item -mbig-endian
23143 @opindex mbig-endian
23144 Generate code in big-endian mode.
23145
23146 @item -mlittle-endian
23147 @opindex mlittle-endian
23148 Generate code in little-endian mode.
23149
23150 @item -mreduced-regs
23151 @opindex mreduced-regs
23152 Use reduced-set registers for register allocation.
23153
23154 @item -mfull-regs
23155 @opindex mfull-regs
23156 Use full-set registers for register allocation.
23157
23158 @item -mcmov
23159 @opindex mcmov
23160 Generate conditional move instructions.
23161
23162 @item -mno-cmov
23163 @opindex mno-cmov
23164 Do not generate conditional move instructions.
23165
23166 @item -mext-perf
23167 @opindex mext-perf
23168 Generate performance extension instructions.
23169
23170 @item -mno-ext-perf
23171 @opindex mno-ext-perf
23172 Do not generate performance extension instructions.
23173
23174 @item -mext-perf2
23175 @opindex mext-perf2
23176 Generate performance extension 2 instructions.
23177
23178 @item -mno-ext-perf2
23179 @opindex mno-ext-perf2
23180 Do not generate performance extension 2 instructions.
23181
23182 @item -mext-string
23183 @opindex mext-string
23184 Generate string extension instructions.
23185
23186 @item -mno-ext-string
23187 @opindex mno-ext-string
23188 Do not generate string extension instructions.
23189
23190 @item -mv3push
23191 @opindex mv3push
23192 Generate v3 push25/pop25 instructions.
23193
23194 @item -mno-v3push
23195 @opindex mno-v3push
23196 Do not generate v3 push25/pop25 instructions.
23197
23198 @item -m16-bit
23199 @opindex m16-bit
23200 Generate 16-bit instructions.
23201
23202 @item -mno-16-bit
23203 @opindex mno-16-bit
23204 Do not generate 16-bit instructions.
23205
23206 @item -misr-vector-size=@var{num}
23207 @opindex misr-vector-size
23208 Specify the size of each interrupt vector, which must be 4 or 16.
23209
23210 @item -mcache-block-size=@var{num}
23211 @opindex mcache-block-size
23212 Specify the size of each cache block,
23213 which must be a power of 2 between 4 and 512.
23214
23215 @item -march=@var{arch}
23216 @opindex march
23217 Specify the name of the target architecture.
23218
23219 @item -mcmodel=@var{code-model}
23220 @opindex mcmodel
23221 Set the code model to one of
23222 @table @asis
23223 @item @samp{small}
23224 All the data and read-only data segments must be within 512KB addressing space.
23225 The text segment must be within 16MB addressing space.
23226 @item @samp{medium}
23227 The data segment must be within 512KB while the read-only data segment can be
23228 within 4GB addressing space. The text segment should be still within 16MB
23229 addressing space.
23230 @item @samp{large}
23231 All the text and data segments can be within 4GB addressing space.
23232 @end table
23233
23234 @item -mctor-dtor
23235 @opindex mctor-dtor
23236 Enable constructor/destructor feature.
23237
23238 @item -mrelax
23239 @opindex mrelax
23240 Guide linker to relax instructions.
23241
23242 @end table
23243
23244 @node Nios II Options
23245 @subsection Nios II Options
23246 @cindex Nios II options
23247 @cindex Altera Nios II options
23248
23249 These are the options defined for the Altera Nios II processor.
23250
23251 @table @gcctabopt
23252
23253 @item -G @var{num}
23254 @opindex G
23255 @cindex smaller data references
23256 Put global and static objects less than or equal to @var{num} bytes
23257 into the small data or BSS sections instead of the normal data or BSS
23258 sections. The default value of @var{num} is 8.
23259
23260 @item -mgpopt=@var{option}
23261 @itemx -mgpopt
23262 @itemx -mno-gpopt
23263 @opindex mgpopt
23264 @opindex mno-gpopt
23265 Generate (do not generate) GP-relative accesses. The following
23266 @var{option} names are recognized:
23267
23268 @table @samp
23269
23270 @item none
23271 Do not generate GP-relative accesses.
23272
23273 @item local
23274 Generate GP-relative accesses for small data objects that are not
23275 external, weak, or uninitialized common symbols.
23276 Also use GP-relative addressing for objects that
23277 have been explicitly placed in a small data section via a @code{section}
23278 attribute.
23279
23280 @item global
23281 As for @samp{local}, but also generate GP-relative accesses for
23282 small data objects that are external, weak, or common. If you use this option,
23283 you must ensure that all parts of your program (including libraries) are
23284 compiled with the same @option{-G} setting.
23285
23286 @item data
23287 Generate GP-relative accesses for all data objects in the program. If you
23288 use this option, the entire data and BSS segments
23289 of your program must fit in 64K of memory and you must use an appropriate
23290 linker script to allocate them within the addressable range of the
23291 global pointer.
23292
23293 @item all
23294 Generate GP-relative addresses for function pointers as well as data
23295 pointers. If you use this option, the entire text, data, and BSS segments
23296 of your program must fit in 64K of memory and you must use an appropriate
23297 linker script to allocate them within the addressable range of the
23298 global pointer.
23299
23300 @end table
23301
23302 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23303 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23304
23305 The default is @option{-mgpopt} except when @option{-fpic} or
23306 @option{-fPIC} is specified to generate position-independent code.
23307 Note that the Nios II ABI does not permit GP-relative accesses from
23308 shared libraries.
23309
23310 You may need to specify @option{-mno-gpopt} explicitly when building
23311 programs that include large amounts of small data, including large
23312 GOT data sections. In this case, the 16-bit offset for GP-relative
23313 addressing may not be large enough to allow access to the entire
23314 small data section.
23315
23316 @item -mgprel-sec=@var{regexp}
23317 @opindex mgprel-sec
23318 This option specifies additional section names that can be accessed via
23319 GP-relative addressing. It is most useful in conjunction with
23320 @code{section} attributes on variable declarations
23321 (@pxref{Common Variable Attributes}) and a custom linker script.
23322 The @var{regexp} is a POSIX Extended Regular Expression.
23323
23324 This option does not affect the behavior of the @option{-G} option, and
23325 the specified sections are in addition to the standard @code{.sdata}
23326 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23327
23328 @item -mr0rel-sec=@var{regexp}
23329 @opindex mr0rel-sec
23330 This option specifies names of sections that can be accessed via a
23331 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23332 of the 32-bit address space. It is most useful in conjunction with
23333 @code{section} attributes on variable declarations
23334 (@pxref{Common Variable Attributes}) and a custom linker script.
23335 The @var{regexp} is a POSIX Extended Regular Expression.
23336
23337 In contrast to the use of GP-relative addressing for small data,
23338 zero-based addressing is never generated by default and there are no
23339 conventional section names used in standard linker scripts for sections
23340 in the low or high areas of memory.
23341
23342 @item -mel
23343 @itemx -meb
23344 @opindex mel
23345 @opindex meb
23346 Generate little-endian (default) or big-endian (experimental) code,
23347 respectively.
23348
23349 @item -march=@var{arch}
23350 @opindex march
23351 This specifies the name of the target Nios II architecture. GCC uses this
23352 name to determine what kind of instructions it can emit when generating
23353 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23354
23355 The preprocessor macro @code{__nios2_arch__} is available to programs,
23356 with value 1 or 2, indicating the targeted ISA level.
23357
23358 @item -mbypass-cache
23359 @itemx -mno-bypass-cache
23360 @opindex mno-bypass-cache
23361 @opindex mbypass-cache
23362 Force all load and store instructions to always bypass cache by
23363 using I/O variants of the instructions. The default is not to
23364 bypass the cache.
23365
23366 @item -mno-cache-volatile
23367 @itemx -mcache-volatile
23368 @opindex mcache-volatile
23369 @opindex mno-cache-volatile
23370 Volatile memory access bypass the cache using the I/O variants of
23371 the load and store instructions. The default is not to bypass the cache.
23372
23373 @item -mno-fast-sw-div
23374 @itemx -mfast-sw-div
23375 @opindex mno-fast-sw-div
23376 @opindex mfast-sw-div
23377 Do not use table-based fast divide for small numbers. The default
23378 is to use the fast divide at @option{-O3} and above.
23379
23380 @item -mno-hw-mul
23381 @itemx -mhw-mul
23382 @itemx -mno-hw-mulx
23383 @itemx -mhw-mulx
23384 @itemx -mno-hw-div
23385 @itemx -mhw-div
23386 @opindex mno-hw-mul
23387 @opindex mhw-mul
23388 @opindex mno-hw-mulx
23389 @opindex mhw-mulx
23390 @opindex mno-hw-div
23391 @opindex mhw-div
23392 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23393 instructions by the compiler. The default is to emit @code{mul}
23394 and not emit @code{div} and @code{mulx}.
23395
23396 @item -mbmx
23397 @itemx -mno-bmx
23398 @itemx -mcdx
23399 @itemx -mno-cdx
23400 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23401 CDX (code density) instructions. Enabling these instructions also
23402 requires @option{-march=r2}. Since these instructions are optional
23403 extensions to the R2 architecture, the default is not to emit them.
23404
23405 @item -mcustom-@var{insn}=@var{N}
23406 @itemx -mno-custom-@var{insn}
23407 @opindex mcustom-@var{insn}
23408 @opindex mno-custom-@var{insn}
23409 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23410 custom instruction with encoding @var{N} when generating code that uses
23411 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23412 instruction 253 for single-precision floating-point add operations instead
23413 of the default behavior of using a library call.
23414
23415 The following values of @var{insn} are supported. Except as otherwise
23416 noted, floating-point operations are expected to be implemented with
23417 normal IEEE 754 semantics and correspond directly to the C operators or the
23418 equivalent GCC built-in functions (@pxref{Other Builtins}).
23419
23420 Single-precision floating point:
23421 @table @asis
23422
23423 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23424 Binary arithmetic operations.
23425
23426 @item @samp{fnegs}
23427 Unary negation.
23428
23429 @item @samp{fabss}
23430 Unary absolute value.
23431
23432 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23433 Comparison operations.
23434
23435 @item @samp{fmins}, @samp{fmaxs}
23436 Floating-point minimum and maximum. These instructions are only
23437 generated if @option{-ffinite-math-only} is specified.
23438
23439 @item @samp{fsqrts}
23440 Unary square root operation.
23441
23442 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23443 Floating-point trigonometric and exponential functions. These instructions
23444 are only generated if @option{-funsafe-math-optimizations} is also specified.
23445
23446 @end table
23447
23448 Double-precision floating point:
23449 @table @asis
23450
23451 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23452 Binary arithmetic operations.
23453
23454 @item @samp{fnegd}
23455 Unary negation.
23456
23457 @item @samp{fabsd}
23458 Unary absolute value.
23459
23460 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23461 Comparison operations.
23462
23463 @item @samp{fmind}, @samp{fmaxd}
23464 Double-precision minimum and maximum. These instructions are only
23465 generated if @option{-ffinite-math-only} is specified.
23466
23467 @item @samp{fsqrtd}
23468 Unary square root operation.
23469
23470 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23471 Double-precision trigonometric and exponential functions. These instructions
23472 are only generated if @option{-funsafe-math-optimizations} is also specified.
23473
23474 @end table
23475
23476 Conversions:
23477 @table @asis
23478 @item @samp{fextsd}
23479 Conversion from single precision to double precision.
23480
23481 @item @samp{ftruncds}
23482 Conversion from double precision to single precision.
23483
23484 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23485 Conversion from floating point to signed or unsigned integer types, with
23486 truncation towards zero.
23487
23488 @item @samp{round}
23489 Conversion from single-precision floating point to signed integer,
23490 rounding to the nearest integer and ties away from zero.
23491 This corresponds to the @code{__builtin_lroundf} function when
23492 @option{-fno-math-errno} is used.
23493
23494 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23495 Conversion from signed or unsigned integer types to floating-point types.
23496
23497 @end table
23498
23499 In addition, all of the following transfer instructions for internal
23500 registers X and Y must be provided to use any of the double-precision
23501 floating-point instructions. Custom instructions taking two
23502 double-precision source operands expect the first operand in the
23503 64-bit register X. The other operand (or only operand of a unary
23504 operation) is given to the custom arithmetic instruction with the
23505 least significant half in source register @var{src1} and the most
23506 significant half in @var{src2}. A custom instruction that returns a
23507 double-precision result returns the most significant 32 bits in the
23508 destination register and the other half in 32-bit register Y.
23509 GCC automatically generates the necessary code sequences to write
23510 register X and/or read register Y when double-precision floating-point
23511 instructions are used.
23512
23513 @table @asis
23514
23515 @item @samp{fwrx}
23516 Write @var{src1} into the least significant half of X and @var{src2} into
23517 the most significant half of X.
23518
23519 @item @samp{fwry}
23520 Write @var{src1} into Y.
23521
23522 @item @samp{frdxhi}, @samp{frdxlo}
23523 Read the most or least (respectively) significant half of X and store it in
23524 @var{dest}.
23525
23526 @item @samp{frdy}
23527 Read the value of Y and store it into @var{dest}.
23528 @end table
23529
23530 Note that you can gain more local control over generation of Nios II custom
23531 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23532 and @code{target("no-custom-@var{insn}")} function attributes
23533 (@pxref{Function Attributes})
23534 or pragmas (@pxref{Function Specific Option Pragmas}).
23535
23536 @item -mcustom-fpu-cfg=@var{name}
23537 @opindex mcustom-fpu-cfg
23538
23539 This option enables a predefined, named set of custom instruction encodings
23540 (see @option{-mcustom-@var{insn}} above).
23541 Currently, the following sets are defined:
23542
23543 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23544 @gccoptlist{-mcustom-fmuls=252 @gol
23545 -mcustom-fadds=253 @gol
23546 -mcustom-fsubs=254 @gol
23547 -fsingle-precision-constant}
23548
23549 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23550 @gccoptlist{-mcustom-fmuls=252 @gol
23551 -mcustom-fadds=253 @gol
23552 -mcustom-fsubs=254 @gol
23553 -mcustom-fdivs=255 @gol
23554 -fsingle-precision-constant}
23555
23556 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23557 @gccoptlist{-mcustom-floatus=243 @gol
23558 -mcustom-fixsi=244 @gol
23559 -mcustom-floatis=245 @gol
23560 -mcustom-fcmpgts=246 @gol
23561 -mcustom-fcmples=249 @gol
23562 -mcustom-fcmpeqs=250 @gol
23563 -mcustom-fcmpnes=251 @gol
23564 -mcustom-fmuls=252 @gol
23565 -mcustom-fadds=253 @gol
23566 -mcustom-fsubs=254 @gol
23567 -mcustom-fdivs=255 @gol
23568 -fsingle-precision-constant}
23569
23570 Custom instruction assignments given by individual
23571 @option{-mcustom-@var{insn}=} options override those given by
23572 @option{-mcustom-fpu-cfg=}, regardless of the
23573 order of the options on the command line.
23574
23575 Note that you can gain more local control over selection of a FPU
23576 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23577 function attribute (@pxref{Function Attributes})
23578 or pragma (@pxref{Function Specific Option Pragmas}).
23579
23580 @end table
23581
23582 These additional @samp{-m} options are available for the Altera Nios II
23583 ELF (bare-metal) target:
23584
23585 @table @gcctabopt
23586
23587 @item -mhal
23588 @opindex mhal
23589 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23590 startup and termination code, and is typically used in conjunction with
23591 @option{-msys-crt0=} to specify the location of the alternate startup code
23592 provided by the HAL BSP.
23593
23594 @item -msmallc
23595 @opindex msmallc
23596 Link with a limited version of the C library, @option{-lsmallc}, rather than
23597 Newlib.
23598
23599 @item -msys-crt0=@var{startfile}
23600 @opindex msys-crt0
23601 @var{startfile} is the file name of the startfile (crt0) to use
23602 when linking. This option is only useful in conjunction with @option{-mhal}.
23603
23604 @item -msys-lib=@var{systemlib}
23605 @opindex msys-lib
23606 @var{systemlib} is the library name of the library that provides
23607 low-level system calls required by the C library,
23608 e.g.@: @code{read} and @code{write}.
23609 This option is typically used to link with a library provided by a HAL BSP.
23610
23611 @end table
23612
23613 @node Nvidia PTX Options
23614 @subsection Nvidia PTX Options
23615 @cindex Nvidia PTX options
23616 @cindex nvptx options
23617
23618 These options are defined for Nvidia PTX:
23619
23620 @table @gcctabopt
23621
23622 @item -m32
23623 @itemx -m64
23624 @opindex m32
23625 @opindex m64
23626 Generate code for 32-bit or 64-bit ABI.
23627
23628 @item -misa=@var{ISA-string}
23629 @opindex march
23630 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23631 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23632 @samp{sm_35}. The default ISA is sm_30.
23633
23634 @item -mmainkernel
23635 @opindex mmainkernel
23636 Link in code for a __main kernel. This is for stand-alone instead of
23637 offloading execution.
23638
23639 @item -moptimize
23640 @opindex moptimize
23641 Apply partitioned execution optimizations. This is the default when any
23642 level of optimization is selected.
23643
23644 @item -msoft-stack
23645 @opindex msoft-stack
23646 Generate code that does not use @code{.local} memory
23647 directly for stack storage. Instead, a per-warp stack pointer is
23648 maintained explicitly. This enables variable-length stack allocation (with
23649 variable-length arrays or @code{alloca}), and when global memory is used for
23650 underlying storage, makes it possible to access automatic variables from other
23651 threads, or with atomic instructions. This code generation variant is used
23652 for OpenMP offloading, but the option is exposed on its own for the purpose
23653 of testing the compiler; to generate code suitable for linking into programs
23654 using OpenMP offloading, use option @option{-mgomp}.
23655
23656 @item -muniform-simt
23657 @opindex muniform-simt
23658 Switch to code generation variant that allows to execute all threads in each
23659 warp, while maintaining memory state and side effects as if only one thread
23660 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23661 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23662 current lane index equals the master lane index), and the register being
23663 assigned is copied via a shuffle instruction from the master lane. Outside of
23664 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23665 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23666 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23667 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23668 with current lane index to compute the master lane index.
23669
23670 @item -mgomp
23671 @opindex mgomp
23672 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23673 @option{-muniform-simt} options, and selects corresponding multilib variant.
23674
23675 @end table
23676
23677 @node OpenRISC Options
23678 @subsection OpenRISC Options
23679 @cindex OpenRISC Options
23680
23681 These options are defined for OpenRISC:
23682
23683 @table @gcctabopt
23684
23685 @item -mboard=@var{name}
23686 @opindex mboard
23687 Configure a board specific runtime. This will be passed to the linker for
23688 newlib board library linking. The default is @code{or1ksim}.
23689
23690 @item -mnewlib
23691 @opindex mnewlib
23692 This option is ignored; it is for compatibility purposes only. This used to
23693 select linker and preprocessor options for use with newlib.
23694
23695 @item -msoft-div
23696 @itemx -mhard-div
23697 @opindex msoft-div
23698 @opindex mhard-div
23699 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
23700 This default is hardware divide.
23701
23702 @item -msoft-mul
23703 @itemx -mhard-mul
23704 @opindex msoft-mul
23705 @opindex mhard-mul
23706 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
23707 This default is hardware multiply.
23708
23709 @item -msoft-float
23710 @itemx -mhard-float
23711 @opindex msoft-float
23712 @opindex mhard-float
23713 Select software or hardware for floating point operations.
23714 The default is software.
23715
23716 @item -mdouble-float
23717 @opindex mdouble-float
23718 When @option{-mhard-float} is selected, enables generation of double-precision
23719 floating point instructions. By default functions from @file{libgcc} are used
23720 to perform double-precision floating point operations.
23721
23722 @item -munordered-float
23723 @opindex munordered-float
23724 When @option{-mhard-float} is selected, enables generation of unordered
23725 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
23726 functions from @file{libgcc} are used to perform unordered floating point
23727 compare and set flag operations.
23728
23729 @item -mcmov
23730 @opindex mcmov
23731 Enable generation of conditional move (@code{l.cmov}) instructions. By
23732 default the equivalent will be generated using using set and branch.
23733
23734 @item -mror
23735 @opindex mror
23736 Enable generation of rotate right (@code{l.ror}) instructions. By default
23737 functions from @file{libgcc} are used to perform rotate right operations.
23738
23739 @item -mrori
23740 @opindex mrori
23741 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
23742 By default functions from @file{libgcc} are used to perform rotate right with
23743 immediate operations.
23744
23745 @item -msext
23746 @opindex msext
23747 Enable generation of sign extension (@code{l.ext*}) instructions. By default
23748 memory loads are used to perform sign extension.
23749
23750 @item -msfimm
23751 @opindex msfimm
23752 Enable generation of compare and set flag with immediate (@code{l.sf*i})
23753 instructions. By default extra instructions will be generated to store the
23754 immediate to a register first.
23755
23756 @item -mshftimm
23757 @opindex mshftimm
23758 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
23759 @code{l.slli}) instructions. By default extra instructions will be generated
23760 to store the immediate to a register first.
23761
23762
23763 @end table
23764
23765 @node PDP-11 Options
23766 @subsection PDP-11 Options
23767 @cindex PDP-11 Options
23768
23769 These options are defined for the PDP-11:
23770
23771 @table @gcctabopt
23772 @item -mfpu
23773 @opindex mfpu
23774 Use hardware FPP floating point. This is the default. (FIS floating
23775 point on the PDP-11/40 is not supported.) Implies -m45.
23776
23777 @item -msoft-float
23778 @opindex msoft-float
23779 Do not use hardware floating point.
23780
23781 @item -mac0
23782 @opindex mac0
23783 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23784
23785 @item -mno-ac0
23786 @opindex mno-ac0
23787 Return floating-point results in memory. This is the default.
23788
23789 @item -m40
23790 @opindex m40
23791 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23792
23793 @item -m45
23794 @opindex m45
23795 Generate code for a PDP-11/45. This is the default.
23796
23797 @item -m10
23798 @opindex m10
23799 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23800
23801 @item -mint16
23802 @itemx -mno-int32
23803 @opindex mint16
23804 @opindex mno-int32
23805 Use 16-bit @code{int}. This is the default.
23806
23807 @item -mint32
23808 @itemx -mno-int16
23809 @opindex mint32
23810 @opindex mno-int16
23811 Use 32-bit @code{int}.
23812
23813 @item -msplit
23814 @opindex msplit
23815 Target has split instruction and data space. Implies -m45.
23816
23817 @item -munix-asm
23818 @opindex munix-asm
23819 Use Unix assembler syntax.
23820
23821 @item -mdec-asm
23822 @opindex mdec-asm
23823 Use DEC assembler syntax.
23824
23825 @item -mgnu-asm
23826 @opindex mgnu-asm
23827 Use GNU assembler syntax. This is the default.
23828
23829 @item -mlra
23830 @opindex mlra
23831 Use the new LRA register allocator. By default, the old ``reload''
23832 allocator is used.
23833 @end table
23834
23835 @node picoChip Options
23836 @subsection picoChip Options
23837 @cindex picoChip options
23838
23839 These @samp{-m} options are defined for picoChip implementations:
23840
23841 @table @gcctabopt
23842
23843 @item -mae=@var{ae_type}
23844 @opindex mcpu
23845 Set the instruction set, register set, and instruction scheduling
23846 parameters for array element type @var{ae_type}. Supported values
23847 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23848
23849 @option{-mae=ANY} selects a completely generic AE type. Code
23850 generated with this option runs on any of the other AE types. The
23851 code is not as efficient as it would be if compiled for a specific
23852 AE type, and some types of operation (e.g., multiplication) do not
23853 work properly on all types of AE.
23854
23855 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23856 for compiled code, and is the default.
23857
23858 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23859 option may suffer from poor performance of byte (char) manipulation,
23860 since the DSP AE does not provide hardware support for byte load/stores.
23861
23862 @item -msymbol-as-address
23863 Enable the compiler to directly use a symbol name as an address in a
23864 load/store instruction, without first loading it into a
23865 register. Typically, the use of this option generates larger
23866 programs, which run faster than when the option isn't used. However, the
23867 results vary from program to program, so it is left as a user option,
23868 rather than being permanently enabled.
23869
23870 @item -mno-inefficient-warnings
23871 Disables warnings about the generation of inefficient code. These
23872 warnings can be generated, for example, when compiling code that
23873 performs byte-level memory operations on the MAC AE type. The MAC AE has
23874 no hardware support for byte-level memory operations, so all byte
23875 load/stores must be synthesized from word load/store operations. This is
23876 inefficient and a warning is generated to indicate
23877 that you should rewrite the code to avoid byte operations, or to target
23878 an AE type that has the necessary hardware support. This option disables
23879 these warnings.
23880
23881 @end table
23882
23883 @node PowerPC Options
23884 @subsection PowerPC Options
23885 @cindex PowerPC options
23886
23887 These are listed under @xref{RS/6000 and PowerPC Options}.
23888
23889 @node PRU Options
23890 @subsection PRU Options
23891 @cindex PRU Options
23892
23893 These command-line options are defined for PRU target:
23894
23895 @table @gcctabopt
23896 @item -minrt
23897 @opindex minrt
23898 Link with a minimum runtime environment, with no support for static
23899 initializers and constructors. Using this option can significantly reduce
23900 the size of the final ELF binary. Beware that the compiler could still
23901 generate code with static initializers and constructors. It is up to the
23902 programmer to ensure that the source program will not use those features.
23903
23904 @item -mmcu=@var{mcu}
23905 @opindex mmcu
23906 Specify the PRU MCU variant to use. Check Newlib for the exact list of
23907 supported MCUs.
23908
23909 @item -mno-relax
23910 @opindex mno-relax
23911 Make GCC pass the @option{--no-relax} command-line option to the linker
23912 instead of the @option{--relax} option.
23913
23914 @item -mloop
23915 @opindex mloop
23916 Allow (or do not allow) GCC to use the LOOP instruction.
23917
23918 @item -mabi=@var{variant}
23919 @opindex mabi
23920 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
23921 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
23922 more naturally with certain GCC assumptions. These are the differences:
23923
23924 @table @samp
23925 @item Function Pointer Size
23926 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
23927 supports only 32-bit data and code pointers.
23928
23929 @item Optional Return Value Pointer
23930 Function return values larger than 64 bits are passed by using a hidden
23931 pointer as the first argument of the function. TI ABI, though, mandates that
23932 the pointer can be NULL in case the caller is not using the returned value.
23933 GNU always passes and expects a valid return value pointer.
23934
23935 @end table
23936
23937 The current @option{-mabi=ti} implementation simply raises a compile error
23938 when any of the above code constructs is detected. As a consequence
23939 the standard C library cannot be built and it is omitted when linking with
23940 @option{-mabi=ti}.
23941
23942 Relaxation is a GNU feature and for safety reasons is disabled when using
23943 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
23944 instructions, so the GNU linker cannot adjust them when shortening adjacent
23945 LDI32 pseudo instructions.
23946
23947 @end table
23948
23949 @node RISC-V Options
23950 @subsection RISC-V Options
23951 @cindex RISC-V Options
23952
23953 These command-line options are defined for RISC-V targets:
23954
23955 @table @gcctabopt
23956 @item -mbranch-cost=@var{n}
23957 @opindex mbranch-cost
23958 Set the cost of branches to roughly @var{n} instructions.
23959
23960 @item -mplt
23961 @itemx -mno-plt
23962 @opindex plt
23963 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23964 non-PIC. The default is @option{-mplt}.
23965
23966 @item -mabi=@var{ABI-string}
23967 @opindex mabi
23968 Specify integer and floating-point calling convention. @var{ABI-string}
23969 contains two parts: the size of integer types and the registers used for
23970 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23971 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23972 32-bit), and that floating-point values up to 64 bits wide are passed in F
23973 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23974 allows the compiler to generate code that uses the F and D extensions but only
23975 allows floating-point values up to 32 bits long to be passed in registers; or
23976 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23977 passed in registers.
23978
23979 The default for this argument is system dependent, users who want a specific
23980 calling convention should specify one explicitly. The valid calling
23981 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23982 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23983 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23984 invalid because the ABI requires 64-bit values be passed in F registers, but F
23985 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23986 only be used with the @samp{rv32e} architecture. This ABI is not well
23987 specified at present, and is subject to change.
23988
23989 @item -mfdiv
23990 @itemx -mno-fdiv
23991 @opindex mfdiv
23992 Do or don't use hardware floating-point divide and square root instructions.
23993 This requires the F or D extensions for floating-point registers. The default
23994 is to use them if the specified architecture has these instructions.
23995
23996 @item -mdiv
23997 @itemx -mno-div
23998 @opindex mdiv
23999 Do or don't use hardware instructions for integer division. This requires the
24000 M extension. The default is to use them if the specified architecture has
24001 these instructions.
24002
24003 @item -march=@var{ISA-string}
24004 @opindex march
24005 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
24006 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
24007 @samp{rv32imaf}.
24008
24009 @item -mtune=@var{processor-string}
24010 @opindex mtune
24011 Optimize the output for the given processor, specified by microarchitecture
24012 name. Permissible values for this option are: @samp{rocket},
24013 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
24014 and @samp{size}.
24015
24016 When @option{-mtune=} is not specified, the default is @samp{rocket}.
24017
24018 The @samp{size} choice is not intended for use by end-users. This is used
24019 when @option{-Os} is specified. It overrides the instruction cost info
24020 provided by @option{-mtune=}, but does not override the pipeline info. This
24021 helps reduce code size while still giving good performance.
24022
24023 @item -mpreferred-stack-boundary=@var{num}
24024 @opindex mpreferred-stack-boundary
24025 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24026 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24027 the default is 4 (16 bytes or 128-bits).
24028
24029 @strong{Warning:} If you use this switch, then you must build all modules with
24030 the same value, including any libraries. This includes the system libraries
24031 and startup modules.
24032
24033 @item -msmall-data-limit=@var{n}
24034 @opindex msmall-data-limit
24035 Put global and static data smaller than @var{n} bytes into a special section
24036 (on some targets).
24037
24038 @item -msave-restore
24039 @itemx -mno-save-restore
24040 @opindex msave-restore
24041 Do or don't use smaller but slower prologue and epilogue code that uses
24042 library function calls. The default is to use fast inline prologues and
24043 epilogues.
24044
24045 @item -mstrict-align
24046 @itemx -mno-strict-align
24047 @opindex mstrict-align
24048 Do not or do generate unaligned memory accesses. The default is set depending
24049 on whether the processor we are optimizing for supports fast unaligned access
24050 or not.
24051
24052 @item -mcmodel=medlow
24053 @opindex mcmodel=medlow
24054 Generate code for the medium-low code model. The program and its statically
24055 defined symbols must lie within a single 2 GiB address range and must lie
24056 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24057 statically or dynamically linked. This is the default code model.
24058
24059 @item -mcmodel=medany
24060 @opindex mcmodel=medany
24061 Generate code for the medium-any code model. The program and its statically
24062 defined symbols must be within any single 2 GiB address range. Programs can be
24063 statically or dynamically linked.
24064
24065 @item -mexplicit-relocs
24066 @itemx -mno-exlicit-relocs
24067 Use or do not use assembler relocation operators when dealing with symbolic
24068 addresses. The alternative is to use assembler macros instead, which may
24069 limit optimization.
24070
24071 @item -mrelax
24072 @itemx -mno-relax
24073 Take advantage of linker relaxations to reduce the number of instructions
24074 required to materialize symbol addresses. The default is to take advantage of
24075 linker relaxations.
24076
24077 @item -memit-attribute
24078 @itemx -mno-emit-attribute
24079 Emit (do not emit) RISC-V attribute to record extra information into ELF
24080 objects. This feature requires at least binutils 2.32.
24081
24082 @item -malign-data=@var{type}
24083 @opindex malign-data
24084 Control how GCC aligns variables and constants of array, structure, or union
24085 types. Supported values for @var{type} are @samp{xlen} which uses x register
24086 width as the alignment value, and @samp{natural} which uses natural alignment.
24087 @samp{xlen} is the default.
24088 @end table
24089
24090 @node RL78 Options
24091 @subsection RL78 Options
24092 @cindex RL78 Options
24093
24094 @table @gcctabopt
24095
24096 @item -msim
24097 @opindex msim
24098 Links in additional target libraries to support operation within a
24099 simulator.
24100
24101 @item -mmul=none
24102 @itemx -mmul=g10
24103 @itemx -mmul=g13
24104 @itemx -mmul=g14
24105 @itemx -mmul=rl78
24106 @opindex mmul
24107 Specifies the type of hardware multiplication and division support to
24108 be used. The simplest is @code{none}, which uses software for both
24109 multiplication and division. This is the default. The @code{g13}
24110 value is for the hardware multiply/divide peripheral found on the
24111 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24112 the multiplication and division instructions supported by the RL78/G14
24113 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24114 the value @code{mg10} is an alias for @code{none}.
24115
24116 In addition a C preprocessor macro is defined, based upon the setting
24117 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24118 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24119
24120 @item -mcpu=g10
24121 @itemx -mcpu=g13
24122 @itemx -mcpu=g14
24123 @itemx -mcpu=rl78
24124 @opindex mcpu
24125 Specifies the RL78 core to target. The default is the G14 core, also
24126 known as an S3 core or just RL78. The G13 or S2 core does not have
24127 multiply or divide instructions, instead it uses a hardware peripheral
24128 for these operations. The G10 or S1 core does not have register
24129 banks, so it uses a different calling convention.
24130
24131 If this option is set it also selects the type of hardware multiply
24132 support to use, unless this is overridden by an explicit
24133 @option{-mmul=none} option on the command line. Thus specifying
24134 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24135 peripheral and specifying @option{-mcpu=g10} disables the use of
24136 hardware multiplications altogether.
24137
24138 Note, although the RL78/G14 core is the default target, specifying
24139 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24140 change the behavior of the toolchain since it also enables G14
24141 hardware multiply support. If these options are not specified on the
24142 command line then software multiplication routines will be used even
24143 though the code targets the RL78 core. This is for backwards
24144 compatibility with older toolchains which did not have hardware
24145 multiply and divide support.
24146
24147 In addition a C preprocessor macro is defined, based upon the setting
24148 of this option. Possible values are: @code{__RL78_G10__},
24149 @code{__RL78_G13__} or @code{__RL78_G14__}.
24150
24151 @item -mg10
24152 @itemx -mg13
24153 @itemx -mg14
24154 @itemx -mrl78
24155 @opindex mg10
24156 @opindex mg13
24157 @opindex mg14
24158 @opindex mrl78
24159 These are aliases for the corresponding @option{-mcpu=} option. They
24160 are provided for backwards compatibility.
24161
24162 @item -mallregs
24163 @opindex mallregs
24164 Allow the compiler to use all of the available registers. By default
24165 registers @code{r24..r31} are reserved for use in interrupt handlers.
24166 With this option enabled these registers can be used in ordinary
24167 functions as well.
24168
24169 @item -m64bit-doubles
24170 @itemx -m32bit-doubles
24171 @opindex m64bit-doubles
24172 @opindex m32bit-doubles
24173 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24174 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24175 @option{-m32bit-doubles}.
24176
24177 @item -msave-mduc-in-interrupts
24178 @itemx -mno-save-mduc-in-interrupts
24179 @opindex msave-mduc-in-interrupts
24180 @opindex mno-save-mduc-in-interrupts
24181 Specifies that interrupt handler functions should preserve the
24182 MDUC registers. This is only necessary if normal code might use
24183 the MDUC registers, for example because it performs multiplication
24184 and division operations. The default is to ignore the MDUC registers
24185 as this makes the interrupt handlers faster. The target option -mg13
24186 needs to be passed for this to work as this feature is only available
24187 on the G13 target (S2 core). The MDUC registers will only be saved
24188 if the interrupt handler performs a multiplication or division
24189 operation or it calls another function.
24190
24191 @end table
24192
24193 @node RS/6000 and PowerPC Options
24194 @subsection IBM RS/6000 and PowerPC Options
24195 @cindex RS/6000 and PowerPC Options
24196 @cindex IBM RS/6000 and PowerPC Options
24197
24198 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24199 @table @gcctabopt
24200 @item -mpowerpc-gpopt
24201 @itemx -mno-powerpc-gpopt
24202 @itemx -mpowerpc-gfxopt
24203 @itemx -mno-powerpc-gfxopt
24204 @need 800
24205 @itemx -mpowerpc64
24206 @itemx -mno-powerpc64
24207 @itemx -mmfcrf
24208 @itemx -mno-mfcrf
24209 @itemx -mpopcntb
24210 @itemx -mno-popcntb
24211 @itemx -mpopcntd
24212 @itemx -mno-popcntd
24213 @itemx -mfprnd
24214 @itemx -mno-fprnd
24215 @need 800
24216 @itemx -mcmpb
24217 @itemx -mno-cmpb
24218 @itemx -mhard-dfp
24219 @itemx -mno-hard-dfp
24220 @opindex mpowerpc-gpopt
24221 @opindex mno-powerpc-gpopt
24222 @opindex mpowerpc-gfxopt
24223 @opindex mno-powerpc-gfxopt
24224 @opindex mpowerpc64
24225 @opindex mno-powerpc64
24226 @opindex mmfcrf
24227 @opindex mno-mfcrf
24228 @opindex mpopcntb
24229 @opindex mno-popcntb
24230 @opindex mpopcntd
24231 @opindex mno-popcntd
24232 @opindex mfprnd
24233 @opindex mno-fprnd
24234 @opindex mcmpb
24235 @opindex mno-cmpb
24236 @opindex mhard-dfp
24237 @opindex mno-hard-dfp
24238 You use these options to specify which instructions are available on the
24239 processor you are using. The default value of these options is
24240 determined when configuring GCC@. Specifying the
24241 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24242 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24243 rather than the options listed above.
24244
24245 Specifying @option{-mpowerpc-gpopt} allows
24246 GCC to use the optional PowerPC architecture instructions in the
24247 General Purpose group, including floating-point square root. Specifying
24248 @option{-mpowerpc-gfxopt} allows GCC to
24249 use the optional PowerPC architecture instructions in the Graphics
24250 group, including floating-point select.
24251
24252 The @option{-mmfcrf} option allows GCC to generate the move from
24253 condition register field instruction implemented on the POWER4
24254 processor and other processors that support the PowerPC V2.01
24255 architecture.
24256 The @option{-mpopcntb} option allows GCC to generate the popcount and
24257 double-precision FP reciprocal estimate instruction implemented on the
24258 POWER5 processor and other processors that support the PowerPC V2.02
24259 architecture.
24260 The @option{-mpopcntd} option allows GCC to generate the popcount
24261 instruction implemented on the POWER7 processor and other processors
24262 that support the PowerPC V2.06 architecture.
24263 The @option{-mfprnd} option allows GCC to generate the FP round to
24264 integer instructions implemented on the POWER5+ processor and other
24265 processors that support the PowerPC V2.03 architecture.
24266 The @option{-mcmpb} option allows GCC to generate the compare bytes
24267 instruction implemented on the POWER6 processor and other processors
24268 that support the PowerPC V2.05 architecture.
24269 The @option{-mhard-dfp} option allows GCC to generate the decimal
24270 floating-point instructions implemented on some POWER processors.
24271
24272 The @option{-mpowerpc64} option allows GCC to generate the additional
24273 64-bit instructions that are found in the full PowerPC64 architecture
24274 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24275 @option{-mno-powerpc64}.
24276
24277 @item -mcpu=@var{cpu_type}
24278 @opindex mcpu
24279 Set architecture type, register usage, and
24280 instruction scheduling parameters for machine type @var{cpu_type}.
24281 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24282 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24283 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24284 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24285 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24286 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24287 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24288 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24289 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24290 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24291 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24292 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24293
24294 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24295 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24296 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24297 architecture machine types, with an appropriate, generic processor
24298 model assumed for scheduling purposes.
24299
24300 Specifying @samp{native} as cpu type detects and selects the
24301 architecture option that corresponds to the host processor of the
24302 system performing the compilation.
24303 @option{-mcpu=native} has no effect if GCC does not recognize the
24304 processor.
24305
24306 The other options specify a specific processor. Code generated under
24307 those options runs best on that processor, and may not run at all on
24308 others.
24309
24310 The @option{-mcpu} options automatically enable or disable the
24311 following options:
24312
24313 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24314 -mpopcntb -mpopcntd -mpowerpc64 @gol
24315 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24316 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24317 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24318 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24319
24320 The particular options set for any particular CPU varies between
24321 compiler versions, depending on what setting seems to produce optimal
24322 code for that CPU; it doesn't necessarily reflect the actual hardware's
24323 capabilities. If you wish to set an individual option to a particular
24324 value, you may specify it after the @option{-mcpu} option, like
24325 @option{-mcpu=970 -mno-altivec}.
24326
24327 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24328 not enabled or disabled by the @option{-mcpu} option at present because
24329 AIX does not have full support for these options. You may still
24330 enable or disable them individually if you're sure it'll work in your
24331 environment.
24332
24333 @item -mtune=@var{cpu_type}
24334 @opindex mtune
24335 Set the instruction scheduling parameters for machine type
24336 @var{cpu_type}, but do not set the architecture type or register usage,
24337 as @option{-mcpu=@var{cpu_type}} does. The same
24338 values for @var{cpu_type} are used for @option{-mtune} as for
24339 @option{-mcpu}. If both are specified, the code generated uses the
24340 architecture and registers set by @option{-mcpu}, but the
24341 scheduling parameters set by @option{-mtune}.
24342
24343 @item -mcmodel=small
24344 @opindex mcmodel=small
24345 Generate PowerPC64 code for the small model: The TOC is limited to
24346 64k.
24347
24348 @item -mcmodel=medium
24349 @opindex mcmodel=medium
24350 Generate PowerPC64 code for the medium model: The TOC and other static
24351 data may be up to a total of 4G in size. This is the default for 64-bit
24352 Linux.
24353
24354 @item -mcmodel=large
24355 @opindex mcmodel=large
24356 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24357 in size. Other data and code is only limited by the 64-bit address
24358 space.
24359
24360 @item -maltivec
24361 @itemx -mno-altivec
24362 @opindex maltivec
24363 @opindex mno-altivec
24364 Generate code that uses (does not use) AltiVec instructions, and also
24365 enable the use of built-in functions that allow more direct access to
24366 the AltiVec instruction set. You may also need to set
24367 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24368 enhancements.
24369
24370 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24371 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24372 match array element order corresponding to the endianness of the
24373 target. That is, element zero identifies the leftmost element in a
24374 vector register when targeting a big-endian platform, and identifies
24375 the rightmost element in a vector register when targeting a
24376 little-endian platform.
24377
24378 @item -mvrsave
24379 @itemx -mno-vrsave
24380 @opindex mvrsave
24381 @opindex mno-vrsave
24382 Generate VRSAVE instructions when generating AltiVec code.
24383
24384 @item -msecure-plt
24385 @opindex msecure-plt
24386 Generate code that allows @command{ld} and @command{ld.so}
24387 to build executables and shared
24388 libraries with non-executable @code{.plt} and @code{.got} sections.
24389 This is a PowerPC
24390 32-bit SYSV ABI option.
24391
24392 @item -mbss-plt
24393 @opindex mbss-plt
24394 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24395 fills in, and
24396 requires @code{.plt} and @code{.got}
24397 sections that are both writable and executable.
24398 This is a PowerPC 32-bit SYSV ABI option.
24399
24400 @item -misel
24401 @itemx -mno-isel
24402 @opindex misel
24403 @opindex mno-isel
24404 This switch enables or disables the generation of ISEL instructions.
24405
24406 @item -mvsx
24407 @itemx -mno-vsx
24408 @opindex mvsx
24409 @opindex mno-vsx
24410 Generate code that uses (does not use) vector/scalar (VSX)
24411 instructions, and also enable the use of built-in functions that allow
24412 more direct access to the VSX instruction set.
24413
24414 @item -mcrypto
24415 @itemx -mno-crypto
24416 @opindex mcrypto
24417 @opindex mno-crypto
24418 Enable the use (disable) of the built-in functions that allow direct
24419 access to the cryptographic instructions that were added in version
24420 2.07 of the PowerPC ISA.
24421
24422 @item -mhtm
24423 @itemx -mno-htm
24424 @opindex mhtm
24425 @opindex mno-htm
24426 Enable (disable) the use of the built-in functions that allow direct
24427 access to the Hardware Transactional Memory (HTM) instructions that
24428 were added in version 2.07 of the PowerPC ISA.
24429
24430 @item -mpower8-fusion
24431 @itemx -mno-power8-fusion
24432 @opindex mpower8-fusion
24433 @opindex mno-power8-fusion
24434 Generate code that keeps (does not keeps) some integer operations
24435 adjacent so that the instructions can be fused together on power8 and
24436 later processors.
24437
24438 @item -mpower8-vector
24439 @itemx -mno-power8-vector
24440 @opindex mpower8-vector
24441 @opindex mno-power8-vector
24442 Generate code that uses (does not use) the vector and scalar
24443 instructions that were added in version 2.07 of the PowerPC ISA. Also
24444 enable the use of built-in functions that allow more direct access to
24445 the vector instructions.
24446
24447 @item -mquad-memory
24448 @itemx -mno-quad-memory
24449 @opindex mquad-memory
24450 @opindex mno-quad-memory
24451 Generate code that uses (does not use) the non-atomic quad word memory
24452 instructions. The @option{-mquad-memory} option requires use of
24453 64-bit mode.
24454
24455 @item -mquad-memory-atomic
24456 @itemx -mno-quad-memory-atomic
24457 @opindex mquad-memory-atomic
24458 @opindex mno-quad-memory-atomic
24459 Generate code that uses (does not use) the atomic quad word memory
24460 instructions. The @option{-mquad-memory-atomic} option requires use of
24461 64-bit mode.
24462
24463 @item -mfloat128
24464 @itemx -mno-float128
24465 @opindex mfloat128
24466 @opindex mno-float128
24467 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24468 and use either software emulation for IEEE 128-bit floating point or
24469 hardware instructions.
24470
24471 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24472 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24473 use the IEEE 128-bit floating point support. The IEEE 128-bit
24474 floating point support only works on PowerPC Linux systems.
24475
24476 The default for @option{-mfloat128} is enabled on PowerPC Linux
24477 systems using the VSX instruction set, and disabled on other systems.
24478
24479 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24480 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24481 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24482 floating point instructions. Otherwise, if you do not specify to
24483 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24484 system, IEEE 128-bit floating point will be done with software
24485 emulation.
24486
24487 @item -mfloat128-hardware
24488 @itemx -mno-float128-hardware
24489 @opindex mfloat128-hardware
24490 @opindex mno-float128-hardware
24491 Enable/disable using ISA 3.0 hardware instructions to support the
24492 @var{__float128} data type.
24493
24494 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24495 Linux systems using the ISA 3.0 instruction set, and disabled on other
24496 systems.
24497
24498 @item -m32
24499 @itemx -m64
24500 @opindex m32
24501 @opindex m64
24502 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24503 targets (including GNU/Linux). The 32-bit environment sets int, long
24504 and pointer to 32 bits and generates code that runs on any PowerPC
24505 variant. The 64-bit environment sets int to 32 bits and long and
24506 pointer to 64 bits, and generates code for PowerPC64, as for
24507 @option{-mpowerpc64}.
24508
24509 @item -mfull-toc
24510 @itemx -mno-fp-in-toc
24511 @itemx -mno-sum-in-toc
24512 @itemx -mminimal-toc
24513 @opindex mfull-toc
24514 @opindex mno-fp-in-toc
24515 @opindex mno-sum-in-toc
24516 @opindex mminimal-toc
24517 Modify generation of the TOC (Table Of Contents), which is created for
24518 every executable file. The @option{-mfull-toc} option is selected by
24519 default. In that case, GCC allocates at least one TOC entry for
24520 each unique non-automatic variable reference in your program. GCC
24521 also places floating-point constants in the TOC@. However, only
24522 16,384 entries are available in the TOC@.
24523
24524 If you receive a linker error message that saying you have overflowed
24525 the available TOC space, you can reduce the amount of TOC space used
24526 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24527 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24528 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24529 generate code to calculate the sum of an address and a constant at
24530 run time instead of putting that sum into the TOC@. You may specify one
24531 or both of these options. Each causes GCC to produce very slightly
24532 slower and larger code at the expense of conserving TOC space.
24533
24534 If you still run out of space in the TOC even when you specify both of
24535 these options, specify @option{-mminimal-toc} instead. This option causes
24536 GCC to make only one TOC entry for every file. When you specify this
24537 option, GCC produces code that is slower and larger but which
24538 uses extremely little TOC space. You may wish to use this option
24539 only on files that contain less frequently-executed code.
24540
24541 @item -maix64
24542 @itemx -maix32
24543 @opindex maix64
24544 @opindex maix32
24545 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24546 @code{long} type, and the infrastructure needed to support them.
24547 Specifying @option{-maix64} implies @option{-mpowerpc64},
24548 while @option{-maix32} disables the 64-bit ABI and
24549 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24550
24551 @item -mxl-compat
24552 @itemx -mno-xl-compat
24553 @opindex mxl-compat
24554 @opindex mno-xl-compat
24555 Produce code that conforms more closely to IBM XL compiler semantics
24556 when using AIX-compatible ABI@. Pass floating-point arguments to
24557 prototyped functions beyond the register save area (RSA) on the stack
24558 in addition to argument FPRs. Do not assume that most significant
24559 double in 128-bit long double value is properly rounded when comparing
24560 values and converting to double. Use XL symbol names for long double
24561 support routines.
24562
24563 The AIX calling convention was extended but not initially documented to
24564 handle an obscure K&R C case of calling a function that takes the
24565 address of its arguments with fewer arguments than declared. IBM XL
24566 compilers access floating-point arguments that do not fit in the
24567 RSA from the stack when a subroutine is compiled without
24568 optimization. Because always storing floating-point arguments on the
24569 stack is inefficient and rarely needed, this option is not enabled by
24570 default and only is necessary when calling subroutines compiled by IBM
24571 XL compilers without optimization.
24572
24573 @item -mpe
24574 @opindex mpe
24575 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24576 application written to use message passing with special startup code to
24577 enable the application to run. The system must have PE installed in the
24578 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24579 must be overridden with the @option{-specs=} option to specify the
24580 appropriate directory location. The Parallel Environment does not
24581 support threads, so the @option{-mpe} option and the @option{-pthread}
24582 option are incompatible.
24583
24584 @item -malign-natural
24585 @itemx -malign-power
24586 @opindex malign-natural
24587 @opindex malign-power
24588 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24589 @option{-malign-natural} overrides the ABI-defined alignment of larger
24590 types, such as floating-point doubles, on their natural size-based boundary.
24591 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24592 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24593
24594 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24595 is not supported.
24596
24597 @item -msoft-float
24598 @itemx -mhard-float
24599 @opindex msoft-float
24600 @opindex mhard-float
24601 Generate code that does not use (uses) the floating-point register set.
24602 Software floating-point emulation is provided if you use the
24603 @option{-msoft-float} option, and pass the option to GCC when linking.
24604
24605 @item -mmultiple
24606 @itemx -mno-multiple
24607 @opindex mmultiple
24608 @opindex mno-multiple
24609 Generate code that uses (does not use) the load multiple word
24610 instructions and the store multiple word instructions. These
24611 instructions are generated by default on POWER systems, and not
24612 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24613 PowerPC systems, since those instructions do not work when the
24614 processor is in little-endian mode. The exceptions are PPC740 and
24615 PPC750 which permit these instructions in little-endian mode.
24616
24617 @item -mupdate
24618 @itemx -mno-update
24619 @opindex mupdate
24620 @opindex mno-update
24621 Generate code that uses (does not use) the load or store instructions
24622 that update the base register to the address of the calculated memory
24623 location. These instructions are generated by default. If you use
24624 @option{-mno-update}, there is a small window between the time that the
24625 stack pointer is updated and the address of the previous frame is
24626 stored, which means code that walks the stack frame across interrupts or
24627 signals may get corrupted data.
24628
24629 @item -mavoid-indexed-addresses
24630 @itemx -mno-avoid-indexed-addresses
24631 @opindex mavoid-indexed-addresses
24632 @opindex mno-avoid-indexed-addresses
24633 Generate code that tries to avoid (not avoid) the use of indexed load
24634 or store instructions. These instructions can incur a performance
24635 penalty on Power6 processors in certain situations, such as when
24636 stepping through large arrays that cross a 16M boundary. This option
24637 is enabled by default when targeting Power6 and disabled otherwise.
24638
24639 @item -mfused-madd
24640 @itemx -mno-fused-madd
24641 @opindex mfused-madd
24642 @opindex mno-fused-madd
24643 Generate code that uses (does not use) the floating-point multiply and
24644 accumulate instructions. These instructions are generated by default
24645 if hardware floating point is used. The machine-dependent
24646 @option{-mfused-madd} option is now mapped to the machine-independent
24647 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24648 mapped to @option{-ffp-contract=off}.
24649
24650 @item -mmulhw
24651 @itemx -mno-mulhw
24652 @opindex mmulhw
24653 @opindex mno-mulhw
24654 Generate code that uses (does not use) the half-word multiply and
24655 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24656 These instructions are generated by default when targeting those
24657 processors.
24658
24659 @item -mdlmzb
24660 @itemx -mno-dlmzb
24661 @opindex mdlmzb
24662 @opindex mno-dlmzb
24663 Generate code that uses (does not use) the string-search @samp{dlmzb}
24664 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24665 generated by default when targeting those processors.
24666
24667 @item -mno-bit-align
24668 @itemx -mbit-align
24669 @opindex mno-bit-align
24670 @opindex mbit-align
24671 On System V.4 and embedded PowerPC systems do not (do) force structures
24672 and unions that contain bit-fields to be aligned to the base type of the
24673 bit-field.
24674
24675 For example, by default a structure containing nothing but 8
24676 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24677 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24678 the structure is aligned to a 1-byte boundary and is 1 byte in
24679 size.
24680
24681 @item -mno-strict-align
24682 @itemx -mstrict-align
24683 @opindex mno-strict-align
24684 @opindex mstrict-align
24685 On System V.4 and embedded PowerPC systems do not (do) assume that
24686 unaligned memory references are handled by the system.
24687
24688 @item -mrelocatable
24689 @itemx -mno-relocatable
24690 @opindex mrelocatable
24691 @opindex mno-relocatable
24692 Generate code that allows (does not allow) a static executable to be
24693 relocated to a different address at run time. A simple embedded
24694 PowerPC system loader should relocate the entire contents of
24695 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24696 a table of 32-bit addresses generated by this option. For this to
24697 work, all objects linked together must be compiled with
24698 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24699 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24700
24701 @item -mrelocatable-lib
24702 @itemx -mno-relocatable-lib
24703 @opindex mrelocatable-lib
24704 @opindex mno-relocatable-lib
24705 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24706 @code{.fixup} section to allow static executables to be relocated at
24707 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24708 alignment of @option{-mrelocatable}. Objects compiled with
24709 @option{-mrelocatable-lib} may be linked with objects compiled with
24710 any combination of the @option{-mrelocatable} options.
24711
24712 @item -mno-toc
24713 @itemx -mtoc
24714 @opindex mno-toc
24715 @opindex mtoc
24716 On System V.4 and embedded PowerPC systems do not (do) assume that
24717 register 2 contains a pointer to a global area pointing to the addresses
24718 used in the program.
24719
24720 @item -mlittle
24721 @itemx -mlittle-endian
24722 @opindex mlittle
24723 @opindex mlittle-endian
24724 On System V.4 and embedded PowerPC systems compile code for the
24725 processor in little-endian mode. The @option{-mlittle-endian} option is
24726 the same as @option{-mlittle}.
24727
24728 @item -mbig
24729 @itemx -mbig-endian
24730 @opindex mbig
24731 @opindex mbig-endian
24732 On System V.4 and embedded PowerPC systems compile code for the
24733 processor in big-endian mode. The @option{-mbig-endian} option is
24734 the same as @option{-mbig}.
24735
24736 @item -mdynamic-no-pic
24737 @opindex mdynamic-no-pic
24738 On Darwin and Mac OS X systems, compile code so that it is not
24739 relocatable, but that its external references are relocatable. The
24740 resulting code is suitable for applications, but not shared
24741 libraries.
24742
24743 @item -msingle-pic-base
24744 @opindex msingle-pic-base
24745 Treat the register used for PIC addressing as read-only, rather than
24746 loading it in the prologue for each function. The runtime system is
24747 responsible for initializing this register with an appropriate value
24748 before execution begins.
24749
24750 @item -mprioritize-restricted-insns=@var{priority}
24751 @opindex mprioritize-restricted-insns
24752 This option controls the priority that is assigned to
24753 dispatch-slot restricted instructions during the second scheduling
24754 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24755 or @samp{2} to assign no, highest, or second-highest (respectively)
24756 priority to dispatch-slot restricted
24757 instructions.
24758
24759 @item -msched-costly-dep=@var{dependence_type}
24760 @opindex msched-costly-dep
24761 This option controls which dependences are considered costly
24762 by the target during instruction scheduling. The argument
24763 @var{dependence_type} takes one of the following values:
24764
24765 @table @asis
24766 @item @samp{no}
24767 No dependence is costly.
24768
24769 @item @samp{all}
24770 All dependences are costly.
24771
24772 @item @samp{true_store_to_load}
24773 A true dependence from store to load is costly.
24774
24775 @item @samp{store_to_load}
24776 Any dependence from store to load is costly.
24777
24778 @item @var{number}
24779 Any dependence for which the latency is greater than or equal to
24780 @var{number} is costly.
24781 @end table
24782
24783 @item -minsert-sched-nops=@var{scheme}
24784 @opindex minsert-sched-nops
24785 This option controls which NOP insertion scheme is used during
24786 the second scheduling pass. The argument @var{scheme} takes one of the
24787 following values:
24788
24789 @table @asis
24790 @item @samp{no}
24791 Don't insert NOPs.
24792
24793 @item @samp{pad}
24794 Pad with NOPs any dispatch group that has vacant issue slots,
24795 according to the scheduler's grouping.
24796
24797 @item @samp{regroup_exact}
24798 Insert NOPs to force costly dependent insns into
24799 separate groups. Insert exactly as many NOPs as needed to force an insn
24800 to a new group, according to the estimated processor grouping.
24801
24802 @item @var{number}
24803 Insert NOPs to force costly dependent insns into
24804 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24805 @end table
24806
24807 @item -mcall-sysv
24808 @opindex mcall-sysv
24809 On System V.4 and embedded PowerPC systems compile code using calling
24810 conventions that adhere to the March 1995 draft of the System V
24811 Application Binary Interface, PowerPC processor supplement. This is the
24812 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24813
24814 @item -mcall-sysv-eabi
24815 @itemx -mcall-eabi
24816 @opindex mcall-sysv-eabi
24817 @opindex mcall-eabi
24818 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24819
24820 @item -mcall-sysv-noeabi
24821 @opindex mcall-sysv-noeabi
24822 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24823
24824 @item -mcall-aixdesc
24825 @opindex m
24826 On System V.4 and embedded PowerPC systems compile code for the AIX
24827 operating system.
24828
24829 @item -mcall-linux
24830 @opindex mcall-linux
24831 On System V.4 and embedded PowerPC systems compile code for the
24832 Linux-based GNU system.
24833
24834 @item -mcall-freebsd
24835 @opindex mcall-freebsd
24836 On System V.4 and embedded PowerPC systems compile code for the
24837 FreeBSD operating system.
24838
24839 @item -mcall-netbsd
24840 @opindex mcall-netbsd
24841 On System V.4 and embedded PowerPC systems compile code for the
24842 NetBSD operating system.
24843
24844 @item -mcall-openbsd
24845 @opindex mcall-netbsd
24846 On System V.4 and embedded PowerPC systems compile code for the
24847 OpenBSD operating system.
24848
24849 @item -mtraceback=@var{traceback_type}
24850 @opindex mtraceback
24851 Select the type of traceback table. Valid values for @var{traceback_type}
24852 are @samp{full}, @samp{part}, and @samp{no}.
24853
24854 @item -maix-struct-return
24855 @opindex maix-struct-return
24856 Return all structures in memory (as specified by the AIX ABI)@.
24857
24858 @item -msvr4-struct-return
24859 @opindex msvr4-struct-return
24860 Return structures smaller than 8 bytes in registers (as specified by the
24861 SVR4 ABI)@.
24862
24863 @item -mabi=@var{abi-type}
24864 @opindex mabi
24865 Extend the current ABI with a particular extension, or remove such extension.
24866 Valid values are @samp{altivec}, @samp{no-altivec},
24867 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24868 @samp{elfv1}, @samp{elfv2}@.
24869
24870 @item -mabi=ibmlongdouble
24871 @opindex mabi=ibmlongdouble
24872 Change the current ABI to use IBM extended-precision long double.
24873 This is not likely to work if your system defaults to using IEEE
24874 extended-precision long double. If you change the long double type
24875 from IEEE extended-precision, the compiler will issue a warning unless
24876 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24877 to be enabled.
24878
24879 @item -mabi=ieeelongdouble
24880 @opindex mabi=ieeelongdouble
24881 Change the current ABI to use IEEE extended-precision long double.
24882 This is not likely to work if your system defaults to using IBM
24883 extended-precision long double. If you change the long double type
24884 from IBM extended-precision, the compiler will issue a warning unless
24885 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24886 to be enabled.
24887
24888 @item -mabi=elfv1
24889 @opindex mabi=elfv1
24890 Change the current ABI to use the ELFv1 ABI.
24891 This is the default ABI for big-endian PowerPC 64-bit Linux.
24892 Overriding the default ABI requires special system support and is
24893 likely to fail in spectacular ways.
24894
24895 @item -mabi=elfv2
24896 @opindex mabi=elfv2
24897 Change the current ABI to use the ELFv2 ABI.
24898 This is the default ABI for little-endian PowerPC 64-bit Linux.
24899 Overriding the default ABI requires special system support and is
24900 likely to fail in spectacular ways.
24901
24902 @item -mgnu-attribute
24903 @itemx -mno-gnu-attribute
24904 @opindex mgnu-attribute
24905 @opindex mno-gnu-attribute
24906 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24907 .gnu.attributes section that specify ABI variations in function
24908 parameters or return values.
24909
24910 @item -mprototype
24911 @itemx -mno-prototype
24912 @opindex mprototype
24913 @opindex mno-prototype
24914 On System V.4 and embedded PowerPC systems assume that all calls to
24915 variable argument functions are properly prototyped. Otherwise, the
24916 compiler must insert an instruction before every non-prototyped call to
24917 set or clear bit 6 of the condition code register (@code{CR}) to
24918 indicate whether floating-point values are passed in the floating-point
24919 registers in case the function takes variable arguments. With
24920 @option{-mprototype}, only calls to prototyped variable argument functions
24921 set or clear the bit.
24922
24923 @item -msim
24924 @opindex msim
24925 On embedded PowerPC systems, assume that the startup module is called
24926 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24927 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24928 configurations.
24929
24930 @item -mmvme
24931 @opindex mmvme
24932 On embedded PowerPC systems, assume that the startup module is called
24933 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24934 @file{libc.a}.
24935
24936 @item -mads
24937 @opindex mads
24938 On embedded PowerPC systems, assume that the startup module is called
24939 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24940 @file{libc.a}.
24941
24942 @item -myellowknife
24943 @opindex myellowknife
24944 On embedded PowerPC systems, assume that the startup module is called
24945 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24946 @file{libc.a}.
24947
24948 @item -mvxworks
24949 @opindex mvxworks
24950 On System V.4 and embedded PowerPC systems, specify that you are
24951 compiling for a VxWorks system.
24952
24953 @item -memb
24954 @opindex memb
24955 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24956 header to indicate that @samp{eabi} extended relocations are used.
24957
24958 @item -meabi
24959 @itemx -mno-eabi
24960 @opindex meabi
24961 @opindex mno-eabi
24962 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24963 Embedded Applications Binary Interface (EABI), which is a set of
24964 modifications to the System V.4 specifications. Selecting @option{-meabi}
24965 means that the stack is aligned to an 8-byte boundary, a function
24966 @code{__eabi} is called from @code{main} to set up the EABI
24967 environment, and the @option{-msdata} option can use both @code{r2} and
24968 @code{r13} to point to two separate small data areas. Selecting
24969 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24970 no EABI initialization function is called from @code{main}, and the
24971 @option{-msdata} option only uses @code{r13} to point to a single
24972 small data area. The @option{-meabi} option is on by default if you
24973 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24974
24975 @item -msdata=eabi
24976 @opindex msdata=eabi
24977 On System V.4 and embedded PowerPC systems, put small initialized
24978 @code{const} global and static data in the @code{.sdata2} section, which
24979 is pointed to by register @code{r2}. Put small initialized
24980 non-@code{const} global and static data in the @code{.sdata} section,
24981 which is pointed to by register @code{r13}. Put small uninitialized
24982 global and static data in the @code{.sbss} section, which is adjacent to
24983 the @code{.sdata} section. The @option{-msdata=eabi} option is
24984 incompatible with the @option{-mrelocatable} option. The
24985 @option{-msdata=eabi} option also sets the @option{-memb} option.
24986
24987 @item -msdata=sysv
24988 @opindex msdata=sysv
24989 On System V.4 and embedded PowerPC systems, put small global and static
24990 data in the @code{.sdata} section, which is pointed to by register
24991 @code{r13}. Put small uninitialized global and static data in the
24992 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24993 The @option{-msdata=sysv} option is incompatible with the
24994 @option{-mrelocatable} option.
24995
24996 @item -msdata=default
24997 @itemx -msdata
24998 @opindex msdata=default
24999 @opindex msdata
25000 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
25001 compile code the same as @option{-msdata=eabi}, otherwise compile code the
25002 same as @option{-msdata=sysv}.
25003
25004 @item -msdata=data
25005 @opindex msdata=data
25006 On System V.4 and embedded PowerPC systems, put small global
25007 data in the @code{.sdata} section. Put small uninitialized global
25008 data in the @code{.sbss} section. Do not use register @code{r13}
25009 to address small data however. This is the default behavior unless
25010 other @option{-msdata} options are used.
25011
25012 @item -msdata=none
25013 @itemx -mno-sdata
25014 @opindex msdata=none
25015 @opindex mno-sdata
25016 On embedded PowerPC systems, put all initialized global and static data
25017 in the @code{.data} section, and all uninitialized data in the
25018 @code{.bss} section.
25019
25020 @item -mreadonly-in-sdata
25021 @opindex mreadonly-in-sdata
25022 @opindex mno-readonly-in-sdata
25023 Put read-only objects in the @code{.sdata} section as well. This is the
25024 default.
25025
25026 @item -mblock-move-inline-limit=@var{num}
25027 @opindex mblock-move-inline-limit
25028 Inline all block moves (such as calls to @code{memcpy} or structure
25029 copies) less than or equal to @var{num} bytes. The minimum value for
25030 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
25031 targets. The default value is target-specific.
25032
25033 @item -mblock-compare-inline-limit=@var{num}
25034 @opindex mblock-compare-inline-limit
25035 Generate non-looping inline code for all block compares (such as calls
25036 to @code{memcmp} or structure compares) less than or equal to @var{num}
25037 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25038 block compare is disabled. The default value is target-specific.
25039
25040 @item -mblock-compare-inline-loop-limit=@var{num}
25041 @opindex mblock-compare-inline-loop-limit
25042 Generate an inline expansion using loop code for all block compares that
25043 are less than or equal to @var{num} bytes, but greater than the limit
25044 for non-loop inline block compare expansion. If the block length is not
25045 constant, at most @var{num} bytes will be compared before @code{memcmp}
25046 is called to compare the remainder of the block. The default value is
25047 target-specific.
25048
25049 @item -mstring-compare-inline-limit=@var{num}
25050 @opindex mstring-compare-inline-limit
25051 Compare at most @var{num} string bytes with inline code.
25052 If the difference or end of string is not found at the
25053 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25054 take care of the rest of the comparison. The default is 64 bytes.
25055
25056 @item -G @var{num}
25057 @opindex G
25058 @cindex smaller data references (PowerPC)
25059 @cindex .sdata/.sdata2 references (PowerPC)
25060 On embedded PowerPC systems, put global and static items less than or
25061 equal to @var{num} bytes into the small data or BSS sections instead of
25062 the normal data or BSS section. By default, @var{num} is 8. The
25063 @option{-G @var{num}} switch is also passed to the linker.
25064 All modules should be compiled with the same @option{-G @var{num}} value.
25065
25066 @item -mregnames
25067 @itemx -mno-regnames
25068 @opindex mregnames
25069 @opindex mno-regnames
25070 On System V.4 and embedded PowerPC systems do (do not) emit register
25071 names in the assembly language output using symbolic forms.
25072
25073 @item -mlongcall
25074 @itemx -mno-longcall
25075 @opindex mlongcall
25076 @opindex mno-longcall
25077 By default assume that all calls are far away so that a longer and more
25078 expensive calling sequence is required. This is required for calls
25079 farther than 32 megabytes (33,554,432 bytes) from the current location.
25080 A short call is generated if the compiler knows
25081 the call cannot be that far away. This setting can be overridden by
25082 the @code{shortcall} function attribute, or by @code{#pragma
25083 longcall(0)}.
25084
25085 Some linkers are capable of detecting out-of-range calls and generating
25086 glue code on the fly. On these systems, long calls are unnecessary and
25087 generate slower code. As of this writing, the AIX linker can do this,
25088 as can the GNU linker for PowerPC/64. It is planned to add this feature
25089 to the GNU linker for 32-bit PowerPC systems as well.
25090
25091 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
25092 GCC can generate long calls using an inline PLT call sequence (see
25093 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
25094 ELFv1 (big-endian) do not support inline PLT calls.
25095
25096 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25097 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25098 addresses represent the callee and the branch island. The
25099 Darwin/PPC linker prefers the first address and generates a @code{bl
25100 callee} if the PPC @code{bl} instruction reaches the callee directly;
25101 otherwise, the linker generates @code{bl L42} to call the branch
25102 island. The branch island is appended to the body of the
25103 calling function; it computes the full 32-bit address of the callee
25104 and jumps to it.
25105
25106 On Mach-O (Darwin) systems, this option directs the compiler emit to
25107 the glue for every direct call, and the Darwin linker decides whether
25108 to use or discard it.
25109
25110 In the future, GCC may ignore all longcall specifications
25111 when the linker is known to generate glue.
25112
25113 @item -mpltseq
25114 @itemx -mno-pltseq
25115 @opindex mpltseq
25116 @opindex mno-pltseq
25117 Implement (do not implement) -fno-plt and long calls using an inline
25118 PLT call sequence that supports lazy linking and long calls to
25119 functions in dlopen'd shared libraries. Inline PLT calls are only
25120 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25121 linkers, and are enabled by default if the support is detected when
25122 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25123 configured with @option{--enable-secureplt}. @option{-mpltseq} code
25124 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25125 linked together.
25126
25127 @item -mtls-markers
25128 @itemx -mno-tls-markers
25129 @opindex mtls-markers
25130 @opindex mno-tls-markers
25131 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25132 specifying the function argument. The relocation allows the linker to
25133 reliably associate function call with argument setup instructions for
25134 TLS optimization, which in turn allows GCC to better schedule the
25135 sequence.
25136
25137 @item -mrecip
25138 @itemx -mno-recip
25139 @opindex mrecip
25140 This option enables use of the reciprocal estimate and
25141 reciprocal square root estimate instructions with additional
25142 Newton-Raphson steps to increase precision instead of doing a divide or
25143 square root and divide for floating-point arguments. You should use
25144 the @option{-ffast-math} option when using @option{-mrecip} (or at
25145 least @option{-funsafe-math-optimizations},
25146 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25147 @option{-fno-trapping-math}). Note that while the throughput of the
25148 sequence is generally higher than the throughput of the non-reciprocal
25149 instruction, the precision of the sequence can be decreased by up to 2
25150 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25151 roots.
25152
25153 @item -mrecip=@var{opt}
25154 @opindex mrecip=opt
25155 This option controls which reciprocal estimate instructions
25156 may be used. @var{opt} is a comma-separated list of options, which may
25157 be preceded by a @code{!} to invert the option:
25158
25159 @table @samp
25160
25161 @item all
25162 Enable all estimate instructions.
25163
25164 @item default
25165 Enable the default instructions, equivalent to @option{-mrecip}.
25166
25167 @item none
25168 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25169
25170 @item div
25171 Enable the reciprocal approximation instructions for both
25172 single and double precision.
25173
25174 @item divf
25175 Enable the single-precision reciprocal approximation instructions.
25176
25177 @item divd
25178 Enable the double-precision reciprocal approximation instructions.
25179
25180 @item rsqrt
25181 Enable the reciprocal square root approximation instructions for both
25182 single and double precision.
25183
25184 @item rsqrtf
25185 Enable the single-precision reciprocal square root approximation instructions.
25186
25187 @item rsqrtd
25188 Enable the double-precision reciprocal square root approximation instructions.
25189
25190 @end table
25191
25192 So, for example, @option{-mrecip=all,!rsqrtd} enables
25193 all of the reciprocal estimate instructions, except for the
25194 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25195 which handle the double-precision reciprocal square root calculations.
25196
25197 @item -mrecip-precision
25198 @itemx -mno-recip-precision
25199 @opindex mrecip-precision
25200 Assume (do not assume) that the reciprocal estimate instructions
25201 provide higher-precision estimates than is mandated by the PowerPC
25202 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25203 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25204 The double-precision square root estimate instructions are not generated by
25205 default on low-precision machines, since they do not provide an
25206 estimate that converges after three steps.
25207
25208 @item -mveclibabi=@var{type}
25209 @opindex mveclibabi
25210 Specifies the ABI type to use for vectorizing intrinsics using an
25211 external library. The only type supported at present is @samp{mass},
25212 which specifies to use IBM's Mathematical Acceleration Subsystem
25213 (MASS) libraries for vectorizing intrinsics using external libraries.
25214 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25215 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25216 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25217 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25218 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25219 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25220 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25221 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25222 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25223 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25224 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25225 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25226 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25227 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25228 for power7. Both @option{-ftree-vectorize} and
25229 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25230 libraries must be specified at link time.
25231
25232 @item -mfriz
25233 @itemx -mno-friz
25234 @opindex mfriz
25235 Generate (do not generate) the @code{friz} instruction when the
25236 @option{-funsafe-math-optimizations} option is used to optimize
25237 rounding of floating-point values to 64-bit integer and back to floating
25238 point. The @code{friz} instruction does not return the same value if
25239 the floating-point number is too large to fit in an integer.
25240
25241 @item -mpointers-to-nested-functions
25242 @itemx -mno-pointers-to-nested-functions
25243 @opindex mpointers-to-nested-functions
25244 Generate (do not generate) code to load up the static chain register
25245 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25246 systems where a function pointer points to a 3-word descriptor giving
25247 the function address, TOC value to be loaded in register @code{r2}, and
25248 static chain value to be loaded in register @code{r11}. The
25249 @option{-mpointers-to-nested-functions} is on by default. You cannot
25250 call through pointers to nested functions or pointers
25251 to functions compiled in other languages that use the static chain if
25252 you use @option{-mno-pointers-to-nested-functions}.
25253
25254 @item -msave-toc-indirect
25255 @itemx -mno-save-toc-indirect
25256 @opindex msave-toc-indirect
25257 Generate (do not generate) code to save the TOC value in the reserved
25258 stack location in the function prologue if the function calls through
25259 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25260 saved in the prologue, it is saved just before the call through the
25261 pointer. The @option{-mno-save-toc-indirect} option is the default.
25262
25263 @item -mcompat-align-parm
25264 @itemx -mno-compat-align-parm
25265 @opindex mcompat-align-parm
25266 Generate (do not generate) code to pass structure parameters with a
25267 maximum alignment of 64 bits, for compatibility with older versions
25268 of GCC.
25269
25270 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25271 structure parameter on a 128-bit boundary when that structure contained
25272 a member requiring 128-bit alignment. This is corrected in more
25273 recent versions of GCC. This option may be used to generate code
25274 that is compatible with functions compiled with older versions of
25275 GCC.
25276
25277 The @option{-mno-compat-align-parm} option is the default.
25278
25279 @item -mstack-protector-guard=@var{guard}
25280 @itemx -mstack-protector-guard-reg=@var{reg}
25281 @itemx -mstack-protector-guard-offset=@var{offset}
25282 @itemx -mstack-protector-guard-symbol=@var{symbol}
25283 @opindex mstack-protector-guard
25284 @opindex mstack-protector-guard-reg
25285 @opindex mstack-protector-guard-offset
25286 @opindex mstack-protector-guard-symbol
25287 Generate stack protection code using canary at @var{guard}. Supported
25288 locations are @samp{global} for global canary or @samp{tls} for per-thread
25289 canary in the TLS block (the default with GNU libc version 2.4 or later).
25290
25291 With the latter choice the options
25292 @option{-mstack-protector-guard-reg=@var{reg}} and
25293 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25294 which register to use as base register for reading the canary, and from what
25295 offset from that base register. The default for those is as specified in the
25296 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25297 the offset with a symbol reference to a canary in the TLS block.
25298
25299 @item -mpcrel
25300 @itemx -mno-pcrel
25301 @opindex mpcrel
25302 @opindex mno-pcrel
25303 Generate (do not generate) pc-relative addressing when the option
25304 @option{-mcpu=future} is used.
25305 @end table
25306
25307 @node RX Options
25308 @subsection RX Options
25309 @cindex RX Options
25310
25311 These command-line options are defined for RX targets:
25312
25313 @table @gcctabopt
25314 @item -m64bit-doubles
25315 @itemx -m32bit-doubles
25316 @opindex m64bit-doubles
25317 @opindex m32bit-doubles
25318 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25319 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25320 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25321 works on 32-bit values, which is why the default is
25322 @option{-m32bit-doubles}.
25323
25324 @item -fpu
25325 @itemx -nofpu
25326 @opindex fpu
25327 @opindex nofpu
25328 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25329 floating-point hardware. The default is enabled for the RX600
25330 series and disabled for the RX200 series.
25331
25332 Floating-point instructions are only generated for 32-bit floating-point
25333 values, however, so the FPU hardware is not used for doubles if the
25334 @option{-m64bit-doubles} option is used.
25335
25336 @emph{Note} If the @option{-fpu} option is enabled then
25337 @option{-funsafe-math-optimizations} is also enabled automatically.
25338 This is because the RX FPU instructions are themselves unsafe.
25339
25340 @item -mcpu=@var{name}
25341 @opindex mcpu
25342 Selects the type of RX CPU to be targeted. Currently three types are
25343 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25344 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25345
25346 The only difference between @samp{RX600} and @samp{RX610} is that the
25347 @samp{RX610} does not support the @code{MVTIPL} instruction.
25348
25349 The @samp{RX200} series does not have a hardware floating-point unit
25350 and so @option{-nofpu} is enabled by default when this type is
25351 selected.
25352
25353 @item -mbig-endian-data
25354 @itemx -mlittle-endian-data
25355 @opindex mbig-endian-data
25356 @opindex mlittle-endian-data
25357 Store data (but not code) in the big-endian format. The default is
25358 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25359 format.
25360
25361 @item -msmall-data-limit=@var{N}
25362 @opindex msmall-data-limit
25363 Specifies the maximum size in bytes of global and static variables
25364 which can be placed into the small data area. Using the small data
25365 area can lead to smaller and faster code, but the size of area is
25366 limited and it is up to the programmer to ensure that the area does
25367 not overflow. Also when the small data area is used one of the RX's
25368 registers (usually @code{r13}) is reserved for use pointing to this
25369 area, so it is no longer available for use by the compiler. This
25370 could result in slower and/or larger code if variables are pushed onto
25371 the stack instead of being held in this register.
25372
25373 Note, common variables (variables that have not been initialized) and
25374 constants are not placed into the small data area as they are assigned
25375 to other sections in the output executable.
25376
25377 The default value is zero, which disables this feature. Note, this
25378 feature is not enabled by default with higher optimization levels
25379 (@option{-O2} etc) because of the potentially detrimental effects of
25380 reserving a register. It is up to the programmer to experiment and
25381 discover whether this feature is of benefit to their program. See the
25382 description of the @option{-mpid} option for a description of how the
25383 actual register to hold the small data area pointer is chosen.
25384
25385 @item -msim
25386 @itemx -mno-sim
25387 @opindex msim
25388 @opindex mno-sim
25389 Use the simulator runtime. The default is to use the libgloss
25390 board-specific runtime.
25391
25392 @item -mas100-syntax
25393 @itemx -mno-as100-syntax
25394 @opindex mas100-syntax
25395 @opindex mno-as100-syntax
25396 When generating assembler output use a syntax that is compatible with
25397 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25398 assembler, but it has some restrictions so it is not generated by default.
25399
25400 @item -mmax-constant-size=@var{N}
25401 @opindex mmax-constant-size
25402 Specifies the maximum size, in bytes, of a constant that can be used as
25403 an operand in a RX instruction. Although the RX instruction set does
25404 allow constants of up to 4 bytes in length to be used in instructions,
25405 a longer value equates to a longer instruction. Thus in some
25406 circumstances it can be beneficial to restrict the size of constants
25407 that are used in instructions. Constants that are too big are instead
25408 placed into a constant pool and referenced via register indirection.
25409
25410 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25411 or 4 means that constants of any size are allowed.
25412
25413 @item -mrelax
25414 @opindex mrelax
25415 Enable linker relaxation. Linker relaxation is a process whereby the
25416 linker attempts to reduce the size of a program by finding shorter
25417 versions of various instructions. Disabled by default.
25418
25419 @item -mint-register=@var{N}
25420 @opindex mint-register
25421 Specify the number of registers to reserve for fast interrupt handler
25422 functions. The value @var{N} can be between 0 and 4. A value of 1
25423 means that register @code{r13} is reserved for the exclusive use
25424 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25425 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25426 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25427 A value of 0, the default, does not reserve any registers.
25428
25429 @item -msave-acc-in-interrupts
25430 @opindex msave-acc-in-interrupts
25431 Specifies that interrupt handler functions should preserve the
25432 accumulator register. This is only necessary if normal code might use
25433 the accumulator register, for example because it performs 64-bit
25434 multiplications. The default is to ignore the accumulator as this
25435 makes the interrupt handlers faster.
25436
25437 @item -mpid
25438 @itemx -mno-pid
25439 @opindex mpid
25440 @opindex mno-pid
25441 Enables the generation of position independent data. When enabled any
25442 access to constant data is done via an offset from a base address
25443 held in a register. This allows the location of constant data to be
25444 determined at run time without requiring the executable to be
25445 relocated, which is a benefit to embedded applications with tight
25446 memory constraints. Data that can be modified is not affected by this
25447 option.
25448
25449 Note, using this feature reserves a register, usually @code{r13}, for
25450 the constant data base address. This can result in slower and/or
25451 larger code, especially in complicated functions.
25452
25453 The actual register chosen to hold the constant data base address
25454 depends upon whether the @option{-msmall-data-limit} and/or the
25455 @option{-mint-register} command-line options are enabled. Starting
25456 with register @code{r13} and proceeding downwards, registers are
25457 allocated first to satisfy the requirements of @option{-mint-register},
25458 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25459 is possible for the small data area register to be @code{r8} if both
25460 @option{-mint-register=4} and @option{-mpid} are specified on the
25461 command line.
25462
25463 By default this feature is not enabled. The default can be restored
25464 via the @option{-mno-pid} command-line option.
25465
25466 @item -mno-warn-multiple-fast-interrupts
25467 @itemx -mwarn-multiple-fast-interrupts
25468 @opindex mno-warn-multiple-fast-interrupts
25469 @opindex mwarn-multiple-fast-interrupts
25470 Prevents GCC from issuing a warning message if it finds more than one
25471 fast interrupt handler when it is compiling a file. The default is to
25472 issue a warning for each extra fast interrupt handler found, as the RX
25473 only supports one such interrupt.
25474
25475 @item -mallow-string-insns
25476 @itemx -mno-allow-string-insns
25477 @opindex mallow-string-insns
25478 @opindex mno-allow-string-insns
25479 Enables or disables the use of the string manipulation instructions
25480 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25481 @code{SWHILE} and also the @code{RMPA} instruction. These
25482 instructions may prefetch data, which is not safe to do if accessing
25483 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25484 for more information).
25485
25486 The default is to allow these instructions, but it is not possible for
25487 GCC to reliably detect all circumstances where a string instruction
25488 might be used to access an I/O register, so their use cannot be
25489 disabled automatically. Instead it is reliant upon the programmer to
25490 use the @option{-mno-allow-string-insns} option if their program
25491 accesses I/O space.
25492
25493 When the instructions are enabled GCC defines the C preprocessor
25494 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25495 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25496
25497 @item -mjsr
25498 @itemx -mno-jsr
25499 @opindex mjsr
25500 @opindex mno-jsr
25501 Use only (or not only) @code{JSR} instructions to access functions.
25502 This option can be used when code size exceeds the range of @code{BSR}
25503 instructions. Note that @option{-mno-jsr} does not mean to not use
25504 @code{JSR} but instead means that any type of branch may be used.
25505 @end table
25506
25507 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25508 has special significance to the RX port when used with the
25509 @code{interrupt} function attribute. This attribute indicates a
25510 function intended to process fast interrupts. GCC ensures
25511 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25512 and/or @code{r13} and only provided that the normal use of the
25513 corresponding registers have been restricted via the
25514 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25515 options.
25516
25517 @node S/390 and zSeries Options
25518 @subsection S/390 and zSeries Options
25519 @cindex S/390 and zSeries Options
25520
25521 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25522
25523 @table @gcctabopt
25524 @item -mhard-float
25525 @itemx -msoft-float
25526 @opindex mhard-float
25527 @opindex msoft-float
25528 Use (do not use) the hardware floating-point instructions and registers
25529 for floating-point operations. When @option{-msoft-float} is specified,
25530 functions in @file{libgcc.a} are used to perform floating-point
25531 operations. When @option{-mhard-float} is specified, the compiler
25532 generates IEEE floating-point instructions. This is the default.
25533
25534 @item -mhard-dfp
25535 @itemx -mno-hard-dfp
25536 @opindex mhard-dfp
25537 @opindex mno-hard-dfp
25538 Use (do not use) the hardware decimal-floating-point instructions for
25539 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25540 specified, functions in @file{libgcc.a} are used to perform
25541 decimal-floating-point operations. When @option{-mhard-dfp} is
25542 specified, the compiler generates decimal-floating-point hardware
25543 instructions. This is the default for @option{-march=z9-ec} or higher.
25544
25545 @item -mlong-double-64
25546 @itemx -mlong-double-128
25547 @opindex mlong-double-64
25548 @opindex mlong-double-128
25549 These switches control the size of @code{long double} type. A size
25550 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25551 type. This is the default.
25552
25553 @item -mbackchain
25554 @itemx -mno-backchain
25555 @opindex mbackchain
25556 @opindex mno-backchain
25557 Store (do not store) the address of the caller's frame as backchain pointer
25558 into the callee's stack frame.
25559 A backchain may be needed to allow debugging using tools that do not understand
25560 DWARF call frame information.
25561 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25562 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25563 the backchain is placed into the topmost word of the 96/160 byte register
25564 save area.
25565
25566 In general, code compiled with @option{-mbackchain} is call-compatible with
25567 code compiled with @option{-mmo-backchain}; however, use of the backchain
25568 for debugging purposes usually requires that the whole binary is built with
25569 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25570 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25571 to build a linux kernel use @option{-msoft-float}.
25572
25573 The default is to not maintain the backchain.
25574
25575 @item -mpacked-stack
25576 @itemx -mno-packed-stack
25577 @opindex mpacked-stack
25578 @opindex mno-packed-stack
25579 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25580 specified, the compiler uses the all fields of the 96/160 byte register save
25581 area only for their default purpose; unused fields still take up stack space.
25582 When @option{-mpacked-stack} is specified, register save slots are densely
25583 packed at the top of the register save area; unused space is reused for other
25584 purposes, allowing for more efficient use of the available stack space.
25585 However, when @option{-mbackchain} is also in effect, the topmost word of
25586 the save area is always used to store the backchain, and the return address
25587 register is always saved two words below the backchain.
25588
25589 As long as the stack frame backchain is not used, code generated with
25590 @option{-mpacked-stack} is call-compatible with code generated with
25591 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25592 S/390 or zSeries generated code that uses the stack frame backchain at run
25593 time, not just for debugging purposes. Such code is not call-compatible
25594 with code compiled with @option{-mpacked-stack}. Also, note that the
25595 combination of @option{-mbackchain},
25596 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25597 to build a linux kernel use @option{-msoft-float}.
25598
25599 The default is to not use the packed stack layout.
25600
25601 @item -msmall-exec
25602 @itemx -mno-small-exec
25603 @opindex msmall-exec
25604 @opindex mno-small-exec
25605 Generate (or do not generate) code using the @code{bras} instruction
25606 to do subroutine calls.
25607 This only works reliably if the total executable size does not
25608 exceed 64k. The default is to use the @code{basr} instruction instead,
25609 which does not have this limitation.
25610
25611 @item -m64
25612 @itemx -m31
25613 @opindex m64
25614 @opindex m31
25615 When @option{-m31} is specified, generate code compliant to the
25616 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25617 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25618 particular to generate 64-bit instructions. For the @samp{s390}
25619 targets, the default is @option{-m31}, while the @samp{s390x}
25620 targets default to @option{-m64}.
25621
25622 @item -mzarch
25623 @itemx -mesa
25624 @opindex mzarch
25625 @opindex mesa
25626 When @option{-mzarch} is specified, generate code using the
25627 instructions available on z/Architecture.
25628 When @option{-mesa} is specified, generate code using the
25629 instructions available on ESA/390. Note that @option{-mesa} is
25630 not possible with @option{-m64}.
25631 When generating code compliant to the GNU/Linux for S/390 ABI,
25632 the default is @option{-mesa}. When generating code compliant
25633 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25634
25635 @item -mhtm
25636 @itemx -mno-htm
25637 @opindex mhtm
25638 @opindex mno-htm
25639 The @option{-mhtm} option enables a set of builtins making use of
25640 instructions available with the transactional execution facility
25641 introduced with the IBM zEnterprise EC12 machine generation
25642 @ref{S/390 System z Built-in Functions}.
25643 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25644
25645 @item -mvx
25646 @itemx -mno-vx
25647 @opindex mvx
25648 @opindex mno-vx
25649 When @option{-mvx} is specified, generate code using the instructions
25650 available with the vector extension facility introduced with the IBM
25651 z13 machine generation.
25652 This option changes the ABI for some vector type values with regard to
25653 alignment and calling conventions. In case vector type values are
25654 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25655 command will be added to mark the resulting binary with the ABI used.
25656 @option{-mvx} is enabled by default when using @option{-march=z13}.
25657
25658 @item -mzvector
25659 @itemx -mno-zvector
25660 @opindex mzvector
25661 @opindex mno-zvector
25662 The @option{-mzvector} option enables vector language extensions and
25663 builtins using instructions available with the vector extension
25664 facility introduced with the IBM z13 machine generation.
25665 This option adds support for @samp{vector} to be used as a keyword to
25666 define vector type variables and arguments. @samp{vector} is only
25667 available when GNU extensions are enabled. It will not be expanded
25668 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25669 In addition to the GCC low-level builtins @option{-mzvector} enables
25670 a set of builtins added for compatibility with AltiVec-style
25671 implementations like Power and Cell. In order to make use of these
25672 builtins the header file @file{vecintrin.h} needs to be included.
25673 @option{-mzvector} is disabled by default.
25674
25675 @item -mmvcle
25676 @itemx -mno-mvcle
25677 @opindex mmvcle
25678 @opindex mno-mvcle
25679 Generate (or do not generate) code using the @code{mvcle} instruction
25680 to perform block moves. When @option{-mno-mvcle} is specified,
25681 use a @code{mvc} loop instead. This is the default unless optimizing for
25682 size.
25683
25684 @item -mdebug
25685 @itemx -mno-debug
25686 @opindex mdebug
25687 @opindex mno-debug
25688 Print (or do not print) additional debug information when compiling.
25689 The default is to not print debug information.
25690
25691 @item -march=@var{cpu-type}
25692 @opindex march
25693 Generate code that runs on @var{cpu-type}, which is the name of a
25694 system representing a certain processor type. Possible values for
25695 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25696 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25697 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25698 @samp{z14}/@samp{arch12}, and @samp{native}.
25699
25700 The default is @option{-march=z900}.
25701
25702 Specifying @samp{native} as cpu type can be used to select the best
25703 architecture option for the host processor.
25704 @option{-march=native} has no effect if GCC does not recognize the
25705 processor.
25706
25707 @item -mtune=@var{cpu-type}
25708 @opindex mtune
25709 Tune to @var{cpu-type} everything applicable about the generated code,
25710 except for the ABI and the set of available instructions.
25711 The list of @var{cpu-type} values is the same as for @option{-march}.
25712 The default is the value used for @option{-march}.
25713
25714 @item -mtpf-trace
25715 @itemx -mno-tpf-trace
25716 @opindex mtpf-trace
25717 @opindex mno-tpf-trace
25718 Generate code that adds (does not add) in TPF OS specific branches to trace
25719 routines in the operating system. This option is off by default, even
25720 when compiling for the TPF OS@.
25721
25722 @item -mfused-madd
25723 @itemx -mno-fused-madd
25724 @opindex mfused-madd
25725 @opindex mno-fused-madd
25726 Generate code that uses (does not use) the floating-point multiply and
25727 accumulate instructions. These instructions are generated by default if
25728 hardware floating point is used.
25729
25730 @item -mwarn-framesize=@var{framesize}
25731 @opindex mwarn-framesize
25732 Emit a warning if the current function exceeds the given frame size. Because
25733 this is a compile-time check it doesn't need to be a real problem when the program
25734 runs. It is intended to identify functions that most probably cause
25735 a stack overflow. It is useful to be used in an environment with limited stack
25736 size e.g.@: the linux kernel.
25737
25738 @item -mwarn-dynamicstack
25739 @opindex mwarn-dynamicstack
25740 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25741 arrays. This is generally a bad idea with a limited stack size.
25742
25743 @item -mstack-guard=@var{stack-guard}
25744 @itemx -mstack-size=@var{stack-size}
25745 @opindex mstack-guard
25746 @opindex mstack-size
25747 If these options are provided the S/390 back end emits additional instructions in
25748 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25749 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25750 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25751 the frame size of the compiled function is chosen.
25752 These options are intended to be used to help debugging stack overflow problems.
25753 The additionally emitted code causes only little overhead and hence can also be
25754 used in production-like systems without greater performance degradation. The given
25755 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25756 @var{stack-guard} without exceeding 64k.
25757 In order to be efficient the extra code makes the assumption that the stack starts
25758 at an address aligned to the value given by @var{stack-size}.
25759 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25760
25761 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25762 @opindex mhotpatch
25763 If the hotpatch option is enabled, a ``hot-patching'' function
25764 prologue is generated for all functions in the compilation unit.
25765 The funtion label is prepended with the given number of two-byte
25766 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25767 the label, 2 * @var{post-halfwords} bytes are appended, using the
25768 largest NOP like instructions the architecture allows (maximum
25769 1000000).
25770
25771 If both arguments are zero, hotpatching is disabled.
25772
25773 This option can be overridden for individual functions with the
25774 @code{hotpatch} attribute.
25775 @end table
25776
25777 @node Score Options
25778 @subsection Score Options
25779 @cindex Score Options
25780
25781 These options are defined for Score implementations:
25782
25783 @table @gcctabopt
25784 @item -meb
25785 @opindex meb
25786 Compile code for big-endian mode. This is the default.
25787
25788 @item -mel
25789 @opindex mel
25790 Compile code for little-endian mode.
25791
25792 @item -mnhwloop
25793 @opindex mnhwloop
25794 Disable generation of @code{bcnz} instructions.
25795
25796 @item -muls
25797 @opindex muls
25798 Enable generation of unaligned load and store instructions.
25799
25800 @item -mmac
25801 @opindex mmac
25802 Enable the use of multiply-accumulate instructions. Disabled by default.
25803
25804 @item -mscore5
25805 @opindex mscore5
25806 Specify the SCORE5 as the target architecture.
25807
25808 @item -mscore5u
25809 @opindex mscore5u
25810 Specify the SCORE5U of the target architecture.
25811
25812 @item -mscore7
25813 @opindex mscore7
25814 Specify the SCORE7 as the target architecture. This is the default.
25815
25816 @item -mscore7d
25817 @opindex mscore7d
25818 Specify the SCORE7D as the target architecture.
25819 @end table
25820
25821 @node SH Options
25822 @subsection SH Options
25823
25824 These @samp{-m} options are defined for the SH implementations:
25825
25826 @table @gcctabopt
25827 @item -m1
25828 @opindex m1
25829 Generate code for the SH1.
25830
25831 @item -m2
25832 @opindex m2
25833 Generate code for the SH2.
25834
25835 @item -m2e
25836 Generate code for the SH2e.
25837
25838 @item -m2a-nofpu
25839 @opindex m2a-nofpu
25840 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25841 that the floating-point unit is not used.
25842
25843 @item -m2a-single-only
25844 @opindex m2a-single-only
25845 Generate code for the SH2a-FPU, in such a way that no double-precision
25846 floating-point operations are used.
25847
25848 @item -m2a-single
25849 @opindex m2a-single
25850 Generate code for the SH2a-FPU assuming the floating-point unit is in
25851 single-precision mode by default.
25852
25853 @item -m2a
25854 @opindex m2a
25855 Generate code for the SH2a-FPU assuming the floating-point unit is in
25856 double-precision mode by default.
25857
25858 @item -m3
25859 @opindex m3
25860 Generate code for the SH3.
25861
25862 @item -m3e
25863 @opindex m3e
25864 Generate code for the SH3e.
25865
25866 @item -m4-nofpu
25867 @opindex m4-nofpu
25868 Generate code for the SH4 without a floating-point unit.
25869
25870 @item -m4-single-only
25871 @opindex m4-single-only
25872 Generate code for the SH4 with a floating-point unit that only
25873 supports single-precision arithmetic.
25874
25875 @item -m4-single
25876 @opindex m4-single
25877 Generate code for the SH4 assuming the floating-point unit is in
25878 single-precision mode by default.
25879
25880 @item -m4
25881 @opindex m4
25882 Generate code for the SH4.
25883
25884 @item -m4-100
25885 @opindex m4-100
25886 Generate code for SH4-100.
25887
25888 @item -m4-100-nofpu
25889 @opindex m4-100-nofpu
25890 Generate code for SH4-100 in such a way that the
25891 floating-point unit is not used.
25892
25893 @item -m4-100-single
25894 @opindex m4-100-single
25895 Generate code for SH4-100 assuming the floating-point unit is in
25896 single-precision mode by default.
25897
25898 @item -m4-100-single-only
25899 @opindex m4-100-single-only
25900 Generate code for SH4-100 in such a way that no double-precision
25901 floating-point operations are used.
25902
25903 @item -m4-200
25904 @opindex m4-200
25905 Generate code for SH4-200.
25906
25907 @item -m4-200-nofpu
25908 @opindex m4-200-nofpu
25909 Generate code for SH4-200 without in such a way that the
25910 floating-point unit is not used.
25911
25912 @item -m4-200-single
25913 @opindex m4-200-single
25914 Generate code for SH4-200 assuming the floating-point unit is in
25915 single-precision mode by default.
25916
25917 @item -m4-200-single-only
25918 @opindex m4-200-single-only
25919 Generate code for SH4-200 in such a way that no double-precision
25920 floating-point operations are used.
25921
25922 @item -m4-300
25923 @opindex m4-300
25924 Generate code for SH4-300.
25925
25926 @item -m4-300-nofpu
25927 @opindex m4-300-nofpu
25928 Generate code for SH4-300 without in such a way that the
25929 floating-point unit is not used.
25930
25931 @item -m4-300-single
25932 @opindex m4-300-single
25933 Generate code for SH4-300 in such a way that no double-precision
25934 floating-point operations are used.
25935
25936 @item -m4-300-single-only
25937 @opindex m4-300-single-only
25938 Generate code for SH4-300 in such a way that no double-precision
25939 floating-point operations are used.
25940
25941 @item -m4-340
25942 @opindex m4-340
25943 Generate code for SH4-340 (no MMU, no FPU).
25944
25945 @item -m4-500
25946 @opindex m4-500
25947 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25948 assembler.
25949
25950 @item -m4a-nofpu
25951 @opindex m4a-nofpu
25952 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25953 floating-point unit is not used.
25954
25955 @item -m4a-single-only
25956 @opindex m4a-single-only
25957 Generate code for the SH4a, in such a way that no double-precision
25958 floating-point operations are used.
25959
25960 @item -m4a-single
25961 @opindex m4a-single
25962 Generate code for the SH4a assuming the floating-point unit is in
25963 single-precision mode by default.
25964
25965 @item -m4a
25966 @opindex m4a
25967 Generate code for the SH4a.
25968
25969 @item -m4al
25970 @opindex m4al
25971 Same as @option{-m4a-nofpu}, except that it implicitly passes
25972 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25973 instructions at the moment.
25974
25975 @item -mb
25976 @opindex mb
25977 Compile code for the processor in big-endian mode.
25978
25979 @item -ml
25980 @opindex ml
25981 Compile code for the processor in little-endian mode.
25982
25983 @item -mdalign
25984 @opindex mdalign
25985 Align doubles at 64-bit boundaries. Note that this changes the calling
25986 conventions, and thus some functions from the standard C library do
25987 not work unless you recompile it first with @option{-mdalign}.
25988
25989 @item -mrelax
25990 @opindex mrelax
25991 Shorten some address references at link time, when possible; uses the
25992 linker option @option{-relax}.
25993
25994 @item -mbigtable
25995 @opindex mbigtable
25996 Use 32-bit offsets in @code{switch} tables. The default is to use
25997 16-bit offsets.
25998
25999 @item -mbitops
26000 @opindex mbitops
26001 Enable the use of bit manipulation instructions on SH2A.
26002
26003 @item -mfmovd
26004 @opindex mfmovd
26005 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
26006 alignment constraints.
26007
26008 @item -mrenesas
26009 @opindex mrenesas
26010 Comply with the calling conventions defined by Renesas.
26011
26012 @item -mno-renesas
26013 @opindex mno-renesas
26014 Comply with the calling conventions defined for GCC before the Renesas
26015 conventions were available. This option is the default for all
26016 targets of the SH toolchain.
26017
26018 @item -mnomacsave
26019 @opindex mnomacsave
26020 Mark the @code{MAC} register as call-clobbered, even if
26021 @option{-mrenesas} is given.
26022
26023 @item -mieee
26024 @itemx -mno-ieee
26025 @opindex mieee
26026 @opindex mno-ieee
26027 Control the IEEE compliance of floating-point comparisons, which affects the
26028 handling of cases where the result of a comparison is unordered. By default
26029 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
26030 enabled @option{-mno-ieee} is implicitly set, which results in faster
26031 floating-point greater-equal and less-equal comparisons. The implicit settings
26032 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
26033
26034 @item -minline-ic_invalidate
26035 @opindex minline-ic_invalidate
26036 Inline code to invalidate instruction cache entries after setting up
26037 nested function trampolines.
26038 This option has no effect if @option{-musermode} is in effect and the selected
26039 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26040 instruction.
26041 If the selected code generation option does not allow the use of the @code{icbi}
26042 instruction, and @option{-musermode} is not in effect, the inlined code
26043 manipulates the instruction cache address array directly with an associative
26044 write. This not only requires privileged mode at run time, but it also
26045 fails if the cache line had been mapped via the TLB and has become unmapped.
26046
26047 @item -misize
26048 @opindex misize
26049 Dump instruction size and location in the assembly code.
26050
26051 @item -mpadstruct
26052 @opindex mpadstruct
26053 This option is deprecated. It pads structures to multiple of 4 bytes,
26054 which is incompatible with the SH ABI@.
26055
26056 @item -matomic-model=@var{model}
26057 @opindex matomic-model=@var{model}
26058 Sets the model of atomic operations and additional parameters as a comma
26059 separated list. For details on the atomic built-in functions see
26060 @ref{__atomic Builtins}. The following models and parameters are supported:
26061
26062 @table @samp
26063
26064 @item none
26065 Disable compiler generated atomic sequences and emit library calls for atomic
26066 operations. This is the default if the target is not @code{sh*-*-linux*}.
26067
26068 @item soft-gusa
26069 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26070 built-in functions. The generated atomic sequences require additional support
26071 from the interrupt/exception handling code of the system and are only suitable
26072 for SH3* and SH4* single-core systems. This option is enabled by default when
26073 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26074 this option also partially utilizes the hardware atomic instructions
26075 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26076 @samp{strict} is specified.
26077
26078 @item soft-tcb
26079 Generate software atomic sequences that use a variable in the thread control
26080 block. This is a variation of the gUSA sequences which can also be used on
26081 SH1* and SH2* targets. The generated atomic sequences require additional
26082 support from the interrupt/exception handling code of the system and are only
26083 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26084 parameter has to be specified as well.
26085
26086 @item soft-imask
26087 Generate software atomic sequences that temporarily disable interrupts by
26088 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26089 in privileged mode and is only suitable for single-core systems. Additional
26090 support from the interrupt/exception handling code of the system is not
26091 required. This model is enabled by default when the target is
26092 @code{sh*-*-linux*} and SH1* or SH2*.
26093
26094 @item hard-llcs
26095 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26096 instructions only. This is only available on SH4A and is suitable for
26097 multi-core systems. Since the hardware instructions support only 32 bit atomic
26098 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26099 Code compiled with this option is also compatible with other software
26100 atomic model interrupt/exception handling systems if executed on an SH4A
26101 system. Additional support from the interrupt/exception handling code of the
26102 system is not required for this model.
26103
26104 @item gbr-offset=
26105 This parameter specifies the offset in bytes of the variable in the thread
26106 control block structure that should be used by the generated atomic sequences
26107 when the @samp{soft-tcb} model has been selected. For other models this
26108 parameter is ignored. The specified value must be an integer multiple of four
26109 and in the range 0-1020.
26110
26111 @item strict
26112 This parameter prevents mixed usage of multiple atomic models, even if they
26113 are compatible, and makes the compiler generate atomic sequences of the
26114 specified model only.
26115
26116 @end table
26117
26118 @item -mtas
26119 @opindex mtas
26120 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26121 Notice that depending on the particular hardware and software configuration
26122 this can degrade overall performance due to the operand cache line flushes
26123 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26124 processors the @code{tas.b} instruction must be used with caution since it
26125 can result in data corruption for certain cache configurations.
26126
26127 @item -mprefergot
26128 @opindex mprefergot
26129 When generating position-independent code, emit function calls using
26130 the Global Offset Table instead of the Procedure Linkage Table.
26131
26132 @item -musermode
26133 @itemx -mno-usermode
26134 @opindex musermode
26135 @opindex mno-usermode
26136 Don't allow (allow) the compiler generating privileged mode code. Specifying
26137 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26138 inlined code would not work in user mode. @option{-musermode} is the default
26139 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26140 @option{-musermode} has no effect, since there is no user mode.
26141
26142 @item -multcost=@var{number}
26143 @opindex multcost=@var{number}
26144 Set the cost to assume for a multiply insn.
26145
26146 @item -mdiv=@var{strategy}
26147 @opindex mdiv=@var{strategy}
26148 Set the division strategy to be used for integer division operations.
26149 @var{strategy} can be one of:
26150
26151 @table @samp
26152
26153 @item call-div1
26154 Calls a library function that uses the single-step division instruction
26155 @code{div1} to perform the operation. Division by zero calculates an
26156 unspecified result and does not trap. This is the default except for SH4,
26157 SH2A and SHcompact.
26158
26159 @item call-fp
26160 Calls a library function that performs the operation in double precision
26161 floating point. Division by zero causes a floating-point exception. This is
26162 the default for SHcompact with FPU. Specifying this for targets that do not
26163 have a double precision FPU defaults to @code{call-div1}.
26164
26165 @item call-table
26166 Calls a library function that uses a lookup table for small divisors and
26167 the @code{div1} instruction with case distinction for larger divisors. Division
26168 by zero calculates an unspecified result and does not trap. This is the default
26169 for SH4. Specifying this for targets that do not have dynamic shift
26170 instructions defaults to @code{call-div1}.
26171
26172 @end table
26173
26174 When a division strategy has not been specified the default strategy is
26175 selected based on the current target. For SH2A the default strategy is to
26176 use the @code{divs} and @code{divu} instructions instead of library function
26177 calls.
26178
26179 @item -maccumulate-outgoing-args
26180 @opindex maccumulate-outgoing-args
26181 Reserve space once for outgoing arguments in the function prologue rather
26182 than around each call. Generally beneficial for performance and size. Also
26183 needed for unwinding to avoid changing the stack frame around conditional code.
26184
26185 @item -mdivsi3_libfunc=@var{name}
26186 @opindex mdivsi3_libfunc=@var{name}
26187 Set the name of the library function used for 32-bit signed division to
26188 @var{name}.
26189 This only affects the name used in the @samp{call} division strategies, and
26190 the compiler still expects the same sets of input/output/clobbered registers as
26191 if this option were not present.
26192
26193 @item -mfixed-range=@var{register-range}
26194 @opindex mfixed-range
26195 Generate code treating the given register range as fixed registers.
26196 A fixed register is one that the register allocator cannot use. This is
26197 useful when compiling kernel code. A register range is specified as
26198 two registers separated by a dash. Multiple register ranges can be
26199 specified separated by a comma.
26200
26201 @item -mbranch-cost=@var{num}
26202 @opindex mbranch-cost=@var{num}
26203 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26204 make the compiler try to generate more branch-free code if possible.
26205 If not specified the value is selected depending on the processor type that
26206 is being compiled for.
26207
26208 @item -mzdcbranch
26209 @itemx -mno-zdcbranch
26210 @opindex mzdcbranch
26211 @opindex mno-zdcbranch
26212 Assume (do not assume) that zero displacement conditional branch instructions
26213 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26214 compiler prefers zero displacement branch code sequences. This is
26215 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26216 disabled by specifying @option{-mno-zdcbranch}.
26217
26218 @item -mcbranch-force-delay-slot
26219 @opindex mcbranch-force-delay-slot
26220 Force the usage of delay slots for conditional branches, which stuffs the delay
26221 slot with a @code{nop} if a suitable instruction cannot be found. By default
26222 this option is disabled. It can be enabled to work around hardware bugs as
26223 found in the original SH7055.
26224
26225 @item -mfused-madd
26226 @itemx -mno-fused-madd
26227 @opindex mfused-madd
26228 @opindex mno-fused-madd
26229 Generate code that uses (does not use) the floating-point multiply and
26230 accumulate instructions. These instructions are generated by default
26231 if hardware floating point is used. The machine-dependent
26232 @option{-mfused-madd} option is now mapped to the machine-independent
26233 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26234 mapped to @option{-ffp-contract=off}.
26235
26236 @item -mfsca
26237 @itemx -mno-fsca
26238 @opindex mfsca
26239 @opindex mno-fsca
26240 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26241 and cosine approximations. The option @option{-mfsca} must be used in
26242 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26243 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26244 approximations even if @option{-funsafe-math-optimizations} is in effect.
26245
26246 @item -mfsrra
26247 @itemx -mno-fsrra
26248 @opindex mfsrra
26249 @opindex mno-fsrra
26250 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26251 reciprocal square root approximations. The option @option{-mfsrra} must be used
26252 in combination with @option{-funsafe-math-optimizations} and
26253 @option{-ffinite-math-only}. It is enabled by default when generating code for
26254 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26255 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26256 in effect.
26257
26258 @item -mpretend-cmove
26259 @opindex mpretend-cmove
26260 Prefer zero-displacement conditional branches for conditional move instruction
26261 patterns. This can result in faster code on the SH4 processor.
26262
26263 @item -mfdpic
26264 @opindex fdpic
26265 Generate code using the FDPIC ABI.
26266
26267 @end table
26268
26269 @node Solaris 2 Options
26270 @subsection Solaris 2 Options
26271 @cindex Solaris 2 options
26272
26273 These @samp{-m} options are supported on Solaris 2:
26274
26275 @table @gcctabopt
26276 @item -mclear-hwcap
26277 @opindex mclear-hwcap
26278 @option{-mclear-hwcap} tells the compiler to remove the hardware
26279 capabilities generated by the Solaris assembler. This is only necessary
26280 when object files use ISA extensions not supported by the current
26281 machine, but check at runtime whether or not to use them.
26282
26283 @item -mimpure-text
26284 @opindex mimpure-text
26285 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26286 the compiler to not pass @option{-z text} to the linker when linking a
26287 shared object. Using this option, you can link position-dependent
26288 code into a shared object.
26289
26290 @option{-mimpure-text} suppresses the ``relocations remain against
26291 allocatable but non-writable sections'' linker error message.
26292 However, the necessary relocations trigger copy-on-write, and the
26293 shared object is not actually shared across processes. Instead of
26294 using @option{-mimpure-text}, you should compile all source code with
26295 @option{-fpic} or @option{-fPIC}.
26296
26297 @end table
26298
26299 These switches are supported in addition to the above on Solaris 2:
26300
26301 @table @gcctabopt
26302 @item -pthreads
26303 @opindex pthreads
26304 This is a synonym for @option{-pthread}.
26305 @end table
26306
26307 @node SPARC Options
26308 @subsection SPARC Options
26309 @cindex SPARC options
26310
26311 These @samp{-m} options are supported on the SPARC:
26312
26313 @table @gcctabopt
26314 @item -mno-app-regs
26315 @itemx -mapp-regs
26316 @opindex mno-app-regs
26317 @opindex mapp-regs
26318 Specify @option{-mapp-regs} to generate output using the global registers
26319 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26320 global register 1, each global register 2 through 4 is then treated as an
26321 allocable register that is clobbered by function calls. This is the default.
26322
26323 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26324 specify @option{-mno-app-regs}. You should compile libraries and system
26325 software with this option.
26326
26327 @item -mflat
26328 @itemx -mno-flat
26329 @opindex mflat
26330 @opindex mno-flat
26331 With @option{-mflat}, the compiler does not generate save/restore instructions
26332 and uses a ``flat'' or single register window model. This model is compatible
26333 with the regular register window model. The local registers and the input
26334 registers (0--5) are still treated as ``call-saved'' registers and are
26335 saved on the stack as needed.
26336
26337 With @option{-mno-flat} (the default), the compiler generates save/restore
26338 instructions (except for leaf functions). This is the normal operating mode.
26339
26340 @item -mfpu
26341 @itemx -mhard-float
26342 @opindex mfpu
26343 @opindex mhard-float
26344 Generate output containing floating-point instructions. This is the
26345 default.
26346
26347 @item -mno-fpu
26348 @itemx -msoft-float
26349 @opindex mno-fpu
26350 @opindex msoft-float
26351 Generate output containing library calls for floating point.
26352 @strong{Warning:} the requisite libraries are not available for all SPARC
26353 targets. Normally the facilities of the machine's usual C compiler are
26354 used, but this cannot be done directly in cross-compilation. You must make
26355 your own arrangements to provide suitable library functions for
26356 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26357 @samp{sparclite-*-*} do provide software floating-point support.
26358
26359 @option{-msoft-float} changes the calling convention in the output file;
26360 therefore, it is only useful if you compile @emph{all} of a program with
26361 this option. In particular, you need to compile @file{libgcc.a}, the
26362 library that comes with GCC, with @option{-msoft-float} in order for
26363 this to work.
26364
26365 @item -mhard-quad-float
26366 @opindex mhard-quad-float
26367 Generate output containing quad-word (long double) floating-point
26368 instructions.
26369
26370 @item -msoft-quad-float
26371 @opindex msoft-quad-float
26372 Generate output containing library calls for quad-word (long double)
26373 floating-point instructions. The functions called are those specified
26374 in the SPARC ABI@. This is the default.
26375
26376 As of this writing, there are no SPARC implementations that have hardware
26377 support for the quad-word floating-point instructions. They all invoke
26378 a trap handler for one of these instructions, and then the trap handler
26379 emulates the effect of the instruction. Because of the trap handler overhead,
26380 this is much slower than calling the ABI library routines. Thus the
26381 @option{-msoft-quad-float} option is the default.
26382
26383 @item -mno-unaligned-doubles
26384 @itemx -munaligned-doubles
26385 @opindex mno-unaligned-doubles
26386 @opindex munaligned-doubles
26387 Assume that doubles have 8-byte alignment. This is the default.
26388
26389 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26390 alignment only if they are contained in another type, or if they have an
26391 absolute address. Otherwise, it assumes they have 4-byte alignment.
26392 Specifying this option avoids some rare compatibility problems with code
26393 generated by other compilers. It is not the default because it results
26394 in a performance loss, especially for floating-point code.
26395
26396 @item -muser-mode
26397 @itemx -mno-user-mode
26398 @opindex muser-mode
26399 @opindex mno-user-mode
26400 Do not generate code that can only run in supervisor mode. This is relevant
26401 only for the @code{casa} instruction emitted for the LEON3 processor. This
26402 is the default.
26403
26404 @item -mfaster-structs
26405 @itemx -mno-faster-structs
26406 @opindex mfaster-structs
26407 @opindex mno-faster-structs
26408 With @option{-mfaster-structs}, the compiler assumes that structures
26409 should have 8-byte alignment. This enables the use of pairs of
26410 @code{ldd} and @code{std} instructions for copies in structure
26411 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26412 However, the use of this changed alignment directly violates the SPARC
26413 ABI@. Thus, it's intended only for use on targets where the developer
26414 acknowledges that their resulting code is not directly in line with
26415 the rules of the ABI@.
26416
26417 @item -mstd-struct-return
26418 @itemx -mno-std-struct-return
26419 @opindex mstd-struct-return
26420 @opindex mno-std-struct-return
26421 With @option{-mstd-struct-return}, the compiler generates checking code
26422 in functions returning structures or unions to detect size mismatches
26423 between the two sides of function calls, as per the 32-bit ABI@.
26424
26425 The default is @option{-mno-std-struct-return}. This option has no effect
26426 in 64-bit mode.
26427
26428 @item -mlra
26429 @itemx -mno-lra
26430 @opindex mlra
26431 @opindex mno-lra
26432 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26433 so @option{-mno-lra} needs to be passed to get old Reload.
26434
26435 @item -mcpu=@var{cpu_type}
26436 @opindex mcpu
26437 Set the instruction set, register set, and instruction scheduling parameters
26438 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26439 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26440 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26441 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26442 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26443 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26444
26445 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26446 which selects the best architecture option for the host processor.
26447 @option{-mcpu=native} has no effect if GCC does not recognize
26448 the processor.
26449
26450 Default instruction scheduling parameters are used for values that select
26451 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26452 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26453
26454 Here is a list of each supported architecture and their supported
26455 implementations.
26456
26457 @table @asis
26458 @item v7
26459 cypress, leon3v7
26460
26461 @item v8
26462 supersparc, hypersparc, leon, leon3
26463
26464 @item sparclite
26465 f930, f934, sparclite86x
26466
26467 @item sparclet
26468 tsc701
26469
26470 @item v9
26471 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26472 niagara7, m8
26473 @end table
26474
26475 By default (unless configured otherwise), GCC generates code for the V7
26476 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26477 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26478 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26479 SPARCStation 1, 2, IPX etc.
26480
26481 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26482 architecture. The only difference from V7 code is that the compiler emits
26483 the integer multiply and integer divide instructions which exist in SPARC-V8
26484 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26485 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26486 2000 series.
26487
26488 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26489 the SPARC architecture. This adds the integer multiply, integer divide step
26490 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26491 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26492 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26493 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26494 MB86934 chip, which is the more recent SPARClite with FPU@.
26495
26496 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26497 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26498 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26499 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26500 optimizes it for the TEMIC SPARClet chip.
26501
26502 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26503 architecture. This adds 64-bit integer and floating-point move instructions,
26504 3 additional floating-point condition code registers and conditional move
26505 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26506 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26507 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26508 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26509 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26510 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26511 additionally optimizes it for Sun UltraSPARC T2 chips. With
26512 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26513 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26514 additionally optimizes it for Sun UltraSPARC T4 chips. With
26515 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26516 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26517 additionally optimizes it for Oracle M8 chips.
26518
26519 @item -mtune=@var{cpu_type}
26520 @opindex mtune
26521 Set the instruction scheduling parameters for machine type
26522 @var{cpu_type}, but do not set the instruction set or register set that the
26523 option @option{-mcpu=@var{cpu_type}} does.
26524
26525 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26526 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26527 that select a particular CPU implementation. Those are
26528 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26529 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26530 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26531 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26532 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26533 and GNU/Linux toolchains, @samp{native} can also be used.
26534
26535 @item -mv8plus
26536 @itemx -mno-v8plus
26537 @opindex mv8plus
26538 @opindex mno-v8plus
26539 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26540 difference from the V8 ABI is that the global and out registers are
26541 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26542 mode for all SPARC-V9 processors.
26543
26544 @item -mvis
26545 @itemx -mno-vis
26546 @opindex mvis
26547 @opindex mno-vis
26548 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26549 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26550
26551 @item -mvis2
26552 @itemx -mno-vis2
26553 @opindex mvis2
26554 @opindex mno-vis2
26555 With @option{-mvis2}, GCC generates code that takes advantage of
26556 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26557 default is @option{-mvis2} when targeting a cpu that supports such
26558 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26559 also sets @option{-mvis}.
26560
26561 @item -mvis3
26562 @itemx -mno-vis3
26563 @opindex mvis3
26564 @opindex mno-vis3
26565 With @option{-mvis3}, GCC generates code that takes advantage of
26566 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26567 default is @option{-mvis3} when targeting a cpu that supports such
26568 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26569 also sets @option{-mvis2} and @option{-mvis}.
26570
26571 @item -mvis4
26572 @itemx -mno-vis4
26573 @opindex mvis4
26574 @opindex mno-vis4
26575 With @option{-mvis4}, GCC generates code that takes advantage of
26576 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26577 default is @option{-mvis4} when targeting a cpu that supports such
26578 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26579 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26580
26581 @item -mvis4b
26582 @itemx -mno-vis4b
26583 @opindex mvis4b
26584 @opindex mno-vis4b
26585 With @option{-mvis4b}, GCC generates code that takes advantage of
26586 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26587 the additional VIS instructions introduced in the Oracle SPARC
26588 Architecture 2017. The default is @option{-mvis4b} when targeting a
26589 cpu that supports such instructions, such as m8 and later. Setting
26590 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26591 @option{-mvis2} and @option{-mvis}.
26592
26593 @item -mcbcond
26594 @itemx -mno-cbcond
26595 @opindex mcbcond
26596 @opindex mno-cbcond
26597 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26598 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26599 when targeting a CPU that supports such instructions, such as Niagara-4 and
26600 later.
26601
26602 @item -mfmaf
26603 @itemx -mno-fmaf
26604 @opindex mfmaf
26605 @opindex mno-fmaf
26606 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26607 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26608 when targeting a CPU that supports such instructions, such as Niagara-3 and
26609 later.
26610
26611 @item -mfsmuld
26612 @itemx -mno-fsmuld
26613 @opindex mfsmuld
26614 @opindex mno-fsmuld
26615 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26616 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26617 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26618 or V9 with FPU except @option{-mcpu=leon}.
26619
26620 @item -mpopc
26621 @itemx -mno-popc
26622 @opindex mpopc
26623 @opindex mno-popc
26624 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26625 Population Count instruction. The default is @option{-mpopc}
26626 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26627 later.
26628
26629 @item -msubxc
26630 @itemx -mno-subxc
26631 @opindex msubxc
26632 @opindex mno-subxc
26633 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26634 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26635 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26636 later.
26637
26638 @item -mfix-at697f
26639 @opindex mfix-at697f
26640 Enable the documented workaround for the single erratum of the Atmel AT697F
26641 processor (which corresponds to erratum #13 of the AT697E processor).
26642
26643 @item -mfix-ut699
26644 @opindex mfix-ut699
26645 Enable the documented workarounds for the floating-point errata and the data
26646 cache nullify errata of the UT699 processor.
26647
26648 @item -mfix-ut700
26649 @opindex mfix-ut700
26650 Enable the documented workaround for the back-to-back store errata of
26651 the UT699E/UT700 processor.
26652
26653 @item -mfix-gr712rc
26654 @opindex mfix-gr712rc
26655 Enable the documented workaround for the back-to-back store errata of
26656 the GR712RC processor.
26657 @end table
26658
26659 These @samp{-m} options are supported in addition to the above
26660 on SPARC-V9 processors in 64-bit environments:
26661
26662 @table @gcctabopt
26663 @item -m32
26664 @itemx -m64
26665 @opindex m32
26666 @opindex m64
26667 Generate code for a 32-bit or 64-bit environment.
26668 The 32-bit environment sets int, long and pointer to 32 bits.
26669 The 64-bit environment sets int to 32 bits and long and pointer
26670 to 64 bits.
26671
26672 @item -mcmodel=@var{which}
26673 @opindex mcmodel
26674 Set the code model to one of
26675
26676 @table @samp
26677 @item medlow
26678 The Medium/Low code model: 64-bit addresses, programs
26679 must be linked in the low 32 bits of memory. Programs can be statically
26680 or dynamically linked.
26681
26682 @item medmid
26683 The Medium/Middle code model: 64-bit addresses, programs
26684 must be linked in the low 44 bits of memory, the text and data segments must
26685 be less than 2GB in size and the data segment must be located within 2GB of
26686 the text segment.
26687
26688 @item medany
26689 The Medium/Anywhere code model: 64-bit addresses, programs
26690 may be linked anywhere in memory, the text and data segments must be less
26691 than 2GB in size and the data segment must be located within 2GB of the
26692 text segment.
26693
26694 @item embmedany
26695 The Medium/Anywhere code model for embedded systems:
26696 64-bit addresses, the text and data segments must be less than 2GB in
26697 size, both starting anywhere in memory (determined at link time). The
26698 global register %g4 points to the base of the data segment. Programs
26699 are statically linked and PIC is not supported.
26700 @end table
26701
26702 @item -mmemory-model=@var{mem-model}
26703 @opindex mmemory-model
26704 Set the memory model in force on the processor to one of
26705
26706 @table @samp
26707 @item default
26708 The default memory model for the processor and operating system.
26709
26710 @item rmo
26711 Relaxed Memory Order
26712
26713 @item pso
26714 Partial Store Order
26715
26716 @item tso
26717 Total Store Order
26718
26719 @item sc
26720 Sequential Consistency
26721 @end table
26722
26723 These memory models are formally defined in Appendix D of the SPARC-V9
26724 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26725
26726 @item -mstack-bias
26727 @itemx -mno-stack-bias
26728 @opindex mstack-bias
26729 @opindex mno-stack-bias
26730 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26731 frame pointer if present, are offset by @minus{}2047 which must be added back
26732 when making stack frame references. This is the default in 64-bit mode.
26733 Otherwise, assume no such offset is present.
26734 @end table
26735
26736 @node SPU Options
26737 @subsection SPU Options
26738 @cindex SPU options
26739
26740 These @samp{-m} options are supported on the SPU:
26741
26742 @table @gcctabopt
26743 @item -mwarn-reloc
26744 @itemx -merror-reloc
26745 @opindex mwarn-reloc
26746 @opindex merror-reloc
26747
26748 The loader for SPU does not handle dynamic relocations. By default, GCC
26749 gives an error when it generates code that requires a dynamic
26750 relocation. @option{-mno-error-reloc} disables the error,
26751 @option{-mwarn-reloc} generates a warning instead.
26752
26753 @item -msafe-dma
26754 @itemx -munsafe-dma
26755 @opindex msafe-dma
26756 @opindex munsafe-dma
26757
26758 Instructions that initiate or test completion of DMA must not be
26759 reordered with respect to loads and stores of the memory that is being
26760 accessed.
26761 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26762 memory accesses, but that can lead to inefficient code in places where the
26763 memory is known to not change. Rather than mark the memory as volatile,
26764 you can use @option{-msafe-dma} to tell the compiler to treat
26765 the DMA instructions as potentially affecting all memory.
26766
26767 @item -mbranch-hints
26768 @opindex mbranch-hints
26769
26770 By default, GCC generates a branch hint instruction to avoid
26771 pipeline stalls for always-taken or probably-taken branches. A hint
26772 is not generated closer than 8 instructions away from its branch.
26773 There is little reason to disable them, except for debugging purposes,
26774 or to make an object a little bit smaller.
26775
26776 @item -msmall-mem
26777 @itemx -mlarge-mem
26778 @opindex msmall-mem
26779 @opindex mlarge-mem
26780
26781 By default, GCC generates code assuming that addresses are never larger
26782 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
26783 a full 32-bit address.
26784
26785 @item -mstdmain
26786 @opindex mstdmain
26787
26788 By default, GCC links against startup code that assumes the SPU-style
26789 main function interface (which has an unconventional parameter list).
26790 With @option{-mstdmain}, GCC links your program against startup
26791 code that assumes a C99-style interface to @code{main}, including a
26792 local copy of @code{argv} strings.
26793
26794 @item -mfixed-range=@var{register-range}
26795 @opindex mfixed-range
26796 Generate code treating the given register range as fixed registers.
26797 A fixed register is one that the register allocator cannot use. This is
26798 useful when compiling kernel code. A register range is specified as
26799 two registers separated by a dash. Multiple register ranges can be
26800 specified separated by a comma.
26801
26802 @item -mea32
26803 @itemx -mea64
26804 @opindex mea32
26805 @opindex mea64
26806 Compile code assuming that pointers to the PPU address space accessed
26807 via the @code{__ea} named address space qualifier are either 32 or 64
26808 bits wide. The default is 32 bits. As this is an ABI-changing option,
26809 all object code in an executable must be compiled with the same setting.
26810
26811 @item -maddress-space-conversion
26812 @itemx -mno-address-space-conversion
26813 @opindex maddress-space-conversion
26814 @opindex mno-address-space-conversion
26815 Allow/disallow treating the @code{__ea} address space as superset
26816 of the generic address space. This enables explicit type casts
26817 between @code{__ea} and generic pointer as well as implicit
26818 conversions of generic pointers to @code{__ea} pointers. The
26819 default is to allow address space pointer conversions.
26820
26821 @item -mcache-size=@var{cache-size}
26822 @opindex mcache-size
26823 This option controls the version of libgcc that the compiler links to an
26824 executable and selects a software-managed cache for accessing variables
26825 in the @code{__ea} address space with a particular cache size. Possible
26826 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26827 and @samp{128}. The default cache size is 64KB.
26828
26829 @item -matomic-updates
26830 @itemx -mno-atomic-updates
26831 @opindex matomic-updates
26832 @opindex mno-atomic-updates
26833 This option controls the version of libgcc that the compiler links to an
26834 executable and selects whether atomic updates to the software-managed
26835 cache of PPU-side variables are used. If you use atomic updates, changes
26836 to a PPU variable from SPU code using the @code{__ea} named address space
26837 qualifier do not interfere with changes to other PPU variables residing
26838 in the same cache line from PPU code. If you do not use atomic updates,
26839 such interference may occur; however, writing back cache lines is
26840 more efficient. The default behavior is to use atomic updates.
26841
26842 @item -mdual-nops
26843 @itemx -mdual-nops=@var{n}
26844 @opindex mdual-nops
26845 By default, GCC inserts NOPs to increase dual issue when it expects
26846 it to increase performance. @var{n} can be a value from 0 to 10. A
26847 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26848 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26849
26850 @item -mhint-max-nops=@var{n}
26851 @opindex mhint-max-nops
26852 Maximum number of NOPs to insert for a branch hint. A branch hint must
26853 be at least 8 instructions away from the branch it is affecting. GCC
26854 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26855 generate the branch hint.
26856
26857 @item -mhint-max-distance=@var{n}
26858 @opindex mhint-max-distance
26859 The encoding of the branch hint instruction limits the hint to be within
26860 256 instructions of the branch it is affecting. By default, GCC makes
26861 sure it is within 125.
26862
26863 @item -msafe-hints
26864 @opindex msafe-hints
26865 Work around a hardware bug that causes the SPU to stall indefinitely.
26866 By default, GCC inserts the @code{hbrp} instruction to make sure
26867 this stall won't happen.
26868
26869 @end table
26870
26871 @node System V Options
26872 @subsection Options for System V
26873
26874 These additional options are available on System V Release 4 for
26875 compatibility with other compilers on those systems:
26876
26877 @table @gcctabopt
26878 @item -G
26879 @opindex G
26880 Create a shared object.
26881 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26882
26883 @item -Qy
26884 @opindex Qy
26885 Identify the versions of each tool used by the compiler, in a
26886 @code{.ident} assembler directive in the output.
26887
26888 @item -Qn
26889 @opindex Qn
26890 Refrain from adding @code{.ident} directives to the output file (this is
26891 the default).
26892
26893 @item -YP,@var{dirs}
26894 @opindex YP
26895 Search the directories @var{dirs}, and no others, for libraries
26896 specified with @option{-l}.
26897
26898 @item -Ym,@var{dir}
26899 @opindex Ym
26900 Look in the directory @var{dir} to find the M4 preprocessor.
26901 The assembler uses this option.
26902 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26903 @c the generic assembler that comes with Solaris takes just -Ym.
26904 @end table
26905
26906 @node TILE-Gx Options
26907 @subsection TILE-Gx Options
26908 @cindex TILE-Gx options
26909
26910 These @samp{-m} options are supported on the TILE-Gx:
26911
26912 @table @gcctabopt
26913 @item -mcmodel=small
26914 @opindex mcmodel=small
26915 Generate code for the small model. The distance for direct calls is
26916 limited to 500M in either direction. PC-relative addresses are 32
26917 bits. Absolute addresses support the full address range.
26918
26919 @item -mcmodel=large
26920 @opindex mcmodel=large
26921 Generate code for the large model. There is no limitation on call
26922 distance, pc-relative addresses, or absolute addresses.
26923
26924 @item -mcpu=@var{name}
26925 @opindex mcpu
26926 Selects the type of CPU to be targeted. Currently the only supported
26927 type is @samp{tilegx}.
26928
26929 @item -m32
26930 @itemx -m64
26931 @opindex m32
26932 @opindex m64
26933 Generate code for a 32-bit or 64-bit environment. The 32-bit
26934 environment sets int, long, and pointer to 32 bits. The 64-bit
26935 environment sets int to 32 bits and long and pointer to 64 bits.
26936
26937 @item -mbig-endian
26938 @itemx -mlittle-endian
26939 @opindex mbig-endian
26940 @opindex mlittle-endian
26941 Generate code in big/little endian mode, respectively.
26942 @end table
26943
26944 @node TILEPro Options
26945 @subsection TILEPro Options
26946 @cindex TILEPro options
26947
26948 These @samp{-m} options are supported on the TILEPro:
26949
26950 @table @gcctabopt
26951 @item -mcpu=@var{name}
26952 @opindex mcpu
26953 Selects the type of CPU to be targeted. Currently the only supported
26954 type is @samp{tilepro}.
26955
26956 @item -m32
26957 @opindex m32
26958 Generate code for a 32-bit environment, which sets int, long, and
26959 pointer to 32 bits. This is the only supported behavior so the flag
26960 is essentially ignored.
26961 @end table
26962
26963 @node V850 Options
26964 @subsection V850 Options
26965 @cindex V850 Options
26966
26967 These @samp{-m} options are defined for V850 implementations:
26968
26969 @table @gcctabopt
26970 @item -mlong-calls
26971 @itemx -mno-long-calls
26972 @opindex mlong-calls
26973 @opindex mno-long-calls
26974 Treat all calls as being far away (near). If calls are assumed to be
26975 far away, the compiler always loads the function's address into a
26976 register, and calls indirect through the pointer.
26977
26978 @item -mno-ep
26979 @itemx -mep
26980 @opindex mno-ep
26981 @opindex mep
26982 Do not optimize (do optimize) basic blocks that use the same index
26983 pointer 4 or more times to copy pointer into the @code{ep} register, and
26984 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26985 option is on by default if you optimize.
26986
26987 @item -mno-prolog-function
26988 @itemx -mprolog-function
26989 @opindex mno-prolog-function
26990 @opindex mprolog-function
26991 Do not use (do use) external functions to save and restore registers
26992 at the prologue and epilogue of a function. The external functions
26993 are slower, but use less code space if more than one function saves
26994 the same number of registers. The @option{-mprolog-function} option
26995 is on by default if you optimize.
26996
26997 @item -mspace
26998 @opindex mspace
26999 Try to make the code as small as possible. At present, this just turns
27000 on the @option{-mep} and @option{-mprolog-function} options.
27001
27002 @item -mtda=@var{n}
27003 @opindex mtda
27004 Put static or global variables whose size is @var{n} bytes or less into
27005 the tiny data area that register @code{ep} points to. The tiny data
27006 area can hold up to 256 bytes in total (128 bytes for byte references).
27007
27008 @item -msda=@var{n}
27009 @opindex msda
27010 Put static or global variables whose size is @var{n} bytes or less into
27011 the small data area that register @code{gp} points to. The small data
27012 area can hold up to 64 kilobytes.
27013
27014 @item -mzda=@var{n}
27015 @opindex mzda
27016 Put static or global variables whose size is @var{n} bytes or less into
27017 the first 32 kilobytes of memory.
27018
27019 @item -mv850
27020 @opindex mv850
27021 Specify that the target processor is the V850.
27022
27023 @item -mv850e3v5
27024 @opindex mv850e3v5
27025 Specify that the target processor is the V850E3V5. The preprocessor
27026 constant @code{__v850e3v5__} is defined if this option is used.
27027
27028 @item -mv850e2v4
27029 @opindex mv850e2v4
27030 Specify that the target processor is the V850E3V5. This is an alias for
27031 the @option{-mv850e3v5} option.
27032
27033 @item -mv850e2v3
27034 @opindex mv850e2v3
27035 Specify that the target processor is the V850E2V3. The preprocessor
27036 constant @code{__v850e2v3__} is defined if this option is used.
27037
27038 @item -mv850e2
27039 @opindex mv850e2
27040 Specify that the target processor is the V850E2. The preprocessor
27041 constant @code{__v850e2__} is defined if this option is used.
27042
27043 @item -mv850e1
27044 @opindex mv850e1
27045 Specify that the target processor is the V850E1. The preprocessor
27046 constants @code{__v850e1__} and @code{__v850e__} are defined if
27047 this option is used.
27048
27049 @item -mv850es
27050 @opindex mv850es
27051 Specify that the target processor is the V850ES. This is an alias for
27052 the @option{-mv850e1} option.
27053
27054 @item -mv850e
27055 @opindex mv850e
27056 Specify that the target processor is the V850E@. The preprocessor
27057 constant @code{__v850e__} is defined if this option is used.
27058
27059 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
27060 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
27061 are defined then a default target processor is chosen and the
27062 relevant @samp{__v850*__} preprocessor constant is defined.
27063
27064 The preprocessor constants @code{__v850} and @code{__v851__} are always
27065 defined, regardless of which processor variant is the target.
27066
27067 @item -mdisable-callt
27068 @itemx -mno-disable-callt
27069 @opindex mdisable-callt
27070 @opindex mno-disable-callt
27071 This option suppresses generation of the @code{CALLT} instruction for the
27072 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27073 architecture.
27074
27075 This option is enabled by default when the RH850 ABI is
27076 in use (see @option{-mrh850-abi}), and disabled by default when the
27077 GCC ABI is in use. If @code{CALLT} instructions are being generated
27078 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27079
27080 @item -mrelax
27081 @itemx -mno-relax
27082 @opindex mrelax
27083 @opindex mno-relax
27084 Pass on (or do not pass on) the @option{-mrelax} command-line option
27085 to the assembler.
27086
27087 @item -mlong-jumps
27088 @itemx -mno-long-jumps
27089 @opindex mlong-jumps
27090 @opindex mno-long-jumps
27091 Disable (or re-enable) the generation of PC-relative jump instructions.
27092
27093 @item -msoft-float
27094 @itemx -mhard-float
27095 @opindex msoft-float
27096 @opindex mhard-float
27097 Disable (or re-enable) the generation of hardware floating point
27098 instructions. This option is only significant when the target
27099 architecture is @samp{V850E2V3} or higher. If hardware floating point
27100 instructions are being generated then the C preprocessor symbol
27101 @code{__FPU_OK__} is defined, otherwise the symbol
27102 @code{__NO_FPU__} is defined.
27103
27104 @item -mloop
27105 @opindex mloop
27106 Enables the use of the e3v5 LOOP instruction. The use of this
27107 instruction is not enabled by default when the e3v5 architecture is
27108 selected because its use is still experimental.
27109
27110 @item -mrh850-abi
27111 @itemx -mghs
27112 @opindex mrh850-abi
27113 @opindex mghs
27114 Enables support for the RH850 version of the V850 ABI. This is the
27115 default. With this version of the ABI the following rules apply:
27116
27117 @itemize
27118 @item
27119 Integer sized structures and unions are returned via a memory pointer
27120 rather than a register.
27121
27122 @item
27123 Large structures and unions (more than 8 bytes in size) are passed by
27124 value.
27125
27126 @item
27127 Functions are aligned to 16-bit boundaries.
27128
27129 @item
27130 The @option{-m8byte-align} command-line option is supported.
27131
27132 @item
27133 The @option{-mdisable-callt} command-line option is enabled by
27134 default. The @option{-mno-disable-callt} command-line option is not
27135 supported.
27136 @end itemize
27137
27138 When this version of the ABI is enabled the C preprocessor symbol
27139 @code{__V850_RH850_ABI__} is defined.
27140
27141 @item -mgcc-abi
27142 @opindex mgcc-abi
27143 Enables support for the old GCC version of the V850 ABI. With this
27144 version of the ABI the following rules apply:
27145
27146 @itemize
27147 @item
27148 Integer sized structures and unions are returned in register @code{r10}.
27149
27150 @item
27151 Large structures and unions (more than 8 bytes in size) are passed by
27152 reference.
27153
27154 @item
27155 Functions are aligned to 32-bit boundaries, unless optimizing for
27156 size.
27157
27158 @item
27159 The @option{-m8byte-align} command-line option is not supported.
27160
27161 @item
27162 The @option{-mdisable-callt} command-line option is supported but not
27163 enabled by default.
27164 @end itemize
27165
27166 When this version of the ABI is enabled the C preprocessor symbol
27167 @code{__V850_GCC_ABI__} is defined.
27168
27169 @item -m8byte-align
27170 @itemx -mno-8byte-align
27171 @opindex m8byte-align
27172 @opindex mno-8byte-align
27173 Enables support for @code{double} and @code{long long} types to be
27174 aligned on 8-byte boundaries. The default is to restrict the
27175 alignment of all objects to at most 4-bytes. When
27176 @option{-m8byte-align} is in effect the C preprocessor symbol
27177 @code{__V850_8BYTE_ALIGN__} is defined.
27178
27179 @item -mbig-switch
27180 @opindex mbig-switch
27181 Generate code suitable for big switch tables. Use this option only if
27182 the assembler/linker complain about out of range branches within a switch
27183 table.
27184
27185 @item -mapp-regs
27186 @opindex mapp-regs
27187 This option causes r2 and r5 to be used in the code generated by
27188 the compiler. This setting is the default.
27189
27190 @item -mno-app-regs
27191 @opindex mno-app-regs
27192 This option causes r2 and r5 to be treated as fixed registers.
27193
27194 @end table
27195
27196 @node VAX Options
27197 @subsection VAX Options
27198 @cindex VAX options
27199
27200 These @samp{-m} options are defined for the VAX:
27201
27202 @table @gcctabopt
27203 @item -munix
27204 @opindex munix
27205 Do not output certain jump instructions (@code{aobleq} and so on)
27206 that the Unix assembler for the VAX cannot handle across long
27207 ranges.
27208
27209 @item -mgnu
27210 @opindex mgnu
27211 Do output those jump instructions, on the assumption that the
27212 GNU assembler is being used.
27213
27214 @item -mg
27215 @opindex mg
27216 Output code for G-format floating-point numbers instead of D-format.
27217 @end table
27218
27219 @node Visium Options
27220 @subsection Visium Options
27221 @cindex Visium options
27222
27223 @table @gcctabopt
27224
27225 @item -mdebug
27226 @opindex mdebug
27227 A program which performs file I/O and is destined to run on an MCM target
27228 should be linked with this option. It causes the libraries libc.a and
27229 libdebug.a to be linked. The program should be run on the target under
27230 the control of the GDB remote debugging stub.
27231
27232 @item -msim
27233 @opindex msim
27234 A program which performs file I/O and is destined to run on the simulator
27235 should be linked with option. This causes libraries libc.a and libsim.a to
27236 be linked.
27237
27238 @item -mfpu
27239 @itemx -mhard-float
27240 @opindex mfpu
27241 @opindex mhard-float
27242 Generate code containing floating-point instructions. This is the
27243 default.
27244
27245 @item -mno-fpu
27246 @itemx -msoft-float
27247 @opindex mno-fpu
27248 @opindex msoft-float
27249 Generate code containing library calls for floating-point.
27250
27251 @option{-msoft-float} changes the calling convention in the output file;
27252 therefore, it is only useful if you compile @emph{all} of a program with
27253 this option. In particular, you need to compile @file{libgcc.a}, the
27254 library that comes with GCC, with @option{-msoft-float} in order for
27255 this to work.
27256
27257 @item -mcpu=@var{cpu_type}
27258 @opindex mcpu
27259 Set the instruction set, register set, and instruction scheduling parameters
27260 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27261 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27262
27263 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27264
27265 By default (unless configured otherwise), GCC generates code for the GR5
27266 variant of the Visium architecture.
27267
27268 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27269 architecture. The only difference from GR5 code is that the compiler will
27270 generate block move instructions.
27271
27272 @item -mtune=@var{cpu_type}
27273 @opindex mtune
27274 Set the instruction scheduling parameters for machine type @var{cpu_type},
27275 but do not set the instruction set or register set that the option
27276 @option{-mcpu=@var{cpu_type}} would.
27277
27278 @item -msv-mode
27279 @opindex msv-mode
27280 Generate code for the supervisor mode, where there are no restrictions on
27281 the access to general registers. This is the default.
27282
27283 @item -muser-mode
27284 @opindex muser-mode
27285 Generate code for the user mode, where the access to some general registers
27286 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27287 mode; on the GR6, only registers r29 to r31 are affected.
27288 @end table
27289
27290 @node VMS Options
27291 @subsection VMS Options
27292
27293 These @samp{-m} options are defined for the VMS implementations:
27294
27295 @table @gcctabopt
27296 @item -mvms-return-codes
27297 @opindex mvms-return-codes
27298 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27299 condition (e.g.@: error) codes.
27300
27301 @item -mdebug-main=@var{prefix}
27302 @opindex mdebug-main=@var{prefix}
27303 Flag the first routine whose name starts with @var{prefix} as the main
27304 routine for the debugger.
27305
27306 @item -mmalloc64
27307 @opindex mmalloc64
27308 Default to 64-bit memory allocation routines.
27309
27310 @item -mpointer-size=@var{size}
27311 @opindex mpointer-size=@var{size}
27312 Set the default size of pointers. Possible options for @var{size} are
27313 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27314 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27315 The later option disables @code{pragma pointer_size}.
27316 @end table
27317
27318 @node VxWorks Options
27319 @subsection VxWorks Options
27320 @cindex VxWorks Options
27321
27322 The options in this section are defined for all VxWorks targets.
27323 Options specific to the target hardware are listed with the other
27324 options for that target.
27325
27326 @table @gcctabopt
27327 @item -mrtp
27328 @opindex mrtp
27329 GCC can generate code for both VxWorks kernels and real time processes
27330 (RTPs). This option switches from the former to the latter. It also
27331 defines the preprocessor macro @code{__RTP__}.
27332
27333 @item -non-static
27334 @opindex non-static
27335 Link an RTP executable against shared libraries rather than static
27336 libraries. The options @option{-static} and @option{-shared} can
27337 also be used for RTPs (@pxref{Link Options}); @option{-static}
27338 is the default.
27339
27340 @item -Bstatic
27341 @itemx -Bdynamic
27342 @opindex Bstatic
27343 @opindex Bdynamic
27344 These options are passed down to the linker. They are defined for
27345 compatibility with Diab.
27346
27347 @item -Xbind-lazy
27348 @opindex Xbind-lazy
27349 Enable lazy binding of function calls. This option is equivalent to
27350 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27351
27352 @item -Xbind-now
27353 @opindex Xbind-now
27354 Disable lazy binding of function calls. This option is the default and
27355 is defined for compatibility with Diab.
27356 @end table
27357
27358 @node x86 Options
27359 @subsection x86 Options
27360 @cindex x86 Options
27361
27362 These @samp{-m} options are defined for the x86 family of computers.
27363
27364 @table @gcctabopt
27365
27366 @item -march=@var{cpu-type}
27367 @opindex march
27368 Generate instructions for the machine type @var{cpu-type}. In contrast to
27369 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27370 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27371 to generate code that may not run at all on processors other than the one
27372 indicated. Specifying @option{-march=@var{cpu-type}} implies
27373 @option{-mtune=@var{cpu-type}}.
27374
27375 The choices for @var{cpu-type} are:
27376
27377 @table @samp
27378 @item native
27379 This selects the CPU to generate code for at compilation time by determining
27380 the processor type of the compiling machine. Using @option{-march=native}
27381 enables all instruction subsets supported by the local machine (hence
27382 the result might not run on different machines). Using @option{-mtune=native}
27383 produces code optimized for the local machine under the constraints
27384 of the selected instruction set.
27385
27386 @item x86-64
27387 A generic CPU with 64-bit extensions.
27388
27389 @item i386
27390 Original Intel i386 CPU@.
27391
27392 @item i486
27393 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27394
27395 @item i586
27396 @itemx pentium
27397 Intel Pentium CPU with no MMX support.
27398
27399 @item lakemont
27400 Intel Lakemont MCU, based on Intel Pentium CPU.
27401
27402 @item pentium-mmx
27403 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27404
27405 @item pentiumpro
27406 Intel Pentium Pro CPU@.
27407
27408 @item i686
27409 When used with @option{-march}, the Pentium Pro
27410 instruction set is used, so the code runs on all i686 family chips.
27411 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27412
27413 @item pentium2
27414 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27415 support.
27416
27417 @item pentium3
27418 @itemx pentium3m
27419 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27420 set support.
27421
27422 @item pentium-m
27423 Intel Pentium M; low-power version of Intel Pentium III CPU
27424 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27425
27426 @item pentium4
27427 @itemx pentium4m
27428 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27429
27430 @item prescott
27431 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27432 set support.
27433
27434 @item nocona
27435 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27436 SSE2 and SSE3 instruction set support.
27437
27438 @item core2
27439 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27440 instruction set support.
27441
27442 @item nehalem
27443 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27444 SSE4.1, SSE4.2 and POPCNT instruction set support.
27445
27446 @item westmere
27447 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27448 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27449
27450 @item sandybridge
27451 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27452 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27453
27454 @item ivybridge
27455 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27456 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27457 instruction set support.
27458
27459 @item haswell
27460 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27461 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27462 BMI, BMI2 and F16C instruction set support.
27463
27464 @item broadwell
27465 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27466 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27467 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27468
27469 @item skylake
27470 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27471 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27472 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27473 XSAVES instruction set support.
27474
27475 @item bonnell
27476 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27477 instruction set support.
27478
27479 @item silvermont
27480 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27481 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27482
27483 @item goldmont
27484 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27485 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27486 instruction set support.
27487
27488 @item goldmont-plus
27489 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27490 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27491 PTWRITE, RDPID, SGX and UMIP instruction set support.
27492
27493 @item tremont
27494 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27495 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27496 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27497
27498 @item knl
27499 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27500 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27501 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27502 AVX512CD instruction set support.
27503
27504 @item knm
27505 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27506 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27507 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27508 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27509
27510 @item skylake-avx512
27511 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27512 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27513 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27514 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27515
27516 @item cannonlake
27517 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27518 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27519 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27520 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27521 AVX512IFMA, SHA and UMIP instruction set support.
27522
27523 @item icelake-client
27524 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27525 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27526 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27527 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27528 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27529 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27530
27531 @item icelake-server
27532 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27533 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27534 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27535 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27536 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27537 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27538 set support.
27539
27540 @item cascadelake
27541 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27542 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27543 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27544 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27545
27546 @item k6
27547 AMD K6 CPU with MMX instruction set support.
27548
27549 @item k6-2
27550 @itemx k6-3
27551 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27552
27553 @item athlon
27554 @itemx athlon-tbird
27555 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27556 support.
27557
27558 @item athlon-4
27559 @itemx athlon-xp
27560 @itemx athlon-mp
27561 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27562 instruction set support.
27563
27564 @item k8
27565 @itemx opteron
27566 @itemx athlon64
27567 @itemx athlon-fx
27568 Processors based on the AMD K8 core with x86-64 instruction set support,
27569 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27570 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27571 instruction set extensions.)
27572
27573 @item k8-sse3
27574 @itemx opteron-sse3
27575 @itemx athlon64-sse3
27576 Improved versions of AMD K8 cores with SSE3 instruction set support.
27577
27578 @item amdfam10
27579 @itemx barcelona
27580 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27581 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27582 instruction set extensions.)
27583
27584 @item bdver1
27585 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27586 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27587 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27588 @item bdver2
27589 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27590 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27591 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27592 extensions.)
27593 @item bdver3
27594 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27595 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27596 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27597 64-bit instruction set extensions.
27598 @item bdver4
27599 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27600 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27601 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27602 SSE4.2, ABM and 64-bit instruction set extensions.
27603
27604 @item znver1
27605 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27606 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27607 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27608 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27609 instruction set extensions.
27610 @item znver2
27611 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27612 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27613 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27614 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27615 instruction set extensions.)
27616
27617
27618 @item btver1
27619 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27620 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27621 instruction set extensions.)
27622
27623 @item btver2
27624 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27625 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27626 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27627
27628 @item winchip-c6
27629 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27630 set support.
27631
27632 @item winchip2
27633 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27634 instruction set support.
27635
27636 @item c3
27637 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27638 (No scheduling is implemented for this chip.)
27639
27640 @item c3-2
27641 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27642 (No scheduling is implemented for this chip.)
27643
27644 @item c7
27645 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27646 (No scheduling is implemented for this chip.)
27647
27648 @item samuel-2
27649 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27650 (No scheduling is implemented for this chip.)
27651
27652 @item nehemiah
27653 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27654 (No scheduling is implemented for this chip.)
27655
27656 @item esther
27657 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27658 (No scheduling is implemented for this chip.)
27659
27660 @item eden-x2
27661 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27662 (No scheduling is implemented for this chip.)
27663
27664 @item eden-x4
27665 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27666 AVX and AVX2 instruction set support.
27667 (No scheduling is implemented for this chip.)
27668
27669 @item nano
27670 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27671 instruction set support.
27672 (No scheduling is implemented for this chip.)
27673
27674 @item nano-1000
27675 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27676 instruction set support.
27677 (No scheduling is implemented for this chip.)
27678
27679 @item nano-2000
27680 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27681 instruction set support.
27682 (No scheduling is implemented for this chip.)
27683
27684 @item nano-3000
27685 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27686 instruction set support.
27687 (No scheduling is implemented for this chip.)
27688
27689 @item nano-x2
27690 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27691 instruction set support.
27692 (No scheduling is implemented for this chip.)
27693
27694 @item nano-x4
27695 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27696 instruction set support.
27697 (No scheduling is implemented for this chip.)
27698
27699 @item geode
27700 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27701 @end table
27702
27703 @item -mtune=@var{cpu-type}
27704 @opindex mtune
27705 Tune to @var{cpu-type} everything applicable about the generated code, except
27706 for the ABI and the set of available instructions.
27707 While picking a specific @var{cpu-type} schedules things appropriately
27708 for that particular chip, the compiler does not generate any code that
27709 cannot run on the default machine type unless you use a
27710 @option{-march=@var{cpu-type}} option.
27711 For example, if GCC is configured for i686-pc-linux-gnu
27712 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27713 but still runs on i686 machines.
27714
27715 The choices for @var{cpu-type} are the same as for @option{-march}.
27716 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27717
27718 @table @samp
27719 @item generic
27720 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27721 If you know the CPU on which your code will run, then you should use
27722 the corresponding @option{-mtune} or @option{-march} option instead of
27723 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27724 of your application will have, then you should use this option.
27725
27726 As new processors are deployed in the marketplace, the behavior of this
27727 option will change. Therefore, if you upgrade to a newer version of
27728 GCC, code generation controlled by this option will change to reflect
27729 the processors
27730 that are most common at the time that version of GCC is released.
27731
27732 There is no @option{-march=generic} option because @option{-march}
27733 indicates the instruction set the compiler can use, and there is no
27734 generic instruction set applicable to all processors. In contrast,
27735 @option{-mtune} indicates the processor (or, in this case, collection of
27736 processors) for which the code is optimized.
27737
27738 @item intel
27739 Produce code optimized for the most current Intel processors, which are
27740 Haswell and Silvermont for this version of GCC. If you know the CPU
27741 on which your code will run, then you should use the corresponding
27742 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27743 But, if you want your application performs better on both Haswell and
27744 Silvermont, then you should use this option.
27745
27746 As new Intel processors are deployed in the marketplace, the behavior of
27747 this option will change. Therefore, if you upgrade to a newer version of
27748 GCC, code generation controlled by this option will change to reflect
27749 the most current Intel processors at the time that version of GCC is
27750 released.
27751
27752 There is no @option{-march=intel} option because @option{-march} indicates
27753 the instruction set the compiler can use, and there is no common
27754 instruction set applicable to all processors. In contrast,
27755 @option{-mtune} indicates the processor (or, in this case, collection of
27756 processors) for which the code is optimized.
27757 @end table
27758
27759 @item -mcpu=@var{cpu-type}
27760 @opindex mcpu
27761 A deprecated synonym for @option{-mtune}.
27762
27763 @item -mfpmath=@var{unit}
27764 @opindex mfpmath
27765 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27766 for @var{unit} are:
27767
27768 @table @samp
27769 @item 387
27770 Use the standard 387 floating-point coprocessor present on the majority of chips and
27771 emulated otherwise. Code compiled with this option runs almost everywhere.
27772 The temporary results are computed in 80-bit precision instead of the precision
27773 specified by the type, resulting in slightly different results compared to most
27774 of other chips. See @option{-ffloat-store} for more detailed description.
27775
27776 This is the default choice for non-Darwin x86-32 targets.
27777
27778 @item sse
27779 Use scalar floating-point instructions present in the SSE instruction set.
27780 This instruction set is supported by Pentium III and newer chips,
27781 and in the AMD line
27782 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27783 instruction set supports only single-precision arithmetic, thus the double and
27784 extended-precision arithmetic are still done using 387. A later version, present
27785 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27786 arithmetic too.
27787
27788 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27789 or @option{-msse2} switches to enable SSE extensions and make this option
27790 effective. For the x86-64 compiler, these extensions are enabled by default.
27791
27792 The resulting code should be considerably faster in the majority of cases and avoid
27793 the numerical instability problems of 387 code, but may break some existing
27794 code that expects temporaries to be 80 bits.
27795
27796 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27797 and the default choice for x86-32 targets with the SSE2 instruction set
27798 when @option{-ffast-math} is enabled.
27799
27800 @item sse,387
27801 @itemx sse+387
27802 @itemx both
27803 Attempt to utilize both instruction sets at once. This effectively doubles the
27804 amount of available registers, and on chips with separate execution units for
27805 387 and SSE the execution resources too. Use this option with care, as it is
27806 still experimental, because the GCC register allocator does not model separate
27807 functional units well, resulting in unstable performance.
27808 @end table
27809
27810 @item -masm=@var{dialect}
27811 @opindex masm=@var{dialect}
27812 Output assembly instructions using selected @var{dialect}. Also affects
27813 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27814 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27815 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27816 not support @samp{intel}.
27817
27818 @item -mieee-fp
27819 @itemx -mno-ieee-fp
27820 @opindex mieee-fp
27821 @opindex mno-ieee-fp
27822 Control whether or not the compiler uses IEEE floating-point
27823 comparisons. These correctly handle the case where the result of a
27824 comparison is unordered.
27825
27826 @item -m80387
27827 @itemx -mhard-float
27828 @opindex 80387
27829 @opindex mhard-float
27830 Generate output containing 80387 instructions for floating point.
27831
27832 @item -mno-80387
27833 @itemx -msoft-float
27834 @opindex no-80387
27835 @opindex msoft-float
27836 Generate output containing library calls for floating point.
27837
27838 @strong{Warning:} the requisite libraries are not part of GCC@.
27839 Normally the facilities of the machine's usual C compiler are used, but
27840 this cannot be done directly in cross-compilation. You must make your
27841 own arrangements to provide suitable library functions for
27842 cross-compilation.
27843
27844 On machines where a function returns floating-point results in the 80387
27845 register stack, some floating-point opcodes may be emitted even if
27846 @option{-msoft-float} is used.
27847
27848 @item -mno-fp-ret-in-387
27849 @opindex mno-fp-ret-in-387
27850 @opindex mfp-ret-in-387
27851 Do not use the FPU registers for return values of functions.
27852
27853 The usual calling convention has functions return values of types
27854 @code{float} and @code{double} in an FPU register, even if there
27855 is no FPU@. The idea is that the operating system should emulate
27856 an FPU@.
27857
27858 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27859 in ordinary CPU registers instead.
27860
27861 @item -mno-fancy-math-387
27862 @opindex mno-fancy-math-387
27863 @opindex mfancy-math-387
27864 Some 387 emulators do not support the @code{sin}, @code{cos} and
27865 @code{sqrt} instructions for the 387. Specify this option to avoid
27866 generating those instructions.
27867 This option is overridden when @option{-march}
27868 indicates that the target CPU always has an FPU and so the
27869 instruction does not need emulation. These
27870 instructions are not generated unless you also use the
27871 @option{-funsafe-math-optimizations} switch.
27872
27873 @item -malign-double
27874 @itemx -mno-align-double
27875 @opindex malign-double
27876 @opindex mno-align-double
27877 Control whether GCC aligns @code{double}, @code{long double}, and
27878 @code{long long} variables on a two-word boundary or a one-word
27879 boundary. Aligning @code{double} variables on a two-word boundary
27880 produces code that runs somewhat faster on a Pentium at the
27881 expense of more memory.
27882
27883 On x86-64, @option{-malign-double} is enabled by default.
27884
27885 @strong{Warning:} if you use the @option{-malign-double} switch,
27886 structures containing the above types are aligned differently than
27887 the published application binary interface specifications for the x86-32
27888 and are not binary compatible with structures in code compiled
27889 without that switch.
27890
27891 @item -m96bit-long-double
27892 @itemx -m128bit-long-double
27893 @opindex m96bit-long-double
27894 @opindex m128bit-long-double
27895 These switches control the size of @code{long double} type. The x86-32
27896 application binary interface specifies the size to be 96 bits,
27897 so @option{-m96bit-long-double} is the default in 32-bit mode.
27898
27899 Modern architectures (Pentium and newer) prefer @code{long double}
27900 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27901 conforming to the ABI, this is not possible. So specifying
27902 @option{-m128bit-long-double} aligns @code{long double}
27903 to a 16-byte boundary by padding the @code{long double} with an additional
27904 32-bit zero.
27905
27906 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27907 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27908
27909 Notice that neither of these options enable any extra precision over the x87
27910 standard of 80 bits for a @code{long double}.
27911
27912 @strong{Warning:} if you override the default value for your target ABI, this
27913 changes the size of
27914 structures and arrays containing @code{long double} variables,
27915 as well as modifying the function calling convention for functions taking
27916 @code{long double}. Hence they are not binary-compatible
27917 with code compiled without that switch.
27918
27919 @item -mlong-double-64
27920 @itemx -mlong-double-80
27921 @itemx -mlong-double-128
27922 @opindex mlong-double-64
27923 @opindex mlong-double-80
27924 @opindex mlong-double-128
27925 These switches control the size of @code{long double} type. A size
27926 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27927 type. This is the default for 32-bit Bionic C library. A size
27928 of 128 bits makes the @code{long double} type equivalent to the
27929 @code{__float128} type. This is the default for 64-bit Bionic C library.
27930
27931 @strong{Warning:} if you override the default value for your target ABI, this
27932 changes the size of
27933 structures and arrays containing @code{long double} variables,
27934 as well as modifying the function calling convention for functions taking
27935 @code{long double}. Hence they are not binary-compatible
27936 with code compiled without that switch.
27937
27938 @item -malign-data=@var{type}
27939 @opindex malign-data
27940 Control how GCC aligns variables. Supported values for @var{type} are
27941 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27942 and earlier, @samp{abi} uses alignment value as specified by the
27943 psABI, and @samp{cacheline} uses increased alignment value to match
27944 the cache line size. @samp{compat} is the default.
27945
27946 @item -mlarge-data-threshold=@var{threshold}
27947 @opindex mlarge-data-threshold
27948 When @option{-mcmodel=medium} is specified, data objects larger than
27949 @var{threshold} are placed in the large data section. This value must be the
27950 same across all objects linked into the binary, and defaults to 65535.
27951
27952 @item -mrtd
27953 @opindex mrtd
27954 Use a different function-calling convention, in which functions that
27955 take a fixed number of arguments return with the @code{ret @var{num}}
27956 instruction, which pops their arguments while returning. This saves one
27957 instruction in the caller since there is no need to pop the arguments
27958 there.
27959
27960 You can specify that an individual function is called with this calling
27961 sequence with the function attribute @code{stdcall}. You can also
27962 override the @option{-mrtd} option by using the function attribute
27963 @code{cdecl}. @xref{Function Attributes}.
27964
27965 @strong{Warning:} this calling convention is incompatible with the one
27966 normally used on Unix, so you cannot use it if you need to call
27967 libraries compiled with the Unix compiler.
27968
27969 Also, you must provide function prototypes for all functions that
27970 take variable numbers of arguments (including @code{printf});
27971 otherwise incorrect code is generated for calls to those
27972 functions.
27973
27974 In addition, seriously incorrect code results if you call a
27975 function with too many arguments. (Normally, extra arguments are
27976 harmlessly ignored.)
27977
27978 @item -mregparm=@var{num}
27979 @opindex mregparm
27980 Control how many registers are used to pass integer arguments. By
27981 default, no registers are used to pass arguments, and at most 3
27982 registers can be used. You can control this behavior for a specific
27983 function by using the function attribute @code{regparm}.
27984 @xref{Function Attributes}.
27985
27986 @strong{Warning:} if you use this switch, and
27987 @var{num} is nonzero, then you must build all modules with the same
27988 value, including any libraries. This includes the system libraries and
27989 startup modules.
27990
27991 @item -msseregparm
27992 @opindex msseregparm
27993 Use SSE register passing conventions for float and double arguments
27994 and return values. You can control this behavior for a specific
27995 function by using the function attribute @code{sseregparm}.
27996 @xref{Function Attributes}.
27997
27998 @strong{Warning:} if you use this switch then you must build all
27999 modules with the same value, including any libraries. This includes
28000 the system libraries and startup modules.
28001
28002 @item -mvect8-ret-in-mem
28003 @opindex mvect8-ret-in-mem
28004 Return 8-byte vectors in memory instead of MMX registers. This is the
28005 default on VxWorks to match the ABI of the Sun Studio compilers until
28006 version 12. @emph{Only} use this option if you need to remain
28007 compatible with existing code produced by those previous compiler
28008 versions or older versions of GCC@.
28009
28010 @item -mpc32
28011 @itemx -mpc64
28012 @itemx -mpc80
28013 @opindex mpc32
28014 @opindex mpc64
28015 @opindex mpc80
28016
28017 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
28018 is specified, the significands of results of floating-point operations are
28019 rounded to 24 bits (single precision); @option{-mpc64} rounds the
28020 significands of results of floating-point operations to 53 bits (double
28021 precision) and @option{-mpc80} rounds the significands of results of
28022 floating-point operations to 64 bits (extended double precision), which is
28023 the default. When this option is used, floating-point operations in higher
28024 precisions are not available to the programmer without setting the FPU
28025 control word explicitly.
28026
28027 Setting the rounding of floating-point operations to less than the default
28028 80 bits can speed some programs by 2% or more. Note that some mathematical
28029 libraries assume that extended-precision (80-bit) floating-point operations
28030 are enabled by default; routines in such libraries could suffer significant
28031 loss of accuracy, typically through so-called ``catastrophic cancellation'',
28032 when this option is used to set the precision to less than extended precision.
28033
28034 @item -mstackrealign
28035 @opindex mstackrealign
28036 Realign the stack at entry. On the x86, the @option{-mstackrealign}
28037 option generates an alternate prologue and epilogue that realigns the
28038 run-time stack if necessary. This supports mixing legacy codes that keep
28039 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
28040 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
28041 applicable to individual functions.
28042
28043 @item -mpreferred-stack-boundary=@var{num}
28044 @opindex mpreferred-stack-boundary
28045 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28046 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28047 the default is 4 (16 bytes or 128 bits).
28048
28049 @strong{Warning:} When generating code for the x86-64 architecture with
28050 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
28051 used to keep the stack boundary aligned to 8 byte boundary. Since
28052 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
28053 intended to be used in controlled environment where stack space is
28054 important limitation. This option leads to wrong code when functions
28055 compiled with 16 byte stack alignment (such as functions from a standard
28056 library) are called with misaligned stack. In this case, SSE
28057 instructions may lead to misaligned memory access traps. In addition,
28058 variable arguments are handled incorrectly for 16 byte aligned
28059 objects (including x87 long double and __int128), leading to wrong
28060 results. You must build all modules with
28061 @option{-mpreferred-stack-boundary=3}, including any libraries. This
28062 includes the system libraries and startup modules.
28063
28064 @item -mincoming-stack-boundary=@var{num}
28065 @opindex mincoming-stack-boundary
28066 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28067 boundary. If @option{-mincoming-stack-boundary} is not specified,
28068 the one specified by @option{-mpreferred-stack-boundary} is used.
28069
28070 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28071 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28072 suffer significant run time performance penalties. On Pentium III, the
28073 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28074 properly if it is not 16-byte aligned.
28075
28076 To ensure proper alignment of this values on the stack, the stack boundary
28077 must be as aligned as that required by any value stored on the stack.
28078 Further, every function must be generated such that it keeps the stack
28079 aligned. Thus calling a function compiled with a higher preferred
28080 stack boundary from a function compiled with a lower preferred stack
28081 boundary most likely misaligns the stack. It is recommended that
28082 libraries that use callbacks always use the default setting.
28083
28084 This extra alignment does consume extra stack space, and generally
28085 increases code size. Code that is sensitive to stack space usage, such
28086 as embedded systems and operating system kernels, may want to reduce the
28087 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28088
28089 @need 200
28090 @item -mmmx
28091 @opindex mmmx
28092 @need 200
28093 @itemx -msse
28094 @opindex msse
28095 @need 200
28096 @itemx -msse2
28097 @opindex msse2
28098 @need 200
28099 @itemx -msse3
28100 @opindex msse3
28101 @need 200
28102 @itemx -mssse3
28103 @opindex mssse3
28104 @need 200
28105 @itemx -msse4
28106 @opindex msse4
28107 @need 200
28108 @itemx -msse4a
28109 @opindex msse4a
28110 @need 200
28111 @itemx -msse4.1
28112 @opindex msse4.1
28113 @need 200
28114 @itemx -msse4.2
28115 @opindex msse4.2
28116 @need 200
28117 @itemx -mavx
28118 @opindex mavx
28119 @need 200
28120 @itemx -mavx2
28121 @opindex mavx2
28122 @need 200
28123 @itemx -mavx512f
28124 @opindex mavx512f
28125 @need 200
28126 @itemx -mavx512pf
28127 @opindex mavx512pf
28128 @need 200
28129 @itemx -mavx512er
28130 @opindex mavx512er
28131 @need 200
28132 @itemx -mavx512cd
28133 @opindex mavx512cd
28134 @need 200
28135 @itemx -mavx512vl
28136 @opindex mavx512vl
28137 @need 200
28138 @itemx -mavx512bw
28139 @opindex mavx512bw
28140 @need 200
28141 @itemx -mavx512dq
28142 @opindex mavx512dq
28143 @need 200
28144 @itemx -mavx512ifma
28145 @opindex mavx512ifma
28146 @need 200
28147 @itemx -mavx512vbmi
28148 @opindex mavx512vbmi
28149 @need 200
28150 @itemx -msha
28151 @opindex msha
28152 @need 200
28153 @itemx -maes
28154 @opindex maes
28155 @need 200
28156 @itemx -mpclmul
28157 @opindex mpclmul
28158 @need 200
28159 @itemx -mclflushopt
28160 @opindex mclflushopt
28161 @need 200
28162 @itemx -mclwb
28163 @opindex mclwb
28164 @need 200
28165 @itemx -mfsgsbase
28166 @opindex mfsgsbase
28167 @need 200
28168 @itemx -mptwrite
28169 @opindex mptwrite
28170 @need 200
28171 @itemx -mrdrnd
28172 @opindex mrdrnd
28173 @need 200
28174 @itemx -mf16c
28175 @opindex mf16c
28176 @need 200
28177 @itemx -mfma
28178 @opindex mfma
28179 @need 200
28180 @itemx -mpconfig
28181 @opindex mpconfig
28182 @need 200
28183 @itemx -mwbnoinvd
28184 @opindex mwbnoinvd
28185 @need 200
28186 @itemx -mfma4
28187 @opindex mfma4
28188 @need 200
28189 @itemx -mprfchw
28190 @opindex mprfchw
28191 @need 200
28192 @itemx -mrdpid
28193 @opindex mrdpid
28194 @need 200
28195 @itemx -mprefetchwt1
28196 @opindex mprefetchwt1
28197 @need 200
28198 @itemx -mrdseed
28199 @opindex mrdseed
28200 @need 200
28201 @itemx -msgx
28202 @opindex msgx
28203 @need 200
28204 @itemx -mxop
28205 @opindex mxop
28206 @need 200
28207 @itemx -mlwp
28208 @opindex mlwp
28209 @need 200
28210 @itemx -m3dnow
28211 @opindex m3dnow
28212 @need 200
28213 @itemx -m3dnowa
28214 @opindex m3dnowa
28215 @need 200
28216 @itemx -mpopcnt
28217 @opindex mpopcnt
28218 @need 200
28219 @itemx -mabm
28220 @opindex mabm
28221 @need 200
28222 @itemx -madx
28223 @opindex madx
28224 @need 200
28225 @itemx -mbmi
28226 @opindex mbmi
28227 @need 200
28228 @itemx -mbmi2
28229 @opindex mbmi2
28230 @need 200
28231 @itemx -mlzcnt
28232 @opindex mlzcnt
28233 @need 200
28234 @itemx -mfxsr
28235 @opindex mfxsr
28236 @need 200
28237 @itemx -mxsave
28238 @opindex mxsave
28239 @need 200
28240 @itemx -mxsaveopt
28241 @opindex mxsaveopt
28242 @need 200
28243 @itemx -mxsavec
28244 @opindex mxsavec
28245 @need 200
28246 @itemx -mxsaves
28247 @opindex mxsaves
28248 @need 200
28249 @itemx -mrtm
28250 @opindex mrtm
28251 @need 200
28252 @itemx -mhle
28253 @opindex mhle
28254 @need 200
28255 @itemx -mtbm
28256 @opindex mtbm
28257 @need 200
28258 @itemx -mmwaitx
28259 @opindex mmwaitx
28260 @need 200
28261 @itemx -mclzero
28262 @opindex mclzero
28263 @need 200
28264 @itemx -mpku
28265 @opindex mpku
28266 @need 200
28267 @itemx -mavx512vbmi2
28268 @opindex mavx512vbmi2
28269 @need 200
28270 @itemx -mavx512bf16
28271 @opindex mavx512bf16
28272 @need 200
28273 @itemx -mgfni
28274 @opindex mgfni
28275 @need 200
28276 @itemx -mvaes
28277 @opindex mvaes
28278 @need 200
28279 @itemx -mwaitpkg
28280 @opindex mwaitpkg
28281 @need 200
28282 @itemx -mvpclmulqdq
28283 @opindex mvpclmulqdq
28284 @need 200
28285 @itemx -mavx512bitalg
28286 @opindex mavx512bitalg
28287 @need 200
28288 @itemx -mmovdiri
28289 @opindex mmovdiri
28290 @need 200
28291 @itemx -mmovdir64b
28292 @opindex mmovdir64b
28293 @need 200
28294 @itemx -menqcmd
28295 @opindex menqcmd
28296 @need 200
28297 @itemx -mavx512vpopcntdq
28298 @opindex mavx512vpopcntdq
28299 @need 200
28300 @itemx -mavx512vp2intersect
28301 @opindex mavx512vp2intersect
28302 @need 200
28303 @itemx -mavx5124fmaps
28304 @opindex mavx5124fmaps
28305 @need 200
28306 @itemx -mavx512vnni
28307 @opindex mavx512vnni
28308 @need 200
28309 @itemx -mavx5124vnniw
28310 @opindex mavx5124vnniw
28311 @need 200
28312 @itemx -mcldemote
28313 @opindex mcldemote
28314 These switches enable the use of instructions in the MMX, SSE,
28315 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28316 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28317 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28318 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28319 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28320 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28321 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28322 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28323 extended instruction sets. Each has a corresponding @option{-mno-} option to
28324 disable use of these instructions.
28325
28326 These extensions are also available as built-in functions: see
28327 @ref{x86 Built-in Functions}, for details of the functions enabled and
28328 disabled by these switches.
28329
28330 To generate SSE/SSE2 instructions automatically from floating-point
28331 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28332
28333 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28334 generates new AVX instructions or AVX equivalence for all SSEx instructions
28335 when needed.
28336
28337 These options enable GCC to use these extended instructions in
28338 generated code, even without @option{-mfpmath=sse}. Applications that
28339 perform run-time CPU detection must compile separate files for each
28340 supported architecture, using the appropriate flags. In particular,
28341 the file containing the CPU detection code should be compiled without
28342 these options.
28343
28344 @item -mdump-tune-features
28345 @opindex mdump-tune-features
28346 This option instructs GCC to dump the names of the x86 performance
28347 tuning features and default settings. The names can be used in
28348 @option{-mtune-ctrl=@var{feature-list}}.
28349
28350 @item -mtune-ctrl=@var{feature-list}
28351 @opindex mtune-ctrl=@var{feature-list}
28352 This option is used to do fine grain control of x86 code generation features.
28353 @var{feature-list} is a comma separated list of @var{feature} names. See also
28354 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28355 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28356 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28357 developers. Using it may lead to code paths not covered by testing and can
28358 potentially result in compiler ICEs or runtime errors.
28359
28360 @item -mno-default
28361 @opindex mno-default
28362 This option instructs GCC to turn off all tunable features. See also
28363 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28364
28365 @item -mcld
28366 @opindex mcld
28367 This option instructs GCC to emit a @code{cld} instruction in the prologue
28368 of functions that use string instructions. String instructions depend on
28369 the DF flag to select between autoincrement or autodecrement mode. While the
28370 ABI specifies the DF flag to be cleared on function entry, some operating
28371 systems violate this specification by not clearing the DF flag in their
28372 exception dispatchers. The exception handler can be invoked with the DF flag
28373 set, which leads to wrong direction mode when string instructions are used.
28374 This option can be enabled by default on 32-bit x86 targets by configuring
28375 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28376 instructions can be suppressed with the @option{-mno-cld} compiler option
28377 in this case.
28378
28379 @item -mvzeroupper
28380 @opindex mvzeroupper
28381 This option instructs GCC to emit a @code{vzeroupper} instruction
28382 before a transfer of control flow out of the function to minimize
28383 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28384 intrinsics.
28385
28386 @item -mprefer-avx128
28387 @opindex mprefer-avx128
28388 This option instructs GCC to use 128-bit AVX instructions instead of
28389 256-bit AVX instructions in the auto-vectorizer.
28390
28391 @item -mprefer-vector-width=@var{opt}
28392 @opindex mprefer-vector-width
28393 This option instructs GCC to use @var{opt}-bit vector width in instructions
28394 instead of default on the selected platform.
28395
28396 @table @samp
28397 @item none
28398 No extra limitations applied to GCC other than defined by the selected platform.
28399
28400 @item 128
28401 Prefer 128-bit vector width for instructions.
28402
28403 @item 256
28404 Prefer 256-bit vector width for instructions.
28405
28406 @item 512
28407 Prefer 512-bit vector width for instructions.
28408 @end table
28409
28410 @item -mcx16
28411 @opindex mcx16
28412 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28413 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28414 objects. This is useful for atomic updates of data structures exceeding one
28415 machine word in size. The compiler uses this instruction to implement
28416 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28417 128-bit integers, a library call is always used.
28418
28419 @item -msahf
28420 @opindex msahf
28421 This option enables generation of @code{SAHF} instructions in 64-bit code.
28422 Early Intel Pentium 4 CPUs with Intel 64 support,
28423 prior to the introduction of Pentium 4 G1 step in December 2005,
28424 lacked the @code{LAHF} and @code{SAHF} instructions
28425 which are supported by AMD64.
28426 These are load and store instructions, respectively, for certain status flags.
28427 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28428 @code{drem}, and @code{remainder} built-in functions;
28429 see @ref{Other Builtins} for details.
28430
28431 @item -mmovbe
28432 @opindex mmovbe
28433 This option enables use of the @code{movbe} instruction to implement
28434 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28435
28436 @item -mshstk
28437 @opindex mshstk
28438 The @option{-mshstk} option enables shadow stack built-in functions
28439 from x86 Control-flow Enforcement Technology (CET).
28440
28441 @item -mcrc32
28442 @opindex mcrc32
28443 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28444 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28445 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28446
28447 @item -mrecip
28448 @opindex mrecip
28449 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28450 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28451 with an additional Newton-Raphson step
28452 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28453 (and their vectorized
28454 variants) for single-precision floating-point arguments. These instructions
28455 are generated only when @option{-funsafe-math-optimizations} is enabled
28456 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28457 Note that while the throughput of the sequence is higher than the throughput
28458 of the non-reciprocal instruction, the precision of the sequence can be
28459 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28460
28461 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28462 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28463 combination), and doesn't need @option{-mrecip}.
28464
28465 Also note that GCC emits the above sequence with additional Newton-Raphson step
28466 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28467 already with @option{-ffast-math} (or the above option combination), and
28468 doesn't need @option{-mrecip}.
28469
28470 @item -mrecip=@var{opt}
28471 @opindex mrecip=opt
28472 This option controls which reciprocal estimate instructions
28473 may be used. @var{opt} is a comma-separated list of options, which may
28474 be preceded by a @samp{!} to invert the option:
28475
28476 @table @samp
28477 @item all
28478 Enable all estimate instructions.
28479
28480 @item default
28481 Enable the default instructions, equivalent to @option{-mrecip}.
28482
28483 @item none
28484 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28485
28486 @item div
28487 Enable the approximation for scalar division.
28488
28489 @item vec-div
28490 Enable the approximation for vectorized division.
28491
28492 @item sqrt
28493 Enable the approximation for scalar square root.
28494
28495 @item vec-sqrt
28496 Enable the approximation for vectorized square root.
28497 @end table
28498
28499 So, for example, @option{-mrecip=all,!sqrt} enables
28500 all of the reciprocal approximations, except for square root.
28501
28502 @item -mveclibabi=@var{type}
28503 @opindex mveclibabi
28504 Specifies the ABI type to use for vectorizing intrinsics using an
28505 external library. Supported values for @var{type} are @samp{svml}
28506 for the Intel short
28507 vector math library and @samp{acml} for the AMD math core library.
28508 To use this option, both @option{-ftree-vectorize} and
28509 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28510 ABI-compatible library must be specified at link time.
28511
28512 GCC currently emits calls to @code{vmldExp2},
28513 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28514 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28515 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28516 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28517 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28518 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28519 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28520 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28521 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28522 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28523 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28524 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28525 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28526 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28527 when @option{-mveclibabi=acml} is used.
28528
28529 @item -mabi=@var{name}
28530 @opindex mabi
28531 Generate code for the specified calling convention. Permissible values
28532 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28533 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28534 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28535 You can control this behavior for specific functions by
28536 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28537 @xref{Function Attributes}.
28538
28539 @item -mforce-indirect-call
28540 @opindex mforce-indirect-call
28541 Force all calls to functions to be indirect. This is useful
28542 when using Intel Processor Trace where it generates more precise timing
28543 information for function calls.
28544
28545 @item -mmanual-endbr
28546 @opindex mmanual-endbr
28547 Insert ENDBR instruction at function entry only via the @code{cf_check}
28548 function attribute. This is useful when used with the option
28549 @option{-fcf-protection=branch} to control ENDBR insertion at the
28550 function entry.
28551
28552 @item -mcall-ms2sysv-xlogues
28553 @opindex mcall-ms2sysv-xlogues
28554 @opindex mno-call-ms2sysv-xlogues
28555 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28556 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28557 default, the code for saving and restoring these registers is emitted inline,
28558 resulting in fairly lengthy prologues and epilogues. Using
28559 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28560 use stubs in the static portion of libgcc to perform these saves and restores,
28561 thus reducing function size at the cost of a few extra instructions.
28562
28563 @item -mtls-dialect=@var{type}
28564 @opindex mtls-dialect
28565 Generate code to access thread-local storage using the @samp{gnu} or
28566 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28567 @samp{gnu2} is more efficient, but it may add compile- and run-time
28568 requirements that cannot be satisfied on all systems.
28569
28570 @item -mpush-args
28571 @itemx -mno-push-args
28572 @opindex mpush-args
28573 @opindex mno-push-args
28574 Use PUSH operations to store outgoing parameters. This method is shorter
28575 and usually equally fast as method using SUB/MOV operations and is enabled
28576 by default. In some cases disabling it may improve performance because of
28577 improved scheduling and reduced dependencies.
28578
28579 @item -maccumulate-outgoing-args
28580 @opindex maccumulate-outgoing-args
28581 If enabled, the maximum amount of space required for outgoing arguments is
28582 computed in the function prologue. This is faster on most modern CPUs
28583 because of reduced dependencies, improved scheduling and reduced stack usage
28584 when the preferred stack boundary is not equal to 2. The drawback is a notable
28585 increase in code size. This switch implies @option{-mno-push-args}.
28586
28587 @item -mthreads
28588 @opindex mthreads
28589 Support thread-safe exception handling on MinGW. Programs that rely
28590 on thread-safe exception handling must compile and link all code with the
28591 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28592 @option{-D_MT}; when linking, it links in a special thread helper library
28593 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28594
28595 @item -mms-bitfields
28596 @itemx -mno-ms-bitfields
28597 @opindex mms-bitfields
28598 @opindex mno-ms-bitfields
28599
28600 Enable/disable bit-field layout compatible with the native Microsoft
28601 Windows compiler.
28602
28603 If @code{packed} is used on a structure, or if bit-fields are used,
28604 it may be that the Microsoft ABI lays out the structure differently
28605 than the way GCC normally does. Particularly when moving packed
28606 data between functions compiled with GCC and the native Microsoft compiler
28607 (either via function call or as data in a file), it may be necessary to access
28608 either format.
28609
28610 This option is enabled by default for Microsoft Windows
28611 targets. This behavior can also be controlled locally by use of variable
28612 or type attributes. For more information, see @ref{x86 Variable Attributes}
28613 and @ref{x86 Type Attributes}.
28614
28615 The Microsoft structure layout algorithm is fairly simple with the exception
28616 of the bit-field packing.
28617 The padding and alignment of members of structures and whether a bit-field
28618 can straddle a storage-unit boundary are determine by these rules:
28619
28620 @enumerate
28621 @item Structure members are stored sequentially in the order in which they are
28622 declared: the first member has the lowest memory address and the last member
28623 the highest.
28624
28625 @item Every data object has an alignment requirement. The alignment requirement
28626 for all data except structures, unions, and arrays is either the size of the
28627 object or the current packing size (specified with either the
28628 @code{aligned} attribute or the @code{pack} pragma),
28629 whichever is less. For structures, unions, and arrays,
28630 the alignment requirement is the largest alignment requirement of its members.
28631 Every object is allocated an offset so that:
28632
28633 @smallexample
28634 offset % alignment_requirement == 0
28635 @end smallexample
28636
28637 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28638 unit if the integral types are the same size and if the next bit-field fits
28639 into the current allocation unit without crossing the boundary imposed by the
28640 common alignment requirements of the bit-fields.
28641 @end enumerate
28642
28643 MSVC interprets zero-length bit-fields in the following ways:
28644
28645 @enumerate
28646 @item If a zero-length bit-field is inserted between two bit-fields that
28647 are normally coalesced, the bit-fields are not coalesced.
28648
28649 For example:
28650
28651 @smallexample
28652 struct
28653 @{
28654 unsigned long bf_1 : 12;
28655 unsigned long : 0;
28656 unsigned long bf_2 : 12;
28657 @} t1;
28658 @end smallexample
28659
28660 @noindent
28661 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28662 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28663
28664 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28665 alignment of the zero-length bit-field is greater than the member that follows it,
28666 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28667
28668 For example:
28669
28670 @smallexample
28671 struct
28672 @{
28673 char foo : 4;
28674 short : 0;
28675 char bar;
28676 @} t2;
28677
28678 struct
28679 @{
28680 char foo : 4;
28681 short : 0;
28682 double bar;
28683 @} t3;
28684 @end smallexample
28685
28686 @noindent
28687 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28688 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28689 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28690 of the structure.
28691
28692 Taking this into account, it is important to note the following:
28693
28694 @enumerate
28695 @item If a zero-length bit-field follows a normal bit-field, the type of the
28696 zero-length bit-field may affect the alignment of the structure as whole. For
28697 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28698 normal bit-field, and is of type short.
28699
28700 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28701 still affect the alignment of the structure:
28702
28703 @smallexample
28704 struct
28705 @{
28706 char foo : 6;
28707 long : 0;
28708 @} t4;
28709 @end smallexample
28710
28711 @noindent
28712 Here, @code{t4} takes up 4 bytes.
28713 @end enumerate
28714
28715 @item Zero-length bit-fields following non-bit-field members are ignored:
28716
28717 @smallexample
28718 struct
28719 @{
28720 char foo;
28721 long : 0;
28722 char bar;
28723 @} t5;
28724 @end smallexample
28725
28726 @noindent
28727 Here, @code{t5} takes up 2 bytes.
28728 @end enumerate
28729
28730
28731 @item -mno-align-stringops
28732 @opindex mno-align-stringops
28733 @opindex malign-stringops
28734 Do not align the destination of inlined string operations. This switch reduces
28735 code size and improves performance in case the destination is already aligned,
28736 but GCC doesn't know about it.
28737
28738 @item -minline-all-stringops
28739 @opindex minline-all-stringops
28740 By default GCC inlines string operations only when the destination is
28741 known to be aligned to least a 4-byte boundary.
28742 This enables more inlining and increases code
28743 size, but may improve performance of code that depends on fast
28744 @code{memcpy} and @code{memset} for short lengths.
28745 The option enables inline expansion of @code{strlen} for all
28746 pointer alignments.
28747
28748 @item -minline-stringops-dynamically
28749 @opindex minline-stringops-dynamically
28750 For string operations of unknown size, use run-time checks with
28751 inline code for small blocks and a library call for large blocks.
28752
28753 @item -mstringop-strategy=@var{alg}
28754 @opindex mstringop-strategy=@var{alg}
28755 Override the internal decision heuristic for the particular algorithm to use
28756 for inlining string operations. The allowed values for @var{alg} are:
28757
28758 @table @samp
28759 @item rep_byte
28760 @itemx rep_4byte
28761 @itemx rep_8byte
28762 Expand using i386 @code{rep} prefix of the specified size.
28763
28764 @item byte_loop
28765 @itemx loop
28766 @itemx unrolled_loop
28767 Expand into an inline loop.
28768
28769 @item libcall
28770 Always use a library call.
28771 @end table
28772
28773 @item -mmemcpy-strategy=@var{strategy}
28774 @opindex mmemcpy-strategy=@var{strategy}
28775 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28776 should be inlined and what inline algorithm to use when the expected size
28777 of the copy operation is known. @var{strategy}
28778 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28779 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28780 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28781 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28782 in the list must be specified in increasing order. The minimal byte size for
28783 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28784 preceding range.
28785
28786 @item -mmemset-strategy=@var{strategy}
28787 @opindex mmemset-strategy=@var{strategy}
28788 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28789 @code{__builtin_memset} expansion.
28790
28791 @item -momit-leaf-frame-pointer
28792 @opindex momit-leaf-frame-pointer
28793 Don't keep the frame pointer in a register for leaf functions. This
28794 avoids the instructions to save, set up, and restore frame pointers and
28795 makes an extra register available in leaf functions. The option
28796 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28797 which might make debugging harder.
28798
28799 @item -mtls-direct-seg-refs
28800 @itemx -mno-tls-direct-seg-refs
28801 @opindex mtls-direct-seg-refs
28802 Controls whether TLS variables may be accessed with offsets from the
28803 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28804 or whether the thread base pointer must be added. Whether or not this
28805 is valid depends on the operating system, and whether it maps the
28806 segment to cover the entire TLS area.
28807
28808 For systems that use the GNU C Library, the default is on.
28809
28810 @item -msse2avx
28811 @itemx -mno-sse2avx
28812 @opindex msse2avx
28813 Specify that the assembler should encode SSE instructions with VEX
28814 prefix. The option @option{-mavx} turns this on by default.
28815
28816 @item -mfentry
28817 @itemx -mno-fentry
28818 @opindex mfentry
28819 If profiling is active (@option{-pg}), put the profiling
28820 counter call before the prologue.
28821 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28822 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28823
28824 @item -mrecord-mcount
28825 @itemx -mno-record-mcount
28826 @opindex mrecord-mcount
28827 If profiling is active (@option{-pg}), generate a __mcount_loc section
28828 that contains pointers to each profiling call. This is useful for
28829 automatically patching and out calls.
28830
28831 @item -mnop-mcount
28832 @itemx -mno-nop-mcount
28833 @opindex mnop-mcount
28834 If profiling is active (@option{-pg}), generate the calls to
28835 the profiling functions as NOPs. This is useful when they
28836 should be patched in later dynamically. This is likely only
28837 useful together with @option{-mrecord-mcount}.
28838
28839 @item -minstrument-return=@var{type}
28840 @opindex minstrument-return
28841 Instrument function exit in -pg -mfentry instrumented functions with
28842 call to specified function. This only instruments true returns ending
28843 with ret, but not sibling calls ending with jump. Valid types
28844 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28845 or @var{nop5} to generate a 5 byte nop.
28846
28847 @item -mrecord-return
28848 @itemx -mno-record-return
28849 @opindex mrecord-return
28850 Generate a __return_loc section pointing to all return instrumentation code.
28851
28852 @item -mfentry-name=@var{name}
28853 @opindex mfentry-name
28854 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28855
28856 @item -mfentry-section=@var{name}
28857 @opindex mfentry-section
28858 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28859
28860 @item -mskip-rax-setup
28861 @itemx -mno-skip-rax-setup
28862 @opindex mskip-rax-setup
28863 When generating code for the x86-64 architecture with SSE extensions
28864 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28865 register when there are no variable arguments passed in vector registers.
28866
28867 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28868 saving vector registers on stack when passing variable arguments, the
28869 impacts of this option are callees may waste some stack space,
28870 misbehave or jump to a random location. GCC 4.4 or newer don't have
28871 those issues, regardless the RAX register value.
28872
28873 @item -m8bit-idiv
28874 @itemx -mno-8bit-idiv
28875 @opindex m8bit-idiv
28876 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28877 much faster than 32-bit/64-bit integer divide. This option generates a
28878 run-time check. If both dividend and divisor are within range of 0
28879 to 255, 8-bit unsigned integer divide is used instead of
28880 32-bit/64-bit integer divide.
28881
28882 @item -mavx256-split-unaligned-load
28883 @itemx -mavx256-split-unaligned-store
28884 @opindex mavx256-split-unaligned-load
28885 @opindex mavx256-split-unaligned-store
28886 Split 32-byte AVX unaligned load and store.
28887
28888 @item -mstack-protector-guard=@var{guard}
28889 @itemx -mstack-protector-guard-reg=@var{reg}
28890 @itemx -mstack-protector-guard-offset=@var{offset}
28891 @opindex mstack-protector-guard
28892 @opindex mstack-protector-guard-reg
28893 @opindex mstack-protector-guard-offset
28894 Generate stack protection code using canary at @var{guard}. Supported
28895 locations are @samp{global} for global canary or @samp{tls} for per-thread
28896 canary in the TLS block (the default). This option has effect only when
28897 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28898
28899 With the latter choice the options
28900 @option{-mstack-protector-guard-reg=@var{reg}} and
28901 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28902 which segment register (@code{%fs} or @code{%gs}) to use as base register
28903 for reading the canary, and from what offset from that base register.
28904 The default for those is as specified in the relevant ABI.
28905
28906 @item -mgeneral-regs-only
28907 @opindex mgeneral-regs-only
28908 Generate code that uses only the general-purpose registers. This
28909 prevents the compiler from using floating-point, vector, mask and bound
28910 registers.
28911
28912 @item -mindirect-branch=@var{choice}
28913 @opindex mindirect-branch
28914 Convert indirect call and jump with @var{choice}. The default is
28915 @samp{keep}, which keeps indirect call and jump unmodified.
28916 @samp{thunk} converts indirect call and jump to call and return thunk.
28917 @samp{thunk-inline} converts indirect call and jump to inlined call
28918 and return thunk. @samp{thunk-extern} converts indirect call and jump
28919 to external call and return thunk provided in a separate object file.
28920 You can control this behavior for a specific function by using the
28921 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28922
28923 Note that @option{-mcmodel=large} is incompatible with
28924 @option{-mindirect-branch=thunk} and
28925 @option{-mindirect-branch=thunk-extern} since the thunk function may
28926 not be reachable in the large code model.
28927
28928 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28929 @option{-fcf-protection=branch} since the external thunk cannot be modified
28930 to disable control-flow check.
28931
28932 @item -mfunction-return=@var{choice}
28933 @opindex mfunction-return
28934 Convert function return with @var{choice}. The default is @samp{keep},
28935 which keeps function return unmodified. @samp{thunk} converts function
28936 return to call and return thunk. @samp{thunk-inline} converts function
28937 return to inlined call and return thunk. @samp{thunk-extern} converts
28938 function return to external call and return thunk provided in a separate
28939 object file. You can control this behavior for a specific function by
28940 using the function attribute @code{function_return}.
28941 @xref{Function Attributes}.
28942
28943 Note that @option{-mcmodel=large} is incompatible with
28944 @option{-mfunction-return=thunk} and
28945 @option{-mfunction-return=thunk-extern} since the thunk function may
28946 not be reachable in the large code model.
28947
28948
28949 @item -mindirect-branch-register
28950 @opindex mindirect-branch-register
28951 Force indirect call and jump via register.
28952
28953 @end table
28954
28955 These @samp{-m} switches are supported in addition to the above
28956 on x86-64 processors in 64-bit environments.
28957
28958 @table @gcctabopt
28959 @item -m32
28960 @itemx -m64
28961 @itemx -mx32
28962 @itemx -m16
28963 @itemx -miamcu
28964 @opindex m32
28965 @opindex m64
28966 @opindex mx32
28967 @opindex m16
28968 @opindex miamcu
28969 Generate code for a 16-bit, 32-bit or 64-bit environment.
28970 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28971 to 32 bits, and
28972 generates code that runs on any i386 system.
28973
28974 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28975 types to 64 bits, and generates code for the x86-64 architecture.
28976 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28977 and @option{-mdynamic-no-pic} options.
28978
28979 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28980 to 32 bits, and
28981 generates code for the x86-64 architecture.
28982
28983 The @option{-m16} option is the same as @option{-m32}, except for that
28984 it outputs the @code{.code16gcc} assembly directive at the beginning of
28985 the assembly output so that the binary can run in 16-bit mode.
28986
28987 The @option{-miamcu} option generates code which conforms to Intel MCU
28988 psABI. It requires the @option{-m32} option to be turned on.
28989
28990 @item -mno-red-zone
28991 @opindex mno-red-zone
28992 @opindex mred-zone
28993 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28994 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28995 stack pointer that is not modified by signal or interrupt handlers
28996 and therefore can be used for temporary data without adjusting the stack
28997 pointer. The flag @option{-mno-red-zone} disables this red zone.
28998
28999 @item -mcmodel=small
29000 @opindex mcmodel=small
29001 Generate code for the small code model: the program and its symbols must
29002 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
29003 Programs can be statically or dynamically linked. This is the default
29004 code model.
29005
29006 @item -mcmodel=kernel
29007 @opindex mcmodel=kernel
29008 Generate code for the kernel code model. The kernel runs in the
29009 negative 2 GB of the address space.
29010 This model has to be used for Linux kernel code.
29011
29012 @item -mcmodel=medium
29013 @opindex mcmodel=medium
29014 Generate code for the medium model: the program is linked in the lower 2
29015 GB of the address space. Small symbols are also placed there. Symbols
29016 with sizes larger than @option{-mlarge-data-threshold} are put into
29017 large data or BSS sections and can be located above 2GB. Programs can
29018 be statically or dynamically linked.
29019
29020 @item -mcmodel=large
29021 @opindex mcmodel=large
29022 Generate code for the large model. This model makes no assumptions
29023 about addresses and sizes of sections.
29024
29025 @item -maddress-mode=long
29026 @opindex maddress-mode=long
29027 Generate code for long address mode. This is only supported for 64-bit
29028 and x32 environments. It is the default address mode for 64-bit
29029 environments.
29030
29031 @item -maddress-mode=short
29032 @opindex maddress-mode=short
29033 Generate code for short address mode. This is only supported for 32-bit
29034 and x32 environments. It is the default address mode for 32-bit and
29035 x32 environments.
29036 @end table
29037
29038 @node x86 Windows Options
29039 @subsection x86 Windows Options
29040 @cindex x86 Windows Options
29041 @cindex Windows Options for x86
29042
29043 These additional options are available for Microsoft Windows targets:
29044
29045 @table @gcctabopt
29046 @item -mconsole
29047 @opindex mconsole
29048 This option
29049 specifies that a console application is to be generated, by
29050 instructing the linker to set the PE header subsystem type
29051 required for console applications.
29052 This option is available for Cygwin and MinGW targets and is
29053 enabled by default on those targets.
29054
29055 @item -mdll
29056 @opindex mdll
29057 This option is available for Cygwin and MinGW targets. It
29058 specifies that a DLL---a dynamic link library---is to be
29059 generated, enabling the selection of the required runtime
29060 startup object and entry point.
29061
29062 @item -mnop-fun-dllimport
29063 @opindex mnop-fun-dllimport
29064 This option is available for Cygwin and MinGW targets. It
29065 specifies that the @code{dllimport} attribute should be ignored.
29066
29067 @item -mthread
29068 @opindex mthread
29069 This option is available for MinGW targets. It specifies
29070 that MinGW-specific thread support is to be used.
29071
29072 @item -municode
29073 @opindex municode
29074 This option is available for MinGW-w64 targets. It causes
29075 the @code{UNICODE} preprocessor macro to be predefined, and
29076 chooses Unicode-capable runtime startup code.
29077
29078 @item -mwin32
29079 @opindex mwin32
29080 This option is available for Cygwin and MinGW targets. It
29081 specifies that the typical Microsoft Windows predefined macros are to
29082 be set in the pre-processor, but does not influence the choice
29083 of runtime library/startup code.
29084
29085 @item -mwindows
29086 @opindex mwindows
29087 This option is available for Cygwin and MinGW targets. It
29088 specifies that a GUI application is to be generated by
29089 instructing the linker to set the PE header subsystem type
29090 appropriately.
29091
29092 @item -fno-set-stack-executable
29093 @opindex fno-set-stack-executable
29094 @opindex fset-stack-executable
29095 This option is available for MinGW targets. It specifies that
29096 the executable flag for the stack used by nested functions isn't
29097 set. This is necessary for binaries running in kernel mode of
29098 Microsoft Windows, as there the User32 API, which is used to set executable
29099 privileges, isn't available.
29100
29101 @item -fwritable-relocated-rdata
29102 @opindex fno-writable-relocated-rdata
29103 @opindex fwritable-relocated-rdata
29104 This option is available for MinGW and Cygwin targets. It specifies
29105 that relocated-data in read-only section is put into the @code{.data}
29106 section. This is a necessary for older runtimes not supporting
29107 modification of @code{.rdata} sections for pseudo-relocation.
29108
29109 @item -mpe-aligned-commons
29110 @opindex mpe-aligned-commons
29111 This option is available for Cygwin and MinGW targets. It
29112 specifies that the GNU extension to the PE file format that
29113 permits the correct alignment of COMMON variables should be
29114 used when generating code. It is enabled by default if
29115 GCC detects that the target assembler found during configuration
29116 supports the feature.
29117 @end table
29118
29119 See also under @ref{x86 Options} for standard options.
29120
29121 @node Xstormy16 Options
29122 @subsection Xstormy16 Options
29123 @cindex Xstormy16 Options
29124
29125 These options are defined for Xstormy16:
29126
29127 @table @gcctabopt
29128 @item -msim
29129 @opindex msim
29130 Choose startup files and linker script suitable for the simulator.
29131 @end table
29132
29133 @node Xtensa Options
29134 @subsection Xtensa Options
29135 @cindex Xtensa Options
29136
29137 These options are supported for Xtensa targets:
29138
29139 @table @gcctabopt
29140 @item -mconst16
29141 @itemx -mno-const16
29142 @opindex mconst16
29143 @opindex mno-const16
29144 Enable or disable use of @code{CONST16} instructions for loading
29145 constant values. The @code{CONST16} instruction is currently not a
29146 standard option from Tensilica. When enabled, @code{CONST16}
29147 instructions are always used in place of the standard @code{L32R}
29148 instructions. The use of @code{CONST16} is enabled by default only if
29149 the @code{L32R} instruction is not available.
29150
29151 @item -mfused-madd
29152 @itemx -mno-fused-madd
29153 @opindex mfused-madd
29154 @opindex mno-fused-madd
29155 Enable or disable use of fused multiply/add and multiply/subtract
29156 instructions in the floating-point option. This has no effect if the
29157 floating-point option is not also enabled. Disabling fused multiply/add
29158 and multiply/subtract instructions forces the compiler to use separate
29159 instructions for the multiply and add/subtract operations. This may be
29160 desirable in some cases where strict IEEE 754-compliant results are
29161 required: the fused multiply add/subtract instructions do not round the
29162 intermediate result, thereby producing results with @emph{more} bits of
29163 precision than specified by the IEEE standard. Disabling fused multiply
29164 add/subtract instructions also ensures that the program output is not
29165 sensitive to the compiler's ability to combine multiply and add/subtract
29166 operations.
29167
29168 @item -mserialize-volatile
29169 @itemx -mno-serialize-volatile
29170 @opindex mserialize-volatile
29171 @opindex mno-serialize-volatile
29172 When this option is enabled, GCC inserts @code{MEMW} instructions before
29173 @code{volatile} memory references to guarantee sequential consistency.
29174 The default is @option{-mserialize-volatile}. Use
29175 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29176
29177 @item -mforce-no-pic
29178 @opindex mforce-no-pic
29179 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29180 position-independent code (PIC), this option disables PIC for compiling
29181 kernel code.
29182
29183 @item -mtext-section-literals
29184 @itemx -mno-text-section-literals
29185 @opindex mtext-section-literals
29186 @opindex mno-text-section-literals
29187 These options control the treatment of literal pools. The default is
29188 @option{-mno-text-section-literals}, which places literals in a separate
29189 section in the output file. This allows the literal pool to be placed
29190 in a data RAM/ROM, and it also allows the linker to combine literal
29191 pools from separate object files to remove redundant literals and
29192 improve code size. With @option{-mtext-section-literals}, the literals
29193 are interspersed in the text section in order to keep them as close as
29194 possible to their references. This may be necessary for large assembly
29195 files. Literals for each function are placed right before that function.
29196
29197 @item -mauto-litpools
29198 @itemx -mno-auto-litpools
29199 @opindex mauto-litpools
29200 @opindex mno-auto-litpools
29201 These options control the treatment of literal pools. The default is
29202 @option{-mno-auto-litpools}, which places literals in a separate
29203 section in the output file unless @option{-mtext-section-literals} is
29204 used. With @option{-mauto-litpools} the literals are interspersed in
29205 the text section by the assembler. Compiler does not produce explicit
29206 @code{.literal} directives and loads literals into registers with
29207 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29208 do relaxation and place literals as necessary. This option allows
29209 assembler to create several literal pools per function and assemble
29210 very big functions, which may not be possible with
29211 @option{-mtext-section-literals}.
29212
29213 @item -mtarget-align
29214 @itemx -mno-target-align
29215 @opindex mtarget-align
29216 @opindex mno-target-align
29217 When this option is enabled, GCC instructs the assembler to
29218 automatically align instructions to reduce branch penalties at the
29219 expense of some code density. The assembler attempts to widen density
29220 instructions to align branch targets and the instructions following call
29221 instructions. If there are not enough preceding safe density
29222 instructions to align a target, no widening is performed. The
29223 default is @option{-mtarget-align}. These options do not affect the
29224 treatment of auto-aligned instructions like @code{LOOP}, which the
29225 assembler always aligns, either by widening density instructions or
29226 by inserting NOP instructions.
29227
29228 @item -mlongcalls
29229 @itemx -mno-longcalls
29230 @opindex mlongcalls
29231 @opindex mno-longcalls
29232 When this option is enabled, GCC instructs the assembler to translate
29233 direct calls to indirect calls unless it can determine that the target
29234 of a direct call is in the range allowed by the call instruction. This
29235 translation typically occurs for calls to functions in other source
29236 files. Specifically, the assembler translates a direct @code{CALL}
29237 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29238 The default is @option{-mno-longcalls}. This option should be used in
29239 programs where the call target can potentially be out of range. This
29240 option is implemented in the assembler, not the compiler, so the
29241 assembly code generated by GCC still shows direct call
29242 instructions---look at the disassembled object code to see the actual
29243 instructions. Note that the assembler uses an indirect call for
29244 every cross-file call, not just those that really are out of range.
29245 @end table
29246
29247 @node zSeries Options
29248 @subsection zSeries Options
29249 @cindex zSeries options
29250
29251 These are listed under @xref{S/390 and zSeries Options}.
29252
29253
29254 @c man end
29255
29256 @node Spec Files
29257 @section Specifying Subprocesses and the Switches to Pass to Them
29258 @cindex Spec Files
29259
29260 @command{gcc} is a driver program. It performs its job by invoking a
29261 sequence of other programs to do the work of compiling, assembling and
29262 linking. GCC interprets its command-line parameters and uses these to
29263 deduce which programs it should invoke, and which command-line options
29264 it ought to place on their command lines. This behavior is controlled
29265 by @dfn{spec strings}. In most cases there is one spec string for each
29266 program that GCC can invoke, but a few programs have multiple spec
29267 strings to control their behavior. The spec strings built into GCC can
29268 be overridden by using the @option{-specs=} command-line switch to specify
29269 a spec file.
29270
29271 @dfn{Spec files} are plain-text files that are used to construct spec
29272 strings. They consist of a sequence of directives separated by blank
29273 lines. The type of directive is determined by the first non-whitespace
29274 character on the line, which can be one of the following:
29275
29276 @table @code
29277 @item %@var{command}
29278 Issues a @var{command} to the spec file processor. The commands that can
29279 appear here are:
29280
29281 @table @code
29282 @item %include <@var{file}>
29283 @cindex @code{%include}
29284 Search for @var{file} and insert its text at the current point in the
29285 specs file.
29286
29287 @item %include_noerr <@var{file}>
29288 @cindex @code{%include_noerr}
29289 Just like @samp{%include}, but do not generate an error message if the include
29290 file cannot be found.
29291
29292 @item %rename @var{old_name} @var{new_name}
29293 @cindex @code{%rename}
29294 Rename the spec string @var{old_name} to @var{new_name}.
29295
29296 @end table
29297
29298 @item *[@var{spec_name}]:
29299 This tells the compiler to create, override or delete the named spec
29300 string. All lines after this directive up to the next directive or
29301 blank line are considered to be the text for the spec string. If this
29302 results in an empty string then the spec is deleted. (Or, if the
29303 spec did not exist, then nothing happens.) Otherwise, if the spec
29304 does not currently exist a new spec is created. If the spec does
29305 exist then its contents are overridden by the text of this
29306 directive, unless the first character of that text is the @samp{+}
29307 character, in which case the text is appended to the spec.
29308
29309 @item [@var{suffix}]:
29310 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29311 and up to the next directive or blank line are considered to make up the
29312 spec string for the indicated suffix. When the compiler encounters an
29313 input file with the named suffix, it processes the spec string in
29314 order to work out how to compile that file. For example:
29315
29316 @smallexample
29317 .ZZ:
29318 z-compile -input %i
29319 @end smallexample
29320
29321 This says that any input file whose name ends in @samp{.ZZ} should be
29322 passed to the program @samp{z-compile}, which should be invoked with the
29323 command-line switch @option{-input} and with the result of performing the
29324 @samp{%i} substitution. (See below.)
29325
29326 As an alternative to providing a spec string, the text following a
29327 suffix directive can be one of the following:
29328
29329 @table @code
29330 @item @@@var{language}
29331 This says that the suffix is an alias for a known @var{language}. This is
29332 similar to using the @option{-x} command-line switch to GCC to specify a
29333 language explicitly. For example:
29334
29335 @smallexample
29336 .ZZ:
29337 @@c++
29338 @end smallexample
29339
29340 Says that .ZZ files are, in fact, C++ source files.
29341
29342 @item #@var{name}
29343 This causes an error messages saying:
29344
29345 @smallexample
29346 @var{name} compiler not installed on this system.
29347 @end smallexample
29348 @end table
29349
29350 GCC already has an extensive list of suffixes built into it.
29351 This directive adds an entry to the end of the list of suffixes, but
29352 since the list is searched from the end backwards, it is effectively
29353 possible to override earlier entries using this technique.
29354
29355 @end table
29356
29357 GCC has the following spec strings built into it. Spec files can
29358 override these strings or create their own. Note that individual
29359 targets can also add their own spec strings to this list.
29360
29361 @smallexample
29362 asm Options to pass to the assembler
29363 asm_final Options to pass to the assembler post-processor
29364 cpp Options to pass to the C preprocessor
29365 cc1 Options to pass to the C compiler
29366 cc1plus Options to pass to the C++ compiler
29367 endfile Object files to include at the end of the link
29368 link Options to pass to the linker
29369 lib Libraries to include on the command line to the linker
29370 libgcc Decides which GCC support library to pass to the linker
29371 linker Sets the name of the linker
29372 predefines Defines to be passed to the C preprocessor
29373 signed_char Defines to pass to CPP to say whether @code{char} is signed
29374 by default
29375 startfile Object files to include at the start of the link
29376 @end smallexample
29377
29378 Here is a small example of a spec file:
29379
29380 @smallexample
29381 %rename lib old_lib
29382
29383 *lib:
29384 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29385 @end smallexample
29386
29387 This example renames the spec called @samp{lib} to @samp{old_lib} and
29388 then overrides the previous definition of @samp{lib} with a new one.
29389 The new definition adds in some extra command-line options before
29390 including the text of the old definition.
29391
29392 @dfn{Spec strings} are a list of command-line options to be passed to their
29393 corresponding program. In addition, the spec strings can contain
29394 @samp{%}-prefixed sequences to substitute variable text or to
29395 conditionally insert text into the command line. Using these constructs
29396 it is possible to generate quite complex command lines.
29397
29398 Here is a table of all defined @samp{%}-sequences for spec
29399 strings. Note that spaces are not generated automatically around the
29400 results of expanding these sequences. Therefore you can concatenate them
29401 together or combine them with constant text in a single argument.
29402
29403 @table @code
29404 @item %%
29405 Substitute one @samp{%} into the program name or argument.
29406
29407 @item %i
29408 Substitute the name of the input file being processed.
29409
29410 @item %b
29411 Substitute the basename of the input file being processed.
29412 This is the substring up to (and not including) the last period
29413 and not including the directory.
29414
29415 @item %B
29416 This is the same as @samp{%b}, but include the file suffix (text after
29417 the last period).
29418
29419 @item %d
29420 Marks the argument containing or following the @samp{%d} as a
29421 temporary file name, so that that file is deleted if GCC exits
29422 successfully. Unlike @samp{%g}, this contributes no text to the
29423 argument.
29424
29425 @item %g@var{suffix}
29426 Substitute a file name that has suffix @var{suffix} and is chosen
29427 once per compilation, and mark the argument in the same way as
29428 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29429 name is now chosen in a way that is hard to predict even when previously
29430 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29431 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29432 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29433 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29434 was simply substituted with a file name chosen once per compilation,
29435 without regard to any appended suffix (which was therefore treated
29436 just like ordinary text), making such attacks more likely to succeed.
29437
29438 @item %u@var{suffix}
29439 Like @samp{%g}, but generates a new temporary file name
29440 each time it appears instead of once per compilation.
29441
29442 @item %U@var{suffix}
29443 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29444 new one if there is no such last file name. In the absence of any
29445 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29446 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29447 involves the generation of two distinct file names, one
29448 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29449 simply substituted with a file name chosen for the previous @samp{%u},
29450 without regard to any appended suffix.
29451
29452 @item %j@var{suffix}
29453 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29454 writable, and if @option{-save-temps} is not used;
29455 otherwise, substitute the name
29456 of a temporary file, just like @samp{%u}. This temporary file is not
29457 meant for communication between processes, but rather as a junk
29458 disposal mechanism.
29459
29460 @item %|@var{suffix}
29461 @itemx %m@var{suffix}
29462 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29463 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29464 all. These are the two most common ways to instruct a program that it
29465 should read from standard input or write to standard output. If you
29466 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29467 construct: see for example @file{gcc/fortran/lang-specs.h}.
29468
29469 @item %.@var{SUFFIX}
29470 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29471 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29472 terminated by the next space or %.
29473
29474 @item %w
29475 Marks the argument containing or following the @samp{%w} as the
29476 designated output file of this compilation. This puts the argument
29477 into the sequence of arguments that @samp{%o} substitutes.
29478
29479 @item %o
29480 Substitutes the names of all the output files, with spaces
29481 automatically placed around them. You should write spaces
29482 around the @samp{%o} as well or the results are undefined.
29483 @samp{%o} is for use in the specs for running the linker.
29484 Input files whose names have no recognized suffix are not compiled
29485 at all, but they are included among the output files, so they are
29486 linked.
29487
29488 @item %O
29489 Substitutes the suffix for object files. Note that this is
29490 handled specially when it immediately follows @samp{%g, %u, or %U},
29491 because of the need for those to form complete file names. The
29492 handling is such that @samp{%O} is treated exactly as if it had already
29493 been substituted, except that @samp{%g, %u, and %U} do not currently
29494 support additional @var{suffix} characters following @samp{%O} as they do
29495 following, for example, @samp{.o}.
29496
29497 @item %p
29498 Substitutes the standard macro predefinitions for the
29499 current target machine. Use this when running @command{cpp}.
29500
29501 @item %P
29502 Like @samp{%p}, but puts @samp{__} before and after the name of each
29503 predefined macro, except for macros that start with @samp{__} or with
29504 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29505 C@.
29506
29507 @item %I
29508 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29509 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29510 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29511 and @option{-imultilib} as necessary.
29512
29513 @item %s
29514 Current argument is the name of a library or startup file of some sort.
29515 Search for that file in a standard list of directories and substitute
29516 the full name found. The current working directory is included in the
29517 list of directories scanned.
29518
29519 @item %T
29520 Current argument is the name of a linker script. Search for that file
29521 in the current list of directories to scan for libraries. If the file
29522 is located insert a @option{--script} option into the command line
29523 followed by the full path name found. If the file is not found then
29524 generate an error message. Note: the current working directory is not
29525 searched.
29526
29527 @item %e@var{str}
29528 Print @var{str} as an error message. @var{str} is terminated by a newline.
29529 Use this when inconsistent options are detected.
29530
29531 @item %(@var{name})
29532 Substitute the contents of spec string @var{name} at this point.
29533
29534 @item %x@{@var{option}@}
29535 Accumulate an option for @samp{%X}.
29536
29537 @item %X
29538 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29539 spec string.
29540
29541 @item %Y
29542 Output the accumulated assembler options specified by @option{-Wa}.
29543
29544 @item %Z
29545 Output the accumulated preprocessor options specified by @option{-Wp}.
29546
29547 @item %a
29548 Process the @code{asm} spec. This is used to compute the
29549 switches to be passed to the assembler.
29550
29551 @item %A
29552 Process the @code{asm_final} spec. This is a spec string for
29553 passing switches to an assembler post-processor, if such a program is
29554 needed.
29555
29556 @item %l
29557 Process the @code{link} spec. This is the spec for computing the
29558 command line passed to the linker. Typically it makes use of the
29559 @samp{%L %G %S %D and %E} sequences.
29560
29561 @item %D
29562 Dump out a @option{-L} option for each directory that GCC believes might
29563 contain startup files. If the target supports multilibs then the
29564 current multilib directory is prepended to each of these paths.
29565
29566 @item %L
29567 Process the @code{lib} spec. This is a spec string for deciding which
29568 libraries are included on the command line to the linker.
29569
29570 @item %G
29571 Process the @code{libgcc} spec. This is a spec string for deciding
29572 which GCC support library is included on the command line to the linker.
29573
29574 @item %S
29575 Process the @code{startfile} spec. This is a spec for deciding which
29576 object files are the first ones passed to the linker. Typically
29577 this might be a file named @file{crt0.o}.
29578
29579 @item %E
29580 Process the @code{endfile} spec. This is a spec string that specifies
29581 the last object files that are passed to the linker.
29582
29583 @item %C
29584 Process the @code{cpp} spec. This is used to construct the arguments
29585 to be passed to the C preprocessor.
29586
29587 @item %1
29588 Process the @code{cc1} spec. This is used to construct the options to be
29589 passed to the actual C compiler (@command{cc1}).
29590
29591 @item %2
29592 Process the @code{cc1plus} spec. This is used to construct the options to be
29593 passed to the actual C++ compiler (@command{cc1plus}).
29594
29595 @item %*
29596 Substitute the variable part of a matched option. See below.
29597 Note that each comma in the substituted string is replaced by
29598 a single space.
29599
29600 @item %<S
29601 Remove all occurrences of @code{-S} from the command line. Note---this
29602 command is position dependent. @samp{%} commands in the spec string
29603 before this one see @code{-S}, @samp{%} commands in the spec string
29604 after this one do not.
29605
29606 @item %:@var{function}(@var{args})
29607 Call the named function @var{function}, passing it @var{args}.
29608 @var{args} is first processed as a nested spec string, then split
29609 into an argument vector in the usual fashion. The function returns
29610 a string which is processed as if it had appeared literally as part
29611 of the current spec.
29612
29613 The following built-in spec functions are provided:
29614
29615 @table @code
29616 @item @code{getenv}
29617 The @code{getenv} spec function takes two arguments: an environment
29618 variable name and a string. If the environment variable is not
29619 defined, a fatal error is issued. Otherwise, the return value is the
29620 value of the environment variable concatenated with the string. For
29621 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29622
29623 @smallexample
29624 %:getenv(TOPDIR /include)
29625 @end smallexample
29626
29627 expands to @file{/path/to/top/include}.
29628
29629 @item @code{if-exists}
29630 The @code{if-exists} spec function takes one argument, an absolute
29631 pathname to a file. If the file exists, @code{if-exists} returns the
29632 pathname. Here is a small example of its usage:
29633
29634 @smallexample
29635 *startfile:
29636 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29637 @end smallexample
29638
29639 @item @code{if-exists-else}
29640 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29641 spec function, except that it takes two arguments. The first argument is
29642 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29643 returns the pathname. If it does not exist, it returns the second argument.
29644 This way, @code{if-exists-else} can be used to select one file or another,
29645 based on the existence of the first. Here is a small example of its usage:
29646
29647 @smallexample
29648 *startfile:
29649 crt0%O%s %:if-exists(crti%O%s) \
29650 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29651 @end smallexample
29652
29653 @item @code{replace-outfile}
29654 The @code{replace-outfile} spec function takes two arguments. It looks for the
29655 first argument in the outfiles array and replaces it with the second argument. Here
29656 is a small example of its usage:
29657
29658 @smallexample
29659 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29660 @end smallexample
29661
29662 @item @code{remove-outfile}
29663 The @code{remove-outfile} spec function takes one argument. It looks for the
29664 first argument in the outfiles array and removes it. Here is a small example
29665 its usage:
29666
29667 @smallexample
29668 %:remove-outfile(-lm)
29669 @end smallexample
29670
29671 @item @code{pass-through-libs}
29672 The @code{pass-through-libs} spec function takes any number of arguments. It
29673 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29674 assumes are the names of linker input library archive files) and returns a
29675 result containing all the found arguments each prepended by
29676 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29677 intended to be passed to the LTO linker plugin.
29678
29679 @smallexample
29680 %:pass-through-libs(%G %L %G)
29681 @end smallexample
29682
29683 @item @code{print-asm-header}
29684 The @code{print-asm-header} function takes no arguments and simply
29685 prints a banner like:
29686
29687 @smallexample
29688 Assembler options
29689 =================
29690
29691 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29692 @end smallexample
29693
29694 It is used to separate compiler options from assembler options
29695 in the @option{--target-help} output.
29696 @end table
29697
29698 @item %@{S@}
29699 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29700 If that switch is not specified, this substitutes nothing. Note that
29701 the leading dash is omitted when specifying this option, and it is
29702 automatically inserted if the substitution is performed. Thus the spec
29703 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29704 and outputs the command-line option @option{-foo}.
29705
29706 @item %W@{S@}
29707 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29708 deleted on failure.
29709
29710 @item %@{S*@}
29711 Substitutes all the switches specified to GCC whose names start
29712 with @code{-S}, but which also take an argument. This is used for
29713 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29714 GCC considers @option{-o foo} as being
29715 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29716 text, including the space. Thus two arguments are generated.
29717
29718 @item %@{S*&T*@}
29719 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29720 (the order of @code{S} and @code{T} in the spec is not significant).
29721 There can be any number of ampersand-separated variables; for each the
29722 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29723
29724 @item %@{S:X@}
29725 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29726
29727 @item %@{!S:X@}
29728 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29729
29730 @item %@{S*:X@}
29731 Substitutes @code{X} if one or more switches whose names start with
29732 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29733 once, no matter how many such switches appeared. However, if @code{%*}
29734 appears somewhere in @code{X}, then @code{X} is substituted once
29735 for each matching switch, with the @code{%*} replaced by the part of
29736 that switch matching the @code{*}.
29737
29738 If @code{%*} appears as the last part of a spec sequence then a space
29739 is added after the end of the last substitution. If there is more
29740 text in the sequence, however, then a space is not generated. This
29741 allows the @code{%*} substitution to be used as part of a larger
29742 string. For example, a spec string like this:
29743
29744 @smallexample
29745 %@{mcu=*:--script=%*/memory.ld@}
29746 @end smallexample
29747
29748 @noindent
29749 when matching an option like @option{-mcu=newchip} produces:
29750
29751 @smallexample
29752 --script=newchip/memory.ld
29753 @end smallexample
29754
29755 @item %@{.S:X@}
29756 Substitutes @code{X}, if processing a file with suffix @code{S}.
29757
29758 @item %@{!.S:X@}
29759 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29760
29761 @item %@{,S:X@}
29762 Substitutes @code{X}, if processing a file for language @code{S}.
29763
29764 @item %@{!,S:X@}
29765 Substitutes @code{X}, if not processing a file for language @code{S}.
29766
29767 @item %@{S|P:X@}
29768 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29769 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29770 @code{*} sequences as well, although they have a stronger binding than
29771 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29772 alternatives must be starred, and only the first matching alternative
29773 is substituted.
29774
29775 For example, a spec string like this:
29776
29777 @smallexample
29778 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29779 @end smallexample
29780
29781 @noindent
29782 outputs the following command-line options from the following input
29783 command-line options:
29784
29785 @smallexample
29786 fred.c -foo -baz
29787 jim.d -bar -boggle
29788 -d fred.c -foo -baz -boggle
29789 -d jim.d -bar -baz -boggle
29790 @end smallexample
29791
29792 @item %@{S:X; T:Y; :D@}
29793
29794 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29795 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29796 be as many clauses as you need. This may be combined with @code{.},
29797 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29798
29799
29800 @end table
29801
29802 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29803 or similar construct can use a backslash to ignore the special meaning
29804 of the character following it, thus allowing literal matching of a
29805 character that is otherwise specially treated. For example,
29806 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29807 @option{-std=iso9899:1999} option is given.
29808
29809 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29810 construct may contain other nested @samp{%} constructs or spaces, or
29811 even newlines. They are processed as usual, as described above.
29812 Trailing white space in @code{X} is ignored. White space may also
29813 appear anywhere on the left side of the colon in these constructs,
29814 except between @code{.} or @code{*} and the corresponding word.
29815
29816 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29817 handled specifically in these constructs. If another value of
29818 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29819 @option{-W} switch is found later in the command line, the earlier
29820 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29821 just one letter, which passes all matching options.
29822
29823 The character @samp{|} at the beginning of the predicate text is used to
29824 indicate that a command should be piped to the following command, but
29825 only if @option{-pipe} is specified.
29826
29827 It is built into GCC which switches take arguments and which do not.
29828 (You might think it would be useful to generalize this to allow each
29829 compiler's spec to say which switches take arguments. But this cannot
29830 be done in a consistent fashion. GCC cannot even decide which input
29831 files have been specified without knowing which switches take arguments,
29832 and it must know which input files to compile in order to tell which
29833 compilers to run).
29834
29835 GCC also knows implicitly that arguments starting in @option{-l} are to be
29836 treated as compiler output files, and passed to the linker in their
29837 proper position among the other output files.
29838
29839 @node Environment Variables
29840 @section Environment Variables Affecting GCC
29841 @cindex environment variables
29842
29843 @c man begin ENVIRONMENT
29844 This section describes several environment variables that affect how GCC
29845 operates. Some of them work by specifying directories or prefixes to use
29846 when searching for various kinds of files. Some are used to specify other
29847 aspects of the compilation environment.
29848
29849 Note that you can also specify places to search using options such as
29850 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29851 take precedence over places specified using environment variables, which
29852 in turn take precedence over those specified by the configuration of GCC@.
29853 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29854 GNU Compiler Collection (GCC) Internals}.
29855
29856 @table @env
29857 @item LANG
29858 @itemx LC_CTYPE
29859 @c @itemx LC_COLLATE
29860 @itemx LC_MESSAGES
29861 @c @itemx LC_MONETARY
29862 @c @itemx LC_NUMERIC
29863 @c @itemx LC_TIME
29864 @itemx LC_ALL
29865 @findex LANG
29866 @findex LC_CTYPE
29867 @c @findex LC_COLLATE
29868 @findex LC_MESSAGES
29869 @c @findex LC_MONETARY
29870 @c @findex LC_NUMERIC
29871 @c @findex LC_TIME
29872 @findex LC_ALL
29873 @cindex locale
29874 These environment variables control the way that GCC uses
29875 localization information which allows GCC to work with different
29876 national conventions. GCC inspects the locale categories
29877 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29878 so. These locale categories can be set to any value supported by your
29879 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29880 Kingdom encoded in UTF-8.
29881
29882 The @env{LC_CTYPE} environment variable specifies character
29883 classification. GCC uses it to determine the character boundaries in
29884 a string; this is needed for some multibyte encodings that contain quote
29885 and escape characters that are otherwise interpreted as a string
29886 end or escape.
29887
29888 The @env{LC_MESSAGES} environment variable specifies the language to
29889 use in diagnostic messages.
29890
29891 If the @env{LC_ALL} environment variable is set, it overrides the value
29892 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29893 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29894 environment variable. If none of these variables are set, GCC
29895 defaults to traditional C English behavior.
29896
29897 @item TMPDIR
29898 @findex TMPDIR
29899 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29900 files. GCC uses temporary files to hold the output of one stage of
29901 compilation which is to be used as input to the next stage: for example,
29902 the output of the preprocessor, which is the input to the compiler
29903 proper.
29904
29905 @item GCC_COMPARE_DEBUG
29906 @findex GCC_COMPARE_DEBUG
29907 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29908 @option{-fcompare-debug} to the compiler driver. See the documentation
29909 of this option for more details.
29910
29911 @item GCC_EXEC_PREFIX
29912 @findex GCC_EXEC_PREFIX
29913 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29914 names of the subprograms executed by the compiler. No slash is added
29915 when this prefix is combined with the name of a subprogram, but you can
29916 specify a prefix that ends with a slash if you wish.
29917
29918 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29919 an appropriate prefix to use based on the pathname it is invoked with.
29920
29921 If GCC cannot find the subprogram using the specified prefix, it
29922 tries looking in the usual places for the subprogram.
29923
29924 The default value of @env{GCC_EXEC_PREFIX} is
29925 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29926 the installed compiler. In many cases @var{prefix} is the value
29927 of @code{prefix} when you ran the @file{configure} script.
29928
29929 Other prefixes specified with @option{-B} take precedence over this prefix.
29930
29931 This prefix is also used for finding files such as @file{crt0.o} that are
29932 used for linking.
29933
29934 In addition, the prefix is used in an unusual way in finding the
29935 directories to search for header files. For each of the standard
29936 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29937 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29938 replacing that beginning with the specified prefix to produce an
29939 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29940 @file{foo/bar} just before it searches the standard directory
29941 @file{/usr/local/lib/bar}.
29942 If a standard directory begins with the configured
29943 @var{prefix} then the value of @var{prefix} is replaced by
29944 @env{GCC_EXEC_PREFIX} when looking for header files.
29945
29946 @item COMPILER_PATH
29947 @findex COMPILER_PATH
29948 The value of @env{COMPILER_PATH} is a colon-separated list of
29949 directories, much like @env{PATH}. GCC tries the directories thus
29950 specified when searching for subprograms, if it cannot find the
29951 subprograms using @env{GCC_EXEC_PREFIX}.
29952
29953 @item LIBRARY_PATH
29954 @findex LIBRARY_PATH
29955 The value of @env{LIBRARY_PATH} is a colon-separated list of
29956 directories, much like @env{PATH}. When configured as a native compiler,
29957 GCC tries the directories thus specified when searching for special
29958 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29959 using GCC also uses these directories when searching for ordinary
29960 libraries for the @option{-l} option (but directories specified with
29961 @option{-L} come first).
29962
29963 @item LANG
29964 @findex LANG
29965 @cindex locale definition
29966 This variable is used to pass locale information to the compiler. One way in
29967 which this information is used is to determine the character set to be used
29968 when character literals, string literals and comments are parsed in C and C++.
29969 When the compiler is configured to allow multibyte characters,
29970 the following values for @env{LANG} are recognized:
29971
29972 @table @samp
29973 @item C-JIS
29974 Recognize JIS characters.
29975 @item C-SJIS
29976 Recognize SJIS characters.
29977 @item C-EUCJP
29978 Recognize EUCJP characters.
29979 @end table
29980
29981 If @env{LANG} is not defined, or if it has some other value, then the
29982 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29983 recognize and translate multibyte characters.
29984 @end table
29985
29986 @noindent
29987 Some additional environment variables affect the behavior of the
29988 preprocessor.
29989
29990 @include cppenv.texi
29991
29992 @c man end
29993
29994 @node Precompiled Headers
29995 @section Using Precompiled Headers
29996 @cindex precompiled headers
29997 @cindex speed of compilation
29998
29999 Often large projects have many header files that are included in every
30000 source file. The time the compiler takes to process these header files
30001 over and over again can account for nearly all of the time required to
30002 build the project. To make builds faster, GCC allows you to
30003 @dfn{precompile} a header file.
30004
30005 To create a precompiled header file, simply compile it as you would any
30006 other file, if necessary using the @option{-x} option to make the driver
30007 treat it as a C or C++ header file. You may want to use a
30008 tool like @command{make} to keep the precompiled header up-to-date when
30009 the headers it contains change.
30010
30011 A precompiled header file is searched for when @code{#include} is
30012 seen in the compilation. As it searches for the included file
30013 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
30014 compiler looks for a precompiled header in each directory just before it
30015 looks for the include file in that directory. The name searched for is
30016 the name specified in the @code{#include} with @samp{.gch} appended. If
30017 the precompiled header file cannot be used, it is ignored.
30018
30019 For instance, if you have @code{#include "all.h"}, and you have
30020 @file{all.h.gch} in the same directory as @file{all.h}, then the
30021 precompiled header file is used if possible, and the original
30022 header is used otherwise.
30023
30024 Alternatively, you might decide to put the precompiled header file in a
30025 directory and use @option{-I} to ensure that directory is searched
30026 before (or instead of) the directory containing the original header.
30027 Then, if you want to check that the precompiled header file is always
30028 used, you can put a file of the same name as the original header in this
30029 directory containing an @code{#error} command.
30030
30031 This also works with @option{-include}. So yet another way to use
30032 precompiled headers, good for projects not designed with precompiled
30033 header files in mind, is to simply take most of the header files used by
30034 a project, include them from another header file, precompile that header
30035 file, and @option{-include} the precompiled header. If the header files
30036 have guards against multiple inclusion, they are skipped because
30037 they've already been included (in the precompiled header).
30038
30039 If you need to precompile the same header file for different
30040 languages, targets, or compiler options, you can instead make a
30041 @emph{directory} named like @file{all.h.gch}, and put each precompiled
30042 header in the directory, perhaps using @option{-o}. It doesn't matter
30043 what you call the files in the directory; every precompiled header in
30044 the directory is considered. The first precompiled header
30045 encountered in the directory that is valid for this compilation is
30046 used; they're searched in no particular order.
30047
30048 There are many other possibilities, limited only by your imagination,
30049 good sense, and the constraints of your build system.
30050
30051 A precompiled header file can be used only when these conditions apply:
30052
30053 @itemize
30054 @item
30055 Only one precompiled header can be used in a particular compilation.
30056
30057 @item
30058 A precompiled header cannot be used once the first C token is seen. You
30059 can have preprocessor directives before a precompiled header; you cannot
30060 include a precompiled header from inside another header.
30061
30062 @item
30063 The precompiled header file must be produced for the same language as
30064 the current compilation. You cannot use a C precompiled header for a C++
30065 compilation.
30066
30067 @item
30068 The precompiled header file must have been produced by the same compiler
30069 binary as the current compilation is using.
30070
30071 @item
30072 Any macros defined before the precompiled header is included must
30073 either be defined in the same way as when the precompiled header was
30074 generated, or must not affect the precompiled header, which usually
30075 means that they don't appear in the precompiled header at all.
30076
30077 The @option{-D} option is one way to define a macro before a
30078 precompiled header is included; using a @code{#define} can also do it.
30079 There are also some options that define macros implicitly, like
30080 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30081 defined this way.
30082
30083 @item If debugging information is output when using the precompiled
30084 header, using @option{-g} or similar, the same kind of debugging information
30085 must have been output when building the precompiled header. However,
30086 a precompiled header built using @option{-g} can be used in a compilation
30087 when no debugging information is being output.
30088
30089 @item The same @option{-m} options must generally be used when building
30090 and using the precompiled header. @xref{Submodel Options},
30091 for any cases where this rule is relaxed.
30092
30093 @item Each of the following options must be the same when building and using
30094 the precompiled header:
30095
30096 @gccoptlist{-fexceptions}
30097
30098 @item
30099 Some other command-line options starting with @option{-f},
30100 @option{-p}, or @option{-O} must be defined in the same way as when
30101 the precompiled header was generated. At present, it's not clear
30102 which options are safe to change and which are not; the safest choice
30103 is to use exactly the same options when generating and using the
30104 precompiled header. The following are known to be safe:
30105
30106 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30107 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30108 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30109 -pedantic-errors}
30110
30111 @end itemize
30112
30113 For all of these except the last, the compiler automatically
30114 ignores the precompiled header if the conditions aren't met. If you
30115 find an option combination that doesn't work and doesn't cause the
30116 precompiled header to be ignored, please consider filing a bug report,
30117 see @ref{Bugs}.
30118
30119 If you do use differing options when generating and using the
30120 precompiled header, the actual behavior is a mixture of the
30121 behavior for the options. For instance, if you use @option{-g} to
30122 generate the precompiled header but not when using it, you may or may
30123 not get debugging information for routines in the precompiled header.